From 5c76704239759f3335d9ef0fc6ad2e0f5ca4b76e Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Sat, 20 Oct 2007 06:34:28 +0200 Subject: [PATCH] push 9ed7f32abbb93ea3a813fd6b1650e5bcfc506606 --- .gitignore | 5 + Makefile.in | 2 + configure | 241 +++++++++++++++++++++++++++- configure.ac | 14 ++ dlls/Makefile.in | 5 + dlls/comctl32/comctl_El.rc | 87 +++++++++++ dlls/comctl32/rsrc.rc | 1 + dlls/crypt32/cert.c | 5 +- dlls/crypt32/chain.c | 8 +- dlls/crypt32/crl.c | 5 +- dlls/crypt32/crypt32.spec | 4 +- dlls/crypt32/crypt32_private.h | 4 +- dlls/crypt32/filestore.c | 35 ++--- dlls/crypt32/main.c | 13 ++ dlls/crypt32/msg.c | 70 +++++---- dlls/crypt32/oid.c | 186 +++++++++++++++++++--- dlls/crypt32/regstore.c | 30 ++-- dlls/crypt32/rootstore.c | 5 + dlls/crypt32/store.c | 34 +++- dlls/crypt32/tests/msg.c | 2 + dlls/crypt32/tests/oid.c | 42 +++++ dlls/crypt32/tests/store.c | 100 ++++++++++++ dlls/cryptnet/Makefile.in | 3 +- dlls/cryptnet/cryptnet.spec | 4 +- dlls/cryptnet/cryptnet_main.c | 247 ++++++++++++++++++++++++++++- dlls/cryptnet/{ => tests}/Makefile.in | 12 +- dlls/cryptnet/tests/cryptnet.c | 239 ++++++++++++++++++++++++++++ dlls/gdi32/Makefile.in | 2 +- dlls/kernel32/file.c | 6 +- dlls/kernel32/locale.c | 32 +++- dlls/kernel32/tests/actctx.c | 156 ++++++++++++++++--- dlls/kernel32/tests/file.c | 38 +++++ dlls/mpr/wnet.c | 2 +- dlls/mshtml/install.c | 21 +-- dlls/mshtml/mshtml_private.h | 1 + dlls/mshtml/selection.c | 30 +++- dlls/mshtml/tests/dom.c | 34 ++++ dlls/mshtml/view.c | 1 - dlls/msi/action.c | 32 ++-- dlls/msi/streams.c | 32 +++- dlls/msi/string.c | 17 +- dlls/msi/table.c | 4 +- dlls/msi/tests/db.c | 286 ++++++++++++++++++++++++++++++++-- dlls/msi/tests/install.c | 8 +- dlls/ntdll/actctx.c | 31 +++- dlls/ntdll/directory.c | 54 +++++++ dlls/ntdll/ntdll_misc.h | 9 ++ dlls/ntdll/path.c | 52 +------ dlls/ole32/tests/ole2.c | 2 +- dlls/riched20/editor.c | 4 +- dlls/riched20/tests/editor.c | 51 ++++++ dlls/rpcrt4/tests/server.c | 54 +++++++ dlls/rpcrt4/tests/server.idl | 16 ++ dlls/rsaenh/tests/rsaenh.c | 2 +- dlls/shell32/shell32_main.c | 2 +- dlls/shell32/shellole.c | 52 +++---- dlls/shell32/shfldr_unixfs.c | 59 ++----- dlls/shell32/tests/systray.c | 2 +- dlls/spoolss/spoolss.spec | 2 +- dlls/spoolss/spoolss_main.c | 14 +- dlls/user32/edit.c | 37 ++--- dlls/user32/listbox.c | 81 +++++++--- dlls/user32/tests/edit.c | 33 +++- dlls/user32/tests/msg.c | 91 +++++++++-- dlls/winealsa.drv/waveinit.c | 7 +- dlls/wined3d/device.c | 16 +- dlls/winex11.drv/dib.c | 102 +++++++----- dlls/winex11.drv/winpos.c | 2 + dlls/wininet/http.c | 3 + dlls/ws2_32/protocol.c | 12 +- include/dimm.idl | 2 + include/hlink.idl | 4 + include/imm.h | 2 +- include/mshtml.idl | 3 +- include/ndrtypes.h | 2 + include/wincrypt.h | 2 + programs/oleview/pane.c | 6 +- programs/winetest/Makefile.in | 3 + programs/winetest/winetest.rc | 1 + server/window.c | 132 +++++++++++----- tools/fnt2fon.c | 19 +-- tools/widl/header.c | 6 +- tools/widl/parser.l | 10 +- tools/widl/parser.y | 42 +++-- tools/widl/proxy.c | 2 +- tools/widl/typegen.c | 22 ++- tools/widl/utils.c | 41 +++-- tools/widl/utils.h | 2 +- tools/widl/widl.c | 218 +++++++++++++++++++++++--- tools/widl/widl.h | 3 + tools/wine.inf | 1 + tools/winegcc/utils.c | 11 +- tools/winegcc/winegcc.c | 14 +- tools/wmc/mcl.c | 30 ++-- tools/wmc/mcy.y | 56 +++---- tools/wmc/utils.c | 4 - tools/wmc/write.c | 12 +- tools/wrc/genres.c | 26 ++-- tools/wrc/newstruc.c | 36 ++--- tools/wrc/parser.l | 42 ++--- tools/wrc/parser.y | 122 +++++++-------- tools/wrc/readres.c | 20 +-- tools/wrc/utils.c | 11 +- tools/wrc/wrc.c | 6 +- tools/wrc/writeres.c | 6 +- 105 files changed, 3032 insertions(+), 782 deletions(-) create mode 100644 dlls/comctl32/comctl_El.rc copy dlls/cryptnet/{ => tests}/Makefile.in (53%) create mode 100644 dlls/cryptnet/tests/cryptnet.c diff --git a/.gitignore b/.gitignore index 95e66f5c050..1bde3846142 100644 --- a/.gitignore +++ b/.gitignore @@ -72,6 +72,10 @@ dlls/crypt32/tests/*.ok dlls/crypt32/tests/crypt32_crosstest.exe dlls/crypt32/tests/testlist.c dlls/cryptdll/libcryptdll.def +dlls/cryptnet/libcryptnet.def +dlls/cryptnet/tests/*.ok +dlls/cryptnet/tests/cryptnet_crosstest.exe +dlls/cryptnet/tests/testlist.c dlls/ctl3d.dll16 dlls/ctl3d32/libctl3d32.def dlls/ctl3dv2.dll16 @@ -688,6 +692,7 @@ programs/winetest/comcat_test.exe programs/winetest/comctl32_test.exe programs/winetest/comdlg32_test.exe programs/winetest/crypt32_test.exe +programs/winetest/cryptnet_test.exe programs/winetest/d3d8_test.exe programs/winetest/d3d9_test.exe programs/winetest/d3drm_test.exe diff --git a/Makefile.in b/Makefile.in index 46f330c44ca..31bfb087a4c 100644 --- a/Makefile.in +++ b/Makefile.in @@ -188,6 +188,7 @@ ALL_MAKEFILES = \ dlls/crypt32/tests/Makefile \ dlls/cryptdll/Makefile \ dlls/cryptnet/Makefile \ + dlls/cryptnet/tests/Makefile \ dlls/ctl3d32/Makefile \ dlls/d3d10/Makefile \ dlls/d3d8/Makefile \ @@ -561,6 +562,7 @@ dlls/crypt32/Makefile: dlls/crypt32/Makefile.in dlls/Makedll.rules dlls/crypt32/tests/Makefile: dlls/crypt32/tests/Makefile.in dlls/Maketest.rules dlls/cryptdll/Makefile: dlls/cryptdll/Makefile.in dlls/Makedll.rules dlls/cryptnet/Makefile: dlls/cryptnet/Makefile.in dlls/Makedll.rules +dlls/cryptnet/tests/Makefile: dlls/cryptnet/tests/Makefile.in dlls/Maketest.rules dlls/ctl3d32/Makefile: dlls/ctl3d32/Makefile.in dlls/Makedll.rules dlls/d3d10/Makefile: dlls/d3d10/Makefile.in dlls/Makedll.rules dlls/d3d8/Makefile: dlls/d3d8/Makefile.in dlls/Makedll.rules diff --git a/configure b/configure index 3eaa42f4847..414fd53a189 100755 --- a/configure +++ b/configure @@ -757,6 +757,7 @@ ESDLIBS ESDINCL ALSALIBS AUDIOIOLIBS +FONTCONFIGINCL EXTRACFLAGS BUILTINFLAG LDPATH @@ -14599,6 +14600,240 @@ _ACEOF fi +elif test -n "$X_CFLAGS" +then + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + $as_unset ac_cv_header_fontconfig_fontconfig_h + +for ac_header in fontconfig/fontconfig.h +do +as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + { echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } +else + # Is the header compilable? +{ echo "$as_me:$LINENO: checking $ac_header usability" >&5 +echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +$ac_includes_default +#include <$ac_header> +_ACEOF +rm -f conftest.$ac_objext +if { (ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_compile") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then + ac_header_compiler=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_compiler=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5 +echo "${ECHO_T}$ac_header_compiler" >&6; } + +# Is the header present? +{ echo "$as_me:$LINENO: checking $ac_header presence" >&5 +echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; } +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#include <$ac_header> +_ACEOF +if { (ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then + ac_header_preproc=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_header_preproc=no +fi + +rm -f conftest.err conftest.$ac_ext +{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5 +echo "${ECHO_T}$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in + yes:no: ) + { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5 +echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;} + ac_header_preproc=yes + ;; + no:yes:* ) + { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5 +echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5 +echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5 +echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5 +echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5 +echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;} + { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5 +echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;} + ( cat <<\_ASBOX +## ------------------------------------ ## +## Report this to wine-devel@winehq.org ## +## ------------------------------------ ## +_ASBOX + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac +{ echo "$as_me:$LINENO: checking for $ac_header" >&5 +echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; } +if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + eval "$as_ac_Header=\$ac_header_preproc" +fi +ac_res=`eval echo '${'$as_ac_Header'}'` + { echo "$as_me:$LINENO: result: $ac_res" >&5 +echo "${ECHO_T}$ac_res" >&6; } + +fi +if test `eval echo '${'$as_ac_Header'}'` = yes; then + cat >>confdefs.h <<_ACEOF +#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + CPPFLAGS="$ac_save_CPPFLAGS" + if test "$ac_cv_header_fontconfig_fontconfig_h" = "yes" + then + FONTCONFIGINCL="$X_CFLAGS" + + { echo "$as_me:$LINENO: checking for -lfontconfig" >&5 +echo $ECHO_N "checking for -lfontconfig... $ECHO_C" >&6; } +if test "${ac_cv_lib_soname_fontconfig+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_soname_save_LIBS=$LIBS +LIBS="-lfontconfig $X_LIBS $LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char FcInit (); +int +main () +{ +return FcInit (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 + (eval "$ac_link") 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && + $as_test_x conftest$ac_exeext; then + case "$LIBEXT" in + dll) ;; + dylib) ac_cv_lib_soname_fontconfig=`otool -L conftest$ac_exeext | grep "libfontconfig\\.[0-9A-Za-z.]*dylib" | sed -e "s/^.*\/\(libfontconfig\.[0-9A-Za-z.]*dylib\).*$/\1/"';2,$d'` ;; + *) ac_cv_lib_soname_fontconfig=`$ac_cv_path_LDD conftest$ac_exeext | grep "libfontconfig\\.$LIBEXT" | sed -e "s/^.*\(libfontconfig\.$LIBEXT[^ ]*\).*$/\1/"';2,$d'` ;; + esac +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_check_soname_save_LIBS +fi +if test "x$ac_cv_lib_soname_fontconfig" = "x"; then + { echo "$as_me:$LINENO: result: not found" >&5 +echo "${ECHO_T}not found" >&6; } + +else + { echo "$as_me:$LINENO: result: $ac_cv_lib_soname_fontconfig" >&5 +echo "${ECHO_T}$ac_cv_lib_soname_fontconfig" >&6; } + +cat >>confdefs.h <<_ACEOF +#define SONAME_LIBFONTCONFIG "$ac_cv_lib_soname_fontconfig" +_ACEOF + + +fi + + fi fi if test "x$ac_cv_lib_soname_fontconfig" = "x"; then wine_notices="$wine_notices|fontconfig development files not found. @@ -20357,6 +20592,8 @@ ac_config_files="$ac_config_files dlls/cryptdll/Makefile" ac_config_files="$ac_config_files dlls/cryptnet/Makefile" +ac_config_files="$ac_config_files dlls/cryptnet/tests/Makefile" + ac_config_files="$ac_config_files dlls/ctl3d32/Makefile" ac_config_files="$ac_config_files dlls/d3d10/Makefile" @@ -21609,6 +21846,7 @@ do "dlls/crypt32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/crypt32/tests/Makefile" ;; "dlls/cryptdll/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/cryptdll/Makefile" ;; "dlls/cryptnet/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/cryptnet/Makefile" ;; + "dlls/cryptnet/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/cryptnet/tests/Makefile" ;; "dlls/ctl3d32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ctl3d32/Makefile" ;; "dlls/d3d10/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3d10/Makefile" ;; "dlls/d3d8/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/d3d8/Makefile" ;; @@ -22203,6 +22441,7 @@ ESDLIBS!$ESDLIBS$ac_delim ESDINCL!$ESDINCL$ac_delim ALSALIBS!$ALSALIBS$ac_delim AUDIOIOLIBS!$AUDIOIOLIBS$ac_delim +FONTCONFIGINCL!$FONTCONFIGINCL$ac_delim EXTRACFLAGS!$EXTRACFLAGS$ac_delim BUILTINFLAG!$BUILTINFLAG$ac_delim LDPATH!$LDPATH$ac_delim @@ -22217,7 +22456,7 @@ LIBOBJS!$LIBOBJS$ac_delim LTLIBOBJS!$LTLIBOBJS$ac_delim _ACEOF - if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 72; then + if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 73; then break elif $ac_last_try; then { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5 diff --git a/configure.ac b/configure.ac index 4396f43a872..7f34a7741e1 100644 --- a/configure.ac +++ b/configure.ac @@ -1058,6 +1058,19 @@ dnl **** Check for fontconfig **** if test "$ac_cv_header_fontconfig_fontconfig_h" = "yes" then WINE_CHECK_SONAME(fontconfig,FcInit) +elif test -n "$X_CFLAGS" +then + dnl fontconfig is in the X directory on Mac OS X + ac_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $X_CFLAGS" + $as_unset ac_cv_header_fontconfig_fontconfig_h + AC_CHECK_HEADERS([fontconfig/fontconfig.h]) + CPPFLAGS="$ac_save_CPPFLAGS" + if test "$ac_cv_header_fontconfig_fontconfig_h" = "yes" + then + AC_SUBST(FONTCONFIGINCL,"$X_CFLAGS") + WINE_CHECK_SONAME(fontconfig,FcInit,,,[$X_LIBS]) + fi fi WINE_NOTICE_IF([test "x$ac_cv_lib_soname_fontconfig" = "x"],[fontconfig development files not found. Wine will be built without fontconfig support.]) @@ -1599,6 +1612,7 @@ AC_CONFIG_FILES([dlls/crypt32/Makefile]) AC_CONFIG_FILES([dlls/crypt32/tests/Makefile]) AC_CONFIG_FILES([dlls/cryptdll/Makefile]) AC_CONFIG_FILES([dlls/cryptnet/Makefile]) +AC_CONFIG_FILES([dlls/cryptnet/tests/Makefile]) AC_CONFIG_FILES([dlls/ctl3d32/Makefile]) AC_CONFIG_FILES([dlls/d3d10/Makefile]) AC_CONFIG_FILES([dlls/d3d8/Makefile]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index b7c03bfe9e0..5be98ecf491 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -252,6 +252,7 @@ TESTSUBDIRS = \ comctl32/tests \ comdlg32/tests \ crypt32/tests \ + cryptnet/tests \ d3d8/tests \ d3d9/tests \ d3drm/tests \ @@ -501,6 +502,7 @@ IMPORT_LIBS = \ crtdll/libcrtdll.$(IMPLIBEXT) \ crypt32/libcrypt32.$(IMPLIBEXT) \ cryptdll/libcryptdll.$(IMPLIBEXT) \ + cryptnet/libcryptnet.$(IMPLIBEXT) \ ctl3d32/libctl3d32.$(IMPLIBEXT) \ d3d8/libd3d8.$(IMPLIBEXT) \ d3d9/libd3d9.$(IMPLIBEXT) \ @@ -666,6 +668,9 @@ crypt32/libcrypt32.$(IMPLIBEXT): crypt32/crypt32.spec $(WINEBUILD) cryptdll/libcryptdll.$(IMPLIBEXT): cryptdll/cryptdll.spec $(WINEBUILD) @cd cryptdll && $(MAKE) libcryptdll.$(IMPLIBEXT) +cryptnet/libcryptnet.$(IMPLIBEXT): cryptnet/cryptnet.spec $(WINEBUILD) + @cd cryptnet && $(MAKE) libcryptnet.$(IMPLIBEXT) + ctl3d32/libctl3d32.$(IMPLIBEXT): ctl3d32/ctl3d32.spec $(WINEBUILD) @cd ctl3d32 && $(MAKE) libctl3d32.$(IMPLIBEXT) diff --git a/dlls/comctl32/comctl_El.rc b/dlls/comctl32/comctl_El.rc new file mode 100644 index 00000000000..a226e3798ab --- /dev/null +++ b/dlls/comctl32/comctl_El.rc @@ -0,0 +1,87 @@ +/* + * Copyright 2007 Apostolos Alexiadis (djapal@gmail.com) + * + * This library 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. + * + * This library 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 library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_GREEK, SUBLANG_DEFAULT + +IDD_PROPSHEET DIALOG DISCARDABLE 0, 0, 220, 140 +STYLE DS_CONTEXTHELP | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Éäéüôçôåò ãéá %s" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "OK", IDOK,4,122,50,14, WS_TABSTOP | WS_GROUP + PUSHBUTTON "Áêýñùóç", IDCANCEL,58,122,50,14 + PUSHBUTTON "&ÅöáñìïãÞ", IDC_APPLY_BUTTON,112,122,50,14,WS_DISABLED + PUSHBUTTON "ÂïÞèåéá", IDHELP,166,122,50,14,WS_TABSTOP|WS_GROUP + CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS|WS_GROUP|WS_TABSTOP|TCS_MULTILINE,4,4,212,114 +END + + +IDD_WIZARD DIALOG DISCARDABLE 0, 0, 290, 159 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | WS_VISIBLE +CAPTION "Âïçèüò" +FONT 8, "MS Shell Dlg" +BEGIN + PUSHBUTTON "< &Ðñïçãïýìåíï", IDC_BACK_BUTTON,71,138,50,14 + DEFPUSHBUTTON "&Åðüìåíï >", IDC_NEXT_BUTTON,121,138,50,14 + DEFPUSHBUTTON "ÏëïêëÞñùóç", IDC_FINISH_BUTTON,121,138,50,14 + PUSHBUTTON "Áêýñùóç", IDCANCEL,178,138,50,14 + PUSHBUTTON "ÂïÞèåéá", IDHELP,235,138,50,14,WS_GROUP + LTEXT "", IDC_SUNKEN_LINE,7,129,278,1,SS_SUNKEN + CONTROL "Tab", IDC_TABCONTROL,"SysTabControl32",WS_CLIPSIBLINGS | WS_DISABLED,7,7,258,5 + LTEXT "", IDC_SUNKEN_LINEHEADER,0,35,290,1,SS_LEFT | SS_SUNKEN | WS_CHILD | WS_VISIBLE +END + + +IDD_TBCUSTOMIZE DIALOG DISCARDABLE 10, 20, 357, 125 +STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +CAPTION "Ðáñáìåôñïðïßçóç ÌðÜñáò Åñãáëåßùí" +FONT 8, "MS Shell Dlg" +BEGIN + DEFPUSHBUTTON "&Êëåßóéìï", IDCANCEL,308,6,44,14 + PUSHBUTTON "R&eset", IDC_RESET_BTN,308,23,44,14 + PUSHBUTTON "&ÂïÞèåéá", IDC_HELP_BTN,308,40,44,14 + PUSHBUTTON "Ìåôáêßíçóç &ÐÜíù", IDC_MOVEUP_BTN,308,74,44,14 + PUSHBUTTON "Ìåôáêßíçóç &ÊÜôù", IDC_MOVEDN_BTN,308,91,44,14 + LTEXT "Ä&éáèÝóéìá êïõìðéÜ:", -1,4,5,84,10 + LISTBOX IDC_AVAILBTN_LBOX,4,17,120,100, LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP + PUSHBUTTON "&ÐñïóèÞêç ->", IDOK, 131, 42, 44, 14 + PUSHBUTTON "<- &Áöáßñåóç", IDC_REMOVE_BTN,131,62,44,14 + LTEXT "&ÊïõìðéÜ ìðÜñáò åñãáëåßùí:", -1,182,5,78,10 + LISTBOX IDC_TOOLBARBTN_LBOX, 182,17,120,100,LBS_NOTIFY | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_NOINTEGRALHEIGHT | LBS_DISABLENOSCROLL | WS_BORDER | WS_VSCROLL | WS_HSCROLL | WS_TABSTOP +END + +STRINGTABLE DISCARDABLE +{ + IDS_CLOSE "Êëåßóéìï" +} + +STRINGTABLE DISCARDABLE +{ + IDM_TODAY "ÓÞìåñá:" + IDM_GOTODAY "ÌåôÜâáóç óôá óçìåñéíÜ" +} + +STRINGTABLE DISCARDABLE +{ + IDS_SEPARATOR "Äéá÷ùñéóôÞò" +} + +STRINGTABLE DISCARDABLE +{ + HKY_NONE "ÊáíÝíá" +} diff --git a/dlls/comctl32/rsrc.rc b/dlls/comctl32/rsrc.rc index adcc0165b1b..06ffd4d0f11 100644 --- a/dlls/comctl32/rsrc.rc +++ b/dlls/comctl32/rsrc.rc @@ -94,6 +94,7 @@ IDI_TT_ERROR_SM ICON LOADONCALL DISCARDABLE idi_tt_error_sm.ico #include "comctl_Cn.rc" #include "comctl_Cs.rc" #include "comctl_De.rc" +#include "comctl_El.rc" #include "comctl_En.rc" #include "comctl_Eo.rc" #include "comctl_Es.rc" diff --git a/dlls/crypt32/cert.c b/dlls/crypt32/cert.c index dcad7fa2f3e..24519736432 100644 --- a/dlls/crypt32/cert.c +++ b/dlls/crypt32/cert.c @@ -1305,10 +1305,7 @@ LONG WINAPI CertVerifyTimeValidity(LPFILETIME pTimeToVerify, if (!pTimeToVerify) { - SYSTEMTIME sysTime; - - GetSystemTime(&sysTime); - SystemTimeToFileTime(&sysTime, &fileTime); + GetSystemTimeAsFileTime(&fileTime); pTimeToVerify = &fileTime; } if ((ret = CompareFileTime(pTimeToVerify, &pCertInfo->NotBefore)) >= 0) diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c index ff555bbc6c4..92043b127ec 100644 --- a/dlls/crypt32/chain.c +++ b/dlls/crypt32/chain.c @@ -1062,6 +1062,8 @@ static void CRYPT_FreeLowerQualityChains(PCertificateChain chain) for (i = 0; i < chain->context.cLowerQualityChainContext; i++) CertFreeCertificateChain(chain->context.rgpLowerQualityChainContext[i]); CryptMemFree(chain->context.rgpLowerQualityChainContext); + chain->context.cLowerQualityChainContext = 0; + chain->context.rgpLowerQualityChainContext = NULL; } static void CRYPT_FreeChainContext(PCertificateChain chain) @@ -1272,6 +1274,8 @@ static PCertificateChain CRYPT_ChooseHighestQualityChain( chain->context.rgpLowerQualityChainContext; alternate->context.rgpLowerQualityChainContext[i] = (PCCERT_CHAIN_CONTEXT)chain; + chain->context.cLowerQualityChainContext = 0; + chain->context.rgpLowerQualityChainContext = NULL; chain = alternate; } } @@ -1363,11 +1367,7 @@ BOOL WINAPI CertGetCertificateChain(HCERTCHAINENGINE hChainEngine, } while (ret && alternate); chain = CRYPT_ChooseHighestQualityChain(chain); if (!(dwFlags & CERT_CHAIN_RETURN_LOWER_QUALITY_CONTEXTS)) - { CRYPT_FreeLowerQualityChains(chain); - chain->context.cLowerQualityChainContext = 0; - chain->context.rgpLowerQualityChainContext = NULL; - } if (ppChainContext) *ppChainContext = (PCCERT_CHAIN_CONTEXT)chain; else diff --git a/dlls/crypt32/crl.c b/dlls/crypt32/crl.c index bc7f73e04de..ada06fc4d8d 100644 --- a/dlls/crypt32/crl.c +++ b/dlls/crypt32/crl.c @@ -519,10 +519,7 @@ LONG WINAPI CertVerifyCRLTimeValidity(LPFILETIME pTimeToVerify, if (!pTimeToVerify) { - SYSTEMTIME sysTime; - - GetSystemTime(&sysTime); - SystemTimeToFileTime(&sysTime, &fileTime); + GetSystemTimeAsFileTime(&fileTime); pTimeToVerify = &fileTime; } if ((ret = CompareFileTime(pTimeToVerify, &pCrlInfo->ThisUpdate)) >= 0) diff --git a/dlls/crypt32/crypt32.spec b/dlls/crypt32/crypt32.spec index cbadf229284..874d26d7c13 100644 --- a/dlls/crypt32/crypt32.spec +++ b/dlls/crypt32/crypt32.spec @@ -190,10 +190,12 @@ @ stdcall CryptVerifyMessageSignature(ptr long ptr long ptr ptr ptr) @ stub CryptVerifyMessageSignatureWithKey @ stub CryptVerifySignatureU +@ stdcall I_CertUpdateStore(ptr ptr long long) @ stdcall I_CryptAllocTls() @ stdcall I_CryptCreateLruCache(ptr ptr) -@ stub I_CryptCreateLruEntry +@ stdcall I_CryptCreateLruEntry(ptr long long) @ stdcall I_CryptDetachTls(long) +@ stdcall I_CryptFindLruEntry(long long) @ stdcall I_CryptFindLruEntryData(long long long) @ stdcall I_CryptFlushLruCache(ptr long long) @ stdcall I_CryptFreeLruCache(ptr long long) diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index c0246d054be..8293e8276d8 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -126,6 +126,7 @@ HCRYPTPROV CRYPT_GetDefaultProvider(void); void crypt_oid_init(HINSTANCE hinst); void crypt_oid_free(void); void crypt_sip_free(void); +void root_store_free(void); void default_chain_engine_free(void); /* Some typedefs that make it easier to abstract which type of context we're @@ -233,7 +234,8 @@ typedef struct WINE_CRYPTCERTSTORE void CRYPT_InitStore(WINECRYPT_CERTSTORE *store, DWORD dwFlags, CertStoreType type); void CRYPT_FreeStore(PWINECRYPT_CERTSTORE store); -void CRYPT_EmptyStore(HCERTSTORE store); +BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, + DWORD unk1); PWINECRYPT_CERTSTORE CRYPT_CollectionOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, const void *pvPara); diff --git a/dlls/crypt32/filestore.c b/dlls/crypt32/filestore.c index 8294e827ccd..4c8c4a14a82 100644 --- a/dlls/crypt32/filestore.c +++ b/dlls/crypt32/filestore.c @@ -118,11 +118,20 @@ static BOOL WINAPI CRYPT_FileControl(HCERTSTORE hCertStore, DWORD dwFlags, switch (dwCtrlType) { case CERT_STORE_CTRL_RESYNC: - CRYPT_EmptyStore(store->memStore); store->dirty = FALSE; if (store->type == CERT_STORE_SAVE_AS_STORE) - ret = CRYPT_ReadSerializedStoreFromFile(store->file, - store->memStore); + { + HCERTSTORE memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + + /* FIXME: if I could translate a handle to a path, I could use + * CryptQueryObject instead, but there's no API to do so yet. + */ + ret = CRYPT_ReadSerializedStoreFromFile(store->file, memStore); + if (ret) + I_CertUpdateStore(store->memStore, memStore, 0, 0); + CertCloseStore(memStore, 0); + } else if (store->type == CERT_STORE_SAVE_AS_PKCS7) { CERT_BLOB blob = { 0, NULL }; @@ -136,24 +145,8 @@ static BOOL WINAPI CRYPT_FileControl(HCERTSTORE hCertStore, DWORD dwFlags, CERT_QUERY_CONTENT_FLAG_PKCS7_SIGNED, CERT_QUERY_FORMAT_FLAG_BINARY, 0, NULL, NULL, NULL, &messageStore, NULL, NULL); - if (ret) - { - PCCERT_CONTEXT cert = NULL; - PCCRL_CONTEXT crl = NULL; - - do { - cert = CertEnumCertificatesInStore(messageStore, cert); - if (cert) - CertAddCertificateContextToStore(store->memStore, - cert, CERT_STORE_ADD_ALWAYS, NULL); - } while (cert); - do { - crl = CertEnumCRLsInStore(messageStore, crl); - if (crl) - CertAddCRLContextToStore(store->memStore, crl, - CERT_STORE_ADD_ALWAYS, NULL); - } while (crl); - } + I_CertUpdateStore(store->memStore, messageStore, 0, 0); + CertCloseStore(messageStore, 0); CryptMemFree(blob.pbData); } } diff --git a/dlls/crypt32/main.c b/dlls/crypt32/main.c index f10a9c9b2bb..727246e6a9e 100644 --- a/dlls/crypt32/main.c +++ b/dlls/crypt32/main.c @@ -45,6 +45,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD fdwReason, PVOID pvReserved) case DLL_PROCESS_DETACH: crypt_oid_free(); crypt_sip_free(); + root_store_free(); default_chain_engine_free(); if (hDefProv) CryptReleaseContext(hDefProv, 0); break; @@ -75,12 +76,24 @@ BOOL WINAPI I_CryptCreateLruCache(void *unknown, HLRUCACHE *out) return TRUE; } +BOOL WINAPI I_CryptFindLruEntry(DWORD unk0, DWORD unk1) +{ + FIXME("(%08x, %08x): stub!\n", unk0, unk1); + return FALSE; +} + BOOL WINAPI I_CryptFindLruEntryData(DWORD unk0, DWORD unk1, DWORD unk2) { FIXME("(%08x, %08x, %08x): stub!\n", unk0, unk1, unk2); return FALSE; } +BOOL WINAPI I_CryptCreateLruEntry(HLRUCACHE h, DWORD unk0, DWORD unk1) +{ + FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1); + return FALSE; +} + DWORD WINAPI I_CryptFlushLruCache(HLRUCACHE h, DWORD unk0, DWORD unk1) { FIXME("(%p, %08x, %08x): stub!\n", h, unk0, unk1); diff --git a/dlls/crypt32/msg.c b/dlls/crypt32/msg.c index 2d19736dec2..30c0ddbb1a1 100644 --- a/dlls/crypt32/msg.c +++ b/dlls/crypt32/msg.c @@ -801,12 +801,12 @@ typedef struct _CSignerHandles { HCRYPTHASH contentHash; HCRYPTHASH authAttrHash; - HCRYPTKEY key; } CSignerHandles; typedef struct _CSignedMsgData { CRYPT_SIGNED_INFO *info; + DWORD cSignerHandle; CSignerHandles *signerHandles; } CSignedMsgData; @@ -842,13 +842,22 @@ static BOOL CSignedMsgData_AllocateHandles(CSignedMsgData *msg_data) msg_data->signerHandles = CryptMemAlloc(msg_data->info->cSignerInfo * sizeof(CSignerHandles)); if (msg_data->signerHandles) + { + msg_data->cSignerHandle = msg_data->info->cSignerInfo; memset(msg_data->signerHandles, 0, msg_data->info->cSignerInfo * sizeof(CSignerHandles)); + } else + { + msg_data->cSignerHandle = 0; ret = FALSE; + } } else + { + msg_data->cSignerHandle = 0; msg_data->signerHandles = NULL; + } return ret; } @@ -856,16 +865,16 @@ static void CSignedMsgData_CloseHandles(CSignedMsgData *msg_data) { DWORD i; - for (i = 0; i < msg_data->info->cSignerInfo; i++) + for (i = 0; i < msg_data->cSignerHandle; i++) { - if (msg_data->signerHandles[i].key) - CryptDestroyKey(msg_data->signerHandles[i].key); if (msg_data->signerHandles[i].contentHash) CryptDestroyHash(msg_data->signerHandles[i].contentHash); if (msg_data->signerHandles[i].authAttrHash) CryptDestroyHash(msg_data->signerHandles[i].authAttrHash); } CryptMemFree(msg_data->signerHandles); + msg_data->signerHandles = NULL; + msg_data->cSignerHandle = 0; } static BOOL CSignedMsgData_UpdateHash(CSignedMsgData *msg_data, @@ -874,7 +883,7 @@ static BOOL CSignedMsgData_UpdateHash(CSignedMsgData *msg_data, DWORD i; BOOL ret = TRUE; - for (i = 0; ret && i < msg_data->info->cSignerInfo; i++) + for (i = 0; ret && i < msg_data->cSignerHandle; i++) ret = CryptHashData(msg_data->signerHandles[i].contentHash, pbData, cbData, 0); return ret; @@ -1143,7 +1152,7 @@ static BOOL CSignedEncodeMsg_GetParam(HCRYPTMSG hCryptMsg, DWORD dwParamType, break; } case CMSG_COMPUTED_HASH_PARAM: - if (dwIndex >= msg->msg_data.info->cSignerInfo) + if (dwIndex >= msg->msg_data.cSignerHandle) SetLastError(CRYPT_E_INVALID_INDEX); else ret = CryptGetHashParam( @@ -1248,33 +1257,42 @@ static HCRYPTMSG CSignedEncodeMsg_Open(DWORD dwFlags, } else ret = FALSE; - if (ret && info->cSigners) + if (ret) { - msg->msg_data.info->rgSignerInfo = - CryptMemAlloc(info->cSigners * sizeof(CMSG_SIGNER_INFO)); - if (msg->msg_data.info->rgSignerInfo) + if (info->cSigners) { - msg->msg_data.info->cSignerInfo = info->cSigners; - memset(msg->msg_data.info->rgSignerInfo, 0, - msg->msg_data.info->cSignerInfo * sizeof(CMSG_SIGNER_INFO)); - ret = CSignedMsgData_AllocateHandles(&msg->msg_data); - for (i = 0; ret && i < msg->msg_data.info->cSignerInfo; i++) + msg->msg_data.info->rgSignerInfo = + CryptMemAlloc(info->cSigners * sizeof(CMSG_SIGNER_INFO)); + if (msg->msg_data.info->rgSignerInfo) { - ret = CSignerInfo_Construct( - &msg->msg_data.info->rgSignerInfo[i], - &info->rgSigners[i]); - if (ret) + msg->msg_data.info->cSignerInfo = info->cSigners; + memset(msg->msg_data.info->rgSignerInfo, 0, + msg->msg_data.info->cSignerInfo * sizeof(CMSG_SIGNER_INFO)); + ret = CSignedMsgData_AllocateHandles(&msg->msg_data); + for (i = 0; ret && i < msg->msg_data.info->cSignerInfo; i++) { - ret = CSignedMsgData_ConstructSignerHandles( - &msg->msg_data, i, info->rgSigners[i].hCryptProv); - if (dwFlags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG) - CryptReleaseContext(info->rgSigners[i].hCryptProv, - 0); + ret = CSignerInfo_Construct( + &msg->msg_data.info->rgSignerInfo[i], + &info->rgSigners[i]); + if (ret) + { + ret = CSignedMsgData_ConstructSignerHandles( + &msg->msg_data, i, info->rgSigners[i].hCryptProv); + if (dwFlags & CMSG_CRYPT_RELEASE_CONTEXT_FLAG) + CryptReleaseContext(info->rgSigners[i].hCryptProv, + 0); + } } } + else + ret = FALSE; } else - ret = FALSE; + { + msg->msg_data.info->cSignerInfo = 0; + msg->msg_data.signerHandles = NULL; + msg->msg_data.cSignerHandle = 0; + } } if (ret) ret = CRYPT_ConstructBlobArray( @@ -2018,7 +2036,7 @@ static BOOL CDecodeSignedMsg_GetParam(CDecodeMsg *msg, DWORD dwParamType, case CMSG_COMPUTED_HASH_PARAM: if (msg->u.signed_data.info) { - if (dwIndex >= msg->u.signed_data.info->cSignerInfo) + if (dwIndex >= msg->u.signed_data.cSignerHandle) SetLastError(CRYPT_E_INVALID_INDEX); else ret = CryptGetHashParam( diff --git a/dlls/crypt32/oid.c b/dlls/crypt32/oid.c index 1e2de95eb21..c35554f8c83 100644 --- a/dlls/crypt32/oid.c +++ b/dlls/crypt32/oid.c @@ -208,7 +208,7 @@ BOOL WINAPI CryptGetDefaultOIDDllList(HCRYPTOIDFUNCSET hFuncSet, else { /* No value, return an empty list */ - if (*pcchDllList) + if (pwszDllList && *pcchDllList) *pwszDllList = '\0'; *pcchDllList = 1; } @@ -216,8 +216,10 @@ BOOL WINAPI CryptGetDefaultOIDDllList(HCRYPTOIDFUNCSET hFuncSet, } else { - SetLastError(rc); - ret = FALSE; + /* No value, return an empty list */ + if (pwszDllList && *pcchDllList) + *pwszDllList = '\0'; + *pcchDllList = 1; } CryptMemFree(keyName); @@ -275,6 +277,13 @@ BOOL WINAPI CryptInstallOIDFunctionAddress(HMODULE hModule, return ret; } +struct FuncAddr +{ + HMODULE lib; + LPWSTR dllList; + LPWSTR currentDll; +}; + static BOOL CRYPT_GetFuncFromReg(DWORD dwEncodingType, LPCSTR pszOID, LPCSTR szFuncName, LPVOID *ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr) { @@ -322,8 +331,21 @@ static BOOL CRYPT_GetFuncFromReg(DWORD dwEncodingType, LPCSTR pszOID, *ppvFuncAddr = GetProcAddress(lib, funcName); if (*ppvFuncAddr) { - *phFuncAddr = (HCRYPTOIDFUNCADDR)lib; - ret = TRUE; + struct FuncAddr *addr = + CryptMemAlloc(sizeof(struct FuncAddr)); + + if (addr) + { + addr->lib = lib; + addr->dllList = addr->currentDll = NULL; + *phFuncAddr = addr; + ret = TRUE; + } + else + { + *phFuncAddr = NULL; + FreeLibrary(lib); + } } else { @@ -409,17 +431,151 @@ BOOL WINAPI CryptFreeOIDFunctionAddress(HCRYPTOIDFUNCADDR hFuncAddr, * and only unload it if it can be unloaded. Also need to implement ref * counting on the functions. */ - FreeLibrary((HMODULE)hFuncAddr); + if (hFuncAddr) + { + struct FuncAddr *addr = (struct FuncAddr *)hFuncAddr; + + CryptMemFree(addr->dllList); + FreeLibrary(addr->lib); + CryptMemFree(addr); + } return TRUE; } +static BOOL CRYPT_GetFuncFromDll(LPCWSTR dll, LPCSTR func, HMODULE *lib, + void **ppvFuncAddr) +{ + BOOL ret = FALSE; + + *lib = LoadLibraryW(dll); + if (*lib) + { + *ppvFuncAddr = GetProcAddress(*lib, func); + if (*ppvFuncAddr) + ret = TRUE; + else + { + FreeLibrary(*lib); + *lib = NULL; + } + } + return ret; +} + BOOL WINAPI CryptGetDefaultOIDFunctionAddress(HCRYPTOIDFUNCSET hFuncSet, DWORD dwEncodingType, LPCWSTR pwszDll, DWORD dwFlags, void **ppvFuncAddr, HCRYPTOIDFUNCADDR *phFuncAddr) { - FIXME("(%p, %d, %s, %08x, %p, %p): stub\n", hFuncSet, dwEncodingType, + struct OIDFunctionSet *set = (struct OIDFunctionSet *)hFuncSet; + BOOL ret = FALSE; + + TRACE("(%p, %d, %s, %08x, %p, %p)\n", hFuncSet, dwEncodingType, debugstr_w(pwszDll), dwFlags, ppvFuncAddr, phFuncAddr); - return FALSE; + + if (pwszDll) + { + HMODULE lib; + + *phFuncAddr = NULL; + ret = CRYPT_GetFuncFromDll(pwszDll, set->name, &lib, ppvFuncAddr); + if (ret) + { + struct FuncAddr *addr = CryptMemAlloc(sizeof(struct FuncAddr)); + + if (addr) + { + addr->lib = lib; + addr->dllList = addr->currentDll = NULL; + *phFuncAddr = addr; + } + else + { + FreeLibrary(lib); + *ppvFuncAddr = NULL; + SetLastError(ERROR_OUTOFMEMORY); + ret = FALSE; + } + } + else + SetLastError(ERROR_FILE_NOT_FOUND); + } + else + { + struct FuncAddr *addr = (struct FuncAddr *)*phFuncAddr; + + if (!addr) + { + DWORD size; + + ret = CryptGetDefaultOIDDllList(hFuncSet, dwEncodingType, NULL, + &size); + if (ret) + { + LPWSTR dllList = CryptMemAlloc(size * sizeof(WCHAR)); + + if (dllList) + { + ret = CryptGetDefaultOIDDllList(hFuncSet, dwEncodingType, + dllList, &size); + if (ret) + { + addr = CryptMemAlloc(sizeof(struct FuncAddr)); + if (addr) + { + addr->dllList = dllList; + addr->currentDll = dllList; + addr->lib = NULL; + *phFuncAddr = addr; + } + else + { + CryptMemFree(dllList); + SetLastError(ERROR_OUTOFMEMORY); + ret = FALSE; + } + } + } + else + { + SetLastError(ERROR_OUTOFMEMORY); + ret = FALSE; + } + } + } + if (addr) + { + if (!*addr->currentDll) + { + CryptFreeOIDFunctionAddress(*phFuncAddr, 0); + SetLastError(ERROR_FILE_NOT_FOUND); + *phFuncAddr = NULL; + ret = FALSE; + } + else + { + /* FIXME: as elsewhere, can't free until DllCanUnloadNow says + * it's possible, and should defer unloading for some time to + * avoid repeated LoadLibrary/FreeLibrary on the same dll. + */ + FreeLibrary(addr->lib); + ret = CRYPT_GetFuncFromDll(addr->currentDll, set->name, + &addr->lib, ppvFuncAddr); + if (ret) + { + /* Move past the current DLL */ + addr->currentDll += lstrlenW(addr->currentDll) + 1; + *phFuncAddr = addr; + } + else + { + CryptFreeOIDFunctionAddress(*phFuncAddr, 0); + SetLastError(ERROR_FILE_NOT_FOUND); + *phFuncAddr = NULL; + } + } + } + } + return ret; } /*********************************************************************** @@ -452,10 +608,6 @@ BOOL WINAPI CryptRegisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, TRACE("(%x, %s, %s, %s, %s)\n", dwEncodingType, pszFuncName, debugstr_a(pszOID), debugstr_w(pwszDll), pszOverrideFuncName); - /* This only registers functions for encoding certs, not messages */ - if (!GET_CERT_ENCODING_TYPE(dwEncodingType)) - return TRUE; - /* Native does nothing pwszDll is NULL */ if (!pwszDll) return TRUE; @@ -513,10 +665,8 @@ BOOL WINAPI CryptUnregisterOIDFunction(DWORD dwEncodingType, LPCSTR pszFuncName, LPSTR szKey; LONG rc; - TRACE("%x %s %s\n", dwEncodingType, pszFuncName, pszOID); - - if (!GET_CERT_ENCODING_TYPE(dwEncodingType)) - return TRUE; + TRACE("%x %s %s\n", dwEncodingType, debugstr_a(pszFuncName), + debugstr_a(pszOID)); if (!pszFuncName || !pszOID) { @@ -784,8 +934,8 @@ BOOL WINAPI CryptRegisterDefaultOIDFunction(DWORD dwEncodingType, LPCWSTR existing; BOOL ret = FALSE; - TRACE("(%x, %s, %x, %s)\n", dwEncodingType, pszFuncName, dwIndex, - debugstr_w(pwszDll)); + TRACE("(%x, %s, %d, %s)\n", dwEncodingType, debugstr_a(pszFuncName), + dwIndex, debugstr_w(pwszDll)); if (!pwszDll) { diff --git a/dlls/crypt32/regstore.c b/dlls/crypt32/regstore.c index e7de5fdaf16..35928b8960a 100644 --- a/dlls/crypt32/regstore.c +++ b/dlls/crypt32/regstore.c @@ -63,8 +63,8 @@ static const WCHAR CRLsW[] = { 'C','R','L','s',0 }; static const WCHAR CTLsW[] = { 'C','T','L','s',0 }; static const WCHAR BlobW[] = { 'B','l','o','b',0 }; -static void CRYPT_RegReadSerializedFromReg(const WINE_REGSTOREINFO *store, HKEY key, - DWORD contextType) +static void CRYPT_RegReadSerializedFromReg(HKEY key, DWORD contextType, + HCERTSTORE store) { LONG rc; DWORD index = 0; @@ -136,7 +136,7 @@ static void CRYPT_RegReadSerializedFromReg(const WINE_REGSTOREINFO *store, HKEY { TRACE("hash matches, adding\n"); contextInterface->addContextToStore( - store->memStore, context, + store, context, CERT_STORE_ADD_REPLACE_EXISTING, NULL); } else @@ -156,7 +156,7 @@ static void CRYPT_RegReadSerializedFromReg(const WINE_REGSTOREINFO *store, HKEY } while (!rc); } -static void CRYPT_RegReadFromReg(const WINE_REGSTOREINFO *store) +static void CRYPT_RegReadFromReg(HKEY key, HCERTSTORE store) { static const WCHAR * const subKeys[] = { CertsW, CRLsW, CTLsW }; static const DWORD contextFlags[] = { CERT_STORE_CERTIFICATE_CONTEXT_FLAG, @@ -165,15 +165,15 @@ static void CRYPT_RegReadFromReg(const WINE_REGSTOREINFO *store) for (i = 0; i < sizeof(subKeys) / sizeof(subKeys[0]); i++) { - HKEY key; + HKEY hKey; LONG rc; - rc = RegCreateKeyExW(store->key, subKeys[i], 0, NULL, 0, KEY_READ, NULL, - &key, NULL); + rc = RegCreateKeyExW(key, subKeys[i], 0, NULL, 0, KEY_READ, NULL, + &hKey, NULL); if (!rc) { - CRYPT_RegReadSerializedFromReg(store, key, contextFlags[i]); - RegCloseKey(key); + CRYPT_RegReadSerializedFromReg(hKey, contextFlags[i], store); + RegCloseKey(hKey); } } } @@ -442,11 +442,17 @@ static BOOL WINAPI CRYPT_RegControl(HCERTSTORE hCertStore, DWORD dwFlags, switch (dwCtrlType) { case CERT_STORE_CTRL_RESYNC: + { + HCERTSTORE memStore = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + CRYPT_RegFlushStore(store, FALSE); - CRYPT_EmptyStore(store->memStore); - CRYPT_RegReadFromReg(store); + CRYPT_RegReadFromReg(store->key, memStore); + I_CertUpdateStore(store->memStore, memStore, 0, 0); + CertCloseStore(memStore, 0); ret = TRUE; break; + } case CERT_STORE_CTRL_COMMIT: ret = CRYPT_RegFlushStore(store, dwFlags & CERT_STORE_CTRL_COMMIT_FORCE_FLAG); @@ -523,7 +529,7 @@ PWINECRYPT_CERTSTORE CRYPT_RegOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags, regInfo->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": PWINE_REGSTOREINFO->cs"); list_init(®Info->certsToDelete); list_init(®Info->crlsToDelete); - CRYPT_RegReadFromReg(regInfo); + CRYPT_RegReadFromReg(regInfo->key, regInfo->memStore); regInfo->dirty = FALSE; provInfo.cbSize = sizeof(provInfo); provInfo.cStoreProvFunc = sizeof(regProvFuncs) / diff --git a/dlls/crypt32/rootstore.c b/dlls/crypt32/rootstore.c index 0bd537d4730..b96e456d30e 100644 --- a/dlls/crypt32/rootstore.c +++ b/dlls/crypt32/rootstore.c @@ -504,3 +504,8 @@ PWINECRYPT_CERTSTORE CRYPT_RootOpenStore(HCRYPTPROV hCryptProv, DWORD dwFlags) CertDuplicateStore(CRYPT_rootStore); return CRYPT_rootStore; } + +void root_store_free(void) +{ + CertCloseStore(CRYPT_rootStore, 0); +} diff --git a/dlls/crypt32/store.c b/dlls/crypt32/store.c index c32ae62098c..57a2bd8abdd 100644 --- a/dlls/crypt32/store.c +++ b/dlls/crypt32/store.c @@ -199,7 +199,7 @@ static BOOL CRYPT_MemDeleteCrl(PWINECRYPT_CERTSTORE store, void *pCrlContext) return TRUE; } -void CRYPT_EmptyStore(HCERTSTORE store) +static void CRYPT_EmptyStore(HCERTSTORE store) { PCCERT_CONTEXT cert; PCCRL_CONTEXT crl; @@ -216,6 +216,38 @@ void CRYPT_EmptyStore(HCERTSTORE store) } while (crl); } +BOOL WINAPI I_CertUpdateStore(HCERTSTORE store1, HCERTSTORE store2, DWORD unk0, + DWORD unk1) +{ + static BOOL warned = FALSE; + PCCERT_CONTEXT cert = NULL; + PCCRL_CONTEXT crl = NULL; + + TRACE("(%p, %p, %08x, %08x)\n", store1, store2, unk0, unk1); + if (!warned) + { + FIXME("semi-stub\n"); + warned = TRUE; + } + + /* Poor-man's resync: empty first store, then add everything from second + * store to it. + */ + CRYPT_EmptyStore(store1); + do { + cert = CertEnumCertificatesInStore(store2, cert); + if (cert) + CertAddCertificateContextToStore(store1, cert, + CERT_STORE_ADD_ALWAYS, NULL); + } while (cert); + do { + crl = CertEnumCRLsInStore(store2, crl); + if (crl) + CertAddCRLContextToStore(store1, crl, CERT_STORE_ADD_ALWAYS, NULL); + } while (crl); + return TRUE; +} + static void WINAPI CRYPT_MemCloseStore(HCERTSTORE hCertStore, DWORD dwFlags) { WINE_MEMSTORE *store = (WINE_MEMSTORE *)hCertStore; diff --git a/dlls/crypt32/tests/msg.c b/dlls/crypt32/tests/msg.c index 711677b91d7..47321af6e74 100644 --- a/dlls/crypt32/tests/msg.c +++ b/dlls/crypt32/tests/msg.c @@ -1926,6 +1926,7 @@ static void test_decode_msg_update(void) ret = CryptMsgUpdate(msg, dataEmptyContent, sizeof(dataEmptyContent), TRUE); ok(ret, "CryptMsgUpdate failed: %x\n", GetLastError()); + CryptMsgClose(msg); /* but decoding it as an explicitly typed message fails. */ msg = CryptMsgOpenToDecode(PKCS_7_ASN_ENCODING, 0, CMSG_DATA, 0, NULL, NULL); @@ -2447,6 +2448,7 @@ static void test_msg_control(void) sizeof(signedWithCertWithValidPubKeyContent), TRUE); ret = CryptMsgControl(msg, 0, CMSG_CTRL_VERIFY_SIGNATURE, &certInfo); ok(ret, "CryptMsgControl failed: %08x\n", GetLastError()); + CryptMsgClose(msg); } static void test_msg_get_signer_count(void) diff --git a/dlls/crypt32/tests/oid.c b/dlls/crypt32/tests/oid.c index c42b891af6b..f4f11f08ebc 100644 --- a/dlls/crypt32/tests/oid.c +++ b/dlls/crypt32/tests/oid.c @@ -414,6 +414,47 @@ static void test_registerDefaultOIDFunction(void) "Expected ERROR_FILE_NOT_FOUND, got %08x\n", GetLastError()); } +static void test_getDefaultOIDFunctionAddress(void) +{ + BOOL ret; + HCRYPTOIDFUNCSET set; + void *funcAddr; + HCRYPTOIDFUNCADDR hFuncAddr; + + /* Crash + ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, NULL, NULL); + ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, &funcAddr, NULL); + ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, NULL, &hFuncAddr); + ret = CryptGetDefaultOIDFunctionAddress(0, 0, NULL, 0, &funcAddr, + &hFuncAddr); + */ + set = CryptInitOIDFunctionSet("CertDllOpenStoreProv", 0); + ok(set != 0, "CryptInitOIDFunctionSet failed: %d\n", GetLastError()); + /* This crashes if hFuncAddr is not 0 to begin with */ + hFuncAddr = 0; + ret = CryptGetDefaultOIDFunctionAddress(set, 0, NULL, 0, &funcAddr, + &hFuncAddr); + ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, + "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); + /* This fails with the normal encoding too, so built-in functions aren't + * returned. + */ + ret = CryptGetDefaultOIDFunctionAddress(set, X509_ASN_ENCODING, NULL, 0, + &funcAddr, &hFuncAddr); + ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, + "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); + + /* Even with a registered dll, this fails (since the dll doesn't exist) */ + ret = CryptRegisterDefaultOIDFunction(0, "CertDllOpenStoreProv", 0, + bogusDll); + ok(ret, "CryptRegisterDefaultOIDFunction failed: %08x\n", GetLastError()); + ret = CryptGetDefaultOIDFunctionAddress(set, 0, NULL, 0, &funcAddr, + &hFuncAddr); + ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, + "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); + CryptUnregisterDefaultOIDFunction(0, "CertDllOpenStoreProv", bogusDll); +} + static BOOL WINAPI countOidInfo(PCCRYPT_OID_INFO pInfo, void *pvArg) { (*(DWORD *)pvArg)++; @@ -499,4 +540,5 @@ START_TEST(oid) test_installOIDFunctionAddress(); test_registerOIDFunction(); test_registerDefaultOIDFunction(); + test_getDefaultOIDFunctionAddress(); } diff --git a/dlls/crypt32/tests/store.c b/dlls/crypt32/tests/store.c index b14dbc2f903..05ea5e069e7 100644 --- a/dlls/crypt32/tests/store.c +++ b/dlls/crypt32/tests/store.c @@ -1788,6 +1788,104 @@ static void testAddSerialized(void) CertCloseStore(store, 0); } +static DWORD countCertsInStore(HCERTSTORE store) +{ + PCCERT_CONTEXT cert = NULL; + DWORD certs = 0; + + do { + cert = CertEnumCertificatesInStore(store, cert); + if (cert) + certs++; + } while (cert); + return certs; +} + +static DWORD countCRLsInStore(HCERTSTORE store) +{ + PCCRL_CONTEXT crl = NULL; + DWORD crls = 0; + + do { + crl = CertEnumCRLsInStore(store, crl); + if (crl) + crls++; + } while (crl); + return crls; +} + +static void test_I_UpdateStore(void) +{ + HMODULE lib = GetModuleHandleA("crypt32"); + BOOL (WINAPI *pI_CertUpdatestore)(HCERTSTORE, HCERTSTORE, DWORD, DWORD) = + (void *)GetProcAddress(lib, "I_CertUpdateStore"); + BOOL ret; + HCERTSTORE store1, store2; + PCCERT_CONTEXT cert; + DWORD certs; + + if (!pI_CertUpdatestore) + { + skip("No I_CertUpdateStore\n"); + return; + } + store1 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + store2 = CertOpenStore(CERT_STORE_PROV_MEMORY, 0, 0, + CERT_STORE_CREATE_NEW_FLAG, NULL); + + /* Crash + ret = pI_CertUpdatestore(NULL, NULL, 0, 0); + ret = pI_CertUpdatestore(store1, NULL, 0, 0); + ret = pI_CertUpdatestore(NULL, store2, 0, 0); + */ + ret = pI_CertUpdatestore(store1, store2, 0, 0); + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + + CertAddEncodedCertificateToStore(store2, X509_ASN_ENCODING, bigCert, + sizeof(bigCert), CERT_STORE_ADD_ALWAYS, &cert); + /* I_CertUpdateStore adds the contexts from store2 to store1 */ + ret = pI_CertUpdatestore(store1, store2, 0, 0); + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + certs = countCertsInStore(store1); + ok(certs == 1, "Expected 1 cert, got %d\n", certs); + /* Calling it a second time has no effect */ + ret = pI_CertUpdatestore(store1, store2, 0, 0); + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + certs = countCertsInStore(store1); + ok(certs == 1, "Expected 1 cert, got %d\n", certs); + + /* The last parameters to I_CertUpdateStore appear to be ignored */ + ret = pI_CertUpdatestore(store1, store2, 1, 0); + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + ret = pI_CertUpdatestore(store1, store2, 0, 1); + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + + CertAddEncodedCRLToStore(store2, X509_ASN_ENCODING, signedCRL, + sizeof(signedCRL), CERT_STORE_ADD_ALWAYS, NULL); + + /* I_CertUpdateStore also adds the CRLs from store2 to store1 */ + ret = pI_CertUpdatestore(store1, store2, 0, 0); + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + certs = countCertsInStore(store1); + ok(certs == 1, "Expected 1 cert, got %d\n", certs); + certs = countCRLsInStore(store1); + ok(certs == 1, "Expected 1 CRL, got %d\n", certs); + + CertDeleteCertificateFromStore(cert); + /* If a context is deleted from store2, I_CertUpdateStore delets it + * from store1 + */ + ret = pI_CertUpdatestore(store1, store2, 0, 0); + ok(ret, "I_CertUpdateStore failed: %08x\n", GetLastError()); + certs = countCertsInStore(store1); + ok(certs == 0, "Expected 0 certs, got %d\n", certs); + + CertFreeCertificateContext(cert); + CertCloseStore(store1, 0); + CertCloseStore(store2, 0); +} + START_TEST(store) { /* various combinations of CertOpenStore */ @@ -1805,4 +1903,6 @@ START_TEST(store) testStoreProperty(); testAddSerialized(); + + test_I_UpdateStore(); } diff --git a/dlls/cryptnet/Makefile.in b/dlls/cryptnet/Makefile.in index ed737e12c01..ed180f4b227 100644 --- a/dlls/cryptnet/Makefile.in +++ b/dlls/cryptnet/Makefile.in @@ -3,7 +3,8 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = cryptnet.dll -IMPORTS = kernel32 +IMPORTLIB = libcryptnet.$(IMPLIBEXT) +IMPORTS = crypt32 kernel32 C_SRCS = \ cryptnet_main.c diff --git a/dlls/cryptnet/cryptnet.spec b/dlls/cryptnet/cryptnet.spec index 62a88234570..bcf35e6f426 100644 --- a/dlls/cryptnet/cryptnet.spec +++ b/dlls/cryptnet/cryptnet.spec @@ -1,10 +1,10 @@ @ stub CertDllVerifyCTLUsage -@ stub CertDllVerifyRevocation +@ stdcall CertDllVerifyRevocation(long long long ptr long ptr ptr) @ stub CryptnetWlxLogoffEvent @ stub LdapProvOpenStore @ stub CryptCancelAsyncRetrieval @ stub CryptFlushTimeValidObject -@ stub CryptGetObjectUrl +@ stdcall CryptGetObjectUrl(ptr ptr long ptr ptr ptr ptr ptr) @ stub CryptGetTimeValidObject @ stub CryptInstallCancelRetrieval @ stub CryptRetrieveObjectByUrlA diff --git a/dlls/cryptnet/cryptnet_main.c b/dlls/cryptnet/cryptnet_main.c index b43a492d83f..206ba24c349 100644 --- a/dlls/cryptnet/cryptnet_main.c +++ b/dlls/cryptnet/cryptnet_main.c @@ -18,10 +18,14 @@ */ #include "config.h" +#include "wine/port.h" +#include #include "windef.h" #include "wine/debug.h" #include "winbase.h" #include "winnt.h" +#define NONAMELESSUNION +#include "wincrypt.h" WINE_DEFAULT_DEBUG_CHANNEL(cryptnet); @@ -43,13 +47,23 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) return TRUE; } +static const WCHAR cryptNet[] = { 'c','r','y','p','t','n','e','t','.', + 'd','l','l',0 }; +static const WCHAR ldapProvOpenStore[] = { 'L','d','a','p','P','r','o','v', + 'O','p','e','S','t','o','r','e',0 }; + /*********************************************************************** * DllRegisterServer (CRYPTNET.@) */ HRESULT WINAPI DllRegisterServer(void) { - FIXME("stub\n"); - + TRACE("\n"); + CryptRegisterDefaultOIDFunction(X509_ASN_ENCODING, + CRYPT_OID_VERIFY_REVOCATION_FUNC, 0, cryptNet); + CryptRegisterOIDFunction(0, CRYPT_OID_OPEN_STORE_PROV_FUNC, "Ldap", + cryptNet, "LdapProvOpenStore"); + CryptRegisterOIDFunction(0, CRYPT_OID_OPEN_STORE_PROV_FUNC, + CERT_STORE_PROV_LDAP_W, cryptNet, "LdapProvOpenStore"); return S_OK; } @@ -58,7 +72,232 @@ HRESULT WINAPI DllRegisterServer(void) */ HRESULT WINAPI DllUnregisterServer(void) { - FIXME("stub\n"); - + TRACE("\n"); + CryptUnregisterDefaultOIDFunction(X509_ASN_ENCODING, + CRYPT_OID_VERIFY_REVOCATION_FUNC, cryptNet); + CryptUnregisterOIDFunction(0, CRYPT_OID_OPEN_STORE_PROV_FUNC, "Ldap"); + CryptUnregisterOIDFunction(0, CRYPT_OID_OPEN_STORE_PROV_FUNC, + CERT_STORE_PROV_LDAP_W); return S_OK; } + +static const char *url_oid_to_str(LPCSTR oid) +{ + if (HIWORD(oid)) + return oid; + else + { + static char buf[10]; + + switch (LOWORD(oid)) + { +#define _x(oid) case LOWORD(oid): return #oid + _x(URL_OID_CERTIFICATE_ISSUER); + _x(URL_OID_CERTIFICATE_CRL_DIST_POINT); + _x(URL_OID_CTL_ISSUER); + _x(URL_OID_CTL_NEXT_UPDATE); + _x(URL_OID_CRL_ISSUER); + _x(URL_OID_CERTIFICATE_FRESHEST_CRL); + _x(URL_OID_CRL_FRESHEST_CRL); + _x(URL_OID_CROSS_CERT_DIST_POINT); +#undef _x + default: + snprintf(buf, sizeof(buf), "%d", LOWORD(oid)); + return buf; + } + } +} + +typedef BOOL (WINAPI *UrlDllGetObjectUrlFunc)(LPCSTR, LPVOID, DWORD, + PCRYPT_URL_ARRAY, DWORD *, PCRYPT_URL_INFO, DWORD *, LPVOID); + +static BOOL WINAPI CRYPT_GetUrlFromCertificateIssuer(LPCSTR pszUrlOid, + LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, + PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved) +{ + /* FIXME: This depends on the AIA (authority info access) extension being + * supported in crypt32. + */ + FIXME("\n"); + SetLastError(CRYPT_E_NOT_FOUND); + return FALSE; +} + +static BOOL WINAPI CRYPT_GetUrlFromCertificateCRLDistPoint(LPCSTR pszUrlOid, + LPVOID pvPara, DWORD dwFlags, PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, + PCRYPT_URL_INFO pUrlInfo, DWORD *pcbUrlInfo, LPVOID pvReserved) +{ + PCCERT_CONTEXT cert = (PCCERT_CONTEXT)pvPara; + PCERT_EXTENSION ext; + BOOL ret = FALSE; + + /* The only applicable flag is CRYPT_GET_URL_FROM_EXTENSION */ + if (dwFlags && !(dwFlags & CRYPT_GET_URL_FROM_EXTENSION)) + { + SetLastError(CRYPT_E_NOT_FOUND); + return FALSE; + } + if ((ext = CertFindExtension(szOID_CRL_DIST_POINTS, + cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension))) + { + CRL_DIST_POINTS_INFO *info; + DWORD size; + + ret = CryptDecodeObjectEx(X509_ASN_ENCODING, X509_CRL_DIST_POINTS, + ext->Value.pbData, ext->Value.cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, + &info, &size); + if (ret) + { + DWORD i, cUrl, bytesNeeded = sizeof(CRYPT_URL_ARRAY); + + for (i = 0, cUrl = 0; i < info->cDistPoint; i++) + if (info->rgDistPoint[i].DistPointName.dwDistPointNameChoice + == CRL_DIST_POINT_FULL_NAME) + { + DWORD j; + CERT_ALT_NAME_INFO *name = + &info->rgDistPoint[i].DistPointName.FullName; + + for (j = 0; j < name->cAltEntry; j++) + if (name->rgAltEntry[j].dwAltNameChoice == + CERT_ALT_NAME_URL) + { + if (name->rgAltEntry[j].pwszURL) + { + cUrl++; + bytesNeeded += sizeof(LPWSTR) + + (lstrlenW(name->rgAltEntry[j].pwszURL) + 1) + * sizeof(WCHAR); + } + } + } + if (!pcbUrlArray) + SetLastError(E_INVALIDARG); + else if (!pUrlArray) + *pcbUrlArray = bytesNeeded; + else if (*pcbUrlArray < bytesNeeded) + { + SetLastError(ERROR_MORE_DATA); + *pcbUrlArray = bytesNeeded; + ret = FALSE; + } + else + { + LPWSTR nextUrl; + + *pcbUrlArray = bytesNeeded; + pUrlArray->cUrl = 0; + pUrlArray->rgwszUrl = + (LPWSTR *)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY)); + nextUrl = (LPWSTR)((BYTE *)pUrlArray + sizeof(CRYPT_URL_ARRAY) + + cUrl * sizeof(LPWSTR)); + for (i = 0; i < info->cDistPoint; i++) + if (info->rgDistPoint[i].DistPointName.dwDistPointNameChoice + == CRL_DIST_POINT_FULL_NAME) + { + DWORD j; + CERT_ALT_NAME_INFO *name = + &info->rgDistPoint[i].DistPointName.FullName; + + for (j = 0; j < name->cAltEntry; j++) + if (name->rgAltEntry[j].dwAltNameChoice == + CERT_ALT_NAME_URL) + { + if (name->rgAltEntry[j].pwszURL) + { + lstrcpyW(nextUrl, + name->rgAltEntry[j].pwszURL); + pUrlArray->rgwszUrl[pUrlArray->cUrl++] = + nextUrl; + nextUrl += + (lstrlenW(name->rgAltEntry[j].pwszURL) + 1) + * sizeof(WCHAR); + } + } + } + } + if (ret) + { + if (pcbUrlInfo) + { + FIXME("url info: stub\n"); + if (!pUrlInfo) + *pcbUrlInfo = sizeof(CRYPT_URL_INFO); + else if (*pcbUrlInfo < sizeof(CRYPT_URL_INFO)) + { + *pcbUrlInfo = sizeof(CRYPT_URL_INFO); + SetLastError(ERROR_MORE_DATA); + ret = FALSE; + } + else + { + *pcbUrlInfo = sizeof(CRYPT_URL_INFO); + memset(pUrlInfo, 0, sizeof(CRYPT_URL_INFO)); + } + } + } + LocalFree(info); + } + } + else + SetLastError(CRYPT_E_NOT_FOUND); + return ret; +} + +/*********************************************************************** + * CryptGetObjectUrl (CRYPTNET.@) + */ +BOOL WINAPI CryptGetObjectUrl(LPCSTR pszUrlOid, LPVOID pvPara, DWORD dwFlags, + PCRYPT_URL_ARRAY pUrlArray, DWORD *pcbUrlArray, PCRYPT_URL_INFO pUrlInfo, + DWORD *pcbUrlInfo, LPVOID pvReserved) +{ + UrlDllGetObjectUrlFunc func = NULL; + HCRYPTOIDFUNCADDR hFunc = NULL; + BOOL ret = FALSE; + + TRACE("(%s, %p, %08x, %p, %p, %p, %p, %p)\n", debugstr_a(pszUrlOid), + pvPara, dwFlags, pUrlArray, pcbUrlArray, pUrlInfo, pcbUrlInfo, pvReserved); + + if (!HIWORD(pszUrlOid)) + { + switch (LOWORD(pszUrlOid)) + { + case LOWORD(URL_OID_CERTIFICATE_ISSUER): + func = CRYPT_GetUrlFromCertificateIssuer; + break; + case LOWORD(URL_OID_CERTIFICATE_CRL_DIST_POINT): + func = CRYPT_GetUrlFromCertificateCRLDistPoint; + break; + default: + FIXME("unimplemented for %s\n", url_oid_to_str(pszUrlOid)); + SetLastError(ERROR_FILE_NOT_FOUND); + } + } + else + { + static HCRYPTOIDFUNCSET set = NULL; + + if (!set) + set = CryptInitOIDFunctionSet(URL_OID_GET_OBJECT_URL_FUNC, 0); + CryptGetOIDFunctionAddress(set, X509_ASN_ENCODING, pszUrlOid, 0, + (void **)&func, &hFunc); + } + if (func) + ret = func(pszUrlOid, pvPara, dwFlags, pUrlArray, pcbUrlArray, + pUrlInfo, pcbUrlInfo, pvReserved); + if (hFunc) + CryptFreeOIDFunctionAddress(hFunc, 0); + return ret; +} + +/*********************************************************************** + * CertDllVerifyRevocation (CRYPTNET.@) + */ +BOOL WINAPI CertDllVerifyRevocation(DWORD dwEncodingType, DWORD dwRevType, + DWORD cContext, void *rgpvContext[], DWORD dwFlags, + PCERT_REVOCATION_PARA pRevPara, PCERT_REVOCATION_STATUS pRevStatus) +{ + FIXME("(%08x, %d, %d, %p, %08x, %p, %p): stub\n", dwEncodingType, dwRevType, + cContext, rgpvContext, dwFlags, pRevPara, pRevStatus); + return FALSE; +} diff --git a/dlls/cryptnet/Makefile.in b/dlls/cryptnet/tests/Makefile.in similarity index 53% copy from dlls/cryptnet/Makefile.in copy to dlls/cryptnet/tests/Makefile.in index ed737e12c01..2bf626e9660 100644 --- a/dlls/cryptnet/Makefile.in +++ b/dlls/cryptnet/tests/Makefile.in @@ -1,13 +1,13 @@ TOPSRCDIR = @top_srcdir@ -TOPOBJDIR = ../.. +TOPOBJDIR = ../../.. SRCDIR = @srcdir@ VPATH = @srcdir@ -MODULE = cryptnet.dll -IMPORTS = kernel32 +TESTDLL = cryptnet.dll +IMPORTS = cryptnet crypt32 kernel32 -C_SRCS = \ - cryptnet_main.c +CTESTS = \ + cryptnet.c -@MAKE_DLL_RULES@ +@MAKE_TEST_RULES@ @DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/cryptnet/tests/cryptnet.c b/dlls/cryptnet/tests/cryptnet.c new file mode 100644 index 00000000000..25ad8726118 --- /dev/null +++ b/dlls/cryptnet/tests/cryptnet.c @@ -0,0 +1,239 @@ +/* + * Unit test suite for cryptnet.dll + * + * Copyright 2007 Juan Lang + * + * This library 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. + * + * This library 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 library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#include +#define NONAMELESSUNION +#include +#include +#include +#include +#include "wine/test.h" + +static const BYTE bigCert[] = { +0x30,0x78,0x02,0x01,0x01,0x30,0x02,0x06,0x00,0x30,0x14,0x31,0x12,0x30,0x10, +0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e, +0x67,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31,0x30,0x30, +0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31, +0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x14,0x31,0x12,0x30,0x10,0x06,0x03, +0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67,0x30, +0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x16,0x30,0x14,0x30,0x12,0x06, +0x03,0x55,0x1d,0x13,0x01,0x01,0xff,0x04,0x08,0x30,0x06,0x01,0x01,0xff,0x02, +0x01,0x01}; +static const BYTE certWithIssuingDistPoint[] = { +0x30,0x81,0x99,0xa0,0x03,0x02,0x01,0x02,0x02,0x01,0x01,0x30,0x0d,0x06,0x09, +0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x30,0x14,0x31,0x12, +0x30,0x10,0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c, +0x61,0x6e,0x67,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31, +0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31, +0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x14,0x31,0x12,0x30,0x10, +0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e, +0x67,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x27,0x30,0x25,0x30, +0x23,0x06,0x03,0x55,0x1d,0x1c,0x01,0x01,0xff,0x04,0x19,0x30,0x17,0xa0,0x15, +0xa0,0x13,0x86,0x11,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69,0x6e,0x65, +0x68,0x71,0x2e,0x6f,0x72,0x67, }; +static const BYTE certWithCRLDistPoint[] = { +0x30,0x81,0x9b,0xa0,0x03,0x02,0x01,0x02,0x02,0x01,0x01,0x30,0x0d,0x06,0x09, +0x2a,0x86,0x48,0x86,0xf7,0x0d,0x01,0x01,0x05,0x05,0x00,0x30,0x14,0x31,0x12, +0x30,0x10,0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c, +0x61,0x6e,0x67,0x30,0x22,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31,0x30,0x31, +0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x18,0x0f,0x31,0x36,0x30,0x31,0x30,0x31, +0x30,0x31,0x30,0x30,0x30,0x30,0x30,0x30,0x5a,0x30,0x14,0x31,0x12,0x30,0x10, +0x06,0x03,0x55,0x04,0x03,0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e, +0x67,0x30,0x07,0x30,0x02,0x06,0x00,0x03,0x01,0x00,0xa3,0x29,0x30,0x27,0x30, +0x25,0x06,0x03,0x55,0x1d,0x1f,0x01,0x01,0xff,0x04,0x1b,0x30,0x19,0x30,0x17, +0xa0,0x15,0xa0,0x13,0x86,0x11,0x68,0x74,0x74,0x70,0x3a,0x2f,0x2f,0x77,0x69, +0x6e,0x65,0x68,0x71,0x2e,0x6f,0x72,0x67, }; + +static void compareUrlArray(const CRYPT_URL_ARRAY *expected, + const CRYPT_URL_ARRAY *got) +{ + ok(expected->cUrl == got->cUrl, "Expected %d URLs, got %d\n", + expected->cUrl, got->cUrl); + if (expected->cUrl == got->cUrl) + { + DWORD i; + + for (i = 0; i < got->cUrl; i++) + ok(!lstrcmpiW(expected->rgwszUrl[i], got->rgwszUrl[i]), + "%d: unexpected URL\n", i); + } +} + +static WCHAR url[] = + { 'h','t','t','p',':','/','/','w','i','n','e','h','q','.','o','r','g',0 }; + +static void test_getObjectUrl(void) +{ + BOOL ret; + DWORD urlArraySize = 0, infoSize = 0; + PCCERT_CONTEXT cert; + + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL); + ok(!ret && GetLastError() == ERROR_FILE_NOT_FOUND, + "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError()); + /* Crash + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, NULL, 0, NULL, NULL, + NULL, NULL, NULL); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, NULL, 0, NULL, NULL, + NULL, &infoSize, NULL); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, NULL, 0, NULL, + &urlArraySize, NULL, &infoSize, NULL); + */ + /* A cert with no CRL dist point extension fails.. */ + cert = CertCreateCertificateContext(X509_ASN_ENCODING, bigCert, + sizeof(bigCert)); + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert, 0, NULL, + NULL, NULL, NULL, NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + CertFreeCertificateContext(cert); + + cert = CertCreateCertificateContext(X509_ASN_ENCODING, + certWithIssuingDistPoint, sizeof(certWithIssuingDistPoint)); + if (cert) + { + /* This cert has no AIA extension, so expect this to fail */ + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert, 0, + NULL, NULL, NULL, NULL, NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert, + CRYPT_GET_URL_FROM_PROPERTY, NULL, NULL, NULL, NULL, NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert, + CRYPT_GET_URL_FROM_EXTENSION, NULL, NULL, NULL, NULL, NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + /* It does have an issuing dist point extension, but that's not what + * this is looking for (it wants a CRL dist points extension) + */ + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, + (void *)cert, 0, NULL, NULL, NULL, NULL, NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, + (void *)cert, CRYPT_GET_URL_FROM_PROPERTY, NULL, NULL, NULL, NULL, + NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, + (void *)cert, CRYPT_GET_URL_FROM_EXTENSION, NULL, NULL, NULL, NULL, + NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + } + cert = CertCreateCertificateContext(X509_ASN_ENCODING, + certWithCRLDistPoint, sizeof(certWithCRLDistPoint)); + if (cert) + { + PCRYPT_URL_ARRAY urlArray; + + /* This cert has no AIA extension, so expect this to fail */ + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert, 0, + NULL, NULL, NULL, NULL, NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert, + CRYPT_GET_URL_FROM_PROPERTY, NULL, NULL, NULL, NULL, NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_ISSUER, (void *)cert, + CRYPT_GET_URL_FROM_EXTENSION, NULL, NULL, NULL, NULL, NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + /* It does have a CRL dist points extension */ + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, + (void *)cert, 0, NULL, NULL, NULL, NULL, NULL); + todo_wine + ok(!ret && GetLastError() == E_INVALIDARG, + "Expected E_INVALIDARG, got %08x\n", GetLastError()); + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, + (void *)cert, 0, NULL, NULL, NULL, &infoSize, NULL); + todo_wine + ok(!ret && GetLastError() == E_INVALIDARG, + "Expected E_INVALIDARG, got %08x\n", GetLastError()); + /* Can get it without specifying the location: */ + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, + (void *)cert, 0, NULL, &urlArraySize, NULL, NULL, NULL); + ok(ret, "CryptGetObjectUrl failed: %08x\n", GetLastError()); + urlArray = HeapAlloc(GetProcessHeap(), 0, urlArraySize); + if (urlArray) + { + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, + (void *)cert, 0, urlArray, &urlArraySize, NULL, NULL, NULL); + ok(ret, "CryptGetObjectUrl failed: %08x\n", GetLastError()); + if (ret) + { + LPWSTR pUrl = url; + CRYPT_URL_ARRAY expectedUrl = { 1, &pUrl }; + + compareUrlArray(&expectedUrl, urlArray); + } + HeapFree(GetProcessHeap(), 0, urlArray); + } + /* or by specifying it's an extension: */ + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, + (void *)cert, CRYPT_GET_URL_FROM_EXTENSION, NULL, &urlArraySize, NULL, + NULL, NULL); + ok(ret, "CryptGetObjectUrl failed: %08x\n", GetLastError()); + urlArray = HeapAlloc(GetProcessHeap(), 0, urlArraySize); + if (urlArray) + { + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, + (void *)cert, CRYPT_GET_URL_FROM_EXTENSION, urlArray, + &urlArraySize, NULL, NULL, NULL); + ok(ret, "CryptGetObjectUrl failed: %08x\n", GetLastError()); + if (ret) + { + LPWSTR pUrl = url; + CRYPT_URL_ARRAY expectedUrl = { 1, &pUrl }; + + compareUrlArray(&expectedUrl, urlArray); + } + HeapFree(GetProcessHeap(), 0, urlArray); + } + /* but it isn't contained in a property: */ + SetLastError(0xdeadbeef); + ret = CryptGetObjectUrl(URL_OID_CERTIFICATE_CRL_DIST_POINT, + (void *)cert, CRYPT_GET_URL_FROM_PROPERTY, NULL, &urlArraySize, NULL, + NULL, NULL); + ok(!ret && GetLastError() == CRYPT_E_NOT_FOUND, + "Expected CRYPT_E_NOT_FOUND, got %08x\n", GetLastError()); + CertFreeCertificateContext(cert); + } +} + +START_TEST(cryptnet) +{ + test_getObjectUrl(); +} diff --git a/dlls/gdi32/Makefile.in b/dlls/gdi32/Makefile.in index ee44d149986..9a165396bc6 100644 --- a/dlls/gdi32/Makefile.in +++ b/dlls/gdi32/Makefile.in @@ -6,7 +6,7 @@ VPATH = @srcdir@ MODULE = gdi32.dll IMPORTLIB = libgdi32.$(IMPLIBEXT) IMPORTS = advapi32 kernel32 ntdll -EXTRAINCL = @FREETYPEINCL@ +EXTRAINCL = @FREETYPEINCL@ @FONTCONFIGINCL@ EXTRALIBS = @CARBONLIB@ SPEC_SRCS16 = \ diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c index f36196ba745..ed97c5113a1 100644 --- a/dlls/kernel32/file.c +++ b/dlls/kernel32/file.c @@ -1544,6 +1544,9 @@ BOOL WINAPI ReplaceFileA(LPCSTR lpReplacedFileName,LPCSTR lpReplacementFileName, /************************************************************************* * FindFirstFileExW (KERNEL32.@) + * + * NOTE: The FindExSearchLimitToDirectories is ignored - it gives the same + * results as FindExSearchNameMatch */ HANDLE WINAPI FindFirstFileExW( LPCWSTR filename, FINDEX_INFO_LEVELS level, LPVOID data, FINDEX_SEARCH_OPS search_op, @@ -1781,9 +1784,6 @@ BOOL WINAPI FindNextFileW( HANDLE handle, WIN32_FIND_DATAW *data ) { if (!check_dir_symlink( info, dir_info )) continue; } - if (info->search_op == FindExSearchLimitToDirectories && - (dir_info->FileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0) - continue; data->dwFileAttributes = dir_info->FileAttributes; data->ftCreationTime = *(FILETIME *)&dir_info->CreationTime; diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index 6624f8121fb..1ecda49382a 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -3500,8 +3500,36 @@ BOOL WINAPI InvalidateNLSCache(void) */ GEOID WINAPI GetUserGeoID( GEOCLASS GeoClass ) { - FIXME("%d\n",GeoClass); - return GEOID_NOT_AVAILABLE; + GEOID ret = GEOID_NOT_AVAILABLE; + static const WCHAR geoW[] = {'G','e','o',0}; + static const WCHAR nationW[] = {'N','a','t','i','o','n',0}; + WCHAR bufferW[40], *end; + DWORD count; + HANDLE hkey, hSubkey = 0; + UNICODE_STRING keyW; + const KEY_VALUE_PARTIAL_INFORMATION *info = (KEY_VALUE_PARTIAL_INFORMATION *)bufferW; + RtlInitUnicodeString( &keyW, nationW ); + count = sizeof(bufferW); + + if(!(hkey = create_registry_key())) return ret; + + switch( GeoClass ){ + case GEOCLASS_NATION: + if ((hSubkey = NLS_RegOpenKey(hkey, geoW))) + { + if((NtQueryValueKey(hSubkey, &keyW, KeyValuePartialInformation, + (LPBYTE)bufferW, count, &count) == STATUS_SUCCESS ) && info->DataLength) + ret = strtolW((LPCWSTR)info->Data, &end, 10); + } + break; + case GEOCLASS_REGION: + FIXME("GEOCLASS_REGION not handled yet\n"); + break; + } + + NtClose(hkey); + if (hSubkey) NtClose(hSubkey); + return ret; } /****************************************************************************** diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c index 56860894c7d..0e687b5f071 100644 --- a/dlls/kernel32/tests/actctx.c +++ b/dlls/kernel32/tests/actctx.c @@ -16,7 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +#include "wine/test.h" #include #include #include @@ -163,7 +163,7 @@ static const WCHAR wndClass2W[] = static const WCHAR acr_manifest[] = {'a','c','r','.','m','a','n','i','f','e','s','t',0}; -static WCHAR app_dir[MAX_PATH], exe_path[MAX_PATH]; +static WCHAR app_dir[MAX_PATH], exe_path[MAX_PATH], work_dir[MAX_PATH], work_dir_subdir[MAX_PATH]; static WCHAR app_manifest_path[MAX_PATH], manifest_path[MAX_PATH], depmanifest_path[MAX_PATH]; static int strcmp_aw(LPCWSTR strw, const char *stra) @@ -180,7 +180,7 @@ static DWORD strlen_aw(const char *str) return MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0) - 1; } -static BOOL create_manifest_file(const char *filename, const char *manifest, +static BOOL create_manifest_file(const char *filename, const char *manifest, int manifest_len, const char *depfile, const char *depmanifest) { DWORD size; @@ -190,12 +190,15 @@ static BOOL create_manifest_file(const char *filename, const char *manifest, MultiByteToWideChar( CP_ACP, 0, filename, -1, path, MAX_PATH ); GetFullPathNameW(path, sizeof(manifest_path)/sizeof(WCHAR), manifest_path, NULL); + if (manifest_len == -1) + manifest_len = strlen(manifest); + file = CreateFileW(path, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError()); if(file == INVALID_HANDLE_VALUE) return FALSE; - WriteFile(file, manifest, strlen(manifest), &size, NULL); + WriteFile(file, manifest, manifest_len, &size, NULL); CloseHandle(file); if (depmanifest) @@ -213,6 +216,25 @@ static BOOL create_manifest_file(const char *filename, const char *manifest, return TRUE; } +static BOOL create_wide_manifest(const char *filename, const char *manifest, BOOL fBOM, BOOL fReverse) +{ + WCHAR *wmanifest = HeapAlloc(GetProcessHeap(), 0, (strlen(manifest)+2) * sizeof(WCHAR)); + BOOL ret; + int offset = (fBOM ? 0 : 1); + + MultiByteToWideChar(CP_ACP, 0, manifest, -1, &wmanifest[1], (strlen(manifest)+1) * sizeof(WCHAR)); + wmanifest[0] = 0xfeff; + if (fReverse) + { + int i; + for (i = 0; i < strlen(manifest)+1; i++) + wmanifest[i] = (wmanifest[i] << 8) | ((wmanifest[i] >> 8) & 0xff); + } + ret = create_manifest_file(filename, (char *)&wmanifest[offset], (strlen(manifest)+1-offset) * sizeof(WCHAR), NULL, NULL); + HeapFree(GetProcessHeap(), 0, wmanifest); + return ret; +} + typedef struct { ULONG format_version; ULONG assembly_cnt; @@ -230,7 +252,7 @@ static const detailed_info_t detailed_info0 = { static const detailed_info_t detailed_info1 = { 1, 1, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path, ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, - app_dir, + work_dir, }; static const detailed_info_t detailed_info1_child = { @@ -242,7 +264,7 @@ static const detailed_info_t detailed_info1_child = { static const detailed_info_t detailed_info2 = { 1, 2, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, manifest_path, ACTIVATION_CONTEXT_PATH_TYPE_NONE, ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE, - app_dir, + work_dir, }; static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo) @@ -253,7 +275,7 @@ static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo) exsize = sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION) + (exinfo->root_manifest_path ? (lstrlenW(exinfo->root_manifest_path)+1)*sizeof(WCHAR):0) - + (exinfo->app_dir ? (lstrlenW(app_dir)+1)*sizeof(WCHAR) : 0); + + (exinfo->app_dir ? (lstrlenW(exinfo->app_dir)+1)*sizeof(WCHAR) : 0); if(exsize != sizeof(ACTIVATION_CONTEXT_DETAILED_INFORMATION)) { size = 0xdeadbeef; @@ -298,9 +320,9 @@ static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo) ok(detailed_info->ulAppDirPathType == exinfo->app_dir_type, "detailed_info->ulAppDirPathType=%u, expected %u\n", detailed_info->ulAppDirPathType, exinfo->app_dir_type); - ok(detailed_info->ulAppDirPathChars == (exinfo->app_dir ? lstrlenW(app_dir) : 0), + ok(detailed_info->ulAppDirPathChars == (exinfo->app_dir ? lstrlenW(exinfo->app_dir) : 0), "detailed_info->ulAppDirPathChars=%u, expected %u\n", - detailed_info->ulAppDirPathChars, exinfo->app_dir ? lstrlenW(app_dir) : 0); + detailed_info->ulAppDirPathChars, exinfo->app_dir ? lstrlenW(exinfo->app_dir) : 0); if(exinfo->root_manifest_path) { ok(detailed_info->lpRootManifestPath != NULL, "detailed_info->lpRootManifestPath == NULL\n"); if(detailed_info->lpRootManifestPath) @@ -314,8 +336,8 @@ static void test_detailed_info(HANDLE handle, const detailed_info_t *exinfo) if(exinfo->app_dir) { ok(detailed_info->lpAppDirPath != NULL, "detailed_info->lpAppDirPath == NULL\n"); if(detailed_info->lpAppDirPath) - ok(!lstrcmpiW(app_dir, detailed_info->lpAppDirPath), - "unexpected detailed_info->lpAppDirPath %s\n",strw(detailed_info->lpAppDirPath)); + ok(!lstrcmpiW(exinfo->app_dir, detailed_info->lpAppDirPath), + "unexpected detailed_info->lpAppDirPath\n%s\n",strw(detailed_info->lpAppDirPath)); }else { ok(detailed_info->lpAppDirPath == NULL, "detailed_info->lpAppDirPath != NULL\n"); } @@ -581,7 +603,7 @@ static void test_create_and_fail(const char *manifest, const char *depmanifest, actctx.cbSize = sizeof(ACTCTXW); actctx.lpSource = path; - create_manifest_file("bad.manifest", manifest, "testdep.manifest", depmanifest); + create_manifest_file("bad.manifest", manifest, -1, "testdep.manifest", depmanifest); handle = pCreateActCtxW(&actctx); if (todo) todo_wine { @@ -598,6 +620,26 @@ static void test_create_and_fail(const char *manifest, const char *depmanifest, DeleteFileA("testdep.manifest"); } +static void test_create_wide_and_fail(const char *manifest, BOOL fBOM) +{ + ACTCTXW actctx; + HANDLE handle; + WCHAR path[MAX_PATH]; + + MultiByteToWideChar( CP_ACP, 0, "bad.manifest", -1, path, MAX_PATH ); + memset(&actctx, 0, sizeof(ACTCTXW)); + actctx.cbSize = sizeof(ACTCTXW); + actctx.lpSource = path; + + create_wide_manifest("bad.manifest", manifest, fBOM, FALSE); + handle = pCreateActCtxW(&actctx); + ok(handle == INVALID_HANDLE_VALUE, "handle != INVALID_HANDLE_VALUE\n"); + ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX, "GetLastError == %u\n", GetLastError()); + + if (handle != INVALID_HANDLE_VALUE) pReleaseActCtx( handle ); + DeleteFileA("bad.manifest"); +} + static void test_create_fail(void) { ACTCTXW actctx; @@ -629,6 +671,8 @@ static void test_create_fail(void) test_create_and_fail(wrong_manifest7, NULL, 1 ); trace("wrong_manifest8\n"); test_create_and_fail(wrong_manifest8, NULL, 0 ); + trace("UTF-16 manifest1 without BOM\n"); + test_create_wide_and_fail(manifest1, FALSE ); trace("manifest2\n"); test_create_and_fail(manifest2, NULL, 0 ); trace("manifest2+depmanifest1\n"); @@ -822,7 +866,7 @@ static void test_actctx(void) pReleaseActCtx(handle); } - if(!create_manifest_file("test1.manifest", manifest1, NULL, NULL)) { + if(!create_manifest_file("test1.manifest", manifest1, -1, NULL, NULL)) { skip("Could not create manifest file\n"); return; } @@ -835,14 +879,17 @@ static void test_actctx(void) test_detailed_info(handle, &detailed_info1); test_info_in_assembly(handle, 1, &manifest1_info); - b = CloseHandle(handle); - ok(!b, "CloseHandle succeeded\n"); - ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() == %u\n", GetLastError()); + if (!IsDebuggerPresent()) /* CloseHandle will generate an exception if a debugger is present */ + { + b = CloseHandle(handle); + ok(!b, "CloseHandle succeeded\n"); + ok(GetLastError() == ERROR_INVALID_HANDLE, "GetLastError() == %u\n", GetLastError()); + } pReleaseActCtx(handle); } - if(!create_manifest_file("test2.manifest", manifest2, "testdep.manifest", testdep_manifest1)) { + if(!create_manifest_file("test2.manifest", manifest2, -1, "testdep.manifest", testdep_manifest1)) { skip("Could not create manifest file\n"); return; } @@ -859,7 +906,7 @@ static void test_actctx(void) pReleaseActCtx(handle); } - if(!create_manifest_file("test3.manifest", manifest2, "testdep.manifest", testdep_manifest2)) { + if(!create_manifest_file("test3.manifest", manifest2, -1, "testdep.manifest", testdep_manifest2)) { skip("Could not create manifest file\n"); return; } @@ -888,7 +935,7 @@ static void test_actctx(void) trace("manifest2 depmanifest3\n"); - if(!create_manifest_file("test2-3.manifest", manifest2, "testdep.manifest", testdep_manifest3)) { + if(!create_manifest_file("test2-3.manifest", manifest2, -1, "testdep.manifest", testdep_manifest3)) { skip("Could not create manifest file\n"); return; } @@ -917,7 +964,7 @@ static void test_actctx(void) trace("manifest3\n"); - if(!create_manifest_file("test3.manifest", manifest3, NULL, NULL)) { + if(!create_manifest_file("test3.manifest", manifest3, -1, NULL, NULL)) { skip("Could not create manifest file\n"); return; } @@ -942,7 +989,7 @@ static void test_actctx(void) trace("manifest4\n"); - if(!create_manifest_file("test4.manifest", manifest4, NULL, NULL)) { + if(!create_manifest_file("test4.manifest", manifest4, -1, NULL, NULL)) { skip("Could not create manifest file\n"); return; } @@ -956,6 +1003,57 @@ static void test_actctx(void) test_info_in_assembly(handle, 2, &manifest_comctrl_info); pReleaseActCtx(handle); } + + trace("manifest1 in subdir\n"); + + CreateDirectoryW(work_dir_subdir, NULL); + if (SetCurrentDirectoryW(work_dir_subdir)) + { + if(!create_manifest_file("..\\test1.manifest", manifest1, -1, NULL, NULL)) { + skip("Could not create manifest file\n"); + return; + } + handle = test_create("..\\test1.manifest", manifest1); + DeleteFileA("..\\test1.manifest"); + if(handle != INVALID_HANDLE_VALUE) { + test_detailed_info(handle, &detailed_info1); + test_info_in_assembly(handle, 1, &manifest1_info); + pReleaseActCtx(handle); + } + SetCurrentDirectoryW(work_dir); + } + else + skip("Couldn't change directory\n"); + RemoveDirectoryW(work_dir_subdir); + + trace("UTF-16 manifest1, with BOM\n"); + if(!create_wide_manifest("test1.manifest", manifest1, TRUE, FALSE)) { + skip("Could not create manifest file\n"); + return; + } + + handle = test_create("test1.manifest", manifest1); + DeleteFileA("test1.manifest"); + if (handle != INVALID_HANDLE_VALUE) { + test_detailed_info(handle, &detailed_info1); + test_info_in_assembly(handle, 1, &manifest1_info); + pReleaseActCtx(handle); + } + + trace("UTF-16 manifest1, reverse endian, with BOM\n"); + if(!create_wide_manifest("test1.manifest", manifest1, TRUE, TRUE)) { + skip("Could not create manifest file\n"); + return; + } + + handle = test_create("test1.manifest", manifest1); + DeleteFileA("test1.manifest"); + if (handle != INVALID_HANDLE_VALUE) { + test_detailed_info(handle, &detailed_info1); + test_info_in_assembly(handle, 1, &manifest1_info); + pReleaseActCtx(handle); + } + } static void test_app_manifest(void) @@ -985,14 +1083,14 @@ static void run_child_process(void) GetModuleFileNameA(NULL, path, MAX_PATH); strcat(path, ".manifest"); - if(!create_manifest_file(path, manifest1, NULL, NULL)) { + if(!create_manifest_file(path, manifest1, -1, NULL, NULL)) { skip("Could not create manifest file\n"); return; } si.cb = sizeof(si); winetest_get_mainargs( &argv ); - sprintf(cmdline, "%s %s manifest1", argv[0], argv[1]); + sprintf(cmdline, "\"%s\" %s manifest1", argv[0], argv[1]); ok(CreateProcess(argv[0], cmdline, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi) != 0, "Could not create process: %u\n", GetLastError()); CloseHandle(pi.hThread); @@ -1005,14 +1103,24 @@ static void run_child_process(void) static void init_paths(void) { LPWSTR ptr; + WCHAR last; static const WCHAR dot_manifest[] = {'.','M','a','n','i','f','e','s','t',0}; + static const WCHAR backslash[] = {'\\',0}; + static const WCHAR subdir[] = {'T','e','s','t','S','u','b','d','i','r','\\',0}; GetModuleFileNameW(NULL, exe_path, sizeof(exe_path)/sizeof(WCHAR)); lstrcpyW(app_dir, exe_path); - for(ptr=app_dir+lstrlenW(app_dir); *ptr != '\\'; ptr--); + for(ptr=app_dir+lstrlenW(app_dir); *ptr != '\\' && *ptr != '/'; ptr--); ptr[1] = 0; + GetCurrentDirectoryW(MAX_PATH, work_dir); + last = work_dir[lstrlenW(work_dir) - 1]; + if (last != '\\' && last != '/') + lstrcatW(work_dir, backslash); + lstrcpyW(work_dir_subdir, work_dir); + lstrcatW(work_dir_subdir, subdir); + GetModuleFileNameW(NULL, app_manifest_path, sizeof(app_manifest_path)/sizeof(WCHAR)); lstrcpyW(app_manifest_path+lstrlenW(app_manifest_path), dot_manifest); } diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index e9f97f5a6f4..d115a570c5e 100644 --- a/dlls/kernel32/tests/file.c +++ b/dlls/kernel32/tests/file.c @@ -1377,6 +1377,43 @@ static void test_FindNextFileA(void) ok ( err == ERROR_NO_MORE_FILES, "GetLastError should return ERROR_NO_MORE_FILES\n"); } +static void test_FindFirstFileExA(void) +{ + WIN32_FIND_DATAA search_results; + HANDLE handle; + + CreateDirectoryA("test-dir", NULL); + _lclose(_lcreat("test-dir\\file1", 0)); + _lclose(_lcreat("test-dir\\file2", 0)); + CreateDirectoryA("test-dir\\dir1", NULL); + /* FindExLimitToDirectories is ignored */ + handle = FindFirstFileExA("test-dir\\*", FindExInfoStandard, &search_results, FindExSearchLimitToDirectories, NULL, 0); + ok(handle != INVALID_HANDLE_VALUE, "FindFirstFile failed (err=%u)\n", GetLastError()); + ok(strcmp(search_results.cFileName, ".") == 0, "First entry should be '.', is %s\n", search_results.cFileName); + +#define CHECK_NAME(fn) (strcmp((fn), "file1") == 0 || strcmp((fn), "file2") == 0 || strcmp((fn), "dir1") == 0) + + ok(FindNextFile(handle, &search_results), "Fetching second file failed\n"); + ok(strcmp(search_results.cFileName, "..") == 0, "Second entry should be '..' is %s\n", search_results.cFileName); + + ok(FindNextFile(handle, &search_results), "Fetching third file failed\n"); + ok(CHECK_NAME(search_results.cFileName), "Invalid thrid entry - %s\n", search_results.cFileName); + + ok(FindNextFile(handle, &search_results), "Fetching fourth file failed\n"); + ok(CHECK_NAME(search_results.cFileName), "Invalid fourth entry - %s\n", search_results.cFileName); + + ok(FindNextFile(handle, &search_results), "Fetching fifth file failed\n"); + ok(CHECK_NAME(search_results.cFileName), "Invalid fifth entry - %s\n", search_results.cFileName); + +#undef CHECK_NAME + + ok(FindNextFile(handle, &search_results) == FALSE, "Fetching sixth file should failed\n"); + DeleteFileA("test-dir\\file1"); + DeleteFileA("test-dir\\file2"); + RemoveDirectoryA("test-dir\\dir1"); + RemoveDirectoryA("test-dir"); +} + static int test_Mapfile_createtemp(HANDLE *handle) { SetFileAttributesA(filename,FILE_ATTRIBUTE_NORMAL); @@ -1839,6 +1876,7 @@ START_TEST(file) test_MoveFileW(); test_FindFirstFileA(); test_FindNextFileA(); + test_FindFirstFileExA(); test_LockFile(); test_file_sharing(); test_offset_in_overlapped_structure(); diff --git a/dlls/mpr/wnet.c b/dlls/mpr/wnet.c index 2fc8792ad26..36fb93cff59 100644 --- a/dlls/mpr/wnet.c +++ b/dlls/mpr/wnet.c @@ -1409,7 +1409,7 @@ DWORD WINAPI WNetGetResourceInformationW( LPNETRESOURCEW lpNetResource, DWORD ret = WN_NO_NETWORK; DWORD index; - TRACE( "(%p, %p, %p, %p): stub\n", + TRACE( "(%p, %p, %p, %p)\n", lpNetResource, lpBuffer, cbBuffer, lplpSystem); if (!(lpBuffer)) diff --git a/dlls/mshtml/install.c b/dlls/mshtml/install.c index 3890ac2b4f1..4acef19dcd5 100644 --- a/dlls/mshtml/install.c +++ b/dlls/mshtml/install.c @@ -251,22 +251,25 @@ static BOOL install_from_registered_dir(void) static BOOL install_from_default_dir(void) { - const char *data_dir; + const char *data_dir, *subdir; char *file_name; - int len; + int len, len2; BOOL ret; - static const char gecko_dir[] = "/gecko/"; - - data_dir = wine_get_data_dir(); - if(!data_dir) return FALSE; + if((data_dir = wine_get_data_dir())) + subdir = "/gecko/"; + else if((data_dir = wine_get_build_dir())) + subdir = "/../gecko/"; + else + return FALSE; len = strlen(data_dir); + len2 = strlen(subdir); - file_name = mshtml_alloc(len+sizeof(gecko_dir)+sizeof(GECKO_FILE_NAME)); + file_name = mshtml_alloc(len+len2+sizeof(GECKO_FILE_NAME)); memcpy(file_name, data_dir, len); - memcpy(file_name+len, gecko_dir, sizeof(gecko_dir)); - memcpy(file_name+len+sizeof(gecko_dir)-1, GECKO_FILE_NAME, sizeof(GECKO_FILE_NAME)); + memcpy(file_name+len, subdir, len2); + memcpy(file_name+len+len2, GECKO_FILE_NAME, sizeof(GECKO_FILE_NAME)); ret = install_from_unix_file(file_name); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index a493109854b..14ae1be8adf 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -16,6 +16,7 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "wingdi.h" #include "docobj.h" #include "mshtml.h" #include "mshtmhst.h" diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c index 4139d3b04c3..df2d6353b7d 100644 --- a/dlls/mshtml/selection.c +++ b/dlls/mshtml/selection.c @@ -153,8 +153,36 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac nsresult nsres; nsISelection_GetRangeCount(This->nsselection, &nsrange_cnt); - if(nsrange_cnt != 1) + if(!nsrange_cnt) { + nsIDOMDocument *nsdoc; + nsIDOMHTMLDocument *nshtmldoc; + nsIDOMHTMLElement *nsbody = NULL; + + TRACE("nsrange_cnt = 0\n"); + + nsres = nsIWebNavigation_GetDocument(This->doc->nscontainer->navigation, &nsdoc); + if(NS_FAILED(nsres) || !nsdoc) { + ERR("GetDocument failed: %08x\n", nsres); + return E_FAIL; + } + + nsIDOMDocument_QueryInterface(nsdoc, &IID_nsIDOMHTMLDocument, (void**)&nshtmldoc); + nsIDOMDocument_Release(nsdoc); + + nsres = nsIDOMHTMLDocument_GetBody(nshtmldoc, &nsbody); + nsIDOMHTMLDocument_Release(nshtmldoc); + if(NS_FAILED(nsres) || !nsbody) { + ERR("Could not get body: %08x\n", nsres); + return E_FAIL; + } + + nsres = nsISelection_Collapse(This->nsselection, (nsIDOMNode*)nsbody, 0); + nsIDOMHTMLElement_Release(nsbody); + if(NS_FAILED(nsres)) + ERR("Collapse failed: %08x\n", nsres); + }else if(nsrange_cnt > 1) { FIXME("range_cnt = %d\n", nsrange_cnt); + } nsres = nsISelection_GetRangeAt(This->nsselection, 0, &nsrange); if(NS_FAILED(nsres)) diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index bf9f499d2bb..3933ac8de94 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -539,6 +539,20 @@ static void _test_range_isequal(unsigned line, IHTMLTxtRange *range1, IHTMLTxtRa } } +#define test_range_parent(r,t) _test_range_parent(__LINE__,r,t) +static void _test_range_parent(unsigned line, IHTMLTxtRange *range, elem_type_t type) +{ + IHTMLElement *elem; + HRESULT hres; + + hres = IHTMLTxtRange_parentElement(range, &elem); + ok_(__FILE__,line) (hres == S_OK, "parentElement failed: %08x\n", hres); + + _test_elem_type(line, (IUnknown*)elem, type); + + IHTMLElement_Release(elem); +} + static void test_elem_collection(IHTMLElementCollection *col, const elem_type_t *elem_types, long exlen) { long len; @@ -695,6 +709,8 @@ static void test_txtrange(IHTMLDocument2 *doc) IHTMLElement *elem; IHTMLBodyElement *body; IHTMLTxtRange *body_range, *range, *range2; + IHTMLSelectionObject *selection; + IDispatch *disp_range; HRESULT hres; hres = IHTMLDocument2_get_body(doc, &elem); @@ -841,6 +857,24 @@ static void test_txtrange(IHTMLDocument2 *doc) IHTMLTxtRange_Release(range); IHTMLTxtRange_Release(body_range); + + hres = IHTMLDocument2_get_selection(doc, &selection); + ok(hres == S_OK, "IHTMLDocument2_get_selection failed: %08x\n", hres); + + hres = IHTMLSelectionObject_createRange(selection, &disp_range); + ok(hres == S_OK, "IHTMLSelectionObject_createRange failed: %08x\n", hres); + IHTMLSelectionObject_Release(selection); + + hres = IDispatch_QueryInterface(disp_range, &IID_IHTMLTxtRange, (void **)&range); + ok(hres == S_OK, "Could not get IID_IHTMLTxtRange interface: 0x%08x\n", hres); + IDispatch_Release(disp_range); + + test_range_text(range, NULL); + test_range_moveend(range, characterW, 3, 3); + test_range_text(range, "wor"); + test_range_parent(range, ET_BODY); + + IHTMLTxtRange_Release(range); } static void test_compatmode(IHTMLDocument2 *doc) diff --git a/dlls/mshtml/view.c b/dlls/mshtml/view.c index e5ef7a7419a..e24fa77adac 100644 --- a/dlls/mshtml/view.c +++ b/dlls/mshtml/view.c @@ -26,7 +26,6 @@ #include "windef.h" #include "winbase.h" #include "winuser.h" -#include "wingdi.h" #include "commctrl.h" #include "ole2.h" #include "resource.h" diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 0b3374d7edc..80caaac13ec 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -4757,12 +4757,13 @@ static UINT ACTION_InstallODBC( MSIPACKAGE *package ) #define check_flag_combo(x, y) ((x) & ~(y)) == (y) -static LONG env_set_flags( LPCWSTR *name, LPWSTR *value, DWORD *flags ) +static LONG env_set_flags( LPCWSTR *name, LPCWSTR *value, DWORD *flags ) { LPCWSTR cptr = *name; - LPWSTR ptr = *value; + LPCWSTR ptr = *value; static const WCHAR prefix[] = {'[','~',']',0}; + static const int prefix_len = 3; *flags = 0; while (*cptr) @@ -4790,18 +4791,18 @@ static LONG env_set_flags( LPCWSTR *name, LPWSTR *value, DWORD *flags ) return ERROR_FUNCTION_FAILED; } - if (!strncmpW(ptr, prefix, lstrlenW(prefix))) + if (!strncmpW(ptr, prefix, prefix_len)) { - *flags |= ENV_MOD_PREFIX; + *flags |= ENV_MOD_APPEND; *value += lstrlenW(prefix); } - else + else if (lstrlenW(*value) >= prefix_len) { - ptr += lstrlenW(ptr) - lstrlenW(prefix) - 1; + ptr += lstrlenW(ptr) - prefix_len; if (!lstrcmpW(ptr, prefix)) { - *flags |= ENV_MOD_APPEND; - *ptr = '\0'; + *flags |= ENV_MOD_PREFIX; + /* the "[~]" will be removed by deformat_string */; } } @@ -4823,7 +4824,7 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) MSIPACKAGE *package = param; LPCWSTR name, value, comp; LPWSTR data = NULL, newval = NULL; - LPWSTR deformatted, ptr; + LPWSTR deformatted = NULL, ptr; DWORD flags, type, size; LONG res; HKEY env = NULL, root = HKEY_CURRENT_USER; @@ -4840,14 +4841,17 @@ static UINT ITERATE_WriteEnvironmentString( MSIRECORD *rec, LPVOID param ) value = MSI_RecordGetString(rec, 3); comp = MSI_RecordGetString(rec, 4); - deformat_string(package, value, &deformatted); - if (!deformatted) - return ERROR_OUTOFMEMORY; - - res = env_set_flags(&name, &deformatted, &flags); + res = env_set_flags(&name, &value, &flags); if (res != ERROR_SUCCESS) goto done; + deformat_string(package, value, &deformatted); + if (!deformatted) + { + res = ERROR_OUTOFMEMORY; + goto done; + } + value = deformatted; if (flags & ENV_MOD_MACHINE) diff --git a/dlls/msi/streams.c b/dlls/msi/streams.c index 4a40a12e4ff..a4c0a529b53 100644 --- a/dlls/msi/streams.c +++ b/dlls/msi/streams.c @@ -280,8 +280,36 @@ static UINT STREAMS_get_column_info(struct tagMSIVIEW *view, static UINT STREAMS_modify(struct tagMSIVIEW *view, MSIMODIFY eModifyMode, MSIRECORD *rec, UINT row) { - FIXME("(%p, %d, %p): stub!\n", view, eModifyMode, rec); - return ERROR_SUCCESS; + UINT r; + + TRACE("%p %d %p\n", view, eModifyMode, rec); + + switch (eModifyMode) + { + case MSIMODIFY_INSERT: + r = STREAMS_insert_row(view, rec, FALSE); + break; + + case MSIMODIFY_VALIDATE_NEW: + case MSIMODIFY_INSERT_TEMPORARY: + case MSIMODIFY_UPDATE: + case MSIMODIFY_REFRESH: + case MSIMODIFY_ASSIGN: + case MSIMODIFY_REPLACE: + case MSIMODIFY_MERGE: + case MSIMODIFY_DELETE: + case MSIMODIFY_VALIDATE: + case MSIMODIFY_VALIDATE_FIELD: + case MSIMODIFY_VALIDATE_DELETE: + FIXME("%p %d %p - mode not implemented\n", view, eModifyMode, rec ); + r = ERROR_CALL_NOT_IMPLEMENTED; + break; + + default: + r = ERROR_INVALID_DATA; + } + + return r; } static UINT STREAMS_delete(struct tagMSIVIEW *view) diff --git a/dlls/msi/string.c b/dlls/msi/string.c index 0cacf1e64bd..fecd93f0346 100644 --- a/dlls/msi/string.c +++ b/dlls/msi/string.c @@ -457,20 +457,22 @@ UINT msi_strcmp( const string_table *st, UINT lval, UINT rval, UINT *res ) static void string_totalsize( const string_table *st, UINT *datasize, UINT *poolsize ) { - UINT i, len, max, holesize; + UINT i, len, holesize; if( st->strings[0].str || st->strings[0].persistent_refcount || st->strings[0].nonpersistent_refcount) ERR("oops. element 0 has a string\n"); *poolsize = 4; *datasize = 0; - max = 1; holesize = 0; for( i=1; imaxcount; i++ ) { if( !st->strings[i].persistent_refcount ) - continue; - if( st->strings[i].str ) + { + TRACE("[%u] nonpersistent = %s\n", i, debugstr_w(st->strings[i].str)); + (*poolsize) += 4; + } + else if( st->strings[i].str ) { TRACE("[%u] = %s\n", i, debugstr_w(st->strings[i].str)); len = WideCharToMultiByte( st->codepage, 0, @@ -480,7 +482,6 @@ static void string_totalsize( const string_table *st, UINT *datasize, UINT *pool (*datasize) += len; if (len>0xffff) (*poolsize) += 4; - max = i + 1; (*poolsize) += holesize + 4; holesize = 0; } @@ -634,7 +635,13 @@ UINT msi_save_string_table( const string_table *st, IStorage *storage ) for( i=1; imaxcount; i++ ) { if( !st->strings[i].persistent_refcount ) + { + pool[ n*2 ] = 0; + pool[ n*2 + 1] = 0; + n++; continue; + } + sz = datasize - used; r = msi_id2stringA( st, i, data+used, &sz ); if( r != ERROR_SUCCESS ) diff --git a/dlls/msi/table.c b/dlls/msi/table.c index c5850e3189a..a8170982451 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c @@ -1490,7 +1490,7 @@ static UINT table_validate_new( MSITABLEVIEW *tv, MSIRECORD *rec ) /* check there's no duplicate keys */ r = msi_table_find_row( tv, rec, &row ); if (r == ERROR_SUCCESS) - return ERROR_INVALID_DATA; + return ERROR_FUNCTION_FAILED; return ERROR_SUCCESS; } @@ -1560,7 +1560,7 @@ static UINT msi_table_update(struct tagMSIVIEW *view, MSIRECORD *rec, UINT row) if (r != ERROR_SUCCESS) { ERR("can't find row to modify\n"); - return ERROR_SUCCESS; + return ERROR_FUNCTION_FAILED; } /* the row cannot be changed */ diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 293cf0cf9f7..c620768e45c 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -791,10 +791,8 @@ static void test_viewmodify(void) ok(r == ERROR_SUCCESS, "MsiViewExecute failed\n"); /* should fail ... */ - todo_wine { r = MsiViewModify(hview, MSIMODIFY_INSERT_TEMPORARY, hrec ); ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n"); - } r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); @@ -843,10 +841,7 @@ static void test_viewmodify(void) ok(r == ERROR_SUCCESS, "MsiRecordSetInteger failed\n"); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); - todo_wine - { - ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n"); - } + ok(r == ERROR_FUNCTION_FAILED, "MsiViewModify failed\n"); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); @@ -894,10 +889,7 @@ static void test_viewmodify(void) ok(r == ERROR_SUCCESS, "failed to set string\n"); r = MsiViewModify(hview, MSIMODIFY_UPDATE, hrec); - todo_wine - { - ok(r == ERROR_FUNCTION_FAILED, "Expected ERROR_FUNCTION_FAILED, got %d\n", r); - } + ok(r == ERROR_FUNCTION_FAILED, "Expected ERROR_FUNCTION_FAILED, got %d\n", r); r = MsiCloseHandle(hrec); ok(r == ERROR_SUCCESS, "failed to close record\n"); @@ -4073,6 +4065,279 @@ static void test_viewmodify_update(void) ok(r == ERROR_SUCCESS, "MsiOpenDatabase close failed\n"); } +static const WCHAR data10[] = { /* MOO */ + 0x8001, 0x000b, +}; +static const WCHAR data11[] = { /* AAR */ + 0x8002, 0x8005, + 0x000c, 0x000f, +}; +static const char data12[] = /* _StringData */ + "MOOABAARCDonetwofourfive"; +static const WCHAR data13[] = { /* _StringPool */ +/* len, refs */ + 0, 0, /* string 0 '' */ + 0, 0, /* string 1 '' */ + 0, 0, /* string 2 '' */ + 0, 0, /* string 3 '' */ + 0, 0, /* string 4 '' */ + 3, 3, /* string 5 'MOO' */ + 1, 1, /* string 6 'A' */ + 1, 1, /* string 7 'B' */ + 3, 3, /* string 8 'AAR' */ + 1, 1, /* string 9 'C' */ + 1, 1, /* string a 'D' */ + 3, 1, /* string b 'one' */ + 3, 1, /* string c 'two' */ + 0, 0, /* string d '' */ + 4, 1, /* string e 'four' */ + 4, 1, /* string f 'five' */ +}; + +static void test_stringtable(void) +{ + MSIHANDLE hdb = 0, hview = 0, hrec = 0; + IStorage *stg = NULL; + IStream *stm; + WCHAR name[0x20]; + HRESULT hr; + const char *query; + char buffer[MAX_PATH]; + WCHAR data[MAX_PATH]; + DWORD sz, read; + UINT r; + + static const DWORD mode = STGM_DIRECT | STGM_READ | STGM_SHARE_DENY_WRITE; + static const WCHAR stringdata[] = {0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0}; /* _StringData */ + static const WCHAR stringpool[] = {0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0}; /* _StringPool */ + static const WCHAR moo[] = {0x4840, 0x3e16, 0x4818, 0}; /* MOO */ + static const WCHAR aar[] = {0x4840, 0x3a8a, 0x481b, 0}; /* AAR */ + + DeleteFile(msifile); + + r = MsiOpenDatabase(msifile, MSIDBOPEN_CREATE, &hdb); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + query = "CREATE TABLE `MOO` (`A` INT, `B` CHAR(72) PRIMARY KEY `A`)"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + query = "CREATE TABLE `AAR` (`C` INT, `D` CHAR(72) PRIMARY KEY `C`)"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + /* insert persistent row */ + query = "INSERT INTO `MOO` (`A`, `B`) VALUES (1, 'one')"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + /* insert persistent row */ + query = "INSERT INTO `AAR` (`C`, `D`) VALUES (2, 'two')"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + /* open a view */ + query = "SELECT * FROM `MOO`"; + r = MsiDatabaseOpenView(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + hrec = MsiCreateRecord(2); + + r = MsiRecordSetInteger(hrec, 1, 3); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = MsiRecordSetString(hrec, 2, "three"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + /* insert a nonpersistent row */ + r = MsiViewModify(hview, MSIMODIFY_INSERT_TEMPORARY, hrec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = MsiViewClose(hview); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = MsiCloseHandle(hview); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + /* insert persistent row */ + query = "INSERT INTO `MOO` (`A`, `B`) VALUES (4, 'four')"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + /* insert persistent row */ + query = "INSERT INTO `AAR` (`C`, `D`) VALUES (5, 'five')"; + r = run_query(hdb, 0, query); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiDatabaseCommit(hdb); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiCloseHandle(hdb); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiOpenDatabase(msifile, MSIDBOPEN_READONLY, &hdb); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + query = "SELECT * FROM `MOO`"; + r = MsiDatabaseOpenView(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiRecordGetFieldCount(hrec); + ok(r == 2, "Expected 2, got %d\n", r); + + r = MsiRecordGetInteger(hrec, 1); + ok(r == 1, "Expected 1, got %d\n", r); + + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 2, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "one"), "Expected one, got %s\n", buffer); + + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiViewFetch(hview, &hrec); + todo_wine + { + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + } + + r = MsiViewClose(hview); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = MsiCloseHandle(hview); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + query = "SELECT * FROM `AAR`"; + r = MsiDatabaseOpenView(hdb, query, &hview); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiViewExecute(hview, 0); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiRecordGetFieldCount(hrec); + ok(r == 2, "Expected 2, got %d\n", r); + + r = MsiRecordGetInteger(hrec, 1); + ok(r == 2, "Expected 2, got %d\n", r); + + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 2, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "two"), "Expected two, got %s\n", buffer); + + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiRecordGetFieldCount(hrec); + ok(r == 2, "Expected 2, got %d\n", r); + + r = MsiRecordGetInteger(hrec, 1); + ok(r == 5, "Expected 5, got %d\n", r); + + sz = sizeof(buffer); + r = MsiRecordGetString(hrec, 2, buffer, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmp(buffer, "five"), "Expected five, got %s\n", buffer); + + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + r = MsiViewFetch(hview, &hrec); + ok(r == ERROR_NO_MORE_ITEMS, "Expected ERROR_NO_MORE_ITEMS, got %d\n", r); + + r = MsiViewClose(hview); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = MsiCloseHandle(hview); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = MsiCloseHandle(hrec); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + r = MsiCloseHandle(hdb); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + MultiByteToWideChar(CP_ACP, 0, msifile, -1, name, 0x20); + hr = StgOpenStorage(name, NULL, mode, NULL, 0, &stg); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + ok(stg != NULL, "Expected non-NULL storage\n"); + + hr = IStorage_OpenStream(stg, moo, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + ok(stm != NULL, "Expected non-NULL stream\n"); + + hr = IStream_Read(stm, data, MAX_PATH, &read); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + todo_wine + { + ok(read == 4, "Expected 4, got %d\n", read); + ok(!memcmp(data, data10, read), "Unexpected data\n"); + } + + hr = IStream_Release(stm); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + + hr = IStorage_OpenStream(stg, aar, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + ok(stm != NULL, "Expected non-NULL stream\n"); + + hr = IStream_Read(stm, data, MAX_PATH, &read); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + ok(read == 8, "Expected 8, got %d\n", read); + todo_wine + { + ok(!memcmp(data, data11, read), "Unexpected data\n"); + } + + hr = IStream_Release(stm); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + + hr = IStorage_OpenStream(stg, stringdata, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + ok(stm != NULL, "Expected non-NULL stream\n"); + + hr = IStream_Read(stm, buffer, MAX_PATH, &read); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + ok(read == 24, "Expected 24, got %d\n", read); + ok(!memcmp(buffer, data12, read), "Unexpected data\n"); + + hr = IStream_Release(stm); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + + hr = IStorage_OpenStream(stg, stringpool, NULL, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &stm); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + ok(stm != NULL, "Expected non-NULL stream\n"); + + hr = IStream_Read(stm, data, MAX_PATH, &read); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + todo_wine + { + ok(read == 64, "Expected 64, got %d\n", read); + ok(!memcmp(data, data13, read), "Unexpected data\n"); + } + + hr = IStream_Release(stm); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + + hr = IStorage_Release(stg); + ok(hr == S_OK, "Expected S_OK, got %d\n", hr); + + DeleteFileA(msifile); +} + START_TEST(db) { test_msidatabase(); @@ -4098,4 +4363,5 @@ START_TEST(db) test_special_tables(); test_select_markers(); test_viewmodify_update(); + test_stringtable(); } diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index b1698862247..c00b8699e74 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -1006,12 +1006,16 @@ static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2) return FALSE; size = MAX_PATH; - if (RegQueryValueEx(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) + if (RegQueryValueExA(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) { + RegCloseKey(hkey); return FALSE; + } size = MAX_PATH; - if (RegQueryValueEx(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) + if (RegQueryValueExA(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) { + RegCloseKey(hkey); return FALSE; + } RegCloseKey(hkey); return TRUE; diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c index 2021cb8d714..fe83be63b82 100644 --- a/dlls/ntdll/actctx.c +++ b/dlls/ntdll/actctx.c @@ -1484,6 +1484,7 @@ static NTSTATUS parse_manifest( struct actctx_loader* acl, struct assembly_ident xmlbuf_t xmlbuf; NTSTATUS status; struct assembly *assembly; + int unicode_tests; TRACE( "parsing manifest loaded from %s base dir %s\n", debugstr_w(filename), debugstr_w(directory) ); @@ -1497,7 +1498,29 @@ static NTSTATUS parse_manifest( struct actctx_loader* acl, struct assembly_ident assembly->manifest.type = assembly->manifest.info ? ACTIVATION_CONTEXT_PATH_TYPE_WIN32_FILE : ACTIVATION_CONTEXT_PATH_TYPE_NONE; - if (!RtlIsTextUnicode( buffer, size, NULL )) + unicode_tests = IS_TEXT_UNICODE_SIGNATURE | IS_TEXT_UNICODE_REVERSE_SIGNATURE; + if (RtlIsTextUnicode( buffer, size, &unicode_tests )) + { + xmlbuf.ptr = buffer; + xmlbuf.end = xmlbuf.ptr + size / sizeof(WCHAR); + status = parse_manifest_buffer( acl, assembly, ai, &xmlbuf ); + } + else if (unicode_tests & IS_TEXT_UNICODE_REVERSE_SIGNATURE) + { + const WCHAR *buf = buffer; + WCHAR *new_buff; + unsigned int i; + + if (!(new_buff = RtlAllocateHeap( GetProcessHeap(), 0, size ))) + return STATUS_NO_MEMORY; + for (i = 0; i < size / sizeof(WCHAR); i++) + new_buff[i] = RtlUshortByteSwap( buf[i] ); + xmlbuf.ptr = new_buff; + xmlbuf.end = xmlbuf.ptr + size / sizeof(WCHAR); + status = parse_manifest_buffer( acl, assembly, ai, &xmlbuf ); + RtlFreeHeap( GetProcessHeap(), 0, new_buff ); + } + else { /* let's assume utf-8 for now */ int len = wine_utf8_mbstowcs( 0, buffer, size, NULL, 0 ); @@ -1516,12 +1539,6 @@ static NTSTATUS parse_manifest( struct actctx_loader* acl, struct assembly_ident status = parse_manifest_buffer( acl, assembly, ai, &xmlbuf ); RtlFreeHeap( GetProcessHeap(), 0, new_buff ); } - else - { - xmlbuf.ptr = buffer; - xmlbuf.end = xmlbuf.ptr + size / sizeof(WCHAR); - status = parse_manifest_buffer( acl, assembly, ai, &xmlbuf ); - } return status; } diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 894d3365cdf..9288d31f629 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -227,6 +227,60 @@ static char *get_default_lpt_device( int num ) /*********************************************************************** + * DIR_get_drives_info + * + * Retrieve device/inode number for all the drives. Helper for find_drive_root. + */ +unsigned int DIR_get_drives_info( struct drive_info info[MAX_DOS_DRIVES] ) +{ + static struct drive_info cache[MAX_DOS_DRIVES]; + static time_t last_update; + static unsigned int nb_drives; + unsigned int ret; + time_t now = time(NULL); + + RtlEnterCriticalSection( &dir_section ); + if (now != last_update) + { + const char *config_dir = wine_get_config_dir(); + char *buffer, *p; + struct stat st; + unsigned int i; + + if ((buffer = RtlAllocateHeap( GetProcessHeap(), 0, + strlen(config_dir) + sizeof("/dosdevices/a:") ))) + { + strcpy( buffer, config_dir ); + strcat( buffer, "/dosdevices/a:" ); + p = buffer + strlen(buffer) - 2; + + for (i = nb_drives = 0; i < MAX_DOS_DRIVES; i++) + { + *p = 'a' + i; + if (!stat( buffer, &st )) + { + cache[i].dev = st.st_dev; + cache[i].ino = st.st_ino; + nb_drives++; + } + else + { + cache[i].dev = 0; + cache[i].ino = 0; + } + } + RtlFreeHeap( GetProcessHeap(), 0, buffer ); + } + last_update = now; + } + memcpy( info, cache, sizeof(cache) ); + ret = nb_drives; + RtlLeaveCriticalSection( &dir_section ); + return ret; +} + + +/*********************************************************************** * parse_mount_entries * * Parse mount entries looking for a given device. Helper for get_default_drive_device. diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 05df50796e8..4f64421d642 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -29,6 +29,14 @@ #define MAX_NT_PATH_LENGTH 277 +#define MAX_DOS_DRIVES 26 + +struct drive_info +{ + dev_t dev; + ino_t ino; +}; + /* exceptions */ extern void wait_suspend( CONTEXT *context ); extern void WINAPI __regs_RtlRaiseException( PEXCEPTION_RECORD, PCONTEXT ); @@ -113,6 +121,7 @@ extern NTSTATUS FILE_GetNtStatus(void); extern BOOL DIR_is_hidden_file( const UNICODE_STRING *name ); extern NTSTATUS DIR_unmount_device( HANDLE handle ); extern NTSTATUS DIR_get_unix_cwd( char **cwd ); +extern unsigned int DIR_get_drives_info( struct drive_info info[MAX_DOS_DRIVES] ); /* virtual memory */ extern NTSTATUS VIRTUAL_HandleFault(LPCVOID addr); diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c index a42682dbf4b..db4cd102ecd 100644 --- a/dlls/ntdll/path.c +++ b/dlls/ntdll/path.c @@ -50,52 +50,6 @@ static const WCHAR UncPfxW[] = {'U','N','C','\\',0}; #define IS_SEPARATOR(ch) ((ch) == '\\' || (ch) == '/') -#define MAX_DOS_DRIVES 26 - -struct drive_info -{ - dev_t dev; - ino_t ino; -}; - -/*********************************************************************** - * get_drives_info - * - * Retrieve device/inode number for all the drives. Helper for find_drive_root. - */ -static inline int get_drives_info( struct drive_info info[MAX_DOS_DRIVES] ) -{ - const char *config_dir = wine_get_config_dir(); - char *buffer, *p; - struct stat st; - int i, ret; - - buffer = RtlAllocateHeap( GetProcessHeap(), 0, strlen(config_dir) + sizeof("/dosdevices/a:") ); - if (!buffer) return 0; - strcpy( buffer, config_dir ); - strcat( buffer, "/dosdevices/a:" ); - p = buffer + strlen(buffer) - 2; - - for (i = ret = 0; i < MAX_DOS_DRIVES; i++) - { - *p = 'a' + i; - if (!stat( buffer, &st )) - { - info[i].dev = st.st_dev; - info[i].ino = st.st_ino; - ret++; - } - else - { - info[i].dev = 0; - info[i].ino = 0; - } - } - RtlFreeHeap( GetProcessHeap(), 0, buffer ); - return ret; -} - - /*********************************************************************** * remove_last_componentA * @@ -149,7 +103,7 @@ static NTSTATUS find_drive_rootA( LPCSTR *ppath, unsigned int len, int *drive_re struct drive_info info[MAX_DOS_DRIVES]; /* get device and inode of all drives */ - if (!get_drives_info( info )) return STATUS_OBJECT_PATH_NOT_FOUND; + if (!DIR_get_drives_info( info )) return STATUS_OBJECT_PATH_NOT_FOUND; /* strip off trailing slashes */ while (len > 1 && path[len - 1] == '/') len--; @@ -240,7 +194,7 @@ static int find_drive_rootW( LPCWSTR *ppath ) struct drive_info info[MAX_DOS_DRIVES]; /* get device and inode of all drives */ - if (!get_drives_info( info )) return -1; + if (!DIR_get_drives_info( info )) return -1; /* strip off trailing slashes */ lenW = strlenW(path); @@ -855,7 +809,7 @@ DWORD WINAPI RtlGetFullPathName_U(const WCHAR* name, ULONG size, WCHAR* buffer, { LPWSTR tmp = RtlAllocateHeap(GetProcessHeap(), 0, reqsize); reqsize = get_full_path_helper(name, tmp, reqsize); - if (reqsize > size) /* it may have worked the second time */ + if (reqsize + sizeof(WCHAR) > size) /* it may have worked the second time */ { RtlFreeHeap(GetProcessHeap(), 0, tmp); return reqsize + sizeof(WCHAR); diff --git a/dlls/ole32/tests/ole2.c b/dlls/ole32/tests/ole2.c index 6732c1330bd..4eb6be6898b 100644 --- a/dlls/ole32/tests/ole2.c +++ b/dlls/ole32/tests/ole2.c @@ -1175,7 +1175,7 @@ static void test_data_cache(void) fmtetc.cfFormat = CF_METAFILEPICT; stgmedium.tymed = TYMED_MFPICT; U(stgmedium).hMetaFilePict = OleMetafilePictFromIconAndLabel( - LoadIcon(NULL, MAKEINTRESOURCE(IDI_APPLICATION)), wszPath, wszPath, 0); + LoadIcon(NULL, IDI_APPLICATION), wszPath, wszPath, 0); stgmedium.pUnkForRelease = NULL; fmtetc.dwAspect = DVASPECT_CONTENT; diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 81fe9b2ba40..eabaa8d1311 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2431,7 +2431,9 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, SendMessageW(editor->hWnd, EM_UNDO, 0, 0); return 0; } - if (((unsigned)wstr)>=' ' || wstr=='\r' || wstr=='\t') { + if (((unsigned)wstr)>=' ' + || (wstr=='\r' && (GetWindowLongW(hWnd, GWL_STYLE) & ES_MULTILINE)) + || wstr=='\t') { /* FIXME maybe it would make sense to call EM_REPLACESEL instead ? */ /* WM_CHAR is restricted to nTextLimit */ int from, to; diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index 5375d305868..90899e058ea 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -2058,6 +2058,56 @@ static void test_unicode_conversions(void) DestroyWindow(hwnd); } +static void test_WM_CHAR(void) +{ + HWND hwnd; + int ret; + const char * char_list = "abc\rabc\r"; + const char * expected_content_single = "abcabc"; + const char * expected_content_multi = "abc\r\nabc\r\n"; + char buffer[64] = {0}; + const char * p; + + /* single-line control must IGNORE carriage returns */ + hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP, + 0, 0, 200, 60, 0, 0, 0, 0); + ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError()); + + p = char_list; + while (*p != '\0') { + SendMessageA(hwnd, WM_KEYDOWN, *p, 1); + ret = SendMessageA(hwnd, WM_CHAR, *p, 1); + ok(ret == 0, "WM_CHAR('%c') ret=%d\n", *p, ret); + SendMessageA(hwnd, WM_KEYUP, *p, 1); + p++; + } + + SendMessage(hwnd, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer); + ret = strcmp(buffer, expected_content_single); + ok(ret == 0, "WM_GETTEXT recovered incorrect string!\n"); + + DestroyWindow(hwnd); + + /* multi-line control inserts CR normally */ + hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP|ES_MULTILINE, + 0, 0, 200, 60, 0, 0, 0, 0); + ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError()); + + p = char_list; + while (*p != '\0') { + SendMessageA(hwnd, WM_KEYDOWN, *p, 1); + ret = SendMessageA(hwnd, WM_CHAR, *p, 1); + ok(ret == 0, "WM_CHAR('%c') ret=%d\n", *p, ret); + SendMessageA(hwnd, WM_KEYUP, *p, 1); + p++; + } + + SendMessage(hwnd, WM_GETTEXT, sizeof(buffer), (LPARAM)buffer); + ret = strcmp(buffer, expected_content_multi); + ok(ret == 0, "WM_GETTEXT recovered incorrect string!\n"); + + DestroyWindow(hwnd); +} static void test_EM_GETTEXTLENGTHEX(void) { @@ -2205,6 +2255,7 @@ START_TEST( editor ) hmoduleRichEdit = LoadLibrary("RICHED20.DLL"); ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError()); + test_WM_CHAR(); test_EM_FINDTEXT(); test_EM_GETLINE(); test_EM_SCROLLCARET(); diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index d8ecff09662..97f2e234d6f 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -48,6 +48,14 @@ midl_user_free(void __RPC_FAR *p) free(p); } +static char * +xstrdup(const char *s) +{ + char *d = HeapAlloc(GetProcessHeap(), 0, strlen(s) + 1); + strcpy(d, s); + return d; +} + int s_int_return(void) { @@ -264,6 +272,26 @@ s_square_puint(puint_t p) } int +s_sum_puints(puints_t *p) +{ + int sum = 0; + int i; + for (i = 0; i < p->n; ++i) + sum += atoi(p->ps[i]); + return sum; +} + +int +s_sum_cpuints(cpuints_t *p) +{ + int sum = 0; + int i; + for (i = 0; i < p->n; ++i) + sum += atoi(p->ps[i]); + return sum; +} + +int s_dot_copy_vectors(vector_t u, vector_t v) { return u.x * v.x + u.y * v.y + u.z * v.z; @@ -724,9 +752,35 @@ pointer_tests(void) test_list_t *list = make_list(make_list(make_list(null_list()))); test_us_t tus = {{p1}}; int *pa[4]; + puints_t pus; + cpuints_t cpus; ok(test_list_length(list) == 3, "RPC test_list_length\n"); ok(square_puint(p1) == 121, "RPC square_puint\n"); + pus.n = 4; + pus.ps = HeapAlloc(GetProcessHeap(), 0, pus.n * sizeof pus.ps[0]); + pus.ps[0] = xstrdup("5"); + pus.ps[1] = xstrdup("6"); + pus.ps[2] = xstrdup("7"); + pus.ps[3] = xstrdup("8"); + ok(sum_puints(&pus) == 26, "RPC sum_puints\n"); + HeapFree(GetProcessHeap(), 0, pus.ps[0]); + HeapFree(GetProcessHeap(), 0, pus.ps[1]); + HeapFree(GetProcessHeap(), 0, pus.ps[2]); + HeapFree(GetProcessHeap(), 0, pus.ps[3]); + HeapFree(GetProcessHeap(), 0, pus.ps); + cpus.n = 4; + cpus.ps = HeapAlloc(GetProcessHeap(), 0, cpus.n * sizeof cpus.ps[0]); + cpus.ps[0] = xstrdup("5"); + cpus.ps[1] = xstrdup("6"); + cpus.ps[2] = xstrdup("7"); + cpus.ps[3] = xstrdup("8"); + ok(sum_cpuints(&cpus) == 26, "RPC sum_puints\n"); + HeapFree(GetProcessHeap(), 0, cpus.ps[0]); + HeapFree(GetProcessHeap(), 0, cpus.ps[1]); + HeapFree(GetProcessHeap(), 0, cpus.ps[2]); + HeapFree(GetProcessHeap(), 0, cpus.ps[3]); + HeapFree(GetProcessHeap(), 0, cpus.ps); ok(square_test_us(&tus) == 121, "RPC square_test_us\n"); pa[0] = &a[0]; diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl index 6233a1fd7dc..807bf449817 100644 --- a/dlls/rpcrt4/tests/server.idl +++ b/dlls/rpcrt4/tests/server.idl @@ -153,6 +153,22 @@ cpp_quote("#endif") typedef [wire_marshal(int)] void *puint_t; int square_puint(puint_t p); + + typedef struct + { + [size_is(n)] puint_t *ps; + int n; + } puints_t; + + /* Same thing as puints_t, but make it complex (needs padding). */ + typedef struct + { + [size_is(n)] puint_t *ps; + char n; + } cpuints_t; + + int sum_puints(puints_t *p); + int sum_cpuints(cpuints_t *p); int dot_copy_vectors(vector_t u, vector_t v); typedef struct wire_us *wire_us_t; diff --git a/dlls/rsaenh/tests/rsaenh.c b/dlls/rsaenh/tests/rsaenh.c index 163aa5e6a49..076467efa2a 100644 --- a/dlls/rsaenh/tests/rsaenh.c +++ b/dlls/rsaenh/tests/rsaenh.c @@ -1546,7 +1546,7 @@ static void test_schannel_provider(void) static void test_enum_container(void) { - BYTE abContainerName[256]; + BYTE abContainerName[MAX_PATH + 2]; /* Larger than maximum name len */ DWORD dwBufferLen; BOOL result, fFound = FALSE; diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index b974f8d63d9..63f81f39b8f 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -97,7 +97,7 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) /* Return the path to the executable */ DWORD len, size=16; - hargv=GlobalAlloc(size, 0); + hargv=GlobalAlloc(0, size); argv=GlobalLock(hargv); for (;;) { diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index 21ae519cf84..d3fb7c3e4ad 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -128,10 +128,8 @@ HRESULT WINAPI SHCoCreateInstance( const WCHAR sInProcServer32[16] ={'\\','I','n','p','r','o','c','S','e','r','v','e','r','3','2','\0'}; const WCHAR sLoadWithoutCOM[15] ={'L','o','a','d','W','i','t','h','o','u','t','C','O','M','\0'}; WCHAR sDllPath[MAX_PATH]; - HKEY hKey; + HKEY hKey = 0; DWORD dwSize; - BOOLEAN bLoadFromShell32 = FALSE; - BOOLEAN bLoadWithoutCOM = FALSE; IClassFactory * pcf = NULL; if(!ppv) return E_POINTER; @@ -148,42 +146,33 @@ HRESULT WINAPI SHCoCreateInstance( TRACE("(%p,%s,unk:%p,%s,%p)\n", aclsid,shdebugstr_guid(myclsid),pUnkOuter,shdebugstr_guid(refiid),ppv); + if (SUCCEEDED(DllGetClassObject(myclsid, &IID_IClassFactory,(LPVOID*)&pcf))) + { + hres = IClassFactory_CreateInstance(pcf, pUnkOuter, refiid, ppv); + IClassFactory_Release(pcf); + goto end; + } + /* we look up the dll path in the registry */ __SHGUIDToStringW(myclsid, sClassID); lstrcpyW(sKeyName, sCLSID); lstrcatW(sKeyName, sClassID); lstrcatW(sKeyName, sInProcServer32); - if (ERROR_SUCCESS == RegOpenKeyExW(HKEY_CLASSES_ROOT, sKeyName, 0, KEY_READ, &hKey)) { - dwSize = sizeof(sDllPath); - SHQueryValueExW(hKey, NULL, 0,0, sDllPath, &dwSize ); - - /* if a special registry key is set, we load a shell extension without help of OLE32 */ - bLoadWithoutCOM = (ERROR_SUCCESS == SHQueryValueExW(hKey, sLoadWithoutCOM, 0, 0, 0, 0)); - - /* if the com object is inside shell32, omit use of ole32 */ - bLoadFromShell32 = (0==lstrcmpiW( PathFindFileNameW(sDllPath), sShell32)); - - RegCloseKey (hKey); - } else { - /* since we can't find it in the registry we try internally */ - bLoadFromShell32 = TRUE; - } - - TRACE("WithoutCom=%u FromShell=%u\n", bLoadWithoutCOM, bLoadFromShell32); - - /* now we create an instance */ - if (bLoadFromShell32) { - if (! SUCCEEDED(DllGetClassObject(myclsid, &IID_IClassFactory,(LPVOID*)&pcf))) { - ERR("LoadFromShell failed for CLSID=%s\n", shdebugstr_guid(myclsid)); - } - } else if (bLoadWithoutCOM) { + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, sKeyName, 0, KEY_READ, &hKey)) + return E_ACCESSDENIED; + /* if a special registry key is set, we load a shell extension without help of OLE32 */ + if (!SHQueryValueExW(hKey, sLoadWithoutCOM, 0, 0, 0, 0)) + { /* load an external dll without ole32 */ HANDLE hLibrary; typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv); DllGetClassObjectFunc DllGetClassObject; + dwSize = sizeof(sDllPath); + SHQueryValueExW(hKey, NULL, 0,0, sDllPath, &dwSize ); + if ((hLibrary = LoadLibraryExW(sDllPath, 0, LOAD_WITH_ALTERED_SEARCH_PATH)) == 0) { ERR("couldn't load InprocServer32 dll %s\n", debugstr_w(sDllPath)); hres = E_ACCESSDENIED; @@ -198,19 +187,16 @@ HRESULT WINAPI SHCoCreateInstance( goto end; } + hres = IClassFactory_CreateInstance(pcf, pUnkOuter, refiid, ppv); + IClassFactory_Release(pcf); } else { /* load an external dll in the usual way */ hres = CoCreateInstance(myclsid, pUnkOuter, CLSCTX_INPROC_SERVER, refiid, ppv); - goto end; } - /* here we should have a ClassFactory */ - if (!pcf) return E_ACCESSDENIED; - - hres = IClassFactory_CreateInstance(pcf, pUnkOuter, refiid, ppv); - IClassFactory_Release(pcf); end: + if (hKey) RegCloseKey(hKey); if(hres!=S_OK) { ERR("failed (0x%08x) to create CLSID:%s IID:%s\n", diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c index a4f4ade3cc3..f780037c3a6 100644 --- a/dlls/shell32/shfldr_unixfs.c +++ b/dlls/shell32/shfldr_unixfs.c @@ -369,36 +369,6 @@ static inline BOOL UNIXFS_is_pidl_of_type(LPITEMIDLIST pIDL, SHCONTF fFilter) { } /****************************************************************************** - * UNIXFS_is_dos_device [Internal] - * - * Determines if a unix directory corresponds to any dos device. - * - * PARAMS - * statPath [I] The stat struct of the directory, as returned by stat(2). - * - * RETURNS - * TRUE, if statPath corresponds to any dos drive letter - * FALSE, otherwise - */ -static BOOL UNIXFS_is_dos_device(const struct stat *statPath) { - struct stat statDrive; - char *pszDrivePath; - DWORD dwDriveMap; - WCHAR wszDosDevice[4] = { 'A', ':', '\\', 0 }; - - for (dwDriveMap = GetLogicalDrives(); dwDriveMap; dwDriveMap >>= 1, wszDosDevice[0]++) { - if (!(dwDriveMap & 0x1)) continue; - pszDrivePath = wine_get_unix_file_name(wszDosDevice); - if (pszDrivePath && !stat(pszDrivePath, &statDrive)) { - HeapFree(GetProcessHeap(), 0, pszDrivePath); - if ((statPath->st_dev == statDrive.st_dev) && (statPath->st_ino == statDrive.st_ino)) - return TRUE; - } - } - return FALSE; -} - -/****************************************************************************** * UNIXFS_get_unix_path [Internal] * * Convert an absolute dos path to an absolute unix path. @@ -733,9 +703,9 @@ static HRESULT UNIXFS_initialize_target_folder(UnixFolder *This, const char *szB { LPCITEMIDLIST current = pidlSubFolder; DWORD dwPathLen = strlen(szBasePath)+1; - struct stat statPrefix; char *pNextDir; - + WCHAR *dos_name; + /* Determine the path's length bytes */ while (current && current->mkid.cb) { dwPathLen += UNIXFS_filename_from_shitemid(current, NULL) + 1; /* For the '/' */ @@ -755,23 +725,20 @@ static HRESULT UNIXFS_initialize_target_folder(UnixFolder *This, const char *szB pNextDir += strlen(szBasePath); if (This->m_dwPathMode == PATHMODE_UNIX || IsEqualCLSID(&CLSID_MyDocuments, This->m_pCLSID)) This->m_dwAttributes |= SFGAO_FILESYSTEM; - if (!(This->m_dwAttributes & SFGAO_FILESYSTEM)) { - *pNextDir = '\0'; - if (!stat(This->m_pszPath, &statPrefix) && UNIXFS_is_dos_device(&statPrefix)) - This->m_dwAttributes |= SFGAO_FILESYSTEM; - } while (current && current->mkid.cb) { pNextDir += UNIXFS_filename_from_shitemid(current, pNextDir); - if (!(This->m_dwAttributes & SFGAO_FILESYSTEM)) { - *pNextDir = '\0'; - if (!stat(This->m_pszPath, &statPrefix) && UNIXFS_is_dos_device(&statPrefix)) - This->m_dwAttributes |= SFGAO_FILESYSTEM; - } *pNextDir++ = '/'; current = ILGetNext(current); } *pNextDir='\0'; - + + if (!(This->m_dwAttributes & SFGAO_FILESYSTEM) && + ((dos_name = wine_get_dos_file_name(This->m_pszPath)))) + { + This->m_dwAttributes |= SFGAO_FILESYSTEM; + HeapFree( GetProcessHeap(), 0, dos_name ); + } + return S_OK; } @@ -1050,11 +1017,13 @@ static HRESULT WINAPI UnixFolder_IShellFolder2_GetAttributesOf(IShellFolder2* if pszRelativePath = szAbsolutePath + lstrlenA(szAbsolutePath); for (i=0; im_dwAttributes & SFGAO_FILESYSTEM)) { - struct stat fileStat; + WCHAR *dos_name; if (!UNIXFS_filename_from_shitemid(apidl[i], pszRelativePath)) return E_INVALIDARG; - if (stat(szAbsolutePath, &fileStat) || !UNIXFS_is_dos_device(&fileStat)) + if (!(dos_name = wine_get_dos_file_name( szAbsolutePath ))) *rgfInOut &= ~SFGAO_FILESYSTEM; + else + HeapFree( GetProcessHeap(), 0, dos_name ); } if (_ILIsFolder(apidl[i])) *rgfInOut |= SFGAO_FOLDER|SFGAO_HASSUBFOLDER|SFGAO_FILESYSANCESTOR; diff --git a/dlls/shell32/tests/systray.c b/dlls/shell32/tests/systray.c index b80b1090907..9c97a4e2759 100644 --- a/dlls/shell32/tests/systray.c +++ b/dlls/shell32/tests/systray.c @@ -83,7 +83,7 @@ START_TEST(systray) wc.cbWndExtra = 0; wc.hInstance = GetModuleHandleA(NULL); wc.hIcon = NULL; - wc.hCursor = LoadCursorA(NULL, MAKEINTRESOURCEA(IDC_IBEAM)); + wc.hCursor = LoadCursorA(NULL, IDC_IBEAM); wc.hbrBackground = GetSysColorBrush(COLOR_WINDOW); wc.lpszMenuName = NULL; wc.lpszClassName = "MyTestWnd"; diff --git a/dlls/spoolss/spoolss.spec b/dlls/spoolss/spoolss.spec index 2f893d51427..d873d7534fb 100644 --- a/dlls/spoolss/spoolss.spec +++ b/dlls/spoolss/spoolss.spec @@ -14,7 +14,7 @@ @ stub AddPrinterW @ stdcall AllocSplStr(wstr) @ stub AppendPrinterNotifyInfoData -@ stub BuildOtherNamesFromMachineName +@ stdcall BuildOtherNamesFromMachineName(ptr ptr) @ stub CallDrvDevModeConversion @ stub CallRouterFindFirstPrinterChangeNotification @ stub ClosePrinter diff --git a/dlls/spoolss/spoolss_main.c b/dlls/spoolss/spoolss_main.c index 9a9ec4893e6..2fee59ea2a9 100644 --- a/dlls/spoolss/spoolss_main.c +++ b/dlls/spoolss/spoolss_main.c @@ -80,6 +80,18 @@ LPWSTR WINAPI AllocSplStr(LPCWSTR pwstr) } /****************************************************************** + * BuildOtherNamesFromMachineName [SPOOLSS.@] + */ +BOOL WINAPI BuildOtherNamesFromMachineName(LPVOID * ptr1, LPVOID * ptr2) +{ + FIXME("(%p, %p) stub\n", ptr1, ptr2); + + *ptr1 = NULL; + *ptr2 = NULL; + return FALSE; +} + +/****************************************************************** * DllAllocSplMem [SPOOLSS.@] * * Allocate cleared memory from the spooler heap @@ -163,7 +175,7 @@ BOOL WINAPI ImpersonatePrinterClient(HANDLE hToken) HANDLE WINAPI RevertToPrinterSelf(void) { FIXME("() stub\n"); - return NULL; + return (HANDLE) 0xdead0947; } /****************************************************************** diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index b11bf10e645..6ea843ecc97 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -65,9 +65,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(edit); WINE_DECLARE_DEBUG_CHANNEL(combo); WINE_DECLARE_DEBUG_CHANNEL(relay); -#define BUFLIMIT_MULTI 65534 /* maximum buffer size (not including '\0') - FIXME: BTW, new specs say 65535 (do you dare ???) */ -#define BUFLIMIT_SINGLE 32766 /* maximum buffer size (not including '\0') */ +#define BUFLIMIT_INITIAL 30000 /* initial buffer size */ #define GROWLENGTH 32 /* buffers granularity in bytes: must be power of 2 */ #define ROUND_TO_GROW(size) (((size) + (GROWLENGTH - 1)) & ~(GROWLENGTH - 1)) #define HSCROLL_FRACTION 3 /* scroll window by 1/3 width */ @@ -247,7 +245,7 @@ static LRESULT EDIT_EM_Scroll(EDITSTATE *es, INT action); static void EDIT_EM_ScrollCaret(EDITSTATE *es); static void EDIT_EM_SetHandle(EDITSTATE *es, HLOCAL hloc); static void EDIT_EM_SetHandle16(EDITSTATE *es, HLOCAL16 hloc); -static void EDIT_EM_SetLimitText(EDITSTATE *es, INT limit); +static void EDIT_EM_SetLimitText(EDITSTATE *es, UINT limit); static void EDIT_EM_SetMargins(EDITSTATE *es, INT action, WORD left, WORD right, BOOL repaint); static void EDIT_EM_SetPasswordChar(EDITSTATE *es, WCHAR c); static void EDIT_EM_SetSel(EDITSTATE *es, UINT start, UINT end, BOOL after_wrap); @@ -650,7 +648,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg, case EM_LIMITTEXT16: case EM_SETLIMITTEXT: - EDIT_EM_SetLimitText(es, (INT)wParam); + EDIT_EM_SetLimitText(es, wParam); break; case EM_CANUNDO16: @@ -3203,7 +3201,7 @@ static void EDIT_EM_ReplaceSel(EDITSTATE *es, BOOL can_undo, LPCWSTR lpsz_replac /* Issue the EN_MAXTEXT notification and continue with replacing text * such that buffer limit is honored. */ - if ((honor_limit) && (es->buffer_limit > 0) && (size > es->buffer_limit)) { + if ((honor_limit) && (size > es->buffer_limit)) { EDIT_NOTIFY_PARENT(es, EN_MAXTEXT); strl = es->buffer_limit - (tl - (e-s)); } @@ -3649,27 +3647,14 @@ static void EDIT_EM_SetHandle16(EDITSTATE *es, HLOCAL16 hloc) * * EM_SETLIMITTEXT * - * FIXME: in WinNT maxsize is 0x7FFFFFFF / 0xFFFFFFFF - * However, the windows version is not complied to yet in all of edit.c + * NOTE: this version currently implements WinNT limits * - * Additionally as the wrapper for RichEdit controls we need larger buffers - * at present -1 will represent nolimit */ -static void EDIT_EM_SetLimitText(EDITSTATE *es, INT limit) +static void EDIT_EM_SetLimitText(EDITSTATE *es, UINT limit) { - if (limit == 0xFFFFFFFF) - es->buffer_limit = -1; - else if (es->style & ES_MULTILINE) { - if (limit) - es->buffer_limit = min(limit, BUFLIMIT_MULTI); - else - es->buffer_limit = BUFLIMIT_MULTI; - } else { - if (limit) - es->buffer_limit = min(limit, BUFLIMIT_SINGLE); - else - es->buffer_limit = BUFLIMIT_SINGLE; - } + if (!limit) limit = ~0u; + if (!(es->style & ES_MULTILINE)) limit = min(limit, 0x7ffffffe); + es->buffer_limit = limit; } @@ -4792,7 +4777,7 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode) es->style &= ~ES_UPPERCASE; } if (es->style & ES_MULTILINE) { - es->buffer_limit = BUFLIMIT_MULTI; + es->buffer_limit = BUFLIMIT_INITIAL; if (es->style & WS_VSCROLL) es->style |= ES_AUTOVSCROLL; if (es->style & WS_HSCROLL) @@ -4806,7 +4791,7 @@ static LRESULT EDIT_WM_NCCreate(HWND hwnd, LPCREATESTRUCTW lpcs, BOOL unicode) es->style &= ~ES_AUTOHSCROLL; } } else { - es->buffer_limit = BUFLIMIT_SINGLE; + es->buffer_limit = BUFLIMIT_INITIAL; if ((es->style & ES_RIGHT) && (es->style & ES_CENTER)) es->style &= ~ES_CENTER; es->style &= ~WS_HSCROLL; diff --git a/dlls/user32/listbox.c b/dlls/user32/listbox.c index fad5a4831ff..0a39582b6fe 100644 --- a/dlls/user32/listbox.c +++ b/dlls/user32/listbox.c @@ -300,6 +300,9 @@ static void LISTBOX_UpdateScroll( LB_DESCR *descr ) static LRESULT LISTBOX_SetTopItem( LB_DESCR *descr, INT index, BOOL scroll ) { INT max = LISTBOX_GetMaxTopIndex( descr ); + + TRACE("setting top item %d, scroll %d\n", index, scroll); + if (index > max) index = max; if (index < 0) index = 0; if (descr->style & LBS_MULTICOLUMN) index -= index % descr->page_size; @@ -473,6 +476,8 @@ static LRESULT LISTBOX_GetItemRect( LB_DESCR *descr, INT index, RECT *rect ) rect->right += descr->horz_pos; } + TRACE("item %d, rect %s\n", index, wine_dbgstr_rect(rect)); + return ((rect->left < descr->width) && (rect->right > 0) && (rect->top < descr->height) && (rect->bottom > 0)); } @@ -680,7 +685,7 @@ static void LISTBOX_RepaintItem( LB_DESCR *descr, INT index, UINT action ) if (!IsWindowEnabled(descr->self)) SetTextColor( hdc, GetSysColor( COLOR_GRAYTEXT ) ); SetWindowOrgEx( hdc, descr->horz_pos, 0, NULL ); - LISTBOX_PaintItem( descr, hdc, &rect, index, action, FALSE ); + LISTBOX_PaintItem( descr, hdc, &rect, index, action, TRUE ); if (oldFont) SelectObject( hdc, oldFont ); if (oldBrush) SelectObject( hdc, oldBrush ); ReleaseDC( descr->self, hdc ); @@ -688,6 +693,33 @@ static void LISTBOX_RepaintItem( LB_DESCR *descr, INT index, UINT action ) /*********************************************************************** + * LISTBOX_DrawFocusRect + */ +static void LISTBOX_DrawFocusRect( LB_DESCR *descr, BOOL on ) +{ + HDC hdc; + RECT rect; + HFONT oldFont = 0; + + /* Do not repaint the item if the item is not visible */ + if (!IsWindowVisible(descr->self)) return; + + if (descr->focus_item == -1) return; + if (!descr->caret_on || !descr->in_focus) return; + + if (LISTBOX_GetItemRect( descr, descr->focus_item, &rect ) != 1) return; + if (!(hdc = GetDCEx( descr->self, 0, DCX_CACHE ))) return; + if (descr->font) oldFont = SelectObject( hdc, descr->font ); + if (!IsWindowEnabled(descr->self)) + SetTextColor( hdc, GetSysColor( COLOR_GRAYTEXT ) ); + SetWindowOrgEx( hdc, descr->horz_pos, 0, NULL ); + LISTBOX_PaintItem( descr, hdc, &rect, descr->focus_item, ODA_FOCUS, on ? FALSE : TRUE ); + if (oldFont) SelectObject( hdc, oldFont ); + ReleaseDC( descr->self, hdc ); +} + + +/*********************************************************************** * LISTBOX_InitStorage */ static LRESULT LISTBOX_InitStorage( LB_DESCR *descr, INT nb_items ) @@ -1317,6 +1349,8 @@ static void LISTBOX_MakeItemVisible( LB_DESCR *descr, INT index, BOOL fully ) { INT top; + TRACE("current top item %d, index %d, fully %d\n", descr->top_item, index, fully); + if (index <= descr->top_item) top = index; else if (descr->style & LBS_MULTICOLUMN) { @@ -1354,16 +1388,17 @@ static LRESULT LISTBOX_SetCaretIndex( LB_DESCR *descr, INT index, BOOL fully_vis { INT oldfocus = descr->focus_item; + TRACE("old focus %d, index %d\n", oldfocus, index); + if (descr->style & LBS_NOSEL) return LB_ERR; if ((index < 0) || (index >= descr->nb_items)) return LB_ERR; if (index == oldfocus) return LB_OKAY; + + LISTBOX_DrawFocusRect( descr, FALSE ); descr->focus_item = index; - if ((oldfocus != -1) && descr->caret_on && (descr->in_focus)) - LISTBOX_RepaintItem( descr, oldfocus, ODA_FOCUS ); LISTBOX_MakeItemVisible( descr, index, fully_visible ); - if (descr->caret_on && (descr->in_focus)) - LISTBOX_RepaintItem( descr, index, ODA_FOCUS ); + LISTBOX_DrawFocusRect( descr, TRUE ); return LB_OKAY; } @@ -1439,8 +1474,8 @@ static LRESULT LISTBOX_SetSelection( LB_DESCR *descr, INT index, if (index == oldsel) return LB_OKAY; if (oldsel != -1) descr->items[oldsel].selected = FALSE; if (index != -1) descr->items[index].selected = TRUE; - descr->selected_item = index; if (oldsel != -1) LISTBOX_RepaintItem( descr, oldsel, ODA_SELECT ); + descr->selected_item = index; if (index != -1) LISTBOX_RepaintItem( descr, index, ODA_SELECT ); if (send_notify && descr->nb_items) SEND_NOTIFICATION( descr, (index != -1) ? LBN_SELCHANGE : LBN_SELCANCEL ); @@ -1459,7 +1494,7 @@ static LRESULT LISTBOX_SetSelection( LB_DESCR *descr, INT index, */ static void LISTBOX_MoveCaret( LB_DESCR *descr, INT index, BOOL fully_visible ) { - INT oldfocus = descr->focus_item; + TRACE("old focus %d, index %d\n", descr->focus_item, index); if ((index < 0) || (index >= descr->nb_items)) return; @@ -1472,9 +1507,7 @@ static void LISTBOX_MoveCaret( LB_DESCR *descr, INT index, BOOL fully_visible ) 4. Set the focus to 'index' and repaint the item */ /* 1. remove the focus and repaint the item */ - descr->focus_item = -1; - if ((oldfocus != -1) && descr->caret_on && (descr->in_focus)) - LISTBOX_RepaintItem( descr, oldfocus, ODA_FOCUS ); + LISTBOX_DrawFocusRect( descr, FALSE ); /* 2. then turn off the previous selection */ /* 3. repaint the new selected item */ @@ -1499,8 +1532,7 @@ static void LISTBOX_MoveCaret( LB_DESCR *descr, INT index, BOOL fully_visible ) /* 4. repaint the new item with the focus */ descr->focus_item = index; LISTBOX_MakeItemVisible( descr, index, fully_visible ); - if (descr->caret_on && (descr->in_focus)) - LISTBOX_RepaintItem( descr, index, ODA_FOCUS ); + LISTBOX_DrawFocusRect( descr, TRUE ); } @@ -2005,7 +2037,10 @@ static LRESULT LISTBOX_HandleMouseWheel(LB_DESCR *descr, SHORT delta ) static LRESULT LISTBOX_HandleLButtonDown( LB_DESCR *descr, DWORD keys, INT x, INT y ) { INT index = LISTBOX_GetItemFromPoint( descr, x, y ); - TRACE("[%p]: lbuttondown %d,%d item %d\n", descr->self, x, y, index ); + + TRACE("[%p]: lbuttondown %d,%d item %d, focus item %d\n", + descr->self, x, y, index, descr->focus_item); + if (!descr->caret_on && (descr->in_focus)) return 0; if (!descr->in_focus) @@ -2016,6 +2051,16 @@ static LRESULT LISTBOX_HandleLButtonDown( LB_DESCR *descr, DWORD keys, INT x, IN if (index == -1) return 0; + if (!descr->lphc) + { + if (descr->style & LBS_NOTIFY ) + SendMessageW( descr->owner, WM_LBTRACKPOINT, index, + MAKELPARAM( x, y ) ); + } + + descr->captured = TRUE; + SetCapture( descr->self ); + if (descr->style & (LBS_EXTENDEDSEL | LBS_MULTIPLESEL)) { /* we should perhaps make sure that all items are deselected @@ -2058,14 +2103,8 @@ static LRESULT LISTBOX_HandleLButtonDown( LB_DESCR *descr, DWORD keys, INT x, IN TRUE, (descr->style & LBS_NOTIFY) != 0 ); } - descr->captured = TRUE; - SetCapture( descr->self ); - if (!descr->lphc) { - if (descr->style & LBS_NOTIFY ) - SendMessageW( descr->owner, WM_LBTRACKPOINT, index, - MAKELPARAM( x, y ) ); if (GetWindowLongW( descr->self, GWL_EXSTYLE ) & WS_EX_DRAGDETECT) { POINT pt; @@ -2902,7 +2941,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg, if (IS_MULTISELECT(descr)) return LB_ERR; LISTBOX_SetCaretIndex( descr, wParam, FALSE ); ret = LISTBOX_SetSelection( descr, wParam, TRUE, FALSE ); - if (lphc && ret != LB_ERR) ret = descr->selected_item; + if (ret != LB_ERR) ret = descr->selected_item; return ret; case LB_GETSELCOUNT16: @@ -3063,7 +3102,7 @@ static LRESULT WINAPI ListBoxWndProc_common( HWND hwnd, UINT msg, descr->in_focus = TRUE; descr->caret_on = TRUE; if (descr->focus_item != -1) - LISTBOX_RepaintItem( descr, descr->focus_item, ODA_FOCUS ); + LISTBOX_DrawFocusRect( descr, TRUE ); SEND_NOTIFICATION( descr, LBN_SETFOCUS ); return 0; case WM_KILLFOCUS: diff --git a/dlls/user32/tests/edit.c b/dlls/user32/tests/edit.c index c74f6d7fd2e..cd498cc61da 100644 --- a/dlls/user32/tests/edit.c +++ b/dlls/user32/tests/edit.c @@ -706,6 +706,36 @@ static void test_edit_control_5(void) DestroyWindow(hWnd); } +static void test_edit_control_limittext(void) +{ + HWND hwEdit; + DWORD r; + + /* Test default limit for single-line control */ + trace("EDIT: buffer limit for single-line\n"); + hwEdit = create_editcontrol(ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0); + r = SendMessage(hwEdit, EM_GETLIMITTEXT, 0, 0); + ok(r == 30000, "Incorrect default text limit, expected 30000 got %u\n", r); + SendMessage(hwEdit, EM_SETLIMITTEXT, 0, 0); + r = SendMessage(hwEdit, EM_GETLIMITTEXT, 0, 0); + /* Win9x+ME: 32766; WinNT: 2147483646UL */ + ok( (r == 32766) || (r == 2147483646UL), + "got limit %u (expected 32766 or 2147483646)\n", r); + DestroyWindow(hwEdit); + + /* Test default limit for multi-line control */ + trace("EDIT: buffer limit for multi-line\n"); + hwEdit = create_editcontrol(ES_MULTILINE | WS_VSCROLL | ES_AUTOHSCROLL | ES_AUTOVSCROLL, 0); + r = SendMessage(hwEdit, EM_GETLIMITTEXT, 0, 0); + ok(r == 30000, "Incorrect default text limit, expected 30000 got %u\n", r); + SendMessage(hwEdit, EM_SETLIMITTEXT, 0, 0); + r = SendMessage(hwEdit, EM_GETLIMITTEXT, 0, 0); + /* Win9x+ME: 65535; WinNT: 4294967295UL */ + ok( (r == 65535) || (r == 4294967295UL), + "got limit %u (expected 65535 or 4294967295)\n", r); + DestroyWindow(hwEdit); +} + static void test_margins(void) { HWND hwEdit; @@ -1139,7 +1169,7 @@ static BOOL RegisterWindowClasses (void) text_position.cbWndExtra = 0; text_position.hInstance = hinst; text_position.hIcon = NULL; - text_position.hCursor = LoadCursorA(NULL, MAKEINTRESOURCEA(IDC_ARROW)); + text_position.hCursor = LoadCursorA(NULL, IDC_ARROW); text_position.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); text_position.lpszMenuName = NULL; text_position.lpszClassName = szEditTextPositionClass; @@ -1166,6 +1196,7 @@ START_TEST(edit) test_edit_control_3(); test_edit_control_4(); test_edit_control_5(); + test_edit_control_limittext(); test_margins(); test_margins_font_change(); test_text_position(); diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index a73e6b91901..c6c1cd7c184 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -9848,16 +9848,63 @@ static const struct message wm_lb_setcursel_0[] = { { LB_SETCURSEL, sent|wparam|lparam, 0, 0 }, { WM_CTLCOLORLISTBOX, sent|parent }, - { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x00120f2 }, + { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x000120f2 }, + { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 1 }, + { EVENT_OBJECT_SELECTION, winevent_hook|wparam|lparam, OBJID_CLIENT, 1 }, { 0 } }; static const struct message wm_lb_setcursel_1[] = { { LB_SETCURSEL, sent|wparam|lparam, 1, 0 }, { WM_CTLCOLORLISTBOX, sent|parent }, - { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x00020f2 }, + { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x000020f2 }, { WM_CTLCOLORLISTBOX, sent|parent }, - { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x00121f2 }, + { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x000121f2 }, + { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 2 }, + { EVENT_OBJECT_SELECTION, winevent_hook|wparam|lparam, OBJID_CLIENT, 2 }, + { 0 } +}; +static const struct message wm_lb_setcursel_2[] = +{ + { LB_SETCURSEL, sent|wparam|lparam, 2, 0 }, + { WM_CTLCOLORLISTBOX, sent|parent }, + { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x000021f2 }, + { WM_CTLCOLORLISTBOX, sent|parent }, + { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x000122f2 }, + { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 3 }, + { EVENT_OBJECT_SELECTION, winevent_hook|wparam|lparam, OBJID_CLIENT, 3 }, + { 0 } +}; +static const struct message wm_lb_click_0[] = +{ + { WM_LBUTTONDOWN, sent|wparam|lparam, 0, MAKELPARAM(1,1) }, + { HCBT_SETFOCUS, hook }, + { WM_KILLFOCUS, sent|parent }, + { WM_IME_SETCONTEXT, sent|wparam|optional|parent, 0 }, + { WM_IME_SETCONTEXT, sent|wparam|optional, 1 }, + { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 0 }, + { WM_SETFOCUS, sent }, + + { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x001142f2 }, + { WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_LISTBOX, LBN_SETFOCUS) }, + { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 3 }, + { WM_LBTRACKPOINT, sent|wparam|lparam|parent, 0, MAKELPARAM(1,1) }, + { EVENT_SYSTEM_CAPTURESTART, winevent_hook|wparam|lparam, 0, 0 }, + + { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x000142f2 }, + { WM_CTLCOLORLISTBOX, sent|parent }, + { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x000022f2 }, + { WM_CTLCOLORLISTBOX, sent|parent }, + { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x000120f2 }, + { WM_DRAWITEM, sent|wparam|lparam|parent, ID_LISTBOX, 0x001140f2 }, + + { EVENT_OBJECT_FOCUS, winevent_hook|wparam|lparam, OBJID_CLIENT, 1 }, + { EVENT_OBJECT_SELECTION, winevent_hook|wparam|lparam, OBJID_CLIENT, 1 }, + + { WM_LBUTTONUP, sent|wparam|lparam, 0, 0 }, + { EVENT_SYSTEM_CAPTUREEND, winevent_hook|wparam|lparam, 0, 0 }, + { WM_CAPTURECHANGED, sent|wparam|lparam, 0, 0 }, + { WM_COMMAND, sent|wparam|parent, MAKEWPARAM(ID_LISTBOX, LBN_SELCHANGE) }, { 0 } }; @@ -9896,13 +9943,14 @@ static void check_lb_state_dbg(HWND listbox, int count, int cur_sel, { LRESULT ret; - ret = SendMessage(listbox, LB_GETCOUNT, 0, 0); + /* calling an orig proc helps to avoid unnecessary message logging */ + ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETCOUNT, 0, 0); ok_(__FILE__, line)(ret == count, "expected count %d, got %ld\n", count, ret); - ret = SendMessage(listbox, LB_GETCURSEL, 0, 0); + ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETCURSEL, 0, 0); ok_(__FILE__, line)(ret == cur_sel, "expected cur sel %d, got %ld\n", cur_sel, ret); - ret = SendMessage(listbox, LB_GETCARETINDEX, 0, 0); + ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETCARETINDEX, 0, 0); ok_(__FILE__, line)(ret == caret_index, "expected caret index %d, got %ld\n", caret_index, ret); - ret = SendMessage(listbox, LB_GETTOPINDEX, 0, 0); + ret = CallWindowProcA(listbox_orig_proc, listbox, LB_GETTOPINDEX, 0, 0); ok_(__FILE__, line)(ret == top_index, "expected top index %d, got %ld\n", top_index, ret); } @@ -9915,16 +9963,16 @@ static void test_listbox(void) 100, 100, 200, 200, 0, 0, 0, NULL); listbox = CreateWindowExA(WS_EX_NOPARENTNOTIFY, "ListBox", NULL, WS_CHILD | LBS_NOTIFY | LBS_OWNERDRAWVARIABLE | LBS_HASSTRINGS | WS_VISIBLE, - 10, 10, 80, 20, parent, (HMENU)ID_LISTBOX, 0, NULL); + 10, 10, 80, 80, parent, (HMENU)ID_LISTBOX, 0, NULL); listbox_orig_proc = (WNDPROC)SetWindowLongPtrA(listbox, GWLP_WNDPROC, (ULONG_PTR)listbox_hook_proc); check_lb_state(listbox, 0, LB_ERR, 0, 0); - ret = SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1"); + ret = SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)"item 0"); ok(ret == 0, "expected 0, got %ld\n", ret); - ret = SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2"); + ret = SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)"item 1"); ok(ret == 1, "expected 1, got %ld\n", ret); - ret = SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)"item 3"); + ret = SendMessage(listbox, LB_ADDSTRING, 0, (LPARAM)"item 2"); ok(ret == 2, "expected 2, got %ld\n", ret); check_lb_state(listbox, 3, LB_ERR, 0, 0); @@ -9934,16 +9982,33 @@ static void test_listbox(void) log_all_parent_messages++; trace("selecting item 0\n"); - SendMessage(listbox, LB_SETCURSEL, 0, 0); + ret = SendMessage(listbox, LB_SETCURSEL, 0, 0); + ok(ret == 0, "expected 0, got %ld\n", ret); ok_sequence(wm_lb_setcursel_0, "LB_SETCURSEL 0", FALSE ); check_lb_state(listbox, 3, 0, 0, 0); flush_sequence(); trace("selecting item 1\n"); - SendMessage(listbox, LB_SETCURSEL, 1, 0); + ret = SendMessage(listbox, LB_SETCURSEL, 1, 0); + ok(ret == 1, "expected 1, got %ld\n", ret); ok_sequence(wm_lb_setcursel_1, "LB_SETCURSEL 1", FALSE ); check_lb_state(listbox, 3, 1, 1, 0); + trace("selecting item 2\n"); + ret = SendMessage(listbox, LB_SETCURSEL, 2, 0); + ok(ret == 2, "expected 2, got %ld\n", ret); + ok_sequence(wm_lb_setcursel_2, "LB_SETCURSEL 2", FALSE ); + check_lb_state(listbox, 3, 2, 2, 0); + + trace("clicking on item 0\n"); + ret = SendMessage(listbox, WM_LBUTTONDOWN, 0, MAKELPARAM(1, 1)); + ok(ret == LB_OKAY, "expected LB_OKAY, got %ld\n", ret); + ret = SendMessage(listbox, WM_LBUTTONUP, 0, 0); + ok(ret == LB_OKAY, "expected LB_OKAY, got %ld\n", ret); + ok_sequence(wm_lb_click_0, "WM_LBUTTONDOWN 0", FALSE ); + check_lb_state(listbox, 3, 0, 0, 0); + flush_sequence(); + log_all_parent_messages--; DestroyWindow(parent); diff --git a/dlls/winealsa.drv/waveinit.c b/dlls/winealsa.drv/waveinit.c index dae6ab45d40..86143b6ff9d 100644 --- a/dlls/winealsa.drv/waveinit.c +++ b/dlls/winealsa.drv/waveinit.c @@ -697,15 +697,10 @@ static int ALSA_ScanDevices(int directhw, ** Try to open a ctl handle; Wine doesn't absolutely require one, ** but it does allow for volume control and for device scanning **------------------------------------------------------------------*/ - sprintf(ctlname, "default:%d", fixedctlcard == -1 ? card : fixedctlcard); + sprintf(ctlname, "hw:%d", fixedctlcard == -1 ? card : fixedctlcard); rc = snd_ctl_open(&ctl, ctlname, SND_CTL_NONBLOCK); if (rc < 0) { - sprintf(ctlname, "hw:%d", fixedctlcard == -1 ? card : fixedctlcard); - rc = snd_ctl_open(&ctl, ctlname, SND_CTL_NONBLOCK); - } - if (rc < 0) - { ctl = NULL; WARN("Unable to open an alsa ctl for [%s] (pcm card %d): %s; not scanning devices\n", ctlname, card, snd_strerror(rc)); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 19a770a8a41..202b24ec17b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -1107,10 +1107,16 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface if (Usage & WINED3DUSAGE_AUTOGENMIPMAP) { if(!GL_SUPPORT(SGIS_GENERATE_MIPMAP)) { WARN("No mipmap generation support, returning D3DERR_INVALIDCALL\n"); + HeapFree(GetProcessHeap(), 0, object); + *ppCubeTexture = NULL; + return WINED3DERR_INVALIDCALL; } if(Levels > 1) { WARN("D3DUSAGE_AUTOGENMIPMAP is set, and level count > 1, returning D3DERR_INVALIDCALL\n"); + HeapFree(GetProcessHeap(), 0, object); + *ppCubeTexture = NULL; + return WINED3DERR_INVALIDCALL; } Levels = 1; @@ -1139,11 +1145,11 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateCubeTexture(IWineD3DDevice *iface int k; int l; for (l = 0; l < j; l++) { - IWineD3DSurface_Release(object->surfaces[j][i]); + IWineD3DSurface_Release(object->surfaces[l][i]); } for (k = 0; k < i; k++) { for (l = 0; l < 6; l++) { - IWineD3DSurface_Release(object->surfaces[l][j]); + IWineD3DSurface_Release(object->surfaces[l][k]); } } @@ -2223,11 +2229,11 @@ static void WINAPI IWineD3DDeviceImpl_SetFullscreen(IWineD3DDevice *iface, BOOL This->ddraw_fullscreen = fullscreen; } -/* Enables thead safety in the wined3d device and its resources. Called by DirectDraw - * from SetCooperativeLeven if DDSCL_MULTITHREADED is specified, and by d3d8/9 from +/* Enables thread safety in the wined3d device and its resources. Called by DirectDraw + * from SetCooperativeLevel if DDSCL_MULTITHREADED is specified, and by d3d8/9 from * CreateDevice if D3DCREATE_MULTITHREADED is passed. * - * There is no way to deactivate thread safety once it is enabled + * There is no way to deactivate thread safety once it is enabled. */ static void WINAPI IWineD3DDeviceImpl_SetMultithreaded(IWineD3DDevice *iface) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *) iface; diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c index 4c28928782a..e24bd96546e 100644 --- a/dlls/winex11.drv/dib.c +++ b/dlls/winex11.drv/dib.c @@ -257,6 +257,34 @@ static int DIB_GetBitmapInfoEx( const BITMAPINFOHEADER *header, LONG *width, /*********************************************************************** + * X11DRV_DIB_GetColorCount + * + * Computes the number of colors for the bitmap palette. + * Should not be called for a >8-bit deep bitmap. + */ +static unsigned int X11DRV_DIB_GetColorCount(const BITMAPINFO *info) +{ + unsigned int colors; + BOOL core_info = info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER); + + if (core_info) + { + colors = 1 << ((const BITMAPCOREINFO*)info)->bmciHeader.bcBitCount; + } + else + { + colors = info->bmiHeader.biClrUsed; + if (!colors) colors = 1 << info->bmiHeader.biBitCount; + } + if (colors > 256) + { + ERR("called with >256 colors!\n"); + colors = 0; + } + return colors; +} + +/*********************************************************************** * DIB_GetBitmapInfo * * Get the info from a bitmap header. @@ -343,15 +371,10 @@ static int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping, } else /* DIB_PAL_COLORS */ { - if (colorPtr) { - const WORD * index = (const WORD *)colorPtr; + const WORD * index = (const WORD *)colorPtr; - for (i = start; i < end; i++, index++) - colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, PALETTEINDEX(*index) ); - } else { - for (i = start; i < end; i++) - colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, PALETTEINDEX(i) ); - } + for (i = start; i < end; i++, index++) + colorMapping[i] = X11DRV_PALETTE_ToPhysical( physDev, PALETTEINDEX(*index) ); } return colorMapping; @@ -366,40 +389,21 @@ static int *X11DRV_DIB_GenColorMap( X11DRV_PDEVICE *physDev, int *colorMapping, static int *X11DRV_DIB_BuildColorMap( X11DRV_PDEVICE *physDev, WORD coloruse, WORD depth, const BITMAPINFO *info, int *nColors ) { - unsigned int colors; BOOL isInfo; const void *colorPtr; int *colorMapping; - isInfo = info->bmiHeader.biSize != sizeof(BITMAPCOREHEADER); - if (isInfo) - { - colors = info->bmiHeader.biClrUsed; - if (!colors) colors = 1 << info->bmiHeader.biBitCount; - } - else - { - colors = 1 << ((const BITMAPCOREHEADER *)info)->bcBitCount; - } + *nColors = X11DRV_DIB_GetColorCount(info); + if (!*nColors) return NULL; - colorPtr = (const BYTE*) info + (WORD) info->bmiHeader.biSize; - - if (colors > 256) - { - ERR("called with >256 colors!\n"); - return NULL; - } - - /* just so CopyDIBSection doesn't have to create an identity palette */ - if (coloruse == (WORD)-1) colorPtr = NULL; - - if (!(colorMapping = HeapAlloc(GetProcessHeap(), 0, colors * sizeof(int) ))) + isInfo = info->bmiHeader.biSize != sizeof(BITMAPCOREHEADER); + colorPtr = (const BYTE*)info + (WORD)info->bmiHeader.biSize; + if (!(colorMapping = HeapAlloc(GetProcessHeap(), 0, *nColors * sizeof(int) ))) return NULL; - *nColors = colors; return X11DRV_DIB_GenColorMap( physDev, colorMapping, coloruse, depth, - isInfo, colorPtr, 0, colors); + isInfo, colorPtr, 0, *nColors); } /*********************************************************************** @@ -4199,7 +4203,9 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD { DIBSECTION dib; X_PHYSBITMAP *physBitmap; - int nColorMap = 0, *colorMap = NULL, aColorMap = FALSE; + unsigned int nColorMap; + int* x11ColorMap; + int freeColorMap; TRACE("(%p,%p,%d,%d,%d,%d,%d,%d)\n", physDevSrc->hdc, physDevDst->hdc, xSrc, ySrc, xDest, yDest, width, height); @@ -4228,24 +4234,34 @@ void X11DRV_DIB_CopyDIBSection(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physD * use the DIB colormap instead - this is necessary in some * cases since we need to do depth conversion in some places * where real Windows can just copy data straight over */ - colorMap = physBitmap->colorMap; + x11ColorMap = physBitmap->colorMap; nColorMap = physBitmap->nColorMap; + freeColorMap = FALSE; } else { - colorMap = X11DRV_DIB_BuildColorMap( physDevSrc, (WORD)-1, - dib.dsBm.bmBitsPixel, - (BITMAPINFO*)&dib.dsBmih, - &nColorMap ); - if (colorMap) aColorMap = TRUE; + const BITMAPINFO* info = (BITMAPINFO*)&dib.dsBmih; + int i; + + nColorMap = X11DRV_DIB_GetColorCount(info); + x11ColorMap = HeapAlloc(GetProcessHeap(), 0, nColorMap * sizeof(int)); + for (i = 0; i < nColorMap; i++) + x11ColorMap[i] = X11DRV_PALETTE_ToPhysical(physDevSrc, PALETTEINDEX(i)); + freeColorMap = TRUE; } } + else + { + nColorMap = 0; + x11ColorMap = NULL; + freeColorMap = FALSE; + } /* perform the copy */ - X11DRV_DIB_DoCopyDIBSection(physBitmap, FALSE, colorMap, nColorMap, + X11DRV_DIB_DoCopyDIBSection(physBitmap, FALSE, x11ColorMap, nColorMap, physDevDst->drawable, physDevDst->gc, xSrc, ySrc, physDevDst->dc_rect.left + xDest, physDevDst->dc_rect.top + yDest, width, height); /* free color mapping */ - if (aColorMap) - HeapFree(GetProcessHeap(), 0, colorMap); + if (freeColorMap) + HeapFree(GetProcessHeap(), 0, x11ColorMap); } } diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c index 02e61511494..da08bd493f5 100644 --- a/dlls/winex11.drv/winpos.c +++ b/dlls/winex11.drv/winpos.c @@ -264,6 +264,8 @@ BOOL X11DRV_SetWindowPos( HWND hwnd, HWND insert_after, const RECT *rectWindow, old_client_rect = data->client_rect; + if (!data->whole_window) swp_flags |= SWP_NOCOPYBITS; /* we can't rely on X11 to move the bits */ + if (!(win = WIN_GetPtr( hwnd ))) return FALSE; if (win == WND_OTHER_PROCESS) { diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index 454d332989d..70239f798e4 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -830,6 +830,8 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, if (NULL == lpwhr || lpwhr->hdr.htype != WH_HHTTPREQ) { INTERNET_SetLastError(ERROR_INTERNET_INCORRECT_HANDLE_TYPE); + if (lpwhr) + WININET_Release( &lpwhr->hdr ); return FALSE; } @@ -881,6 +883,7 @@ BOOL WINAPI HttpEndRequestW(HINTERNET hRequest, } } + WININET_Release( &lpwhr->hdr ); TRACE("%i <--\n",rc); return rc; } diff --git a/dlls/ws2_32/protocol.c b/dlls/ws2_32/protocol.c index 2f71d32e9d8..7cccecb4cc6 100644 --- a/dlls/ws2_32/protocol.c +++ b/dlls/ws2_32/protocol.c @@ -301,18 +301,16 @@ INT WINAPI WSAEnumProtocolsA( LPINT protocols, LPWSAPROTOCOL_INFOA buffer, LPDWO DWORD size = 0; INT local[] = { WS_IPPROTO_TCP, WS_IPPROTO_UDP, NSPROTO_IPX, NSPROTO_SPX, NSPROTO_SPXII, 0 }; - if (!buffer) - return SOCKET_ERROR; - if (!protocols) protocols = local; while (protocols[i]) i++; size = i * sizeof(WSAPROTOCOL_INFOA); - if (*len < size) + if (*len < size || !buffer) { *len = size; + WSASetLastError(WSAENOBUFS); return SOCKET_ERROR; } @@ -367,18 +365,16 @@ INT WINAPI WSAEnumProtocolsW( LPINT protocols, LPWSAPROTOCOL_INFOW buffer, LPDWO DWORD size = 0; INT local[] = { WS_IPPROTO_TCP, WS_IPPROTO_UDP, NSPROTO_IPX, NSPROTO_SPX, NSPROTO_SPXII, 0 }; - if (!buffer) - return SOCKET_ERROR; - if (!protocols) protocols = local; while (protocols[i]) i++; size = i * sizeof(WSAPROTOCOL_INFOW); - if (*len < size) + if (*len < size || !buffer) { *len = size; + WSASetLastError(WSAENOBUFS); return SOCKET_ERROR; } diff --git a/include/dimm.idl b/include/dimm.idl index 528c0c518e4..ab74d4acda2 100644 --- a/include/dimm.idl +++ b/include/dimm.idl @@ -16,7 +16,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifndef DO_NO_IMPORTS import "unknwn.idl"; +#endif cpp_quote("#include ") diff --git a/include/hlink.idl b/include/hlink.idl index 3e3389175ea..7c5156ed6fe 100644 --- a/include/hlink.idl +++ b/include/hlink.idl @@ -277,6 +277,10 @@ interface IHlinkBrowseContext : IUnknown [in, unique] IMoniker *pimk, [out] DWORD *pdwRegister); +cpp_quote("#ifdef WINE_NO_UNICODE_MACROS") +cpp_quote("#undef GetObject") +cpp_quote("#endif") + HRESULT GetObject( [in, unique] IMoniker *pimk, [in] BOOL fBindIfRootRegistered, diff --git a/include/imm.h b/include/imm.h index 89473edb8c4..85848e63749 100644 --- a/include/imm.h +++ b/include/imm.h @@ -493,7 +493,7 @@ DWORD WINAPI ImmGetCandidateListCountA(HIMC, LPDWORD); DWORD WINAPI ImmGetCandidateListCountW(HIMC, LPDWORD); #define ImmGetCandidateListCount WINELIB_NAME_AW(ImmGetCandidateListCount) BOOL WINAPI ImmGetCandidateWindow(HIMC, DWORD, LPCANDIDATEFORM); -#ifndef NOGDI +#if defined(_WINGDI_) && !defined(NOGDI) BOOL WINAPI ImmGetCompositionFontA(HIMC, LPLOGFONTA); BOOL WINAPI ImmGetCompositionFontW(HIMC, LPLOGFONTW); #define ImmGetCompositionFont WINELIB_NAME_AW(ImmGetCompositionFont) diff --git a/include/mshtml.idl b/include/mshtml.idl index adc87ededdd..b25c5e42c72 100644 --- a/include/mshtml.idl +++ b/include/mshtml.idl @@ -21,7 +21,8 @@ #include import "ocidl.idl"; -/* import "dimm.idl"; */ +import "dimm.idl"; +import "shtypes.idl"; cpp_quote("#include ") diff --git a/include/ndrtypes.h b/include/ndrtypes.h index 40d83317848..5d932fa9e72 100644 --- a/include/ndrtypes.h +++ b/include/ndrtypes.h @@ -21,6 +21,8 @@ #ifndef __NDRTYPES_H__ #define __NDRTYPES_H__ +#include + typedef struct { unsigned short MustSize : 1; /* 0x0001 - client interpreter MUST size this diff --git a/include/wincrypt.h b/include/wincrypt.h index 75630513996..e45a38bcfe2 100644 --- a/include/wincrypt.h +++ b/include/wincrypt.h @@ -1216,6 +1216,8 @@ typedef struct _CRYPT_URL_INFO { #define URL_OID_CRL_FRESHEST_CRL ((LPCSTR)7) #define URL_OID_CROSS_CERT_DIST_POINT ((LPCSTR)8) +#define URL_OID_GET_OBJECT_URL_FUNC "UrlDllGetObjectUrl" + typedef HANDLE HCRYPTASYNC, *PHCRYPTASYNC; typedef void (WINAPI *PFN_CRYPT_ASYNC_PARAM_FREE_FUNC)(LPSTR pszParamOid, diff --git a/programs/oleview/pane.c b/programs/oleview/pane.c index 54ac27481b0..f274be84553 100644 --- a/programs/oleview/pane.c +++ b/programs/oleview/pane.c @@ -151,7 +151,11 @@ BOOL CreatePanedWindow(HWND hWnd, HWND *hWndCreated, HINSTANCE hInst) pane = HeapAlloc(GetProcessHeap(), 0, sizeof(PANE)); *hWndCreated = CreateWindow(wszPaneClass, NULL, WS_CHILD|WS_VISIBLE, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, hWnd, (HMENU)pane, hInst, NULL); - if(!hWndCreated) return FALSE; + if(!hWndCreated) + { + HeapFree(GetProcessHeap(), 0, pane); + return FALSE; + } pane->left = NULL; pane->right = NULL; diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index 8858a88a014..b1342e0a55e 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -28,6 +28,7 @@ TESTBINS = \ comctl32_test.exe \ comdlg32_test.exe \ crypt32_test.exe \ + cryptnet_test.exe \ d3d8_test.exe \ d3d9_test.exe \ d3drm_test.exe \ @@ -106,6 +107,8 @@ comdlg32_test.exe: $(DLLDIR)/comdlg32/tests/comdlg32_test.exe$(DLLEXT) cp $(DLLDIR)/comdlg32/tests/comdlg32_test.exe$(DLLEXT) $@ && $(STRIP) $@ crypt32_test.exe: $(DLLDIR)/crypt32/tests/crypt32_test.exe$(DLLEXT) cp $(DLLDIR)/crypt32/tests/crypt32_test.exe$(DLLEXT) $@ && $(STRIP) $@ +cryptnet_test.exe: $(DLLDIR)/cryptnet/tests/cryptnet_test.exe$(DLLEXT) + cp $(DLLDIR)/cryptnet/tests/cryptnet_test.exe$(DLLEXT) $@ && $(STRIP) $@ d3d8_test.exe: $(DLLDIR)/d3d8/tests/d3d8_test.exe$(DLLEXT) cp $(DLLDIR)/d3d8/tests/d3d8_test.exe$(DLLEXT) $@ && $(STRIP) $@ d3d9_test.exe: $(DLLDIR)/d3d9/tests/d3d9_test.exe$(DLLEXT) diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index fb8cee20983..9b8a8ebfc0b 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -86,6 +86,7 @@ comcat_test.exe TESTRES "comcat_test.exe" comctl32_test.exe TESTRES "comctl32_test.exe" comdlg32_test.exe TESTRES "comdlg32_test.exe" crypt32_test.exe TESTRES "crypt32_test.exe" +cryptnet_test.exe TESTRES "cryptnet_test.exe" d3d8_test.exe TESTRES "d3d8_test.exe" d3d9_test.exe TESTRES "d3d9_test.exe" d3drm_test.exe TESTRES "d3drm_test.exe" diff --git a/server/window.c b/server/window.c index 7c246dc3566..ce5297c9512 100644 --- a/server/window.c +++ b/server/window.c @@ -1303,23 +1303,51 @@ static unsigned int get_window_update_flags( struct window *win, struct window * } -/* expose a region of a window on its parent */ -/* the region is in window coordinates */ -static void expose_window( struct window *win, struct region *region ) +/* expose the areas revealed by a vis region change on the window parent */ +/* returns the region exposed on the window itself (in client coordinates) */ +static struct region *expose_window( struct window *win, const rectangle_t *old_window_rect, + struct region *old_vis_rgn ) { struct window *parent = win; - int offset_x = win->window_rect.left - win->client_rect.left; - int offset_y = win->window_rect.top - win->client_rect.top; + struct region *new_vis_rgn, *exposed_rgn; - if (win->parent && !is_desktop_window(win->parent)) + if (!(new_vis_rgn = get_visible_region( win, DCX_WINDOW ))) return NULL; + + if ((exposed_rgn = create_empty_region())) + { + if (subtract_region( exposed_rgn, new_vis_rgn, old_vis_rgn ) && !is_region_empty( exposed_rgn )) + { + /* make it relative to the new client area */ + offset_region( exposed_rgn, win->window_rect.left - win->client_rect.left, + win->window_rect.top - win->client_rect.top ); + } + else + { + free_region( exposed_rgn ); + exposed_rgn = NULL; + } + } + + /* make it relative to the old window pos for subtracting */ + offset_region( new_vis_rgn, win->window_rect.left - old_window_rect->left, + win->window_rect.top - old_window_rect->top ); + + if (subtract_region( new_vis_rgn, old_vis_rgn, new_vis_rgn ) && !is_region_empty( new_vis_rgn )) { - offset_x += win->client_rect.left; - offset_y += win->client_rect.top; - parent = win->parent; + /* make it relative to new client rect again */ + int offset_x = old_window_rect->left - win->client_rect.left; + int offset_y = old_window_rect->top - win->client_rect.top; + if (win->parent && !is_desktop_window(win->parent)) + { + offset_x += win->client_rect.left; + offset_y += win->client_rect.top; + parent = win->parent; + } + offset_region( new_vis_rgn, offset_x, offset_y ); + redraw_window( parent, new_vis_rgn, 0, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN ); } - offset_region( region, offset_x, offset_y ); - redraw_window( parent, region, 0, RDW_INVALIDATE | RDW_ERASE | RDW_ALLCHILDREN ); - offset_region( region, -offset_x, -offset_y ); + free_region( new_vis_rgn ); + return exposed_rgn; } @@ -1329,10 +1357,11 @@ static void set_window_pos( struct window *win, struct window *previous, const rectangle_t *client_rect, const rectangle_t *visible_rect, const rectangle_t *valid_rects ) { - struct region *old_vis_rgn = NULL, *new_vis_rgn; + struct region *old_vis_rgn = NULL, *exposed_rgn = NULL; const rectangle_t old_window_rect = win->window_rect; const rectangle_t old_visible_rect = win->visible_rect; const rectangle_t old_client_rect = win->client_rect; + int client_changed, frame_changed; int visible = (win->style & WS_VISIBLE) || (swp_flags & SWP_SHOWWINDOW); if (win->parent && !is_visible( win->parent )) visible = 0; @@ -1356,23 +1385,10 @@ static void set_window_pos( struct window *win, struct window *previous, /* if the window is not visible, everything is easy */ if (!visible) return; - if (!(new_vis_rgn = get_visible_region( win, DCX_WINDOW ))) - { - free_region( old_vis_rgn ); - clear_error(); /* ignore error since the window info has been modified already */ - return; - } - /* expose anything revealed by the change */ if (!(swp_flags & SWP_NOREDRAW)) - { - offset_region( old_vis_rgn, old_window_rect.left - window_rect->left, - old_window_rect.top - window_rect->top ); - if (xor_region( new_vis_rgn, old_vis_rgn, new_vis_rgn )) - expose_window( win, new_vis_rgn ); - } - free_region( old_vis_rgn ); + exposed_rgn = expose_window( win, &old_window_rect, old_vis_rgn ); if (!(win->style & WS_VISIBLE)) { @@ -1405,34 +1421,65 @@ static void set_window_pos( struct window *win, struct window *previous, /* expose the whole non-client area if it changed in any way */ - if ((swp_flags & SWP_FRAMECHANGED) || - memcmp( window_rect, &old_window_rect, sizeof(old_window_rect) ) || - memcmp( visible_rect, &old_visible_rect, sizeof(old_visible_rect) ) || - memcmp( client_rect, &old_client_rect, sizeof(old_client_rect) )) + if (swp_flags & SWP_NOCOPYBITS) + { + frame_changed = ((swp_flags & SWP_FRAMECHANGED) || + memcmp( window_rect, &old_window_rect, sizeof(old_window_rect) ) || + memcmp( visible_rect, &old_visible_rect, sizeof(old_visible_rect) )); + client_changed = memcmp( client_rect, &old_client_rect, sizeof(old_client_rect) ); + } + else + { + /* assume the bits have been moved to follow the window rect */ + int x_offset = window_rect->left - old_window_rect.left; + int y_offset = window_rect->top - old_window_rect.top; + frame_changed = ((swp_flags & SWP_FRAMECHANGED) || + window_rect->right - old_window_rect.right != x_offset || + window_rect->bottom - old_window_rect.bottom != y_offset || + visible_rect->left - old_visible_rect.left != x_offset || + visible_rect->right - old_visible_rect.right != x_offset || + visible_rect->top - old_visible_rect.top != y_offset || + visible_rect->bottom - old_visible_rect.bottom != y_offset); + client_changed = (client_rect->left - old_client_rect.left != x_offset || + client_rect->right - old_client_rect.right != x_offset || + client_rect->top - old_client_rect.top != y_offset || + client_rect->bottom - old_client_rect.bottom != y_offset); + } + + if (frame_changed || client_changed) { struct region *tmp = create_empty_region(); if (tmp) { /* subtract the valid portion of client rect from the total region */ - if (!memcmp( client_rect, &old_client_rect, sizeof(old_client_rect) )) + if (!client_changed) set_region_rect( tmp, client_rect ); else if (valid_rects) set_region_rect( tmp, &valid_rects[0] ); - set_region_rect( new_vis_rgn, window_rect ); - if (subtract_region( tmp, new_vis_rgn, tmp )) + set_region_rect( old_vis_rgn, window_rect ); + if (!subtract_region( tmp, old_vis_rgn, tmp )) free_region( tmp ); + else { if (!is_desktop_window(win)) offset_region( tmp, -client_rect->left, -client_rect->top ); - redraw_window( win, tmp, 1, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ); + if (exposed_rgn) + { + union_region( exposed_rgn, exposed_rgn, tmp ); + free_region( tmp ); + } + else exposed_rgn = tmp; } - free_region( tmp ); } } + if (exposed_rgn) + redraw_window( win, exposed_rgn, 1, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ); + done: - free_region( new_vis_rgn ); + free_region( old_vis_rgn ); + if (exposed_rgn) free_region( exposed_rgn ); clear_error(); /* we ignore out of memory errors once the new rects have been set */ } @@ -1440,7 +1487,7 @@ done: /* set the window region, updating the update region if necessary */ static void set_window_region( struct window *win, struct region *region, int redraw ) { - struct region *old_vis_rgn = NULL, *new_vis_rgn; + struct region *old_vis_rgn = NULL, *exposed_rgn; /* no need to redraw if window is not visible */ if (redraw && !is_visible( win )) redraw = 0; @@ -1450,12 +1497,11 @@ static void set_window_region( struct window *win, struct region *region, int re if (win->win_region) free_region( win->win_region ); win->win_region = region; - if (old_vis_rgn && (new_vis_rgn = get_visible_region( win, DCX_WINDOW ))) + /* expose anything revealed by the change */ + if (old_vis_rgn && ((exposed_rgn = expose_window( win, &win->window_rect, old_vis_rgn )))) { - /* expose anything revealed by the change */ - if (xor_region( new_vis_rgn, old_vis_rgn, new_vis_rgn )) - expose_window( win, new_vis_rgn ); - free_region( new_vis_rgn ); + redraw_window( win, exposed_rgn, 1, RDW_INVALIDATE | RDW_ERASE | RDW_FRAME | RDW_ALLCHILDREN ); + free_region( exposed_rgn ); } if (old_vis_rgn) free_region( old_vis_rgn ); diff --git a/tools/fnt2fon.c b/tools/fnt2fon.c index 3f82fd91b4f..87c5ab79ef6 100644 --- a/tools/fnt2fon.c +++ b/tools/fnt2fon.c @@ -28,6 +28,7 @@ #ifdef HAVE_UNISTD_H # include #endif +#include #include #ifdef HAVE_IO_H # include @@ -78,19 +79,6 @@ static void usage(char **argv) #define __attribute__(X) #endif -static void error(const char *s, ...) __attribute__((format (printf, 1, 2))); - -static void error(const char *s, ...) -{ - va_list ap; - va_start(ap, s); - fprintf(stderr, "Error: "); - vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); - va_end(ap); - exit(1); -} - int main(int argc, char **argv) { int i, j; @@ -123,13 +111,14 @@ int main(int argc, char **argv) for(i = 0; i < num_files; i++) { fp = fopen(argv[i+1], "rb"); if(!fp) { - fprintf(stderr, "Can't open %s\n", argv[i+1]); + fprintf(stderr, "error: unable to open %s for reading: %s\n", argv[i+1], strerror(errno)); usage(argv); exit(1); } fread(&ver, sizeof(short), 1, fp); if(ver != 0x200 && ver != 0x300) { - error("invalid fnt file %s ver %d", argv[i+1], ver); + fprintf(stderr, "error: invalid fnt file %s ver %d\n", argv[i+1], ver); + exit(1); } fread(file_lens + i, sizeof(int), 1, fp); fseek(fp, 0x44, SEEK_SET); diff --git a/tools/widl/header.c b/tools/widl/header.c index 2643f49198e..40fda80e1bc 100644 --- a/tools/widl/header.c +++ b/tools/widl/header.c @@ -101,7 +101,9 @@ int is_void(const type_t *t) int is_conformant_array(const type_t *t) { - return t->type == RPC_FC_CARRAY || t->type == RPC_FC_CVARRAY; + return t->type == RPC_FC_CARRAY + || t->type == RPC_FC_CVARRAY + || (t->type == RPC_FC_BOGUS_ARRAY && t->size_is); } void write_guid(FILE *f, const char *guid_prefix, const char *name, const UUID *uuid) @@ -837,7 +839,7 @@ static void write_coclass_guid(type_t *cocl) static void write_com_interface(type_t *iface) { if (!iface->funcs && !iface->ref) { - parser_warning("%s has no methods", iface->name); + parser_warning("%s has no methods\n", iface->name); return; } diff --git a/tools/widl/parser.l b/tools/widl/parser.l index e9bfb1f7122..78ee4b2f98b 100644 --- a/tools/widl/parser.l +++ b/tools/widl/parser.l @@ -113,10 +113,10 @@ UUID *parse_uuid(const char *u) yy_pop_state(); lineno = (int)strtol(yytext, &cptr, 10); if(!lineno) - parser_error("Malformed '#...' line-directive; invalid linenumber"); + parser_error("Malformed '#...' line-directive; invalid linenumber\n"); fname = strchr(cptr, '"'); if(!fname) - parser_error("Malformed '#...' line-directive; missing filename"); + parser_error("Malformed '#...' line-directive; missing filename\n"); fname++; cptr = strchr(fname, '"'); if(!cptr) @@ -352,7 +352,7 @@ static void addcchar(char c) cbufalloc += 1024; cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0])); if(cbufalloc > 65536) - parser_warning("Reallocating string buffer larger than 64kB"); + parser_warning("Reallocating string buffer larger than 64kB\n"); } cbuffer[cbufidx++] = c; } @@ -414,7 +414,7 @@ int do_import(char *fname) first_import = import; if (!(path = wpp_find_include( fname, input_name ))) - parser_error("Unable to open include file %s", fname); + parser_error("Unable to open include file %s\n", fname); import_stack[ptr].temp_name = temp_name; import_stack[ptr].input_name = input_name; @@ -427,7 +427,7 @@ int do_import(char *fname) if (ret) exit(1); if((f = fopen(temp_name, "r")) == NULL) - parser_error("Unable to open %s", temp_name); + parser_error("Unable to open %s\n", temp_name); import_stack[ptr].state = YY_CURRENT_BUFFER; yy_switch_to_buffer(yy_create_buffer(f, YY_BUF_SIZE)); diff --git a/tools/widl/parser.y b/tools/widl/parser.y index afab0d2b7ae..6a93995d0d1 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -288,6 +288,7 @@ input: gbl_statements { fix_incomplete(); write_proxies($1); write_client($1); write_server($1); + write_dlldata($1); } ; @@ -1433,24 +1434,24 @@ static void set_type(var_t *v, type_t *type, int ptr_level, array_dims_t *arr, if (is_array(v->type)) { const type_t *rt = v->type->ref; - switch (rt->type) - { - case RPC_FC_BOGUS_STRUCT: - case RPC_FC_NON_ENCAPSULATED_UNION: - case RPC_FC_ENCAPSULATED_UNION: - case RPC_FC_ENUM16: + if (is_user_type(rt)) v->type->type = RPC_FC_BOGUS_ARRAY; - break; - /* FC_RP should be above, but widl overuses these, and will break things. */ - case RPC_FC_UP: - case RPC_FC_RP: - if (rt->ref->type == RPC_FC_IP) - v->type->type = RPC_FC_BOGUS_ARRAY; - break; - default: - if (is_user_type(rt)) - v->type->type = RPC_FC_BOGUS_ARRAY; - } + else + switch (rt->type) + { + case RPC_FC_BOGUS_STRUCT: + case RPC_FC_NON_ENCAPSULATED_UNION: + case RPC_FC_ENCAPSULATED_UNION: + case RPC_FC_ENUM16: + v->type->type = RPC_FC_BOGUS_ARRAY; + break; + /* FC_RP should be above, but widl overuses these, and will break things. */ + case RPC_FC_UP: + case RPC_FC_RP: + if (rt->ref->type == RPC_FC_IP) + v->type->type = RPC_FC_BOGUS_ARRAY; + break; + } } } @@ -1858,6 +1859,7 @@ static int get_struct_type(var_list_t *fields) case RPC_FC_OP: case RPC_FC_CARRAY: case RPC_FC_CVARRAY: + case RPC_FC_BOGUS_ARRAY: has_pointer = 1; break; @@ -1896,15 +1898,9 @@ static int get_struct_type(var_list_t *fields) /* fallthru - treat it as complex */ /* as soon as we see one of these these members, it's bogus... */ - case RPC_FC_IP: case RPC_FC_ENCAPSULATED_UNION: case RPC_FC_NON_ENCAPSULATED_UNION: - case RPC_FC_TRANSMIT_AS: - case RPC_FC_REPRESENT_AS: - case RPC_FC_PAD: - case RPC_FC_EMBEDDED_COMPLEX: case RPC_FC_BOGUS_STRUCT: - case RPC_FC_BOGUS_ARRAY: return RPC_FC_BOGUS_STRUCT; } } diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index 5354c27c286..0255923e834 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -509,7 +509,7 @@ static void write_proxy(type_t *iface, unsigned int *proc_offset) gen_stub(iface, cur, cname, *proc_offset); *proc_offset += get_size_procformatstring_func( cur ); if (midx == -1) midx = idx; - else if (midx != idx) parser_error("method index mismatch in write_proxy"); + else if (midx != idx) parser_error("method index mismatch in write_proxy\n"); midx++; } } diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index bf24d3f23d9..6f194b71c28 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -863,7 +863,7 @@ static unsigned char conf_string_type_of_char_type(unsigned char t) return RPC_FC_C_WSTRING; } - error("string_type_of_char_type: unrecognized type %d", t); + error("string_type_of_char_type: unrecognized type %d\n", t); return 0; } @@ -1744,6 +1744,22 @@ static size_t write_struct_tfs(FILE *file, type_t *type, type_t *ft = f->type; if (is_ptr(ft)) write_pointer_tfs(file, ft, tfsoff); + else if (!ft->declarray && is_conformant_array(ft)) + { + unsigned int absoff = ft->typestring_offset; + short reloff = absoff - (*tfsoff + 2); + int ptr_type = get_attrv(f->attrs, ATTR_POINTERTYPE); + /* FIXME: We need to store pointer attributes for arrays + so we don't lose pointer_default info. */ + if (ptr_type == 0) + ptr_type = RPC_FC_UP; + print_file(file, 0, "/* %d */\n", *tfsoff); + print_file(file, 2, "0x%x, 0x0,\t/* %s */\n", ptr_type, + string_of_type(ptr_type)); + print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%u) */\n", + reloff, reloff, absoff); + *tfsoff += 4; + } } if (type->ptrdesc == *tfsoff) type->ptrdesc = 0; @@ -2501,7 +2517,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, fprintf(file, " *)_StubMsg.Buffer = *"); else fprintf(file, " *)_StubMsg.Buffer = "); - fprintf(file, varname); + fprintf(file, "%s", varname); fprintf(file, ";\n"); } else if (phase == PHASE_UNMARSHAL) @@ -2510,7 +2526,7 @@ void print_phase_basetype(FILE *file, int indent, enum remoting_phase phase, print_file(file, indent, ""); else print_file(file, indent, "*"); - fprintf(file, varname); + fprintf(file, "%s", varname); if (pass == PASS_IN && is_ptr(type)) fprintf(file, " = ("); else diff --git a/tools/widl/utils.c b/tools/widl/utils.c index 007d1cb0311..1382597dfea 100644 --- a/tools/widl/utils.c +++ b/tools/widl/utils.c @@ -62,8 +62,6 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap) free(cpy); } } - - fprintf(stderr, "\n"); } @@ -86,16 +84,6 @@ int parser_warning(const char *s, ...) return 0; } -void internal_error(const char *file, int line, const char *s, ...) -{ - va_list ap; - va_start(ap, s); - fprintf(stderr, "Internal error (please report) %s %d: ", file, line); - vfprintf(stderr, s, ap); - va_end(ap); - exit(3); -} - void error(const char *s, ...) { va_list ap; @@ -153,6 +141,35 @@ char *dup_basename(const char *name, const char *ext) return base; } +size_t widl_getline(char **linep, size_t *lenp, FILE *fp) +{ + char *line = *linep; + size_t len = *lenp; + size_t n = 0; + + if (!line) + { + len = 64; + line = xmalloc(len); + } + + while (fgets(&line[n], len - n, fp)) + { + n += strlen(&line[n]); + if (line[n - 1] == '\n') + break; + else if (n == len - 1) + { + len *= 2; + line = xrealloc(line, len); + } + } + + *linep = line; + *lenp = len; + return n; +} + void *xmalloc(size_t size) { void *res; diff --git a/tools/widl/utils.h b/tools/widl/utils.h index aa1d6b48172..37f12f09ca7 100644 --- a/tools/widl/utils.h +++ b/tools/widl/utils.h @@ -35,12 +35,12 @@ char *xstrdup(const char *str); int parser_error(const char *s, ...) __attribute__((format (printf, 1, 2))); int parser_warning(const char *s, ...) __attribute__((format (printf, 1, 2))); -void internal_error(const char *file, int line, const char *s, ...) __attribute__((format (printf, 3, 4))); void error(const char *s, ...) __attribute__((format (printf, 1, 2))); void warning(const char *s, ...) __attribute__((format (printf, 1, 2))); void chat(const char *s, ...) __attribute__((format (printf, 1, 2))); char *dup_basename(const char *name, const char *ext); +size_t widl_getline(char **linep, size_t *lenp, FILE *fp); UUID *parse_uuid(const char *u); int is_valid_uuid(const char *s); diff --git a/tools/widl/widl.c b/tools/widl/widl.c index c5e9d4090ce..37f1a5ed7b7 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -22,6 +22,7 @@ #include "config.h" #include "wine/port.h" +#include #include #include #include @@ -51,10 +52,12 @@ static const char usage[] = "Usage: widl [options...] infile.idl\n" +" or: widl [options...] --dlldata-only name1 [name2...]\n" " -c Generate client stub\n" " -C file Name of client stub file (default is infile_c.c)\n" " -d n Set debug level to 'n'\n" " -D id[=val] Define preprocessor identifier id=val\n" +" --dlldata=file Name of the dlldata file (default is dlldata.c)\n" " -E Preprocess only\n" " -h Generate headers\n" " -H file Name of header file (default is infile.h)\n" @@ -99,6 +102,7 @@ int do_proxies = 0; int do_client = 0; int do_server = 0; int do_idfile = 0; +int do_dlldata = 0; int no_preprocess = 0; int old_names = 0; @@ -106,6 +110,7 @@ char *input_name; char *header_name; char *header_token; char *typelib_name; +char *dlldata_name; char *proxy_name; char *proxy_token; char *client_name; @@ -128,6 +133,8 @@ time_t now; enum { OLDNAMES_OPTION = CHAR_MAX + 1, + DLLDATA_OPTION, + DLLDATA_ONLY_OPTION, PREFIX_ALL_OPTION, PREFIX_CLIENT_OPTION, PREFIX_SERVER_OPTION @@ -136,6 +143,8 @@ enum { static const char short_options[] = "cC:d:D:EhH:I:NpP:sS:tT:uU:VW"; static const struct option long_options[] = { + { "dlldata", required_argument, 0, DLLDATA_OPTION }, + { "dlldata-only", no_argument, 0, DLLDATA_ONLY_OPTION }, { "oldnames", no_argument, 0, OLDNAMES_OPTION }, { "prefix-all", required_argument, 0, PREFIX_ALL_OPTION }, { "prefix-client", required_argument, 0, PREFIX_CLIENT_OPTION }, @@ -177,6 +186,145 @@ static void exit_on_signal( int sig ) exit(1); /* this will call the atexit functions */ } +static void set_everything(int x) +{ + do_header = x; + do_typelib = x; + do_proxies = x; + do_client = x; + do_server = x; + do_idfile = x; + do_dlldata = x; +} + +static void start_cplusplus_guard(FILE *fp) +{ + fprintf(fp, "#ifdef __cplusplus\n"); + fprintf(fp, "extern \"C\" {\n"); + fprintf(fp, "#endif\n\n"); +} + +static void end_cplusplus_guard(FILE *fp) +{ + fprintf(fp, "#ifdef __cplusplus\n"); + fprintf(fp, "}\n"); + fprintf(fp, "#endif\n\n"); +} + +typedef struct +{ + char *filename; + struct list link; +} filename_node_t; + +static void add_filename_node(struct list *list, const char *name) +{ + filename_node_t *node = xmalloc(sizeof *node); + node->filename = xstrdup(name); + list_add_tail(list, &node->link); +} + +static void free_filename_nodes(struct list *list) +{ + filename_node_t *node, *next; + LIST_FOR_EACH_ENTRY_SAFE(node, next, list, filename_node_t, link) { + list_remove(&node->link); + free(node->filename); + free(node); + } +} + +static void write_dlldata_list(struct list *filenames) +{ + FILE *dlldata; + filename_node_t *node; + + dlldata = fopen(dlldata_name, "w"); + if (!dlldata) + error("couldn't open %s: %s\n", dlldata_name, strerror(errno)); + + fprintf(dlldata, "/*** Autogenerated by WIDL %s ", PACKAGE_VERSION); + fprintf(dlldata, "- Do not edit ***/\n\n"); + fprintf(dlldata, "#include \n"); + fprintf(dlldata, "#include \n\n"); + start_cplusplus_guard(dlldata); + + LIST_FOR_EACH_ENTRY(node, filenames, filename_node_t, link) + fprintf(dlldata, "EXTERN_PROXY_FILE(%s)\n", node->filename); + + fprintf(dlldata, "\nPROXYFILE_LIST_START\n"); + fprintf(dlldata, "/* Start of list */\n"); + LIST_FOR_EACH_ENTRY(node, filenames, filename_node_t, link) + fprintf(dlldata, " REFERENCE_PROXY_FILE(%s),\n", node->filename); + fprintf(dlldata, "/* End of list */\n"); + fprintf(dlldata, "PROXYFILE_LIST_END\n\n"); + + fprintf(dlldata, "DLLDATA_ROUTINES(aProxyFileList, GET_DLL_CLSID)\n\n"); + end_cplusplus_guard(dlldata); + fclose(dlldata); +} + +static char *eat_space(char *s) +{ + while (isspace((unsigned char) *s)) + ++s; + return s; +} + +void write_dlldata(ifref_list_t *ifaces) +{ + struct list filenames = LIST_INIT(filenames); + filename_node_t *node; + FILE *dlldata; + + if (!do_dlldata || !need_proxy_file(ifaces)) + return; + + dlldata = fopen(dlldata_name, "r"); + if (dlldata) { + static char marker[] = "REFERENCE_PROXY_FILE"; + char *line = NULL; + size_t len = 0; + + while (widl_getline(&line, &len, dlldata)) { + char *start, *end; + start = eat_space(line); + if (strncmp(start, marker, sizeof marker - 1) == 0) { + start = eat_space(start + sizeof marker - 1); + if (*start != '(') + continue; + end = start = eat_space(start + 1); + while (*end && *end != ')') + ++end; + if (*end != ')') + continue; + while (isspace((unsigned char) end[-1])) + --end; + *end = '\0'; + if (start < end) + add_filename_node(&filenames, start); + } + } + + if (ferror(dlldata)) + error("couldn't read from %s: %s\n", dlldata_name, strerror(errno)); + + free(line); + fclose(dlldata); + } + + LIST_FOR_EACH_ENTRY(node, &filenames, filename_node_t, link) + if (strcmp(proxy_token, node->filename) == 0) { + /* We're already in the list, no need to regenerate this file. */ + free_filename_nodes(&filenames); + return; + } + + add_filename_node(&filenames, proxy_token); + write_dlldata_list(&filenames); + free_filename_nodes(&filenames); +} + int main(int argc,char *argv[]) { extern char* optarg; @@ -195,6 +343,13 @@ int main(int argc,char *argv[]) while((optc = getopt_long(argc, argv, short_options, long_options, &opti)) != EOF) { switch(optc) { + case DLLDATA_OPTION: + dlldata_name = xstrdup(optarg); + break; + case DLLDATA_ONLY_OPTION: + do_everything = 0; + do_dlldata = 1; + break; case OLDNAMES_OPTION: old_names = 1; break; @@ -267,25 +422,43 @@ int main(int argc,char *argv[]) idfile_name = xstrdup(optarg); break; case 'V': - printf(version_string); + printf("%s", version_string); return 0; case 'W': pedantic = 1; break; default: - fprintf(stderr, usage); + fprintf(stderr, "%s", usage); return 1; } } if(do_everything) { - do_header = do_typelib = do_proxies = do_client = do_server = do_idfile = 1; + set_everything(TRUE); } + + if (!dlldata_name && do_dlldata) + dlldata_name = xstrdup("dlldata.c"); + if(optind < argc) { - input_name = xstrdup(argv[optind]); + if (do_dlldata && !do_everything) { + struct list filenames = LIST_INIT(filenames); + for ( ; optind < argc; ++optind) + add_filename_node(&filenames, argv[optind]); + + write_dlldata_list(&filenames); + free_filename_nodes(&filenames); + return 0; + } + else if (optind != argc - 1) { + fprintf(stderr, "%s", usage); + return 1; + } + else + input_name = xstrdup(argv[optind]); } else { - fprintf(stderr, usage); + fprintf(stderr, "%s", usage); return 1; } @@ -378,9 +551,7 @@ int main(int argc,char *argv[]) fprintf(header, "#include \n\n" ); fprintf(header, "#ifndef __WIDL_%s\n", header_token); fprintf(header, "#define __WIDL_%s\n", header_token); - fprintf(header, "#ifdef __cplusplus\n"); - fprintf(header, "extern \"C\" {\n"); - fprintf(header, "#endif\n"); + start_cplusplus_guard(header); } if (do_idfile) { @@ -397,9 +568,7 @@ int main(int argc,char *argv[]) fprintf(idfile, "#include \n"); fprintf(idfile, "#include \n\n"); fprintf(idfile, "#include \n\n"); - fprintf(idfile, "#ifdef __cplusplus\n"); - fprintf(idfile, "extern \"C\" {\n"); - fprintf(idfile, "#endif\n\n"); + start_cplusplus_guard(idfile); } init_types(); @@ -413,18 +582,14 @@ int main(int argc,char *argv[]) fprintf(header, "\n"); fprintf(header, "/* End additional prototypes */\n"); fprintf(header, "\n"); - fprintf(header, "#ifdef __cplusplus\n"); - fprintf(header, "}\n"); - fprintf(header, "#endif\n"); + end_cplusplus_guard(header); fprintf(header, "#endif /* __WIDL_%s */\n", header_token); fclose(header); } if (do_idfile) { fprintf(idfile, "\n"); - fprintf(idfile, "#ifdef __cplusplus\n"); - fprintf(idfile, "}\n"); - fprintf(idfile, "#endif\n"); + end_cplusplus_guard(idfile); fclose(idfile); } @@ -434,10 +599,9 @@ int main(int argc,char *argv[]) if(ret) { exit(1); } - header_name = NULL; - client_name = NULL; - server_name = NULL; - idfile_name = NULL; + + /* Everything has been done successfully, don't delete any files. */ + set_everything(FALSE); return 0; } @@ -446,10 +610,16 @@ static void rm_tempfile(void) abort_import(); if(temp_name) unlink(temp_name); - if (header_name) + if (do_header) unlink(header_name); - if (client_name) + if (do_client) unlink(client_name); - if (server_name) + if (do_server) unlink(server_name); + if (do_idfile) + unlink(idfile_name); + if (do_proxies) + unlink(proxy_name); + if (do_typelib) + unlink(typelib_name); } diff --git a/tools/widl/widl.h b/tools/widl/widl.h index a2b905c2225..4496a81b8c5 100644 --- a/tools/widl/widl.h +++ b/tools/widl/widl.h @@ -43,11 +43,13 @@ extern int do_proxies; extern int do_client; extern int do_server; extern int do_idfile; +extern int do_dlldata; extern int old_names; extern char *input_name; extern char *header_name; extern char *typelib_name; +extern char *dlldata_name; extern char *proxy_name; extern char *proxy_token; extern char *client_name; @@ -67,5 +69,6 @@ extern FILE* idfile; extern void write_proxies(ifref_list_t *ifaces); extern void write_client(ifref_list_t *ifaces); extern void write_server(ifref_list_t *ifaces); +extern void write_dlldata(ifref_list_t *ifaces); #endif diff --git a/tools/wine.inf b/tools/wine.inf index 542875004c4..80715fa6bc0 100644 --- a/tools/wine.inf +++ b/tools/wine.inf @@ -2180,6 +2180,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,mshtml.dll,1 11,,msi.dll,1 11,,msiexec.exe,1 +11,,msimtf.dll,1 11,,msxml3.dll,1 11,,objsel.dll,1 11,,ole32.dll,1 diff --git a/tools/winegcc/utils.c b/tools/winegcc/utils.c index c5b46a457fc..225062d307d 100644 --- a/tools/winegcc/utils.c +++ b/tools/winegcc/utils.c @@ -43,7 +43,6 @@ void error(const char* s, ...) va_start(ap, s); fprintf(stderr, "winegcc: "); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); exit(2); } @@ -53,7 +52,7 @@ void* xmalloc(size_t size) void* p; if ((p = malloc (size)) == NULL) - error("Could not malloc %d bytes.", size); + error("Could not malloc %d bytes\n", size); return p; } @@ -62,7 +61,7 @@ void *xrealloc(void* p, size_t size) { void* p2 = realloc (p, size); if (size && !p2) - error("Could not realloc %d bytes.", size); + error("Could not realloc %d bytes\n", size); return p2; } @@ -120,7 +119,7 @@ void strarray_add(strarray* arr, const char* str) void strarray_del(strarray* arr, unsigned int i) { - if (i >= arr->size) error("Invalid index i=%d", i); + if (i >= arr->size) error("Invalid index i=%d\n", i); memmove(&arr->base[i], &arr->base[i + 1], (arr->size - i - 1) * sizeof(arr->base[0])); arr->size--; } @@ -195,7 +194,7 @@ void create_file(const char* name, int mode, const char* fmt, ...) if (verbose) printf("Creating file %s\n", name); va_start(ap, fmt); if ( !(file = fopen(name, "w")) ) - error("Unable to open %s for writing.", name); + error("Unable to open %s for writing\n", name); vfprintf(file, fmt, ap); va_end(ap); fclose(file); @@ -327,7 +326,7 @@ void spawn(const strarray* prefix, const strarray* args, int ignore_errors) if ((status = spawnvp( _P_WAIT, argv[0], argv)) && !ignore_errors) { - if (status > 0) error("%s failed.", argv[0]); + if (status > 0) error("%s failed\n", argv[0]); else perror("winegcc"); exit(3); } diff --git a/tools/winegcc/winegcc.c b/tools/winegcc/winegcc.c index 3955276486d..38a1f5e911c 100644 --- a/tools/winegcc/winegcc.c +++ b/tools/winegcc/winegcc.c @@ -201,7 +201,7 @@ static char* get_temp_file(const char* prefix, const char* suffix) free(tmp); tmp = strmake("/tmp/%s-XXXXXX%s", prefix, suffix); fd = mkstemps( tmp, strlen(suffix) ); - if (fd == -1) error( "could not create temp file" ); + if (fd == -1) error( "could not create temp file\n" ); } close( fd ); strarray_add(tmp_files, tmp); @@ -233,7 +233,7 @@ static const strarray* get_translator(enum processor processor) if (!as) as = strarray_fromstring(AS, " "); return as; } - error("Unknown processor"); + error("Unknown processor\n"); } static void compile(struct options* opts, const char* lang) @@ -507,12 +507,12 @@ static void build(struct options* opts) case file_def: case file_spec: if (spec_file) - error("Only one spec file can be specified."); + error("Only one spec file can be specified\n"); spec_file = file; break; case file_rc: /* FIXME: invoke wrc to build it */ - error("Can't compile .rc file at the moment: %s", file); + error("Can't compile .rc file at the moment: %s\n", file); break; case file_res: strarray_add(files, strmake("-r%s", file)); @@ -527,7 +527,7 @@ static void build(struct options* opts) strarray_add(files, strmake("-s%s", file)); break; case file_na: - error("File does not exist: %s", file); + error("File does not exist: %s\n", file); break; default: file = compile_to_object(opts, file, lang); @@ -541,7 +541,7 @@ static void build(struct options* opts) lang = file; } if (opts->shared && !spec_file) - error("A spec file is currently needed in shared mode"); + error("A spec file is currently needed in shared mode\n"); /* add the default libraries, if needed */ if (!opts->nostdlib && opts->use_msvcrt) add_library(lib_dirs, files, "msvcrt"); @@ -1020,7 +1020,7 @@ int main(int argc, char **argv) } if (opts.processor == proc_cpp) linking = 0; - if (linking == -1) error("Static linking is not supported."); + if (linking == -1) error("Static linking is not supported\n"); if (opts.files->size == 0) forward(argc, argv, &opts); else if (linking) build(&opts); diff --git a/tools/wmc/mcl.c b/tools/wmc/mcl.c index 1c16fe3ce77..380c06c7e34 100644 --- a/tools/wmc/mcl.c +++ b/tools/wmc/mcl.c @@ -156,7 +156,7 @@ void set_codepage(int cp) codepage = cp; codepage_def = find_codepage(codepage); if(!codepage_def) - xyyerror("Codepage %d not found; cannot process", codepage); + xyyerror("Codepage %d not found; cannot process\n", codepage); } /* @@ -203,7 +203,7 @@ try_again: assert(codepage_def != NULL); n = wine_cp_mbstowcs(codepage_def, 0, xlatebuffer, strlen(xlatebuffer)+1, inputbuffer, INPUTBUFFER_SIZE); if(n < 0) - internal_error(__FILE__, __LINE__, "Could not translate to unicode (%d)", n); + internal_error(__FILE__, __LINE__, "Could not translate to unicode (%d)\n", n); if(n <= 1) goto try_again; /* Should not hapen */ n--; /* Strip added conversion '\0' from input length */ @@ -224,7 +224,7 @@ try_again: if(!n && ferror(yyin)) xyyerror(err_fatalread); else - xyyerror("Fatal: file to short to determine byteorder (should never happen)"); + xyyerror("Fatal: file to short to determine byteorder (should never happen)\n"); } if(isisochar(inputbuffer[0]) && isisochar(inputbuffer[1]) && @@ -249,7 +249,7 @@ try_again: #endif } else - xyyerror("Fatal: cannot determine file's byteorder"); + xyyerror("Fatal: cannot determine file's byteorder\n"); /* FIXME: * Determine the file-endian with the leader-bytes * "FF FE..."; can't remember the exact sequence. @@ -302,7 +302,7 @@ try_again: if(!n) { - mcy_warning("Re-read line (input was or converted to zilch)"); + mcy_warning("Re-read line (input was or converted to zilch)\n"); goto try_again; /* Should not happen, but could be due to stdin reading and a signal */ } @@ -458,7 +458,7 @@ static int scan_number(int ch) while(1) { if(!isisochar(ch)) - xyyerror("Invalid digit"); + xyyerror("Invalid digit\n"); switch(state) { @@ -472,7 +472,7 @@ static int scan_number(int ch) state = 4; } else - internal_error(__FILE__, __LINE__, "Non-digit in first number-scanner state"); + internal_error(__FILE__, __LINE__, "Non-digit in first number-scanner state\n"); break; case 1: if(ch == 'x' || ch == 'X') @@ -486,7 +486,7 @@ static int scan_number(int ch) state = 3; } else if(isalpha(ch) || ch == '_') - xyyerror("Invalid number digit"); + xyyerror("Invalid number digit\n"); else { unget_unichar(ch); @@ -498,7 +498,7 @@ static int scan_number(int ch) if(isxdigit(ch)) push_char(ch); else if(isalpha(ch) || ch == '_' || !isxdigit(tos_char_stack())) - xyyerror("Invalid hex digit"); + xyyerror("Invalid hex digit\n"); else { base = 16; @@ -509,7 +509,7 @@ static int scan_number(int ch) if(ch >= '0' && ch <= '7') push_char(ch); else if(isalnum(ch) || ch == '_') - xyyerror("Invalid octal digit"); + xyyerror("Invalid octal digit\n"); else { base = 8; @@ -520,7 +520,7 @@ static int scan_number(int ch) if(isdigit(ch)) push_char(ch); else if(isalnum(ch) || ch == '_') - xyyerror("Invalid decimal digit"); + xyyerror("Invalid decimal digit\n"); else { base = 10; @@ -528,7 +528,7 @@ static int scan_number(int ch) } break; default: - internal_error(__FILE__, __LINE__, "Invalid state in number-scanner"); + internal_error(__FILE__, __LINE__, "Invalid state in number-scanner\n"); } ch = get_unichar(); } @@ -626,7 +626,7 @@ int mcy_lex(void) while((ch = get_unichar()) != '\n') { if(ch == EOF) - xyyerror("Unexpected EOF"); + xyyerror("Unexpected EOF\n"); push_unichar(ch); } newline(); @@ -710,7 +710,7 @@ int mcy_lex(void) return tTOKEN; default: - internal_error(__FILE__, __LINE__, "Invalid token type encountered"); + internal_error(__FILE__, __LINE__, "Invalid token type encountered\n"); } } @@ -741,7 +741,7 @@ int mcy_lex(void) mcy_lval.str = xunistrdup(get_unichar_stack()); return tCOMMENT; default: - xyyerror("Invalid character '%c' (0x%04x)", isisochar(ch) && isprint(ch) ? ch : '.', ch); + xyyerror("Invalid character '%c' (0x%04x)\n", isisochar(ch) && isprint(ch) ? ch : '.', ch); } } } diff --git a/tools/wmc/mcy.y b/tools/wmc/mcy.y index 836bf55ed2e..2887df56b6d 100644 --- a/tools/wmc/mcy.y +++ b/tools/wmc/mcy.y @@ -122,7 +122,7 @@ static cp_xlat_t *find_cpxlat(int lan); %% file : items { if(!check_languages(nodehead)) - xyyerror("No messages defined"); + xyyerror("No messages defined\n"); lanblockhead = block_messages(nodehead); } ; @@ -165,7 +165,7 @@ global : tSEVNAMES '=' '(' smaps ')' base = $3; break; default: - xyyerror("Numberbase must be 8, 10 or 16"); + xyyerror("Numberbase must be 8, 10 or 16\n"); } } | tBASE '=' error { xyyerror(err_number); } @@ -184,7 +184,7 @@ smap : token '=' tNUMBER alias { $1->token = $3; $1->alias = $4; if($3 & (~0x3)) - xyyerror("Severity value out of range (0x%08x > 0x3)", $3); + xyyerror("Severity value out of range (0x%08x > 0x3)\n", $3); do_add_token(tok_severity, $1, "severity"); } | token '=' error { xyyerror(err_number); } @@ -203,7 +203,7 @@ fmap : token '=' tNUMBER alias { $1->token = $3; $1->alias = $4; if($3 & (~0xfff)) - xyyerror("Facility value out of range (0x%08x > 0xfff)", $3); + xyyerror("Facility value out of range (0x%08x > 0xfff)\n", $3); do_add_token(tok_facility, $1, "facility"); } | token '=' error { xyyerror(err_number); } @@ -229,9 +229,9 @@ lmap : token '=' tNUMBER setfile ':' tFILE optcp { $1->codepage = $7; do_add_token(tok_language, $1, "language"); if(!find_language($3) && !find_cpxlat($3)) - mcy_warning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override", $3, WMC_DEFAULT_CODEPAGE); + mcy_warning("Language 0x%x not built-in, using codepage %d; use explicit codepage to override\n", $3, WMC_DEFAULT_CODEPAGE); } - | token '=' tNUMBER setfile ':' error { xyyerror("Filename expected"); } + | token '=' tNUMBER setfile ':' error { xyyerror("Filename expected\n"); } | token '=' tNUMBER error { xyyerror(err_colon); } | token '=' error { xyyerror(err_number); } | token error { xyyerror(err_assign); } @@ -239,7 +239,7 @@ lmap : token '=' tNUMBER setfile ':' tFILE optcp { optcp : /* Empty */ { $$ = 0; } | ':' tNUMBER { $$ = $2; } - | ':' error { xyyerror("Codepage-number expected"); } + | ':' error { xyyerror("Codepage-number expected\n"); } ; /*---------------------------------------------------------------------- @@ -253,7 +253,7 @@ cmaps : cmap cmap : clan '=' tNUMBER ':' tNUMBER { static const char err_nocp[] = "Codepage %d not builtin; cannot convert"; if(find_cpxlat($1)) - xyyerror("Codepage translation already defined for language 0x%x", $1); + xyyerror("Codepage translation already defined for language 0x%x\n", $1); if($3 && !find_codepage($3)) xyyerror(err_nocp, $3); if($5 && !find_codepage($5)) @@ -269,7 +269,7 @@ cmap : clan '=' tNUMBER ':' tNUMBER { clan : tNUMBER { $$ = $1; } | tTOKEN { if($1->type != tok_language) - xyyerror("Language name or code expected"); + xyyerror("Language name or code expected\n"); $$ = $1->token; } ; @@ -282,7 +282,7 @@ msg : msgid sevfacsym { test_id($1); } bodies { $$ = complete_msg($4, $1); } msgid : tMSGID '=' id { if($3 & (~0xffff)) - xyyerror("Message ID value out of range (0x%08x > 0xffff)", $3); + xyyerror("Message ID value out of range (0x%08x > 0xffff)\n", $3); $$ = $3; } | tMSGID error { xyyerror(err_assign); } @@ -295,9 +295,9 @@ id : /* Empty */ { $$ = ++last_id; } ; sevfacsym: /* Empty */ { have_sev = have_fac = have_sym = 0; } - | sevfacsym sev { if(have_sev) xyyerror("Severity already defined"); have_sev = 1; } - | sevfacsym fac { if(have_fac) xyyerror("Facility already defined"); have_fac = 1; } - | sevfacsym sym { if(have_sym) xyyerror("Symbolname already defined"); have_sym = 1; } + | sevfacsym sev { if(have_sev) xyyerror("Severity already defined\n"); have_sev = 1; } + | sevfacsym fac { if(have_fac) xyyerror("Facility already defined\n"); have_fac = 1; } + | sevfacsym sym { if(have_sym) xyyerror("Symbolname already defined\n"); have_sym = 1; } ; sym : tSYMNAME '=' tIDENT { last_sym = $3; } @@ -308,9 +308,9 @@ sym : tSYMNAME '=' tIDENT { last_sym = $3; } sev : tSEVERITY '=' token { token_t *tok = lookup_token($3->name); if(!tok) - xyyerror("Undefined severityname"); + xyyerror("Undefined severityname\n"); if(tok->type != tok_severity) - xyyerror("Identifier is not of class 'severity'"); + xyyerror("Identifier is not of class 'severity'\n"); last_sev = tok->token; } | tSEVERITY '=' error { xyyerror(err_ident); } @@ -320,9 +320,9 @@ sev : tSEVERITY '=' token { fac : tFACILITY '=' token { token_t *tok = lookup_token($3->name); if(!tok) - xyyerror("Undefined facilityname"); + xyyerror("Undefined facilityname\n"); if(tok->type != tok_facility) - xyyerror("Identifier is not of class 'facility'"); + xyyerror("Identifier is not of class 'facility'\n"); last_fac = tok->token; } | tFACILITY '=' error { xyyerror(err_ident); } @@ -334,7 +334,7 @@ fac : tFACILITY '=' token { */ bodies : body { $$ = add_lanmsg(NULL, $1); } | bodies body { $$ = add_lanmsg($1, $2); } - | error { xyyerror("'Language=...' (start of message text-definition) expected"); } + | error { xyyerror("'Language=...' (start of message text-definition) expected\n"); } ; body : lang setline lines tMSGEND { $$ = new_lanmsg(&$1, $3); } @@ -349,9 +349,9 @@ lang : tLANGUAGE setnl '=' token tNL { token_t *tok = lookup_token($4->name); cp_xlat_t *cpx; if(!tok) - xyyerror("Undefined language"); + xyyerror("Undefined language\n"); if(tok->type != tok_language) - xyyerror("Identifier is not of class 'language'"); + xyyerror("Identifier is not of class 'language'\n"); if((cpx = find_cpxlat(tok->token))) { set_codepage($$.codepage = cpx->cpin); @@ -374,7 +374,7 @@ lang : tLANGUAGE setnl '=' token tNL { set_codepage($$.codepage = tok->codepage); $$.language = tok->token; } - | tLANGUAGE setnl '=' token error { xyyerror("Missing newline"); } + | tLANGUAGE setnl '=' token error { xyyerror("Missing newline\n"); } | tLANGUAGE setnl '=' error { xyyerror(err_ident); } | tLANGUAGE error { xyyerror(err_assign); } ; @@ -419,12 +419,12 @@ static void do_add_token(tok_e type, token_t *tok, const char *code) if(tp) { if(tok->type != type) - mcy_warning("Type change in token"); + mcy_warning("Type change in token\n"); if(tp != tok) - xyyerror("Overlapping token not the same"); + xyyerror("Overlapping token not the same\n"); /* else its already defined and changed */ if(tok->fixed) - xyyerror("Redefinition of %s", code); + xyyerror("Redefinition of %s\n", code); tok->fixed = 1; } else @@ -442,7 +442,7 @@ static lanmsg_t *new_lanmsg(lan_cp_t *lcp, WCHAR *msg) lmp->msg = msg; lmp->len = unistrlen(msg) + 1; /* Include termination */ if(lmp->len > 4096) - mcy_warning("Message exceptionally long; might be a missing termination"); + mcy_warning("Message exceptionally long; might be a missing termination\n"); return lmp; } @@ -460,7 +460,7 @@ static msg_t *add_lanmsg(msg_t *msg, lanmsg_t *lanmsg) for(i = 0; i < msg->nmsgs-1; i++) { if(msg->msgs[i]->lan == lanmsg->lan) - xyyerror("Message for language 0x%x already defined", lanmsg->lan); + xyyerror("Message for language 0x%x already defined\n", lanmsg->lan); } return msg; } @@ -477,7 +477,7 @@ static msg_t *complete_msg(msg_t *mp, int id) if(have_sym) mp->sym = last_sym; else - xyyerror("No symbolic name defined for message id %d", id); + xyyerror("No symbolic name defined for message id %d\n", id); mp->sev = last_sev; mp->fac = last_fac; qsort(mp->msgs, mp->nmsgs, sizeof(*(mp->msgs)), sort_lanmsg); @@ -516,7 +516,7 @@ static void test_id(int id) if(ndp->type != nd_msg) continue; if(ndp->u.msg->id == id && ndp->u.msg->sev == last_sev && ndp->u.msg->fac == last_fac) - xyyerror("MessageId %d with facility 0x%x and severity 0x%x already defined", id, last_fac, last_sev); + xyyerror("MessageId %d with facility 0x%x and severity 0x%x already defined\n", id, last_fac, last_sev); } } diff --git a/tools/wmc/utils.c b/tools/wmc/utils.c index bdcd6c04d65..2b29db9bb1f 100644 --- a/tools/wmc/utils.c +++ b/tools/wmc/utils.c @@ -38,7 +38,6 @@ static void generic_msg(const char *s, const char *t, va_list ap) { fprintf(stderr, "%s:%d:%d: %s: ", input_name ? input_name : "stdin", line_number, char_number, t); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); } /* @@ -85,7 +84,6 @@ void internal_error(const char *file, int line, const char *s, ...) va_start(ap, s); fprintf(stderr, "Internal error (please report) %s %d: ", file, line); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); exit(3); } @@ -96,7 +94,6 @@ void error(const char *s, ...) va_start(ap, s); fprintf(stderr, "Error: "); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); exit(2); } @@ -107,7 +104,6 @@ void warning(const char *s, ...) va_start(ap, s); fprintf(stderr, "Warning: "); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); } diff --git a/tools/wmc/write.c b/tools/wmc/write.c index 13b72634a21..40c3357e71f 100644 --- a/tools/wmc/write.c +++ b/tools/wmc/write.c @@ -101,11 +101,11 @@ static char *dup_u2c(int cp, const WCHAR *uc) char *cptr; const union cptable *cpdef = find_codepage(cp); if(!cpdef) - internal_error(__FILE__, __LINE__, "Codepage %d not found (vanished?)", cp); + internal_error(__FILE__, __LINE__, "Codepage %d not found (vanished?)\n", cp); len = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, NULL, 0, NULL, NULL); cptr = xmalloc(len); if((len = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, cptr, len, NULL, NULL)) < 0) - internal_error(__FILE__, __LINE__, "Buffer overflow? code %d.", len); + internal_error(__FILE__, __LINE__, "Buffer overflow? code %d\n", len); return cptr; } @@ -271,13 +271,13 @@ void write_h_file(const char *fname) fprintf(fp, "#define %s\t0x%08xL\n\n", cptr, ndp->u.msg->realid); break; default: - internal_error(__FILE__, __LINE__, "Invalid base for number print"); + internal_error(__FILE__, __LINE__, "Invalid base for number print\n"); } free(cptr); free(cast); break; default: - internal_error(__FILE__, __LINE__, "Invalid node type %d", ndp->type); + internal_error(__FILE__, __LINE__, "Invalid node type %d\n", ndp->type); } } fprintf(fp, "\n#endif\n"); @@ -307,7 +307,7 @@ static void write_rcbin(FILE *fp) } } if(!cptr) - internal_error(__FILE__, __LINE__, "Filename vanished for language 0x%0x", lbp->lan); + internal_error(__FILE__, __LINE__, "Filename vanished for language 0x%0x\n", lbp->lan); fprintf(fp, "1 MESSAGETABLE \"%s.bin\"\n", cptr); free(cptr); } @@ -389,7 +389,7 @@ static char *make_string(WCHAR *uc, int len, int codepage) mlen = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, NULL, 0, NULL, NULL); cc = tmp = xmalloc(mlen); if((i = wine_cp_wcstombs(cpdef, 0, uc, unistrlen(uc)+1, tmp, mlen, NULL, NULL)) < 0) - internal_error(__FILE__, __LINE__, "Buffer overflow? code %d.", i); + internal_error(__FILE__, __LINE__, "Buffer overflow? code %d\n", i); *cptr++ = ' '; *cptr++ = '"'; for(i = b = 0; i < len; i++, cc++) diff --git a/tools/wrc/genres.c b/tools/wrc/genres.c index da5ca56e5ed..f90d93fb7f5 100644 --- a/tools/wrc/genres.c +++ b/tools/wrc/genres.c @@ -272,7 +272,7 @@ static void string_to_upper(string_t *str) } else { - internal_error(__FILE__, __LINE__, "Invalid string type %d", str->type); + internal_error(__FILE__, __LINE__, "Invalid string type %d\n", str->type); } } @@ -313,7 +313,7 @@ static void put_string(res_t *res, const string_t *str, enum str_e type, int ist { if (!check_unicode_conversion( str, newstr, codepage )) error( "String %s does not convert identically to Unicode and back in codepage %d. " - "Try using a Unicode string instead.", str->str.cstr, codepage ); + "Try using a Unicode string instead\n", str->str.cstr, codepage ); } if (!isterm) put_word(res, newstr->size); for(cnt = 0; cnt < newstr->size; cnt++) @@ -366,7 +366,7 @@ static void put_name_id(res_t *res, name_id_t *nid, int upcase, const language_t } else { - internal_error(__FILE__, __LINE__, "Invalid name_id type %d", nid->type); + internal_error(__FILE__, __LINE__, "Invalid name_id type %d\n", nid->type); } } @@ -597,7 +597,7 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg) if(ctrl->ctlclass) put_name_id(res, ctrl->ctlclass, TRUE, dlg->lvc.language); else - internal_error(__FILE__, __LINE__, "Control has no control-class"); + internal_error(__FILE__, __LINE__, "Control has no control-class\n"); if(ctrl->title) put_name_id(res, ctrl->title, FALSE, dlg->lvc.language); else @@ -665,10 +665,10 @@ static res_t *dialog2res(name_id_t *name, dialog_t *dlg) else if(ctrl->ctlclass->type == name_str) put_name_id(res, ctrl->ctlclass, FALSE, NULL); else - error("Unknown control-class %04x", ctrl->ctlclass->name.i_name); + error("Unknown control-class %04x\n", ctrl->ctlclass->name.i_name); } else - internal_error(__FILE__, __LINE__, "Control has no control-class"); + internal_error(__FILE__, __LINE__, "Control has no control-class\n"); if(ctrl->title) put_name_id(res, ctrl->title, FALSE, NULL); else @@ -772,7 +772,7 @@ static res_t *dialogex2res(name_id_t *name, dialogex_t *dlgex) if(ctrl->ctlclass) put_name_id(res, ctrl->ctlclass, TRUE, dlgex->lvc.language); else - internal_error(__FILE__, __LINE__, "Control has no control-class"); + internal_error(__FILE__, __LINE__, "Control has no control-class\n"); if(ctrl->title) put_name_id(res, ctrl->title, FALSE, dlgex->lvc.language); else @@ -1454,7 +1454,7 @@ static res_t *stringtable2res(stringtable_t *stt) { if(!stt->nentries) { - warning("Empty internal stringtable"); + warning("Empty internal stringtable\n"); continue; } name.type = name_ord; @@ -1591,7 +1591,7 @@ static void versionblock2res(res_t *res, ver_block_t *blk, int level, const lang } else { - internal_error(__FILE__, __LINE__, "Invalid value indicator %d in VERSIONINFO", val->type); + internal_error(__FILE__, __LINE__, "Invalid value indicator %d in VERSIONINFO\n", val->type); } } @@ -1794,7 +1794,7 @@ char *prep_nid_for_label(const name_id_t *nid) if((unsigned)*sptr < 0x80 && isprint(*sptr & 0xff)) buf[i] = *sptr++; else - warning("Resourcename (str_unicode) contain unprintable characters or invalid translation, ignored"); + warning("Resourcename (str_unicode) contain unprintable characters or invalid translation, ignored\n"); } buf[i] = '\0'; } @@ -1809,7 +1809,7 @@ char *prep_nid_for_label(const name_id_t *nid) if((unsigned)*cptr < 0x80 && isprint(*cptr & 0xff)) buf[i] = *cptr++; else - warning("Resourcename (str_char) contain unprintable characters, ignored"); + warning("Resourcename (str_char) contain unprintable characters, ignored\n"); } buf[i] = '\0'; } @@ -1819,7 +1819,7 @@ char *prep_nid_for_label(const name_id_t *nid) } else { - internal_error(__FILE__, __LINE__, "Resource name_id with invalid type %d", nid->type); + internal_error(__FILE__, __LINE__, "Resource name_id with invalid type %d\n", nid->type); } return buf; } @@ -2000,7 +2000,7 @@ void resources2res(resource_t *top) top->binres = anicurico2res(top->name, top->res.ani, top->type); break; default: - internal_error(__FILE__, __LINE__, "Unknown resource type encountered %d in binary res generation", top->type); + internal_error(__FILE__, __LINE__, "Unknown resource type encountered %d in binary res generation\n", top->type); } top->c_name = make_c_name(get_c_typename(top->type), top->name, top->lan); top = top->next; diff --git a/tools/wrc/newstruc.c b/tools/wrc/newstruc.c index 9c215e4b952..07a8209cdde 100644 --- a/tools/wrc/newstruc.c +++ b/tools/wrc/newstruc.c @@ -327,7 +327,7 @@ static int convert_bitmap(char *data, int size) type |= FL_SIZEBE | FL_OS2; } else - parser_error("Invalid bitmap format, bih->biSize = %d", bih->biSize); + parser_error("Invalid bitmap format, bih->biSize = %d\n", bih->biSize); switch(type) { @@ -336,12 +336,12 @@ static int convert_bitmap(char *data, int size) case FL_SIZEBE: case FL_SIZEBE | FL_V4: case FL_SIZEBE | FL_OS2: - parser_warning("Bitmap v%c signature little-endian, but size big-endian", type & FL_V4 ? '4' : '3'); + parser_warning("Bitmap v%c signature little-endian, but size big-endian\n", type & FL_V4 ? '4' : '3'); break; case FL_SIGBE: case FL_SIGBE | FL_V4: case FL_SIGBE | FL_OS2: - parser_warning("Bitmap v%c signature big-endian, but size little-endian", type & FL_V4 ? '4' : '3'); + parser_warning("Bitmap v%c signature big-endian, but size little-endian\n", type & FL_V4 ? '4' : '3'); break; } @@ -461,7 +461,7 @@ static void split_icons(raw_data_t *rd, icon_group_t *icog, int *nico) else if(BYTESWAP_WORD(ih->type) == 1) swap = 1; else - parser_error("Icon resource data has invalid type id %d", ih->type); + parser_error("Icon resource data has invalid type id %d\n", ih->type); cnt = swap ? BYTESWAP_WORD(ih->count) : ih->count; for(i = 0; i < cnt; i++) @@ -481,7 +481,7 @@ static void split_icons(raw_data_t *rd, icon_group_t *icog, int *nico) } if(ide.offset > rd->size || ide.offset + ide.ressize > rd->size) - parser_error("Icon resource data corrupt"); + parser_error("Icon resource data corrupt\n"); ico->width = ide.width; ico->height = ide.height; ico->nclr = ide.nclr; @@ -556,7 +556,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur) else if(BYTESWAP_WORD(ch->type) == 2) swap = 1; else - parser_error("Cursor resource data has invalid type id %d", ch->type); + parser_error("Cursor resource data has invalid type id %d\n", ch->type); cnt = swap ? BYTESWAP_WORD(ch->count) : ch->count; for(i = 0; i < cnt; i++) { @@ -575,7 +575,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur) } if(cde.offset > rd->size || cde.offset + cde.ressize > rd->size) - parser_error("Cursor resource data corrupt"); + parser_error("Cursor resource data corrupt\n"); cur->width = cde.width; cur->height = cde.height; cur->nclr = cde.nclr; @@ -598,7 +598,7 @@ static void split_cursors(raw_data_t *rd, cursor_group_t *curg, int *ncur) cur->bits = info.biBitCount; } if(!win32 && (cur->planes != 1 || cur->bits != 1)) - parser_warning("Win16 cursor contains colors"); + parser_warning("Win16 cursor contains colors\n"); cur->xhot = swap ? BYTESWAP_WORD(cde.xhot) : cde.xhot; cur->yhot = swap ? BYTESWAP_WORD(cde.yhot) : cde.yhot; cur->data = new_raw_data(); @@ -840,7 +840,7 @@ ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt) else if(rtp->size + 2*sizeof(DWORD) == rd->size) isswapped = 0; else - parser_error("Animated %s has an invalid RIFF length", anistr); + parser_error("Animated %s has an invalid RIFF length\n", anistr); switch(byteorder) { @@ -1002,7 +1002,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) msg->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE; if(rd->size < sizeof(DWORD)) - parser_error("Invalid messagetable, size too small"); + parser_error("Invalid messagetable, size too small\n"); nblk = *(DWORD *)rd->data; lo = WRC_LOWORD(nblk); @@ -1017,9 +1017,9 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) * the ID, offset and length (and flag) fields to be very sure. */ if(hi && lo) - internal_error(__FILE__, __LINE__, "Messagetable contains more than 65535 blocks; cannot determine endian"); + internal_error(__FILE__, __LINE__, "Messagetable contains more than 65535 blocks; cannot determine endian\n"); if(!hi && !lo) - parser_error("Invalid messagetable block count 0"); + parser_error("Invalid messagetable block count 0\n"); if(!hi && lo) /* Messagetable byteorder == native byteorder */ { @@ -1032,7 +1032,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) mbp = (msgtab_block_t *)&(((DWORD *)rd->data)[1]); if(MSGTAB_BAD_PTR(mbp, rd->data, rd->size, nblk * sizeof(*mbp))) - parser_error("Messagetable's blocks are outside of defined data"); + parser_error("Messagetable's blocks are outside of defined data\n"); for(i = 0; i < nblk; i++) { msgtab_entry_t *mep, *next_mep; @@ -1043,7 +1043,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) for(id = mbp[i].idlo; id <= mbp[i].idhi; id++) { if(MSGTAB_BAD_PTR(mep, rd->data, rd->size, mep->length)) - parser_error("Messagetable's data for block %d, ID 0x%08x is outside of defined data", i, id); + parser_error("Messagetable's data for block %d, ID 0x%08x is outside of defined data\n", i, id); if(mep->flags == 1) /* Docu says 'flags == 0x0001' for unicode */ { WORD *wp = (WORD *)&mep[1]; @@ -1051,7 +1051,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) int n; if(mep->length & 1) - parser_error("Message 0x%08x is unicode (block %d), but has odd length (%d)", id, i, mep->length); + parser_error("Message 0x%08x is unicode (block %d), but has odd length (%d)\n", id, i, mep->length); for(n = 0; n < l; n++) wp[n] = BYTESWAP_WORD(wp[n]); @@ -1079,7 +1079,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) mbp = (msgtab_block_t *)&(((DWORD *)rd->data)[1]); nblk = BYTESWAP_DWORD(nblk); if(MSGTAB_BAD_PTR(mbp, rd->data, rd->size, nblk * sizeof(*mbp))) - parser_error("Messagetable's blocks are outside of defined data"); + parser_error("Messagetable's blocks are outside of defined data\n"); for(i = 0; i < nblk; i++) { msgtab_entry_t *mep; @@ -1096,7 +1096,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) mep->flags = BYTESWAP_WORD(mep->flags); if(MSGTAB_BAD_PTR(mep, rd->data, rd->size, mep->length)) - parser_error("Messagetable's data for block %d, ID 0x%08x is outside of defined data", i, id); + parser_error("Messagetable's data for block %d, ID 0x%08x is outside of defined data\n", i, id); if(mep->flags == 1) /* Docu says 'flags == 0x0001' for unicode */ { WORD *wp = (WORD *)&mep[1]; @@ -1104,7 +1104,7 @@ messagetable_t *new_messagetable(raw_data_t *rd, int *memopt) int n; if(mep->length & 1) - parser_error("Message 0x%08x is unicode (block %d), but has odd length (%d)", id, i, mep->length); + parser_error("Message 0x%08x is unicode (block %d), but has odd length (%d)\n", id, i, mep->length); for(n = 0; n < l; n++) wp[n] = BYTESWAP_WORD(wp[n]); diff --git a/tools/wrc/parser.l b/tools/wrc/parser.l index 4b0a7db24a6..98f9c85d778 100644 --- a/tools/wrc/parser.l +++ b/tools/wrc/parser.l @@ -324,10 +324,10 @@ static struct keyword *iskeyword(char *kw) yy_pop_state(); lineno = (int)strtol(yytext, &cptr, 10); if(!lineno) - parser_error("Malformed '#...' line-directive; invalid linenumber"); + parser_error("Malformed '#...' line-directive; invalid linenumber\n"); fname = strchr(cptr, '"'); if(!fname) - parser_error("Malformed '#...' line-directive; missing filename"); + parser_error("Malformed '#...' line-directive; missing filename\n"); fname++; cptr = strchr(fname, '"'); if(!cptr) @@ -344,7 +344,7 @@ static struct keyword *iskeyword(char *kw) } code_page[^\n]* yyless(9); yy_pop_state(); yy_push_state(pp_code_page); -[^\n]* yy_pop_state(); if (pedantic) parser_warning("Unrecognized #pragma directive '%s'",yytext); +[^\n]* yy_pop_state(); if (pedantic) parser_warning("Unrecognized #pragma directive '%s'\n",yytext); \({ws}*default{ws}*\)[^\n]* current_codepage = -1; yy_pop_state(); \({ws}*utf8{ws}*\)[^\n]* current_codepage = CP_UTF8; yy_pop_state(); @@ -355,11 +355,11 @@ static struct keyword *iskeyword(char *kw) current_codepage = strtol( p, NULL, 10 ); if (current_codepage && current_codepage != CP_UTF8 && !wine_cp_get_table( current_codepage )) { - parser_error("Codepage %d not supported", current_codepage); + parser_error("Codepage %d not supported\n", current_codepage); current_codepage = 0; } } -[^\n]* yy_pop_state(); parser_error("Malformed #pragma code_page directive"); +[^\n]* yy_pop_state(); parser_error("Malformed #pragma code_page directive\n"); /* * Strip everything until a ';' taking @@ -423,7 +423,7 @@ L\" { unsigned int result; result = strtoul(yytext+1, 0, 8); if ( result > 0xffff ) - parser_error("Character constant out of range"); + parser_error("Character constant out of range\n"); addwchar((WCHAR)result); } \\x[0-9a-fA-F]{4} { /* hex escape sequence */ @@ -431,9 +431,9 @@ L\" { result = strtoul(yytext+2, 0, 16); addwchar((WCHAR)result); } -\\x[0-9a-fA-F]{1,3} { parser_error("Invalid hex escape sequence '%s'", yytext); } +\\x[0-9a-fA-F]{1,3} { parser_error("Invalid hex escape sequence '%s'\n", yytext); } -\\[0-9]+ parser_error("Bad escape sequence"); +\\[0-9]+ parser_error("Bad escape sequence\n"); \\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ \\a addwchar('\a'); \\b addwchar('\b'); @@ -452,7 +452,7 @@ L\" { while(*yptr) /* FIXME: codepage translation */ addwchar(*yptr++ & 0xff); } -\n parser_error("Unterminated string"); +\n parser_error("Unterminated string\n"); /* * Normal string scanning @@ -468,7 +468,7 @@ L\" { int result; result = strtol(yytext+1, 0, 8); if ( result > 0xff ) - parser_error("Character constant out of range"); + parser_error("Character constant out of range\n"); addcchar((char)result); } \\x[0-9a-fA-F]{2} { /* hex escape sequence */ @@ -476,9 +476,9 @@ L\" { result = strtol(yytext+2, 0, 16); addcchar((char)result); } -\\x[0-9a-fA-F] { parser_error("Invalid hex escape sequence '%s'", yytext); } +\\x[0-9a-fA-F] { parser_error("Invalid hex escape sequence '%s'\n", yytext); } -\\[0-9]+ parser_error("Bad escape sequence"); +\\[0-9]+ parser_error("Bad escape sequence\n"); \\\n{ws}* line_number++; char_number = 1; /* backslash at EOL continues string after leading whitespace on next line */ \\a addcchar('\a'); \\b addcchar('\b'); @@ -497,7 +497,7 @@ L\" { \"\" addcchar('\"'); /* "bla""bla" -> "bla\"bla" */ \\\"\" addcchar('\"'); /* "bla\""bla" -> "bla\"bla" */ \"{ws}+\" ; /* "bla" "bla" -> "blabla" */ -\n parser_error("Unterminated string"); +\n parser_error("Unterminated string\n"); /* * Raw data scanning @@ -518,7 +518,7 @@ L\" { } {ws}+ ; /* Ignore space */ \n line_number++; char_number = 1; -. parser_error("Malformed data-line"); +. parser_error("Malformed data-line\n"); /* * Comment stripping @@ -528,7 +528,7 @@ L\" { yy_push_state(comment); save_wanted_id = wanted_id; if(!no_preprocess) - parser_warning("Found comments after preprocessing, please report"); + parser_warning("Found comments after preprocessing, please report\n"); } [^*\n]* ; "*"+[^*/\n]* ; @@ -536,7 +536,7 @@ L\" { "*"+"/" yy_pop_state(); want_id = save_wanted_id; ;[^\n]* want_id = wanted_id; /* not really comment, but left-over c-junk */ -"//"[^\n]* want_id = wanted_id; if(!no_preprocess) parser_warning("Found comments after preprocessing, please report"); +"//"[^\n]* want_id = wanted_id; if(!no_preprocess) parser_warning("Found comments after preprocessing, please report\n"); \n { want_id = wanted_id; @@ -559,7 +559,7 @@ L\" { line_number++; char_number = 1; } - parser_warning("Unmatched text '%c' (0x%02x) YY_START=%d", + parser_warning("Unmatched text '%c' (0x%02x) YY_START=%d\n", isprint(*yytext & 0xff) ? *yytext : '.', *yytext, YY_START); } @@ -575,7 +575,7 @@ static void addcchar(char c) cbufalloc += 1024; cbuffer = xrealloc(cbuffer, cbufalloc * sizeof(cbuffer[0])); if(cbufalloc > 65536) - parser_warning("Reallocating string buffer larger than 64kB"); + parser_warning("Reallocating string buffer larger than 64kB\n"); } cbuffer[cbufidx++] = c; } @@ -587,7 +587,7 @@ static void addwchar(WCHAR s) wbufalloc += 1024; wbuffer = xrealloc(wbuffer, wbufalloc * sizeof(wbuffer[0])); if(wbufalloc > 65536) - parser_warning("Reallocating wide string buffer larger than 64kB"); + parser_warning("Reallocating wide string buffer larger than 64kB\n"); } wbuffer[wbufidx++] = s; } @@ -604,7 +604,7 @@ static string_t *get_buffered_cstring(void) if (!current_codepage || current_codepage == -1 || !win32) /* store as ANSI string */ { - if (!current_codepage) parser_error("Codepage set to Unicode only, cannot use ASCII string here"); + if (!current_codepage) parser_error("Codepage set to Unicode only, cannot use ASCII string here\n"); return str; } else /* convert to Unicode before storing */ @@ -612,7 +612,7 @@ static string_t *get_buffered_cstring(void) string_t *str_w = convert_string( str, str_unicode, current_codepage ); if (!check_unicode_conversion( str, str_w, current_codepage )) parser_error("String %s does not convert identically to Unicode and back in codepage %d. " - "Try using a Unicode string instead.", str->str.cstr, current_codepage ); + "Try using a Unicode string instead\n", str->str.cstr, current_codepage ); free_string( str ); return str_w; } diff --git a/tools/wrc/parser.y b/tools/wrc/parser.y index 5806620be74..1c4cdaa0ad4 100644 --- a/tools/wrc/parser.y +++ b/tools/wrc/parser.y @@ -419,7 +419,7 @@ resources && rsc->lan->sub == head->lan->sub && !compare_name_id(rsc->name, head->name)) { - parser_error("Duplicate resource name '%s'", get_nameid_str(rsc->name)); + parser_error("Duplicate resource name '%s'\n", get_nameid_str(rsc->name)); } rsc = rsc->prev; } @@ -476,11 +476,11 @@ resource if($$) { if($1 > 65535 || $1 < -32768) - parser_error("Resource's ID out of range (%d)", $1); + parser_error("Resource's ID out of range (%d)\n", $1); $$->name = new_name_id(); $$->name->type = name_ord; $$->name->name.i_name = $1; - chat("Got %s (%d)", get_typename($3), $$->name->name.i_name); + chat("Got %s (%d)\n", get_typename($3), $$->name->name.i_name); } } | tIDENT usrcvt resource_definition { @@ -490,7 +490,7 @@ resource $$->name = new_name_id(); $$->name->type = name_str; $$->name->name.s_name = $1; - chat("Got %s (%s)", get_typename($3), $$->name->name.s_name->str.cstr); + chat("Got %s (%s)\n", get_typename($3), $$->name->name.s_name->str.cstr); } } | stringtable { @@ -499,7 +499,7 @@ resource * the final rule of the parser is reduced (see above) */ $$ = NULL; - chat("Got STRINGTABLE"); + chat("Got STRINGTABLE\n"); } | tLANGUAGE {want_nl = 1; } expr ',' expr { /* We *NEED* the newline to delimit the expression. @@ -525,18 +525,18 @@ resource yychar = YYEMPTY; /* Could use 'yyclearin', but we already need the*/ /* direct access to yychar in rule 'usrcvt' below. */ else if(yychar == tIDENT) - parser_warning("LANGUAGE statement not delimited with newline; next identifier might be wrong"); + parser_warning("LANGUAGE statement not delimited with newline; next identifier might be wrong\n"); want_nl = 0; /* We don't want it anymore if we didn't get it */ if(!win32) - parser_warning("LANGUAGE not supported in 16-bit mode"); + parser_warning("LANGUAGE not supported in 16-bit mode\n"); free(currentlanguage); if (get_language_codepage($3, $5) == -1) - parser_error( "Language %04x is not supported", ($5<<10) + $3); + parser_error( "Language %04x is not supported\n", ($5<<10) + $3); currentlanguage = new_language($3, $5); $$ = NULL; - chat("Got LANGUAGE %d,%d (0x%04x)", $3, $5, ($5<<10) + $3); + chat("Got LANGUAGE %d,%d (0x%04x)\n", $3, $5, ($5<<10) + $3); } ; @@ -552,7 +552,7 @@ usrcvt : /* Empty */ { yychar = rsrcid_to_token(yychar); } */ nameid : expr { if($1 > 65535 || $1 < -32768) - parser_error("Resource's ID out of range (%d)", $1); + parser_error("Resource's ID out of range (%d)\n", $1); $$ = new_name_id(); $$->type = name_ord; $$->name.i_name = $1; @@ -600,7 +600,7 @@ resource_definition } } else - internal_error(__FILE__, __LINE__, "Invalid top-level type %d in cursor resource", $1->type); + internal_error(__FILE__, __LINE__, "Invalid top-level type %d in cursor resource\n", $1->type); free($1); } | dialog { $$ = new_resource(res_dlg, $1, $1->memopt, $1->lvc.language); } @@ -634,7 +634,7 @@ resource_definition } } else - internal_error(__FILE__, __LINE__, "Invalid top-level type %d in icon resource", $1->type); + internal_error(__FILE__, __LINE__, "Invalid top-level type %d in icon resource\n", $1->type); free($1); } | menu { $$ = new_resource(res_men, $1, $1->memopt, $1->lvc.language); } @@ -721,7 +721,7 @@ fontdir : tFONTDIR loadmemopts file_raw { $$ = new_fontdir($3, $2); } messagetable : tMESSAGETABLE loadmemopts file_raw { if(!win32) - parser_warning("MESSAGETABLE not supported in 16-bit mode"); + parser_warning("MESSAGETABLE not supported in 16-bit mode\n"); $$ = new_messagetable($3, $2); } ; @@ -745,7 +745,7 @@ userres : usertype loadmemopts file_raw { #else if(pedantic && byteorder == WRC_BO_BIG) #endif - parser_warning("Byteordering is not little-endian and type cannot be interpreted"); + parser_warning("Byteordering is not little-endian and type cannot be interpreted\n"); $$ = new_user($1, $3, $2); } ; @@ -776,7 +776,7 @@ accelerators $$->memopt = WRC_MO_MOVEABLE | WRC_MO_PURE; } if(!$5) - parser_error("Accelerator table must have at least one entry"); + parser_error("Accelerator table must have at least one entry\n"); $$->events = get_event_head($5); if($3) { @@ -1027,7 +1027,7 @@ ctlclass dialogex: tDIALOGEX loadmemopts expr ',' expr ',' expr ',' expr helpid dlgex_attribs tBEGIN exctrls tEND { if(!win32) - parser_warning("DIALOGEX not supported in 16-bit mode"); + parser_warning("DIALOGEX not supported in 16-bit mode\n"); if($2) { $11->memopt = *($2); @@ -1224,7 +1224,7 @@ opt_expr: /* Empty */ { $$ = NULL; } /* ------------------------------ Menu ------------------------------ */ menu : tMENU loadmemopts opt_lvc menu_body { if(!$4) - parser_error("Menu must contain items"); + parser_error("Menu must contain items\n"); $$ = new_menu(); if($2) { @@ -1296,9 +1296,9 @@ item_options /* ------------------------------ MenuEx ------------------------------ */ menuex : tMENUEX loadmemopts opt_lvc menuex_body { if(!win32) - parser_warning("MENUEX not supported in 16-bit mode"); + parser_warning("MENUEX not supported in 16-bit mode\n"); if(!$4) - parser_error("MenuEx must contain items"); + parser_error("MenuEx must contain items\n"); $$ = new_menuex(); if($2) { @@ -1432,7 +1432,7 @@ stringtable : stt_head tBEGIN strings tEND { if(!$3) { - parser_error("Stringtable must have at least one entry"); + parser_error("Stringtable must have at least one entry\n"); } else { @@ -1482,12 +1482,12 @@ strings : /* Empty */ { $$ = NULL; } int i; assert(tagstt != NULL); if($2 > 65535 || $2 < -32768) - parser_error("Stringtable entry's ID out of range (%d)", $2); + parser_error("Stringtable entry's ID out of range (%d)\n", $2); /* Search for the ID */ for(i = 0; i < tagstt->nentries; i++) { if(tagstt->entries[i].id == $2) - parser_error("Stringtable ID %d already in use", $2); + parser_error("Stringtable ID %d already in use\n", $2); } /* If we get here, then we have a new unique entry */ tagstt->nentries++; @@ -1502,11 +1502,11 @@ strings : /* Empty */ { $$ = NULL; } tagstt->entries[tagstt->nentries-1].characts = tagstt_characts; if(pedantic && !$4->size) - parser_warning("Zero length strings make no sense"); + parser_warning("Zero length strings make no sense\n"); if(!win32 && $4->size > 254) - parser_error("Stringtable entry more than 254 characters"); + parser_error("Stringtable entry more than 254 characters\n"); if(win32 && $4->size > 65534) /* Hmm..., does this happen? */ - parser_error("Stringtable entry more than 65534 characters (probably something else that went wrong)"); + parser_error("Stringtable entry more than 65534 characters (probably something else that went wrong)\n"); $$ = tagstt; } ; @@ -1537,7 +1537,7 @@ fix_version : /* Empty */ { $$ = new_versioninfo(); } | fix_version tFILEVERSION expr ',' expr ',' expr ',' expr { if($1->gotit.fv) - parser_error("FILEVERSION already defined"); + parser_error("FILEVERSION already defined\n"); $$ = $1; $$->filever_maj1 = $3; $$->filever_maj2 = $5; @@ -1547,7 +1547,7 @@ fix_version } | fix_version tPRODUCTVERSION expr ',' expr ',' expr ',' expr { if($1->gotit.pv) - parser_error("PRODUCTVERSION already defined"); + parser_error("PRODUCTVERSION already defined\n"); $$ = $1; $$->prodver_maj1 = $3; $$->prodver_maj2 = $5; @@ -1557,35 +1557,35 @@ fix_version } | fix_version tFILEFLAGS expr { if($1->gotit.ff) - parser_error("FILEFLAGS already defined"); + parser_error("FILEFLAGS already defined\n"); $$ = $1; $$->fileflags = $3; $$->gotit.ff = 1; } | fix_version tFILEFLAGSMASK expr { if($1->gotit.ffm) - parser_error("FILEFLAGSMASK already defined"); + parser_error("FILEFLAGSMASK already defined\n"); $$ = $1; $$->fileflagsmask = $3; $$->gotit.ffm = 1; } | fix_version tFILEOS expr { if($1->gotit.fo) - parser_error("FILEOS already defined"); + parser_error("FILEOS already defined\n"); $$ = $1; $$->fileos = $3; $$->gotit.fo = 1; } | fix_version tFILETYPE expr { if($1->gotit.ft) - parser_error("FILETYPE already defined"); + parser_error("FILETYPE already defined\n"); $$ = $1; $$->filetype = $3; $$->gotit.ft = 1; } | fix_version tFILESUBTYPE expr { if($1->gotit.fst) - parser_error("FILESUBTYPE already defined"); + parser_error("FILESUBTYPE already defined\n"); $$ = $1; $$->filesubtype = $3; $$->gotit.fst = 1; @@ -1728,25 +1728,25 @@ lama : tLOADONCALL { $$ = new_int(~WRC_MO_PRELOAD); } opt_lvc : /* Empty */ { $$ = new_lvc(); } | opt_lvc opt_language { if(!win32) - parser_warning("LANGUAGE not supported in 16-bit mode"); + parser_warning("LANGUAGE not supported in 16-bit mode\n"); if($1->language) - parser_error("Language already defined"); + parser_error("Language already defined\n"); $$ = $1; $1->language = $2; } | opt_lvc opt_characts { if(!win32) - parser_warning("CHARACTERISTICS not supported in 16-bit mode"); + parser_warning("CHARACTERISTICS not supported in 16-bit mode\n"); if($1->characts) - parser_error("Characteristics already defined"); + parser_error("Characteristics already defined\n"); $$ = $1; $1->characts = $2; } | opt_lvc opt_version { if(!win32) - parser_warning("VERSION not supported in 16-bit mode"); + parser_warning("VERSION not supported in 16-bit mode\n"); if($1->version) - parser_error("Version already defined"); + parser_error("Version already defined\n"); $$ = $1; $1->version = $2; } @@ -1762,7 +1762,7 @@ opt_lvc : /* Empty */ { $$ = new_lvc(); } opt_language : tLANGUAGE expr ',' expr { $$ = new_language($2, $4); if (get_language_codepage($2, $4) == -1) - parser_error( "Language %04x is not supported", ($4<<10) + $2); + parser_error( "Language %04x is not supported\n", ($4<<10) + $2); } ; @@ -1852,7 +1852,7 @@ static dialog_t *dialog_style(style_t * st, dialog_t *dlg) if(dlg->gotstyle) { - parser_warning("Style already defined, or-ing together"); + parser_warning("Style already defined, or-ing together\n"); } else { @@ -1876,7 +1876,7 @@ static dialog_t *dialog_exstyle(style_t *st, dialog_t *dlg) if(dlg->gotexstyle) { - parser_warning("ExStyle already defined, or-ing together"); + parser_warning("ExStyle already defined, or-ing together\n"); } else { @@ -1894,7 +1894,7 @@ static dialog_t *dialog_caption(string_t *s, dialog_t *dlg) { assert(dlg != NULL); if(dlg->title) - parser_error("Caption already defined"); + parser_error("Caption already defined\n"); dlg->title = s; return dlg; } @@ -1903,7 +1903,7 @@ static dialog_t *dialog_font(font_id_t *f, dialog_t *dlg) { assert(dlg != NULL); if(dlg->font) - parser_error("Font already defined"); + parser_error("Font already defined\n"); dlg->font = f; return dlg; } @@ -1912,7 +1912,7 @@ static dialog_t *dialog_class(name_id_t *n, dialog_t *dlg) { assert(dlg != NULL); if(dlg->dlgclass) - parser_error("Class already defined"); + parser_error("Class already defined\n"); dlg->dlgclass = n; return dlg; } @@ -2024,7 +2024,7 @@ static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control defaultstyle |= WS_TABSTOP; break; default: - parser_warning("Unknown default button control-style 0x%08x", special_style); + parser_warning("Unknown default button control-style 0x%08x\n", special_style); case BS_GROUPBOX: case BS_RADIOBUTTON: break; @@ -2042,7 +2042,7 @@ static control_t *ins_ctrl(int type, int special_style, control_t *ctrl, control case SS_ICON: /* Special case */ break; default: - parser_warning("Unknown default static control-style 0x%08x", special_style); + parser_warning("Unknown default static control-style 0x%08x\n", special_style); break; } break; @@ -2127,7 +2127,7 @@ static dialogex_t *dialogex_style(style_t * st, dialogex_t *dlg) if(dlg->gotstyle) { - parser_warning("Style already defined, or-ing together"); + parser_warning("Style already defined, or-ing together\n"); } else { @@ -2151,7 +2151,7 @@ static dialogex_t *dialogex_exstyle(style_t * st, dialogex_t *dlg) if(dlg->gotexstyle) { - parser_warning("ExStyle already defined, or-ing together"); + parser_warning("ExStyle already defined, or-ing together\n"); } else { @@ -2422,7 +2422,7 @@ static raw_data_t *str2raw_data(string_t *str) } } else - internal_error(__FILE__, __LINE__, "Invalid stringtype"); + internal_error(__FILE__, __LINE__, "Invalid stringtype\n"); return rd; } @@ -2547,12 +2547,12 @@ static stringtable_t *find_stringtable(lvc_t *lvc) if((stt->lvc.version && lvc->version && *(stt->lvc.version) != *(lvc->version)) || (!stt->lvc.version && lvc->version) || (stt->lvc.version && !lvc->version)) - parser_warning("Stringtable's versions are not the same, using first definition"); + parser_warning("Stringtable's versions are not the same, using first definition\n"); if((stt->lvc.characts && lvc->characts && *(stt->lvc.characts) != *(lvc->characts)) || (!stt->lvc.characts && lvc->characts) || (stt->lvc.characts && !lvc->characts)) - parser_warning("Stringtable's characteristics are not the same, using first definition"); + parser_warning("Stringtable's characteristics are not the same, using first definition\n"); */ return stt; } @@ -2629,7 +2629,7 @@ static resource_t *build_stt_resources(stringtable_t *stthead) } if(andsum != orsum) { - warning("Stringtable's memory options are not equal (idbase: %d)", newstt->idbase); + warning("Stringtable's memory options are not equal (idbase: %d)\n", newstt->idbase); } /* Check version and characteristics */ for(j = 0; j < 16; j++) @@ -2637,11 +2637,11 @@ static resource_t *build_stt_resources(stringtable_t *stthead) if(characts && newstt->entries[j].characts && *newstt->entries[j].characts != *characts) - warning("Stringtable's characteristics are not the same (idbase: %d)", newstt->idbase); + warning("Stringtable's characteristics are not the same (idbase: %d)\n", newstt->idbase); if(version && newstt->entries[j].version && *newstt->entries[j].version != *version) - warning("Stringtable's versions are not the same (idbase: %d)", newstt->idbase); + warning("Stringtable's versions are not the same (idbase: %d)\n", newstt->idbase); } rsc = new_resource(res_stt, newstt, newstt->memopt, newstt->lvc.language); rsc->name = new_name_id(); @@ -2755,7 +2755,7 @@ static resource_t *build_fontdir(resource_t **fnt, int nfnt) static int once = 0; if(!once) { - warning("Need to parse fonts, not yet implemented (fnt: %p, nfnt: %d)", fnt, nfnt); + warning("Need to parse fonts, not yet implemented (fnt: %p, nfnt: %d)\n", fnt, nfnt); once++; } return NULL; @@ -2804,7 +2804,7 @@ static resource_t *build_fontdirs(resource_t *tail) { if(compare_name_id(&nid, fnd[i]->name)) { - warning("User supplied FONTDIR entry has an invalid name '%s', ignored", + warning("User supplied FONTDIR entry has an invalid name '%s', ignored\n", get_nameid_str(fnd[i]->name)); fnd[i] = NULL; } @@ -2814,7 +2814,7 @@ static resource_t *build_fontdirs(resource_t *tail) if(nfnt == 0) { if(nfnd != 0) - warning("Found %d FONTDIR entries without any fonts present", nfnd); + warning("Found %d FONTDIR entries without any fonts present\n", nfnd); goto clean; } @@ -2849,7 +2849,7 @@ static resource_t *build_fontdirs(resource_t *tail) else if(nlanfnt == BYTESWAP_WORD(cnt)) isswapped = 1; else - error("FONTDIR for language %d,%d has wrong count (%d, expected %d)", + error("FONTDIR for language %d,%d has wrong count (%d, expected %d)\n", fnd[i]->lan->id, fnd[i]->lan->sub, cnt, nlanfnt); #ifdef WORDS_BIGENDIAN if((byteorder == WRC_BO_LITTLE && !isswapped) || (byteorder != WRC_BO_LITTLE && isswapped)) @@ -2857,7 +2857,7 @@ static resource_t *build_fontdirs(resource_t *tail) if((byteorder == WRC_BO_BIG && !isswapped) || (byteorder != WRC_BO_BIG && isswapped)) #endif { - internal_error(__FILE__, __LINE__, "User supplied FONTDIR needs byteswapping"); + internal_error(__FILE__, __LINE__, "User supplied FONTDIR needs byteswapping\n"); } } @@ -3020,13 +3020,13 @@ static int rsrcid_to_token(int lookahead) case WRC_RT_ANIICON: case WRC_RT_GROUP_CURSOR: case WRC_RT_GROUP_ICON: - parser_warning("Usertype uses reserved type ID %d, which is auto-generated", yylval.num); + parser_warning("Usertype uses reserved type ID %d, which is auto-generated\n", yylval.num); return lookahead; case WRC_RT_DLGINCLUDE: case WRC_RT_PLUGPLAY: case WRC_RT_VXD: - parser_warning("Usertype uses reserved type ID %d, which is not supported by wrc yet", yylval.num); + parser_warning("Usertype uses reserved type ID %d, which is not supported by wrc yet\n", yylval.num); default: return lookahead; } diff --git a/tools/wrc/readres.c b/tools/wrc/readres.c index 0f948cbfd52..e3a4db74d25 100644 --- a/tools/wrc/readres.c +++ b/tools/wrc/readres.c @@ -106,7 +106,7 @@ static enum res_e res_type_from_id(const name_id_t *nid) return res_usr; if(nid->type != name_ord) - internal_error(__FILE__, __LINE__, "Invalid name_id descriptor %d", nid->type); + internal_error(__FILE__, __LINE__, "Invalid name_id descriptor %d\n", nid->type); switch(nid->name.i_name) { @@ -132,7 +132,7 @@ static enum res_e res_type_from_id(const name_id_t *nid) case WRC_RT_VXD: case WRC_RT_ANICURSOR: case WRC_RT_ANIICON: - warning("Cannot be sure of resource type, using usertype settings"); + warning("Cannot be sure of resource type, using usertype settings\n"); return res_usr; } } @@ -185,7 +185,7 @@ static resource_t *read_res32(FILE *fp) totsize = hdrsize; if(hdrsize & 3) { - warning("Hu? .res header needed alignment (anything can happen now)"); + warning("Hu? .res header needed alignment (anything can happen now)\n"); totsize += 4 - (hdrsize & 3); } totsize += ressize; @@ -217,7 +217,7 @@ static resource_t *read_res32(FILE *fp) } else if(get_word(idx) == 0) { - error("ResType name has zero length (32 bit)"); + error("ResType name has zero length (32 bit)\n"); } else { @@ -251,7 +251,7 @@ static resource_t *read_res32(FILE *fp) } else if(get_word(idx) == 0) { - error("ResName name has zero length (32 bit)"); + error("ResName name has zero length (32 bit)\n"); } else { @@ -328,7 +328,7 @@ static resource_t *read_res32(FILE *fp) */ static resource_t *read_res16(FILE *fp) { - internal_error(__FILE__, __LINE__, "Can't yet read 16 bit .res files"); + internal_error(__FILE__, __LINE__, "Can't yet read 16 bit .res files\n"); return NULL; } @@ -351,7 +351,7 @@ resource_t *read_resfile(char *inname) fp = fopen(inname, "rb"); if(!fp) - error("Could not open inputfile %s", inname); + error("Could not open inputfile %s\n", inname); /* Determine 16 or 32 bit .res file */ if(fread(&rh, 1, sizeof(rh), fp) != sizeof(rh)) @@ -361,16 +361,16 @@ resource_t *read_resfile(char *inname) if(!memcmp(&emptyheader, &rh, sizeof(rh))) is32bit = 1; else if(!memcmp(&emptyheaderSWAPPED, &rh, sizeof(rh))) - error("Binary .res-file has its byteorder swapped"); + error("Binary .res-file has its byteorder swapped\n"); else is32bit = 0; } if(is32bit && !win32) - error("Cannot convert 32-bit .res-file into 16-bit resources (and will, hopefully never, implement it)"); + error("Cannot convert 32-bit .res-file into 16-bit resources (and will, hopefully never, implement it)\n"); if(!is32bit && win32) - error("Cannot (yet) convert 16-bit .res-file into 32-bit resources"); + error("Cannot (yet) convert 16-bit .res-file into 32-bit resources\n"); if(!is32bit) { diff --git a/tools/wrc/utils.c b/tools/wrc/utils.c index 39d17641896..b0109a7f145 100644 --- a/tools/wrc/utils.c +++ b/tools/wrc/utils.c @@ -64,7 +64,6 @@ static void generic_msg(const char *s, const char *t, const char *n, va_list ap) } } #endif - fprintf(stderr, "\n"); } @@ -93,7 +92,6 @@ void internal_error(const char *file, int line, const char *s, ...) va_start(ap, s); fprintf(stderr, "Internal error (please report) %s %d: ", file, line); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); exit(3); } @@ -104,7 +102,6 @@ void error(const char *s, ...) va_start(ap, s); fprintf(stderr, "Error: "); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); exit(2); } @@ -115,7 +112,6 @@ void warning(const char *s, ...) va_start(ap, s); fprintf(stderr, "Warning: "); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); } @@ -127,7 +123,6 @@ void chat(const char *s, ...) va_start(ap, s); fprintf(stderr, "FYI: "); vfprintf(stderr, s, ap); - fprintf(stderr, "\n"); va_end(ap); } } @@ -226,7 +221,7 @@ int compare_name_id(const name_id_t *n1, const name_id_t *n2) } else { - internal_error(__FILE__, __LINE__, "Can't yet compare strings of mixed type"); + internal_error(__FILE__, __LINE__, "Can't yet compare strings of mixed type\n"); } } else if(n1->type == name_ord && n2->type == name_str) @@ -234,7 +229,7 @@ int compare_name_id(const name_id_t *n1, const name_id_t *n2) else if(n1->type == name_str && n2->type == name_ord) return -1; else - internal_error(__FILE__, __LINE__, "Comparing name-ids with unknown types (%d, %d)", + internal_error(__FILE__, __LINE__, "Comparing name-ids with unknown types (%d, %d)\n", n1->type, n2->type); return 0; /* Keep the compiler happy */ @@ -247,7 +242,7 @@ string_t *convert_string(const string_t *str, enum str_e type, int codepage) int res; if (!codepage && str->type != type) - parser_error( "Current language is Unicode only, cannot convert string" ); + parser_error( "Current language is Unicode only, cannot convert string\n" ); if((str->type == str_char) && (type == str_unicode)) { diff --git a/tools/wrc/wrc.c b/tools/wrc/wrc.c index 828176cb745..f28a45c58a3 100644 --- a/tools/wrc/wrc.c +++ b/tools/wrc/wrc.c @@ -451,7 +451,7 @@ int main(int argc,char *argv[]) * no output was given. */ - chat("Starting preprocess"); + chat("Starting preprocess\n"); if (!preprocess_only) { @@ -484,7 +484,7 @@ int main(int argc,char *argv[]) } /* Go from .rc to .res */ - chat("Starting parse"); + chat("Starting parse\n"); if(!(parser_in = fopen(input_name, "rb"))) error("Could not open %s for input\n", input_name); @@ -507,7 +507,7 @@ int main(int argc,char *argv[]) /* Convert the internal lists to binary data */ resources2res(resource_top); - chat("Writing .res-file"); + chat("Writing .res-file\n"); write_resfile(output_name, resource_top); output_name = NULL; diff --git a/tools/wrc/writeres.c b/tools/wrc/writeres.c index af7f8cfc063..8df92dcb9b3 100644 --- a/tools/wrc/writeres.c +++ b/tools/wrc/writeres.c @@ -75,7 +75,7 @@ void write_resfile(char *outname, resource_t *top) if(ret != res->size) { fclose(fo); - error("Error writing %s", outname); + error("Error writing %s\n", outname); } free(res); } @@ -89,7 +89,7 @@ void write_resfile(char *outname, resource_t *top) if(ret != top->binres->size) { fclose(fo); - error("Error writing %s", outname); + error("Error writing %s\n", outname); } if(win32 && (top->binres->size & 0x03)) { @@ -98,7 +98,7 @@ void write_resfile(char *outname, resource_t *top) if(ret != 4 - (top->binres->size & 0x03)) { fclose(fo); - error("Error writing %s", outname); + error("Error writing %s\n", outname); } } } -- 2.11.4.GIT