Changeset View
Changeset View
Standalone View
Standalone View
src/gpgme-w32spawn.c
Show First 20 Lines • Show All 46 Lines • ▼ Show 20 Lines | |||||
#define PGM "gpgme-w32spawn" | #define PGM "gpgme-w32spawn" | ||||
#ifdef DEBUG_TO_FILE | #ifdef DEBUG_TO_FILE | ||||
static FILE *mystderr; | static FILE *mystderr; | ||||
#else | #else | ||||
#define mystderr stderr | #define mystderr stderr | ||||
#endif | #endif | ||||
typedef BOOL (WINAPI * AllowSetForegroundWindowFunc)(DWORD); | |||||
␌ | ␌ | ||||
static wchar_t * | static wchar_t * | ||||
build_commandline (wchar_t **argv) | build_commandline (wchar_t **argv) | ||||
{ | { | ||||
int i; | int i; | ||||
int n = 0; | int n = 0; | ||||
wchar_t *buf; | wchar_t *buf; | ||||
▲ Show 20 Lines • Show All 171 Lines • ▼ Show 20 Lines | if (hnul != INVALID_HANDLE_VALUE) | ||||
CloseHandle (hnul); | CloseHandle (hnul); | ||||
for (i = 0; fd_list[i].fd != -1; i++) | for (i = 0; fd_list[i].fd != -1; i++) | ||||
CloseHandle ((HANDLE) fd_list[i].fd); | CloseHandle ((HANDLE) fd_list[i].fd); | ||||
if (flags & IOSPAWN_FLAG_ALLOW_SET_FG) | if (flags & IOSPAWN_FLAG_ALLOW_SET_FG) | ||||
{ | { | ||||
static int initialized; | static int initialized; | ||||
static BOOL (WINAPI * func)(DWORD); | static AllowSetForegroundWindowFunc func; | ||||
void *handle; | void *handle; | ||||
if (!initialized) | if (!initialized) | ||||
{ | { | ||||
/* Available since W2000; thus we dynload it. */ | /* Available since W2000; thus we dynload it. */ | ||||
initialized = 1; | initialized = 1; | ||||
handle = LoadLibraryA ("user32.dll"); | handle = LoadLibraryA ("user32.dll"); | ||||
if (handle) | if (handle) | ||||
{ | { | ||||
func = GetProcAddress (handle, "AllowSetForegroundWindow"); | func = (AllowSetForegroundWindowFunc) GetProcAddress (handle, "AllowSetForegroundWindow"); | ||||
if (!func) | if (!func) | ||||
FreeLibrary (handle); | FreeLibrary (handle); | ||||
} | } | ||||
} | } | ||||
if (func) | if (func) | ||||
{ | { | ||||
int rc = func (pi.dwProcessId); | int rc = func (pi.dwProcessId); | ||||
▲ Show 20 Lines • Show All 245 Lines • Show Last 20 Lines |