A very small CCleaner

Started by Jokaste, May 08, 2019, 02:59:00 AM

Previous topic - Next topic

Jokaste

This program explains how to use SHGetKnownFolderPath.
It runs under Windows 10. Could run under Windows 7 & 8 but that's all.

LPSTR GetSpecialFolder(REFKNOWNFOLDERID rfid,LPSTR __lpszResult)
{
LPWSTR _lpwszPath = NULL ;

HRESULT _hr = SHGetKnownFolderPath(rfid,KF_FLAG_CREATE,NULL,&_lpwszPath) ;
if(SUCCEEDED(_hr))
{
WideCharToMultiByte(CP_UTF8,0,_lpwszPath,lstrlenW(_lpwszPath),__lpszResult,MAX_PATH,NULL,NULL) ;

return (__lpszResult) ;
}

return (NULL) ;
}


It cleans many folders :

       
  • Internet cache
  • History
  • CD Burning cache
  • Cookies
  • Printers cache
  • Recents Documents
  • Applications updates
  • Downloaded files
  • Searches
  • Searches history
  • Downloaded Program Files
  • Prefetch
  • Software Distribution
It empties all recyclebins
Launches Dism.exe to clean WinSxS

You must run the program wih Administrator privileges.