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 >
Text File  |  1995-06-02  |  3KB  |  107 lines

  1. /****************************************************************************
  2. **      DISCLAIMER  
  3. **  
  4. **   Novell, Inc. makes no representations or warranties with respect to
  5. **   any NetWare software, and specifically disclaims any express or
  6. **   implied warranties of merchantability, title, or fitness for a
  7. **   particular purpose.  
  8. **
  9. **   Distribution of any NetWare software is forbidden without the
  10. **   express written consent of Novell, Inc.  Further, Novell reserves
  11. **   the right to discontinue distribution of any NetWare software.
  12. **   
  13. **   Novell is not responsible for lost profits or revenue, loss of use
  14. **   of the software, loss of data, costs of re-creating lost data, the
  15. **   cost of any substitute equipment or program, or claims by any party
  16. **   other than you.  Novell strongly recommends a backup be made before
  17. **   any software is installed.   Technical support for this software
  18. **   may be provided at the discretion of Novell.
  19. ****************************************************************************
  20. **
  21. **   File: Serial.c   
  22. **
  23. **   Desc: Finds the servers serial number.  
  24. **
  25. **        
  26. **   Programmers:
  27. **   Ini   Who         Firm
  28. **   ------------------------------------------------------------------
  29. **   ARM   A. Ray Maxwell     Novell Developer Support.
  30. **
  31. **   History:
  32. **       
  33. **   ------------------------------------------------------------------
  34. **   01-11-94   ARM   First code.
  35. */
  36.  
  37. /***************************************************************************
  38. **   Include headers, macros, function prototypes, etc.
  39. */
  40.  
  41.    /*------------------------------------------------------------------
  42.    **   ANSI
  43.     */
  44.     #include <stdlib.h>          /* exit(), atol()        */
  45.     #include <stdio.h>           /* printf()              */
  46.    #include <string.h>              /* strcpy()              */
  47.  
  48.     /*------------------------------------------------------------------
  49.     **   NetWare
  50.     */
  51.     #include <nwcalls.h>
  52.  
  53.  
  54.  
  55. /****************************************************************************
  56. **   Program Start
  57. */
  58. void main(int argc, char *argv[])
  59. {
  60.     NWCONN_HANDLE   connHandle;
  61.     NWCCODE         ccode;
  62.    char            server[50];
  63.     DWORD           serialNum;
  64.    WORD            appNum;
  65.  
  66.    
  67.    
  68.    
  69.    if(argc != 2) {
  70.       printf("Usage: SERIAL <servername>\n");
  71.       exit(1);
  72.     }
  73.  
  74.    strcpy(server,  strupr(argv[1]));
  75.  
  76.  
  77.    ccode = NWCallsInit(NULL, NULL);
  78.  
  79.    if(ccode)
  80.       exit(1);
  81.  
  82.    ccode = NWGetConnectionHandle(
  83.            /* > servername        */ server,
  84.            /*   Novell Reserved1  */ 0,
  85.            /* < connection Handle */ &connHandle,
  86.            /*   Novell Reserved2  */ NULL);
  87.    if(ccode){
  88.       printf("NWGetConnectionHandle failed %X\n",ccode);
  89.       exit(1);
  90.    }
  91.  
  92.     ccode=NWGetNetworkSerialNumber(
  93.             /* connection Handle      */ connHandle,
  94.             /* pointer to serial num  */ &serialNum,
  95.             /* pointer to appNum      */ &appNum);
  96.     if(ccode){
  97.         printf("NWGetNetworkSerialNumber failed %X\n",ccode);
  98.         exit(1);
  99.     }
  100.     printf("Serial number = %08lX\n",serialNum);
  101.    printf("Application Number = %04X\n",appNum);
  102.  
  103.  
  104. }
  105.  
  106.  
  107.