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.

173 lines
8.2 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1996.
  5. //
  6. // File: privoa.h
  7. //
  8. // Contents: Definitions for OleAut32.dll wrappers
  9. //
  10. // Classes:
  11. //
  12. // History: 20-Jun-96 MikeHill Created.
  13. // 06-May-98 MikeHill Added SafeArray wrappers.
  14. //
  15. // Notes:
  16. // This file has macros, function prototypes, and global
  17. // externs that enable the OleAut32 wrapper functions.
  18. // These functions load OleAut32.dll if necessary, and forward
  19. // the call.
  20. //
  21. //----------------------------------------------------------------------------
  22. #ifndef _PRIV_OA_H_
  23. #define _PRIV_OA_H_
  24. // OleAut32 function prototypes
  25. typedef BSTR (STDAPICALLTYPE SYS_ALLOC_STRING)(LPCOLESTR pwsz);
  26. typedef VOID (STDAPICALLTYPE SYS_FREE_STRING)(BSTR bstr);
  27. typedef BOOL (STDAPICALLTYPE SYS_REALLOC_STRING_LEN)(BSTR* pbstr, OLECHAR* pch, UINT cch);
  28. typedef UINT (STDAPICALLTYPE SYS_STRING_BYTE_LEN)(BSTR bstr);
  29. typedef UINT (STDAPICALLTYPE FNTYPE_SysStringLen)(BSTR bstr);
  30. typedef HRESULT (STDAPICALLTYPE SAFE_ARRAY_ACCESS_DATA)(SAFEARRAY * psa, void HUGEP** ppvData);
  31. typedef HRESULT (STDAPICALLTYPE SAFE_ARRAY_GET_L_BOUND)(SAFEARRAY * psa, UINT nDim, LONG * plLbound);
  32. typedef UINT (STDAPICALLTYPE SAFE_ARRAY_GET_DIM)(SAFEARRAY * psa);
  33. typedef UINT (STDAPICALLTYPE SAFE_ARRAY_GET_ELEM_SIZE)(SAFEARRAY * psa);
  34. typedef HRESULT (STDAPICALLTYPE SAFE_ARRAY_GET_U_BOUND)(SAFEARRAY * psa, UINT nDim, LONG * plUbound);
  35. typedef HRESULT (STDAPICALLTYPE SAFE_ARRAY_UNACCESS_DATA)(SAFEARRAY * psa);
  36. typedef SAFEARRAY* (STDAPICALLTYPE SAFE_ARRAY_CREATE_EX)(VARTYPE vt, UINT cDims, SAFEARRAYBOUND * rgsabound, PVOID pvExtra);
  37. typedef HRESULT (STDAPICALLTYPE SAFE_ARRAY_GET_VARTYPE)(SAFEARRAY * psa, VARTYPE * pvt);
  38. typedef SAFEARRAY* (STDAPICALLTYPE FNTYPE_SafeArrayCreate)(VARTYPE vt, UINT cDims, SAFEARRAYBOUND * rgsabound);
  39. typedef HRESULT (STDAPICALLTYPE FNTYPE_SafeArrayPutElement)(SAFEARRAY* psa, long* pIdx, void* pv );
  40. typedef HRESULT (STDAPICALLTYPE FNTYPE_SafeArrayDestroy)(SAFEARRAY* psa );
  41. typedef void (STDAPICALLTYPE FNTYPE_VariantInit)(VARIANTARG * pvarg);
  42. typedef HRESULT (STDAPICALLTYPE FNTYPE_VariantClear)(VARIANTARG * pvarg);
  43. typedef HRESULT (STDAPICALLTYPE FNTYPE_VariantCopy)(VARIANTARG * pvargDest, VARIANTARG * pvargSrc);
  44. typedef HRESULT (STDAPICALLTYPE FNTYPE_VariantChangeTypeEx)(VARIANTARG * pvargDest, VARIANTARG * pvarSrc, LCID lcid, USHORT wFlags, VARTYPE vt);
  45. typedef unsigned long BSTR_USER_SIZE ( unsigned long __RPC_FAR *, unsigned long , BSTR __RPC_FAR * );
  46. typedef unsigned char __RPC_FAR * BSTR_USER_MARSHAL ( unsigned long __RPC_FAR *, unsigned char __RPC_FAR*, BSTR __RPC_FAR * );
  47. typedef unsigned char __RPC_FAR * BSTR_USER_UNMARSHAL (unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, BSTR __RPC_FAR * );
  48. typedef void BSTR_USER_FREE ( unsigned long __RPC_FAR *, BSTR __RPC_FAR * );
  49. typedef unsigned long LPSAFEARRAY_USER_SIZE ( unsigned long __RPC_FAR *, unsigned long , LPSAFEARRAY __RPC_FAR * );
  50. typedef unsigned char __RPC_FAR * LPSAFEARRAY_USER_MARSHAL ( unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, LPSAFEARRAY __RPC_FAR * );
  51. typedef unsigned char __RPC_FAR * LPSAFEARRAY_USER_UNMARSHAL (unsigned long __RPC_FAR *, unsigned char __RPC_FAR *, LPSAFEARRAY __RPC_FAR * );
  52. typedef void LPSAFEARRAY_USER_FREE ( unsigned long __RPC_FAR *, LPSAFEARRAY __RPC_FAR * );
  53. // The Wrapper routines, and function pointers for them.
  54. #define DECLARE_OLEAUT_FUNCTION( fname ) \
  55. FNTYPE_##fname Load##fname; \
  56. EXTERN_C FNTYPE_##fname *pfn##fname;
  57. SYS_ALLOC_STRING LoadSysAllocString;
  58. EXTERN_C SYS_ALLOC_STRING *pfnSysAllocString;
  59. SYS_FREE_STRING LoadSysFreeString;
  60. EXTERN_C SYS_FREE_STRING *pfnSysFreeString;
  61. SYS_REALLOC_STRING_LEN LoadSysReAllocStringLen;
  62. EXTERN_C SYS_REALLOC_STRING_LEN *pfnSysReAllocStringLen;
  63. SYS_STRING_BYTE_LEN LoadSysStringByteLen;
  64. EXTERN_C SYS_STRING_BYTE_LEN *pfnSysStringByteLen;
  65. DECLARE_OLEAUT_FUNCTION( SysStringLen );
  66. SAFE_ARRAY_ACCESS_DATA LoadSafeArrayAccessData;
  67. EXTERN_C SAFE_ARRAY_ACCESS_DATA *pfnSafeArrayAccessData;
  68. SAFE_ARRAY_GET_L_BOUND LoadSafeArrayGetLBound;
  69. EXTERN_C SAFE_ARRAY_GET_L_BOUND *pfnSafeArrayGetLBound;
  70. SAFE_ARRAY_GET_DIM LoadSafeArrayGetDim;
  71. EXTERN_C SAFE_ARRAY_GET_DIM *pfnSafeArrayGetDim;
  72. SAFE_ARRAY_GET_ELEM_SIZE LoadSafeArrayGetElemsize;
  73. EXTERN_C SAFE_ARRAY_GET_ELEM_SIZE *pfnSafeArrayGetElemsize;
  74. SAFE_ARRAY_GET_U_BOUND LoadSafeArrayGetUBound;
  75. EXTERN_C SAFE_ARRAY_GET_U_BOUND *pfnSafeArrayGetUBound;
  76. SAFE_ARRAY_GET_VARTYPE LoadSafeArrayGetVartype;
  77. EXTERN_C SAFE_ARRAY_GET_VARTYPE *pfnSafeArrayGetVartype;
  78. SAFE_ARRAY_UNACCESS_DATA LoadSafeArrayUnaccessData;
  79. EXTERN_C SAFE_ARRAY_UNACCESS_DATA *pfnSafeArrayUnaccessData;
  80. SAFE_ARRAY_CREATE_EX LoadSafeArrayCreateEx;
  81. EXTERN_C SAFE_ARRAY_CREATE_EX *pfnSafeArrayCreateEx;
  82. DECLARE_OLEAUT_FUNCTION( SafeArrayCreate );
  83. DECLARE_OLEAUT_FUNCTION( SafeArrayPutElement );
  84. DECLARE_OLEAUT_FUNCTION( SafeArrayDestroy );
  85. DECLARE_OLEAUT_FUNCTION( VariantClear );
  86. DECLARE_OLEAUT_FUNCTION( VariantInit );
  87. DECLARE_OLEAUT_FUNCTION( VariantCopy );
  88. DECLARE_OLEAUT_FUNCTION( VariantChangeTypeEx );
  89. EXTERN_C BSTR_USER_SIZE LoadBSTR_UserSize;
  90. EXTERN_C BSTR_USER_SIZE *pfnBSTR_UserSize;
  91. EXTERN_C BSTR_USER_MARSHAL LoadBSTR_UserMarshal;
  92. EXTERN_C BSTR_USER_MARSHAL *pfnBSTR_UserMarshal;
  93. EXTERN_C BSTR_USER_UNMARSHAL LoadBSTR_UserUnmarshal;
  94. EXTERN_C BSTR_USER_UNMARSHAL *pfnBSTR_UserUnmarshal;
  95. EXTERN_C BSTR_USER_FREE LoadBSTR_UserFree;
  96. EXTERN_C BSTR_USER_FREE *pfnBSTR_UserFree;
  97. EXTERN_C LPSAFEARRAY_USER_SIZE LoadLPSAFEARRAY_UserSize;
  98. EXTERN_C LPSAFEARRAY_USER_SIZE *pfnLPSAFEARRAY_UserSize;
  99. EXTERN_C LPSAFEARRAY_USER_MARSHAL LoadLPSAFEARRAY_UserMarshal;
  100. EXTERN_C LPSAFEARRAY_USER_MARSHAL *pfnLPSAFEARRAY_UserMarshal;
  101. EXTERN_C LPSAFEARRAY_USER_UNMARSHAL LoadLPSAFEARRAY_UserUnmarshal;
  102. EXTERN_C LPSAFEARRAY_USER_UNMARSHAL *pfnLPSAFEARRAY_UserUnmarshal;
  103. EXTERN_C LPSAFEARRAY_USER_FREE LoadLPSAFEARRAY_UserFree;
  104. EXTERN_C LPSAFEARRAY_USER_FREE *pfnLPSAFEARRAY_UserFree;
  105. // Macros to ease the calling of the above function pointers
  106. #define PrivSysAllocString(pwsz) (*pfnSysAllocString)(pwsz)
  107. #define PrivSysFreeString(bstr) (*pfnSysFreeString)(bstr)
  108. #define PrivSysReAllocStringLen(pbstr,olestr,ui) (*pfnSysReAllocStringLen)(pbstr, olestr, ui)
  109. #define PrivSysStringByteLen(pbstr) (*pfnSysStringByteLen)(pbstr)
  110. #define PrivSysStringLen(pbstr) (*pfnSysStringByteLen)(pbstr)
  111. #define PrivSafeArrayAccessData(psa,ppvData) (*pfnSafeArrayAccessData)(psa, ppvData )
  112. #define PrivSafeArrayGetLBound(psa,nDim, plLbound) (*pfnSafeArrayGetLBound)( psa, nDim, plLbound )
  113. #define PrivSafeArrayGetDim(psa) (*pfnSafeArrayGetDim)( psa )
  114. #define PrivSafeArrayGetElemsize(psa) (*pfnSafeArrayGetElemsize)( psa )
  115. #define PrivSafeArrayGetUBound(psa,nDim, plUbound) (*pfnSafeArrayGetUBound)( psa, nDim, plUbound )
  116. #define PrivSafeArrayGetVartype(psa, pvt) (*pfnSafeArrayGetVartype)( psa, pvt )
  117. #define PrivSafeArrayUnaccessData(psa) (*pfnSafeArrayUnaccessData)( psa )
  118. #define PrivSafeArrayCreateEx(vt,cDims,rgsabound,pvExtra) \
  119. (*pfnSafeArrayCreateEx)(vt, cDims, rgsabound, pvExtra)
  120. #define PrivSafeArrayCreate(vt,cDims,rgsabound) (*pfnSafeArrayCreate)(vt, cDims, rgsabound)
  121. #define PrivSafeArrayPutElement(psa, pIdx, pv) (*pfnSafeArrayPutElement)(psa, pIdx, pv)
  122. #define PrivSafeArrayDestroy( psa ) (*pfnSafeArrayDestroy)(psa)
  123. #define PrivVariantClear(pvarg) (*pfnVariantClear)( pvarg )
  124. #define PrivVariantInit(pvarg) (*pfnVariantInit)(pvarg)
  125. #define PrivVariantCopy(pvargDest,pvargSrc) (*pfnVariantCopy)( pvargDest, pvargSrc )
  126. #define PrivVariantChangeTypeEx(pvargDest,pvarSrc,lcid,wFlags,vt) \
  127. (*pfnVariantChangeTypeEx)( pvargDest, pvarSrc, lcid, wFlags, vt )
  128. #endif // ! _PRIV_OA_H_