Click to See Complete Forum and Search --> : NetLocalGroupGetMembers


JerryWoodstock
October 22nd, 2008, 01:49 PM
Hello

I am getting a bad pointer everytime I run this code can someone please help me. The bad ptr is the LPBYTE * bufptr.

Function Definition
------------------------------------------------------------------------------------------------
Net_API_STATUS NetGroupGetUsers ( LPWCSTR servername, LPWCSTR localgroupname, DWORD level, LPBYTE* bufptr, DWORD prefmaxlen, LPDWORD entriesread,LPDWORD totalentries,PDWORD_PTR resumehandle)
------------------------------------------------------------------------------------------------

I am calling this API as follows

void main(void)
{
NET_API_STATUS ret = 0 ;
LPCWSTR servername = L"MYSERVER";
LPCWSTR groupname = L"MYGROUP";
LPBYTE buffer = NULL;
DWORD entriesRead;
DWORD totalEntries;
DWORD resumeHandle;

//function call
ret=NetGroupGetUsers (servername, groupname, 0, &buffer, MAX_PREFFERED_LENGTH, &entriesRead, &totalEntries, &resumeHandle);
}

Thanks in advanced

MrViggy
October 22nd, 2008, 05:03 PM
What's the return value after calling NetGroupGetUsers?

Viggy

JerryWoodstock
October 23rd, 2008, 08:12 AM
I do not get a return value from the function. I recieve the following exception .

"Unhandled exception at 0x5b8930fc in Test.exe: 0xC0000005: Access violation reading location 0xcccccce0"

MrViggy
October 23rd, 2008, 05:44 PM
After a quick look at the MSDN (http://msdn.microsoft.com/en-us/library/aa370430(VS.85).aspx) it looks like you need to set 'resumeHandle' to '0' before making the function call. This parameter is an input and an output to the function. Right now, it contains invalid (garbage) data.

Viggy