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.

408 lines
16 KiB

  1. //////////////////////////////////////////////////////////////////////////////////////////////
  2. //
  3. // InformationManager.h
  4. //
  5. // Copyright (C) 1998, 1999 Microsoft Corporation. All rights reserved.
  6. //
  7. // Abstract :
  8. //
  9. // This is the header file for the CInformationManager class used by the Application
  10. // Manager. It is a private class that will never be distributed to the public.
  11. //
  12. //
  13. // History :
  14. //
  15. // 05/06/1999 luish Created
  16. //
  17. //////////////////////////////////////////////////////////////////////////////////////////////
  18. #ifndef __INFORMATIONMANAGER_
  19. #define __INFORMATIONMANAGER_
  20. #ifdef __cplusplus
  21. extern "C" {
  22. #endif
  23. #include <objbase.h>
  24. #include "ApplicationManager.h"
  25. #include "AppPropertyRules.h"
  26. #include "Win32API.h"
  27. //////////////////////////////////////////////////////////////////////////////////////////////
  28. #define REG_VERSION 0x00000004
  29. #ifndef UNLEN
  30. #define UNLEN 256
  31. #endif
  32. //
  33. // Defines used as mask for the dwValidFields data member
  34. //
  35. #define DATA_FIELD_GUID 0x00000001
  36. #define DATA_FIELD_SIGNATURE 0x00000002
  37. #define DATA_FIELD_COMPANYNAME 0x00000004
  38. #define DATA_FIELD_VERSION 0x00000008
  39. #define DATA_FIELD_TYPE 0x00000010
  40. #define DATA_FIELD_STATE 0x00000020
  41. #define DATA_FIELD_CATEGORY 0x00000040
  42. #define DATA_FIELD_INSTALLCOST 0x00000080
  43. #define DATA_FIELD_REINSTALLCOUNT 0x00000100
  44. #define DATA_FIELD_USAGECOUNT 0x00000200
  45. #define DATA_FIELD_INSTALLDATE 0x00000400
  46. #define DATA_FIELD_LASTUSEDDATE 0x00000800
  47. #define DATA_FIELD_NONREMOVABLESIZE 0x00001000
  48. #define DATA_FIELD_REMOVABLESIZE 0x00002000
  49. #define DATA_FIELD_RESERVEDSIZE 0x00004000
  50. #define DATA_FIELD_ROOTPATH 0x00008000
  51. #define DATA_FIELD_SETUPROOTPATH 0x00010000
  52. #define DATA_FIELD_EXECUTECMDLINE 0x00020000
  53. #define DATA_FIELD_SETUPINTERFACECLSID 0x00040000
  54. #define DATA_FIELD_DOWNSIZECMDLINE 0x00080000
  55. #define DATA_FIELD_REINSTALLCMDLINE 0x00100000
  56. #define DATA_FIELD_UNINSTALLCMDLINE 0x00200000
  57. #define DATA_FIELD_SELFTESTCMDLINE 0x00400000
  58. #define DATA_FIELD_CUSTOMIZECMDLINE 0x00800000
  59. #define DATA_FIELD_DEVICEGUID 0x01000000
  60. #define DATA_FIELD_WEBURL 0x02000000
  61. #define DATA_FIELD_ICONPATH 0x04000000
  62. //
  63. // Defines used to define the device type
  64. //
  65. #define DEVICE_NONE 0x00000000
  66. #define DEVICE_FIXED 0x00000001
  67. #define DEVICE_REMOVABLE 0x00000002
  68. #define DEVICE_NETWORK 0x00000004
  69. #define DEVICE_RAMDISK 0x00000008
  70. //
  71. // Wait events
  72. //
  73. #define WAIT_FINALIZE_DOWNSIZE 0x00000000
  74. #define WAIT_FINALIZE_REINSTALL 0x00000001
  75. #define WAIT_FINALIZE_UNINSTALL 0x00000002
  76. #define WAIT_FINALIZE_SELFTEST 0x00000003
  77. #define WAIT_EVENT_COUNT 0x00000004
  78. //
  79. // Misc defines
  80. //
  81. #define BAD_REFERENCE_COUNT 0xffffffff
  82. #define BAD_INDEX 0xffffffff
  83. //
  84. // These defines are used to denote the initialization level of an CApplicationInfo object
  85. //
  86. #define INIT_LEVEL_NONE 0x00000001
  87. #define INIT_LEVEL_BASIC 0x00000002
  88. #define INIT_LEVEL_TOTAL 0x00000004
  89. //////////////////////////////////////////////////////////////////////////////////////////////
  90. typedef struct // sizeof(SYNC_INFO) = 28 bytes
  91. {
  92. DWORD dwSize;
  93. DWORD dwStructId;
  94. DWORD dwReserved;
  95. SYSTEMTIME stDate;
  96. GUID sSynchronizationGuid;
  97. } SYNC_INFO, *LPSYNC_INFO;
  98. //////////////////////////////////////////////////////////////////////////////////////////////
  99. typedef struct
  100. {
  101. DWORD dwSize;
  102. DWORD dwStructId;
  103. DWORD dwReserved;
  104. GUID guidInstanceGuid;
  105. DWORD dwLockCount;
  106. } LOCK_INFO, *LPLOCK_INFO;
  107. //////////////////////////////////////////////////////////////////////////////////////////////
  108. typedef struct
  109. {
  110. DWORD dwSize;
  111. DWORD dwStructId;
  112. DWORD dwReserved;
  113. DWORD dwEventCount[WAIT_EVENT_COUNT];
  114. GUID guidInstanceGuid;
  115. } WAIT_INFO, *LPWAIT_INFO;
  116. //////////////////////////////////////////////////////////////////////////////////////////////
  117. typedef struct // sizeof(TEMP_SPACE_INFO) = 524 bytes
  118. {
  119. DWORD dwSize;
  120. DWORD dwStructId;
  121. DWORD dwReserved;
  122. DWORD dwKilobytes;
  123. GUID sGuid;
  124. GUID sApplicationGuid;
  125. GUID sDeviceGuid;
  126. WCHAR wszDirectory[MAX_PATH_CHARCOUNT];
  127. } TEMP_SPACE_RECORD, *LPTEMP_SPACE_RECORD;
  128. //////////////////////////////////////////////////////////////////////////////////////////////
  129. typedef struct
  130. {
  131. DWORD dwSize;
  132. DWORD dwStructId;
  133. DWORD dwReserved;
  134. DWORD dwAssociationType;
  135. GUID sParentGuid;
  136. GUID sChildGuid;
  137. } ASSOCIATION_INFO, *LPASSOCIATION_INFO;
  138. //////////////////////////////////////////////////////////////////////////////////////////////
  139. typedef struct
  140. {
  141. DWORD dwSize;
  142. DWORD dwStructId;
  143. DWORD dwReserved;
  144. DWORD dwUsageCount;
  145. DWORD dwReInstallCount;
  146. DWORD dwInstallCost;
  147. SYSTEMTIME stInstallDate;
  148. SYSTEMTIME stLastUsedDate;
  149. } AGING_INFO, *LPAGING_INFO;
  150. //////////////////////////////////////////////////////////////////////////////////////////////
  151. typedef struct
  152. {
  153. DWORD dwSize;
  154. DWORD dwStructId;
  155. DWORD dwReserved;
  156. DWORD dwLowPropertyMask;
  157. DWORD dwHighPropertyMask;
  158. GUID sApplicationGuid;
  159. GUID sDeviceGuid;
  160. GUID sInstanceGuid;
  161. DWORD dwState;
  162. DWORD dwCategory;
  163. DWORD dwRemovableKilobytes;
  164. DWORD dwNonRemovableKilobytes;
  165. DWORD dwReservedKilobytes;
  166. DWORD dwPinState;
  167. } BASE_INFO, *LPBASE_INFO;
  168. //////////////////////////////////////////////////////////////////////////////////////////////
  169. typedef struct
  170. {
  171. BASE_INFO sBaseInfo;
  172. AGING_INFO sAgingInfo;
  173. ASSOCIATION_INFO sAssociation;
  174. WCHAR wszStringProperty[APP_STRING_COUNT][MAX_PATH_CHARCOUNT+1];
  175. } APPLICATION_DATA, *LPAPPLICATION_DATA;
  176. //////////////////////////////////////////////////////////////////////////////////////////////
  177. typedef struct // sizeof(DEVICE_INFO) = 32 bytes
  178. {
  179. DWORD dwSize;
  180. DWORD dwStructId;
  181. DWORD dwReserved;
  182. DWORD dwDeviceFlags;
  183. DWORD dwDeviceIndex;
  184. DWORD dwVolumeSerial;
  185. DWORD dwPercentCacheSize;
  186. DWORD dwPercentMinimumFreeSize;
  187. DWORD dwRemovableKilobytes;
  188. DWORD dwNonRemovableKilobytes;
  189. DWORD dwReservedKilobytes;
  190. DWORD dwApplicationCategoryExclusionMask;
  191. DWORD dwLastUsedThreshold;
  192. } DEVICE_INFO, *LPDEVICE_INFO;
  193. typedef struct // sizeof(DEVICE_SPACE_INFO) = 72 bytes
  194. {
  195. DWORD dwSize;
  196. DWORD dwStructId;
  197. DWORD dwReserved;
  198. DWORD dwTotalKilobytes;
  199. DWORD dwTotalFreeKilobytes;
  200. DWORD dwMinimumFreeKilobytes;
  201. DWORD dwTotalUsableFreeKilobytes;
  202. DWORD dwCacheSizeKilobytes;
  203. DWORD dwCacheUsedKilobytes;
  204. DWORD dwCacheFreeKilobytes;
  205. DWORD dwSlackSizeKilobytes;
  206. DWORD dwSlackUsedKilobytes;
  207. DWORD dwSlackFreeKilobytes;
  208. DWORD dwTotalRemovableKilobytes;
  209. DWORD dwTotalNonRemovableKilobytes;
  210. DWORD dwOptimalRemovableKilobytes;
  211. DWORD dwMaximumUsableKilobytes;
  212. DWORD dwOptimalUsableKilobytes;
  213. DWORD dwTotalReservedKilobytes;
  214. DWORD dwTotalReservedTemporaryKilobytes;
  215. DWORD dwTotalUsedTemporaryKilobytes;
  216. } DEVICE_SPACE_INFO, *LPDEVICE_SPACE_INFO;
  217. //////////////////////////////////////////////////////////////////////////////////////////////
  218. typedef struct // sizeof(APPLICATION_MANAGER_RECORD) = 32 bytes
  219. {
  220. DWORD dwSize;
  221. DWORD dwStructId;
  222. DWORD dwReserved;
  223. GUID sSystemGuid;
  224. DWORD dwAdvancedMode;
  225. } APPLICATION_MANAGER_RECORD, *LPAPPLICATION_MANAGER_RECORD;
  226. typedef struct // sizeof(DEVICE_RECORD) = 48 bytes
  227. {
  228. DWORD dwSize;
  229. DWORD dwStructId;
  230. DWORD dwReserved;
  231. GUID sDeviceGuid;
  232. DEVICE_INFO sDeviceInfo;
  233. } DEVICE_RECORD, *LPDEVICE_RECORD;
  234. //////////////////////////////////////////////////////////////////////////////////////////////
  235. //
  236. // CInformationManager
  237. //
  238. //////////////////////////////////////////////////////////////////////////////////////////////
  239. class CInformationManager
  240. {
  241. friend class CApplicationManagerAdmin;
  242. public :
  243. CInformationManager(void);
  244. ~CInformationManager(void);
  245. STDMETHOD (Initialize) (void);
  246. STDMETHOD (Shutdown) (void);
  247. STDMETHOD_(ULONG, AddRef) (void);
  248. STDMETHOD_(ULONG, Release) (void);
  249. STDMETHOD (GetAdvancedMode) (LPDWORD lpdwAdvancedMode);
  250. STDMETHOD (SetAdvancedMode) (DWORD dwAdvancedMode);
  251. STDMETHOD (GetOptimalAvailableSpace) (const DWORD dwApplicationCategory, LPDWORD lpdwOptimalKilobytes);
  252. STDMETHOD (GetMaximumAvailableSpace) (const DWORD dwApplicationCategory, LPDWORD lpdwMaximumKilobytes);
  253. STDMETHOD (GetSpace) (const DWORD dwApplicationCategory, const DWORD dwRequiredKilobytes, LPDWORD lpdwDeviceIndex);
  254. STDMETHOD (FreeSpaceOnDevice) (const GUID * lpDeviceGuid, const DWORD dwRequiredKilobytes);
  255. STDMETHOD (FixCacheOverrun) (const GUID * lpDeviceGuid, const DWORD dwExtraKilobytes);
  256. //STDMETHOD_(DWORD, GetApplicationAge) (LPAPPLICATION_DATA lpApplicationData);
  257. STDMETHOD (CheckApplicationExistance) (const LPAPPLICATION_DATA lpApplicationData);
  258. STDMETHOD (AddApplicationData) (LPAPPLICATION_DATA lpApplicationData, const GUID * lpInstanceGuid);
  259. STDMETHOD (RemoveApplicationData) (LPAPPLICATION_DATA lpApplicationData);
  260. STDMETHOD (GetApplicationDataWithIndex) (const DWORD dwApplicationIndex, LPAPPLICATION_DATA lpApplicationData);
  261. STDMETHOD (GetApplicationData) (LPAPPLICATION_DATA lpApplicationData);
  262. STDMETHOD (SetApplicationData) (LPAPPLICATION_DATA lpApplicationData, const GUID * lpInstanceGuid);
  263. STDMETHOD (SetApplicationState) (const LPAPPLICATION_DATA lpApplicationData, const GUID * lpInstanceGuid);
  264. STDMETHOD (AssignDeviceToApplication) (const DWORD dwDeviceIndex, LPAPPLICATION_DATA lpApplicationData);
  265. STDMETHOD (DownsizeApplication) (const DWORD dwRequiredKilobytes, const LPAPPLICATION_DATA lpApplicationData);
  266. STDMETHOD (ReInstallApplication) (const LPAPPLICATION_DATA lpApplicationData);
  267. STDMETHOD (UnInstallApplication) (const LPAPPLICATION_DATA lpApplicationData);
  268. STDMETHOD (UnInstallApplicationWait) (const LPAPPLICATION_DATA lpApplicationData);
  269. STDMETHOD (SelfTestApplication) (const LPAPPLICATION_DATA lpApplicationData);
  270. STDMETHOD (RunApplication) (const LPAPPLICATION_DATA lpApplicationData, const DWORD dwRunFlags, const DWORD dwStringMask, LPVOID lpData, const DWORD dwDataLen);
  271. STDMETHOD (PinApplication) (const LPAPPLICATION_DATA lpApplicationData, BOOL * lpfPinState);
  272. STDMETHOD (ReadyApplication) (const LPAPPLICATION_DATA lpApplicationData);
  273. STDMETHOD (DisableApplication) (const LPAPPLICATION_DATA lpApplicationData);
  274. STDMETHOD_(DWORD, GetPropertyIndex) (const DWORD dwProperty);
  275. STDMETHOD (IsValidApplicationProperty) (const DWORD dwProperty);
  276. STDMETHOD (ValidateApplicationPropertyWithIndex) (const DWORD dwPropertyIndex, LPAPPLICATION_DATA lpApplicationData);
  277. STDMETHOD (InvalidateApplicationPropertyWithIndex) (const DWORD dwPropertyIndex, LPAPPLICATION_DATA lpApplicationData);
  278. STDMETHOD (IsApplicationPropertyInitializedWithIndex) (const DWORD dwPropertyIndex, LPAPPLICATION_DATA lpApplicationData);
  279. STDMETHOD (DeleteDirectoryTree) (LPCSTR lpszDirectory);
  280. STDMETHOD (DeleteDirectoryTree) (LPCWSTR lpwszDirectory);
  281. STDMETHOD (RegInitialize) (void);
  282. STDMETHOD (RegFutureDirectoryCleanup) (LPCWSTR lpwszDirectory);
  283. STDMETHOD (InitializeWaitEvent) (LPAPPLICATION_DATA lpApplicationData, const DWORD dwWaitEvent);
  284. STDMETHOD (EnterWaitEvent) (LPAPPLICATION_DATA lpApplicationData, const DWORD dwWaitEvent, const GUID * lpInstanceGuid);
  285. STDMETHOD (LeaveWaitEvent) (LPAPPLICATION_DATA lpApplicationData, const DWORD dwWaitEvent);
  286. STDMETHOD (WaitForEventCompletion) (LPAPPLICATION_DATA lpApplicationData, const DWORD dwWaitEvent, const DWORD dwEntryMilliseconds, const DWORD dwExitMilliseconds);
  287. STDMETHOD (KillWaitEvent) (LPAPPLICATION_DATA lpApplicationData, const DWORD dwWaitEvent);
  288. STDMETHOD (CheckDeviceExistance) (const DWORD dwDeviceIndex);
  289. STDMETHOD_(BOOL, IsApplicationPinned) (const LPAPPLICATION_DATA lpApplicationData);
  290. STDMETHOD (IsInstanceGuidStillAlive) (const GUID * lpGuid);
  291. STDMETHOD (IsApplicationLocked) (LPAPPLICATION_DATA lpApplicationData);
  292. STDMETHOD (LockApplicationData) (LPAPPLICATION_DATA lpApplicationData, GUID * lpInstanceGuid);
  293. STDMETHOD (UnlockApplicationData) (LPAPPLICATION_DATA lpApplicationData, GUID * lpInstanceGuid);
  294. STDMETHOD (ForceUnlockApplicationData) (LPAPPLICATION_DATA lpApplicationData, GUID * lpInstanceGuid);
  295. STDMETHOD (LockApplicationData) (LPAPPLICATION_DATA lpApplicationData);
  296. STDMETHOD (UnlockApplicationData) (LPAPPLICATION_DATA lpApplicationData);
  297. STDMETHOD (LockParentApplications) (LPAPPLICATION_DATA lpApplicationData, GUID * lpInstanceGuid);
  298. STDMETHOD (UnlockParentApplications) (LPAPPLICATION_DATA lpApplicationData, GUID * lpInstanceGuid);
  299. STDMETHOD (LockParentApplications) (LPAPPLICATION_DATA lpApplicationData);
  300. STDMETHOD (UnlockParentApplications) (LPAPPLICATION_DATA lpApplicationData);
  301. STDMETHOD_(DWORD, GetDeviceIndex) (const DWORD dwVolumeSerial);
  302. STDMETHOD (AddDeviceWithIndex) (const DWORD dwDeviceIndex);
  303. STDMETHOD (RemoveDeviceWithIndex) (const DWORD dwDeviceIndex);
  304. STDMETHOD (UpdateDeviceInfoWithIndex) (const DWORD dwDeviceIndex);
  305. STDMETHOD (ScanDevices) (void);
  306. STDMETHOD (ScanDevices) (const DWORD dwDeviceIndex);
  307. STDMETHOD (GetDeviceInfo) (LPDEVICE_RECORD lpDeviceRecord);
  308. STDMETHOD (GetDeviceInfoWithIndex) (const DWORD dwDeviceIndex, LPDEVICE_RECORD lpDeviceRecord);
  309. STDMETHOD (SetDeviceInfoWithIndex) (const DWORD dwDeviceIndex, LPDEVICE_RECORD lpDeviceRecord);
  310. STDMETHOD (GetDeviceSpaceInfoWithIndex) (const DWORD dwDeviceIndex, LPDEVICE_SPACE_INFO lpDeviceSpaceInfo);
  311. STDMETHOD (GetDeviceOptimalSpaceWithIndex) (const DWORD dwDeviceIndex, LPDWORD lpdwKilobytes);
  312. STDMETHOD (GetDeviceMaximumSpaceWithIndex) (const DWORD dwDeviceIndex, LPDWORD lpdwKilobytes);
  313. STDMETHOD (FreeSpaceOnDeviceWithIndex) (const DWORD dwDeviceIndex, const DWORD dwRequiredKilobytes);
  314. STDMETHOD_(DWORD, GetAgingCount) (LPAPPLICATION_DATA lpApplicationData);
  315. STDMETHOD (GetOldestApplicationDataByDeviceWithIndex) (const DWORD dwDeviceIndex, LPAPPLICATION_DATA lpApplicationData);
  316. STDMETHOD (GetNextOldestApplicationDataByDeviceWithIndex) (const DWORD dwDeviceIndex, LPAPPLICATION_DATA lpApplicationData);
  317. STDMETHOD (AddTempSpace) (LPTEMP_SPACE_RECORD lpTempSpaceRecord);
  318. STDMETHOD (RemoveTempSpace) (LPTEMP_SPACE_RECORD lpTempSpaceRecord);
  319. STDMETHOD (EnumTempSpace) (const DWORD dwIndex, LPTEMP_SPACE_RECORD lpTempSpaceRecord);
  320. STDMETHOD (AddAssociation) (LPASSOCIATION_INFO lpAssociationInfo);
  321. STDMETHOD (RemoveAssociation) (LPASSOCIATION_INFO lpAssociationInfo);
  322. STDMETHOD (EnumAssociations) (const DWORD dwIndex, LPASSOCIATION_INFO lpAssociationInfo);
  323. private :
  324. STDMETHOD_(DWORD, GetExtraWaitEventEntryTime) (void);
  325. STDMETHOD_(DWORD, GetExtraWaitEventExitTime) (void);
  326. //
  327. // Private data members
  328. //
  329. LONG m_lInitializationIndex;
  330. CWin32API m_Win32API;
  331. CCriticalSection m_CriticalSection;
  332. };
  333. //////////////////////////////////////////////////////////////////////////////////////////////
  334. #ifdef __cplusplus
  335. }
  336. #endif
  337. #endif // __INFORMATIONMANAGER_