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.

142 lines
4.7 KiB

  1. #ifndef __INSTAPP_H_
  2. #define __INSTAPP_H_
  3. /////////////////////////////////////////////////////////////////////////////
  4. // CInstalledApp
  5. //
  6. // There are four classes of legacy applications...
  7. //
  8. // Uninstall keys can go into either HKLM or HKCU, on either the native
  9. // platform or the alternate platform.
  10. //
  11. // For Win64, the alternate platform is Win32.
  12. // For Win32, there is no alternate platform.
  13. //
  14. #define CIA_LM 0x0000
  15. #define CIA_CU 0x0001
  16. #define CIA_NATIVE 0x0000
  17. #define CIA_ALT 0x0002
  18. #define CIA_LM_NATIVE (CIA_LM | CIA_NATIVE)
  19. #define CIA_CU_NATIVE (CIA_CU | CIA_NATIVE)
  20. #define CIA_LM_ALT (CIA_LM | CIA_ALT)
  21. #define CIA_CU_ALT (CIA_CU | CIA_ALT)
  22. #define REGSTR_PATH_ALTUNINSTALL TEXT("Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall")
  23. STDAPI_(void) WOW64Uninstall_RunDLLW(HWND hwnd, HINSTANCE hAppInstance, LPWSTR lpszCmdLine, int nCmdShow);
  24. class CInstalledApp : public IInstalledApp
  25. {
  26. public:
  27. // Constructor for Legacy Apps
  28. CInstalledApp(HKEY hkeySub, LPCTSTR pszKeyName, LPCTSTR pszProducts, LPCTSTR pszUninstall, DWORD dwCIA);
  29. // Constructor for Darwin Apps
  30. CInstalledApp(LPTSTR pszProductID);
  31. ~CInstalledApp(void);
  32. // Helper function for SysWOW64 execution
  33. friend void WOW64Uninstall_RunDLLW(HWND hwnd, HINSTANCE hAppInstance, LPWSTR lpszCmdLine, int nCmdShow);
  34. // *** IUnknown Methods
  35. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  36. virtual STDMETHODIMP_(ULONG) AddRef(void) ;
  37. virtual STDMETHODIMP_(ULONG) Release(void);
  38. // *** IShellApp
  39. STDMETHODIMP GetAppInfo(PAPPINFODATA pai);
  40. STDMETHODIMP GetPossibleActions(DWORD * pdwActions);
  41. STDMETHODIMP GetSlowAppInfo(PSLOWAPPINFO psai);
  42. STDMETHODIMP GetCachedSlowAppInfo(PSLOWAPPINFO psai);
  43. STDMETHODIMP IsInstalled(void);
  44. // *** IInstalledApp
  45. STDMETHODIMP Uninstall(HWND hwndParent);
  46. STDMETHODIMP Modify(HWND hwndParent);
  47. STDMETHODIMP Repair(BOOL bReinstall);
  48. STDMETHODIMP Upgrade(void);
  49. protected:
  50. LONG _cRef;
  51. #define IA_LEGACY 1
  52. #define IA_DARWIN 2
  53. #define IA_SMS 4
  54. DWORD _dwSource; // App install source (IA_*)
  55. DWORD _dwAction; // APPACTION_*
  56. DWORD _dwCIA; // CIA_*
  57. // products name
  58. TCHAR _szProduct[MAX_PATH];
  59. // action strings
  60. TCHAR _szModifyPath[MAX_INFO_STRING];
  61. TCHAR _szUninstall[MAX_INFO_STRING];
  62. // info strings
  63. TCHAR _szInstallLocation[MAX_PATH];
  64. // for Darwin apps only
  65. TCHAR _szProductID[GUIDSTR_MAX];
  66. LPTSTR _pszUpdateUrl;
  67. // for Legacy apps only
  68. TCHAR _szKeyName[MAX_PATH];
  69. TCHAR _szCleanedKeyName[MAX_PATH];
  70. // app size
  71. BOOL _bTriedToFindFolder; // TRUE: we have attempted to find the
  72. // install folder already
  73. // GUID identifying this InstalledApp
  74. GUID _guid;
  75. #define PERSISTSLOWINFO_IMAGE 0x00000001
  76. // Structure used to persist SLOWAPPINFO
  77. typedef struct _PersistSlowInfo
  78. {
  79. DWORD dwSize;
  80. DWORD dwMasks;
  81. ULONGLONG ullSize;
  82. FILETIME ftLastUsed;
  83. int iTimesUsed;
  84. WCHAR szImage[MAX_PATH];
  85. } PERSISTSLOWINFO;
  86. HKEY _MyHkeyRoot() { return (_dwCIA & CIA_CU) ? HKEY_CURRENT_USER : HKEY_LOCAL_MACHINE; };
  87. BOOL _LegacyUninstall(HWND hwndParent);
  88. BOOL _LegacyModify(HWND hwndParent);
  89. LONG _DarRepair(BOOL bReinstall);
  90. HKEY _OpenRelatedRegKey(HKEY hkey, LPCTSTR pszRegLoc, REGSAM samDesired, BOOL bCreate);
  91. HKEY _OpenUninstallRegKey(REGSAM samDesired);
  92. void _GetUpdateUrl();
  93. void _GetInstallLocationFromRegistry(HKEY hkeySub);
  94. LPWSTR _GetLegacyInfoString(HKEY hkeySub, LPTSTR pszInfoName);
  95. BOOL _GetDarwinAppSize(ULONGLONG * pullTotal);
  96. BOOL _IsAppFastUserSwitchingCompliant(void);
  97. DWORD _QueryActionBlockInfo(HKEY hkey);
  98. DWORD _QueryBlockedActions(HKEY hkey);
  99. BOOL _FindAppFolderFromStrings();
  100. HRESULT _DarwinGetAppInfo(DWORD dwInfoFlags, PAPPINFODATA pai);
  101. HRESULT _LegacyGetAppInfo(DWORD dwInfoFlags, PAPPINFODATA pai);
  102. HRESULT _PersistSlowAppInfo(PSLOWAPPINFO psai);
  103. #define CAMP_UNINSTALL 0
  104. #define CAMP_MODIFY 1
  105. BOOL _CreateAppModifyProcess(HWND hwndParent, DWORD dwCAMP);
  106. BOOL _CreateAppModifyProcessWow64(HWND hwndParent, DWORD dwCAMP);
  107. BOOL _CreateAppModifyProcessNative(HWND hwndParent, LPTSTR pszExePath);
  108. HRESULT _SetSlowAppInfoChanged(HKEY hkeyCache, DWORD dwValue);
  109. HRESULT _IsSlowAppInfoChanged();
  110. };
  111. #endif //__INSTAPP_H_