Leaked source code of windows server 2003
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.

242 lines
5.9 KiB

  1. #ifndef _HXX_UTIL
  2. #define _HXX_UTIL
  3. //+---------------------------------------------------------------------------
  4. //
  5. // Microsoft Windows
  6. // Copyright (C) Microsoft Corporation, 1992 - 1993.
  7. //
  8. // File: util.hxx
  9. //
  10. // Contents: Utilities in cdutil that are not exported outside of
  11. // formidbl.dll.
  12. //
  13. // History: 7-13-94 adams Created
  14. //
  15. //----------------------------------------------------------------------------
  16. //+------------------------------------------------------------------------
  17. //
  18. // misc.cxx
  19. //
  20. //-------------------------------------------------------------------------
  21. HRESULT GetLastWin32Error(void);
  22. //+------------------------------------------------------------------------
  23. //
  24. // Dispatch utilites in disputil.cxx
  25. //
  26. //-------------------------------------------------------------------------
  27. HRESULT ValidateInvoke(
  28. DISPPARAMS * pdispparams,
  29. VARIANT * pvarResult,
  30. EXCEPINFO * pexcepinfo,
  31. UINT * puArgErr);
  32. inline void
  33. InitEXCEPINFO(EXCEPINFO * pEI)
  34. {
  35. if (pEI)
  36. memset(pEI, 0, sizeof(*pEI));
  37. }
  38. void FreeEXCEPINFO(EXCEPINFO * pEI);
  39. HRESULT LoadTypeInfo(CLSID clsidTL, CLSID clsidTI, LPTYPEINFO *ppTI);
  40. HRESULT GetDispProp(
  41. IDispatch * pDisp,
  42. DISPID dispid,
  43. REFIID riid,
  44. LCID lcid,
  45. VARIANT * pvarg,
  46. EXCEPINFO * pexcepinfo = NULL);
  47. HRESULT SetDispProp(
  48. IDispatch * pDisp,
  49. DISPID dispid,
  50. REFIID riid,
  51. LCID lcid,
  52. VARIANTARG * pvarg,
  53. EXCEPINFO * pexcepinfo = NULL);
  54. HRESULT GetDispPropOfType(
  55. IDispatch * pDisp,
  56. DISPID dispid,
  57. LCID lcid,
  58. VARTYPE vt,
  59. void * pv);
  60. HRESULT SetDispPropOfType(
  61. IDispatch * pDisp,
  62. DISPID dispid,
  63. LCID lcid,
  64. VARTYPE vt,
  65. void * pv);
  66. HRESULT CallDispMethod(
  67. IDispatch * pDisp,
  68. DISPID dispid,
  69. LCID lcid,
  70. VARTYPE vtReturn,
  71. void * pvReturn,
  72. VARTYPE * pvtParams,
  73. ...);
  74. STDAPI DispParamsToCParams(
  75. DISPPARAMS * pDP,
  76. UINT * puArgErr,
  77. VARTYPE * pvt,
  78. ...);
  79. void CParamsToDispParams(
  80. DISPPARAMS * pDispParams,
  81. VARTYPE * pvt,
  82. va_list va);
  83. BOOL IsVariantEqual(VARIANTARG FAR* pvar1, VARIANTARG FAR* pvar2);
  84. //+------------------------------------------------------------------------
  85. //
  86. // Message display and Error handling (error.cxx)
  87. //
  88. //-------------------------------------------------------------------------
  89. // properties of a message box for displaying an error
  90. const UINT MB_ERRORFLAGS = MB_ICONEXCLAMATION | MB_OK;
  91. //
  92. // Extension of EXCEPINFO which initializes itself and
  93. // destroys allocated strings.
  94. //
  95. // Functions for creating and propogating error information
  96. HRESULT ADsPropogateErrorInfo(HRESULT hrError, REFIID iid, IUnknown * pUnk);
  97. HRESULT ADsSetErrorInfo(HRESULT hrError, EXCEPINFO * pEI = NULL);
  98. HRESULT ADsCreateErrorInfo(HRESULT hrError, IErrorInfo ** ppEI);
  99. HRESULT GetErrorInfoToExcepInfo(HRESULT hrError, EXCEPINFO * pEI);
  100. HRESULT ResultToExcepInfo(HRESULT hrError, EXCEPINFO * pEI);
  101. void ADsGetErrorInfo(IUnknown * pUnk, REFIID iid, IErrorInfo ** ppEI);
  102. // Functions for displaying messages
  103. HRESULT GetErrorText(HRESULT hrError, LPWSTR * ppwszDescription);
  104. HRESULT __cdecl DisplayErrorMsg(HWND hwndOwner, UINT idsContext, ...);
  105. HRESULT __cdecl DisplayError(
  106. HWND hwndOwner,
  107. HRESULT hrError,
  108. LPWSTR pwszSource,
  109. LPWSTR pwszDescription,
  110. UINT idsContext,
  111. va_list arglist);
  112. HRESULT __cdecl DisplayErrorResult(
  113. HWND hwndOwner,
  114. HRESULT hrError,
  115. UINT idsContext,
  116. ...);
  117. HRESULT __cdecl DisplayErrorEXCEPINFO(
  118. HWND hwndOwner,
  119. HRESULT hrError,
  120. EXCEPINFO * pEI,
  121. UINT idsContext,
  122. ...);
  123. HRESULT __cdecl DisplayErrorErrorInfo(
  124. HWND hwndOwner,
  125. HRESULT hrError,
  126. IErrorInfo * pEI,
  127. UINT idsContext,
  128. ...);
  129. HRESULT __cdecl DisplayMessage(
  130. int * pResult,
  131. HWND hwndOwner,
  132. UINT uiMessageFlags,
  133. UINT idsTitle,
  134. UINT idsMessage,
  135. ...);
  136. HRESULT DisplayMessageV(
  137. int * pResult,
  138. HWND hwndOwner,
  139. UINT uiMessageFlags,
  140. UINT idsTitle,
  141. UINT idsMessage,
  142. va_list argptr);
  143. HRESULT
  144. BuildVariantArrayofStrings(
  145. LPWSTR *lppPathNames,
  146. DWORD dwPathNames,
  147. VARIANT ** ppVar
  148. );
  149. HRESULT
  150. BuildVariantArrayofIntegers(
  151. LPDWORD lpdwObjectTypes,
  152. DWORD dwObjectTypes,
  153. VARIANT ** ppVar
  154. );
  155. typedef VARIANT *PVARIANT;
  156. HRESULT
  157. ConvertSafeArrayToVariantArray(
  158. VARIANT varSafeArray,
  159. PVARIANT * ppVarArray,
  160. PDWORD pdwNumVariants
  161. );
  162. HRESULT
  163. ConvertByRefSafeArrayToVariantArray(
  164. VARIANT varSafeArray,
  165. PVARIANT * ppVarArray,
  166. PDWORD pdwNumVariants
  167. );
  168. HRESULT
  169. ConvertVariantArrayToLDAPStringArray(
  170. PVARIANT pVarArray,
  171. PWSTR **pppszStringArray,
  172. DWORD dwNumStrings
  173. );
  174. void
  175. RaiseException(
  176. HRESULT hr
  177. );
  178. HRESULT
  179. BinaryToVariant(
  180. DWORD Length,
  181. BYTE* pByte,
  182. PVARIANT lpVarDestObject
  183. );
  184. HRESULT
  185. VariantToBinary(
  186. PVARIANT pVarSrcObject,
  187. DWORD *pdwLength,
  188. BYTE **ppByte
  189. );
  190. HRESULT
  191. CopyOctetString(
  192. DWORD dwNumBytes,
  193. BYTE *pData,
  194. DWORD *pdwNumBytes,
  195. BYTE **ppByte
  196. );
  197. #endif // #ifndef _HXX_UTIL