diff options
Diffstat (limited to 'options.cpp')
-rw-r--r-- | options.cpp | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/options.cpp b/options.cpp index 4f2dbce..906119a 100644 --- a/options.cpp +++ b/options.cpp @@ -139,7 +139,6 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA return TRUE;
case IDC_DELETE_KEY_BUTTON:
{ //gpg execute block
- TCHAR cmd[40960] = {0};
TCHAR tmp2[MAX_PATH] = {0};
TCHAR *ptmp;
char *tmp;
@@ -161,15 +160,14 @@ static BOOL CALLBACK DlgProcGpgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA }
if(!keep)
{
+ wstring cmd;
string output;
DWORD exitcode;
- _tcscat(cmd, _T(" --batch"));
- _tcscat(cmd, _T(" --yes"));
- _tcscat(cmd, _T(" --delete-key "));
+ cmd += _T(" --batch --yes --delete-key ");
ptmp = mir_a2t(tmp);
- _tcscat(cmd, ptmp);
+ cmd += ptmp;
mir_free(ptmp);
- pxExecute(cmd, "", &output,&exitcode);
+ pxExecute(&cmd, "", &output,&exitcode);
MessageBoxA(0, "Key removed from GPG keyring", "info", MB_OK);
}
mir_free(tmp);
@@ -351,12 +349,12 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP _tcscpy(tmp, key_buf.substr(ws1,ws2-ws1).c_str());
ListView_SetItemText(hwndList_p, item_num, 2, tmp);
{ //gpg execute block
- TCHAR cmd[4096] = {0};
+ wstring cmd;
TCHAR tmp2[MAX_PATH] = {0};
TCHAR *ptmp;
string output;
DWORD exitcode;
- _tcscat(cmd, _T(" --import "));
+
{
ptmp = UniGetContactSettingUtf(NULL, szModuleName, "szHomePath", _T(""));
_tcscpy(tmp2, ptmp);
@@ -374,11 +372,11 @@ static BOOL CALLBACK DlgProcLoadPublicKey(HWND hwndDlg,UINT msg,WPARAM wParam,LP }
f<<str.c_str();
f.close();
- _tcscat(cmd, _T(" \""));
- _tcscat(cmd, tmp2);
- _tcscat(cmd, _T("\""));
+ cmd += _T(" --import \"");
+ cmd += tmp2;
+ cmd += _T("\"");
}
- pxExecute(cmd, "", &output, &exitcode);
+ pxExecute(&cmd, "", &output, &exitcode);
cp866_to_cp1251(&output);
{
string::size_type s = output.find("gpg: key ") + strlen("gpg: key ");
|