home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Network Support Encyclopedia 96-1
/
novell-nsepro-1996-1-cd2.iso
/
download
/
netware
/
sernum.exe
/
SERIAL.C
next >
Wrap
Text File
|
1995-06-02
|
3KB
|
107 lines
/****************************************************************************
** DISCLAIMER
**
** Novell, Inc. makes no representations or warranties with respect to
** any NetWare software, and specifically disclaims any express or
** implied warranties of merchantability, title, or fitness for a
** particular purpose.
**
** Distribution of any NetWare software is forbidden without the
** express written consent of Novell, Inc. Further, Novell reserves
** the right to discontinue distribution of any NetWare software.
**
** Novell is not responsible for lost profits or revenue, loss of use
** of the software, loss of data, costs of re-creating lost data, the
** cost of any substitute equipment or program, or claims by any party
** other than you. Novell strongly recommends a backup be made before
** any software is installed. Technical support for this software
** may be provided at the discretion of Novell.
****************************************************************************
**
** File: Serial.c
**
** Desc: Finds the servers serial number.
**
**
** Programmers:
** Ini Who Firm
** ------------------------------------------------------------------
** ARM A. Ray Maxwell Novell Developer Support.
**
** History:
**
** ------------------------------------------------------------------
** 01-11-94 ARM First code.
*/
/***************************************************************************
** Include headers, macros, function prototypes, etc.
*/
/*------------------------------------------------------------------
** ANSI
*/
#include <stdlib.h> /* exit(), atol() */
#include <stdio.h> /* printf() */
#include <string.h> /* strcpy() */
/*------------------------------------------------------------------
** NetWare
*/
#include <nwcalls.h>
/****************************************************************************
** Program Start
*/
void main(int argc, char *argv[])
{
NWCONN_HANDLE connHandle;
NWCCODE ccode;
char server[50];
DWORD serialNum;
WORD appNum;
if(argc != 2) {
printf("Usage: SERIAL <servername>\n");
exit(1);
}
strcpy(server, strupr(argv[1]));
ccode = NWCallsInit(NULL, NULL);
if(ccode)
exit(1);
ccode = NWGetConnectionHandle(
/* > servername */ server,
/* Novell Reserved1 */ 0,
/* < connection Handle */ &connHandle,
/* Novell Reserved2 */ NULL);
if(ccode){
printf("NWGetConnectionHandle failed %X\n",ccode);
exit(1);
}
ccode=NWGetNetworkSerialNumber(
/* connection Handle */ connHandle,
/* pointer to serial num */ &serialNum,
/* pointer to appNum */ &appNum);
if(ccode){
printf("NWGetNetworkSerialNumber failed %X\n",ccode);
exit(1);
}
printf("Serial number = %08lX\n",serialNum);
printf("Application Number = %04X\n",appNum);
}