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.

145 lines
1.9 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. int
  56. AnsiToUnicodeString(
  57. LPSTR pAnsi,
  58. LPWSTR pUnicode,
  59. DWORD StringLength
  60. );
  61. int
  62. UnicodeToAnsiString(
  63. LPWSTR pUnicode,
  64. LPSTR pAnsi,
  65. DWORD StringLength
  66. );
  67. LPWSTR
  68. AllocateUnicodeString(
  69. LPSTR pAnsiString
  70. );
  71. void
  72. FreeUnicodeString(
  73. LPWSTR pUnicodeString
  74. );
  75. HRESULT
  76. PrintVariantArray(
  77. VARIANT var
  78. );
  79. HRESULT
  80. PrintVariant(
  81. VARIANT varPropData
  82. );
  83. HRESULT
  84. PrintProperty(
  85. BSTR bstrPropName,
  86. HRESULT hRetVal,
  87. VARIANT varPropData
  88. );
  89. HRESULT
  90. GetPropertyList(
  91. IADs * pADs,
  92. VARIANT * pvar
  93. );
  94. //
  95. // Functions to dump contents of an object
  96. //
  97. int
  98. DoDump(
  99. char *AnsiADsPath
  100. ) ;
  101. HRESULT
  102. DumpObject(
  103. IADs * pADs
  104. );
  105. //
  106. // Functions to list objects within a container.
  107. //
  108. int
  109. DoList(
  110. char *AnsiADsPath
  111. ) ;
  112. HRESULT
  113. EnumObject(
  114. LPWSTR pszADsPath,
  115. LPWSTR * lppClassNames,
  116. DWORD dwClassNames
  117. ) ;