Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

157 lines
2.2 KiB

  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. // ********* System Includes
  15. //
  16. #define UNICODE
  17. #define _UNICODE
  18. #define INC_OLE2
  19. #include <windows.h>
  20. //
  21. // ********* CRunTime Includes
  22. //
  23. #include <stdlib.h>
  24. #include <limits.h>
  25. #include <io.h>
  26. #include <stdio.h>
  27. //
  28. // ********* Public ADs includes
  29. //
  30. #include <activeds.h>
  31. //
  32. // ********* Useful macros
  33. //
  34. #define BAIL_ON_NULL(p) \
  35. if (!(p)) { \
  36. goto error; \
  37. }
  38. #define BAIL_ON_FAILURE(hr) \
  39. if (FAILED(hr)) { \
  40. goto error; \
  41. }
  42. #define FREE_INTERFACE(pInterface) \
  43. if (pInterface) { \
  44. pInterface->Release(); \
  45. pInterface=NULL; \
  46. }
  47. #define FREE_BSTR(bstr) \
  48. if (bstr) { \
  49. SysFreeString(bstr); \
  50. bstr = NULL; \
  51. }
  52. //
  53. // ********* Prototypes
  54. //
  55. void
  56. PrintUsage(
  57. void
  58. );
  59. int
  60. AnsiToUnicodeString(
  61. LPSTR pAnsi,
  62. LPWSTR pUnicode,
  63. DWORD StringLength
  64. );
  65. int
  66. UnicodeToAnsiString(
  67. LPWSTR pUnicode,
  68. LPSTR pAnsi,
  69. DWORD StringLength
  70. );
  71. LPWSTR
  72. AllocateUnicodeString(
  73. LPSTR pAnsiString
  74. );
  75. void
  76. FreeUnicodeString(
  77. LPWSTR pUnicodeString
  78. );
  79. HRESULT
  80. PrintVariantArray(
  81. VARIANT var
  82. );
  83. HRESULT
  84. PrintVariant(
  85. VARIANT varPropData
  86. );
  87. HRESULT
  88. PrintProperty(
  89. BSTR bstrPropName,
  90. HRESULT hRetVal,
  91. VARIANT varPropData
  92. );
  93. HRESULT
  94. GetPropertyList(
  95. IADs * pADs,
  96. VARIANT ** ppVariant,
  97. PDWORD pcElementFetched
  98. );
  99. //
  100. // Functions to dump contents of an object
  101. //
  102. int
  103. DoDump(
  104. char *AnsiADsPath
  105. ) ;
  106. HRESULT
  107. DumpObject(
  108. IADs * pADs
  109. );
  110. //
  111. // Functions to list objects within a container.
  112. //
  113. int
  114. DoList(
  115. char *AnsiADsPath
  116. ) ;
  117. HRESULT
  118. EnumObject(
  119. LPWSTR pszADsPath,
  120. LPWSTR * lppClassNames,
  121. DWORD dwClassNames
  122. ) ;
  123.