NetUserGetInfo() on 64-bit windows doesn't work like 32-bit
Hi,
I am using the NetUserGetInfo() call to obtain account information, for
example, logon hours, etc. The 32-bit version of the code works fine. The
64-bit code does not work.
The function I'm using is this:
http://msdn2.microsoft.com/en-us/library/aa370654.aspx
I am selecting USER_INFO_4:
http://msdn2.microsoft.com/en-us/library/aa371339(VS.85).aspx
Here is a binary dump of the USER_INFO_4 data:
24 85 16 00 00 00 00 00 00 00 00 00 00 00 00 00 8a 0c 00 00 01 00 00 00 22
85 16 00 00 00
00 00 20 85 16 00 00 00 00 00 01 02 00 00 00 00 00 00 1e 85 16 00 00 00 00
00 00 00 00 00
00 00 00 00 52 85 16 00 00 00 00 00 50 85 16 00 00 00 00 00 4e 85 16 00 00
00 00 00 4c 85
16 00 00 00 00 00 00 00 00 00 00 00 00 00 ff ff ff ff ff ff ff ff a8 00 00
00 00 00 00 00
37 85 16 00 00 00 00 00 00 00 00 00 00 00 00 00 2e 85 16 00 00 00 00 00 00
00 00 00 00 00
00 00 f2 03 00 00 01 02 00 00 56 85 16 00 00 00 00 00
what I am interested in is the logon hours, i.e.,
PBYTE usri4_logon_hours;
The help says:
usri4_logon_hours
Pointer to a 21-byte (168 bits) bit string that specifies the times during
which the user can log on. Each bit represents a unique hour in the week, in
Greenwich Mean Time (GMT).
If you carefully parse through that binary dump, you'll see the pointer to
this data is "ff ff ff ff ff ff ff ff". Needless to say, when my program
dereferences this to get at the 21-byte data, it crashes.
I call the function like this:
LPUSER_INFO_4 pBuf = NULL;
nStatus = NetUserGetInfo(NULL, w_username, 4, (LPBYTE *)&pBuf);
I de-ref the pointer like so:
PBYTE data = pBuf->usri4_logon_hours;
then, i walk through the 21 byte data to build the logon hours vector as
described by the help.
what am I doing wrong here? Again, works like a champ on 32-bit windows,
but 64-bit windows, no love.
Is there an alternate way of getting the data?
I tried the obsolete USER_INFO_3 and got the same results.
thanks
JC
date: Wed, 27 Feb 2008 07:18:04 -0800
author: JC-F5