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: a82e3a0ae5

GnuPG-Bug-Id: T4453
This commit is contained in:
Andre Heinecke 2019-04-09 14:11:21 +02:00
parent a82e3a0ae5
commit ecbba12b86
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C

View File

@ -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);