home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / adsi / sampapp / adscmd / main.cxx < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-29  |  1.3 KB  |  71 lines

  1. //----------------------------------------------------------------------------
  2. //
  3. //  Microsoft Active Directory 1.0 Sample Code
  4. //
  5. //  Copyright (C) Microsoft Corporation, 1996
  6. //
  7. //  File:       main.cxx
  8. //
  9. //  Contents:   Main for adscmd
  10. //
  11. //
  12. //----------------------------------------------------------------------------
  13.  
  14.  
  15. #include "main.hxx"
  16.  
  17.  
  18. //-------------------------------------------------------------------------
  19. //
  20. // main
  21. //
  22. //-------------------------------------------------------------------------
  23.  
  24. int __cdecl
  25. main(int argc, char * argv[])
  26. {
  27.     HRESULT hr;
  28.     int exitcode;
  29.  
  30.     if (argc != 3) {
  31.         PrintUsage() ;
  32.         exit(1);
  33.     }
  34.  
  35.     hr = CoInitialize(NULL);
  36.  
  37.     if (FAILED(hr)) {
  38.         printf("CoInitialize failed\n");
  39.         exit(1);
  40.     }
  41.  
  42.     if (_stricmp(argv[1],"list") == 0) {
  43.  
  44.         //
  45.         // Call the List helper function
  46.         //
  47.  
  48.         exitcode = DoList(argv[2]) ;
  49.     }
  50.     else if (_stricmp(argv[1],"dump") == 0) {
  51.  
  52.         //
  53.         // Call the Dump helper function
  54.         //
  55.  
  56.         exitcode = DoDump(argv[2]) ;
  57.     }
  58.     else {
  59.  
  60.         //
  61.         // Unknown command
  62.         //
  63.  
  64.         PrintUsage() ;
  65.         exitcode = 1 ;
  66.     }
  67.  
  68.     exit(exitcode) ;
  69.     return 0;
  70. }
  71.