Author: dquintana
Date: Tue Oct 7 14:40:33 2014
New Revision: 64578
URL:
http://svn.reactos.org/svn/reactos?rev=64578&view=rev
Log:
[FILEBROWSER]
* Always open separate.
[BROWSEUI]
* Use the threadref IUnknown for reference counting in the browser threads.
Modified:
branches/shell-experiments/base/shell/filebrowser/filebrowser.c
branches/shell-experiments/dll/win32/browseui/desktopipc.cpp
branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
Modified: branches/shell-experiments/base/shell/filebrowser/filebrowser.c
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/fi…
==============================================================================
--- branches/shell-experiments/base/shell/filebrowser/filebrowser.c [iso-8859-1]
(original)
+++ branches/shell-experiments/base/shell/filebrowser/filebrowser.c [iso-8859-1] Tue Oct
7 14:40:33 2014
@@ -27,14 +27,15 @@
#include <shlwapi_undoc.h>
#include <stdio.h>
-typedef HRESULT (WINAPI *SH_OPEN_NEW_FRAME)(LPITEMIDLIST pidl, IUnknown *paramC, long
param10, long param14);
-
int _tmain(int argc, _TCHAR* argv[])
{
EXPLORER_CMDLINE_PARSE_RESULTS parseResults = { 0 };
if (SHExplorerParseCmdLine(&parseResults))
+ {
+ parseResults.dwFlags |= SH_EXPLORER_CMDLINE_FLAG_SEPARATE;
return SHCreateFromDesktop(&parseResults);
+ }
return 0;
}
Modified: branches/shell-experiments/dll/win32/browseui/desktopipc.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/desktopipc.cpp [iso-8859-1] (original)
+++ branches/shell-experiments/dll/win32/browseui/desktopipc.cpp [iso-8859-1] Tue Oct 7
14:40:33 2014
@@ -450,15 +450,21 @@
HANDLE threadHandle;
DWORD threadID;
- DbgPrint("SHOpenFolderWindow\n");
-
- threadHandle = CreateThread(NULL, 0x10000, BrowserThreadProc, parameters, 0,
&threadID);
+ WCHAR debugStr[MAX_PATH + 1];
+ SHGetPathFromIDListW(parameters->directoryPIDL, debugStr);
+
+ DbgPrint("SHOpenFolderWindow %p(%S)\n", parameters->directoryPIDL,
debugStr);
+
+ PIE_THREAD_PARAM_BLOCK paramsCopy = SHCloneIETHREADPARAM(parameters);
+
+ SHGetInstanceExplorer(&(paramsCopy->offsetF8));
+ threadHandle = CreateThread(NULL, 0x10000, BrowserThreadProc, paramsCopy, 0,
&threadID);
if (threadHandle != NULL)
{
CloseHandle(threadHandle);
return S_OK;
}
- SHDestroyIETHREADPARAM(parameters);
+ SHDestroyIETHREADPARAM(paramsCopy);
return E_FAIL;
}
@@ -485,8 +491,12 @@
parameters->offset10 = param10;
parameters->directoryPIDL = pidl;
parameters->dwFlags = dwFlags;
-
- return SHOpenFolderWindow(parameters);
+
+ HRESULT hr = SHOpenFolderWindow(parameters);
+
+ SHDestroyIETHREADPARAM(parameters);
+
+ return hr;
}
/*************************************************************************
Modified: branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/bro…
==============================================================================
--- branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1]
(original)
+++ branches/shell-experiments/dll/win32/browseui/shellbrowser.cpp [iso-8859-1] Tue Oct 7
14:40:33 2014
@@ -3399,6 +3399,9 @@
HRESULT hResult;
MSG Msg;
BOOL Ret;
+
+ // Tell the thread ref we are using it.
+ parameters->offsetF8->AddRef();
ATLTRY(theCabinet = new CComObject<CShellBrowser>);
if (theCabinet == NULL)
@@ -3440,6 +3443,9 @@
theCabinet.Detach();
+ // Tell the thread ref we are not using it anymore.
+ parameters->offsetF8->Release();
+
return hResult;
}
@@ -3454,5 +3460,7 @@
OleUninitialize();
+ SHDestroyIETHREADPARAM(parameters);
+
return hr;
}