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.

164 lines
6.9 KiB

  1. #ifndef _CLEANUPWIZ_H_
  2. #define _CLEANUPWIZ_H_
  3. #include <shlobj.h>
  4. #include <shfusion.h>
  5. #include <regstr.h> // REGSTR_PATH_EXPLORER
  6. #include <ccstock.h>
  7. #include <shlwapi.h>
  8. #include <strsafe.h>
  9. #include <cfgmgr32.h>
  10. // some useful debug stuff
  11. #define SZ_DEBUGINI "ccshell.ini"
  12. #define SZ_DEBUGSECTION "Desktop Cleaning Utility"
  13. #define SZ_MODULE "fldrclnr"
  14. #include <debug.h>
  15. // constant strings
  16. extern const LPTSTR c_szRegStrSHELLFOLDERS;
  17. extern const LPTSTR c_szRegStrDESKTOPNAMESPACE;
  18. extern const LPTSTR c_szRegStrPROFILELIST;
  19. extern const LPTSTR c_szRegStrMSNCODES;
  20. extern const LPTSTR c_szRegStrPATH_OCMANAGER;
  21. extern const LPTSTR c_szRegStrWMP_PATH_SETUP;
  22. extern const LPTSTR c_szRegStrPROFILESDIR;
  23. extern const LPTSTR c_szRegStrALLUSERS;
  24. extern const LPTSTR c_szRegStrDEFAULTUSER;
  25. extern const LPTSTR c_szRegStrDESKTOP;
  26. extern const LPTSTR c_szRegStrMSN_IAONLY;
  27. extern const LPTSTR c_szDESKTOP_DIR;
  28. extern const LPTSTR c_szRegStrIEACCESS;
  29. extern const LPTSTR c_szRegStrYES;
  30. extern const LPTSTR c_szRegStrWMP_REGVALUE;
  31. extern const LPTSTR c_szDEFAULT_USER;
  32. extern const LPTSTR c_szVAL_TIME;
  33. extern const LPTSTR c_szVAL_DELTA_DAYS;
  34. extern const LPTSTR c_szVAL_DONTRUN;
  35. extern const LPTSTR c_szVALUE_STARTPANEL;
  36. extern const LPTSTR c_szVALUE_CLASSICMENU;
  37. extern const LPTSTR c_szOEM_TITLEVAL;
  38. extern const LPTSTR c_szOEM_DISABLE;
  39. extern const LPTSTR c_szOEM_SEVENDAY_DISABLE;
  40. //
  41. // These flags specify the mode the wizard runs in
  42. //
  43. #define CLEANUP_MODE_NORMAL 0x0
  44. #define CLEANUP_MODE_ALL 0x1
  45. #define CLEANUP_MODE_SILENT 0x2
  46. #define REGSTR_PATH_CLEANUPWIZ REGSTR_PATH_EXPLORER TEXT("\\Desktop\\CleanupWiz")
  47. #define REGSTR_PATH_HIDDEN_DESKTOP_ICONS REGSTR_PATH_EXPLORER TEXT("\\HideDesktopIcons\\%s")
  48. #define REGSTR_OEM_PATH REGSTR_PATH_SETUP TEXT("\\OemStartMenuData")
  49. //
  50. // enum for figuring what type of desktop item we are dealing with
  51. //
  52. typedef enum eFILETYPE
  53. {
  54. FC_TYPE_REGITEM,
  55. FC_TYPE_LINK,
  56. FC_TYPE_EXE,
  57. FC_TYPE_FOLDER,
  58. FC_TYPE_OTHER,
  59. };
  60. //
  61. // struct used to keep track of which items should
  62. // be cleaned
  63. //
  64. typedef struct
  65. {
  66. LPITEMIDLIST pidl;
  67. BOOL bSelected;
  68. LPTSTR pszName;
  69. HICON hIcon;
  70. FILETIME ftLastUsed;
  71. } FOLDERITEMDATA, * PFOLDERITEMDATA;
  72. class CCleanupWiz
  73. {
  74. public:
  75. CCleanupWiz();
  76. ~CCleanupWiz();
  77. STDMETHODIMP Run(DWORD dwCleanMode, HWND hwndParent);
  78. STDMETHODIMP_(int) GetNumDaysBetweenCleanup(); // returns the number of days to check for between runs
  79. private:
  80. IShellFolder * _psf;
  81. HDSA _hdsaItems;
  82. DWORD _dwCleanMode;
  83. int _iDeltaDays;
  84. BOOL _bInited;
  85. int _cItemsOnDesktop;
  86. HFONT _hTitleFont;
  87. TCHAR _szFolderName[MAX_PATH];
  88. STDMETHODIMP _RunInteractive(HWND hwndParent);
  89. STDMETHODIMP _RunSilent();
  90. STDMETHODIMP_(DWORD) _LoadUnloadHive(HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszHive);
  91. STDMETHODIMP _HideRegItemsFromNameSpace(LPCTSTR szDestPath, HKEY hkey);
  92. STDMETHODIMP _GetDesktopFolderBySid(LPCTSTR szDestPath, LPCTSTR pszSid, LPTSTR pszBuffer, DWORD cchBuffer);
  93. STDMETHODIMP _GetDesktopFolderByRegKey(LPCTSTR pszRegKey, LPCTSTR pszRegValue, LPTSTR szBuffer, DWORD cchBuffer);
  94. STDMETHODIMP _AppendDesktopFolderName(LPTSTR pszBuffer);
  95. STDMETHODIMP _MoveDesktopItems(LPCTSTR pszFrom, LPCTSTR pszTo);
  96. STDMETHODIMP _SilentProcessUserBySid(LPCTSTR pszDestPath, LPCTSTR pszSid);
  97. STDMETHODIMP _SilentProcessUserByRegKey(LPCTSTR pszDestPath, LPCTSTR pszRegKey, LPCTSTR pszRegValue);
  98. STDMETHODIMP _SilentProcessUsers(LPCTSTR pszDestPath);
  99. STDMETHODIMP _LoadDesktopContents();
  100. STDMETHODIMP _LoadMergedDesktopContents();
  101. STDMETHODIMP _ProcessItems();
  102. STDMETHODIMP _ShowBalloonNotification();
  103. STDMETHODIMP _LogUsage();
  104. STDMETHODIMP _ShouldShow(IShellFolder* psf, LPCITEMIDLIST pidlFolder, LPCITEMIDLIST pidlItem);
  105. STDMETHODIMP_(BOOL) _ShouldProcess();
  106. STDMETHODIMP_(BOOL) _IsSupportedType(LPCITEMIDLIST pidl);
  107. STDMETHODIMP_(BOOL) _IsCandidateForRemoval(LPCITEMIDLIST pidl, FILETIME * pftLastUsed);
  108. STDMETHODIMP_(BOOL) _IsRegItemName(LPTSTR pszName);
  109. STDMETHODIMP_(BOOL) _CreateFakeRegItem(LPCTSTR pszDestPath, LPCTSTR pszName, LPCTSTR pszGUID);
  110. STDMETHODIMP _GetUEMInfo(WPARAM wParam, LPARAM lParam, int * pcHit, FILETIME * pftLastUsed);
  111. STDMETHODIMP_(eFILETYPE) _GetItemType(LPCITEMIDLIST pidl);
  112. STDMETHODIMP _HideRegPidl(LPCITEMIDLIST pidl, BOOL bHide);
  113. STDMETHODIMP _HideRegItem(CLSID* pclsid, BOOL fHide, BOOL* pfWasHidden);
  114. STDMETHODIMP _GetDateFromFileTime(FILETIME ftLastUsed, LPTSTR pszDate, int cch );
  115. STDMETHODIMP _InitListBox(HWND hWndListView);
  116. STDMETHODIMP _InitChoosePage(HWND hWndListView);
  117. STDMETHODIMP _InitFinishPage(HWND hWndListView);
  118. STDMETHODIMP _RefreshFinishPage(HWND hDlg);
  119. STDMETHODIMP_(int) _PopulateListView(HWND hWndListView);
  120. STDMETHODIMP_(int) _PopulateListViewFinish(HWND hWndListView);
  121. STDMETHODIMP_(void) _CleanUpDSA();
  122. STDMETHODIMP _CleanUpDSAItem(FOLDERITEMDATA * pfid);
  123. STDMETHODIMP _SetCheckedState(HWND hWndListView);
  124. STDMETHODIMP _MarkSelectedItems(HWND hWndListView);
  125. STDMETHODIMP _InitializeAndLaunchWizard(HWND hwndParent);
  126. INT_PTR STDMETHODCALLTYPE _IntroPageDlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  127. INT_PTR STDMETHODCALLTYPE _ChooseFilesPageDlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  128. INT_PTR STDMETHODCALLTYPE _FinishPageDlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  129. static INT_PTR CALLBACK s_StubDlgProc(HWND hdlg, UINT wm, WPARAM wParam, LPARAM lParam);
  130. } ;
  131. // helper functions
  132. STDAPI_(BOOL) IsUserAGuest();
  133. void CreateDesktopIcons(); // if OEM decides to disable silent mode, then we create icons on desktop
  134. #endif // _CLEANUPWIZ_H_