ReactOS 0.4.16-dev-927-g467dec4
CCleanMgrModule Class Reference
Inheritance diagram for CCleanMgrModule:
Collaboration diagram for CCleanMgrModule:

Public Member Functions

bool ParseCommandLine (_In_z_ LPCTSTR lpCmdLine, _Out_ HRESULT *pnRetCode) throw ()
 
HRESULT Run (_In_ int nShowCmd) throw ()
 
- Public Member Functions inherited from ATL::CAtlExeModuleT< CCleanMgrModule >
 CAtlExeModuleT ()
 
 ~CAtlExeModuleT ()
 
int WinMain (int nShowCmd)
 
HRESULT Run (int nShowCmd=SW_HIDE)
 
LONG Lock ()
 
LONG Unlock ()
 
bool ParseCommandLine (LPCTSTR lpCmdLine, HRESULT *pnRetCode)
 
HRESULT PreMessageLoop (int nShowCmd)
 
void RunMessageLoop ()
 
HRESULT PostMessageLoop ()
 
HRESULT RegisterClassObjects (DWORD dwClsContext, DWORD dwFlags)
 
HRESULT RevokeClassObjects ()
 
- Public Member Functions inherited from ATL::CAtlModuleT< T >
HRESULT RegisterServer (BOOL bRegTypeLib=FALSE, const CLSID *pCLSID=NULL)
 
HRESULT UnregisterServer (BOOL bUnRegTypeLib, const CLSID *pCLSID=NULL)
 
virtual HRESULT AddCommonRGSReplacements (IRegistrarBase *pRegistrar)
 
- Public Member Functions inherited from ATL::CAtlModule
 CAtlModule ()
 
virtual LONG GetLockCount ()
 
virtual LONG Lock ()
 
virtual LONG Unlock ()
 
virtual HRESULT AddCommonRGSReplacements (IRegistrarBase *)=0
 
HRESULT WINAPI UpdateRegistryFromResource (LPCTSTR lpszRes, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries=NULL)
 
HRESULT WINAPI UpdateRegistryFromResource (UINT nResID, BOOL bRegister, struct _ATL_REGMAP_ENTRY *pMapEntries=NULL)
 

Static Public Member Functions

static UINT GetWindowProcessId (_In_ HWND hWnd)
 
static BOOL CALLBACK EnumSingleInstanceCallback (_In_ HWND hWnd, _In_ LPARAM lParam)
 
- Static Public Member Functions inherited from ATL::CAtlExeModuleT< CCleanMgrModule >
static HRESULT InitializeCom ()
 
static void UninitializeCom ()
 
- Static Public Member Functions inherited from ATL::CAtlModuleT< T >
static LPCOLESTR GetAppId ()
 

Public Attributes

WCHAR m_Drive = UNICODE_NULL
 
- Public Attributes inherited from ATL::CAtlExeModuleT< CCleanMgrModule >
DWORD m_dwMainThreadID
 
- Public Attributes inherited from ATL::_ATL_MODULE70
UINT cbSize
 
LONG m_nLockCnt
 
_ATL_TERMFUNC_ELEMm_pTermFuncs
 
CComCriticalSection m_csStaticDataInitAndTypeInfo
 

Additional Inherited Members

- Static Public Attributes inherited from ATL::CAtlModule
static GUID m_libid
 

Detailed Description

Definition at line 217 of file cleanmgr.cpp.

Member Function Documentation

◆ EnumSingleInstanceCallback()

static BOOL CALLBACK CCleanMgrModule::EnumSingleInstanceCallback ( _In_ HWND  hWnd,
_In_ LPARAM  lParam 
)
inlinestatic

Definition at line 256 of file cleanmgr.cpp.

257 {
259 {
261 return FALSE;
262 }
263 return TRUE;
264 }
HWND hWnd
Definition: settings.c:17
static UINT GetWindowProcessId(_In_ HWND hWnd)
Definition: cleanmgr.cpp:250
LPARAM lParam
Definition: combotst.c:139
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LONG_PTR LPARAM
Definition: windef.h:208
BOOL WINAPI SetForegroundWindow(_In_ HWND)
BOOL WINAPI IsWindowVisible(_In_ HWND)

Referenced by Run().

◆ GetWindowProcessId()

static UINT CCleanMgrModule::GetWindowProcessId ( _In_ HWND  hWnd)
inlinestatic

Definition at line 250 of file cleanmgr.cpp.

251 {
252 DWORD pid;
253 return GetWindowThreadProcessId(hWnd, &pid) ? pid : 0;
254 }
unsigned long DWORD
Definition: ntddk_ex.h:95
DWORD WINAPI GetWindowThreadProcessId(HWND hWnd, PDWORD lpdwProcessId)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
Definition: winddi.h:3837

Referenced by EnumSingleInstanceCallback(), and Run().

◆ ParseCommandLine()

bool CCleanMgrModule::ParseCommandLine ( _In_z_ LPCTSTR  lpCmdLine,
_Out_ HRESULT pnRetCode 
)
throw (
)
inline

Definition at line 222 of file cleanmgr.cpp.

