calling NetGetJoinInformation with System::Call - parameter format?
I need to use the Win32 API "NetGetJoinInformation()", and am having problems figuring out the right syntax when using "System::Call".
The API format is as follows:
NET_API_STATUS NetGetJoinInformation(
_In_ LPCWSTR lpServer,
_Out_ LPWSTR *lpNameBuffer,
_Out_ PNETSETUP_JOIN_STATUS BufferType
);
typedef enum _NETSETUP_JOIN_STATUS {
NetSetupUnknownStatus = 0,
NetSetupUnjoined,
NetSetupWorkgroupName,
NetSetupDomainName
} NETSETUP_JOIN_STATUS, *PNETSETUP_JOIN_STATUS;
- NET_API_STATUS is a DWORD
- The first parameter can be a NULL or ""
- The second parameter is "A Pointer to the buffer that receives the NetBIOS name of the domain or workgroup to which the computer is joined. Is allocated by the system and must be freed using the NetApiBufferFree function."
So I'm using the following to call the API:
System::Call 'Netapi32::NetGetJoinInformation(w "", *w.r0,*i.r1)i.r2'
My project runs on Win7 but crashes on XP when I call that API (it works in an VC++ app, so I know it isn't an unsupported API in XP). So I'm assuming that my parameter format for System::Call isn't 100% correct and this is causing the crash.
Any suggestions?