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.hxx < prev    next >
Encoding:
Text File  |  1997-10-13  |  2.1 KB  |  151 lines

  1. //----------------------------------------------------------------------
  2. //
  3. //  Microsoft Active Directory 1.0 Sample Code
  4. //
  5. //  Copyright (C) Microsoft Corporation, 1996
  6. //
  7. //  File:       main.hxx
  8. //
  9. //  Contents:   Main include file for adscmd
  10. //
  11. //
  12. //----------------------------------------------------------------------
  13.  
  14. //
  15. // ********* System Includes
  16. //
  17.  
  18. #define UNICODE
  19. #define _UNICODE
  20. #define INC_OLE2
  21.  
  22. #include <windows.h>
  23.  
  24. //
  25. // ********* CRunTime Includes
  26. //
  27.  
  28. #include <stdlib.h>
  29. #include <limits.h>
  30. #include <io.h>
  31. #include <stdio.h>
  32.  
  33. //
  34. // *********  Public ADs includes
  35. //
  36.  
  37. #include <activeds.h>
  38.  
  39. //
  40. // *********  Useful macros
  41. //
  42.  
  43. #define BAIL_ON_NULL(p)       \
  44.      if (!(p)) {           \
  45.              goto error;   \
  46.      }
  47.  
  48. #define BAIL_ON_FAILURE(hr)   \
  49.      if (FAILED(hr)) {     \
  50.              goto error;   \
  51.      }
  52.  
  53. #define FREE_INTERFACE(pInterface) \
  54.      if (pInterface) {          \
  55.          pInterface->Release(); \
  56.          pInterface=NULL;       \
  57.      }
  58.  
  59. #define FREE_BSTR(bstr)            \
  60.      if (bstr) {                \
  61.          SysFreeString(bstr);   \
  62.          bstr = NULL;           \
  63.      }
  64.  
  65. //
  66. // *********  Prototypes
  67. //
  68.  
  69. void
  70. PrintUsage(
  71.  void
  72.  );
  73.  
  74. int
  75. AnsiToUnicodeString(
  76.  LPSTR pAnsi,
  77.  LPWSTR pUnicode,
  78.  DWORD StringLength
  79.  );
  80.  
  81. int
  82. UnicodeToAnsiString(
  83.  LPWSTR pUnicode,
  84.  LPSTR pAnsi,
  85.  DWORD StringLength
  86.  );
  87.  
  88. LPWSTR
  89. AllocateUnicodeString(
  90.  LPSTR  pAnsiString
  91.  );
  92.  
  93. void
  94. FreeUnicodeString(
  95.  LPWSTR  pUnicodeString
  96.  );
  97.  
  98. HRESULT
  99. PrintVariantArray(
  100.  VARIANT var
  101.  );
  102.  
  103. HRESULT
  104. PrintVariant(
  105.  VARIANT varPropData
  106.  );
  107.  
  108. HRESULT
  109. PrintProperty(
  110.  BSTR bstrPropName,
  111.  HRESULT hRetVal,
  112.  VARIANT varPropData
  113.  );
  114.  
  115. HRESULT
  116. GetPropertyList(
  117.  IADs * pADs,
  118.  VARIANT * pvar
  119.  );
  120.  
  121. //
  122. // Functions to dump contents of an object
  123. //
  124.  
  125. int
  126. DoDump(
  127.  char *AnsiADsPath
  128.  ) ;
  129.  
  130. HRESULT
  131. DumpObject(
  132.  IADs * pADs
  133.  );
  134.  
  135. //
  136. // Functions to list objects within a container.
  137. //
  138.  
  139. int
  140. DoList(
  141.  char *AnsiADsPath
  142.  ) ;
  143.  
  144. HRESULT
  145. EnumObject(
  146.  LPWSTR pszADsPath,
  147.  LPWSTR * lppClassNames,
  148.  DWORD dwClassNames
  149.  ) ;
  150.  
  151.