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.

212 lines
5.9 KiB

  1. #ifndef __MDSPDEFS_H__
  2. #define __MDSPDEFS_H__
  3. #if _MSC_VER >= 1000
  4. #pragma once
  5. #endif // _MSC_VER >= 1000
  6. #include "scserver.h"
  7. #define MDSP_TEMP
  8. #define ALSO_CHECK_FILES
  9. typedef PVOID HDEVNOTIFY;
  10. typedef HDEVNOTIFY *PHDEVNOTIFY;
  11. #define DEVICE_NOTIFY_WINDOW_HANDLE 0x00000000
  12. typedef struct {
  13. BOOL bValid;
  14. WCHAR wcsDevName[32];
  15. LPVOID pDeviceObj;
  16. LPVOID pIWMDMConnect;
  17. } MDSPNOTIFYINFO;
  18. typedef struct {
  19. BOOL bValid;
  20. WCHAR wcsDevName[32];
  21. DWORD dwStatus;
  22. LPVOID pIMDSPStorageGlobals;
  23. } MDSPGLOBALDEVICEINFO;
  24. #define WMDM_WAVE_FORMAT_ALL (WORD)0xFFFF
  25. #define WCS_MIME_TYPE_ALL L"*/*"
  26. #define MDSP_PMID_SOFT 0
  27. #define MDSP_PMID_SANDISK 1
  28. #define MDSP_MAX_DRIVE_COUNT 26
  29. #define MDSP_MAX_DEVICE_OBJ 64
  30. #define STR_MDSPREG "Software\\Microsoft\\Windows Media Device Manager\\Plugins\\SP\\MSPMSP"
  31. #define STR_MDSPPROGID "MDServiceProvider.MDServiceProvider"
  32. #define WCS_PMID_SOFT L"media.id"
  33. extern DWORD DoRegisterDeviceInterface(HWND hWnd, GUID InterfaceClassGuid, HDEVNOTIFY *hDevNotify);
  34. extern BOOL DoUnregisterDeviceInterface(HDEVNOTIFY hDev);
  35. extern void MDSPProcessDeviceChange(WPARAM wParam, LPARAM lParam);
  36. extern void MDSPNotifyDeviceConnection(WCHAR *wcsDeviceName, BOOL nIsConnect);
  37. extern HRESULT wcsParseDeviceName(WCHAR *wcsIn, WCHAR *wcsOut, DWORD dwNumCharsInOutBuffer);
  38. extern HRESULT GetFileSizeRecursiveA(char *szPath, DWORD *pdwSizeLow, DWORD *pdwSizeHigh);
  39. extern HRESULT GetFileSizeRecursiveW(WCHAR *wcsPath, DWORD *pdwSizeLow, DWORD *pdwSizeHigh);
  40. extern HRESULT DeleteFileRecursiveA(char *szPath);
  41. extern HRESULT DeleteFileRecursiveW(WCHAR *wcsPath);
  42. extern HRESULT SetGlobalDeviceStatus(WCHAR *wcsName, DWORD dwStat, BOOL bClear);
  43. extern HRESULT GetGlobalDeviceStatus(WCHAR *wcsNameIn, DWORD *pdwStat);
  44. extern BOOL IsIomegaDrive(LPSTR szDL);
  45. extern UINT __stdcall UtilGetDriveType(LPSTR szDL);
  46. extern BOOL IsWinNT();
  47. extern BOOL UtilSetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes);
  48. extern DWORD UtilGetFileAttributesW(LPCWSTR lpFileName);
  49. extern BOOL UtilCreateDirectoryW(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  50. extern HANDLE UtilCreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
  51. extern BOOL UtilMoveFileW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName);
  52. extern HRESULT QuerySubFoldersAndFiles(LPCWSTR szCurrentFolder, DWORD *pdwAttr);
  53. extern DWORD g_dwStartDrive;
  54. extern HINSTANCE g_hinstance;
  55. extern MDSPNOTIFYINFO g_NotifyInfo[MDSP_MAX_DEVICE_OBJ];
  56. extern MDSPGLOBALDEVICEINFO g_GlobalDeviceInfo[MDSP_MAX_DEVICE_OBJ];
  57. extern WCHAR g_wcsBackslash[2];
  58. #define BACKSLASH_STRING_LENGTH (ARRAYSIZE(g_wcsBackslash)-1)
  59. extern CHAR g_szBackslash[2];
  60. #define BACKSLASH_SZ_STRING_LENGTH (ARRAYSIZE(g_szBackslash)-1)
  61. extern CComMultiThreadModel::AutoCriticalSection g_CriticalSection;
  62. extern CSecureChannelServer *g_pAppSCServer;
  63. extern BOOL g_bIsWinNT;
  64. // The following are copied from drmerr.h
  65. #define fFalse 0
  66. #define fTrue 1
  67. #define hrOK HRESULT(S_OK)
  68. #define hrTrue HRESULT(S_OK)
  69. #define hrFalse ResultFromScode(S_FALSE)
  70. #define hrFail ResultFromScode(E_FAIL)
  71. #define hrNotImpl ResultFromScode(E_NOTIMPL)
  72. #define hrNoInterface ResultFromScode(E_NOINTERFACE)
  73. #define hrNoMem WMDM_E_BUFFERTOOSMALL
  74. #define hrAbort ResultFromScode(E_ABORT)
  75. #define hrInvalidArg ResultFromScode(E_INVALIDARG)
  76. /*----------------------------------------------------------------------------
  77. CORg style error handling
  78. (Historicaly stands for Check OLE Result and Goto)
  79. ----------------------------------------------------------------------------*/
  80. #define DebugMessageCPRg(pwszFile, nLine)
  81. #define DebugMessageCORg(pwszFile, nLine, hr)
  82. #define DebugMessageCFRg(pwszFile, nLine)
  83. #define DebugMessageCADORg(pwszFile, nLine, hr)
  84. #define _UNITEXT(quote) L##quote
  85. #define UNITEXT(quote) _UNITEXT(quote)
  86. #define CPRg(p)\
  87. do\
  88. {\
  89. if (!(p))\
  90. {\
  91. DebugMessageCPRg(UNITEXT(__FILE__), __LINE__);\
  92. hr = hrNoMem;\
  93. goto Error;\
  94. }\
  95. }\
  96. while (fFalse)
  97. #define CHRg(hResult) CORg(hResult)
  98. #define CORg(hResult)\
  99. do\
  100. {\
  101. hr = (hResult);\
  102. if (FAILED(hr))\
  103. {\
  104. DebugMessageCORg(UNITEXT(__FILE__), __LINE__, hr);\
  105. goto Error;\
  106. }\
  107. }\
  108. while (fFalse)
  109. #define CADORg(hResult)\
  110. do\
  111. {\
  112. hr = (hResult);\
  113. if (hr!=S_OK && hr!=S_FALSE)\
  114. {\
  115. hr = HRESULT_FROM_ADO_ERROR(hr);\
  116. DebugMessageCADORg(UNITEXT(__FILE__), __LINE__, hr);\
  117. goto Error;\
  118. }\
  119. }\
  120. while (fFalse)
  121. #define CORgl(label, hResult)\
  122. do\
  123. {\
  124. hr = (hResult);\
  125. if (FAILED(hr))\
  126. {\
  127. DebugMessageCORg(UNITEXT(__FILE__), __LINE__, hr);\
  128. goto label;\
  129. }\
  130. }\
  131. while (fFalse)
  132. #define CWRg(fResult)\
  133. {\
  134. if (!(fResult))\
  135. {\
  136. hr = GetLastError();\
  137. if (!(hr & 0xFFFF0000)) hr = HRESULT_FROM_WIN32(hr);\
  138. DebugMessageCORg(UNITEXT(__FILE__), __LINE__, hr);\
  139. goto Error;\
  140. }\
  141. }
  142. #define CWRgl(label, fResult)\
  143. {\
  144. if (!(fResult))\
  145. {\
  146. hr = GetLastError();\
  147. if (!(hr & 0xFFFF0000)) hr = HRESULT_FROM_WIN32(hr);\
  148. DebugMessageCORg(UNITEXT(__FILE__), __LINE__, hr);\
  149. goto label;\
  150. }\
  151. }
  152. #define CFRg(fResult)\
  153. {\
  154. if (!(fResult))\
  155. {\
  156. DebugMessageCFRg(UNITEXT(__FILE__), __LINE__);\
  157. hr = hrFail;\
  158. goto Error;\
  159. }\
  160. }
  161. #define CFRgl(label, fResult)\
  162. {\
  163. if (!(fResult))\
  164. {\
  165. DebugMessageCFRg(UNITEXT(__FILE__), __LINE__);\
  166. hr = hrFail;\
  167. goto label;\
  168. }\
  169. }
  170. #define CARg(p)\
  171. do\
  172. {\
  173. if (!(p))\
  174. {\
  175. hr = hrInvalidArg;\
  176. goto Error;\
  177. }\
  178. }\
  179. while (fFalse)
  180. #endif // __MDSPDEFS_H__