Commit f2ac486e authored by Jay Yang's avatar Jay Yang Committed by Alexandre Julliard

explorer: Implement the explorer using IExplorerBrowser.

parent 0132645e
......@@ -15473,7 +15473,7 @@ wine_fn_config_program control enable_control install
wine_fn_config_program dxdiag enable_dxdiag install,po
wine_fn_config_program eject enable_eject install
wine_fn_config_program expand enable_expand install
wine_fn_config_program explorer enable_explorer install
wine_fn_config_program explorer enable_explorer install,po
wine_fn_config_program extrac32 enable_extrac32 install
wine_fn_config_program hh enable_hh install
wine_fn_config_program hostname enable_hostname install,po
......
......@@ -2946,7 +2946,7 @@ WINE_CONFIG_PROGRAM(control,,[install])
WINE_CONFIG_PROGRAM(dxdiag,,[install,po])
WINE_CONFIG_PROGRAM(eject,,[install])
WINE_CONFIG_PROGRAM(expand,,[install])
WINE_CONFIG_PROGRAM(explorer,,[install])
WINE_CONFIG_PROGRAM(explorer,,[install,po])
WINE_CONFIG_PROGRAM(extrac32,,[install])
WINE_CONFIG_PROGRAM(hh,,[install])
WINE_CONFIG_PROGRAM(hostname,,[install,po])
......
......@@ -8085,6 +8085,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8261,6 +8261,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "&Разгледай"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8008,6 +8008,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8640,6 +8640,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "P&rozkoumat"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8664,6 +8664,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8653,6 +8653,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8132,6 +8132,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8309,6 +8309,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr "Wine Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8401,6 +8401,10 @@ msgstr "DirectX Diagnostic Tool"
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
#: explorer.rc:28
msgid "Wine Explorer"
msgstr "Wine Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr "Usage: hostname\n"
......
......@@ -8252,6 +8252,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "E&sploru"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8842,6 +8842,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Internet Explorer de Wine"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8087,6 +8087,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8333,6 +8333,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "&Selaa"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8482,6 +8482,11 @@ msgstr "Outil de diagnostic DirectX"
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr "Usage : dxdiag [/whql:off | /whql:on] [/t fichier | /x fichier]"
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Internet Explorer de Wine"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr "Usage : hostname\n"
......
......@@ -8502,6 +8502,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8005,6 +8005,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8527,6 +8527,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8747,6 +8747,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Internet Explorer di Wine"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8399,6 +8399,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine インターネット エクスプローラ"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr "使い方: hostname\n"
......
......@@ -8371,6 +8371,11 @@ msgstr "다이렉트엑스 진단 도구"
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr "사용법: dxdiag [/whql:off | /whql:on] [/t 파일이름 | /x 파일이름]"
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine 인터넷 익스폴로어r"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr "사용법:hostname\n"
......
......@@ -8417,6 +8417,11 @@ msgstr "DirectX diagnostikos įrankis"
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr "Naudojimas: dxdiag [/whql:off | /whql:on] [/t failas | /x failas]"
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine interneto naršyklė"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr "Naudojimas: hostname\n"
......
......@@ -8005,6 +8005,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8669,6 +8669,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8555,6 +8555,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Verkenner"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8005,6 +8005,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8005,6 +8005,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8419,6 +8419,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8694,6 +8694,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8747,6 +8747,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Explorador de Internet Wine"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8055,6 +8055,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine ag�d"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8980,6 +8980,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8416,6 +8416,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8288,6 +8288,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "E&xplore"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8449,6 +8449,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8394,6 +8394,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8448,6 +8448,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8417,6 +8417,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8005,6 +8005,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8141,6 +8141,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8788,6 +8788,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "A&raştır"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8426,6 +8426,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Оглядач Інтернету Wine"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8104,6 +8104,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "E&xplore"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -7981,6 +7981,10 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
msgid "Wine Explorer"
msgstr ""
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8381,6 +8381,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -8436,6 +8436,11 @@ msgstr ""
msgid "Usage: dxdiag [/whql:off | /whql:on] [/t filename | /x filename]"
msgstr ""
#: explorer.rc:28
#, fuzzy
msgid "Wine Explorer"
msgstr "Wine Internet Explorer"
#: hostname.rc:27
msgid "Usage: hostname\n"
msgstr ""
......
......@@ -2,7 +2,7 @@ EXTRADEFS = -DWINE_NO_UNICODE_MACROS
MODULE = explorer.exe
APPMODE = -mwindows -municode
IMPORTS = rpcrt4 user32 gdi32 advapi32
DELAYIMPORTS = comctl32
DELAYIMPORTS = comctl32 shell32 ole32
C_SRCS = \
appbar.c \
......@@ -10,4 +10,7 @@ C_SRCS = \
explorer.c \
systray.c
RC_SRCS = explorer.rc
PO_SRCS = explorer.rc
@MAKE_PROG_RULES@
......@@ -3,6 +3,7 @@
*
* Copyright 2004 CodeWeavers, Mike Hearn
* Copyright 2005,2006 CodeWeavers, Aric Stewart
* Copyright 2011 Jay Yang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
......@@ -19,10 +20,30 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <windows.h>
#define COBJMACROS
#include "wine/unicode.h"
#include "wine/debug.h"
#include "explorer_private.h"
#include "resource.h"
#include <initguid.h>
#include <windows.h>
#include <shobjidl.h>
#include <shlobj.h>
WINE_DEFAULT_DEBUG_CHANNEL(explorer);
#define EXPLORER_INFO_INDEX 0
#define DEFAULT_WIDTH 640
#define DEFAULT_HEIGHT 480
static const WCHAR EXPLORER_CLASS[] = {'W','I','N','E','_','E','X','P','L','O','R','E','R','\0'};
HINSTANCE explorer_hInstance;
typedef struct parametersTAG {
BOOL explorer_mode;
......@@ -30,8 +51,116 @@ typedef struct parametersTAG {
WCHAR selection[MAX_PATH];
} parameters_struct;
typedef struct
{
IExplorerBrowser *browser;
} explorer_info;
static void make_explorer_window(IShellFolder* startFolder)
{
RECT explorerRect;
HWND window;
FOLDERSETTINGS fs;
explorer_info *info;
HRESULT hres;
WCHAR explorer_title[100];
LoadStringW(explorer_hInstance,IDS_EXPLORER_TITLE,explorer_title,
sizeof(explorer_title)/sizeof(WCHAR));
info = HeapAlloc(GetProcessHeap(),0,sizeof(explorer_info));
if(!info)
{
WINE_ERR("Could not allocate a explorer_info struct\n");
return;
}
hres = CoCreateInstance(&CLSID_ExplorerBrowser,NULL,CLSCTX_INPROC_SERVER,
&IID_IExplorerBrowser,(LPVOID*)&info->browser);
if(!SUCCEEDED(hres))
{
WINE_ERR("Could not obtain an instance of IExplorerBrowser\n");
HeapFree(GetProcessHeap(),0,info);
return;
}
window = CreateWindowW(EXPLORER_CLASS,explorer_title,WS_OVERLAPPEDWINDOW,
CW_USEDEFAULT,CW_USEDEFAULT,DEFAULT_WIDTH,
DEFAULT_HEIGHT,NULL,NULL,explorer_hInstance,NULL);
fs.ViewMode = FVM_DETAILS;
fs.fFlags = FWF_AUTOARRANGE;
explorerRect.left = 0;
explorerRect.top = 0;
explorerRect.right = DEFAULT_WIDTH;
explorerRect.bottom = DEFAULT_HEIGHT;
IExplorerBrowser_Initialize(info->browser,window,&explorerRect,&fs);
IExplorerBrowser_SetOptions(info->browser,EBO_SHOWFRAMES);
SetWindowLongPtrW(window,EXPLORER_INFO_INDEX,(LONG_PTR)info);
IExplorerBrowser_BrowseToObject(info->browser,(IUnknown*)startFolder,
SBSP_ABSOLUTE);
ShowWindow(window,SW_SHOWDEFAULT);
UpdateWindow(window);
}
static void update_window_size(explorer_info *info, int height, int width)
{
RECT new_rect;
new_rect.left = 0;
new_rect.top = 0;
new_rect.right = width;
new_rect.bottom = height;
IExplorerBrowser_SetRect(info->browser,NULL,new_rect);
}
static int CopyPathString(LPWSTR target, LPWSTR source)
static void do_exit(int code)
{
OleUninitialize();
ExitProcess(code);
}
LRESULT CALLBACK explorer_wnd_proc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
explorer_info *info
= (explorer_info*)GetWindowLongPtrW(hwnd,EXPLORER_INFO_INDEX);
IExplorerBrowser *browser = NULL;
if(info)
browser = info->browser;
switch(uMsg)
{
case WM_DESTROY:
IExplorerBrowser_Release(browser);
HeapFree(GetProcessHeap(),0,info);
PostQuitMessage(0);
break;
case WM_QUIT:
do_exit(wParam);
case WM_SIZE:
update_window_size(info,HIWORD(lParam),LOWORD(lParam));
break;
default:
return DefWindowProcW(hwnd,uMsg,wParam,lParam);
}
return 0;
}
static void register_explorer_window_class(void)
{
WNDCLASSEXW window_class;
window_class.cbSize = sizeof(WNDCLASSEXW);
window_class.style = 0;
window_class.cbClsExtra = 0;
window_class.cbWndExtra = sizeof(LONG_PTR);
window_class.lpfnWndProc = explorer_wnd_proc;
window_class.hInstance = explorer_hInstance;
window_class.hIcon = NULL;
window_class.hCursor = NULL;
window_class.hbrBackground = NULL;
window_class.lpszMenuName = NULL;
window_class.lpszClassName = EXPLORER_CLASS;
window_class.hIconSm = NULL;
RegisterClassExW(&window_class);
}
static int copy_path_string(LPWSTR target, LPWSTR source)
{
INT i = 0;
......@@ -54,7 +183,7 @@ static int CopyPathString(LPWSTR target, LPWSTR source)
}
static void CopyPathRoot(LPWSTR root, LPWSTR path)
static void copy_path_root(LPWSTR root, LPWSTR path)
{
LPWSTR p,p2;
INT i = 0;
......@@ -86,7 +215,7 @@ static void CopyPathRoot(LPWSTR root, LPWSTR path)
* [/root,object] Specifies the root level of the view
* [/select,object] parent folder is opened and specified object is selected
*/
static void ParseCommandLine(LPWSTR commandline,parameters_struct *parameters)
static void parse_command_line(LPWSTR commandline,parameters_struct *parameters)
{
static const WCHAR arg_n[] = {'/','n'};
static const WCHAR arg_e[] = {'/','e',','};
......@@ -113,15 +242,15 @@ static void ParseCommandLine(LPWSTR commandline,parameters_struct *parameters)
else if (strncmpW(p, arg_root, sizeof(arg_root)/sizeof(WCHAR))==0)
{
p += sizeof(arg_root)/sizeof(WCHAR);
p+=CopyPathString(parameters->root,p);
p+=copy_path_string(parameters->root,p);
}
else if (strncmpW(p, arg_select, sizeof(arg_select)/sizeof(WCHAR))==0)
{
p += sizeof(arg_select)/sizeof(WCHAR);
p+=CopyPathString(parameters->selection,p);
p+=copy_path_string(parameters->selection,p);
if (!parameters->root[0])
CopyPathRoot(parameters->root,
parameters->selection);
copy_path_root(parameters->root,
parameters->selection);
}
else if (strncmpW(p, arg_desktop, sizeof(arg_desktop)/sizeof(WCHAR))==0)
{
......@@ -136,7 +265,7 @@ static void ParseCommandLine(LPWSTR commandline,parameters_struct *parameters)
if (p2 && *p2)
{
/* left over command line is generally the path to be opened */
CopyPathString(parameters->root,p2);
copy_path_string(parameters->root,p2);
}
}
......@@ -145,56 +274,29 @@ int WINAPI wWinMain(HINSTANCE hinstance,
LPWSTR cmdline,
int cmdshow)
{
STARTUPINFOW si;
PROCESS_INFORMATION info;
parameters_struct parameters;
BOOL rc;
static const WCHAR winefile[] = {'\\','w','i','n','e','f','i','l','e','.','e','x','e',0};
static const WCHAR space[] = {' ',0};
WCHAR app[MAX_PATH];
LPWSTR winefile_commandline = NULL;
DWORD len = 0;
HRESULT hres;
MSG msg;
IShellFolder *folder;
memset(&parameters,0,sizeof(parameters));
memset(&si,0,sizeof(STARTUPINFOW));
ParseCommandLine(cmdline,&parameters);
len = GetSystemDirectoryW( NULL, 0 ) + sizeof(winefile)/sizeof(WCHAR);
if (parameters.selection[0]) len += lstrlenW(parameters.selection) + 2;
else if (parameters.root[0]) len += lstrlenW(parameters.root) + 3;
winefile_commandline = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR));
GetSystemDirectoryW( app, MAX_PATH - sizeof(winefile)/sizeof(WCHAR) );
strcatW( app, winefile );
strcpyW( winefile_commandline, app );
if (parameters.selection[0])
explorer_hInstance = hinstance;
parse_command_line(cmdline,&parameters);
hres = OleInitialize(NULL);
if(!SUCCEEDED(hres))
{
lstrcatW(winefile_commandline,space);
lstrcatW(winefile_commandline,parameters.selection);
WINE_ERR("Could not initialize COM\n");
ExitProcess(EXIT_FAILURE);
}
else if (parameters.root[0])
register_explorer_window_class();
SHGetDesktopFolder(&folder);
make_explorer_window(folder);
IShellFolder_Release(folder);
while(GetMessageW( &msg, NULL, 0, 0 ) != 0)
{
lstrcatW(winefile_commandline,space);
lstrcatW(winefile_commandline,parameters.root);
if (winefile_commandline[lstrlenW(winefile_commandline)-1]!='\\')
{
static const WCHAR slash[] = {'\\',0};
lstrcatW(winefile_commandline,slash);
}
TranslateMessage(&msg);
DispatchMessageW(&msg);
}
rc = CreateProcessW(app, winefile_commandline, NULL, NULL, FALSE, 0, NULL,
parameters.root[0] ? parameters.root:NULL, &si, &info);
HeapFree(GetProcessHeap(),0,winefile_commandline);
if (!rc)
return 0;
CloseHandle(info.hThread);
WaitForSingleObject(info.hProcess,INFINITE);
CloseHandle(info.hProcess);
return 0;
}
/*
* Explorer resources
*
* Copyright 2011 Jay Yang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "windef.h"
#include "resource.h"
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE
{
IDS_EXPLORER_TITLE "Wine Explorer"
}
/*
* Explorer resource definitions
*
* Copyright 2011 Jay Yang
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef __WINE_EXPLORER_RESOURCE_H
#define __WINE_EXPLORER_RESOURCE_H
#define IDS_EXPLORER_TITLE 1
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment