diff --git a/source/lib/sysdep/sysdep.h b/source/lib/sysdep/sysdep.h index da061f5a4f..6f54062b7d 100755 --- a/source/lib/sysdep/sysdep.h +++ b/source/lib/sysdep/sysdep.h @@ -34,6 +34,8 @@ extern int clipboard_free(wchar_t* copy); extern int get_executable_name(char* n_path, size_t buf_size); +extern int pick_directory(char* n_path, size_t buf_size); + #ifdef _MSC_VER extern double round(double); diff --git a/source/lib/sysdep/win/wdbg.cpp b/source/lib/sysdep/win/wdbg.cpp index 278378a5b4..2ce6ef864c 100755 --- a/source/lib/sysdep/win/wdbg.cpp +++ b/source/lib/sysdep/win/wdbg.cpp @@ -31,7 +31,7 @@ #include "assert_dlg.h" -#define LOCALISED_TEXT +//#define LOCALISED_TEXT #ifdef LOCALISED_TEXT #include "ps/i18n.h" @@ -763,12 +763,14 @@ int debug_main_exception_filter(unsigned int UNUSEDPARAM(code), PEXCEPTION_POINT { if (ep->ExceptionRecord->NumberParameters == 3) { +/*/* PSERROR* err = (PSERROR*) ep->ExceptionRecord->ExceptionInformation[1]; if (err->magic == 0x45725221) { int code = err->code; error = GetErrorString(code); } +*/ } } __except (EXCEPTION_EXECUTE_HANDLER) diff --git a/source/lib/sysdep/win/win.cpp b/source/lib/sysdep/win/win.cpp index 4c77e9f6ed..35650e3edf 100755 --- a/source/lib/sysdep/win/win.cpp +++ b/source/lib/sysdep/win/win.cpp @@ -26,6 +26,7 @@ #include #include // __argc #include +#include // pick_dir extern HWND hWnd; @@ -56,6 +57,43 @@ inline int get_executable_name(char* n_path, size_t buf_size) return nbytes? 0 : -1; } +static int CALLBACK browse_cb(HWND hWnd, unsigned int msg, LPARAM lParam, LPARAM ldata) +{ + if(msg == BFFM_INITIALIZED) + { + const char* cur_dir = (const char*)ldata; + SendMessage(hWnd, BFFM_SETSELECTIONA, 1, (LPARAM)cur_dir); + return 1; + } + + return 0; +} + +int pick_directory(char* path, size_t buf_size) +{ + IMalloc* p_malloc; + SHGetMalloc(&p_malloc); + + GetCurrentDirectory(PATH_MAX, path); + +/// ShowWindow(hWnd, SW_HIDE); + + BROWSEINFOA bi; + memset(&bi, 0, sizeof(bi)); + bi.ulFlags = BIF_RETURNONLYFSDIRS; + bi.lpfn = (BFFCALLBACK)browse_cb; + bi.lParam = (LPARAM)path; + ITEMIDLIST* pidl = SHBrowseForFolderA(&bi); + BOOL ok = SHGetPathFromIDList(pidl, path); + +/// ShowWindow(hWnd, SW_SHOW); + + p_malloc->Free(pidl); + p_malloc->Release(); + + return ok? 0 : -1; +} + void display_msg(const char* caption, const char* msg) {