Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How many bytes does a Win32 LPSTR take ?
Message
De
23/04/1999 18:06:39
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Divers
Thread ID:
00211755
Message ID:
00211776
Vues:
22
>Maybe a stupid question but still....
>Thanks for your time guys !

An LPSTR is 4 bytes long - it's a 32 bit pointer. The string it points to is of variable size; it's read from the first byte pointed to by the LPSTR pointer to the first null (CHR(0)) encountered after that.

The address pointed to by the LPSTR does not need to be (and in all probability, will not be) adjacent to the structure containing the LPSTR.

Take a look at the source in NETRSC.ZIP for the BuildNETRESOURCE method to get a feel for how the NETRESOURCE structure is constructed and allocated using my Heap class. The NETRESOURCE strucutre has a number of LPTSTRs (for all intents and purposes, they're the same thing a an LPSTR) embedded in the NETRESOURCE; you'll see that there are two distinct memory allocations associated with the NETRESOURCE, the structure itself, which is a fixed 32 bytes, and the string space pointed to by the structure, which can be virtually any size, and need not be a part of the same physical or virtual memory allocation.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform