🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.pascal.delphi.misc
Article #571

Re: netusergetinfo

#571
From: Edward McSweeney
Date: Mon, 12 Apr 1999 00:00
32 lines
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
Technical Details
Message-ID: <37125D1E.945476B4@mayo.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <3711F8C9.F690F8E5@thornet.co.uk>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 10baee,7bb44cfaf8ed4c11
X-Google-Attributes: gid10baee,public
X-Google-Thread: 1091e5,7bb44cfaf8ed4c11
X-Google-Attributes: gid1091e5,public
From: Edward McSweeney <emcsweeney@mayo.edu>
Subject: Re: netusergetinfo
Date: 1999/04/12
Message-ID: <37125D1E.945476B4@mayo.edu>
X-Deja-AN: 465615202
Content-Transfer-Encoding: 7bit
References: <3711F8C9.F690F8E5@thornet.co.uk>
Content-Type: text/plain; charset=us-ascii
Organization: Mayo Clinic
Mime-Version: 1.0
Newsgroups: comp.lang.pascal.delphi.misc,borland.public.delphi.winapi