summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndre Heinecke <aheinecke@gnupg.org>2019-04-09 14:11:21 +0200
committerAndre Heinecke <aheinecke@gnupg.org>2019-04-09 14:11:21 +0200
commitecbba12b869106ba03e10b7b7dd80f74d086831b (patch)
treed514c5d5ce6fb2f456e909c5b09d27284e60f739
parenta82e3a0ae57a48ba173e282a050680751006c074 (diff)
downloadgpgme-ecbba12b869106ba03e10b7b7dd80f74d086831b.tar.gz
core,w32: Fix new w32-util functions
* src/w32-util.c (_gpgme_access): Respect mode parameter. (_gpgme_create_process_utf8): Convert startupinfo, too. -- This both did not show up in testing as we only use mode F_OK and STARTUPINFOA is basically the same as STARTUPINFOW. Fixes commit: a82e3a0ae57a48ba173e282a050680751006c074 GnuPG-Bug-Id: T4453
-rw-r--r--src/w32-util.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/src/w32-util.c b/src/w32-util.c
index eced1396..6aa45f8f 100644
--- a/src/w32-util.c
+++ b/src/w32-util.c
@@ -832,12 +832,13 @@ int
_gpgme_access (const char *path, int mode)
{
wchar_t *u16 = utf8_to_wchar0 (path);
- int r = _waccess (u16, F_OK);
+ int r = _waccess (u16, mode);
free(u16);
return r;
}
+
/* Like CreateProcessA but mapping the arguments to wchar API */
int _gpgme_create_process_utf8 (const char *application_name_utf8,
char *command_line_utf8,
@@ -847,7 +848,7 @@ int _gpgme_create_process_utf8 (const char *application_name_utf8,
DWORD dwCreationFlags,
void *lpEnvironment,
char *working_directory_utf8,
- LPSTARTUPINFOA lpStartupInfo,
+ LPSTARTUPINFOA si,
LPPROCESS_INFORMATION lpProcessInformation)
{
BOOL ret;
@@ -855,6 +856,27 @@ int _gpgme_create_process_utf8 (const char *application_name_utf8,
wchar_t *command_line = utf8_to_wchar0 (command_line_utf8);
wchar_t *working_directory = utf8_to_wchar0 (working_directory_utf8);
+ STARTUPINFOW siw;
+ memset (&siw, 0, sizeof siw);
+ if (si)
+ {
+ siw.cb = sizeof (siw);
+ siw.dwFlags = si->dwFlags;
+ siw.wShowWindow = si->wShowWindow;
+ siw.hStdInput = si->hStdInput;
+ siw.hStdOutput = si->hStdOutput;
+ siw.hStdError = si->hStdError;
+ siw.dwX = si->dwX;
+ siw.dwY = si->dwY;
+ siw.dwXSize = si->dwXSize;
+ siw.dwYSize = si->dwYSize;
+ siw.dwXCountChars = si->dwXCountChars;
+ siw.dwYCountChars = si->dwYCountChars;
+ siw.dwFillAttribute = si->dwFillAttribute;
+ siw.lpDesktop = utf8_to_wchar0 (si->lpDesktop);
+ siw.lpTitle = utf8_to_wchar0 (si->lpTitle);
+ }
+
ret = CreateProcessW (application_name,
command_line,
lpProcessAttributes,
@@ -863,7 +885,7 @@ int _gpgme_create_process_utf8 (const char *application_name_utf8,
dwCreationFlags,
lpEnvironment,
working_directory,
- lpStartupInfo,
+ si ? &siw : NULL,
lpProcessInformation);
free (application_name);
free (command_line);