diff options
author | Alexander Gluzsky <sss123next@list.ru> | 2015-03-31 10:36:37 +0000 |
---|---|---|
committer | Alexander Gluzsky <sss123next@list.ru> | 2015-03-31 10:36:37 +0000 |
commit | a9feca3461062a266adf9e240a2f436ca27b4ffb (patch) | |
tree | 6fac9b82265819fa699c8ca5cde56655e4d71afa /plugins | |
parent | 3d6f59b3c14b9775a476a98b995b9c443cdeb0d1 (diff) |
new_gpg:
various startup validation fixes
git-svn-id: http://svn.miranda-ng.org/main/trunk@12572 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/New_GPG/src/gpg_wrapper.cpp | 8 | ||||
-rwxr-xr-x | plugins/New_GPG/src/main.cpp | 4 | ||||
-rwxr-xr-x | plugins/New_GPG/src/utilities.cpp | 8 |
3 files changed, 12 insertions, 8 deletions
diff --git a/plugins/New_GPG/src/gpg_wrapper.cpp b/plugins/New_GPG/src/gpg_wrapper.cpp index 1f2e6090fe..57f8d79205 100755 --- a/plugins/New_GPG/src/gpg_wrapper.cpp +++ b/plugins/New_GPG/src/gpg_wrapper.cpp @@ -62,7 +62,7 @@ pxResult pxExecute(std::vector<std::wstring> &aargv, string *aoutput, LPDWORD ae if(bDebugLog) { std::wstring args; - for(int i = 0; i < argv.size(); ++i) + for(unsigned int i = 0; i < argv.size(); ++i) { args += argv[i]; args += L" "; @@ -79,10 +79,10 @@ pxResult pxExecute(std::vector<std::wstring> &aargv, string *aoutput, LPDWORD ae file_descriptor_sink sout(pout.sink, close_handle); file_descriptor_sink serr(perr.sink, close_handle); - char *mir_path = new char [MAX_PATH]; - PathToAbsolute("\\", mir_path); + TCHAR *mir_path = new TCHAR [MAX_PATH]; + PathToAbsoluteW(_T("\\"), mir_path); - c = new child(execute(set_args(argv), bind_stdout(sout), bind_stderr(serr), close_stdin(),/*bind_stdin(sin),*/ show_window(SW_HIDE), hide_console(), inherit_env(), set_env(env), start_in_dir(toUTF16(mir_path)))); + c = new child(execute(set_args(argv), bind_stdout(sout), bind_stderr(serr), close_stdin(),/*bind_stdin(sin),*/ show_window(SW_HIDE), hide_console(), inherit_env(), set_env(env), start_in_dir(mir_path))); _child = c; delete [] mir_path; diff --git a/plugins/New_GPG/src/main.cpp b/plugins/New_GPG/src/main.cpp index cf37f2482c..8c653b32f8 100755 --- a/plugins/New_GPG/src/main.cpp +++ b/plugins/New_GPG/src/main.cpp @@ -2013,7 +2013,11 @@ void FirstRun() void InitCheck() { {//parse gpg output + TCHAR *current_home = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); + db_set_ts(NULL, szGPGModuleName, "szHomePath", _T("")); //we do not need home for gpg binary validation gpg_valid = isGPGValid(); + db_set_ts(NULL, szGPGModuleName, "szHomePath", current_home); //return current home dir back + mir_free(current_home); bool home_dir_access = false, temp_access = false; TCHAR *home_dir = UniGetContactSettingUtf(NULL, szGPGModuleName, "szHomePath", _T("")); std::wstring test_path = home_dir; diff --git a/plugins/New_GPG/src/utilities.cpp b/plugins/New_GPG/src/utilities.cpp index ef3d0977e8..6fddc89a2e 100755 --- a/plugins/New_GPG/src/utilities.cpp +++ b/plugins/New_GPG/src/utilities.cpp @@ -1129,10 +1129,10 @@ bool isGPGValid() mir_free(tmp); tmp = NULL; TCHAR *path = (TCHAR*)mir_alloc(sizeof(TCHAR)*MAX_PATH); - char *mir_path = (char*)mir_alloc(MAX_PATH); - PathToAbsolute("\\", mir_path); - SetCurrentDirectoryA(mir_path); - tmp = mir_a2t(mir_path); + TCHAR *mir_path = (TCHAR*)mir_alloc(MAX_PATH * sizeof(TCHAR)); + PathToAbsoluteW(_T("\\"), mir_path); + SetCurrentDirectoryW(mir_path); + tmp = mir_tstrdup(mir_path); mir_free(mir_path); //mir_realloc(path, (_tcslen(path)+64)*sizeof(TCHAR)); TCHAR *gpg_path = (TCHAR*)mir_alloc(sizeof(TCHAR)*MAX_PATH); |