Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <windows.h>
- #include <shlobj.h>
- #include <tchar.h>
- #include <stdio.h>
- HRESULT GetFolderDescriptionId(LPCWSTR pszPath, SHDESCRIPTIONID *pdid)
- {
- HRESULT hr;
- LPITEMIDLIST pidl;
- if (SUCCEEDED(hr = SHParseDisplayName(pszPath, NULL,&pidl, 0, NULL))) {
- IShellFolder *psf;
- LPCITEMIDLIST pidlChild;
- if (SUCCEEDED(hr = SHBindToParent(pidl, IID_IShellFolder, (void**)&psf, &pidlChild))) {
- hr = SHGetDataFromIDList(psf, pidlChild,SHGDFIL_DESCRIPTIONID, pdid, sizeof(*pdid));
- psf->Release();
- }
- CoTaskMemFree(pidl);
- }
- return hr;
- }
- int __cdecl wmain(int argc, WCHAR **argv)
- {
- SHDESCRIPTIONID did;
- if (SUCCEEDED(GetFolderDescriptionId(argv[1], &did)) && did.clsid == CLSID_RecycleBin) {
- printf("is a recycle binn");
- } else {
- printf("is not a recycle binn");
- }
- return 0;
- }
- C:> checkrecycle C:Windows
- is not a recycle bin
- C:> checkrecycle C:RECYCLERS-1-5-21-2127521184-1604012920-1887927527-72713
- is a recycle bin
Add Comment
Please, Sign In to add comment