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.

85 lines
3.3 KiB

  1. /*++
  2. Copyright (C) 1996-2001 Microsoft Corporation
  3. Module Name:
  4. OLEWRAP.H
  5. Abstract:
  6. Wrapper classes for COM data type functions.
  7. If a COM data function is required to allocate memory and fails to do
  8. so, then a CX_MemoryException exception is thrown. All COM data type
  9. functions are wrapped, regardless if they allocate memory, for the sake
  10. of completeness.
  11. History:
  12. a-dcrews 19-Mar-99 Created.
  13. --*/
  14. #ifndef _OLEWRAP_H_
  15. #define _OLEWRAP_H_
  16. class COleAuto
  17. {
  18. public:
  19. // Safe array methods
  20. // ==================
  21. static HRESULT _SafeArrayAccessData(SAFEARRAY* psa, void HUGEP** ppvData);
  22. static HRESULT _SafeArrayAllocData(SAFEARRAY* psa);
  23. static HRESULT _SafeArrayAllocDescriptor(unsigned int cDims, SAFEARRAY** ppsaOut);
  24. static HRESULT _SafeArrayCopy(SAFEARRAY* psa, SAFEARRAY** ppsaOut);
  25. static HRESULT _SafeArrayCopyData(SAFEARRAY* psaSource, SAFEARRAY* psaTarget);
  26. static SAFEARRAY* _SafeArrayCreate(VARTYPE vt, unsigned int cDims, SAFEARRAYBOUND* rgsabound);
  27. static SAFEARRAY* _SafeArrayCreateVector(VARTYPE vt, long lLbound, unsigned int cElements);
  28. static HRESULT _SafeArrayDestroy(SAFEARRAY* psa);
  29. static HRESULT _SafeArrayDestroyData(SAFEARRAY* psa);
  30. static HRESULT _SafeArrayDestroyDescriptor(SAFEARRAY* psa);
  31. static UINT _SafeArrayGetDim(SAFEARRAY* psa);
  32. static HRESULT _SafeArrayGetElement(SAFEARRAY* psa, long* rgIndices, void* pv);
  33. static UINT _SafeArrayGetElemsize(SAFEARRAY* psa);
  34. static HRESULT _SafeArrayGetLBound(SAFEARRAY* psa, unsigned int nDim, long* plLbound);
  35. static HRESULT _SafeArrayGetUBound(SAFEARRAY* psa, unsigned int nDim, long* plUbound);
  36. static HRESULT _SafeArrayLock(SAFEARRAY* psa);
  37. static HRESULT _SafeArrayPtrOfIndex(SAFEARRAY* psa, long* rgIndices, void HUGEP** ppvData);
  38. static HRESULT _SafeArrayPutElement(SAFEARRAY* psa, long* rgIndices, void* pv);
  39. static HRESULT _SafeArrayRedim(SAFEARRAY* psa, SAFEARRAYBOUND* psaboundNew);
  40. static HRESULT _SafeArrayUnaccessData(SAFEARRAY* psa);
  41. static HRESULT _SafeArrayUnlock(SAFEARRAY* psa);
  42. // Variant methods
  43. // ===============
  44. static HRESULT _WbemVariantChangeType(VARIANTARG* pvargDest, VARIANTARG* pvarSrc, VARTYPE vt);
  45. static HRESULT _VariantChangeType(VARIANTARG* pvargDest, VARIANTARG* pvarSrc, unsigned short wFlags, VARTYPE vt);
  46. static HRESULT _VariantChangeTypeEx(VARIANTARG* pvargDest, VARIANTARG* pvarSrc, LCID lcid, unsigned short wFlags, VARTYPE vt);
  47. static HRESULT _VariantClear(VARIANTARG* pvarg);
  48. static HRESULT _VariantCopy(VARIANTARG* pvargDest, VARIANTARG* pvargSrc);
  49. static HRESULT _VariantCopyInd(VARIANT* pvarDest, VARIANTARG* pvargSrc);
  50. static void _VariantInit(VARIANTARG* pvarg);
  51. // BSTR methods
  52. // ============
  53. static BSTR _SysAllocString(const OLECHAR* sz);
  54. static BSTR _SysAllocStringByteLen(LPCSTR psz, UINT len);
  55. static BSTR _SysAllocStringLen(const OLECHAR* pch, UINT cch);
  56. static void _SysFreeString(BSTR bstr);
  57. static HRESULT _SysReAllocString(BSTR* pbstr, const OLECHAR* sz);
  58. static HRESULT _SysReAllocStringLen(BSTR* pbstr, const OLECHAR* pch, UINT cch);
  59. static HRESULT _SysStringByteLen(BSTR bstr);
  60. static HRESULT _SysStringLen(BSTR bstr);
  61. // Conversion methods
  62. // ==================
  63. static HRESULT _VectorFromBstr (BSTR bstr, SAFEARRAY ** ppsa);
  64. static HRESULT _BstrFromVector (SAFEARRAY *psa, BSTR *pbstr);
  65. };
  66. #endif //_OLEWRAP_H_