Thread View: comp.lang.pascal.delphi.misc
2 messages
2 total messages
Started by thorNET Support
Mon, 12 Apr 1999 00:00
netusergetinfo
Author: thorNET Support
Date: Mon, 12 Apr 1999 00:00
Date: Mon, 12 Apr 1999 00:00
11 lines
978 bytes
978 bytes
I am trying to use the NetUserGetInfo routine in netapi32.dll on NT 4.0. I think the problem is with my interpretation of the C datatypes LPWSTR and LPBYTE into Delphi data types. Has anyone user NetUserGetInfo or any of the other similar routines in netapi32.dll? If so could you post a snippet of code that I could use. Thanks Steve
Re: netusergetinfo
Author: Edward McSweeney
Date: Mon, 12 Apr 1999 00:00
Date: Mon, 12 Apr 1999 00:00
32 lines
1980 bytes
1980 bytes
function NetUserGetInfo(ServerName,UserName: PWideChar; Level: Cardinal; var BufPtr: Pointer): Integer; stdcall; NOTE: You can (and probably should) declare Level as a LongWord. I had my reasons for declaring it as a Cardinal, but technically it's an unsigned 32-bit Integer. Also, BufPtr is declared as a simple pointer in the above, but it will point to a limited number of different structures depending upon what you pass in Level. I found it easiest to simply typecast BufPtr after making the call. This should get you going. Most of the other NetAPI32 functions are very similar to this one. Some return arrays of structures, but they all deal with PWideChars and return information in UNICODE. That means your record declarations will also have to declare text fields as PWideChar values. You can simplify things somewhat by translating the returned records to use WideStrings or even Strings. And don't forget to call NetApiBufferFree when you're done. thorNET Support wrote: > I am trying to use the NetUserGetInfo routine in netapi32.dll on NT 4.0. > > I think the problem is with my interpretation of the C datatypes LPWSTR > and LPBYTE into Delphi data types. > Has anyone user NetUserGetInfo or any of the other similar routines in > netapi32.dll? > If so could you post a snippet of code that I could use. > > Thanks > > Steve
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads