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.

60 lines
2.6 KiB

  1. ///////////////////////////////////////////////////////////////////////////////////////////////////////////////
  2. // Microsoft WMIOLE DB Provider
  3. // (C) Copyright 1999 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // dataconvert.h
  6. //
  7. ////////////////////////////////////////////////////////////////////////////
  8. typedef LONG_PTR HSLOT;
  9. #define MAX_CIM_STRING_SIZE -1
  10. #ifndef __DATA_CONVERT_H__
  11. #define __DATA_CONVERT_H__
  12. class CDataMap
  13. {
  14. HRESULT AllocateData(DBTYPE dwType,void *& pData,DBLENGTH &dwLength);
  15. BOOL IsValidDBTimeStamp(DBTIMESTAMP *pTimeStamp);
  16. BOOL IsSafeArrayEmpty(SAFEARRAY *psa);
  17. BOOL IsDateType(DWORD dwType);
  18. HRESULT ConvertDateTypes(DWORD dwSrcType,
  19. DWORD dwDstType,
  20. DBLENGTH dwSrcLen,
  21. DBLENGTH* pdwDstLen,
  22. void * pSrc,
  23. void * & pDst,
  24. DBLENGTH dbDstLen,
  25. DWORD * pdwStatus);
  26. public:
  27. CDataMap() {};
  28. ~CDataMap() {};
  29. HRESULT MapOLEDBTypeToCIMType(WORD dwDataType, long & dwCIMType );
  30. HRESULT MapCIMTypeToOLEDBType(long lType, WORD & dwdbOLEDBType, DBLENGTH & uColumnSize , DWORD &dwFlags);
  31. HRESULT FreeData(DBTYPE lType, BYTE *& pData);
  32. HRESULT AllocateAndMapCIMTypeToOLEDBType(CVARIANT & vValue,BYTE *& pData,DBTYPE &dwColType,DBLENGTH & dwSize, DWORD &dwFlags);
  33. HRESULT MapAndConvertOLEDBTypeToCIMType(DBTYPE wDataType, void *pData ,DBLENGTH dwSrcLength,VARIANT &varData,LONG_PTR dwArrayCIMType = -1);
  34. HRESULT ConvertVariantType(VARIANT &varSrc, VARIANT varDst ,CIMTYPE lType);
  35. BOOL CompareData(DWORD dwType,void * pData1 , void *pData2);
  36. // Array conversion functions
  37. HRESULT ConvertAndCopyArray(SAFEARRAY *psaSrc, SAFEARRAY **psaDst, DBTYPE dwSrcType,DBTYPE dwDstType,DBSTATUS *pdwStatus);
  38. HRESULT ConvertToVariantArray(SAFEARRAY *pArray,DBTYPE dwSrcType,SAFEARRAY ** ppArrayOut);
  39. // Date conversion functions
  40. HRESULT ConvertOledbDateToCIMType(VARIANT *vTimeStamp,BSTR &strDate);
  41. HRESULT ConvertDateToOledbType(BSTR strDate,DBTIMESTAMP *pTimeStamp);
  42. HRESULT ConvertVariantDateOledbDate(DATE *pDate,DBTIMESTAMP *pTimeStamp);
  43. HRESULT ConvertOledbDateToCIMType(DBTIMESTAMP *pTimeStamp,BSTR &strDate);
  44. HRESULT ConvertVariantDateToCIMType(DATE *pDate,BSTR &strDate);
  45. HRESULT ClearData(DBTYPE lType, void * pData);
  46. HRESULT ConvertToCIMType(BYTE *pData, DBTYPE lType ,DBLENGTH lDataLength,LONG lCIMType ,VARIANT &varData);
  47. HRESULT AllocateAndConvertToOLEDBType(VARIANT &varData,LONG lCimType , DBTYPE lOledbType,BYTE *&pData, DBLENGTH &lDataLength, DBSTATUS &dwStatus);
  48. HRESULT TranslateParameterStringToOLEDBType( DBTYPE & wDataType, WCHAR * str) ;
  49. };
  50. #endif