Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Dereferencing string pointer


2 replies to this topic

mdayton

mdayton
  • Members
  • 5 posts

Posted 26 March 2002 - 19:56

It seems that the Address operator (&) works on all data types, but the dereference operator(*) only works on number pointers - Gah!

I want to call the Windows SDK function EnumDependentServicesA, which takes a pointer to an array of ENUM_SERVICE_STATUS structures (see below) and populates it.

typedef ENUM_SERVICE_STATUS
begin
   LPSTR   lpServiceName;
   LPSTR   lpDisplayName;
   SERVICE_STATUS ServiceStatus;
end;

Once the call completes, how do I dereference the LPSTR's to get the string values?


Thanks
???
Mike[br]

Ide Nentjes

Ide Nentjes
  • Members
  • 222 posts

Posted 27 March 2002 - 10:23

There's a script on 'IS5/6 Samples>Strings' to convert pointers to strings, but if I'm not mistaken, you can just substitute 'STRING' for 'LPSTR', so

typedef ENUM_SERVICE_STATUS
begin
  STRING   lpServiceName;
  STRING   lpDisplayName;
  SERVICE_STATUS ServiceStatus;
end;

should work.

Ide



PeterKosenko

PeterKosenko
  • Full Members
  • 2 posts

Posted 25 May 2011 - 22:51

QUOTE (mdayton @ 2002-03-26 19:56)
It seems that the Address operator (&) works on all data types, but the dereference operator(*) only works on number pointers - Gah!

I want to call the Windows SDK function EnumDependentServicesA, which takes a pointer to an array of ENUM_SERVICE_STATUS structures (see below) and populates it.

typedef ENUM_SERVICE_STATUS
begin
   LPSTR   lpServiceName;
   LPSTR   lpDisplayName;
   SERVICE_STATUS ServiceStatus;
end;

Once the call completes, how do I dereference the LPSTR's to get the string values?


Thanks
???

I am converting a Dev Studio 9.0 project to Installshield 2011. It seems that IS 2011 now supplies its own version of lstrlenW() which requires a string and can no longer use the pointer. And InstallShield is still unable to dereference a string pointer. But the old script that I have now requires that I dereference the pointer, which even InstallShield 2011 doesn't allow.

// In ISRTWindows.h:
// prototype number KERNEL32.lstrlenW(byval wstring);

i = 0;
while( i < EintraegeGelesen)
RtlMoveMemory( pServerStruktur,nBufferPointer,8 );
// copy address
l = pServerStruktur->name; // l is a pointer; needs to be a string value
Laenge = lstrlenW( l )*2; // calculate stringsize // now requires STRING value
if Laenge then
RtlMoveMemory( pServerName,l, Laenge); // copy servername // pointer is okay here
endif;