diff --git a/programs/winecfg/Makefile.in b/programs/winecfg/Makefile.in index 91639a6c9d8..8244caa69ff 100644 --- a/programs/winecfg/Makefile.in +++ b/programs/winecfg/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = winecfg.exe APPMODE = -mwindows -IMPORTS = comdlg32 comctl32 user32 advapi32 kernel32 +IMPORTS = comdlg32 comctl32 shell32 ole32 shlwapi user32 advapi32 kernel32 C_SRCS = \ appdefaults.c \ diff --git a/programs/winecfg/driveui.c b/programs/winecfg/driveui.c index 52f7e1bc35f..a485ff662a9 100644 --- a/programs/winecfg/driveui.c +++ b/programs/winecfg/driveui.c @@ -517,6 +517,66 @@ static void paint(HWND dialog) EndPaint(dialog, &ps); } +static void browse_for_folder(HWND dialog) +{ + static WCHAR wszUnixRootDisplayName[] = + { ':',':','{','C','C','7','0','2','E','B','2','-','7','D','C','5','-','1','1','D','9','-', + 'C','6','8','7','-','0','0','0','4','2','3','8','A','0','1','C','D','}','\\','/', 0 }; + BROWSEINFOA bi = { + dialog, + NULL, + NULL, + "Select the unix directory to be mapped, please.", + 0, + NULL, + 0, + 0 + }; + IShellFolder *pDesktop; + LPITEMIDLIST pidlUnixRoot, pidlSelectedPath; + HRESULT hr; + + hr = SHGetDesktopFolder(&pDesktop); + if (!SUCCEEDED(hr)) return; + + hr = pDesktop->lpVtbl->ParseDisplayName(pDesktop, NULL, NULL, wszUnixRootDisplayName, NULL, + &pidlUnixRoot, NULL); + if (!SUCCEEDED(hr)) { + pDesktop->lpVtbl->Release(pDesktop); + return; + } + + bi.pidlRoot = pidlUnixRoot; + pidlSelectedPath = SHBrowseForFolderA(&bi); + + SHFree(pidlUnixRoot); + + if (pidlSelectedPath) { + STRRET strSelectedPath; + char *pszSelectedPath; + HRESULT hr; + + hr = pDesktop->lpVtbl->GetDisplayNameOf(pDesktop, pidlSelectedPath, SHGDN_FORPARSING, + &strSelectedPath); + pDesktop->lpVtbl->Release(pDesktop); + if (!SUCCEEDED(hr)) { + SHFree(pidlSelectedPath); + return; + } + + hr = StrRetToStr(&strSelectedPath, pidlSelectedPath, &pszSelectedPath); + SHFree(pidlSelectedPath); + if (!SUCCEEDED(hr)) return; + + HeapFree(GetProcessHeap(), 0, current_drive->unixpath); + current_drive->unixpath = strdupA(pszSelectedPath); + fill_drives_list(dialog); + update_controls(dialog); + + CoTaskMemFree(pszSelectedPath); + } +} + INT_PTR CALLBACK DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam) { @@ -588,7 +648,7 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam) break; case IDC_BUTTON_BROWSE_PATH: - MessageBox(dialog, "", "Write me!", MB_OK); + browse_for_folder(dialog); break; case IDC_RADIO_ASSIGN: diff --git a/programs/winecfg/main.c b/programs/winecfg/main.c index d1eb36aef87..e981bb20072 100644 --- a/programs/winecfg/main.c +++ b/programs/winecfg/main.c @@ -37,6 +37,7 @@ #include #include #include +#include #include #include "properties.h" @@ -248,16 +249,17 @@ WinMain (HINSTANCE hInstance, HINSTANCE hPrev, LPSTR szCmdLine, int nShow) } /* - * The next 3 lines should be all that is needed + * The next 9 lines should be all that is needed * for the Wine Configuration property sheet */ InitCommonControls (); + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); if (doPropertySheet (hInstance, NULL) > 0) { WINE_TRACE("OK\n"); } else { WINE_TRACE("Cancel\n"); } - + CoUninitialize(); ExitProcess (0); return 0;