Newsgroups: bit.listserv.novell
Date:         Fri, 18 Dec 1992 16:01:33 EST
Reply-To:     Novell LAN Interest Group <NOVELL@SUVM.BITNET>
From:         Brett Warthen <BRETT@INFINITE.MHS.COMPUSERVE.COM>
Subject:      RE: How to use netapi20.dll

FORWARDED MESSAGE from Lim Chieng Fai (MAIL @ CSERVE
LF> {INTERNET:lchiengf@TRANTOR.DSO.GOV.SG}) at 12/18/92 1:26 PM
LF>
LF> Hi, I am currently doing some windows-based netware programming on
LF> Novell 3.11 and found a file called "netapi20.dll". I couldn't find any
LF> documentation on using this DLL.
LF>
LF> Can someone provide me with some pointers on how to use this DLL ?
LF>
***** NOTES from Brett Warthen (BRETT @ INFINITE) at 12/18/92 3:06 PM
Good question...I think the real question should be "Where did you get this
DLL?"

I ask this, just because I haven't seen this DLL on my system, and I've
been doing a fair amount of Windows & NetWare programming lately.

There is a NETAPI.DLL, which is the name that is given to the DLL that
implements the generic Windows network API functions like WNetGetUser().
There is a set of limited network APIs defined in the Windows APIs (the
WNet*() functions), but unfortunately, most of them are only documented in
the Windows DDK (Device Driver Kit).

In the latest release of Novell's NetWare C Interface for Windows (and the
NetWare Client SDK which is replacing it), there is a NWNETAPI.DLL, which
implements most of the NetWare API functions in a single DLL.  Previously
you had NWCONN.DLL, NWCORE.DLL, and a bunch of others.  Now it's just
NWNETAPI.DLL, NWPSERV.DLL (for the PSERVER family of APIs) and NWIPXSPX.DLL
(for IPX/SPX communications).

Anyway, at this time, the only documentation that exists on these DLLs has
to be purchased from Novell...as either the NetWare C Interface for
Windows, or the NetWare Client SDK which supports DOS, Windows & OS/2 in a
single package.  Last I heard, the Client SDK won't be shipping until
January.

Call Novell's Professional Developer Program (PDP) at 1-800-RED-WORD or
512-794-1483.  (Sorry, I know a lot of international folks like FAX inquiry
numbers, but I'm not sure what the correct FAX number is for PDP.)

Now, if you have the NetWare C Interface for DOS, then you can often get
away using a DLL call of the same name, by using the prototype of the
function defined in the DOS C interface, but define the function as "FAR
PASCAL extern"...and change any pointers to be LONG pointers, like LPSTR
instead of char *.

For example, to call LoginToFileServer from NWCONN.DLL (or it's now
NWNETAPI.DLL in the latest WINUP7.ZIP), define a prototype for the function
like this:

extern int FAR PASCAL LoginToFileServer (LPSTR, WORD, LPSTR);

In your DEF file for this function, you'd use:

IMPORTS NWCONN.LoginToFileServer

  or

IMPORTS NWNETAPI.LoginToFileServer

You'll have to experiment on your own with which calls work, and which
don't.  Before breaking down and getting the official docs from Novell, I
did find a few calls that I couldn't make work.  And I definitely do not
suggest that you try any IPX, SPX or diagnostics APIs without the official
docs.

Just for the sake of mentioning all possible avenues...if you have the
assembly level documentation, you can also roll your own access by calling
the NetWareRequest() function, anywhere you would generate Int 21h.
(Import NetWareRequest from NETWARE.DRV, and define a void prototype for
the function, marking it "extern FAR PASCAL".)

I'm using in-line assembler with Borland C++ v3.1, and this approach works
great.  Also, with this approach, you don't have to worry about
distributing the Novell DLLs (which you can't unless you actually purchased
their product).

------------------------+-------------------------------------------------
 Brett Warthen          |        MHS:  Brett @ Infinite (via NHUB/CSERVE)
 Infinite Technologies  | CompuServe:  >MHS:Brett@Infinite
 11433 Cronridge Drive  |   Internet:  Brett@Infinite.mhs.compuserve.com
 Suite H                |       Phax:  +1-410-363-3779
 Owings Mills, MD 21117 |      Phone:  +1-410-363-1097
------------------------+-------------------------------------------------
Comments: Gated by NETNEWS@AUVM.AMERICAN.EDU