if (CreateProcess (NULL, keyman, NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &si, &pi) == TRUE) { CloseHandle (pi.hProcess); CloseHandle (pi.hThread);
while (info && info->protocol != GPGME_PROTOCOL_OpenPGP) info = info->next; if (info && info->file_name && *info->file_name) { keyman = xmalloc (strlen (info->file_name) + 10); strcpy (keyman, info->file_name); for (p=keyman; *p; p++) if (*p == '/') *p = '\\'; p = strrchr (keyman, '\\'); if (!p) { xfree (keyman); return -1; } strcpy (p+1, "winpt.exe"); if (access (keyman, F_OK)) { strcpy (p+1, "gpa.exe"); if (access (keyman, F_OK)) { xfree (keyman); return -1; } } }
start_key_manager (void){    PROCESS_INFORMATION pi;    STARTUPINFO si;    char *keyman = NULL;        if (load_config_value (NULL, REGPATH, "keyManager", &keyman))	return -1;    /* create startup info for the gpg process */    memset (&si, 0, sizeof (si));    si.cb = sizeof (STARTUPINFO);    si.dwFlags = STARTF_USESHOWWINDOW;    si.wShowWindow = SW_SHOW;    if (CreateProcess (NULL, keyman,			NULL, NULL, TRUE, CREATE_DEFAULT_ERROR_MODE,			NULL, NULL, &si, &pi) == TRUE) {	CloseHandle (pi.hProcess);	CloseHandle (pi.hThread);    }    xfree (keyman);    return 0;}