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.

161 lines
4.2 KiB

  1. // COMDLL.h -- Component Object Model plumbing for the Storage DLL
  2. //
  3. // ------------------------------
  4. // History:
  5. //
  6. // 96/10/08; RonM; Created
  7. // ------------------------------
  8. // DLL Exports
  9. //
  10. // Note the { extern "C" } qualifiers. They're necessary to mark these as C declarations
  11. // rather than C++ declarations.
  12. extern "C" BOOL WINAPI DllMain(HMODULE hInst, ULONG ul_reason_for_call, LPVOID lpReserved);
  13. extern "C" STDAPI DllRegisterServer(void);
  14. extern "C" STDAPI DllUnregisterServer(void);
  15. extern "C" STDAPI DllCanUnloadNow();
  16. extern "C" STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv);
  17. extern CImpITUnknown *g_pImpITFileSystemList;
  18. extern CImpITUnknown *g_pFSLockBytesFirstActive;
  19. extern CImpITUnknown *g_pStrmLockBytesFirstActive;
  20. extern CImpITUnknown *g_pImpIFSStorageList;
  21. /* GUID formats for the MVStorage class ID:
  22. {5D02926A-212E-11d0-9DF9-00A0C922E6EC}
  23. // {5D02926A-212E-11d0-9DF9-00A0C922E6EC}
  24. static const GUID <<name>> =
  25. { 0x5d02926a, 0x212e, 0x11d0, { 0x9d, 0xf9, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xec } };
  26. // {5D02926A-212E-11d0-9DF9-00A0C922E6EC}
  27. DEFINE_GUID(<<name>>,
  28. 0x5d02926a, 0x212e, 0x11d0, 0x9d, 0xf9, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xec);
  29. // {5D02926A-212E-11d0-9DF9-00A0C922E6EC}
  30. IMPLEMENT_OLECREATE(<<class>>, <<external_name>>,
  31. 0x5d02926a, 0x212e, 0x11d0, 0x9d, 0xf9, 0x0, 0xa0, 0xc9, 0x22, 0xe6, 0xec);
  32. */
  33. #define CLASS_NAME "MSITFS"
  34. #define CLASS_NAMEW L"MSITFS"
  35. #define CURRENT_VERSION "MSITFS1.0"
  36. #define CLASS_NAME_MK "MSITStore"
  37. #define CLASS_NAMEW_MK L"MSITStore"
  38. #define CURRENT_VERSION_MK "MSITStore1.0"
  39. #define CLASS_NAME_ITS "ITSProtocol"
  40. #define CLASS_NAMEW_ITS L"ITSProtocol"
  41. #define CURRENT_VERSION_ITS "ITSProtocol1.0"
  42. #define CLASS_NAME_FS "MSFSStore"
  43. #define CLASS_NAMEW_FS L"MSFSStore"
  44. #define CURRENT_VERSION_FS "MSFSStore1.0"
  45. extern CITCriticalSection g_csITFS;
  46. class CServerState
  47. {
  48. public:
  49. static CServerState *CreateServerState(HMODULE hInst);
  50. ~CServerState();
  51. INT ObjectAdded();
  52. INT ObjectReleased();
  53. INT LockServer();
  54. INT UnlockServer();
  55. BOOL CanUnloadNow();
  56. HMODULE ModuleInstance();
  57. IMalloc *OLEAllocator();
  58. private:
  59. CServerState(HANDLE hInst);
  60. BOOL InitServerState();
  61. INT m_cObjectsActive;
  62. INT m_cLocksActive;
  63. HMODULE m_hModule;
  64. IMalloc *m_pIMalloc;
  65. CITCriticalSection m_cs;
  66. };
  67. inline CServerState::CServerState(HANDLE hModule)
  68. {
  69. m_cObjectsActive = 0;
  70. m_cLocksActive = 0;
  71. m_pIMalloc = NULL;
  72. m_hModule = (HMODULE) hModule;
  73. DEBUGCODE(CITUnknown::OpenReferee();)
  74. }
  75. inline CServerState::~CServerState()
  76. {
  77. RonM_ASSERT(CanUnloadNow());
  78. if (m_pIMalloc)
  79. m_pIMalloc->Release();
  80. }
  81. inline IMalloc *CServerState::OLEAllocator()
  82. {
  83. return m_pIMalloc;
  84. }
  85. inline HMODULE CServerState::ModuleInstance()
  86. {
  87. return m_hModule;
  88. }
  89. extern CServerState *pDLLServerState;
  90. inline IMalloc *OLEHeap()
  91. {
  92. RonM_ASSERT(pDLLServerState);
  93. RonM_ASSERT(pDLLServerState->OLEAllocator());
  94. return pDLLServerState->OLEAllocator();
  95. }
  96. // Typedefs and global pointers for IE 4.0 APIs which we use.
  97. typedef HRESULT (STDAPICALLTYPE *PFindMimeFromData)
  98. (LPBC pBC, // bind context - can be NULL
  99. LPCWSTR pwzUrl, // url - can be null
  100. LPVOID pBuffer, // buffer with data to sniff - can be null (pwzUrl must be valid)
  101. DWORD cbSize, // size of buffer
  102. LPCWSTR pwzMimeProposed, // proposed mime if - can be null
  103. DWORD dwMimeFlags, // will be determined
  104. LPWSTR *ppwzMimeOut, // the suggested mime
  105. DWORD dwReserved // must be 0
  106. );
  107. extern PFindMimeFromData pFindMimeFromData;
  108. extern BOOL g_fDBCSSystem;
  109. inline BOOL IS_IE4 () { return (pFindMimeFromData != NULL); }
  110. inline BOOL DBCS_SYSTEM() { return g_fDBCSSystem; }
  111. #define NT_System 0
  112. #define Unknown_System 1
  113. #define Win32s_System 2
  114. #define Win95_System 3
  115. extern UINT iSystemType;
  116. inline BOOL Is_NT_System () { return (iSystemType == NT_System); }
  117. inline BOOL Is_Win32s_System() { return (iSystemType == Win32s_System); }
  118. inline BOOL Is_Win95_System () { return (iSystemType == Win95_System); }
  119. extern UINT cp_Default;
  120. inline UINT CP_USER_DEFAULT() { return cp_Default; }