Board index » delphi » Delphi/Windows NT Network

Delphi/Windows NT Network

Hi!

I'm need a Delphi-solution to get a list of all users that are defined
on a NT domain.

In the Win32 helpfile there are funktions like "NetUserEnum" - sadly
they have not been interfaced in Delphi's "Windows"-Unit.

Does anybody have a solution to shis problem?

I' not very experienced in that topic, but: would it be a reasonable
possibility to declare those funxtions in an own unit, just like
Borland did with the other Win32 functions? Or are there any reasons
why this won't work?

Help me!
Ciao,
  Wolfgang

--------------------------------------
Finger me for my PGP-Key

 

Re:Delphi/Windows NT Network


Quote
Wolfgang Krietsch wrote:

> Hi!

> I'm need a Delphi-solution to get a list of all users that are defined
> on a NT domain.

> In the Win32 helpfile there are funktions like "NetUserEnum" - sadly
> they have not been interfaced in Delphi's "Windows"-Unit.

> Does anybody have a solution to shis problem?

> I' not very experienced in that topic, but: would it be a reasonable
> possibility to declare those funxtions in an own unit, just like
> Borland did with the other Win32 functions? Or are there any reasons
> why this won't work?

> Help me!
> Ciao,
>   Wolfgang

> --------------------------------------
> Finger me for my PGP-Key

Hello Wolfgang,

You can provide your own declaration unit for this function: all you
have to know is the function prototype and the import DLL name.  For
example, I believe that this declaration should work (I didn't test it
so don't flame me if it doesn't work!)

unit ImportNet

interface

  uses Windows;

  function WNetUserEnum( servername: PChar; //use string at your
descretion
                       level: dword;
                       filter: dword;
                       var bufptr: byteptr;
                       prefmaxlen: dword;
                       var entriesread: dword;
                       var totalentries: dword;
                       var resumehandle: dword; ): NET_API_STATUS;

implementation
  function WNetUserEnum; external advapi32 name 'NetUserEnumW'; //if the
doesn't work, try 'NetUserEnum';

end.

Don't take this as gospel; use it as a springboard to get started.  Hope
this helps!

Dave Heinecke

Re:Delphi/Windows NT Network


You need to create an interface unit for the NetAPI, I've started you off
with the attached file which should solve your immediate problem.

Wolfgang Krietsch <w.kriet...@pobox.com> wrote in article
<32e2c488.1488...@news.mb-t.net>...

Quote
> Hi!

> I'm need a Delphi-solution to get a list of all users that are defined
> on a NT domain.

> In the Win32 helpfile there are funktions like "NetUserEnum" - sadly
> they have not been interfaced in Delphi's "Windows"-Unit.

> Does anybody have a solution to shis problem?

> I' not very experienced in that topic, but: would it be a reasonable
> possibility to declare those funxtions in an own unit, just like
> Borland did with the other Win32 functions? Or are there any reasons
> why this won't work?

> Help me!
> Ciao,
>   Wolfgang

> --------------------------------------
> Finger me for my PGP-Key

begin 600 NetAPI32.pas
<uuencoded_portion_removed>
K5$%023,R+D1,3"<@;F%M92 G3F5T57-E<D5N=6TG.PT*#0H-"F5N9"X-"DY%
`
end

Other Threads