NET_ID.DLL      MYID.EXE        MYVBID.EXE

Feb. 6, 1996

These programs are copyrighted and may not be resold or distributed for 
profit.  Use them at your own risk.
Now that's over...

Preface:
MS Windows Database applications are finally being developed at work.
Visual Basic was decided to be the development tool.  The Netware User 
ID was wanted for security reasons in the database applications. Novell 
supplied VB interfaces to DLLs - found on CompuServe - but they were 
dated 1991. These downloaded BASIC programs produced inconsistent 
errors when trying to get User IDs out of the Novell Netware 4.1 system. 
That is, every now and then the programs would come up with the wrong 
connection number.  This produced an incorrect User ID.
Visual Basic doesn't want to work with the current Netware DLLs, or vice 
versa, because of a clash in data types.  Specifically, I couldn't get VB to 
work with "unsigned int" and "unsigned long" data types.

The programs provided here are small but contain a useful method of 
getting Netware system information to Windows programs not written 
in C.

General:
Software/OS/Equipment
Borland C++ 3.1         Visual Basic 3.0
Novell Netware 4.1      DOS 6.22
Compaq XL 466 - i486, 66MHz

NET_ID.DLL is the third DLL I've written.  I know it's far from book 
examples.  It's stripped down.  No data is being passed from the window 
program to the DLL.  This cuts out a large number of functions normally 
needed.  It contains one module, NetUserID(char far *).  When called, it 
uses functions from within NWCALLS.DLL to get the user ID character 
string. NWCALLS.DLL is a standard DLL that comes with the Novell 
Workstation setup and usually resides in the /windows/system directory.

The C programs were compiled with Borland C/C++ Ver. 3.1.  I used 
make files and the make command to compile and link them.  This lets 
you be specific about how you want your program made.

No OWL, API, or other specific compiler brand functions are used in these 
programs.  Portability.  The programs are C, not C++, to avoid any 
compiler brand class definitions or class libraries.

Makefiles:
The make files are included.  Some of the lines inside them will probably 
need to be edited. The make files' compiler, linker, and library lines 
specify the portions of the command lines used for compiling and linking 
the programs.  These make files are based on those used by Charles 
Petzold in his "Programming Windows 3.1" book*.

Use the command line "make -f <makefile.ext>" to compile and link the
programs with Borland.

	#------------------------
	# myid.MAK make file
	#------------------------
	WINCC=bcc -c -v -ms! -w-par -P -W -2
	WINLINK=tlink /c /v /n /Twe /L\bcpp\lib c0ws
	WINLIB=import mathws cws

	myid.exe : myid.obj myid.def
		  $(WINLINK) myid, myid, NUL, $(WINLIB), myid
	     rc -t myid.exe

	myid.obj : myid.c netlib.h myid.mak
		  $(WINCC) myid.c

Look at the "WINLINK" line.  See the /L\bcpp\lib? This is the library 
directory.  I keep my standard libraries in d:\bcpp\lib.  Substitute your 
library path for "\bcpp\lib".

(For Borland C, type bcc at the DOS prompt and the compile options will 
be displayed.  You can do the same thing for Borland tlink.  A more 
specific definition of the options can be found in the BC.EXE help.)

In NET_ID.MAK there is the line:

	DLLLINK=tlink /v /l /c /n /Twd /L\bcpp\lib;\bcpp\nov\win c0ds

Put your search path for standard C libraries and the Netware DLL 
libraries in place of "\bcpp\lib;\bcpp\nov\win".

Important: Use the Novell DLL libraries rather than the standard Novell 
libraries.  With the Novell Client API SDK 1.0 there should be a "win" 
subdirectory.  The libraries coresponding to the calls from windows 
applications to DLLs are there along with the DLLs they represent.  

Microsoft Visual C++ make files are also here, named as NET_ID.MVC
and MYID.MVC.  Copy them to *.MAK and use the command line
"nmake /f <makefile.ext>" to compile and link the programs.  With
Microsoft, you need to have the environment variables "INCLUDE"
and "LIB" set appropriately.


NET_ID.DLL:
NET_ID.DLL takes care of all the unsigned integers and other data 
formats that Visual Basic can't deal with.  It passes the User
ID back to the calling application.  It uses the Novell Netware NWCLIENT.DLL 
for Netware calls.  Look close at the NET_ID.DEF file.  Notice the Import 
lines.  These tell the NET_ID.DLL which DLL to look in to find the 
functions it's importing.  In this case they're netware functions, i.e.

	IMPORTS        NWCALLS.NWCallsInit

This tells the application to look in the NWCALLS.DLL for the NWCallsInit 
function.

MYID.C:
MYID.C is an application that calls the NET_ID.DLL.  This was used in 
program development for debugging.  I could watch changes in variables, 
addresses, and trace the instructions/commands from MY_ID.C to 
NET_ID.DLL when using this program.  It helps to see that type of info.  I 
couldn't see that info or trace from the exe to the dll in VB.


MYID.DEF:
Defines the MYID window characteristics.  In this case, the main factor is 
that it tells MYID to find the NetUserID() function in NET_LIB.DLL through 
use of the "IMPORTS" line.


MYVBID.* :
MYVBID.EXE was made through Visual Basic.  It calls the NET_ID.DLL just 
as the C program did.  The NetUserID() call is placed in the form's load 
module.

ALIAS.TXT:
If you use the Netware API Client SDK 1.0-, you probably know about it's 
wonderful data types.  The documentation on the product could be better.  
I used the "grep" command that came with Borland C++ to search files for 
data definitions.  The ALIAS.TXT file includes the results of the search.  I 
also grepped for the function names in the include files to check how their 
parameters were specified.  You can see the results here.  It never hurts 
to know that a "NWCONN_HANDLE" is a "unsigned int".  This can really 
help when interfacing between languages.


* "Programming Windows 3.1", Third Edition,  by Charles Petzold, 
(C) Microsoft Press 1993, ISBN 1-55615-395-3
