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.

152 lines
5.0 KiB

  1. //
  2. // Microsoft Windows Media Technologies
  3. // � 1999 Microsoft Corporation. All rights reserved.
  4. //
  5. // Refer to your End User License Agreement for details on your rights/restrictions to use these sample files.
  6. //
  7. // MSHDSP.DLL is a sample WMDM Service Provider(SP) that enumerates fixed drives.
  8. // This sample shows you how to implement an SP according to the WMDM documentation.
  9. // This sample uses fixed drives on your PC to emulate portable media, and
  10. // shows the relationship between different interfaces and objects. Each hard disk
  11. // volume is enumerated as a device and directories and files are enumerated as
  12. // Storage objects under respective devices. You can copy non-SDMI compliant content
  13. // to any device that this SP enumerates. To copy an SDMI compliant content to a
  14. // device, the device must be able to report a hardware embedded serial number.
  15. // Hard disks do not have such serial numbers.
  16. //
  17. // To build this SP, you are recommended to use the MSHDSP.DSP file under Microsoft
  18. // Visual C++ 6.0 and run REGSVR32.EXE to register the resulting MSHDSP.DLL. You can
  19. // then build the sample application from the WMDMAPP directory to see how it gets
  20. // loaded by the application. However, you need to obtain a certificate from
  21. // Microsoft to actually run this SP. This certificate would be in the KEY.C file
  22. // under the INCLUDE directory for one level up.
  23. #ifndef __MDSPDEFS_H__
  24. #define __MDSPDEFS_H__
  25. #if _MSC_VER >= 1000
  26. #pragma once
  27. #endif // _MSC_VER >= 1000
  28. #include "scserver.h"
  29. typedef struct {
  30. BOOL bValid;
  31. WCHAR wcsDevName[32];
  32. DWORD dwStatus;
  33. LPVOID pIMDSPStorageGlobals;
  34. } MDSPGLOBALDEVICEINFO;
  35. #define DRIVE_LYRA_TYPE 0xFF
  36. #define LYRA_START_DRIVE_NUM 2
  37. #define WMDM_WAVE_FORMAT_ALL (WORD)0xFFFF
  38. #define WCS_MIME_TYPE_ALL L"*/*"
  39. #define MDSP_MAX_DRIVE_COUNT 26
  40. #define MDSP_MAX_DEVICE_OBJ 64
  41. #define STR_MDSPREG "Software\\Microsoft\\Windows Media Device Manager\\Plugins\\SP\\LyraSP"
  42. #define STR_MDSPPROGID "MDServiceProviderLyra.MDServiceProviderLyra"
  43. #define ALSO_CHECK_FILES
  44. extern void wcsParseDeviceName(WCHAR *wcsIn, WCHAR **wcsOut);
  45. extern HRESULT GetFileSizeRecursive(char *szPath, DWORD *pdwSizeLow, DWORD *pdwSizeHigh);
  46. extern HRESULT DeleteFileRecursive(char *szPath);
  47. extern HRESULT SetGlobalDeviceStatus(WCHAR *wcsName, DWORD dwStat, BOOL bClear);
  48. extern HRESULT GetGlobalDeviceStatus(WCHAR *wcsNameIn, DWORD *pdwStat);
  49. extern UINT __stdcall UtilGetLyraDriveType(LPSTR szDL);
  50. extern BOOL IsWinNT();
  51. extern BOOL UtilSetFileAttributesW(LPCWSTR lpFileName, DWORD dwFileAttributes);
  52. extern DWORD UtilGetFileAttributesW(LPCWSTR lpFileName);
  53. extern HRESULT QuerySubFoldersAndFiles(LPCWSTR szCurrentFolder, DWORD *pdwAttr);
  54. extern BOOL UtilCreateDirectoryW(LPCWSTR lpPathName, LPSECURITY_ATTRIBUTES lpSecurityAttributes);
  55. extern HANDLE UtilCreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile);
  56. extern BOOL UtilMoveFileW(LPCWSTR lpExistingFileName, LPCWSTR lpNewFileName);
  57. extern HRESULT DeleteFileRecursiveA(char *szPath);
  58. extern HRESULT DeleteFileRecursiveW(WCHAR *wcsPath);
  59. extern HINSTANCE g_hinstance;
  60. extern MDSPGLOBALDEVICEINFO g_GlobalDeviceInfo[MDSP_MAX_DEVICE_OBJ];
  61. extern WCHAR g_wcsBackslash[];
  62. extern CHAR g_szBackslash[];
  63. extern CSecureChannelServer *g_pAppSCServer;
  64. extern CComMultiThreadModel::AutoCriticalSection g_CriticalSection;
  65. extern BOOL g_bIsWinNT;
  66. #define fFalse 0
  67. #define fTrue 1
  68. #define hrOK HRESULT(S_OK)
  69. #define hrTrue HRESULT(S_OK)
  70. #define hrFalse ResultFromScode(S_FALSE)
  71. #define hrFail ResultFromScode(E_FAIL)
  72. #define hrNotImpl ResultFromScode(E_NOTIMPL)
  73. #define hrNoInterface ResultFromScode(E_NOINTERFACE)
  74. #define hrNoMem WMDM_E_BUFFERTOOSMALL
  75. #define hrAbort ResultFromScode(E_ABORT)
  76. #define hrInvalidArg ResultFromScode(E_INVALIDARG)
  77. /*----------------------------------------------------------------------------
  78. CORg style error handling
  79. (Historicaly stands for Check OLE Result and Goto)
  80. ----------------------------------------------------------------------------*/
  81. #define CPRg(p)\
  82. do\
  83. {\
  84. if (!(p))\
  85. {\
  86. hr = hrNoMem;\
  87. goto Error;\
  88. }\
  89. }\
  90. while (fFalse)
  91. #define CHRg(hResult) CORg(hResult)
  92. #define CORg(hResult)\
  93. do\
  94. {\
  95. hr = (hResult);\
  96. if (FAILED(hr))\
  97. {\
  98. goto Error;\
  99. }\
  100. }\
  101. while (fFalse)
  102. #define CWRg(fResult)\
  103. {\
  104. if (!(fResult))\
  105. {\
  106. hr = GetLastError();\
  107. if (!(hr & 0xFFFF0000)) hr = HRESULT_FROM_WIN32(hr);\
  108. goto Error;\
  109. }\
  110. }
  111. #define CFRg(fResult)\
  112. {\
  113. if (!(fResult))\
  114. {\
  115. hr = hrFail;\
  116. goto Error;\
  117. }\
  118. }
  119. #define CARg(p)\
  120. do\
  121. {\
  122. if (!(p))\
  123. {\
  124. hr = hrInvalidArg;\
  125. goto Error;\
  126. }\
  127. }\
  128. while (fFalse)
  129. #endif // __MDSPDEFS_H__