News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Is this structure conversion correct?

Started by georgek01, February 16, 2006, 02:47:03 PM

Previous topic - Next topic

georgek01

Hello!

Is this C++ structure converted correctly to MASM required structure?


typedef struct _WSAQuerySetA
{
    DWORD           dwSize;
    LPSTR           lpszServiceInstanceName;
    LPGUID          lpServiceClassId;
    LPWSAVERSION    lpVersion;
    LPSTR           lpszComment;
    DWORD           dwNameSpace;
    LPGUID          lpNSProviderId;
    LPSTR           lpszContext;
    DWORD           dwNumberOfProtocols;
    LPAFPROTOCOLS   lpafpProtocols;
    LPSTR           lpszQueryString;
    DWORD           dwNumberOfCsAddrs;
    LPCSADDR_INFO   lpcsaBuffer;
    DWORD           dwOutputFlags;
    LPBLOB          lpBlob;
} WSAQUERYSETA, *PWSAQUERYSETA, *LPWSAQUERYSETA;



WSAQUERYSET struct
    dwSize                          DWORD ?
    lpszServiceInstanceName        dd ?
    lpServiceClassId                GUID <?>
    lpVersion                        dd ?
    lpszComment                 dd ?
    dwNameSpace                      DWORD ?
    lpNSProviderId               dd ?
    lpszContext                    dd ?
    dwNumberOfProtocols     DWORD ?
    lpafpProtocols                  dd ?
    lpszQueryString                dd ?
    dwNumberOfCsAddrs              DWORD ?
    lpcsaBuffer                      dd ?
    dwOutputFlags                DWORD ?
    lpBlob                    dd ?
WSAQUERYSET EndS
What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

QvasiModo

Hello :)

Note that those members that are not DWORDs, are LP + something. In Microsoft's convention for naming the SDK data types, LP means it's a pointer - so they're really all DWORDs.


WSAQUERYSET struct
    dwSize                          DWORD ?
    lpszServiceInstanceName         DWORD ?
    lpServiceClassId                DWORD ?
    lpVersion                       DWORD ?
    lpszComment                     DWORD ?
    dwNameSpace                     DWORD ?
    lpNSProviderId                  DWORD ?
    lpszContext                     DWORD ?
    dwNumberOfProtocols             DWORD ?
    lpafpProtocols                  DWORD ?
    lpszQueryString                 DWORD ?
    dwNumberOfCsAddrs               DWORD ?
    lpcsaBuffer                     DWORD ?
    dwOutputFlags                   DWORD ?
    lpBlob                          DWORD ?
WSAQUERYSET ends


Hope that helps! :U

PBrennick

Except for ....

lpServiceClassId                GUID <?>

which should remain as written as it is a pointer to another structure.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

georgek01

Does the same then not apply to the following?

lpNSProviderId also points to a GUID

lpafpProtocols points to the following structure:


typedef struct _AFPROTOCOLS { 
    INT iAddressFamily; 
    INT iProtocol;
} AFPROTOCOLS,


lpVersion points to the following structure:


typedef struct _WSAVersion { 
    DWORD dwVersion; 
    WSAECOMPARATOR ecHow;
} WSAVERSION


lpcsaBuffer points to the following structure:


typedef struct _CSADDR_INFO {
    SOCKET_ADDRESS LocalAddr ;
    SOCKET_ADDRESS RemoteAddr ;
    INT iSocketType ;
    INT iProtocol ;
} CSADDR_INFO, *PCSADDR_INFO, FAR * LPCSADDR_INFO ;



What we have to learn to do, we learn by doing.

- ARISTOTLE (384-322 BC)

donkey

Quote from: PBrennick on February 16, 2006, 05:32:28 PM
Except for ....

lpServiceClassId                GUID <?>

which should remain as written as it is a pointer to another structure.

Paul


You should define this as a DWORD, it is simply a pointer...

Quote from: MSDNThe LPGUID structure represents a long pointer to a GUID.

typedef struct _GUID {
  ULONG  Data1;
  USHORT  Data2;
  USHORT  Data3;
  UCHAR  Data4[8];
} GUID

typedef GUID *LPGUID;
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable