From d2d7a2b128e981740ee3a3c6e2859bec0202cb86 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 2 Jun 2022 16:10:37 +0200 Subject: [PATCH] Remove remaining support for WindowsCE -- --- agent/call-daemon.c | 5 +- agent/gpg-agent.c | 27 +++------- agent/protect.c | 6 --- common/init.c | 97 --------------------------------- common/iobuf.c | 24 ++------- common/mischelp.c | 22 -------- common/stringhelp.c | 6 --- common/sysutils.c | 110 +++++++------------------------------- common/t-dotlock.c | 6 --- common/t-stringhelp.c | 5 -- common/t-sysutils.c | 4 -- common/utf8conv.c | 4 -- common/util.h | 11 ---- common/w32help.h | 15 ------ g10/cpr.c | 2 - g10/decrypt.c | 5 -- g10/exec.c | 4 -- g10/tdbio.c | 32 +---------- kbx/keyboxd.c | 17 +----- sm/server.c | 15 +----- tools/Makefile.am | 20 +------ tools/gpg-connect-agent.c | 15 ++---- tools/gpgconf-comp.c | 7 ++- 23 files changed, 44 insertions(+), 415 deletions(-) diff --git a/agent/call-daemon.c b/agent/call-daemon.c index 26c25fcd9..f907f40eb 100644 --- a/agent/call-daemon.c +++ b/agent/call-daemon.c @@ -469,9 +469,7 @@ daemon_start (enum daemon_type type, ctrl_t ctrl) xfree (databuf); } - /* Tell the daemon we want him to send us an event signal. We - don't support this for W32CE. */ -#ifndef HAVE_W32CE_SYSTEM + /* Tell the daemon we want him to send us an event signal. */ if (opt.sigusr2_enabled) { char buf[100]; @@ -484,7 +482,6 @@ daemon_start (enum daemon_type type, ctrl_t ctrl) #endif assuan_transact (ctx, buf, NULL, NULL, NULL, NULL, NULL, NULL); } -#endif /*HAVE_W32CE_SYSTEM*/ g->primary_ctx = ctx; g->primary_ctx_reusable = 0; diff --git a/agent/gpg-agent.c b/agent/gpg-agent.c index d2ea91307..468427933 100644 --- a/agent/gpg-agent.c +++ b/agent/gpg-agent.c @@ -333,17 +333,12 @@ static struct debug_flags_s debug_flags [] = /* The timer tick used for housekeeping stuff. Note that on Windows * we use a SetWaitableTimer seems to signal earlier than about 2 - * seconds. Thus we use 4 seconds on all platforms except for - * Windowsce. CHECK_OWN_SOCKET_INTERVAL defines how often we check + * seconds. Thus we use 4 seconds on all platforms. + * CHECK_OWN_SOCKET_INTERVAL defines how often we check * our own socket in standard socket mode. If that value is 0 we * don't check at all. All values are in seconds. */ -#if defined(HAVE_W32CE_SYSTEM) -# define TIMERTICK_INTERVAL (60) -# define CHECK_OWN_SOCKET_INTERVAL (0) /* Never */ -#else -# define TIMERTICK_INTERVAL (4) -# define CHECK_OWN_SOCKET_INTERVAL (60) -#endif +#define TIMERTICK_INTERVAL (4) +#define CHECK_OWN_SOCKET_INTERVAL (60) /* Flag indicating that the ssh-agent subsystem has been enabled. */ @@ -2105,7 +2100,7 @@ get_agent_active_connection_count (void) /* Under W32, this function returns the handle of the scdaemon notification event. Calling it the first time creates that event. */ -#if defined(HAVE_W32_SYSTEM) && !defined(HAVE_W32CE_SYSTEM) +#if defined(HAVE_W32_SYSTEM) void * get_agent_daemon_notify_event (void) { @@ -2142,7 +2137,7 @@ get_agent_daemon_notify_event (void) return the_event; } -#endif /*HAVE_W32_SYSTEM && !HAVE_W32CE_SYSTEM*/ +#endif /*HAVE_W32_SYSTEM*/ @@ -2230,8 +2225,8 @@ create_server_socket (char *name, int primary, int cygwin, len = SUN_LEN (unaddr); rc = assuan_sock_bind (fd, addr, len); - /* Our error code mapping on W32CE returns EEXIST thus we also test - for this. */ + /* At least our error code mapping on Windows-CE used to return + * EEXIST thus we better test for this on Windows . */ if (rc == -1 && (errno == EADDRINUSE #ifdef HAVE_W32_SYSTEM @@ -2895,14 +2890,8 @@ handle_connections (gnupg_fd_t listen_fd, npth_sigev_add (SIGTERM); npth_sigev_fini (); #else -# ifdef HAVE_W32CE_SYSTEM - /* Use a dummy event. */ - sigs = 0; - ev = pth_event (PTH_EVENT_SIGS, &sigs, &signo); -# else events[0] = get_agent_daemon_notify_event (); events[1] = INVALID_HANDLE_VALUE; -# endif #endif if (disable_check_own_socket) diff --git a/agent/protect.c b/agent/protect.c index 30ee1345d..bc44fe107 100644 --- a/agent/protect.c +++ b/agent/protect.c @@ -122,15 +122,9 @@ static void calibrate_get_time (struct calibrate_time_s *data) { #ifdef HAVE_W32_SYSTEM -# ifdef HAVE_W32CE_SYSTEM - GetThreadTimes (GetCurrentThread (), - &data->creation_time, &data->exit_time, - &data->kernel_time, &data->user_time); -# else GetProcessTimes (GetCurrentProcess (), &data->creation_time, &data->exit_time, &data->kernel_time, &data->user_time); -# endif #elif defined (USE_CLOCK_GETTIME) struct timespec tmp; diff --git a/common/init.c b/common/init.c index b9f05f359..269119ff1 100644 --- a/common/init.c +++ b/common/init.c @@ -35,9 +35,6 @@ # endif # include #endif -#ifdef HAVE_W32CE_SYSTEM -# include /* For _assuan_w32ce_finish_pipe. */ -#endif #include #include "util.h" @@ -69,16 +66,6 @@ static mem_cleanup_item_t mem_cleanup_list; gpg_err_source_t default_errsource = 0; -#ifdef HAVE_W32CE_SYSTEM -static void parse_std_file_handles (int *argcp, char ***argvp); -static void -sleep_on_exit (void) -{ - /* The sshd on CE swallows some of the command output. Sleeping a - while usually helps. */ - Sleep (400); -} -#endif /*HAVE_W32CE_SYSTEM*/ #if HAVE_W32_SYSTEM static void prepare_w32_commandline (int *argcp, char ***argvp); @@ -178,14 +165,6 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp) } #endif -#ifdef HAVE_W32CE_SYSTEM - /* Register the sleep exit function before the estream init so that - the sleep will be called after the estream registered atexit - function which flushes the left open estream streams and in - particular es_stdout. */ - atexit (sleep_on_exit); -#endif - if (!gcry_check_version (NEED_LIBGCRYPT_VERSION)) { log_fatal (_("%s is too old (need %s, have %s)\n"), "libgcrypt", @@ -196,11 +175,6 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp) gpgrt_init (); gpgrt_set_alloc_func (gcry_realloc); -#ifdef HAVE_W32CE_SYSTEM - /* Special hack for Windows CE: We extract some options from arg - to setup the standard handles. */ - parse_std_file_handles (argcp, argvp); -#endif #ifdef HAVE_W32_SYSTEM /* We want gettext to always output UTF-8 and we put the console in @@ -251,77 +225,6 @@ _init_common_subsystems (gpg_err_source_t errsource, int *argcp, char ***argvp) -/* WindowsCE uses a very strange way of handling the standard streams. - There is a function SetStdioPath to associate a standard stream - with a file or a device but what we really want is to use pipes as - standard streams. Despite that we implement pipes using a device, - we would have some limitations on the number of open pipes due to - the 3 character limit of device file name. Thus we don't take this - path. Another option would be to install a file system driver with - support for pipes; this would allow us to get rid of the device - name length limitation. However, with GnuPG we can get away be - redefining the standard streams and passing the handles to be used - on the command line. This has also the advantage that it makes - creating a process much easier and does not require the - SetStdioPath set and restore game. The caller needs to pass the - rendezvous ids using up to three options: - - -&S0= -&S1= -&S2= - - They are all optional but they must be the first arguments on the - command line. Parsing stops as soon as an invalid option is found. - These rendezvous ids are then used to finish the pipe creation.*/ -#ifdef HAVE_W32CE_SYSTEM -static void -parse_std_file_handles (int *argcp, char ***argvp) -{ - int argc = *argcp; - char **argv = *argvp; - const char *s; - assuan_fd_t fd; - int i; - int fixup = 0; - - if (!argc) - return; - - for (argc--, argv++; argc; argc--, argv++) - { - s = *argv; - if (*s == '-' && s[1] == '&' && s[2] == 'S' - && (s[3] == '0' || s[3] == '1' || s[3] == '2') - && s[4] == '=' - && (strchr ("-01234567890", s[5]) || !strcmp (s+5, "null"))) - { - if (s[5] == 'n') - fd = ASSUAN_INVALID_FD; - else - fd = _assuan_w32ce_finish_pipe (atoi (s+5), s[3] != '0'); - _es_set_std_fd (s[3] - '0', (int)fd); - fixup++; - } - else - break; - } - - if (fixup) - { - argc = *argcp; - argc -= fixup; - *argcp = argc; - - argv = *argvp; - for (i=1; i < argc; i++) - argv[i] = argv[i + fixup]; - for (; i < argc + fixup; i++) - argv[i] = NULL; - } - - -} -#endif /*HAVE_W32CE_SYSTEM*/ - - /* For Windows we need to parse the command line so that we can * provide an UTF-8 encoded argv. If there is any Unicode character * we return a new array but if there is no Unicode character we do diff --git a/common/iobuf.c b/common/iobuf.c index 05486b976..2137604a9 100644 --- a/common/iobuf.c +++ b/common/iobuf.c @@ -78,13 +78,8 @@ static unsigned int iobuf_buffer_size = DEFAULT_IOBUF_BUFFER_SIZE; #ifdef HAVE_W32_SYSTEM -# ifdef HAVE_W32CE_SYSTEM -# define FD_FOR_STDIN (es_fileno (es_stdin)) -# define FD_FOR_STDOUT (es_fileno (es_stdout)) -# else -# define FD_FOR_STDIN (GetStdHandle (STD_INPUT_HANDLE)) -# define FD_FOR_STDOUT (GetStdHandle (STD_OUTPUT_HANDLE)) -# endif +# define FD_FOR_STDIN (GetStdHandle (STD_INPUT_HANDLE)) +# define FD_FOR_STDOUT (GetStdHandle (STD_OUTPUT_HANDLE)) #else /*!HAVE_W32_SYSTEM*/ # define FD_FOR_STDIN (0) # define FD_FOR_STDOUT (1) @@ -1287,14 +1282,8 @@ iobuf_cancel (iobuf_t a) { /* Argg, MSDOS does not allow removing open files. So * we have to do it here */ -#ifdef HAVE_W32CE_SYSTEM - wchar_t *wtmp = utf8_to_wchar (remove_name); - if (wtmp) - DeleteFile (wtmp); - xfree (wtmp); -#else remove (remove_name); -#endif + xfree (remove_name); } #endif @@ -2893,12 +2882,7 @@ iobuf_read_line (iobuf_t a, byte ** addr_of_buffer, static int translate_file_handle (int fd, int for_write) { -#if defined(HAVE_W32CE_SYSTEM) - /* This is called only with one of the special filenames. Under - W32CE the FD here is not a file descriptor but a rendezvous id, - thus we need to finish the pipe first. */ - fd = _assuan_w32ce_finish_pipe (fd, for_write); -#elif defined(HAVE_W32_SYSTEM) +#if defined(HAVE_W32_SYSTEM) { int x; diff --git a/common/mischelp.c b/common/mischelp.c index 81dd501f8..68fd2bc24 100644 --- a/common/mischelp.c +++ b/common/mischelp.c @@ -81,34 +81,12 @@ same_file_p (const char *name1, const char *name2) HANDLE file1, file2; BY_HANDLE_FILE_INFORMATION info1, info2; -#ifdef HAVE_W32CE_SYSTEM - { - wchar_t *wname = utf8_to_wchar (name1); - if (wname) - file1 = CreateFile (wname, 0, 0, NULL, OPEN_EXISTING, 0, NULL); - else - file1 = INVALID_HANDLE_VALUE; - xfree (wname); - } -#else file1 = CreateFile (name1, 0, 0, NULL, OPEN_EXISTING, 0, NULL); -#endif if (file1 == INVALID_HANDLE_VALUE) yes = 0; /* If we can't open the file, it is not the same. */ else { -#ifdef HAVE_W32CE_SYSTEM - { - wchar_t *wname = utf8_to_wchar (name2); - if (wname) - file2 = CreateFile (wname, 0, 0, NULL, OPEN_EXISTING, 0, NULL); - else - file2 = INVALID_HANDLE_VALUE; - xfree (wname); - } -#else file2 = CreateFile (name2, 0, 0, NULL, OPEN_EXISTING, 0, NULL); -#endif if (file2 == INVALID_HANDLE_VALUE) yes = 0; /* If we can't open the file, it is not the same. */ else diff --git a/common/stringhelp.c b/common/stringhelp.c index 3e56d664d..6959299e4 100644 --- a/common/stringhelp.c +++ b/common/stringhelp.c @@ -783,11 +783,6 @@ w32_strerror (int ec) if (ec == -1) ec = (int)GetLastError (); -#ifdef HAVE_W32CE_SYSTEM - /* There is only a wchar_t FormatMessage. It does not make much - sense to play the conversion game; we print only the code. */ - snprintf (strerr, sizeof strerr, "ec=%d", (int)GetLastError ()); -#else FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, ec, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), strerr, DIM (strerr)-1, NULL); @@ -797,7 +792,6 @@ w32_strerror (int ec) if (n > 2 && strerr[n-2] == '\r' && strerr[n-1] == '\n' ) strerr[n-2] = 0; } -#endif return strerr; } #endif /*HAVE_W32_SYSTEM*/ diff --git a/common/sysutils.c b/common/sysutils.c index 1342d1016..21b6eefb2 100644 --- a/common/sysutils.c +++ b/common/sysutils.c @@ -535,10 +535,7 @@ gnupg_usleep (unsigned int usecs) int translate_sys2libc_fd (gnupg_fd_t fd, int for_write) { -#if defined(HAVE_W32CE_SYSTEM) - (void)for_write; - return (int) fd; -#elif defined(HAVE_W32_SYSTEM) +#if defined(HAVE_W32_SYSTEM) int x; if (fd == GNUPG_INVALID_FD) @@ -563,10 +560,7 @@ translate_sys2libc_fd (gnupg_fd_t fd, int for_write) int translate_sys2libc_fd_int (int fd, int for_write) { -#if HAVE_W32CE_SYSTEM - fd = (int) _assuan_w32ce_finish_pipe (fd, for_write); - return translate_sys2libc_fd ((void*)fd, for_write); -#elif HAVE_W32_SYSTEM +#ifdef HAVE_W32_SYSTEM if (fd <= 2) return fd; /* Do not do this for error, stdin, stdout, stderr. */ @@ -611,15 +605,8 @@ gnupg_tmpfile (void) { #ifdef HAVE_W32_SYSTEM int attempts, n; -#ifdef HAVE_W32CE_SYSTEM - wchar_t buffer[MAX_PATH+7+12+1]; -# define mystrlen(a) wcslen (a) - wchar_t *name, *p; -#else char buffer[MAX_PATH+7+12+1]; -# define mystrlen(a) strlen (a) char *name, *p; -#endif HANDLE file; int pid = GetCurrentProcessId (); unsigned int value; @@ -631,18 +618,13 @@ gnupg_tmpfile (void) sec_attr.bInheritHandle = TRUE; n = GetTempPath (MAX_PATH+1, buffer); - if (!n || n > MAX_PATH || mystrlen (buffer) > MAX_PATH) + if (!n || n > MAX_PATH || strlen (buffer) > MAX_PATH) { gpg_err_set_errno (ENOENT); return NULL; } - p = buffer + mystrlen (buffer); -#ifdef HAVE_W32CE_SYSTEM - wcscpy (p, L"_gnupg"); - p += 7; -#else + p = buffer + strlen (buffer); p = stpcpy (p, "_gnupg"); -#endif /* We try to create the directory but don't care about an error as it may already exist and the CreateFile would throw an error anyway. */ @@ -658,11 +640,7 @@ gnupg_tmpfile (void) *p++ = tohex (((value >> 28) & 0x0f)); value <<= 4; } -#ifdef HAVE_W32CE_SYSTEM - wcscpy (p, L".tmp"); -#else strcpy (p, ".tmp"); -#endif file = CreateFile (buffer, GENERIC_READ | GENERIC_WRITE, 0, @@ -673,10 +651,6 @@ gnupg_tmpfile (void) if (file != INVALID_HANDLE_VALUE) { FILE *fp; -#ifdef HAVE_W32CE_SYSTEM - int fd = (int)file; - fp = _wfdopen (fd, L"w+b"); -#else int fd = _open_osfhandle ((intptr_t)file, 0); if (fd == -1) { @@ -684,7 +658,6 @@ gnupg_tmpfile (void) return NULL; } fp = fdopen (fd, "w+b"); -#endif if (!fp) { int save = errno; @@ -698,9 +671,11 @@ gnupg_tmpfile (void) } gpg_err_set_errno (ENOENT); return NULL; -#undef mystrlen + #else /*!HAVE_W32_SYSTEM*/ + return tmpfile (); + #endif /*!HAVE_W32_SYSTEM*/ } @@ -799,7 +774,7 @@ gnupg_allow_set_foregound_window (pid_t pid) if (!pid) log_info ("%s called with invalid pid %lu\n", "gnupg_allow_set_foregound_window", (unsigned long)pid); -#if defined(HAVE_W32_SYSTEM) && !defined(HAVE_W32CE_SYSTEM) +#if defined(HAVE_W32_SYSTEM) else if (inhibit_set_foregound_window) ; else if (!AllowSetForegroundWindow ((pid_t)pid == (pid_t)(-1)?ASFW_ANY:pid)) @@ -1148,13 +1123,7 @@ gnupg_mkdtemp (char *tmpl) int gnupg_setenv (const char *name, const char *value, int overwrite) { -#ifdef HAVE_W32CE_SYSTEM - (void)name; - (void)value; - (void)overwrite; - return 0; -#else /*!W32CE*/ -# ifdef HAVE_W32_SYSTEM +#ifdef HAVE_W32_SYSTEM /* Windows maintains (at least) two sets of environment variables. One set can be accessed by GetEnvironmentVariable and SetEnvironmentVariable. This set is inherited by the children. @@ -1172,11 +1141,11 @@ gnupg_setenv (const char *name, const char *value, int overwrite) return -1; } } -# endif /*W32*/ +#endif /*W32*/ -# ifdef HAVE_SETENV +#ifdef HAVE_SETENV return setenv (name, value, overwrite); -# else /*!HAVE_SETENV*/ +#else /*!HAVE_SETENV*/ if (! getenv (name) || overwrite) { char *buf; @@ -1196,19 +1165,14 @@ gnupg_setenv (const char *name, const char *value, int overwrite) return putenv (buf); } return 0; -# endif /*!HAVE_SETENV*/ -#endif /*!W32CE*/ +#endif /*!HAVE_SETENV*/ } int gnupg_unsetenv (const char *name) { -#ifdef HAVE_W32CE_SYSTEM - (void)name; - return 0; -#else /*!W32CE*/ -# ifdef HAVE_W32_SYSTEM +#ifdef HAVE_W32_SYSTEM /* Windows maintains (at least) two sets of environment variables. One set can be accessed by GetEnvironmentVariable and SetEnvironmentVariable. This set is inherited by the children. @@ -1220,11 +1184,11 @@ gnupg_unsetenv (const char *name) gpg_err_set_errno (EINVAL); /* (Might also be ENOMEM.) */ return -1; } -# endif /*W32*/ +#endif /*W32*/ -# ifdef HAVE_UNSETENV +#ifdef HAVE_UNSETENV return unsetenv (name); -# else /*!HAVE_UNSETENV*/ +#else /*!HAVE_UNSETENV*/ { char *buf; @@ -1241,8 +1205,7 @@ gnupg_unsetenv (const char *name) # endif return putenv (buf); } -# endif /*!HAVE_UNSETENV*/ -#endif /*!W32CE*/ +#endif /*!HAVE_UNSETENV*/ } @@ -1571,43 +1534,6 @@ gnupg_chuid (const char *user, int silent) -#ifdef HAVE_W32CE_SYSTEM -/* There is a isatty function declaration in cegcc but it does not - make sense, thus we redefine it. */ -int -_gnupg_isatty (int fd) -{ - (void)fd; - return 0; -} -#endif - - -#ifdef HAVE_W32CE_SYSTEM -/* Replacement for getenv which takes care of the our use of getenv. - The code is not thread safe but we expect it to work in all cases - because it is called for the first time early enough. */ -char * -_gnupg_getenv (const char *name) -{ - static int initialized; - static char *assuan_debug; - - if (!initialized) - { - assuan_debug = read_w32_registry_string (NULL, - "\\Software\\GNU\\libassuan", - "debug"); - initialized = 1; - } - - if (!strcmp (name, "ASSUAN_DEBUG")) - return assuan_debug; - else - return NULL; -} - -#endif /*HAVE_W32CE_SYSTEM*/ #ifdef HAVE_W32_SYSTEM diff --git a/common/t-dotlock.c b/common/t-dotlock.c index 48f2e1f67..994ef1be3 100644 --- a/common/t-dotlock.c +++ b/common/t-dotlock.c @@ -59,11 +59,6 @@ w32_strerror (int ec) if (ec == -1) ec = (int)GetLastError (); -#ifdef HAVE_W32CE_SYSTEM - /* There is only a wchar_t FormatMessage. It does not make much - sense to play the conversion game; we print only the code. */ - snprintf (strerr, sizeof strerr, "ec=%d", (int)GetLastError ()); -#else FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM, NULL, ec, MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), strerr, DIM (strerr)-1, NULL); @@ -73,7 +68,6 @@ w32_strerror (int ec) if (n > 2 && strerr[n-2] == '\r' && strerr[n-1] == '\n' ) strerr[n-2] = 0; } -#endif return strerr; } diff --git a/common/t-stringhelp.c b/common/t-stringhelp.c index 4086f8c3d..6723d65b6 100644 --- a/common/t-stringhelp.c +++ b/common/t-stringhelp.c @@ -83,10 +83,6 @@ mygetcwd (void) for (;;) { buffer = xmalloc (size+1); -#ifdef HAVE_W32CE_SYSTEM - strcpy (buffer, "/"); /* Always "/". */ - return buffer; -#else if (getcwd (buffer, size) == buffer) { #ifdef HAVE_W32_SYSTEM @@ -105,7 +101,6 @@ mygetcwd (void) exit (2); } size *= 2; -#endif } } diff --git a/common/t-sysutils.c b/common/t-sysutils.c index 79f8385ac..9908c16cd 100644 --- a/common/t-sysutils.c +++ b/common/t-sysutils.c @@ -24,10 +24,6 @@ #include "util.h" #include "sysutils.h" -#ifdef HAVE_W32CE_SYSTEM -# define rewind(f) do { fseek (f, 0, SEEK_SET); clearerr (f); } while (0) -#endif - #define pass() do { ; } while(0) #define fail(a) do { fprintf (stderr, "%s:%d: test %d failed\n",\ __FILE__,__LINE__, (a)); \ diff --git a/common/utf8conv.c b/common/utf8conv.c index 1f01841c7..8b66e7f41 100644 --- a/common/utf8conv.c +++ b/common/utf8conv.c @@ -170,10 +170,8 @@ set_native_charset (const char *newset) different one for console input. Not sure how to cope with that. If the console Code page is not known we fall back to the system code page. */ -#ifndef HAVE_W32CE_SYSTEM cpno = GetConsoleOutputCP (); if (!cpno) -#endif cpno = GetACP (); sprintf (codepage, "CP%u", cpno ); /* Resolve alias. We use a long string string and not the usual @@ -806,10 +804,8 @@ get_w32_codepage (void) if (!cp) { -#ifndef HAVE_W32CE_SYSTEM cp = GetConsoleOutputCP (); if (!cp) -#endif cp = GetACP (); } return cp; diff --git a/common/util.h b/common/util.h index 43cb2fd3e..4327153bc 100644 --- a/common/util.h +++ b/common/util.h @@ -390,18 +390,7 @@ _gnupg_ttyname (int fd) # define gnupg_ttyname(n) ttyname ((n)) #endif /*HAVE_TTYNAME */ -#ifdef HAVE_W32CE_SYSTEM -#define getpid() GetCurrentProcessId () -char *_gnupg_getenv (const char *name); /* See sysutils.c */ -#define getenv(a) _gnupg_getenv ((a)) -char *_gnupg_setenv (const char *name); /* See sysutils.c */ -#define setenv(a,b,c) _gnupg_setenv ((a),(b),(c)) -int _gnupg_isatty (int fd); -#define gnupg_isatty(a) _gnupg_isatty ((a)) -#else #define gnupg_isatty(a) isatty ((a)) -#endif - /*-- Macros to replace ctype ones to avoid locale problems. --*/ diff --git a/common/w32help.h b/common/w32help.h index a79081f8e..33000acc7 100644 --- a/common/w32help.h +++ b/common/w32help.h @@ -46,21 +46,6 @@ char *read_w32_registry_string (const char *root, const char *dir, const char *name ); char *read_w32_reg_string (const char *key); -/* Other stuff. */ -#ifdef HAVE_W32CE_SYSTEM -/* Setmode is missing in cegcc but available since CE 5.0. */ -int _setmode (int handle, int mode); -# define setmode(a,b) _setmode ((a),(b)) - -static inline int -umask (int a) -{ - (void)a; - return 0; -} - - -#endif /*HAVE_W32CE_SYSTEM*/ #endif /*HAVE_W32_SYSTEM*/ #endif /*GNUPG_COMMON_MISCHELP_H*/ diff --git a/g10/cpr.c b/g10/cpr.c index 002656b82..9bfdd3c34 100644 --- a/g10/cpr.c +++ b/g10/cpr.c @@ -465,9 +465,7 @@ myread(int fd, void *buf, size_t count) else /* Ctrl-D not caught - do something reasonable */ { #ifdef HAVE_DOSISH_SYSTEM -#ifndef HAVE_W32CE_SYSTEM raise (SIGINT); /* Nothing to hangup under DOS. */ -#endif #else raise (SIGHUP); /* No more input data. */ #endif diff --git a/g10/decrypt.c b/g10/decrypt.c index 9589aff58..065601b7b 100644 --- a/g10/decrypt.c +++ b/g10/decrypt.c @@ -138,12 +138,7 @@ decrypt_message_fd (ctrl_t ctrl, int input_fd, int output_fd) return err; } -#ifdef HAVE_W32CE_SYSTEM -#warning Need to fix this if we want to use g13 - opt.outfp = NULL; -#else opt.outfp = es_fdopen_nc (output_fd, "wb"); -#endif if (!opt.outfp) { char xname[64]; diff --git a/g10/exec.c b/g10/exec.c index f612c850a..75b39e0fe 100644 --- a/g10/exec.c +++ b/g10/exec.c @@ -148,9 +148,6 @@ w32_system(const char *command) int set_exec_path(const char *path) { -#ifdef HAVE_W32CE_SYSTEM -#warning Change this code to use common/exechelp.c -#else char *p; p=xmalloc(5+strlen(path)+1); @@ -168,6 +165,5 @@ set_exec_path(const char *path) return GPG_ERR_GENERAL; else return 0; -#endif } #endif /* ! NO_EXEC */ diff --git a/g10/tdbio.c b/g10/tdbio.c index a6ce5ce00..50dccca05 100644 --- a/g10/tdbio.c +++ b/g10/tdbio.c @@ -48,13 +48,6 @@ #define MY_O_BINARY 0 #endif -/* We use ERRNO despite that the cegcc provided open/read/write - functions don't set ERRNO - at least show that ERRNO does not make - sense. */ -#ifdef HAVE_W32CE_SYSTEM -#undef strerror -#define strerror(a) ("[errno not available]") -#endif /* * Yes, this is a very simple implementation. We should really @@ -730,13 +723,6 @@ tdbio_set_dbname (ctrl_t ctrl, const char *new_dbname, int rc; mode_t oldmask; -#ifdef HAVE_W32CE_SYSTEM - /* We know how the cegcc implementation of access works ;-). */ - if (GetLastError () == ERROR_FILE_NOT_FOUND) - gpg_err_set_errno (ENOENT); - else - gpg_err_set_errno (EIO); -#endif /*HAVE_W32CE_SYSTEM*/ if (errno && errno != ENOENT) log_fatal ( _("can't access '%s': %s\n"), fname, strerror (errno)); @@ -797,22 +783,6 @@ open_db () log_assert( db_fd == -1 ); -#ifdef HAVE_W32CE_SYSTEM - { - DWORD prevrc = 0; - wchar_t *wname = utf8_to_wchar (db_name); - if (wname) - { - db_fd = (int)CreateFile (wname, GENERIC_READ|GENERIC_WRITE, - FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, - OPEN_EXISTING, 0, NULL); - xfree (wname); - } - if (db_fd == -1) - log_fatal ("can't open '%s': %d, %d\n", db_name, - (int)prevrc, (int)GetLastError ()); - } -#else /*!HAVE_W32CE_SYSTEM*/ db_fd = gnupg_open (db_name, O_RDWR | MY_O_BINARY, 0); if (db_fd == -1 && (errno == EACCES #ifdef EROFS @@ -827,7 +797,7 @@ open_db () } if ( db_fd == -1 ) log_fatal( _("can't open '%s': %s\n"), db_name, strerror(errno) ); -#endif /*!HAVE_W32CE_SYSTEM*/ + register_secured_file (db_name); /* Read the version record. */ diff --git a/kbx/keyboxd.c b/kbx/keyboxd.c index 76e360b18..88a350a08 100644 --- a/kbx/keyboxd.c +++ b/kbx/keyboxd.c @@ -146,17 +146,12 @@ static struct debug_flags_s debug_flags [] = /* The timer tick used for housekeeping stuff. Note that on Windows * we use a SetWaitableTimer seems to signal earlier than about 2 - * seconds. Thus we use 4 seconds on all platforms except for - * Windowsce. CHECK_OWN_SOCKET_INTERVAL defines how often we check + * seconds. Thus we use 4 seconds on all platforms. + * CHECK_OWN_SOCKET_INTERVAL defines how often we check * our own socket in standard socket mode. If that value is 0 we * don't check at all. All values are in seconds. */ -#if defined(HAVE_W32CE_SYSTEM) -# define TIMERTICK_INTERVAL (60) -# define CHECK_OWN_SOCKET_INTERVAL (0) /* Never */ -#else # define TIMERTICK_INTERVAL (4) # define CHECK_OWN_SOCKET_INTERVAL (60) -#endif /* The list of open file descriptors at startup. Note that this list * has been allocated using the standard malloc. */ @@ -1141,8 +1136,6 @@ create_server_socket (char *name, int cygwin, assuan_sock_nonce_t *nonce) len = SUN_LEN (unaddr); rc = assuan_sock_bind (fd, addr, len); - /* Our error code mapping on W32CE returns EEXIST thus we also test - for this. */ if (rc == -1 && (errno == EADDRINUSE #ifdef HAVE_W32_SYSTEM @@ -1502,13 +1495,7 @@ handle_connections (gnupg_fd_t listen_fd) npth_sigev_add (SIGTERM); npth_sigev_fini (); #else -# ifdef HAVE_W32CE_SYSTEM - /* Use a dummy event. */ - sigs = 0; - ev = pth_event (PTH_EVENT_SIGS, &sigs, &signo); -# else events[0] = INVALID_HANDLE_VALUE; -# endif #endif if (disable_check_own_socket) diff --git a/sm/server.c b/sm/server.c index 2a6d7c381..e44856ab9 100644 --- a/sm/server.c +++ b/sm/server.c @@ -134,9 +134,6 @@ close_message_fd (ctrl_t ctrl) { if (ctrl->server_local->message_fd != -1) { -#ifdef HAVE_W32CE_SYSTEM -#warning Is this correct for W32/W32CE? -#endif close (ctrl->server_local->message_fd); ctrl->server_local->message_fd = -1; } @@ -871,12 +868,6 @@ cmd_message (assuan_context_t ctx, char *line) if (rc) return rc; -#ifdef HAVE_W32CE_SYSTEM - sysfd = _assuan_w32ce_finish_pipe ((int)sysfd, 0); - if (sysfd == INVALID_HANDLE_VALUE) - return set_error (gpg_err_code_from_syserror (), - "rvid conversion failed"); -#endif fd = translate_sys2libc_fd (sysfd, 0); if (fd == -1) @@ -1370,13 +1361,9 @@ gpgsm_server (certlist_t default_recplist) /* We use a pipe based server so that we can work from scripts. assuan_init_pipe_server will automagically detect when we are called with a socketpair and ignore FILEDES in this case. */ -#ifdef HAVE_W32CE_SYSTEM - #define SERVER_STDIN es_fileno(es_stdin) - #define SERVER_STDOUT es_fileno(es_stdout) -#else #define SERVER_STDIN 0 #define SERVER_STDOUT 1 -#endif + filedes[0] = assuan_fdopen (SERVER_STDIN); filedes[1] = assuan_fdopen (SERVER_STDOUT); rc = assuan_new (&ctx); diff --git a/tools/Makefile.am b/tools/Makefile.am index 9e9e13eda..a6979ebf1 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -66,37 +66,19 @@ endif libexec_PROGRAMS = gpg-check-pattern gpg-pair-tool -if !HAVE_W32CE_SYSTEM noinst_PROGRAMS = clean-sat make-dns-cert -endif -if !HAVE_W32CE_SYSTEM if BUILD_GPGTAR bin_PROGRAMS += gpgtar else noinst_PROGRAMS += gpgtar endif -endif common_libs = $(libcommon) commonpth_libs = $(libcommonpth) -# Some modules require PTH under W32CE. -if HAVE_W32CE_SYSTEM -maybe_commonpth_libs = $(commonpth_libs) -else -maybe_commonpth_libs = $(common_libs) -endif - -if HAVE_W32CE_SYSTEM -pwquery_libs = -else pwquery_libs = ../common/libsimple-pwquery.a -endif -if HAVE_W32CE_SYSTEM -opt_libassuan_libs = $(LIBASSUAN_LIBS) -endif regexp_libs = ../regexp/libregexp.a @@ -109,7 +91,7 @@ gpgconf_SOURCES = gpgconf.c gpgconf.h gpgconf-comp.c # common sucks in gpg-error, will they, nil they (some compilers # do not eliminate the supposed-to-be-unused-inline-functions). -gpgconf_LDADD = $(maybe_commonpth_libs) $(opt_libassuan_libs) \ +gpgconf_LDADD = $(common_libs) \ $(LIBINTL) $(LIBGCRYPT_LIBS) $(GPG_ERROR_LIBS) $(NETLIBS) \ $(LIBICONV) $(W32SOCKLIBS) \ $(gpgconf_rc_objs) diff --git a/tools/gpg-connect-agent.c b/tools/gpg-connect-agent.c index 6bbdc816b..dff367050 100644 --- a/tools/gpg-connect-agent.c +++ b/tools/gpg-connect-agent.c @@ -1008,10 +1008,7 @@ do_open (char *line) if (fd >= 0 && fd < DIM (open_fd_table)) { open_fd_table[fd].inuse = 1; -#ifdef HAVE_W32CE_SYSTEM -# warning fixme: implement our pipe emulation. -#endif -#if defined(HAVE_W32_SYSTEM) && !defined(HAVE_W32CE_SYSTEM) +#if defined(HAVE_W32_SYSTEM) { HANDLE prochandle, handle, newhandle; @@ -1041,12 +1038,12 @@ do_open (char *line) log_info ("file '%s' opened in \"%s\" mode, fd=%d (libc=%d)\n", name, mode, (int)open_fd_table[fd].handle, fd); set_int_var (varname, (int)open_fd_table[fd].handle); -#else +#else /* Unix */ if (opt.verbose) log_info ("file '%s' opened in \"%s\" mode, fd=%d\n", name, mode, fd); set_int_var (varname, fd); -#endif +#endif /* Unix */ } else { @@ -2023,11 +2020,7 @@ handle_inquire (assuan_context_t ctx, char *line) { if (d->is_prog) { -#ifdef HAVE_W32CE_SYSTEM - fp = NULL; -#else fp = popen (d->file, "r"); -#endif if (!fp) log_error ("error executing '%s': %s\n", d->file, strerror (errno)); @@ -2064,10 +2057,8 @@ handle_inquire (assuan_context_t ctx, char *line) ; else if (d->is_prog) { -#ifndef HAVE_W32CE_SYSTEM if (pclose (fp)) cancelled = 1; -#endif } else fclose (fp); diff --git a/tools/gpgconf-comp.c b/tools/gpgconf-comp.c index 704bdca16..7cd45c7e9 100644 --- a/tools/gpgconf-comp.c +++ b/tools/gpgconf-comp.c @@ -2974,7 +2974,7 @@ key_matches_user_or_group (char *user) /* Under Windows we don't support groups. */ if (group && *group) gc_error (0, 0, _("Note that group specifications are ignored\n")); -#ifndef HAVE_W32CE_SYSTEM + if (*user) { static char *my_name; @@ -2994,8 +2994,9 @@ key_matches_user_or_group (char *user) if (!strcmp (user, my_name)) return 1; /* Found. */ } -#endif /*HAVE_W32CE_SYSTEM*/ + #else /*!HAVE_W32_SYSTEM*/ + /* First check whether the user matches. */ if (*user) { @@ -3054,7 +3055,9 @@ key_matches_user_or_group (char *user) if (!strcmp (group, my_supgroups[n])) return 1; /* Found. */ } + #endif /*!HAVE_W32_SYSTEM*/ + return 0; /* No match. */ }