#include <windows.h>
#include <shobjidl.h>
#include <shlobj.h>
+#include <shlwapi.h>
+#include <stdio.h>
-typedef HRESULT (WINAPI *SH_OPEN_NEW_FRAME)(LPITEMIDLIST pidl, IUnknown *paramC, long param10, long param14);
+#include <browseui_undoc.h>
int _tmain(int argc, _TCHAR* argv[])
{
- HMODULE hBrowseui = LoadLibraryW(L"browseui.dll");
- if (hBrowseui)
+ EXPLORER_CMDLINE_PARSE_RESULTS parseResults = { 0 };
+
+ if (SHExplorerParseCmdLine(&parseResults))
{
- SH_OPEN_NEW_FRAME SHOpenNewFrame = (SH_OPEN_NEW_FRAME)GetProcAddress(hBrowseui, (LPCSTR)103);
- LPITEMIDLIST pidlDrives;
- SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &pidlDrives);
- SHOpenNewFrame((LPITEMIDLIST)pidlDrives, NULL, 0, 0);
+ parseResults.dwFlags |= SH_EXPLORER_CMDLINE_FLAG_SEPARATE;
+ return SHCreateFromDesktop(&parseResults);
}
- /* FIXME: we should wait a bit here and see if a window was created. If not we should exit this process */
- ExitThread(0);
+ if (parseResults.strPath)
+ SHFree(parseResults.strPath);
+
+ if (parseResults.pidlPath)
+ ILFree(parseResults.pidlPath);
+
+ if (parseResults.pidlRoot)
+ ILFree(parseResults.pidlRoot);
return 0;
}
-