mirror of
git://git.gnupg.org/gnupg.git
synced 2024-12-22 10:19:57 +01:00
w32: Fix spawn functions to support Windows Xp.
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
This commit is contained in:
parent
b9e65faa5d
commit
768d365b0f
@ -452,6 +452,30 @@ post_syscall (void)
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Check if STARTUPINFOEXW supports PROC_THREAD_ATTRIBUTE_HANDLE_LIST.
|
||||
*/
|
||||
static int
|
||||
check_windows_version (void)
|
||||
{
|
||||
static int is_vista_or_later = -1;
|
||||
|
||||
OSVERSIONINFO osvi;
|
||||
|
||||
if (is_vista_or_later == -1)
|
||||
{
|
||||
memset (&osvi,0,sizeof(osvi));
|
||||
osvi.dwOSVersionInfoSize = sizeof(osvi);
|
||||
GetVersionEx (&osvi);
|
||||
|
||||
/* The feature is available on Vista or later. */
|
||||
is_vista_or_later = (osvi.dwMajorVersion >= 6);
|
||||
}
|
||||
|
||||
return is_vista_or_later;
|
||||
}
|
||||
|
||||
|
||||
static gpg_err_code_t
|
||||
spawn_detached (const char *pgmname, char *cmdline,
|
||||
void (*spawn_cb) (struct spawn_cb_arg *), void *spawn_cb_arg)
|
||||
@ -505,6 +529,8 @@ spawn_detached (const char *pgmname, char *cmdline,
|
||||
}
|
||||
|
||||
if (j)
|
||||
{
|
||||
if (check_windows_version ())
|
||||
{
|
||||
InitializeProcThreadAttributeList (NULL, 1, 0, &attr_list_size);
|
||||
si.lpAttributeList = xtrymalloc (attr_list_size);
|
||||
@ -518,6 +544,8 @@ spawn_detached (const char *pgmname, char *cmdline,
|
||||
UpdateProcThreadAttribute (si.lpAttributeList, 0,
|
||||
PROC_THREAD_ATTRIBUTE_HANDLE_LIST,
|
||||
hd, sizeof (HANDLE) * j, NULL, NULL);
|
||||
}
|
||||
|
||||
ask_inherit = TRUE;
|
||||
}
|
||||
}
|
||||
@ -783,6 +811,8 @@ gnupg_process_spawn (const char *pgmname, const char *argv[],
|
||||
}
|
||||
|
||||
if (j)
|
||||
{
|
||||
if (check_windows_version ())
|
||||
{
|
||||
InitializeProcThreadAttributeList (NULL, 1, 0, &attr_list_size);
|
||||
si.lpAttributeList = xtrymalloc (attr_list_size);
|
||||
@ -812,6 +842,7 @@ gnupg_process_spawn (const char *pgmname, const char *argv[],
|
||||
UpdateProcThreadAttribute (si.lpAttributeList, 0,
|
||||
PROC_THREAD_ATTRIBUTE_HANDLE_LIST,
|
||||
hd, sizeof (HANDLE) * j, NULL, NULL);
|
||||
}
|
||||
ask_inherit = TRUE;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user