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.

224 lines
7.2 KiB

  1. /* agfxsp.h
  2. * header for agfxs.cpp
  3. * Copyright (c) 2000-2001 Microsoft Corporation
  4. */
  5. #define ZONETYPE_RENDER 1
  6. #define ZONETYPE_CAPTURE 2
  7. #define ZONETYPE_RENDERCAPTURE 3
  8. typedef CList<class CGfxFactory*, class CGfxFactory*> CListGfxFactories;
  9. typedef CList<class CZoneFactory*, class CZoneFactory*> CListZoneFactories;
  10. typedef CList<class CLmAutoLoad*, class CLmAutoLoad*> CListLmAutoLoads;
  11. typedef CList<class CCuUserLoad*, class CCuUserLoad*> CListCuUserLoads;
  12. //=== CUser ===
  13. class CUser {
  14. public:
  15. CUser(void);
  16. ~CUser(void);
  17. BOOL operator==(const CUser &other);
  18. PSID GetSid(void);
  19. LONG Initialize(DWORD SessionId);
  20. LONG RegOpen(IN REGSAM samDesired, OUT PHKEY phkResult);
  21. private:
  22. void CloseUserRegistry(void);
  23. BOOL OpenUserRegistry(void);
  24. HANDLE m_hUserToken;
  25. DWORD m_SessionId;
  26. PSID m_pSid;
  27. CRITICAL_SECTION m_csRegistry;
  28. BOOL m_fcsRegistry;
  29. LONG m_refRegistry;
  30. HKEY m_hRegistry;
  31. };
  32. //=== CCuUserLoad ===
  33. class CCuUserLoad {
  34. public:
  35. CCuUserLoad(CUser *pUser);
  36. ~CCuUserLoad(void);
  37. LONG AddToZoneGraph(CZoneFactory *pZoneFactory);
  38. LONG CreateFromAutoLoad(ULONG CuAutoLoadId);
  39. LONG CreateFromUser(PCTSTR GfxFactoryDi, PCTSTR ZoneFactoryDi, ULONG Type, ULONG Order);
  40. LONG Erase(void);
  41. HANDLE GetFilterHandle(void);
  42. PCTSTR GetGfxFactoryDi(void);
  43. LONG GetGfxFactoryClsid(CListGfxFactories &rlistGfxFactories, LPCLSID pClsid);
  44. DWORD GetId(void);
  45. ULONG GetOrder(void);
  46. ULONG GetType(void);
  47. PCTSTR GetZoneFactoryDi(void);
  48. LONG Initialize(PCTSTR pstrCuAutoLoad);
  49. LONG ModifyOrder(ULONG NewOrder);
  50. LONG RegCreateFilterKey(IN PCTSTR SubKey, IN REGSAM samDesired, OUT PHKEY phkResult);
  51. LONG RegOpenFilterKey(IN PCTSTR SubKey, IN REGSAM samDesired, OUT PHKEY phkResult);
  52. void RemoveFromZoneGraph(void);
  53. LONG Scan(CListZoneFactories &rlistZoneFactories, CListGfxFactories &rlistGfxFactories);
  54. LONG Write(void);
  55. static void FillListFromReg(CUser *pUser, CListCuUserLoads& rlistCuUserLoads);
  56. static void ListRemoveGfxFactoryDi(IN CListCuUserLoads &rlistCuUserLoads, IN PCTSTR DeviceInterface);
  57. static void ListRemoveZoneFactoryDi(IN CListCuUserLoads &rlistCuUserLoads, IN PCTSTR DeviceInterface);
  58. static void ListRemoveZoneFactoryDiCapture(IN CListCuUserLoads &rlistCuUserLoads, IN PCTSTR DeviceInterface);
  59. static void ListRemoveZoneFactoryDiRender(IN CListCuUserLoads &rlistCuUserLoads, IN PCTSTR DeviceInterface);
  60. static void ScanList(CListCuUserLoads& rlistCuUsrLoads, CListZoneFactories& rlistZoneFactories, CListGfxFactories& rlistGfxFactories);
  61. private:
  62. LONG AddGfxToGraph(void);
  63. LONG ChangeGfxOrderInGraph(IN ULONG NewOrder);
  64. LONG RemoveFromGraph(void);
  65. BOOL WinsConflictWith(CCuUserLoad *pOther);
  66. CUser *m_User;
  67. ULONG m_CuUserLoadId;
  68. ULONG m_CuAutoLoadId;
  69. PTSTR m_GfxFactoryDi;
  70. PTSTR m_ZoneFactoryDi;
  71. ULONG m_Type;
  72. ULONG m_Order;
  73. HANDLE m_FilterHandle;
  74. LONG m_ErrorFilterCreate;
  75. CZoneFactory *m_pZoneFactory;
  76. POSITION m_posZoneGfxList;
  77. };
  78. //=== CCuAutoLoad ===
  79. class CCuAutoLoad {
  80. public:
  81. CCuAutoLoad(CUser *pUser);
  82. ~CCuAutoLoad(void);
  83. LONG Create(PCTSTR ZoneFactoryDi, ULONG LmAutoLoadId);
  84. LONG Erase(void);
  85. PCTSTR GetGfxFactoryDi(void);
  86. ULONG GetLmAutoLoadId(void);
  87. ULONG GetType(void);
  88. PCTSTR GetZoneFactoryDi(void);
  89. LONG Initialize(ULONG CuAutoLoadId);
  90. LONG Write(void);
  91. static void ScanReg(IN CUser *pUser, IN PCTSTR ZoneFactoryDi, IN ULONG LmAutoLoadId, IN CListCuUserLoads &rlistCuUserLoads);
  92. private:
  93. CUser *m_User;
  94. ULONG m_CuAutoLoadId;
  95. ULONG m_LmAutoLoadId;
  96. PTSTR m_ZoneFactoryDi;
  97. PTSTR m_GfxFactoryDi;
  98. ULONG m_Type;
  99. };
  100. //=== CLmAutoLoad ===
  101. class CLmAutoLoad {
  102. public:
  103. CLmAutoLoad(void);
  104. ~CLmAutoLoad(void);
  105. LONG Create(DWORD Id, PCTSTR GfxFactoryDi, PCTSTR HardwareId, PCTSTR ReferenceString, ULONG Type);
  106. LONG Erase(void);
  107. PCTSTR GetGfxFactoryDi(void);
  108. ULONG GetType(void);
  109. LONG Initialize(DWORD Id);
  110. BOOL IsCompatibleZoneFactory(CZoneFactory& rZoneFactory);
  111. LONG Write(void);
  112. static CListLmAutoLoads* CreateListFromReg(void);
  113. static void DestroyList(CListLmAutoLoads* pListLmAutoLoads);
  114. static void ScanRegOnGfxFactory(CUser *pUser, CGfxFactory& rGfxFactory, CListZoneFactories &rlistZoneFactories, CListCuUserLoads &rlistCuUserLoads);
  115. static void ScanRegOnZoneFactory(CUser *pUser, CZoneFactory& rZoneFactory, CListGfxFactories &rlistGfxFactories, CListCuUserLoads &rlistCuUserLoads);
  116. private:
  117. DWORD m_Id;
  118. PTSTR m_GfxFactoryDi;
  119. PTSTR m_HardwareId;
  120. PTSTR m_ReferenceString;
  121. ULONG m_Type;
  122. };
  123. //=== CInfAutoLoad ===
  124. class CInfAutoLoad {
  125. public:
  126. CInfAutoLoad();
  127. ~CInfAutoLoad();
  128. LONG Initialize(HKEY hkey, CGfxFactory *pGfxFactory);
  129. LONG Scan(void);
  130. static LONG ScanReg(HKEY hkey, CGfxFactory *pGfxFactory);
  131. private:
  132. CGfxFactory *m_pGfxFactory;
  133. HKEY m_hkey;
  134. DWORD m_Id;
  135. DWORD m_NewAutoLoad;
  136. PTSTR m_GfxFactoryDi;
  137. PTSTR m_HardwareId;
  138. PTSTR m_ReferenceString;
  139. ULONG m_Type;
  140. };
  141. //=== CGfxFactory ===
  142. class CGfxFactory {
  143. public:
  144. CGfxFactory();
  145. ~CGfxFactory();
  146. REFCLSID GetClsid(void);
  147. PCTSTR GetDeviceInterface(void);
  148. CListLmAutoLoads& GetListLmAutoLoads(void);
  149. LONG Initialize(HKEY hkey, PCTSTR DeviceInterface);
  150. BOOL IsCompatibleZoneFactory(IN ULONG Type, IN CZoneFactory& rZoneFactory);
  151. static void ListRemoveGfxFactoryDi(IN CListGfxFactories &rlistGfxFactories, IN PCTSTR DeviceInterface);
  152. static CGfxFactory* ListSearchOnDi(IN CListGfxFactories& rlistGfxFactories, IN PCTSTR GfxFactoryDi);
  153. private:
  154. CListLmAutoLoads *m_plistLmAutoLoads;
  155. PTSTR m_DeviceInterface;
  156. CLSID m_Clsid;
  157. };
  158. //=== CZoneFactory ===
  159. class CZoneFactory {
  160. public:
  161. CZoneFactory(void);
  162. ~CZoneFactory(void);
  163. LONG AddType(IN ULONG Type);
  164. PCTSTR GetDeviceInterface(void);
  165. PCTSTR GetTargetHardwareId(void);
  166. BOOL HasHardwareId(IN PCTSTR HardwareId);
  167. BOOL HasReferenceString(IN PCTSTR ReferenceString);
  168. BOOL HasCompatibleType(IN ULONG Type);
  169. LONG Initialize(IN PCTSTR DeviceInterface, IN ULONG Type);
  170. LONG RemoveType(IN ULONG Type);
  171. static void ListRemoveZoneFactoryDi(IN CListZoneFactories &rlistZoneFactories, IN PCTSTR DeviceInterface);
  172. static void ListRemoveZoneFactoryDiCapture(IN CListZoneFactories &rlistZoneFactories, IN PCTSTR DeviceInterface);
  173. static void ListRemoveZoneFactoryDiRender(IN CListZoneFactories &rlistZoneFactories, IN PCTSTR DeviceInterface);
  174. static CZoneFactory* ListSearchOnDi(IN CListZoneFactories& rlistZoneFactories, IN PCTSTR ZoneFactoryDi);
  175. CListCuUserLoads m_listCaptureGfxs;
  176. CListCuUserLoads m_listRenderGfxs;
  177. private:
  178. PTSTR m_DeviceInterface;
  179. PTSTR m_HardwareId;
  180. PTSTR m_ReferenceString;
  181. ULONG m_Type;
  182. };