w32: Remove all support for WindowsCE
* configure.ac: Remove WindwosCE support. * contrib/: Remove all; it was only used for WindowsCE. * src/w32-ce.c, src/w32-ce.h: Remove files. * src/Makefile.am (system_components): Remove these files. * src/ath.c, src/ath.h: Remove W32CE support. * src/data-compat.c (gpgme_data_new_from_filepart): Ditto. (gpgme_data_new_from_file): Ditto. * src/debug.c (debug_init, _gpgme_debug): Ditto. * src/gpgme-tool.c (gpgme_server): Ditto. (main): Ditto. * src/priv-io.h: Do not include w32-ce.h. * src/util.h: Remove WindowsCE support. * src/w32-io.c: Ditto. * src/w32-util.c: Ditto. * src/debug.h (TRACE_SUC4): New. -- There is no more hardware to test our code, the support for Windows CE terminated along time ago. Note that our code worked only with the old WindowsCE with that overall system limit of 31 processes. Signed-off-by: Werner Koch <wk@gnupg.org>
This commit is contained in:
parent
2e07d4f89a
commit
3c04dea3ec
@ -34,7 +34,7 @@ ACLOCAL_AMFLAGS = -I m4
|
|||||||
DISTCHECK_CONFIGURE_FLAGS =
|
DISTCHECK_CONFIGURE_FLAGS =
|
||||||
|
|
||||||
EXTRA_DIST = autogen.sh autogen.rc gpgme.spec.in \
|
EXTRA_DIST = autogen.sh autogen.rc gpgme.spec.in \
|
||||||
ChangeLog-2011 m4/ChangeLog-2011 contrib/ChangeLog-2011 \
|
ChangeLog-2011 m4/ChangeLog-2011 \
|
||||||
conf/whatisthis VERSION
|
conf/whatisthis VERSION
|
||||||
|
|
||||||
|
|
||||||
|
11
configure.ac
11
configure.ac
@ -186,9 +186,6 @@ case "${host}" in
|
|||||||
x86_64-*mingw32*)
|
x86_64-*mingw32*)
|
||||||
have_w64_system=yes
|
have_w64_system=yes
|
||||||
;;
|
;;
|
||||||
*-mingw32ce*)
|
|
||||||
have_w32ce_system=yes
|
|
||||||
;;
|
|
||||||
*-linux-androideabi)
|
*-linux-androideabi)
|
||||||
have_android_system=yes
|
have_android_system=yes
|
||||||
;;
|
;;
|
||||||
@ -197,7 +194,7 @@ case "${host}" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
case "${host}" in
|
case "${host}" in
|
||||||
*-mingw32ce*|*-mingw32*)
|
*-mingw32*)
|
||||||
have_dosish_system=yes
|
have_dosish_system=yes
|
||||||
have_w32_system=yes
|
have_w32_system=yes
|
||||||
GPG_DEFAULT='c:\\gnupg\\gpg.exe'
|
GPG_DEFAULT='c:\\gnupg\\gpg.exe'
|
||||||
@ -241,12 +238,6 @@ if test "$have_w64_system" = yes; then
|
|||||||
fi
|
fi
|
||||||
AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
|
AM_CONDITIONAL(HAVE_W64_SYSTEM, test "$have_w64_system" = yes)
|
||||||
|
|
||||||
if test "$have_w32ce_system" = yes; then
|
|
||||||
AC_DEFINE(HAVE_W32CE_SYSTEM,1,
|
|
||||||
[Defined if we run on a W32 CE API based system])
|
|
||||||
fi
|
|
||||||
AM_CONDITIONAL(HAVE_W32CE_SYSTEM, test "$have_w32ce_system" = yes)
|
|
||||||
|
|
||||||
if test "$have_android_system" = yes; then
|
if test "$have_android_system" = yes; then
|
||||||
AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
|
AC_DEFINE(HAVE_ANDROID_SYSTEM,1, [Defined if we build for an Android system])
|
||||||
fi
|
fi
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
2011-12-02 Werner Koch <wk@g10code.com>
|
|
||||||
|
|
||||||
NB: ChangeLog files are no longer manually maintained. Starting
|
|
||||||
on December 1st, 2011 we put change information only in the GIT
|
|
||||||
commit log, and generate a top-level ChangeLog file from logs at
|
|
||||||
"make dist". See doc/HACKING for details.
|
|
||||||
|
|
||||||
2010-11-15 Marcus Brinkmann <mb@g10code.com>
|
|
||||||
|
|
||||||
* conf-w32ce-msc/fcntl.h: New file.
|
|
||||||
* conf-w32ce-msc/build.mk (conf_sources): Add fnctl.h.
|
|
||||||
(sources): Remove memrchr.c.
|
|
||||||
|
|
||||||
* conf-w32ce-msc/io.h: New file.
|
|
||||||
* conf-w32ce-msc/build.mk (conf_sources): Add io.h.
|
|
||||||
|
|
||||||
* conf-w32ce-msc/stdint.h: New file.
|
|
||||||
* conf-w32ce-msc/build.mk (conf_sources): Add stdint.h.
|
|
||||||
* conf-w32ce-msc/build.mk (copy-static-source): Revert last change.
|
|
||||||
|
|
||||||
2010-11-15 Werner Koch <wk@g10code.com>
|
|
||||||
|
|
||||||
* conf-w32ce-msc/build.mk (copy-static-source): Create stdint.h.
|
|
||||||
(all): Add ws2.lib
|
|
||||||
(clean): New.
|
|
||||||
|
|
||||||
2010-11-04 Werner Koch <wk@g10code.com>
|
|
||||||
|
|
||||||
* conf-w32ce-msc/build.mk (copy-built-source): Revert last
|
|
||||||
change. Does not work with W32CE where MSC defines it in except.h.
|
|
||||||
|
|
||||||
2010-11-03 Werner Koch <wk@g10code.com>
|
|
||||||
|
|
||||||
* conf-w32ce-msc/build.mk (copy-built-source): Create dummy sehmap.h.
|
|
||||||
|
|
||||||
2010-11-01 Werner Koch <wk@g10code.com>
|
|
||||||
|
|
||||||
* conf-w32ce-msc/config.h: New.
|
|
||||||
* conf-w32ce-msc/build.mk: New.
|
|
||||||
|
|
||||||
Copyright (C) 2010 g10 Code GmbH
|
|
||||||
|
|
||||||
This file is free software; as a special exception the author gives
|
|
||||||
unlimited permission to copy and/or distribute it, with or without
|
|
||||||
modifications, as long as this notice is preserved.
|
|
||||||
|
|
||||||
This file is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
|
||||||
implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
@ -1,256 +0,0 @@
|
|||||||
# build.mk - Makefile to build libgpg-error using Visual-C
|
|
||||||
# Copyright 2010 g10 Code GmbH
|
|
||||||
#
|
|
||||||
# This file is free software; as a special exception the author gives
|
|
||||||
# unlimited permission to copy and/or distribute it, with or without
|
|
||||||
# modifications, as long as this notice is preserved.
|
|
||||||
#
|
|
||||||
# This file is distributed in the hope that it will be useful, but
|
|
||||||
# WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
|
||||||
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
# This is a helper make script to build libgpg-error for WindowsCE
|
|
||||||
# using the Microsoft Visual C compiler.
|
|
||||||
|
|
||||||
targetdir = /home/smb/xppro-gnu/src/gpgme/src
|
|
||||||
# The target build directory where we run the Visual C compiler/ This
|
|
||||||
# needs to be an absolute directory name. Further we expect this
|
|
||||||
# structure of the tree:
|
|
||||||
#
|
|
||||||
# TARGET/src - Source directories: One directory for each project
|
|
||||||
# /bin - Installed DLLs
|
|
||||||
# /lib - Installed import libs.
|
|
||||||
# /include - Instaled header files.
|
|
||||||
|
|
||||||
targetdir = /home/smb/xppro-gnu
|
|
||||||
targetsrc = $(targetdir)/src
|
|
||||||
|
|
||||||
# Install directories (relative)
|
|
||||||
bindir = ../../../bin
|
|
||||||
libdir = ../../../lib
|
|
||||||
incdir = ../../../include
|
|
||||||
|
|
||||||
|
|
||||||
help:
|
|
||||||
@echo "Run "
|
|
||||||
@echo " make -f ../contrib/conf-w32ce-msc/build.mk copy-source"
|
|
||||||
@echo "on the POSIX system and then"
|
|
||||||
@echo " nmake -f build.mk all"
|
|
||||||
@echo " nmake -f build.mk install"
|
|
||||||
@echo "on the Windows system"
|
|
||||||
|
|
||||||
ce_defines = -DWINCE -D_WIN32_WCE=0x502 -DUNDER_CE \
|
|
||||||
-DWIN32_PLATFORM_PSPC -D_UNICODE -DUNICODE \
|
|
||||||
-D_CONSOLE -DARM -D_ARM_
|
|
||||||
#-D_DEBUG -DDEBUG
|
|
||||||
|
|
||||||
CFLAGS = -nologo -W3 -fp:fast -Os $(ce_defines) \
|
|
||||||
-DHAVE_CONFIG_H -DDLL_EXPORT -D_CRT_SECURE_NO_WARNINGS \
|
|
||||||
-I. -I$(incdir) -I$(incdir)/gpg-extra
|
|
||||||
|
|
||||||
LDFLAGS =
|
|
||||||
|
|
||||||
# Standard source files
|
|
||||||
sources = \
|
|
||||||
assuan-support.c \
|
|
||||||
ath-pth.c \
|
|
||||||
ath-pthread.c \
|
|
||||||
ath.c \
|
|
||||||
ath.h \
|
|
||||||
context.h \
|
|
||||||
conversion.c \
|
|
||||||
data-compat.c \
|
|
||||||
data-fd.c \
|
|
||||||
data-mem.c \
|
|
||||||
data-stream.c \
|
|
||||||
data-user.c \
|
|
||||||
data.c \
|
|
||||||
data.h \
|
|
||||||
debug.c \
|
|
||||||
debug.h \
|
|
||||||
decrypt-verify.c \
|
|
||||||
decrypt.c \
|
|
||||||
delete.c \
|
|
||||||
dirinfo.c \
|
|
||||||
edit.c \
|
|
||||||
encrypt-sign.c \
|
|
||||||
encrypt.c \
|
|
||||||
engine-assuan.c \
|
|
||||||
engine-backend.h \
|
|
||||||
engine-g13.c \
|
|
||||||
engine-gpg.c \
|
|
||||||
engine-gpgconf.c \
|
|
||||||
engine-gpgsm.c \
|
|
||||||
engine-uiserver.c \
|
|
||||||
engine.c \
|
|
||||||
engine.h \
|
|
||||||
error.c \
|
|
||||||
export.c \
|
|
||||||
funopen.c \
|
|
||||||
genkey.c \
|
|
||||||
get-env.c \
|
|
||||||
getauditlog.c \
|
|
||||||
gpgconf.c \
|
|
||||||
gpgme-tool.c \
|
|
||||||
gpgme-w32spawn.c \
|
|
||||||
gpgme.c \
|
|
||||||
import.c \
|
|
||||||
isascii.c \
|
|
||||||
kdpipeiodevice.h \
|
|
||||||
key.c \
|
|
||||||
keylist.c \
|
|
||||||
op-support.c \
|
|
||||||
opassuan.c \
|
|
||||||
ops.h \
|
|
||||||
passphrase.c \
|
|
||||||
passwd.c \
|
|
||||||
priv-io.h \
|
|
||||||
progress.c \
|
|
||||||
putc_unlocked.c \
|
|
||||||
sema.h \
|
|
||||||
setenv.c \
|
|
||||||
sig-notation.c \
|
|
||||||
sign.c \
|
|
||||||
signers.c \
|
|
||||||
stpcpy.c \
|
|
||||||
trust-item.c \
|
|
||||||
trustlist.c \
|
|
||||||
ttyname_r.c \
|
|
||||||
util.h \
|
|
||||||
vasprintf.c \
|
|
||||||
verify.c \
|
|
||||||
version.c \
|
|
||||||
vfs-create.c \
|
|
||||||
vfs-mount.c \
|
|
||||||
w32-ce.c \
|
|
||||||
w32-ce.h \
|
|
||||||
w32-glib-io.c \
|
|
||||||
w32-io.c \
|
|
||||||
w32-sema.c \
|
|
||||||
w32-util.c \
|
|
||||||
wait-global.c \
|
|
||||||
wait-private.c \
|
|
||||||
wait-user.c \
|
|
||||||
wait.c \
|
|
||||||
wait.h \
|
|
||||||
gpgme.def
|
|
||||||
|
|
||||||
# The object files we need to create from sources.
|
|
||||||
objs = \
|
|
||||||
conversion.obj \
|
|
||||||
get-env.obj \
|
|
||||||
data.obj \
|
|
||||||
data-fd.obj \
|
|
||||||
data-stream.obj \
|
|
||||||
data-mem.obj \
|
|
||||||
data-user.obj \
|
|
||||||
data-compat.obj \
|
|
||||||
signers.obj \
|
|
||||||
sig-notation.obj \
|
|
||||||
wait.obj \
|
|
||||||
wait-global.obj \
|
|
||||||
wait-private.obj \
|
|
||||||
wait-user.obj \
|
|
||||||
op-support.obj \
|
|
||||||
encrypt.obj \
|
|
||||||
encrypt-sign.obj \
|
|
||||||
decrypt.obj \
|
|
||||||
decrypt-verify.obj \
|
|
||||||
verify.obj \
|
|
||||||
sign.obj \
|
|
||||||
passphrase.obj \
|
|
||||||
progress.obj \
|
|
||||||
key.obj \
|
|
||||||
keylist.obj \
|
|
||||||
trust-item.obj \
|
|
||||||
trustlist.obj \
|
|
||||||
import.obj \
|
|
||||||
export.obj \
|
|
||||||
genkey.obj \
|
|
||||||
delete.obj \
|
|
||||||
edit.obj \
|
|
||||||
getauditlog.obj \
|
|
||||||
opassuan.obj \
|
|
||||||
passwd.obj \
|
|
||||||
engine.obj \
|
|
||||||
engine-gpg.obj \
|
|
||||||
engine-gpgsm.obj \
|
|
||||||
assuan-support.obj \
|
|
||||||
engine-assuan.obj \
|
|
||||||
engine-gpgconf.obj \
|
|
||||||
engine-g13.obj \
|
|
||||||
vfs-mount.obj \
|
|
||||||
vfs-create.obj \
|
|
||||||
gpgconf.obj \
|
|
||||||
w32-ce.obj \
|
|
||||||
w32-util.obj \
|
|
||||||
w32-sema.obj \
|
|
||||||
w32-io.obj \
|
|
||||||
dirinfo.obj \
|
|
||||||
debug.obj \
|
|
||||||
gpgme.obj \
|
|
||||||
version.obj \
|
|
||||||
error.obj \
|
|
||||||
ath.obj \
|
|
||||||
vasprintf.obj \
|
|
||||||
ttyname_r.obj \
|
|
||||||
stpcpy.obj \
|
|
||||||
setenv.obj
|
|
||||||
|
|
||||||
|
|
||||||
# Sources files in this directory inclduing this Makefile
|
|
||||||
conf_sources = \
|
|
||||||
build.mk \
|
|
||||||
config.h \
|
|
||||||
stdint.h io.h fcntl.h
|
|
||||||
|
|
||||||
# Source files built by running the standard build system.
|
|
||||||
built_sources = \
|
|
||||||
gpgme.h \
|
|
||||||
status-table.h
|
|
||||||
|
|
||||||
copy-static-source:
|
|
||||||
@if [ ! -f ./gpgme.c ]; then \
|
|
||||||
echo "Please cd to the src/ directory first"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
cp -t $(targetsrc)/gpgme/src $(sources);
|
|
||||||
cd ../contrib/conf-w32ce-msc ; \
|
|
||||||
cp -t $(targetsrc)/gpgme/src $(conf_sources)
|
|
||||||
|
|
||||||
copy-built-source:
|
|
||||||
@if [ ! -f ./gpgme.h ]; then \
|
|
||||||
echo "Please build using ./autogen.sh --build-w32ce first"; \
|
|
||||||
exit 1; \
|
|
||||||
fi
|
|
||||||
cp -t $(targetsrc)/gpgme/src $(built_sources)
|
|
||||||
|
|
||||||
copy-source: copy-static-source copy-built-source
|
|
||||||
|
|
||||||
|
|
||||||
.c.obj:
|
|
||||||
$(CC) $(CFLAGS) -c $<
|
|
||||||
|
|
||||||
all: $(sources) $(conf_sources) $(built_sources) $(objs)
|
|
||||||
link /DLL /IMPLIB:libgpgme-11-msc.lib \
|
|
||||||
/OUT:libgpgme-11-msc.dll \
|
|
||||||
/DEF:gpgme.def /NOLOGO /MANIFEST:NO \
|
|
||||||
/NODEFAULTLIB:"oldnames.lib" /DYNAMICBASE:NO \
|
|
||||||
$(objs) \
|
|
||||||
$(libdir)/libgpg-error-0-msc.lib \
|
|
||||||
$(libdir)/libassuan-0-msc.lib \
|
|
||||||
coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib \
|
|
||||||
commctrl.lib ws2.lib /subsystem:windowsce,5.02
|
|
||||||
|
|
||||||
# Note that we don't need to create the install directories because
|
|
||||||
# libgpg-error must have been build and installed prior to this
|
|
||||||
# package.
|
|
||||||
install: all
|
|
||||||
copy /y gpgme.h $(incdir:/=\)
|
|
||||||
copy /y libgpgme-11-msc.dll $(bindir:/=\)
|
|
||||||
copy /y libgpgme-11-msc.lib $(libdir:/=\)
|
|
||||||
|
|
||||||
|
|
||||||
clean:
|
|
||||||
del *.obj libgpgme-11-msc.lib libgpgme-11-msc.dll libgpgme-11-msc.exp
|
|
||||||
|
|
@ -1,314 +0,0 @@
|
|||||||
/* config.h for building with Visual-C for WindowsCE.
|
|
||||||
* Copyright 2010 g10 Code GmbH
|
|
||||||
*
|
|
||||||
* This file is free software; as a special exception the author gives
|
|
||||||
* unlimited permission to copy and/or distribute it, with or without
|
|
||||||
* modifications, as long as this notice is preserved.
|
|
||||||
*
|
|
||||||
* This file is distributed in the hope that it will be useful, but
|
|
||||||
* WITHOUT ANY WARRANTY, to the extent permitted by law; without even the
|
|
||||||
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This file was originally created by running
|
|
||||||
* ./autogen.sh --build-w32ce
|
|
||||||
* on svn revision 1495 (gpgme 1.3.1-svn1495) and then adjusted to work
|
|
||||||
* with Visual-C.
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Define to the version of this package. */
|
|
||||||
#define PACKAGE_VERSION "1.3.1-svn1495-msc1"
|
|
||||||
|
|
||||||
/* Name of this package */
|
|
||||||
#define PACKAGE "gpgme"
|
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */
|
|
||||||
#define PACKAGE_BUGREPORT "bug-gpgme@gnupg.org"
|
|
||||||
|
|
||||||
/* Define to the full name of this package. */
|
|
||||||
#define PACKAGE_NAME "gpgme"
|
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */
|
|
||||||
#define PACKAGE_STRING "gpgme " PACKAGE_VERSION
|
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */
|
|
||||||
#define PACKAGE_TARNAME "gpgme"
|
|
||||||
|
|
||||||
/* Define to the home page for this package. */
|
|
||||||
#define PACKAGE_URL ""
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Whether Assuan support is enabled */
|
|
||||||
#define ENABLE_ASSUAN 1
|
|
||||||
|
|
||||||
/* Whether G13 support is enabled */
|
|
||||||
#define ENABLE_G13 1
|
|
||||||
|
|
||||||
/* Whether GPGCONF support is enabled */
|
|
||||||
#define ENABLE_GPGCONF 1
|
|
||||||
|
|
||||||
/* Whether GPGSM support is enabled */
|
|
||||||
#define ENABLE_GPGSM 1
|
|
||||||
|
|
||||||
/* Defined if we are building with uiserver support. */
|
|
||||||
/* #undef ENABLE_UISERVER */
|
|
||||||
|
|
||||||
/* Path to the G13 binary. */
|
|
||||||
#define G13_PATH "c:\\gnupg\\g13.exe"
|
|
||||||
|
|
||||||
/* Path to the GPGCONF binary. */
|
|
||||||
#define GPGCONF_PATH "c:\\gnupg\\gpgconf.exe"
|
|
||||||
|
|
||||||
/* version of the libassuan library */
|
|
||||||
#define GPGME_LIBASSUAN_VERSION "2.0.2-svn381"
|
|
||||||
|
|
||||||
/* Path to the GPGSM binary. */
|
|
||||||
#define GPGSM_PATH "c:\\gnupg\\gpgsm.exe"
|
|
||||||
|
|
||||||
/* The default error source for GPGME. */
|
|
||||||
#define GPG_ERR_SOURCE_DEFAULT GPG_ERR_SOURCE_GPGME
|
|
||||||
|
|
||||||
/* Path to the GnuPG binary. */
|
|
||||||
#define GPG_PATH "c:\\gnupg\\gpg.exe"
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <dlfcn.h> header file. */
|
|
||||||
/* #undef HAVE_DLFCN_H */
|
|
||||||
|
|
||||||
/* Defined if we run on some of the PCDOS like systems (DOS, Windoze. OS/2)
|
|
||||||
with special properties like no file modes */
|
|
||||||
#define HAVE_DOSISH_SYSTEM 1
|
|
||||||
|
|
||||||
/* Define to 1 if the system has the type `error_t'. */
|
|
||||||
/* #undef HAVE_ERROR_T */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `fopencookie' function. */
|
|
||||||
/* #undef HAVE_FOPENCOOKIE */
|
|
||||||
|
|
||||||
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
|
|
||||||
/* #undef HAVE_FSEEKO */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `funopen' function. */
|
|
||||||
/* #undef HAVE_FUNOPEN */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getegid' function. */
|
|
||||||
/* #undef HAVE_GETEGID */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getenv_r' function. */
|
|
||||||
/* #undef HAVE_GETENV_R */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `getgid' function. */
|
|
||||||
/* #undef HAVE_GETGID */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
|
||||||
#define HAVE_INTTYPES_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <locale.h> header file. */
|
|
||||||
/* #undef HAVE_LOCALE_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */
|
|
||||||
#define HAVE_MEMORY_H 1
|
|
||||||
|
|
||||||
/* Define if we have Pth. */
|
|
||||||
/* #undef HAVE_PTH */
|
|
||||||
|
|
||||||
/* Define if we have pthread. */
|
|
||||||
/* #undef HAVE_PTHREAD */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `setenv' function. */
|
|
||||||
/* #undef HAVE_SETENV */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `setlocale' function. */
|
|
||||||
/* #undef HAVE_SETLOCALE */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */
|
|
||||||
#define HAVE_STDINT_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
|
||||||
#define HAVE_STDLIB_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `stpcpy' function. */
|
|
||||||
/* #undef HAVE_STPCPY */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */
|
|
||||||
/* #undef HAVE_STRINGS_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <string.h> header file. */
|
|
||||||
#define HAVE_STRING_H 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/select.h> header file. */
|
|
||||||
/* #undef HAVE_SYS_SELECT_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
|
||||||
/* #undef HAVE_SYS_STAT_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
|
||||||
/* #undef HAVE_SYS_TYPES_H */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/uio.h> header file. */
|
|
||||||
/* #undef HAVE_SYS_UIO_H */
|
|
||||||
|
|
||||||
/* Define if getenv() is thread-safe */
|
|
||||||
/* #undef HAVE_THREAD_SAFE_GETENV */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `timegm' function. */
|
|
||||||
/* #undef HAVE_TIMEGM */
|
|
||||||
|
|
||||||
/* Define if __thread is supported */
|
|
||||||
/* #define HAVE_TLS 1 */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `ttyname_r' function. */
|
|
||||||
/* #undef HAVE_TTYNAME_R */
|
|
||||||
|
|
||||||
/* Define to 1 if the system has the type `uintptr_t'. */
|
|
||||||
#define HAVE_UINTPTR_T 1
|
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */
|
|
||||||
/* #define HAVE_UNISTD_H 1 */
|
|
||||||
|
|
||||||
/* Define to 1 if you have the `vasprintf' function. */
|
|
||||||
/* #undef HAVE_VASPRINTF */
|
|
||||||
|
|
||||||
/* Defined if we run on a W32 CE API based system */
|
|
||||||
#define HAVE_W32CE_SYSTEM 1
|
|
||||||
|
|
||||||
/* Defined if we run on a W32 API based system */
|
|
||||||
#define HAVE_W32_SYSTEM 1
|
|
||||||
|
|
||||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||||
*/
|
|
||||||
#define LT_OBJDIR ".libs/"
|
|
||||||
|
|
||||||
/* used to implement the va_copy macro */
|
|
||||||
/* #undef MUST_COPY_VA_BYVAL */
|
|
||||||
|
|
||||||
/* Min. needed G13 version. */
|
|
||||||
#define NEED_G13_VERSION "2.1.0"
|
|
||||||
|
|
||||||
/* Min. needed GPGCONF version. */
|
|
||||||
#define NEED_GPGCONF_VERSION "2.0.4"
|
|
||||||
|
|
||||||
/* Min. needed GPGSM version. */
|
|
||||||
#define NEED_GPGSM_VERSION "1.9.6"
|
|
||||||
|
|
||||||
/* Min. needed GnuPG version. */
|
|
||||||
#define NEED_GPG_VERSION "1.4.0"
|
|
||||||
|
|
||||||
|
|
||||||
/* Separators as used in $PATH. */
|
|
||||||
#ifdef HAVE_DOSISH_SYSTEM
|
|
||||||
#define PATHSEP_C ';'
|
|
||||||
#else
|
|
||||||
#define PATHSEP_C ':'
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* The size of `unsigned int', as computed by sizeof. */
|
|
||||||
#define SIZEOF_UNSIGNED_INT 4
|
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */
|
|
||||||
#define STDC_HEADERS 1
|
|
||||||
|
|
||||||
/* Defined if descriptor passing is enabled and supported */
|
|
||||||
/* #undef USE_DESCRIPTOR_PASSING */
|
|
||||||
|
|
||||||
/* Enable extensions on AIX 3, Interix. */
|
|
||||||
#ifndef _ALL_SOURCE
|
|
||||||
# define _ALL_SOURCE 1
|
|
||||||
#endif
|
|
||||||
/* Enable GNU extensions on systems that have them. */
|
|
||||||
#ifndef _GNU_SOURCE
|
|
||||||
# define _GNU_SOURCE 1
|
|
||||||
#endif
|
|
||||||
/* Enable threading extensions on Solaris. */
|
|
||||||
#ifndef _POSIX_PTHREAD_SEMANTICS
|
|
||||||
# define _POSIX_PTHREAD_SEMANTICS 1
|
|
||||||
#endif
|
|
||||||
/* Enable extensions on HP NonStop. */
|
|
||||||
#ifndef _TANDEM_SOURCE
|
|
||||||
# define _TANDEM_SOURCE 1
|
|
||||||
#endif
|
|
||||||
/* Enable general extensions on Solaris. */
|
|
||||||
#ifndef __EXTENSIONS__
|
|
||||||
# define __EXTENSIONS__ 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
/* Version of this package */
|
|
||||||
#define VERSION PACKAGE_VERSION
|
|
||||||
|
|
||||||
/* Number of bits in a file offset, on hosts where this is settable. */
|
|
||||||
/* #undef _FILE_OFFSET_BITS */
|
|
||||||
|
|
||||||
/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
|
|
||||||
/* #undef _LARGEFILE_SOURCE */
|
|
||||||
|
|
||||||
/* Define for large files, on AIX-style hosts. */
|
|
||||||
/* #undef _LARGE_FILES */
|
|
||||||
|
|
||||||
/* Define to 1 if on MINIX. */
|
|
||||||
/* #undef _MINIX */
|
|
||||||
|
|
||||||
/* Define to 2 if the system does not provide POSIX.1 features except with
|
|
||||||
this defined. */
|
|
||||||
/* #undef _POSIX_1_SOURCE */
|
|
||||||
|
|
||||||
/* Define to 1 if you need to in order for `stat' and other things to work. */
|
|
||||||
/* #undef _POSIX_SOURCE */
|
|
||||||
|
|
||||||
/* To allow the use of GPGME in multithreaded programs we have to use
|
|
||||||
special features from the library.
|
|
||||||
IMPORTANT: gpgme is not yet fully reentrant and you should use it
|
|
||||||
only from one thread. */
|
|
||||||
#ifndef _REENTRANT
|
|
||||||
# define _REENTRANT 1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Activate POSIX interface on MacOS X */
|
|
||||||
/* #undef _XOPEN_SOURCE */
|
|
||||||
|
|
||||||
/* Define to a type to use for `error_t' if it is not otherwise available. */
|
|
||||||
#define error_t int
|
|
||||||
|
|
||||||
/* Define to `__inline__' or `__inline' if that's what the C compiler
|
|
||||||
calls it, or to nothing if 'inline' is not supported under any name. */
|
|
||||||
#ifndef __cplusplus
|
|
||||||
#define inline __inline
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Define to `long int' if <sys/types.h> does not define. */
|
|
||||||
/* #undef off_t */
|
|
||||||
|
|
||||||
/* Define to the type of an unsigned integer type wide enough to hold a
|
|
||||||
pointer, if such a type exists, and if the system does not define it. */
|
|
||||||
/* #undef uintptr_t */
|
|
||||||
|
|
||||||
|
|
||||||
/* Definition of GCC specific attributes. */
|
|
||||||
#if __GNUC__ > 2
|
|
||||||
# define GPGME_GCC_A_PURE __attribute__ ((__pure__))
|
|
||||||
#else
|
|
||||||
# define GPGME_GCC_A_PURE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Under WindowsCE we need gpg-error's strerror macro. */
|
|
||||||
#define GPG_ERR_ENABLE_ERRNO_MACROS 1
|
|
||||||
|
|
||||||
/* snprintf is not part of oldnames.lib thus we redefine it here. */
|
|
||||||
#define snprintf _snprintf
|
|
||||||
|
|
||||||
/* We don't want warnings like this:
|
|
||||||
|
|
||||||
warning C4996: e.g. "The POSIX name for this item is
|
|
||||||
deprecated. Instead, use the ISO C++ conformant name: _fileno"
|
|
||||||
|
|
||||||
warning C4018: '<' : signed/unsigned mismatch
|
|
||||||
|
|
||||||
warning C4244: '=' : conversion from 'time_t' to
|
|
||||||
'unsigned long', possible loss of data
|
|
||||||
|
|
||||||
*/
|
|
||||||
#pragma warning(disable:4996 4018 4244)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1 +0,0 @@
|
|||||||
/* Dummy fcntl.h header. */
|
|
@ -1,2 +0,0 @@
|
|||||||
/* Dummy io.h header. */
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
|||||||
typedef unsigned long long uint64_t;
|
|
||||||
typedef long long int64_t;
|
|
||||||
typedef unsigned int uint32_t;
|
|
||||||
typedef int int32_t;
|
|
||||||
typedef unsigned short uint16_t;
|
|
||||||
typedef short int16_t;
|
|
||||||
typedef unsigned int uintptr_t;
|
|
||||||
typedef int intptr_t;
|
|
||||||
|
|
@ -50,10 +50,6 @@ system_components = ath.h posix-util.c posix-io.c
|
|||||||
system_components_not_extra =
|
system_components_not_extra =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if HAVE_W32CE_SYSTEM
|
|
||||||
system_components += w32-ce.h w32-ce.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
if HAVE_UISERVER
|
if HAVE_UISERVER
|
||||||
uiserver_components = engine-uiserver.c
|
uiserver_components = engine-uiserver.c
|
||||||
else
|
else
|
||||||
@ -111,12 +107,7 @@ if HAVE_W32_SYSTEM
|
|||||||
# Windows provides us with an endless stream of Tough Love. To spawn
|
# Windows provides us with an endless stream of Tough Love. To spawn
|
||||||
# processes with a controlled set of inherited handles, we need a
|
# processes with a controlled set of inherited handles, we need a
|
||||||
# wrapper process.
|
# wrapper process.
|
||||||
# Except on Windows CE. There nothing is inheritable anyway.
|
|
||||||
if HAVE_W32CE_SYSTEM
|
|
||||||
libexec_PROGRAMS =
|
|
||||||
else
|
|
||||||
libexec_PROGRAMS = gpgme-w32spawn
|
libexec_PROGRAMS = gpgme-w32spawn
|
||||||
endif
|
|
||||||
|
|
||||||
RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
|
RCCOMPILE = $(RC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES)
|
||||||
LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE)
|
LTRCCOMPILE = $(LIBTOOL) --mode=compile --tag=RC $(RCCOMPILE)
|
||||||
|
@ -78,22 +78,14 @@ ath_self (void)
|
|||||||
gpgme_ssize_t
|
gpgme_ssize_t
|
||||||
ath_read (int fd, void *buf, size_t nbytes)
|
ath_read (int fd, void *buf, size_t nbytes)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER)
|
|
||||||
return -1; /* Not supported. */
|
|
||||||
#else
|
|
||||||
return read (fd, buf, nbytes);
|
return read (fd, buf, nbytes);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
gpgme_ssize_t
|
gpgme_ssize_t
|
||||||
ath_write (int fd, const void *buf, size_t nbytes)
|
ath_write (int fd, const void *buf, size_t nbytes)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER)
|
|
||||||
return -1; /* Not supported. */
|
|
||||||
#else
|
|
||||||
return write (fd, buf, nbytes);
|
return write (fd, buf, nbytes);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -28,9 +28,6 @@
|
|||||||
/* fixme: Check how we did it in libgcrypt. */
|
/* fixme: Check how we did it in libgcrypt. */
|
||||||
struct msghdr { int dummy; };
|
struct msghdr { int dummy; };
|
||||||
typedef int socklen_t;
|
typedef int socklen_t;
|
||||||
# if defined(HAVE_W32CE_SYSTEM) && defined(_MSC_VER)
|
|
||||||
# include <winsock2.h>
|
|
||||||
# endif
|
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
# include <io.h>
|
# include <io.h>
|
||||||
|
|
||||||
|
@ -43,9 +43,6 @@ gpgme_error_t
|
|||||||
gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname,
|
gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname,
|
||||||
FILE *stream, gpgme_off_t offset, size_t length)
|
FILE *stream, gpgme_off_t offset, size_t length)
|
||||||
{
|
{
|
||||||
#if defined (HAVE_W32CE_SYSTEM) && defined (_MSC_VER)
|
|
||||||
return gpgme_error (GPG_ERR_NOT_IMPLEMENTED);
|
|
||||||
#else
|
|
||||||
gpgme_error_t err;
|
gpgme_error_t err;
|
||||||
char *buf = NULL;
|
char *buf = NULL;
|
||||||
int res;
|
int res;
|
||||||
@ -114,7 +111,6 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname,
|
|||||||
(*r_dh)->data.mem.length = length;
|
(*r_dh)->data.mem.length = length;
|
||||||
|
|
||||||
return TRACE_SUC1 ("r_dh=%p", *r_dh);
|
return TRACE_SUC1 ("r_dh=%p", *r_dh);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -123,9 +119,6 @@ gpgme_data_new_from_filepart (gpgme_data_t *r_dh, const char *fname,
|
|||||||
gpgme_error_t
|
gpgme_error_t
|
||||||
gpgme_data_new_from_file (gpgme_data_t *r_dh, const char *fname, int copy)
|
gpgme_data_new_from_file (gpgme_data_t *r_dh, const char *fname, int copy)
|
||||||
{
|
{
|
||||||
#if defined (HAVE_W32CE_SYSTEM) && defined (_MSC_VER)
|
|
||||||
return gpgme_error (GPG_ERR_NOT_IMPLEMENTED);
|
|
||||||
#else
|
|
||||||
gpgme_error_t err;
|
gpgme_error_t err;
|
||||||
struct stat statbuf;
|
struct stat statbuf;
|
||||||
TRACE_BEG3 (DEBUG_DATA, "gpgme_data_new_from_file", r_dh,
|
TRACE_BEG3 (DEBUG_DATA, "gpgme_data_new_from_file", r_dh,
|
||||||
@ -139,7 +132,6 @@ gpgme_data_new_from_file (gpgme_data_t *r_dh, const char *fname, int copy)
|
|||||||
|
|
||||||
err = gpgme_data_new_from_filepart (r_dh, fname, NULL, 0, statbuf.st_size);
|
err = gpgme_data_new_from_filepart (r_dh, fname, NULL, 0, statbuf.st_size);
|
||||||
return TRACE_ERR (err);
|
return TRACE_ERR (err);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,62 +33,6 @@
|
|||||||
#include "data.h"
|
#include "data.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if defined(HAVE_W32CE_SYSTEM) && !defined(__MINGW32CE__)
|
|
||||||
/* We need to provide replacements for read, write and lseek. They
|
|
||||||
are taken from the cegcc runtime files, written by Pedro Alves
|
|
||||||
<pedro_alves@portugalmail.pt> in Feb 2007 and placed in the public
|
|
||||||
domain. (cf. cegcc/src/mingw/mingwex/wince/) */
|
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
static int
|
|
||||||
read (int fildes, void *buf, unsigned int bufsize)
|
|
||||||
{
|
|
||||||
DWORD NumberOfBytesRead;
|
|
||||||
if (bufsize > 0x7fffffff)
|
|
||||||
bufsize = 0x7fffffff;
|
|
||||||
if (!ReadFile ((HANDLE) fildes, buf, bufsize, &NumberOfBytesRead, NULL))
|
|
||||||
return -1;
|
|
||||||
return (int) NumberOfBytesRead;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int
|
|
||||||
write (int fildes, const void *buf, unsigned int bufsize)
|
|
||||||
{
|
|
||||||
DWORD NumberOfBytesWritten;
|
|
||||||
if (bufsize > 0x7fffffff)
|
|
||||||
bufsize = 0x7fffffff;
|
|
||||||
if (!WriteFile ((HANDLE) fildes, buf, bufsize, &NumberOfBytesWritten, NULL))
|
|
||||||
return -1;
|
|
||||||
return (int) NumberOfBytesWritten;
|
|
||||||
}
|
|
||||||
|
|
||||||
static long
|
|
||||||
lseek (int fildes, long offset, int whence)
|
|
||||||
{
|
|
||||||
DWORD mode;
|
|
||||||
switch (whence)
|
|
||||||
{
|
|
||||||
case SEEK_SET:
|
|
||||||
mode = FILE_BEGIN;
|
|
||||||
break;
|
|
||||||
case SEEK_CUR:
|
|
||||||
mode = FILE_CURRENT;
|
|
||||||
break;
|
|
||||||
case SEEK_END:
|
|
||||||
mode = FILE_END;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
/* Specify an invalid mode so SetFilePointer catches it. */
|
|
||||||
mode = (DWORD)-1;
|
|
||||||
}
|
|
||||||
return (long) SetFilePointer ((HANDLE) fildes, offset, NULL, mode);
|
|
||||||
}
|
|
||||||
#endif /*HAVE_W32CE_SYSTEM && !__MINGW32CE__*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
static gpgme_ssize_t
|
static gpgme_ssize_t
|
||||||
fd_read (gpgme_data_t dh, void *buffer, size_t size)
|
fd_read (gpgme_data_t dh, void *buffer, size_t size)
|
||||||
{
|
{
|
||||||
|
14
src/debug.c
14
src/debug.c
@ -150,16 +150,12 @@ debug_init (void)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
e = _gpgme_w32ce_get_debug_envvar ();
|
|
||||||
#else /*!HAVE_W32CE_SYSTEM*/
|
|
||||||
err = _gpgme_getenv ("GPGME_DEBUG", &e);
|
err = _gpgme_getenv ("GPGME_DEBUG", &e);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
UNLOCK (debug_lock);
|
UNLOCK (debug_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif /*!HAVE_W32CE_SYSTEM*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
initialized = 1;
|
initialized = 1;
|
||||||
@ -257,15 +253,6 @@ _gpgme_debug (int level, const char *format, ...)
|
|||||||
va_start (arg_ptr, format);
|
va_start (arg_ptr, format);
|
||||||
LOCK (debug_lock);
|
LOCK (debug_lock);
|
||||||
{
|
{
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
SYSTEMTIME t;
|
|
||||||
|
|
||||||
GetLocalTime (&t);
|
|
||||||
fprintf (errfp, "GPGME %04d-%02d-%02d %02d:%02d:%02d <0x%04llx> ",
|
|
||||||
t.wYear, t.wMonth, t.wDay,
|
|
||||||
t.wHour, t.wMinute, t.wSecond,
|
|
||||||
(unsigned long long) ath_self ());
|
|
||||||
#else
|
|
||||||
struct tm *tp;
|
struct tm *tp;
|
||||||
time_t atime = time (NULL);
|
time_t atime = time (NULL);
|
||||||
|
|
||||||
@ -274,7 +261,6 @@ _gpgme_debug (int level, const char *format, ...)
|
|||||||
1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
|
1900+tp->tm_year, tp->tm_mon+1, tp->tm_mday,
|
||||||
tp->tm_hour, tp->tm_min, tp->tm_sec,
|
tp->tm_hour, tp->tm_min, tp->tm_sec,
|
||||||
(unsigned long long) ath_self ());
|
(unsigned long long) ath_self ());
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
#ifdef FRAME_NR
|
#ifdef FRAME_NR
|
||||||
{
|
{
|
||||||
|
@ -211,6 +211,10 @@ _gpgme_trace_gpgme_error (gpgme_error_t err, const char *file, int line)
|
|||||||
#define TRACE_SUC2(fmt, arg1, arg2) \
|
#define TRACE_SUC2(fmt, arg1, arg2) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
||||||
_gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end ()
|
_gpgme_trace_func, arg1, arg2), _gpgme_debug_frame_end ()
|
||||||
|
#define TRACE_SUC4(fmt, arg1, arg2, arg3, arg4) \
|
||||||
|
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
||||||
|
_gpgme_trace_func, arg1, arg2, arg3, arg4), \
|
||||||
|
_gpgme_debug_frame_end ()
|
||||||
#define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \
|
#define TRACE_SUC5(fmt, arg1, arg2, arg3, arg4, arg5) \
|
||||||
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
_gpgme_debug (_gpgme_trace_level, "%s: leave: " fmt "\n", \
|
||||||
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), \
|
_gpgme_trace_func, arg1, arg2, arg3, arg4, arg5), \
|
||||||
|
@ -3282,15 +3282,11 @@ gpgme_server (gpgme_tool_t gt)
|
|||||||
gt->write_data_hook = &server;
|
gt->write_data_hook = &server;
|
||||||
|
|
||||||
/* We use a pipe based server so that we can work from scripts.
|
/* We use a pipe based server so that we can work from scripts.
|
||||||
assuan_init_pipe_server will automagically detect when we are
|
* assuan_init_pipe_server will automagically detect when we are
|
||||||
called with a socketpair and ignore FIELDES in this case. */
|
* called with a socketpair and ignore FILEDES in this case. */
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
filedes[0] = ASSUAN_STDIN;
|
|
||||||
filedes[1] = ASSUAN_STDOUT;
|
|
||||||
#else
|
|
||||||
filedes[0] = assuan_fdopen (0);
|
filedes[0] = assuan_fdopen (0);
|
||||||
filedes[1] = assuan_fdopen (1);
|
filedes[1] = assuan_fdopen (1);
|
||||||
#endif
|
|
||||||
err = assuan_new (&server.assuan_ctx);
|
err = assuan_new (&server.assuan_ctx);
|
||||||
if (err)
|
if (err)
|
||||||
log_error (1, err, "can't create assuan context");
|
log_error (1, err, "can't create assuan context");
|
||||||
@ -3439,10 +3435,5 @@ main (int argc, char *argv[])
|
|||||||
if (needgt)
|
if (needgt)
|
||||||
gpgme_release (gt.ctx);
|
gpgme_release (gt.ctx);
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
/* Give the buggy ssh server time to flush the output buffers. */
|
|
||||||
Sleep (300);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -23,9 +23,6 @@
|
|||||||
#define IO_H
|
#define IO_H
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
# ifdef HAVE_W32CE_SYSTEM
|
|
||||||
# include "w32-ce.h"
|
|
||||||
# endif
|
|
||||||
# include <winsock2.h>
|
# include <winsock2.h>
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#else
|
#else
|
||||||
|
@ -23,12 +23,8 @@
|
|||||||
#define UTIL_H
|
#define UTIL_H
|
||||||
|
|
||||||
#ifdef HAVE_W32_SYSTEM
|
#ifdef HAVE_W32_SYSTEM
|
||||||
# ifdef HAVE_W32CE_SYSTEM
|
|
||||||
# include "w32-ce.h"
|
|
||||||
# else
|
|
||||||
# include "winsock2.h"
|
# include "winsock2.h"
|
||||||
# include "windows.h"
|
# include "windows.h"
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* For pid_t. */
|
/* For pid_t. */
|
||||||
@ -208,9 +204,6 @@ const char *_gpgme_status_to_string (gpgme_status_code_t code);
|
|||||||
int _gpgme_mkstemp (int *fd, char **name);
|
int _gpgme_mkstemp (int *fd, char **name);
|
||||||
const char *_gpgme_get_w32spawn_path (void);
|
const char *_gpgme_get_w32spawn_path (void);
|
||||||
#endif /*HAVE_W32_SYSTEM*/
|
#endif /*HAVE_W32_SYSTEM*/
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
char *_gpgme_w32ce_get_debug_envvar (void);
|
|
||||||
#endif /*HAVE_W32CE_SYSTEM*/
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
507
src/w32-ce.c
507
src/w32-ce.c
@ -1,507 +0,0 @@
|
|||||||
/* w32-ce.h
|
|
||||||
Copyright (C) 2010 g10 Code GmbH
|
|
||||||
Copyright (C) 1991,92,97,2000,02 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
This file is part of GPGME.
|
|
||||||
|
|
||||||
GPGME is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2.1 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
GPGME is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this program; if not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
|
||||||
#include <config.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <string.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <assert.h>
|
|
||||||
|
|
||||||
#include <gpg-error.h>
|
|
||||||
|
|
||||||
#define _WIN32_IE 0x0400 /* Required for SHGetSpecialFolderPathW. */
|
|
||||||
|
|
||||||
/* We need to include the windows stuff here prior to shlobj.h so that
|
|
||||||
we get the right winsock version. This is usually done in w32-ce.h
|
|
||||||
but that header also redefines some Windows functions which we need
|
|
||||||
to avoid unless having included shlobj.h. */
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <ws2tcpip.h>
|
|
||||||
#include <windows.h>
|
|
||||||
#include <shlobj.h>
|
|
||||||
|
|
||||||
#include "w32-ce.h"
|
|
||||||
|
|
||||||
/* Return a malloced string encoded in UTF-8 from the wide char input
|
|
||||||
string STRING. Caller must free this value. Returns NULL and sets
|
|
||||||
ERRNO on failure. Calling this function with STRING set to NULL is
|
|
||||||
not defined. */
|
|
||||||
char *
|
|
||||||
wchar_to_utf8 (const wchar_t *string)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
char *result;
|
|
||||||
|
|
||||||
n = WideCharToMultiByte (CP_UTF8, 0, string, -1, NULL, 0, NULL, NULL);
|
|
||||||
if (n < 0)
|
|
||||||
{
|
|
||||||
gpg_err_set_errno (EINVAL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
result = malloc (n+1);
|
|
||||||
if (!result)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
n = WideCharToMultiByte (CP_UTF8, 0, string, -1, result, n, NULL, NULL);
|
|
||||||
if (n < 0)
|
|
||||||
{
|
|
||||||
free (result);
|
|
||||||
gpg_err_set_errno (EINVAL);
|
|
||||||
result = NULL;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Return a malloced wide char string from an UTF-8 encoded input
|
|
||||||
string STRING. Caller must free this value. Returns NULL and sets
|
|
||||||
ERRNO on failure. Calling this function with STRING set to NULL is
|
|
||||||
not defined. */
|
|
||||||
wchar_t *
|
|
||||||
utf8_to_wchar (const char *string)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
size_t nbytes;
|
|
||||||
wchar_t *result;
|
|
||||||
|
|
||||||
n = MultiByteToWideChar (CP_UTF8, 0, string, -1, NULL, 0);
|
|
||||||
if (n < 0)
|
|
||||||
{
|
|
||||||
gpg_err_set_errno (EINVAL);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
nbytes = (size_t)(n+1) * sizeof(*result);
|
|
||||||
if (nbytes / sizeof(*result) != (n+1))
|
|
||||||
{
|
|
||||||
gpg_err_set_errno (ENOMEM);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
result = malloc (nbytes);
|
|
||||||
if (!result)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
n = MultiByteToWideChar (CP_UTF8, 0, string, -1, result, n);
|
|
||||||
if (n < 0)
|
|
||||||
{
|
|
||||||
free (result);
|
|
||||||
gpg_err_set_errno (EINVAL);
|
|
||||||
result = NULL;
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#define MAX_ENV 30
|
|
||||||
|
|
||||||
char *environ[MAX_ENV + 1];
|
|
||||||
|
|
||||||
char *
|
|
||||||
getenv (const char *name)
|
|
||||||
{
|
|
||||||
static char *past_result;
|
|
||||||
char **envp;
|
|
||||||
|
|
||||||
if (past_result)
|
|
||||||
{
|
|
||||||
free (past_result);
|
|
||||||
past_result = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
if (! strcmp (name, "DBUS_VERBOSE"))
|
|
||||||
return past_result = get_verbose_setting ();
|
|
||||||
else if (! strcmp (name, "HOMEPATH"))
|
|
||||||
return past_result = find_my_documents_folder ();
|
|
||||||
else if (! strcmp (name, "DBUS_DATADIR"))
|
|
||||||
return past_result = find_inst_subdir ("share");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
for (envp = environ; *envp != 0; envp++)
|
|
||||||
{
|
|
||||||
const char *varp = name;
|
|
||||||
char *ep = *envp;
|
|
||||||
|
|
||||||
while (*varp == *ep && *varp != '\0')
|
|
||||||
{
|
|
||||||
++ep;
|
|
||||||
++varp;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (*varp == '\0' && *ep == '=')
|
|
||||||
return ep + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
|
||||||
GetSystemTimeAsFileTime (LPFILETIME ftp)
|
|
||||||
{
|
|
||||||
SYSTEMTIME st;
|
|
||||||
GetSystemTime (&st);
|
|
||||||
SystemTimeToFileTime (&st, ftp);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
DeleteFileA (LPCSTR lpFileName)
|
|
||||||
{
|
|
||||||
wchar_t *filename;
|
|
||||||
BOOL result;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
filename = utf8_to_wchar (lpFileName);
|
|
||||||
if (!filename)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
result = DeleteFileW (filename);
|
|
||||||
|
|
||||||
err = GetLastError ();
|
|
||||||
free (filename);
|
|
||||||
SetLastError (err);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
HANDLE
|
|
||||||
CreateFileA (LPCSTR lpFileName, DWORD dwDesiredAccess, DWORD dwSharedMode,
|
|
||||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
|
||||||
DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes,
|
|
||||||
HANDLE hTemplateFile)
|
|
||||||
{
|
|
||||||
wchar_t *filename;
|
|
||||||
HANDLE result;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
filename = utf8_to_wchar (lpFileName);
|
|
||||||
if (!filename)
|
|
||||||
return INVALID_HANDLE_VALUE;
|
|
||||||
|
|
||||||
result = CreateFileW (filename, dwDesiredAccess, dwSharedMode,
|
|
||||||
lpSecurityAttributes, dwCreationDisposition,
|
|
||||||
dwFlagsAndAttributes, hTemplateFile);
|
|
||||||
|
|
||||||
err = GetLastError ();
|
|
||||||
free (filename);
|
|
||||||
SetLastError (err);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
BOOL
|
|
||||||
CreateProcessA (LPCSTR pszImageName, LPSTR pszCmdLine,
|
|
||||||
LPSECURITY_ATTRIBUTES psaProcess,
|
|
||||||
LPSECURITY_ATTRIBUTES psaThread, BOOL fInheritHandles,
|
|
||||||
DWORD fdwCreate, PVOID pvEnvironment, LPCSTR pszCurDir,
|
|
||||||
LPSTARTUPINFOA psiStartInfo,
|
|
||||||
LPPROCESS_INFORMATION pProcInfo)
|
|
||||||
{
|
|
||||||
wchar_t *image_name = NULL;
|
|
||||||
wchar_t *cmd_line = NULL;
|
|
||||||
BOOL result;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
assert (psaProcess == NULL);
|
|
||||||
assert (psaThread == NULL);
|
|
||||||
assert (fInheritHandles == FALSE);
|
|
||||||
assert (pvEnvironment == NULL);
|
|
||||||
assert (pszCurDir == NULL);
|
|
||||||
/* psiStartInfo is generally not NULL. */
|
|
||||||
|
|
||||||
if (pszImageName)
|
|
||||||
{
|
|
||||||
image_name = utf8_to_wchar (pszImageName);
|
|
||||||
if (!image_name)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
if (pszCmdLine)
|
|
||||||
{
|
|
||||||
cmd_line = utf8_to_wchar (pszCmdLine);
|
|
||||||
if (!cmd_line)
|
|
||||||
{
|
|
||||||
if (image_name)
|
|
||||||
free (image_name);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
result = CreateProcessW (image_name, cmd_line, NULL, NULL, FALSE,
|
|
||||||
fdwCreate, NULL, NULL, NULL, pProcInfo);
|
|
||||||
|
|
||||||
err = GetLastError ();
|
|
||||||
free (image_name);
|
|
||||||
free (cmd_line);
|
|
||||||
SetLastError (err);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LONG
|
|
||||||
RegOpenKeyExA (HKEY hKey, LPCSTR lpSubKey, DWORD ulOptions,
|
|
||||||
REGSAM samDesired, PHKEY phkResult)
|
|
||||||
{
|
|
||||||
wchar_t *subkey;
|
|
||||||
LONG result;
|
|
||||||
int err;
|
|
||||||
|
|
||||||
if (lpSubKey)
|
|
||||||
{
|
|
||||||
subkey = utf8_to_wchar (lpSubKey);
|
|
||||||
if (!subkey)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
subkey = NULL;
|
|
||||||
|
|
||||||
result = RegOpenKeyEx (hKey, subkey, ulOptions, samDesired, phkResult);
|
|
||||||
|
|
||||||
err = GetLastError ();
|
|
||||||
free (subkey);
|
|
||||||
SetLastError (err);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
LONG WINAPI
|
|
||||||
RegQueryValueExA (HKEY hKey, LPCSTR lpValueName, LPDWORD lpReserved,
|
|
||||||
LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData)
|
|
||||||
{
|
|
||||||
wchar_t *name;
|
|
||||||
LONG err;
|
|
||||||
void *data;
|
|
||||||
DWORD data_len;
|
|
||||||
DWORD type;
|
|
||||||
|
|
||||||
if (lpValueName)
|
|
||||||
{
|
|
||||||
name = utf8_to_wchar (lpValueName);
|
|
||||||
if (!name)
|
|
||||||
return GetLastError ();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
name = NULL;
|
|
||||||
|
|
||||||
data_len = 0;
|
|
||||||
err = RegQueryValueExW (hKey, name, lpReserved, lpType, NULL, &data_len);
|
|
||||||
if (err || !lpcbData)
|
|
||||||
{
|
|
||||||
free (name);
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
data = malloc (data_len + sizeof (wchar_t));
|
|
||||||
if (!data)
|
|
||||||
{
|
|
||||||
free (name);
|
|
||||||
return ERROR_NOT_ENOUGH_MEMORY;
|
|
||||||
}
|
|
||||||
|
|
||||||
err = RegQueryValueExW (hKey, name, lpReserved, &type, data, &data_len);
|
|
||||||
if (lpType)
|
|
||||||
*lpType = type;
|
|
||||||
free (name);
|
|
||||||
/* If err is ERROR_MORE_DATA, there probably was a race condition.
|
|
||||||
We can punt this to the caller just as well. */
|
|
||||||
if (err)
|
|
||||||
return err;
|
|
||||||
|
|
||||||
/* NOTE: REG_MULTI_SZ and REG_EXPAND_SZ not supported, because they
|
|
||||||
are not needed in this module. */
|
|
||||||
if (type == REG_SZ)
|
|
||||||
{
|
|
||||||
char *data_c;
|
|
||||||
int data_c_len;
|
|
||||||
|
|
||||||
/* This is valid since we allocated one more above. */
|
|
||||||
((char*)data)[data_len] = '\0';
|
|
||||||
((char*)data)[data_len + 1] = '\0';
|
|
||||||
|
|
||||||
data_c = wchar_to_utf8 ((wchar_t*) data);
|
|
||||||
if (!data_c)
|
|
||||||
return GetLastError();
|
|
||||||
|
|
||||||
data_c_len = strlen (data_c) + 1;
|
|
||||||
assert (data_c_len <= data_len + sizeof (wchar_t));
|
|
||||||
memcpy (data, data_c, data_c_len);
|
|
||||||
data_len = data_c_len;
|
|
||||||
free (data_c);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* DATA and DATA_LEN now contain the result. */
|
|
||||||
if (lpData)
|
|
||||||
{
|
|
||||||
if (data_len > *lpcbData)
|
|
||||||
err = ERROR_MORE_DATA;
|
|
||||||
else
|
|
||||||
memcpy (lpData, data, data_len);
|
|
||||||
}
|
|
||||||
*lpcbData = data_len;
|
|
||||||
return err;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
DWORD
|
|
||||||
GetTempPathA (DWORD nBufferLength, LPSTR lpBuffer)
|
|
||||||
{
|
|
||||||
wchar_t dummy[1];
|
|
||||||
DWORD len;
|
|
||||||
|
|
||||||
len = GetTempPathW (0, dummy);
|
|
||||||
if (len == 0)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
assert (len <= MAX_PATH);
|
|
||||||
|
|
||||||
/* Better be safe than sorry. MSDN doesn't say if len is with or
|
|
||||||
without terminating 0. */
|
|
||||||
len++;
|
|
||||||
|
|
||||||
{
|
|
||||||
wchar_t *buffer_w;
|
|
||||||
DWORD len_w;
|
|
||||||
char *buffer_c;
|
|
||||||
DWORD len_c;
|
|
||||||
|
|
||||||
buffer_w = malloc (sizeof (wchar_t) * len);
|
|
||||||
if (! buffer_w)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
len_w = GetTempPathW (len, buffer_w);
|
|
||||||
/* Give up if we still can't get at it. */
|
|
||||||
if (len_w == 0 || len_w >= len)
|
|
||||||
{
|
|
||||||
free (buffer_w);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Better be really safe. */
|
|
||||||
buffer_w[len_w] = '\0';
|
|
||||||
|
|
||||||
buffer_c = wchar_to_utf8 (buffer_w);
|
|
||||||
free (buffer_w);
|
|
||||||
if (! buffer_c)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* strlen is correct (not _mbstrlen), because we want storage and
|
|
||||||
not string length. */
|
|
||||||
len_c = strlen (buffer_c) + 1;
|
|
||||||
if (len_c > nBufferLength)
|
|
||||||
return len_c;
|
|
||||||
|
|
||||||
strcpy (lpBuffer, buffer_c);
|
|
||||||
free (buffer_c);
|
|
||||||
return len_c - 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* The symbol is named SHGetSpecialFolderPath and not
|
|
||||||
SHGetSpecialFolderPathW but shlobj.h from cegcc redefines it to *W
|
|
||||||
which is a bug. Work around it. */
|
|
||||||
#ifdef __MINGW32CE__
|
|
||||||
# undef SHGetSpecialFolderPath
|
|
||||||
#endif
|
|
||||||
BOOL
|
|
||||||
SHGetSpecialFolderPathA (HWND hwndOwner, LPSTR lpszPath, int nFolder,
|
|
||||||
BOOL fCreate)
|
|
||||||
{
|
|
||||||
wchar_t path[MAX_PATH];
|
|
||||||
char *path_c;
|
|
||||||
BOOL result;
|
|
||||||
|
|
||||||
path[0] = (wchar_t) 0;
|
|
||||||
result = SHGetSpecialFolderPath (hwndOwner, path, nFolder, fCreate);
|
|
||||||
/* Note: May return false even if succeeds. */
|
|
||||||
|
|
||||||
path[MAX_PATH - 1] = (wchar_t) 0;
|
|
||||||
path_c = wchar_to_utf8 (path);
|
|
||||||
if (! path_c)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
strncpy (lpszPath, path_c, MAX_PATH);
|
|
||||||
free (path_c);
|
|
||||||
lpszPath[MAX_PATH - 1] = '\0';
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Replacement for the access function. Note that we can't use fopen
|
|
||||||
here because wince might now allow to have a shared read for an
|
|
||||||
executable; it is better to to read the file attributes.
|
|
||||||
|
|
||||||
Limitation: Only F_OK is supported.
|
|
||||||
*/
|
|
||||||
int
|
|
||||||
_gpgme_wince_access (const char *fname, int mode)
|
|
||||||
{
|
|
||||||
DWORD attr;
|
|
||||||
wchar_t *wfname;
|
|
||||||
|
|
||||||
(void)mode;
|
|
||||||
|
|
||||||
wfname = utf8_to_wchar (fname);
|
|
||||||
if (!wfname)
|
|
||||||
return -1;
|
|
||||||
|
|
||||||
attr = GetFileAttributes (wfname);
|
|
||||||
free (wfname);
|
|
||||||
if (attr == (DWORD)(-1))
|
|
||||||
{
|
|
||||||
gpg_err_set_errno (ENOENT);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Perform a binary search for KEY in BASE which has NMEMB elements
|
|
||||||
of SIZE bytes each. The comparisons are done by (*COMPAR)().
|
|
||||||
Code taken from glibc-2.6. */
|
|
||||||
void *
|
|
||||||
_gpgme_wince_bsearch (const void *key, const void *base,
|
|
||||||
size_t nmemb, size_t size,
|
|
||||||
int (*compar) (const void *, const void *))
|
|
||||||
{
|
|
||||||
size_t l, u, idx;
|
|
||||||
const void *p;
|
|
||||||
int comparison;
|
|
||||||
|
|
||||||
l = 0;
|
|
||||||
u = nmemb;
|
|
||||||
while (l < u)
|
|
||||||
{
|
|
||||||
idx = (l + u) / 2;
|
|
||||||
p = (void *) (((const char *) base) + (idx * size));
|
|
||||||
comparison = (*compar) (key, p);
|
|
||||||
if (comparison < 0)
|
|
||||||
u = idx;
|
|
||||||
else if (comparison > 0)
|
|
||||||
l = idx + 1;
|
|
||||||
else
|
|
||||||
return (void *) p;
|
|
||||||
}
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
91
src/w32-ce.h
91
src/w32-ce.h
@ -1,91 +0,0 @@
|
|||||||
/* w32-ce.h
|
|
||||||
Copyright (C) 2010 g10 Code GmbH
|
|
||||||
|
|
||||||
This file is part of GPGME.
|
|
||||||
|
|
||||||
GPGME is free software; you can redistribute it and/or modify it
|
|
||||||
under the terms of the GNU Lesser General Public License as
|
|
||||||
published by the Free Software Foundation; either version 2.1 of
|
|
||||||
the License, or (at your option) any later version.
|
|
||||||
|
|
||||||
GPGME is distributed in the hope that it will be useful, but
|
|
||||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
Lesser General Public License for more details.
|
|
||||||
|
|
||||||
You should have received a copy of the GNU Lesser General Public
|
|
||||||
License along with this program; if not, write to the Free Software
|
|
||||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|
||||||
02111-1307, USA. */
|
|
||||||
|
|
||||||
#ifndef GPGME_W32_CE_H
|
|
||||||
#define GPGME_W32_CE_H
|
|
||||||
|
|
||||||
#include <time.h>
|
|
||||||
#include <stdarg.h>
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
|
||||||
typedef int pid_t;
|
|
||||||
#define strdup _strdup
|
|
||||||
#define strcasecmp _stricmp
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <winsock2.h>
|
|
||||||
#include <ws2tcpip.h> /* For getaddrinfo. */
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#define getenv _gpgme_wince_getenv
|
|
||||||
char *getenv (const char *name);
|
|
||||||
|
|
||||||
#include <io.h>
|
|
||||||
#define isatty(fd) 0
|
|
||||||
|
|
||||||
|
|
||||||
/* Windows CE is missing some Windows functions that we want. */
|
|
||||||
|
|
||||||
#define GetSystemTimeAsFileTime _gpgme_wince_GetSystemTimeAsFileTime
|
|
||||||
void GetSystemTimeAsFileTime (LPFILETIME ftp);
|
|
||||||
|
|
||||||
#define DeleteFileA _gpgme_wince_DeleteFileA
|
|
||||||
BOOL DeleteFileA(LPCSTR);
|
|
||||||
|
|
||||||
#define CreateFileA _gpgme_wince_CreateFileA
|
|
||||||
HANDLE CreateFileA (LPCSTR, DWORD, DWORD, LPSECURITY_ATTRIBUTES,
|
|
||||||
DWORD, DWORD, HANDLE);
|
|
||||||
|
|
||||||
#define CreateProcessA _gpgme_wince_CreateProcessA
|
|
||||||
BOOL CreateProcessA(LPCSTR,LPSTR,LPSECURITY_ATTRIBUTES,LPSECURITY_ATTRIBUTES,BOOL,DWORD,PVOID,LPCSTR,LPSTARTUPINFOA,LPPROCESS_INFORMATION);
|
|
||||||
|
|
||||||
#define RegOpenKeyExA _gpgme_wince_RegOpenKeyExA
|
|
||||||
LONG RegOpenKeyExA(HKEY,LPCSTR,DWORD,REGSAM,PHKEY);
|
|
||||||
|
|
||||||
#define RegQueryValueExA _gpgme_wince_RegQueryValueExA
|
|
||||||
LONG WINAPI RegQueryValueExA(HKEY,LPCSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD);
|
|
||||||
|
|
||||||
#define GetTempPathA _gpgme_wince_GetTempPathA
|
|
||||||
DWORD GetTempPathA(DWORD,LPSTR);
|
|
||||||
|
|
||||||
#define SHGetSpecialFolderPathA _gpgme_wince_SHGetSpecialFolderPathA
|
|
||||||
BOOL SHGetSpecialFolderPathA(HWND,LPSTR,int,BOOL);
|
|
||||||
|
|
||||||
int _gpgme_wince_access (const char *fname, int mode);
|
|
||||||
#define access(a,b) _gpgme_wince_access ((a), (b))
|
|
||||||
|
|
||||||
void *_gpgme_wince_bsearch (const void *key, const void *base,
|
|
||||||
size_t nmemb, size_t size,
|
|
||||||
int (*compar) (const void *, const void *));
|
|
||||||
#define bsearch(a,b,c,d,e) _gpgme_wince_bsearch ((a),(b),(c),(d),(e))
|
|
||||||
|
|
||||||
#if defined(_MSC_VER)
|
|
||||||
/* Remove the redefined __leave keyword. It is defined by MSC for
|
|
||||||
W32 in excpt.h and not in sehmap.h as for the plain windows
|
|
||||||
version. */
|
|
||||||
# undef leave
|
|
||||||
# define HKEY_PERFORMANCE_DATA ((HKEY)0x80000004)
|
|
||||||
# define HKEY_CURRENT_CONFIG ((HKEY)0x80000005)
|
|
||||||
/* Replace the Mingw32CE provided abort function. */
|
|
||||||
# define abort() do { TerminateProcess (GetCurrentProcess(), 8); } while (0)
|
|
||||||
# define _IOLBF 0x40
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* GPGME_W32_CE_H */
|
|
307
src/w32-io.c
307
src/w32-io.c
@ -37,16 +37,6 @@
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
#include <assuan.h>
|
|
||||||
#include <winioctl.h>
|
|
||||||
#define GPGCEDEV_IOCTL_UNBLOCK \
|
|
||||||
CTL_CODE (FILE_DEVICE_STREAMS, 2050, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
||||||
#define GPGCEDEV_IOCTL_ASSIGN_RVID \
|
|
||||||
CTL_CODE (FILE_DEVICE_STREAMS, 2051, METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "sema.h"
|
#include "sema.h"
|
||||||
#include "priv-io.h"
|
#include "priv-io.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
@ -66,9 +56,6 @@ static struct
|
|||||||
/* If this is not INVALID_SOCKET, then it's a Windows socket. */
|
/* If this is not INVALID_SOCKET, then it's a Windows socket. */
|
||||||
int socket;
|
int socket;
|
||||||
|
|
||||||
/* If this is not 0, then it's a rendezvous ID for the pipe server. */
|
|
||||||
int rvid;
|
|
||||||
|
|
||||||
/* DUP_FROM is -1 if this file descriptor was allocated by pipe or
|
/* DUP_FROM is -1 if this file descriptor was allocated by pipe or
|
||||||
socket functions. Only then should the handle or socket be
|
socket functions. Only then should the handle or socket be
|
||||||
destroyed when this FD is closed. This, together with the fact
|
destroyed when this FD is closed. This, together with the fact
|
||||||
@ -109,7 +96,6 @@ new_fd (void)
|
|||||||
fd_table[idx].used = 1;
|
fd_table[idx].used = 1;
|
||||||
fd_table[idx].handle = INVALID_HANDLE_VALUE;
|
fd_table[idx].handle = INVALID_HANDLE_VALUE;
|
||||||
fd_table[idx].socket = INVALID_SOCKET;
|
fd_table[idx].socket = INVALID_SOCKET;
|
||||||
fd_table[idx].rvid = 0;
|
|
||||||
fd_table[idx].dup_from = -1;
|
fd_table[idx].dup_from = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,7 +118,6 @@ release_fd (int fd)
|
|||||||
fd_table[fd].used = 0;
|
fd_table[fd].used = 0;
|
||||||
fd_table[fd].handle = INVALID_HANDLE_VALUE;
|
fd_table[fd].handle = INVALID_HANDLE_VALUE;
|
||||||
fd_table[fd].socket = INVALID_SOCKET;
|
fd_table[fd].socket = INVALID_SOCKET;
|
||||||
fd_table[fd].rvid = 0;
|
|
||||||
fd_table[fd].dup_from = -1;
|
fd_table[fd].dup_from = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -334,8 +319,6 @@ reader (void *arg)
|
|||||||
ctx->buffer + ctx->writepos, nbytes, &nread, NULL))
|
ctx->buffer + ctx->writepos, nbytes, &nread, NULL))
|
||||||
{
|
{
|
||||||
ctx->error_code = (int) GetLastError ();
|
ctx->error_code = (int) GetLastError ();
|
||||||
/* NOTE (W32CE): Do not ignore ERROR_BUSY! Check at
|
|
||||||
least stop_me if that happens. */
|
|
||||||
if (ctx->error_code == ERROR_BROKEN_PIPE)
|
if (ctx->error_code == ERROR_BROKEN_PIPE)
|
||||||
{
|
{
|
||||||
ctx->eof = 1;
|
ctx->eof = 1;
|
||||||
@ -445,12 +428,7 @@ create_reader (int fd)
|
|||||||
|
|
||||||
INIT_LOCK (ctx->mutex);
|
INIT_LOCK (ctx->mutex);
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
ctx->thread_hd = CreateThread (&sec_attr, 64 * 1024, reader, ctx,
|
|
||||||
STACK_SIZE_PARAM_IS_A_RESERVATION, &tid);
|
|
||||||
#else
|
|
||||||
ctx->thread_hd = CreateThread (&sec_attr, 0, reader, ctx, 0, &tid);
|
ctx->thread_hd = CreateThread (&sec_attr, 0, reader, ctx, 0, &tid);
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!ctx->thread_hd)
|
if (!ctx->thread_hd)
|
||||||
{
|
{
|
||||||
@ -497,22 +475,6 @@ destroy_reader (struct reader_context_s *ctx)
|
|||||||
SetEvent (ctx->have_space_ev);
|
SetEvent (ctx->have_space_ev);
|
||||||
UNLOCK (ctx->mutex);
|
UNLOCK (ctx->mutex);
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
/* Scenario: We never create a full pipe, but already started
|
|
||||||
reading. Then we need to unblock the reader in the pipe driver
|
|
||||||
to make our reader thread notice that we want it to go away. */
|
|
||||||
|
|
||||||
if (ctx->file_hd != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
if (!DeviceIoControl (ctx->file_hd, GPGCEDEV_IOCTL_UNBLOCK,
|
|
||||||
NULL, 0, NULL, 0, NULL, NULL))
|
|
||||||
{
|
|
||||||
TRACE1 (DEBUG_SYSIO, "gpgme:destroy_reader", ctx->file_hd,
|
|
||||||
"unblock control call failed for thread %p", ctx->thread_hd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* The reader thread is usually blocking in recv or ReadFile. If
|
/* The reader thread is usually blocking in recv or ReadFile. If
|
||||||
the peer does not send an EOF or breaks the pipe the WFSO might
|
the peer does not send an EOF or breaks the pipe the WFSO might
|
||||||
get stuck waiting for the termination of the reader thread. This
|
get stuck waiting for the termination of the reader thread. This
|
||||||
@ -817,13 +779,7 @@ create_writer (int fd)
|
|||||||
|
|
||||||
INIT_LOCK (ctx->mutex);
|
INIT_LOCK (ctx->mutex);
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
ctx->thread_hd = CreateThread (&sec_attr, 64 * 1024, writer, ctx,
|
|
||||||
STACK_SIZE_PARAM_IS_A_RESERVATION, &tid);
|
|
||||||
#else
|
|
||||||
ctx->thread_hd = CreateThread (&sec_attr, 0, writer, ctx, 0, &tid );
|
ctx->thread_hd = CreateThread (&sec_attr, 0, writer, ctx, 0, &tid );
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!ctx->thread_hd)
|
if (!ctx->thread_hd)
|
||||||
{
|
{
|
||||||
TRACE_LOG1 ("CreateThread failed: ec=%d", (int) GetLastError ());
|
TRACE_LOG1 ("CreateThread failed: ec=%d", (int) GetLastError ());
|
||||||
@ -869,20 +825,6 @@ destroy_writer (struct writer_context_s *ctx)
|
|||||||
/* Give the writer a chance to flush the buffer. */
|
/* Give the writer a chance to flush the buffer. */
|
||||||
WaitForSingleObject (ctx->is_empty, INFINITE);
|
WaitForSingleObject (ctx->is_empty, INFINITE);
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
/* Scenario: We never create a full pipe, but already started
|
|
||||||
writing more than the pipe buffer. Then we need to unblock the
|
|
||||||
writer in the pipe driver to make our writer thread notice that
|
|
||||||
we want it to go away. */
|
|
||||||
|
|
||||||
if (!DeviceIoControl (ctx->file_hd, GPGCEDEV_IOCTL_UNBLOCK,
|
|
||||||
NULL, 0, NULL, 0, NULL, NULL))
|
|
||||||
{
|
|
||||||
TRACE1 (DEBUG_SYSIO, "gpgme:destroy_writer", ctx->file_hd,
|
|
||||||
"unblock control call failed for thread %p", ctx->thread_hd);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* After setting this event CTX is void. */
|
/* After setting this event CTX is void. */
|
||||||
SetEvent (ctx->close_ev);
|
SetEvent (ctx->close_ev);
|
||||||
}
|
}
|
||||||
@ -1008,14 +950,9 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
|
|||||||
{
|
{
|
||||||
int rfd;
|
int rfd;
|
||||||
int wfd;
|
int wfd;
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
HANDLE hd;
|
|
||||||
int rvid;
|
|
||||||
#else
|
|
||||||
HANDLE rh;
|
HANDLE rh;
|
||||||
HANDLE wh;
|
HANDLE wh;
|
||||||
SECURITY_ATTRIBUTES sec_attr;
|
SECURITY_ATTRIBUTES sec_attr;
|
||||||
#endif
|
|
||||||
|
|
||||||
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_pipe", filedes,
|
TRACE_BEG2 (DEBUG_SYSIO, "_gpgme_io_pipe", filedes,
|
||||||
"inherit_idx=%i (GPGME uses it for %s)",
|
"inherit_idx=%i (GPGME uses it for %s)",
|
||||||
@ -1031,32 +968,6 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
|
|||||||
return TRACE_SYSRES (-1);
|
return TRACE_SYSRES (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
hd = _assuan_w32ce_prepare_pipe (&rvid, !inherit_idx);
|
|
||||||
if (hd == INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
TRACE_LOG1 ("_assuan_w32ce_prepare_pipe failed: ec=%d",
|
|
||||||
(int) GetLastError ());
|
|
||||||
release_fd (rfd);
|
|
||||||
release_fd (wfd);
|
|
||||||
/* FIXME: Should translate the error code. */
|
|
||||||
gpg_err_set_errno (EIO);
|
|
||||||
return TRACE_SYSRES (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inherit_idx == 0)
|
|
||||||
{
|
|
||||||
fd_table[rfd].rvid = rvid;
|
|
||||||
fd_table[wfd].handle = hd;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fd_table[rfd].handle = hd;
|
|
||||||
fd_table[wfd].rvid = rvid;
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
memset (&sec_attr, 0, sizeof (sec_attr));
|
memset (&sec_attr, 0, sizeof (sec_attr));
|
||||||
sec_attr.nLength = sizeof (sec_attr);
|
sec_attr.nLength = sizeof (sec_attr);
|
||||||
sec_attr.bInheritHandle = FALSE;
|
sec_attr.bInheritHandle = FALSE;
|
||||||
@ -1114,13 +1025,11 @@ _gpgme_io_pipe (int filedes[2], int inherit_idx)
|
|||||||
}
|
}
|
||||||
fd_table[rfd].handle = rh;
|
fd_table[rfd].handle = rh;
|
||||||
fd_table[wfd].handle = wh;
|
fd_table[wfd].handle = wh;
|
||||||
#endif
|
|
||||||
|
|
||||||
filedes[0] = rfd;
|
filedes[0] = rfd;
|
||||||
filedes[1] = wfd;
|
filedes[1] = wfd;
|
||||||
return TRACE_SUC6 ("read=0x%x (%p/0x%x), write=0x%x (%p/0x%x)",
|
return TRACE_SUC4 ("read=0x%x (%p), write=0x%x (%p)",
|
||||||
rfd, fd_table[rfd].handle, fd_table[rfd].rvid,
|
rfd, fd_table[rfd].handle, wfd, fd_table[wfd].handle);
|
||||||
wfd, fd_table[wfd].handle, fd_table[wfd].rvid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1213,7 +1122,6 @@ _gpgme_io_close (int fd)
|
|||||||
return TRACE_SYSRES (-1);
|
return TRACE_SYSRES (-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* Nothing to do for RVIDs. */
|
|
||||||
}
|
}
|
||||||
|
|
||||||
release_fd (fd);
|
release_fd (fd);
|
||||||
@ -1263,91 +1171,6 @@ _gpgme_io_set_nonblocking (int fd)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
static char *
|
|
||||||
build_commandline (char **argv, int fd0, int fd0_isnull,
|
|
||||||
int fd1, int fd1_isnull,
|
|
||||||
int fd2, int fd2_isnull)
|
|
||||||
{
|
|
||||||
int i, n;
|
|
||||||
const char *s;
|
|
||||||
char *buf, *p;
|
|
||||||
char fdbuf[3*30];
|
|
||||||
|
|
||||||
p = fdbuf;
|
|
||||||
*p = 0;
|
|
||||||
|
|
||||||
if (fd0 != -1)
|
|
||||||
{
|
|
||||||
if (fd0_isnull)
|
|
||||||
strcpy (p, "-&S0=null ");
|
|
||||||
else
|
|
||||||
snprintf (p, 25, "-&S0=%d ", fd_table[fd0].rvid);
|
|
||||||
p += strlen (p);
|
|
||||||
}
|
|
||||||
if (fd1 != -1)
|
|
||||||
{
|
|
||||||
if (fd1_isnull)
|
|
||||||
strcpy (p, "-&S1=null ");
|
|
||||||
else
|
|
||||||
snprintf (p, 25, "-&S1=%d ", fd_table[fd1].rvid);
|
|
||||||
p += strlen (p);
|
|
||||||
}
|
|
||||||
if (fd2 != -1)
|
|
||||||
{
|
|
||||||
if (fd2_isnull)
|
|
||||||
strcpy (p, "-&S2=null ");
|
|
||||||
else
|
|
||||||
snprintf (p, 25, "-&S2=%d ", fd_table[fd2].rvid);
|
|
||||||
p += strlen (p);
|
|
||||||
}
|
|
||||||
strcpy (p, "-&S2=null ");
|
|
||||||
p += strlen (p);
|
|
||||||
|
|
||||||
n = strlen (fdbuf);
|
|
||||||
for (i=0; (s = argv[i]); i++)
|
|
||||||
{
|
|
||||||
if (!i)
|
|
||||||
continue; /* Ignore argv[0]. */
|
|
||||||
n += strlen (s) + 1 + 2; /* (1 space, 2 quoting) */
|
|
||||||
for (; *s; s++)
|
|
||||||
if (*s == '\"')
|
|
||||||
n++; /* Need to double inner quotes. */
|
|
||||||
}
|
|
||||||
n++;
|
|
||||||
buf = p = malloc (n);
|
|
||||||
if (! buf)
|
|
||||||
return NULL;
|
|
||||||
|
|
||||||
p = stpcpy (p, fdbuf);
|
|
||||||
for (i = 0; argv[i]; i++)
|
|
||||||
{
|
|
||||||
if (!i)
|
|
||||||
continue; /* Ignore argv[0]. */
|
|
||||||
if (i > 1)
|
|
||||||
p = stpcpy (p, " ");
|
|
||||||
|
|
||||||
if (! *argv[i]) /* Empty string. */
|
|
||||||
p = stpcpy (p, "\"\"");
|
|
||||||
else if (strpbrk (argv[i], " \t\n\v\f\""))
|
|
||||||
{
|
|
||||||
p = stpcpy (p, "\"");
|
|
||||||
for (s = argv[i]; *s; s++)
|
|
||||||
{
|
|
||||||
*p++ = *s;
|
|
||||||
if (*s == '\"')
|
|
||||||
*p++ = *s;
|
|
||||||
}
|
|
||||||
*p++ = '\"';
|
|
||||||
*p = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
p = stpcpy (p, argv[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return buf;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
static char *
|
static char *
|
||||||
build_commandline (char **argv)
|
build_commandline (char **argv)
|
||||||
{
|
{
|
||||||
@ -1401,7 +1224,6 @@ build_commandline (char **argv)
|
|||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -1419,120 +1241,6 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
|
|||||||
};
|
};
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
int fd_in = -1;
|
|
||||||
int fd_out = -1;
|
|
||||||
int fd_err = -1;
|
|
||||||
int fd_in_isnull = 1;
|
|
||||||
int fd_out_isnull = 1;
|
|
||||||
int fd_err_isnull = 1;
|
|
||||||
char *cmdline;
|
|
||||||
HANDLE hd = INVALID_HANDLE_VALUE;
|
|
||||||
|
|
||||||
TRACE_BEG1 (DEBUG_SYSIO, "_gpgme_io_spawn", path,
|
|
||||||
"path=%s", path);
|
|
||||||
i = 0;
|
|
||||||
while (argv[i])
|
|
||||||
{
|
|
||||||
TRACE_LOG2 ("argv[%2i] = %s", i, argv[i]);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; fd_list[i].fd != -1; i++)
|
|
||||||
{
|
|
||||||
int fd = fd_list[i].fd;
|
|
||||||
|
|
||||||
TRACE_LOG3 ("fd_list[%2i] = fd %i, dup_to %i", i, fd, fd_list[i].dup_to);
|
|
||||||
if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used)
|
|
||||||
{
|
|
||||||
TRACE_LOG1 ("invalid fd 0x%x", fd);
|
|
||||||
gpg_err_set_errno (EBADF);
|
|
||||||
return TRACE_SYSRES (-1);
|
|
||||||
}
|
|
||||||
if (fd_table[fd].rvid == 0)
|
|
||||||
{
|
|
||||||
TRACE_LOG1 ("fd 0x%x not inheritable (not an RVID)", fd);
|
|
||||||
gpg_err_set_errno (EBADF);
|
|
||||||
return TRACE_SYSRES (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (fd_list[i].dup_to == 0)
|
|
||||||
{
|
|
||||||
fd_in = fd_list[i].fd;
|
|
||||||
fd_in_isnull = 0;
|
|
||||||
}
|
|
||||||
else if (fd_list[i].dup_to == 1)
|
|
||||||
{
|
|
||||||
fd_out = fd_list[i].fd;
|
|
||||||
fd_out_isnull = 0;
|
|
||||||
}
|
|
||||||
else if (fd_list[i].dup_to == 2)
|
|
||||||
{
|
|
||||||
fd_err = fd_list[i].fd;
|
|
||||||
fd_err_isnull = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
cmdline = build_commandline (argv, fd_in, fd_in_isnull,
|
|
||||||
fd_out, fd_out_isnull, fd_err, fd_err_isnull);
|
|
||||||
if (!cmdline)
|
|
||||||
{
|
|
||||||
TRACE_LOG1 ("build_commandline failed: %s", strerror (errno));
|
|
||||||
return TRACE_SYSRES (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!CreateProcessA (path, /* Program to start. */
|
|
||||||
cmdline, /* Command line arguments. */
|
|
||||||
NULL, /* (not supported) */
|
|
||||||
NULL, /* (not supported) */
|
|
||||||
FALSE, /* (not supported) */
|
|
||||||
(CREATE_SUSPENDED), /* Creation flags. */
|
|
||||||
NULL, /* (not supported) */
|
|
||||||
NULL, /* (not supported) */
|
|
||||||
NULL, /* (not supported) */
|
|
||||||
&pi /* Returns process information.*/
|
|
||||||
))
|
|
||||||
{
|
|
||||||
TRACE_LOG1 ("CreateProcess failed: ec=%d", (int) GetLastError ());
|
|
||||||
free (cmdline);
|
|
||||||
gpg_err_set_errno (EIO);
|
|
||||||
return TRACE_SYSRES (-1);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Create arbitrary pipe descriptor to send in ASSIGN_RVID
|
|
||||||
commands. Errors are ignored. We don't need read or write access,
|
|
||||||
as ASSIGN_RVID works without any permissions, yay! */
|
|
||||||
hd = CreateFile (L"GPG1:", 0, 0,
|
|
||||||
NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
|
|
||||||
if (hd == INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
TRACE_LOG1 ("CreateFile failed (ignored): ec=%d",
|
|
||||||
(int) GetLastError ());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Insert the inherited handles. */
|
|
||||||
for (i = 0; fd_list[i].fd != -1; i++)
|
|
||||||
{
|
|
||||||
/* Return the child name of this handle. */
|
|
||||||
fd_list[i].peer_name = fd_table[fd_list[i].fd].rvid;
|
|
||||||
|
|
||||||
if (hd != INVALID_HANDLE_VALUE)
|
|
||||||
{
|
|
||||||
DWORD data[2];
|
|
||||||
data[0] = (DWORD) fd_table[fd_list[i].fd].rvid;
|
|
||||||
data[1] = pi.dwProcessId;
|
|
||||||
if (!DeviceIoControl (hd, GPGCEDEV_IOCTL_ASSIGN_RVID,
|
|
||||||
data, sizeof (data), NULL, 0, NULL, NULL))
|
|
||||||
{
|
|
||||||
TRACE_LOG3 ("ASSIGN_RVID(%i, %i) failed (ignored): %i",
|
|
||||||
data[0], data[1], (int) GetLastError ());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (hd != INVALID_HANDLE_VALUE)
|
|
||||||
CloseHandle (hd);
|
|
||||||
|
|
||||||
#else
|
|
||||||
SECURITY_ATTRIBUTES sec_attr;
|
SECURITY_ATTRIBUTES sec_attr;
|
||||||
STARTUPINFOA si;
|
STARTUPINFOA si;
|
||||||
int cr_flags = CREATE_DEFAULT_ERROR_MODE;
|
int cr_flags = CREATE_DEFAULT_ERROR_MODE;
|
||||||
@ -1729,7 +1437,6 @@ _gpgme_io_spawn (const char *path, char *const argv[], unsigned int flags,
|
|||||||
close (tmp_fd);
|
close (tmp_fd);
|
||||||
/* The temporary file is deleted by the gpgme-w32spawn process
|
/* The temporary file is deleted by the gpgme-w32spawn process
|
||||||
(hopefully). */
|
(hopefully). */
|
||||||
#endif
|
|
||||||
|
|
||||||
free (tmp_name);
|
free (tmp_name);
|
||||||
free (arg_string);
|
free (arg_string);
|
||||||
@ -1954,15 +1661,6 @@ _gpgme_io_subsystem_init (void)
|
|||||||
int
|
int
|
||||||
_gpgme_io_fd2str (char *buf, int buflen, int fd)
|
_gpgme_io_fd2str (char *buf, int buflen, int fd)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
/* FIXME: For now. See above. */
|
|
||||||
if (fd < 0 || fd >= MAX_SLAFD || !fd_table[fd].used
|
|
||||||
|| fd_table[fd].rvid == 0)
|
|
||||||
fd = -1;
|
|
||||||
else
|
|
||||||
fd = fd_table[fd].rvid;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
return snprintf (buf, buflen, "%d", fd);
|
return snprintf (buf, buflen, "%d", fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1989,7 +1687,6 @@ _gpgme_io_dup (int fd)
|
|||||||
|
|
||||||
fd_table[newfd].handle = fd_table[fd].handle;
|
fd_table[newfd].handle = fd_table[fd].handle;
|
||||||
fd_table[newfd].socket = fd_table[fd].socket;
|
fd_table[newfd].socket = fd_table[fd].socket;
|
||||||
fd_table[newfd].rvid = fd_table[fd].rvid;
|
|
||||||
fd_table[newfd].dup_from = fd;
|
fd_table[newfd].dup_from = fd;
|
||||||
|
|
||||||
rd_ctx = find_reader (fd, 1);
|
rd_ctx = find_reader (fd, 1);
|
||||||
|
@ -65,9 +65,7 @@
|
|||||||
#include "sys-util.h"
|
#include "sys-util.h"
|
||||||
|
|
||||||
|
|
||||||
#ifndef HAVE_W32CE_SYSTEM
|
|
||||||
#define HAVE_ALLOW_SET_FOREGROUND_WINDOW 1
|
#define HAVE_ALLOW_SET_FOREGROUND_WINDOW 1
|
||||||
#endif
|
|
||||||
#ifndef F_OK
|
#ifndef F_OK
|
||||||
# define F_OK 0
|
# define F_OK 0
|
||||||
#endif
|
#endif
|
||||||
@ -303,53 +301,6 @@ read_w32_registry_string (const char *root, const char *dir, const char *name)
|
|||||||
}
|
}
|
||||||
result[nbytes] = 0; /* Make sure it is really a string. */
|
result[nbytes] = 0; /* Make sure it is really a string. */
|
||||||
|
|
||||||
#ifndef HAVE_W32CE_SYSTEM
|
|
||||||
/* Windows CE does not have an environment. */
|
|
||||||
if (type == REG_EXPAND_SZ && strchr (result, '%'))
|
|
||||||
{
|
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
n1 += 1000;
|
|
||||||
tmp = malloc (n1 + 1);
|
|
||||||
if (!tmp)
|
|
||||||
goto leave;
|
|
||||||
nbytes = ExpandEnvironmentStrings (result, tmp, n1);
|
|
||||||
if (nbytes && nbytes > n1)
|
|
||||||
{
|
|
||||||
free (tmp);
|
|
||||||
n1 = nbytes;
|
|
||||||
tmp = malloc (n1 + 1);
|
|
||||||
if (!tmp)
|
|
||||||
goto leave;
|
|
||||||
nbytes = ExpandEnvironmentStrings (result, tmp, n1);
|
|
||||||
if (nbytes && nbytes > n1) {
|
|
||||||
free (tmp); /* Oops - truncated, better don't expand at all. */
|
|
||||||
goto leave;
|
|
||||||
}
|
|
||||||
tmp[nbytes] = 0;
|
|
||||||
free (result);
|
|
||||||
result = tmp;
|
|
||||||
}
|
|
||||||
else if (nbytes) /* Okay, reduce the length. */
|
|
||||||
{
|
|
||||||
tmp[nbytes] = 0;
|
|
||||||
free (result);
|
|
||||||
result = malloc (strlen (tmp)+1);
|
|
||||||
if (!result)
|
|
||||||
result = tmp;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
strcpy (result, tmp);
|
|
||||||
free (tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else /* Error - don't expand. */
|
|
||||||
{
|
|
||||||
free (tmp);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
leave:
|
leave:
|
||||||
RegCloseKey (key_handle);
|
RegCloseKey (key_handle);
|
||||||
return result;
|
return result;
|
||||||
@ -652,15 +603,8 @@ _gpgme_get_conf_int (const char *key, int *value)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
int
|
|
||||||
_gpgme_mkstemp (int *fd, char **name)
|
|
||||||
{
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
|
|
||||||
|
|
||||||
/* mkstemp extracted from libc/sysdeps/posix/tempname.c. Copyright
|
/* mkstemp extracted from libc/sysdeps/posix/tempname.c. Copyright
|
||||||
(C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc.
|
(C) 1991-1999, 2000, 2001, 2006 Free Software Foundation, Inc.
|
||||||
|
|
||||||
@ -794,30 +738,9 @@ _gpgme_mkstemp (int *fd, char **name)
|
|||||||
*name = tmpname;
|
*name = tmpname;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_W32CE_SYSTEM
|
|
||||||
/* Return a malloced string with the replacement value for the
|
|
||||||
GPGME_DEBUG envvar. Caller must release. Returns NULL if not
|
|
||||||
set. */
|
|
||||||
char *
|
|
||||||
_gpgme_w32ce_get_debug_envvar (void)
|
|
||||||
{
|
|
||||||
char *tmp;
|
|
||||||
|
|
||||||
tmp = read_w32_registry_string (NULL, "\\Software\\GNU\\gpgme", "debug");
|
|
||||||
if (tmp && !*tmp)
|
|
||||||
{
|
|
||||||
free (tmp);
|
|
||||||
tmp = NULL;
|
|
||||||
}
|
|
||||||
return tmp;
|
|
||||||
}
|
|
||||||
#endif /*HAVE_W32CE_SYSTEM*/
|
|
||||||
|
|
||||||
|
|
||||||
/* Entry point called by the DLL loader. */
|
/* Entry point called by the DLL loader. */
|
||||||
#ifdef DLL_EXPORT
|
#ifdef DLL_EXPORT
|
||||||
int WINAPI
|
int WINAPI
|
||||||
|
Loading…
Reference in New Issue
Block a user