home *** CD-ROM | disk | FTP | other *** search
/ Black Box 4 / BlackBox.cdr / lan / queues.arj / CREATQ.C next >
Text File  |  1991-05-31  |  7KB  |  166 lines

  1. /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
  2.  *                                                                           *
  3.  *                                                                           *
  4.  Program : CREATQ.C
  5.  Author  : Christopher R. Ojeda
  6.  Date    : 05/20/91
  7.  Function: CREATQ creates a queue on the current server.
  8.  Genesis : Turbo C 2.0
  9.            Compiled in Turbo C environment with defaults under DOS 3.3.
  10.  
  11.  This software is provided as is and carries no warranty
  12.  whatsoever.  Novell disclaims and excludes any and all implied
  13.  warranties of merchantability, title and fitness for a particular
  14.  purpose.  Novell does not warrant that the software will satisfy
  15.  your requirements or that the software is without defect or error
  16.  or that operation of the software will be uninterrupted.  You are
  17.  using the software at your risk.  The software is not a product
  18.  of Novell, Inc. or any of subsidiaries.
  19.  *                                                                           *
  20.  *                                                                           *
  21.  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
  22. #include <stdio.h>
  23. #include <string.h>
  24. #include <dos.h>
  25. #include <nit.h>
  26. #include <niterror.h>
  27. #include <nitq.h>
  28.  
  29. #define INT21            0x21
  30. #define OT_TEST_SERVER   0x8010
  31. #define OT_TEST_QUEUE    0x8020
  32. #define SEGMENT1         0x01
  33. #define NO_MORE_SEGMENTS 0x00
  34.  
  35. char GetCurrentDrive (void) ;
  36. void main (void);
  37.  
  38. struct {
  39.     BYTE accountExpirationDate[3] ;
  40.     BYTE accountDisabledFlag ;
  41.     BYTE passwordExpirationDate[3] ;
  42.     BYTE graceLogin ;
  43.     WORD passwordExpirationIntervals ;
  44.     BYTE graceLoginResetValue ;
  45.     BYTE minPasswordLength ;
  46.     WORD maxConcurrentConnections ;    
  47.     BYTE allowedLoginTimeBitmap[42] ;
  48.     BYTE lastLoginDateTime[6] ;
  49.     BYTE restrictionFlags ;
  50.     BYTE unused ;
  51.     long maxDiskUsageInBlocks ;
  52.     WORD badLoginCount ;
  53.     long nextResetTime ;
  54.     BYTE badLoginAddr[12] ;
  55. } loginControl;
  56.  
  57. void main(void) {
  58.     int  cCode;
  59.     long queueID;
  60.     BYTE drive ;
  61.     BYTE statusFlags;
  62.     BYTE dirHandle;
  63.     WORD fileServerConnectionID;
  64.  
  65.     drive = GetCurrentDrive() ;
  66.     statusFlags = GetDriveInformation (drive,
  67.                                        &fileServerConnectionID,
  68.                                        &dirHandle);
  69.  
  70.   if (cCode = CreateBinderyObject ("CHRIS_SERVER",
  71.                                    OT_TEST_SERVER,
  72.                                    BF_STATIC,
  73.                                    BS_ANY_READ|BS_ANY_WRITE))
  74.     printf ("\nError Creating Object.  Error: %d\n", cCode);
  75.   else
  76.     printf ("\nObject Created.");
  77.   if (cCode = ChangeBinderyObjectPassword ("CHRIS_SERVER",
  78.                                            OT_TEST_SERVER,
  79.                                            "",
  80.                                            "CHRISERVER"))
  81.      printf ("\nError Changing Password.  Error: %d\n", cCode);
  82.   else
  83.     printf ("\nPassword Created.");
  84.   if (cCode = CreateProperty ("CHRIS_SERVER",
  85.                               OT_TEST_SERVER,
  86.                               "LOGIN_CONTROL",
  87.                               BF_STATIC|BF_ITEM,
  88.                               BS_OBJECT_READ|BS_OBJECT_WRITE))
  89.      printf ("\nError Creating Property.  Error: %d\n", cCode);
  90.   else
  91.     printf ("\nProperty Created.");
  92.   memset (loginControl.allowedLoginTimeBitmap, 0xFF,
  93.           sizeof (loginControl.allowedLoginTimeBitmap));
  94.   loginControl.minPasswordLength=5;
  95.   if (cCode = WritePropertyValue ("CHRIS_SERVER",
  96.                                   OT_TEST_SERVER,
  97.                                   "LOGIN_CONTROL",
  98.                                   SEGMENT1,
  99.                                   (BYTE *)&loginControl,
  100.                                   NO_MORE_SEGMENTS))
  101.     printf ("\nError Writing Property Value.  Error: %d\n", cCode);
  102.   else printf ("\nProperty Written.");
  103.   if (cCode = CreateProperty ("CHRIS_SERVER",
  104.                               OT_TEST_SERVER,
  105.                               "SECURITY_EQUALS",
  106.                               BF_STATIC|BF_SET,
  107.                               BS_OBJECT_READ|BS_OBJECT_WRITE))
  108.      printf ("\nError Creating Property.  Error: %d\n", cCode);
  109.   else printf ("\nProperty Created.");
  110.   if (cCode = AddBinderyObjectToSet ("CHRIS_SERVER",
  111.                                      OT_TEST_SERVER,
  112.                                      "SECURITY_EQUALS",
  113.                                      "SUPERVISOR",
  114.                                      OT_USER))
  115.      printf ("\nError Adding to Set.  Error: %d\n", cCode);
  116.   else printf ("\nObject Added to Set.");
  117.   if (cCode = AddBinderyObjectToSet ("CHRIS_SERVER",
  118.                                      OT_TEST_SERVER,
  119.                                      "SECURITY_EQUALS",
  120.                                      "EVERYONE",
  121.                                      OT_USER_GROUP))
  122.      printf ("\nError Adding to Set.  Error: %d\n", cCode);
  123.   else printf ("\nObject Added to Set.");
  124.  
  125.   if (cCode = CreateQueue ("CHRIS_QUEUE",
  126.                            OT_TEST_QUEUE,
  127.                            dirHandle,
  128.                            "",
  129.                            &queueID))
  130.     printf ("\nError %d creating queue", cCode);
  131.   else printf ("\nQueue created.");
  132.  
  133.   if (cCode = AddBinderyObjectToSet ("CHRIS_QUEUE",
  134.                                      OT_TEST_QUEUE,
  135.                                      "Q_USERS",
  136.                                      "COJEDA",
  137.                                      OT_USER))
  138.      printf ("\nError Adding to Set.  Error: %d\n", cCode);
  139.   else printf ("\nObject Added to Set.");
  140.  
  141.   if (cCode = AddBinderyObjectToSet ("CHRIS_QUEUE",
  142.                                      OT_TEST_QUEUE,
  143.                                      "Q_OPERATORS",
  144.                                      "COJEDA",
  145.                                      OT_USER))
  146.      printf ("\nError Adding to Set.  Error: %d\n", cCode);
  147.   else printf ("\nObject Added to Set.");
  148.  
  149.   if (cCode = AddBinderyObjectToSet ("CHRIS_QUEUE",
  150.                                      OT_TEST_QUEUE,
  151.                                      "Q_SERVERS",
  152.                                      "CHRIS_SERVER",
  153.                                      OT_TEST_SERVER))
  154.      printf ("\nError Adding to Set.  Error: %d\n", cCode);
  155.   else printf ("\nObject Added to Set.");
  156. }
  157.  
  158. char GetCurrentDrive () {
  159.     union REGS reg ;
  160.     struct SREGS segs ;
  161.  
  162.     reg.h.ah = 0x19 ;
  163.     int86x(INT21,®,®,&segs) ;
  164.     return(reg.h.al) ;
  165. }
  166.