225 {
226 int argc = 0;
228
229 for (int n = 1; n < argc; ++n)
230 {
231 if ((argv[n][0] == '/' || argv[n][0] == '-') && towlower(argv[n][1]) == 'd')
232 {
233 if (iswalpha(argv[n][2]))
234 {
235 m_Drive = towupper(argv[n][2]);
236 continue;
237 }
238 if ((n + 1) < argc)
239 {
240 m_Drive = towupper(argv[n + 1][0]);
241 ++n;
242 continue;
243 }
244 }
245 }
246 *pnRetCode = S_OK;
247 return true;
248 }
static int argc
Definition: ServiceArgs.c:12
GLdouble n
Definition: glext.h:7729
#define iswalpha(_c)
Definition: ctype.h:664
#define S_OK
Definition: intsafe.h:52
#define argv
Definition: mplay32.c:18
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:79
#define towlower(c)
Definition: wctype.h:97
#define towupper(c)
Definition: wctype.h:99

◆ Run()

HRESULT CCleanMgrModule::Run ( _In_ int  nShowCmd)
throw (
)
inline

Definition at line 266 of file cleanmgr.cpp.

267 {
268 if (m_Drive == UNICODE_NULL)
269 {
271 }
272
273 if (m_Drive == UNICODE_NULL)
274 return E_FAIL;
275
278
279 HWND hWndInstance = ::CreateWindowExW(WS_EX_TOOLWINDOW, WC_STATIC, Title, 0, 0, 0, 0, 0, NULL, NULL, NULL, NULL);
280 for (HWND hNext = NULL, hFind; (hFind = ::FindWindowExW(NULL, hNext, WC_STATIC, Title)) != NULL; hNext = hFind)
281 {
282 if (hFind != hWndInstance)
283 {
285 return S_FALSE;
286 }
287 }
288
290 CEmptyVolumeCacheCallBack CacheCallBack;
291
292 Handlers.LoadHandlers(m_Drive);
293 DWORDLONG TotalSpaceUsed = Handlers.ScanDrive(&CacheCallBack);
294
295 CCleanMgrProperties cleanMgr(m_Drive, TotalSpaceUsed, &Handlers);
296 HPROPSHEETPAGE hpsp[1] = { cleanMgr.Create() };
297
298 PROPSHEETHEADERW psh = { };
299 psh.dwSize = sizeof(psh);
300 psh.dwFlags = PSH_NOAPPLYNOW | PSH_USEICONID | PSH_NOCONTEXTHELP;
301 psh.hInstance = _AtlBaseModule.GetResourceInstance();
303 psh.pszCaption = Title;
304 psh.nPages = _countof(hpsp);
305 psh.phpage = hpsp;
306
307 if (PropertySheetW(&psh) >= 1)
308 {
309 ::DestroyWindow(hWndInstance); // Allow new "cleanmgr /D" without waiting for these handlers
310 Handlers.ExecuteCleanup(&CacheCallBack);
311 }
312 else
313 {
314 ::DestroyWindow(hWndInstance);
315 }
316 return S_OK;
317 }
#define IDS_PROPERTIES_MAIN_TITLE
Definition: resource.h:23
#define IDI_CLEANMGR
Definition: resource.h:10
static BOOL CALLBACK EnumSingleInstanceCallback(_In_ HWND hWnd, _In_ LPARAM lParam)
Definition: cleanmgr.cpp:256
void SelectDrive(WCHAR &Drive)
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
static const WCHAR Title[]
Definition: oid.c:1259
IShellIconOverlayIdentifier ** Handlers
Definition: folders.cpp:25
unsigned long long DWORDLONG
Definition: intsafe.h:93
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define UNICODE_NULL
#define PSH_USEICONID
Definition: prsht.h:42
#define PSH_NOAPPLYNOW
Definition: prsht.h:47
#define WC_STATIC
Definition: commctrl.h:4687
#define _countof(array)
Definition: sndvol32.h:70
HINSTANCE hInstance
Definition: prsht.h:296
DWORD dwSize
Definition: prsht.h:293
DWORD dwFlags
Definition: prsht.h:294
LPCWSTR pszIcon
Definition: prsht.h:299
HPROPSHEETPAGE * phpage
Definition: prsht.h:309
LPCWSTR pszCaption
Definition: prsht.h:301
#define S_FALSE
Definition: winerror.h:2357
#define WS_EX_TOOLWINDOW
Definition: winuser.h:404
HWND WINAPI FindWindowExW(_In_opt_ HWND, _In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR)
BOOL WINAPI EnumWindows(_In_ WNDENUMPROC lpEnumFunc, _In_ LPARAM lParam)
HWND WINAPI CreateWindowExW(_In_ DWORD dwExStyle, _In_opt_ LPCWSTR lpClassName, _In_opt_ LPCWSTR lpWindowName, _In_ DWORD dwStyle, _In_ int X, _In_ int Y, _In_ int nWidth, _In_ int nHeight, _In_opt_ HWND hWndParent, _In_opt_ HMENU hMenu, _In_opt_ HINSTANCE hInstance, _In_opt_ LPVOID lpParam)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
BOOL WINAPI DestroyWindow(_In_ HWND)

Member Data Documentation

◆ m_Drive

WCHAR CCleanMgrModule::m_Drive = UNICODE_NULL

Definition at line 220 of file cleanmgr.cpp.

Referenced by ParseCommandLine(), and Run().


The documentation for this class was generated from the following file: