diff --git a/pinentry/argparse.c b/pinentry/argparse.c --- a/pinentry/argparse.c +++ b/pinentry/argparse.c @@ -1168,7 +1168,7 @@ return 0; case ARGPARSE_TYPE_ULONG: - while (isascii (*s) && isspace(*s)) + while (isascii (*s) && isspace((unsigned char)*s)) s++; if (*s == '-') { diff --git a/tty/pinentry-tty.c b/tty/pinentry-tty.c --- a/tty/pinentry-tty.c +++ b/tty/pinentry-tty.c @@ -131,7 +131,7 @@ highlight++; continue; } - if (!isalnum (*highlight)) + if (!isalnum ((unsigned char)*highlight)) /* Unusable accelerator. */ continue; break; @@ -141,7 +141,7 @@ /* Not accelerator. Take the first alpha-numeric character. */ { highlight = text; - while (*highlight && !isalnum (*highlight)) + while (*highlight && !isalnum ((unsigned char)*highlight)) highlight ++; } diff --git a/w32/main.c b/w32/main.c --- a/w32/main.c +++ b/w32/main.c @@ -19,9 +19,7 @@ #include #include #include -#if WINVER < 0x0403 -# define WINVER 0x0403 /* Required for SendInput. */ -#endif +#include #include #ifdef HAVE_W32CE_SYSTEM # include @@ -36,21 +34,11 @@ #define PGMNAME "pinentry-w32" -#ifndef LSFW_LOCK -# define LSFW_LOCK 1 -# define LSFW_UNLOCK 2 -#endif - #ifndef debugfp #define debugfp stderr #endif -/* This function pointer gets initialized in main. */ -#ifndef HAVE_W32CE_SYSTEM -static BOOL WINAPI (*lock_set_foreground_window)(UINT); -#endif - static int w32_cmd_handler (pinentry_t pe); static void ok_button_clicked (HWND dlg, pinentry_t pe); @@ -279,59 +267,6 @@ -static void -move_mouse_and_click (HWND hwnd) -{ -#ifndef HAVE_W32CE_SYSTEM - RECT rect; - HDC hdc; - int wscreen, hscreen, x, y, normx, normy; - INPUT inp[3]; - int idx; - - hdc = GetDC (hwnd); - wscreen = GetDeviceCaps (hdc, HORZRES); - hscreen = GetDeviceCaps (hdc, VERTRES); - ReleaseDC (hwnd, hdc); - if (wscreen < 10 || hscreen < 10) - return; - - GetWindowRect (hwnd, &rect); - x = rect.left; - y = rect.bottom; - - normx = x * (65535 / wscreen); - if (normx < 0 || normx > 65535) - return; - normy = y * (65535 / hscreen); - if (normy < 0 || normy > 65535) - return; - - for (idx=0; idx < 3; idx++) - memset (&inp[idx], 0, sizeof inp[idx]); - - idx=0; - inp[idx].type = INPUT_MOUSE; - inp[idx].mi.dx = normx; - inp[idx].mi.dy = normy; - inp[idx].mi.dwFlags = MOUSEEVENTF_MOVE | MOUSEEVENTF_ABSOLUTE; - idx++; - - inp[idx].type = INPUT_MOUSE; - inp[idx].mi.dwFlags = MOUSEEVENTF_LEFTDOWN; - idx++; - - inp[idx].type = INPUT_MOUSE; - inp[idx].mi.dwFlags = MOUSEEVENTF_LEFTUP; - idx++; - - if ( (SendInput (idx, inp, sizeof (INPUT)) != idx) && debugfp) - fprintf (debugfp, "SendInput failed: %s\n", w32_strerror (-1)); -#endif -} - - - /* Resize the button so that STRING fits into it. */ static void resize_button (HWND hwnd, const char *string) @@ -339,6 +274,8 @@ if (!hwnd) return; + (void)string; + /* FIXME: Need to figure out how to convert dialog coorddnates to screen coordinates and how buttons should be placed. */ /* SetWindowPos (hbutton, NULL, */ @@ -421,7 +358,7 @@ /* Dialog processing loop. */ -static BOOL CALLBACK +static INT_PTR CALLBACK dlg_proc (HWND dlg, UINT msg, WPARAM wparam, LPARAM lparam) { static pinentry_t pe; @@ -477,19 +414,8 @@ center_window (dlg, HWND_TOP); - /* Unfortunately we can't use SetForegroundWindow because there - is no easy eay to have all the calling processes do an - AllowSetForegroundWindow. What we do instead is to bad hack - by simulating a click to the Window. */ -/* if (SetForegroundWindow (dlg) && lock_set_foreground_window) */ -/* { */ -/* lock_set_foreground_window (LSFW_LOCK); */ -/* } */ - /* show_window_hierarchy (GetDesktopWindow (), 0); */ - ShowWindow (dlg, SW_SHOW); - move_mouse_and_click ( GetDlgItem (dlg, IDC_PINENT_PROMPT) ); raise_sip (dlg); break; @@ -571,8 +497,6 @@ static int w32_cmd_handler (pinentry_t pe) { -/* HWND lastwindow = GetForegroundWindow (); */ - confirm_mode = !pe->pin; passphrase_ok = confirm_yes = 0; @@ -580,14 +504,7 @@ dialog_handle = NULL; DialogBoxParam (GetModuleHandle (NULL), MAKEINTRESOURCE (IDD_PINENT), GetDesktopWindow (), dlg_proc, (LPARAM)pe); - if (dialog_handle) - { -/* if (lock_set_foreground_window) */ -/* lock_set_foreground_window (LSFW_UNLOCK); */ -/* if (lastwindow) */ -/* SetForegroundWindow (lastwindow); */ - } - else + if (!dialog_handle) return -1; if (confirm_mode) @@ -676,10 +593,6 @@ int main (int argc, char **argv) { -#ifndef HAVE_W32CE_SYSTEM - void *handle; -#endif - w32_infd = STDIN_FILENO; w32_outfd = STDOUT_FILENO; @@ -695,21 +608,6 @@ /* if (!debugfp) */ /* debugfp = stderr; */ - /* We need to load a function because that one is only available - since W2000 but not in older NTs. */ -#ifndef HAVE_W32CE_SYSTEM - handle = LoadLibrary ("user32.dll"); - if (handle) - { - void *foo; - foo = GetProcAddress (handle, "LockSetForegroundWindow"); - if (foo) - lock_set_foreground_window = foo; - else - CloseHandle (handle); - } -#endif - if (pinentry_loop2 (w32_infd, w32_outfd)) return 1; diff --git a/w32/pinentry-w32.rc b/w32/pinentry-w32.rc --- a/w32/pinentry-w32.rc +++ b/w32/pinentry-w32.rc @@ -51,20 +51,20 @@ IDB_ICON_96 BITMAP DISCARDABLE "logo-96.bmp" IDB_ICON_128 BITMAP DISCARDABLE "logo-128.bmp" -IDD_PINENT DIALOG DISCARDABLE 0, 0, 186, 116 +IDD_PINENT DIALOG DISCARDABLE 0, 0, 230, 125 STYLE DS_MODALFRAME | DS_SYSMODAL | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Pinentry" FONT 10, "MS Sans Serif" BEGIN CONTROL "", IDC_PINENT_ICON, "Static", SS_BITMAP|SS_CENTERIMAGE, - 4, 6, 32, 32 - LTEXT "", IDC_PINENT_DESC, 40, 6, 140, 50 - RTEXT "", IDC_PINENT_PROMPT, 6, 60, 60, 12 - EDITTEXT IDC_PINENT_TEXT, 70, 59, 110, 12, ES_PASSWORD | ES_AUTOHSCROLL - CTEXT "", IDC_PINENT_ERR, 6, 76, 174, 12 - DEFPUSHBUTTON "O&K", IDOK, 74, 96, 50, 14 - PUSHBUTTON "&Cancel", IDCANCEL, 130, 96, 50, 14 + 5, 5, 32, 32 + LTEXT "", IDC_PINENT_DESC, 45, 5, 180, 65 + RTEXT "", IDC_PINENT_PROMPT, 5, 75, 60, 12 + EDITTEXT IDC_PINENT_TEXT, 70, 75, 155, 12, ES_PASSWORD | ES_AUTOHSCROLL + CTEXT "", IDC_PINENT_ERR, 5, 90, 220, 12 + DEFPUSHBUTTON "O&K", IDOK, 50, 105, 85, 14 + PUSHBUTTON "&Cancel", IDCANCEL, 140, 105, 85, 14 END