Author: dquintana Date: Fri Mar 7 22:39:49 2014 New Revision: 62449
URL: http://svn.reactos.org/svn/reactos?rev=62449&view=rev Log: [EXPLORER] * Rename the output to explorer_old
[EXPLORER-NEW] * Rename the output to explorer * Launch a browseui window when explorer is run with an existing shell process.
Shell-experiments will now be running the new shell by default. This allows me to test the shell classes under more accurate conditions, so I was using it locally for a while. I decided to commit because of two reasons: 1. It was making me temporarily revert some changes done to some files when I wanted to commit, and 2. It lets everyone see the results of the shell-experiments project without having to mess with the task manager.
Keep in mind that, as the branch name implies, it STILL is an experiment.
CORE-7586
Modified: branches/shell-experiments/base/shell/explorer-new/CMakeLists.txt branches/shell-experiments/base/shell/explorer-new/explorer.c branches/shell-experiments/base/shell/explorer/CMakeLists.txt branches/shell-experiments/base/shell/filebrowser/CMakeLists.txt branches/shell-experiments/base/shell/filebrowser/filebrowser.c branches/shell-experiments/base/shell/rshell/CMakeLists.txt branches/shell-experiments/dll/win32/browseui/CMakeLists.txt
Modified: branches/shell-experiments/base/shell/explorer-new/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/exp... ============================================================================== --- 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] Fri Mar 7 22:39:49 2014 @@ -19,10 +19,10 @@ traywnd.c precomp.h)
-add_executable(explorer_new ${SOURCE} explorer.rc) -target_link_libraries(explorer_new uuid) -set_module_type(explorer_new win32gui UNICODE) -add_importlibs(explorer_new +add_executable(explorer ${SOURCE} explorer.rc) +target_link_libraries(explorer uuid) +set_module_type(explorer win32gui UNICODE) +add_importlibs(explorer advapi32 gdi32 user32 @@ -37,5 +37,5 @@ msvcrt kernel32 ntdll) -add_pch(explorer_new precomp.h SOURCE) -add_cd_file(TARGET explorer_new DESTINATION reactos FOR all) +add_pch(explorer precomp.h SOURCE) +add_cd_file(TARGET explorer DESTINATION reactos FOR all)
Modified: branches/shell-experiments/base/shell/explorer-new/explorer.c URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/exp... ============================================================================== --- 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] Fri Mar 7 22:39:49 2014 @@ -381,6 +381,8 @@ HANDLE hShellDesktop = NULL; BOOL CreateShellDesktop = FALSE;
+ DbgPrint("Explorer starting... Commandline: %S\n", lpCmdLine); + if (RegOpenKey(HKEY_CURRENT_USER, TEXT("Software\Microsoft\Windows\CurrentVersion\Explorer"), &hkExplorer) != ERROR_SUCCESS) @@ -442,10 +444,109 @@ } else { + WCHAR root[MAX_PATH]; + HMODULE hBrowseui; + HRESULT hr; + LPSHELLFOLDER pDesktopFolder = NULL; + LPITEMIDLIST pidlRoot = NULL; + /* 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); + if (FAILED(hr)) + return 0; + } + + DbgPrint("Trying to open browser window... \n"); + + typedef HRESULT(WINAPI *SH_OPEN_NEW_FRAME)(LPITEMIDLIST pidl, IUnknown *paramC, long param10, long param14); + SH_OPEN_NEW_FRAME SHOpenNewFrame; + + hBrowseui = LoadLibraryW(L"browseui.dll"); + if (!hBrowseui) + { + DbgPrint("Browseui not found.. \n"); + 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/base/shell/explorer/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/exp... ============================================================================== --- branches/shell-experiments/base/shell/explorer/CMakeLists.txt [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/explorer/CMakeLists.txt [iso-8859-1] Fri Mar 7 22:39:49 2014 @@ -46,17 +46,17 @@ list(APPEND I386_SOURCE i386-stub-win32.c) endif()
-add_executable(explorer +add_executable(explorer_old ${SOURCE} ${I386_SOURCE} services/startup.c explorer.rc)
-target_link_libraries(explorer comsupp wine uuid) -set_module_type(explorer win32gui UNICODE) +target_link_libraries(explorer_old comsupp wine uuid) +set_module_type(explorer_old win32gui UNICODE)
-add_importlibs(explorer advapi32 gdi32 user32 ws2_32 msimg32 comctl32 ole32 oleaut32 shell32 shlwapi notifyhook msvcrt kernel32 ntdll) -add_pch(explorer precomp.h SOURCE) -add_dependencies(explorer psdk) -add_cd_file(TARGET explorer DESTINATION reactos FOR all) +add_importlibs(explorer_old advapi32 gdi32 user32 ws2_32 msimg32 comctl32 ole32 oleaut32 shell32 shlwapi notifyhook msvcrt kernel32 ntdll) +add_pch(explorer_old precomp.h SOURCE) +add_dependencies(explorer_old psdk) +add_cd_file(TARGET explorer_old DESTINATION reactos FOR all) add_cd_file(FILE ${CMAKE_CURRENT_SOURCE_DIR}/explorer-cfg-template.xml DESTINATION reactos FOR all)
Modified: branches/shell-experiments/base/shell/filebrowser/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/fil... ============================================================================== --- branches/shell-experiments/base/shell/filebrowser/CMakeLists.txt [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/filebrowser/CMakeLists.txt [iso-8859-1] Fri Mar 7 22:39:49 2014 @@ -11,4 +11,5 @@ shell32 msvcrt kernel32) - + +add_cd_file(TARGET explorer DESTINATION reactos FOR all)add_cd_file(TARGET explorer DESTINATION reactos FOR all)
Modified: branches/shell-experiments/base/shell/filebrowser/filebrowser.c URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/fil... ============================================================================== --- branches/shell-experiments/base/shell/filebrowser/filebrowser.c [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/filebrowser/filebrowser.c [iso-8859-1] Fri Mar 7 22:39:49 2014 @@ -33,7 +33,7 @@ { SH_OPEN_NEW_FRAME SHOpenNewFrame = (SH_OPEN_NEW_FRAME)GetProcAddress(hBrowseui, (LPCSTR)103); LPITEMIDLIST pidlDrives; - HRESULT hRet = SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &pidlDrives); + SHGetSpecialFolderLocation(NULL, CSIDL_DRIVES, &pidlDrives); SHOpenNewFrame((LPITEMIDLIST)pidlDrives, NULL, 0, 0); }
Modified: branches/shell-experiments/base/shell/rshell/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/base/shell/rsh... ============================================================================== --- branches/shell-experiments/base/shell/rshell/CMakeLists.txt [iso-8859-1] (original) +++ branches/shell-experiments/base/shell/rshell/CMakeLists.txt [iso-8859-1] Fri Mar 7 22:39:49 2014 @@ -47,7 +47,7 @@ add_custom_command(TARGET rshell POST_BUILD COMMAND "${CMAKE_COMMAND}" -E copy "$<TARGET_FILE:rshell>" - "$<TARGET_FILE_DIR:explorer_new>/$<TARGET_FILE_NAME:rshell>" + "$<TARGET_FILE_DIR:explorer>/$<TARGET_FILE_NAME:rshell>" COMMENT "Copying to output directory")
add_custom_command(TARGET rshell POST_BUILD @@ -55,3 +55,9 @@ "$<TARGET_FILE:rshell>" "$<TARGET_FILE_DIR:filebrowser>/$<TARGET_FILE_NAME:rshell>" COMMENT "Copying to output directory") + +add_custom_command(TARGET rshell POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "$<TARGET_FILE:rshell>" + "$<TARGET_FILE_DIR:filebrowser>/$<TARGET_FILE_NAME:rshell>" + COMMENT "Copying to output directory")
Modified: branches/shell-experiments/dll/win32/browseui/CMakeLists.txt URL: http://svn.reactos.org/svn/reactos/branches/shell-experiments/dll/win32/brow... ============================================================================== --- branches/shell-experiments/dll/win32/browseui/CMakeLists.txt [iso-8859-1] (original) +++ branches/shell-experiments/dll/win32/browseui/CMakeLists.txt [iso-8859-1] Fri Mar 7 22:39:49 2014 @@ -65,3 +65,9 @@ "$<TARGET_FILE:browseui>" "$<TARGET_FILE_DIR:filebrowser>/$<TARGET_FILE_NAME:browseui>" COMMENT "Copying to output directory") + +add_custom_command(TARGET browseui POST_BUILD + COMMAND "${CMAKE_COMMAND}" -E copy + "$<TARGET_FILE:browseui>" + "$<TARGET_FILE_DIR:filebrowser>/$<TARGET_FILE_NAME:browseui>" + COMMENT "Copying to output directory")