Author: dquintana
Date: Mon Sep 8 13:09:19 2014
New Revision: 64083
URL:
http://svn.reactos.org/svn/reactos?rev=64083&view=rev
Log:
[PSDK]
* Make shlwapi_undoc.h compatible with C code.
[EXPLORER-NEW]
* Link with browseui.
* Use SHOpenNewFrame linked from browseui instead of explicitly loaded.
* Make use of SHExplorerParseCmdLine. Does not yet open windows in an existing process
when used through commandline.
Modified:
branches/shell-experiments/base/shell/explorer-new/CMakeLists.txt
branches/shell-experiments/base/shell/explorer-new/explorer.c
branches/shell-experiments/include/psdk/shlwapi_undoc.h
Modified: branches/shell-experiments/base/shell/explorer-new/CMakeLists.txt
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
==============================================================================
--- branches/shell-experiments/base/shell/explorer-new/CMakeLists.txt [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/explorer-new/CMakeLists.txt [iso-8859-1] Mon Sep
8 13:09:19 2014
@@ -31,6 +31,7 @@
ole32
oleaut32
shell32
+ browseui
shlwapi
shdocvw
version
Modified: branches/shell-experiments/base/shell/explorer-new/explorer.c
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/ex…
==============================================================================
--- branches/shell-experiments/base/shell/explorer-new/explorer.c [iso-8859-1] (original)
+++ branches/shell-experiments/base/shell/explorer-new/explorer.c [iso-8859-1] Mon Sep 8
13:09:19 2014
@@ -19,7 +19,7 @@
*/
#include "precomp.h"
-
+#include <shlwapi_undoc.h>
#include <winver.h>
HINSTANCE hExplorerInstance;
@@ -450,108 +450,28 @@
}
else
{
- WCHAR root[MAX_PATH];
- HMODULE hBrowseui;
HRESULT hr;
- LPSHELLFOLDER pDesktopFolder = NULL;
- LPITEMIDLIST pidlRoot = NULL;
- typedef HRESULT(WINAPI *SH_OPEN_NEW_FRAME)(LPITEMIDLIST pidl, IUnknown *paramC,
long param10, long param14);
- SH_OPEN_NEW_FRAME SHOpenNewFrame;
-
- /* A shell is already loaded. Parse the command line arguments
- and unless we need to do something specific simply display
- the desktop in a separate explorer window */
- /* FIXME */
-
- /* Commandline switches:
- *
- * /n Open a new window, even if an existing one still exists.
- * /e Start with the explorer sidebar shown.
- * /root,<object> Open a window for the given object path.
- * /select,<object> Open a window with the given object selected.
- */
-
- /* FIXME: Do it right */
- WCHAR* tmp = wcsstr(lpCmdLine,L"/root,");
- if (tmp)
- {
- WCHAR* tmp2;
-
- tmp += 6; // skip to beginning of path
- tmp2 = wcschr(tmp, L',');
-
- if (tmp2)
- {
- wcsncpy(root, tmp, tmp2 - tmp);
- }
- else
- {
- wcscpy(root, tmp);
- }
- }
- else
- {
- wcscpy(root, lpCmdLine);
- }
-
- if (root[0] == L'"')
- {
- int len = wcslen(root) - 2;
- wcsncpy(root, root + 1, len);
- root[len] = 0;
- }
-
- if (wcslen(root) > 0)
- {
- LPITEMIDLIST pidl;
- ULONG chEaten;
- ULONG dwAttributes;
-
- if (SUCCEEDED(SHGetDesktopFolder(&pDesktopFolder)))
- {
- hr = pDesktopFolder->lpVtbl->ParseDisplayName(pDesktopFolder,
- NULL,
- NULL,
- root,
- &chEaten,
- &pidl,
- &dwAttributes);
- if (SUCCEEDED(hr))
- {
- pidlRoot = pidl;
- DbgPrint("Got PIDL for folder '%S'\n", root);
- }
- }
- }
-
- if (!pidlRoot)
- {
- DbgPrint("No folder, getting PIDL for My Computer.\n", root);
- hr = SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &pidlRoot);
+ EXPLORER_CMDLINE_PARSE_RESULTS parseResults = { 0 };
+
+ if (!SHExplorerParseCmdLine(&parseResults))
+ return 0;
+
+ // TODO: Handle the case where .strPath was assigned instead of .pidlPath
+
+ if (parseResults.dwFlags & SH_EXPLORER_CMDLINE_FLAG_IDLIST)
+ {
+ TRACE("Trying to open browser window... \n");
+
+ hr = SHOpenNewFrame(parseResults.pidlPath, NULL, 0, 0);
if (FAILED(hr))
return 0;
- }
-
- DbgPrint("Trying to open browser window... \n");
-
- hBrowseui = LoadLibraryW(L"browseui.dll");
- if (!hBrowseui)
- {
- DbgPrint("Browseui not found.. \n");
+
+ /* FIXME: we should wait a bit here and see if a window was created. If not
we should exit this process. */
+ Sleep(1000);
+ ExitThread(0);
+
return 0;
}
-
- SHOpenNewFrame = (SH_OPEN_NEW_FRAME) GetProcAddress(hBrowseui, (LPCSTR) 103);
-
- hr = SHOpenNewFrame(pidlRoot, (IUnknown*)pDesktopFolder, 0, 0);
- if (FAILED(hr))
- return 0;
-
- /* FIXME: we should wait a bit here and see if a window was created. If not we
should exit this process. */
- Sleep(1000);
- ExitThread(0);
-
- return 0;
}
if (Tray != NULL)
Modified: branches/shell-experiments/include/psdk/shlwapi_undoc.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/include/psdk/…
==============================================================================
--- branches/shell-experiments/include/psdk/shlwapi_undoc.h [iso-8859-1] (original)
+++ branches/shell-experiments/include/psdk/shlwapi_undoc.h [iso-8859-1] Mon Sep 8
13:09:19 2014
@@ -25,7 +25,7 @@
extern "C" {
#endif /* defined(__cplusplus) */
-struct IEThreadParamBlock
+typedef struct IEThreadParamBlock
{
long offset0;
long offset4;
@@ -43,9 +43,9 @@
char filler3[116]; // unknown contents
IUnknown *offsetF8; // instance explorer
long filler4; // unknown contents
-};
+} IE_THREAD_PARAM_BLOCK, *PIE_THREAD_PARAM_BLOCK;
-struct ExplorerCommandLineParseResults
+typedef struct ExplorerCommandLineParseResults
{
LPWSTR strPath;
LPITEMIDLIST pidlPath;
@@ -61,7 +61,7 @@
DWORD unk_44;
DWORD unk_48;
GUID guidInproc;
-};
+} EXPLORER_CMDLINE_PARSE_RESULTS, *PEXPLORER_CMDLINE_PARSE_RESULTS;
#define SH_EXPLORER_CMDLINE_FLAG_ONE 0x00000001
#define SH_EXPLORER_CMDLINE_FLAG_S 0x00000002
@@ -122,18 +122,18 @@
BOOL WINAPI SHIsChildOrSelf(HWND hParent, HWND hChild);
void WINAPI InitOCHostClass(long param8);
-long WINAPI SHOpenFolderWindow(IEThreadParamBlock *param8);
+long WINAPI SHOpenFolderWindow(PIE_THREAD_PARAM_BLOCK param8);
void WINAPI SHCreateSavedWindows(void);
long WINAPI SHCreateFromDesktop(long param8);
-UINT WINAPI SHExplorerParseCmdLine(ExplorerCommandLineParseResults * pParseResults);
+UINT WINAPI SHExplorerParseCmdLine(PEXPLORER_CMDLINE_PARSE_RESULTS pParseResults);
void WINAPI UEMRegisterNotify(long param8, long paramC);
HRESULT WINAPI SHCreateBandForPidl(LPCITEMIDLIST param8, IUnknown *paramC, BOOL
param10);
HRESULT WINAPI SHPidlFromDataObject(IDataObject *param8, long *paramC, long param10,
FILEDESCRIPTORW *param14);
long WINAPI IDataObject_GetDeskBandState(long param8);
-IEThreadParamBlock *WINAPI SHCreateIETHREADPARAM(long param8, long paramC, IUnknown
*param10, IUnknown *param14);
-IEThreadParamBlock *WINAPI SHCloneIETHREADPARAM(IEThreadParamBlock *param);
+PIE_THREAD_PARAM_BLOCK WINAPI SHCreateIETHREADPARAM(long param8, long paramC, IUnknown
*param10, IUnknown *param14);
+PIE_THREAD_PARAM_BLOCK WINAPI SHCloneIETHREADPARAM(PIE_THREAD_PARAM_BLOCK param);
long WINAPI SHParseIECommandLine(long param8, long paramC);
-void WINAPI SHDestroyIETHREADPARAM(IEThreadParamBlock *param);
+void WINAPI SHDestroyIETHREADPARAM(PIE_THREAD_PARAM_BLOCK param);
HRESULT WINAPI SHOnCWMCommandLine(long param8);
LPITEMIDLIST WINAPI Channel_GetFolderPidl(void);
IUnknown *WINAPI ChannelBand_Create(LPITEMIDLIST pidl);