From 0543b2007c68be731a5e60a5e518b41b4bfd1303 Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Sun, 4 Oct 2009 16:33:53 +0200 Subject: [PATCH] push b71aec5de911a58dd53fad5cd398b45da52121ed --- .gitignore | 7 - configure | 146 + configure.ac | 17 + dlls/Makefile.in | 23 +- dlls/advapi32/lsa.c | 84 +- dlls/advapi32/tests/lsa.c | 8 +- dlls/comctl32/comctl32.h | 13 +- dlls/comctl32/datetime.c | 49 +- dlls/comctl32/listview.c | 133 +- dlls/comctl32/monthcal.c | 793 +-- dlls/comctl32/tests/datetime.c | 409 +- dlls/comctl32/tests/dpa.c | 12 +- dlls/comctl32/tests/monthcal.c | 662 ++- dlls/comctl32/tests/toolbar.c | 22 +- dlls/comctl32/tests/updown.c | 15 + dlls/comdlg32/filedlg31.c | 4 +- dlls/d3d10/d3d10_private.h | 29 +- dlls/d3d10/effect.c | 664 ++- dlls/d3d8/cubetexture.c | 6 +- dlls/d3d8/indexbuffer.c | 6 +- dlls/d3d8/surface.c | 5 +- dlls/d3d8/texture.c | 6 +- dlls/d3d8/vertexbuffer.c | 6 +- dlls/d3d8/volumetexture.c | 6 +- dlls/d3d9/cubetexture.c | 6 +- dlls/d3d9/indexbuffer.c | 6 +- dlls/d3d9/pixelshader.c | 6 +- dlls/d3d9/surface.c | 6 +- dlls/d3d9/swapchain.c | 6 +- dlls/d3d9/tests/surface.c | 2 +- dlls/d3d9/tests/visual.c | 73 +- dlls/d3d9/texture.c | 6 +- dlls/d3d9/vertexbuffer.c | 6 +- dlls/d3d9/vertexdeclaration.c | 6 +- dlls/d3d9/vertexshader.c | 6 +- dlls/d3d9/volumetexture.c | 6 +- dlls/ddraw/ddraw.c | 1 + dlls/ddraw/tests/d3d.c | 104 + dlls/ddraw/tests/dsurface.c | 12 +- dlls/dwmapi/dwmapi.spec | 4 +- dlls/dwmapi/dwmapi_main.c | 20 + dlls/dxdiagn/provider.c | 1 - dlls/{version => fltlib}/Makefile.in | 16 +- dlls/fltlib/fltlib.c | 60 + dlls/fltlib/fltlib.spec | 29 + dlls/gdi32/Makefile.in | 7 +- dlls/gdi32/bitblt.c | 19 +- dlls/gdi32/bitmap.c | 10 - dlls/gdi32/brush.c | 16 +- dlls/gdi32/dc.c | 72 +- dlls/gdi32/enhmfdrv/objects.c | 4 +- dlls/gdi32/gdi16.c | 118 +- dlls/gdi32/gdi_private.h | 5 +- dlls/gdi32/metafile16.c | 55 + dlls/gdi32/mfdrv/bitblt.c | 12 - dlls/gdi32/mfdrv/init.c | 50 +- dlls/gdi32/mfdrv/metafiledrv.h | 3 - dlls/gdi32/mfdrv/objects.c | 9 +- dlls/gdi32/tests/bitmap.c | 387 ++ dlls/gdiplus/tests/image.c | 8 +- dlls/imm32/imm.c | 14 + dlls/imm32/tests/imm32.c | 7 +- dlls/jscript/Makefile.in | 3 +- dlls/jscript/activex.c | 181 + dlls/jscript/engine.c | 22 +- dlls/jscript/engine.h | 2 +- dlls/jscript/error.c | 5 + dlls/jscript/function.c | 47 +- dlls/jscript/global.c | 11 +- dlls/jscript/jscript.c | 33 +- dlls/jscript/jscript.h | 9 +- dlls/jscript/jscript_De.rc | 4 + dlls/jscript/jscript_En.rc | 1 + dlls/jscript/jscript_Fr.rc | 2 + dlls/jscript/jscript_Lt.rc | 1 + dlls/jscript/jscript_Nl.rc | 3 + dlls/jscript/jscript_main.c | 1 + dlls/jscript/resource.h | 1 + dlls/jscript/string.c | 2 +- dlls/jscript/tests/Makefile.in | 3 +- dlls/jscript/tests/activex.c | 969 ++++ dlls/jscript/tests/api.js | 3 + dlls/jscript/tests/jscript.c | 19 + dlls/jscript/tests/run.c | 85 +- dlls/kernel32/Makefile.in | 9 +- dlls/kernel32/debugger.c | 5 + dlls/kernel32/dosmem.c | 3 +- dlls/kernel32/global16.c | 147 +- dlls/kernel32/instr.c | 7 - dlls/kernel32/kernel16.c | 12 +- dlls/kernel32/kernel16_private.h | 7 + dlls/kernel32/kernel_main.c | 1 - dlls/kernel32/kernel_private.h | 1 - dlls/kernel32/local16.c | 90 +- dlls/kernel32/ne_module.c | 53 - dlls/kernel32/ne_segment.c | 1 - dlls/kernel32/selector.c | 64 +- dlls/kernel32/snoop16.c | 1 - dlls/kernel32/task.c | 83 - dlls/kernel32/tests/debugger.c | 33 + dlls/kernel32/tests/file.c | 25 +- dlls/kernel32/thread.c | 20 + dlls/kernel32/time.c | 2 +- dlls/kernel32/toolhelp16.c | 219 - dlls/localspl/provider.c | 325 +- dlls/localui/localui.c | 10 +- dlls/mapi32/mapi32_main.c | 11 +- dlls/mapi32/sendmail.c | 333 +- dlls/mapi32/util.c | 2 + dlls/mapi32/util.h | 2 + dlls/mshtml/Makefile.in | 1 + dlls/mshtml/dispex.c | 54 +- dlls/mshtml/htmlanchor.c | 57 +- dlls/mshtml/htmlbody.c | 6 +- dlls/mshtml/htmlcomment.c | 3 +- dlls/mshtml/htmldoc.c | 22 +- dlls/mshtml/htmldoc3.c | 7 +- dlls/mshtml/htmlelem.c | 7 +- dlls/mshtml/htmlgeneric.c | 3 +- dlls/mshtml/htmliframe.c | 43 +- dlls/mshtml/htmlimg.c | 3 +- dlls/mshtml/htmlinput.c | 3 +- dlls/mshtml/htmllocation.c | 63 +- dlls/mshtml/htmlnode.c | 18 +- dlls/mshtml/htmloption.c | 3 +- dlls/mshtml/htmlscript.c | 4 +- dlls/mshtml/htmlselect.c | 3 +- dlls/mshtml/htmltable.c | 3 +- dlls/mshtml/htmltablerow.c | 3 +- dlls/mshtml/htmltextarea.c | 4 +- dlls/mshtml/htmltextcont.c | 6 +- dlls/mshtml/mshtml_private.h | 14 +- dlls/mshtml/nsiface.idl | 36 + dlls/mshtml/script.c | 52 + dlls/mshtml/secmgr.c | 181 + dlls/mshtml/tests/dom.c | 100 +- dlls/mshtml/tests/script.c | 120 +- dlls/msi/action.c | 3 + dlls/msi/custom.c | 7 +- dlls/msi/files.c | 39 +- dlls/msi/media.c | 47 +- dlls/msi/msi.c | 3 - dlls/msi/msipriv.h | 1 + dlls/msi/tests/automation.c | 4 +- dlls/msi/tests/install.c | 272 ++ dlls/msxml3/attribute.c | 96 +- dlls/msxml3/cdata.c | 108 +- dlls/msxml3/comment.c | 112 +- dlls/msxml3/docfrag.c | 90 +- dlls/msxml3/domdoc.c | 2 +- dlls/msxml3/element.c | 2 +- dlls/msxml3/entityref.c | 90 +- dlls/msxml3/msxml_private.h | 2 +- dlls/msxml3/node.c | 104 +- dlls/msxml3/pi.c | 96 +- dlls/msxml3/text.c | 108 +- dlls/ntdll/process.c | 12 +- dlls/ntdll/tests/directory.c | 213 +- dlls/ntdll/tests/info.c | 82 + dlls/ntdll/thread.c | 1 + dlls/ole32/storage32.c | 4 +- dlls/ole32/tests/clipboard.c | 56 +- dlls/ole32/tests/storage32.c | 40 + dlls/oleaut32/tests/olefont.c | 16 +- dlls/oledb32/convert.c | 21 + dlls/oledb32/tests/convert.c | 89 + dlls/openal32/openal.c | 6 + dlls/opengl32/tests/opengl.c | 2 +- dlls/riched20/caret.c | 2 + dlls/riched20/editor.c | 17 +- dlls/riched20/editor.h | 2 +- dlls/riched20/editstr.h | 2 +- dlls/riched20/tests/editor.c | 26 + dlls/riched20/txthost.c | 17 +- dlls/riched20/wrap.c | 2 + dlls/secur32/schannel.c | 28 +- dlls/secur32/tests/schannel.c | 9 +- dlls/setupapi/Makefile.in | 8 - dlls/setupapi/parser.c | 4 +- dlls/setupapi/setupapi_private.h | 2 - dlls/setupapi/stubs.c | 19 - dlls/setupapi/tests/misc.c | 4 +- dlls/setupapi/tests/query.c | 7 +- dlls/{version => setupx.dll16}/Makefile.in | 21 +- dlls/{setupapi => setupx.dll16}/devinst16.c | 0 dlls/{setupapi => setupx.dll16}/infparse.c | 92 +- .../setupx.spec => setupx.dll16/setupx.dll16.spec} | 0 dlls/{setupapi => setupx.dll16}/setupx16.h | 0 dlls/{setupapi => setupx.dll16}/setupx_main.c | 19 +- dlls/{setupapi => setupx.dll16}/virtcopy.c | 21 +- dlls/shell32/tests/shellpath.c | 5 +- dlls/shell32/tests/shlexec.c | 370 +- dlls/shlwapi/regstream.c | 284 +- dlls/shlwapi/shlwapi.spec | 10 +- dlls/{jscript => sti}/tests/Makefile.in | 11 +- dlls/sti/tests/sti.c | 154 + dlls/system.drv16/Makefile.in | 13 + dlls/{kernel32 => system.drv16}/system.c | 8 +- .../system.drv16.spec} | 0 dlls/toolhelp.dll16/Makefile.in | 13 + dlls/toolhelp.dll16/toolhelp.c | 737 +++ .../toolhelp.dll16.spec} | 0 dlls/{kernel32 => toolhelp.dll16}/toolhelp.h | 7 - dlls/urlmon/sec_mgr.c | 9 +- dlls/urlmon/tests/sec_mgr.c | 74 +- dlls/user32/message.c | 36 +- dlls/user32/sysparams.c | 21 +- dlls/user32/tests/msg.c | 35 +- dlls/user32/tests/text.c | 2 +- dlls/user32/text.c | 20 +- dlls/ver.dll16/Makefile.in | 14 + .../{version/ver.spec => ver.dll16/ver.dll16.spec} | 0 dlls/{version/resource.c => ver.dll16/version.c} | 172 +- dlls/version/Makefile.in | 5 - dlls/version/info.c | 39 +- dlls/version/resource.c | 199 +- dlls/version/ver16.c | 122 - dlls/windowscodecs/bmpencode.c | 2 +- dlls/wined3d/arb_program_shader.c | 13 +- dlls/wined3d/device.c | 636 +-- dlls/wined3d/directx.c | 79 +- dlls/wined3d/glsl_shader.c | 18 +- dlls/wined3d/shader_sm1.c | 3 +- dlls/wined3d/state.c | 19 +- dlls/wined3d/stateblock.c | 743 ++- dlls/wined3d/vertexdeclaration.c | 8 +- dlls/wined3d/wined3d_private.h | 25 +- dlls/winedos/dosmem.c | 23 +- dlls/winedos/winedos.spec | 3 - dlls/wineps.drv/Makefile.in | 2 - dlls/wineps.drv/brush.c | 4 +- dlls/wineps.drv/driver.c | 51 - dlls/wineps.drv/psdrv.h | 5 - dlls/wineps16.drv16/Makefile.in | 14 + dlls/wineps16.drv16/driver.c | 89 + .../wineps16.drv16.spec} | 0 dlls/winex11.drv/bitblt.c | 439 +- dlls/winex11.drv/brush.c | 4 +- dlls/winex11.drv/dib.c | 39 +- dlls/winex11.drv/event.c | 2 +- dlls/winex11.drv/winex11.drv.spec | 2 - dlls/winex11.drv/x11drv.h | 6 +- dlls/winex11.drv/xrender.c | 33 + dlls/wing.dll16/Makefile.in | 13 + dlls/{gdi32 => wing.dll16}/wing.c | 97 +- .../wing.spec => wing.dll16/wing.dll16.spec} | 0 dlls/winhttp/request.c | 1 - dlls/wininet/http.c | 2 +- dlls/wininet/internet.c | 7 +- dlls/wininet/internet.h | 1 + dlls/wininet/netconnection.c | 98 +- dlls/wininet/tests/http.c | 68 + dlls/wininet/tests/url.c | 7 +- dlls/winsock.dll16/Makefile.in | 14 + dlls/winsock.dll16/socket.c | 1026 ++++ .../winsock.dll16.spec} | 16 +- {include/wine => dlls/winsock.dll16}/winsock16.h | 5 +- dlls/winspool.drv/info.c | 477 +- dlls/wnaspi32/winaspi32.c | 2 +- dlls/ws2_32/Makefile.in | 4 - dlls/ws2_32/async.c | 1227 ++--- dlls/ws2_32/socket.c | 17 +- dlls/ws2_32/socket16.c | 605 --- include/commctrl.h | 7 + include/config.h.in | 3 + include/d3d10shader.h | 6 + include/ddk/winsplp.h | 3 +- include/mapidefs.h | 416 +- include/mapitags.h | 1 + include/mshtmdid.h | 109 + include/mshtml.idl | 5101 +++++++------------- include/sti.h | 119 + include/urlmon.idl | 47 + include/wine/library.h | 13 +- include/wine/winbase16.h | 6 - include/winerror.h | 1 + include/wnaspi32.h | 4 +- libs/port/interlocked.c | 147 +- libs/wine/ldt.c | 1 - libs/wine/port.c | 14 + libs/wine/wine.def | 1 - libs/wpp/ppl.l | 104 +- libs/wpp/ppy.y | 97 +- libs/wpp/preproc.c | 38 +- libs/wpp/wpp.c | 15 +- libs/wpp/wpp_private.h | 4 +- programs/winetest/main.c | 47 +- server/fd.c | 4 +- server/process.c | 14 +- server/thread.c | 34 +- server/thread.h | 1 + tools/widl/widl.c | 3 +- tools/winedump/main.c | 26 +- tools/winedump/winedump.h | 4 +- 294 files changed, 14780 insertions(+), 9944 deletions(-) copy dlls/{version => fltlib}/Makefile.in (51%) create mode 100644 dlls/fltlib/fltlib.c create mode 100644 dlls/fltlib/fltlib.spec create mode 100644 dlls/jscript/activex.c create mode 100644 dlls/jscript/tests/activex.c delete mode 100644 dlls/kernel32/toolhelp16.c create mode 100644 dlls/mshtml/secmgr.c copy dlls/{version => setupx.dll16}/Makefile.in (50%) rename dlls/{setupapi => setupx.dll16}/devinst16.c (100%) rename dlls/{setupapi => setupx.dll16}/infparse.c (69%) rename dlls/{setupapi/setupx.spec => setupx.dll16/setupx.dll16.spec} (100%) rename dlls/{setupapi => setupx.dll16}/setupx16.h (100%) rename dlls/{setupapi => setupx.dll16}/setupx_main.c (96%) rename dlls/{setupapi => setupx.dll16}/virtcopy.c (97%) copy dlls/{jscript => sti}/tests/Makefile.in (65%) create mode 100644 dlls/sti/tests/sti.c create mode 100644 dlls/system.drv16/Makefile.in rename dlls/{kernel32 => system.drv16}/system.c (96%) rename dlls/{kernel32/system.drv.spec => system.drv16/system.drv16.spec} (100%) create mode 100644 dlls/toolhelp.dll16/Makefile.in create mode 100644 dlls/toolhelp.dll16/toolhelp.c rename dlls/{kernel32/toolhelp.spec => toolhelp.dll16/toolhelp.dll16.spec} (100%) rename dlls/{kernel32 => toolhelp.dll16}/toolhelp.h (96%) create mode 100644 dlls/ver.dll16/Makefile.in rename dlls/{version/ver.spec => ver.dll16/ver.dll16.spec} (100%) copy dlls/{version/resource.c => ver.dll16/version.c} (75%) delete mode 100644 dlls/version/ver16.c create mode 100644 dlls/wineps16.drv16/Makefile.in create mode 100644 dlls/wineps16.drv16/driver.c rename dlls/{wineps.drv/wineps16.drv.spec => wineps16.drv16/wineps16.drv16.spec} (100%) create mode 100644 dlls/wing.dll16/Makefile.in rename dlls/{gdi32 => wing.dll16}/wing.c (77%) rename dlls/{gdi32/wing.spec => wing.dll16/wing.dll16.spec} (100%) create mode 100644 dlls/winsock.dll16/Makefile.in create mode 100644 dlls/winsock.dll16/socket.c rename dlls/{ws2_32/winsock.spec => winsock.dll16/winsock.dll16.spec} (87%) rename {include/wine => dlls/winsock.dll16}/winsock16.h (97%) rewrite dlls/ws2_32/async.c (78%) delete mode 100644 dlls/ws2_32/socket16.c diff --git a/.gitignore b/.gitignore index 418244e96b0..5d498c83da8 100644 --- a/.gitignore +++ b/.gitignore @@ -115,17 +115,10 @@ dlls/rpcrt4/epm_c.c dlls/rpcrt4/tests/server.h dlls/rpcrt4/tests/server_c.c dlls/rpcrt4/tests/server_s.c -dlls/setupx.dll16 dlls/shdocvw/shdocvw_v1.tlb dlls/stdole2.tlb/std_ole_v2.tlb dlls/stdole32.tlb/std_ole_v1.tlb -dlls/system.drv16 -dlls/toolhelp.dll16 dlls/user.exe16 -dlls/ver.dll16 -dlls/wineps16.drv16 -dlls/wing.dll16 -dlls/winsock.dll16 dlls/wprocs.dll16 include/activaut.h include/activdbg.h diff --git a/configure b/configure index 2c50fe75ee5..39ef92d8bd7 100755 --- a/configure +++ b/configure @@ -3863,6 +3863,7 @@ then enable_w32skrnl=${enable_w32skrnl:-no} enable_winedos=${enable_winedos:-no} enable_winevdm=${enable_winevdm:-no} + enable_wow32=${enable_wow32:-no} fi if test -n "$with_wine64" @@ -17756,6 +17757,68 @@ echo "${ECHO_T}$ac_cv_c_string_h_warnings" >&6; } then EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith" fi + + if test "${enable_maintainer_mode+set}" = set + then + { echo "$as_me:$LINENO: checking whether the compiler supports -Werror" >&5 +echo $ECHO_N "checking whether the compiler supports -Werror... $ECHO_C" >&6; } +if test "${ac_cv_cflags__Werror+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_wine_try_cflags_saved=$CFLAGS +CFLAGS="$CFLAGS -Werror" +cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +int +main () +{ + + ; + 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 + ac_cv_cflags__Werror=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_cv_cflags__Werror=no +fi + +rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ + conftest$ac_exeext conftest.$ac_ext +CFLAGS=$ac_wine_try_cflags_saved +fi +{ echo "$as_me:$LINENO: result: $ac_cv_cflags__Werror" >&5 +echo "${ECHO_T}$ac_cv_cflags__Werror" >&6; } +if test $ac_cv_cflags__Werror = yes; then + EXTRACFLAGS="$EXTRACFLAGS -Werror" +fi + + fi fi @@ -18381,6 +18444,7 @@ CFLAGS="$CFLAGS $BUILTINFLAG" + for ac_func in \ _pclose \ _popen \ @@ -18426,6 +18490,7 @@ for ac_func in \ pwrite \ readdir \ readlink \ + sched_setaffinity \ sched_yield \ select \ setproctitle \ @@ -25090,6 +25155,14 @@ dlls/faultrep/Makefile: dlls/faultrep/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/faultrep/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/fltlib/Makefile" +test "x$enable_fltlib" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + fltlib" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/fltlib/Makefile: dlls/fltlib/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/fltlib/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/fusion/Makefile" test "x$enable_fusion" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ fusion" @@ -26666,6 +26739,14 @@ dlls/setupapi/tests/Makefile: dlls/setupapi/tests/Makefile.in dlls/Maketest.rule ac_config_files="$ac_config_files dlls/setupapi/tests/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/setupx.dll16/Makefile" +test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + setupx.dll16" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/setupx.dll16/Makefile: dlls/setupx.dll16/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/setupx.dll16/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/sfc/Makefile" test "x$enable_sfc" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ sfc" @@ -26842,6 +26923,14 @@ dlls/sti/Makefile: dlls/sti/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/sti/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/sti/tests/Makefile" +test "x$enable_tests" != xno && ALL_TEST_DIRS="$ALL_TEST_DIRS \\ + sti/tests" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/sti/tests/Makefile: dlls/sti/tests/Makefile.in dlls/Maketest.rules" +ac_config_files="$ac_config_files dlls/sti/tests/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/storage.dll16/Makefile" test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ storage.dll16" @@ -26882,6 +26971,14 @@ dlls/sxs/Makefile: dlls/sxs/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/sxs/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/system.drv16/Makefile" +test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + system.drv16" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/system.drv16/Makefile: dlls/system.drv16/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/system.drv16/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/t2embed/Makefile" test "x$enable_t2embed" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ t2embed" @@ -26898,6 +26995,14 @@ dlls/tapi32/Makefile: dlls/tapi32/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/tapi32/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/toolhelp.dll16/Makefile" +test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + toolhelp.dll16" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/toolhelp.dll16/Makefile: dlls/toolhelp.dll16/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/toolhelp.dll16/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/traffic/Makefile" test "x$enable_traffic" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ traffic" @@ -27066,6 +27171,14 @@ dlls/vdmdbg/Makefile: dlls/vdmdbg/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/vdmdbg/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/ver.dll16/Makefile" +test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + ver.dll16" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/ver.dll16/Makefile: dlls/ver.dll16/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/ver.dll16/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/version/Makefile" test "x$enable_version" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ version" @@ -27298,6 +27411,14 @@ dlls/wineps.drv/Makefile: dlls/wineps.drv/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/wineps.drv/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/wineps16.drv16/Makefile" +test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + wineps16.drv16" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/wineps16.drv16/Makefile: dlls/wineps16.drv16/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/wineps16.drv16/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/winepulse.drv/Makefile" test "x$enable_winepulse_drv" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ winepulse.drv" @@ -27322,6 +27443,14 @@ dlls/winex11.drv/Makefile: dlls/winex11.drv/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/winex11.drv/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/wing.dll16/Makefile" +test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + wing.dll16" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/wing.dll16/Makefile: dlls/wing.dll16/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/wing.dll16/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/wing32/Makefile" test "x$enable_wing32" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ wing32" @@ -27402,6 +27531,14 @@ dlls/winscard/Makefile: dlls/winscard/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/winscard/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/winsock.dll16/Makefile" +test "x$enable_win16" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + winsock.dll16" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/winsock.dll16/Makefile: dlls/winsock.dll16/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/winsock.dll16/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/winspool.drv/Makefile" test "x$enable_winspool_drv" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ winspool.drv" @@ -28917,6 +29054,7 @@ do "dlls/dxgi/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dxgi/tests/Makefile" ;; "dlls/dxguid/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/dxguid/Makefile" ;; "dlls/faultrep/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/faultrep/Makefile" ;; + "dlls/fltlib/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/fltlib/Makefile" ;; "dlls/fusion/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/fusion/Makefile" ;; "dlls/fusion/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/fusion/tests/Makefile" ;; "dlls/gdi32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gdi32/Makefile" ;; @@ -29114,6 +29252,7 @@ do "dlls/serialui/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/serialui/tests/Makefile" ;; "dlls/setupapi/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/setupapi/Makefile" ;; "dlls/setupapi/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/setupapi/tests/Makefile" ;; + "dlls/setupx.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/setupx.dll16/Makefile" ;; "dlls/sfc/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/sfc/Makefile" ;; "dlls/sfc_os/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/sfc_os/Makefile" ;; "dlls/shdoclc/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/shdoclc/Makefile" ;; @@ -29136,13 +29275,16 @@ do "dlls/stdole2.tlb/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stdole2.tlb/Makefile" ;; "dlls/stdole32.tlb/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stdole32.tlb/Makefile" ;; "dlls/sti/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/sti/Makefile" ;; + "dlls/sti/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/sti/tests/Makefile" ;; "dlls/storage.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/storage.dll16/Makefile" ;; "dlls/stress.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/stress.dll16/Makefile" ;; "dlls/strmiids/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/strmiids/Makefile" ;; "dlls/svrapi/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/svrapi/Makefile" ;; "dlls/sxs/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/sxs/Makefile" ;; + "dlls/system.drv16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/system.drv16/Makefile" ;; "dlls/t2embed/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/t2embed/Makefile" ;; "dlls/tapi32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/tapi32/Makefile" ;; + "dlls/toolhelp.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/toolhelp.dll16/Makefile" ;; "dlls/traffic/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/traffic/Makefile" ;; "dlls/twain.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/twain.dll16/Makefile" ;; "dlls/twain_32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/twain_32/Makefile" ;; @@ -29164,6 +29306,7 @@ do "dlls/uxtheme/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/uxtheme/tests/Makefile" ;; "dlls/vdhcp.vxd/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/vdhcp.vxd/Makefile" ;; "dlls/vdmdbg/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/vdmdbg/Makefile" ;; + "dlls/ver.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ver.dll16/Makefile" ;; "dlls/version/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/version/Makefile" ;; "dlls/version/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/version/tests/Makefile" ;; "dlls/vmm.vxd/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/vmm.vxd/Makefile" ;; @@ -29193,9 +29336,11 @@ do "dlls/winenas.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winenas.drv/Makefile" ;; "dlls/wineoss.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wineoss.drv/Makefile" ;; "dlls/wineps.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wineps.drv/Makefile" ;; + "dlls/wineps16.drv16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wineps16.drv16/Makefile" ;; "dlls/winepulse.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winepulse.drv/Makefile" ;; "dlls/winequartz.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winequartz.drv/Makefile" ;; "dlls/winex11.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winex11.drv/Makefile" ;; + "dlls/wing.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wing.dll16/Makefile" ;; "dlls/wing32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wing32/Makefile" ;; "dlls/winhttp/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winhttp/Makefile" ;; "dlls/winhttp/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winhttp/tests/Makefile" ;; @@ -29206,6 +29351,7 @@ do "dlls/winnls.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winnls.dll16/Makefile" ;; "dlls/winnls32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winnls32/Makefile" ;; "dlls/winscard/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winscard/Makefile" ;; + "dlls/winsock.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winsock.dll16/Makefile" ;; "dlls/winspool.drv/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winspool.drv/Makefile" ;; "dlls/winspool.drv/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/winspool.drv/tests/Makefile" ;; "dlls/wintab.dll16/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wintab.dll16/Makefile" ;; diff --git a/configure.ac b/configure.ac index ecde1ab9e04..3f34f124371 100644 --- a/configure.ac +++ b/configure.ac @@ -179,6 +179,7 @@ then enable_w32skrnl=${enable_w32skrnl:-no} enable_winedos=${enable_winedos:-no} enable_winevdm=${enable_winevdm:-no} + enable_wow32=${enable_wow32:-no} fi dnl Some special cases for the wow64 build @@ -1520,6 +1521,12 @@ then then EXTRACFLAGS="$EXTRACFLAGS -Wpointer-arith" fi + + dnl Enable -Werror for maintainer mode + if test "${enable_maintainer_mode+set}" = set + then + WINE_TRY_CFLAGS([-Werror]) + fi fi dnl **** Check for underscore on external symbols **** @@ -1714,6 +1721,7 @@ AC_CHECK_FUNCS(\ pwrite \ readdir \ readlink \ + sched_setaffinity \ sched_yield \ select \ setproctitle \ @@ -2241,6 +2249,7 @@ WINE_CONFIG_MAKEFILE([dlls/dxgi/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_D WINE_CONFIG_MAKEFILE([dlls/dxgi/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/dxguid/Makefile],[dlls/Makeimplib.rules],[dlls],[ALL_IMPLIB_DIRS]) WINE_CONFIG_MAKEFILE([dlls/faultrep/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/fltlib/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/fusion/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/fusion/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/gdi32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) @@ -2438,6 +2447,7 @@ WINE_CONFIG_MAKEFILE([dlls/serialui/Makefile],[dlls/Makedll.rules],[dlls],[ALL_D WINE_CONFIG_MAKEFILE([dlls/serialui/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/setupapi/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/setupapi/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) +WINE_CONFIG_MAKEFILE([dlls/setupx.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/sfc/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/sfc_os/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/shdoclc/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) @@ -2460,13 +2470,16 @@ WINE_CONFIG_MAKEFILE([dlls/spoolss/tests/Makefile],[dlls/Maketest.rules],[dlls], WINE_CONFIG_MAKEFILE([dlls/stdole2.tlb/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/stdole32.tlb/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/sti/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/sti/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/storage.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/stress.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/strmiids/Makefile],[dlls/Makeimplib.rules],[dlls],[ALL_IMPLIB_DIRS]) WINE_CONFIG_MAKEFILE([dlls/svrapi/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/sxs/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/system.drv16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/t2embed/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/tapi32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/toolhelp.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/traffic/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/twain.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/twain_32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) @@ -2488,6 +2501,7 @@ WINE_CONFIG_MAKEFILE([dlls/uxtheme/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DL WINE_CONFIG_MAKEFILE([dlls/uxtheme/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/vdhcp.vxd/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/vdmdbg/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/ver.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/version/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/version/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/vmm.vxd/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) @@ -2517,9 +2531,11 @@ WINE_CONFIG_MAKEFILE([dlls/winemp3.acm/Makefile],[dlls/Makedll.rules],[dlls],[AL WINE_CONFIG_MAKEFILE([dlls/winenas.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/wineoss.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/wineps.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/wineps16.drv16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/winepulse.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winequartz.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winex11.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/wing.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/wing32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winhttp/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winhttp/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) @@ -2530,6 +2546,7 @@ WINE_CONFIG_MAKEFILE([dlls/winmm/tests/Makefile],[dlls/Maketest.rules],[dlls],[A WINE_CONFIG_MAKEFILE([dlls/winnls.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/winnls32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winscard/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/winsock.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) WINE_CONFIG_MAKEFILE([dlls/winspool.drv/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/winspool.drv/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/wintab.dll16/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS],[enable_win16]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 3ff953cf2db..8dcfdab85ef 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -22,14 +22,7 @@ WIN16_FILES = \ gdi.exe16 \ krnl386.exe16 \ mmsystem.dll16 \ - setupx.dll16 \ - system.drv16 \ - toolhelp.dll16 \ user.exe16 \ - ver.dll16 \ - wineps16.drv16 \ - wing.dll16 \ - winsock.dll16 \ wprocs.dll16 @MAKE_RULES@ @@ -43,33 +36,21 @@ all: $(BUILDSUBDIRS) @WIN16_FILES@ commdlg.dll16: echo "comdlg32.dll" >$@ -gdi.exe16 wing.dll16: +gdi.exe16: echo "gdi32.dll" >$@ -krnl386.exe16 system.drv16 toolhelp.dll16: +krnl386.exe16: echo "kernel32.dll" >$@ -setupx.dll16: - echo "setupapi.dll" >$@ - user.exe16: echo "user32.dll" >$@ -ver.dll16: - echo "version.dll" >$@ - wprocs.dll16: echo "winedos.dll" >$@ -wineps16.drv16: - echo "wineps.drv" >$@ - mmsystem.dll16: echo "winmm.dll" >$@ -winsock.dll16: - echo "ws2_32.dll" >$@ - # Import libraries STATIC_IMPLIBEXT = $(IMPLIBEXT:def=def.a) diff --git a/dlls/advapi32/lsa.c b/dlls/advapi32/lsa.c index a0a332eed96..b5dab211285 100644 --- a/dlls/advapi32/lsa.c +++ b/dlls/advapi32/lsa.c @@ -33,6 +33,7 @@ #include "advapi32_misc.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(advapi); @@ -311,6 +312,39 @@ static BOOL lookup_name( LSA_UNICODE_STRING *name, SID *sid, DWORD *sid_size, WC return ret; } +static INT build_domain(PLSA_REFERENCED_DOMAIN_LIST currentList, PLSA_UNICODE_STRING domain) +{ + ULONG count; + ULONG sid_size = 0,domain_size = 0; + BOOL handled = FALSE; + SID_NAME_USE use; + + for (count = 0; count < currentList->Entries; count ++) + { + if ((currentList->Domains[count].Name.Length == domain->Length) && + (strncmpiW(currentList->Domains[count].Name.Buffer,domain->Buffer,(domain->Length / sizeof(WCHAR))) == 0)) + { + HeapFree(GetProcessHeap(),0,domain->Buffer); + return count; + } + } + + if (currentList->Entries > 0) + currentList->Domains = HeapReAlloc(GetProcessHeap(),0,currentList->Domains, (currentList->Entries + 1) * sizeof(LSA_TRUST_INFORMATION)); + else + currentList->Domains = HeapAlloc(GetProcessHeap(),0,sizeof(LSA_TRUST_INFORMATION)); + + currentList->Domains[currentList->Entries].Name = *domain; + + lookup_name( domain, NULL, &sid_size, NULL, &domain_size, &use, &handled ); + domain_size = 0; + currentList->Domains[currentList->Entries].Sid = HeapAlloc(GetProcessHeap(),0,sid_size); + lookup_name( domain, currentList->Domains[currentList->Entries].Sid, &sid_size, NULL, &domain_size, &use, &handled ); + + currentList->Entries++; + return currentList->Entries-1; +} + /****************************************************************************** * LsaLookupNames2 [ADVAPI32.@] * @@ -319,7 +353,7 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count, PLSA_UNICODE_STRING names, PLSA_REFERENCED_DOMAIN_LIST *domains, PLSA_TRANSLATED_SID2 *sids ) { - ULONG i, sid_size_total = 0, domain_size_total = 0, size, num_domains; + ULONG i, sid_size_total = 0, domain_size_max = 0, size; ULONG sid_size, domain_size, mapped; BOOL ret, handled = FALSE; SID_NAME_USE use; @@ -327,7 +361,7 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count, TRACE("(%p,0x%08x,0x%08x,%p,%p,%p)\n", policy, flags, count, names, domains, sids); - mapped = num_domains = 0; + mapped = 0; for (i = 0; i < count; i++) { handled = FALSE; @@ -338,9 +372,8 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count, sid_size_total += sid_size; if (domain_size) { - FIXME("domain not handled\n"); - domain_size_total += domain_size; - num_domains++; + if (domain_size > domain_size_max) + domain_size_max = domain_size; } mapped++; } @@ -362,13 +395,20 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count, for (i = 0; i < count; i++) { + LSA_UNICODE_STRING domain; + + domain.Length = domain_size_max*sizeof(WCHAR); + domain.MaximumLength = domain_size_max*sizeof(WCHAR); + domain.Buffer = HeapAlloc(GetProcessHeap(),0,domain.Length); + (*sids)[i].Use = SidTypeUnknown; (*sids)[i].DomainIndex = -1; (*sids)[i].Flags = 0; handled = FALSE; sid_size = sid_size_total; - ret = lookup_name( &names[i], sid, &sid_size, NULL, &domain_size, &use, &handled ); + domain_size = domain_size_max; + ret = lookup_name( &names[i], sid, &sid_size, domain.Buffer, &domain_size, &use, &handled ); if (handled) { (*sids)[i].Sid = sid; @@ -376,7 +416,16 @@ NTSTATUS WINAPI LsaLookupNames2( LSA_HANDLE policy, ULONG flags, ULONG count, sid += sid_size; sid_size_total -= sid_size; + if (domain_size) + { + domain.Length = domain_size * sizeof(WCHAR); + (*sids)[i].DomainIndex = build_domain(*domains, &domain); + } + else + HeapFree(GetProcessHeap(),0,domain.Buffer); } + else + HeapFree(GetProcessHeap(),0,domain.Buffer); } if (mapped == count) return STATUS_SUCCESS; @@ -436,16 +485,31 @@ NTSTATUS WINAPI LsaLookupSids( (*Names)[i].Name.Buffer = NULL; if (LookupAccountSidW(NULL, Sids[i], NULL, &name_size, NULL, &domain_size, &use)) { - if (domain_size) - FIXME("domains not handled\n"); + LSA_UNICODE_STRING domain; + mapped++; - domain_size = 0; + if (domain_size) + { + domain.Length = domain_size*sizeof(WCHAR); + domain.MaximumLength = domain_size*sizeof(WCHAR); + domain.Buffer = HeapAlloc(GetProcessHeap(),0,domain.Length); + } + else + { + domain.Length = 0; + domain.MaximumLength = 0; + domain.Buffer = NULL; + } + (*Names)[i].Use = use; (*Names)[i].Name.Length = name_size * sizeof(WCHAR); (*Names)[i].Name.MaximumLength = name_size * sizeof(WCHAR); (*Names)[i].Name.Buffer = HeapAlloc(GetProcessHeap(),0,name_size * sizeof(WCHAR)); - LookupAccountSidW(NULL, Sids[i], (*Names)[i].Name.Buffer, &name_size, NULL, &domain_size, &use); + LookupAccountSidW(NULL, Sids[i], (*Names)[i].Name.Buffer, &name_size, domain.Buffer, &domain_size, &use); + + if (domain_size) + (*Names)[i].DomainIndex = build_domain(*ReferencedDomains, &domain); } } TRACE("mapped %u out of %u\n",mapped,Count); diff --git a/dlls/advapi32/tests/lsa.c b/dlls/advapi32/tests/lsa.c index 991b06bdbf2..efb75bbe2ba 100644 --- a/dlls/advapi32/tests/lsa.c +++ b/dlls/advapi32/tests/lsa.c @@ -298,7 +298,7 @@ static void test_LsaLookupNames2(void) ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %x)\n", status); ok(sids[0].Use == SidTypeWellKnownGroup, "expected SidTypeWellKnownGroup, got %u\n", sids[0].Use); ok(sids[0].Flags == 0, "expected 0, got 0x%08x\n", sids[0].Flags); - todo_wine ok(domains->Entries == 1, "expected 1, got %u\n", domains->Entries); + ok(domains->Entries == 1, "expected 1, got %u\n", domains->Entries); get_sid_info(sids[0].Sid, &account, &sid_dom); ok(!strcmp(account, "LOCAL SERVICE"), "expected \"LOCAL SERVICE\", got \"%s\"\n", account); ok(!strcmp(sid_dom, "NT AUTHORITY"), "expected \"NT AUTHORITY\", got \"%s\"\n", sid_dom); @@ -323,7 +323,7 @@ static void test_LsaLookupNames2(void) ok(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %x)\n", status); ok(sids[0].Use == SidTypeWellKnownGroup, "expected SidTypeWellKnownGroup, got %u\n", sids[0].Use); ok(sids[0].Flags == 0, "expected 0, got 0x%08x\n", sids[0].Flags); - todo_wine ok(domains->Entries == 1, "expected 1, got %u\n", domains->Entries); + ok(domains->Entries == 1, "expected 1, got %u\n", domains->Entries); get_sid_info(sids[0].Sid, &account, &sid_dom); ok(!strcmp(account, "LOCAL SERVICE"), "expected \"LOCAL SERVICE\", got \"%s\"\n", account); ok(!strcmp(sid_dom, "NT AUTHORITY"), "expected \"NT AUTHORITY\", got \"%s\"\n", sid_dom); @@ -338,8 +338,8 @@ static void test_LsaLookupNames2(void) ok(sids[0].Use == SidTypeWellKnownGroup, "expected SidTypeWellKnownGroup, got %u\n", sids[0].Use); ok(sids[1].Use == SidTypeUnknown, "expected SidTypeUnknown, got %u\n", sids[0].Use); ok(sids[2].Use == SidTypeWellKnownGroup, "expected SidTypeWellKnownGroup, got %u\n", sids[0].Use); - todo_wine ok(sids[0].DomainIndex == 0, "expected 0, got %u\n", sids[0].DomainIndex); - todo_wine ok(domains->Entries == 1, "expected 1, got %u\n", domains->Entries); + ok(sids[0].DomainIndex == 0, "expected 0, got %u\n", sids[0].DomainIndex); + ok(domains->Entries == 1, "expected 1, got %u\n", domains->Entries); pLsaFreeMemory(sids); pLsaFreeMemory(domains); diff --git a/dlls/comctl32/comctl32.h b/dlls/comctl32/comctl32.h index 300831434ee..e0d19707bf2 100644 --- a/dlls/comctl32/comctl32.h +++ b/dlls/comctl32/comctl32.h @@ -231,18 +231,7 @@ extern void UPDOWN_Unregister(void); int MONTHCAL_MonthLength(int month, int year); - -static inline void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) -{ - to->wYear = from->wYear; - to->wMonth = from->wMonth; - to->wDayOfWeek = from->wDayOfWeek; - to->wDay = from->wDay; - to->wHour = from->wHour; - to->wMinute = from->wMinute; - to->wSecond = from->wSecond; - to->wMilliseconds = from->wMilliseconds; -} +int MONTHCAL_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year); extern void THEMING_Initialize(void); extern void THEMING_Uninitialize(void); diff --git a/dlls/comctl32/datetime.c b/dlls/comctl32/datetime.c index ae538a535e9..891ca9163d5 100644 --- a/dlls/comctl32/datetime.c +++ b/dlls/comctl32/datetime.c @@ -88,6 +88,7 @@ typedef struct /* in monthcal.c */ extern int MONTHCAL_MonthLength(int month, int year); +extern int MONTHCAL_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year); /* this list of defines is closely related to `allowedformatchars' defined * in datetime.c; the high nibble indicates the `base type' of the format @@ -138,43 +139,47 @@ static const int maxrepetition [] = {4,2,2,2,4,2,2,4,-1}; static DWORD -DATETIME_GetSystemTime (const DATETIME_INFO *infoPtr, SYSTEMTIME *lprgSysTimeArray) +DATETIME_GetSystemTime (const DATETIME_INFO *infoPtr, SYSTEMTIME *systime) { - if (!lprgSysTimeArray) return GDT_NONE; + if (!systime) return GDT_NONE; if ((infoPtr->dwStyle & DTS_SHOWNONE) && (SendMessageW (infoPtr->hwndCheckbut, BM_GETCHECK, 0, 0) == BST_UNCHECKED)) return GDT_NONE; - MONTHCAL_CopyTime (&infoPtr->date, lprgSysTimeArray); + *systime = infoPtr->date; return GDT_VALID; } static BOOL -DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *lprgSysTimeArray) +DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *systime) { - if (!lprgSysTimeArray) return 0; + if (!systime) return 0; TRACE("%04d/%02d/%02d %02d:%02d:%02d\n", - lprgSysTimeArray->wYear, lprgSysTimeArray->wMonth, lprgSysTimeArray->wDay, - lprgSysTimeArray->wHour, lprgSysTimeArray->wMinute, lprgSysTimeArray->wSecond); + systime->wYear, systime->wMonth, systime->wDay, + systime->wHour, systime->wMinute, systime->wSecond); if (flag == GDT_VALID) { - if (lprgSysTimeArray->wYear < 1601 || lprgSysTimeArray->wYear > 30827 || - lprgSysTimeArray->wMonth < 1 || lprgSysTimeArray->wMonth > 12 || - lprgSysTimeArray->wDayOfWeek > 6 || - lprgSysTimeArray->wDay < 1 || lprgSysTimeArray->wDay > 31 || - lprgSysTimeArray->wHour > 23 || - lprgSysTimeArray->wMinute > 59 || - lprgSysTimeArray->wSecond > 59 || - lprgSysTimeArray->wMilliseconds > 999 + if (systime->wYear < 1601 || systime->wYear > 30827 || + systime->wMonth < 1 || systime->wMonth > 12 || + systime->wDay < 1 || systime->wDay > 31 || + systime->wHour > 23 || + systime->wMinute > 59 || + systime->wSecond > 59 || + systime->wMilliseconds > 999 ) - return 0; + return FALSE; infoPtr->dateValid = TRUE; - MONTHCAL_CopyTime (lprgSysTimeArray, &infoPtr->date); + infoPtr->date = *systime; + /* always store a valid day of week */ + infoPtr->date.wDayOfWeek = + MONTHCAL_CalculateDayOfWeek(infoPtr->date.wDay, infoPtr->date.wMonth, + infoPtr->date.wYear); + SendMessageW (infoPtr->hMonthCal, MCM_SETCURSEL, 0, (LPARAM)(&infoPtr->date)); SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_CHECKED, 0); } else if ((infoPtr->dwStyle & DTS_SHOWNONE) && (flag == GDT_NONE)) { @@ -182,7 +187,7 @@ DATETIME_SetSystemTime (DATETIME_INFO *infoPtr, DWORD flag, const SYSTEMTIME *lp SendMessageW (infoPtr->hwndCheckbut, BM_SETCHECK, BST_UNCHECKED, 0); } else - return 0; + return FALSE; InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); return TRUE; @@ -970,7 +975,8 @@ DATETIME_Char (DATETIME_INFO *infoPtr, WPARAM vkCode) break; case INVALIDFULLYEAR: case FULLYEAR: - date->wYear = (date->wYear%1000)*10 + num; + /* reset current year initialy */ + date->wYear = ((date->wYear/1000) ? 0 : 1)*(date->wYear%1000)*10 + num; date->wDayOfWeek = DATETIME_CalculateDayOfWeek( date->wDay,date->wMonth,date->wYear); DATETIME_SendDateTimeChangeNotify (infoPtr); @@ -1128,7 +1134,7 @@ DATETIME_SendDateTimeChangeNotify (const DATETIME_INFO *infoPtr) dtdtc.dwFlags = (infoPtr->dwStyle & DTS_SHOWNONE) ? GDT_NONE : GDT_VALID; - MONTHCAL_CopyTime (&infoPtr->date, &dtdtc.st); + dtdtc.st = infoPtr->date; return (BOOL) SendMessageW (infoPtr->hwndNotify, WM_NOTIFY, dtdtc.nmhdr.idFrom, (LPARAM)&dtdtc); } @@ -1235,7 +1241,6 @@ DATETIME_SetFont (DATETIME_INFO *infoPtr, HFONT font, BOOL repaint) static LRESULT DATETIME_Create (HWND hwnd, const CREATESTRUCTW *lpcs) { - static const WCHAR SysMonthCal32W[] = { 'S', 'y', 's', 'M', 'o', 'n', 't', 'h', 'C', 'a', 'l', '3', '2', 0 }; DATETIME_INFO *infoPtr = Alloc (sizeof(DATETIME_INFO)); STYLESTRUCT ss = { 0, lpcs->style }; @@ -1256,7 +1261,7 @@ DATETIME_Create (HWND hwnd, const CREATESTRUCTW *lpcs) DATETIME_SetFormatW (infoPtr, 0); /* create the monthcal control */ - infoPtr->hMonthCal = CreateWindowExW (0, SysMonthCal32W, 0, WS_BORDER | WS_POPUP | WS_CLIPSIBLINGS, + infoPtr->hMonthCal = CreateWindowExW (0, MONTHCAL_CLASSW, 0, WS_BORDER | WS_POPUP | WS_CLIPSIBLINGS, 0, 0, 0, 0, infoPtr->hwndSelf, 0, 0, 0); /* initialize info structure */ diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index 1c0f58bbd69..eb2dbfb67ec 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -7,6 +7,7 @@ * Copyright 2001 CodeWeavers Inc. * Copyright 2002 Dimitrie O. Paun * Copyright 2009 Nikolay Sivov + * Copyright 2009 Owen Rudge for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -98,7 +99,6 @@ * -- LVN_BEGINSCROLL, LVN_ENDSCROLL * -- LVN_GETINFOTIP * -- LVN_HOTTRACK - * -- LVN_MARQUEEBEGIN * -- LVN_SETDISPINFO * -- NM_HOVER * -- LVN_BEGINRDRAG @@ -248,6 +248,8 @@ typedef struct tagLISTVIEW_INFO BOOL bLButtonDown; BOOL bRButtonDown; BOOL bDragging; + BOOL bMarqueeSelect; /* marquee selection/highlight underway */ + RECT marqueeRect; POINT ptClickPos; /* point where the user clicked */ BOOL bNoItemMetrics; /* flags if item metrics are not yet computed */ INT nItemHeight; @@ -3605,17 +3607,94 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN WORD wDragWidth = GetSystemMetrics(SM_CXDRAG); WORD wDragHeight= GetSystemMetrics(SM_CYDRAG); - rect.left = infoPtr->ptClickPos.x - wDragWidth; - rect.right = infoPtr->ptClickPos.x + wDragWidth; - rect.top = infoPtr->ptClickPos.y - wDragHeight; - rect.bottom = infoPtr->ptClickPos.y + wDragHeight; - tmp.x = x; tmp.y = y; lvHitTestInfo.pt = tmp; LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE); + if (infoPtr->bMarqueeSelect) + { + LVITEMW item; + ITERATOR i; + + if (x > infoPtr->ptClickPos.x) + { + rect.left = infoPtr->ptClickPos.x; + rect.right = x; + } + else + { + rect.left = x; + rect.right = infoPtr->ptClickPos.x; + } + + if (y > infoPtr->ptClickPos.y) + { + rect.top = infoPtr->ptClickPos.y; + rect.bottom = y; + } + else + { + rect.top = y; + rect.bottom = infoPtr->ptClickPos.y; + } + + /* Cancel out the old marquee rectangle and draw the new one */ + LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeRect); + + /* Invert the items in the old marquee rectangle */ + iterator_frameditems(&i, infoPtr, &infoPtr->marqueeRect); + + while (iterator_next(&i)) + { + if (i.nItem > -1) + { + if (LISTVIEW_GetItemState(infoPtr, i.nItem, LVIS_SELECTED) == LVIS_SELECTED) + item.state = 0; + else + item.state = LVIS_SELECTED; + + item.stateMask = LVIS_SELECTED; + + LISTVIEW_SetItemState(infoPtr, i.nItem, &item); + } + } + + iterator_destroy(&i); + + CopyRect(&infoPtr->marqueeRect, &rect); + + /* Iterate over the items within our marquee rectangle */ + iterator_frameditems(&i, infoPtr, &rect); + + while (iterator_next(&i)) + { + if (i.nItem > -1) + { + /* If CTRL is pressed, invert. If not, always select the item. */ + if ((fwKeys & MK_CONTROL) && (LISTVIEW_GetItemState(infoPtr, i.nItem, LVIS_SELECTED))) + item.state = 0; + else + item.state = LVIS_SELECTED; + + item.stateMask = LVIS_SELECTED; + + LISTVIEW_SetItemState(infoPtr, i.nItem, &item); + } + } + + iterator_destroy(&i); + + LISTVIEW_InvalidateRect(infoPtr, &rect); + return 0; + } + + rect.left = infoPtr->ptClickPos.x - wDragWidth; + rect.right = infoPtr->ptClickPos.x + wDragWidth; + rect.top = infoPtr->ptClickPos.y - wDragHeight; + rect.bottom = infoPtr->ptClickPos.y + wDragHeight; + /* reset item marker */ if (infoPtr->nLButtonDownItem != lvHitTestInfo.iItem) infoPtr->nLButtonDownItem = -1; @@ -3640,17 +3719,31 @@ static LRESULT LISTVIEW_MouseMove(LISTVIEW_INFO *infoPtr, WORD fwKeys, INT x, IN if (!infoPtr->bDragging) { - NMLISTVIEW nmlv; - lvHitTestInfo.pt = infoPtr->ptClickPos; LISTVIEW_HitTest(infoPtr, &lvHitTestInfo, TRUE, TRUE); - ZeroMemory(&nmlv, sizeof(nmlv)); - nmlv.iItem = lvHitTestInfo.iItem; - nmlv.ptAction = infoPtr->ptClickPos; + /* If the click is outside the range of an item, begin a + highlight. If not, begin an item drag. */ + if (lvHitTestInfo.iItem == -1) + { + NMHDR hdr; + + /* If we're allowing multiple selections, send notification. + If return value is non-zero, cancel. */ + if (!(infoPtr->dwStyle & LVS_SINGLESEL) && (notify_hdr(infoPtr, LVN_MARQUEEBEGIN, &hdr) == 0)) + infoPtr->bMarqueeSelect = TRUE; + } + else + { + NMLISTVIEW nmlv; - notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv); - infoPtr->bDragging = TRUE; + ZeroMemory(&nmlv, sizeof(nmlv)); + nmlv.iItem = lvHitTestInfo.iItem; + nmlv.ptAction = infoPtr->ptClickPos; + + notify_listview(infoPtr, LVN_BEGINDRAG, &nmlv); + infoPtr->bDragging = TRUE; + } } return 0; @@ -4643,6 +4736,10 @@ enddraw: if ((infoPtr->uView == LV_VIEW_DETAILS) && infoPtr->dwLvExStyle & LVS_EX_GRIDLINES) LISTVIEW_RefreshReportGrid(infoPtr, hdc); + /* Draw marquee rectangle if appropriate */ + if (infoPtr->bMarqueeSelect) + DrawFocusRect(hdc, &infoPtr->marqueeRect); + if (cdmode & CDRF_NOTIFYPOSTPAINT) notify_postpaint(infoPtr, &nmlvcd); @@ -9312,6 +9409,7 @@ static LRESULT LISTVIEW_LButtonDown(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, IN infoPtr->bLButtonDown = TRUE; infoPtr->ptClickPos = pt; infoPtr->bDragging = FALSE; + infoPtr->bMarqueeSelect = FALSE; lvHitTestInfo.pt.x = x; lvHitTestInfo.pt.y = y; @@ -9433,9 +9531,16 @@ static LRESULT LISTVIEW_LButtonUp(LISTVIEW_INFO *infoPtr, WORD wKey, INT x, INT LISTVIEW_SetSelection(infoPtr, infoPtr->nLButtonDownItem); infoPtr->nLButtonDownItem = -1; - if (infoPtr->bDragging) + if (infoPtr->bDragging || infoPtr->bMarqueeSelect) { + /* Remove the marquee rectangle */ + if (infoPtr->bMarqueeSelect) + LISTVIEW_InvalidateRect(infoPtr, &infoPtr->marqueeRect); + + SetRect(&infoPtr->marqueeRect, 0, 0, 0, 0); + infoPtr->bDragging = FALSE; + infoPtr->bMarqueeSelect = FALSE; return 0; } diff --git a/dlls/comctl32/monthcal.c b/dlls/comctl32/monthcal.c index 7a49c7025bf..ed059ff2981 100644 --- a/dlls/comctl32/monthcal.c +++ b/dlls/comctl32/monthcal.c @@ -36,9 +36,6 @@ * -- handle resources better (doesn't work now); * -- take care of internationalization. * -- keyboard handling. - * -- GetRange: At the moment, we copy ranges anyway, regardless of - * infoPtr->rangeValid; an invalid range is simply filled - * with zeros in SetRange. Is this the right behavior? * -- search for FIXME */ @@ -99,14 +96,12 @@ typedef struct int monthRange; MONTHDAYSTATE *monthdayState; SYSTEMTIME todaysDate; - DWORD currentMonth; - DWORD currentYear; int status; /* See MC_SEL flags */ - int curSelDay; /* current selected day */ int firstSelDay; /* first selected day */ INT maxSelCount; SYSTEMTIME minSel; SYSTEMTIME maxSel; + SYSTEMTIME curSel; /* contains currently selected year, month and day */ DWORD rangeValid; SYSTEMTIME minDate; SYSTEMTIME maxDate; @@ -135,6 +130,33 @@ static const WCHAR themeClass[] = { 'S','c','r','o','l','l','b','a','r',0 }; /* helper functions */ +/* send a single MCN_SELCHANGE notification */ +static inline void MONTHCAL_NotifySelectionChange(const MONTHCAL_INFO *infoPtr) +{ + NMSELCHANGE nmsc; + + nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf; + nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); + nmsc.nmhdr.code = MCN_SELCHANGE; + nmsc.stSelStart = infoPtr->minSel; + nmsc.stSelEnd = infoPtr->maxSel; + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc); +} + +/* send a single MCN_SELECT notification */ +static inline void MONTHCAL_NotifySelect(const MONTHCAL_INFO *infoPtr) +{ + NMSELCHANGE nmsc; + + nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf; + nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); + nmsc.nmhdr.code = MCN_SELECT; + nmsc.stSelStart = infoPtr->minSel; + nmsc.stSelEnd = infoPtr->maxSel; + + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc); +} + /* returns the number of days in any given month, checking for leap days */ /* january is 1, december is 12 */ int MONTHCAL_MonthLength(int month, int year) @@ -165,17 +187,35 @@ static inline BOOL MONTHCAL_IsDateEqual(const SYSTEMTIME *first, const SYSTEMTIM (first->wDay == second->wDay); } -/* make sure that time is valid */ -static BOOL MONTHCAL_ValidateTime(SYSTEMTIME time) +/* make sure that date fields are valid */ +static BOOL MONTHCAL_ValidateDate(const SYSTEMTIME *time) { - if(time.wMonth < 1 || time.wMonth > 12 ) return FALSE; - if(time.wDayOfWeek > 6) return FALSE; - if(time.wDay > MONTHCAL_MonthLength(time.wMonth, time.wYear)) + if(time->wMonth < 1 || time->wMonth > 12 ) return FALSE; + if(time->wDayOfWeek > 6) return FALSE; + if(time->wDay > MONTHCAL_MonthLength(time->wMonth, time->wYear)) return FALSE; return TRUE; } +/* Used in MCM_SETRANGE/MCM_SETSELRANGE to determine resulting time part. + Milliseconds are intentionaly not validated. */ +static BOOL MONTHCAL_ValidateTime(const SYSTEMTIME *time) +{ + if((time->wHour > 24) || (time->wMinute > 59) || (time->wSecond > 59)) + return FALSE; + else + return TRUE; +} + +/* Copies timestamp part only. Milliseconds are intentionaly not copied + cause it matches required behaviour for current use of this helper */ +static void MONTHCAL_CopyTime(const SYSTEMTIME *from, SYSTEMTIME *to) +{ + to->wHour = from->wHour; + to->wMinute = from->wMinute; + to->wSecond = from->wSecond; +} /* Note:Depending on DST, this may be offset by a day. Need to find out if we're on a DST place & adjust the clock accordingly. @@ -186,7 +226,7 @@ static BOOL MONTHCAL_ValidateTime(SYSTEMTIME time) /* returns the day in the week(0 == sunday, 6 == saturday) */ /* day(1 == 1st, 2 == 2nd... etc), year is the year value */ -static int MONTHCAL_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year) +int MONTHCAL_CalculateDayOfWeek(DWORD day, DWORD month, DWORD year) { year-=(month < 3); @@ -214,7 +254,7 @@ static int MONTHCAL_CalcDayFromPos(const MONTHCAL_INFO *infoPtr, int x, int y, *daypos = (x - infoPtr->days.left ) / infoPtr->width_increment; *weekpos = (y - infoPtr->days.top ) / infoPtr->height_increment; - firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear)+6 - infoPtr->firstDay)%7; + firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->curSel.wMonth, infoPtr->curSel.wYear)+6 - infoPtr->firstDay)%7; retval = *daypos + (7 * *weekpos) - firstDay; return retval; } @@ -227,26 +267,26 @@ static void MONTHCAL_CalcDayXY(const MONTHCAL_INFO *infoPtr, int day, int month, { int firstDay, prevMonth; - firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear) +6 - infoPtr->firstDay)%7; + firstDay = (MONTHCAL_CalculateDayOfWeek(1, infoPtr->curSel.wMonth, infoPtr->curSel.wYear) +6 - infoPtr->firstDay)%7; - if(month==infoPtr->currentMonth) { + if(month==infoPtr->curSel.wMonth) { *x = (day + firstDay) % 7; *y = (day + firstDay - *x) / 7; return; } - if(month < infoPtr->currentMonth) { + if(month < infoPtr->curSel.wMonth) { prevMonth = month - 1; if(prevMonth==0) prevMonth = 12; - *x = (MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) - firstDay) % 7; + *x = (MONTHCAL_MonthLength(prevMonth, infoPtr->curSel.wYear) - firstDay) % 7; *y = 0; return; } - *y = MONTHCAL_MonthLength(month, infoPtr->currentYear - 1) / 7; + *y = MONTHCAL_MonthLength(month, infoPtr->curSel.wYear - 1) / 7; *x = (day + firstDay + MONTHCAL_MonthLength(month, - infoPtr->currentYear)) % 7; + infoPtr->curSel.wYear)) % 7; } @@ -312,7 +352,7 @@ static void MONTHCAL_DrawDay(const MONTHCAL_INFO *infoPtr, HDC hdc, int day, int MONTHCAL_CalcDayRect(infoPtr, &r, x, y); if((day>=infoPtr->minSel.wDay) && (day<=infoPtr->maxSel.wDay) - && (month==infoPtr->currentMonth)) { + && (month == infoPtr->curSel.wMonth)) { RECT r2; TRACE("%d %d %d\n",day, infoPtr->minSel.wDay, infoPtr->maxSel.wDay); @@ -354,7 +394,7 @@ static void MONTHCAL_DrawDay(const MONTHCAL_INFO *infoPtr, HDC hdc, int day, int } /* draw a rectangle around the currently selected days text */ - if((day==infoPtr->curSelDay) && (month==infoPtr->currentMonth)) + if((day == infoPtr->curSel.wDay) && (month == infoPtr->curSel.wMonth)) DrawFocusRect(hdc, &r); } @@ -451,9 +491,9 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT SetTextColor(hdc, infoPtr->titletxt); currentFont = SelectObject(hdc, infoPtr->hBoldFont); - GetLocaleInfoW( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->currentMonth -1, + GetLocaleInfoW( LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+infoPtr->curSel.wMonth -1, buf1,countof(buf1)); - wsprintfW(buf, fmt1W, buf1, infoPtr->currentYear); + wsprintfW(buf, fmt1W, buf1, infoPtr->curSel.wYear); if(IntersectRect(&rcTemp, &(ps->rcPaint), title)) { @@ -489,8 +529,8 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT MoveToEx(hdc, infoPtr->days.left + 3, title->bottom + textHeight + 1, NULL); LineTo(hdc, infoPtr->days.right - 3, title->bottom + textHeight + 1); - prevMonth = infoPtr->currentMonth - 1; - if(prevMonth == 0) /* if currentMonth is january(1) prevMonth is */ + prevMonth = infoPtr->curSel.wMonth - 1; + if(prevMonth == 0) /* if curSel.wMonth is january(1) prevMonth is */ prevMonth = 12; /* december(12) of the previous year */ infoPtr->wdays.left = infoPtr->days.left = infoPtr->weeknums.right; @@ -518,18 +558,18 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT /* draw day numbers; first, the previous month */ - firstDay = MONTHCAL_CalculateDayOfWeek(1, infoPtr->currentMonth, infoPtr->currentYear); + firstDay = MONTHCAL_CalculateDayOfWeek(1, infoPtr->curSel.wMonth, infoPtr->curSel.wYear); - day = MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear) + + day = MONTHCAL_MonthLength(prevMonth, infoPtr->curSel.wYear) + (infoPtr->firstDay + 7 - firstDay)%7 + 1; - if (day > MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)) + if (day > MONTHCAL_MonthLength(prevMonth, infoPtr->curSel.wYear)) day -=7; startofprescal = day; mask = 1<<(day-1); i = 0; m = 0; - while(day <= MONTHCAL_MonthLength(prevMonth, infoPtr->currentYear)) { + while(day <= MONTHCAL_MonthLength(prevMonth, infoPtr->curSel.wYear)) { MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, 0); if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) { @@ -557,14 +597,14 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) { - MONTHCAL_DrawDay(infoPtr, hdc, day, infoPtr->currentMonth, i, 0, + MONTHCAL_DrawDay(infoPtr, hdc, day, infoPtr->curSel.wMonth, i, 0, infoPtr->monthdayState[m] & mask); - if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && + if((infoPtr->curSel.wMonth == infoPtr->todaysDate.wMonth) && (day==infoPtr->todaysDate.wDay) && - (infoPtr->currentYear == infoPtr->todaysDate.wYear)) { + (infoPtr->curSel.wYear == infoPtr->todaysDate.wYear)) { if(!(infoPtr->dwStyle & MCS_NOTODAYCIRCLE)) - MONTHCAL_CircleDay(infoPtr, hdc, day, infoPtr->currentMonth); + MONTHCAL_CircleDay(infoPtr, hdc, day, infoPtr->curSel.wMonth); } } @@ -575,18 +615,18 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT j = 1; /* move to the 2nd week of the current month */ i = 0; /* move back to sunday */ - while(day <= MONTHCAL_MonthLength(infoPtr->currentMonth, infoPtr->currentYear)) { + while(day <= MONTHCAL_MonthLength(infoPtr->curSel.wMonth, infoPtr->curSel.wYear)) { MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) { - MONTHCAL_DrawDay(infoPtr, hdc, day, infoPtr->currentMonth, i, j, + MONTHCAL_DrawDay(infoPtr, hdc, day, infoPtr->curSel.wMonth, i, j, infoPtr->monthdayState[m] & mask); - if((infoPtr->currentMonth==infoPtr->todaysDate.wMonth) && + if((infoPtr->curSel.wMonth == infoPtr->todaysDate.wMonth) && (day==infoPtr->todaysDate.wDay) && - (infoPtr->currentYear == infoPtr->todaysDate.wYear)) + (infoPtr->curSel.wYear == infoPtr->todaysDate.wYear)) if(!(infoPtr->dwStyle & MCS_NOTODAYCIRCLE)) - MONTHCAL_CircleDay(infoPtr, hdc, day, infoPtr->currentMonth); + MONTHCAL_CircleDay(infoPtr, hdc, day, infoPtr->curSel.wMonth); } mask<<=1; day++; @@ -608,7 +648,7 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT MONTHCAL_CalcDayRect(infoPtr, &rcDay, i, j); if(IntersectRect(&rcTemp, &(ps->rcPaint), &rcDay)) { - MONTHCAL_DrawDay(infoPtr, hdc, day, infoPtr->currentMonth + 1, i, j, + MONTHCAL_DrawDay(infoPtr, hdc, day, infoPtr->curSel.wMonth + 1, i, j, infoPtr->monthdayState[m] & mask); } @@ -630,8 +670,8 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT if(!(infoPtr->dwStyle & MCS_NOTODAYCIRCLE)) { /*day is the number of days from nextmonth we put on the calendar */ MONTHCAL_CircleDay(infoPtr, hdc, - day+MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear), - infoPtr->currentMonth); + day+MONTHCAL_MonthLength(infoPtr->curSel.wMonth, infoPtr->curSel.wYear), + infoPtr->curSel.wMonth); } if (!LoadStringW(COMCTL32_hModule,IDM_TODAY,buf1,countof(buf1))) { @@ -639,7 +679,7 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT strcpyW(buf1, todayW); } MONTHCAL_CalcDayRect(infoPtr, &rtoday, 1, 6); - MONTHCAL_CopyTime(&infoPtr->todaysDate,&localtime); + localtime = infoPtr->todaysDate; GetDateFormatW(LOCALE_USER_DEFAULT,DATE_SHORTDATE,&localtime,NULL,buf2,countof(buf2)); wsprintfW(buf, fmt2W, buf1, buf2); SelectObject(hdc, infoPtr->hBoldFont); @@ -677,20 +717,20 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT default: mindays = 0; } - if (infoPtr->currentMonth < 2) + if (infoPtr->curSel.wMonth < 2) { /* calculate all those exceptions for january */ - weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear); + weeknum1=MONTHCAL_CalculateDayOfWeek(1, 1, infoPtr->curSel.wYear); if ((infoPtr->firstDay +7 - weeknum1)%7 > mindays) weeknum =1; else { weeknum = 0; for(i=0; i<11; i++) - weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->currentYear-1); + weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->curSel.wYear - 1); weeknum +=startofprescal+ 7; weeknum /=7; - weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear-1); + weeknum1=MONTHCAL_CalculateDayOfWeek(1, 1, infoPtr->curSel.wYear - 1); if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays) weeknum++; } @@ -699,10 +739,10 @@ static void MONTHCAL_Refresh(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRUCT { weeknum = 0; for(i=0; icurrentYear); + weeknum+=MONTHCAL_MonthLength(i+1, infoPtr->curSel.wYear); weeknum +=startofprescal+ 7; weeknum /=7; - weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->currentYear); + weeknum1=MONTHCAL_CalculateDayOfWeek(1,1,infoPtr->curSel.wYear); if ((infoPtr->firstDay + 7 - weeknum1)%7 > mindays) weeknum++; } @@ -746,12 +786,16 @@ MONTHCAL_GetMinReqRect(const MONTHCAL_INFO *infoPtr, LPRECT lpRect) if(!lpRect) return FALSE; - lpRect->left = infoPtr->title.left; - lpRect->top = infoPtr->title.top; - lpRect->right = infoPtr->title.right; + lpRect->left = infoPtr->title.left; + lpRect->top = infoPtr->title.top; + lpRect->right = infoPtr->title.right; lpRect->bottom = infoPtr->todayrect.bottom; + AdjustWindowRect(lpRect, infoPtr->dwStyle, FALSE); + /* minimal rectangle is zero based */ + OffsetRect(lpRect, -lpRect->left, -lpRect->top); + TRACE("%s\n", wine_dbgstr_rect(lpRect)); return TRUE; @@ -860,18 +904,19 @@ static LRESULT MONTHCAL_SetFirstDayOfWeek(MONTHCAL_INFO *infoPtr, INT day) { int prev = MAKELONG(infoPtr->firstDay, infoPtr->firstDayHighWord); - int localFirstDay; - WCHAR buf[40]; TRACE("day %d\n", day); - GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf)); - TRACE("%s %d\n", debugstr_w(buf), strlenW(buf)); - - localFirstDay = atoiW(buf); - if(day == -1) { + int localFirstDay; + WCHAR buf[80]; + + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_IFIRSTDAYOFWEEK, buf, countof(buf)); + TRACE("%s %d\n", debugstr_w(buf), strlenW(buf)); + + localFirstDay = atoiW(buf); + infoPtr->firstDay = localFirstDay; infoPtr->firstDayHighWord = FALSE; } @@ -913,29 +958,35 @@ MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, SHORT limits, SYSTEMTIME *range) TRACE("%x %p\n", limits, range); - if ((limits & GDTR_MIN && !MONTHCAL_ValidateTime(range[0])) || - (limits & GDTR_MAX && !MONTHCAL_ValidateTime(range[1]))) + if ((limits & GDTR_MIN && !MONTHCAL_ValidateDate(&range[0])) || + (limits & GDTR_MAX && !MONTHCAL_ValidateDate(&range[1]))) return FALSE; if (limits & GDTR_MIN) { - MONTHCAL_CopyTime(&range[0], &infoPtr->minDate); + if (!MONTHCAL_ValidateTime(&range[0])) + MONTHCAL_CopyTime(&infoPtr->todaysDate, &range[0]); + + infoPtr->minDate = range[0]; infoPtr->rangeValid |= GDTR_MIN; } if (limits & GDTR_MAX) { - MONTHCAL_CopyTime(&range[1], &infoPtr->maxDate); + if (!MONTHCAL_ValidateTime(&range[1])) + MONTHCAL_CopyTime(&infoPtr->todaysDate, &range[1]); + + infoPtr->maxDate = range[1]; infoPtr->rangeValid |= GDTR_MAX; } /* Only one limit set - we are done */ if ((infoPtr->rangeValid & (GDTR_MIN | GDTR_MAX)) != (GDTR_MIN | GDTR_MAX)) return TRUE; - + SystemTimeToFileTime(&infoPtr->maxDate, &ft_max); SystemTimeToFileTime(&infoPtr->minDate, &ft_min); - if (CompareFileTime(&ft_min, &ft_max) > 0) + if (CompareFileTime(&ft_min, &ft_max) >= 0) { if ((limits & (GDTR_MIN | GDTR_MAX)) == (GDTR_MIN | GDTR_MAX)) { @@ -946,8 +997,11 @@ MONTHCAL_SetRange(MONTHCAL_INFO *infoPtr, SHORT limits, SYSTEMTIME *range) } else { - /* Reset the other limit. */ - /* FIXME: native sets date&time to 0. Should we do this too? */ + static const SYSTEMTIME zero; + + /* reset the other limit */ + if (limits & GDTR_MIN) infoPtr->maxDate = zero; + if (limits & GDTR_MAX) infoPtr->minDate = zero; infoPtr->rangeValid &= limits & GDTR_MIN ? ~GDTR_MAX : ~GDTR_MIN ; } } @@ -963,8 +1017,8 @@ MONTHCAL_GetRange(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *range) if(!range) return FALSE; - MONTHCAL_CopyTime(&infoPtr->maxDate, &range[1]); - MONTHCAL_CopyTime(&infoPtr->minDate, &range[0]); + range[1] = infoPtr->maxDate; + range[0] = infoPtr->minDate; return infoPtr->rangeValid; } @@ -991,7 +1045,7 @@ MONTHCAL_GetCurSel(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel) if(!curSel) return FALSE; if(infoPtr->dwStyle & MCS_MULTISELECT) return FALSE; - MONTHCAL_CopyTime(&infoPtr->minSel, curSel); + *curSel = infoPtr->minSel; TRACE("%d/%d/%d\n", curSel->wYear, curSel->wMonth, curSel->wDay); return TRUE; } @@ -1005,18 +1059,15 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel) if(!curSel) return FALSE; if(infoPtr->dwStyle & MCS_MULTISELECT) return FALSE; - if(!MONTHCAL_ValidateTime(*curSel)) return FALSE; + if(!MONTHCAL_ValidateDate(curSel)) return FALSE; - MONTHCAL_CopyTime(curSel, &infoPtr->minSel); - MONTHCAL_CopyTime(curSel, &infoPtr->maxSel); + infoPtr->minSel = *curSel; + infoPtr->maxSel = *curSel; /* exit earlier if selection equals current */ - if (infoPtr->currentMonth == curSel->wMonth && - infoPtr->currentYear == curSel->wYear && - infoPtr->curSelDay == curSel->wDay) return TRUE; + if (MONTHCAL_IsDateEqual(&infoPtr->curSel, curSel)) return TRUE; - infoPtr->currentMonth = curSel->wMonth; - infoPtr->currentYear = curSel->wYear; + infoPtr->curSel = *curSel; InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); @@ -1036,9 +1087,10 @@ MONTHCAL_SetMaxSelCount(MONTHCAL_INFO *infoPtr, INT max) { TRACE("%d\n", max); - if(infoPtr->dwStyle & MCS_MULTISELECT) { - infoPtr->maxSelCount = max; - } + if(!(infoPtr->dwStyle & MCS_MULTISELECT)) return FALSE; + if(max <= 0) return FALSE; + + infoPtr->maxSelCount = max; return TRUE; } @@ -1053,8 +1105,8 @@ MONTHCAL_GetSelRange(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *range) if(infoPtr->dwStyle & MCS_MULTISELECT) { - MONTHCAL_CopyTime(&infoPtr->maxSel, &range[1]); - MONTHCAL_CopyTime(&infoPtr->minSel, &range[0]); + range[1] = infoPtr->maxSel; + range[0] = infoPtr->minSel; TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay); return TRUE; } @@ -1072,8 +1124,15 @@ MONTHCAL_SetSelRange(MONTHCAL_INFO *infoPtr, SYSTEMTIME *range) if(infoPtr->dwStyle & MCS_MULTISELECT) { - MONTHCAL_CopyTime(&range[1], &infoPtr->maxSel); - MONTHCAL_CopyTime(&range[0], &infoPtr->minSel); + /* adjust timestamps */ + if(!MONTHCAL_ValidateTime(&range[0])) + MONTHCAL_CopyTime(&infoPtr->todaysDate, &range[0]); + if(!MONTHCAL_ValidateTime(&range[1])) + MONTHCAL_CopyTime(&infoPtr->todaysDate, &range[1]); + + infoPtr->minSel = range[0]; + infoPtr->maxSel = range[1]; + TRACE("[min,max]=[%d %d]\n", infoPtr->minSel.wDay, infoPtr->maxSel.wDay); return TRUE; } @@ -1088,7 +1147,7 @@ MONTHCAL_GetToday(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *today) TRACE("%p\n", today); if(!today) return FALSE; - MONTHCAL_CopyTime(&infoPtr->todaysDate, today); + *today = infoPtr->todaysDate; return TRUE; } @@ -1102,7 +1161,7 @@ MONTHCAL_SetToday(MONTHCAL_INFO *infoPtr, SYSTEMTIME *today) if(MONTHCAL_IsDateEqual(today, &infoPtr->todaysDate)) return TRUE; - MONTHCAL_CopyTime(today, &infoPtr->todaysDate); + infoPtr->todaysDate = *today; InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return TRUE; } @@ -1115,6 +1174,7 @@ MONTHCAL_HitTest(const MONTHCAL_INFO *infoPtr, MCHITTESTINFO *lpht) DWORD retval; int day,wday,wnum; + if(!lpht || lpht->cbSize < MCHITTESTINFO_V1_SIZE) return -1; x = lpht->pt.x; y = lpht->pt.y; @@ -1160,52 +1220,52 @@ MONTHCAL_HitTest(const MONTHCAL_INFO *infoPtr, MCHITTESTINFO *lpht) day = MONTHCAL_CalcDayFromPos(infoPtr,x,y,&wday,&wnum); if(PtInRect(&infoPtr->wdays, lpht->pt)) { retval = MCHT_CALENDARDAY; - lpht->st.wYear = infoPtr->currentYear; - lpht->st.wMonth = (day < 1)? infoPtr->currentMonth -1 : infoPtr->currentMonth; + lpht->st.wYear = infoPtr->curSel.wYear; + lpht->st.wMonth = (day < 1)? infoPtr->curSel.wMonth -1 : infoPtr->curSel.wMonth; lpht->st.wDay = (day < 1)? - MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : day; + MONTHCAL_MonthLength(infoPtr->curSel.wMonth-1, infoPtr->curSel.wYear) -day : day; goto done; } if(PtInRect(&infoPtr->weeknums, lpht->pt)) { retval = MCHT_CALENDARWEEKNUM; - lpht->st.wYear = infoPtr->currentYear; - lpht->st.wMonth = (day < 1) ? infoPtr->currentMonth -1 : - (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? - infoPtr->currentMonth +1 :infoPtr->currentMonth; + lpht->st.wYear = infoPtr->curSel.wYear; + lpht->st.wMonth = (day < 1) ? infoPtr->curSel.wMonth -1 : + (day > MONTHCAL_MonthLength(infoPtr->curSel.wMonth,infoPtr->curSel.wYear)) ? + infoPtr->curSel.wMonth +1 :infoPtr->curSel.wMonth; lpht->st.wDay = (day < 1 ) ? - MONTHCAL_MonthLength(infoPtr->currentMonth-1,infoPtr->currentYear) -day : - (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) ? - day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) : day; + MONTHCAL_MonthLength(infoPtr->curSel.wMonth-1,infoPtr->curSel.wYear) -day : + (day > MONTHCAL_MonthLength(infoPtr->curSel.wMonth,infoPtr->curSel.wYear)) ? + day - MONTHCAL_MonthLength(infoPtr->curSel.wMonth,infoPtr->curSel.wYear) : day; goto done; } if(PtInRect(&infoPtr->days, lpht->pt)) - { - lpht->st.wYear = infoPtr->currentYear; + { + lpht->st.wYear = infoPtr->curSel.wYear; if ( day < 1) - { + { retval = MCHT_CALENDARDATEPREV; - lpht->st.wMonth = infoPtr->currentMonth - 1; - if (lpht->st.wMonth <1) - { + lpht->st.wMonth = infoPtr->curSel.wMonth - 1; + if (lpht->st.wMonth < 1) + { lpht->st.wMonth = 12; lpht->st.wYear--; - } - lpht->st.wDay = MONTHCAL_MonthLength(lpht->st.wMonth,lpht->st.wYear) -day; - } - else if (day > MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear)) - { + } + lpht->st.wDay = MONTHCAL_MonthLength(lpht->st.wMonth,lpht->st.wYear) + day; + } + else if (day > MONTHCAL_MonthLength(infoPtr->curSel.wMonth,infoPtr->curSel.wYear)) + { retval = MCHT_CALENDARDATENEXT; - lpht->st.wMonth = infoPtr->currentMonth + 1; - if (lpht->st.wMonth <12) - { + lpht->st.wMonth = infoPtr->curSel.wMonth + 1; + if (lpht->st.wMonth > 12) + { lpht->st.wMonth = 1; lpht->st.wYear++; - } - lpht->st.wDay = day - MONTHCAL_MonthLength(infoPtr->currentMonth,infoPtr->currentYear) ; - } + } + lpht->st.wDay = day - MONTHCAL_MonthLength(infoPtr->curSel.wMonth,infoPtr->curSel.wYear); + } else { retval = MCHT_CALENDARDATE; - lpht->st.wMonth = infoPtr->currentMonth; + lpht->st.wMonth = infoPtr->curSel.wMonth; lpht->st.wDay = day; lpht->st.wDayOfWeek = MONTHCAL_CalculateDayOfWeek(day,lpht->st.wMonth,lpht->st.wYear); } @@ -1225,20 +1285,12 @@ MONTHCAL_HitTest(const MONTHCAL_INFO *infoPtr, MCHITTESTINFO *lpht) return retval; } - -static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) +/* MCN_GETDAYSTATE notification helper */ +static void MONTHCAL_NotifyDayState(MONTHCAL_INFO *infoPtr) { - TRACE("MONTHCAL_GoToNextMonth\n"); - - infoPtr->currentMonth++; - if(infoPtr->currentMonth > 12) { - infoPtr->currentYear++; - infoPtr->currentMonth = 1; - } - if(infoPtr->dwStyle & MCS_DAYSTATE) { NMDAYSTATE nmds; - int i; + INT i; nmds.nmhdr.hwndFrom = infoPtr->hwndSelf; nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); @@ -1247,51 +1299,77 @@ static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) nmds.prgDayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); nmds.stStart = infoPtr->todaysDate; - nmds.stStart.wYear = infoPtr->currentYear; - nmds.stStart.wMonth = infoPtr->currentMonth; + nmds.stStart.wYear = infoPtr->curSel.wYear; + nmds.stStart.wMonth = infoPtr->curSel.wMonth; nmds.stStart.wDay = 1; SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmds.nmhdr.idFrom, (LPARAM)&nmds); - for(i=0; imonthRange; i++) + for(i = 0; i < infoPtr->monthRange; i++) infoPtr->monthdayState[i] = nmds.prgDayState[i]; + + Free(nmds.prgDayState); } } +static void MONTHCAL_GoToNextMonth(MONTHCAL_INFO *infoPtr) +{ + SYSTEMTIME next = infoPtr->curSel; + + TRACE("\n"); + + next.wMonth++; + if(next.wMonth > 12) { + next.wYear++; + next.wMonth = 1; + } + + /* prevent max range exceeding */ + if(infoPtr->rangeValid & GDTR_MAX) + { + FILETIME ft_next, ft_max; + + SystemTimeToFileTime(&infoPtr->maxDate, &ft_max); + SystemTimeToFileTime(&next, &ft_next); + + if (CompareFileTime(&ft_next, &ft_max) > 0) return; + } + + infoPtr->curSel = next; + + MONTHCAL_NotifyDayState(infoPtr); +} + static void MONTHCAL_GoToPrevMonth(MONTHCAL_INFO *infoPtr) { + SYSTEMTIME prev = infoPtr->curSel; + TRACE("\n"); - infoPtr->currentMonth--; - if(infoPtr->currentMonth < 1) { - infoPtr->currentYear--; - infoPtr->currentMonth = 12; + prev.wMonth--; + if(prev.wMonth < 1) { + prev.wYear--; + prev.wMonth = 12; } - if(infoPtr->dwStyle & MCS_DAYSTATE) { - NMDAYSTATE nmds; - int i; - - nmds.nmhdr.hwndFrom = infoPtr->hwndSelf; - nmds.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); - nmds.nmhdr.code = MCN_GETDAYSTATE; - nmds.cDayState = infoPtr->monthRange; - nmds.prgDayState = Alloc - (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); + /* prevent min range exceeding */ + if(infoPtr->rangeValid & GDTR_MIN) + { + FILETIME ft_prev, ft_min; - nmds.stStart = infoPtr->todaysDate; - nmds.stStart.wYear = infoPtr->currentYear; - nmds.stStart.wMonth = infoPtr->currentMonth; - nmds.stStart.wDay = 1; + SystemTimeToFileTime(&infoPtr->minDate, &ft_min); + SystemTimeToFileTime(&prev, &ft_prev); - SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmds.nmhdr.idFrom, (LPARAM)&nmds); - for(i=0; imonthRange; i++) - infoPtr->monthdayState[i] = nmds.prgDayState[i]; + if (CompareFileTime(&ft_prev, &ft_min) < 0) return; } + + infoPtr->curSel = prev; + + MONTHCAL_NotifyDayState(infoPtr); } static LRESULT -MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) +MONTHCAL_RButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam) { static const WCHAR todayW[] = { 'G','o',' ','t','o',' ','T','o','d','a','y',':',0 }; HMENU hMenu; @@ -1299,182 +1377,154 @@ MONTHCAL_RButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) WCHAR buf[32]; hMenu = CreatePopupMenu(); - if (!LoadStringW(COMCTL32_hModule,IDM_GOTODAY,buf,countof(buf))) - { + if (!LoadStringW(COMCTL32_hModule, IDM_GOTODAY, buf, countof(buf))) + { WARN("Can't load resource\n"); strcpyW(buf, todayW); - } - AppendMenuW(hMenu, MF_STRING|MF_ENABLED,1, buf); - menupoint.x=(short)LOWORD(lParam); - menupoint.y=(short)HIWORD(lParam); + } + AppendMenuW(hMenu, MF_STRING|MF_ENABLED, 1, buf); + menupoint.x = (short)LOWORD(lParam); + menupoint.y = (short)HIWORD(lParam); ClientToScreen(infoPtr->hwndSelf, &menupoint); - if( TrackPopupMenu(hMenu,TPM_RIGHTBUTTON| TPM_NONOTIFY|TPM_RETURNCMD, + if( TrackPopupMenu(hMenu, TPM_RIGHTBUTTON | TPM_NONOTIFY | TPM_RETURNCMD, menupoint.x, menupoint.y, 0, infoPtr->hwndSelf, NULL)) - { - infoPtr->currentMonth=infoPtr->todaysDate.wMonth; - infoPtr->currentYear=infoPtr->todaysDate.wYear; + { + infoPtr->curSel = infoPtr->todaysDate; + infoPtr->minSel = infoPtr->todaysDate; + infoPtr->maxSel = infoPtr->todaysDate; InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); - } + } + return 0; } +/* creates updown control and edit box */ +static void MONTHCAL_EditYear(MONTHCAL_INFO *infoPtr) +{ + static const WCHAR EditW[] = { 'E','D','I','T',0 }; + + infoPtr->hWndYearEdit = + CreateWindowExW(0, EditW, 0, WS_VISIBLE | WS_CHILD | ES_READONLY, + infoPtr->titleyear.left + 3, infoPtr->titlebtnnext.top, + infoPtr->titleyear.right - infoPtr->titleyear.left + 4, + infoPtr->textHeight, infoPtr->hwndSelf, + NULL, NULL, NULL); + + SendMessageW(infoPtr->hWndYearEdit, WM_SETFONT, (WPARAM)infoPtr->hBoldFont, TRUE); + + infoPtr->hWndYearUpDown = + CreateWindowExW(0, UPDOWN_CLASSW, 0, + WS_VISIBLE | WS_CHILD | UDS_SETBUDDYINT | UDS_NOTHOUSANDS | UDS_ARROWKEYS, + infoPtr->titleyear.right + 7, infoPtr->titlebtnnext.top, + 18, infoPtr->textHeight, infoPtr->hwndSelf, + NULL, NULL, NULL); + + /* attach edit box */ + SendMessageW(infoPtr->hWndYearUpDown, UDM_SETRANGE, 0, MAKELONG(9999, 1753)); + SendMessageW(infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM)infoPtr->hWndYearEdit, 0); + SendMessageW(infoPtr->hWndYearUpDown, UDM_SETPOS, 0, infoPtr->curSel.wYear); +} + static LRESULT MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) { - static const WCHAR EditW[] = { 'E','D','I','T',0 }; MCHITTESTINFO ht; DWORD hit; - HMENU hMenu; - RECT rcDay; /* used in determining area to invalidate */ - WCHAR buf[32]; - int i; - POINT menupoint; - - TRACE("%lx\n", lParam); if (infoPtr->hWndYearUpDown) - { - infoPtr->currentYear=SendMessageW(infoPtr->hWndYearUpDown, UDM_SETPOS, 0, 0); + { + infoPtr->curSel.wYear = SendMessageW(infoPtr->hWndYearUpDown, UDM_SETPOS, 0, 0); if(!DestroyWindow(infoPtr->hWndYearUpDown)) - { - FIXME("Can't destroy Updown Control\n"); - } + { + FIXME("Can't destroy Updown Control\n"); + } else - infoPtr->hWndYearUpDown=0; + infoPtr->hWndYearUpDown = 0; + if(!DestroyWindow(infoPtr->hWndYearEdit)) - { - FIXME("Can't destroy Updown Control\n"); - } + { + FIXME("Can't destroy Updown Control\n"); + } else - infoPtr->hWndYearEdit=0; + infoPtr->hWndYearEdit = 0; + InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); - } + } + ht.cbSize = sizeof(MCHITTESTINFO); ht.pt.x = (short)LOWORD(lParam); ht.pt.y = (short)HIWORD(lParam); + TRACE("(%d, %d)\n", ht.pt.x, ht.pt.y); + hit = MONTHCAL_HitTest(infoPtr, &ht); - /* FIXME: these flags should be checked by */ - /*((hit & MCHT_XXX) == MCHT_XXX) b/c some of the flags are */ - /* multi-bit */ - if(hit ==MCHT_TITLEBTNNEXT) { + switch(hit) + { + case MCHT_TITLEBTNNEXT: MONTHCAL_GoToNextMonth(infoPtr); infoPtr->status = MC_NEXTPRESSED; SetTimer(infoPtr->hwndSelf, MC_NEXTMONTHTIMER, MC_NEXTMONTHDELAY, 0); InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return 0; - } - if(hit == MCHT_TITLEBTNPREV){ + + case MCHT_TITLEBTNPREV: MONTHCAL_GoToPrevMonth(infoPtr); infoPtr->status = MC_PREVPRESSED; SetTimer(infoPtr->hwndSelf, MC_PREVMONTHTIMER, MC_NEXTMONTHDELAY, 0); InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return 0; - } - if(hit == MCHT_TITLEMONTH) { - hMenu = CreatePopupMenu(); + case MCHT_TITLEMONTH: + { + HMENU hMenu = CreatePopupMenu(); + WCHAR buf[32]; + POINT menupoint; + INT i; - for (i=0; i<12;i++) - { - GetLocaleInfoW(LOCALE_USER_DEFAULT,LOCALE_SMONTHNAME1+i, buf,countof(buf)); - AppendMenuW(hMenu, MF_STRING|MF_ENABLED,i+1, buf); - } - menupoint.x=infoPtr->titlemonth.right; - menupoint.y=infoPtr->titlemonth.bottom; + for (i = 0; i < 12; i++) + { + GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SMONTHNAME1+i, buf, countof(buf)); + AppendMenuW(hMenu, MF_STRING|MF_ENABLED, i + 1, buf); + } + menupoint.x = ht.pt.x; + menupoint.y = ht.pt.y; ClientToScreen(infoPtr->hwndSelf, &menupoint); - i= TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD, - menupoint.x, menupoint.y, 0, infoPtr->hwndSelf, NULL); - if ((i>0) && (i<13)) - { - infoPtr->currentMonth=i; + i = TrackPopupMenu(hMenu,TPM_LEFTALIGN | TPM_NONOTIFY | TPM_RIGHTBUTTON | TPM_RETURNCMD, + menupoint.x, menupoint.y, 0, infoPtr->hwndSelf, NULL); + + if ((i > 0) && (i < 13) && infoPtr->curSel.wMonth != i) + { + infoPtr->curSel.wMonth = i; InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); - } + } + return 0; } - if(hit == MCHT_TITLEYEAR) { - infoPtr->hWndYearEdit=CreateWindowExW(0, - EditW, - 0, - WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT, - infoPtr->titleyear.left+3,infoPtr->titlebtnnext.top, - infoPtr->titleyear.right-infoPtr->titleyear.left+4, - infoPtr->textHeight, - infoPtr->hwndSelf, - NULL, - NULL, - NULL); - SendMessageW( infoPtr->hWndYearEdit, WM_SETFONT, (WPARAM) infoPtr->hBoldFont, (LPARAM)TRUE); - infoPtr->hWndYearUpDown=CreateWindowExW(0, - UPDOWN_CLASSW, - 0, - WS_VISIBLE | WS_CHILD |UDS_SETBUDDYINT|UDS_NOTHOUSANDS|UDS_ARROWKEYS, - infoPtr->titleyear.right+7,infoPtr->titlebtnnext.top, - 18, - infoPtr->textHeight, - infoPtr->hwndSelf, - NULL, - NULL, - NULL); - SendMessageW(infoPtr->hWndYearUpDown, UDM_SETRANGE, 0, MAKELONG (9999, 1753)); - SendMessageW(infoPtr->hWndYearUpDown, UDM_SETBUDDY, (WPARAM) infoPtr->hWndYearEdit, 0); - SendMessageW(infoPtr->hWndYearUpDown, UDM_SETPOS, 0, infoPtr->currentYear); + case MCHT_TITLEYEAR: + { + MONTHCAL_EditYear(infoPtr); return 0; - } - if(hit == MCHT_TODAYLINK) { - NMSELCHANGE nmsc; - - infoPtr->curSelDay = infoPtr->todaysDate.wDay; - infoPtr->firstSelDay = infoPtr->todaysDate.wDay; - infoPtr->currentMonth=infoPtr->todaysDate.wMonth; - infoPtr->currentYear=infoPtr->todaysDate.wYear; - MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->minSel); - MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->maxSel); + case MCHT_TODAYLINK: + { + infoPtr->firstSelDay = infoPtr->todaysDate.wDay; + infoPtr->curSel = infoPtr->todaysDate; + infoPtr->minSel = infoPtr->todaysDate; + infoPtr->maxSel = infoPtr->todaysDate; InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); - nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf; - nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); - nmsc.nmhdr.code = MCN_SELCHANGE; - MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart); - MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd); - SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc); - - nmsc.nmhdr.code = MCN_SELECT; - SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc); + MONTHCAL_NotifySelectionChange(infoPtr); + MONTHCAL_NotifySelect(infoPtr); return 0; } - if(hit == MCHT_CALENDARDATE) { - SYSTEMTIME selArray[2]; - NMSELCHANGE nmsc; - - MONTHCAL_CopyTime(&ht.st, &selArray[0]); - MONTHCAL_CopyTime(&ht.st, &selArray[1]); - MONTHCAL_SetSelRange(infoPtr, selArray); - MONTHCAL_SetCurSel(infoPtr, &selArray[0]); + case MCHT_CALENDARDATE: + { TRACE("MCHT_CALENDARDATE\n"); - nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf; - nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); - nmsc.nmhdr.code = MCN_SELCHANGE; - MONTHCAL_CopyTime(&infoPtr->minSel,&nmsc.stSelStart); - MONTHCAL_CopyTime(&infoPtr->maxSel,&nmsc.stSelEnd); - - SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc); - - - /* redraw both old and new days if the selected day changed */ - if(infoPtr->curSelDay != ht.st.wDay) { - MONTHCAL_CalcPosFromDay(infoPtr, ht.st.wDay, ht.st.wMonth, &rcDay); - InvalidateRect(infoPtr->hwndSelf, &rcDay, TRUE); - - MONTHCAL_CalcPosFromDay(infoPtr, infoPtr->curSelDay, infoPtr->currentMonth, &rcDay); - InvalidateRect(infoPtr->hwndSelf, &rcDay, TRUE); - } infoPtr->firstSelDay = ht.st.wDay; - infoPtr->curSelDay = ht.st.wDay; infoPtr->status = MC_SEL_LBUTDOWN; return 0; } + } return 1; } @@ -1483,7 +1533,6 @@ MONTHCAL_LButtonDown(MONTHCAL_INFO *infoPtr, LPARAM lParam) static LRESULT MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam) { - NMSELCHANGE nmsc; NMHDR nmhdr; BOOL redraw = FALSE; MCHITTESTINFO ht; @@ -1502,42 +1551,45 @@ MONTHCAL_LButtonUp(MONTHCAL_INFO *infoPtr, LPARAM lParam) redraw = TRUE; } + /* always send NM_RELEASEDCAPTURE notification */ + nmhdr.hwndFrom = infoPtr->hwndSelf; + nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); + nmhdr.code = NM_RELEASEDCAPTURE; + TRACE("Sent notification from %p to %p\n", infoPtr->hwndSelf, infoPtr->hwndNotify); + + SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr); + + ht.cbSize = sizeof(MCHITTESTINFO); ht.pt.x = (short)LOWORD(lParam); ht.pt.y = (short)HIWORD(lParam); hit = MONTHCAL_HitTest(infoPtr, &ht); infoPtr->status = MC_SEL_LBUTUP; - if(hit ==MCHT_CALENDARDATENEXT) { - MONTHCAL_GoToNextMonth(infoPtr); - InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); - return TRUE; - } - if(hit == MCHT_CALENDARDATEPREV){ - MONTHCAL_GoToPrevMonth(infoPtr); - InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); - return TRUE; + if((hit == MCHT_CALENDARDATENEXT) || + (hit == MCHT_CALENDARDATEPREV) || + (hit == MCHT_CALENDARDATE)) + { + SYSTEMTIME st[2], sel = infoPtr->curSel; + + st[0] = st[1] = ht.st; + MONTHCAL_SetSelRange(infoPtr, st); + /* will be invalidated here */ + MONTHCAL_SetCurSel(infoPtr, &st[0]); + + /* send MCN_SELCHANGE only if new date selected */ + if (!MONTHCAL_IsDateEqual(&sel, &ht.st)) + MONTHCAL_NotifySelectionChange(infoPtr); + + MONTHCAL_NotifySelect(infoPtr); + + return 0; } - nmhdr.hwndFrom = infoPtr->hwndSelf; - nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); - nmhdr.code = NM_RELEASEDCAPTURE; - TRACE("Sent notification from %p to %p\n", infoPtr->hwndSelf, infoPtr->hwndNotify); - SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmhdr.idFrom, (LPARAM)&nmhdr); /* redraw if necessary */ if(redraw) InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); - /* only send MCN_SELECT if currently displayed month's day was selected */ - if(hit == MCHT_CALENDARDATE) { - nmsc.nmhdr.hwndFrom = infoPtr->hwndSelf; - nmsc.nmhdr.idFrom = GetWindowLongPtrW(infoPtr->hwndSelf, GWLP_ID); - nmsc.nmhdr.code = MCN_SELECT; - MONTHCAL_CopyTime(&infoPtr->minSel, &nmsc.stSelStart); - MONTHCAL_CopyTime(&infoPtr->maxSel, &nmsc.stSelEnd); - - SendMessageW(infoPtr->hwndNotify, WM_NOTIFY, nmsc.nmhdr.idFrom, (LPARAM)&nmsc); - } return 0; } @@ -1580,6 +1632,7 @@ MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, LPARAM lParam) if(!(infoPtr->status & MC_SEL_LBUTDOWN)) return 0; + ht.cbSize = sizeof(MCHITTESTINFO); ht.pt.x = (short)LOWORD(lParam); ht.pt.y = (short)HIWORD(lParam); @@ -1590,8 +1643,8 @@ MONTHCAL_MouseMove(MONTHCAL_INFO *infoPtr, LPARAM lParam) if((hit & MCHT_CALENDARDATE) != MCHT_CALENDARDATE) return 0; selday = ht.st.wDay; - oldselday = infoPtr->curSelDay; - infoPtr->curSelDay = selday; + oldselday = infoPtr->curSel.wDay; + infoPtr->curSel.wDay = selday; MONTHCAL_CalcPosFromDay(infoPtr, selday, ht.st. wMonth, &r); if(infoPtr->dwStyle & MCS_MULTISELECT) { @@ -1637,7 +1690,7 @@ done: /* only redraw if the currently selected day changed */ /* FIXME: this should specify a rectangle containing only the days that changed */ /* using InvalidateRect */ - if(oldselday != infoPtr->curSelDay) + if(oldselday != infoPtr->curSel.wDay) InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return 0; @@ -1691,7 +1744,6 @@ MONTHCAL_SetFocus(const MONTHCAL_INFO *infoPtr) /* sets the size information */ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) { - static const WCHAR SunW[] = { 'S','u','n',0 }; static const WCHAR O0W[] = { '0','0',0 }; HDC hdc = GetDC(infoPtr->hwndSelf); RECT *title=&infoPtr->title; @@ -1703,11 +1755,12 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) RECT *weeknumrect=&infoPtr->weeknums; RECT *days=&infoPtr->days; RECT *todayrect=&infoPtr->todayrect; - SIZE size; + SIZE size, sz; TEXTMETRICW tm; HFONT currentFont; - int xdiv, left_offset; + INT xdiv, dx, dy, i; RECT rcClient; + WCHAR buff[80]; GetClientRect(infoPtr->hwndSelf, &rcClient); @@ -1716,7 +1769,26 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) /* get the height and width of each day's text */ GetTextMetricsW(hdc, &tm); infoPtr->textHeight = tm.tmHeight + tm.tmExternalLeading + tm.tmInternalLeading; - GetTextExtentPoint32W(hdc, SunW, 3, &size); + + /* find largest abbreviated day name for current locale */ + size.cx = sz.cx = 0; + for (i = 0; i < 7; i++) + { + if(GetLocaleInfoW(LOCALE_USER_DEFAULT, LOCALE_SABBREVDAYNAME1, + buff, countof(buff))) + { + GetTextExtentPoint32W(hdc, buff, lstrlenW(buff), &sz); + if (sz.cx > size.cx) size.cx = sz.cx; + } + else /* locale independent fallback on failure */ + { + static const WCHAR SunW[] = { 'S','u','n',0 }; + + GetTextExtentPoint32W(hdc, SunW, lstrlenW(SunW), &size); + break; + } + } + infoPtr->textWidth = size.cx + 2; /* recalculate the height and width increments and offsets */ @@ -1724,22 +1796,21 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) xdiv = (infoPtr->dwStyle & MCS_WEEKNUMBERS) ? 8 : 7; - infoPtr->width_increment = size.cx * 2 + 4; + infoPtr->width_increment = size.cx * 2 + 4; infoPtr->height_increment = infoPtr->textHeight; - left_offset = (rcClient.right - rcClient.left) - (infoPtr->width_increment * xdiv); /* calculate title area */ - title->top = rcClient.top; - title->bottom = title->top + 3 * infoPtr->height_increment / 2; - title->left = left_offset; - title->right = rcClient.right; + title->top = 0; + title->bottom = 3 * infoPtr->height_increment / 2; + title->left = 0; + title->right = infoPtr->width_increment * xdiv; /* set the dimensions of the next and previous buttons and center */ /* the month text vertically */ prev->top = next->top = title->top + 4; prev->bottom = next->bottom = title->bottom - 4; prev->left = title->left + 4; - prev->right = prev->left + (title->bottom - title->top) ; + prev->right = prev->left + (title->bottom - title->top); next->right = title->right - 4; next->left = next->right - (title->bottom - title->top); @@ -1751,24 +1822,47 @@ static void MONTHCAL_UpdateSize(MONTHCAL_INFO *infoPtr) /* setup the dimensions of the rectangle we draw the names of the */ /* days of the week in */ - weeknumrect->left = left_offset; + weeknumrect->left = 0; + if(infoPtr->dwStyle & MCS_WEEKNUMBERS) - weeknumrect->right=prev->right; + weeknumrect->right = prev->right; else - weeknumrect->right=weeknumrect->left; + weeknumrect->right = weeknumrect->left; + wdays->left = days->left = weeknumrect->right; wdays->right = days->right = wdays->left + 7 * infoPtr->width_increment; - wdays->top = title->bottom ; + wdays->top = title->bottom; wdays->bottom = wdays->top + infoPtr->height_increment; - days->top = weeknumrect->top = wdays->bottom ; + days->top = weeknumrect->top = wdays->bottom; days->bottom = weeknumrect->bottom = days->top + 6 * infoPtr->height_increment; - todayrect->left = rcClient.left; - todayrect->right = rcClient.right; + todayrect->left = 0; + todayrect->right = title->right; todayrect->top = days->bottom; todayrect->bottom = days->bottom + infoPtr->height_increment; + /* offset all rectangles to center in client area */ + dx = (rcClient.right - title->right) / 2; + dy = (rcClient.bottom - todayrect->bottom) / 2; + + /* if calendar doesn't fit client area show it at left/top bounds */ + if (title->left + dx < 0) dx = 0; + if (title->top + dy < 0) dy = 0; + + if (dx != 0 || dy != 0) + { + OffsetRect(title, dx, dy); + OffsetRect(prev, dx, dy); + OffsetRect(next, dx, dy); + OffsetRect(titlemonth, dx, dy); + OffsetRect(titleyear, dx, dy); + OffsetRect(wdays, dx, dy); + OffsetRect(weeknumrect, dx, dy); + OffsetRect(days, dx, dy); + OffsetRect(todayrect, dx, dy); + } + TRACE("dx=%d dy=%d client[%s] title[%s] wdays[%s] days[%s] today[%s]\n", infoPtr->width_increment,infoPtr->height_increment, wine_dbgstr_rect(&rcClient), @@ -1844,6 +1938,24 @@ static INT MONTHCAL_StyleChanged(MONTHCAL_INFO *infoPtr, WPARAM wStyleType, return 0; } +static INT MONTHCAL_StyleChanging(MONTHCAL_INFO *infoPtr, WPARAM wStyleType, + STYLESTRUCT *lpss) +{ + TRACE("(styletype=%lx, styleOld=0x%08x, styleNew=0x%08x)\n", + wStyleType, lpss->styleOld, lpss->styleNew); + + /* block MCS_MULTISELECT change */ + if ((lpss->styleNew ^ lpss->styleOld) & MCS_MULTISELECT) + { + if (lpss->styleOld & MCS_MULTISELECT) + lpss->styleNew |= MCS_MULTISELECT; + else + lpss->styleNew &= ~MCS_MULTISELECT; + } + + return 0; +} + /* FIXME: check whether dateMin/dateMax need to be adjusted. */ static LRESULT MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) @@ -1871,26 +1983,20 @@ MONTHCAL_Create(HWND hwnd, LPCREATESTRUCTW lpcs) GetLocalTime(&infoPtr->todaysDate); infoPtr->firstDayHighWord = FALSE; MONTHCAL_SetFirstDayOfWeek(infoPtr, -1); - infoPtr->currentMonth = infoPtr->todaysDate.wMonth; - infoPtr->currentYear = infoPtr->todaysDate.wYear; - MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->minDate); - MONTHCAL_CopyTime(&infoPtr->todaysDate, &infoPtr->maxDate); - infoPtr->maxDate.wYear=2050; - infoPtr->minDate.wYear=1950; - infoPtr->maxSelCount = 7; - infoPtr->monthRange = 3; - infoPtr->monthdayState = Alloc - (infoPtr->monthRange * sizeof(MONTHDAYSTATE)); - infoPtr->titlebk = comctl32_color.clrActiveCaption; - infoPtr->titletxt = comctl32_color.clrWindow; - infoPtr->monthbk = comctl32_color.clrWindow; - infoPtr->trailingtxt = comctl32_color.clrGrayText; - infoPtr->bk = comctl32_color.clrWindow; - infoPtr->txt = comctl32_color.clrWindowText; - - /* set the current day for highlighing */ - infoPtr->minSel.wDay = infoPtr->todaysDate.wDay; - infoPtr->maxSel.wDay = infoPtr->todaysDate.wDay; + + infoPtr->maxSelCount = (infoPtr->dwStyle & MCS_MULTISELECT) ? 7 : 1; + infoPtr->monthRange = 3; + infoPtr->monthdayState = Alloc(infoPtr->monthRange * sizeof(MONTHDAYSTATE)); + infoPtr->titlebk = comctl32_color.clrActiveCaption; + infoPtr->titletxt = comctl32_color.clrWindow; + infoPtr->monthbk = comctl32_color.clrWindow; + infoPtr->trailingtxt = comctl32_color.clrGrayText; + infoPtr->bk = comctl32_color.clrWindow; + infoPtr->txt = comctl32_color.clrWindowText; + + infoPtr->minSel = infoPtr->todaysDate; + infoPtr->maxSel = infoPtr->todaysDate; + infoPtr->curSel = infoPtr->todaysDate; /* call MONTHCAL_UpdateSize to set all of the dimensions */ /* of the control */ @@ -1997,8 +2103,8 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_KILLFOCUS: return MONTHCAL_KillFocus(infoPtr, (HWND)wParam); - case WM_RBUTTONDOWN: - return MONTHCAL_RButtonDown(infoPtr, lParam); + case WM_RBUTTONUP: + return MONTHCAL_RButtonUp(infoPtr, lParam); case WM_LBUTTONDOWN: return MONTHCAL_LButtonDown(infoPtr, lParam); @@ -2044,6 +2150,9 @@ MONTHCAL_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) case WM_STYLECHANGED: return MONTHCAL_StyleChanged(infoPtr, wParam, (LPSTYLESTRUCT)lParam); + case WM_STYLECHANGING: + return MONTHCAL_StyleChanging(infoPtr, wParam, (LPSTYLESTRUCT)lParam); + default: if ((uMsg >= WM_USER) && (uMsg < WM_APP) && !COMCTL32_IsReflectedMessage(uMsg)) ERR( "unknown msg %04x wp=%08lx lp=%08lx\n", uMsg, wParam, lParam); diff --git a/dlls/comctl32/tests/datetime.c b/dlls/comctl32/tests/datetime.c index 038a7898118..c449e45acf2 100644 --- a/dlls/comctl32/tests/datetime.c +++ b/dlls/comctl32/tests/datetime.c @@ -33,102 +33,91 @@ static struct msg_sequence *sequences[NUM_MSG_SEQUENCES]; static const struct message test_dtm_set_format_seq[] = { - { DTM_SETFORMATA, sent|wparam|lparam, 0x00000000, 0x00000000 }, - { DTM_SETFORMATA, sent|wparam, 0x00000000 }, + { DTM_SETFORMATA, sent|wparam|lparam, 0, 0 }, + { DTM_SETFORMATA, sent|wparam, 0 }, { 0 } }; static const struct message test_dtm_set_and_get_mccolor_seq[] = { - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000000, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000000, 0x00ffffff }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000000, 0x00dcb464 }, - { DTM_GETMCCOLOR, sent|wparam|lparam, 0x00000000, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000004, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000004, 0x00ffffff }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000004, 0x00dcb464 }, - { DTM_GETMCCOLOR, sent|wparam|lparam, 0x00000004, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000001, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000001, 0x00ffffff }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000001, 0x00dcb464 }, - { DTM_GETMCCOLOR, sent|wparam|lparam, 0x00000001, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000002, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000002, 0x00ffffff }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000002, 0x00dcb464 }, - { DTM_GETMCCOLOR, sent|wparam|lparam, 0x00000002, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000003, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000003, 0x00ffffff }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000003, 0x00dcb464 }, - { DTM_GETMCCOLOR, sent|wparam|lparam, 0x00000003, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000005, 0x00000000 }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000005, 0x00ffffff }, - { DTM_SETMCCOLOR, sent|wparam|lparam, 0x00000005, 0x00dcb464 }, - { DTM_GETMCCOLOR, sent|wparam|lparam, 0x00000005, 0x00000000 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_BACKGROUND, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_BACKGROUND, RGB(255, 255, 255) }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_BACKGROUND, RGB(100, 180, 220) }, + { DTM_GETMCCOLOR, sent|wparam|lparam, MCSC_BACKGROUND, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_MONTHBK, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_MONTHBK, RGB(255, 255, 255) }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_MONTHBK, RGB(100, 180, 220) }, + { DTM_GETMCCOLOR, sent|wparam|lparam, MCSC_MONTHBK, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TEXT, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TEXT, RGB(255, 255, 255) }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TEXT, RGB(100, 180, 220) }, + { DTM_GETMCCOLOR, sent|wparam|lparam, MCSC_TEXT, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TITLEBK, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TITLEBK, RGB(255, 255, 255) }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TITLEBK, RGB(100, 180, 220) }, + { DTM_GETMCCOLOR, sent|wparam|lparam, MCSC_TITLEBK, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TITLETEXT, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TITLETEXT, RGB(255, 255, 255) }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TITLETEXT, RGB(100, 180, 220) }, + { DTM_GETMCCOLOR, sent|wparam|lparam, MCSC_TITLETEXT, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TRAILINGTEXT, 0 }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TRAILINGTEXT, RGB(255, 255, 255) }, + { DTM_SETMCCOLOR, sent|wparam|lparam, MCSC_TRAILINGTEXT, RGB(100, 180, 220) }, + { DTM_GETMCCOLOR, sent|wparam|lparam, MCSC_TRAILINGTEXT, 0 }, { 0 } }; static const struct message test_dtm_set_and_get_mcfont_seq[] = { - { DTM_SETMCFONT, sent|lparam, 0, 0x00000001 }, - { DTM_GETMCFONT, sent|wparam|lparam, 0x00000000, 0x00000000 }, + { DTM_SETMCFONT, sent|lparam, 0, 1 }, + { DTM_GETMCFONT, sent|wparam|lparam, 0, 0 }, { 0 } }; static const struct message test_dtm_get_monthcal_seq[] = { - { DTM_GETMONTHCAL, sent|wparam|lparam, 0x00000000, 0x00000000 }, + { DTM_GETMONTHCAL, sent|wparam|lparam, 0, 0 }, { 0 } }; static const struct message test_dtm_set_and_get_range_seq[] = { - { DTM_SETRANGE, sent|wparam, 0x00000001 }, - { DTM_GETRANGE, sent|wparam, 0x00000000 }, - { DTM_SETRANGE, sent|wparam, 0x00000002 }, - { DTM_SETRANGE, sent|wparam, 0x00000002 }, - { DTM_GETRANGE, sent|wparam, 0x00000000}, - { DTM_SETRANGE, sent|wparam, 0x00000001 }, - { DTM_SETRANGE, sent|wparam, 0x00000003 }, - { DTM_SETRANGE, sent|wparam, 0x00000003 }, - { DTM_GETRANGE, sent|wparam, 0x00000000 }, - { DTM_SETRANGE, sent|wparam, 0x00000003 }, - { DTM_GETRANGE, sent|wparam, 0x00000000 }, - { DTM_SETRANGE, sent|wparam, 0x00000003 }, - { DTM_GETRANGE, sent|wparam, 0x00000000 }, + { DTM_SETRANGE, sent|wparam, GDTR_MIN }, + { DTM_GETRANGE, sent|wparam, 0 }, + { DTM_SETRANGE, sent|wparam, GDTR_MAX }, + { DTM_SETRANGE, sent|wparam, GDTR_MAX }, + { DTM_GETRANGE, sent|wparam, 0 }, + { DTM_SETRANGE, sent|wparam, GDTR_MIN }, + { DTM_SETRANGE, sent|wparam, GDTR_MIN | GDTR_MAX }, + { DTM_SETRANGE, sent|wparam, GDTR_MIN | GDTR_MAX }, + { DTM_GETRANGE, sent|wparam, 0 }, + { DTM_SETRANGE, sent|wparam, GDTR_MIN | GDTR_MAX }, + { DTM_GETRANGE, sent|wparam, 0 }, + { DTM_SETRANGE, sent|wparam, GDTR_MIN | GDTR_MAX }, + { DTM_GETRANGE, sent|wparam, 0 }, { 0 } }; static const struct message test_dtm_set_range_swap_min_max_seq[] = { - { DTM_SETSYSTEMTIME, sent|wparam, 0x00000000 }, - { DTM_GETSYSTEMTIME, sent|wparam, 0x00000000 }, - { DTM_SETRANGE, sent|wparam, 0x00000003 }, - { DTM_GETRANGE, sent|wparam, 0x00000000 }, - { DTM_SETSYSTEMTIME, sent|wparam, 0x00000000 }, - { DTM_GETSYSTEMTIME, sent|wparam, 0x00000000 }, - { DTM_SETRANGE, sent|wparam, 0x00000003 }, - { DTM_GETRANGE, sent|wparam, 0x00000000 }, - { DTM_SETRANGE, sent|wparam, 0x00000003 }, - { DTM_GETRANGE, sent|wparam, 0x00000000 }, - { DTM_SETRANGE, sent|wparam, 0x00000003 }, - { DTM_GETRANGE, sent|wparam, 0x00000000 }, + { DTM_SETSYSTEMTIME, sent|wparam, 0 }, + { DTM_GETSYSTEMTIME, sent|wparam, 0 }, + { DTM_SETRANGE, sent|wparam, GDTR_MIN | GDTR_MAX }, + { DTM_GETRANGE, sent|wparam, 0 }, + { DTM_SETSYSTEMTIME, sent|wparam, 0 }, + { DTM_GETSYSTEMTIME, sent|wparam, 0 }, + { DTM_SETRANGE, sent|wparam, GDTR_MIN | GDTR_MAX }, + { DTM_GETRANGE, sent|wparam, 0 }, + { DTM_SETRANGE, sent|wparam, GDTR_MIN | GDTR_MAX }, + { DTM_GETRANGE, sent|wparam, 0 }, + { DTM_SETRANGE, sent|wparam, GDTR_MIN | GDTR_MAX }, + { DTM_GETRANGE, sent|wparam, 0 }, { 0 } }; static const struct message test_dtm_set_and_get_system_time_seq[] = { - { DTM_SETSYSTEMTIME, sent|wparam, 0x00000001 }, - { 0x0090, sent|optional }, /* Vista */ - { WM_DESTROY, sent|wparam|lparam, 0x00000000, 0x00000000 }, - { WM_NCDESTROY, sent|wparam|lparam, 0x00000000, 0x00000000 }, - { DTM_SETSYSTEMTIME, sent|wparam, 0x00000001 }, - { DTM_GETSYSTEMTIME, sent|wparam, 0x00000000 }, - { DTM_SETSYSTEMTIME, sent|wparam, 0x00000000 }, - { DTM_SETSYSTEMTIME, sent|wparam, 0x00000000 }, - { DTM_SETSYSTEMTIME, sent|wparam, 0x00000000 }, - { DTM_GETSYSTEMTIME, sent|wparam, 0x00000000 }, - { DTM_SETSYSTEMTIME, sent|wparam, 0x00000000 }, - { 0 } -}; - -static const struct message destroy_window_seq[] = { - { 0x0090, sent|optional }, /* Vista */ - { WM_DESTROY, sent|wparam|lparam, 0x00000000, 0x00000000 }, - { WM_NCDESTROY, sent|wparam|lparam, 0x00000000, 0x00000000 }, + { DTM_SETSYSTEMTIME, sent|wparam, GDT_NONE }, + { DTM_GETSYSTEMTIME, sent|wparam, 0 }, + { DTM_SETSYSTEMTIME, sent|wparam, 0 }, + { DTM_SETSYSTEMTIME, sent|wparam, 0 }, + { DTM_SETSYSTEMTIME, sent|wparam, 0 }, + { DTM_GETSYSTEMTIME, sent|wparam, 0 }, + { DTM_SETSYSTEMTIME, sent|wparam, 0 }, { 0 } }; @@ -191,32 +180,38 @@ static HWND create_datetime_control(DWORD style, DWORD exstyle) return hWndDateTime; } -static void test_dtm_set_format(HWND hWndDateTime) +static void test_dtm_set_format(void) { + HWND hWnd; CHAR txt[256]; SYSTEMTIME systime; LRESULT r; - r = SendMessage(hWndDateTime, DTM_SETFORMAT, 0, 0); + hWnd = create_datetime_control(DTS_SHOWNONE, 0); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + r = SendMessage(hWnd, DTM_SETFORMAT, 0, 0); expect(1, r); - r = SendMessage(hWndDateTime, DTM_SETFORMAT, 0, + r = SendMessage(hWnd, DTM_SETFORMAT, 0, (LPARAM)"'Today is: 'hh':'m':'s dddd MMM dd', 'yyyy"); expect(1, r); ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_format_seq, "test_dtm_set_format", FALSE); - r = SendMessage(hWndDateTime, DTM_SETFORMAT, 0, + r = SendMessage(hWnd, DTM_SETFORMAT, 0, (LPARAM)"'hh' hh"); expect(1, r); ZeroMemory(&systime, sizeof(systime)); systime.wYear = 2000; systime.wMonth = systime.wDay = 1; - r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, 0, (LPARAM)&systime); + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, 0, (LPARAM)&systime); expect(1, r); - GetWindowText(hWndDateTime, txt, 256); + GetWindowText(hWnd, txt, 256); todo_wine ok(strcmp(txt, "hh 12") == 0, "String mismatch (\"%s\" vs \"hh 12\")\n", txt); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + + DestroyWindow(hWnd); } static void test_mccolor_types(HWND hWndDateTime, int mccolor_type, const char* mccolor_name) @@ -239,43 +234,60 @@ static void test_mccolor_types(HWND hWndDateTime, int mccolor_type, const char* ok(r==theColor, "%s: GETMCCOLOR: Expected %d, got %ld\n", mccolor_name, theColor, r); } -static void test_dtm_set_and_get_mccolor(HWND hWndDateTime) +static void test_dtm_set_and_get_mccolor(void) { - test_mccolor_types(hWndDateTime, MCSC_BACKGROUND, "MCSC_BACKGROUND"); - test_mccolor_types(hWndDateTime, MCSC_MONTHBK, "MCSC_MONTHBK"); - test_mccolor_types(hWndDateTime, MCSC_TEXT, "MCSC_TEXT"); - test_mccolor_types(hWndDateTime, MCSC_TITLEBK, "MCSC_TITLEBK"); - test_mccolor_types(hWndDateTime, MCSC_TITLETEXT, "MCSC_TITLETEXT"); - test_mccolor_types(hWndDateTime, MCSC_TRAILINGTEXT, "MCSC_TRAILINGTEXT"); + HWND hWnd; + + hWnd = create_datetime_control(DTS_SHOWNONE, 0); - ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_mccolor_seq, "test_dtm_set_and_get_mccolor", FALSE); flush_sequences(sequences, NUM_MSG_SEQUENCES); + + test_mccolor_types(hWnd, MCSC_BACKGROUND, "MCSC_BACKGROUND"); + test_mccolor_types(hWnd, MCSC_MONTHBK, "MCSC_MONTHBK"); + test_mccolor_types(hWnd, MCSC_TEXT, "MCSC_TEXT"); + test_mccolor_types(hWnd, MCSC_TITLEBK, "MCSC_TITLEBK"); + test_mccolor_types(hWnd, MCSC_TITLETEXT, "MCSC_TITLETEXT"); + test_mccolor_types(hWnd, MCSC_TRAILINGTEXT, "MCSC_TRAILINGTEXT"); + + ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_mccolor_seq, "test_dtm_set_and_get_mccolor", FALSE); + + DestroyWindow(hWnd); } -static void test_dtm_set_and_get_mcfont(HWND hWndDateTime) +static void test_dtm_set_and_get_mcfont(void) { HFONT hFontOrig, hFontNew; + HWND hWnd; + + hWnd = create_datetime_control(DTS_SHOWNONE, 0); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); hFontOrig = GetStockObject(DEFAULT_GUI_FONT); - SendMessage(hWndDateTime, DTM_SETMCFONT, (WPARAM)hFontOrig, TRUE); - hFontNew = (HFONT)SendMessage(hWndDateTime, DTM_GETMCFONT, 0, 0); + SendMessage(hWnd, DTM_SETMCFONT, (WPARAM)hFontOrig, TRUE); + hFontNew = (HFONT)SendMessage(hWnd, DTM_GETMCFONT, 0, 0); ok(hFontOrig == hFontNew, "Expected hFontOrig==hFontNew, hFontOrig=%p, hFontNew=%p\n", hFontOrig, hFontNew); ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_mcfont_seq, "test_dtm_set_and_get_mcfont", FALSE); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + DestroyWindow(hWnd); } -static void test_dtm_get_monthcal(HWND hWndDateTime) +static void test_dtm_get_monthcal(void) { LRESULT r; + HWND hWnd; + + hWnd = create_datetime_control(DTS_SHOWNONE, 0); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); todo_wine { - r = SendMessage(hWndDateTime, DTM_GETMONTHCAL, 0, 0); + r = SendMessage(hWnd, DTM_GETMONTHCAL, 0, 0); ok(r == 0, "Expected NULL(no child month calendar control), got %ld\n", r); } ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_get_monthcal_seq, "test_dtm_get_monthcal", FALSE); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + DestroyWindow(hWnd); } static void fill_systime_struct(SYSTEMTIME *st, int year, int month, int dayofweek, int day, int hour, int minute, int second, int milliseconds) @@ -318,24 +330,29 @@ static LPARAM compare_systime(SYSTEMTIME *st1, SYSTEMTIME *st2) #define expect_systime_date(ST1, ST2) ok(compare_systime_date((ST1), (ST2))==1, "ST1.date != ST2.date\n") #define expect_systime_time(ST1, ST2) ok(compare_systime_time((ST1), (ST2))==1, "ST1.time != ST2.time\n") -static void test_dtm_set_and_get_range(HWND hWndDateTime) +static void test_dtm_set_and_get_range(void) { LRESULT r; SYSTEMTIME st[2]; SYSTEMTIME getSt[2]; + HWND hWnd; + + hWnd = create_datetime_control(DTS_SHOWNONE, 0); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); /* initialize st[0] to lowest possible value */ fill_systime_struct(&st[0], 1601, 1, 0, 1, 0, 0, 0, 0); /* initialize st[1] to all invalid numbers */ fill_systime_struct(&st[1], 0, 0, 7, 0, 24, 60, 60, 1000); - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MIN, (LPARAM)st); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETRANGE, 0, (LPARAM)getSt); + r = SendMessage(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == GDTR_MIN, "Expected %x, not %x(GDTR_MAX) or %x(GDTR_MIN | GDTR_MAX), got %lx\n", GDTR_MIN, GDTR_MAX, GDTR_MIN | GDTR_MAX, r); expect_systime(&st[0], &getSt[0]); - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MAX, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MAX, (LPARAM)st); expect_unsuccess(0, r); /* set st[0] to all invalid numbers */ @@ -343,25 +360,25 @@ static void test_dtm_set_and_get_range(HWND hWndDateTime) /* set st[1] to highest possible value */ fill_systime_struct(&st[1], 30827, 12, 6, 31, 23, 59, 59, 999); - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MAX, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MAX, (LPARAM)st); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETRANGE, 0, (LPARAM)getSt); + r = SendMessage(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); todo_wine { ok(r == GDTR_MAX, "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MIN | GDTR_MAX), got %lx\n", GDTR_MAX, GDTR_MIN, GDTR_MIN | GDTR_MAX, r); } expect_systime(&st[1], &getSt[1]); - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MIN, (LPARAM)st); expect_unsuccess(0, r); - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect_unsuccess(0, r); /* set st[0] to highest possible value */ fill_systime_struct(&st[0], 30827, 12, 6, 31, 23, 59, 59, 999); - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETRANGE, 0, (LPARAM)getSt); + r = SendMessage(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); expect_systime(&st[0], &getSt[0]); expect_systime(&st[1], &getSt[1]); @@ -371,9 +388,9 @@ static void test_dtm_set_and_get_range(HWND hWndDateTime) /* set st[1] to highest possible value */ fill_systime_struct(&st[1], 30827, 12, 6, 31, 23, 59, 59, 999); - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETRANGE, 0, (LPARAM)getSt); + r = SendMessage(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); expect_systime(&st[0], &getSt[0]); expect_systime(&st[1], &getSt[1]); @@ -383,32 +400,37 @@ static void test_dtm_set_and_get_range(HWND hWndDateTime) /* set st[1] to value lower than maximum */ fill_systime_struct(&st[1], 2007, 3, 2, 31, 23, 59, 59, 999); - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETRANGE, 0, (LPARAM)getSt); + r = SendMessage(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); expect_systime(&st[0], &getSt[0]); expect_systime(&st[1], &getSt[1]); ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_range_seq, "test_dtm_set_and_get_range", FALSE); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + + DestroyWindow(hWnd); } /* when maxmax, min and max values should be swapped by DTM_SETRANGE automatically */ - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETRANGE, 0, (LPARAM)getSt); + r = SendMessage(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); todo_wine { ok(compare_systime(&st[0], &getSt[0]) == 1 || @@ -434,9 +456,9 @@ static void test_dtm_set_range_swap_min_max(HWND hWndDateTime) fill_systime_struct(&st[0], 1980, 1, 3, 23, 14, 34, 37, 465); - r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st[0]); + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st[0]); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt[0]); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt[0]); ok(r == GDT_VALID, "Expected %d, not %d(GDT_NONE) or %d(GDT_ERROR), got %ld\n", GDT_VALID, GDT_NONE, GDT_ERROR, r); /* the time part seems to not change after swapping the min and max values and doing DTM_SETSYSTEMTIME */ @@ -452,12 +474,12 @@ static void test_dtm_set_range_swap_min_max(HWND hWndDateTime) /* set st[1] to value lower than maximum */ fill_systime_struct(&st[1], 2007, 3, 2, 31, 23, 59, 59, 999); - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); /* for some reason after we swapped the min and max values before, whenever we do a DTM_SETRANGE, the DTM_GETRANGE will return the values swapped*/ - r = SendMessage(hWndDateTime, DTM_GETRANGE, 0, (LPARAM)getSt); + r = SendMessage(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); todo_wine { ok(compare_systime(&st[0], &getSt[1]) == 1 || @@ -475,9 +497,9 @@ static void test_dtm_set_range_swap_min_max(HWND hWndDateTime) /* set min>max again, so that the return values of DTM_GETRANGE are no longer swapped the next time we do a DTM SETRANGE and DTM_GETRANGE*/ - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETRANGE, 0, (LPARAM)getSt); + r = SendMessage(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); expect_systime(&st[0], &getSt[1]); expect_systime(&st[1], &getSt[0]); @@ -487,23 +509,23 @@ static void test_dtm_set_range_swap_min_max(HWND hWndDateTime) /* set st[1] to highest possible value */ fill_systime_struct(&st[1], 30827, 12, 6, 31, 23, 59, 59, 999); - r = SendMessage(hWndDateTime, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); + r = SendMessage(hWnd, DTM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETRANGE, 0, (LPARAM)getSt); + r = SendMessage(hWnd, DTM_GETRANGE, 0, (LPARAM)getSt); ok(r == (GDTR_MIN | GDTR_MAX), "Expected %x, not %x(GDTR_MIN) or %x(GDTR_MAX), got %lx\n", (GDTR_MIN | GDTR_MAX), GDTR_MIN, GDTR_MAX, r); expect_systime(&st[0], &getSt[0]); expect_systime(&st[1], &getSt[1]); ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_range_swap_min_max_seq, "test_dtm_set_range_swap_min_max", FALSE); - flush_sequences(sequences, NUM_MSG_SEQUENCES); + + DestroyWindow(hWnd); } -static void test_dtm_set_and_get_system_time(HWND hWndDateTime) +static void test_dtm_set_and_get_system_time(void) { LRESULT r; - SYSTEMTIME st; - SYSTEMTIME getSt; - HWND hWndDateTime_test_gdt_none; + SYSTEMTIME st, getSt, ref; + HWND hWnd, hWndDateTime_test_gdt_none; hWndDateTime_test_gdt_none = create_datetime_control(0, 0); @@ -521,64 +543,129 @@ static void test_dtm_set_and_get_system_time(HWND hWndDateTime) DestroyWindow(hWndDateTime_test_gdt_none); - r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_NONE, (LPARAM)&st); + hWnd = create_datetime_control(DTS_SHOWNONE, 0); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_NONE, (LPARAM)&st); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); ok(r == GDT_NONE, "Expected %d, not %d(GDT_VALID) or %d(GDT_ERROR), got %ld\n", GDT_NONE, GDT_VALID, GDT_ERROR, r); /* set st to lowest possible value */ fill_systime_struct(&st, 1601, 1, 0, 1, 0, 0, 0, 0); - r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(1, r); /* set st to highest possible value */ fill_systime_struct(&st, 30827, 12, 6, 31, 23, 59, 59, 999); - r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(1, r); /* set st to value between min and max */ fill_systime_struct(&st, 1980, 1, 3, 23, 14, 34, 37, 465); - r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect(1, r); - r = SendMessage(hWndDateTime, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); ok(r == GDT_VALID, "Expected %d, not %d(GDT_NONE) or %d(GDT_ERROR), got %ld\n", GDT_VALID, GDT_NONE, GDT_ERROR, r); expect_systime(&st, &getSt); /* set st to invalid value */ fill_systime_struct(&st, 0, 0, 7, 0, 24, 60, 60, 1000); - r = SendMessage(hWndDateTime, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); expect_unsuccess(0, r); ok_sequence(sequences, DATETIME_SEQ_INDEX, test_dtm_set_and_get_system_time_seq, "test_dtm_set_and_get_system_time", FALSE); - flush_sequences(sequences, NUM_MSG_SEQUENCES); -} -static void test_datetime_control(void) -{ - HWND hWndDateTime; - - hWndDateTime = create_datetime_control(DTS_SHOWNONE, 0); - - ok(hWndDateTime != NULL, "Expected non NULL, got %p\n", hWndDateTime); - if(hWndDateTime!=NULL) { - test_dtm_set_format(hWndDateTime); - test_dtm_set_and_get_mccolor(hWndDateTime); - test_dtm_set_and_get_mcfont(hWndDateTime); - test_dtm_get_monthcal(hWndDateTime); - test_dtm_set_and_get_range(hWndDateTime); - test_dtm_set_range_swap_min_max(hWndDateTime); - test_dtm_set_and_get_system_time(hWndDateTime); - } - else { - skip("hWndDateTime is NULL\n"); - } + /* set to some valid value */ + GetSystemTime(&ref); + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&ref); + expect(1, r); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + expect(GDT_VALID, r); + expect_systime(&ref, &getSt); + + /* year invalid */ + st = ref; + st.wYear = 0; + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + todo_wine expect(1, r); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + expect(GDT_VALID, r); + expect_systime(&ref, &getSt); + /* month invalid */ + st = ref; + st.wMonth = 13; + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + expect(0, r); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + expect(GDT_VALID, r); + expect_systime(&ref, &getSt); + /* day invalid */ + st = ref; + st.wDay = 32; + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + expect(0, r); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + expect(GDT_VALID, r); + expect_systime(&ref, &getSt); + /* day of week isn't validated */ + st = ref; + st.wDayOfWeek = 10; + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + expect(1, r); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + expect(GDT_VALID, r); + expect_systime(&ref, &getSt); + /* hour invalid */ + st = ref; + st.wHour = 25; + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + expect(0, r); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + expect(GDT_VALID, r); + expect_systime(&ref, &getSt); + /* minute invalid */ + st = ref; + st.wMinute = 60; + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + expect(0, r); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + expect(GDT_VALID, r); + expect_systime(&ref, &getSt); + /* sec invalid */ + st = ref; + st.wSecond = 60; + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + expect(0, r); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + expect(GDT_VALID, r); + expect_systime(&ref, &getSt); + /* msec invalid */ + st = ref; + st.wMilliseconds = 1000; + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + expect(0, r); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + expect(GDT_VALID, r); + expect_systime(&ref, &getSt); + + /* day of week should be calculated automatically, + actual day of week for this date is 4 */ + fill_systime_struct(&st, 2009, 10, 1, 1, 0, 0, 10, 200); + r = SendMessage(hWnd, DTM_SETSYSTEMTIME, GDT_VALID, (LPARAM)&st); + expect(1, r); + r = SendMessage(hWnd, DTM_GETSYSTEMTIME, 0, (LPARAM)&getSt); + expect(GDT_VALID, r); + /* 01.10.2009 is Thursday */ + expect(4, (LRESULT)getSt.wDayOfWeek); + st.wDayOfWeek = 4; + expect_systime(&st, &getSt); - DestroyWindow(hWndDateTime); - ok_sequence(sequences, DATETIME_SEQ_INDEX, destroy_window_seq, "test_dtm_set_and_get_system_time", TRUE); + DestroyWindow(hWnd); } START_TEST(datetime) @@ -600,5 +687,11 @@ START_TEST(datetime) init_msg_sequences(sequences, NUM_MSG_SEQUENCES); - test_datetime_control(); + test_dtm_set_format(); + test_dtm_set_and_get_mccolor(); + test_dtm_set_and_get_mcfont(); + test_dtm_get_monthcal(); + test_dtm_set_and_get_range(); + test_dtm_set_range_swap_min_max(); + test_dtm_set_and_get_system_time(); } diff --git a/dlls/comctl32/tests/dpa.c b/dlls/comctl32/tests/dpa.c index 022460a3612..c9e91c25437 100644 --- a/dlls/comctl32/tests/dpa.c +++ b/dlls/comctl32/tests/dpa.c @@ -380,9 +380,9 @@ static void test_DPA_Merge(void) for (i = 0; i < 6; i++) { - ret = pDPA_InsertPtr(dpa2, i, (PVOID)(6-i)); + ret = pDPA_InsertPtr(dpa2, i, (PVOID)(INT_PTR)(6-i)); ok(ret == i, "ret=%d\n", ret); - ret = pDPA_InsertPtr(dpa3, i, (PVOID)(i+1)); + ret = pDPA_InsertPtr(dpa3, i, (PVOID)(INT_PTR)(i+1)); ok(ret == i, "ret=%d\n", ret); } @@ -404,7 +404,7 @@ static void test_DPA_Merge(void) for (i = 0; i < 6; i++) { - ret = pDPA_InsertPtr(dpa2, i, (PVOID)(6-i)); + ret = pDPA_InsertPtr(dpa2, i, (PVOID)(INT_PTR)(6-i)); ok(ret == i, "ret=%d\n", ret); } @@ -497,7 +497,7 @@ static void test_DPA_EnumCallback(void) for (i = 0; i < 6; i++) { - ret = pDPA_InsertPtr(dpa, i, (PVOID)(i+1)); + ret = pDPA_InsertPtr(dpa, i, (PVOID)(INT_PTR)(i+1)); ok(ret == i, "ret=%d\n", ret); } @@ -529,7 +529,7 @@ static void test_DPA_DestroyCallback(void) for (i = 0; i < 3; i++) { - ret = pDPA_InsertPtr(dpa, i, (PVOID)(i+1)); + ret = pDPA_InsertPtr(dpa, i, (PVOID)(INT_PTR)(i+1)); ok(ret == i, "ret=%d\n", ret); } @@ -706,7 +706,7 @@ if (0) { /* saving/loading */ for (i = 0; i < 6; i++) { - ret = pDPA_InsertPtr(dpa, i, (PVOID)(i+1)); + ret = pDPA_InsertPtr(dpa, i, (PVOID)(INT_PTR)(i+1)); ok(ret == i, "ret=%d\n", ret); } diff --git a/dlls/comctl32/tests/monthcal.c b/dlls/comctl32/tests/monthcal.c index 5f8e09ef465..28b364647ae 100644 --- a/dlls/comctl32/tests/monthcal.c +++ b/dlls/comctl32/tests/monthcal.c @@ -33,6 +33,7 @@ #include "msg.h" #define expect(expected, got) ok(expected == got, "Expected %d, got %d\n", expected, got); +#define expect_hex(expected, got) ok(expected == got, "Expected %x, got %x\n", expected, got); #define NUM_MSG_SEQUENCES 2 #define PARENT_SEQ_INDEX 0 @@ -45,6 +46,8 @@ struct subclass_info static struct msg_sequence *sequences[NUM_MSG_SEQUENCES]; +static HWND parent_wnd; + static const struct message create_parent_window_seq[] = { { WM_GETMINMAXINFO, sent }, { WM_NCCREATE, sent }, @@ -81,6 +84,7 @@ static const struct message create_monthcal_multi_sel_style_seq[] = { { WM_NOTIFYFORMAT, sent|lparam, 0, NF_QUERY }, { WM_QUERYUISTATE, sent|optional }, { WM_GETFONT, sent }, + { WM_PARENTNOTIFY, sent }, { 0 } }; @@ -126,7 +130,6 @@ static const struct message monthcal_color_seq[] = { static const struct message monthcal_curr_date_seq[] = { { MCM_SETCURSEL, sent|wparam, 0}, { WM_PAINT, sent|wparam|lparam|defwinproc, 0, 0}, - { WM_ERASEBKGND, sent|lparam|defwinproc, 0}, { MCM_SETCURSEL, sent|wparam, 0}, { MCM_SETCURSEL, sent|wparam, 0}, { MCM_GETCURSEL, sent|wparam, 0}, @@ -213,9 +216,6 @@ static const struct message monthcal_hit_test_seq[] = { { MCM_HITTEST, sent|wparam, 0}, { MCM_HITTEST, sent|wparam, 0}, { MCM_HITTEST, sent|wparam, 0}, - { MCM_HITTEST, sent|wparam, 0}, - { MCM_HITTEST, sent|wparam, 0}, - { MCM_HITTEST, sent|wparam, 0}, { 0 } }; @@ -289,6 +289,9 @@ static const struct message destroy_monthcal_child_msgs_seq[] = { static const struct message destroy_monthcal_multi_sel_style_seq[] = { { 0x0090, sent|optional }, /* Vista */ + { WM_SHOWWINDOW, sent|wparam|lparam, 0, 0}, + { WM_WINDOWPOSCHANGING, sent|wparam, 0}, + { WM_WINDOWPOSCHANGED, sent|wparam, 0}, { WM_DESTROY, sent|wparam|lparam, 0, 0}, { WM_NCDESTROY, sent|wparam|lparam, 0, 0}, { 0 } @@ -317,22 +320,73 @@ static const struct message destroy_parent_seq[] = { static void test_monthcal(void) { HWND hwnd; - SYSTEMTIME st[2], st1[2]; + SYSTEMTIME st[2], st1[2], today; int res, month_range; hwnd = CreateWindowA(MONTHCAL_CLASSA, "MonthCal", WS_POPUP | WS_VISIBLE, CW_USEDEFAULT, 0, 300, 300, 0, 0, NULL, NULL); ok(hwnd != NULL, "Failed to create MonthCal\n"); + + /* test range just after creation */ + memset(&st, 0xcc, sizeof(st)); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st) == 0, "No limits should be set\n"); + + expect(0, st[0].wYear); + expect(0, st[0].wMonth); + expect(0, st[0].wDay); + expect(0, st[0].wDayOfWeek); + expect(0, st[0].wHour); + expect(0, st[0].wMinute); + expect(0, st[0].wSecond); + expect(0, st[0].wMilliseconds); + + expect(0, st[1].wYear); + expect(0, st[1].wMonth); + expect(0, st[1].wDay); + expect(0, st[1].wDayOfWeek); + expect(0, st[1].wHour); + expect(0, st[1].wMinute); + expect(0, st[1].wSecond); + expect(0, st[1].wMilliseconds); + GetSystemTime(&st[0]); st[1] = st[0]; + SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&today); + /* Invalid date/time */ st[0].wYear = 2000; /* Time should not matter */ st[1].wHour = st[1].wMinute = st[1].wSecond = 70; + st[1].wMilliseconds = 1200; ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set MAX limit\n"); + /* invalid timestamp is written back with today data and msecs untouched */ + expect(today.wHour, st[1].wHour); + expect(today.wMinute, st[1].wMinute); + expect(today.wSecond, st[1].wSecond); + expect(1200, st[1].wMilliseconds); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "No limits should be set\n"); ok(st1[0].wYear != 2000, "Lover limit changed\n"); + /* invalid timestamp should be replaced with today data, except msecs */ + expect(today.wHour, st1[1].wHour); + expect(today.wMinute, st1[1].wMinute); + expect(today.wSecond, st1[1].wSecond); + expect(1200, st1[1].wMilliseconds); + + /* Invalid date/time with invalid milliseconds only */ + GetSystemTime(&st[0]); + st[1] = st[0]; + /* Time should not matter */ + st[1].wMilliseconds = 1200; + ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set MAX limit\n"); + /* invalid milliseconds field doesn't lead to invalid timestamp */ + expect(st[0].wHour, st[1].wHour); + expect(st[0].wMinute, st[1].wMinute); + expect(st[0].wSecond, st[1].wSecond); + expect(1200, st[1].wMilliseconds); + + GetSystemTime(&st[0]); st[1].wMonth = 0; ok(!SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN | GDTR_MAX, (LPARAM)st), "Should have failed to set limits\n"); @@ -375,6 +429,60 @@ static void test_monthcal(void) ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set max limit\n"); ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "Only MAX limit should be set\n"); + /* set both limits, then set max < min */ + GetSystemTime(&st[0]); + st[1] = st[0]; + st[1].wYear++; + ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN|GDTR_MAX, (LPARAM)st), "Failed to set limits\n"); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == (GDTR_MIN|GDTR_MAX), "Min limit expected\n"); + st[1].wYear -= 2; + ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MAX, (LPARAM)st), "Failed to set limits\n"); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MAX, "Max limit expected\n"); + + expect(0, st1[0].wYear); + expect(0, st1[0].wMonth); + expect(0, st1[0].wDay); + expect(0, st1[0].wDayOfWeek); + expect(0, st1[0].wHour); + expect(0, st1[0].wMinute); + expect(0, st1[0].wSecond); + expect(0, st1[0].wMilliseconds); + + expect(st[1].wYear, st1[1].wYear); + expect(st[1].wMonth, st1[1].wMonth); + expect(st[1].wDay, st1[1].wDay); + expect(st[1].wDayOfWeek, st1[1].wDayOfWeek); + expect(st[1].wHour, st1[1].wHour); + expect(st[1].wMinute, st1[1].wMinute); + expect(st[1].wSecond, st1[1].wSecond); + expect(st[1].wMilliseconds, st1[1].wMilliseconds); + + st[1] = st[0]; + st[1].wYear++; + ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN|GDTR_MAX, (LPARAM)st), "Failed to set limits\n"); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == (GDTR_MIN|GDTR_MAX), "Min limit expected\n"); + st[0].wYear++; /* start == end now */ + ok(SendMessage(hwnd, MCM_SETRANGE, GDTR_MIN, (LPARAM)st), "Failed to set limits\n"); + ok(SendMessage(hwnd, MCM_GETRANGE, 0, (LPARAM)st1) == GDTR_MIN, "Min limit expected\n"); + + expect(st[0].wYear, st1[0].wYear); + expect(st[0].wMonth, st1[0].wMonth); + expect(st[0].wDay, st1[0].wDay); + expect(st[0].wDayOfWeek, st1[0].wDayOfWeek); + expect(st[0].wHour, st1[0].wHour); + expect(st[0].wMinute, st1[0].wMinute); + expect(st[0].wSecond, st1[0].wSecond); + expect(st[0].wMilliseconds, st1[0].wMilliseconds); + + expect(0, st1[1].wYear); + expect(0, st1[1].wMonth); + expect(0, st1[1].wDay); + expect(0, st1[1].wDayOfWeek); + expect(0, st1[1].wHour); + expect(0, st1[1].wMinute); + expect(0, st1[1].wSecond); + expect(0, st1[1].wMilliseconds); + DestroyWindow(hwnd); } @@ -469,6 +577,14 @@ static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wPa msg.lParam = lParam; add_message(sequences, MONTHCAL_SEQ_INDEX, &msg); + /* some debug output for style changing */ + if ((message == WM_STYLECHANGING || + message == WM_STYLECHANGED) && lParam) + { + STYLESTRUCT *style = (STYLESTRUCT*)lParam; + trace("\told style: 0x%08x, new style: 0x%08x\n", style->styleOld, style->styleNew); + } + defwndproc_counter++; ret = CallWindowProcA(info->oldproc, hwnd, message, wParam, lParam); defwndproc_counter--; @@ -476,7 +592,7 @@ static LRESULT WINAPI monthcal_subclass_proc(HWND hwnd, UINT message, WPARAM wPa return ret; } -static HWND create_monthcal_control(DWORD style, HWND parent_window) +static HWND create_monthcal_control(DWORD style) { struct subclass_info *info; HWND hwnd; @@ -488,9 +604,9 @@ static HWND create_monthcal_control(DWORD style, HWND parent_window) hwnd = CreateWindowEx(0, MONTHCAL_CLASS, "", - style, + WS_CHILD | WS_BORDER | WS_VISIBLE | style, 0, 0, 300, 400, - parent_window, NULL, GetModuleHandleA(NULL), NULL); + parent_wnd, NULL, GetModuleHandleA(NULL), NULL); if (!hwnd) { @@ -502,15 +618,20 @@ static HWND create_monthcal_control(DWORD style, HWND parent_window) (LONG_PTR)monthcal_subclass_proc); SetWindowLongPtrA(hwnd, GWLP_USERDATA, (LONG_PTR)info); + SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0); + return hwnd; } /* Setter and Getters Tests */ -static void test_monthcal_color(HWND hwnd) +static void test_monthcal_color(void) { int res, temp; + HWND hwnd; + + hwnd = create_monthcal_control(0); flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -576,12 +697,17 @@ static void test_monthcal_color(HWND hwnd) expect(RGB(255,255,255), temp); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_color_seq, "monthcal color", FALSE); + + DestroyWindow(hwnd); } -static void test_monthcal_currDate(HWND hwnd) +static void test_monthcal_currdate(void) { SYSTEMTIME st_original, st_new, st_test; int res; + HWND hwnd; + + hwnd = create_monthcal_control(0); flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -640,19 +766,24 @@ static void test_monthcal_currDate(HWND hwnd) expect(0, res); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_curr_date_seq, "monthcal currDate", TRUE); + + DestroyWindow(hwnd); } -static void test_monthcal_firstDay(HWND hwnd) +static void test_monthcal_firstDay(void) { int res, fday, i, prev; - TCHAR b[128]; + CHAR b[128]; LCID lcid = LOCALE_USER_DEFAULT; + HWND hwnd; + + hwnd = create_monthcal_control(0); flush_sequences(sequences, NUM_MSG_SEQUENCES); /* Setter and Getters for first day of week */ /* check for locale first day */ - if(GetLocaleInfo(lcid, LOCALE_IFIRSTDAYOFWEEK, b, 128)){ + if(GetLocaleInfoA(lcid, LOCALE_IFIRSTDAYOFWEEK, b, 128)){ fday = atoi(b); trace("fday: %d\n", fday); res = SendMessage(hwnd, MCM_GETFIRSTDAYOFWEEK, 0, 0); @@ -683,11 +814,15 @@ static void test_monthcal_firstDay(HWND hwnd) skip("Cannot retrieve first day of the week\n"); } + DestroyWindow(hwnd); } -static void test_monthcal_unicode(HWND hwnd) +static void test_monthcal_unicode(void) { int res, temp; + HWND hwnd; + + hwnd = create_monthcal_control(0); flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -717,22 +852,67 @@ static void test_monthcal_unicode(HWND hwnd) expect(0, res); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_unicode_seq, "monthcal unicode", FALSE); + + DestroyWindow(hwnd); } -static void test_monthcal_HitTest(HWND hwnd) +static void test_monthcal_hittest(void) { + typedef struct hittest_test + { + UINT ht; + int todo; + } hittest_test_t; + + static const hittest_test_t title_hits[] = { + /* Start is the same everywhere */ + { MCHT_TITLE, 0 }, + { MCHT_TITLEBTNPREV, 0 }, + /* The middle piece is only tested for presence of items */ + /* End is the same everywhere */ + { MCHT_TITLEBTNNEXT, 0 }, + { MCHT_TITLE, 0 }, + { MCHT_NOWHERE, 1 } + }; + MCHITTESTINFO mchit; - UINT res; + UINT res, old_res; SYSTEMTIME st; LONG x; UINT title_index; - static const UINT title_hits[] = - { MCHT_NOWHERE, MCHT_TITLEBK, MCHT_TITLEBTNPREV, MCHT_TITLEBK, - MCHT_TITLEMONTH, MCHT_TITLEBK, MCHT_TITLEYEAR, MCHT_TITLEBK, - MCHT_TITLEBTNNEXT, MCHT_TITLEBK, MCHT_NOWHERE }; + HWND hwnd; + RECT r; + char yearmonth[80], *locale_month, *locale_year; + int month_count, year_count; + BOOL in_the_middle; memset(&mchit, 0, sizeof(MCHITTESTINFO)); + hwnd = create_monthcal_control(0); + + /* test with invalid structure size */ + mchit.cbSize = MCHITTESTINFO_V1_SIZE - 1; + mchit.pt.x = 0; + mchit.pt.y = 0; + res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit); + expect(0, mchit.pt.x); + expect(0, mchit.pt.y); + expect(-1, res); + expect(0, mchit.uHit); + /* test with invalid pointer */ + res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM)NULL); + expect(-1, res); + + /* resize control to display single Calendar */ + res = SendMessage(hwnd, MCM_GETMINREQRECT, 0, (LPARAM)&r); + if (res == 0) + { + win_skip("Message MCM_GETMINREQRECT unsupported. Skipping.\n"); + DestroyWindow(hwnd); + return; + } + MoveWindow(hwnd, 0, 0, r.right, r.bottom, FALSE); + flush_sequences(sequences, NUM_MSG_SEQUENCES); st.wYear = 2007; @@ -747,60 +927,60 @@ static void test_monthcal_HitTest(HWND hwnd) res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st); expect(1,res); - /* (0, 0) is the top left of the control and should not be active */ - mchit.cbSize = sizeof(MCHITTESTINFO); + /* (0, 0) is the top left of the control - title */ + mchit.cbSize = MCHITTESTINFO_V1_SIZE; mchit.pt.x = 0; mchit.pt.y = 0; - res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); + res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit); expect(0, mchit.pt.x); expect(0, mchit.pt.y); expect(mchit.uHit, res); - todo_wine {expect(MCHT_NOWHERE, res);} - - /* (300, 400) is the bottom right of the control and should not be active */ - mchit.pt.x = 300; - mchit.pt.y = 400; - res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(300, mchit.pt.x); - expect(400, mchit.pt.y); + expect_hex(MCHT_TITLE, res); + + /* bottom right of the control and should not be active */ + mchit.pt.x = r.right; + mchit.pt.y = r.bottom; + res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM)&mchit); + expect(r.right, mchit.pt.x); + expect(r.bottom, mchit.pt.y); expect(mchit.uHit, res); - todo_wine {expect(MCHT_NOWHERE, res);} + todo_wine expect_hex(MCHT_NOWHERE, res); - /* (500, 500) is completely out of the control and should not be active */ - mchit.pt.x = 500; - mchit.pt.y = 500; + /* completely out of the control, should not be active */ + mchit.pt.x = 2 * r.right; + mchit.pt.y = 2 * r.bottom; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(500, mchit.pt.x); - expect(500, mchit.pt.y); + expect(2 * r.right, mchit.pt.x); + expect(2 * r.bottom, mchit.pt.y); expect(mchit.uHit, res); - todo_wine {expect(MCHT_NOWHERE, res);} + todo_wine expect_hex(MCHT_NOWHERE, res); - /* (120, 180) is in active area - calendar background */ - mchit.pt.x = 120; - mchit.pt.y = 180; + /* in active area - day of the week */ + mchit.pt.x = r.right / 2; + mchit.pt.y = r.bottom / 2; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(120, mchit.pt.x); - expect(180, mchit.pt.y); + expect(r.right / 2, mchit.pt.x); + expect(r.bottom / 2, mchit.pt.y); expect(mchit.uHit, res); - expect(MCHT_CALENDARBK, res); + expect_hex(MCHT_CALENDARDATE, res); - /* (70, 70) is in active area - day of the week */ - mchit.pt.x = 70; - mchit.pt.y = 70; + /* in active area - day of the week #2 */ + mchit.pt.x = r.right / 14; /* half of first day rect */ + mchit.pt.y = r.bottom / 2; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(70, mchit.pt.x); - expect(70, mchit.pt.y); + expect(r.right / 14, mchit.pt.x); + expect(r.bottom / 2, mchit.pt.y); expect(mchit.uHit, res); - todo_wine {expect(MCHT_CALENDARDAY, res);} + expect_hex(MCHT_CALENDARDATE, res); - /* (70, 90) is in active area - date from prev month */ - mchit.pt.x = 70; - mchit.pt.y = 90; + /* in active area - date from prev month */ + mchit.pt.x = r.right / 14; /* half of first day rect */ + mchit.pt.y = 6 * r.bottom / 19; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(70, mchit.pt.x); - expect(90, mchit.pt.y); + expect(r.right / 14, mchit.pt.x); + expect(6 * r.bottom / 19, mchit.pt.y); expect(mchit.uHit, res); - todo_wine {expect(MCHT_CALENDARDATEPREV, res);} + expect_hex(MCHT_CALENDARDATEPREV, res); #if 0 /* (125, 115) is in active area - date from this month */ @@ -813,106 +993,136 @@ static void test_monthcal_HitTest(HWND hwnd) expect(MCHT_CALENDARDATE, res); #endif - /* (80, 220) is in active area - background section of the title */ - mchit.pt.x = 80; - mchit.pt.y = 220; + /* in active area - date from next month */ + mchit.pt.x = 11 * r.right / 14; + mchit.pt.y = 16 * r.bottom / 19; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(80, mchit.pt.x); - expect(220, mchit.pt.y); + expect(11 * r.right / 14, mchit.pt.x); + expect(16 * r.bottom / 19, mchit.pt.y); expect(mchit.uHit, res); - todo_wine {expect(MCHT_TITLEBK, res);} + expect_hex(MCHT_CALENDARDATENEXT, res); - /* (140, 215) is in active area - month section of the title */ - mchit.pt.x = 140; - mchit.pt.y = 215; + /* in active area - today link */ + mchit.pt.x = r.right / 14; + mchit.pt.y = 18 * r.bottom / 19; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(140, mchit.pt.x); - expect(215, mchit.pt.y); + expect(r.right / 14, mchit.pt.x); + expect(18 * r.bottom / 19, mchit.pt.y); expect(mchit.uHit, res); - todo_wine {expect(MCHT_TITLEMONTH, res);} + expect_hex(MCHT_TODAYLINK, res); - /* (170, 215) is in active area - year section of the title */ - mchit.pt.x = 170; - mchit.pt.y = 215; + /* in active area - today link */ + mchit.pt.x = r.right / 2; + mchit.pt.y = 18 * r.bottom / 19; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(170, mchit.pt.x); - expect(215, mchit.pt.y); + expect(r.right / 2, mchit.pt.x); + expect(18 * r.bottom / 19, mchit.pt.y); expect(mchit.uHit, res); - todo_wine {expect(MCHT_TITLEYEAR, res);} + expect_hex(MCHT_TODAYLINK, res); - /* (150, 260) is in active area - date from this month */ - mchit.pt.x = 150; - mchit.pt.y = 260; + /* in active area - today link */ + mchit.pt.x = r.right / 10; + mchit.pt.y = 18 * r.bottom / 19; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(150, mchit.pt.x); - expect(260, mchit.pt.y); + expect(r.right / 10, mchit.pt.x); + expect(18 * r.bottom / 19, mchit.pt.y); expect(mchit.uHit, res); - todo_wine {expect(MCHT_CALENDARDATE, res);} - - /* (150, 350) is in active area - date from next month */ - mchit.pt.x = 150; - mchit.pt.y = 350; - res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(150, mchit.pt.x); - expect(350, mchit.pt.y); - expect(mchit.uHit, res); - todo_wine {expect(MCHT_CALENDARDATENEXT, res);} - - /* (150, 370) is in active area - today link */ - mchit.pt.x = 150; - mchit.pt.y = 370; - res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(150, mchit.pt.x); - expect(370, mchit.pt.y); - expect(mchit.uHit, res); - todo_wine {expect(MCHT_TODAYLINK, res);} - - /* (70, 370) is in active area - today link */ - mchit.pt.x = 70; - mchit.pt.y = 370; - res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); - expect(70, mchit.pt.x); - expect(370, mchit.pt.y); - expect(mchit.uHit, res); - todo_wine {expect(MCHT_TODAYLINK, res);} + expect_hex(MCHT_TODAYLINK, res); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_hit_test_seq, "monthcal hit test", TRUE); /* The horizontal position of title bar elements depends on locale (y pos is constant), so we sample across a horizontal line and make sure we find all elements. */ - mchit.pt.y = 40; + + /* Get the format of the title */ + GetLocaleInfo(LOCALE_USER_DEFAULT, LOCALE_SYEARMONTH, yearmonth, 80); + /* Find out if we have a month and/or year */ + locale_year = strstr(yearmonth, "y"); + locale_month = strstr(yearmonth, "M"); + + mchit.pt.x = 0; + mchit.pt.y = (5/2) * r.bottom / 19; title_index = 0; - for (x = 0; x < 300; x++){ + old_res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); + expect_hex(title_hits[title_index].ht, old_res); + + in_the_middle = FALSE; + month_count = year_count = 0; + for (x = 0; x < r.right; x++){ mchit.pt.x = x; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); expect(x, mchit.pt.x); - expect(40, mchit.pt.y); + expect((5/2) * r.bottom / 19, mchit.pt.y); expect(mchit.uHit, res); - if (res != title_hits[title_index]){ - title_index++; - if (sizeof(title_hits) / sizeof(title_hits[0]) <= title_index) - break; - todo_wine {expect(title_hits[title_index], res);} + if (res != old_res) { + + if (old_res == MCHT_TITLEBTNPREV) + in_the_middle = TRUE; + + if (res == MCHT_TITLEBTNNEXT) + in_the_middle = FALSE; + + if (in_the_middle) { + if (res == MCHT_TITLEMONTH) + month_count++; + else if (res == MCHT_TITLEYEAR) + year_count++; + } else { + title_index++; + + if (sizeof(title_hits) / sizeof(title_hits[0]) <= title_index) + break; + + if (title_hits[title_index].todo) { + todo_wine + ok(title_hits[title_index].ht == res, "Expected %x, got %x, pos %d\n", + title_hits[title_index].ht, res, x); + } else { + ok(title_hits[title_index].ht == res, "Expected %x, got %x, pos %d\n", + title_hits[title_index].ht, res, x); + } + } + old_res = res; } } - todo_wine {ok(300 <= x && title_index + 1 == sizeof(title_hits) / sizeof(title_hits[0]), - "Wrong title layout\n");} + + /* There are some limits, even if LOCALE_SYEARMONTH contains rubbish + * or no month/year indicators at all */ + if (locale_month) + todo_wine ok(month_count == 1, "Expected 1 month item, got %d\n", month_count); + else + ok(month_count <= 1, "Too many month items: %d\n", month_count); + + if (locale_year) + todo_wine ok(year_count == 1, "Expected 1 year item, got %d\n", year_count); + else + ok(year_count <= 1, "Too many year items: %d\n", year_count); + + todo_wine ok(month_count + year_count >= 1, "Not enough month and year items\n"); + + ok(r.right <= x && title_index + 1 == sizeof(title_hits) / sizeof(title_hits[0]), + "Wrong title layout\n"); + + DestroyWindow(hwnd); } -static void test_monthcal_todaylink(HWND hwnd) +static void test_monthcal_todaylink(void) { MCHITTESTINFO mchit; SYSTEMTIME st_test, st_new; BOOL error = FALSE; UINT res; + HWND hwnd; memset(&mchit, 0, sizeof(MCHITTESTINFO)); + hwnd = create_monthcal_control(0); + flush_sequences(sequences, NUM_MSG_SEQUENCES); /* (70, 370) is in active area - today link */ - mchit.cbSize = sizeof(MCHITTESTINFO); + mchit.cbSize = MCHITTESTINFO_V1_SIZE; mchit.pt.x = 70; mchit.pt.y = 370; res = SendMessage(hwnd, MCM_HITTEST, 0, (LPARAM) & mchit); @@ -956,12 +1166,17 @@ static void test_monthcal_todaylink(HWND hwnd) expect(2005, st_new.wYear); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_todaylink_seq, "monthcal hit test", TRUE); + + DestroyWindow(hwnd); } -static void test_monthcal_today(HWND hwnd) +static void test_monthcal_today(void) { SYSTEMTIME st_test, st_new; int res; + HWND hwnd; + + hwnd = create_monthcal_control(0); flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -1005,11 +1220,16 @@ static void test_monthcal_today(HWND hwnd) expect(0, st_new.wMonth); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_today_seq, "monthcal today", TRUE); + + DestroyWindow(hwnd); } -static void test_monthcal_scroll(HWND hwnd) +static void test_monthcal_scroll(void) { int res; + HWND hwnd; + + hwnd = create_monthcal_control(0); flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -1038,19 +1258,40 @@ static void test_monthcal_scroll(HWND hwnd) expect(-5, res); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_scroll_seq, "monthcal scroll", FALSE); + + DestroyWindow(hwnd); } -static void test_monthcal_monthrange(HWND hwnd) +static void test_monthcal_monthrange(void) { int res; - SYSTEMTIME st_visible[2], st_daystate[2]; + SYSTEMTIME st_visible[2], st_daystate[2], st; + HWND hwnd; + + hwnd = create_monthcal_control(0); - flush_sequences(sequences, NUM_MSG_SEQUENCES); st_visible[0].wYear = 0; st_visible[0].wMonth = 0; st_visible[0].wDay = 0; st_daystate[1] = st_daystate[0] = st_visible[1] = st_visible[0]; + st.wYear = 2000; + st.wMonth = 11; + st.wDay = 28; + st.wHour = 11; + st.wMinute = 59; + st.wSecond = 30; + st.wMilliseconds = 0; + st.wDayOfWeek = 0; + + res = SendMessage(hwnd, MCM_SETCURSEL, 0, (LPARAM)&st); + expect(1,res); + + /* to be locale independent */ + SendMessage(hwnd, MCM_SETFIRSTDAYOFWEEK, 0, (LPARAM)6); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + res = SendMessage(hwnd, MCM_GETMONTHRANGE, GMR_VISIBLE, (LPARAM)st_visible); todo_wine { expect(2, res); @@ -1073,11 +1314,45 @@ static void test_monthcal_monthrange(HWND hwnd) } ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_monthrange_seq, "monthcal monthrange", FALSE); + + DestroyWindow(hwnd); } -static void test_monthcal_MaxSelDay(HWND hwnd) +static void test_monthcal_maxselday(void) { int res; + HWND hwnd; + DWORD style; + + hwnd = create_monthcal_control(0); + /* if no style specified default to 1 */ + res = SendMessage(hwnd, MCM_GETMAXSELCOUNT, 0, 0); + expect(1, res); + res = SendMessage(hwnd, MCM_SETMAXSELCOUNT, 5, 0); + expect(0, res); + res = SendMessage(hwnd, MCM_GETMAXSELCOUNT, 0, 0); + expect(1, res); + + /* try to set style */ + style = GetWindowLong(hwnd, GWL_STYLE); + SetWindowLong(hwnd, GWL_STYLE, style | MCS_MULTISELECT); + style = GetWindowLong(hwnd, GWL_STYLE); + ok(!(style & MCS_MULTISELECT), "Expected MCS_MULTISELECT not to be set\n"); + DestroyWindow(hwnd); + + hwnd = create_monthcal_control(MCS_MULTISELECT); + /* try to remove style */ + style = GetWindowLong(hwnd, GWL_STYLE); + SetWindowLong(hwnd, GWL_STYLE, style & ~MCS_MULTISELECT); + style = GetWindowLong(hwnd, GWL_STYLE); + ok(style & MCS_MULTISELECT, "Expected MCS_MULTISELECT to be set\n"); + DestroyWindow(hwnd); + + hwnd = create_monthcal_control(MCS_MULTISELECT); + + /* default width is a week */ + res = SendMessage(hwnd, MCM_GETMAXSELCOUNT, 0, 0); + expect(7, res); flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -1092,20 +1367,32 @@ static void test_monthcal_MaxSelDay(HWND hwnd) res = SendMessage(hwnd, MCM_GETMAXSELCOUNT, 0, 0); expect(15, res); + /* test invalid value */ res = SendMessage(hwnd, MCM_SETMAXSELCOUNT, -1, 0); - todo_wine {expect(0, res);} + expect(0, res); res = SendMessage(hwnd, MCM_GETMAXSELCOUNT, 0, 0); - todo_wine {expect(15, res);} + expect(15, res); ok_sequence(sequences, MONTHCAL_SEQ_INDEX, monthcal_max_sel_day_seq, "monthcal MaxSelDay", FALSE); + + /* zero value is invalid too */ + res = SendMessage(hwnd, MCM_SETMAXSELCOUNT, 0, 0); + expect(0, res); + res = SendMessage(hwnd, MCM_GETMAXSELCOUNT, 0, 0); + expect(15, res); + + DestroyWindow(hwnd); } -static void test_monthcal_size(HWND hwnd) +static void test_monthcal_size(void) { int res; RECT r1, r2; HFONT hFont1, hFont2; LOGFONTA logfont; + HWND hwnd; + + hwnd = create_monthcal_control(0); lstrcpyA(logfont.lfFaceName, "Arial"); memset(&logfont, 0, sizeof(logfont)); @@ -1127,6 +1414,77 @@ static void test_monthcal_size(HWND hwnd) OffsetRect(&r2, -r2.left, -r2.top); ok(r1.bottom < r2.bottom, "Failed to get larger rect with larger font\n"); + + DestroyWindow(hwnd); +} + +static void test_monthcal_create(void) +{ + HWND hwnd; + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + + hwnd = create_monthcal_control(0); + ok_sequence(sequences, PARENT_SEQ_INDEX, create_monthcal_control_seq, "create monthcal control", TRUE); + + DestroyWindow(hwnd); + + flush_sequences(sequences, NUM_MSG_SEQUENCES); + hwnd = create_monthcal_control(MCS_MULTISELECT); + ok_sequence(sequences, PARENT_SEQ_INDEX, create_monthcal_multi_sel_style_seq, "create monthcal (multi sel style)", TRUE); + DestroyWindow(hwnd); +} + +static void test_monthcal_destroy(void) +{ + HWND hwnd; + + hwnd = create_monthcal_control(0); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + DestroyWindow(hwnd); + ok_sequence(sequences, PARENT_SEQ_INDEX, destroy_monthcal_parent_msgs_seq, "Destroy monthcal (parent msg)", FALSE); + ok_sequence(sequences, MONTHCAL_SEQ_INDEX, destroy_monthcal_child_msgs_seq, "Destroy monthcal (child msg)", FALSE); + + /* MCS_MULTISELECT */ + hwnd = create_monthcal_control(MCS_MULTISELECT); + flush_sequences(sequences, NUM_MSG_SEQUENCES); + DestroyWindow(hwnd); + ok_sequence(sequences, MONTHCAL_SEQ_INDEX, destroy_monthcal_multi_sel_style_seq, "Destroy monthcal (multi sel style)", FALSE); +} + +static void test_monthcal_getselrange(void) +{ + HWND hwnd; + SYSTEMTIME st, range[2]; + BOOL ret; + + hwnd = create_monthcal_control(MCS_MULTISELECT); + + /* just after creation selection should start and end today */ + ret = SendMessage(hwnd, MCM_GETTODAY, 0, (LPARAM)&st); + expect(TRUE, ret); + + ret = SendMessage(hwnd, MCM_GETSELRANGE, 0, (LPARAM)range); + expect(TRUE, ret); + expect(st.wYear, range[0].wYear); + expect(st.wMonth, range[0].wMonth); + expect(st.wDay, range[0].wDay); + expect(st.wDayOfWeek, range[0].wDayOfWeek); + expect(st.wHour, range[0].wHour); + expect(st.wMinute, range[0].wMinute); + expect(st.wSecond, range[0].wSecond); + expect(st.wMilliseconds, range[0].wMilliseconds); + + expect(st.wYear, range[1].wYear); + expect(st.wMonth, range[1].wMonth); + expect(st.wDay, range[1].wDay); + expect(st.wDayOfWeek, range[1].wDayOfWeek); + expect(st.wHour, range[1].wHour); + expect(st.wMinute, range[1].wMinute); + expect(st.wSecond, range[1].wSecond); + expect(st.wMilliseconds, range[1].wMilliseconds); + + DestroyWindow(hwnd); } START_TEST(monthcal) @@ -1134,7 +1492,6 @@ START_TEST(monthcal) HMODULE hComctl32; BOOL (WINAPI *pInitCommonControlsEx)(const INITCOMMONCONTROLSEX*); INITCOMMONCONTROLSEX iccex; - HWND hwnd, parent_wnd; hComctl32 = GetModuleHandleA("comctl32.dll"); pInitCommonControlsEx = (void*)GetProcAddress(hComctl32, "InitCommonControlsEx"); @@ -1153,39 +1510,20 @@ START_TEST(monthcal) parent_wnd = create_parent_window(); - flush_sequences(sequences, NUM_MSG_SEQUENCES); - hwnd = create_monthcal_control(WS_CHILD | WS_BORDER | WS_VISIBLE, parent_wnd); - assert(hwnd); - ok_sequence(sequences, PARENT_SEQ_INDEX, create_monthcal_control_seq, "create monthcal control", TRUE); - - SendMessage(hwnd, WM_SETFONT, (WPARAM)GetStockObject(SYSTEM_FONT), 0); - - test_monthcal_color(hwnd); - test_monthcal_currDate(hwnd); - test_monthcal_firstDay(hwnd); - test_monthcal_unicode(hwnd); - test_monthcal_today(hwnd); - test_monthcal_scroll(hwnd); - test_monthcal_monthrange(hwnd); - test_monthcal_HitTest(hwnd); - test_monthcal_todaylink(hwnd); - test_monthcal_size(hwnd); - - flush_sequences(sequences, NUM_MSG_SEQUENCES); - DestroyWindow(hwnd); - ok_sequence(sequences, PARENT_SEQ_INDEX, destroy_monthcal_parent_msgs_seq, "Destroy monthcal (parent msg)", FALSE); - ok_sequence(sequences, MONTHCAL_SEQ_INDEX, destroy_monthcal_child_msgs_seq, "Destroy monthcal (child msg)", FALSE); - - flush_sequences(sequences, NUM_MSG_SEQUENCES); - hwnd = create_monthcal_control(MCS_MULTISELECT, parent_wnd); - assert(hwnd); - ok_sequence(sequences, PARENT_SEQ_INDEX, create_monthcal_multi_sel_style_seq, "create monthcal (multi sel style)", TRUE); - - test_monthcal_MaxSelDay(hwnd); - - flush_sequences(sequences, NUM_MSG_SEQUENCES); - DestroyWindow(hwnd); - ok_sequence(sequences, MONTHCAL_SEQ_INDEX, destroy_monthcal_multi_sel_style_seq, "Destroy monthcal (multi sel style)", FALSE); + test_monthcal_create(); + test_monthcal_destroy(); + test_monthcal_color(); + test_monthcal_currdate(); + test_monthcal_firstDay(); + test_monthcal_unicode(); + test_monthcal_today(); + test_monthcal_scroll(); + test_monthcal_monthrange(); + test_monthcal_hittest(); + test_monthcal_todaylink(); + test_monthcal_size(); + test_monthcal_maxselday(); + test_monthcal_getselrange(); flush_sequences(sequences, NUM_MSG_SEQUENCES); DestroyWindow(parent_wnd); diff --git a/dlls/comctl32/tests/toolbar.c b/dlls/comctl32/tests/toolbar.c index 86e902788c9..d0a444e69dc 100644 --- a/dlls/comctl32/tests/toolbar.c +++ b/dlls/comctl32/tests/toolbar.c @@ -740,6 +740,22 @@ static tbsize_result_t tbsize_results[] = static int tbsize_numtests = 0; +typedef struct +{ + int test_num; + int rect_index; + RECT rcButton; +} tbsize_alt_result_t; + +static tbsize_alt_result_t tbsize_alt_results[] = +{ + { 5, 2, { 0, 24, 8, 29 } }, + { 20, 1, { 100, 2, 107, 102 } }, + { 20, 2, { 107, 2, 207, 102 } } +}; + +static int tbsize_alt_numtests = 0; + #define check_sizes_todo(todomask) { \ RECT rc; \ int buttonCount, i, mask=(todomask); \ @@ -751,7 +767,11 @@ static int tbsize_numtests = 0; compare(buttonCount, res->nButtons, "%d"); \ for (i=0; inButtons); i++) { \ ok(SendMessageA(hToolbar, TB_GETITEMRECT, i, (LPARAM)&rc) == 1, "TB_GETITEMRECT\n"); \ - if (!(mask&1)) { \ + if (broken(tbsize_alt_numtests < sizeof(tbsize_alt_results)/sizeof(tbsize_alt_results[0]) && \ + memcmp(&rc, &tbsize_alt_results[tbsize_alt_numtests].rcButton, sizeof(RECT)) == 0)) { \ + win_skip("Alternate rect found\n"); \ + tbsize_alt_numtests++; \ + } else if (!(mask&1)) { \ check_rect("button", rc, res->rcButtons[i]); \ } else {\ todo_wine { check_rect("button", rc, res->rcButtons[i]); } \ diff --git a/dlls/comctl32/tests/updown.c b/dlls/comctl32/tests/updown.c index 8797b9f8886..253e9599823 100644 --- a/dlls/comctl32/tests/updown.c +++ b/dlls/comctl32/tests/updown.c @@ -393,7 +393,15 @@ static void test_updown_pos32(void) /* Set the position to 0 to 1000 */ SendMessage(updown, UDM_SETRANGE32, 0 , 1000 ); + low = high = -1; r = SendMessage(updown, UDM_GETRANGE32, (WPARAM) &low , (LPARAM) &high ); + if (low == -1) + { + win_skip("UDM_SETRANGE32/UDM_GETRANGE32 not available\n"); + DestroyWindow(updown); + return; + } + expect(0,low); expect(1000,high); @@ -402,6 +410,7 @@ static void test_updown_pos32(void) if (!r) { win_skip("UDM_SETPOS32 and UDM_GETPOS32 need 5.80\n"); + DestroyWindow(updown); return; } expect(50,r); @@ -548,6 +557,12 @@ static void test_updown_unicode(void) r = SendMessage(updown, UDM_SETUNICODEFORMAT, 1 , 0); expect(0,r); r = SendMessage(updown, UDM_GETUNICODEFORMAT, 0 , 0); + if (!r) + { + win_skip("UDM_SETUNICODEFORMAT not available\n"); + DestroyWindow(updown); + return; + } expect(1,r); /* And now set it back to ANSI */ diff --git a/dlls/comdlg32/filedlg31.c b/dlls/comdlg32/filedlg31.c index 3e431782d21..4fab38ffc7d 100644 --- a/dlls/comdlg32/filedlg31.c +++ b/dlls/comdlg32/filedlg31.c @@ -251,7 +251,7 @@ LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam, SetBkColor( lpdis->hDC, oldBk ); SetTextColor( lpdis->hDC, oldText ); } - DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hFolder); + DrawIconEx( lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hFolder, 16, 16, 0, 0, DI_NORMAL ); HeapFree(GetProcessHeap(), 0, str); return TRUE; } @@ -285,7 +285,7 @@ LONG FD31_WMDrawItem(HWND hWnd, WPARAM wParam, LPARAM lParam, SetBkColor( lpdis->hDC, oldBk ); SetTextColor( lpdis->hDC, oldText ); } - DrawIcon(lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hIcon); + DrawIconEx( lpdis->hDC, lpdis->rcItem.left, lpdis->rcItem.top, hIcon, 16, 16, 0, 0, DI_NORMAL ); HeapFree(GetProcessHeap(), 0, str); return TRUE; } diff --git a/dlls/d3d10/d3d10_private.h b/dlls/d3d10/d3d10_private.h index 2d664cbf1cb..839624be80b 100644 --- a/dlls/d3d10/d3d10_private.h +++ b/dlls/d3d10/d3d10_private.h @@ -72,6 +72,7 @@ struct d3d10_effect_type DWORD id; struct wine_rb_entry entry; + struct d3d10_effect *effect; char *name; DWORD element_count; @@ -83,6 +84,15 @@ struct d3d10_effect_type DWORD row_count; D3D10_SHADER_VARIABLE_TYPE basetype; D3D10_SHADER_VARIABLE_CLASS type_class; + struct d3d10_effect_type_member *members; +}; + +struct d3d10_effect_type_member +{ + char *name; + char *semantic; + DWORD buffer_offset; + struct d3d10_effect_type *type; }; /* ID3D10EffectVariable */ @@ -90,7 +100,7 @@ struct d3d10_effect_variable { const struct ID3D10EffectVariableVtbl *vtbl; - struct d3d10_effect_local_buffer *buffer; + struct d3d10_effect_variable *buffer; struct d3d10_effect *effect; char *name; @@ -98,20 +108,9 @@ struct d3d10_effect_variable DWORD buffer_offset; DWORD annotation_count; DWORD flag; - struct d3d10_effect_type *type; - struct d3d10_effect_variable *annotations; -}; - -struct d3d10_effect_local_buffer -{ - const struct ID3D10EffectConstantBufferVtbl *vtbl; - - struct d3d10_effect *effect; - char *name; DWORD data_size; - DWORD variable_count; - DWORD annotation_count; - struct d3d10_effect_variable *variables; + struct d3d10_effect_type *type; + struct d3d10_effect_variable *members; struct d3d10_effect_variable *annotations; }; @@ -169,7 +168,7 @@ struct d3d10_effect DWORD shader_compile_count; struct wine_rb_tree types; - struct d3d10_effect_local_buffer *local_buffers; + struct d3d10_effect_variable *local_buffers; struct d3d10_effect_technique *techniques; }; diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index d1bd7ee2da4..b41daebe06d 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -57,16 +57,24 @@ static struct d3d10_effect_technique null_technique = {&d3d10_effect_technique_vtbl, NULL, NULL, 0, 0, NULL, NULL}; static struct d3d10_effect_pass null_pass = {&d3d10_effect_pass_vtbl, NULL, NULL, 0, 0, 0, NULL, NULL}; -static struct d3d10_effect_local_buffer null_local_buffer = - {&d3d10_effect_constant_buffer_vtbl, NULL, NULL, 0, 0, 0, NULL, NULL}; +static struct d3d10_effect_type null_type = + {&d3d10_effect_type_vtbl, 0, {NULL, NULL, 0}, NULL, NULL, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL}; +static struct d3d10_effect_variable null_local_buffer = + {(ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl, + NULL, NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL}; static struct d3d10_effect_variable null_variable = - {&d3d10_effect_variable_vtbl, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL}; + {&d3d10_effect_variable_vtbl, NULL, NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL}; static struct d3d10_effect_variable null_scalar_variable = - {(ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL}; + {(ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl, + NULL, NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL}; static struct d3d10_effect_variable null_vector_variable = - {(ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL}; + {(ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl, + NULL, NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL}; static struct d3d10_effect_variable null_matrix_variable = - {(ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl, NULL, NULL, NULL, NULL, 0, 0, 0, NULL, NULL}; + {(ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl, + NULL, NULL, NULL, NULL, 0, 0, 0, 0, &null_type, NULL, NULL}; + +static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, const char *data, DWORD offset); static inline void read_dword(const char **ptr, DWORD *d) { @@ -154,8 +162,10 @@ static BOOL copy_name(const char *ptr, char **name) { size_t name_len; + if (!ptr) return TRUE; + name_len = strlen(ptr) + 1; - if( name_len == 1 ) + if (name_len == 1) { return TRUE; } @@ -355,7 +365,6 @@ static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, con else if (unknown0 == 3) { unsigned int i; - DWORD tmp; TRACE("Type is a structure.\n"); @@ -367,20 +376,49 @@ static HRESULT parse_fx10_type(struct d3d10_effect_type *t, const char *ptr, con t->basetype = 0; t->type_class = D3D10_SVC_STRUCT; + t->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, t->member_count * sizeof(*t->members)); + if (!t->members) + { + ERR("Failed to allocate members memory.\n"); + return E_OUTOFMEMORY; + } + for (i = 0; i < t->member_count; ++i) { - read_dword(&ptr, &tmp); - TRACE("Member %u name at offset %#x.\n", i, tmp); - TRACE("Member %u name: %s.\n", i, debugstr_a(data + tmp)); + struct d3d10_effect_type_member *typem = &t->members[i]; - /* Member semantic? */ - skip_dword_unknown(&ptr, 1); + read_dword(&ptr, &offset); + TRACE("Member name at offset %#x.\n", offset); - read_dword(&ptr, &tmp); - TRACE("Member %u offset in struct: %#x.\n", i, tmp); + if (!copy_name(data + offset, &typem->name)) + { + ERR("Failed to copy name.\n"); + return E_OUTOFMEMORY; + } + TRACE("Member name: %s.\n", debugstr_a(typem->name)); + + read_dword(&ptr, &offset); + TRACE("Member semantic at offset %#x.\n", offset); - read_dword(&ptr, &tmp); - TRACE("Member %u type info at offset %#x.\n", i, tmp); + if (!copy_name(data + offset, &typem->semantic)) + { + ERR("Failed to copy semantic.\n"); + return E_OUTOFMEMORY; + } + TRACE("Member semantic: %s.\n", debugstr_a(typem->semantic)); + + read_dword(&ptr, &typem->buffer_offset); + TRACE("Member offset in struct: %#x.\n", typem->buffer_offset); + + read_dword(&ptr, &offset); + TRACE("Member type info at offset %#x.\n", offset); + + typem->type = get_fx10_type(t->effect, data, offset); + if (!typem->type) + { + ERR("Failed to get variable type.\n"); + return E_FAIL; + } } } @@ -409,6 +447,7 @@ static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, cons type->vtbl = &d3d10_effect_type_vtbl; type->id = offset; + type->effect = effect; hr = parse_fx10_type(type, data + offset, data); if (FAILED(hr)) { @@ -427,6 +466,78 @@ static struct d3d10_effect_type *get_fx10_type(struct d3d10_effect *effect, cons return type; } +static void set_variable_vtbl(struct d3d10_effect_variable *v) +{ + switch (v->type->type_class) + { + case D3D10_SVC_SCALAR: + v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl; + break; + + case D3D10_SVC_VECTOR: + v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl; + break; + + case D3D10_SVC_MATRIX_ROWS: + case D3D10_SVC_MATRIX_COLUMNS: + v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl; + break; + + default: + FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class)); + v->vtbl = &d3d10_effect_variable_vtbl; + break; + } +} + +static HRESULT copy_variableinfo_from_type(struct d3d10_effect_variable *v) +{ + unsigned int i; + + if (v->type->member_count == 0) return S_OK; + + v->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, v->type->member_count * sizeof(*v->members)); + if (!v->members) + { + ERR("Failed to allocate members memory.\n"); + return E_OUTOFMEMORY; + } + + for (i = 0; i < v->type->member_count; ++i) + { + struct d3d10_effect_variable *var = &v->members[i]; + struct d3d10_effect_type_member *typem = &v->type->members[i]; + HRESULT hr; + + var->buffer = v; + var->effect = v->effect; + var->type = typem->type; + set_variable_vtbl(var); + + if (!copy_name(typem->name, &var->name)) + { + ERR("Failed to copy name.\n"); + return E_OUTOFMEMORY; + } + TRACE("Variable name: %s.\n", debugstr_a(var->name)); + + if (!copy_name(typem->semantic, &var->semantic)) + { + ERR("Failed to copy name.\n"); + return E_OUTOFMEMORY; + } + TRACE("Variable semantic: %s.\n", debugstr_a(var->semantic)); + + var->buffer_offset = typem->buffer_offset; + TRACE("Variable buffer offset: %u.\n", var->buffer_offset); + + hr = copy_variableinfo_from_type(var); + if (FAILED(hr)) return hr; + } + + return S_OK; +} + static HRESULT parse_fx10_variable_head(struct d3d10_effect_variable *v, const char **ptr, const char *data) { DWORD offset; @@ -450,29 +561,9 @@ static HRESULT parse_fx10_variable_head(struct d3d10_effect_variable *v, const c ERR("Failed to get variable type.\n"); return E_FAIL; } + set_variable_vtbl(v); - switch (v->type->type_class) - { - case D3D10_SVC_SCALAR: - v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_scalar_variable_vtbl; - break; - - case D3D10_SVC_VECTOR: - v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_vector_variable_vtbl; - break; - - case D3D10_SVC_MATRIX_ROWS: - case D3D10_SVC_MATRIX_COLUMNS: - v->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_matrix_variable_vtbl; - break; - - default: - FIXME("Unhandled type class %s.\n", debug_d3d10_shader_variable_class(v->type->type_class)); - v->vtbl = &d3d10_effect_variable_vtbl; - break; - } - - return S_OK; + return copy_variableinfo_from_type(v); } static HRESULT parse_fx10_annotation(struct d3d10_effect_variable *a, const char **ptr, const char *data) @@ -699,10 +790,9 @@ static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char * return E_OUTOFMEMORY; } - for(i = 0; i < v->annotation_count; ++i) + for (i = 0; i < v->annotation_count; ++i) { struct d3d10_effect_variable *a = &v->annotations[i]; - HRESULT hr; a->effect = v->effect; @@ -713,12 +803,24 @@ static HRESULT parse_fx10_variable(struct d3d10_effect_variable *v, const char * return S_OK; } -static HRESULT parse_fx10_local_buffer(struct d3d10_effect_local_buffer *l, const char **ptr, const char *data) +static HRESULT parse_fx10_local_buffer(struct d3d10_effect_variable *l, const char **ptr, const char *data) { unsigned int i; DWORD offset; + D3D10_CBUFFER_TYPE d3d10_cbuffer_type; HRESULT hr; + /* Generate our own type, it isn't in the fx blob. */ + l->type = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*l->type)); + if (!l->type) + { + ERR("Failed to allocate local buffer type memory.\n"); + return E_OUTOFMEMORY; + } + l->type->vtbl = &d3d10_effect_type_vtbl; + l->type->type_class = D3D10_SVC_OBJECT; + l->type->effect = l->effect; + read_dword(ptr, &offset); TRACE("Local buffer name at offset %#x.\n", offset); @@ -732,10 +834,36 @@ static HRESULT parse_fx10_local_buffer(struct d3d10_effect_local_buffer *l, cons read_dword(ptr, &l->data_size); TRACE("Local buffer data size: %#x.\n", l->data_size); - skip_dword_unknown(ptr, 1); + read_dword(ptr, &d3d10_cbuffer_type); + TRACE("Local buffer type: %#x.\n", d3d10_cbuffer_type); - read_dword(ptr, &l->variable_count); - TRACE("Local buffer variable count: %#x.\n", l->variable_count); + switch(d3d10_cbuffer_type) + { + case D3D10_CT_CBUFFER: + l->type->basetype = D3D10_SVT_CBUFFER; + if (!copy_name("cbuffer", &l->type->name)) + { + ERR("Failed to copy name.\n"); + return E_OUTOFMEMORY; + } + break; + + case D3D10_CT_TBUFFER: + l->type->basetype = D3D10_SVT_TBUFFER; + if (!copy_name("tbuffer", &l->type->name)) + { + ERR("Failed to copy name.\n"); + return E_OUTOFMEMORY; + } + break; + + default: + ERR("Unexpected D3D10_CBUFFER_TYPE %#x!\n", d3d10_cbuffer_type); + return E_FAIL; + } + + read_dword(ptr, &l->type->member_count); + TRACE("Local buffer member count: %#x.\n", l->type->member_count); skip_dword_unknown(ptr, 1); @@ -759,23 +887,68 @@ static HRESULT parse_fx10_local_buffer(struct d3d10_effect_local_buffer *l, cons if (FAILED(hr)) return hr; } - l->variables = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->variable_count * sizeof(*l->variables)); - if (!l->variables) + l->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->members)); + if (!l->members) + { + ERR("Failed to allocate members memory.\n"); + return E_OUTOFMEMORY; + } + + l->type->members = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, l->type->member_count * sizeof(*l->type->members)); + if (!l->type->members) { - ERR("Failed to allocate variables memory.\n"); + ERR("Failed to allocate type members memory.\n"); return E_OUTOFMEMORY; } - for (i = 0; i < l->variable_count; ++i) + for (i = 0; i < l->type->member_count; ++i) { - struct d3d10_effect_variable *v = &l->variables[i]; + struct d3d10_effect_variable *v = &l->members[i]; + struct d3d10_effect_type_member *typem = &l->type->members[i]; v->buffer = l; v->effect = l->effect; hr = parse_fx10_variable(v, ptr, data); if (FAILED(hr)) return hr; + + /* + * Copy the values from the variable type to the constant buffers type + * members structure, because it is our own generated type. + */ + typem->type = v->type; + + if (!copy_name(v->name, &typem->name)) + { + ERR("Failed to copy name.\n"); + return E_OUTOFMEMORY; + } + TRACE("Variable name: %s.\n", debugstr_a(typem->name)); + + if (!copy_name(v->semantic, &typem->semantic)) + { + ERR("Failed to copy name.\n"); + return E_OUTOFMEMORY; + } + TRACE("Variable semantic: %s.\n", debugstr_a(typem->semantic)); + + typem->buffer_offset = v->buffer_offset; + TRACE("Variable buffer offset: %u.\n", typem->buffer_offset); + + l->type->size_packed += v->type->size_packed; + l->type->size_unpacked += v->type->size_unpacked; } + l->type->stride = l->type->size_unpacked = (l->type->size_unpacked + 0xf) & ~0xf; + + TRACE("Constant buffer:\n"); + TRACE("\tType name: %s.\n", debugstr_a(l->type->name)); + TRACE("\tElement count: %u.\n", l->type->element_count); + TRACE("\tMember count: %u.\n", l->type->member_count); + TRACE("\tUnpacked size: %#x.\n", l->type->size_unpacked); + TRACE("\tStride: %#x.\n", l->type->stride); + TRACE("\tPacked size %#x.\n", l->type->size_packed); + TRACE("\tBasetype: %s.\n", debug_d3d10_shader_variable_type(l->type->basetype)); + TRACE("\tTypeclass: %s.\n", debug_d3d10_shader_variable_class(l->type->type_class)); return S_OK; } @@ -788,12 +961,32 @@ static int d3d10_effect_type_compare(const void *key, const struct wine_rb_entry return *id - t->id; } +static void d3d10_effect_type_member_destroy(struct d3d10_effect_type_member *typem) +{ + TRACE("effect type member %p.\n", typem); + + /* Do not release typem->type, it will be covered by d3d10_effect_type_destroy(). */ + HeapFree(GetProcessHeap(), 0, typem->semantic); + HeapFree(GetProcessHeap(), 0, typem->name); +} + static void d3d10_effect_type_destroy(struct wine_rb_entry *entry, void *context) { struct d3d10_effect_type *t = WINE_RB_ENTRY_VALUE(entry, struct d3d10_effect_type, entry); TRACE("effect type %p.\n", t); + if (t->members) + { + unsigned int i; + + for (i = 0; i < t->member_count; ++i) + { + d3d10_effect_type_member_destroy(&t->members[i]); + } + HeapFree(GetProcessHeap(), 0, t->members); + } + HeapFree(GetProcessHeap(), 0, t->name); HeapFree(GetProcessHeap(), 0, t); } @@ -834,8 +1027,8 @@ static HRESULT parse_fx10_body(struct d3d10_effect *e, const char *data, DWORD d for (i = 0; i < e->local_buffer_count; ++i) { - struct d3d10_effect_local_buffer *l = &e->local_buffers[i]; - l->vtbl = &d3d10_effect_constant_buffer_vtbl; + struct d3d10_effect_variable *l = &e->local_buffers[i]; + l->vtbl = (ID3D10EffectVariableVtbl *)&d3d10_effect_constant_buffer_vtbl; l->effect = e; hr = parse_fx10_local_buffer(l, &ptr, data); @@ -993,19 +1186,29 @@ static HRESULT d3d10_effect_object_apply(struct d3d10_effect_object *o) static void d3d10_effect_variable_destroy(struct d3d10_effect_variable *v) { + unsigned int i; + TRACE("variable %p.\n", v); HeapFree(GetProcessHeap(), 0, v->name); HeapFree(GetProcessHeap(), 0, v->semantic); if (v->annotations) { - unsigned int i; for (i = 0; i < v->annotation_count; ++i) { d3d10_effect_variable_destroy(&v->annotations[i]); } HeapFree(GetProcessHeap(), 0, v->annotations); } + + if (v->members) + { + for (i = 0; i < v->type->member_count; ++i) + { + d3d10_effect_variable_destroy(&v->members[i]); + } + HeapFree(GetProcessHeap(), 0, v->members); + } } static void d3d10_effect_pass_destroy(struct d3d10_effect_pass *p) @@ -1061,21 +1264,34 @@ static void d3d10_effect_technique_destroy(struct d3d10_effect_technique *t) } } -static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_local_buffer *l) +static void d3d10_effect_local_buffer_destroy(struct d3d10_effect_variable *l) { unsigned int i; TRACE("local buffer %p.\n", l); HeapFree(GetProcessHeap(), 0, l->name); - if (l->variables) + if (l->members) + { + for (i = 0; i < l->type->member_count; ++i) + { + d3d10_effect_variable_destroy(&l->members[i]); + } + HeapFree(GetProcessHeap(), 0, l->members); + } + + if (l->type->members) { - for (i = 0; i < l->variable_count; ++i) + for (i = 0; i < l->type->member_count; ++i) { - d3d10_effect_variable_destroy(&l->variables[i]); + /* Do not release l->type->members[i].type, it will be covered by d3d10_effect_type_destroy(). */ + HeapFree(GetProcessHeap(), 0, l->type->members[i].semantic); + HeapFree(GetProcessHeap(), 0, l->type->members[i].name); } - HeapFree(GetProcessHeap(), 0, l->variables); + HeapFree(GetProcessHeap(), 0, l->type->members); } + HeapFree(GetProcessHeap(), 0, l->type->name); + HeapFree(GetProcessHeap(), 0, l->type); if (l->annotations) { @@ -1194,7 +1410,7 @@ static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetCon UINT index) { struct d3d10_effect *This = (struct d3d10_effect *)iface; - struct d3d10_effect_local_buffer *l; + struct d3d10_effect_variable *l; TRACE("iface %p, index %u\n", iface, index); @@ -1221,7 +1437,7 @@ static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_GetCon for (i = 0; i < This->local_buffer_count; ++i) { - struct d3d10_effect_local_buffer *l = &This->local_buffers[i]; + struct d3d10_effect_variable *l = &This->local_buffers[i]; if (!strcmp(l->name, name)) { @@ -1251,12 +1467,12 @@ static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_GetVariableB for (i = 0; i < This->local_buffer_count; ++i) { - struct d3d10_effect_local_buffer *l = &This->local_buffers[i]; + struct d3d10_effect_variable *l = &This->local_buffers[i]; unsigned int j; - for (j = 0; j < l->variable_count; ++j) + for (j = 0; j < l->type->member_count; ++j) { - struct d3d10_effect_variable *v = &l->variables[j]; + struct d3d10_effect_variable *v = &l->members[j]; if (!strcmp(v->name, name)) { @@ -1759,25 +1975,88 @@ static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_Get static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByIndex( ID3D10EffectVariable *iface, UINT index) { - FIXME("iface %p, index %u stub!\n", iface, index); + struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface; + struct d3d10_effect_variable *m; - return NULL; + TRACE("iface %p, index %u\n", iface, index); + + if (index >= This->type->member_count) + { + WARN("Invalid index specified\n"); + return (ID3D10EffectVariable *)&null_variable; + } + + m = &This->members[index]; + + TRACE("Returning member %p, %s\n", m, debugstr_a(m->name)); + + return (ID3D10EffectVariable *)m; } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberByName( ID3D10EffectVariable *iface, LPCSTR name) { - FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); + struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface; + unsigned int i; - return NULL; + TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); + + if (!name) + { + WARN("Invalid name specified\n"); + return (ID3D10EffectVariable *)&null_variable; + } + + for (i = 0; i < This->type->member_count; ++i) + { + struct d3d10_effect_variable *m = &This->members[i]; + + if (m->name) + { + if (!strcmp(m->name, name)) + { + TRACE("Returning member %p\n", m); + return (ID3D10EffectVariable *)m; + } + } + } + + WARN("Invalid name specified\n"); + + return (ID3D10EffectVariable *)&null_variable; } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetMemberBySemantic( ID3D10EffectVariable *iface, LPCSTR semantic) { - FIXME("iface %p, semantic %s stub!\n", iface, debugstr_a(semantic)); + struct d3d10_effect_variable *This = (struct d3d10_effect_variable *)iface; + unsigned int i; - return NULL; + TRACE("iface %p, semantic %s.\n", iface, debugstr_a(semantic)); + + if (!semantic) + { + WARN("Invalid semantic specified\n"); + return (ID3D10EffectVariable *)&null_variable; + } + + for (i = 0; i < This->type->member_count; ++i) + { + struct d3d10_effect_variable *m = &This->members[i]; + + if (m->semantic) + { + if (!strcmp(m->semantic, semantic)) + { + TRACE("Returning member %p\n", m); + return (ID3D10EffectVariable *)m; + } + } + } + + WARN("Invalid semantic specified\n"); + + return (ID3D10EffectVariable *)&null_variable; } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_variable_GetElement( @@ -1965,225 +2244,149 @@ static BOOL STDMETHODCALLTYPE d3d10_effect_constant_buffer_IsValid(ID3D10EffectC { TRACE("iface %p\n", iface); - return (struct d3d10_effect_local_buffer *)iface != &null_local_buffer; + return (struct d3d10_effect_variable *)iface != &null_local_buffer; } static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetType(ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_GetType((ID3D10EffectVariable *)iface); } static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetDesc(ID3D10EffectConstantBuffer *iface, D3D10_EFFECT_VARIABLE_DESC *desc) { - FIXME("iface %p, desc %p stub!\n", iface, desc); - - return E_NOTIMPL; + return d3d10_effect_variable_GetDesc((ID3D10EffectVariable *)iface, desc); } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByIndex( ID3D10EffectConstantBuffer *iface, UINT index) { - struct d3d10_effect_local_buffer *This = (struct d3d10_effect_local_buffer *)iface; - struct d3d10_effect_variable *a; - - TRACE("iface %p, index %u\n", iface, index); - - if (index >= This->annotation_count) - { - WARN("Invalid index specified\n"); - return (ID3D10EffectVariable *)&null_variable; - } - - a = &This->annotations[index]; - - TRACE("Returning annotation %p, %s\n", a, debugstr_a(a->name)); - - return (ID3D10EffectVariable *)a; + return d3d10_effect_variable_GetAnnotationByIndex((ID3D10EffectVariable *)iface, index); } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetAnnotationByName( ID3D10EffectConstantBuffer *iface, LPCSTR name) { - struct d3d10_effect_local_buffer *This = (struct d3d10_effect_local_buffer *)iface; - unsigned int i; - - TRACE("iface %p, name %s.\n", iface, debugstr_a(name)); - - for (i = 0; i < This->annotation_count; ++i) - { - struct d3d10_effect_variable *a = &This->annotations[i]; - if (!strcmp(a->name, name)) - { - TRACE("Returning annotation %p\n", a); - return (ID3D10EffectVariable *)a; - } - } - - WARN("Invalid name specified\n"); - - return (ID3D10EffectVariable *)&null_variable; + return d3d10_effect_variable_GetAnnotationByName((ID3D10EffectVariable *)iface, name); } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByIndex( ID3D10EffectConstantBuffer *iface, UINT index) { - FIXME("iface %p, index %u stub!\n", iface, index); - - return NULL; + return d3d10_effect_variable_GetMemberByIndex((ID3D10EffectVariable *)iface, index); } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberByName( ID3D10EffectConstantBuffer *iface, LPCSTR name) { - FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); - - return NULL; + return d3d10_effect_variable_GetMemberByName((ID3D10EffectVariable *)iface, name); } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetMemberBySemantic( ID3D10EffectConstantBuffer *iface, LPCSTR semantic) { - FIXME("iface %p, semantic %s stub!\n", iface, debugstr_a(semantic)); - - return NULL; + return d3d10_effect_variable_GetMemberBySemantic((ID3D10EffectVariable *)iface, semantic); } static struct ID3D10EffectVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetElement( ID3D10EffectConstantBuffer *iface, UINT index) { - FIXME("iface %p, index %u stub!\n", iface, index); - - return NULL; + return d3d10_effect_variable_GetElement((ID3D10EffectVariable *)iface, index); } static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetParentConstantBuffer( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_GetParentConstantBuffer((ID3D10EffectVariable *)iface); } static struct ID3D10EffectScalarVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsScalar( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsScalar((ID3D10EffectVariable *)iface); } static struct ID3D10EffectVectorVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsVector( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsVector((ID3D10EffectVariable *)iface); } static struct ID3D10EffectMatrixVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsMatrix( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsMatrix((ID3D10EffectVariable *)iface); } static struct ID3D10EffectStringVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsString( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsString((ID3D10EffectVariable *)iface); } static struct ID3D10EffectShaderResourceVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShaderResource( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsShaderResource((ID3D10EffectVariable *)iface); } static struct ID3D10EffectRenderTargetViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRenderTargetView( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsRenderTargetView((ID3D10EffectVariable *)iface); } static struct ID3D10EffectDepthStencilViewVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencilView( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsDepthStencilView((ID3D10EffectVariable *)iface); } static struct ID3D10EffectConstantBuffer * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsConstantBuffer( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsConstantBuffer((ID3D10EffectVariable *)iface); } static struct ID3D10EffectShaderVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsShader( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsShader((ID3D10EffectVariable *)iface); } static struct ID3D10EffectBlendVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsBlend(ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsBlend((ID3D10EffectVariable *)iface); } static struct ID3D10EffectDepthStencilVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsDepthStencil( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsDepthStencil((ID3D10EffectVariable *)iface); } static struct ID3D10EffectRasterizerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsRasterizer( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsRasterizer((ID3D10EffectVariable *)iface); } static struct ID3D10EffectSamplerVariable * STDMETHODCALLTYPE d3d10_effect_constant_buffer_AsSampler( ID3D10EffectConstantBuffer *iface) { - FIXME("iface %p stub!\n", iface); - - return NULL; + return d3d10_effect_variable_AsSampler((ID3D10EffectVariable *)iface); } static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_SetRawValue(ID3D10EffectConstantBuffer *iface, void *data, UINT offset, UINT count) { - FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count); - - return E_NOTIMPL; + return d3d10_effect_variable_SetRawValue((ID3D10EffectVariable *)iface, data, offset, count); } static HRESULT STDMETHODCALLTYPE d3d10_effect_constant_buffer_GetRawValue(ID3D10EffectConstantBuffer *iface, void *data, UINT offset, UINT count) { - FIXME("iface %p, data %p, offset %u, count %u stub!\n", iface, data, offset, count); - - return E_NOTIMPL; + return d3d10_effect_variable_GetRawValue((ID3D10EffectVariable *)iface, data, offset, count); } /* ID3D10EffectConstantBuffer methods */ @@ -3114,7 +3317,17 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *ifa TRACE("iface %p, desc %p\n", iface, desc); - if (!desc) return E_INVALIDARG; + if (This == &null_type) + { + WARN("Null type specified\n"); + return E_FAIL; + } + + if (!desc) + { + WARN("Invalid argument specified\n"); + return E_INVALIDARG; + } desc->TypeName = This->name; desc->Class = This->type_class; @@ -3133,39 +3346,128 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_type_GetDesc(ID3D10EffectType *ifa static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByIndex(ID3D10EffectType *iface, UINT index) { - FIXME("iface %p, index %u stub!\n", iface, index); + struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface; + struct d3d10_effect_type *t; - return NULL; + TRACE("iface %p, index %u\n", iface, index); + + if (index >= This->member_count) + { + WARN("Invalid index specified\n"); + return (ID3D10EffectType *)&null_type; + } + + t = (&This->members[index])->type; + + TRACE("Returning member %p, %s\n", t, debugstr_a(t->name)); + + return (ID3D10EffectType *)t; } static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeByName(ID3D10EffectType *iface, LPCSTR name) { - FIXME("iface %p, name %s stub!\n", iface, debugstr_a(name)); + struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface; + unsigned int i; - return NULL; + TRACE("iface %p, name %s\n", iface, debugstr_a(name)); + + if (!name) + { + WARN("Invalid name specified\n"); + return (ID3D10EffectType *)&null_type; + } + + for (i = 0; i < This->member_count; ++i) + { + struct d3d10_effect_type_member *typem = &This->members[i]; + + if (typem->name) + { + if (!strcmp(typem->name, name)) + { + TRACE("Returning type %p.\n", typem->type); + return (ID3D10EffectType *)typem->type; + } + } + } + + WARN("Invalid name specified\n"); + + return (ID3D10EffectType *)&null_type; } static struct ID3D10EffectType * STDMETHODCALLTYPE d3d10_effect_type_GetMemberTypeBySemantic(ID3D10EffectType *iface, LPCSTR semantic) { - FIXME("iface %p, semantic %s stub!\n", iface, debugstr_a(semantic)); + struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface; + unsigned int i; - return NULL; + TRACE("iface %p, semantic %s\n", iface, debugstr_a(semantic)); + + if (!semantic) + { + WARN("Invalid semantic specified\n"); + return (ID3D10EffectType *)&null_type; + } + + for (i = 0; i < This->member_count; ++i) + { + struct d3d10_effect_type_member *typem = &This->members[i]; + + if (typem->semantic) + { + if (!strcmp(typem->semantic, semantic)) + { + TRACE("Returning type %p.\n", typem->type); + return (ID3D10EffectType *)typem->type; + } + } + } + + WARN("Invalid semantic specified\n"); + + return (ID3D10EffectType *)&null_type; } static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberName(ID3D10EffectType *iface, UINT index) { - FIXME("iface %p, index %u stub!\n", iface, index); + struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface; + struct d3d10_effect_type_member *typem; - return NULL; + TRACE("iface %p, index %u\n", iface, index); + + if (index >= This->member_count) + { + WARN("Invalid index specified\n"); + return NULL; + } + + typem = &This->members[index]; + + TRACE("Returning name %s\n", debugstr_a(typem->name)); + + return typem->name; } static LPCSTR STDMETHODCALLTYPE d3d10_effect_type_GetMemberSemantic(ID3D10EffectType *iface, UINT index) { - FIXME("iface %p, index %u stub!\n", iface, index); + struct d3d10_effect_type *This = (struct d3d10_effect_type *)iface; + struct d3d10_effect_type_member *typem; - return NULL; + TRACE("iface %p, index %u\n", iface, index); + + if (index >= This->member_count) + { + WARN("Invalid index specified\n"); + return NULL; + } + + typem = &This->members[index]; + + TRACE("Returning semantic %s\n", debugstr_a(typem->semantic)); + + return typem->semantic; } static const struct ID3D10EffectTypeVtbl d3d10_effect_type_vtbl = diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c index d3ec98c1330..24417df6cf3 100644 --- a/dlls/d3d8/cubetexture.c +++ b/dlls/d3d8/cubetexture.c @@ -64,12 +64,16 @@ static ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 ifa TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { + IDirect3DDevice8 *parentDevice = This->parentDevice; + TRACE("Releasing child %p\n", This->wineD3DCubeTexture); - IUnknown_Release(This->parentDevice); wined3d_mutex_lock(); IWineD3DCubeTexture_Release(This->wineD3DCubeTexture); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice8_Release(parentDevice); } return ref; } diff --git a/dlls/d3d8/indexbuffer.c b/dlls/d3d8/indexbuffer.c index 49391222663..bb62c39a376 100644 --- a/dlls/d3d8/indexbuffer.c +++ b/dlls/d3d8/indexbuffer.c @@ -64,10 +64,14 @@ static ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 ifa TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IDirect3DDevice8_Release(This->parentDevice); + IDirect3DDevice8 *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DBuffer_Release(This->wineD3DIndexBuffer); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice8_Release(parentDevice); } return ref; } diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index 2d00fce822c..8923dd8b7ef 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -79,11 +79,14 @@ static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) { TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - if (This->parentDevice) IUnknown_Release(This->parentDevice); + IDirect3DDevice8 *parentDevice = This->parentDevice; + /* Implicit surfaces are destroyed with the device, not if refcount reaches 0. */ wined3d_mutex_lock(); IWineD3DSurface_Release(This->wineD3DSurface); wined3d_mutex_unlock(); + + if (parentDevice) IDirect3DDevice8_Release(parentDevice); } return ref; diff --git a/dlls/d3d8/texture.c b/dlls/d3d8/texture.c index e377fffec69..000b07858dd 100644 --- a/dlls/d3d8/texture.c +++ b/dlls/d3d8/texture.c @@ -65,10 +65,14 @@ static ULONG WINAPI IDirect3DTexture8Impl_Release(LPDIRECT3DTEXTURE8 iface) { TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IDirect3DDevice8_Release(This->parentDevice); + IDirect3DDevice8 *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DTexture_Release(This->wineD3DTexture); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice8_Release(parentDevice); } return ref; } diff --git a/dlls/d3d8/vertexbuffer.c b/dlls/d3d8/vertexbuffer.c index 99e8304ecd2..a798afd829b 100644 --- a/dlls/d3d8/vertexbuffer.c +++ b/dlls/d3d8/vertexbuffer.c @@ -65,10 +65,14 @@ static ULONG WINAPI IDirect3DVertexBuffer8Impl_Release(LPDIRECT3DVERTEXBUFFER8 i TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IDirect3DDevice8_Release(This->parentDevice); + IDirect3DDevice8 *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DBuffer_Release(This->wineD3DVertexBuffer); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice8_Release(parentDevice); } return ref; diff --git a/dlls/d3d8/volumetexture.c b/dlls/d3d8/volumetexture.c index 46c1ec5af83..d31c1561e0d 100644 --- a/dlls/d3d8/volumetexture.c +++ b/dlls/d3d8/volumetexture.c @@ -65,10 +65,14 @@ static ULONG WINAPI IDirect3DVolumeTexture8Impl_Release(LPDIRECT3DVOLUMETEXTURE8 TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IUnknown_Release(This->parentDevice); + IDirect3DDevice8 *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice8_Release(parentDevice); } return ref; } diff --git a/dlls/d3d9/cubetexture.c b/dlls/d3d9/cubetexture.c index 4bab9dfd021..10336b51dd8 100644 --- a/dlls/d3d9/cubetexture.c +++ b/dlls/d3d9/cubetexture.c @@ -67,12 +67,16 @@ static ULONG WINAPI IDirect3DCubeTexture9Impl_Release(LPDIRECT3DCUBETEXTURE9 ifa TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { + IDirect3DDevice9Ex *parentDevice = This->parentDevice; + TRACE("Releasing child %p\n", This->wineD3DCubeTexture); - IDirect3DDevice9Ex_Release(This->parentDevice); wined3d_mutex_lock(); IWineD3DCubeTexture_Release(This->wineD3DCubeTexture); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice9Ex_Release(parentDevice); } return ref; } diff --git a/dlls/d3d9/indexbuffer.c b/dlls/d3d9/indexbuffer.c index e089beaddc0..2748abb9fd6 100644 --- a/dlls/d3d9/indexbuffer.c +++ b/dlls/d3d9/indexbuffer.c @@ -65,10 +65,14 @@ static ULONG WINAPI IDirect3DIndexBuffer9Impl_Release(LPDIRECT3DINDEXBUFFER9 ifa TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IDirect3DDevice9Ex_Release(This->parentDevice); + IDirect3DDevice9Ex *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DBuffer_Release(This->wineD3DIndexBuffer); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice9Ex_Release(parentDevice); } return ref; } diff --git a/dlls/d3d9/pixelshader.c b/dlls/d3d9/pixelshader.c index 547dc746496..1c4214212c0 100644 --- a/dlls/d3d9/pixelshader.c +++ b/dlls/d3d9/pixelshader.c @@ -64,10 +64,14 @@ static ULONG WINAPI IDirect3DPixelShader9Impl_Release(LPDIRECT3DPIXELSHADER9 ifa TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IDirect3DDevice9Ex_Release(This->parentDevice); + IDirect3DDevice9Ex *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DPixelShader_Release(This->wineD3DPixelShader); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice9Ex_Release(parentDevice); } return ref; } diff --git a/dlls/d3d9/surface.c b/dlls/d3d9/surface.c index f9b2794a25c..0c277b91634 100644 --- a/dlls/d3d9/surface.c +++ b/dlls/d3d9/surface.c @@ -82,10 +82,14 @@ static ULONG WINAPI IDirect3DSurface9Impl_Release(LPDIRECT3DSURFACE9 iface) { TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - if (This->parentDevice) IDirect3DDevice9Ex_Release(This->parentDevice); + IDirect3DDevice9Ex *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DSurface_Release(This->wineD3DSurface); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + if (parentDevice) IDirect3DDevice9Ex_Release(parentDevice); } return ref; diff --git a/dlls/d3d9/swapchain.c b/dlls/d3d9/swapchain.c index e63e3435b60..461db37fcd2 100644 --- a/dlls/d3d9/swapchain.c +++ b/dlls/d3d9/swapchain.c @@ -60,7 +60,8 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface) TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - if (This->parentDevice) IDirect3DDevice9Ex_Release(This->parentDevice); + IDirect3DDevice9Ex *parentDevice = This->parentDevice; + if (!This->isImplicit) { wined3d_mutex_lock(); IWineD3DSwapChain_Destroy(This->wineD3DSwapChain); @@ -68,6 +69,9 @@ static ULONG WINAPI IDirect3DSwapChain9Impl_Release(LPDIRECT3DSWAPCHAIN9 iface) HeapFree(GetProcessHeap(), 0, This); } + + /* Release the device last, as it may cause the device to be destroyed. */ + if (parentDevice) IDirect3DDevice9Ex_Release(parentDevice); } return ref; } diff --git a/dlls/d3d9/tests/surface.c b/dlls/d3d9/tests/surface.c index 638442e0620..69c85f0bca5 100644 --- a/dlls/d3d9/tests/surface.c +++ b/dlls/d3d9/tests/surface.c @@ -365,7 +365,7 @@ static void test_private_data(IDirect3DDevice9 *device) hr = IDirect3DSurface9_GetPrivateData(surface, &IID_IDirect3DSurface9, &ptr, &size); ok(hr == D3D_OK, "IDirect3DSurface9_GetPrivateData failed with %08x\n", hr); ref2 = getref((IUnknown *) device); - /* Object is NOT being addrefed */ + /* Object is addrefed */ ok(ptr == (IUnknown *) device, "Returned interface pointer is %p, expected %p\n", ptr, device); ok(ref2 == ref + 2, "Object reference is %d, expected %d. ptr at %p, orig at %p\n", ref2, ref + 2, ptr, device); IUnknown_Release(ptr); diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index b4f1dda415d..092cbe96879 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -10351,7 +10351,7 @@ static void sgn_test(IDirect3DDevice9 *device) { 0x05000051, 0xa00f0000, 0xbf000000, 0x00000000, 0x3f000000, 0x41400000, /* def c0, -0.5, 0.0, 0.5, 12.0 */ 0x05000051, 0xa00f0001, 0x3fc00000, 0x00000000, 0x00000000, 0x00000000, /* def c1, 1.5, 0.0, 0.0, 0.0 */ 0x02000001, 0xc00f0000, 0x90e40000, /* mov oPos, v0 */ - 0x02000022, 0x800f0000, 0xa0e40000, /* sgn r0, c0 */ + 0x04000022, 0x800f0000, 0xa0e40000, 0x80e40001, 0x80e40002, /* sgn r0, c0, r1, r2 */ 0x03000002, 0xd00f0000, 0x80e40000, 0xa0e40001, /* add oD0, r0, c1 */ 0x0000ffff /* end */ }; @@ -10395,6 +10395,76 @@ static void sgn_test(IDirect3DDevice9 *device) { IDirect3DVertexShader9_Release(shader); } +static void viewport_test(IDirect3DDevice9 *device) { + HRESULT hr; + DWORD color; + D3DVIEWPORT9 vp, old_vp; + const float quad[] = + { + -0.5, -0.5, 0.1, + 0.5, -0.5, 0.1, + -0.5, 0.5, 0.1, + 0.5, 0.5, 0.1 + }; + + memset(&old_vp, 0, sizeof(old_vp)); + hr = IDirect3DDevice9_GetViewport(device, &old_vp); + ok(hr == D3D_OK, "IDirect3DDevice9_GetViewport failed with %08x\n", hr); + + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0x00ff0000, 0.0, 0); + ok(hr == D3D_OK, "IDirect3DDevice9_Clear returned %08x\n", hr); + + /* Test a viewport with Width and Height bigger than the surface dimensions + * + * TODO: Test Width < surface.width, but X + Width > surface.width + * TODO: Test Width < surface.width, what happens with the height? + */ + memset(&vp, 0, sizeof(vp)); + vp.X = 0; + vp.Y = 0; + vp.Width = 10000; + vp.Height = 10000; + vp.MinZ = 0.0; + vp.MaxZ = 0.0; + hr = IDirect3DDevice9_SetViewport(device, &vp); + ok(hr == D3D_OK, "IDirect3DDevice9_SetViewport failed with %08x\n", hr); + + hr = IDirect3DDevice9_SetFVF(device, D3DFVF_XYZ); + ok(hr == D3D_OK, "IDirect3DDevice9_SetFVF returned %08x\n", hr); + hr = IDirect3DDevice9_BeginScene(device); + ok(hr == D3D_OK, "IDirect3DDevice9_BeginScene returned %08x\n", hr); + if(SUCCEEDED(hr)) + { + hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, 3 * sizeof(float)); + ok(hr == D3D_OK, "DrawPrimitiveUP failed (%08x)\n", hr); + hr = IDirect3DDevice9_EndScene(device); + ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %08x\n", hr); + } + hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); + + ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); + color = getPixelColor(device, 158, 118); + ok(color == 0x00ff0000, "viewport test: (158,118) has color %08x\n", color); + color = getPixelColor(device, 162, 118); + ok(color == 0x00ff0000, "viewport test: (162,118) has color %08x\n", color); + color = getPixelColor(device, 158, 122); + ok(color == 0x00ff0000, "viewport test: (158,122) has color %08x\n", color); + color = getPixelColor(device, 162, 122); + ok(color == 0x00ffffff, "viewport test: (162,122) has color %08x\n", color); + + color = getPixelColor(device, 478, 358); + ok(color == 0x00ffffff, "viewport test: (478,358 has color %08x\n", color); + color = getPixelColor(device, 482, 358); + ok(color == 0x00ff0000, "viewport test: (482,358) has color %08x\n", color); + color = getPixelColor(device, 478, 362); + ok(color == 0x00ff0000, "viewport test: (478,362) has color %08x\n", color); + color = getPixelColor(device, 482, 362); + ok(color == 0x00ff0000, "viewport test: (482,362) has color %08x\n", color); + + hr = IDirect3DDevice9_SetViewport(device, &old_vp); + ok(hr == D3D_OK, "IDirect3DDevice9_SetViewport failed with %08x\n", hr); +} + START_TEST(visual) { IDirect3DDevice9 *device_ptr; @@ -10493,6 +10563,7 @@ START_TEST(visual) yuv_color_test(device_ptr); zwriteenable_test(device_ptr); alphatest_test(device_ptr); + viewport_test(device_ptr); if (caps.VertexShaderVersion >= D3DVS_VERSION(1, 1)) { diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index 9818c2698b9..c63bb25456d 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -67,10 +67,14 @@ static ULONG WINAPI IDirect3DTexture9Impl_Release(LPDIRECT3DTEXTURE9 iface) { TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IDirect3DDevice9Ex_Release(This->parentDevice); + IDirect3DDevice9Ex *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DTexture_Release(This->wineD3DTexture); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice9Ex_Release(parentDevice); } return ref; } diff --git a/dlls/d3d9/vertexbuffer.c b/dlls/d3d9/vertexbuffer.c index c46f8b3f003..d1d7b548dc2 100644 --- a/dlls/d3d9/vertexbuffer.c +++ b/dlls/d3d9/vertexbuffer.c @@ -66,10 +66,14 @@ static ULONG WINAPI IDirect3DVertexBuffer9Impl_Release(LPDIRECT3DVERTEXBUFFER9 i TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IDirect3DDevice9Ex_Release(This->parentDevice); + IDirect3DDevice9Ex *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DBuffer_Release(This->wineD3DVertexBuffer); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice9Ex_Release(parentDevice); } return ref; } diff --git a/dlls/d3d9/vertexdeclaration.c b/dlls/d3d9/vertexdeclaration.c index 1234bffbe10..63b257c1e43 100644 --- a/dlls/d3d9/vertexdeclaration.c +++ b/dlls/d3d9/vertexdeclaration.c @@ -248,10 +248,14 @@ static ULONG WINAPI IDirect3DVertexDeclaration9Impl_Release(LPDIRECT3DVERTEXDECL TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IDirect3DDevice9Ex_Release(This->parentDevice); + IDirect3DDevice9Ex *parentDevice = This->parentDevice; + if(!This->convFVF) { IDirect3DVertexDeclaration9Impl_Destroy(iface); } + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice9Ex_Release(parentDevice); } return ref; } diff --git a/dlls/d3d9/vertexshader.c b/dlls/d3d9/vertexshader.c index 8b775dedfb0..9293c204199 100644 --- a/dlls/d3d9/vertexshader.c +++ b/dlls/d3d9/vertexshader.c @@ -64,10 +64,14 @@ static ULONG WINAPI IDirect3DVertexShader9Impl_Release(LPDIRECT3DVERTEXSHADER9 i TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IDirect3DDevice9Ex_Release(This->parentDevice); + IDirect3DDevice9Ex *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DVertexShader_Release(This->wineD3DVertexShader); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice9Ex_Release(parentDevice); } return ref; } diff --git a/dlls/d3d9/volumetexture.c b/dlls/d3d9/volumetexture.c index 3adab632813..7a47e4ade6d 100644 --- a/dlls/d3d9/volumetexture.c +++ b/dlls/d3d9/volumetexture.c @@ -66,10 +66,14 @@ static ULONG WINAPI IDirect3DVolumeTexture9Impl_Release(LPDIRECT3DVOLUMETEXTURE9 TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { - IDirect3DDevice9Ex_Release(This->parentDevice); + IDirect3DDevice9Ex *parentDevice = This->parentDevice; + wined3d_mutex_lock(); IWineD3DVolumeTexture_Release(This->wineD3DVolumeTexture); wined3d_mutex_unlock(); + + /* Release the device last, as it may cause the device to be destroyed. */ + IDirect3DDevice9Ex_Release(parentDevice); } return ref; } diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c index c21dec1c2a3..726ce7babe1 100644 --- a/dlls/ddraw/ddraw.c +++ b/dlls/ddraw/ddraw.c @@ -2492,6 +2492,7 @@ IDirectDrawImpl_CreateSurface(IDirectDraw7 *iface, extra_surfaces = DDSD->dwBackBufferCount; desc2.ddsCaps.dwCaps &= ~DDSCAPS_FRONTBUFFER; /* It's not a front buffer */ desc2.ddsCaps.dwCaps |= DDSCAPS_BACKBUFFER; + desc2.dwBackBufferCount = 0; } hr = DD_OK; diff --git a/dlls/ddraw/tests/d3d.c b/dlls/ddraw/tests/d3d.c index 2d7d8d04a77..11b6a66b39a 100644 --- a/dlls/ddraw/tests/d3d.c +++ b/dlls/ddraw/tests/d3d.c @@ -2973,6 +2973,109 @@ static void ComputeSphereVisibility(void) ok(result[0] == 0x2002f, "Expected 0x2002f, got %x\n", result[0]); } +static void SetRenderTargetTest(void) +{ + HRESULT hr; + IDirectDrawSurface7 *newrt, *oldrt; + D3DVIEWPORT7 vp; + DDSURFACEDESC2 ddsd; + DWORD stateblock; + + memset(&ddsd, 0, sizeof(ddsd)); + ddsd.dwSize = sizeof(ddsd); + ddsd.dwFlags = DDSD_CAPS | DDSD_WIDTH | DDSD_HEIGHT; + ddsd.ddsCaps.dwCaps = DDSCAPS_TEXTURE | DDSCAPS_3DDEVICE; + ddsd.dwWidth = 64; + ddsd.dwHeight = 64; + hr = IDirectDraw7_CreateSurface(lpDD, &ddsd, &newrt, NULL); + ok(hr == DD_OK, "IDirectDraw7_CreateSurface failed, hr=0x%08x\n", hr); + if(FAILED(hr)) + { + skip("Skipping SetRenderTarget test\n"); + return; + } + + memset(&vp, 0, sizeof(vp)); + vp.dwX = 10; + vp.dwY = 10; + vp.dwWidth = 246; + vp.dwHeight = 246; + vp.dvMinZ = 0.25; + vp.dvMaxZ = 0.75; + hr = IDirect3DDevice7_SetViewport(lpD3DDevice, &vp); + ok(hr == D3D_OK, "IDirect3DDevice7_SetViewport failed, hr=0x%08x\n", hr); + + hr = IDirect3DDevice7_GetRenderTarget(lpD3DDevice, &oldrt); + ok(hr == DD_OK, "IDirect3DDevice7_GetRenderTarget failed, hr=0x%08x\n", hr); + + hr = IDirect3DDevice7_SetRenderTarget(lpD3DDevice, newrt, 0); + ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderTarget failed, hr=0x%08x\n", hr); + memset(&vp, 0xff, sizeof(vp)); + hr = IDirect3DDevice7_GetViewport(lpD3DDevice, &vp); + ok(hr == D3D_OK, "IDirect3DDevice7_GetViewport failed, hr=0x%08x\n", hr); + ok(vp.dwX == 10, "vp.dwX is %u, expected 10\n", vp.dwX); + ok(vp.dwY == 10, "vp.dwY is %u, expected 10\n", vp.dwY); + ok(vp.dwWidth == 246, "vp.dwWidth is %u, expected 246\n", vp.dwWidth); + ok(vp.dwHeight == 246, "vp.dwHeight is %u, expected 246\n", vp.dwHeight); + ok(vp.dvMinZ == 0.25, "vp.dvMinZ is %f, expected 0.1\n", vp.dvMinZ); + ok(vp.dvMaxZ == 0.75, "vp.dvMaxZ is %f, expected 0.9\n", vp.dvMaxZ); + + memset(&vp, 0, sizeof(vp)); + vp.dwX = 0; + vp.dwY = 0; + vp.dwWidth = 64; + vp.dwHeight = 64; + vp.dvMinZ = 0.0; + vp.dvMaxZ = 1.0; + hr = IDirect3DDevice7_SetViewport(lpD3DDevice, &vp); + ok(hr == D3D_OK, "IDirect3DDevice7_SetViewport failed, hr=0x%08x\n", hr); + + hr = IDirect3DDevice7_BeginStateBlock(lpD3DDevice); + ok(hr == D3D_OK, "IDirect3DDevice7_BeginStateblock failed, hr=0x%08x\n", hr); + hr = IDirect3DDevice7_SetRenderTarget(lpD3DDevice, oldrt, 0); + ok(hr == D3D_OK, "IDirect3DDevice7_SetRenderTarget failed, hr=0x%08x\n", hr); + + /* Check this twice, before and after ending the stateblock */ + memset(&vp, 0xff, sizeof(vp)); + hr = IDirect3DDevice7_GetViewport(lpD3DDevice, &vp); + ok(hr == D3D_OK, "IDirect3DDevice7_GetViewport failed, hr=0x%08x\n", hr); + ok(vp.dwX == 0, "vp.dwX is %u, expected 0\n", vp.dwX); + ok(vp.dwY == 0, "vp.dwY is %u, expected 0\n", vp.dwY); + ok(vp.dwWidth == 64, "vp.dwWidth is %u, expected 64\n", vp.dwWidth); + ok(vp.dwHeight == 64, "vp.dwHeight is %u, expected 64\n", vp.dwHeight); + ok(vp.dvMinZ == 0.0, "vp.dvMinZ is %f, expected 0.0\n", vp.dvMinZ); + ok(vp.dvMaxZ == 1.0, "vp.dvMaxZ is %f, expected 1.0\n", vp.dvMaxZ); + + hr = IDirect3DDevice7_EndStateBlock(lpD3DDevice, &stateblock); + ok(hr == D3D_OK, "IDirect3DDevice7_EndStateblock failed, hr=0x%08x\n", hr); + + memset(&vp, 0xff, sizeof(vp)); + hr = IDirect3DDevice7_GetViewport(lpD3DDevice, &vp); + ok(hr == D3D_OK, "IDirect3DDevice7_GetViewport failed, hr=0x%08x\n", hr); + ok(vp.dwX == 0, "vp.dwX is %u, expected 0\n", vp.dwX); + ok(vp.dwY == 0, "vp.dwY is %u, expected 0\n", vp.dwY); + ok(vp.dwWidth == 64, "vp.dwWidth is %u, expected 64\n", vp.dwWidth); + ok(vp.dwHeight == 64, "vp.dwHeight is %u, expected 64\n", vp.dwHeight); + ok(vp.dvMinZ == 0.0, "vp.dvMinZ is %f, expected 0.0\n", vp.dvMinZ); + ok(vp.dvMaxZ == 1.0, "vp.dvMaxZ is %f, expected 1.0\n", vp.dvMaxZ); + + hr = IDirect3DDevice7_DeleteStateBlock(lpD3DDevice, stateblock); + ok(hr == D3D_OK, "IDirect3DDevice7_DeleteStateblock failed, hr=0x%08x\n", hr); + + memset(&vp, 0, sizeof(vp)); + vp.dwX = 0; + vp.dwY = 0; + vp.dwWidth = 256; + vp.dwHeight = 256; + vp.dvMinZ = 0.0; + vp.dvMaxZ = 0.0; + hr = IDirect3DDevice7_SetViewport(lpD3DDevice, &vp); + ok(hr == D3D_OK, "IDirect3DDevice7_SetViewport failed, hr=0x%08x\n", hr); + + IDirectDrawSurface7_Release(oldrt); + IDirectDrawSurface7_Release(newrt); +} + START_TEST(d3d) { init_function_pointers(); @@ -2996,6 +3099,7 @@ START_TEST(d3d) VertexBufferDescTest(); D3D7_OldRenderStateTest(); DeviceLoadTest(); + SetRenderTargetTest(); ReleaseDirect3D(); } diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index 8e0857e182c..c0e84befbf4 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -1154,9 +1154,9 @@ static void AttachmentTest7(void) HRESULT hr; IDirectDraw7 *dd7; IDirectDrawSurface7 *surface1, *surface2, *surface3, *surface4; - DDSURFACEDESC2 ddsd; + DDSURFACEDESC2 ddsd, ddsd2; UINT num; - DDSCAPS2 caps = {DDSCAPS_TEXTURE, 0, 0, 0}; + DDSCAPS2 caps = {DDSCAPS_TEXTURE, 0, 0, 0}, caps2 = {DDSCAPS_BACKBUFFER,0,0,0}; HWND window = CreateWindow( "static", "ddraw_test", WS_OVERLAPPEDWINDOW, 100, 100, 160, 160, NULL, NULL, NULL, NULL ); hr = IDirectDraw_QueryInterface(lpDD, &IID_IDirectDraw7, (void **) &dd7); @@ -1253,6 +1253,14 @@ static void AttachmentTest7(void) hr = IDirectDraw7_CreateSurface(dd7, &ddsd, &surface1, NULL); ok(hr==DD_OK,"CreateSurface returned: %x\n",hr); + /* backbuffer surfaces must not have dwBackBufferCount set */ + ddsd2.dwSize = sizeof(ddsd2); + hr = IDirectDrawSurface7_GetAttachedSurface(surface1, &caps2, &surface2); + ok(hr==DD_OK,"GetAttachedSurface returned: %x\n", hr); + hr = IDirectDrawSurface7_GetSurfaceDesc(surface2, &ddsd2); + ok(hr==DD_OK,"GetSurfaceDesc returned: %x\n", hr); + ok(ddsd2.dwBackBufferCount==0,"backbuffer surface has dwBackBufferCount==%u\n", ddsd2.dwBackBufferCount); + num = 0; IDirectDrawSurface7_EnumAttachedSurfaces(surface1, &num, SurfaceCounter); ok(num == 1, "Primary surface has %d surfaces attached, expected 1\n", num); diff --git a/dlls/dwmapi/dwmapi.spec b/dlls/dwmapi/dwmapi.spec index f1c800f72cc..27e07045e91 100644 --- a/dlls/dwmapi/dwmapi.spec +++ b/dlls/dwmapi/dwmapi.spec @@ -29,9 +29,9 @@ @ stdcall DwmFlush() @ stdcall DwmGetColorizationColor(ptr long) @ stub DwmGetCompositionTimingInfo -@ stub DwmGetGraphicsStreamClient +@ stdcall DwmGetGraphicsStreamClient(long ptr) @ stub DwmGetGraphicsStreamTransformHint -@ stub DwmGetTransportAttributes +@ stdcall DwmGetTransportAttributes(ptr ptr ptr) @ stub DwmGetWindowAttribute @ stdcall DwmIsCompositionEnabled(ptr) @ stub DwmModifyPreviousDxFrameDuration diff --git a/dlls/dwmapi/dwmapi_main.c b/dlls/dwmapi/dwmapi_main.c index d7d6f5b6e2b..40ecec7bf00 100644 --- a/dlls/dwmapi/dwmapi_main.c +++ b/dlls/dwmapi/dwmapi_main.c @@ -111,6 +111,26 @@ HRESULT WINAPI DwmSetWindowAttribute(HWND hwnd, DWORD attributenum, LPCVOID attr } /********************************************************************** + * DwmGetGraphicsStreamClient (DWMAPI.@) + */ +HRESULT WINAPI DwmGetGraphicsStreamClient(UINT uIndex, UUID *pClientUuid) +{ + FIXME("(%d, %p) stub\n", uIndex, pClientUuid); + + return E_NOTIMPL; +} + +/********************************************************************** + * DwmGetTransportAttributes (DWMAPI.@) + */ +HRESULT WINAPI DwmGetTransportAttributes(BOOL *pfIsRemoting, BOOL *pfIsConnected, DWORD *pDwGeneration) +{ + FIXME("(%p, %p, %p) stub\n", pfIsRemoting, pfIsConnected, pDwGeneration); + + return E_NOTIMPL; +} + +/********************************************************************** * DwmUnregisterThumbnail (DWMAPI.@) */ HRESULT WINAPI DwmUnregisterThumbnail(HTHUMBNAIL thumbnail) diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c index fb13033256d..cb91ed4fa34 100644 --- a/dlls/dxdiagn/provider.c +++ b/dlls/dxdiagn/provider.c @@ -29,7 +29,6 @@ #include "winver.h" #include "objidl.h" #include "dshow.h" -#include "strmif.h" #include "vfw.h" #include "mmddk.h" #include "ddraw.h" diff --git a/dlls/version/Makefile.in b/dlls/fltlib/Makefile.in similarity index 51% copy from dlls/version/Makefile.in copy to dlls/fltlib/Makefile.in index 9fc0fbec52b..f0addf165ab 100644 --- a/dlls/version/Makefile.in +++ b/dlls/fltlib/Makefile.in @@ -2,21 +2,11 @@ TOPSRCDIR = @top_srcdir@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ -MODULE = version.dll -IMPORTLIB = version -IMPORTS = lz32 kernel32 ntdll +MODULE = fltlib.dll +IMPORTS = kernel32 C_SRCS = \ - info.c \ - install.c \ - resource.c - -RC_SRCS = version.rc - -C_SRCS16 = \ - ver16.c - -SPEC_SRCS16 = ver.spec + fltlib.c @MAKE_DLL_RULES@ diff --git a/dlls/fltlib/fltlib.c b/dlls/fltlib/fltlib.c new file mode 100644 index 00000000000..acd202fc517 --- /dev/null +++ b/dlls/fltlib/fltlib.c @@ -0,0 +1,60 @@ +/* + * Copyright 2009 Detlef Riekenberg + * + * 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 + +#include "windef.h" +#include "winbase.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(fltlib); + +/***************************************************** + * DllMain + */ +BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) +{ + TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); + + switch (fdwReason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* use native version */ + + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls(hinstDLL); + break; + } + return TRUE; +} + +/********************************************************************** + * FilterConnectCommunicationPort (FLTLIB.@) + */ +HRESULT WINAPI FilterConnectCommunicationPort(LPCWSTR lpPortName, DWORD dwOptions, + LPVOID lpContext, DWORD dwSizeOfContext, + LPSECURITY_ATTRIBUTES lpSecurityAttributes, + HANDLE *hPort) +{ + FIXME("(%s, %d, %p, %d, %p, %p) stub\n", debugstr_w(lpPortName), dwOptions, + lpContext, dwSizeOfContext, lpSecurityAttributes, hPort); + + *hPort = INVALID_HANDLE_VALUE; + return E_NOTIMPL; +} diff --git a/dlls/fltlib/fltlib.spec b/dlls/fltlib/fltlib.spec new file mode 100644 index 00000000000..9c84601555a --- /dev/null +++ b/dlls/fltlib/fltlib.spec @@ -0,0 +1,29 @@ +@ stub FilterAttach +@ stub FilterAttachAtAltitude +@ stub FilterClose +@ stdcall FilterConnectCommunicationPort(wstr long ptr long ptr ptr) +@ stub FilterCreate +@ stub FilterDetach +@ stub FilterFindClose +@ stub FilterFindFirst +@ stub FilterFindNext +@ stub FilterGetDosName +@ stub FilterGetInformation +@ stub FilterGetMessage +@ stub FilterInstanceClose +@ stub FilterInstanceCreate +@ stub FilterInstanceFindClose +@ stub FilterInstanceFindFirst +@ stub FilterInstanceFindNext +@ stub FilterInstanceGetInformation +@ stub FilterLoad +@ stub FilterReplyMessage +@ stub FilterSendMessage +@ stub FilterUnload +@ stub FilterVolumeClose +@ stub FilterVolumeFindClose +@ stub FilterVolumeFindFirst +@ stub FilterVolumeFindNext +@ stub FilterVolumeInstanceFindClose +@ stub FilterVolumeInstanceFindFirst +@ stub FilterVolumeInstanceFindNext diff --git a/dlls/gdi32/Makefile.in b/dlls/gdi32/Makefile.in index fbd2d476f7e..45bdad58b24 100644 --- a/dlls/gdi32/Makefile.in +++ b/dlls/gdi32/Makefile.in @@ -9,9 +9,7 @@ IMPORTS = advapi32 kernel32 ntdll EXTRAINCL = @FREETYPEINCL@ @FONTCONFIGINCL@ EXTRALIBS = @CARBONLIB@ -SPEC_SRCS16 = \ - gdi.exe.spec \ - wing.spec +SPEC_SRCS16 = gdi.exe.spec C_SRCS = \ bidi.c \ @@ -56,8 +54,7 @@ C_SRCS16 = \ bidi16.c \ env.c \ gdi16.c \ - metafile16.c \ - wing.c + metafile16.c RC_SRCS = version.rc RC_SRCS16 = version16.rc diff --git a/dlls/gdi32/bitblt.c b/dlls/gdi32/bitblt.c index 46c7f6f5a81..f638a738333 100644 --- a/dlls/gdi32/bitblt.c +++ b/dlls/gdi32/bitblt.c @@ -47,12 +47,18 @@ BOOL WINAPI PatBlt( HDC hdc, INT left, INT top, if (!dc) return FALSE; + TRACE("%p %d,%d %dx%d %06x\n", hdc, left, top, width, height, rop ); + if (dc->funcs->pPatBlt) { - TRACE("%p %d,%d %dx%d %06x\n", hdc, left, top, width, height, rop ); update_dc( dc ); bRet = dc->funcs->pPatBlt( dc->physDev, left, top, width, height, rop ); } + else if (dc->funcs->pStretchBlt) + { + update_dc( dc ); + bRet = dc->funcs->pStretchBlt( dc->physDev, left, top, width, height, NULL, 0, 0, 0, 0, rop ); + } release_dc_ptr( dc ); return bRet; } @@ -72,14 +78,19 @@ BOOL WINAPI BitBlt( HDC hdcDst, INT xDst, INT yDst, INT width, if (!(dcDst = get_dc_ptr( hdcDst ))) return FALSE; - if (dcDst->funcs->pBitBlt) + if (dcDst->funcs->pBitBlt || dcDst->funcs->pStretchBlt) { update_dc( dcDst ); dcSrc = get_dc_ptr( hdcSrc ); if (dcSrc) update_dc( dcSrc ); - ret = dcDst->funcs->pBitBlt( dcDst->physDev, xDst, yDst, width, height, - dcSrc ? dcSrc->physDev : NULL, xSrc, ySrc, rop ); + if (dcDst->funcs->pBitBlt) + ret = dcDst->funcs->pBitBlt( dcDst->physDev, xDst, yDst, width, height, + dcSrc ? dcSrc->physDev : NULL, xSrc, ySrc, rop ); + else + ret = dcDst->funcs->pStretchBlt( dcDst->physDev, xDst, yDst, width, height, + dcSrc ? dcSrc->physDev : NULL, xSrc, ySrc, + width, height, rop ); release_dc_ptr( dcDst ); if (dcSrc) release_dc_ptr( dcSrc ); diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index f4c48c6e7b2..609cc9c0d24 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -292,7 +292,6 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp ) bmpobj->bitmap.bmBits = NULL; bmpobj->funcs = NULL; bmpobj->dib = NULL; - bmpobj->segptr_bits = 0; bmpobj->color_table = NULL; bmpobj->nb_colors = 0; @@ -657,15 +656,6 @@ static BOOL BITMAP_DeleteObject( HGDIOBJ handle ) VirtualFree(dib->dsBm.bmBits, 0L, MEM_RELEASE ); } HeapFree(GetProcessHeap(), 0, dib); - bmp->dib = NULL; - if (bmp->segptr_bits) - { /* free its selector array */ - WORD sel = SELECTOROF(bmp->segptr_bits); - WORD count = (GetSelectorLimit16(sel) / 0x10000) + 1; - int i; - - for (i = 0; i < count; i++) FreeSelector16(sel + (i << __AHSHIFT)); - } HeapFree(GetProcessHeap(), 0, bmp->color_table); } return HeapFree( GetProcessHeap(), 0, bmp ); diff --git a/dlls/gdi32/brush.c b/dlls/gdi32/brush.c index a9f3ae14913..721da98a44d 100644 --- a/dlls/gdi32/brush.c +++ b/dlls/gdi32/brush.c @@ -53,10 +53,10 @@ static const struct gdi_obj_funcs brush_funcs = BRUSH_DeleteObject /* pDeleteObject */ }; -static HGLOBAL16 dib_copy(const BITMAPINFO *info, UINT coloruse) +static HGLOBAL dib_copy(const BITMAPINFO *info, UINT coloruse) { BITMAPINFO *newInfo; - HGLOBAL16 hmem; + HGLOBAL hmem; INT size; if (info->bmiHeader.biCompression != BI_RGB && info->bmiHeader.biCompression != BI_BITFIELDS) @@ -67,13 +67,13 @@ static HGLOBAL16 dib_copy(const BITMAPINFO *info, UINT coloruse) info->bmiHeader.biBitCount); size += bitmap_info_size( info, coloruse ); - if (!(hmem = GlobalAlloc16( GMEM_MOVEABLE, size ))) + if (!(hmem = GlobalAlloc( GMEM_MOVEABLE, size ))) { return 0; } - newInfo = GlobalLock16( hmem ); + newInfo = GlobalLock( hmem ); memcpy( newInfo, info, size ); - GlobalUnlock16( hmem ); + GlobalUnlock( hmem ); return hmem; } @@ -133,7 +133,7 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush ) ptr->logbrush.lbStyle = BS_DIBPATTERN; if (!(bmi = GlobalLock( h ))) goto error; - ptr->logbrush.lbHatch = dib_copy( bmi, ptr->logbrush.lbColor); + ptr->logbrush.lbHatch = (ULONG_PTR)dib_copy( bmi, ptr->logbrush.lbColor); GlobalUnlock( h ); if (!ptr->logbrush.lbHatch) goto error; break; @@ -156,7 +156,7 @@ HBRUSH WINAPI CreateBrushIndirect( const LOGBRUSH * brush ) if (ptr->logbrush.lbStyle == BS_PATTERN) DeleteObject( (HGDIOBJ)ptr->logbrush.lbHatch ); else if (ptr->logbrush.lbStyle == BS_DIBPATTERN) - GlobalFree16( (HGLOBAL16)ptr->logbrush.lbHatch ); + GlobalFree( (HGLOBAL)ptr->logbrush.lbHatch ); } HeapFree( GetProcessHeap(), 0, ptr ); return 0; @@ -423,7 +423,7 @@ static BOOL BRUSH_DeleteObject( HGDIOBJ handle ) DeleteObject( (HGDIOBJ)brush->logbrush.lbHatch ); break; case BS_DIBPATTERN: - GlobalFree16( (HGLOBAL16)brush->logbrush.lbHatch ); + GlobalFree( (HGLOBAL)brush->logbrush.lbHatch ); break; } return HeapFree( GetProcessHeap(), 0, brush ); diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index db8a91bab74..f7b295ac594 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -87,7 +87,6 @@ DC *alloc_dc_ptr( const DC_FUNCTIONS *funcs, WORD magic ) dc->saved_dc = 0; dc->dwHookData = 0; dc->hookProc = NULL; - dc->hookThunk = NULL; dc->wndOrgX = 0; dc->wndOrgY = 0; dc->wndExtX = 1; @@ -224,8 +223,8 @@ void release_dc_ptr( DC *dc ) */ void update_dc( DC *dc ) { - if (InterlockedExchange( &dc->dirty, 0 ) && dc->hookThunk) - dc->hookThunk( dc->hSelf, DCHC_INVALIDVISRGN, dc->dwHookData, 0 ); + if (InterlockedExchange( &dc->dirty, 0 ) && dc->hookProc) + dc->hookProc( dc->hSelf, DCHC_INVALIDVISRGN, dc->dwHookData, 0 ); } @@ -403,8 +402,7 @@ INT save_dc_state( HDC hdc ) PATH_InitGdiPath( &newdc->path ); newdc->pAbortProc = NULL; - newdc->hookThunk = NULL; - newdc->hookProc = 0; + newdc->hookProc = NULL; newdc->saved_visrgn = NULL; if (!(newdc->hSelf = alloc_gdi_handle( &newdc->header, dc->header.type, &dc_funcs ))) @@ -820,7 +818,7 @@ BOOL WINAPI DeleteDC( HDC hdc ) } /* Call hook procedure to check whether is it OK to delete this DC */ - if (dc->hookThunk && !dc->hookThunk( hdc, DCHC_DELETEDC, dc->dwHookData, 0 )) + if (dc->hookProc && !dc->hookProc( hdc, DCHC_DELETEDC, dc->dwHookData, 0 )) { release_dc_ptr( dc ); return FALSE; @@ -1389,7 +1387,7 @@ BOOL WINAPI SetDCHook( HDC hdc, DCHOOKPROC hookProc, DWORD_PTR dwHookData ) if (!(dc->flags & DC_SAVED)) { dc->dwHookData = dwHookData; - dc->hookThunk = hookProc; + dc->hookProc = hookProc; } release_dc_ptr( dc ); return TRUE; @@ -1407,65 +1405,7 @@ DWORD_PTR WINAPI GetDCHook( HDC hdc, DCHOOKPROC *proc ) DWORD_PTR ret; if (!dc) return 0; - if (proc) *proc = dc->hookThunk; - ret = dc->dwHookData; - release_dc_ptr( dc ); - return ret; -} - - -/* relay function to call the 16-bit DC hook proc */ -static BOOL WINAPI call_dc_hook16( HDC hdc, WORD code, DWORD_PTR data, LPARAM lParam ) -{ - WORD args[6]; - DWORD ret = 0; - DC *dc = get_dc_ptr( hdc ); - - if (!dc) return FALSE; - if (dc->hookProc) - { - args[5] = HDC_16(hdc); - args[4] = code; - args[3] = HIWORD(data); - args[2] = LOWORD(data); - args[1] = HIWORD(lParam); - args[0] = LOWORD(lParam); - WOWCallback16Ex( (DWORD)dc->hookProc, WCB16_PASCAL, sizeof(args), args, &ret ); - } - release_dc_ptr( dc ); - return LOWORD(ret); -} - -/*********************************************************************** - * SetDCHook (GDI.190) - */ -BOOL16 WINAPI SetDCHook16( HDC16 hdc16, FARPROC16 hookProc, DWORD dwHookData ) -{ - DC *dc = get_dc_ptr( HDC_32(hdc16) ); - - if (!dc) return FALSE; - if (!(dc->flags & DC_SAVED)) - { - dc->dwHookData = dwHookData; - dc->hookThunk = call_dc_hook16; - dc->hookProc = hookProc; - } - release_dc_ptr( dc ); - return TRUE; -} - - -/*********************************************************************** - * GetDCHook (GDI.191) - */ -DWORD WINAPI GetDCHook16( HDC16 hdc16, FARPROC16 *phookProc ) -{ - HDC hdc = HDC_32( hdc16 ); - DC *dc = get_dc_ptr( hdc ); - DWORD ret; - - if (!dc) return 0; - *phookProc = dc->hookProc; + if (proc) *proc = dc->hookProc; ret = dc->dwHookData; release_dc_ptr( dc ); return ret; diff --git a/dlls/gdi32/enhmfdrv/objects.c b/dlls/gdi32/enhmfdrv/objects.c index d2e7251c1b6..68796505162 100644 --- a/dlls/gdi32/enhmfdrv/objects.c +++ b/dlls/gdi32/enhmfdrv/objects.c @@ -166,7 +166,7 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ) { EMRCREATEDIBPATTERNBRUSHPT *emr; DWORD bmSize, biSize, size; - BITMAPINFO *info = GlobalLock16(logbrush.lbHatch); + BITMAPINFO *info = GlobalLock( (HGLOBAL)logbrush.lbHatch ); if (info->bmiHeader.biCompression) bmSize = info->bmiHeader.biSizeImage; @@ -192,7 +192,7 @@ DWORD EMFDRV_CreateBrushIndirect( PHYSDEV dev, HBRUSH hBrush ) if(!EMFDRV_WriteRecord( dev, &emr->emr )) index = 0; HeapFree( GetProcessHeap(), 0, emr ); - GlobalUnlock16(logbrush.lbHatch); + GlobalUnlock( (HGLOBAL)logbrush.lbHatch ); } break; diff --git a/dlls/gdi32/gdi16.c b/dlls/gdi32/gdi16.c index 2f4994869ba..ee829e1340e 100644 --- a/dlls/gdi32/gdi16.c +++ b/dlls/gdi32/gdi16.c @@ -26,6 +26,7 @@ #include "wownt32.h" #include "wine/wingdi16.h" #include "gdi_private.h" +#include "wine/list.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(gdi); @@ -222,6 +223,57 @@ static INT CALLBACK enum_font_callback( const LOGFONTW *plf, return LOWORD(ret); } +struct dib_segptr_bits +{ + struct list entry; + HBITMAP16 bmp; + WORD sel; + WORD count; +}; + +static struct list dib_segptr_list = LIST_INIT( dib_segptr_list ); + +static SEGPTR alloc_segptr_bits( HBITMAP bmp, void *bits32 ) +{ + DIBSECTION dib; + unsigned int i, size; + struct dib_segptr_bits *bits; + + if (!(bits = HeapAlloc( GetProcessHeap(), 0, sizeof(*bits) ))) return 0; + + GetObjectW( bmp, sizeof(dib), &dib ); + size = dib.dsBm.bmHeight * dib.dsBm.bmWidthBytes; + + /* calculate number of sel's needed for size with 64K steps */ + bits->bmp = HBITMAP_16( bmp ); + bits->count = (size + 0xffff) / 0x10000; + bits->sel = AllocSelectorArray16( bits->count ); + + for (i = 0; i < bits->count; i++) + { + SetSelectorBase(bits->sel + (i << __AHSHIFT), (DWORD)bits32 + i * 0x10000); + SetSelectorLimit16(bits->sel + (i << __AHSHIFT), size - 1); /* yep, limit is correct */ + size -= 0x10000; + } + list_add_head( &dib_segptr_list, &bits->entry ); + return MAKESEGPTR( bits->sel, 0 ); +} + +static void free_segptr_bits( HBITMAP16 bmp ) +{ + unsigned int i; + struct dib_segptr_bits *bits; + + LIST_FOR_EACH_ENTRY( bits, &dib_segptr_list, struct dib_segptr_bits, entry ) + { + if (bits->bmp != bmp) continue; + for (i = 0; i < bits->count; i++) FreeSelector16( bits->sel + (i << __AHSHIFT) ); + + list_remove( &bits->entry ); + HeapFree( GetProcessHeap(), 0, bits ); + return; + } +} /*********************************************************************** * SetBkColor (GDI.1) @@ -1125,6 +1177,7 @@ BOOL16 WINAPI DeleteDC16( HDC16 hdc ) */ BOOL16 WINAPI DeleteObject16( HGDIOBJ16 obj ) { + if (GetObjectType( HGDIOBJ_32(obj) ) == OBJ_BITMAP) free_segptr_bits( obj ); return DeleteObject( HGDIOBJ_32(obj) ); } @@ -1601,15 +1654,6 @@ void WINAPI Resurrection16(HDC16 hdc, } -/********************************************************************** - * CreateMetaFile (GDI.125) - */ -HDC16 WINAPI CreateMetaFile16( LPCSTR filename ) -{ - return HDC_16( CreateMetaFileA( filename ) ); -} - - /*********************************************************************** * MulDiv (GDI.128) */ @@ -1778,6 +1822,26 @@ void WINAPI PlayMetaFileRecord16( HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr, /*********************************************************************** + * SetDCHook (GDI.190) + */ +BOOL16 WINAPI SetDCHook16( HDC16 hdc16, FARPROC16 hookProc, DWORD dwHookData ) +{ + FIXME( "%04x %p %x: not supported\n", hdc16, hookProc, dwHookData ); + return FALSE; +} + + +/*********************************************************************** + * GetDCHook (GDI.191) + */ +DWORD WINAPI GetDCHook16( HDC16 hdc16, FARPROC16 *phookProc ) +{ + FIXME( "%04x: not supported\n", hdc16 ); + return 0; +} + + +/*********************************************************************** * SetHookFlags (GDI.192) */ WORD WINAPI SetHookFlags16( HDC16 hdc, WORD flags ) @@ -3612,40 +3676,6 @@ HBITMAP16 WINAPI CreateDIBSection16 (HDC16 hdc, const BITMAPINFO *bmi, UINT16 us HBITMAP hbitmap; hbitmap = CreateDIBSection( HDC_32(hdc), bmi, usage, &bits32, section, offset ); - if (hbitmap) - { - BITMAPOBJ *bmp = GDI_GetObjPtr(hbitmap, OBJ_BITMAP); - if (bmp && bmp->dib && bits32) - { - const BITMAPINFOHEADER *bi = &bmi->bmiHeader; - LONG width, height; - WORD planes, bpp; - DWORD compr, size; - INT width_bytes; - WORD count, sel; - int i; - - DIB_GetBitmapInfo(bi, &width, &height, &planes, &bpp, &compr, &size); - - height = height >= 0 ? height : -height; - width_bytes = DIB_GetDIBWidthBytes(width, bpp); - - if (!size || (compr != BI_RLE4 && compr != BI_RLE8)) size = width_bytes * height; - - /* calculate number of sel's needed for size with 64K steps */ - count = (size + 0xffff) / 0x10000; - sel = AllocSelectorArray16(count); - - for (i = 0; i < count; i++) - { - SetSelectorBase(sel + (i << __AHSHIFT), (DWORD)bits32 + i * 0x10000); - SetSelectorLimit16(sel + (i << __AHSHIFT), size - 1); /* yep, limit is correct */ - size -= 0x10000; - } - bmp->segptr_bits = MAKESEGPTR( sel, 0 ); - if (bits16) *bits16 = bmp->segptr_bits; - } - if (bmp) GDI_ReleaseObj( hbitmap ); - } + if (hbitmap && bits32 && bits16) *bits16 = alloc_segptr_bits( hbitmap, bits32 ); return HBITMAP_16(hbitmap); } diff --git a/dlls/gdi32/gdi_private.h b/dlls/gdi32/gdi_private.h index d7f1d9104a0..f0248c9bf77 100644 --- a/dlls/gdi32/gdi_private.h +++ b/dlls/gdi32/gdi_private.h @@ -252,8 +252,7 @@ typedef struct tagDC INT saveLevel; HDC saved_dc; DWORD_PTR dwHookData; - FARPROC16 hookProc; /* the original SEGPTR ... */ - DCHOOKPROC hookThunk; /* ... and the thunk to call it */ + DCHOOKPROC hookProc; /* DC hook */ INT wndOrgX; /* Window origin */ INT wndOrgY; @@ -344,7 +343,6 @@ typedef struct tagBITMAPOBJ const DC_FUNCTIONS *funcs; /* DC function table */ /* For device-independent bitmaps: */ DIBSECTION *dib; - SEGPTR segptr_bits; /* segptr to DIB bits */ RGBQUAD *color_table; /* DIB color table if <= 8bpp */ UINT nb_colors; /* number of colors in table */ } BITMAPOBJ; @@ -460,7 +458,6 @@ extern BOOL GDI_hdc_not_using_object(HGDIOBJ obj, HDC hdc) DECLSPEC_HIDDEN; /* metafile.c */ extern HMETAFILE MF_Create_HMETAFILE(METAHEADER *mh) DECLSPEC_HIDDEN; -extern HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh) DECLSPEC_HIDDEN; extern METAHEADER *MF_CreateMetaHeaderDisk(METAHEADER *mr, LPCVOID filename, BOOL unicode ) DECLSPEC_HIDDEN; extern METAHEADER *MF_ReadMetaFile(HANDLE hfile) DECLSPEC_HIDDEN; extern METAHEADER *MF_LoadDiskBasedMetaFile(METAHEADER *mh) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/metafile16.c b/dlls/gdi32/metafile16.c index a8e8ca68005..812fb9cb7fa 100644 --- a/dlls/gdi32/metafile16.c +++ b/dlls/gdi32/metafile16.c @@ -58,6 +58,61 @@ static BOOL16 MF_ReleaseMetaHeader16( HMETAFILE16 hmf ) } /****************************************************************** + * MF_Create_HMETATFILE16 + * + * Creates a HMETAFILE16 object from a METAHEADER + * + * HMETAFILE16s are Global memory handles. + */ +static HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh) +{ + HMETAFILE16 hmf; + DWORD size = mh->mtSize * sizeof(WORD); + + hmf = GlobalAlloc16(GMEM_MOVEABLE, size); + if(hmf) + { + METAHEADER *mh_dest = GlobalLock16(hmf); + memcpy(mh_dest, mh, size); + GlobalUnlock16(hmf); + } + HeapFree(GetProcessHeap(), 0, mh); + return hmf; +} + +/********************************************************************** + * CreateMetaFile (GDI.125) + */ +HDC16 WINAPI CreateMetaFile16( LPCSTR filename ) +{ + return HDC_16( CreateMetaFileA( filename ) ); +} + +/****************************************************************** + * CloseMetaFile (GDI.126) + */ +HMETAFILE16 WINAPI CloseMetaFile16(HDC16 hdc) +{ + HMETAFILE16 hmf16 = 0; + HMETAFILE hmf = CloseMetaFile( HDC_32(hdc) ); + + if (hmf) + { + UINT size = GetMetaFileBitsEx( hmf, 0, NULL ); + + hmf16 = GlobalAlloc16( GMEM_MOVEABLE, size ); + if (hmf16) + { + void *buffer = GlobalLock16( hmf16 ); + GetMetaFileBitsEx( hmf, size, buffer ); + GlobalUnlock16( hmf16 ); + } + DeleteMetaFile( hmf ); + } + return hmf16; +} + +/****************************************************************** * DeleteMetaFile (GDI.127) */ BOOL16 WINAPI DeleteMetaFile16( HMETAFILE16 hmf ) diff --git a/dlls/gdi32/mfdrv/bitblt.c b/dlls/gdi32/mfdrv/bitblt.c index 85d4b167df0..c09148f12ee 100644 --- a/dlls/gdi32/mfdrv/bitblt.c +++ b/dlls/gdi32/mfdrv/bitblt.c @@ -36,18 +36,6 @@ BOOL CDECL MFDRV_PatBlt( PHYSDEV dev, INT left, INT top, INT width, INT height, /*********************************************************************** - * MFDRV_BitBlt - */ -BOOL CDECL MFDRV_BitBlt( PHYSDEV devDst, INT xDst, INT yDst, INT width, INT height, - PHYSDEV devSrc, INT xSrc, INT ySrc, DWORD rop ) -{ - return MFDRV_StretchBlt(devDst, xDst, yDst, width, height, devSrc, - xSrc, ySrc, width, height, rop); -} - - - -/*********************************************************************** * MFDRV_StretchBlt * this function contains TWO ways for processing StretchBlt in metafiles, * decide between rdFunction values META_STRETCHBLT or META_DIBSTRETCHBLT diff --git a/dlls/gdi32/mfdrv/init.c b/dlls/gdi32/mfdrv/init.c index a5b18d357fc..59c973a6b34 100644 --- a/dlls/gdi32/mfdrv/init.c +++ b/dlls/gdi32/mfdrv/init.c @@ -23,8 +23,6 @@ #include "windef.h" #include "winbase.h" -#include "wine/winbase16.h" -#include "wownt32.h" #include "gdi_private.h" #include "mfdrv/metafiledrv.h" #include "wine/debug.h" @@ -40,7 +38,7 @@ static const DC_FUNCTIONS MFDRV_Funcs = MFDRV_Arc, /* pArc */ NULL, /* pArcTo */ MFDRV_BeginPath, /* pBeginPath */ - MFDRV_BitBlt, /* pBitBlt */ + NULL, /* pBitBlt */ NULL, /* pChoosePixelFormat */ MFDRV_Chord, /* pChord */ MFDRV_CloseFigure, /* pCloseFigure */ @@ -354,52 +352,6 @@ static DC *MFDRV_CloseMetaFile( HDC hdc ) } /****************************************************************** - * MF_Create_HMETATFILE16 - * - * Creates a HMETAFILE16 object from a METAHEADER - * - * HMETAFILE16s are Global memory handles. - */ -HMETAFILE16 MF_Create_HMETAFILE16(METAHEADER *mh) -{ - HMETAFILE16 hmf; - DWORD size = mh->mtSize * sizeof(WORD); - - hmf = GlobalAlloc16(GMEM_MOVEABLE, size); - if(hmf) - { - METAHEADER *mh_dest = GlobalLock16(hmf); - memcpy(mh_dest, mh, size); - GlobalUnlock16(hmf); - } - HeapFree(GetProcessHeap(), 0, mh); - return hmf; -} - -/****************************************************************** - * CloseMetaFile (GDI.126) - * - * PARAMS - * hdc [I] Metafile DC to close - */ -HMETAFILE16 WINAPI CloseMetaFile16(HDC16 hdc) -{ - HMETAFILE16 hmf; - METAFILEDRV_PDEVICE *physDev; - DC *dc = MFDRV_CloseMetaFile(HDC_32(hdc)); - if (!dc) return 0; - physDev = (METAFILEDRV_PDEVICE *)dc->physDev; - - /* Now allocate a global handle for the metafile */ - - hmf = MF_Create_HMETAFILE16( physDev->mh ); - - physDev->mh = NULL; /* So it won't be deleted */ - MFDRV_DeleteDC( dc ); - return hmf; -} - -/****************************************************************** * CloseMetaFile (GDI32.@) * * Stop recording graphics operations in metafile associated with diff --git a/dlls/gdi32/mfdrv/metafiledrv.h b/dlls/gdi32/mfdrv/metafiledrv.h index bdef9662e02..b15864c92f2 100644 --- a/dlls/gdi32/mfdrv/metafiledrv.h +++ b/dlls/gdi32/mfdrv/metafiledrv.h @@ -64,9 +64,6 @@ extern BOOL CDECL MFDRV_AbortPath( PHYSDEV dev ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_Arc( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_BeginPath( PHYSDEV dev ) DECLSPEC_HIDDEN; -extern BOOL CDECL MFDRV_BitBlt( PHYSDEV devDst, INT xDst, INT yDst, INT width, - INT height, PHYSDEV devSrc, INT xSrc, INT ySrc, - DWORD rop ) DECLSPEC_HIDDEN; extern BOOL CDECL MFDRV_Chord( PHYSDEV dev, INT left, INT top, INT right, INT bottom, INT xstart, INT ystart, INT xend, INT yend ) DECLSPEC_HIDDEN; diff --git a/dlls/gdi32/mfdrv/objects.c b/dlls/gdi32/mfdrv/objects.c index b4f66ec3230..e74cde83f4f 100644 --- a/dlls/gdi32/mfdrv/objects.c +++ b/dlls/gdi32/mfdrv/objects.c @@ -300,7 +300,7 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush ) BITMAPINFO *info; DWORD bmSize, biSize; - info = GlobalLock16((HGLOBAL16)logbrush.lbHatch); + info = GlobalLock( (HGLOBAL)logbrush.lbHatch ); if (info->bmiHeader.biCompression) bmSize = info->bmiHeader.biSizeImage; else @@ -310,12 +310,17 @@ INT16 MFDRV_CreateBrushIndirect(PHYSDEV dev, HBRUSH hBrush ) biSize = bitmap_info_size(info, LOWORD(logbrush.lbColor)); size = sizeof(METARECORD) + biSize + bmSize + 2; mr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size); - if(!mr) goto done; + if (!mr) + { + GlobalUnlock( (HGLOBAL)logbrush.lbHatch ); + goto done; + } mr->rdFunction = META_DIBCREATEPATTERNBRUSH; mr->rdSize = size / 2; *(mr->rdParm) = logbrush.lbStyle; *(mr->rdParm + 1) = LOWORD(logbrush.lbColor); memcpy(mr->rdParm + 2, info, biSize + bmSize); + GlobalUnlock( (HGLOBAL)logbrush.lbHatch ); break; } default: diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index 261f6c2561d..517033c6887 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -2252,6 +2252,15 @@ static void test_get16dibits(void) ReleaseDC(NULL, screen_dc); } +static BOOL compare_buffers_no_alpha(UINT32 *a, UINT32 *b, int length) +{ + int i; + for(i = 0; i < length; i++) + if((a[i] & 0x00FFFFFF) != (b[i] & 0x00FFFFFF)) + return FALSE; + return TRUE; +} + static void check_BitBlt_pixel(HDC hdcDst, HDC hdcSrc, UINT32 *dstBuffer, UINT32 *srcBuffer, DWORD dwRop, UINT32 expected, int line) { @@ -2330,6 +2339,382 @@ static void test_BitBlt(void) DeleteDC(hdcScreen); } +static void check_StretchBlt_pixel(HDC hdcDst, HDC hdcSrc, UINT32 *dstBuffer, UINT32 *srcBuffer, + DWORD dwRop, UINT32 expected, int line) +{ + *srcBuffer = 0xFEDCBA98; + *dstBuffer = 0x89ABCDEF; + StretchBlt(hdcDst, 0, 0, 2, 1, hdcSrc, 0, 0, 1, 1, dwRop); + ok(expected == *dstBuffer, + "StretchBlt with dwRop %06X. Expected 0x%08X, got 0x%08X from line %d\n", + dwRop, expected, *dstBuffer, line); +} + +static void check_StretchBlt_stretch(HDC hdcDst, HDC hdcSrc, UINT32 *dstBuffer, UINT32 *srcBuffer, + int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, + int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, + UINT32 expected[4], UINT32 legacy_expected[4], int line) +{ + memset(dstBuffer, 0, 16); + StretchBlt(hdcDst, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, + hdcSrc, nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, SRCCOPY); + ok(memcmp(dstBuffer, expected, 16) == 0 || + broken(compare_buffers_no_alpha(dstBuffer, legacy_expected, 4)), + "StretchBlt expected { %08X, %08X, %08X, %08X } got { %08X, %08X, %08X, %08X } " + "stretching { %d, %d, %d, %d } to { %d, %d, %d, %d } from line %d\n", + expected[0], expected[1], expected[2], expected[3], + dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3], + nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, + nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, line); +} + +static void test_StretchBlt(void) +{ + HBITMAP bmpDst, bmpSrc; + HBITMAP oldDst, oldSrc; + HDC hdcScreen, hdcDst, hdcSrc; + UINT32 *dstBuffer, *srcBuffer; + HBRUSH hBrush, hOldBrush; + BITMAPINFO biDst, biSrc; + UINT32 expected[4], legacy_expected[4]; + + memset(&biDst, 0, sizeof(BITMAPINFO)); + biDst.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + biDst.bmiHeader.biWidth = 2; + biDst.bmiHeader.biHeight = -2; + biDst.bmiHeader.biPlanes = 1; + biDst.bmiHeader.biBitCount = 32; + biDst.bmiHeader.biCompression = BI_RGB; + memcpy(&biSrc, &biDst, sizeof(BITMAPINFO)); + + hdcScreen = CreateCompatibleDC(0); + hdcDst = CreateCompatibleDC(hdcScreen); + hdcSrc = CreateCompatibleDC(hdcDst); + + /* Pixel Tests */ + bmpDst = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + bmpSrc = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&srcBuffer, + NULL, 0); + oldSrc = SelectObject(hdcSrc, bmpSrc); + + hBrush = CreateSolidBrush(0x012345678); + hOldBrush = SelectObject(hdcDst, hBrush); + + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCCOPY, 0xFEDCBA98, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCPAINT, 0xFFFFFFFF, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCAND, 0x88888888, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCINVERT, 0x77777777, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, SRCERASE, 0x76543210, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, NOTSRCCOPY, 0x01234567, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, NOTSRCERASE, 0x00000000, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, MERGECOPY, 0x00581210, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, MERGEPAINT, 0x89ABCDEF, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, PATCOPY, 0x00785634, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, PATPAINT, 0x89FBDFFF, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, PATINVERT, 0x89D39BDB, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, DSTINVERT, 0x76543210, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, BLACKNESS, 0x00000000, __LINE__); + check_StretchBlt_pixel(hdcDst, hdcSrc, dstBuffer, srcBuffer, WHITENESS, 0xFFFFFFFF, __LINE__); + + SelectObject(hdcDst, hOldBrush); + DeleteObject(hBrush); + + /* Top-down to top-down tests */ + srcBuffer[0] = 0xCAFED00D, srcBuffer[1] = 0xFEEDFACE; + srcBuffer[2] = 0xFEDCBA98, srcBuffer[3] = 0x76543210; + + expected[0] = 0xCAFED00D, expected[1] = 0xFEEDFACE; + expected[2] = 0xFEDCBA98, expected[3] = 0x76543210; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0xCAFED00D, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 1, 1, 0, 0, 1, 1, expected, expected, __LINE__); + + expected[0] = 0xCAFED00D, expected[1] = 0xCAFED00D; + expected[2] = 0xCAFED00D, expected[3] = 0xCAFED00D; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 1, 1, expected, expected, __LINE__); + + expected[0] = 0xCAFED00D, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 1, 1, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0x76543210, expected[1] = 0xFEDCBA98; + expected[2] = 0xFEEDFACE, expected[3] = 0xCAFED00D; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + expected[0] = 0x76543210, expected[1] = 0xFEDCBA98; + expected[2] = 0xFEEDFACE, expected[3] = 0xCAFED00D; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 1, 1, -2, -2, 0, 0, 2, 2, expected, expected, __LINE__); + + /* This result seems broken. One might expect the following result: + * 0xCAFED00D 0xFEEDFACE + * 0xFEDCBA98 0x76543210 + */ + expected[0] = 0xCAFED00D, expected[1] = 0x00000000; + expected[2] = 0xFEDCBA98, expected[3] = 0x76543210; + legacy_expected[0] = 0xCAFED00D, legacy_expected[1] = 0x00000000; + legacy_expected[2] = 0x00000000, legacy_expected[3] = 0x00000000; + todo_wine check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 1, 1, -2, -2, 1, 1, -2, -2, expected, + legacy_expected, __LINE__); + + expected[0] = 0x00000000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0xCAFED00D; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 1, 1, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + + /* Top-down to bottom-up tests */ + biDst.bmiHeader.biHeight = 2; + bmpDst = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + expected[0] = 0xFEDCBA98, expected[1] = 0x76543210; + expected[2] = 0xCAFED00D, expected[3] = 0xFEEDFACE; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0xFEEDFACE, expected[1] = 0xCAFED00D; + expected[2] = 0x76543210, expected[3] = 0xFEDCBA98; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + SelectObject(hdcSrc, oldSrc); + DeleteObject(bmpSrc); + + /* Bottom-up to bottom-up tests */ + biSrc.bmiHeader.biHeight = 2; + bmpSrc = CreateDIBSection(hdcScreen, &biSrc, DIB_RGB_COLORS, (void**)&srcBuffer, + NULL, 0); + srcBuffer[0] = 0xCAFED00D, srcBuffer[1] = 0xFEEDFACE; + srcBuffer[2] = 0xFEDCBA98, srcBuffer[3] = 0x76543210; + oldSrc = SelectObject(hdcSrc, bmpSrc); + + expected[0] = 0xCAFED00D, expected[1] = 0xFEEDFACE; + expected[2] = 0xFEDCBA98, expected[3] = 0x76543210; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0x76543210, expected[1] = 0xFEDCBA98; + expected[2] = 0xFEEDFACE, expected[3] = 0xCAFED00D; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + + /* Bottom-up to top-down tests */ + biDst.bmiHeader.biHeight = -2; + bmpDst = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + expected[0] = 0xFEDCBA98, expected[1] = 0x76543210; + expected[2] = 0xCAFED00D, expected[3] = 0xFEEDFACE; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0xFEEDFACE, expected[1] = 0xCAFED00D; + expected[2] = 0x76543210, expected[3] = 0xFEDCBA98; + check_StretchBlt_stretch(hdcDst, hdcSrc, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + /* Tidy up */ + SelectObject(hdcSrc, oldSrc); + DeleteObject(bmpSrc); + DeleteDC(hdcSrc); + + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + DeleteDC(hdcDst); + + DeleteDC(hdcScreen); +} + +static void check_StretchDIBits_pixel(HDC hdcDst, UINT32 *dstBuffer, UINT32 *srcBuffer, + DWORD dwRop, UINT32 expected, int line) +{ + const UINT32 buffer[2] = { 0xFEDCBA98, 0 }; + BITMAPINFO bitmapInfo; + + memset(&bitmapInfo, 0, sizeof(BITMAPINFO)); + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.bmiHeader.biWidth = 2; + bitmapInfo.bmiHeader.biHeight = 1; + bitmapInfo.bmiHeader.biPlanes = 1; + bitmapInfo.bmiHeader.biBitCount = 32; + bitmapInfo.bmiHeader.biCompression = BI_RGB; + bitmapInfo.bmiHeader.biSizeImage = sizeof(buffer); + + *dstBuffer = 0x89ABCDEF; + + StretchDIBits(hdcDst, 0, 0, 2, 1, 0, 0, 1, 1, &buffer, &bitmapInfo, DIB_RGB_COLORS, dwRop); + ok(expected == *dstBuffer, + "StretchDIBits with dwRop %06X. Expected 0x%08X, got 0x%08X from line %d\n", + dwRop, expected, *dstBuffer, line); +} + +static void check_StretchDIBits_stretch(HDC hdcDst, UINT32 *dstBuffer, UINT32 *srcBuffer, + int nXOriginDest, int nYOriginDest, int nWidthDest, int nHeightDest, + int nXOriginSrc, int nYOriginSrc, int nWidthSrc, int nHeightSrc, + UINT32 expected[4], UINT32 legacy_expected[4], int line) +{ + BITMAPINFO bitmapInfo; + + memset(&bitmapInfo, 0, sizeof(BITMAPINFO)); + bitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bitmapInfo.bmiHeader.biWidth = 2; + bitmapInfo.bmiHeader.biHeight = -2; + bitmapInfo.bmiHeader.biPlanes = 1; + bitmapInfo.bmiHeader.biBitCount = 32; + bitmapInfo.bmiHeader.biCompression = BI_RGB; + + memset(dstBuffer, 0, 16); + StretchDIBits(hdcDst, nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, + nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, + srcBuffer, &bitmapInfo, DIB_RGB_COLORS, SRCCOPY); + ok(memcmp(dstBuffer, expected, 16) == 0 || /* Win2k/XP */ + broken(compare_buffers_no_alpha(dstBuffer, legacy_expected, 4)) || /* Win9X/ME */ + broken(nWidthSrc < 0 || nHeightSrc < 0), /* Win9X/ME */ + "StretchDIBits expected { %08X, %08X, %08X, %08X } got { %08X, %08X, %08X, %08X } " + "stretching { %d, %d, %d, %d } to { %d, %d, %d, %d } from line %d\n", + expected[0], expected[1], expected[2], expected[3], + dstBuffer[0], dstBuffer[1], dstBuffer[2], dstBuffer[3], + nXOriginSrc, nYOriginSrc, nWidthSrc, nHeightSrc, + nXOriginDest, nYOriginDest, nWidthDest, nHeightDest, line); +} + +static void test_StretchDIBits(void) +{ + HBITMAP bmpDst; + HBITMAP oldDst; + HDC hdcScreen, hdcDst; + UINT32 *dstBuffer, srcBuffer[4]; + HBRUSH hBrush, hOldBrush; + BITMAPINFO biDst; + UINT32 expected[4], legacy_expected[4]; + + memset(&biDst, 0, sizeof(BITMAPINFO)); + biDst.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + biDst.bmiHeader.biWidth = 2; + biDst.bmiHeader.biHeight = -2; + biDst.bmiHeader.biPlanes = 1; + biDst.bmiHeader.biBitCount = 32; + biDst.bmiHeader.biCompression = BI_RGB; + + hdcScreen = CreateCompatibleDC(0); + hdcDst = CreateCompatibleDC(hdcScreen); + + /* Pixel Tests */ + bmpDst = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + hBrush = CreateSolidBrush(0x012345678); + hOldBrush = SelectObject(hdcDst, hBrush); + + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, SRCCOPY, 0xFEDCBA98, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, SRCPAINT, 0xFFFFFFFF, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, SRCAND, 0x88888888, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, SRCINVERT, 0x77777777, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, SRCERASE, 0x76543210, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, NOTSRCCOPY, 0x01234567, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, NOTSRCERASE, 0x00000000, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, MERGECOPY, 0x00581210, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, MERGEPAINT, 0x89ABCDEF, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, PATCOPY, 0x00785634, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, PATPAINT, 0x89FBDFFF, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, PATINVERT, 0x89D39BDB, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, DSTINVERT, 0x76543210, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, BLACKNESS, 0x00000000, __LINE__); + check_StretchDIBits_pixel(hdcDst, dstBuffer, srcBuffer, WHITENESS, 0xFFFFFFFF, __LINE__); + + SelectObject(hdcDst, hOldBrush); + DeleteObject(hBrush); + + /* Top-down destination tests */ + srcBuffer[0] = 0xCAFED00D, srcBuffer[1] = 0xFEEDFACE; + srcBuffer[2] = 0xFEDCBA98, srcBuffer[3] = 0x76543210; + + expected[0] = 0xCAFED00D, expected[1] = 0xFEEDFACE; + expected[2] = 0xFEDCBA98, expected[3] = 0x76543210; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + expected[0] = 0xCAFED00D, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + legacy_expected[0] = 0xFEDCBA98, legacy_expected[1] = 0x00000000; + legacy_expected[2] = 0x00000000, legacy_expected[3] = 0x00000000; + todo_wine check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 1, 1, 0, 0, 1, 1, expected, legacy_expected, __LINE__); + + expected[0] = 0xFEDCBA98, expected[1] = 0xFEDCBA98; + expected[2] = 0xFEDCBA98, expected[3] = 0xFEDCBA98; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 1, 1, expected, expected, __LINE__); + + expected[0] = 0x42441000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + legacy_expected[0] = 0x00543210, legacy_expected[1] = 0x00000000; + legacy_expected[2] = 0x00000000, legacy_expected[3] = 0x00000000; + todo_wine check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 1, 1, 0, 0, 2, 2, expected, legacy_expected, __LINE__); + + expected[0] = 0x00000000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + expected[0] = 0x00000000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 2, 2, 1, 1, -2, -2, expected, expected, __LINE__); + + expected[0] = 0x00000000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0x00000000; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 1, 1, -2, -2, 1, 1, -2, -2, expected, expected, __LINE__); + + expected[0] = 0x00000000, expected[1] = 0x00000000; + expected[2] = 0x00000000, expected[3] = 0xCAFED00D; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 1, 1, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + + /* Bottom up destination tests */ + biDst.bmiHeader.biHeight = 2; + bmpDst = CreateDIBSection(hdcScreen, &biDst, DIB_RGB_COLORS, (void**)&dstBuffer, + NULL, 0); + oldDst = SelectObject(hdcDst, bmpDst); + + expected[0] = 0xFEDCBA98, expected[1] = 0x76543210; + expected[2] = 0xCAFED00D, expected[3] = 0xFEEDFACE; + check_StretchDIBits_stretch(hdcDst, dstBuffer, srcBuffer, + 0, 0, 2, 2, 0, 0, 2, 2, expected, expected, __LINE__); + + /* Tidy up */ + SelectObject(hdcDst, oldDst); + DeleteObject(bmpDst); + DeleteDC(hdcDst); + + DeleteDC(hdcScreen); +} + static void test_GdiAlphaBlend(void) { /* test out-of-bound parameters for GdiAlphaBlend */ @@ -2476,6 +2861,8 @@ START_TEST(bitmap) test_select_object(); test_CreateBitmap(); test_BitBlt(); + test_StretchBlt(); + test_StretchDIBits(); test_GdiAlphaBlend(); test_bitmapinfoheadersize(); test_get16dibits(); diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c index e9731868ab3..cd761bdf5cc 100644 --- a/dlls/gdiplus/tests/image.c +++ b/dlls/gdiplus/tests/image.c @@ -828,10 +828,14 @@ static void test_getsetpixel(void) expect(InvalidParameter, stat); stat = GdipBitmapGetPixel(bitmap, 1, -1, &color); - expect(InvalidParameter, stat); + ok(stat == InvalidParameter || + broken(stat == Ok), /* Older gdiplus */ + "Expected InvalidParameter, got %.8x\n", stat); stat = GdipBitmapSetPixel(bitmap, 1, -1, 0); - expect(InvalidParameter, stat); + ok(stat == InvalidParameter || + broken(stat == Ok), /* Older gdiplus */ + "Expected InvalidParameter, got %.8x\n", stat); stat = GdipBitmapGetPixel(bitmap, 2, 1, &color); expect(InvalidParameter, stat); diff --git a/dlls/imm32/imm.c b/dlls/imm32/imm.c index f0850802bc1..6f9744872b6 100644 --- a/dlls/imm32/imm.c +++ b/dlls/imm32/imm.c @@ -2130,6 +2130,13 @@ BOOL WINAPI ImmSetCompositionStringA( if (!data) return FALSE; + if (!(dwIndex == SCS_SETSTR || + dwIndex == SCS_CHANGEATTR || + dwIndex == SCS_CHANGECLAUSE || + dwIndex == SCS_SETRECONVERTSTRING || + dwIndex == SCS_QUERYRECONVERTSTRING)) + return FALSE; + if (!is_himc_ime_unicode(data)) return data->immKbd->pImeSetCompositionString(hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen); @@ -2178,6 +2185,13 @@ BOOL WINAPI ImmSetCompositionStringW( if (!data) return FALSE; + if (!(dwIndex == SCS_SETSTR || + dwIndex == SCS_CHANGEATTR || + dwIndex == SCS_CHANGECLAUSE || + dwIndex == SCS_SETRECONVERTSTRING || + dwIndex == SCS_QUERYRECONVERTSTRING)) + return FALSE; + if (is_himc_ime_unicode(data)) return data->immKbd->pImeSetCompositionString(hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen); diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index db1cd8d36e3..7b76226eb11 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -274,17 +274,18 @@ static void test_ImmSetCompositionString(void) ret = ImmSetCompositionStringW(imc, SCS_SETSTR | SCS_CHANGEATTR, NULL, 0, NULL, 0); - todo_wine ok(!ret, "ImmSetCompositionStringW() succeeded.\n"); ret = ImmSetCompositionStringW(imc, SCS_SETSTR | SCS_CHANGECLAUSE, NULL, 0, NULL, 0); - todo_wine ok(!ret, "ImmSetCompositionStringW() succeeded.\n"); ret = ImmSetCompositionStringW(imc, SCS_CHANGEATTR | SCS_CHANGECLAUSE, NULL, 0, NULL, 0); - todo_wine + ok(!ret, "ImmSetCompositionStringW() succeeded.\n"); + + ret = ImmSetCompositionStringW(imc, SCS_SETSTR | SCS_CHANGEATTR | SCS_CHANGECLAUSE, + NULL, 0, NULL, 0); ok(!ret, "ImmSetCompositionStringW() succeeded.\n"); ImmReleaseContext(hwnd, imc); diff --git a/dlls/jscript/Makefile.in b/dlls/jscript/Makefile.in index 241ef4b4476..63737966a9c 100644 --- a/dlls/jscript/Makefile.in +++ b/dlls/jscript/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = jscript.dll -IMPORTS = oleaut32 user32 advapi32 kernel32 +IMPORTS = oleaut32 ole32 user32 advapi32 kernel32 RC_SRCS = \ jscript_De.rc \ @@ -16,6 +16,7 @@ RC_SRCS = \ rsrc.rc C_SRCS = \ + activex.c \ array.c \ bool.c \ date.c \ diff --git a/dlls/jscript/activex.c b/dlls/jscript/activex.c new file mode 100644 index 00000000000..e37abd2bd77 --- /dev/null +++ b/dlls/jscript/activex.c @@ -0,0 +1,181 @@ +/* + * Copyright 2009 Jacek Caban for CodeWeavers + * + * 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 "config.h" +#include "wine/port.h" + +#include "jscript.h" +#include "objsafe.h" +#include "mshtmhst.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(jscript); + +/* Defined as extern in urlmon.idl, but not exported by uuid.lib */ +const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY = + {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}}; + +static IInternetHostSecurityManager *get_sec_mgr(script_ctx_t *ctx) +{ + IInternetHostSecurityManager *secmgr; + IServiceProvider *sp; + HRESULT hres; + + if(!ctx->site) + return NULL; + + if(ctx->secmgr) + return ctx->secmgr; + + hres = IActiveScriptSite_QueryInterface(ctx->site, &IID_IServiceProvider, (void**)&sp); + if(FAILED(hres)) + return NULL; + + hres = IServiceProvider_QueryService(sp, &SID_SInternetHostSecurityManager, &IID_IInternetHostSecurityManager, + (void**)&secmgr); + IServiceProvider_Release(sp); + if(FAILED(hres)) + return NULL; + + return ctx->secmgr = secmgr; +} + +static IUnknown *create_activex_object(script_ctx_t *ctx, const WCHAR *progid) +{ + IInternetHostSecurityManager *secmgr; + struct CONFIRMSAFETY cs; + IClassFactoryEx *cfex; + IClassFactory *cf; + DWORD policy_size; + BYTE *bpolicy; + IUnknown *obj; + DWORD policy; + GUID guid; + HRESULT hres; + + hres = CLSIDFromProgID(progid, &guid); + if(FAILED(hres)) + return NULL; + + TRACE("GUID %s\n", debugstr_guid(&guid)); + + secmgr = get_sec_mgr(ctx); + if(!secmgr) + return NULL; + + policy = 0; + hres = IInternetHostSecurityManager_ProcessUrlAction(secmgr, URLACTION_ACTIVEX_RUN, (BYTE*)&policy, sizeof(policy), + (BYTE*)&guid, sizeof(GUID), 0, 0); + if(FAILED(hres) || policy != URLPOLICY_ALLOW) + return NULL; + + hres = CoGetClassObject(&guid, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, NULL, &IID_IClassFactory, (void**)&cf); + if(FAILED(hres)) + return NULL; + + hres = IClassFactory_QueryInterface(cf, &IID_IClassFactoryEx, (void**)&cfex); + if(SUCCEEDED(hres)) { + FIXME("Use IClassFactoryEx\n"); + IClassFactoryEx_Release(cfex); + } + + hres = IClassFactory_CreateInstance(cf, NULL, &IID_IUnknown, (void**)&obj); + if(FAILED(hres)) + return NULL; + + cs.clsid = guid; + cs.pUnk = obj; + cs.dwFlags = 0; + hres = IInternetHostSecurityManager_QueryCustomPolicy(secmgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY, &bpolicy, &policy_size, + (BYTE*)&cs, sizeof(cs), 0); + if(SUCCEEDED(hres)) { + policy = policy_size >= sizeof(DWORD) ? *(DWORD*)bpolicy : URLPOLICY_DISALLOW; + CoTaskMemFree(bpolicy); + } + + if(FAILED(hres) || policy != URLPOLICY_ALLOW) { + IUnknown_Release(obj); + return NULL; + } + + return obj; +} + +static HRESULT ActiveXObject_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, + VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) +{ + IDispatch *disp; + IUnknown *obj; + BSTR progid; + HRESULT hres; + + TRACE("\n"); + + if(flags != DISPATCH_CONSTRUCT) { + FIXME("unsupported flags %x\n", flags); + return E_NOTIMPL; + } + + if(ctx->safeopt != (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER)) { + FIXME("Unsupported safeopt %x\n", ctx->safeopt); + return E_NOTIMPL; + } + + if(arg_cnt(dp) != 1) { + FIXME("unsuported arg_cnt %d\n", arg_cnt(dp)); + return E_NOTIMPL; + } + + hres = to_string(ctx, get_arg(dp,0), ei, &progid); + if(FAILED(hres)) + return hres; + + obj = create_activex_object(ctx, progid); + SysFreeString(progid); + if(!obj) + return throw_generic_error(ctx, ei, IDS_CREATE_OBJ_ERROR, NULL); + + hres = IUnknown_QueryInterface(obj, &IID_IDispatch, (void**)&disp); + IUnknown_Release(obj); + if(FAILED(hres)) { + FIXME("Object does not support IDispatch\n"); + return E_NOTIMPL; + } + + V_VT(retv) = VT_DISPATCH; + V_DISPATCH(retv) = disp; + return S_OK; +} + +HRESULT create_activex_constr(script_ctx_t *ctx, DispatchEx **ret) +{ + DispatchEx *prototype; + HRESULT hres; + + static const WCHAR ActiveXObjectW[] = {'A','c','t','i','v','e','X','O','b','j','e','c','t',0}; + + hres = create_object(ctx, NULL, &prototype); + if(FAILED(hres)) + return hres; + + hres = create_builtin_function(ctx, ActiveXObject_value, ActiveXObjectW, NULL, PROPF_CONSTR, prototype, ret); + + jsdisp_release(prototype); + return hres; +} diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index a3007fc3941..cecfd62b606 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -178,7 +178,8 @@ void scope_release(scope_chain_t *scope) heap_free(scope); } -HRESULT create_exec_ctx(IDispatch *this_obj, DispatchEx *var_disp, scope_chain_t *scope, exec_ctx_t **ret) +HRESULT create_exec_ctx(script_ctx_t *script_ctx, IDispatch *this_obj, DispatchEx *var_disp, + scope_chain_t *scope, exec_ctx_t **ret) { exec_ctx_t *ctx; @@ -188,8 +189,13 @@ HRESULT create_exec_ctx(IDispatch *this_obj, DispatchEx *var_disp, scope_chain_t ctx->ref = 1; - IDispatch_AddRef(this_obj); - ctx->this_obj = this_obj; + if(this_obj) + ctx->this_obj = this_obj; + else if(script_ctx->host_global) + ctx->this_obj = script_ctx->host_global; + else + ctx->this_obj = (IDispatch*)_IDispatchEx_(script_ctx->global); + IDispatch_AddRef(ctx->this_obj); IDispatchEx_AddRef(_IDispatchEx_(var_disp)); ctx->var_disp = var_disp; @@ -537,21 +543,15 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, js } } - hres = jsdisp_get_id(ctx->parser->script->script_disp, identifier, 0, &id); - if(SUCCEEDED(hres)) { - exprval_set_idref(ret, (IDispatch*)_IDispatchEx_(ctx->parser->script->script_disp), id); - return S_OK; - } - if(lookup_global_members(ctx->parser->script, identifier, ret)) return S_OK; if(flags & EXPR_NEWREF) { - hres = jsdisp_get_id(ctx->parser->script->script_disp, identifier, fdexNameEnsure, &id); + hres = jsdisp_get_id(ctx->parser->script->global, identifier, fdexNameEnsure, &id); if(FAILED(hres)) return hres; - exprval_set_idref(ret, (IDispatch*)_IDispatchEx_(ctx->parser->script->script_disp), id); + exprval_set_idref(ret, (IDispatch*)_IDispatchEx_(ctx->parser->script->global), id); return S_OK; } diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h index 09394cefa12..386f38b51fd 100644 --- a/dlls/jscript/engine.h +++ b/dlls/jscript/engine.h @@ -116,7 +116,7 @@ static inline void exec_addref(exec_ctx_t *ctx) } void exec_release(exec_ctx_t*); -HRESULT create_exec_ctx(IDispatch*,DispatchEx*,scope_chain_t*,exec_ctx_t**); +HRESULT create_exec_ctx(script_ctx_t*,IDispatch*,DispatchEx*,scope_chain_t*,exec_ctx_t**); HRESULT exec_source(exec_ctx_t*,parser_ctx_t*,source_elements_t*,jsexcept_t*,VARIANT*); typedef struct _statement_t statement_t; diff --git a/dlls/jscript/error.c b/dlls/jscript/error.c index 91bc95aecfa..9530a4ce52a 100644 --- a/dlls/jscript/error.c +++ b/dlls/jscript/error.c @@ -429,6 +429,11 @@ HRESULT throw_eval_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR return throw_error(ctx, ei, id, str, ctx->eval_error_constr); } +HRESULT throw_generic_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str) +{ + return throw_error(ctx, ei, id, str, ctx->error_constr); +} + HRESULT throw_range_error(script_ctx_t *ctx, jsexcept_t *ei, UINT id, const WCHAR *str) { return throw_error(ctx, ei, id, str, ctx->range_error_constr); diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c index cbdc08b953e..b0fb79d711d 100644 --- a/dlls/jscript/function.c +++ b/dlls/jscript/function.c @@ -210,7 +210,7 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis hres = scope_push(function->scope_chain, var_disp, &scope); if(SUCCEEDED(hres)) { - hres = create_exec_ctx(this_obj, var_disp, scope, &exec_ctx); + hres = create_exec_ctx(ctx, this_obj, var_disp, scope, &exec_ctx); scope_release(scope); } if(FAILED(hres)) @@ -222,17 +222,6 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis return hres; } -static HRESULT invoke_function(script_ctx_t *ctx, FunctionInstance *function, DISPPARAMS *dp, - VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) -{ - IDispatch *this_obj; - - if(!(this_obj = get_this(dp))) - this_obj = (IDispatch*)_IDispatchEx_(ctx->script_disp); - - return invoke_source(ctx, function, this_obj, dp, retv, ei, caller); -} - static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) { @@ -254,18 +243,18 @@ static HRESULT invoke_constructor(script_ctx_t *ctx, FunctionInstance *function, return S_OK; } -static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, WORD flags, DISPPARAMS *dp, +static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_disp, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) { - IDispatch *this_disp; vdisp_t vthis; HRESULT hres; - this_disp = get_this(dp); if(this_disp) set_disp(&vthis, this_disp); + else if(ctx->host_global) + set_disp(&vthis, ctx->host_global); else - set_jsdisp(&vthis, ctx->script_disp); + set_jsdisp(&vthis, ctx->global); hres = function->value_proc(ctx, &vthis, flags, dp, retv, ei, caller); @@ -276,24 +265,10 @@ static HRESULT invoke_value_proc(script_ctx_t *ctx, FunctionInstance *function, static HRESULT call_function(script_ctx_t *ctx, FunctionInstance *function, IDispatch *this_obj, DISPPARAMS *args, VARIANT *retv, jsexcept_t *ei, IServiceProvider *caller) { - HRESULT hres; + if(function->value_proc) + return invoke_value_proc(ctx, function, this_obj, DISPATCH_METHOD, args, retv, ei, caller); - if(function->value_proc) { - vdisp_t vthis; - - if(this_obj) - set_disp(&vthis, this_obj); - else - set_jsdisp(&vthis, ctx->script_disp); - - hres = function->value_proc(ctx, &vthis, DISPATCH_METHOD, args, retv, ei, caller); - vdisp_release(&vthis); - }else { - hres = invoke_source(ctx, function, this_obj ? this_obj : (IDispatch*)_IDispatchEx_(ctx->script_disp), - args, retv, ei, caller); - } - - return hres; + return invoke_source(ctx, function, this_obj, args, retv, ei, caller); } static HRESULT function_to_string(FunctionInstance *function, BSTR *ret) @@ -506,9 +481,9 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAM switch(flags) { case DISPATCH_METHOD: if(function->value_proc) - return invoke_value_proc(ctx, function, flags, dp, retv, ei, caller); + return invoke_value_proc(ctx, function, get_this(dp), flags, dp, retv, ei, caller); - return invoke_function(ctx, function, dp, retv, ei, caller); + return invoke_source(ctx, function, get_this(dp), dp, retv, ei, caller); case DISPATCH_PROPERTYGET: { HRESULT hres; @@ -525,7 +500,7 @@ HRESULT Function_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAM case DISPATCH_CONSTRUCT: if(function->value_proc) - return invoke_value_proc(ctx, function, flags, dp, retv, ei, caller); + return invoke_value_proc(ctx, function, get_this(dp), flags, dp, retv, ei, caller); return invoke_constructor(ctx, function, dp, retv, ei, caller); diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c index d9c54db1588..bc39940aeb9 100644 --- a/dlls/jscript/global.c +++ b/dlls/jscript/global.c @@ -274,8 +274,9 @@ static HRESULT JSGlobal_RegExp(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, D static HRESULT JSGlobal_ActiveXObject(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, VARIANT *retv, jsexcept_t *ei, IServiceProvider *sp) { - FIXME("\n"); - return E_NOTIMPL; + TRACE("\n"); + + return constructor_call(ctx->activex_constr, flags, dp, retv, ei, sp); } static HRESULT JSGlobal_VBArray(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, DISPPARAMS *dp, @@ -770,7 +771,7 @@ static HRESULT JSGlobal_encodeURI(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags } static const builtin_prop_t JSGlobal_props[] = { - {ActiveXObjectW, JSGlobal_ActiveXObject, PROPF_METHOD}, + {ActiveXObjectW, JSGlobal_ActiveXObject, PROPF_CONSTR}, {ArrayW, JSGlobal_Array, PROPF_CONSTR}, {BooleanW, JSGlobal_Boolean, PROPF_CONSTR}, {CollectGarbageW, JSGlobal_CollectGarbage, PROPF_METHOD}, @@ -828,6 +829,10 @@ static HRESULT init_constructors(script_ctx_t *ctx, DispatchEx *object_prototype if(FAILED(hres)) return hres; + hres = create_activex_constr(ctx, &ctx->activex_constr); + if(FAILED(hres)) + return hres; + hres = create_array_constr(ctx, object_prototype, &ctx->array_constr); if(FAILED(hres)) return hres; diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index 0771e9badb7..90a5b476eae 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -96,7 +96,7 @@ static HRESULT exec_global_code(JScript *This, parser_ctx_t *parser_ctx) VARIANT var; HRESULT hres; - hres = create_exec_ctx((IDispatch*)_IDispatchEx_(This->ctx->script_disp), This->ctx->script_disp, NULL, &exec_ctx); + hres = create_exec_ctx(This->ctx, NULL, This->ctx->global, NULL, &exec_ctx); if(FAILED(hres)) return hres; @@ -148,12 +148,6 @@ static HRESULT set_ctx_site(JScript *This) This->ctx->lcid = This->lcid; - if(!This->ctx->script_disp) { - hres = create_dispex(This->ctx, NULL, NULL, &This->ctx->script_disp); - if(FAILED(hres)) - return hres; - } - hres = init_global(This->ctx); if(FAILED(hres)) return hres; @@ -335,6 +329,11 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface) if(This->ctx->state == SCRIPTSTATE_DISCONNECTED) change_state(This, SCRIPTSTATE_INITIALIZED); + if(This->ctx->host_global) { + IDispatch_Release(This->ctx->host_global); + This->ctx->host_global = NULL; + } + if(This->ctx->named_items) { named_item_t *iter, *iter2; @@ -352,6 +351,11 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface) This->ctx->named_items = NULL; } + if(This->ctx->secmgr) { + IInternetHostSecurityManager_Release(This->ctx->secmgr); + This->ctx->secmgr = NULL; + } + if(This->ctx->site) { IActiveScriptSite_Release(This->ctx->site); This->ctx->site = NULL; @@ -360,11 +364,6 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface) if (This->site) change_state(This, SCRIPTSTATE_CLOSED); - if(This->ctx->script_disp) { - jsdisp_release(This->ctx->script_disp); - This->ctx->script_disp = NULL; - } - if(This->ctx->global) { jsdisp_release(This->ctx->global); This->ctx->global = NULL; @@ -407,6 +406,11 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface, WARN("object does not implement IDispatch\n"); return hres; } + + if(This->ctx->host_global) + IDispatch_Release(This->ctx->host_global); + IDispatch_AddRef(disp); + This->ctx->host_global = disp; } item = heap_alloc(sizeof(*item)); @@ -449,12 +453,12 @@ static HRESULT WINAPI JScript_GetScriptDispatch(IActiveScript *iface, LPCOLESTR if(!ppdisp) return E_POINTER; - if(This->thread_id != GetCurrentThreadId() || !This->ctx->script_disp) { + if(This->thread_id != GetCurrentThreadId() || !This->ctx->global) { *ppdisp = NULL; return E_UNEXPECTED; } - *ppdisp = (IDispatch*)_IDispatchEx_(This->ctx->script_disp); + *ppdisp = (IDispatch*)_IDispatchEx_(This->ctx->global); IDispatch_AddRef(*ppdisp); return S_OK; } @@ -555,6 +559,7 @@ static HRESULT WINAPI JScriptParse_InitNew(IActiveScriptParse *iface) ctx->ref = 1; ctx->state = SCRIPTSTATE_UNINITIALIZED; + ctx->safeopt = This->safeopt; jsheap_init(&ctx->tmp_heap); ctx = InterlockedCompareExchangePointer((void**)&This->ctx, ctx, NULL); diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 8f9873cb9a6..533be57ff50 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -214,6 +214,7 @@ HRESULT create_builtin_function(script_ctx_t*,builtin_invoke_t,const WCHAR*,cons HRESULT Function_value(script_ctx_t*,vdisp_t*,WORD,DISPPARAMS*,VARIANT*,jsexcept_t*,IServiceProvider*); HRESULT throw_eval_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*); +HRESULT throw_generic_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*); HRESULT throw_range_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*); HRESULT throw_reference_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*); HRESULT throw_regexp_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*); @@ -221,7 +222,6 @@ HRESULT throw_syntax_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*); HRESULT throw_type_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*); HRESULT throw_uri_error(script_ctx_t*,jsexcept_t*,UINT,const WCHAR*); - HRESULT create_object(script_ctx_t*,DispatchEx*,DispatchEx**); HRESULT create_math(script_ctx_t*,DispatchEx**); HRESULT create_array(script_ctx_t*,DWORD,DispatchEx**); @@ -260,13 +260,17 @@ struct _script_ctx_t { exec_ctx_t *exec_ctx; named_item_t *named_items; IActiveScriptSite *site; + IInternetHostSecurityManager *secmgr; + DWORD safeopt; LCID lcid; jsheap_t tmp_heap; - DispatchEx *script_disp; + IDispatch *host_global; + DispatchEx *global; DispatchEx *function_constr; + DispatchEx *activex_constr; DispatchEx *array_constr; DispatchEx *bool_constr; DispatchEx *date_constr; @@ -295,6 +299,7 @@ HRESULT init_global(script_ctx_t*); HRESULT init_function_constr(script_ctx_t*,DispatchEx*); HRESULT create_object_prototype(script_ctx_t*,DispatchEx**); +HRESULT create_activex_constr(script_ctx_t*,DispatchEx**); HRESULT create_array_constr(script_ctx_t*,DispatchEx*,DispatchEx**); HRESULT create_bool_constr(script_ctx_t*,DispatchEx*,DispatchEx**); HRESULT create_date_constr(script_ctx_t*,DispatchEx*,DispatchEx**); diff --git a/dlls/jscript/jscript_De.rc b/dlls/jscript/jscript_De.rc index 39a229b90ac..02b52f38dbf 100644 --- a/dlls/jscript/jscript_De.rc +++ b/dlls/jscript/jscript_De.rc @@ -26,6 +26,7 @@ STRINGTABLE DISCARDABLE { IDS_TO_PRIMITIVE "Fehler beim umwandeln des Objektes in einen Grundtyp" IDS_INVALID_CALL_ARG "Ungültiger Funktionsaufruf oder Argument" + IDS_CREATE_OBJ_ERROR "Automatisierungsserver konnte das Objekt nicht erstellen" IDS_NO_PROPERTY "Das Objekt unterstützt diese Eigenschaft oder Methode nicht" IDS_ARG_NOT_OPT "Argument nicht optional" IDS_SYNTAX_ERROR "Syntax Fehler" @@ -40,5 +41,8 @@ STRINGTABLE DISCARDABLE IDS_ILLEGAL_ASSIGN "Unzulässige Zuweisung" IDS_UNDEFINED "'|' nicht definiert" IDS_NOT_BOOL "Boolisches Objekt erwartet" + IDS_JSCRIPT_EXPECTED "JScript Objekt erwartet" + IDS_REGEXP_SYNTAX_ERROR "Syntax Fehler in regulärem Ausdruck" IDS_INVALID_LENGTH "Array-Größe muss eine endliche, positive Ganzzahl sein" + IDS_ARRAY_EXPECTED "Array Objekt erwartet" } diff --git a/dlls/jscript/jscript_En.rc b/dlls/jscript/jscript_En.rc index 7962ad36c8c..14be9bddbde 100644 --- a/dlls/jscript/jscript_En.rc +++ b/dlls/jscript/jscript_En.rc @@ -24,6 +24,7 @@ STRINGTABLE DISCARDABLE { IDS_TO_PRIMITIVE "Error converting object to primitive type" IDS_INVALID_CALL_ARG "Invalid procedure call or argument" + IDS_CREATE_OBJ_ERROR "Automation server can't create object" IDS_NO_PROPERTY "Object doesn't support this property or method" IDS_ARG_NOT_OPT "Argument not optional" IDS_SYNTAX_ERROR "Syntax error" diff --git a/dlls/jscript/jscript_Fr.rc b/dlls/jscript/jscript_Fr.rc index 39c6f688654..8c23e412c40 100644 --- a/dlls/jscript/jscript_Fr.rc +++ b/dlls/jscript/jscript_Fr.rc @@ -29,6 +29,7 @@ STRINGTABLE DISCARDABLE { IDS_TO_PRIMITIVE "Erreur lors de la conversion de l'objet vers un type primitif" IDS_INVALID_CALL_ARG "Appel de procédure ou argument invalide" + IDS_CREATE_OBJ_ERROR "Le serveur d'automatisation ne peut créer l'objet" IDS_NO_PROPERTY "Cet objet ne supporte pas cette propriété ou méthode" IDS_ARG_NOT_OPT "Argument non optionnel" IDS_SYNTAX_ERROR "Erreur de syntaxe" @@ -46,4 +47,5 @@ STRINGTABLE DISCARDABLE IDS_JSCRIPT_EXPECTED "Objet JScript attendu" IDS_REGEXP_SYNTAX_ERROR "Erreur de syntaxe dans l'expression rationnelle" IDS_INVALID_LENGTH "La longueur d'un tableau doit être un entier positif" + IDS_ARRAY_EXPECTED "Objet tableau attendu" } diff --git a/dlls/jscript/jscript_Lt.rc b/dlls/jscript/jscript_Lt.rc index bb09228cd54..83c0680812a 100644 --- a/dlls/jscript/jscript_Lt.rc +++ b/dlls/jscript/jscript_Lt.rc @@ -44,4 +44,5 @@ STRINGTABLE DISCARDABLE IDS_JSCRIPT_EXPECTED "Tikėtasi JScript objekto" IDS_REGEXP_SYNTAX_ERROR "Sintaksės klaida reguliariajame reiškinyje" IDS_INVALID_LENGTH "Masyvo dydis turi būti teigiamas sveikasis skaičius" + IDS_ARRAY_EXPECTED "Tikėtasi masyvo objekto" } diff --git a/dlls/jscript/jscript_Nl.rc b/dlls/jscript/jscript_Nl.rc index 1006bedc57b..c4f761a3922 100644 --- a/dlls/jscript/jscript_Nl.rc +++ b/dlls/jscript/jscript_Nl.rc @@ -38,5 +38,8 @@ STRINGTABLE DISCARDABLE IDS_ILLEGAL_ASSIGN "Ongeldige toekenning" IDS_UNDEFINED "'|' is ongedefinieerd" IDS_NOT_BOOL "Boolean object verwacht" + IDS_JSCRIPT_EXPECTED "JScript object verwacht" + IDS_REGEXP_SYNTAX_ERROR "Syntax fout in reguliere expressie" IDS_INVALID_LENGTH "Array lengte moet een eindig, positief geheel getal zijn" + IDS_ARRAY_EXPECTED "Array object verwacht" } diff --git a/dlls/jscript/jscript_main.c b/dlls/jscript/jscript_main.c index 4f59ecbc11a..78f8f00e754 100644 --- a/dlls/jscript/jscript_main.c +++ b/dlls/jscript/jscript_main.c @@ -24,6 +24,7 @@ #include "advpub.h" #include "activaut.h" #include "objsafe.h" +#include "mshtmhst.h" #include "wine/debug.h" diff --git a/dlls/jscript/resource.h b/dlls/jscript/resource.h index fcebcb903c2..17c0df09f6d 100644 --- a/dlls/jscript/resource.h +++ b/dlls/jscript/resource.h @@ -20,6 +20,7 @@ #define IDS_TO_PRIMITIVE 0x0001 #define IDS_INVALID_CALL_ARG 0x0005 +#define IDS_CREATE_OBJ_ERROR 0x01AD #define IDS_NO_PROPERTY 0x01B6 #define IDS_ARG_NOT_OPT 0x01c1 #define IDS_SYNTAX_ERROR 0x03EA diff --git a/dlls/jscript/string.c b/dlls/jscript/string.c index 4bb80917384..55b6b858fb6 100644 --- a/dlls/jscript/string.c +++ b/dlls/jscript/string.c @@ -200,7 +200,7 @@ static HRESULT do_attribute_tag_format(script_ctx_t *ctx, vdisp_t *jsthis, WORD StringInstance *string; const WCHAR *str; DWORD length; - BSTR attr_value, val_str; + BSTR attr_value, val_str = NULL; HRESULT hres; if(!(string = string_this(jsthis))) { diff --git a/dlls/jscript/tests/Makefile.in b/dlls/jscript/tests/Makefile.in index 1730cae3403..7a0fef0c2e3 100644 --- a/dlls/jscript/tests/Makefile.in +++ b/dlls/jscript/tests/Makefile.in @@ -3,9 +3,10 @@ TOPOBJDIR = ../../.. SRCDIR = @srcdir@ VPATH = @srcdir@ TESTDLL = jscript.dll -IMPORTS = oleaut32 ole32 kernel32 +IMPORTS = oleaut32 ole32 advapi32 kernel32 CTESTS = \ + activex.c \ jscript.c \ run.c diff --git a/dlls/jscript/tests/activex.c b/dlls/jscript/tests/activex.c new file mode 100644 index 00000000000..aabf8f5cc10 --- /dev/null +++ b/dlls/jscript/tests/activex.c @@ -0,0 +1,969 @@ +/* + * Copyright 2009 Jacek Caban for CodeWeavers + * + * 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 COBJMACROS +#define CONST_VTABLE + +#include +#include +#include +#include +#include +#include + +#include "wine/test.h" + +static const CLSID CLSID_JScript = + {0xf414c260,0x6ac0,0x11cf,{0xb6,0xd1,0x00,0xaa,0x00,0xbb,0xbb,0x58}}; + +#define DEFINE_EXPECT(func) \ + static BOOL expect_ ## func = FALSE, called_ ## func = FALSE + +#define SET_EXPECT(func) \ + expect_ ## func = TRUE + +#define SET_CALLED(func) \ + called_ ## func = TRUE + +#define CHECK_EXPECT2(func) \ + do { \ + ok(expect_ ##func, "unexpected call " #func "\n"); \ + called_ ## func = TRUE; \ + }while(0) + +#define CHECK_EXPECT(func) \ + do { \ + CHECK_EXPECT2(func); \ + expect_ ## func = FALSE; \ + }while(0) + +#define CHECK_CALLED(func) \ + do { \ + ok(called_ ## func, "expected " #func "\n"); \ + expect_ ## func = called_ ## func = FALSE; \ + }while(0) + +DEFINE_EXPECT(CreateInstance); +DEFINE_EXPECT(ProcessUrlAction); +DEFINE_EXPECT(QueryCustomPolicy); +DEFINE_EXPECT(reportSuccess); +DEFINE_EXPECT(Host_QS_SecMgr); +DEFINE_EXPECT(Caller_QS_SecMgr); + +static const WCHAR testW[] = {'t','e','s','t',0}; + +static HRESULT QS_SecMgr_hres; +static HRESULT ProcessUrlAction_hres; +static DWORD ProcessUrlAction_policy; +static HRESULT CreateInstance_hres; +static HRESULT QueryCustomPolicy_hres; +static DWORD QueryCustomPolicy_psize; +static DWORD QueryCustomPolicy_policy; +static HRESULT QI_IDispatch_hres; + +#define TESTOBJ_CLSID "{178fc163-f585-4e24-9c13-4bb7faf80646}" + +static const GUID CLSID_TestObj = + {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}}; + +/* Defined as extern in urlmon.idl, but not exported by uuid.lib */ +const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY = + {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}}; + +#define DISPID_TEST_REPORTSUCCESS 0x1000 + +#define DISPID_GLOBAL_OK 0x2000 + +static const char *debugstr_guid(REFIID riid) +{ + static char buf[50]; + + sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + riid->Data1, riid->Data2, riid->Data3, riid->Data4[0], + riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4], + riid->Data4[5], riid->Data4[6], riid->Data4[7]); + + return buf; +} + +static BSTR a2bstr(const char *str) +{ + BSTR ret; + int len; + + len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + ret = SysAllocStringLen(NULL, len-1); + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + + return ret; +} + +static int strcmp_wa(LPCWSTR strw, const char *stra) +{ + CHAR buf[512]; + WideCharToMultiByte(CP_ACP, 0, strw, -1, buf, sizeof(buf), 0, 0); + return lstrcmpA(buf, stra); +} + +static HRESULT WINAPI DispatchEx_QueryInterface(IDispatchEx *iface, REFIID riid, void **ppv) +{ + *ppv = NULL; + + if(IsEqualGUID(riid, &IID_IUnknown)) { + *ppv = iface; + }else if(IsEqualGUID(riid, &IID_IDispatch) || IsEqualGUID(riid, &IID_IDispatchEx)) { + if(FAILED(QI_IDispatch_hres)) + return QI_IDispatch_hres; + *ppv = iface; + }else { + return E_NOINTERFACE; + } + + return S_OK; +} + +static ULONG WINAPI DispatchEx_AddRef(IDispatchEx *iface) +{ + return 2; +} + +static ULONG WINAPI DispatchEx_Release(IDispatchEx *iface) +{ + return 1; +} + +static HRESULT WINAPI DispatchEx_GetTypeInfoCount(IDispatchEx *iface, UINT *pctinfo) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI DispatchEx_GetTypeInfo(IDispatchEx *iface, UINT iTInfo, + LCID lcid, ITypeInfo **ppTInfo) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI DispatchEx_GetIDsOfNames(IDispatchEx *iface, REFIID riid, + LPOLESTR *rgszNames, UINT cNames, + LCID lcid, DISPID *rgDispId) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI DispatchEx_Invoke(IDispatchEx *iface, DISPID dispIdMember, + REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, + VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI DispatchEx_DeleteMemberByName(IDispatchEx *iface, BSTR bstrName, DWORD grfdex) +{ + ok(0, "unexpected call %s %x\n", wine_dbgstr_w(bstrName), grfdex); + return E_NOTIMPL; +} + +static HRESULT WINAPI DispatchEx_DeleteMemberByDispID(IDispatchEx *iface, DISPID id) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI DispatchEx_GetMemberProperties(IDispatchEx *iface, DISPID id, DWORD grfdexFetch, DWORD *pgrfdex) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI DispatchEx_GetMemberName(IDispatchEx *iface, DISPID id, BSTR *pbstrName) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI DispatchEx_GetNextDispID(IDispatchEx *iface, DWORD grfdex, DISPID id, DISPID *pid) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI DispatchEx_GetNameSpaceParent(IDispatchEx *iface, IUnknown **ppunk) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI Test_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) +{ + if(!strcmp_wa(bstrName, "reportSuccess")) { + ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex); + *pid = DISPID_TEST_REPORTSUCCESS; + return S_OK; + } + + ok(0, "unexpected name %s\n", wine_dbgstr_w(bstrName)); + return E_NOTIMPL; +} + +static HRESULT WINAPI Test_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, + VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) +{ + switch(id) { + case DISPID_TEST_REPORTSUCCESS: + CHECK_EXPECT(reportSuccess); + + ok(wFlags == INVOKE_FUNC, "wFlags = %x\n", wFlags); + ok(pdp != NULL, "pdp == NULL\n"); + ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n"); + ok(pdp->cArgs == 0, "cArgs = %d\n", pdp->cArgs); + ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs); + ok(!pvarRes, "pvarRes != NULL\n"); + ok(pei != NULL, "pei == NULL\n"); + break; + + default: + ok(0, "unexpected call\n"); + return E_NOTIMPL; + } + + return S_OK; +} + +static IDispatchExVtbl testObjVtbl = { + DispatchEx_QueryInterface, + DispatchEx_AddRef, + DispatchEx_Release, + DispatchEx_GetTypeInfoCount, + DispatchEx_GetTypeInfo, + DispatchEx_GetIDsOfNames, + DispatchEx_Invoke, + Test_GetDispID, + Test_InvokeEx, + DispatchEx_DeleteMemberByName, + DispatchEx_DeleteMemberByDispID, + DispatchEx_GetMemberProperties, + DispatchEx_GetMemberName, + DispatchEx_GetNextDispID, + DispatchEx_GetNameSpaceParent +}; + +static IDispatchEx testObj = { &testObjVtbl }; + +static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD grfdex, DISPID *pid) +{ + if(!strcmp_wa(bstrName, "ok")) { + ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex); + *pid = DISPID_GLOBAL_OK; + return S_OK; + } + + ok(0, "unexpected name %s\n", wine_dbgstr_w(bstrName)); + return E_NOTIMPL; +} + +static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, WORD wFlags, DISPPARAMS *pdp, + VARIANT *pvarRes, EXCEPINFO *pei, IServiceProvider *pspCaller) +{ + switch(id) { + case DISPID_GLOBAL_OK: + ok(wFlags == INVOKE_FUNC || wFlags == (INVOKE_FUNC|INVOKE_PROPERTYGET), "wFlags = %x\n", wFlags); + ok(pdp != NULL, "pdp == NULL\n"); + ok(pdp->rgvarg != NULL, "rgvarg == NULL\n"); + ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n"); + ok(pdp->cArgs == 2, "cArgs = %d\n", pdp->cArgs); + ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs); + ok(pei != NULL, "pei == NULL\n"); + + ok(V_VT(pdp->rgvarg) == VT_BSTR, "V_VT(psp->rgvargs) = %d\n", V_VT(pdp->rgvarg)); + ok(V_VT(pdp->rgvarg+1) == VT_BOOL, "V_VT(psp->rgvargs+1) = %d\n", V_VT(pdp->rgvarg)); + ok(V_BOOL(pdp->rgvarg+1), "%s\n", wine_dbgstr_w(V_BSTR(pdp->rgvarg))); + break; + + default: + ok(0, "unexpected call\n"); + return E_NOTIMPL; + } + + return S_OK; +} + +static IDispatchExVtbl globalObjVtbl = { + DispatchEx_QueryInterface, + DispatchEx_AddRef, + DispatchEx_Release, + DispatchEx_GetTypeInfoCount, + DispatchEx_GetTypeInfo, + DispatchEx_GetIDsOfNames, + DispatchEx_Invoke, + Global_GetDispID, + Global_InvokeEx, + DispatchEx_DeleteMemberByName, + DispatchEx_DeleteMemberByDispID, + DispatchEx_GetMemberProperties, + DispatchEx_GetMemberName, + DispatchEx_GetNextDispID, + DispatchEx_GetNameSpaceParent +}; + +static IDispatchEx globalObj = { &globalObjVtbl }; + +static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IClassFactory, riid)) { + *ppv = iface; + return S_OK; + } + + /* TODO: IClassFactoryEx */ + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) +{ + return 2; +} + +static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) +{ + return 1; +} + +static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv) +{ + CHECK_EXPECT(CreateInstance); + + ok(!outer, "outer = %p\n", outer); + ok(IsEqualGUID(&IID_IUnknown, riid), "unexpected riid %s\n", debugstr_guid(riid)); + + if(SUCCEEDED(CreateInstance_hres)) + *ppv = &testObj; + return CreateInstance_hres; +} + +static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) +{ + ok(0, "unexpected call\n"); + return S_OK; +} + +static const IClassFactoryVtbl ClassFactoryVtbl = { + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + ClassFactory_CreateInstance, + ClassFactory_LockServer +}; + +static IClassFactory activex_cf = { &ClassFactoryVtbl }; + +static HRESULT WINAPI InternetHostSecurityManager_QueryInterface(IInternetHostSecurityManager *iface, REFIID riid, void **ppv) +{ + ok(0, "unexpected call\n"); + return E_NOINTERFACE; +} + +static ULONG WINAPI InternetHostSecurityManager_AddRef(IInternetHostSecurityManager *iface) +{ + return 2; +} + +static ULONG WINAPI InternetHostSecurityManager_Release(IInternetHostSecurityManager *iface) +{ + return 1; +} + +static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId(IInternetHostSecurityManager *iface, BYTE *pbSecurityId, + DWORD *pcbSecurityId, DWORD_PTR dwReserved) +{ + ok(0, "unexpected call\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHostSecurityManager *iface, DWORD dwAction, + BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved) +{ + CHECK_EXPECT(ProcessUrlAction); + + ok(dwAction == URLACTION_ACTIVEX_RUN, "dwAction = %x\n", dwAction); + ok(pPolicy != NULL, "pPolicy == NULL\n"); + ok(cbPolicy == sizeof(DWORD), "cbPolicy = %d\n", cbPolicy); + ok(pContext != NULL, "pContext == NULL\n"); + ok(cbContext == sizeof(GUID), "cbContext = %d\n", cbContext); + ok(IsEqualGUID(pContext, &CLSID_TestObj), "pContext = %s\n", debugstr_guid((const IID*)pContext)); + ok(!dwFlags, "dwFlags = %x\n", dwFlags); + ok(!dwReserved, "dwReserved = %x\n", dwReserved); + + if(SUCCEEDED(ProcessUrlAction_hres)) + *(DWORD*)pPolicy = ProcessUrlAction_policy; + return ProcessUrlAction_hres; +} + +static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHostSecurityManager *iface, REFGUID guidKey, + BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved) +{ + const struct CONFIRMSAFETY *cs = (const struct CONFIRMSAFETY*)pContext; + DWORD *ret; + + CHECK_EXPECT(QueryCustomPolicy); + + ok(IsEqualGUID(&GUID_CUSTOM_CONFIRMOBJECTSAFETY, guidKey), "guidKey = %s\n", debugstr_guid(guidKey)); + + ok(ppPolicy != NULL, "ppPolicy == NULL\n"); + ok(pcbPolicy != NULL, "pcbPolicy == NULL\n"); + ok(pContext != NULL, "pContext == NULL\n"); + ok(cbContext == sizeof(struct CONFIRMSAFETY), "cbContext = %d\n", cbContext); + ok(!dwReserved, "dwReserved = %x\n", dwReserved); + + /* TODO: CLSID */ + ok(cs->pUnk != NULL, "cs->pUnk == NULL\n"); + ok(!cs->dwFlags, "dwFlags = %x\n", cs->dwFlags); + + if(FAILED(QueryCustomPolicy_hres)) + return QueryCustomPolicy_hres; + + ret = CoTaskMemAlloc(QueryCustomPolicy_psize); + *ppPolicy = (BYTE*)ret; + *pcbPolicy = QueryCustomPolicy_psize; + memset(ret, 0, QueryCustomPolicy_psize); + if(QueryCustomPolicy_psize >= sizeof(DWORD)) + *ret = QueryCustomPolicy_policy; + + return QueryCustomPolicy_hres; +} + +static const IInternetHostSecurityManagerVtbl InternetHostSecurityManagerVtbl = { + InternetHostSecurityManager_QueryInterface, + InternetHostSecurityManager_AddRef, + InternetHostSecurityManager_Release, + InternetHostSecurityManager_GetSecurityId, + InternetHostSecurityManager_ProcessUrlAction, + InternetHostSecurityManager_QueryCustomPolicy +}; + +static IInternetHostSecurityManager InternetHostSecurityManager = { &InternetHostSecurityManagerVtbl }; + +static IServiceProvider ServiceProvider; + +static HRESULT WINAPI ServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + ok(0, "unexpected call\n"); + return E_NOINTERFACE; +} + +static ULONG WINAPI ServiceProvider_AddRef(IServiceProvider *iface) +{ + return 2; +} + +static ULONG WINAPI ServiceProvider_Release(IServiceProvider *iface) +{ + return 1; +} + +static HRESULT WINAPI ServiceProvider_QueryService(IServiceProvider *iface, + REFGUID guidService, REFIID riid, void **ppv) +{ + if(IsEqualGUID(&SID_GetCaller, guidService)) + return E_NOINTERFACE; + + if(IsEqualGUID(&SID_SInternetHostSecurityManager, guidService)) { + if(iface == &ServiceProvider) + CHECK_EXPECT(Host_QS_SecMgr); + else + CHECK_EXPECT(Caller_QS_SecMgr); + ok(IsEqualGUID(&IID_IInternetHostSecurityManager, riid), "unexpected riid %s\n", debugstr_guid(riid)); + if(SUCCEEDED(QS_SecMgr_hres)) + *ppv = &InternetHostSecurityManager; + return QS_SecMgr_hres; + } + + ok(0, "unexpected service %s\n", debugstr_guid(guidService)); + return E_NOINTERFACE; +} + +static IServiceProviderVtbl ServiceProviderVtbl = { + ServiceProvider_QueryInterface, + ServiceProvider_AddRef, + ServiceProvider_Release, + ServiceProvider_QueryService +}; + +static IServiceProvider ServiceProvider = { &ServiceProviderVtbl }; +static IServiceProvider caller_sp = { &ServiceProviderVtbl }; + +static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, REFIID riid, void **ppv) +{ + if(IsEqualGUID(&IID_IUnknown, riid)) { + *ppv = iface; + }else if(IsEqualGUID(&IID_IActiveScriptSite, riid)) { + *ppv = iface; + }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { + *ppv = &ServiceProvider; + }else { + *ppv = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; +} + +static ULONG WINAPI ActiveScriptSite_AddRef(IActiveScriptSite *iface) +{ + return 2; +} + +static ULONG WINAPI ActiveScriptSite_Release(IActiveScriptSite *iface) +{ + return 1; +} + +static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *plcid) +{ + *plcid = GetUserDefaultLCID(); + return S_OK; +} + +static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR pstrName, + DWORD dwReturnMask, IUnknown **ppiunkItem, ITypeInfo **ppti) +{ + ok(dwReturnMask == SCRIPTINFO_IUNKNOWN, "unexpected dwReturnMask %x\n", dwReturnMask); + ok(!ppti, "ppti != NULL\n"); + ok(!strcmp_wa(pstrName, "test"), "pstrName = %s\n", wine_dbgstr_w(pstrName)); + + *ppiunkItem = (IUnknown*)&globalObj; + return S_OK; +} + +static HRESULT WINAPI ActiveScriptSite_GetDocVersionString(IActiveScriptSite *iface, BSTR *pbstrVersion) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI ActiveScriptSite_OnScriptTerminate(IActiveScriptSite *iface, + const VARIANT *pvarResult, const EXCEPINFO *pexcepinfo) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI ActiveScriptSite_OnStateChange(IActiveScriptSite *iface, SCRIPTSTATE ssScriptState) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI ActiveScriptSite_OnScriptError(IActiveScriptSite *iface, IActiveScriptError *pscripterror) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI ActiveScriptSite_OnEnterScript(IActiveScriptSite *iface) +{ + return E_NOTIMPL; +} + +static HRESULT WINAPI ActiveScriptSite_OnLeaveScript(IActiveScriptSite *iface) +{ + return E_NOTIMPL; +} + +#undef ACTSCPSITE_THIS + +static const IActiveScriptSiteVtbl ActiveScriptSiteVtbl = { + ActiveScriptSite_QueryInterface, + ActiveScriptSite_AddRef, + ActiveScriptSite_Release, + ActiveScriptSite_GetLCID, + ActiveScriptSite_GetItemInfo, + ActiveScriptSite_GetDocVersionString, + ActiveScriptSite_OnScriptTerminate, + ActiveScriptSite_OnStateChange, + ActiveScriptSite_OnScriptError, + ActiveScriptSite_OnEnterScript, + ActiveScriptSite_OnLeaveScript +}; + +static IActiveScriptSite ActiveScriptSite = { &ActiveScriptSiteVtbl }; + +static void set_safety_options(IUnknown *unk) +{ + IObjectSafety *safety; + DWORD supported, enabled; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IObjectSafety, (void**)&safety); + ok(hres == S_OK, "Could not get IObjectSafety: %08x\n", hres); + if(FAILED(hres)) + return; + + hres = IObjectSafety_SetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, + INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER, + INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER); + ok(hres == S_OK, "SetInterfaceSafetyOptions failed: %08x\n", hres); + + supported = enabled = 0xdeadbeef; + hres = IObjectSafety_GetInterfaceSafetyOptions(safety, &IID_IActiveScriptParse, &supported, &enabled); + ok(hres == S_OK, "GetInterfaceSafetyOptions failed: %08x\n", hres); + ok(supported == (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER), + "supported=%x\n", supported); + ok(enabled == (INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER), + "enabled=%x\n", enabled); + + IObjectSafety_Release(safety); +} + +#define parse_script_a(p,s) _parse_script_a(__LINE__,p,s) +static void _parse_script_a(unsigned line, IActiveScriptParse *parser, const char *script) +{ + BSTR str; + HRESULT hres; + + str = a2bstr(script); + hres = IActiveScriptParse64_ParseScriptText(parser, str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + SysFreeString(str); + ok_(__FILE__,line)(hres == S_OK, "ParseScriptText failed: %08x\n", hres); +} + +static IActiveScriptParse *create_script(void) +{ + IActiveScriptParse *parser; + IActiveScript *script; + HRESULT hres; + + QS_SecMgr_hres = S_OK; + ProcessUrlAction_hres = S_OK; + ProcessUrlAction_policy = URLPOLICY_ALLOW; + CreateInstance_hres = S_OK; + QueryCustomPolicy_hres = S_OK; + QueryCustomPolicy_psize = sizeof(DWORD); + QueryCustomPolicy_policy = URLPOLICY_ALLOW; + QI_IDispatch_hres = S_OK; + + hres = CoCreateInstance(&CLSID_JScript, NULL, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER, + &IID_IActiveScript, (void**)&script); + ok(hres == S_OK, "CoCreateInstance failed: %08x\n", hres); + + set_safety_options((IUnknown*)script); + + hres = IActiveScript_QueryInterface(script, &IID_IActiveScriptParse, (void**)&parser); + ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres); + + hres = IActiveScriptParse64_InitNew(parser); + ok(hres == S_OK, "InitNew failed: %08x\n", hres); + + hres = IActiveScript_SetScriptSite(script, &ActiveScriptSite); + ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres); + + hres = IActiveScript_AddNamedItem(script, testW, + SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS); + ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres); + + hres = IActiveScript_SetScriptState(script, SCRIPTSTATE_STARTED); + ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres); + + IActiveScript_Release(script); + + parse_script_a(parser, + "function testException(func, type, number) {\n" + "try {\n" + " func();\n" + "}catch(e) {\n" + " ok(e.name === type, 'e.name = ' + e.name + ', expected ' + type)\n" + " ok(e.number === number, 'e.number = ' + e.number + ', expected ' + number);\n" + " return;\n" + "}" + "ok(false, 'exception expected');\n" + "}"); + + return parser; +} + +static IDispatchEx *parse_procedure_a(IActiveScriptParse *parser, const char *src) +{ + IActiveScriptParseProcedure2 *parse_proc; + IDispatchEx *dispex; + IDispatch *disp; + BSTR str; + HRESULT hres; + + hres = IUnknown_QueryInterface(parser, &IID_IActiveScriptParseProcedure2, (void**)&parse_proc); + ok(hres == S_OK, "Coult not get IActiveScriptParseProcedure2: %08x\n", hres); + + str = a2bstr(src); + hres = IActiveScriptParseProcedure2_64_ParseProcedureText(parse_proc, str, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, &disp); + SysFreeString(str); + IUnknown_Release(parse_proc); + ok(hres == S_OK, "ParseProcedureText failed: %08x\n", hres); + ok(disp != NULL, "disp == NULL\n"); + + hres = IDispatch_QueryInterface(disp, &IID_IDispatchEx, (void**)&dispex); + IDispatch_Release(dispex); + ok(hres == S_OK, "Could not get IDispatchEx iface: %08x\n", hres); + + return dispex; +} + +#define call_procedure(p,c) _call_procedure(__LINE__,p,c) +static void _call_procedure(unsigned line, IDispatchEx *proc, IServiceProvider *caller) +{ + DISPPARAMS dp = {NULL,NULL,0,0}; + EXCEPINFO ei = {0}; + HRESULT hres; + + hres = IDispatchEx_InvokeEx(proc, DISPID_VALUE, 0, DISPATCH_METHOD, &dp, NULL, &ei, caller); + ok_(__FILE__,line)(hres == S_OK, "InvokeEx failed: %08x\n", hres); + +} + +static void test_ActiveXObject(void) +{ + IActiveScriptParse *parser; + IDispatchEx *proc; + + parser = create_script(); + + SET_EXPECT(Host_QS_SecMgr); + SET_EXPECT(ProcessUrlAction); + SET_EXPECT(CreateInstance); + SET_EXPECT(QueryCustomPolicy); + SET_EXPECT(reportSuccess); + parse_script_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();"); + CHECK_CALLED(Host_QS_SecMgr); + CHECK_CALLED(ProcessUrlAction); + CHECK_CALLED(CreateInstance); + CHECK_CALLED(QueryCustomPolicy); + CHECK_CALLED(reportSuccess); + + proc = parse_procedure_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();"); + + SET_EXPECT(ProcessUrlAction); + SET_EXPECT(CreateInstance); + SET_EXPECT(QueryCustomPolicy); + SET_EXPECT(reportSuccess); + call_procedure(proc, NULL); + CHECK_CALLED(ProcessUrlAction); + CHECK_CALLED(CreateInstance); + CHECK_CALLED(QueryCustomPolicy); + CHECK_CALLED(reportSuccess); + + SET_EXPECT(ProcessUrlAction); + SET_EXPECT(CreateInstance); + SET_EXPECT(QueryCustomPolicy); + SET_EXPECT(reportSuccess); + call_procedure(proc, &caller_sp); + CHECK_CALLED(ProcessUrlAction); + CHECK_CALLED(CreateInstance); + CHECK_CALLED(QueryCustomPolicy); + CHECK_CALLED(reportSuccess); + + IDispatchEx_Release(proc); + IUnknown_Release(parser); + + parser = create_script(); + proc = parse_procedure_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();"); + + SET_EXPECT(Host_QS_SecMgr); + SET_EXPECT(ProcessUrlAction); + SET_EXPECT(CreateInstance); + SET_EXPECT(QueryCustomPolicy); + SET_EXPECT(reportSuccess); + call_procedure(proc, &caller_sp); + CHECK_CALLED(Host_QS_SecMgr); + CHECK_CALLED(ProcessUrlAction); + CHECK_CALLED(CreateInstance); + CHECK_CALLED(QueryCustomPolicy); + CHECK_CALLED(reportSuccess); + + parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.TestABC'); }, 'Error', -2146827859);"); + + IDispatchEx_Release(proc); + IUnknown_Release(parser); + + parser = create_script(); + QS_SecMgr_hres = E_NOINTERFACE; + + SET_EXPECT(Host_QS_SecMgr); + parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);"); + CHECK_CALLED(Host_QS_SecMgr); + + IUnknown_Release(parser); + + parser = create_script(); + ProcessUrlAction_hres = E_FAIL; + + SET_EXPECT(Host_QS_SecMgr); + SET_EXPECT(ProcessUrlAction); + parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);"); + CHECK_CALLED(Host_QS_SecMgr); + CHECK_CALLED(ProcessUrlAction); + + IUnknown_Release(parser); + + parser = create_script(); + ProcessUrlAction_policy = URLPOLICY_DISALLOW; + + SET_EXPECT(Host_QS_SecMgr); + SET_EXPECT(ProcessUrlAction); + parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);"); + CHECK_CALLED(Host_QS_SecMgr); + CHECK_CALLED(ProcessUrlAction); + + IUnknown_Release(parser); + + parser = create_script(); + CreateInstance_hres = E_FAIL; + + SET_EXPECT(Host_QS_SecMgr); + SET_EXPECT(ProcessUrlAction); + SET_EXPECT(CreateInstance); + parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);"); + CHECK_CALLED(Host_QS_SecMgr); + CHECK_CALLED(ProcessUrlAction); + CHECK_CALLED(CreateInstance); + + IUnknown_Release(parser); + + parser = create_script(); + QueryCustomPolicy_hres = E_FAIL; + + SET_EXPECT(Host_QS_SecMgr); + SET_EXPECT(ProcessUrlAction); + SET_EXPECT(CreateInstance); + SET_EXPECT(QueryCustomPolicy); + parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);"); + CHECK_CALLED(Host_QS_SecMgr); + CHECK_CALLED(ProcessUrlAction); + CHECK_CALLED(CreateInstance); + CHECK_CALLED(QueryCustomPolicy); + + IUnknown_Release(parser); + + parser = create_script(); + QueryCustomPolicy_psize = 6; + + SET_EXPECT(Host_QS_SecMgr); + SET_EXPECT(ProcessUrlAction); + SET_EXPECT(CreateInstance); + SET_EXPECT(QueryCustomPolicy); + SET_EXPECT(reportSuccess); + parse_script_a(parser, "(new ActiveXObject('Wine.Test')).reportSuccess();"); + CHECK_CALLED(Host_QS_SecMgr); + CHECK_CALLED(ProcessUrlAction); + CHECK_CALLED(CreateInstance); + CHECK_CALLED(QueryCustomPolicy); + CHECK_CALLED(reportSuccess); + + IUnknown_Release(parser); + + parser = create_script(); + QueryCustomPolicy_policy = URLPOLICY_DISALLOW; + + SET_EXPECT(Host_QS_SecMgr); + SET_EXPECT(ProcessUrlAction); + SET_EXPECT(CreateInstance); + SET_EXPECT(QueryCustomPolicy); + parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);"); + CHECK_CALLED(Host_QS_SecMgr); + CHECK_CALLED(ProcessUrlAction); + CHECK_CALLED(CreateInstance); + CHECK_CALLED(QueryCustomPolicy); + + QueryCustomPolicy_psize = 6; + + SET_EXPECT(ProcessUrlAction); + SET_EXPECT(CreateInstance); + SET_EXPECT(QueryCustomPolicy); + parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);"); + CHECK_CALLED(ProcessUrlAction); + CHECK_CALLED(CreateInstance); + CHECK_CALLED(QueryCustomPolicy); + + QueryCustomPolicy_policy = URLPOLICY_ALLOW; + QueryCustomPolicy_psize = 3; + + SET_EXPECT(ProcessUrlAction); + SET_EXPECT(CreateInstance); + SET_EXPECT(QueryCustomPolicy); + parse_script_a(parser, "testException(function() { new ActiveXObject('Wine.Test'); }, 'Error', -2146827859);"); + CHECK_CALLED(ProcessUrlAction); + CHECK_CALLED(CreateInstance); + CHECK_CALLED(QueryCustomPolicy); + + IUnknown_Release(parser); +} + +static BOOL init_key(const char *key_name, const char *def_value, BOOL init) +{ + HKEY hkey; + DWORD res; + + if(!init) { + RegDeleteKey(HKEY_CLASSES_ROOT, key_name); + return TRUE; + } + + res = RegCreateKeyA(HKEY_CLASSES_ROOT, key_name, &hkey); + if(res != ERROR_SUCCESS) + return FALSE; + + if(def_value) + res = RegSetValueA(hkey, NULL, REG_SZ, def_value, strlen(def_value)); + + RegCloseKey(hkey); + + return res == ERROR_SUCCESS; +} + +static BOOL init_registry(BOOL init) +{ + return init_key("Wine.Test\\CLSID", TESTOBJ_CLSID, init); +} + +static BOOL register_activex(void) +{ + DWORD regid; + HRESULT hres; + + if(!init_registry(TRUE)) { + init_registry(FALSE); + return FALSE; + } + + hres = CoRegisterClassObject(&CLSID_TestObj, (IUnknown *)&activex_cf, + CLSCTX_INPROC_SERVER, REGCLS_MULTIPLEUSE, ®id); + ok(hres == S_OK, "Could not register screipt engine: %08x\n", hres); + + return TRUE; +} + +START_TEST(activex) +{ + CoInitialize(NULL); + register_activex(); + + test_ActiveXObject(); + + init_registry(FALSE); + CoUninitialize(); +} diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js index 2e4b0aaebd1..ae118c264ae 100644 --- a/dlls/jscript/tests/api.js +++ b/dlls/jscript/tests/api.js @@ -1532,6 +1532,9 @@ ok(bool.toString() === "true", "bool.toString() = " + bool.toString()); ok(bool.valueOf() === Boolean(1), "bool.valueOf() = " + bool.valueOf()); ok(bool.toLocaleString() === bool.toString(), "bool.toLocaleString() = " + bool.toLocaleString()); +ok(ActiveXObject instanceof Function, "ActiveXObject is not instance of Function"); +ok(ActiveXObject.prototype instanceof Object, "ActiveXObject.prototype is not instance of Object"); + ok(Error.prototype !== TypeError.prototype, "Error.prototype === TypeError.prototype"); ok(RangeError.prototype !== TypeError.prototype, "RangeError.prototype === TypeError.prototype"); ok(Error.prototype.toLocaleString === Object.prototype.toLocaleString, diff --git a/dlls/jscript/tests/jscript.c b/dlls/jscript/tests/jscript.c index 9d9681c299b..e53fc2dcfd2 100644 --- a/dlls/jscript/tests/jscript.c +++ b/dlls/jscript/tests/jscript.c @@ -68,6 +68,18 @@ DEFINE_EXPECT(OnStateChange_INITIALIZED); DEFINE_EXPECT(OnEnterScript); DEFINE_EXPECT(OnLeaveScript); +static BSTR a2bstr(const char *str) +{ + BSTR ret; + int len; + + len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); + ret = SysAllocStringLen(NULL, len-1); + MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len); + + return ret; +} + #define test_state(s,ss) _test_state(__LINE__,s,ss) static void _test_state(unsigned line, IActiveScript *script, SCRIPTSTATE exstate) { @@ -195,6 +207,8 @@ static void test_script_dispatch(IActiveScript *script, BOOL initialized) { IDispatchEx *dispex; IDispatch *disp; + BSTR str; + DISPID id; HRESULT hres; disp = (void*)0xdeadbeef; @@ -214,6 +228,11 @@ static void test_script_dispatch(IActiveScript *script, BOOL initialized) IDispatch_Release(disp); ok(hres == S_OK, "Could not get IDispatchEx interface: %08x\n", hres); + str = a2bstr("ActiveXObject"); + hres = IDispatchEx_GetDispID(dispex, str, fdexNameCaseSensitive, &id); + SysFreeString(str); + ok(hres == S_OK, "GetDispID failed: %08x\n", hres); + IDispatchEx_Release(dispex); } diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 1cfee4f26b0..cf34b2f1abd 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -79,6 +79,8 @@ DEFINE_EXPECT(GetItemInfo_testVal); #define DISPID_GLOBAL_TESTOBJ 0x1006 #define DISPID_GLOBAL_NULL_BSTR 0x1007 #define DISPID_GLOBAL_NULL_DISP 0x1008 +#define DISPID_GLOBAL_TESTTHIS 0x1009 +#define DISPID_GLOBAL_TESTTHIS2 0x100a #define DISPID_TESTOBJ_PROP 0x2000 @@ -89,6 +91,7 @@ static const CHAR test_valA[] = "testVal"; static BOOL strict_dispid_check; static const char *test_name = "(null)"; +static IDispatch *script_disp; static BSTR a2bstr(const char *str) { @@ -325,6 +328,18 @@ static HRESULT WINAPI Global_GetDispID(IDispatchEx *iface, BSTR bstrName, DWORD return DISP_E_UNKNOWNNAME; } + if(!strcmp_wa(bstrName, "testThis")) { + ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex); + *pid = DISPID_GLOBAL_TESTTHIS; + return S_OK; + } + + if(!strcmp_wa(bstrName, "testThis2")) { + ok(grfdex == fdexNameCaseSensitive, "grfdex = %x\n", grfdex); + *pid = DISPID_GLOBAL_TESTTHIS2; + return S_OK; + } + if(strict_dispid_check) ok(0, "unexpected call %s\n", wine_dbgstr_w(bstrName)); return DISP_E_UNKNOWNNAME; @@ -492,6 +507,35 @@ static HRESULT WINAPI Global_InvokeEx(IDispatchEx *iface, DISPID id, LCID lcid, V_VT(pvarRes) = VT_DISPATCH; V_DISPATCH(pvarRes) = NULL; return S_OK; + + case DISPID_GLOBAL_TESTTHIS: + ok(pdp != NULL, "pdp == NULL\n"); + ok(pdp->rgvarg != NULL, "rgvarg == NULL\n"); + ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n"); + ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs); + ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs); + ok(pvarRes == NULL, "pvarRes != NULL\n"); + ok(pei != NULL, "pei == NULL\n"); + + ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(arg) = %d\n", V_VT(pdp->rgvarg)); + ok(V_DISPATCH(pdp->rgvarg) == (IDispatch*)iface, "disp != iface\n"); + + return S_OK; + + case DISPID_GLOBAL_TESTTHIS2: + ok(pdp != NULL, "pdp == NULL\n"); + ok(pdp->rgvarg != NULL, "rgvarg == NULL\n"); + ok(!pdp->rgdispidNamedArgs, "rgdispidNamedArgs != NULL\n"); + ok(pdp->cArgs == 1, "cArgs = %d\n", pdp->cArgs); + ok(!pdp->cNamedArgs, "cNamedArgs = %d\n", pdp->cNamedArgs); + ok(pvarRes == NULL, "pvarRes != NULL\n"); + ok(pei != NULL, "pei == NULL\n"); + + ok(V_VT(pdp->rgvarg) == VT_DISPATCH, "V_VT(arg) = %d\n", V_VT(pdp->rgvarg)); + ok(V_DISPATCH(pdp->rgvarg) != (IDispatch*)iface, "disp == iface\n"); + ok(V_DISPATCH(pdp->rgvarg) == script_disp, "disp != script_disp\n"); + + return S_OK; } ok(0, "unexpected call %x\n", id); @@ -625,7 +669,7 @@ static IActiveScript *create_script(void) return script; } -static void parse_script(BSTR script_str) +static void parse_script(DWORD flags, BSTR script_str) { IActiveScriptParse *parser; IActiveScript *engine; @@ -650,15 +694,21 @@ static void parse_script(BSTR script_str) ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres); hres = IActiveScript_AddNamedItem(engine, testW, - SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|SCRIPTITEM_GLOBALMEMBERS); + SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE|flags); ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres); hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED); ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres); + hres = IActiveScript_GetScriptDispatch(engine, NULL, &script_disp); + ok(hres == S_OK, "GetScriptDispatch failed: %08x\n", hres); + ok(script_disp != NULL, "script_disp == NULL\n"); + ok(script_disp != (IDispatch*)&Global, "script_disp == Global\n"); + hres = IActiveScriptParse64_ParseScriptText(parser, script_str, NULL, NULL, NULL, 0, 0, 0, NULL, NULL); ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + IDispatch_Release(script_disp); IActiveScript_Release(engine); IUnknown_Release(parser); } @@ -704,13 +754,18 @@ static HRESULT parse_htmlscript(BSTR script_str) return hres; } -static void parse_script_a(const char *src) +static void parse_script_af(DWORD flags, const char *src) { BSTR tmp = a2bstr(src); - parse_script(tmp); + parse_script(flags, tmp); SysFreeString(tmp); } +static void parse_script_a(const char *src) +{ + parse_script_af(SCRIPTITEM_GLOBALMEMBERS, src); +} + static HRESULT parse_htmlscript_a(const char *src) { HRESULT hres; @@ -766,7 +821,7 @@ static void run_from_file(const char *filename) strict_dispid_check = FALSE; if(script_str) - parse_script(script_str); + parse_script(SCRIPTITEM_GLOBALMEMBERS, script_str); SysFreeString(script_str); } @@ -793,7 +848,7 @@ static void run_from_res(const char *name) SET_EXPECT(global_success_d); SET_EXPECT(global_success_i); - parse_script(str); + parse_script(SCRIPTITEM_GLOBALMEMBERS, str); CHECK_CALLED(global_success_d); CHECK_CALLED(global_success_i); @@ -916,6 +971,21 @@ static void run_tests(void) parse_script_a("ok(String.prototype.concat.call(testObj, ' OK') === '1 OK', 'wrong concat result');"); CHECK_CALLED(testobj_value); + SET_EXPECT(global_propget_d); + SET_EXPECT(global_propget_i); + parse_script_a("this.testPropGet;"); + CHECK_CALLED(global_propget_d); + CHECK_CALLED(global_propget_i); + + SET_EXPECT(global_propget_d); + SET_EXPECT(global_propget_i); + parse_script_a("(function () { this.testPropGet; })();"); + CHECK_CALLED(global_propget_d); + CHECK_CALLED(global_propget_i); + + parse_script_a("testThis(this);"); + parse_script_a("(function () { testThis(this); })();"); + run_from_res("lang.js"); run_from_res("api.js"); run_from_res("regexp.js"); @@ -923,6 +993,9 @@ static void run_tests(void) test_isvisible(FALSE); test_isvisible(TRUE); + parse_script_af(0, "test.testThis2(this);"); + parse_script_af(0, "(function () { test.testThis2(this); })();"); + hres = parse_htmlscript_a(""); diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in index 299f3247e8f..df977366d77 100644 --- a/dlls/kernel32/Makefile.in +++ b/dlls/kernel32/Makefile.in @@ -9,10 +9,7 @@ IMPORTS = ntdll EXTRALIBS = @COREFOUNDATIONLIB@ @LIBPOLL@ EXTRADLLFLAGS = -Wb,-F,KERNEL32.dll -Wl,--image-base,0x7b800000 -SPEC_SRCS16 = \ - krnl386.exe.spec \ - system.drv.spec \ - toolhelp.spec +SPEC_SRCS16 = krnl386.exe.spec C_SRCS = \ actctx.c \ @@ -55,7 +52,6 @@ C_SRCS = \ string.c \ sync.c \ syslevel.c \ - system.c \ tape.c \ task.c \ thread.c \ @@ -73,8 +69,7 @@ C_SRCS16 = \ atom16.c \ error16.c \ kernel16.c \ - registry16.c \ - toolhelp16.c + registry16.c RC_SRCS = \ locale_rc.rc \ diff --git a/dlls/kernel32/debugger.c b/dlls/kernel32/debugger.c index b83647caf06..bb0b5faed42 100644 --- a/dlls/kernel32/debugger.c +++ b/dlls/kernel32/debugger.c @@ -402,6 +402,11 @@ BOOL WINAPI IsDebuggerPresent(void) */ BOOL WINAPI CheckRemoteDebuggerPresent(HANDLE process, PBOOL DebuggerPresent) { + if(!process || !DebuggerPresent) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } FIXME("(%p)->(%p): Stub!\n", process, DebuggerPresent); *DebuggerPresent = FALSE; return TRUE; diff --git a/dlls/kernel32/dosmem.c b/dlls/kernel32/dosmem.c index f1621394e29..178ed07a15a 100644 --- a/dlls/kernel32/dosmem.c +++ b/dlls/kernel32/dosmem.c @@ -38,7 +38,7 @@ #include "wine/winbase16.h" #include "kernel_private.h" -#include "toolhelp.h" +#include "kernel16_private.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(dosmem); @@ -115,7 +115,6 @@ BOOL load_winedos(void) GET_ADDR(outport); GET_ADDR(EmulateInterruptPM); GET_ADDR(CallBuiltinHandler); - GET_ADDR(BiosTick); #undef GET_ADDR } RtlRemoveVectoredExceptionHandler( dosmem_handler ); diff --git a/dlls/kernel32/global16.c b/dlls/kernel32/global16.c index 6d70767d952..c5dcc14e349 100644 --- a/dlls/kernel32/global16.c +++ b/dlls/kernel32/global16.c @@ -38,7 +38,6 @@ #endif #include "wine/winbase16.h" -#include "toolhelp.h" #include "winternl.h" #include "kernel_private.h" #include "kernel16_private.h" @@ -71,6 +70,7 @@ static GLOBALARENA *pGlobalArena; static int globalArenaSize; #define GLOBAL_MAX_ALLOC_SIZE 0x00ff0000 /* Largest allocation is 16M - 64K */ +#define GLOBAL_MAX_COUNT 8192 /* Max number of allocated blocks */ #define VALID_HANDLE(handle) (((handle)>>__AHSHIFT)> __AHSHIFT)) @@ -113,15 +113,16 @@ static GLOBALARENA *GLOBAL_GetArena( WORD sel, WORD selcount ) if (((sel >> __AHSHIFT) + selcount) > globalArenaSize) { int newsize = ((sel >> __AHSHIFT) + selcount + 0xff) & ~0xff; - GLOBALARENA *pNewArena; - if (pGlobalArena) - pNewArena = HeapReAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, - pGlobalArena, newsize * sizeof(GLOBALARENA) ); - else - pNewArena = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, newsize * sizeof(GLOBALARENA) ); - if (!pNewArena) return 0; - pGlobalArena = pNewArena; + if (!pGlobalArena) + { + pGlobalArena = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, + GLOBAL_MAX_COUNT * sizeof(GLOBALARENA) ); + if (!pGlobalArena) return 0; + /* Hack: store a pointer to it in THHOOK instead of a handle */ + *(GLOBALARENA **)&pThhook->hGlobalHeap = pGlobalArena; + } + if (newsize > GLOBAL_MAX_COUNT) return 0; globalArenaSize = newsize; } return pGlobalArena + (sel >> __AHSHIFT); @@ -949,6 +950,8 @@ DWORD WINAPI GlobalMasterHandle16(void) /*********************************************************************** * GlobalHandleToSel (TOOLHELP.50) + * + * FIXME: This is in TOOLHELP but we keep a copy here for now. */ WORD WINAPI GlobalHandleToSel16( HGLOBAL16 handle ) { @@ -967,133 +970,13 @@ WORD WINAPI GlobalHandleToSel16( HGLOBAL16 handle ) /*********************************************************************** - * GlobalFirst (TOOLHELP.51) - */ -BOOL16 WINAPI GlobalFirst16( GLOBALENTRY *pGlobal, WORD wFlags ) -{ - if (wFlags == GLOBAL_LRU) return FALSE; - pGlobal->dwNext = 0; - return GlobalNext16( pGlobal, wFlags ); -} - - -/*********************************************************************** - * GlobalNext (TOOLHELP.52) - */ -BOOL16 WINAPI GlobalNext16( GLOBALENTRY *pGlobal, WORD wFlags) -{ - GLOBALARENA *pArena; - - if (pGlobal->dwNext >= globalArenaSize) return FALSE; - pArena = pGlobalArena + pGlobal->dwNext; - if (wFlags == GLOBAL_FREE) /* only free blocks */ - { - int i; - for (i = pGlobal->dwNext; i < globalArenaSize; i++, pArena++) - if (pArena->size == 0) break; /* block is free */ - if (i >= globalArenaSize) return FALSE; - pGlobal->dwNext = i; - } - - pGlobal->dwAddress = (DWORD_PTR)pArena->base; - pGlobal->dwBlockSize = pArena->size; - pGlobal->hBlock = pArena->handle; - pGlobal->wcLock = pArena->lockCount; - pGlobal->wcPageLock = pArena->pageLockCount; - pGlobal->wFlags = (GetCurrentPDB16() == pArena->hOwner); - pGlobal->wHeapPresent = FALSE; - pGlobal->hOwner = pArena->hOwner; - pGlobal->wType = GT_UNKNOWN; - pGlobal->wData = 0; - pGlobal->dwNext++; - return TRUE; -} - - -/*********************************************************************** - * GlobalInfo (TOOLHELP.53) - */ -BOOL16 WINAPI GlobalInfo16( GLOBALINFO *pInfo ) -{ - int i; - GLOBALARENA *pArena; - - pInfo->wcItems = globalArenaSize; - pInfo->wcItemsFree = 0; - pInfo->wcItemsLRU = 0; - for (i = 0, pArena = pGlobalArena; i < globalArenaSize; i++, pArena++) - if (pArena->size == 0) pInfo->wcItemsFree++; - return TRUE; -} - - -/*********************************************************************** - * GlobalEntryHandle (TOOLHELP.54) - */ -BOOL16 WINAPI GlobalEntryHandle16( GLOBALENTRY *pGlobal, HGLOBAL16 hItem ) -{ - GLOBALARENA *pArena = GET_ARENA_PTR(hItem); - - pGlobal->dwAddress = (DWORD_PTR)pArena->base; - pGlobal->dwBlockSize = pArena->size; - pGlobal->hBlock = pArena->handle; - pGlobal->wcLock = pArena->lockCount; - pGlobal->wcPageLock = pArena->pageLockCount; - pGlobal->wFlags = (GetCurrentPDB16() == pArena->hOwner); - pGlobal->wHeapPresent = FALSE; - pGlobal->hOwner = pArena->hOwner; - pGlobal->wType = GT_UNKNOWN; - pGlobal->wData = 0; - pGlobal->dwNext++; - return TRUE; -} - - -/*********************************************************************** - * GlobalEntryModule (TOOLHELP.55) - */ -BOOL16 WINAPI GlobalEntryModule16( GLOBALENTRY *pGlobal, HMODULE16 hModule, - WORD wSeg ) -{ - FIXME("(%p, 0x%04x, 0x%04x), stub.\n", pGlobal, hModule, wSeg); - return FALSE; -} - - -/*********************************************************************** - * MemManInfo (TOOLHELP.72) - */ -BOOL16 WINAPI MemManInfo16( MEMMANINFO *info ) -{ - MEMORYSTATUS status; - - /* - * Not unsurprisingly although the documentation says you - * _must_ provide the size in the dwSize field, this function - * (under Windows) always fills the structure and returns true. - */ - GlobalMemoryStatus( &status ); - info->wPageSize = getpagesize(); - info->dwLargestFreeBlock = status.dwAvailVirtual; - info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize; - info->dwMaxPagesLockable = info->dwMaxPagesAvailable; - info->dwTotalLinearSpace = status.dwTotalVirtual / info->wPageSize; - info->dwTotalUnlockedPages = info->dwTotalLinearSpace; - info->dwFreePages = info->dwMaxPagesAvailable; - info->dwTotalPages = info->dwTotalLinearSpace; - info->dwFreeLinearSpace = info->dwMaxPagesAvailable; - info->dwSwapFilePages = status.dwTotalPageFile / info->wPageSize; - return TRUE; -} - -/*********************************************************************** * GetFreeMemInfo (KERNEL.316) */ DWORD WINAPI GetFreeMemInfo16(void) { - MEMMANINFO info; - MemManInfo16( &info ); - return MAKELONG( info.dwTotalLinearSpace, info.dwMaxPagesAvailable ); + MEMORYSTATUS status; + GlobalMemoryStatus( &status ); + return MAKELONG( status.dwTotalVirtual/getpagesize(), status.dwAvailVirtual/getpagesize() ); } /*********************************************************************** diff --git a/dlls/kernel32/instr.c b/dlls/kernel32/instr.c index 7fdc4cd6cab..7f5ddc45dd7 100644 --- a/dlls/kernel32/instr.c +++ b/dlls/kernel32/instr.c @@ -106,13 +106,6 @@ static BOOL INSTR_ReplaceSelector( CONTEXT86 *context, WORD *sel ) { if (*sel == 0x40) { - static WORD sys_timer = 0; - if (!sys_timer) - { - if (!winedos.BiosTick) load_winedos(); - if (winedos.BiosTick) - sys_timer = CreateSystemTimer( 55, winedos.BiosTick ); - } *sel = DOSMEM_BiosDataSeg; return TRUE; } diff --git a/dlls/kernel32/kernel16.c b/dlls/kernel32/kernel16.c index 094156dfbf8..c5683dbeb48 100644 --- a/dlls/kernel32/kernel16.c +++ b/dlls/kernel32/kernel16.c @@ -26,7 +26,6 @@ #include "winternl.h" #include "wownt32.h" -#include "toolhelp.h" #include "kernel_private.h" #include "kernel16_private.h" #include "wine/debug.h" @@ -106,6 +105,17 @@ LONG WINAPI KERNEL_nop(void) return 0; } +/*********************************************************************** + * ToolHelpHook (KERNEL.341) + * see "Undocumented Windows" + */ +FARPROC16 WINAPI ToolHelpHook16(FARPROC16 func) +{ + static FARPROC16 hook; + + FIXME("(%p), stub.\n", func); + return InterlockedExchangePointer( (void **)&hook, func ); +} /* thunk for 16-bit CreateThread */ struct thread_args diff --git a/dlls/kernel32/kernel16_private.h b/dlls/kernel32/kernel16_private.h index 0c59bbd9d70..aada5b29759 100644 --- a/dlls/kernel32/kernel16_private.h +++ b/dlls/kernel32/kernel16_private.h @@ -188,6 +188,13 @@ static inline void stack16_pop( int size ) NtCurrentTeb()->WOW32Reserved = (char *)NtCurrentTeb()->WOW32Reserved + size; } +/* global16.c */ +extern HGLOBAL16 GLOBAL_CreateBlock( UINT16 flags, void *ptr, DWORD size, + HGLOBAL16 hOwner, unsigned char selflags ); +extern BOOL16 GLOBAL_FreeBlock( HGLOBAL16 handle ); +extern BOOL16 GLOBAL_MoveBlock( HGLOBAL16 handle, void *ptr, DWORD size ); +extern HGLOBAL16 GLOBAL_Alloc( WORD flags, DWORD size, HGLOBAL16 hOwner, unsigned char selflags ); + /* ne_module.c */ extern NE_MODULE *NE_GetPtr( HMODULE16 hModule ); extern WORD NE_GetOrdinal( HMODULE16 hModule, const char *name ); diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c index 2365e7a7371..d4f072429f8 100644 --- a/dlls/kernel32/kernel_main.c +++ b/dlls/kernel32/kernel_main.c @@ -35,7 +35,6 @@ #include "wine/winbase16.h" #include "wine/library.h" -#include "toolhelp.h" #include "kernel_private.h" #include "kernel16_private.h" #include "console_private.h" diff --git a/dlls/kernel32/kernel_private.h b/dlls/kernel32/kernel_private.h index 386bab27912..a65d93f36e4 100644 --- a/dlls/kernel32/kernel_private.h +++ b/dlls/kernel32/kernel_private.h @@ -137,7 +137,6 @@ extern struct winedos_exports void (WINAPI *CallBuiltinHandler)( CONTEXT86 *context, BYTE intnum ); DWORD (WINAPI *inport)( int port, int size ); void (WINAPI *outport)( int port, int size, DWORD val ); - void (* BiosTick)(WORD timer); } winedos; /* returns directory handle for named objects */ diff --git a/dlls/kernel32/local16.c b/dlls/kernel32/local16.c index 6171975add0..3470b31232d 100644 --- a/dlls/kernel32/local16.c +++ b/dlls/kernel32/local16.c @@ -35,7 +35,6 @@ #include #include "wine/winbase16.h" #include "wownt32.h" -#include "toolhelp.h" #include "winternl.h" #include "kernel_private.h" #include "kernel16_private.h" @@ -126,6 +125,30 @@ typedef struct WORD magic; /* 28 Magic number */ } LOCALHEAPINFO; +typedef struct +{ + DWORD dwSize; /* 00 */ + DWORD dwMemReserved; /* 04 */ + DWORD dwMemCommitted; /* 08 */ + DWORD dwTotalFree; /* 0C */ + DWORD dwLargestFreeBlock; /* 10 */ + DWORD dwcFreeHandles; /* 14 */ +} LOCAL32INFO; + +typedef struct +{ + DWORD dwSize; /* 00 */ + WORD hHandle; /* 04 */ + DWORD dwAddress; /* 06 */ + DWORD dwSizeBlock; /* 0A */ + WORD wFlags; /* 0E */ + WORD wType; /* 10 */ + WORD hHeap; /* 12 */ + WORD wHeapType; /* 14 */ + DWORD dwNext; /* 16 */ + DWORD dwNextAlt; /* 1A */ +} LOCAL32ENTRY; + #include "poppack.h" #define LOCAL_HEAP_MAGIC 0x484c /* 'LH' */ @@ -1686,68 +1709,6 @@ WORD WINAPI LocalHandleDelta16( WORD delta ) /*********************************************************************** - * LocalInfo (TOOLHELP.56) - */ -BOOL16 WINAPI LocalInfo16( LOCALINFO *pLocalInfo, HGLOBAL16 handle ) -{ - LOCALHEAPINFO *pInfo = LOCAL_GetHeap(SELECTOROF(WOWGlobalLock16(handle))); - if (!pInfo) return FALSE; - pLocalInfo->wcItems = pInfo->items; - return TRUE; -} - - -/*********************************************************************** - * LocalFirst (TOOLHELP.57) - */ -BOOL16 WINAPI LocalFirst16( LOCALENTRY *pLocalEntry, HGLOBAL16 handle ) -{ - WORD ds = GlobalHandleToSel16( handle ); - char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); - LOCALHEAPINFO *pInfo = LOCAL_GetHeap( ds ); - if (!pInfo) return FALSE; - - pLocalEntry->hHandle = pInfo->first + ARENA_HEADER_SIZE; - pLocalEntry->wAddress = pLocalEntry->hHandle; - pLocalEntry->wFlags = LF_FIXED; - pLocalEntry->wcLock = 0; - pLocalEntry->wType = LT_NORMAL; - pLocalEntry->hHeap = handle; - pLocalEntry->wHeapType = NORMAL_HEAP; - pLocalEntry->wNext = ARENA_PTR(ptr,pInfo->first)->next; - pLocalEntry->wSize = pLocalEntry->wNext - pLocalEntry->hHandle; - return TRUE; -} - - -/*********************************************************************** - * LocalNext (TOOLHELP.58) - */ -BOOL16 WINAPI LocalNext16( LOCALENTRY *pLocalEntry ) -{ - WORD ds = GlobalHandleToSel16( pLocalEntry->hHeap ); - char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); - LOCALARENA *pArena; - - if (!LOCAL_GetHeap( ds )) return FALSE; - if (!pLocalEntry->wNext) return FALSE; - pArena = ARENA_PTR( ptr, pLocalEntry->wNext ); - - pLocalEntry->hHandle = pLocalEntry->wNext + ARENA_HEADER_SIZE; - pLocalEntry->wAddress = pLocalEntry->hHandle; - pLocalEntry->wFlags = (pArena->prev & 3) + 1; - pLocalEntry->wcLock = 0; - pLocalEntry->wType = LT_NORMAL; - if (pArena->next != pLocalEntry->wNext) /* last one? */ - pLocalEntry->wNext = pArena->next; - else - pLocalEntry->wNext = 0; - pLocalEntry->wSize = pLocalEntry->wNext - pLocalEntry->hHandle; - return TRUE; -} - - -/*********************************************************************** * 32-bit local heap functions (Win95; undocumented) */ @@ -2189,7 +2150,6 @@ static LOCAL32HEADER *Local32_GetHeap( HGLOBAL16 handle ) /*********************************************************************** * Local32Info (KERNEL.444) - * Local32Info (TOOLHELP.84) */ BOOL16 WINAPI Local32Info16( LOCAL32INFO *pLocal32Info, HGLOBAL16 handle ) { @@ -2236,7 +2196,6 @@ BOOL16 WINAPI Local32Info16( LOCAL32INFO *pLocal32Info, HGLOBAL16 handle ) /*********************************************************************** * Local32First (KERNEL.445) - * Local32First (TOOLHELP.85) */ BOOL16 WINAPI Local32First16( LOCAL32ENTRY *pLocal32Entry, HGLOBAL16 handle ) { @@ -2246,7 +2205,6 @@ BOOL16 WINAPI Local32First16( LOCAL32ENTRY *pLocal32Entry, HGLOBAL16 handle ) /*********************************************************************** * Local32Next (KERNEL.446) - * Local32Next (TOOLHELP.86) */ BOOL16 WINAPI Local32Next16( LOCAL32ENTRY *pLocal32Entry ) { diff --git a/dlls/kernel32/ne_module.c b/dlls/kernel32/ne_module.c index 87a1a86737b..8f22ccb6acb 100644 --- a/dlls/kernel32/ne_module.c +++ b/dlls/kernel32/ne_module.c @@ -36,7 +36,6 @@ #include "wine/winbase16.h" #include "wownt32.h" #include "winternl.h" -#include "toolhelp.h" #include "kernel_private.h" #include "kernel16_private.h" #include "wine/exception.h" @@ -1955,58 +1954,6 @@ FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE hModule, LPCSTR name ) return GetProcAddress16( LOWORD(hModule), name ); } -/********************************************************************** - * ModuleFirst (TOOLHELP.59) - */ -BOOL16 WINAPI ModuleFirst16( MODULEENTRY *lpme ) -{ - lpme->wNext = hFirstModule; - return ModuleNext16( lpme ); -} - - -/********************************************************************** - * ModuleNext (TOOLHELP.60) - */ -BOOL16 WINAPI ModuleNext16( MODULEENTRY *lpme ) -{ - NE_MODULE *pModule; - char *name; - - if (!lpme->wNext) return FALSE; - if (!(pModule = NE_GetPtr( lpme->wNext ))) return FALSE; - name = (char *)pModule + pModule->ne_restab; - memcpy( lpme->szModule, name + 1, min(*name, MAX_MODULE_NAME) ); - lpme->szModule[min(*name, MAX_MODULE_NAME)] = '\0'; - lpme->hModule = lpme->wNext; - lpme->wcUsage = pModule->count; - lstrcpynA( lpme->szExePath, NE_MODULE_NAME(pModule), sizeof(lpme->szExePath) ); - lpme->wNext = pModule->next; - return TRUE; -} - - -/********************************************************************** - * ModuleFindName (TOOLHELP.61) - */ -BOOL16 WINAPI ModuleFindName16( MODULEENTRY *lpme, LPCSTR name ) -{ - lpme->wNext = GetModuleHandle16( name ); - return ModuleNext16( lpme ); -} - - -/********************************************************************** - * ModuleFindHandle (TOOLHELP.62) - */ -BOOL16 WINAPI ModuleFindHandle16( MODULEENTRY *lpme, HMODULE16 hModule ) -{ - hModule = GetExePtr( hModule ); - lpme->wNext = hModule; - return ModuleNext16( lpme ); -} - - /*************************************************************************** * IsRomModule (KERNEL.323) */ diff --git a/dlls/kernel32/ne_segment.c b/dlls/kernel32/ne_segment.c index 0ade4b0ae3c..4bc6603884f 100644 --- a/dlls/kernel32/ne_segment.c +++ b/dlls/kernel32/ne_segment.c @@ -39,7 +39,6 @@ #include "wine/library.h" #include "kernel_private.h" #include "kernel16_private.h" -#include "toolhelp.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(fixup); diff --git a/dlls/kernel32/selector.c b/dlls/kernel32/selector.c index 4a642c04ca2..33e6b904ef7 100644 --- a/dlls/kernel32/selector.c +++ b/dlls/kernel32/selector.c @@ -27,7 +27,6 @@ #include "wine/server.h" #include "wine/debug.h" #include "kernel_private.h" -#include "toolhelp.h" WINE_DEFAULT_DEBUG_CHANNEL(selector); @@ -418,41 +417,6 @@ BOOL16 WINAPI IsBadFlatReadWritePtr16( SEGPTR ptr, DWORD size, BOOL16 bWrite ) } -/*********************************************************************** - * MemoryRead (TOOLHELP.78) - */ -DWORD WINAPI MemoryRead16( WORD sel, DWORD offset, void *buffer, DWORD count ) -{ - LDT_ENTRY entry; - DWORD limit; - - wine_ldt_get_entry( sel, &entry ); - if (wine_ldt_is_empty( &entry )) return 0; - limit = wine_ldt_get_limit( &entry ); - if (offset > limit) return 0; - if (offset + count > limit + 1) count = limit + 1 - offset; - memcpy( buffer, (char *)wine_ldt_get_base(&entry) + offset, count ); - return count; -} - - -/*********************************************************************** - * MemoryWrite (TOOLHELP.79) - */ -DWORD WINAPI MemoryWrite16( WORD sel, DWORD offset, void *buffer, DWORD count ) -{ - LDT_ENTRY entry; - DWORD limit; - - wine_ldt_get_entry( sel, &entry ); - if (wine_ldt_is_empty( &entry )) return 0; - limit = wine_ldt_get_limit( &entry ); - if (offset > limit) return 0; - if (offset + count > limit) count = limit + 1 - offset; - memcpy( (char *)wine_ldt_get_base(&entry) + offset, buffer, count ); - return count; -} - /************************************* Win95 pointer mapping functions * * */ @@ -559,38 +523,14 @@ LPVOID WINAPI MapSLFix( SEGPTR sptr ) return MapSL(sptr); } +#ifdef __i386__ + /*********************************************************************** * UnMapSLFixArray (KERNEL32.@) * * Must not change EAX, hence defined as asm function. */ -#ifdef __i386__ __ASM_STDCALL_FUNC( UnMapSLFixArray, 8, "ret $8" ) -#endif - - -/*********************************************************************** - * GetThreadSelectorEntry (KERNEL32.@) - */ -BOOL WINAPI GetThreadSelectorEntry( HANDLE hthread, DWORD sel, LPLDT_ENTRY ldtent ) -{ - THREAD_DESCRIPTOR_INFORMATION tdi; - NTSTATUS status; - - tdi.Selector = sel; - status = NtQueryInformationThread( hthread, ThreadDescriptorTableEntry, - &tdi, sizeof(tdi), NULL); - if (status) - { - SetLastError( RtlNtStatusToDosError(status) ); - return FALSE; - } - *ldtent = tdi.Entry; - return TRUE; -} - - -#ifdef __i386__ /*********************************************************************** * SMapLS (KERNEL32.@) diff --git a/dlls/kernel32/snoop16.c b/dlls/kernel32/snoop16.c index 8c79269e8ed..efa20cd0937 100644 --- a/dlls/kernel32/snoop16.c +++ b/dlls/kernel32/snoop16.c @@ -33,7 +33,6 @@ #include "wine/library.h" #include "kernel_private.h" #include "kernel16_private.h" -#include "toolhelp.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(snoop); diff --git a/dlls/kernel32/task.c b/dlls/kernel32/task.c index 0381097187d..298742045e5 100644 --- a/dlls/kernel32/task.c +++ b/dlls/kernel32/task.c @@ -38,14 +38,12 @@ #include "wine/winbase16.h" #include "winternl.h" -#include "toolhelp.h" #include "kernel_private.h" #include "kernel16_private.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(task); -WINE_DECLARE_DEBUG_CHANNEL(toolhelp); #include "pshpack1.h" @@ -1462,54 +1460,6 @@ HMODULE16 WINAPI GetExePtr( HANDLE16 handle ) } -/*********************************************************************** - * TaskFirst (TOOLHELP.63) - */ -BOOL16 WINAPI TaskFirst16( TASKENTRY *lpte ) -{ - lpte->hNext = hFirstTask; - return TaskNext16( lpte ); -} - - -/*********************************************************************** - * TaskNext (TOOLHELP.64) - */ -BOOL16 WINAPI TaskNext16( TASKENTRY *lpte ) -{ - TDB *pTask; - INSTANCEDATA *pInstData; - - TRACE_(toolhelp)("(%p): task=%04x\n", lpte, lpte->hNext ); - if (!lpte->hNext) return FALSE; - - /* make sure that task and hInstance are valid (skip initial Wine task !) */ - while (1) { - pTask = TASK_GetPtr( lpte->hNext ); - if (!pTask || pTask->magic != TDB_MAGIC) return FALSE; - if (pTask->hInstance) - break; - lpte->hNext = pTask->hNext; - } - pInstData = MapSL( MAKESEGPTR( GlobalHandleToSel16(pTask->hInstance), 0 ) ); - lpte->hTask = lpte->hNext; - lpte->hTaskParent = pTask->hParent; - lpte->hInst = pTask->hInstance; - lpte->hModule = pTask->hModule; - lpte->wSS = SELECTOROF( pTask->teb->WOW32Reserved ); - lpte->wSP = OFFSETOF( pTask->teb->WOW32Reserved ); - lpte->wStackTop = pInstData->stacktop; - lpte->wStackMinimum = pInstData->stackmin; - lpte->wStackBottom = pInstData->stackbottom; - lpte->wcEvents = pTask->nEvents; - lpte->hQueue = pTask->hQueue; - lstrcpynA( lpte->szModule, pTask->module_name, sizeof(lpte->szModule) ); - lpte->wPSPOffset = 0x100; /*??*/ - lpte->hNext = pTask->hNext; - return TRUE; -} - - typedef INT (WINAPI *MessageBoxA_funcptr)(HWND hWnd, LPCSTR text, LPCSTR title, UINT type); /************************************************************************** @@ -1539,39 +1489,6 @@ void WINAPI FatalAppExit16( UINT16 action, LPCSTR str ) /*********************************************************************** - * TerminateApp (TOOLHELP.77) - * - * See "Undocumented Windows". - */ -void WINAPI TerminateApp16(HTASK16 hTask, WORD wFlags) -{ - if (hTask && hTask != GetCurrentTask()) - { - FIXME("cannot terminate task %x\n", hTask); - return; - } - - if (wFlags & NO_UAE_BOX) - { - UINT16 old_mode; - old_mode = SetErrorMode16(0); - SetErrorMode16(old_mode|SEM_NOGPFAULTERRORBOX); - } - FatalAppExit16( 0, NULL ); - - /* hmm, we're still alive ?? */ - - /* check undocumented flag */ - if (!(wFlags & 0x8000)) - TASK_CallTaskSignalProc( USIG16_TERMINATION, hTask ); - - /* UndocWin says to call int 0x21/0x4c exit=0xff here, - but let's just call ExitThread */ - ExitThread(0xff); -} - - -/*********************************************************************** * GetAppCompatFlags (KERNEL.354) */ DWORD WINAPI GetAppCompatFlags16( HTASK16 hTask ) diff --git a/dlls/kernel32/tests/debugger.c b/dlls/kernel32/tests/debugger.c index 2f324789357..57d68ec6e3a 100644 --- a/dlls/kernel32/tests/debugger.c +++ b/dlls/kernel32/tests/debugger.c @@ -32,6 +32,7 @@ static int myARGC; static char** myARGV; +static BOOL (WINAPI *pCheckRemoteDebuggerPresent)(HANDLE,PBOOL); static BOOL (WINAPI *pDebugActiveProcessStop)(DWORD); static BOOL (WINAPI *pDebugSetProcessKillOnExit)(BOOL); @@ -431,11 +432,42 @@ static void test_ExitCode(void) } } +static void test_RemoteDebugger(void) +{ + BOOL bret, present; + if(!pCheckRemoteDebuggerPresent) + { + win_skip("CheckRemoteDebuggerPresent is not available\n"); + return; + } + present = TRUE; + SetLastError(0xdeadbeef); + bret = pCheckRemoteDebuggerPresent(GetCurrentProcess(),&present); + ok(bret , "expected CheckRemoteDebuggerPresent to succeed\n"); + ok(0xdeadbeef == GetLastError(), + "expected error to be unchanged, got %d/%x\n",GetLastError(), GetLastError()); + + present = TRUE; + SetLastError(0xdeadbeef); + bret = pCheckRemoteDebuggerPresent(NULL,&present); + ok(!bret , "expected CheckRemoteDebuggerPresent to fail\n"); + ok(present, "expected parameter to be unchanged\n"); + ok(ERROR_INVALID_PARAMETER == GetLastError(), + "expected error ERROR_INVALID_PARAMETER, got %d/%x\n",GetLastError(), GetLastError()); + + SetLastError(0xdeadbeef); + bret = pCheckRemoteDebuggerPresent(GetCurrentProcess(),NULL); + ok(!bret , "expected CheckRemoteDebuggerPresent to fail\n"); + ok(ERROR_INVALID_PARAMETER == GetLastError(), + "expected error ERROR_INVALID_PARAMETER, got %d/%x\n",GetLastError(), GetLastError()); +} + START_TEST(debugger) { HMODULE hdll; hdll=GetModuleHandle("kernel32.dll"); + pCheckRemoteDebuggerPresent=(void*)GetProcAddress(hdll, "CheckRemoteDebuggerPresent"); pDebugActiveProcessStop=(void*)GetProcAddress(hdll, "DebugActiveProcessStop"); pDebugSetProcessKillOnExit=(void*)GetProcAddress(hdll, "DebugSetProcessKillOnExit"); @@ -451,5 +483,6 @@ START_TEST(debugger) else { test_ExitCode(); + test_RemoteDebugger(); } } diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index e2ad49d596f..5219f79da76 100644 --- a/dlls/kernel32/tests/file.c +++ b/dlls/kernel32/tests/file.c @@ -1860,10 +1860,11 @@ static void test_FindNextFileA(void) ok ( err == ERROR_NO_MORE_FILES, "GetLastError should return ERROR_NO_MORE_FILES\n"); } -static void test_FindFirstFileExA(void) +static void test_FindFirstFileExA(FINDEX_SEARCH_OPS search_ops) { WIN32_FIND_DATAA search_results; HANDLE handle; + BOOL ret; if (!pFindFirstFileExA) { @@ -1875,9 +1876,8 @@ static void test_FindFirstFileExA(void) _lclose(_lcreat("test-dir\\file1", 0)); _lclose(_lcreat("test-dir\\file2", 0)); CreateDirectoryA("test-dir\\dir1", NULL); - /* FindExLimitToDirectories is ignored */ SetLastError(0xdeadbeef); - handle = pFindFirstFileExA("test-dir\\*", FindExInfoStandard, &search_results, FindExSearchLimitToDirectories, NULL, 0); + handle = pFindFirstFileExA("test-dir\\*", FindExInfoStandard, &search_results, search_ops, NULL, 0); if (handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) { win_skip("FindFirstFileExA is not implemented\n"); @@ -1894,7 +1894,18 @@ static void test_FindFirstFileExA(void) ok(FindNextFile(handle, &search_results), "Fetching third file failed\n"); ok(CHECK_NAME(search_results.cFileName), "Invalid third entry - %s\n", search_results.cFileName); - ok(FindNextFile(handle, &search_results), "Fetching fourth file failed\n"); + SetLastError(0xdeadbeef); + ret = FindNextFile(handle, &search_results); + if (!ret && (GetLastError() == ERROR_NO_MORE_FILES) && (search_ops == FindExSearchLimitToDirectories)) + { + skip("File system supports directory filtering\n"); + /* Results from the previous call are not cleared */ + ok(strcmp(search_results.cFileName, "dir1") == 0, "Third entry should be 'dir1' is %s\n", search_results.cFileName); + FindClose( handle ); + goto cleanup; + } + + ok(ret, "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"); @@ -1902,7 +1913,7 @@ static void test_FindFirstFileExA(void) #undef CHECK_NAME - ok(FindNextFile(handle, &search_results) == FALSE, "Fetching sixth file should failed\n"); + ok(FindNextFile(handle, &search_results) == FALSE, "Fetching sixth file should fail\n"); FindClose( handle ); @@ -2804,7 +2815,9 @@ START_TEST(file) test_MoveFileW(); test_FindFirstFileA(); test_FindNextFileA(); - test_FindFirstFileExA(); + test_FindFirstFileExA(0); + /* FindExLimitToDirectories is ignored if the file system doesn't support directory filtering */ + test_FindFirstFileExA(FindExSearchLimitToDirectories); test_LockFile(); test_file_sharing(); test_offset_in_overlapped_structure(); diff --git a/dlls/kernel32/thread.c b/dlls/kernel32/thread.c index 0029e1179bc..3115a609c85 100644 --- a/dlls/kernel32/thread.c +++ b/dlls/kernel32/thread.c @@ -422,6 +422,26 @@ DWORD WINAPI SetThreadIdealProcessor( } +/*********************************************************************** + * GetThreadSelectorEntry (KERNEL32.@) + */ +BOOL WINAPI GetThreadSelectorEntry( HANDLE hthread, DWORD sel, LPLDT_ENTRY ldtent ) +{ + THREAD_DESCRIPTOR_INFORMATION tdi; + NTSTATUS status; + + tdi.Selector = sel; + status = NtQueryInformationThread( hthread, ThreadDescriptorTableEntry, &tdi, sizeof(tdi), NULL); + if (status) + { + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; + } + *ldtent = tdi.Entry; + return TRUE; +} + + /* callback for QueueUserAPC */ static void CALLBACK call_user_apc( ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3 ) { diff --git a/dlls/kernel32/time.c b/dlls/kernel32/time.c index 7079b499286..2b7bd6cce7b 100644 --- a/dlls/kernel32/time.c +++ b/dlls/kernel32/time.c @@ -325,7 +325,7 @@ BOOL WINAPI GetSystemTimeAdjustment( PDWORD lpTimeAdjustment, PDWORD lpTimeIncre PBOOL lpTimeAdjustmentDisabled ) { *lpTimeAdjustment = 0; - *lpTimeIncrement = 0; + *lpTimeIncrement = 10000000 / sysconf(_SC_CLK_TCK); *lpTimeAdjustmentDisabled = TRUE; return TRUE; } diff --git a/dlls/kernel32/toolhelp16.c b/dlls/kernel32/toolhelp16.c deleted file mode 100644 index c6931d28e36..00000000000 --- a/dlls/kernel32/toolhelp16.c +++ /dev/null @@ -1,219 +0,0 @@ -/* - * Misc Toolhelp functions - * - * Copyright 1996 Marcus Meissner - * - * 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 "config.h" - -#include -#include -#include -#ifdef HAVE_UNISTD_H -# include -#endif -#include -#include -#include "windef.h" -#include "winbase.h" -#include "winternl.h" - -#include "wine/winbase16.h" -#include "toolhelp.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(toolhelp); - -/* FIXME: to make this work, we have to call back all these registered - * functions from all over the WINE code. Someone with more knowledge than - * me please do that. -Marcus - */ - -static struct notify -{ - HTASK16 htask; - FARPROC16 lpfnCallback; - WORD wFlags; -} *notifys = NULL; - -static int nrofnotifys = 0; - -static FARPROC16 HookNotify = NULL; - - -/*********************************************************************** - * TaskFindHandle (TOOLHELP.65) - */ -BOOL16 WINAPI TaskFindHandle16( TASKENTRY *lpte, HTASK16 hTask ) -{ - lpte->hNext = hTask; - return TaskNext16( lpte ); -} - - -/*********************************************************************** - * NotifyRegister (TOOLHELP.73) - */ -BOOL16 WINAPI NotifyRegister16( HTASK16 htask, FARPROC16 lpfnCallback, - WORD wFlags ) -{ - int i; - - FIXME("(%x,%x,%x), semi-stub.\n", - htask, (DWORD)lpfnCallback, wFlags ); - if (!htask) htask = GetCurrentTask(); - for (i=0;idwmsSinceStart = pTimerInfo->dwmsThisVM = GetTickCount(); - return TRUE; -} - -/*********************************************************************** - * SystemHeapInfo (TOOLHELP.71) - */ -BOOL16 WINAPI SystemHeapInfo16( SYSHEAPINFO *pHeapInfo ) -{ - STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved); - HANDLE16 oldDS = stack16->ds; - WORD user = LoadLibrary16( "USER.EXE" ); - WORD gdi = LoadLibrary16( "GDI.EXE" ); - stack16->ds = user; - pHeapInfo->wUserFreePercent = (int)LocalCountFree16() * 100 / LocalHeapSize16(); - stack16->ds = gdi; - pHeapInfo->wGDIFreePercent = (int)LocalCountFree16() * 100 / LocalHeapSize16(); - stack16->ds = oldDS; - pHeapInfo->hUserSegment = user; - pHeapInfo->hGDISegment = gdi; - FreeLibrary16( user ); - FreeLibrary16( gdi ); - return TRUE; -} - - -/*********************************************************************** - * ToolHelpHook (KERNEL.341) - * see "Undocumented Windows" - */ -FARPROC16 WINAPI ToolHelpHook16(FARPROC16 lpfnNotifyHandler) -{ - FARPROC16 tmp; - - FIXME("(%p), stub.\n", lpfnNotifyHandler); - tmp = HookNotify; - HookNotify = lpfnNotifyHandler; - /* just return previously installed notification function */ - return tmp; -} diff --git a/dlls/localspl/provider.c b/dlls/localspl/provider.c index 79541db9937..790a1efea3f 100644 --- a/dlls/localspl/provider.c +++ b/dlls/localspl/provider.c @@ -103,6 +103,7 @@ static const WCHAR default_devmodeW[] = {'D','e','f','a','u','l','t',' ','D','e' static const WCHAR dependent_filesW[] = {'D','e','p','e','n','d','e','n','t',' ','F','i','l','e','s',0}; static const WCHAR descriptionW[] = {'D','e','s','c','r','i','p','t','i','o','n',0}; static const WCHAR driverW[] = {'D','r','i','v','e','r',0}; +static const WCHAR emptyW[] = {0}; static const WCHAR fmt_driversW[] = { 'S','y','s','t','e','m','\\', 'C','u', 'r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', 'c','o','n','t','r','o','l','\\', @@ -345,7 +346,7 @@ static void monitor_unload(monitor_t * pm) /****************************************************************** * monitor_unloadall [internal] * - * release all printmonitors and unload them from memory, when needed + * release all registered printmonitors and unload them from memory, when needed * */ @@ -358,7 +359,8 @@ static void monitor_unloadall(void) /* iterate through the list, with safety against removal */ LIST_FOR_EACH_ENTRY_SAFE(pm, next, &monitor_handles, monitor_t, entry) { - monitor_unload(pm); + /* skip monitorui dlls */ + if (pm->monitor) monitor_unload(pm); } LeaveCriticalSection(&monitor_handles_cs); } @@ -557,6 +559,47 @@ static DWORD monitor_loadall(void) } /****************************************************************** + * monitor_loadui [internal] + * + * load the userinterface-dll for a given portmonitor + * + * On failure, NULL is returned + */ +static monitor_t * monitor_loadui(monitor_t * pm) +{ + monitor_t * pui = NULL; + WCHAR buffer[MAX_PATH]; + HANDLE hXcv; + DWORD len; + DWORD res; + + if (pm == NULL) return NULL; + TRACE("(%p) => dllname: %s\n", pm, debugstr_w(pm->dllname)); + + /* Try the Portmonitor first; works for many monitors */ + if (pm->monitorUI) { + EnterCriticalSection(&monitor_handles_cs); + pm->refcount++; + LeaveCriticalSection(&monitor_handles_cs); + return pm; + } + + /* query the userinterface-dllname from the Portmonitor */ + if ((pm->monitor) && (pm->monitor->pfnXcvDataPort)) { + /* building (",XcvMonitor %s",pm->name) not needed yet */ + res = pm->monitor->pfnXcvOpenPort(emptyW, SERVER_ACCESS_ADMINISTER, &hXcv); + TRACE("got %u with %p\n", res, hXcv); + if (res) { + res = pm->monitor->pfnXcvDataPort(hXcv, monitorUIW, NULL, 0, (BYTE *) buffer, sizeof(buffer), &len); + TRACE("got %u with %s\n", res, debugstr_w(buffer)); + if (res == ERROR_SUCCESS) pui = monitor_load(NULL, buffer); + pm->monitor->pfnXcvClosePort(hXcv); + } + } + return pui; +} + +/****************************************************************** * monitor_load_by_port [internal] * * load a printmonitor for a given port @@ -1152,7 +1195,6 @@ end: */ static BOOL myAddPrinterDriverEx(DWORD level, LPBYTE pDriverInfo, DWORD dwFileCopyFlags, BOOL lazy) { - static const WCHAR emptyW[1]; const printenv_t *env; apd_data_t apd; DRIVER_INFO_8W di; @@ -1416,6 +1458,136 @@ static BOOL WINAPI fpAddMonitor(LPWSTR pName, DWORD Level, LPBYTE pMonitors) } /****************************************************************************** + * fpAddPort [exported through PRINTPROVIDOR] + * + * Add a Port for a specific Monitor + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * hWnd [I] Handle to parent Window for the Dialog-Box + * pMonitorName [I] Name of the Monitor that manage the Port + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + */ +static BOOL WINAPI fpAddPort(LPWSTR pName, HWND hWnd, LPWSTR pMonitorName) +{ + monitor_t * pm; + monitor_t * pui; + LONG lres; + DWORD res; + + TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pMonitorName)); + + lres = copy_servername_from_name(pName, NULL); + if (lres) { + FIXME("server %s not supported\n", debugstr_w(pName)); + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + /* an empty Monitorname is Invalid */ + if (!pMonitorName[0]) { + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; + } + + pm = monitor_load(pMonitorName, NULL); + if (pm && pm->monitor && pm->monitor->pfnAddPort) { + res = pm->monitor->pfnAddPort(pName, hWnd, pMonitorName); + TRACE("got %d with %u (%s)\n", res, GetLastError(), debugstr_w(pm->dllname)); + } + else + { + pui = monitor_loadui(pm); + if (pui && pui->monitorUI && pui->monitorUI->pfnAddPortUI) { + res = pui->monitorUI->pfnAddPortUI(pName, hWnd, pMonitorName, NULL); + TRACE("got %d with %u (%s)\n", res, GetLastError(), debugstr_w(pui->dllname)); + } + else + { + FIXME("not implemented for %s (monitor %p: %s / monitorui %p: %s)\n", + debugstr_w(pMonitorName), pm, debugstr_w(pm ? pm->dllname : NULL), + pui, debugstr_w(pui ? pui->dllname : NULL)); + + SetLastError(ERROR_NOT_SUPPORTED); + res = FALSE; + } + monitor_unload(pui); + } + monitor_unload(pm); + + TRACE("returning %d with %u\n", res, GetLastError()); + return res; +} + +/****************************************************************************** + * fpAddPortEx [exported through PRINTPROVIDOR] + * + * Add a Port for a specific Monitor, without presenting a user interface + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * level [I] Structure-Level (1 or 2) for pBuffer + * pBuffer [I] PTR to: PORT_INFO_1 or PORT_INFO_2 + * pMonitorName [I] Name of the Monitor that manage the Port + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + */ +static BOOL WINAPI fpAddPortEx(LPWSTR pName, DWORD level, LPBYTE pBuffer, LPWSTR pMonitorName) +{ + PORT_INFO_2W * pi2; + monitor_t * pm; + DWORD lres; + DWORD res; + + pi2 = (PORT_INFO_2W *) pBuffer; + + TRACE("(%s, %d, %p, %s): %s %s %s\n", debugstr_w(pName), level, pBuffer, + debugstr_w(pMonitorName), debugstr_w(pi2 ? pi2->pPortName : NULL), + debugstr_w(((level > 1) && pi2) ? pi2->pMonitorName : NULL), + debugstr_w(((level > 1) && pi2) ? pi2->pDescription : NULL)); + + lres = copy_servername_from_name(pName, NULL); + if (lres) { + FIXME("server %s not supported\n", debugstr_w(pName)); + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + if ((level < 1) || (level > 2)) { + SetLastError(ERROR_INVALID_LEVEL); + return FALSE; + } + + if ((!pi2) || (!pMonitorName) || (!pMonitorName[0])) { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + /* load the Monitor */ + pm = monitor_load(pMonitorName, NULL); + if (pm && pm->monitor && pm->monitor->pfnAddPortEx) { + res = pm->monitor->pfnAddPortEx(pName, level, pBuffer, pMonitorName); + TRACE("got %d with %u (%s)\n", res, GetLastError(), debugstr_w(pm->dllname)); + } + else + { + FIXME("not implemented for %s (monitor %p: %s)\n", + debugstr_w(pMonitorName), pm, pm ? debugstr_w(pm->dllname) : NULL); + SetLastError(ERROR_INVALID_PARAMETER); + res = FALSE; + } + monitor_unload(pm); + return res; +} + +/****************************************************************************** * fpAddPrinterDriverEx [exported through PRINTPROVIDOR] * * Install a Printer Driver with the Option to upgrade / downgrade the Files @@ -1476,6 +1648,75 @@ static BOOL WINAPI fpClosePrinter(HANDLE hPrinter) return FALSE; } +/****************************************************************************** + * fpConfigurePort [exported through PRINTPROVIDOR] + * + * Display the Configuration-Dialog for a specific Port + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * hWnd [I] Handle to parent Window for the Dialog-Box + * pPortName [I] Name of the Port, that should be configured + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + */ +static BOOL WINAPI fpConfigurePort(LPWSTR pName, HWND hWnd, LPWSTR pPortName) +{ + monitor_t * pm; + monitor_t * pui; + LONG lres; + DWORD res; + + TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pPortName)); + + lres = copy_servername_from_name(pName, NULL); + if (lres) { + FIXME("server %s not supported\n", debugstr_w(pName)); + SetLastError(ERROR_INVALID_NAME); + return FALSE; + } + + /* an empty Portname is Invalid, but can popup a Dialog */ + if (!pPortName[0]) { + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; + } + + pm = monitor_load_by_port(pPortName); + if (pm && pm->monitor && pm->monitor->pfnConfigurePort) { + TRACE("use %s for %s (monitor %p: %s)\n", debugstr_w(pm->name), + debugstr_w(pPortName), pm, debugstr_w(pm->dllname)); + res = pm->monitor->pfnConfigurePort(pName, hWnd, pPortName); + TRACE("got %d with %u\n", res, GetLastError()); + } + else + { + pui = monitor_loadui(pm); + if (pui && pui->monitorUI && pui->monitorUI->pfnConfigurePortUI) { + TRACE("use %s for %s (monitorui %p: %s)\n", debugstr_w(pui->name), + debugstr_w(pPortName), pui, debugstr_w(pui->dllname)); + res = pui->monitorUI->pfnConfigurePortUI(pName, hWnd, pPortName); + TRACE("got %d with %u\n", res, GetLastError()); + } + else + { + FIXME("not implemented for %s (monitor %p: %s / monitorui %p: %s)\n", + debugstr_w(pPortName), pm, debugstr_w(pm ? pm->dllname : NULL), + pui, debugstr_w(pui ? pui->dllname : NULL)); + + SetLastError(ERROR_NOT_SUPPORTED); + res = FALSE; + } + monitor_unload(pui); + } + monitor_unload(pm); + + TRACE("returning %d with %u\n", res, GetLastError()); + return res; +} /****************************************************************** * fpDeleteMonitor [exported through PRINTPROVIDOR] @@ -1538,6 +1779,76 @@ static BOOL WINAPI fpDeleteMonitor(LPWSTR pName, LPWSTR pEnvironment, LPWSTR pMo } /***************************************************************************** + * fpDeletePort [exported through PRINTPROVIDOR] + * + * Delete a specific Port + * + * PARAMS + * pName [I] Servername or NULL (local Computer) + * hWnd [I] Handle to parent Window for the Dialog-Box + * pPortName [I] Name of the Port, that should be deleted + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + */ +static BOOL WINAPI fpDeletePort(LPWSTR pName, HWND hWnd, LPWSTR pPortName) +{ + monitor_t * pm; + monitor_t * pui; + LONG lres; + DWORD res; + + TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pPortName)); + + lres = copy_servername_from_name(pName, NULL); + if (lres) { + FIXME("server %s not supported\n", debugstr_w(pName)); + SetLastError(ERROR_INVALID_NAME); + return FALSE; + } + + /* an empty Portname is Invalid */ + if (!pPortName[0]) { + SetLastError(ERROR_NOT_SUPPORTED); + return FALSE; + } + + pm = monitor_load_by_port(pPortName); + if (pm && pm->monitor && pm->monitor->pfnDeletePort) { + TRACE("use %s for %s (monitor %p: %s)\n", debugstr_w(pm->name), + debugstr_w(pPortName), pm, debugstr_w(pm->dllname)); + res = pm->monitor->pfnDeletePort(pName, hWnd, pPortName); + TRACE("got %d with %u\n", res, GetLastError()); + } + else + { + pui = monitor_loadui(pm); + if (pui && pui->monitorUI && pui->monitorUI->pfnDeletePortUI) { + TRACE("use %s for %s (monitorui %p: %s)\n", debugstr_w(pui->name), + debugstr_w(pPortName), pui, debugstr_w(pui->dllname)); + res = pui->monitorUI->pfnDeletePortUI(pName, hWnd, pPortName); + TRACE("got %d with %u\n", res, GetLastError()); + } + else + { + FIXME("not implemented for %s (monitor %p: %s / monitorui %p: %s)\n", + debugstr_w(pPortName), pm, debugstr_w(pm ? pm->dllname : NULL), + pui, debugstr_w(pui ? pui->dllname : NULL)); + + SetLastError(ERROR_NOT_SUPPORTED); + res = FALSE; + } + monitor_unload(pui); + } + monitor_unload(pm); + + TRACE("returning %d with %u\n", res, GetLastError()); + return res; +} + +/***************************************************************************** * fpEnumMonitors [exported through PRINTPROVIDOR] * * Enumerate available Port-Monitors @@ -1836,9 +2147,9 @@ void setup_provider(void) NULL, /* fpEnumForms */ fpEnumMonitors, fpEnumPorts, - NULL, /* fpAddPort */ - NULL, /* fpConfigurePort */ - NULL, /* fpDeletePort */ + fpAddPort, + fpConfigurePort, + fpDeletePort, NULL, /* fpCreatePrinterIC */ NULL, /* fpPlayGdiScriptOnPrinterIC */ NULL, /* fpDeletePrinterIC */ @@ -1851,7 +2162,7 @@ void setup_provider(void) NULL, /* fpGetPrinterDriverEx */ NULL, /* fpFindFirstPrinterChangeNotification */ NULL, /* fpFindClosePrinterChangeNotification */ - NULL, /* fpAddPortEx */ + fpAddPortEx, NULL, /* fpShutDown */ NULL, /* fpRefreshPrinterChangeNotification */ NULL, /* fpOpenPrinterEx */ diff --git a/dlls/localui/localui.c b/dlls/localui/localui.c index 2acfc7ecafa..b9e4c4ee324 100644 --- a/dlls/localui/localui.c +++ b/dlls/localui/localui.c @@ -503,7 +503,6 @@ static BOOL WINAPI localui_AddPortUI(PCWSTR pName, HWND hWnd, PCWSTR pMonitorNam { addportui_t data; HANDLE hXcv; - LPWSTR ptr = NULL; DWORD needed; DWORD dummy; DWORD status; @@ -529,14 +528,11 @@ static BOOL WINAPI localui_AddPortUI(PCWSTR pName, HWND hWnd, PCWSTR pMonitorNam (PBYTE) &dummy, 0, &needed, &status); TRACE("got %u with status %u\n", res, status); - if (res && (status == ERROR_SUCCESS)) { + if (res && (status == ERROR_SUCCESS) && ppPortName) { /* Native localui uses GlobalAlloc also. The caller must GlobalFree the buffer */ - ptr = GlobalAlloc(GPTR, (lstrlenW(data.portname)+1) * sizeof(WCHAR)); - if (ptr) { - lstrcpyW(ptr, data.portname); - if (ppPortName) *ppPortName = ptr; - } + *ppPortName = GlobalAlloc(GPTR, (lstrlenW(data.portname)+1) * sizeof(WCHAR)); + if (*ppPortName) lstrcpyW(*ppPortName, data.portname); } if (res && (status == ERROR_ALREADY_EXISTS)) { diff --git a/dlls/mapi32/mapi32_main.c b/dlls/mapi32/mapi32_main.c index 5039c292707..28c2f140d9c 100644 --- a/dlls/mapi32/mapi32_main.c +++ b/dlls/mapi32/mapi32_main.c @@ -61,8 +61,17 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad) */ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv) { - *ppv = NULL; + if (mapiFunctions.DllGetClassObject) + { + HRESULT ret = mapiFunctions.DllGetClassObject(rclsid, iid, ppv); + + TRACE("ret: %x\n", ret); + return ret; + } + FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n", debugstr_guid(rclsid), debugstr_guid(iid)); + + *ppv = NULL; return CLASS_E_CLASSNOTAVAILABLE; } diff --git a/dlls/mapi32/sendmail.c b/dlls/mapi32/sendmail.c index 5054be80f61..13fb4c7b0ef 100644 --- a/dlls/mapi32/sendmail.c +++ b/dlls/mapi32/sendmail.c @@ -25,11 +25,17 @@ #include #include +#define COBJMACROS + #include "windef.h" #include "winbase.h" #include "winerror.h" #include "objbase.h" +#include "objidl.h" #include "mapi.h" +#include "mapix.h" +#include "mapiutil.h" +#include "mapidefs.h" #include "winreg.h" #include "shellapi.h" #include "shlwapi.h" @@ -38,6 +44,328 @@ WINE_DEFAULT_DEBUG_CHANNEL(mapi); +#define READ_BUF_SIZE 4096 + +/* + Internal function to send a message via Extended MAPI. Wrapper around the Simple + MAPI function MAPISendMail. +*/ +static ULONG sendmail_extended_mapi(LHANDLE mapi_session, ULONG_PTR uiparam, lpMapiMessage message, + FLAGS flags, ULONG reserved) +{ + ULONG tags[] = {1, PR_IPM_DRAFTS_ENTRYID}; + ULONG retval = MAPI_E_FAILURE; + IMAPISession *session = NULL; + IMAPITable* msg_table; + LPSRowSet rows = NULL; + IMsgStore* msg_store; + IMAPIFolder* folder = NULL; + LPENTRYID entry_id; + LPSPropValue props; + ULONG entry_len; + DWORD obj_type; + IMessage* msg; + ULONG values; + HRESULT ret; + + TRACE("Using Extended MAPI wrapper for MAPISendMail\n"); + + /* Attempt to log on via Extended MAPI */ + + ret = MAPILogonEx(0, NULL, NULL, MAPI_EXTENDED | MAPI_USE_DEFAULT | MAPI_NEW_SESSION, &session); + TRACE("MAPILogonEx: %x\n", ret); + + if (ret != S_OK) + { + retval = MAPI_E_LOGIN_FAILURE; + goto cleanup; + } + + /* Open the default message store */ + + if (IMAPISession_GetMsgStoresTable(session, 0, &msg_table) == S_OK) + { + /* We want the default store */ + SizedSPropTagArray(2, columns) = {2, {PR_ENTRYID, PR_DEFAULT_STORE}}; + + /* Set the columns we want */ + if (IMAPITable_SetColumns(msg_table, (LPSPropTagArray) &columns, 0) == S_OK) + { + while (1) + { + if (IMAPITable_QueryRows(msg_table, 1, 0, &rows) != S_OK) + { + MAPIFreeBuffer(rows); + rows = NULL; + } + else if (rows->cRows != 1) + { + FreeProws(rows); + rows = NULL; + } + else + { + /* If it's not the default store, try the next row */ + if (!rows->aRow[0].lpProps[1].Value.b) + { + FreeProws(rows); + continue; + } + } + + break; + } + } + + IMAPITable_Release(msg_table); + } + + /* Did we manage to get the right store? */ + if (!rows) + goto logoff; + + /* Open the message store */ + IMAPISession_OpenMsgStore(session, 0, rows->aRow[0].lpProps[0].Value.bin.cb, + (ENTRYID *) rows->aRow[0].lpProps[0].Value.bin.lpb, NULL, + MDB_NO_DIALOG | MAPI_BEST_ACCESS, &msg_store); + + /* We don't need this any more */ + FreeProws(rows); + + /* First open the inbox, from which the drafts folder can be opened */ + if (IMsgStore_GetReceiveFolder(msg_store, NULL, 0, &entry_len, &entry_id, NULL) == S_OK) + { + IMsgStore_OpenEntry(msg_store, entry_len, entry_id, NULL, 0, &obj_type, (LPUNKNOWN*) &folder); + MAPIFreeBuffer(entry_id); + } + + /* Open the drafts folder, or failing that, try asking the message store for the outbox */ + if ((folder == NULL) || ((ret = IMAPIFolder_GetProps(folder, (LPSPropTagArray) tags, 0, &values, &props)) != S_OK)) + { + TRACE("Unable to open Drafts folder; opening Outbox instead\n"); + tags[1] = PR_IPM_OUTBOX_ENTRYID; + ret = IMsgStore_GetProps(msg_store, (LPSPropTagArray) tags, 0, &values, &props); + } + + if (ret != S_OK) + goto logoff; + + IMsgStore_OpenEntry(msg_store, props[0].Value.bin.cb, (LPENTRYID) props[0].Value.bin.lpb, + NULL, MAPI_MODIFY, &obj_type, (LPUNKNOWN *) &folder); + + /* Create a new message */ + if (IMAPIFolder_CreateMessage(folder, NULL, 0, &msg) == S_OK) + { + ULONG token; + SPropValue p; + + /* Define message properties */ + p.ulPropTag = PR_MESSAGE_FLAGS; + p.Value.l = MSGFLAG_FROMME | MSGFLAG_UNSENT; + + IMessage_SetProps(msg, 1, &p, NULL); + + p.ulPropTag = PR_SENTMAIL_ENTRYID; + p.Value.bin.cb = props[0].Value.bin.cb; + p.Value.bin.lpb = props[0].Value.bin.lpb; + IMessage_SetProps(msg, 1,&p, NULL); + + /* Set message subject */ + if (message->lpszSubject) + { + p.ulPropTag = PR_SUBJECT_A; + p.Value.lpszA = message->lpszSubject; + IMessage_SetProps(msg, 1, &p, NULL); + } + + /* Set message body */ + if (message->lpszNoteText) + { + LPSTREAM stream = NULL; + + if (IMessage_OpenProperty(msg, PR_BODY_A, &IID_IStream, 0, + MAPI_MODIFY | MAPI_CREATE, (LPUNKNOWN*) &stream) == S_OK) + { + IStream_Write(stream, message->lpszNoteText, strlen(message->lpszNoteText)+1, NULL); + IStream_Release(stream); + } + } + + /* Add message attachments */ + if (message->nFileCount > 0) + { + ULONG num_attach = 0; + int i, j; + + for (i = 0; i < message->nFileCount; i++) + { + IAttach* attachment = NULL; + SPropValue prop[4]; + LPCSTR filename; + HANDLE file; + + if (!message->lpFiles[i].lpszPathName) + continue; + + /* Open the attachment for reading */ + file = CreateFileA(message->lpFiles[i].lpszPathName, GENERIC_READ, FILE_SHARE_READ, + NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + if (file == INVALID_HANDLE_VALUE) + continue; + + /* Check if a display filename has been given; if not, get one ourselves from path name */ + filename = message->lpFiles[i].lpszFileName; + + if (!filename) + { + filename = message->lpFiles[i].lpszPathName; + + for (j = strlen(message->lpFiles[i].lpszPathName)-1; j >= 0; j--) + { + if (message->lpFiles[i].lpszPathName[i] == '\\' || + message->lpFiles[i].lpszPathName[i] == '/') + { + filename = &message->lpFiles[i].lpszPathName[i+1]; + break; + } + } + } + + TRACE("Attachment %d path: '%s'; filename: '%s'\n", i, debugstr_a(message->lpFiles[i].lpszPathName), + debugstr_a(filename)); + + /* Create the attachment */ + if (IMessage_CreateAttach(msg, NULL, 0, &num_attach, &attachment) != S_OK) + { + TRACE("Unable to create attachment\n"); + CloseHandle(file); + continue; + } + + /* Set the attachment properties */ + ZeroMemory(prop, sizeof(prop)); + + prop[0].ulPropTag = PR_ATTACH_METHOD; + prop[0].Value.ul = ATTACH_BY_VALUE; + prop[1].ulPropTag = PR_ATTACH_LONG_FILENAME_A; + prop[1].Value.lpszA = (LPSTR) filename; + prop[2].ulPropTag = PR_ATTACH_FILENAME_A; + prop[2].Value.lpszA = (LPSTR) filename; + prop[3].ulPropTag = PR_RENDERING_POSITION; + prop[3].Value.l = -1; + + if (IAttach_SetProps(attachment, 4, prop, NULL) == S_OK) + { + LPSTREAM stream = NULL; + + if (IAttach_OpenProperty(attachment, PR_ATTACH_DATA_BIN, &IID_IStream, 0, + MAPI_MODIFY | MAPI_CREATE, (LPUNKNOWN*) &stream) == S_OK) + { + BYTE data[READ_BUF_SIZE]; + DWORD size = 0, read, written; + + while (ReadFile(file, data, READ_BUF_SIZE, &read, NULL) && (read != 0)) + { + IStream_Write(stream, data, read, &written); + size += read; + } + + TRACE("%d bytes read, %d bytes written of attachment\n", read, written); + + IStream_Commit(stream, STGC_DEFAULT); + IStream_Release(stream); + + prop[0].ulPropTag = PR_ATTACH_SIZE; + prop[0].Value.ul = size; + IAttach_SetProps(attachment, 1, prop, NULL); + + IAttach_SaveChanges(attachment, KEEP_OPEN_READONLY); + num_attach++; + } + } + + CloseHandle(file); + IAttach_Release(attachment); + } + } + + IMessage_SaveChanges(msg, KEEP_OPEN_READWRITE); + + /* Prepare the message form */ + + if (IMAPISession_PrepareForm(session, NULL, msg, &token) == S_OK) + { + ULONG access = 0, status = 0, flags = 0, pc = 0; + ULONG pT[2] = {1, PR_MSG_STATUS}; + + /* Retrieve message status, flags, access rights and class */ + + if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK) + { + status = props->Value.ul; + MAPIFreeBuffer(props); + } + + pT[1] = PR_MESSAGE_FLAGS; + + if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK) + { + flags = props->Value.ul; + MAPIFreeBuffer(props); + } + + pT[1] = PR_ACCESS; + + if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK) + { + access = props->Value.ul; + MAPIFreeBuffer(props); + } + + pT[1] = PR_MESSAGE_CLASS_A; + + if (IMessage_GetProps(msg, (LPSPropTagArray) pT, 0, &pc, &props) == S_OK) + { + /* Show the message form (edit window) */ + + ret = IMAPISession_ShowForm(session, 0, msg_store, folder, NULL, + token, NULL, 0, status, flags, access, + props->Value.lpszA); + + switch (ret) + { + case S_OK: + retval = SUCCESS_SUCCESS; + break; + + case MAPI_E_USER_CANCEL: + retval = MAPI_E_USER_ABORT; + break; + + default: + TRACE("ShowForm failure: %x\n", ret); + break; + } + } + } + + IMessage_Release(msg); + } + + /* Free up the resources we've used */ + IMAPIFolder_Release(folder); + IMsgStore_Release(msg_store); + +logoff: ; + IMAPISession_Logoff(session, 0, 0, 0); + IMAPISession_Release(session); + +cleanup: ; + MAPIUninitialize(); + return retval; +} + /************************************************************************** * MAPISendMail (MAPI32.211) * @@ -80,8 +408,9 @@ ULONG WINAPI MAPISendMail( LHANDLE session, ULONG_PTR uiparam, if (mapiFunctions.MAPISendMail) return mapiFunctions.MAPISendMail(session, uiparam, message, flags, reserved); - /* TODO: Check if we have an Extended MAPI provider, if so, implement - wrapper around that. */ + /* Check if we have an Extended MAPI provider - if so, use our wrapper */ + if (MAPIInitialize(NULL) == S_OK) + return sendmail_extended_mapi(session, uiparam, message, flags, reserved); /* Fall back on our own implementation */ if (!message) return MAPI_E_FAILURE; diff --git a/dlls/mapi32/util.c b/dlls/mapi32/util.c index 4957941f0b0..fdb8497d677 100644 --- a/dlls/mapi32/util.c +++ b/dlls/mapi32/util.c @@ -1056,6 +1056,8 @@ void load_mapi_providers(void) mapiFunctions.MAPIInitialize = (void*) GetProcAddress(mapi_ex_provider, "MAPIInitialize"); mapiFunctions.MAPILogonEx = (void*) GetProcAddress(mapi_ex_provider, "MAPILogonEx"); mapiFunctions.MAPIUninitialize = (void*) GetProcAddress(mapi_ex_provider, "MAPIUninitialize"); + + mapiFunctions.DllGetClassObject = (void*) GetProcAddress(mapi_ex_provider, "DllGetClassObject"); } cleanUp: diff --git a/dlls/mapi32/util.h b/dlls/mapi32/util.h index 69b160372f1..98990538ff2 100644 --- a/dlls/mapi32/util.h +++ b/dlls/mapi32/util.h @@ -43,6 +43,8 @@ typedef struct MAPI_FUNCTIONS { LPMAPISENDMAIL MAPISendMail; LPMAPISENDDOCUMENTS MAPISendDocuments; LPMAPIUNINITIALIZE MAPIUninitialize; + + HRESULT (WINAPI *DllGetClassObject)(REFCLSID, REFIID, LPVOID *); } MAPI_FUNCTIONS; extern MAPI_FUNCTIONS mapiFunctions; diff --git a/dlls/mshtml/Makefile.in b/dlls/mshtml/Makefile.in index 7f44bb16a1d..b1003593cb8 100644 --- a/dlls/mshtml/Makefile.in +++ b/dlls/mshtml/Makefile.in @@ -60,6 +60,7 @@ C_SRCS = \ persist.c \ protocol.c \ script.c \ + secmgr.c \ selection.c \ service.c \ task.c \ diff --git a/dlls/mshtml/dispex.c b/dlls/mshtml/dispex.c index a2d3468a2ac..4092374bf67 100644 --- a/dlls/mshtml/dispex.c +++ b/dlls/mshtml/dispex.c @@ -31,6 +31,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); +static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0}; + typedef struct { DISPID id; BSTR name; @@ -79,6 +81,7 @@ static REFIID tid_ids[] = { &IID_NULL, &DIID_DispCEventObj, &DIID_DispDOMChildrenCollection, + &DIID_DispHTMLAnchorElement, &DIID_DispHTMLBody, &DIID_DispHTMLCommentElement, &DIID_DispHTMLCurrentStyle, @@ -98,6 +101,7 @@ static REFIID tid_ids[] = { &DIID_DispHTMLTableRow, &DIID_DispHTMLUnknownElement, &DIID_DispHTMLWindow2, + &IID_IHTMLAnchorElement, &IID_IHTMLBodyElement, &IID_IHTMLBodyElement2, &IID_IHTMLCommentElement, @@ -242,10 +246,12 @@ static dispex_data_t *preprocess_dispex_data(DispatchEx *This) TRACE("(%p)\n", This); - hres = get_typeinfo(This->data->disp_tid, &dti); - if(FAILED(hres)) { - ERR("Could not get disp type info: %08x\n", hres); - return NULL; + if(This->data->disp_tid) { + hres = get_typeinfo(This->data->disp_tid, &dti); + if(FAILED(hres)) { + ERR("Could not get disp type info: %08x\n", hres); + return NULL; + } } data = heap_alloc(sizeof(dispex_data_t)); @@ -419,8 +425,6 @@ HRESULT dispex_get_dprop_ref(DispatchEx *This, const WCHAR *name, BOOL alloc, VA static HRESULT dispex_value(DispatchEx *This, LCID lcid, WORD flags, DISPPARAMS *params, VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) { - static const WCHAR objectW[] = {'[','o','b','j','e','c','t',']',0}; - if(This->data->vtbl && This->data->vtbl->value) return This->data->vtbl->value(This->outer, lcid, flags, params, res, ei, caller); @@ -535,11 +539,13 @@ static const dispex_static_data_vtbl_t function_dispex_vtbl = { NULL }; +static const tid_t function_iface_tids[] = {0}; + static dispex_static_data_t function_dispex = { &function_dispex_vtbl, - LAST_tid, + NULL_tid, NULL, - NULL + function_iface_tids }; static func_disp_t *create_func_disp(DispatchEx *obj, func_info_t *info) @@ -570,6 +576,18 @@ static HRESULT function_invoke(DispatchEx *This, func_info_t *func, WORD flags, case DISPATCH_PROPERTYGET: { dispex_dynamic_data_t *dynamic_data; + if(func->id == DISPID_VALUE) { + BSTR ret; + + ret = SysAllocString(objectW); + if(!ret) + return E_OUTOFMEMORY; + + V_VT(res) = VT_BSTR; + V_BSTR(res) = ret; + return S_OK; + } + dynamic_data = get_dynamic_data(This, TRUE); if(!dynamic_data) return E_OUTOFMEMORY; @@ -611,8 +629,10 @@ static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **re while(min <= max) { n = (min+max)/2; - if(data->funcs[n].id == id) - break; + if(data->funcs[n].id == id) { + *ret = data->funcs+n; + return S_OK; + } if(data->funcs[n].id < id) min = n+1; @@ -620,13 +640,8 @@ static HRESULT get_builtin_func(dispex_data_t *data, DISPID id, func_info_t **re max = n-1; } - if(min > max) { - WARN("invalid id %x\n", id); - return DISP_E_UNKNOWNNAME; - } - - *ret = data->funcs+n; - return S_OK; + WARN("invalid id %x\n", id); + return DISP_E_UNKNOWNNAME; } #define DISPATCHEX_THIS(iface) DEFINE_THIS(DispatchEx, IDispatchEx, iface) @@ -775,9 +790,6 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc TRACE("(%p)->(%x %x %x %p %p %p %p)\n", This, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); - if(id == DISPID_VALUE) - return dispex_value(This, lcid, wFlags, pdp, pvarRes, pei, pspCaller); - if(is_custom_dispid(id) && This->data->vtbl && This->data->vtbl->invoke) return This->data->vtbl->invoke(This->outer, id, lcid, wFlags, pdp, pvarRes, pei, pspCaller); @@ -851,6 +863,8 @@ static HRESULT WINAPI DispatchEx_InvokeEx(IDispatchEx *iface, DISPID id, LCID lc return E_FAIL; hres = get_builtin_func(data, id, &func); + if(id == DISPID_VALUE && hres == DISP_E_UNKNOWNNAME) + return dispex_value(This, lcid, wFlags, pdp, pvarRes, pei, pspCaller); if(FAILED(hres)) return hres; diff --git a/dlls/mshtml/htmlanchor.c b/dlls/mshtml/htmlanchor.c index 819c80c2833..09c7eda8d0b 100644 --- a/dlls/mshtml/htmlanchor.c +++ b/dlls/mshtml/htmlanchor.c @@ -36,6 +36,8 @@ typedef struct { HTMLElement element; const IHTMLAnchorElementVtbl *lpHTMLAnchorElementVtbl; + + nsIDOMHTMLAnchorElement *nsanchor; } HTMLAnchorElement; #define HTMLANCHOR(x) (&(x)->lpHTMLAnchorElementVtbl) @@ -104,8 +106,26 @@ static HRESULT WINAPI HTMLAnchorElement_put_href(IHTMLAnchorElement *iface, BSTR static HRESULT WINAPI HTMLAnchorElement_get_href(IHTMLAnchorElement *iface, BSTR *p) { HTMLAnchorElement *This = HTMLANCHOR_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + nsAString href_str; + nsresult nsres; + HRESULT hres; + + TRACE("(%p)->(%p)\n", This, p); + + nsAString_Init(&href_str, NULL); + nsres = nsIDOMHTMLAnchorElement_GetHref(This->nsanchor, &href_str); + if(NS_SUCCEEDED(nsres)) { + const PRUnichar *href; + + nsAString_GetData(&href_str, &href); + hres = nsuri_to_url(href, TRUE, p); + }else { + ERR("GetHref failed: %08x\n", nsres); + hres = E_FAIL; + } + + nsAString_Finish(&href_str); + return hres; } static HRESULT WINAPI HTMLAnchorElement_put_target(IHTMLAnchorElement *iface, BSTR v) @@ -464,6 +484,10 @@ static HRESULT HTMLAnchorElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) static void HTMLAnchorElement_destructor(HTMLDOMNode *iface) { HTMLAnchorElement *This = HTMLANCHOR_NODE_THIS(iface); + + if(This->nsanchor) + nsIDOMHTMLAnchorElement_Release(This->nsanchor); + HTMLElement_destructor(&This->element.node); } @@ -474,14 +498,39 @@ static const NodeImplVtbl HTMLAnchorElementImplVtbl = { HTMLAnchorElement_destructor }; +static const tid_t HTMLAnchorElement_iface_tids[] = { + IHTMLAnchorElement_tid, + IHTMLDOMNode_tid, + IHTMLDOMNode2_tid, + IHTMLElement_tid, + IHTMLElement2_tid, + IHTMLElement3_tid, + IHTMLElement4_tid, + IHTMLTextContainer_tid, + IHTMLUniqueName_tid, + 0 +}; + +static dispex_static_data_t HTMLAnchorElement_dispex = { + NULL, + DispHTMLAnchorElement_tid, + NULL, + HTMLAnchorElement_iface_tids +}; + HTMLElement *HTMLAnchorElement_Create(nsIDOMHTMLElement *nselem) { HTMLAnchorElement *ret = heap_alloc_zero(sizeof(HTMLAnchorElement)); - - HTMLElement_Init(&ret->element); + nsresult nsres; ret->lpHTMLAnchorElementVtbl = &HTMLAnchorElementVtbl; ret->element.node.vtbl = &HTMLAnchorElementImplVtbl; + HTMLElement_Init(&ret->element, &HTMLAnchorElement_dispex); + + nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLAnchorElement, (void**)&ret->nsanchor); + if(NS_FAILED(nsres)) + ERR("Could not get nsIDOMHTMLAnchorElement iface: %08x\n", nsres); + return &ret->element; } diff --git a/dlls/mshtml/htmlbody.c b/dlls/mshtml/htmlbody.c index ad536f2ef92..5e0a68665c3 100644 --- a/dlls/mshtml/htmlbody.c +++ b/dlls/mshtml/htmlbody.c @@ -766,13 +766,11 @@ HTMLElement *HTMLBodyElement_Create(nsIDOMHTMLElement *nselem) TRACE("(%p)->(%p)\n", ret, nselem); - HTMLTextContainer_Init(&ret->textcont); - ret->lpHTMLBodyElementVtbl = &HTMLBodyElementVtbl; - - init_dispex(&ret->textcont.element.node.dispex, (IUnknown*)HTMLBODY(ret), &HTMLBodyElement_dispex); ret->textcont.element.node.vtbl = &HTMLBodyElementImplVtbl; + HTMLTextContainer_Init(&ret->textcont, &HTMLBodyElement_dispex); + ConnectionPoint_Init(&ret->cp_propnotif, &ret->textcont.element.cp_container, &IID_IPropertyNotifySink); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLBodyElement, diff --git a/dlls/mshtml/htmlcomment.c b/dlls/mshtml/htmlcomment.c index ee63fb9d739..a191c8e3465 100644 --- a/dlls/mshtml/htmlcomment.c +++ b/dlls/mshtml/htmlcomment.c @@ -193,8 +193,7 @@ HTMLElement *HTMLCommentElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode ret->element.node.vtbl = &HTMLCommentElementImplVtbl; ret->lpIHTMLCommentElementVtbl = &HTMLCommentElementVtbl; - init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLCOMMENT(ret), &HTMLCommentElement_dispex); - HTMLElement_Init(&ret->element); + HTMLElement_Init(&ret->element, &HTMLCommentElement_dispex); HTMLDOMNode_Init(doc, &ret->element.node, nsnode); return &ret->element; diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index f7c71902515..d6baa8eb814 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -28,6 +28,7 @@ #include "winuser.h" #include "ole2.h" #include "perhist.h" +#include "mshtmdid.h" #include "wine/debug.h" @@ -1756,13 +1757,24 @@ static HRESULT HTMLDocumentNode_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) if(htmldoc_qi(&This->basedoc, riid, ppv)) return *ppv ? S_OK : E_NOINTERFACE; - return HTMLDOMNode_QI(&This->node, riid, ppv); + if(IsEqualGUID(&IID_IInternetHostSecurityManager, riid)) { + TRACE("(%p)->(IID_IInternetHostSecurityManager %p)\n", This, ppv); + *ppv = HOSTSECMGR(This); + }else { + return HTMLDOMNode_QI(&This->node, riid, ppv); + } + + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; } void HTMLDocumentNode_destructor(HTMLDOMNode *iface) { HTMLDocumentNode *This = HTMLDOCNODE_NODE_THIS(iface); + if(This->secmgr) + IInternetSecurityManager_Release(This->secmgr); + detach_selection(This); detach_ranges(This); release_nodes(This); @@ -1796,6 +1808,7 @@ static dispex_static_data_t HTMLDocumentNode_dispex = { HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_obj, HTMLWindow *window, HTMLDocumentNode **ret) { HTMLDocumentNode *doc; + HRESULT hres; doc = heap_alloc_zero(sizeof(HTMLDocumentNode)); if(!doc) @@ -1806,6 +1819,7 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob init_dispex(&doc->node.dispex, (IUnknown*)HTMLDOMNODE(&doc->node), &HTMLDocumentNode_dispex); init_doc(&doc->basedoc, (IUnknown*)HTMLDOMNODE(&doc->node), DISPATCHEX(&doc->node.dispex)); + HTMLDocumentNode_SecMgr_Init(doc); doc->ref = 1; nsIDOMHTMLDocument_AddRef(nsdoc); @@ -1819,6 +1833,12 @@ HRESULT create_doc_from_nsdoc(nsIDOMHTMLDocument *nsdoc, HTMLDocumentObj *doc_ob HTMLDOMNode_Init(doc, &doc->node, (nsIDOMNode*)nsdoc); doc->node.vtbl = &HTMLDocumentNodeImplVtbl; + hres = CoInternetCreateSecurityManager(NULL, &doc->secmgr, 0); + if(FAILED(hres)) { + htmldoc_release(&doc->basedoc); + return hres; + } + *ret = doc; return S_OK; } diff --git a/dlls/mshtml/htmldoc3.c b/dlls/mshtml/htmldoc3.c index 4b249e6f496..f4f923f3d27 100644 --- a/dlls/mshtml/htmldoc3.c +++ b/dlls/mshtml/htmldoc3.c @@ -31,6 +31,7 @@ #include "wine/debug.h" #include "mshtml_private.h" +#include "htmlevent.h" WINE_DEFAULT_DEBUG_CHANNEL(mshtml); @@ -173,8 +174,10 @@ static HRESULT WINAPI HTMLDocument3_attachEvent(IHTMLDocument3 *iface, BSTR even IDispatch* pDisp, VARIANT_BOOL *pfResult) { HTMLDocument *This = HTMLDOC3_THIS(iface); - FIXME("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult); - return E_NOTIMPL; + + TRACE("(%p)->(%s %p %p)\n", This, debugstr_w(event), pDisp, pfResult); + + return attach_event(&This->doc_node->node.event_target, This, event, pDisp, pfResult); } static HRESULT WINAPI HTMLDocument3_detachEvent(IHTMLDocument3 *iface, BSTR event, diff --git a/dlls/mshtml/htmlelem.c b/dlls/mshtml/htmlelem.c index 1fde2e9635a..28421bba07f 100644 --- a/dlls/mshtml/htmlelem.c +++ b/dlls/mshtml/htmlelem.c @@ -1458,7 +1458,7 @@ static dispex_static_data_t HTMLElement_dispex = { HTMLElement_iface_tids }; -void HTMLElement_Init(HTMLElement *This) +void HTMLElement_Init(HTMLElement *This, dispex_static_data_t *dispex_data) { This->lpHTMLElementVtbl = &HTMLElementVtbl; @@ -1467,8 +1467,7 @@ void HTMLElement_Init(HTMLElement *This) HTMLElement2_Init(This); HTMLElement3_Init(This); - if(!This->node.dispex.data) - init_dispex(&This->node.dispex, (IUnknown*)HTMLELEM(This), &HTMLElement_dispex); + init_dispex(&This->node.dispex, (IUnknown*)HTMLELEM(This), dispex_data ? dispex_data : &HTMLElement_dispex); } HTMLElement *HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL use_generic) @@ -1527,7 +1526,7 @@ HTMLElement *HTMLElement_Create(HTMLDocumentNode *doc, nsIDOMNode *nsnode, BOOL if(!ret) { ret = heap_alloc_zero(sizeof(HTMLElement)); - HTMLElement_Init(ret); + HTMLElement_Init(ret, NULL); ret->node.vtbl = &HTMLElementImplVtbl; } diff --git a/dlls/mshtml/htmlgeneric.c b/dlls/mshtml/htmlgeneric.c index 07e453e5c9c..142caa69e5a 100644 --- a/dlls/mshtml/htmlgeneric.c +++ b/dlls/mshtml/htmlgeneric.c @@ -178,8 +178,7 @@ HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement *nselem) ret->lpHTMLGenericElementVtbl = &HTMLGenericElementVtbl; ret->element.node.vtbl = &HTMLGenericElementImplVtbl; - init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLGENERIC(ret), &HTMLGenericElement_dispex); - HTMLElement_Init(&ret->element); + HTMLElement_Init(&ret->element, &HTMLGenericElement_dispex); return &ret->element; } diff --git a/dlls/mshtml/htmliframe.c b/dlls/mshtml/htmliframe.c index 67665c1c6ff..a482a5b05ae 100644 --- a/dlls/mshtml/htmliframe.c +++ b/dlls/mshtml/htmliframe.c @@ -43,6 +43,40 @@ typedef struct { #define HTMLFRAMEBASE2(x) (&(x)->lpIHTMLFrameBase2Vtbl) +static HRESULT create_content_window(HTMLIFrame *This, nsIDOMHTMLDocument *nsdoc, HTMLWindow **ret) +{ + nsIDOMDocumentView *nsdocview; + nsIDOMAbstractView *nsview; + nsIDOMWindow *nswindow; + nsresult nsres; + HRESULT hres; + + nsres = nsIDOMHTMLDocument_QueryInterface(nsdoc, &IID_nsIDOMDocumentView, (void**)&nsdocview); + if(NS_FAILED(nsres)) { + ERR("Could not get nsIDOMDocumentView: %08x\n", nsres); + return E_FAIL; + } + + nsres = nsIDOMDocumentView_GetDefaultView(nsdocview, &nsview); + nsIDOMDocumentView_Release(nsdocview); + if(NS_FAILED(nsres)) { + ERR("GetDefaultView failed: %08x\n", nsres); + return E_FAIL; + } + + nsres = nsIDOMAbstractView_QueryInterface(nsview, &IID_nsIDOMWindow, (void**)&nswindow); + nsIDOMAbstractView_Release(nsview); + if(NS_FAILED(nsres)) { + ERR("Coult not get nsIDOMWindow iface: %08x\n", nsres); + return E_FAIL; + } + + hres = HTMLWindow_Create(This->element.node.doc->basedoc.doc_obj, nswindow, ret); + + nsIDOMWindow_Release(nswindow); + return hres; +} + #define HTMLFRAMEBASE2_THIS(iface) DEFINE_THIS(HTMLIFrame, IHTMLFrameBase2, iface) static HRESULT WINAPI HTMLIFrameBase2_QueryInterface(IHTMLFrameBase2 *iface, REFIID riid, void **ppv) @@ -130,10 +164,10 @@ static HRESULT WINAPI HTMLIFrameBase2_get_contentWindow(IHTMLFrameBase2 *iface, return E_FAIL; } - hres = HTMLWindow_Create(This->element.node.doc->basedoc.doc_obj, NULL, &window); + hres = create_content_window(This, nshtmldoc, &window); if(FAILED(hres)) { - nsIDOMDocument_Release(nsdoc); - return hres; + nsIDOMHTMLDocument_Release(nshtmldoc); + return E_FAIL; } hres = create_doc_from_nsdoc(nshtmldoc, This->element.node.doc->basedoc.doc_obj, window, &content_doc); @@ -288,8 +322,7 @@ HTMLElement *HTMLIFrame_Create(nsIDOMHTMLElement *nselem) ret->lpIHTMLFrameBase2Vtbl = &HTMLIFrameBase2Vtbl; ret->element.node.vtbl = &HTMLIFrameImplVtbl; - init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLFRAMEBASE2(ret), &HTMLIFrame_dispex); - HTMLElement_Init(&ret->element); + HTMLElement_Init(&ret->element, &HTMLIFrame_dispex); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLIFrameElement, (void**)&ret->nsiframe); if(NS_FAILED(nsres)) diff --git a/dlls/mshtml/htmlimg.c b/dlls/mshtml/htmlimg.c index aac6f6cc0e9..a29cd76ba65 100644 --- a/dlls/mshtml/htmlimg.c +++ b/dlls/mshtml/htmlimg.c @@ -607,8 +607,7 @@ HTMLElement *HTMLImgElement_Create(nsIDOMHTMLElement *nselem) if(NS_FAILED(nsres)) ERR("Could not get nsIDOMHTMLImageElement: %08x\n", nsres); - init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLIMG(ret), &HTMLImgElement_dispex); - HTMLElement_Init(&ret->element); + HTMLElement_Init(&ret->element, &HTMLImgElement_dispex); return &ret->element; } diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index 3d69e0c03a4..7db777c14f5 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -1176,8 +1176,7 @@ HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement *nselem) ret->lpHTMLInputTextElementVtbl = &HTMLInputTextElementVtbl; ret->element.node.vtbl = &HTMLInputElementImplVtbl; - init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLINPUT(ret), &HTMLInputElement_dispex); - HTMLElement_Init(&ret->element); + HTMLElement_Init(&ret->element, &HTMLInputElement_dispex); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLInputElement, (void**)&ret->nsinput); diff --git a/dlls/mshtml/htmllocation.c b/dlls/mshtml/htmllocation.c index 470d679c26a..45899b43379 100644 --- a/dlls/mshtml/htmllocation.c +++ b/dlls/mshtml/htmllocation.c @@ -168,6 +168,10 @@ static HRESULT WINAPI HTMLLocation_get_protocol(IHTMLLocation *iface, BSTR *p) { HTMLLocation *This = HTMLLOCATION_THIS(iface); FIXME("(%p)->(%p)\n", This, p); + + if(!p) + return E_POINTER; + return E_NOTIMPL; } @@ -182,6 +186,10 @@ static HRESULT WINAPI HTMLLocation_get_host(IHTMLLocation *iface, BSTR *p) { HTMLLocation *This = HTMLLOCATION_THIS(iface); FIXME("(%p)->(%p)\n", This, p); + + if(!p) + return E_POINTER; + return E_NOTIMPL; } @@ -196,6 +204,10 @@ static HRESULT WINAPI HTMLLocation_get_hostname(IHTMLLocation *iface, BSTR *p) { HTMLLocation *This = HTMLLOCATION_THIS(iface); FIXME("(%p)->(%p)\n", This, p); + + if(!p) + return E_POINTER; + return E_NOTIMPL; } @@ -210,6 +222,10 @@ static HRESULT WINAPI HTMLLocation_get_port(IHTMLLocation *iface, BSTR *p) { HTMLLocation *This = HTMLLOCATION_THIS(iface); FIXME("(%p)->(%p)\n", This, p); + + if(!p) + return E_POINTER; + return E_NOTIMPL; } @@ -231,6 +247,9 @@ static HRESULT WINAPI HTMLLocation_get_pathname(IHTMLLocation *iface, BSTR *p) TRACE("(%p)->(%p)\n", This, p); + if(!p) + return E_POINTER; + hres = get_url(This, &doc_url); if(FAILED(hres)) return hres; @@ -271,6 +290,10 @@ static HRESULT WINAPI HTMLLocation_get_search(IHTMLLocation *iface, BSTR *p) { HTMLLocation *This = HTMLLOCATION_THIS(iface); FIXME("(%p)->(%p)\n", This, p); + + if(!p) + return E_POINTER; + return E_NOTIMPL; } @@ -285,6 +308,10 @@ static HRESULT WINAPI HTMLLocation_get_hash(IHTMLLocation *iface, BSTR *p) { HTMLLocation *This = HTMLLOCATION_THIS(iface); FIXME("(%p)->(%p)\n", This, p); + + if(!p) + return E_POINTER; + return E_NOTIMPL; } @@ -316,34 +343,6 @@ static HRESULT WINAPI HTMLLocation_toString(IHTMLLocation *iface, BSTR *String) return E_NOTIMPL; } -static HRESULT HTMLLocation_value(IUnknown *iface, LCID lcid, WORD flags, DISPPARAMS *params, - VARIANT *res, EXCEPINFO *ei, IServiceProvider *caller) -{ - HTMLLocation *This = HTMLLOCATION_THIS(iface); - HRESULT hres; - - TRACE("(%p)\n", This); - - switch(flags) { - case DISPATCH_PROPERTYGET: { - BSTR str; - - hres = IHTMLLocation_get_href(HTMLLOCATION(This), &str); - if(FAILED(hres)) - return hres; - - V_VT(res) = VT_BSTR; - V_BSTR(res) = str; - break; - } - default: - FIXME("unimplemented flags %x\n", flags); - return E_NOTIMPL; - } - - return S_OK; -} - #undef HTMLLOCATION_THIS static const IHTMLLocationVtbl HTMLLocationVtbl = { @@ -376,18 +375,12 @@ static const IHTMLLocationVtbl HTMLLocationVtbl = { HTMLLocation_toString }; -static const dispex_static_data_vtbl_t HTMLLocation_dispex_vtbl = { - HTMLLocation_value, - NULL, - NULL -}; - static const tid_t HTMLLocation_iface_tids[] = { IHTMLLocation_tid, 0 }; static dispex_static_data_t HTMLLocation_dispex = { - &HTMLLocation_dispex_vtbl, + NULL, DispHTMLLocation_tid, NULL, HTMLLocation_iface_tids diff --git a/dlls/mshtml/htmlnode.c b/dlls/mshtml/htmlnode.c index 8c83e56b0c9..1c7b7cb441c 100644 --- a/dlls/mshtml/htmlnode.c +++ b/dlls/mshtml/htmlnode.c @@ -536,8 +536,22 @@ static HRESULT WINAPI HTMLDOMNode_cloneNode(IHTMLDOMNode *iface, VARIANT_BOOL fD IHTMLDOMNode **clonedNode) { HTMLDOMNode *This = HTMLDOMNODE_THIS(iface); - FIXME("(%p)->(%x %p)\n", This, fDeep, clonedNode); - return E_NOTIMPL; + nsIDOMNode *nsnode; + HTMLDOMNode *node; + nsresult nsres; + + TRACE("(%p)->(%x %p)\n", This, fDeep, clonedNode); + + nsres = nsIDOMNode_CloneNode(This->nsnode, fDeep != VARIANT_FALSE, &nsnode); + if(NS_FAILED(nsres) || !nsnode) { + ERR("CloneNode failed: %08x\n", nsres); + return E_FAIL; + } + + node = get_node(This->doc, nsnode, TRUE); + IHTMLDOMNode_AddRef(HTMLDOMNODE(node)); + *clonedNode = HTMLDOMNODE(node); + return S_OK; } static HRESULT WINAPI HTMLDOMNode_removeNode(IHTMLDOMNode *iface, VARIANT_BOOL fDeep, diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c index 4b2c8e00854..877eef2ebc1 100644 --- a/dlls/mshtml/htmloption.c +++ b/dlls/mshtml/htmloption.c @@ -347,8 +347,7 @@ HTMLElement *HTMLOptionElement_Create(nsIDOMHTMLElement *nselem) ret->lpHTMLOptionElementVtbl = &HTMLOptionElementVtbl; ret->element.node.vtbl = &HTMLOptionElementImplVtbl; - HTMLElement_Init(&ret->element); - init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLOPTION(ret), &HTMLOptionElement_dispex); + HTMLElement_Init(&ret->element, &HTMLOptionElement_dispex); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLOptionElement, (void**)&ret->nsoption); if(NS_FAILED(nsres)) diff --git a/dlls/mshtml/htmlscript.c b/dlls/mshtml/htmlscript.c index 958877a37a7..5c0c6009962 100644 --- a/dlls/mshtml/htmlscript.c +++ b/dlls/mshtml/htmlscript.c @@ -311,11 +311,11 @@ HTMLElement *HTMLScriptElement_Create(nsIDOMHTMLElement *nselem) HTMLScriptElement *ret = heap_alloc_zero(sizeof(HTMLScriptElement)); nsresult nsres; - HTMLElement_Init(&ret->element); - ret->lpHTMLScriptElementVtbl = &HTMLScriptElementVtbl; ret->element.node.vtbl = &HTMLScriptElementImplVtbl; + HTMLElement_Init(&ret->element, NULL); + nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLScriptElement, (void**)&ret->nsscript); if(NS_FAILED(nsres)) ERR("Could not get nsIDOMHTMLScriptElement: %08x\n", nsres); diff --git a/dlls/mshtml/htmlselect.c b/dlls/mshtml/htmlselect.c index 21afc92d86e..f3dd75797fa 100644 --- a/dlls/mshtml/htmlselect.c +++ b/dlls/mshtml/htmlselect.c @@ -510,8 +510,7 @@ HTMLElement *HTMLSelectElement_Create(nsIDOMHTMLElement *nselem) ret->lpHTMLSelectElementVtbl = &HTMLSelectElementVtbl; ret->element.node.vtbl = &HTMLSelectElementImplVtbl; - init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLSELECT(ret), &HTMLSelectElement_dispex); - HTMLElement_Init(&ret->element); + HTMLElement_Init(&ret->element, &HTMLSelectElement_dispex); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLSelectElement, (void**)&ret->nsselect); diff --git a/dlls/mshtml/htmltable.c b/dlls/mshtml/htmltable.c index b329219bfa8..fabc3808481 100644 --- a/dlls/mshtml/htmltable.c +++ b/dlls/mshtml/htmltable.c @@ -582,8 +582,7 @@ HTMLElement *HTMLTable_Create(nsIDOMHTMLElement *nselem) ret->element.node.vtbl = &HTMLTableImplVtbl; ret->lpHTMLTableVtbl = &HTMLTableVtbl; - init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLTABLE(ret), &HTMLTable_dispex); - HTMLElement_Init(&ret->element); + HTMLElement_Init(&ret->element, &HTMLTable_dispex); ConnectionPoint_Init(&ret->cp, &ret->element.cp_container, &DIID_HTMLTableEvents); diff --git a/dlls/mshtml/htmltablerow.c b/dlls/mshtml/htmltablerow.c index 5abeeec9a8b..aaae2eb502f 100644 --- a/dlls/mshtml/htmltablerow.c +++ b/dlls/mshtml/htmltablerow.c @@ -325,8 +325,7 @@ HTMLElement *HTMLTableRow_Create(nsIDOMHTMLElement *nselem) ret->lpHTMLTableRowVtbl = &HTMLTableRowVtbl; ret->element.node.vtbl = &HTMLTableRowImplVtbl; - init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLTABLEROW(ret), &HTMLTableRow_dispex); - HTMLElement_Init(&ret->element); + HTMLElement_Init(&ret->element, &HTMLTableRow_dispex); nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTableRowElement, (void**)&ret->nsrow); if(NS_FAILED(nsres)) diff --git a/dlls/mshtml/htmltextarea.c b/dlls/mshtml/htmltextarea.c index bec4a2fd90d..2ff5c25a677 100644 --- a/dlls/mshtml/htmltextarea.c +++ b/dlls/mshtml/htmltextarea.c @@ -415,11 +415,11 @@ HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement *nselem) HTMLTextAreaElement *ret = heap_alloc_zero(sizeof(HTMLTextAreaElement)); nsresult nsres; - HTMLElement_Init(&ret->element); - ret->lpHTMLTextAreaElementVtbl = &HTMLTextAreaElementVtbl; ret->element.node.vtbl = &HTMLTextAreaElementImplVtbl; + HTMLElement_Init(&ret->element, NULL); + nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLTextAreaElement, (void**)&ret->nstextarea); if(NS_FAILED(nsres)) diff --git a/dlls/mshtml/htmltextcont.c b/dlls/mshtml/htmltextcont.c index d86a97b84d6..69f1ef4c3a5 100644 --- a/dlls/mshtml/htmltextcont.c +++ b/dlls/mshtml/htmltextcont.c @@ -182,11 +182,11 @@ static const IHTMLTextContainerVtbl HTMLTextContainerVtbl = { HTMLTextContainer_get_onscroll }; -void HTMLTextContainer_Init(HTMLTextContainer *This) +void HTMLTextContainer_Init(HTMLTextContainer *This, dispex_static_data_t *dispex_data) { - HTMLElement_Init(&This->element); - This->lpHTMLTextContainerVtbl = &HTMLTextContainerVtbl; + HTMLElement_Init(&This->element, dispex_data); + ConnectionPoint_Init(&This->cp, &This->element.cp_container, &DIID_HTMLTextContainerEvents); } diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 73daf017aaf..18719fe89b9 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -59,6 +59,7 @@ typedef enum { NULL_tid, DispCEventObj_tid, DispDOMChildrenCollection_tid, + DispHTMLAnchorElement_tid, DispHTMLBody_tid, DispHTMLCommentElement_tid, DispHTMLCurrentStyle_tid, @@ -78,6 +79,7 @@ typedef enum { DispHTMLTableRow_tid, DispHTMLUnknownElement_tid, DispHTMLWindow2_tid, + IHTMLAnchorElement_tid, IHTMLBodyElement_tid, IHTMLBodyElement2_tid, IHTMLCommentElement_tid, @@ -465,10 +467,14 @@ struct HTMLDocumentNode { HTMLDOMNode node; HTMLDocument basedoc; + const IInternetHostSecurityManagerVtbl *lpIInternetHostSecurityManagerVtbl; + LONG ref; HTMLDOMNode *nodes; + IInternetSecurityManager *secmgr; + struct list selection_list; struct list range_list; }; @@ -540,6 +546,8 @@ struct HTMLDocumentNode { #define SUPPERRINFO(x) ((ISupportErrorInfo*) &(x)->lpSupportErrorInfoVtbl) +#define HOSTSECMGR(x) ((IInternetHostSecurityManager*) &(x)->lpIInternetHostSecurityManagerVtbl) + #define DEFINE_THIS2(cls,ifc,iface) ((cls*)((BYTE*)(iface)-offsetof(cls,ifc))) #define DEFINE_THIS(cls,ifc,iface) DEFINE_THIS2(cls,lp ## ifc ## Vtbl,iface) @@ -564,6 +572,8 @@ void HTMLDocument_Window_Init(HTMLDocument*); void HTMLDocument_Service_Init(HTMLDocument*); void HTMLDocument_Hlink_Init(HTMLDocument*); +void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode*); + HRESULT HTMLCurrentStyle_Create(HTMLElement*,IHTMLCurrentStyle**); void ConnectionPoint_Init(ConnectionPoint*,ConnectionPointContainer*,REFIID); @@ -661,10 +671,10 @@ HTMLElement *HTMLTextAreaElement_Create(nsIDOMHTMLElement*); HTMLElement *HTMLGenericElement_Create(nsIDOMHTMLElement*); void HTMLDOMNode_Init(HTMLDocumentNode*,HTMLDOMNode*,nsIDOMNode*); -void HTMLElement_Init(HTMLElement*); +void HTMLElement_Init(HTMLElement*,dispex_static_data_t*); void HTMLElement2_Init(HTMLElement*); void HTMLElement3_Init(HTMLElement*); -void HTMLTextContainer_Init(HTMLTextContainer*); +void HTMLTextContainer_Init(HTMLTextContainer*,dispex_static_data_t*); HRESULT HTMLDOMNode_QI(HTMLDOMNode*,REFIID,void**); void HTMLDOMNode_destructor(HTMLDOMNode*); diff --git a/dlls/mshtml/nsiface.idl b/dlls/mshtml/nsiface.idl index cb8f76839b4..571c0230b09 100644 --- a/dlls/mshtml/nsiface.idl +++ b/dlls/mshtml/nsiface.idl @@ -1353,6 +1353,42 @@ interface nsIDOMHTMLImageElement : nsIDOMHTMLElement [ object, + uuid(a6cf90aa-15b3-11d2-932e-00805f8add32), + local + /* FROZEN */ +] +interface nsIDOMHTMLAnchorElement : nsIDOMHTMLElement +{ + nsresult GetAccessKey(nsAString *aAccessKey); + nsresult SetAccessKey(const nsAString *aAccessKey); + nsresult GetCharset(nsAString *aCharset); + nsresult SetCharset(const nsAString *aCharset); + nsresult GetCoords(nsAString *aCoords); + nsresult SetCoords(const nsAString *aCoords); + nsresult GetHref(nsAString *aHref); + nsresult SetHref(const nsAString *aHref); + nsresult GetHreflang(nsAString *aHreflang); + nsresult SetHreflang(const nsAString *aHreflang); + nsresult GetName(nsAString *aName); + nsresult SetName(const nsAString *aName); + nsresult GetRel(nsAString *aRel); + nsresult SetRel(const nsAString *aRel); + nsresult GetRev(nsAString *aRev); + nsresult SetRev(const nsAString *aRev); + nsresult GetShape(nsAString *aShape); + nsresult SetShape(const nsAString *aShape); + nsresult GetTabIndex(PRInt32 *aTabIndex); + nsresult SetTabIndex(PRInt32 aTabIndex); + nsresult GetTarget(nsAString *aTarget); + nsresult SetTarget(const nsAString *aTarget); + nsresult GetType(nsAString *aType); + nsresult SetType(const nsAString *aType); + nsresult Blur(); + nsresult Focus(); +} + +[ + object, uuid(a6cf90b2-15b3-11d2-932e-00805f8add32), local /* FROZEN */ diff --git a/dlls/mshtml/script.c b/dlls/mshtml/script.c index e66ba9042ce..5c83e1ed294 100644 --- a/dlls/mshtml/script.c +++ b/dlls/mshtml/script.c @@ -47,6 +47,7 @@ struct ScriptHost { const IActiveScriptSiteInterruptPollVtbl *lpIActiveScriptSiteInterruptPollVtbl; const IActiveScriptSiteWindowVtbl *lpIActiveScriptSiteWindowVtbl; const IActiveScriptSiteDebug32Vtbl *lpIActiveScriptSiteDebug32Vtbl; + const IServiceProviderVtbl *lpServiceProviderVtbl; LONG ref; @@ -239,6 +240,9 @@ static HRESULT WINAPI ActiveScriptSite_QueryInterface(IActiveScriptSite *iface, }else if(IsEqualGUID(&IID_IActiveScriptSiteDebug32, riid)) { TRACE("(%p)->(IID_IActiveScriptSiteDebug32 %p)\n", This, ppv); *ppv = ACTSCPDBG32(This); + }else if(IsEqualGUID(&IID_IServiceProvider, riid)) { + TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv); + *ppv = SERVPROV(This); }else if(IsEqualGUID(&IID_ICanHandleException, riid)) { TRACE("(%p)->(IID_ICanHandleException not supported %p)\n", This, ppv); return E_NOINTERFACE; @@ -529,6 +533,53 @@ static const IActiveScriptSiteDebug32Vtbl ActiveScriptSiteDebug32Vtbl = { ActiveScriptSiteDebug32_OnScriptErrorDebug }; +#define SERVPROV_THIS(iface) DEFINE_THIS(ScriptHost, ServiceProvider, iface) + +static HRESULT WINAPI ASServiceProvider_QueryInterface(IServiceProvider *iface, REFIID riid, void **ppv) +{ + ScriptHost *This = SERVPROV_THIS(iface); + return IActiveScriptSite_QueryInterface(ACTSCPSITE(This), riid, ppv); +} + +static ULONG WINAPI ASServiceProvider_AddRef(IServiceProvider *iface) +{ + ScriptHost *This = SERVPROV_THIS(iface); + return IActiveScriptSite_AddRef(ACTSCPSITE(This)); +} + +static ULONG WINAPI ASServiceProvider_Release(IServiceProvider *iface) +{ + ScriptHost *This = SERVPROV_THIS(iface); + return IActiveScriptSite_Release(ACTSCPSITE(This)); +} + +static HRESULT WINAPI ASServiceProvider_QueryService(IServiceProvider *iface, REFGUID guidService, + REFIID riid, void **ppv) +{ + ScriptHost *This = SERVPROV_THIS(iface); + + if(IsEqualGUID(&SID_SInternetHostSecurityManager, guidService)) { + TRACE("(%p)->(SID_SInternetHostSecurityManager)\n", This); + + if(!This->window || !This->window->doc) + return E_NOINTERFACE; + + return IInternetHostSecurityManager_QueryInterface(HOSTSECMGR(This->window->doc), riid, ppv); + } + + FIXME("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv); + return E_NOINTERFACE; +} + +#undef SERVPROV_THIS + +static const IServiceProviderVtbl ASServiceProviderVtbl = { + ASServiceProvider_QueryInterface, + ASServiceProvider_AddRef, + ASServiceProvider_Release, + ASServiceProvider_QueryService +}; + static ScriptHost *create_script_host(HTMLWindow *window, const GUID *guid) { ScriptHost *ret; @@ -539,6 +590,7 @@ static ScriptHost *create_script_host(HTMLWindow *window, const GUID *guid) ret->lpIActiveScriptSiteInterruptPollVtbl = &ActiveScriptSiteInterruptPollVtbl; ret->lpIActiveScriptSiteWindowVtbl = &ActiveScriptSiteWindowVtbl; ret->lpIActiveScriptSiteDebug32Vtbl = &ActiveScriptSiteDebug32Vtbl; + ret->lpServiceProviderVtbl = &ASServiceProviderVtbl; ret->ref = 1; ret->window = window; ret->script_state = SCRIPTSTATE_UNINITIALIZED; diff --git a/dlls/mshtml/secmgr.c b/dlls/mshtml/secmgr.c new file mode 100644 index 00000000000..be56e5dbda9 --- /dev/null +++ b/dlls/mshtml/secmgr.c @@ -0,0 +1,181 @@ +/* + * Copyright 2009 Jacek Caban for CodeWeavers + * + * 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 "config.h" + +#include +#include + +#define COBJMACROS + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "objsafe.h" +#include "activscp.h" + +#include "wine/debug.h" + +#include "mshtml_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mshtml); + +static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0}; + +/* Defined as extern in urlmon.idl, but not exported by uuid.lib */ +const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY = + {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}}; + +#define HOSTSECMGR_THIS(iface) DEFINE_THIS(HTMLDocumentNode, IInternetHostSecurityManager, iface) + +static HRESULT WINAPI InternetHostSecurityManager_QueryInterface(IInternetHostSecurityManager *iface, REFIID riid, void **ppv) +{ + HTMLDocumentNode *This = HOSTSECMGR_THIS(iface); + return IHTMLDOMNode_QueryInterface(HTMLDOMNODE(&This->node), riid, ppv); +} + +static ULONG WINAPI InternetHostSecurityManager_AddRef(IInternetHostSecurityManager *iface) +{ + HTMLDocumentNode *This = HOSTSECMGR_THIS(iface); + return IHTMLDOMNode_AddRef(HTMLDOMNODE(&This->node)); +} + +static ULONG WINAPI InternetHostSecurityManager_Release(IInternetHostSecurityManager *iface) +{ + HTMLDocumentNode *This = HOSTSECMGR_THIS(iface); + return IHTMLDOMNode_Release(HTMLDOMNODE(&This->node)); +} + +static HRESULT WINAPI InternetHostSecurityManager_GetSecurityId(IInternetHostSecurityManager *iface, BYTE *pbSecurityId, + DWORD *pcbSecurityId, DWORD_PTR dwReserved) +{ + HTMLDocumentNode *This = HOSTSECMGR_THIS(iface); + FIXME("(%p)->(%p %p %lx)\n", This, pbSecurityId, pcbSecurityId, dwReserved); + return E_NOTIMPL; +} + +static HRESULT WINAPI InternetHostSecurityManager_ProcessUrlAction(IInternetHostSecurityManager *iface, DWORD dwAction, + BYTE *pPolicy, DWORD cbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwFlags, DWORD dwReserved) +{ + HTMLDocumentNode *This = HOSTSECMGR_THIS(iface); + const WCHAR *url; + + TRACE("%p)->(%d %p %d %p %d %x %x)\n", This, dwAction, pPolicy, cbPolicy, pContext, cbContext, dwFlags, dwReserved); + + url = This->basedoc.doc_obj->url ? This->basedoc.doc_obj->url : about_blankW; + + return IInternetSecurityManager_ProcessUrlAction(This->secmgr, url, dwAction, pPolicy, cbPolicy, + pContext, cbContext, dwFlags, dwReserved); +} + +static DWORD confirm_safety(HTMLDocumentNode *This, const WCHAR *url, IUnknown *obj) +{ + DWORD policy, enabled_opts, supported_opts; + IObjectSafety *obj_safety; + HRESULT hres; + + /* FIXME: Check URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY */ + + hres = IInternetSecurityManager_ProcessUrlAction(This->secmgr, url, URLACTION_SCRIPT_SAFE_ACTIVEX, + (BYTE*)&policy, sizeof(policy), NULL, 0, 0, 0); + if(FAILED(hres) || policy != URLPOLICY_ALLOW) + return URLPOLICY_DISALLOW; + + hres = IUnknown_QueryInterface(obj, &IID_IObjectSafety, (void**)&obj_safety); + if(FAILED(hres)) + return URLPOLICY_DISALLOW; + + hres = IObjectSafety_GetInterfaceSafetyOptions(obj_safety, &IID_IDispatchEx, &supported_opts, &enabled_opts); + if(SUCCEEDED(hres)) { + enabled_opts = INTERFACESAFE_FOR_UNTRUSTED_CALLER; + if(supported_opts & INTERFACE_USES_SECURITY_MANAGER) + enabled_opts |= INTERFACE_USES_SECURITY_MANAGER; + hres = IObjectSafety_SetInterfaceSafetyOptions(obj_safety, &IID_IDispatchEx, enabled_opts, enabled_opts); + } + IObjectSafety_Release(obj_safety); + if(FAILED(hres)) + return URLPOLICY_DISALLOW; + + return URLPOLICY_ALLOW; +} + +static HRESULT WINAPI InternetHostSecurityManager_QueryCustomPolicy(IInternetHostSecurityManager *iface, REFGUID guidKey, + BYTE **ppPolicy, DWORD *pcbPolicy, BYTE *pContext, DWORD cbContext, DWORD dwReserved) +{ + HTMLDocumentNode *This = HOSTSECMGR_THIS(iface); + const WCHAR *url; + HRESULT hres; + + TRACE("(%p)->(%s %p %p %p %d %x)\n", This, debugstr_guid(guidKey), ppPolicy, pcbPolicy, pContext, cbContext, dwReserved); + + url = This->basedoc.doc_obj->url ? This->basedoc.doc_obj->url : about_blankW; + + hres = IInternetSecurityManager_QueryCustomPolicy(This->secmgr, url, guidKey, ppPolicy, pcbPolicy, + pContext, cbContext, dwReserved); + if(hres != HRESULT_FROM_WIN32(ERROR_NOT_FOUND)) + return hres; + + if(IsEqualGUID(&GUID_CUSTOM_CONFIRMOBJECTSAFETY, guidKey)) { + IActiveScript *active_script; + struct CONFIRMSAFETY *cs; + DWORD policy; + + if(cbContext != sizeof(struct CONFIRMSAFETY)) { + FIXME("wrong context size\n"); + return E_FAIL; + } + + cs = (struct CONFIRMSAFETY*)pContext; + hres = IUnknown_QueryInterface(cs->pUnk, &IID_IActiveScript, (void**)&active_script); + if(SUCCEEDED(hres)) { + FIXME("Got IAciveScript iface\n"); + IActiveScript_Release(active_script); + return E_FAIL; + } + + policy = confirm_safety(This, url, cs->pUnk); + + *ppPolicy = CoTaskMemAlloc(sizeof(policy)); + if(!*ppPolicy) + return E_OUTOFMEMORY; + + *(DWORD*)*ppPolicy = policy; + *pcbPolicy = sizeof(policy); + return S_OK; + } + + FIXME("Unknown guidKey %s\n", debugstr_guid(guidKey)); + return hres; +} + +#undef HOSTSECMGR_THIS + +static const IInternetHostSecurityManagerVtbl InternetHostSecurityManagerVtbl = { + InternetHostSecurityManager_QueryInterface, + InternetHostSecurityManager_AddRef, + InternetHostSecurityManager_Release, + InternetHostSecurityManager_GetSecurityId, + InternetHostSecurityManager_ProcessUrlAction, + InternetHostSecurityManager_QueryCustomPolicy +}; + +void HTMLDocumentNode_SecMgr_Init(HTMLDocumentNode *This) +{ + This->lpIInternetHostSecurityManagerVtbl = &InternetHostSecurityManagerVtbl; +} diff --git a/dlls/mshtml/tests/dom.c b/dlls/mshtml/tests/dom.c index fd7cc44827f..dba424b7862 100644 --- a/dlls/mshtml/tests/dom.c +++ b/dlls/mshtml/tests/dom.c @@ -42,7 +42,7 @@ static const char range_test2_str[] = static const char elem_test_str[] = "test" "text test" - "link" + "link" "" "" "" @@ -105,6 +105,7 @@ static const IID * const doc_node_iids[] = { &IID_IHTMLDocument5, &IID_IDispatchEx, &IID_IConnectionPointContainer, + &IID_IInternetHostSecurityManager, NULL }; @@ -352,7 +353,7 @@ static const elem_type_info_t elem_type_infos[] = { {"HEAD", elem_iids, NULL}, {"TITLE", elem_iids, NULL}, {"BODY", body_iids, &DIID_DispHTMLBody}, - {"A", anchor_iids, NULL}, + {"A", anchor_iids, &DIID_DispHTMLAnchorElement}, {"INPUT", input_iids, &DIID_DispHTMLInputElement}, {"SELECT", select_iids, &DIID_DispHTMLSelectElement}, {"TEXTAREA", textarea_iids, NULL}, @@ -526,7 +527,8 @@ static void _test_disp(unsigned line, IUnknown *unk, const IID *diid, const char if(_test_get_dispid(line, unk, &iid)) ok_(__FILE__,line) (IsEqualGUID(&iid, diid), "unexpected guid %s\n", dbgstr_guid(&iid)); - _test_disp_value(line, unk, val); + if(val) + _test_disp_value(line, unk, val); } #define test_disp2(u,id,id2,v) _test_disp2(__LINE__,u,id,id2,v) @@ -538,7 +540,8 @@ static void _test_disp2(unsigned line, IUnknown *unk, const IID *diid, const IID ok_(__FILE__,line) (IsEqualGUID(&iid, diid) || broken(IsEqualGUID(&iid, diid2)), "unexpected guid %s\n", dbgstr_guid(&iid)); - _test_disp_value(line, unk, val); + if(val) + _test_disp_value(line, unk, val); } #define get_elem_iface(u) _get_elem_iface(__LINE__,u) @@ -607,6 +610,17 @@ static IHTMLImgElement *_get_img_iface(unsigned line, IUnknown *unk) return img; } +#define get_anchor_iface(u) _get_anchor_iface(__LINE__,u) +static IHTMLAnchorElement *_get_anchor_iface(unsigned line, IUnknown *unk) +{ + IHTMLAnchorElement *anchor; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLAnchorElement, (void**)&anchor); + ok_(__FILE__,line) (hres == S_OK, "Could not get IHTMLAnchorElement: %08x\n", hres); + return anchor; +} + #define test_node_name(u,n) _test_node_name(__LINE__,u,n) static void _test_node_name(unsigned line, IUnknown *unk, const char *exname) { @@ -642,6 +656,22 @@ static IHTMLDocument2 *_get_owner_doc(unsigned line, IUnknown *unk) return doc; } +#define clone_node(n,d) _clone_node(__LINE__,n,d) +static IHTMLDOMNode *_clone_node(unsigned line, IUnknown *unk, VARIANT_BOOL deep) +{ + IHTMLDOMNode *node = _get_node_iface(line, unk); + IHTMLDOMNode *ret = NULL; + HRESULT hres; + + hres = IHTMLDOMNode_cloneNode(node, deep, &ret); + IHTMLDOMNode_Release(node); + ok_(__FILE__,line)(hres == S_OK, "cloneNode failed: %08x\n", hres); + ok_(__FILE__,line)(ret != NULL, "ret == NULL\n"); + + return ret; + +} + #define test_elem_tag(u,n) _test_elem_tag(__LINE__,u,n) static void _test_elem_tag(unsigned line, IUnknown *unk, const char *extag) { @@ -663,7 +693,7 @@ static void _test_elem_type(unsigned line, IUnknown *unk, elem_type_t type) _test_elem_tag(line, unk, elem_type_infos[type].tag); _test_ifaces(line, unk, elem_type_infos[type].iids); - if(elem_type_infos[type].dispiid) + if(elem_type_infos[type].dispiid && type != ET_A) _test_disp(line, unk, elem_type_infos[type].dispiid, "[object]"); } @@ -895,6 +925,21 @@ static IHTMLElement *_get_doc_elem(unsigned line, IHTMLDocument2 *doc) return elem; } +#define test_anchor_href(a,h) _test_anchor_href(__LINE__,a,h) +static void _test_anchor_href(unsigned line, IUnknown *unk, const char *exhref) +{ + IHTMLAnchorElement *anchor = _get_anchor_iface(line, unk); + BSTR str; + HRESULT hres; + + hres = IHTMLAnchorElement_get_href(anchor, &str); + ok_(__FILE__,line)(hres == S_OK, "get_href failed: %08x\n", hres); + ok_(__FILE__,line)(!strcmp_wa(str, exhref), "href = %s, expected %s\n", wine_dbgstr_w(str), exhref); + SysFreeString(str); + + _test_disp_value(line, unk, exhref); +} + #define test_option_text(o,t) _test_option_text(__LINE__,o,t) static void _test_option_text(unsigned line, IHTMLOptionElement *option, const char *text) { @@ -1258,6 +1303,21 @@ static void _test_elem_collection(unsigned line, IUnknown *unk, IHTMLElementCollection_Release(col); } +#define test_elem_all(c,t,l) _test_elem_all(__LINE__,c,t,l) +static void _test_elem_all(unsigned line, IUnknown *unk, const elem_type_t *elem_types, LONG exlen) +{ + IHTMLElement *elem = _get_elem_iface(line, unk); + IDispatch *disp; + HRESULT hres; + + hres = IHTMLElement_get_all(elem, &disp); + IHTMLElement_Release(elem); + ok_(__FILE__,line)(hres == S_OK, "get_all failed: %08x\n", hres); + + _test_elem_collection(line, (IUnknown*)disp, elem_types, exlen); + IDispatch_Release(disp); +} + #define test_elem_getelembytag(u,t,l) _test_elem_getelembytag(__LINE__,u,t,l) static void _test_elem_getelembytag(unsigned line, IUnknown *unk, elem_type_t type, LONG exlen) { @@ -4433,9 +4493,11 @@ static void test_table_elem(IHTMLElement *elem) { IHTMLElementCollection *col; IHTMLTable *table; + IHTMLDOMNode *node; HRESULT hres; static const elem_type_t row_types[] = {ET_TR,ET_TR}; + static const elem_type_t all_types[] = {ET_TBODY,ET_TR,ET_TR,ET_TD,ET_TD}; hres = IHTMLElement_QueryInterface(elem, &IID_IHTMLTable, (void**)&table); ok(hres == S_OK, "Could not get IHTMLTable iface: %08x\n", hres); @@ -4450,6 +4512,18 @@ static void test_table_elem(IHTMLElement *elem) test_elem_collection((IUnknown*)col, row_types, sizeof(row_types)/sizeof(*row_types)); IHTMLElementCollection_Release(col); + test_elem_all((IUnknown*)table, all_types, sizeof(all_types)/sizeof(*all_types)); + + node = clone_node((IUnknown*)table, VARIANT_TRUE); + test_elem_tag((IUnknown*)node, "TABLE"); + test_elem_all((IUnknown*)node, all_types, sizeof(all_types)/sizeof(*all_types)); + IHTMLDOMNode_Release(node); + + node = clone_node((IUnknown*)table, VARIANT_FALSE); + test_elem_tag((IUnknown*)node, "TABLE"); + test_elem_all((IUnknown*)node, NULL, 0); + IHTMLDOMNode_Release(node); + IHTMLTable_Release(table); } @@ -4719,16 +4793,8 @@ static void test_elems(IHTMLDocument2 *doc) } elem = get_doc_elem(doc); - ok(hres == S_OK, "get_documentElement failed: %08x\n", hres); - hres = IHTMLElement_get_all(elem, &disp); + test_elem_all((IUnknown*)elem, all_types+1, sizeof(all_types)/sizeof(all_types[0])-1); IHTMLElement_Release(elem); - ok(hres == S_OK, "get_all failed: %08x\n", hres); - - hres = IDispatch_QueryInterface(disp, &IID_IHTMLElementCollection, (void**)&col); - IDispatch_Release(disp); - ok(hres == S_OK, "Could not get IHTMLElementCollection: %08x\n", hres); - test_elem_collection((IUnknown*)col, all_types+1, sizeof(all_types)/sizeof(all_types[0])-1); - IHTMLElementCollection_Release(col); get_elem_by_id(doc, "xxx", FALSE); elem = get_doc_elem_by_id(doc, "xxx"); @@ -4929,6 +4995,12 @@ static void test_elems(IHTMLDocument2 *doc) IHTMLElement_Release(elem); } + elem = get_elem_by_id(doc, "a", TRUE); + if(elem) { + test_anchor_href((IUnknown*)elem, "http://test/"); + IHTMLElement_Release(elem); + } + hres = IHTMLDocument2_get_body(doc, &elem); ok(hres == S_OK, "get_body failed: %08x\n", hres); diff --git a/dlls/mshtml/tests/script.c b/dlls/mshtml/tests/script.c index a4ef3d04475..5f59ea4e1b6 100644 --- a/dlls/mshtml/tests/script.c +++ b/dlls/mshtml/tests/script.c @@ -37,6 +37,10 @@ DEFINE_GUID(CLSID_IdentityUnmarshal,0x0000001b,0x0000,0x0000,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46); +/* Defined as extern in urlmon.idl, but not exported by uuid.lib */ +const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY = + {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}}; + #ifdef _WIN64 #define CTXARG_T DWORDLONG @@ -110,6 +114,10 @@ DEFINE_EXPECT(GetScriptDispatch); DEFINE_EXPECT(funcDisp); DEFINE_EXPECT(script_testprop_d); DEFINE_EXPECT(script_testprop_i); +DEFINE_EXPECT(AXQueryInterface_IActiveScript); +DEFINE_EXPECT(AXQueryInterface_IObjectSafety); +DEFINE_EXPECT(AXGetInterfaceSafetyOptions); +DEFINE_EXPECT(AXSetInterfaceSafetyOptions); #define TESTSCRIPT_CLSID "{178fc163-f585-4e24-9c13-4bb7faf80746}" @@ -117,6 +125,8 @@ DEFINE_EXPECT(script_testprop_i); static const GUID CLSID_TestScript = {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x07,0x46}}; +static const GUID CLSID_TestActiveX = + {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}}; static IHTMLDocument2 *notif_doc; static IDispatchEx *window_dispex; @@ -517,7 +527,7 @@ static SCRIPTSTATE state; static HRESULT WINAPI ObjectSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv) { *ppv = NULL; - ok(0, "unexpected call\n"); + ok(0, "unexpected call %s\n", debugstr_guid(riid)); return E_NOINTERFACE; } @@ -571,6 +581,110 @@ static const IObjectSafetyVtbl ObjectSafetyVtbl = { static IObjectSafety ObjectSafety = { &ObjectSafetyVtbl }; +static HRESULT WINAPI AXObjectSafety_QueryInterface(IObjectSafety *iface, REFIID riid, void **ppv) +{ + *ppv = NULL; + + if(IsEqualGUID(&IID_IActiveScript, riid)) { + CHECK_EXPECT(AXQueryInterface_IActiveScript); + return E_NOINTERFACE; + } + + if(IsEqualGUID(&IID_IObjectSafety, riid)) { + CHECK_EXPECT(AXQueryInterface_IObjectSafety); + *ppv = iface; + return S_OK; + } + + ok(0, "unexpected call %s\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static HRESULT WINAPI AXObjectSafety_GetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, + DWORD *pdwSupportedOptions, DWORD *pdwEnabledOptions) +{ + CHECK_EXPECT(AXGetInterfaceSafetyOptions); + + ok(IsEqualGUID(&IID_IDispatchEx, riid), "unexpected riid %s\n", debugstr_guid(riid)); + ok(pdwSupportedOptions != NULL, "pdwSupportedOptions == NULL\n"); + ok(pdwEnabledOptions != NULL, "pdwEnabledOptions == NULL\n"); + + *pdwSupportedOptions = INTERFACESAFE_FOR_UNTRUSTED_DATA|INTERFACE_USES_DISPEX|INTERFACE_USES_SECURITY_MANAGER; + *pdwEnabledOptions = INTERFACE_USES_DISPEX; + + return S_OK; +} + +static HRESULT WINAPI AXObjectSafety_SetInterfaceSafetyOptions(IObjectSafety *iface, REFIID riid, + DWORD dwOptionSetMask, DWORD dwEnabledOptions) +{ + CHECK_EXPECT(AXSetInterfaceSafetyOptions); + + ok(IsEqualGUID(&IID_IDispatchEx, riid), "unexpected riid %s\n", debugstr_guid(riid)); + + ok(dwOptionSetMask == (INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACE_USES_SECURITY_MANAGER), + "dwOptionSetMask=%x\n", dwOptionSetMask); + ok(dwEnabledOptions == (INTERFACESAFE_FOR_UNTRUSTED_CALLER|INTERFACE_USES_SECURITY_MANAGER), + "dwEnabledOptions=%x\n", dwOptionSetMask); + + return S_OK; +} + +static const IObjectSafetyVtbl AXObjectSafetyVtbl = { + AXObjectSafety_QueryInterface, + ObjectSafety_AddRef, + ObjectSafety_Release, + AXObjectSafety_GetInterfaceSafetyOptions, + AXObjectSafety_SetInterfaceSafetyOptions +}; + +static IObjectSafety AXObjectSafety = { &AXObjectSafetyVtbl }; + +static void test_security(void) +{ + IInternetHostSecurityManager *sec_mgr; + IServiceProvider *sp; + DWORD policy, policy_size; + struct CONFIRMSAFETY cs; + BYTE *ppolicy; + HRESULT hres; + + hres = IActiveScriptSite_QueryInterface(site, &IID_IServiceProvider, (void**)&sp); + ok(hres == S_OK, "Could not get IServiceProvider iface: %08x\n", hres); + + hres = IServiceProvider_QueryService(sp, &SID_SInternetHostSecurityManager, + &IID_IInternetHostSecurityManager, (void**)&sec_mgr); + IServiceProvider_Release(sp); + ok(hres == S_OK, "QueryService failed: %08x\n", hres); + + hres = IInternetHostSecurityManager_ProcessUrlAction(sec_mgr, URLACTION_ACTIVEX_RUN, (BYTE*)&policy, sizeof(policy), + (BYTE*)&CLSID_TestActiveX, sizeof(CLSID), 0, 0); + ok(hres == S_OK, "ProcessUrlAction failed: %08x\n", hres); + ok(policy == URLPOLICY_ALLOW, "policy = %x\n", policy); + + cs.clsid = CLSID_TestActiveX; + cs.pUnk = (IUnknown*)&AXObjectSafety; + cs.dwFlags = 0; + + SET_EXPECT(AXQueryInterface_IActiveScript); + SET_EXPECT(AXQueryInterface_IObjectSafety); + SET_EXPECT(AXGetInterfaceSafetyOptions); + SET_EXPECT(AXSetInterfaceSafetyOptions); + hres = IInternetHostSecurityManager_QueryCustomPolicy(sec_mgr, &GUID_CUSTOM_CONFIRMOBJECTSAFETY, + &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0); + CHECK_CALLED(AXQueryInterface_IActiveScript); + CHECK_CALLED(AXQueryInterface_IObjectSafety); + CHECK_CALLED(AXGetInterfaceSafetyOptions); + CHECK_CALLED(AXSetInterfaceSafetyOptions); + + ok(hres == S_OK, "QueryCusromPolicy failed: %08x\n", hres); + ok(policy_size == sizeof(DWORD), "policy_size = %d\n", policy_size); + ok(*(DWORD*)ppolicy == URLPOLICY_ALLOW, "policy = %x\n", *(DWORD*)ppolicy); + CoTaskMemFree(ppolicy); + + IInternetHostSecurityManager_Release(sec_mgr); +} + static HRESULT WINAPI ActiveScriptProperty_QueryInterface(IActiveScriptProperty *iface, REFIID riid, void **ppv) { *ppv = NULL; @@ -960,6 +1074,8 @@ static HRESULT WINAPI ActiveScriptParse_ParseScriptText(IActiveScriptParse *ifac CHECK_CALLED(GetScriptDispatch); CHECK_CALLED(script_testprop_i); + test_security(); + return S_OK; } @@ -1053,7 +1169,7 @@ static HRESULT WINAPI ActiveScript_SetScriptSite(IActiveScript *iface, IActiveSc ok(hres == E_NOINTERFACE, "Could not get IID_ICanHandleException interface: %08x\n", hres); hres = IActiveScriptSite_QueryInterface(pass, &IID_IServiceProvider, (void**)&service); - todo_wine ok(hres == S_OK, "Could not get IServiceProvider interface: %08x\n", hres); + ok(hres == S_OK, "Could not get IServiceProvider interface: %08x\n", hres); if(SUCCEEDED(hres)) IServiceProvider_Release(service); diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 8f004b39460..46249c20813 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -880,6 +880,9 @@ UINT MSI_InstallPackage( MSIPACKAGE *package, LPCWSTR szPackagePath, /* finish up running custom actions */ ACTION_FinishCustomActions(package); + if (rc == ERROR_SUCCESS && package->need_reboot) + return ERROR_SUCCESS_REBOOT_REQUIRED; + return rc; } diff --git a/dlls/msi/custom.c b/dlls/msi/custom.c index cbbcde5a0ee..5ac9c1b24d3 100644 --- a/dlls/msi/custom.c +++ b/dlls/msi/custom.c @@ -1046,15 +1046,16 @@ static UINT HANDLE_CustomType19(MSIPACKAGE *package, LPCWSTR source, if( row ) { LPCWSTR error = MSI_RecordGetString( row, 1 ); - MessageBoxW( NULL, error, NULL, MB_OK ); + if ((gUILevel & INSTALLUILEVEL_MASK) != INSTALLUILEVEL_NONE) + MessageBoxW( NULL, error, NULL, MB_OK ); msiobj_release( &row->hdr ); } - else + else if ((gUILevel & INSTALLUILEVEL_MASK) != INSTALLUILEVEL_NONE) MessageBoxW( NULL, deformated, NULL, MB_OK ); msi_free( deformated ); - return ERROR_FUNCTION_FAILED; + return ERROR_INSTALL_FAILURE; } static UINT HANDLE_CustomType50(MSIPACKAGE *package, LPCWSTR source, diff --git a/dlls/msi/files.c b/dlls/msi/files.c index 01a80b7437c..d9cc0fffb61 100644 --- a/dlls/msi/files.c +++ b/dlls/msi/files.c @@ -139,7 +139,7 @@ static UINT copy_file(MSIFILE *file, LPWSTR source) return ERROR_SUCCESS; } -static UINT copy_install_file(MSIFILE *file, LPWSTR source) +static UINT copy_install_file(MSIPACKAGE *package, MSIFILE *file, LPWSTR source) { UINT gle; @@ -153,7 +153,7 @@ static UINT copy_install_file(MSIFILE *file, LPWSTR source) if (gle == ERROR_ALREADY_EXISTS && file->state == msifs_overwrite) { TRACE("overwriting existing file\n"); - gle = ERROR_SUCCESS; + return ERROR_SUCCESS; } else if (gle == ERROR_ACCESS_DENIED) { @@ -162,6 +162,39 @@ static UINT copy_install_file(MSIFILE *file, LPWSTR source) gle = copy_file(file, source); TRACE("Overwriting existing file: %d\n", gle); } + if (gle == ERROR_SHARING_VIOLATION) + { + static const WCHAR msiW[] = {'m','s','i',0}; + static const WCHAR slashW[] = {'\\',0}; + WCHAR tmpfileW[MAX_PATH], *pathW, *p; + DWORD len; + + TRACE("file in use, scheduling rename operation\n"); + + GetTempFileNameW(slashW, msiW, 0, tmpfileW); + len = strlenW(file->TargetPath) + strlenW(tmpfileW) + 1; + if (!(pathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + return ERROR_OUTOFMEMORY; + + strcpyW(pathW, file->TargetPath); + if ((p = strrchrW(pathW, '\\'))) *p = 0; + strcatW(pathW, tmpfileW); + + if (CopyFileW(source, pathW, FALSE) && + MoveFileExW(file->TargetPath, NULL, MOVEFILE_DELAY_UNTIL_REBOOT) && + MoveFileExW(pathW, file->TargetPath, MOVEFILE_DELAY_UNTIL_REBOOT)) + { + file->state = msifs_installed; + package->need_reboot = 1; + gle = ERROR_SUCCESS; + } + else + { + gle = GetLastError(); + WARN("failed to schedule rename operation: %d)\n", gle); + } + HeapFree(GetProcessHeap(), 0, pathW); + } return gle; } @@ -296,7 +329,7 @@ UINT ACTION_InstallFiles(MSIPACKAGE *package) debugstr_w(file->TargetPath)); msi_file_update_ui(package, file, szInstallFiles); - rc = copy_install_file(file, source); + rc = copy_install_file(package, file, source); if (rc != ERROR_SUCCESS) { ERR("Failed to copy %s to %s (%d)\n", debugstr_w(source), diff --git a/dlls/msi/media.c b/dlls/msi/media.c index a0baa8c6f94..83f46985ed9 100644 --- a/dlls/msi/media.c +++ b/dlls/msi/media.c @@ -338,15 +338,52 @@ static INT_PTR cabinet_copy_file(FDINOTIFICATIONTYPE fdint, if (handle == INVALID_HANDLE_VALUE) { DWORD err = GetLastError(); - DWORD attrs = GetFileAttributesW(path); + DWORD attrs2 = GetFileAttributesW(path); - if (attrs == INVALID_FILE_ATTRIBUTES) + if (attrs2 == INVALID_FILE_ATTRIBUTES) + { ERR("failed to create %s (error %d)\n", debugstr_w(path), err); - else if (err == ERROR_ACCESS_DENIED && (attrs & FILE_ATTRIBUTE_READONLY)) + goto done; + } + else if (err == ERROR_ACCESS_DENIED && (attrs2 & FILE_ATTRIBUTE_READONLY)) { TRACE("removing read-only attribute on %s\n", debugstr_w(path)); - SetFileAttributesW( path, attrs & ~FILE_ATTRIBUTE_READONLY ); - handle = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, attrs, NULL); + SetFileAttributesW( path, attrs2 & ~FILE_ATTRIBUTE_READONLY ); + handle = CreateFileW(path, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, attrs2, NULL); + + if (handle != INVALID_HANDLE_VALUE) goto done; + err = GetLastError(); + } + if (err == ERROR_SHARING_VIOLATION) + { + static const WCHAR msiW[] = {'m','s','i',0}; + static const WCHAR slashW[] = {'\\',0}; + WCHAR tmpfileW[MAX_PATH], *tmppathW, *p; + DWORD len; + + TRACE("file in use, scheduling rename operation\n"); + + GetTempFileNameW(slashW, msiW, 0, tmpfileW); + len = strlenW(path) + strlenW(tmpfileW) + 1; + if (!(tmppathW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + return ERROR_OUTOFMEMORY; + + strcpyW(tmppathW, path); + if ((p = strrchrW(tmppathW, '\\'))) *p = 0; + strcatW(tmppathW, tmpfileW); + + handle = CreateFileW(tmppathW, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, attrs, NULL); + + if (handle != INVALID_HANDLE_VALUE && + MoveFileExW(path, NULL, MOVEFILE_DELAY_UNTIL_REBOOT) && + MoveFileExW(tmppathW, path, MOVEFILE_DELAY_UNTIL_REBOOT)) + { + data->package->need_reboot = 1; + } + else + WARN("failed to schedule rename operation %s (error %d)\n", debugstr_w(path), GetLastError()); + + HeapFree(GetProcessHeap(), 0, tmppathW); } else WARN("failed to create %s (error %d)\n", debugstr_w(path), err); diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index ba9d8bf6b11..2a66d601a8e 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -693,9 +693,6 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel, if (szCommandLine) lstrcpyW(commandline,szCommandLine); - if (MsiQueryProductStateW(szProduct) != INSTALLSTATE_UNKNOWN) - lstrcatW(commandline,szInstalled); - if (eInstallState == INSTALLSTATE_ABSENT) lstrcatW(commandline, szRemoveAll); diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 23756fae6d2..71c3b69bfa7 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -340,6 +340,7 @@ typedef struct tagMSIPACKAGE unsigned char scheduled_action_running : 1; unsigned char commit_action_running : 1; unsigned char rollback_action_running : 1; + unsigned char need_reboot : 1; } MSIPACKAGE; typedef struct tagMSIPREVIEW diff --git a/dlls/msi/tests/automation.c b/dlls/msi/tests/automation.c index df768ece935..4af37aa8219 100644 --- a/dlls/msi/tests/automation.c +++ b/dlls/msi/tests/automation.c @@ -369,8 +369,8 @@ static int strcmp_ww(const WCHAR* str1, const WCHAR* str2) { CHAR str1A[MAX_PATH], str2A[MAX_PATH]; - WideCharToMultiByte(CP_ACP, 0, str1, -1, str1A, MAX_PATH, NULL, NULL); \ - WideCharToMultiByte(CP_ACP, 0, str2, -1, str2A, MAX_PATH, NULL, NULL); \ + WideCharToMultiByte(CP_ACP, 0, str1, -1, str1A, MAX_PATH, NULL, NULL); + WideCharToMultiByte(CP_ACP, 0, str2, -1, str2A, MAX_PATH, NULL, NULL); return lstrcmpA(str1A, str2A); } diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index 9a33b7919c0..0044e0347b6 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -886,6 +886,32 @@ static const CHAR ai_file_dat[] = "File\tComponent_\tFileName\tFileSize\tVersion "file\tcomponent\tfilename\t100\t\t\t8192\t1\n" "service_file\tservice_comp\tservice.exe\t100\t\t\t8192\t1"; +static const CHAR ip_install_exec_seq_dat[] = "Action\tCondition\tSequence\n" + "s72\tS255\tI2\n" + "InstallExecuteSequence\tAction\n" + "CostFinalize\t\t1000\n" + "ValidateProductID\t\t700\n" + "CostInitialize\t\t800\n" + "FileCost\t\t900\n" + "RemoveFiles\t\t3500\n" + "InstallFiles\t\t4000\n" + "RegisterUser\t\t6000\n" + "RegisterProduct\t\t6100\n" + "PublishFeatures\t\t6300\n" + "PublishProduct\t\t6400\n" + "InstallFinalize\t\t6600\n" + "InstallInitialize\t\t1500\n" + "ProcessComponents\t\t1600\n" + "UnpublishFeatures\t\t1800\n" + "InstallValidate\t\t1400\n" + "LaunchConditions\t\t100\n" + "TestInstalledProp\tInstalled AND NOT REMOVE\t950\n"; + +static const CHAR ip_custom_action_dat[] = "Action\tType\tSource\tTarget\tISComments\n" + "s72\ti2\tS64\tS0\tS255\n" + "CustomAction\tAction\n" + "TestInstalledProp\t19\t\tTest failed\t\n"; + typedef struct _msi_table { const CHAR *filename; @@ -1500,6 +1526,43 @@ static const msi_table pc_tables[] = ADD_TABLE(property) }; +static const msi_table ip_tables[] = +{ + ADD_TABLE(component), + ADD_TABLE(directory), + ADD_TABLE(feature), + ADD_TABLE(feature_comp), + ADD_TABLE(file), + ADD_TABLE(ip_install_exec_seq), + ADD_TABLE(ip_custom_action), + ADD_TABLE(media), + ADD_TABLE(property) +}; + +static const msi_table fiu_tables[] = +{ + ADD_TABLE(rof_component), + ADD_TABLE(directory), + ADD_TABLE(rof_feature), + ADD_TABLE(rof_feature_comp), + ADD_TABLE(rof_file), + ADD_TABLE(pp_install_exec_seq), + ADD_TABLE(rof_media), + ADD_TABLE(property), +}; + +static const msi_table fiuc_tables[] = +{ + ADD_TABLE(rof_component), + ADD_TABLE(directory), + ADD_TABLE(rof_feature), + ADD_TABLE(rof_feature_comp), + ADD_TABLE(rofc_file), + ADD_TABLE(pp_install_exec_seq), + ADD_TABLE(rofc_media), + ADD_TABLE(property), +}; + /* cabinet definitions */ /* make the max size large so there is only one cab file */ @@ -6600,6 +6663,212 @@ static void test_preselected(void) delete_test_files(); } +static void test_installed_prop(void) +{ + static char prodcode[] = "{7df88a48-996f-4ec8-a022-bf956f9b2cbb}"; + UINT r; + + create_test_files(); + create_database(msifile, ip_tables, sizeof(ip_tables) / sizeof(msi_table)); + + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + + r = MsiInstallProductA(msifile, "FULL=1"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + r = MsiInstallProductA(msifile, "FULL=1"); + ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r); + + r = MsiConfigureProductExA(prodcode, INSTALLLEVEL_DEFAULT, INSTALLSTATE_DEFAULT, "FULL=1"); + ok(r == ERROR_INSTALL_FAILURE, "Expected ERROR_INSTALL_FAILURE, got %u\n", r); + + ok(delete_pf("msitest\\cabout\\new\\five.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\cabout\\new", FALSE), "File not installed\n"); + ok(delete_pf("msitest\\cabout\\four.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\cabout", FALSE), "File not installed\n"); + ok(delete_pf("msitest\\changed\\three.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\changed", FALSE), "File not installed\n"); + ok(delete_pf("msitest\\first\\two.txt", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\first", FALSE), "File not installed\n"); + ok(delete_pf("msitest\\filename", TRUE), "File not installed\n"); + ok(delete_pf("msitest\\one.txt", TRUE), "File installed\n"); + ok(delete_pf("msitest\\service.exe", TRUE), "File not installed\n"); + ok(delete_pf("msitest", FALSE), "File not installed\n"); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + delete_test_files(); +} + +static char session_manager[] = "System\\CurrentControlSet\\Control\\Session Manager"; +static char rename_ops[] = "PendingFileRenameOperations"; + +static void process_pending_renames(HKEY hkey) +{ + char *buf, *src, *dst; + DWORD size; + LONG ret; + + ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size); + buf = HeapAlloc(GetProcessHeap(), 0, size); + buf[0] = 0; + + ret = RegQueryValueExA(hkey, rename_ops, NULL, NULL, (LPBYTE)buf, &size); + ok(!ret, "RegQueryValueExA failed %d (%u)\n", ret, GetLastError()); + ok(strstr(buf, "msitest\\maximus") != NULL, "Unexpected value \"%s\"\n", buf); + + for (src = buf; *src; src = dst + strlen(dst) + 1) + { + DWORD flags = MOVEFILE_COPY_ALLOWED; + + dst = src + strlen(src) + 1; + if (*dst == '!') + { + flags |= MOVEFILE_REPLACE_EXISTING; + dst++; + } + if (src[0] == '\\' && src[1] == '?' && src[2] == '?' && src[3] == '\\') src += 4; + if (*dst) + { + if (dst[0] == '\\' && dst[1] == '?' && dst[2] == '?' && dst[3] == '\\') dst += 4; + ok(MoveFileExA(src, dst, flags), "Failed to move file %s -> %s (%u)\n", src, dst, GetLastError()); + } + else + ok(DeleteFileA(src), "Failed to delete file %s (%u)\n", src, GetLastError()); + } + HeapFree(GetProcessHeap(), 0, buf); + RegDeleteValueA(hkey, rename_ops); +} + +static BOOL file_matches_data(LPCSTR file, LPCSTR data) +{ + DWORD len, data_len = strlen(data); + HANDLE handle; + char buf[128]; + + handle = CreateFile(file, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + ok(handle != INVALID_HANDLE_VALUE, "failed to open %s (%u)\n", file, GetLastError()); + + if (ReadFile(handle, buf, sizeof(buf), &len, NULL) && len >= data_len) + { + CloseHandle(handle); + return !memcmp(buf, data, data_len); + } + CloseHandle(handle); + return FALSE; +} + +static void test_file_in_use(void) +{ + UINT r; + DWORD size; + HANDLE file; + HKEY hkey; + char path[MAX_PATH]; + + if (on_win9x) + { + win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n"); + return; + } + + RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey); + if (!RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size)) + { + skip("Pending file rename operations, skipping test\n"); + return; + } + + CreateDirectoryA("msitest", NULL); + create_file("msitest\\maximus", 500); + create_database(msifile, fiu_tables, sizeof(fiu_tables) / sizeof(msi_table)); + + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + + lstrcpy(path, PROG_FILES_DIR); + lstrcat(path, "\\msitest"); + CreateDirectoryA(path, NULL); + + lstrcat(path, "\\maximus"); + file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + + r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1"); + ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r); + ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n"); + CloseHandle(file); + ok(!file_matches_data(path, "msitest\\maximus"), "Expected file not to match\n"); + + process_pending_renames(hkey); + RegCloseKey(hkey); + + ok(file_matches_data(path, "msitest\\maximus"), "Expected file to match\n"); + ok(delete_pf("msitest\\maximus", TRUE), "File not present\n"); + ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n"); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + delete_test_files(); +} + +static void test_file_in_use_cab(void) +{ + UINT r; + DWORD size; + HANDLE file; + HKEY hkey; + char path[MAX_PATH]; + + if (on_win9x) + { + win_skip("Pending file renaming is implemented differently on Win9x and WinMe\n"); + return; + } + + RegOpenKeyExA(HKEY_LOCAL_MACHINE, session_manager, 0, KEY_ALL_ACCESS, &hkey); + if (!RegQueryValueExA(hkey, rename_ops, NULL, NULL, NULL, &size)) + { + skip("Pending file rename operations, skipping test\n"); + return; + } + + CreateDirectoryA("msitest", NULL); + create_file("maximus", 500); + create_cab_file("test1.cab", MEDIA_SIZE, "maximus\0"); + DeleteFile("maximus"); + + create_database(msifile, fiuc_tables, sizeof(fiuc_tables) / sizeof(msi_table)); + + MsiSetInternalUI(INSTALLUILEVEL_NONE, NULL); + + lstrcpy(path, PROG_FILES_DIR); + lstrcat(path, "\\msitest"); + CreateDirectoryA(path, NULL); + + lstrcat(path, "\\maximus"); + file = CreateFileA(path, GENERIC_READ, FILE_SHARE_READ, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + + r = MsiInstallProductA(msifile, "REBOOT=ReallySuppress FULL=1"); + ok(r == ERROR_SUCCESS_REBOOT_REQUIRED, "Expected ERROR_SUCCESS_REBOOT_REQUIRED got %u\n", r); + ok(!file_matches_data(path, "maximus"), "Expected file not to match\n"); + CloseHandle(file); + ok(!file_matches_data(path, "maximus"), "Expected file not to match\n"); + + process_pending_renames(hkey); + RegCloseKey(hkey); + + ok(file_matches_data(path, "maximus"), "Expected file to match\n"); + ok(delete_pf("msitest\\maximus", TRUE), "File not present\n"); + ok(delete_pf("msitest", FALSE), "Directory not present or not empty\n"); + + r = MsiInstallProductA(msifile, "REMOVE=ALL"); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); + + delete_cab_files(); + delete_test_files(); +} + START_TEST(install) { DWORD len; @@ -6685,6 +6954,9 @@ START_TEST(install) test_envvar(); test_lastusedsource(); test_preselected(); + test_installed_prop(); + test_file_in_use(); + test_file_in_use_cab(); DeleteFileA(log_file); diff --git a/dlls/msxml3/attribute.c b/dlls/msxml3/attribute.c index 2fc32be11d0..426fdcbb0e3 100644 --- a/dlls/msxml3/attribute.c +++ b/dlls/msxml3/attribute.c @@ -41,8 +41,7 @@ typedef struct _domattr { const struct IXMLDOMAttributeVtbl *lpVtbl; LONG ref; - IUnknown *node_unk; - IXMLDOMNode *node; + xmlnode *node; } domattr; static inline domattr *impl_from_IXMLDOMAttribute( IXMLDOMAttribute *iface ) @@ -66,7 +65,7 @@ static HRESULT WINAPI domattr_QueryInterface( } else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) { - return IUnknown_QueryInterface(This->node_unk, riid, ppvObject); + *ppvObject = IXMLDOMNode_from_impl(This->node); } else { @@ -74,8 +73,7 @@ static HRESULT WINAPI domattr_QueryInterface( return E_NOINTERFACE; } - IXMLDOMAttribute_AddRef( iface ); - + IXMLDOMText_AddRef((IUnknown*)*ppvObject); return S_OK; } @@ -95,7 +93,7 @@ static ULONG WINAPI domattr_Release( ref = InterlockedDecrement( &This->ref ); if ( ref == 0 ) { - IUnknown_Release( This->node_unk ); + destroy_xmlnode(This->node); HeapFree( GetProcessHeap(), 0, This ); } @@ -183,7 +181,7 @@ static HRESULT WINAPI domattr_get_nodeName( BSTR* p ) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_nodeName( This->node, p ); + return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domattr_get_nodeValue( @@ -191,7 +189,7 @@ static HRESULT WINAPI domattr_get_nodeValue( VARIANT* var1 ) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_nodeValue( This->node, var1 ); + return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domattr_put_nodeValue( @@ -199,7 +197,7 @@ static HRESULT WINAPI domattr_put_nodeValue( VARIANT var1 ) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_put_nodeValue( This->node, var1 ); + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domattr_get_nodeType( @@ -207,7 +205,7 @@ static HRESULT WINAPI domattr_get_nodeType( DOMNodeType* domNodeType ) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_nodeType( This->node, domNodeType ); + return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(This->node), domNodeType ); } static HRESULT WINAPI domattr_get_parentNode( @@ -215,7 +213,7 @@ static HRESULT WINAPI domattr_get_parentNode( IXMLDOMNode** parent ) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_parentNode( This->node, parent ); + return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(This->node), parent ); } static HRESULT WINAPI domattr_get_childNodes( @@ -223,7 +221,7 @@ static HRESULT WINAPI domattr_get_childNodes( IXMLDOMNodeList** outList) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_childNodes( This->node, outList ); + return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(This->node), outList ); } static HRESULT WINAPI domattr_get_firstChild( @@ -231,7 +229,7 @@ static HRESULT WINAPI domattr_get_firstChild( IXMLDOMNode** domNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_firstChild( This->node, domNode ); + return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domattr_get_lastChild( @@ -239,7 +237,7 @@ static HRESULT WINAPI domattr_get_lastChild( IXMLDOMNode** domNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_lastChild( This->node, domNode ); + return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domattr_get_previousSibling( @@ -247,7 +245,7 @@ static HRESULT WINAPI domattr_get_previousSibling( IXMLDOMNode** domNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_previousSibling( This->node, domNode ); + return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domattr_get_nextSibling( @@ -255,7 +253,7 @@ static HRESULT WINAPI domattr_get_nextSibling( IXMLDOMNode** domNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_nextSibling( This->node, domNode ); + return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domattr_get_attributes( @@ -263,7 +261,7 @@ static HRESULT WINAPI domattr_get_attributes( IXMLDOMNamedNodeMap** attributeMap) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_attributes( This->node, attributeMap ); + return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(This->node), attributeMap ); } static HRESULT WINAPI domattr_insertBefore( @@ -272,7 +270,7 @@ static HRESULT WINAPI domattr_insertBefore( IXMLDOMNode** outOldNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode ); + return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(This->node), newNode, var1, outOldNode ); } static HRESULT WINAPI domattr_replaceChild( @@ -282,7 +280,7 @@ static HRESULT WINAPI domattr_replaceChild( IXMLDOMNode** outOldNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode ); + return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(This->node), newNode, oldNode, outOldNode ); } static HRESULT WINAPI domattr_removeChild( @@ -290,7 +288,7 @@ static HRESULT WINAPI domattr_removeChild( IXMLDOMNode* domNode, IXMLDOMNode** oldNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_removeChild( This->node, domNode, oldNode ); + return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(This->node), domNode, oldNode ); } static HRESULT WINAPI domattr_appendChild( @@ -298,7 +296,7 @@ static HRESULT WINAPI domattr_appendChild( IXMLDOMNode* newNode, IXMLDOMNode** outNewNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_appendChild( This->node, newNode, outNewNode ); + return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(This->node), newNode, outNewNode ); } static HRESULT WINAPI domattr_hasChildNodes( @@ -306,7 +304,7 @@ static HRESULT WINAPI domattr_hasChildNodes( VARIANT_BOOL* pbool) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_hasChildNodes( This->node, pbool ); + return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domattr_get_ownerDocument( @@ -314,7 +312,7 @@ static HRESULT WINAPI domattr_get_ownerDocument( IXMLDOMDocument** domDocument) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_ownerDocument( This->node, domDocument ); + return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(This->node), domDocument ); } static HRESULT WINAPI domattr_cloneNode( @@ -322,7 +320,7 @@ static HRESULT WINAPI domattr_cloneNode( VARIANT_BOOL pbool, IXMLDOMNode** outNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_cloneNode( This->node, pbool, outNode ); + return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(This->node), pbool, outNode ); } static HRESULT WINAPI domattr_get_nodeTypeString( @@ -330,7 +328,7 @@ static HRESULT WINAPI domattr_get_nodeTypeString( BSTR* p) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_nodeTypeString( This->node, p ); + return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domattr_get_text( @@ -338,7 +336,7 @@ static HRESULT WINAPI domattr_get_text( BSTR* p) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_text( This->node, p ); + return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domattr_put_text( @@ -346,7 +344,7 @@ static HRESULT WINAPI domattr_put_text( BSTR p) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_put_text( This->node, p ); + return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domattr_get_specified( @@ -354,7 +352,7 @@ static HRESULT WINAPI domattr_get_specified( VARIANT_BOOL* pbool) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_specified( This->node, pbool ); + return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domattr_get_definition( @@ -362,7 +360,7 @@ static HRESULT WINAPI domattr_get_definition( IXMLDOMNode** domNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_definition( This->node, domNode ); + return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domattr_get_nodeTypedValue( @@ -370,7 +368,7 @@ static HRESULT WINAPI domattr_get_nodeTypedValue( VARIANT* var1) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domattr_put_nodeTypedValue( @@ -378,7 +376,7 @@ static HRESULT WINAPI domattr_put_nodeTypedValue( VARIANT var1) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_put_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domattr_get_dataType( @@ -386,7 +384,7 @@ static HRESULT WINAPI domattr_get_dataType( VARIANT* var1) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_dataType( This->node, var1 ); + return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domattr_put_dataType( @@ -394,7 +392,7 @@ static HRESULT WINAPI domattr_put_dataType( BSTR p) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_put_dataType( This->node, p ); + return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domattr_get_xml( @@ -402,7 +400,7 @@ static HRESULT WINAPI domattr_get_xml( BSTR* p) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_xml( This->node, p ); + return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domattr_transformNode( @@ -410,7 +408,7 @@ static HRESULT WINAPI domattr_transformNode( IXMLDOMNode* domNode, BSTR* p) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_transformNode( This->node, domNode, p ); + return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(This->node), domNode, p ); } static HRESULT WINAPI domattr_selectNodes( @@ -418,7 +416,7 @@ static HRESULT WINAPI domattr_selectNodes( BSTR p, IXMLDOMNodeList** outList) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_selectNodes( This->node, p, outList ); + return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(This->node), p, outList ); } static HRESULT WINAPI domattr_selectSingleNode( @@ -426,7 +424,7 @@ static HRESULT WINAPI domattr_selectSingleNode( BSTR p, IXMLDOMNode** outNode) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_selectSingleNode( This->node, p, outNode ); + return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(This->node), p, outNode ); } static HRESULT WINAPI domattr_get_parsed( @@ -434,7 +432,7 @@ static HRESULT WINAPI domattr_get_parsed( VARIANT_BOOL* pbool) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_parsed( This->node, pbool ); + return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domattr_get_namespaceURI( @@ -442,7 +440,7 @@ static HRESULT WINAPI domattr_get_namespaceURI( BSTR* p) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_namespaceURI( This->node, p ); + return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domattr_get_prefix( @@ -450,7 +448,7 @@ static HRESULT WINAPI domattr_get_prefix( BSTR* p) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_prefix( This->node, p ); + return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domattr_get_baseName( @@ -458,7 +456,7 @@ static HRESULT WINAPI domattr_get_baseName( BSTR* p) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_baseName( This->node, p ); + return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domattr_transformNodeToObject( @@ -466,7 +464,7 @@ static HRESULT WINAPI domattr_transformNodeToObject( IXMLDOMNode* domNode, VARIANT var1) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 ); + return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(This->node), domNode, var1 ); } static HRESULT WINAPI domattr_get_name( @@ -475,7 +473,7 @@ static HRESULT WINAPI domattr_get_name( { /* name property returns the same value as nodeName */ domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_nodeName( This->node, p ); + return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domattr_get_value( @@ -483,7 +481,7 @@ static HRESULT WINAPI domattr_get_value( VARIANT *var1) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_nodeValue( This->node, var1 ); + return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domattr_put_value( @@ -491,7 +489,7 @@ static HRESULT WINAPI domattr_put_value( VARIANT var1) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_put_nodeValue( This->node, var1 ); + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static const struct IXMLDOMAttributeVtbl domattr_vtbl = @@ -547,7 +545,6 @@ static const struct IXMLDOMAttributeVtbl domattr_vtbl = IUnknown* create_attribute( xmlNodePtr attribute ) { domattr *This; - xmlnode *node; This = HeapAlloc( GetProcessHeap(), 0, sizeof *This ); if ( !This ) @@ -556,16 +553,13 @@ IUnknown* create_attribute( xmlNodePtr attribute ) This->lpVtbl = &domattr_vtbl; This->ref = 1; - node = create_basic_node( attribute, (IUnknown*)&This->lpVtbl, NULL ); - if(!node) + This->node = create_basic_node( attribute, (IUnknown*)&This->lpVtbl, NULL ); + if(!This->node) { HeapFree(GetProcessHeap(), 0, This); return NULL; } - This->node_unk = (IUnknown*)&node->lpInternalUnkVtbl; - This->node = IXMLDOMNode_from_impl(node); - return (IUnknown*) &This->lpVtbl; } diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c index b0ef3d76595..b4882034b34 100644 --- a/dlls/msxml3/cdata.c +++ b/dlls/msxml3/cdata.c @@ -41,8 +41,7 @@ typedef struct _domcdata { const struct IXMLDOMCDATASectionVtbl *lpVtbl; LONG ref; - IUnknown *node_unk; - IXMLDOMNode *node; + xmlnode *node; } domcdata; static inline domcdata *impl_from_IXMLDOMCDATASection( IXMLDOMCDATASection *iface ) @@ -67,7 +66,7 @@ static HRESULT WINAPI domcdata_QueryInterface( } else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) { - return IUnknown_QueryInterface(This->node_unk, riid, ppvObject); + *ppvObject = IXMLDOMNode_from_impl(This->node); } else if ( IsEqualGUID( riid, &IID_IXMLDOMText ) || IsEqualGUID( riid, &IID_IXMLDOMElement ) ) @@ -81,8 +80,7 @@ static HRESULT WINAPI domcdata_QueryInterface( return E_NOINTERFACE; } - IXMLDOMCDATASection_AddRef( iface ); - + IXMLDOMText_AddRef((IUnknown*)*ppvObject); return S_OK; } @@ -102,7 +100,7 @@ static ULONG WINAPI domcdata_Release( ref = InterlockedDecrement( &This->ref ); if ( ref == 0 ) { - IUnknown_Release( This->node_unk ); + destroy_xmlnode(This->node); HeapFree( GetProcessHeap(), 0, This ); } @@ -191,7 +189,7 @@ static HRESULT WINAPI domcdata_get_nodeName( BSTR* p ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeName( This->node, p ); + return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcdata_get_nodeValue( @@ -199,7 +197,7 @@ static HRESULT WINAPI domcdata_get_nodeValue( VARIANT* var1 ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeValue( This->node, var1 ); + return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domcdata_put_nodeValue( @@ -207,7 +205,7 @@ static HRESULT WINAPI domcdata_put_nodeValue( VARIANT var1 ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_put_nodeValue( This->node, var1 ); + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domcdata_get_nodeType( @@ -215,7 +213,7 @@ static HRESULT WINAPI domcdata_get_nodeType( DOMNodeType* domNodeType ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeType( This->node, domNodeType ); + return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(This->node), domNodeType ); } static HRESULT WINAPI domcdata_get_parentNode( @@ -223,7 +221,7 @@ static HRESULT WINAPI domcdata_get_parentNode( IXMLDOMNode** parent ) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_parentNode( This->node, parent ); + return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(This->node), parent ); } static HRESULT WINAPI domcdata_get_childNodes( @@ -231,7 +229,7 @@ static HRESULT WINAPI domcdata_get_childNodes( IXMLDOMNodeList** outList) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_childNodes( This->node, outList ); + return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(This->node), outList ); } static HRESULT WINAPI domcdata_get_firstChild( @@ -239,7 +237,7 @@ static HRESULT WINAPI domcdata_get_firstChild( IXMLDOMNode** domNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_firstChild( This->node, domNode ); + return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domcdata_get_lastChild( @@ -247,7 +245,7 @@ static HRESULT WINAPI domcdata_get_lastChild( IXMLDOMNode** domNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_lastChild( This->node, domNode ); + return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domcdata_get_previousSibling( @@ -255,7 +253,7 @@ static HRESULT WINAPI domcdata_get_previousSibling( IXMLDOMNode** domNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_previousSibling( This->node, domNode ); + return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domcdata_get_nextSibling( @@ -263,7 +261,7 @@ static HRESULT WINAPI domcdata_get_nextSibling( IXMLDOMNode** domNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nextSibling( This->node, domNode ); + return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domcdata_get_attributes( @@ -271,7 +269,7 @@ static HRESULT WINAPI domcdata_get_attributes( IXMLDOMNamedNodeMap** attributeMap) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_attributes( This->node, attributeMap ); + return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(This->node), attributeMap ); } static HRESULT WINAPI domcdata_insertBefore( @@ -280,7 +278,7 @@ static HRESULT WINAPI domcdata_insertBefore( IXMLDOMNode** outOldNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode ); + return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(This->node), newNode, var1, outOldNode ); } static HRESULT WINAPI domcdata_replaceChild( @@ -290,7 +288,7 @@ static HRESULT WINAPI domcdata_replaceChild( IXMLDOMNode** outOldNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode ); + return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(This->node), newNode, oldNode, outOldNode ); } static HRESULT WINAPI domcdata_removeChild( @@ -298,7 +296,7 @@ static HRESULT WINAPI domcdata_removeChild( IXMLDOMNode* domNode, IXMLDOMNode** oldNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_removeChild( This->node, domNode, oldNode ); + return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(This->node), domNode, oldNode ); } static HRESULT WINAPI domcdata_appendChild( @@ -306,7 +304,7 @@ static HRESULT WINAPI domcdata_appendChild( IXMLDOMNode* newNode, IXMLDOMNode** outNewNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_appendChild( This->node, newNode, outNewNode ); + return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(This->node), newNode, outNewNode ); } static HRESULT WINAPI domcdata_hasChildNodes( @@ -314,7 +312,7 @@ static HRESULT WINAPI domcdata_hasChildNodes( VARIANT_BOOL* pbool) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_hasChildNodes( This->node, pbool ); + return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domcdata_get_ownerDocument( @@ -322,7 +320,7 @@ static HRESULT WINAPI domcdata_get_ownerDocument( IXMLDOMDocument** domDocument) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_ownerDocument( This->node, domDocument ); + return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(This->node), domDocument ); } static HRESULT WINAPI domcdata_cloneNode( @@ -330,7 +328,7 @@ static HRESULT WINAPI domcdata_cloneNode( VARIANT_BOOL pbool, IXMLDOMNode** outNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_cloneNode( This->node, pbool, outNode ); + return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(This->node), pbool, outNode ); } static HRESULT WINAPI domcdata_get_nodeTypeString( @@ -338,7 +336,7 @@ static HRESULT WINAPI domcdata_get_nodeTypeString( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeTypeString( This->node, p ); + return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcdata_get_text( @@ -346,7 +344,7 @@ static HRESULT WINAPI domcdata_get_text( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_text( This->node, p ); + return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcdata_put_text( @@ -354,7 +352,7 @@ static HRESULT WINAPI domcdata_put_text( BSTR p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_put_text( This->node, p ); + return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcdata_get_specified( @@ -362,7 +360,7 @@ static HRESULT WINAPI domcdata_get_specified( VARIANT_BOOL* pbool) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_specified( This->node, pbool ); + return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domcdata_get_definition( @@ -370,7 +368,7 @@ static HRESULT WINAPI domcdata_get_definition( IXMLDOMNode** domNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_definition( This->node, domNode ); + return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domcdata_get_nodeTypedValue( @@ -378,7 +376,7 @@ static HRESULT WINAPI domcdata_get_nodeTypedValue( VARIANT* var1) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domcdata_put_nodeTypedValue( @@ -386,7 +384,7 @@ static HRESULT WINAPI domcdata_put_nodeTypedValue( VARIANT var1) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_put_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domcdata_get_dataType( @@ -394,7 +392,7 @@ static HRESULT WINAPI domcdata_get_dataType( VARIANT* var1) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_dataType( This->node, var1 ); + return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domcdata_put_dataType( @@ -402,7 +400,7 @@ static HRESULT WINAPI domcdata_put_dataType( BSTR p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_put_dataType( This->node, p ); + return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcdata_get_xml( @@ -410,7 +408,7 @@ static HRESULT WINAPI domcdata_get_xml( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_xml( This->node, p ); + return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcdata_transformNode( @@ -418,7 +416,7 @@ static HRESULT WINAPI domcdata_transformNode( IXMLDOMNode* domNode, BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_transformNode( This->node, domNode, p ); + return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(This->node), domNode, p ); } static HRESULT WINAPI domcdata_selectNodes( @@ -426,7 +424,7 @@ static HRESULT WINAPI domcdata_selectNodes( BSTR p, IXMLDOMNodeList** outList) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_selectNodes( This->node, p, outList ); + return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(This->node), p, outList ); } static HRESULT WINAPI domcdata_selectSingleNode( @@ -434,7 +432,7 @@ static HRESULT WINAPI domcdata_selectSingleNode( BSTR p, IXMLDOMNode** outNode) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_selectSingleNode( This->node, p, outNode ); + return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(This->node), p, outNode ); } static HRESULT WINAPI domcdata_get_parsed( @@ -442,7 +440,7 @@ static HRESULT WINAPI domcdata_get_parsed( VARIANT_BOOL* pbool) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_parsed( This->node, pbool ); + return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domcdata_get_namespaceURI( @@ -450,7 +448,7 @@ static HRESULT WINAPI domcdata_get_namespaceURI( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_namespaceURI( This->node, p ); + return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcdata_get_prefix( @@ -458,7 +456,7 @@ static HRESULT WINAPI domcdata_get_prefix( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_prefix( This->node, p ); + return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcdata_get_baseName( @@ -466,7 +464,7 @@ static HRESULT WINAPI domcdata_get_baseName( BSTR* p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_baseName( This->node, p ); + return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcdata_transformNodeToObject( @@ -474,7 +472,7 @@ static HRESULT WINAPI domcdata_transformNodeToObject( IXMLDOMNode* domNode, VARIANT var1) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 ); + return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(This->node), domNode, var1 ); } static HRESULT WINAPI domcdata_get_data( @@ -488,7 +486,7 @@ static HRESULT WINAPI domcdata_get_data( if(!p) return E_INVALIDARG; - hr = IXMLDOMNode_get_nodeValue( This->node, &vRet ); + hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); @@ -510,7 +508,7 @@ static HRESULT WINAPI domcdata_put_data( V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; - hr = IXMLDOMNode_put_nodeValue( This->node, val ); + hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), val ); return hr; } @@ -520,7 +518,6 @@ static HRESULT WINAPI domcdata_get_length( LONG *len) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pContent; LONG nLength = 0; @@ -529,7 +526,7 @@ static HRESULT WINAPI domcdata_get_length( if(!len) return E_INVALIDARG; - pContent = xmlNodeGetContent(pDOMNode->node); + pContent = xmlNodeGetContent(This->node->node); if(pContent) { nLength = xmlStrlen(pContent); @@ -546,7 +543,6 @@ static HRESULT WINAPI domcdata_substringData( LONG offset, LONG count, BSTR *p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pContent; LONG nLength = 0; HRESULT hr = S_FALSE; @@ -563,7 +559,7 @@ static HRESULT WINAPI domcdata_substringData( if(count == 0) return hr; - pContent = xmlNodeGetContent(pDOMNode->node); + pContent = xmlNodeGetContent(This->node->node); if(pContent) { nLength = xmlStrlen(pContent); @@ -591,7 +587,6 @@ static HRESULT WINAPI domcdata_appendData( BSTR p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pContent; HRESULT hr = S_FALSE; @@ -604,7 +599,7 @@ static HRESULT WINAPI domcdata_appendData( pContent = xmlChar_from_wchar( p ); if(pContent) { - if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0) + if(xmlTextConcat(This->node->node, pContent, SysStringLen(p) ) == 0) hr = S_OK; else hr = E_FAIL; @@ -621,7 +616,6 @@ static HRESULT WINAPI domcdata_insertData( LONG offset, BSTR p) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pXmlContent; BSTR sNewString; HRESULT hr = S_FALSE; @@ -639,7 +633,7 @@ static HRESULT WINAPI domcdata_insertData( return E_INVALIDARG; } - pXmlContent = xmlNodeGetContent(pDOMNode->node); + pXmlContent = xmlNodeGetContent(This->node->node); if(pXmlContent) { BSTR sContent = bstr_from_xmlChar( pXmlContent ); @@ -670,7 +664,7 @@ static HRESULT WINAPI domcdata_insertData( str = xmlChar_from_wchar(sNewString); if(str) { - xmlNodeSetContent(pDOMNode->node, str); + xmlNodeSetContent(This->node->node, str); hr = S_OK; } HeapFree(GetProcessHeap(), 0, str); @@ -770,7 +764,6 @@ static const struct IXMLDOMCDATASectionVtbl domcdata_vtbl = IUnknown* create_cdata( xmlNodePtr text ) { domcdata *This; - xmlnode *node; This = HeapAlloc( GetProcessHeap(), 0, sizeof *This ); if ( !This ) @@ -779,16 +772,13 @@ IUnknown* create_cdata( xmlNodePtr text ) This->lpVtbl = &domcdata_vtbl; This->ref = 1; - node = create_basic_node( text, (IUnknown*)&This->lpVtbl, NULL ); - if(!node) + This->node = create_basic_node( text, (IUnknown*)&This->lpVtbl, NULL ); + if(!This->node) { HeapFree(GetProcessHeap(), 0, This); return NULL; } - This->node_unk = (IUnknown*)&node->lpInternalUnkVtbl; - This->node = IXMLDOMNode_from_impl(node); - return (IUnknown*) &This->lpVtbl; } diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c index 346ad192730..86712f3978e 100644 --- a/dlls/msxml3/comment.c +++ b/dlls/msxml3/comment.c @@ -41,8 +41,7 @@ typedef struct _domcomment { const struct IXMLDOMCommentVtbl *lpVtbl; LONG ref; - IUnknown *node_unk; - IXMLDOMNode *node; + xmlnode *node; } domcomment; static inline domcomment *impl_from_IXMLDOMComment( IXMLDOMComment *iface ) @@ -67,7 +66,7 @@ static HRESULT WINAPI domcomment_QueryInterface( } else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) { - return IUnknown_QueryInterface(This->node_unk, riid, ppvObject); + *ppvObject = IXMLDOMNode_from_impl(This->node); } else { @@ -75,8 +74,7 @@ static HRESULT WINAPI domcomment_QueryInterface( return E_NOINTERFACE; } - IXMLDOMComment_AddRef( iface ); - + IXMLDOMText_AddRef((IUnknown*)*ppvObject); return S_OK; } @@ -96,7 +94,7 @@ static ULONG WINAPI domcomment_Release( ref = InterlockedDecrement( &This->ref ); if ( ref == 0 ) { - IUnknown_Release( This->node_unk ); + destroy_xmlnode(This->node); HeapFree( GetProcessHeap(), 0, This ); } @@ -185,7 +183,7 @@ static HRESULT WINAPI domcomment_get_nodeName( BSTR* p ) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_nodeName( This->node, p ); + return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcomment_get_nodeValue( @@ -193,7 +191,7 @@ static HRESULT WINAPI domcomment_get_nodeValue( VARIANT* var1 ) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_nodeValue( This->node, var1 ); + return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domcomment_put_nodeValue( @@ -201,7 +199,7 @@ static HRESULT WINAPI domcomment_put_nodeValue( VARIANT var1 ) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_put_nodeValue( This->node, var1 ); + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domcomment_get_nodeType( @@ -209,7 +207,7 @@ static HRESULT WINAPI domcomment_get_nodeType( DOMNodeType* domNodeType ) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_nodeType( This->node, domNodeType ); + return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(This->node), domNodeType ); } static HRESULT WINAPI domcomment_get_parentNode( @@ -217,7 +215,7 @@ static HRESULT WINAPI domcomment_get_parentNode( IXMLDOMNode** parent ) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_parentNode( This->node, parent ); + return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(This->node), parent ); } static HRESULT WINAPI domcomment_get_childNodes( @@ -225,7 +223,7 @@ static HRESULT WINAPI domcomment_get_childNodes( IXMLDOMNodeList** outList) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_childNodes( This->node, outList ); + return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(This->node), outList ); } static HRESULT WINAPI domcomment_get_firstChild( @@ -233,7 +231,7 @@ static HRESULT WINAPI domcomment_get_firstChild( IXMLDOMNode** domNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_firstChild( This->node, domNode ); + return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domcomment_get_lastChild( @@ -241,7 +239,7 @@ static HRESULT WINAPI domcomment_get_lastChild( IXMLDOMNode** domNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_lastChild( This->node, domNode ); + return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domcomment_get_previousSibling( @@ -249,7 +247,7 @@ static HRESULT WINAPI domcomment_get_previousSibling( IXMLDOMNode** domNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_previousSibling( This->node, domNode ); + return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domcomment_get_nextSibling( @@ -257,7 +255,7 @@ static HRESULT WINAPI domcomment_get_nextSibling( IXMLDOMNode** domNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_nextSibling( This->node, domNode ); + return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domcomment_get_attributes( @@ -265,7 +263,7 @@ static HRESULT WINAPI domcomment_get_attributes( IXMLDOMNamedNodeMap** attributeMap) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_attributes( This->node, attributeMap ); + return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(This->node), attributeMap ); } static HRESULT WINAPI domcomment_insertBefore( @@ -274,7 +272,7 @@ static HRESULT WINAPI domcomment_insertBefore( IXMLDOMNode** outOldNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode ); + return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(This->node), newNode, var1, outOldNode ); } static HRESULT WINAPI domcomment_replaceChild( @@ -284,7 +282,7 @@ static HRESULT WINAPI domcomment_replaceChild( IXMLDOMNode** outOldNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode ); + return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(This->node), newNode, oldNode, outOldNode ); } static HRESULT WINAPI domcomment_removeChild( @@ -292,7 +290,7 @@ static HRESULT WINAPI domcomment_removeChild( IXMLDOMNode* domNode, IXMLDOMNode** oldNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_removeChild( This->node, domNode, oldNode ); + return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(This->node), domNode, oldNode ); } static HRESULT WINAPI domcomment_appendChild( @@ -300,7 +298,7 @@ static HRESULT WINAPI domcomment_appendChild( IXMLDOMNode* newNode, IXMLDOMNode** outNewNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_appendChild( This->node, newNode, outNewNode ); + return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(This->node), newNode, outNewNode ); } static HRESULT WINAPI domcomment_hasChildNodes( @@ -308,7 +306,7 @@ static HRESULT WINAPI domcomment_hasChildNodes( VARIANT_BOOL* pbool) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_hasChildNodes( This->node, pbool ); + return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domcomment_get_ownerDocument( @@ -316,7 +314,7 @@ static HRESULT WINAPI domcomment_get_ownerDocument( IXMLDOMDocument** domDocument) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_ownerDocument( This->node, domDocument ); + return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(This->node), domDocument ); } static HRESULT WINAPI domcomment_cloneNode( @@ -324,7 +322,7 @@ static HRESULT WINAPI domcomment_cloneNode( VARIANT_BOOL pbool, IXMLDOMNode** outNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_cloneNode( This->node, pbool, outNode ); + return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(This->node), pbool, outNode ); } static HRESULT WINAPI domcomment_get_nodeTypeString( @@ -332,7 +330,7 @@ static HRESULT WINAPI domcomment_get_nodeTypeString( BSTR* p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_nodeTypeString( This->node, p ); + return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcomment_get_text( @@ -340,7 +338,7 @@ static HRESULT WINAPI domcomment_get_text( BSTR* p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_text( This->node, p ); + return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcomment_put_text( @@ -348,7 +346,7 @@ static HRESULT WINAPI domcomment_put_text( BSTR p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_put_text( This->node, p ); + return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcomment_get_specified( @@ -356,7 +354,7 @@ static HRESULT WINAPI domcomment_get_specified( VARIANT_BOOL* pbool) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_specified( This->node, pbool ); + return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domcomment_get_definition( @@ -364,7 +362,7 @@ static HRESULT WINAPI domcomment_get_definition( IXMLDOMNode** domNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_definition( This->node, domNode ); + return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domcomment_get_nodeTypedValue( @@ -372,7 +370,7 @@ static HRESULT WINAPI domcomment_get_nodeTypedValue( VARIANT* var1) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domcomment_put_nodeTypedValue( @@ -380,7 +378,7 @@ static HRESULT WINAPI domcomment_put_nodeTypedValue( VARIANT var1) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_put_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domcomment_get_dataType( @@ -388,7 +386,7 @@ static HRESULT WINAPI domcomment_get_dataType( VARIANT* var1) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_dataType( This->node, var1 ); + return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domcomment_put_dataType( @@ -396,7 +394,7 @@ static HRESULT WINAPI domcomment_put_dataType( BSTR p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_put_dataType( This->node, p ); + return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcomment_get_xml( @@ -404,7 +402,7 @@ static HRESULT WINAPI domcomment_get_xml( BSTR* p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_xml( This->node, p ); + return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcomment_transformNode( @@ -412,7 +410,7 @@ static HRESULT WINAPI domcomment_transformNode( IXMLDOMNode* domNode, BSTR* p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_transformNode( This->node, domNode, p ); + return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(This->node), domNode, p ); } static HRESULT WINAPI domcomment_selectNodes( @@ -420,7 +418,7 @@ static HRESULT WINAPI domcomment_selectNodes( BSTR p, IXMLDOMNodeList** outList) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_selectNodes( This->node, p, outList ); + return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(This->node), p, outList ); } static HRESULT WINAPI domcomment_selectSingleNode( @@ -428,7 +426,7 @@ static HRESULT WINAPI domcomment_selectSingleNode( BSTR p, IXMLDOMNode** outNode) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_selectSingleNode( This->node, p, outNode ); + return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(This->node), p, outNode ); } static HRESULT WINAPI domcomment_get_parsed( @@ -436,7 +434,7 @@ static HRESULT WINAPI domcomment_get_parsed( VARIANT_BOOL* pbool) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_parsed( This->node, pbool ); + return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domcomment_get_namespaceURI( @@ -444,7 +442,7 @@ static HRESULT WINAPI domcomment_get_namespaceURI( BSTR* p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_namespaceURI( This->node, p ); + return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcomment_get_prefix( @@ -452,7 +450,7 @@ static HRESULT WINAPI domcomment_get_prefix( BSTR* p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_prefix( This->node, p ); + return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcomment_get_baseName( @@ -460,7 +458,7 @@ static HRESULT WINAPI domcomment_get_baseName( BSTR* p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_baseName( This->node, p ); + return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domcomment_transformNodeToObject( @@ -468,7 +466,7 @@ static HRESULT WINAPI domcomment_transformNodeToObject( IXMLDOMNode* domNode, VARIANT var1) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 ); + return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(This->node), domNode, var1 ); } static HRESULT WINAPI domcomment_get_data( @@ -482,7 +480,7 @@ static HRESULT WINAPI domcomment_get_data( if(!p) return E_INVALIDARG; - hr = IXMLDOMNode_get_nodeValue( This->node, &vRet ); + hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); @@ -504,7 +502,7 @@ static HRESULT WINAPI domcomment_put_data( V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; - hr = IXMLDOMNode_put_nodeValue( This->node, val ); + hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), val ); return hr; } @@ -514,7 +512,6 @@ static HRESULT WINAPI domcomment_get_length( LONG *len) { domcomment *This = impl_from_IXMLDOMComment( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pContent; LONG nLength = 0; @@ -523,7 +520,7 @@ static HRESULT WINAPI domcomment_get_length( if(!len) return E_INVALIDARG; - pContent = xmlNodeGetContent(pDOMNode->node); + pContent = xmlNodeGetContent(This->node->node); if(pContent) { nLength = xmlStrlen(pContent); @@ -540,7 +537,6 @@ static HRESULT WINAPI domcomment_substringData( LONG offset, LONG count, BSTR *p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pContent; LONG nLength = 0; HRESULT hr = S_FALSE; @@ -557,7 +553,7 @@ static HRESULT WINAPI domcomment_substringData( if(count == 0) return hr; - pContent = xmlNodeGetContent(pDOMNode->node); + pContent = xmlNodeGetContent(This->node->node); if(pContent) { nLength = xmlStrlen(pContent); @@ -585,7 +581,6 @@ static HRESULT WINAPI domcomment_appendData( BSTR p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pContent; HRESULT hr = S_FALSE; @@ -602,15 +597,15 @@ static HRESULT WINAPI domcomment_appendData( xmlTextConcat on Comment nodes. Fallback to setting the contents directly if xmlTextConcat fails. */ - if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0) + if(xmlTextConcat(This->node->node, pContent, SysStringLen(p) ) == 0) hr = S_OK; else { xmlChar *pNew; - pNew = xmlStrcat(xmlNodeGetContent(pDOMNode->node), pContent); + pNew = xmlStrcat(xmlNodeGetContent(This->node->node), pContent); if(pNew) { - xmlNodeSetContent(pDOMNode->node, pNew); + xmlNodeSetContent(This->node->node, pNew); hr = S_OK; } else @@ -629,7 +624,6 @@ static HRESULT WINAPI domcomment_insertData( LONG offset, BSTR p) { domcomment *This = impl_from_IXMLDOMComment( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pXmlContent; BSTR sNewString; HRESULT hr = S_FALSE; @@ -647,7 +641,7 @@ static HRESULT WINAPI domcomment_insertData( return E_INVALIDARG; } - pXmlContent = xmlNodeGetContent(pDOMNode->node); + pXmlContent = xmlNodeGetContent(This->node->node); if(pXmlContent) { BSTR sContent = bstr_from_xmlChar( pXmlContent ); @@ -678,7 +672,7 @@ static HRESULT WINAPI domcomment_insertData( str = xmlChar_from_wchar(sNewString); if(str) { - xmlNodeSetContent(pDOMNode->node, str); + xmlNodeSetContent(This->node->node, str); hr = S_OK; } HeapFree( GetProcessHeap(), 0, str ); @@ -768,7 +762,6 @@ static const struct IXMLDOMCommentVtbl domcomment_vtbl = IUnknown* create_comment( xmlNodePtr comment ) { domcomment *This; - xmlnode *node; This = HeapAlloc( GetProcessHeap(), 0, sizeof *This ); if ( !This ) @@ -777,16 +770,13 @@ IUnknown* create_comment( xmlNodePtr comment ) This->lpVtbl = &domcomment_vtbl; This->ref = 1; - node = create_basic_node( comment, (IUnknown*)&This->lpVtbl, NULL ); - if(!node) + This->node = create_basic_node( comment, (IUnknown*)&This->lpVtbl, NULL ); + if(!This->node) { HeapFree(GetProcessHeap(), 0, This); return NULL; } - This->node_unk = (IUnknown*)&node->lpInternalUnkVtbl; - This->node = IXMLDOMNode_from_impl(node); - return (IUnknown*) &This->lpVtbl; } diff --git a/dlls/msxml3/docfrag.c b/dlls/msxml3/docfrag.c index 1330c196ba0..10a35b34d8f 100644 --- a/dlls/msxml3/docfrag.c +++ b/dlls/msxml3/docfrag.c @@ -41,8 +41,7 @@ typedef struct _domfrag { const struct IXMLDOMDocumentFragmentVtbl *lpVtbl; LONG ref; - IUnknown *node_unk; - IXMLDOMNode *node; + xmlnode *node; } domfrag; static inline domfrag *impl_from_IXMLDOMDocumentFragment( IXMLDOMDocumentFragment *iface ) @@ -66,7 +65,7 @@ static HRESULT WINAPI domfrag_QueryInterface( } else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) { - return IUnknown_QueryInterface(This->node_unk, riid, ppvObject); + *ppvObject = IXMLDOMNode_from_impl(This->node); } else { @@ -74,8 +73,7 @@ static HRESULT WINAPI domfrag_QueryInterface( return E_NOINTERFACE; } - IXMLDOMDocumentFragment_AddRef( iface ); - + IXMLDOMText_AddRef((IUnknown*)*ppvObject); return S_OK; } @@ -95,7 +93,7 @@ static ULONG WINAPI domfrag_Release( ref = InterlockedDecrement( &This->ref ); if ( ref == 0 ) { - IUnknown_Release( This->node_unk ); + destroy_xmlnode(This->node); HeapFree( GetProcessHeap(), 0, This ); } @@ -184,7 +182,7 @@ static HRESULT WINAPI domfrag_get_nodeName( BSTR* p ) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_nodeName( This->node, p ); + return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domfrag_get_nodeValue( @@ -192,7 +190,7 @@ static HRESULT WINAPI domfrag_get_nodeValue( VARIANT* var1 ) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_nodeValue( This->node, var1 ); + return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domfrag_put_nodeValue( @@ -200,7 +198,7 @@ static HRESULT WINAPI domfrag_put_nodeValue( VARIANT var1 ) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_put_nodeValue( This->node, var1 ); + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domfrag_get_nodeType( @@ -208,7 +206,7 @@ static HRESULT WINAPI domfrag_get_nodeType( DOMNodeType* domNodeType ) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_nodeType( This->node, domNodeType ); + return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(This->node), domNodeType ); } static HRESULT WINAPI domfrag_get_parentNode( @@ -216,7 +214,7 @@ static HRESULT WINAPI domfrag_get_parentNode( IXMLDOMNode** parent ) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_parentNode( This->node, parent ); + return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(This->node), parent ); } static HRESULT WINAPI domfrag_get_childNodes( @@ -224,7 +222,7 @@ static HRESULT WINAPI domfrag_get_childNodes( IXMLDOMNodeList** outList) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_childNodes( This->node, outList ); + return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(This->node), outList ); } static HRESULT WINAPI domfrag_get_firstChild( @@ -232,7 +230,7 @@ static HRESULT WINAPI domfrag_get_firstChild( IXMLDOMNode** domNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_firstChild( This->node, domNode ); + return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domfrag_get_lastChild( @@ -240,7 +238,7 @@ static HRESULT WINAPI domfrag_get_lastChild( IXMLDOMNode** domNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_lastChild( This->node, domNode ); + return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domfrag_get_previousSibling( @@ -248,7 +246,7 @@ static HRESULT WINAPI domfrag_get_previousSibling( IXMLDOMNode** domNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_previousSibling( This->node, domNode ); + return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domfrag_get_nextSibling( @@ -256,7 +254,7 @@ static HRESULT WINAPI domfrag_get_nextSibling( IXMLDOMNode** domNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_nextSibling( This->node, domNode ); + return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domfrag_get_attributes( @@ -264,7 +262,7 @@ static HRESULT WINAPI domfrag_get_attributes( IXMLDOMNamedNodeMap** attributeMap) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_attributes( This->node, attributeMap ); + return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(This->node), attributeMap ); } static HRESULT WINAPI domfrag_insertBefore( @@ -273,7 +271,7 @@ static HRESULT WINAPI domfrag_insertBefore( IXMLDOMNode** outOldNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode ); + return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(This->node), newNode, var1, outOldNode ); } static HRESULT WINAPI domfrag_replaceChild( @@ -283,7 +281,7 @@ static HRESULT WINAPI domfrag_replaceChild( IXMLDOMNode** outOldNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode ); + return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(This->node), newNode, oldNode, outOldNode ); } static HRESULT WINAPI domfrag_removeChild( @@ -291,7 +289,7 @@ static HRESULT WINAPI domfrag_removeChild( IXMLDOMNode* domNode, IXMLDOMNode** oldNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_removeChild( This->node, domNode, oldNode ); + return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(This->node), domNode, oldNode ); } static HRESULT WINAPI domfrag_appendChild( @@ -299,7 +297,7 @@ static HRESULT WINAPI domfrag_appendChild( IXMLDOMNode* newNode, IXMLDOMNode** outNewNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_appendChild( This->node, newNode, outNewNode ); + return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(This->node), newNode, outNewNode ); } static HRESULT WINAPI domfrag_hasChildNodes( @@ -307,7 +305,7 @@ static HRESULT WINAPI domfrag_hasChildNodes( VARIANT_BOOL* pbool) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_hasChildNodes( This->node, pbool ); + return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domfrag_get_ownerDocument( @@ -315,7 +313,7 @@ static HRESULT WINAPI domfrag_get_ownerDocument( IXMLDOMDocument** domDocument) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_ownerDocument( This->node, domDocument ); + return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(This->node), domDocument ); } static HRESULT WINAPI domfrag_cloneNode( @@ -323,7 +321,7 @@ static HRESULT WINAPI domfrag_cloneNode( VARIANT_BOOL pbool, IXMLDOMNode** outNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_cloneNode( This->node, pbool, outNode ); + return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(This->node), pbool, outNode ); } static HRESULT WINAPI domfrag_get_nodeTypeString( @@ -331,7 +329,7 @@ static HRESULT WINAPI domfrag_get_nodeTypeString( BSTR* p) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_nodeTypeString( This->node, p ); + return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domfrag_get_text( @@ -339,7 +337,7 @@ static HRESULT WINAPI domfrag_get_text( BSTR* p) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_text( This->node, p ); + return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domfrag_put_text( @@ -347,7 +345,7 @@ static HRESULT WINAPI domfrag_put_text( BSTR p) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_put_text( This->node, p ); + return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domfrag_get_specified( @@ -355,7 +353,7 @@ static HRESULT WINAPI domfrag_get_specified( VARIANT_BOOL* pbool) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_specified( This->node, pbool ); + return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domfrag_get_definition( @@ -363,7 +361,7 @@ static HRESULT WINAPI domfrag_get_definition( IXMLDOMNode** domNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_definition( This->node, domNode ); + return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domfrag_get_nodeTypedValue( @@ -371,7 +369,7 @@ static HRESULT WINAPI domfrag_get_nodeTypedValue( VARIANT* var1) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domfrag_put_nodeTypedValue( @@ -379,7 +377,7 @@ static HRESULT WINAPI domfrag_put_nodeTypedValue( VARIANT var1) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_put_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domfrag_get_dataType( @@ -387,7 +385,7 @@ static HRESULT WINAPI domfrag_get_dataType( VARIANT* var1) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_dataType( This->node, var1 ); + return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domfrag_put_dataType( @@ -395,7 +393,7 @@ static HRESULT WINAPI domfrag_put_dataType( BSTR p) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_put_dataType( This->node, p ); + return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domfrag_get_xml( @@ -403,7 +401,7 @@ static HRESULT WINAPI domfrag_get_xml( BSTR* p) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_xml( This->node, p ); + return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domfrag_transformNode( @@ -411,7 +409,7 @@ static HRESULT WINAPI domfrag_transformNode( IXMLDOMNode* domNode, BSTR* p) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_transformNode( This->node, domNode, p ); + return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(This->node), domNode, p ); } static HRESULT WINAPI domfrag_selectNodes( @@ -419,7 +417,7 @@ static HRESULT WINAPI domfrag_selectNodes( BSTR p, IXMLDOMNodeList** outList) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_selectNodes( This->node, p, outList ); + return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(This->node), p, outList ); } static HRESULT WINAPI domfrag_selectSingleNode( @@ -427,7 +425,7 @@ static HRESULT WINAPI domfrag_selectSingleNode( BSTR p, IXMLDOMNode** outNode) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_selectSingleNode( This->node, p, outNode ); + return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(This->node), p, outNode ); } static HRESULT WINAPI domfrag_get_parsed( @@ -435,7 +433,7 @@ static HRESULT WINAPI domfrag_get_parsed( VARIANT_BOOL* pbool) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_parsed( This->node, pbool ); + return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domfrag_get_namespaceURI( @@ -443,7 +441,7 @@ static HRESULT WINAPI domfrag_get_namespaceURI( BSTR* p) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_namespaceURI( This->node, p ); + return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domfrag_get_prefix( @@ -451,7 +449,7 @@ static HRESULT WINAPI domfrag_get_prefix( BSTR* p) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_prefix( This->node, p ); + return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domfrag_get_baseName( @@ -459,7 +457,7 @@ static HRESULT WINAPI domfrag_get_baseName( BSTR* p) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_baseName( This->node, p ); + return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domfrag_transformNodeToObject( @@ -467,7 +465,7 @@ static HRESULT WINAPI domfrag_transformNodeToObject( IXMLDOMNode* domNode, VARIANT var1) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 ); + return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(This->node), domNode, var1 ); } static const struct IXMLDOMDocumentFragmentVtbl domfrag_vtbl = @@ -520,7 +518,6 @@ static const struct IXMLDOMDocumentFragmentVtbl domfrag_vtbl = IUnknown* create_doc_fragment( xmlNodePtr fragment ) { domfrag *This; - xmlnode *node; This = HeapAlloc( GetProcessHeap(), 0, sizeof *This ); if ( !This ) @@ -529,16 +526,13 @@ IUnknown* create_doc_fragment( xmlNodePtr fragment ) This->lpVtbl = &domfrag_vtbl; This->ref = 1; - node = create_basic_node( fragment, (IUnknown*)&This->lpVtbl, NULL ); - if(!node) + This->node = create_basic_node( fragment, (IUnknown*)&This->lpVtbl, NULL ); + if(!This->node) { HeapFree(GetProcessHeap(), 0, This); return NULL; } - This->node_unk = (IUnknown*)&node->lpInternalUnkVtbl; - This->node = IXMLDOMNode_from_impl(node); - return (IUnknown*) &This->lpVtbl; } diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index ad0fe0a49bc..b6bc189c481 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -509,7 +509,7 @@ static ULONG WINAPI domdoc_Release( if (This->site) IUnknown_Release( This->site ); - IXMLDOMNode_Release(IXMLDOMNode_from_impl(This->node)); + destroy_xmlnode(This->node); if(This->schema) IXMLDOMSchemaCollection_Release( This->schema ); if (This->stream) IStream_Release(This->stream); HeapFree( GetProcessHeap(), 0, This ); diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c index 531d43eea26..accd0edfef5 100644 --- a/dlls/msxml3/element.c +++ b/dlls/msxml3/element.c @@ -108,7 +108,7 @@ static ULONG WINAPI domelem_Release( TRACE("(%p) ref=%d\n", This, ref); if(!ref) { - IXMLDOMNode_Release(IXMLDOMNode_from_impl(This->node)); + destroy_xmlnode(This->node); heap_free(This); } diff --git a/dlls/msxml3/entityref.c b/dlls/msxml3/entityref.c index 102bf44533b..820edc72e57 100644 --- a/dlls/msxml3/entityref.c +++ b/dlls/msxml3/entityref.c @@ -41,8 +41,7 @@ typedef struct _entityref { const struct IXMLDOMEntityReferenceVtbl *lpVtbl; LONG ref; - IUnknown *node_unk; - IXMLDOMNode *node; + xmlnode *node; } entityref; static inline entityref *impl_from_IXMLDOMEntityReference( IXMLDOMEntityReference *iface ) @@ -66,7 +65,7 @@ static HRESULT WINAPI entityref_QueryInterface( } else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) { - return IUnknown_QueryInterface(This->node_unk, riid, ppvObject); + *ppvObject = IXMLDOMNode_from_impl(This->node); } else { @@ -74,8 +73,7 @@ static HRESULT WINAPI entityref_QueryInterface( return E_NOINTERFACE; } - IXMLDOMEntityReference_AddRef( iface ); - + IUnknown_AddRef((IUnknown*)*ppvObject); return S_OK; } @@ -95,7 +93,7 @@ static ULONG WINAPI entityref_Release( ref = InterlockedDecrement( &This->ref ); if ( ref == 0 ) { - IUnknown_Release( This->node_unk ); + destroy_xmlnode(This->node); HeapFree( GetProcessHeap(), 0, This ); } @@ -183,7 +181,7 @@ static HRESULT WINAPI entityref_get_nodeName( BSTR* p ) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_nodeName( This->node, p ); + return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI entityref_get_nodeValue( @@ -191,7 +189,7 @@ static HRESULT WINAPI entityref_get_nodeValue( VARIANT* var1 ) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_nodeValue( This->node, var1 ); + return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI entityref_put_nodeValue( @@ -199,7 +197,7 @@ static HRESULT WINAPI entityref_put_nodeValue( VARIANT var1 ) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_put_nodeValue( This->node, var1 ); + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI entityref_get_nodeType( @@ -207,7 +205,7 @@ static HRESULT WINAPI entityref_get_nodeType( DOMNodeType* domNodeType ) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_nodeType( This->node, domNodeType ); + return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(This->node), domNodeType ); } static HRESULT WINAPI entityref_get_parentNode( @@ -215,7 +213,7 @@ static HRESULT WINAPI entityref_get_parentNode( IXMLDOMNode** parent ) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_parentNode( This->node, parent ); + return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(This->node), parent ); } static HRESULT WINAPI entityref_get_childNodes( @@ -223,7 +221,7 @@ static HRESULT WINAPI entityref_get_childNodes( IXMLDOMNodeList** outList) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_childNodes( This->node, outList ); + return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(This->node), outList ); } static HRESULT WINAPI entityref_get_firstChild( @@ -231,7 +229,7 @@ static HRESULT WINAPI entityref_get_firstChild( IXMLDOMNode** domNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_firstChild( This->node, domNode ); + return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI entityref_get_lastChild( @@ -239,7 +237,7 @@ static HRESULT WINAPI entityref_get_lastChild( IXMLDOMNode** domNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_lastChild( This->node, domNode ); + return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI entityref_get_previousSibling( @@ -247,7 +245,7 @@ static HRESULT WINAPI entityref_get_previousSibling( IXMLDOMNode** domNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_previousSibling( This->node, domNode ); + return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI entityref_get_nextSibling( @@ -255,7 +253,7 @@ static HRESULT WINAPI entityref_get_nextSibling( IXMLDOMNode** domNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_nextSibling( This->node, domNode ); + return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI entityref_get_attributes( @@ -263,7 +261,7 @@ static HRESULT WINAPI entityref_get_attributes( IXMLDOMNamedNodeMap** attributeMap) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_attributes( This->node, attributeMap ); + return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(This->node), attributeMap ); } static HRESULT WINAPI entityref_insertBefore( @@ -272,7 +270,7 @@ static HRESULT WINAPI entityref_insertBefore( IXMLDOMNode** outOldNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode ); + return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(This->node), newNode, var1, outOldNode ); } static HRESULT WINAPI entityref_replaceChild( @@ -282,7 +280,7 @@ static HRESULT WINAPI entityref_replaceChild( IXMLDOMNode** outOldNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode ); + return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(This->node), newNode, oldNode, outOldNode ); } static HRESULT WINAPI entityref_removeChild( @@ -290,7 +288,7 @@ static HRESULT WINAPI entityref_removeChild( IXMLDOMNode* domNode, IXMLDOMNode** oldNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_removeChild( This->node, domNode, oldNode ); + return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(This->node), domNode, oldNode ); } static HRESULT WINAPI entityref_appendChild( @@ -298,7 +296,7 @@ static HRESULT WINAPI entityref_appendChild( IXMLDOMNode* newNode, IXMLDOMNode** outNewNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_appendChild( This->node, newNode, outNewNode ); + return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(This->node), newNode, outNewNode ); } static HRESULT WINAPI entityref_hasChildNodes( @@ -306,7 +304,7 @@ static HRESULT WINAPI entityref_hasChildNodes( VARIANT_BOOL* pbool) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_hasChildNodes( This->node, pbool ); + return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI entityref_get_ownerDocument( @@ -314,7 +312,7 @@ static HRESULT WINAPI entityref_get_ownerDocument( IXMLDOMDocument** domDocument) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_ownerDocument( This->node, domDocument ); + return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(This->node), domDocument ); } static HRESULT WINAPI entityref_cloneNode( @@ -322,7 +320,7 @@ static HRESULT WINAPI entityref_cloneNode( VARIANT_BOOL pbool, IXMLDOMNode** outNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_cloneNode( This->node, pbool, outNode ); + return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(This->node), pbool, outNode ); } static HRESULT WINAPI entityref_get_nodeTypeString( @@ -330,7 +328,7 @@ static HRESULT WINAPI entityref_get_nodeTypeString( BSTR* p) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_nodeTypeString( This->node, p ); + return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI entityref_get_text( @@ -338,7 +336,7 @@ static HRESULT WINAPI entityref_get_text( BSTR* p) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_text( This->node, p ); + return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI entityref_put_text( @@ -346,7 +344,7 @@ static HRESULT WINAPI entityref_put_text( BSTR p) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_put_text( This->node, p ); + return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI entityref_get_specified( @@ -354,7 +352,7 @@ static HRESULT WINAPI entityref_get_specified( VARIANT_BOOL* pbool) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_specified( This->node, pbool ); + return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI entityref_get_definition( @@ -362,7 +360,7 @@ static HRESULT WINAPI entityref_get_definition( IXMLDOMNode** domNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_definition( This->node, domNode ); + return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI entityref_get_nodeTypedValue( @@ -370,7 +368,7 @@ static HRESULT WINAPI entityref_get_nodeTypedValue( VARIANT* var1) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI entityref_put_nodeTypedValue( @@ -378,7 +376,7 @@ static HRESULT WINAPI entityref_put_nodeTypedValue( VARIANT var1) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_put_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI entityref_get_dataType( @@ -386,7 +384,7 @@ static HRESULT WINAPI entityref_get_dataType( VARIANT* var1) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_dataType( This->node, var1 ); + return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI entityref_put_dataType( @@ -394,7 +392,7 @@ static HRESULT WINAPI entityref_put_dataType( BSTR p) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_put_dataType( This->node, p ); + return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI entityref_get_xml( @@ -402,7 +400,7 @@ static HRESULT WINAPI entityref_get_xml( BSTR* p) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_xml( This->node, p ); + return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI entityref_transformNode( @@ -410,7 +408,7 @@ static HRESULT WINAPI entityref_transformNode( IXMLDOMNode* domNode, BSTR* p) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_transformNode( This->node, domNode, p ); + return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(This->node), domNode, p ); } static HRESULT WINAPI entityref_selectNodes( @@ -418,7 +416,7 @@ static HRESULT WINAPI entityref_selectNodes( BSTR p, IXMLDOMNodeList** outList) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_selectNodes( This->node, p, outList ); + return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(This->node), p, outList ); } static HRESULT WINAPI entityref_selectSingleNode( @@ -426,7 +424,7 @@ static HRESULT WINAPI entityref_selectSingleNode( BSTR p, IXMLDOMNode** outNode) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_selectSingleNode( This->node, p, outNode ); + return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(This->node), p, outNode ); } static HRESULT WINAPI entityref_get_parsed( @@ -434,7 +432,7 @@ static HRESULT WINAPI entityref_get_parsed( VARIANT_BOOL* pbool) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_parsed( This->node, pbool ); + return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI entityref_get_namespaceURI( @@ -442,7 +440,7 @@ static HRESULT WINAPI entityref_get_namespaceURI( BSTR* p) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_namespaceURI( This->node, p ); + return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI entityref_get_prefix( @@ -450,7 +448,7 @@ static HRESULT WINAPI entityref_get_prefix( BSTR* p) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_prefix( This->node, p ); + return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI entityref_get_baseName( @@ -458,7 +456,7 @@ static HRESULT WINAPI entityref_get_baseName( BSTR* p) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_baseName( This->node, p ); + return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI entityref_transformNodeToObject( @@ -466,7 +464,7 @@ static HRESULT WINAPI entityref_transformNodeToObject( IXMLDOMNode* domNode, VARIANT var1) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 ); + return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(This->node), domNode, var1 ); } static const struct IXMLDOMEntityReferenceVtbl entityref_vtbl = @@ -519,7 +517,6 @@ static const struct IXMLDOMEntityReferenceVtbl entityref_vtbl = IUnknown* create_doc_entity_ref( xmlNodePtr entity ) { entityref *This; - xmlnode *node; This = HeapAlloc( GetProcessHeap(), 0, sizeof *This ); if ( !This ) @@ -528,16 +525,13 @@ IUnknown* create_doc_entity_ref( xmlNodePtr entity ) This->lpVtbl = &entityref_vtbl; This->ref = 1; - node = create_basic_node( entity, (IUnknown*)&This->lpVtbl, NULL ); - if(!node) + This->node = create_basic_node( entity, (IUnknown*)&This->lpVtbl, NULL ); + if(!This->node) { HeapFree(GetProcessHeap(), 0, This); return NULL; } - This->node_unk = (IUnknown*)&node->lpInternalUnkVtbl; - This->node = IXMLDOMNode_from_impl(node); - return (IUnknown*) &This->lpVtbl; } diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h index 57dec0f4719..c4568f423ee 100644 --- a/dlls/msxml3/msxml_private.h +++ b/dlls/msxml3/msxml_private.h @@ -144,7 +144,6 @@ typedef struct _xmlnode { DispatchEx dispex; const struct IXMLDOMNodeVtbl *lpVtbl; - const struct IUnknownVtbl *lpInternalUnkVtbl; IUnknown *pUnkOuter; LONG ref; xmlNodePtr node; @@ -161,6 +160,7 @@ static inline IXMLDOMNode *IXMLDOMNode_from_impl(xmlnode *This) } extern xmlnode *create_basic_node(xmlNodePtr,IUnknown*,dispex_static_data_t*); +extern void destroy_xmlnode(xmlnode*); extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document); diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c index 987b07d2d09..643f99efafb 100644 --- a/dlls/msxml3/node.c +++ b/dlls/msxml3/node.c @@ -66,11 +66,6 @@ static const WCHAR szFloat[] = {'f','l','o','a','t',0}; static const WCHAR szUUID[] = {'u','u','i','d',0}; static const WCHAR szBinHex[] = {'b','i','n','.','h','e','x',0}; -static inline xmlnode *impl_from_InternalUnknown( IUnknown *iface ) -{ - return (xmlnode *)((char*)iface - FIELD_OFFSET(xmlnode, lpInternalUnkVtbl)); -} - xmlNodePtr xmlNodePtr_from_domnode( IXMLDOMNode *iface, xmlElementType type ) { xmlnode *This; @@ -91,23 +86,52 @@ static HRESULT WINAPI xmlnode_QueryInterface( void** ppvObject ) { xmlnode *This = impl_from_IXMLDOMNode( iface ); + TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject); - return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObject); + if(This->pUnkOuter) + return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObject); + + if (IsEqualGUID(riid, &IID_IUnknown)) { + *ppvObject = iface; + }else if (IsEqualGUID( riid, &IID_IDispatch) || + IsEqualGUID( riid, &IID_IXMLDOMNode)) { + *ppvObject = &This->lpVtbl; + }else { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + *ppvObject = NULL; + return E_NOINTERFACE; + } + + IUnknown_AddRef( (IUnknown*)*ppvObject ); + return S_OK; } static ULONG WINAPI xmlnode_AddRef( IXMLDOMNode *iface ) { xmlnode *This = impl_from_IXMLDOMNode( iface ); - return IUnknown_AddRef(This->pUnkOuter); + + if(This->pUnkOuter) + return IUnknown_AddRef(This->pUnkOuter); + + return InterlockedIncrement(&This->ref); } static ULONG WINAPI xmlnode_Release( IXMLDOMNode *iface ) { xmlnode *This = impl_from_IXMLDOMNode( iface ); - return IUnknown_Release(This->pUnkOuter); + LONG ref; + + if(This->pUnkOuter) + return IUnknown_Release(This->pUnkOuter); + + ref = InterlockedDecrement( &This->ref ); + if(!ref) + destroy_xmlnode(This); + + return ref; } static HRESULT WINAPI xmlnode_GetTypeInfoCount( @@ -1484,64 +1508,13 @@ static const struct IXMLDOMNodeVtbl xmlnode_vtbl = xmlnode_transformNodeToObject, }; -static HRESULT WINAPI Internal_QueryInterface( - IUnknown *iface, - REFIID riid, - void** ppvObject ) +void destroy_xmlnode(xmlnode *This) { - xmlnode *This = impl_from_InternalUnknown( iface ); - - TRACE("%p %s %p\n", iface, debugstr_guid(riid), ppvObject); - - - if ( IsEqualGUID( riid, &IID_IUnknown )) - *ppvObject = iface; - else if ( IsEqualGUID( riid, &IID_IDispatch ) || - IsEqualGUID( riid, &IID_IXMLDOMNode ) ) - *ppvObject = &This->lpVtbl; - else - { - FIXME("interface %s not implemented\n", debugstr_guid(riid)); - *ppvObject = NULL; - return E_NOINTERFACE; - } - - IUnknown_AddRef( (IUnknown*)*ppvObject ); - - return S_OK; -} - -static ULONG WINAPI Internal_AddRef( - IUnknown *iface ) -{ - xmlnode *This = impl_from_InternalUnknown( iface ); - return InterlockedIncrement( &This->ref ); + if(This->node) + xmldoc_release(This->node->doc); + HeapFree( GetProcessHeap(), 0, This ); } -static ULONG WINAPI Internal_Release( - IUnknown *iface ) -{ - xmlnode *This = impl_from_InternalUnknown( iface ); - ULONG ref; - - ref = InterlockedDecrement( &This->ref ); - if ( ref == 0 ) - { - if( This->node ) - xmldoc_release( This->node->doc ); - HeapFree( GetProcessHeap(), 0, This ); - } - - return ref; -} - -static const struct IUnknownVtbl internal_unk_vtbl = -{ - Internal_QueryInterface, - Internal_AddRef, - Internal_Release -}; - xmlnode *create_basic_node( xmlNodePtr node, IUnknown *pUnkOuter, dispex_static_data_t *dispex_data ) { xmlnode *This; @@ -1554,12 +1527,11 @@ xmlnode *create_basic_node( xmlNodePtr node, IUnknown *pUnkOuter, dispex_static_ xmldoc_add_ref( node->doc ); This->lpVtbl = &xmlnode_vtbl; - This->lpInternalUnkVtbl = &internal_unk_vtbl; if(pUnkOuter) This->pUnkOuter = pUnkOuter; /* Don't take a ref on outer Unknown */ else - This->pUnkOuter = (IUnknown *)&This->lpInternalUnkVtbl; + This->pUnkOuter = NULL; if(dispex_data) init_dispex(&This->dispex, This->pUnkOuter, dispex_data); @@ -1602,7 +1574,7 @@ IXMLDOMNode *create_node( xmlNodePtr node ) break; default: FIXME("only creating basic node for type %d\n", node->type); - pUnk = (IUnknown*)&create_basic_node( node, NULL, NULL )->lpInternalUnkVtbl; + pUnk = (IUnknown*)&create_basic_node( node, NULL, NULL )->lpVtbl; } hr = IUnknown_QueryInterface(pUnk, &IID_IXMLDOMNode, (LPVOID*)&ret); diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c index ddcf68b9415..859e12838be 100644 --- a/dlls/msxml3/pi.c +++ b/dlls/msxml3/pi.c @@ -41,8 +41,7 @@ typedef struct _dom_pi { const struct IXMLDOMProcessingInstructionVtbl *lpVtbl; LONG ref; - IUnknown *node_unk; - IXMLDOMNode *node; + xmlnode *node; } dom_pi; static inline dom_pi *impl_from_IXMLDOMProcessingInstruction( IXMLDOMProcessingInstruction *iface ) @@ -66,7 +65,7 @@ static HRESULT WINAPI dom_pi_QueryInterface( } else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) { - return IUnknown_QueryInterface(This->node_unk, riid, ppvObject); + *ppvObject = IXMLDOMNode_from_impl(This->node); } else { @@ -74,8 +73,7 @@ static HRESULT WINAPI dom_pi_QueryInterface( return E_NOINTERFACE; } - IXMLDOMProcessingInstruction_AddRef( iface ); - + IUnknown_AddRef((IUnknown*)*ppvObject); return S_OK; } @@ -95,7 +93,7 @@ static ULONG WINAPI dom_pi_Release( ref = InterlockedDecrement( &This->ref ); if ( ref == 0 ) { - IUnknown_Release( This->node_unk ); + destroy_xmlnode(This->node); HeapFree( GetProcessHeap(), 0, This ); } @@ -184,7 +182,7 @@ static HRESULT WINAPI dom_pi_get_nodeName( BSTR* p ) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_nodeName( This->node, p ); + return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI dom_pi_get_nodeValue( @@ -192,7 +190,7 @@ static HRESULT WINAPI dom_pi_get_nodeValue( VARIANT* var1 ) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_nodeValue( This->node, var1 ); + return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI dom_pi_put_nodeValue( @@ -219,7 +217,7 @@ static HRESULT WINAPI dom_pi_put_nodeValue( SysFreeString(sTarget); } - return IXMLDOMNode_put_nodeValue( This->node, var1 ); + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI dom_pi_get_nodeType( @@ -227,7 +225,7 @@ static HRESULT WINAPI dom_pi_get_nodeType( DOMNodeType* domNodeType ) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_nodeType( This->node, domNodeType ); + return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(This->node), domNodeType ); } static HRESULT WINAPI dom_pi_get_parentNode( @@ -235,7 +233,7 @@ static HRESULT WINAPI dom_pi_get_parentNode( IXMLDOMNode** parent ) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_parentNode( This->node, parent ); + return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(This->node), parent ); } static HRESULT WINAPI dom_pi_get_childNodes( @@ -243,7 +241,7 @@ static HRESULT WINAPI dom_pi_get_childNodes( IXMLDOMNodeList** outList) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_childNodes( This->node, outList ); + return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(This->node), outList ); } static HRESULT WINAPI dom_pi_get_firstChild( @@ -251,7 +249,7 @@ static HRESULT WINAPI dom_pi_get_firstChild( IXMLDOMNode** domNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_firstChild( This->node, domNode ); + return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI dom_pi_get_lastChild( @@ -259,7 +257,7 @@ static HRESULT WINAPI dom_pi_get_lastChild( IXMLDOMNode** domNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_lastChild( This->node, domNode ); + return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI dom_pi_get_previousSibling( @@ -267,7 +265,7 @@ static HRESULT WINAPI dom_pi_get_previousSibling( IXMLDOMNode** domNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_previousSibling( This->node, domNode ); + return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI dom_pi_get_nextSibling( @@ -275,7 +273,7 @@ static HRESULT WINAPI dom_pi_get_nextSibling( IXMLDOMNode** domNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_nextSibling( This->node, domNode ); + return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI dom_pi_get_attributes( @@ -283,7 +281,7 @@ static HRESULT WINAPI dom_pi_get_attributes( IXMLDOMNamedNodeMap** attributeMap) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_attributes( This->node, attributeMap ); + return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(This->node), attributeMap ); } static HRESULT WINAPI dom_pi_insertBefore( @@ -292,7 +290,7 @@ static HRESULT WINAPI dom_pi_insertBefore( IXMLDOMNode** outOldNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode ); + return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(This->node), newNode, var1, outOldNode ); } static HRESULT WINAPI dom_pi_replaceChild( @@ -302,7 +300,7 @@ static HRESULT WINAPI dom_pi_replaceChild( IXMLDOMNode** outOldNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode ); + return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(This->node), newNode, oldNode, outOldNode ); } static HRESULT WINAPI dom_pi_removeChild( @@ -310,7 +308,7 @@ static HRESULT WINAPI dom_pi_removeChild( IXMLDOMNode* domNode, IXMLDOMNode** oldNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_removeChild( This->node, domNode, oldNode ); + return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(This->node), domNode, oldNode ); } static HRESULT WINAPI dom_pi_appendChild( @@ -318,7 +316,7 @@ static HRESULT WINAPI dom_pi_appendChild( IXMLDOMNode* newNode, IXMLDOMNode** outNewNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_appendChild( This->node, newNode, outNewNode ); + return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(This->node), newNode, outNewNode ); } static HRESULT WINAPI dom_pi_hasChildNodes( @@ -326,7 +324,7 @@ static HRESULT WINAPI dom_pi_hasChildNodes( VARIANT_BOOL* pbool) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_hasChildNodes( This->node, pbool ); + return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI dom_pi_get_ownerDocument( @@ -334,7 +332,7 @@ static HRESULT WINAPI dom_pi_get_ownerDocument( IXMLDOMDocument** domDocument) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_ownerDocument( This->node, domDocument ); + return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(This->node), domDocument ); } static HRESULT WINAPI dom_pi_cloneNode( @@ -342,7 +340,7 @@ static HRESULT WINAPI dom_pi_cloneNode( VARIANT_BOOL pbool, IXMLDOMNode** outNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_cloneNode( This->node, pbool, outNode ); + return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(This->node), pbool, outNode ); } static HRESULT WINAPI dom_pi_get_nodeTypeString( @@ -350,7 +348,7 @@ static HRESULT WINAPI dom_pi_get_nodeTypeString( BSTR* p) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_nodeTypeString( This->node, p ); + return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI dom_pi_get_text( @@ -358,7 +356,7 @@ static HRESULT WINAPI dom_pi_get_text( BSTR* p) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_text( This->node, p ); + return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI dom_pi_put_text( @@ -366,7 +364,7 @@ static HRESULT WINAPI dom_pi_put_text( BSTR p) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_put_text( This->node, p ); + return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI dom_pi_get_specified( @@ -374,7 +372,7 @@ static HRESULT WINAPI dom_pi_get_specified( VARIANT_BOOL* pbool) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_specified( This->node, pbool ); + return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI dom_pi_get_definition( @@ -382,7 +380,7 @@ static HRESULT WINAPI dom_pi_get_definition( IXMLDOMNode** domNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_definition( This->node, domNode ); + return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI dom_pi_get_nodeTypedValue( @@ -390,7 +388,7 @@ static HRESULT WINAPI dom_pi_get_nodeTypedValue( VARIANT* var1) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI dom_pi_put_nodeTypedValue( @@ -398,7 +396,7 @@ static HRESULT WINAPI dom_pi_put_nodeTypedValue( VARIANT var1) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_put_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI dom_pi_get_dataType( @@ -406,7 +404,7 @@ static HRESULT WINAPI dom_pi_get_dataType( VARIANT* var1) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_dataType( This->node, var1 ); + return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI dom_pi_put_dataType( @@ -414,7 +412,7 @@ static HRESULT WINAPI dom_pi_put_dataType( BSTR p) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_put_dataType( This->node, p ); + return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI dom_pi_get_xml( @@ -422,7 +420,7 @@ static HRESULT WINAPI dom_pi_get_xml( BSTR* p) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_xml( This->node, p ); + return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI dom_pi_transformNode( @@ -430,7 +428,7 @@ static HRESULT WINAPI dom_pi_transformNode( IXMLDOMNode* domNode, BSTR* p) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_transformNode( This->node, domNode, p ); + return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(This->node), domNode, p ); } static HRESULT WINAPI dom_pi_selectNodes( @@ -438,7 +436,7 @@ static HRESULT WINAPI dom_pi_selectNodes( BSTR p, IXMLDOMNodeList** outList) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_selectNodes( This->node, p, outList ); + return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(This->node), p, outList ); } static HRESULT WINAPI dom_pi_selectSingleNode( @@ -446,7 +444,7 @@ static HRESULT WINAPI dom_pi_selectSingleNode( BSTR p, IXMLDOMNode** outNode) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_selectSingleNode( This->node, p, outNode ); + return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(This->node), p, outNode ); } static HRESULT WINAPI dom_pi_get_parsed( @@ -454,7 +452,7 @@ static HRESULT WINAPI dom_pi_get_parsed( VARIANT_BOOL* pbool) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_parsed( This->node, pbool ); + return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI dom_pi_get_namespaceURI( @@ -462,7 +460,7 @@ static HRESULT WINAPI dom_pi_get_namespaceURI( BSTR* p) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_namespaceURI( This->node, p ); + return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI dom_pi_get_prefix( @@ -470,7 +468,7 @@ static HRESULT WINAPI dom_pi_get_prefix( BSTR* p) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_prefix( This->node, p ); + return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI dom_pi_get_baseName( @@ -478,7 +476,7 @@ static HRESULT WINAPI dom_pi_get_baseName( BSTR* p) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_baseName( This->node, p ); + return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI dom_pi_transformNodeToObject( @@ -486,7 +484,7 @@ static HRESULT WINAPI dom_pi_transformNodeToObject( IXMLDOMNode* domNode, VARIANT var1) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 ); + return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(This->node), domNode, var1 ); } static HRESULT WINAPI dom_pi_get_target( @@ -495,7 +493,7 @@ static HRESULT WINAPI dom_pi_get_target( { /* target returns the same value as nodeName property */ dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_nodeName( This->node, p ); + return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI dom_pi_get_data( @@ -509,7 +507,7 @@ static HRESULT WINAPI dom_pi_get_data( if(!p) return E_INVALIDARG; - hr = IXMLDOMNode_get_nodeValue( This->node, &vRet ); + hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); @@ -546,7 +544,7 @@ static HRESULT WINAPI dom_pi_put_data( V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; - hr = IXMLDOMNode_put_nodeValue( This->node, val ); + hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), val ); return hr; } @@ -605,7 +603,6 @@ static const struct IXMLDOMProcessingInstructionVtbl dom_pi_vtbl = IUnknown* create_pi( xmlNodePtr pi ) { dom_pi *This; - xmlnode *node; This = HeapAlloc( GetProcessHeap(), 0, sizeof *This ); if ( !This ) @@ -614,16 +611,13 @@ IUnknown* create_pi( xmlNodePtr pi ) This->lpVtbl = &dom_pi_vtbl; This->ref = 1; - node = create_basic_node( pi, (IUnknown*)&This->lpVtbl, NULL ); - if(!node) + This->node = create_basic_node( pi, (IUnknown*)&This->lpVtbl, NULL ); + if(!This->node) { HeapFree(GetProcessHeap(), 0, This); return NULL; } - This->node_unk = (IUnknown*)&node->lpInternalUnkVtbl; - This->node = IXMLDOMNode_from_impl(node); - return (IUnknown*) &This->lpVtbl; } diff --git a/dlls/msxml3/text.c b/dlls/msxml3/text.c index cb1966c03ad..a384beae7c3 100644 --- a/dlls/msxml3/text.c +++ b/dlls/msxml3/text.c @@ -42,8 +42,7 @@ typedef struct _domtext { const struct IXMLDOMTextVtbl *lpVtbl; LONG ref; - IUnknown *node_unk; - IXMLDOMNode *node; + xmlnode *node; } domtext; static inline domtext *impl_from_IXMLDOMText( IXMLDOMText *iface ) @@ -68,7 +67,7 @@ static HRESULT WINAPI domtext_QueryInterface( } else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) { - return IUnknown_QueryInterface(This->node_unk, riid, ppvObject); + *ppvObject = IXMLDOMNode_from_impl(This->node); } else if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) || IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) ) @@ -83,8 +82,7 @@ static HRESULT WINAPI domtext_QueryInterface( return E_NOINTERFACE; } - IXMLDOMText_AddRef( iface ); - + IXMLDOMText_AddRef((IUnknown*)*ppvObject); return S_OK; } @@ -104,7 +102,7 @@ static ULONG WINAPI domtext_Release( ref = InterlockedDecrement( &This->ref ); if ( ref == 0 ) { - IUnknown_Release( This->node_unk ); + destroy_xmlnode(This->node); HeapFree( GetProcessHeap(), 0, This ); } @@ -193,7 +191,7 @@ static HRESULT WINAPI domtext_get_nodeName( BSTR* p ) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_nodeName( This->node, p ); + return IXMLDOMNode_get_nodeName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domtext_get_nodeValue( @@ -201,7 +199,7 @@ static HRESULT WINAPI domtext_get_nodeValue( VARIANT* var1 ) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_nodeValue( This->node, var1 ); + return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domtext_put_nodeValue( @@ -209,7 +207,7 @@ static HRESULT WINAPI domtext_put_nodeValue( VARIANT var1 ) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_put_nodeValue( This->node, var1 ); + return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domtext_get_nodeType( @@ -217,7 +215,7 @@ static HRESULT WINAPI domtext_get_nodeType( DOMNodeType* domNodeType ) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_nodeType( This->node, domNodeType ); + return IXMLDOMNode_get_nodeType( IXMLDOMNode_from_impl(This->node), domNodeType ); } static HRESULT WINAPI domtext_get_parentNode( @@ -225,7 +223,7 @@ static HRESULT WINAPI domtext_get_parentNode( IXMLDOMNode** parent ) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_parentNode( This->node, parent ); + return IXMLDOMNode_get_parentNode( IXMLDOMNode_from_impl(This->node), parent ); } static HRESULT WINAPI domtext_get_childNodes( @@ -233,7 +231,7 @@ static HRESULT WINAPI domtext_get_childNodes( IXMLDOMNodeList** outList) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_childNodes( This->node, outList ); + return IXMLDOMNode_get_childNodes( IXMLDOMNode_from_impl(This->node), outList ); } static HRESULT WINAPI domtext_get_firstChild( @@ -241,7 +239,7 @@ static HRESULT WINAPI domtext_get_firstChild( IXMLDOMNode** domNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_firstChild( This->node, domNode ); + return IXMLDOMNode_get_firstChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domtext_get_lastChild( @@ -249,7 +247,7 @@ static HRESULT WINAPI domtext_get_lastChild( IXMLDOMNode** domNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_lastChild( This->node, domNode ); + return IXMLDOMNode_get_lastChild( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domtext_get_previousSibling( @@ -257,7 +255,7 @@ static HRESULT WINAPI domtext_get_previousSibling( IXMLDOMNode** domNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_previousSibling( This->node, domNode ); + return IXMLDOMNode_get_previousSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domtext_get_nextSibling( @@ -265,7 +263,7 @@ static HRESULT WINAPI domtext_get_nextSibling( IXMLDOMNode** domNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_nextSibling( This->node, domNode ); + return IXMLDOMNode_get_nextSibling( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domtext_get_attributes( @@ -273,7 +271,7 @@ static HRESULT WINAPI domtext_get_attributes( IXMLDOMNamedNodeMap** attributeMap) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_attributes( This->node, attributeMap ); + return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(This->node), attributeMap ); } static HRESULT WINAPI domtext_insertBefore( @@ -282,7 +280,7 @@ static HRESULT WINAPI domtext_insertBefore( IXMLDOMNode** outOldNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_insertBefore( This->node, newNode, var1, outOldNode ); + return IXMLDOMNode_insertBefore( IXMLDOMNode_from_impl(This->node), newNode, var1, outOldNode ); } static HRESULT WINAPI domtext_replaceChild( @@ -292,7 +290,7 @@ static HRESULT WINAPI domtext_replaceChild( IXMLDOMNode** outOldNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_replaceChild( This->node, newNode, oldNode, outOldNode ); + return IXMLDOMNode_replaceChild( IXMLDOMNode_from_impl(This->node), newNode, oldNode, outOldNode ); } static HRESULT WINAPI domtext_removeChild( @@ -300,7 +298,7 @@ static HRESULT WINAPI domtext_removeChild( IXMLDOMNode* domNode, IXMLDOMNode** oldNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_removeChild( This->node, domNode, oldNode ); + return IXMLDOMNode_removeChild( IXMLDOMNode_from_impl(This->node), domNode, oldNode ); } static HRESULT WINAPI domtext_appendChild( @@ -308,7 +306,7 @@ static HRESULT WINAPI domtext_appendChild( IXMLDOMNode* newNode, IXMLDOMNode** outNewNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_appendChild( This->node, newNode, outNewNode ); + return IXMLDOMNode_appendChild( IXMLDOMNode_from_impl(This->node), newNode, outNewNode ); } static HRESULT WINAPI domtext_hasChildNodes( @@ -316,7 +314,7 @@ static HRESULT WINAPI domtext_hasChildNodes( VARIANT_BOOL* pbool) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_hasChildNodes( This->node, pbool ); + return IXMLDOMNode_hasChildNodes( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domtext_get_ownerDocument( @@ -324,7 +322,7 @@ static HRESULT WINAPI domtext_get_ownerDocument( IXMLDOMDocument** domDocument) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_ownerDocument( This->node, domDocument ); + return IXMLDOMNode_get_ownerDocument( IXMLDOMNode_from_impl(This->node), domDocument ); } static HRESULT WINAPI domtext_cloneNode( @@ -332,7 +330,7 @@ static HRESULT WINAPI domtext_cloneNode( VARIANT_BOOL pbool, IXMLDOMNode** outNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_cloneNode( This->node, pbool, outNode ); + return IXMLDOMNode_cloneNode( IXMLDOMNode_from_impl(This->node), pbool, outNode ); } static HRESULT WINAPI domtext_get_nodeTypeString( @@ -340,7 +338,7 @@ static HRESULT WINAPI domtext_get_nodeTypeString( BSTR* p) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_nodeTypeString( This->node, p ); + return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domtext_get_text( @@ -348,7 +346,7 @@ static HRESULT WINAPI domtext_get_text( BSTR* p) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_text( This->node, p ); + return IXMLDOMNode_get_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domtext_put_text( @@ -356,7 +354,7 @@ static HRESULT WINAPI domtext_put_text( BSTR p) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_put_text( This->node, p ); + return IXMLDOMNode_put_text( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domtext_get_specified( @@ -364,7 +362,7 @@ static HRESULT WINAPI domtext_get_specified( VARIANT_BOOL* pbool) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_specified( This->node, pbool ); + return IXMLDOMNode_get_specified( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domtext_get_definition( @@ -372,7 +370,7 @@ static HRESULT WINAPI domtext_get_definition( IXMLDOMNode** domNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_definition( This->node, domNode ); + return IXMLDOMNode_get_definition( IXMLDOMNode_from_impl(This->node), domNode ); } static HRESULT WINAPI domtext_get_nodeTypedValue( @@ -380,7 +378,7 @@ static HRESULT WINAPI domtext_get_nodeTypedValue( VARIANT* var1) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_get_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domtext_put_nodeTypedValue( @@ -388,7 +386,7 @@ static HRESULT WINAPI domtext_put_nodeTypedValue( VARIANT var1) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_put_nodeTypedValue( This->node, var1 ); + return IXMLDOMNode_put_nodeTypedValue( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domtext_get_dataType( @@ -396,7 +394,7 @@ static HRESULT WINAPI domtext_get_dataType( VARIANT* var1) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_dataType( This->node, var1 ); + return IXMLDOMNode_get_dataType( IXMLDOMNode_from_impl(This->node), var1 ); } static HRESULT WINAPI domtext_put_dataType( @@ -404,7 +402,7 @@ static HRESULT WINAPI domtext_put_dataType( BSTR p) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_put_dataType( This->node, p ); + return IXMLDOMNode_put_dataType( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domtext_get_xml( @@ -412,7 +410,7 @@ static HRESULT WINAPI domtext_get_xml( BSTR* p) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_xml( This->node, p ); + return IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domtext_transformNode( @@ -420,7 +418,7 @@ static HRESULT WINAPI domtext_transformNode( IXMLDOMNode* domNode, BSTR* p) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_transformNode( This->node, domNode, p ); + return IXMLDOMNode_transformNode( IXMLDOMNode_from_impl(This->node), domNode, p ); } static HRESULT WINAPI domtext_selectNodes( @@ -428,7 +426,7 @@ static HRESULT WINAPI domtext_selectNodes( BSTR p, IXMLDOMNodeList** outList) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_selectNodes( This->node, p, outList ); + return IXMLDOMNode_selectNodes( IXMLDOMNode_from_impl(This->node), p, outList ); } static HRESULT WINAPI domtext_selectSingleNode( @@ -436,7 +434,7 @@ static HRESULT WINAPI domtext_selectSingleNode( BSTR p, IXMLDOMNode** outNode) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_selectSingleNode( This->node, p, outNode ); + return IXMLDOMNode_selectSingleNode( IXMLDOMNode_from_impl(This->node), p, outNode ); } static HRESULT WINAPI domtext_get_parsed( @@ -444,7 +442,7 @@ static HRESULT WINAPI domtext_get_parsed( VARIANT_BOOL* pbool) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_parsed( This->node, pbool ); + return IXMLDOMNode_get_parsed( IXMLDOMNode_from_impl(This->node), pbool ); } static HRESULT WINAPI domtext_get_namespaceURI( @@ -452,7 +450,7 @@ static HRESULT WINAPI domtext_get_namespaceURI( BSTR* p) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_namespaceURI( This->node, p ); + return IXMLDOMNode_get_namespaceURI( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domtext_get_prefix( @@ -460,7 +458,7 @@ static HRESULT WINAPI domtext_get_prefix( BSTR* p) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_prefix( This->node, p ); + return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domtext_get_baseName( @@ -468,7 +466,7 @@ static HRESULT WINAPI domtext_get_baseName( BSTR* p) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_baseName( This->node, p ); + return IXMLDOMNode_get_baseName( IXMLDOMNode_from_impl(This->node), p ); } static HRESULT WINAPI domtext_transformNodeToObject( @@ -476,7 +474,7 @@ static HRESULT WINAPI domtext_transformNodeToObject( IXMLDOMNode* domNode, VARIANT var1) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_transformNodeToObject( This->node, domNode, var1 ); + return IXMLDOMNode_transformNodeToObject( IXMLDOMNode_from_impl(This->node), domNode, var1 ); } static HRESULT WINAPI domtext_get_data( @@ -490,7 +488,7 @@ static HRESULT WINAPI domtext_get_data( if(!p) return E_INVALIDARG; - hr = IXMLDOMNode_get_nodeValue( This->node, &vRet ); + hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(This->node), &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); @@ -512,7 +510,7 @@ static HRESULT WINAPI domtext_put_data( V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; - hr = IXMLDOMNode_put_nodeValue( This->node, val ); + hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(This->node), val ); return hr; } @@ -522,7 +520,6 @@ static HRESULT WINAPI domtext_get_length( LONG *len) { domtext *This = impl_from_IXMLDOMText( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pContent; LONG nLength = 0; @@ -531,7 +528,7 @@ static HRESULT WINAPI domtext_get_length( if(!len) return E_INVALIDARG; - pContent = xmlNodeGetContent(pDOMNode->node); + pContent = xmlNodeGetContent(This->node->node); if(pContent) { nLength = xmlStrlen(pContent); @@ -548,7 +545,6 @@ static HRESULT WINAPI domtext_substringData( LONG offset, LONG count, BSTR *p) { domtext *This = impl_from_IXMLDOMText( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pContent; LONG nLength = 0; HRESULT hr = S_FALSE; @@ -565,7 +561,7 @@ static HRESULT WINAPI domtext_substringData( if(count == 0) return hr; - pContent = xmlNodeGetContent(pDOMNode->node); + pContent = xmlNodeGetContent(This->node->node); if(pContent) { nLength = xmlStrlen(pContent); @@ -593,7 +589,6 @@ static HRESULT WINAPI domtext_appendData( BSTR p) { domtext *This = impl_from_IXMLDOMText( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pContent; HRESULT hr = S_FALSE; @@ -606,7 +601,7 @@ static HRESULT WINAPI domtext_appendData( pContent = xmlChar_from_wchar( p ); if(pContent) { - if(xmlTextConcat(pDOMNode->node, pContent, SysStringLen(p) ) == 0) + if(xmlTextConcat(This->node->node, pContent, SysStringLen(p) ) == 0) hr = S_OK; else hr = E_FAIL; @@ -623,7 +618,6 @@ static HRESULT WINAPI domtext_insertData( LONG offset, BSTR p) { domtext *This = impl_from_IXMLDOMText( iface ); - xmlnode *pDOMNode = impl_from_IXMLDOMNode( This->node ); xmlChar *pXmlContent; BSTR sNewString; HRESULT hr = S_FALSE; @@ -641,7 +635,7 @@ static HRESULT WINAPI domtext_insertData( return E_INVALIDARG; } - pXmlContent = xmlNodeGetContent(pDOMNode->node); + pXmlContent = xmlNodeGetContent(This->node->node); if(pXmlContent) { BSTR sContent = bstr_from_xmlChar( pXmlContent ); @@ -672,7 +666,7 @@ static HRESULT WINAPI domtext_insertData( str = xmlChar_from_wchar(sNewString); if(str) { - xmlNodeSetContent(pDOMNode->node, str); + xmlNodeSetContent(This->node->node, str); hr = S_OK; } HeapFree(GetProcessHeap(), 0, str); @@ -772,7 +766,6 @@ static const struct IXMLDOMTextVtbl domtext_vtbl = IUnknown* create_text( xmlNodePtr text ) { domtext *This; - xmlnode *node; This = HeapAlloc( GetProcessHeap(), 0, sizeof *This ); if ( !This ) @@ -781,16 +774,13 @@ IUnknown* create_text( xmlNodePtr text ) This->lpVtbl = &domtext_vtbl; This->ref = 1; - node = create_basic_node( text, (IUnknown*)&This->lpVtbl, NULL ); - if(!node) + This->node = create_basic_node( text, (IUnknown*)&This->lpVtbl, NULL ); + if(!This->node) { HeapFree(GetProcessHeap(), 0, This); return NULL; } - This->node_unk = (IUnknown*)&node->lpInternalUnkVtbl; - This->node = IXMLDOMNode_from_impl(node); - return (IUnknown*) &This->lpVtbl; } diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index 573ee86c5ab..cae3f79ffa4 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -141,7 +141,6 @@ NTSTATUS WINAPI NtQueryInformationProcess( UNIMPLEMENTED_INFO_CLASS(ProcessForegroundInformation); UNIMPLEMENTED_INFO_CLASS(ProcessLUIDDeviceMapsEnabled); UNIMPLEMENTED_INFO_CLASS(ProcessBreakOnTermination); - UNIMPLEMENTED_INFO_CLASS(ProcessDebugObjectHandle); UNIMPLEMENTED_INFO_CLASS(ProcessDebugFlags); UNIMPLEMENTED_INFO_CLASS(ProcessHandleTracing); @@ -300,6 +299,15 @@ NTSTATUS WINAPI NtQueryInformationProcess( else ret = STATUS_INFO_LENGTH_MISMATCH; break; + case ProcessDebugObjectHandle: + /* "These are not the debuggers you are looking for." * + * set it to 0 aka "no debugger" to satisfy copy protections */ + len = sizeof(HANDLE); + if (ProcessInformationLength == len) + memset(ProcessInformation, 0, ProcessInformationLength); + else + ret = STATUS_INFO_LENGTH_MISMATCH; + break; case ProcessHandleCount: if (ProcessInformationLength >= 4) { @@ -404,6 +412,8 @@ NTSTATUS WINAPI NtSetInformationProcess( if (ProcessInformationLength != sizeof(DWORD_PTR)) return STATUS_INVALID_PARAMETER; if (*(PDWORD_PTR)ProcessInformation & ~(((DWORD_PTR)1 << NtCurrentTeb()->Peb->NumberOfProcessors) - 1)) return STATUS_INVALID_PARAMETER; + if (!*(PDWORD_PTR)ProcessInformation) + return STATUS_INVALID_PARAMETER; SERVER_START_REQ( set_process_info ) { req->handle = wine_server_obj_handle( ProcessHandle ); diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c index 776ad391f57..6b621dfa336 100644 --- a/dlls/ntdll/tests/directory.c +++ b/dlls/ntdll/tests/directory.c @@ -46,26 +46,109 @@ static VOID (WINAPI *pRtlInitUnicodeString)( PUNICODE_STRING, LPCWSTR ); static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)( LPWSTR dst, DWORD dstlen, LPDWORD reslen, LPCSTR src, DWORD srclen ); +/* The attribute sets to test */ +struct testfile_s { + int todo; /* set if it doesn't work on wine yet */ + const DWORD attr; /* desired attribute */ + const char *name; /* filename to use */ + const char *target; /* what to point to (only for reparse pts) */ + const char *description; /* for error messages */ + int nfound; /* How many were found (expect 1) */ + WCHAR nameW[20]; /* unicode version of name (filled in later) */ +} testfiles[] = { + { 0, FILE_ATTRIBUTE_NORMAL, "n.tmp", NULL, "normal" }, + { 1, FILE_ATTRIBUTE_HIDDEN, "h.tmp", NULL, "hidden" }, + { 1, FILE_ATTRIBUTE_SYSTEM, "s.tmp", NULL, "system" }, + { 0, FILE_ATTRIBUTE_DIRECTORY, "d.tmp", NULL, "directory" }, + { 0, 0, NULL } +}; +static const int max_test_dir_size = 20; /* size of above plus some for .. etc */ + +/* Create a test directory full of attribute test files, clear counts */ +static void set_up_attribute_test(const char *testdirA) +{ + int i; + + ok(CreateDirectoryA(testdirA, NULL), + "couldn't create dir '%s', error %d\n", testdirA, GetLastError()); + + for (i=0; testfiles[i].name; i++) { + char buf[MAX_PATH]; + pRtlMultiByteToUnicodeN(testfiles[i].nameW, sizeof(testfiles[i].nameW), NULL, testfiles[i].name, strlen(testfiles[i].name)+1); + + sprintf(buf, "%s\\%s", testdirA, testfiles[i].name); + testfiles[i].nfound = 0; + if (testfiles[i].attr & FILE_ATTRIBUTE_DIRECTORY) { + ok(CreateDirectoryA(buf, NULL), + "couldn't create dir '%s', error %d\n", buf, GetLastError()); + } else { + HANDLE h = CreateFileA(buf, + GENERIC_READ|GENERIC_WRITE, + 0, NULL, CREATE_ALWAYS, + testfiles[i].attr, 0); + ok( h != INVALID_HANDLE_VALUE, "failed to create temp file '%s'\n", buf ); + CloseHandle(h); + } + } +} + +/* Remove the given test directory and the attribute test files, if any */ +static void tear_down_attribute_test(const char *testdirA) +{ + int i; + + for (i=0; testfiles[i].name; i++) { + int ret; + char buf[MAX_PATH]; + sprintf(buf, "%s\\%s", testdirA, testfiles[i].name); + if (testfiles[i].attr & FILE_ATTRIBUTE_DIRECTORY) { + ret = RemoveDirectory(buf); + ok(ret || (GetLastError() == ERROR_PATH_NOT_FOUND), + "Failed to rmdir %s, error %d\n", buf, GetLastError()); + } else { + ret = DeleteFile(buf); + ok(ret || (GetLastError() == ERROR_PATH_NOT_FOUND), + "Failed to rm %s, error %d\n", buf, GetLastError()); + } + } + RemoveDirectoryA(testdirA); +} + +/* Match one found file against testfiles[], increment count if found */ +static void tally_test_file(FILE_BOTH_DIRECTORY_INFORMATION *dir_info) +{ + int i; + DWORD attribmask = + (FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_DIRECTORY|FILE_ATTRIBUTE_REPARSE_POINT); + DWORD attrib = dir_info->FileAttributes & attribmask; + WCHAR *nameW = dir_info->FileName; + int namelen = dir_info->FileNameLength / sizeof(WCHAR); + + if (nameW[0] == '.') + return; + + for (i=0; testfiles[i].name; i++) { + int len = strlen(testfiles[i].name); + if (namelen != len || memcmp(nameW, testfiles[i].nameW, len*sizeof(WCHAR))) + continue; + if (testfiles[i].todo) { + todo_wine + ok (attrib == (testfiles[i].attr & attribmask), "file %s: expected %s (%x), got %x (is your linux new enough?)\n", testfiles[i].name, testfiles[i].description, testfiles[i].attr, attrib); + } else { + ok (attrib == (testfiles[i].attr & attribmask), "file %s: expected %s (%x), got %x (is your linux new enough?)\n", testfiles[i].name, testfiles[i].description, testfiles[i].attr, attrib); + } + testfiles[i].nfound++; + break; + } + ok(testfiles[i].name != NULL, "unexpected file found\n"); +} + static void test_NtQueryDirectoryFile(void) { - NTSTATUS ret; OBJECT_ATTRIBUTES attr; UNICODE_STRING ntdirname; - char dirnameA[MAX_PATH]; - WCHAR dirnameW[MAX_PATH]; - static const char testdirA[] = "NtQueryDirectoryFile"; - static const char normalfileA[] = "n"; - static const char hiddenfileA[] = "h"; - static const char systemfileA[] = "s"; - char normalpathA[MAX_PATH]; - char hiddenpathA[MAX_PATH]; - char systempathA[MAX_PATH]; - HANDLE normalh = INVALID_HANDLE_VALUE; - HANDLE hiddenh = INVALID_HANDLE_VALUE; - HANDLE systemh = INVALID_HANDLE_VALUE; - int normal_found; - int hidden_found; - int system_found; + char testdirA[MAX_PATH]; + WCHAR testdirW[MAX_PATH]; HANDLE dirh; IO_STATUS_BLOCK io; UINT data_pos; @@ -74,57 +157,26 @@ static void test_NtQueryDirectoryFile(void) FILE_BOTH_DIRECTORY_INFORMATION *dir_info; DWORD status; int numfiles; + int i; - ret = GetTempPathA(MAX_PATH, dirnameA); - if (!ret) - { - ok(0, "couldn't get temp dir\n"); - return; - } - if (ret + sizeof(testdirA)-1 + sizeof(normalfileA)-1 >= MAX_PATH) - { - ok(0, "MAX_PATH exceeded in constructing paths\n"); - return; - } - - strcat(dirnameA, testdirA); - - ret = CreateDirectoryA(dirnameA, NULL); - ok(ret == TRUE, "couldn't create directory '%s', ret %x, error %d\n", dirnameA, ret, GetLastError()); - - /* Create one normal file, one hidden, and one system file */ - GetTempFileNameA( dirnameA, normalfileA, 1, normalpathA ); - normalh = CreateFileA(normalpathA, GENERIC_READ | GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL | FILE_FLAG_DELETE_ON_CLOSE, 0); - ok( normalh != INVALID_HANDLE_VALUE, "failed to create temp file '%s'\n", normalpathA ); + /* Clean up from prior aborted run, if any, then set up test files */ + ok(GetTempPathA(MAX_PATH, testdirA), "couldn't get temp dir\n"); + strcat(testdirA, "NtQueryDirectoryFile.tmp"); + tear_down_attribute_test(testdirA); + set_up_attribute_test(testdirA); - GetTempFileNameA( dirnameA, hiddenfileA, 1, hiddenpathA ); - hiddenh = CreateFileA(hiddenpathA, GENERIC_READ | GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_HIDDEN | FILE_FLAG_DELETE_ON_CLOSE, 0); - ok( hiddenh != INVALID_HANDLE_VALUE, "failed to create hidden temp file '%s'\n", hiddenpathA ); - - GetTempFileNameA( dirnameA, systemfileA, 2, systempathA ); - systemh = CreateFileA(systempathA, GENERIC_READ | GENERIC_WRITE, 0, NULL, - CREATE_ALWAYS, FILE_ATTRIBUTE_SYSTEM | FILE_FLAG_DELETE_ON_CLOSE, 0); - ok( systemh != INVALID_HANDLE_VALUE, "failed to create sys temp file '%s'\n", systempathA ); - if (normalh == INVALID_HANDLE_VALUE || hiddenh == INVALID_HANDLE_VALUE || systemh == INVALID_HANDLE_VALUE) - { - skip("can't test if we can't create files\n"); - goto done; - } - - pRtlMultiByteToUnicodeN(dirnameW, sizeof(dirnameW), NULL, dirnameA, strlen(dirnameA)+1); - if (!pRtlDosPathNameToNtPathName_U(dirnameW, &ntdirname, NULL, NULL)) + /* Read the directory and note which files are found */ + pRtlMultiByteToUnicodeN(testdirW, sizeof(testdirW), NULL, testdirA, strlen(testdirA)+1); + if (!pRtlDosPathNameToNtPathName_U(testdirW, &ntdirname, NULL, NULL)) { ok(0,"RtlDosPathNametoNtPathName_U failed\n"); goto done; } - /* Now read the directory and make sure both are found */ InitializeObjectAttributes(&attr, &ntdirname, 0, 0, NULL); status = pNtOpenFile( &dirh, SYNCHRONIZE | FILE_LIST_DIRECTORY, &attr, &io, FILE_OPEN, FILE_SYNCHRONOUS_IO_NONALERT|FILE_OPEN_FOR_BACKUP_INTENT|FILE_DIRECTORY_FILE); - ok (status == STATUS_SUCCESS, "failed to open dir '%s', ret 0x%x, error %d\n", dirnameA, status, GetLastError()); + ok (status == STATUS_SUCCESS, "failed to open dir '%s', ret 0x%x, error %d\n", testdirA, status, GetLastError()); if (status != STATUS_SUCCESS) { skip("can't test if we can't open the directory\n"); goto done; @@ -136,38 +188,13 @@ static void test_NtQueryDirectoryFile(void) data_len = io.Information; ok (data_len >= sizeof(FILE_BOTH_DIRECTORY_INFORMATION), "not enough data in directory\n"); - normal_found = hidden_found = system_found = 0; - data_pos = 0; numfiles = 0; - while ((data_pos < data_len) && (numfiles < 5)) { - DWORD attrib; + while ((data_pos < data_len) && (numfiles < max_test_dir_size)) { dir_info = (FILE_BOTH_DIRECTORY_INFORMATION *)(data + data_pos); - attrib = dir_info->FileAttributes & (FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN); - switch (dir_info->FileName[0]) { - case '.': - break; - case 'n': - ok(dir_info->FileNameLength == 6*sizeof(WCHAR), "expected six-char name\n"); - ok(attrib == 0, "expected normal file\n"); - ok(normal_found == 0, "too many normal files\n"); - normal_found++; - break; - case 'h': - ok(dir_info->FileNameLength == 6*sizeof(WCHAR), "expected six-char name\n"); - todo_wine ok(attrib == FILE_ATTRIBUTE_HIDDEN, "expected hidden file\n"); - ok(hidden_found == 0, "too many hidden files\n"); - hidden_found++; - break; - case 's': - ok(dir_info->FileNameLength == 6*sizeof(WCHAR), "expected six-char name\n"); - todo_wine ok(attrib == FILE_ATTRIBUTE_SYSTEM, "expected system file\n"); - ok(system_found == 0, "too many system files\n"); - system_found++; - break; - default: - ok(FALSE, "unexpected filename found\n"); - } + + tally_test_file(dir_info); + if (dir_info->NextEntryOffset == 0) { pNtQueryDirectoryFile( dirh, 0, NULL, NULL, &io, data, sizeof(data), FileBothDirectoryInformation, FALSE, NULL, FALSE ); @@ -183,17 +210,15 @@ static void test_NtQueryDirectoryFile(void) } numfiles++; } - ok(numfiles < 5, "too many loops\n"); - ok(normal_found > 0, "no normal files found\n"); - ok(hidden_found > 0, "no hidden files found\n"); - ok(system_found > 0, "no system files found\n"); + ok(numfiles < max_test_dir_size, "too many loops\n"); + + for (i=0; testfiles[i].name; i++) + ok(testfiles[i].nfound == 1, "Wrong number %d of %s files found\n", + testfiles[i].nfound, testfiles[i].description); pNtClose(dirh); done: - CloseHandle(normalh); - CloseHandle(hiddenh); - CloseHandle(systemh); - RemoveDirectoryA(dirnameA); + tear_down_attribute_test(testdirA); } START_TEST(directory) diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c index ff61a2b6470..55b449825c1 100644 --- a/dlls/ntdll/tests/info.c +++ b/dlls/ntdll/tests/info.c @@ -23,6 +23,9 @@ static NTSTATUS (WINAPI * pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG); static NTSTATUS (WINAPI * pNtQueryInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG, PULONG); +static NTSTATUS (WINAPI * pNtQueryInformationThread)(HANDLE, THREADINFOCLASS, PVOID, ULONG, PULONG); +static NTSTATUS (WINAPI * pNtSetInformationProcess)(HANDLE, PROCESSINFOCLASS, PVOID, ULONG); +static NTSTATUS (WINAPI * pNtSetInformationThread)(HANDLE, THREADINFOCLASS, PVOID, ULONG); static NTSTATUS (WINAPI * pNtReadVirtualMemory)(HANDLE, const void*, void*, SIZE_T, SIZE_T*); /* one_before_last_pid is used to be able to compare values of a still running process @@ -50,6 +53,9 @@ static BOOL InitFunctionPtrs(void) NTDLL_GET_PROC(NtQuerySystemInformation); NTDLL_GET_PROC(NtQueryInformationProcess); + NTDLL_GET_PROC(NtQueryInformationThread); + NTDLL_GET_PROC(NtSetInformationProcess); + NTDLL_GET_PROC(NtSetInformationThread); NTDLL_GET_PROC(NtReadVirtualMemory); return TRUE; @@ -884,6 +890,79 @@ static void test_readvirtualmemory(void) CloseHandle(process); } +static void test_affinity(void) +{ + NTSTATUS status; + PROCESS_BASIC_INFORMATION pbi; + DWORD_PTR proc_affinity, thread_affinity; + THREAD_BASIC_INFORMATION tbi; + SYSTEM_INFO si; + + GetSystemInfo(&si); + status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi), NULL ); + ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + proc_affinity = (DWORD_PTR)pbi.Reserved2[0]; + ok( proc_affinity == (1 << si.dwNumberOfProcessors) - 1, "Unexpected process affinity\n" ); + proc_affinity = 1 << si.dwNumberOfProcessors; + status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) ); + ok( status == STATUS_INVALID_PARAMETER, + "Expected STATUS_INVALID_PARAMETER, got %08x\n", status); + + proc_affinity = 0; + status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) ); + ok( status == STATUS_INVALID_PARAMETER, + "Expected STATUS_INVALID_PARAMETER, got %08x\n", status); + + status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL ); + ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + ok( tbi.AffinityMask == (1 << si.dwNumberOfProcessors) - 1, "Unexpected thread affinity\n" ); + thread_affinity = 1 << si.dwNumberOfProcessors; + status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) ); + ok( status == STATUS_INVALID_PARAMETER, + "Expected STATUS_INVALID_PARAMETER, got %08x\n", status); + thread_affinity = 0; + status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) ); + ok( status == STATUS_INVALID_PARAMETER, + "Expected STATUS_INVALID_PARAMETER, got %08x\n", status); + + thread_affinity = 1; + status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) ); + ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL ); + ok( tbi.AffinityMask == 1, "Unexpected thread affinity\n" ); + + if (si.dwNumberOfProcessors <= 1) + { + skip("only one processor, skipping affinity testing\n"); + return; + } + proc_affinity = 2; + status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) ); + ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + status = pNtQueryInformationProcess( GetCurrentProcess(), ProcessBasicInformation, &pbi, sizeof(pbi), NULL ); + ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + proc_affinity = (DWORD_PTR)pbi.Reserved2[0]; + ok( proc_affinity == 2, "Unexpected process affinity\n" ); + /* Setting the process affinity changes the thread affinity to match */ + status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL ); + ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + ok( tbi.AffinityMask == 2, "Unexpected thread affinity\n" ); + /* The thread affinity is restricted to the process affinity */ + thread_affinity = 1; + status = pNtSetInformationThread( GetCurrentThread(), ThreadAffinityMask, &thread_affinity, sizeof(thread_affinity) ); + ok( status == STATUS_INVALID_PARAMETER, + "Expected STATUS_INVALID_PARAMETER, got %08x\n", status); + + proc_affinity = (1 << si.dwNumberOfProcessors) - 1; + status = pNtSetInformationProcess( GetCurrentProcess(), ProcessAffinityMask, &proc_affinity, sizeof(proc_affinity) ); + ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + /* Resetting the process affinity also resets the thread affinity */ + status = pNtQueryInformationThread( GetCurrentThread(), ThreadBasicInformation, &tbi, sizeof(tbi), NULL ); + ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status); + ok( tbi.AffinityMask == (1 << si.dwNumberOfProcessors) - 1, + "Unexpected thread affinity" ); +} + START_TEST(info) { if(!InitFunctionPtrs()) @@ -968,4 +1047,7 @@ START_TEST(info) /* belongs into it's own file */ trace("Starting test_readvirtualmemory()\n"); test_readvirtualmemory(); + + trace("Starting test_affinity()\n"); + test_affinity(); } diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 07e063a51f6..dab1c1de222 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -1216,6 +1216,7 @@ NTSTATUS WINAPI NtSetInformationThread( HANDLE handle, THREADINFOCLASS class, const ULONG_PTR *paff = data; if (length != sizeof(ULONG_PTR)) return STATUS_INVALID_PARAMETER; if (*paff & ~affinity_mask) return STATUS_INVALID_PARAMETER; + if (!*paff) return STATUS_INVALID_PARAMETER; SERVER_START_REQ( set_thread_info ) { req->handle = wine_server_obj_handle( handle ); diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 6e3e1e1d978..90823347039 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -3713,7 +3713,6 @@ static void StorageInternalImpl_Destroy( StorageBaseImpl *iface) { StorageInternalImpl* This = (StorageInternalImpl*) iface; - StorageBaseImpl_Release((IStorage*)This->base.ancestorStorage); HeapFree(GetProcessHeap(), 0, This); } @@ -4312,10 +4311,9 @@ static StorageInternalImpl* StorageInternalImpl_Construct( newStorage->base.openFlags = (openFlags & ~STGM_CREATE); /* - * Keep the ancestor storage pointer and nail a reference to it. + * Keep the ancestor storage pointer but do not nail a reference to it. */ newStorage->base.ancestorStorage = ancestorStorage; - StorageBaseImpl_AddRef((IStorage*)(newStorage->base.ancestorStorage)); /* * Keep the index of the root property set for this storage, diff --git a/dlls/ole32/tests/clipboard.c b/dlls/ole32/tests/clipboard.c index e58ac029237..626d244c073 100644 --- a/dlls/ole32/tests/clipboard.c +++ b/dlls/ole32/tests/clipboard.c @@ -477,8 +477,6 @@ static void test_get_clipboard(void) hr = IDataObject_QueryGetData(data_obj, &fmtetc); ok(hr == DV_E_FORMATETC || broken(hr == S_OK), "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr); - if (hr == S_OK) - ReleaseStgMedium(&stgmedium); InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL); fmtetc.cfFormat = CF_RIFF; @@ -499,19 +497,19 @@ static void test_get_clipboard(void) InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL); hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium); ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08x\n", hr); - ReleaseStgMedium(&stgmedium); + if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium); InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL); fmtetc.dwAspect = 0xdeadbeef; hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium); ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08x\n", hr); - ReleaseStgMedium(&stgmedium); + if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium); InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL); fmtetc.dwAspect = DVASPECT_THUMBNAIL; hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium); ok(hr == S_OK, "IDataObject_GetData failed with error 0x%08x\n", hr); - ReleaseStgMedium(&stgmedium); + if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium); InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL); fmtetc.lindex = 256; @@ -528,11 +526,13 @@ static void test_get_clipboard(void) fmtetc.cfFormat = CF_RIFF; hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium); ok(hr == DV_E_FORMATETC, "IDataObject_GetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr); + if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium); InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL); fmtetc.tymed = TYMED_FILE; hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium); ok(hr == DV_E_TYMED, "IDataObject_GetData should have failed with DV_E_TYMED instead of 0x%08x\n", hr); + if(SUCCEEDED(hr)) ReleaseStgMedium(&stgmedium); ok(DataObjectImpl_GetData_calls == 6, "DataObjectImpl_GetData should have been called 6 times instead of %d times\n", DataObjectImpl_GetData_calls); @@ -967,7 +967,7 @@ static void test_consumer_refs(void) hr = IDataObject_GetData(get1, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(DataObjectImpl_GetData_calls == 0, "GetData called\n"); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); hr = OleGetClipboard(&get2); ok(hr == S_OK, "got %08x\n", hr); @@ -1004,7 +1004,7 @@ static void test_consumer_refs(void) hr = IDataObject_GetData(get1, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(DataObjectImpl_GetData_calls == 1, "GetData not called\n"); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); refs = count_refs(src); ok(refs == old_refs + 1, "%d %d\n", refs, old_refs); @@ -1014,7 +1014,7 @@ static void test_consumer_refs(void) hr = IDataObject_GetData(get1, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(DataObjectImpl_GetData_calls == 1, "GetData not called\n"); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); refs = count_refs(src); ok(refs == 2, "%d\n", refs); @@ -1047,7 +1047,7 @@ static void test_consumer_refs(void) hr = IDataObject_GetData(get1, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(DataObjectImpl_GetData_calls == 1, "GetData not called\n"); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); refs = count_refs(src); ok(refs == 1, "%d\n", refs); @@ -1096,23 +1096,24 @@ static void test_flushed_getdata(void) hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); InitFormatEtc(fmt, CF_TEXT, TYMED_ISTREAM); hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); InitFormatEtc(fmt, CF_TEXT, TYMED_ISTORAGE); hr = IDataObject_GetData(get, &fmt, &med); ok(hr == E_FAIL, "got %08x\n", hr); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); InitFormatEtc(fmt, CF_TEXT, 0xffff); hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); /* stream format -> global & stream */ @@ -1120,23 +1121,24 @@ static void test_flushed_getdata(void) hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); InitFormatEtc(fmt, cf_stream, TYMED_ISTORAGE); hr = IDataObject_GetData(get, &fmt, &med); ok(hr == E_FAIL, "got %08x\n", hr); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); InitFormatEtc(fmt, cf_stream, TYMED_HGLOBAL); hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); InitFormatEtc(fmt, cf_stream, 0xffff); hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); /* storage format -> global, stream & storage */ @@ -1144,34 +1146,36 @@ static void test_flushed_getdata(void) hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed); - hr = IStorage_Stat(med.u.pstg, &stat, STATFLAG_NONAME); - ok(hr == S_OK, "got %08x\n", hr); - ok(stat.grfMode == (STGM_SHARE_EXCLUSIVE | STGM_READWRITE), "got %08x\n", stat.grfMode); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) { + hr = IStorage_Stat(med.u.pstg, &stat, STATFLAG_NONAME); + ok(hr == S_OK, "got %08x\n", hr); + ok(stat.grfMode == (STGM_SHARE_EXCLUSIVE | STGM_READWRITE), "got %08x\n", stat.grfMode); + ReleaseStgMedium(&med); + } InitFormatEtc(fmt, cf_storage, TYMED_ISTREAM); hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_ISTREAM, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); InitFormatEtc(fmt, cf_storage, TYMED_HGLOBAL); hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); InitFormatEtc(fmt, cf_storage, TYMED_HGLOBAL | TYMED_ISTREAM); hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_HGLOBAL, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); InitFormatEtc(fmt, cf_storage, 0xffff); hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); /* complex format with target device */ @@ -1180,7 +1184,7 @@ static void test_flushed_getdata(void) ok(hr == DV_E_FORMATETC || broken(hr == S_OK), /* win9x, winme & nt4 */ "got %08x\n", hr); - if(hr == S_OK) ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); InitFormatEtc(fmt, cf_another, 0xffff); memset(&dm, 0, sizeof(dm)); @@ -1199,7 +1203,7 @@ static void test_flushed_getdata(void) hr = IDataObject_GetData(get, &fmt, &med); ok(hr == S_OK, "got %08x\n", hr); ok(med.tymed == TYMED_ISTORAGE, "got %x\n", med.tymed); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); HeapFree(GetProcessHeap(), 0, fmt.ptd); @@ -1356,7 +1360,7 @@ static void test_nonole_clipboard(void) ok(hr == S_OK, "got %08x\n", hr); obj_type = GetObjectType(U(med).hEnhMetaFile); ok(obj_type == OBJ_ENHMETAFILE, "got %d\n", obj_type); - ReleaseStgMedium(&med); + if(SUCCEEDED(hr)) ReleaseStgMedium(&med); IDataObject_Release(get); diff --git a/dlls/ole32/tests/storage32.c b/dlls/ole32/tests/storage32.c index fec854e5c28..620e6cba14c 100644 --- a/dlls/ole32/tests/storage32.c +++ b/dlls/ole32/tests/storage32.c @@ -1470,6 +1470,45 @@ static void test_fmtusertypestg(void) } } +static void test_references(void) +{ + IStorage *stg,*stg2; + HRESULT hr; + unsigned c1,c2; + static const WCHAR StorName[] = { 'D','a','t','a','S','p','a','c','e','I','n','f','o',0 }; + + DeleteFileA(filenameA); + + hr = StgCreateDocfile( filename, STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE |STGM_TRANSACTED, 0, &stg); + ok(hr==S_OK, "StgCreateDocfile failed\n"); + + if (SUCCEEDED(hr)) + { + IStorage_Release(stg); + + hr = StgOpenStorage( filename, NULL, STGM_TRANSACTED | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, NULL, 0, &stg); + ok(hr==S_OK, "StgOpenStorage failed (result=%x)\n",hr); + + if (SUCCEEDED(hr)) + { + hr = IStorage_CreateStorage(stg,StorName,STGM_READWRITE | STGM_SHARE_EXCLUSIVE,0,0,&stg2); + ok(hr == S_OK, "IStorage_CreateStorage failed (result=%x)\n",hr); + + if (SUCCEEDED(hr)) + { + c1 = IStorage_AddRef(stg); + ok(c1 == 2, "creating internal storage added references to ancestor\n"); + c1 = IStorage_AddRef(stg); + IStorage_Release(stg2); + c2 = IStorage_AddRef(stg) - 1; + ok(c1 == c2, "releasing internal storage removed references to ancestor\n"); + } + c1 = IStorage_Release(stg); + while ( c1 ) c1 = IStorage_Release(stg); + } + } +} + START_TEST(storage32) { CHAR temp[MAX_PATH]; @@ -1497,4 +1536,5 @@ START_TEST(storage32) test_readonly(); test_simple(); test_fmtusertypestg(); + test_references(); } diff --git a/dlls/oleaut32/tests/olefont.c b/dlls/oleaut32/tests/olefont.c index 8e26a0ff505..b457f3604e8 100644 --- a/dlls/oleaut32/tests/olefont.c +++ b/dlls/oleaut32/tests/olefont.c @@ -57,9 +57,9 @@ static HRESULT (WINAPI *pOleCreateFontIndirect)(LPFONTDESC,REFIID,LPVOID*); /* check that resulting hfont has height hfont_height. */ /* Various checks along the way. */ -static void test_ifont_sizes(long lo_size, long hi_size, - long ratio_logical, long ratio_himetric, - long hfont_height, const char * test_name) +static void test_ifont_sizes(LONG lo_size, LONG hi_size, + LONG ratio_logical, LONG ratio_himetric, + LONG hfont_height, const char * test_name) { FONTDESC fd; LPVOID pvObj = NULL; @@ -91,8 +91,8 @@ static void test_ifont_sizes(long lo_size, long hi_size, ok(hres == S_OK,"%s: IFont_get_size returns 0x%08x instead of S_OK.\n", test_name, hres); ok(S(psize).Lo == lo_size && S(psize).Hi == 0, - "%s: get_Size: Lo=%d, Hi=%d; expected Lo=%ld, Hi=%ld.\n", - test_name, S(psize).Lo, S(psize).Hi, lo_size, 0L); + "%s: get_Size: Lo=%d, Hi=%d; expected Lo=%d, Hi=0.\n", + test_name, S(psize).Lo, S(psize).Hi, lo_size); /* Change ratio, check size unchanged. Standard is 72, 2540. */ hres = IFont_SetRatio(ifnt, ratio_logical, ratio_himetric); @@ -102,8 +102,8 @@ static void test_ifont_sizes(long lo_size, long hi_size, ok(hres == S_OK,"%s: IFont_get_size returns 0x%08x instead of S_OK.\n", test_name, hres); ok(S(psize).Lo == lo_size && S(psize).Hi == 0, - "%s: gS after SR: Lo=%d, Hi=%d; expected Lo=%ld, Hi=%ld.\n", - test_name, S(psize).Lo, S(psize).Hi, lo_size, 0L); + "%s: gS after SR: Lo=%d, Hi=%d; expected Lo=%d, Hi=0.\n", + test_name, S(psize).Lo, S(psize).Hi, lo_size); /* Check hFont size with this ratio. This tests an important */ /* conversion for which MSDN is very wrong. */ @@ -112,7 +112,7 @@ static void test_ifont_sizes(long lo_size, long hi_size, test_name, hres); hres = GetObject (hfont, sizeof(LOGFONT), &lf); ok(lf.lfHeight == hfont_height, - "%s: hFont has lf.lfHeight=%d, expected %ld.\n", + "%s: hFont has lf.lfHeight=%d, expected %d.\n", test_name, lf.lfHeight, hfont_height); /* Free IFont. */ diff --git a/dlls/oledb32/convert.c b/dlls/oledb32/convert.c index c1e99be1b98..ad863983ae6 100644 --- a/dlls/oledb32/convert.c +++ b/dlls/oledb32/convert.c @@ -129,6 +129,7 @@ static int get_length(DBTYPE type) case DBTYPE_BSTR: return sizeof(BSTR); case DBTYPE_WSTR: + case DBTYPE_BYREF | DBTYPE_WSTR: return 0; default: FIXME("Unhandled type %04x\n", type); @@ -312,6 +313,26 @@ static HRESULT WINAPI convert_DataConvert(IDataConvert* iface, return hr; } + case DBTYPE_BYREF | DBTYPE_WSTR: + { + BSTR b; + WCHAR **d = dst; + DBLENGTH bstr_len; + hr = IDataConvert_DataConvert(iface, src_type, DBTYPE_BSTR, src_len, &bstr_len, + src, &b, sizeof(BSTR), src_status, dst_status, + precision, scale, flags); + if(hr != S_OK) return hr; + + bstr_len = SysStringLen(b) * sizeof(WCHAR); + *dst_len = bstr_len; /* Doesn't include size for '\0' */ + + *d = CoTaskMemAlloc(bstr_len + sizeof(WCHAR)); + if(*d) memcpy(*d, b, bstr_len + sizeof(WCHAR)); + else hr = E_OUTOFMEMORY; + SysFreeString(b); + return hr; + } + default: FIXME("Unimplemented conversion %04x -> %04x\n", src_type, dst_type); return E_NOTIMPL; diff --git a/dlls/oledb32/tests/convert.c b/dlls/oledb32/tests/convert.c index 376a8cc6b13..a1378cf1341 100644 --- a/dlls/oledb32/tests/convert.c +++ b/dlls/oledb32/tests/convert.c @@ -1023,6 +1023,94 @@ static void test_converttowstr(void) IDataConvert_Release(convert); } +static void test_converttobyrefwstr(void) +{ + IDataConvert *convert; + HRESULT hr; + WCHAR *dst; + BYTE src[20]; + DBSTATUS dst_status; + DBLENGTH dst_len; + static const WCHAR ten[] = {'1','0',0}; + static const WCHAR fourthreetwoone[] = {'4','3','2','1',0}; + BSTR b; + + hr = CoCreateInstance(&CLSID_OLEDB_CONVERSIONLIBRARY, NULL, CLSCTX_INPROC_SERVER, &IID_IDataConvert, (void**)&convert); + if(FAILED(hr)) + { + win_skip("Unable to load oledb conversion library\n"); + return; + } + + hr = IDataConvert_DataConvert(convert, DBTYPE_EMPTY, DBTYPE_BYREF | DBTYPE_WSTR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == 0, "got %d\n", dst_len); + ok(dst[0] == 0, "got %04x\n", dst[0]); + CoTaskMemFree(dst); + + dst = (void*)0x12345678; + hr = IDataConvert_DataConvert(convert, DBTYPE_NULL, DBTYPE_BYREF | DBTYPE_WSTR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == DB_E_UNSUPPORTEDCONVERSION, "got %08x\n", hr); + ok(dst_status == DBSTATUS_E_BADACCESSOR, "got %08x\n", dst_status); + ok(dst_len == 0, "got %d\n", dst_len); + ok(dst == (void*)0x12345678, "got %p\n", dst); + + *(short *)src = 4321; + hr = IDataConvert_DataConvert(convert, DBTYPE_I2, DBTYPE_BYREF | DBTYPE_WSTR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == 8, "got %d\n", dst_len); + ok(!lstrcmpW(dst, fourthreetwoone), "got %s\n", wine_dbgstr_w(dst)); + CoTaskMemFree(dst); + + *(short *)src = 4321; + hr = IDataConvert_DataConvert(convert, DBTYPE_I2, DBTYPE_BYREF | DBTYPE_WSTR, 0, &dst_len, src, &dst, 0, 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == 8, "got %d\n", dst_len); + ok(!lstrcmpW(dst, fourthreetwoone), "got %s\n", wine_dbgstr_w(dst)); + CoTaskMemFree(dst); + + b = SysAllocString(ten); + *(BSTR *)src = b; + hr = IDataConvert_DataConvert(convert, DBTYPE_BSTR, DBTYPE_BYREF | DBTYPE_WSTR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == 4, "got %d\n", dst_len); + ok(!lstrcmpW(b, dst), "got %s\n", wine_dbgstr_w(dst)); + CoTaskMemFree(dst); + SysFreeString(b); + + memcpy(src, ten, sizeof(ten)); + hr = IDataConvert_DataConvert(convert, DBTYPE_WSTR, DBTYPE_BYREF | DBTYPE_WSTR, 2, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == 2, "got %d\n", dst_len); + ok(dst[0] == '1', "got %02x\n", dst[0]); + ok(dst[1] == 0, "got %02x\n", dst[1]); + CoTaskMemFree(dst); + + memcpy(src, ten, sizeof(ten)); + hr = IDataConvert_DataConvert(convert, DBTYPE_WSTR, DBTYPE_BYREF | DBTYPE_WSTR, 4, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, 0); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == 4, "got %d\n", dst_len); + ok(!lstrcmpW(ten, dst), "got %s\n", wine_dbgstr_w(dst)); + CoTaskMemFree(dst); + + memcpy(src, ten, sizeof(ten)); + hr = IDataConvert_DataConvert(convert, DBTYPE_WSTR, DBTYPE_BYREF | DBTYPE_WSTR, 0, &dst_len, src, &dst, sizeof(dst), 0, &dst_status, 0, 0, DBDATACONVERT_LENGTHFROMNTS); + ok(hr == S_OK, "got %08x\n", hr); + ok(dst_status == DBSTATUS_S_OK, "got %08x\n", dst_status); + ok(dst_len == 4, "got %d\n", dst_len); + ok(!lstrcmpW(ten, dst), "got %s\n", wine_dbgstr_w(dst)); + CoTaskMemFree(dst); + + IDataConvert_Release(convert); +} + + START_TEST(convert) { OleInitialize(NULL); @@ -1032,5 +1120,6 @@ START_TEST(convert) test_converttoi4(); test_converttobstr(); test_converttowstr(); + test_converttobyrefwstr(); OleUninitialize(); } diff --git a/dlls/openal32/openal.c b/dlls/openal32/openal.c index 792a87018e5..88bfc9c6bec 100644 --- a/dlls/openal32/openal.c +++ b/dlls/openal32/openal.c @@ -289,6 +289,12 @@ ALCdevice* CDECL wine_alcGetContextsDevice(ALCcontext *context) ALCdevice* CDECL wine_alcOpenDevice(const ALCchar *devicename) { + if(devicename != NULL && (strcmp(devicename, "DirectSound3D") == 0 || + strcmp(devicename, "DirectSound") == 0 || + strcmp(devicename, "Generic Hardware") == 0 || + strcmp(devicename, "Generic Software") == 0)) { + devicename = NULL; + } return alcOpenDevice(devicename); } diff --git a/dlls/opengl32/tests/opengl.c b/dlls/opengl32/tests/opengl.c index 96df7849e0d..13e41fd2cae 100644 --- a/dlls/opengl32/tests/opengl.c +++ b/dlls/opengl32/tests/opengl.c @@ -48,7 +48,7 @@ static int (WINAPI *pwglReleasePbufferDCARB)(HPBUFFERARB, HDC); /* WGL_ARB_make_current_read */ static BOOL (WINAPI *pwglMakeContextCurrentARB)(HDC hdraw, HDC hread, HGLRC hglrc); -static HDC (WINAPI *pwglGetCurrentReadDCARB)(); +static HDC (WINAPI *pwglGetCurrentReadDCARB)(void); /* WGL_ARB_pixel_format */ #define WGL_ACCELERATION_ARB 0x2003 diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index fdcb924c172..500b6c755ec 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -1537,6 +1537,8 @@ void ME_SendSelChange(ME_TextEditor *editor) if (!(editor->nEventMask & ENM_SELCHANGE)) return; + sc.nmhdr.hwndFrom = NULL; + sc.nmhdr.idFrom = 0; sc.nmhdr.code = EN_SELCHANGE; ME_GetSelectionOfs(editor, &sc.chrg.cpMin, &sc.chrg.cpMax); sc.seltyp = SEL_EMPTY; diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 09e3de66647..11d4925df5c 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -2035,14 +2035,14 @@ ME_FilterEvent(ME_TextEditor *editor, UINT msg, WPARAM* wParam, LPARAM* lParam) { MSGFILTER msgf; - if (!editor->hWnd) return FALSE; + if (!editor->hWnd || !editor->hwndParent) return FALSE; msgf.nmhdr.hwndFrom = editor->hWnd; msgf.nmhdr.idFrom = GetWindowLongW(editor->hWnd, GWLP_ID); msgf.nmhdr.code = EN_MSGFILTER; msgf.msg = msg; msgf.wParam = *wParam; msgf.lParam = *lParam; - if (SendMessageW(GetParent(editor->hWnd), WM_NOTIFY, msgf.nmhdr.idFrom, (LPARAM)&msgf)) + if (SendMessageW(editor->hwndParent, WM_NOTIFY, msgf.nmhdr.idFrom, (LPARAM)&msgf)) return FALSE; *wParam = msgf.wParam; *lParam = msgf.lParam; @@ -2598,7 +2598,7 @@ static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y) } if(SUCCEEDED(IRichEditOleCallback_GetContextMenu(editor->lpOleCallback, seltype, NULL, &selrange, &menu))) { - TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, GetParent(editor->hWnd), NULL); + TrackPopupMenu(menu, TPM_LEFTALIGN | TPM_RIGHTBUTTON, x, y, 0, editor->hwndParent, NULL); DestroyMenu(menu); } return TRUE; @@ -2612,6 +2612,7 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) LONG selbarwidth; ed->hWnd = NULL; + ed->hwndParent = NULL; ed->texthost = texthost; ed->bEmulateVersion10 = bEmulateVersion10; ITextHost_TxGetPropertyBits(texthost, @@ -2941,8 +2942,8 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM if (cursor.pRun->member.run.style->fmt.dwMask & CFM_LINK && cursor.pRun->member.run.style->fmt.dwEffects & CFE_LINK) { /* The clicked run has CFE_LINK set */ - info.nmhdr.hwndFrom = editor->hWnd; - info.nmhdr.idFrom = GetWindowLongW(editor->hWnd, GWLP_ID); + info.nmhdr.hwndFrom = NULL; + info.nmhdr.idFrom = 0; info.nmhdr.code = EN_LINK; info.msg = msg; info.wParam = wParam; @@ -2950,7 +2951,7 @@ static void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM cursor.nOffset = 0; info.chrg.cpMin = ME_GetCursorOfs(&cursor); info.chrg.cpMax = info.chrg.cpMin + cursor.pRun->member.run.strText->nLen; - SendMessageW(GetParent(editor->hWnd), WM_NOTIFY,info.nmhdr.idFrom, (LPARAM)&info); + ITextHost_TxNotify(editor->texthost, info.nmhdr.code, &info); } } @@ -4369,7 +4370,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ITextHost *texthost; TRACE("WM_NCCREATE: hWnd %p style 0x%08x\n", hWnd, pcs->style); - texthost = ME_CreateTextHost(hWnd, FALSE); + texthost = ME_CreateTextHost(hWnd, pcs, FALSE); return texthost != NULL; } else if (msg != WM_NCDESTROY) @@ -4499,7 +4500,7 @@ LRESULT WINAPI RichEdit10ANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM CREATESTRUCTW *pcs = (CREATESTRUCTW *)lParam; TRACE("WM_NCCREATE: hWnd %p style 0x%08x\n", hWnd, pcs->style); - texthost = ME_CreateTextHost(hWnd, TRUE); + texthost = ME_CreateTextHost(hWnd, pcs, TRUE); return texthost != NULL; } return RichEditANSIWndProc(hWnd, msg, wParam, lParam); diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h index 7edd86f72c4..8a5304baa01 100644 --- a/dlls/riched20/editor.h +++ b/dlls/riched20/editor.h @@ -271,7 +271,7 @@ struct RTFTable *ME_MakeTableDef(ME_TextEditor *editor); void ME_InitTableDef(ME_TextEditor *editor, struct RTFTable *tableDef); /* txthost.c */ -ITextHost *ME_CreateTextHost(HWND hwnd, BOOL bEmulateVersion10); +ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10); #ifdef __i386__ /* Use wrappers to perform thiscall on i386 */ #define TXTHOST_VTABLE(This) (&itextHostStdcallVtbl) #else /* __i386__ */ diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index 6258a638b18..115662cb7b0 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -326,7 +326,7 @@ typedef struct tagME_FontCacheItem typedef struct tagME_TextEditor { - HWND hWnd; + HWND hWnd, hwndParent; ITextHost *texthost; BOOL bEmulateVersion10; ME_TextBuffer *pBuffer; diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index ce164b37b06..15ac461971b 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -5639,6 +5639,7 @@ static void test_eventMask(void) static int received_WM_NOTIFY = 0; static int modify_at_WM_NOTIFY = 0; +static BOOL filter_on_WM_NOTIFY = FALSE; static HWND hwndRichedit_WM_NOTIFY; static LRESULT WINAPI WM_NOTIFY_ParentMsgCheckProcA(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) @@ -5647,6 +5648,7 @@ static LRESULT WINAPI WM_NOTIFY_ParentMsgCheckProcA(HWND hwnd, UINT message, WPA { received_WM_NOTIFY = 1; modify_at_WM_NOTIFY = SendMessage(hwndRichedit_WM_NOTIFY, EM_GETMODIFY, 0, 0); + if (filter_on_WM_NOTIFY) return TRUE; } return DefWindowProcA(hwnd, message, wParam, lParam); } @@ -5656,6 +5658,7 @@ static void test_WM_NOTIFY(void) HWND parent; WNDCLASSA cls; CHARFORMAT2 cf2; + int sel_start, sel_end; /* register class to capture WM_NOTIFY */ cls.style = 0; @@ -5718,6 +5721,29 @@ static void test_WM_NOTIFY(void) ok(received_WM_NOTIFY == 1, "Expected WM_NOTIFY was NOT sent!\n"); SendMessage(hwndRichedit_WM_NOTIFY, WM_SETREDRAW, TRUE, 0); + /* Test filtering key events. */ + SendMessage(hwndRichedit_WM_NOTIFY, EM_SETSEL, 0, 0); + SendMessage(hwndRichedit_WM_NOTIFY, EM_SETEVENTMASK, 0, ENM_KEYEVENTS); + SendMessage(hwndRichedit_WM_NOTIFY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end); + received_WM_NOTIFY = 0; + SendMessage(hwndRichedit_WM_NOTIFY, WM_KEYDOWN, VK_RIGHT, 0); + SendMessage(hwndRichedit_WM_NOTIFY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end); + ok(sel_start == 1 && sel_end == 1, + "selections is incorrectly at (%d,%d)\n", sel_start, sel_end); + filter_on_WM_NOTIFY = TRUE; + received_WM_NOTIFY = 0; + SendMessage(hwndRichedit_WM_NOTIFY, WM_KEYDOWN, VK_RIGHT, 0); + SendMessage(hwndRichedit_WM_NOTIFY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end); + ok(sel_start == 1 && sel_end == 1, + "selections is incorrectly at (%d,%d)\n", sel_start, sel_end); + + /* test with owner set to NULL */ + SetWindowLongPtr(hwndRichedit_WM_NOTIFY, GWLP_HWNDPARENT, 0); + SendMessage(hwndRichedit_WM_NOTIFY, WM_KEYDOWN, VK_RIGHT, 0); + SendMessage(hwndRichedit_WM_NOTIFY, EM_GETSEL, (WPARAM)&sel_start, (LPARAM)&sel_end); + ok(sel_start == 1 && sel_end == 1, + "selections is incorrectly at (%d,%d)\n", sel_start, sel_end); + DestroyWindow(hwndRichedit_WM_NOTIFY); DestroyWindow(parent); } diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c index 0ccb1777526..950d200251a 100644 --- a/dlls/riched20/txthost.c +++ b/dlls/riched20/txthost.c @@ -44,7 +44,7 @@ typedef struct ITextHostImpl { static const ITextHostVtbl textHostVtbl; -ITextHost *ME_CreateTextHost(HWND hwnd, BOOL bEmulateVersion10) +ITextHost *ME_CreateTextHost(HWND hwnd, CREATESTRUCTW *cs, BOOL bEmulateVersion10) { ITextHostImpl *texthost; texthost = CoTaskMemAlloc(sizeof(*texthost)); @@ -60,6 +60,7 @@ ITextHost *ME_CreateTextHost(HWND hwnd, BOOL bEmulateVersion10) editor = ME_MakeEditor((ITextHost*)texthost, bEmulateVersion10); editor->exStyleFlags = GetWindowLongW(hwnd, GWL_EXSTYLE); editor->hWnd = hwnd; /* FIXME: Remove editor's dependence on hWnd */ + editor->hwndParent = cs->hwndParent; SetWindowLongPtrW(hwnd, 0, (LONG_PTR)editor); } @@ -448,9 +449,13 @@ HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface, void *pv) { ITextHostImpl *This = (ITextHostImpl *)iface; + ME_TextEditor *editor = (ME_TextEditor*)GetWindowLongPtrW(This->hWnd, 0); HWND hwnd = This->hWnd; - HWND parent = GetParent(hwnd); - UINT id = GetWindowLongW(hwnd, GWLP_ID); + UINT id; + + if (!editor || !editor->hwndParent) return S_OK; + + id = GetWindowLongW(hwnd, GWLP_ID); switch (iNotify) { @@ -471,13 +476,13 @@ HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface, info->hwndFrom = hwnd; info->idFrom = id; info->code = iNotify; - SendMessageW(parent, WM_NOTIFY, id, (LPARAM)info); + SendMessageW(editor->hwndParent, WM_NOTIFY, id, (LPARAM)info); break; } case EN_UPDATE: /* Only sent when the window is visible. */ - if (!IsWindowVisible(This->hWnd)) + if (!IsWindowVisible(hwnd)) break; /* Fall through */ case EN_CHANGE: @@ -487,7 +492,7 @@ HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface, case EN_MAXTEXT: case EN_SETFOCUS: case EN_VSCROLL: - SendMessageW(parent, WM_COMMAND, MAKEWPARAM(id, iNotify), (LPARAM)hwnd); + SendMessageW(editor->hwndParent, WM_COMMAND, MAKEWPARAM(id, iNotify), (LPARAM)hwnd); break; case EN_MSGFILTER: diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index 579f33ae19f..00229b223db 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -776,6 +776,8 @@ ME_SendRequestResize(ME_TextEditor *editor, BOOL force) { REQRESIZE info; + info.nmhdr.hwndFrom = NULL; + info.nmhdr.idFrom = 0; info.nmhdr.code = EN_REQUESTRESIZE; info.rc = rc; info.rc.right = editor->nTotalWidth; diff --git a/dlls/secur32/schannel.c b/dlls/secur32/schannel.c index cd204c1ea80..f776206867e 100644 --- a/dlls/secur32/schannel.c +++ b/dlls/secur32/schannel.c @@ -958,8 +958,7 @@ static SECURITY_STATUS SEC_ENTRY schan_QueryContextAttributesW( case SECPKG_ATTR_REMOTE_CERT_CONTEXT: { unsigned int list_size; - const gnutls_datum_t *datum = pgnutls_certificate_get_peers( - ctx->session, &list_size); + const gnutls_datum_t *datum; datum = pgnutls_certificate_get_peers(ctx->session, &list_size); if (datum) @@ -1414,8 +1413,33 @@ fail: void SECUR32_deinitSchannelSP(void) { + int i = schan_handle_table_size; + if (!libgnutls_handle) return; + /* deinitialized sessions first because a pointer to the credentials + * are stored for the session by calling gnutls_credentials_set. */ + while (--i) + { + if (schan_handle_table[i].type == SCHAN_HANDLE_CTX) + { + struct schan_context *ctx = schan_free_handle(i, SCHAN_HANDLE_CTX); + pgnutls_deinit(ctx->session); + HeapFree(GetProcessHeap(), 0, ctx); + } + } + i = schan_handle_table_size; + while (--i) + { + if (schan_handle_table[i].type != SCHAN_HANDLE_FREE) + { + struct schan_credentials *cred; + cred = schan_free_handle(i, SCHAN_HANDLE_CRED); + pgnutls_certificate_free_credentials(cred->credentials); + HeapFree(GetProcessHeap(), 0, cred); + } + } + HeapFree(GetProcessHeap(), 0, schan_handle_table); pgnutls_global_deinit(); wine_dlclose(libgnutls_handle, NULL, 0); } diff --git a/dlls/secur32/tests/schannel.c b/dlls/secur32/tests/schannel.c index 167a0b47d60..82e27db3e84 100644 --- a/dlls/secur32/tests/schannel.c +++ b/dlls/secur32/tests/schannel.c @@ -210,8 +210,15 @@ static void testAcquireSecurityContext(void) certs[1] = pCertCreateCertificateContext(X509_ASN_ENCODING, selfSignedCert, sizeof(selfSignedCert)); - pCryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL, + SetLastError(0xdeadbeef); + ret = pCryptAcquireContextW(&csp, cspNameW, MS_DEF_PROV_W, PROV_RSA_FULL, CRYPT_DELETEKEYSET); + if (!ret && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + /* WinMe would crash on some tests */ + win_skip("CryptAcquireContextW is not implemented\n"); + return; + } st = pAcquireCredentialsHandleA(NULL, NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL); diff --git a/dlls/setupapi/Makefile.in b/dlls/setupapi/Makefile.in index 971a5421ed9..b72c61206db 100644 --- a/dlls/setupapi/Makefile.in +++ b/dlls/setupapi/Makefile.in @@ -23,14 +23,6 @@ C_SRCS = \ stringtable.c \ stubs.c -C_SRCS16 = \ - devinst16.c \ - infparse.c \ - setupx_main.c \ - virtcopy.c - -SPEC_SRCS16 = setupx.spec - RC_SRCS = \ Bg.rc \ Cs.rc \ diff --git a/dlls/setupapi/parser.c b/dlls/setupapi/parser.c index 65a6a037499..37b900fc225 100644 --- a/dlls/setupapi/parser.c +++ b/dlls/setupapi/parser.c @@ -418,8 +418,8 @@ static unsigned int PARSER_string_substW( const struct inf_file *file, const WCH /* do string substitutions on the specified text */ /* the buffer is assumed to be large enough */ /* returns necessary length not including terminating null */ -unsigned int PARSER_string_substA( const struct inf_file *file, const WCHAR *text, char *buffer, - unsigned int size ) +static unsigned int PARSER_string_substA( const struct inf_file *file, const WCHAR *text, + char *buffer, unsigned int size ) { WCHAR buffW[MAX_STRING_LEN+1]; DWORD ret; diff --git a/dlls/setupapi/setupapi_private.h b/dlls/setupapi/setupapi_private.h index 307dbae18dd..e505503c5f0 100644 --- a/dlls/setupapi/setupapi_private.h +++ b/dlls/setupapi/setupapi_private.h @@ -84,8 +84,6 @@ static inline WCHAR *strdupAtoW( const char *str ) struct inf_file; extern const WCHAR *DIRID_get_string( int dirid ); -extern unsigned int PARSER_string_substA( const struct inf_file *file, const WCHAR *text, - char *buffer, unsigned int size ); extern const WCHAR *PARSER_get_inf_filename( HINF hinf ); extern WCHAR *PARSER_get_src_root( HINF hinf ); extern WCHAR *PARSER_get_dest_dir( INFCONTEXT *context ); diff --git a/dlls/setupapi/stubs.c b/dlls/setupapi/stubs.c index 7ba85b6ad89..1b217dbcc6d 100644 --- a/dlls/setupapi/stubs.c +++ b/dlls/setupapi/stubs.c @@ -33,25 +33,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(setupapi); /*********************************************************************** - * TPWriteProfileString (SETUPX.62) - */ -BOOL WINAPI TPWriteProfileString16( LPCSTR section, LPCSTR entry, LPCSTR string ) -{ - FIXME( "%s %s %s: stub\n", debugstr_a(section), debugstr_a(entry), debugstr_a(string) ); - return TRUE; -} - - -/*********************************************************************** - * suErrorToIds (SETUPX.61) - */ -DWORD WINAPI suErrorToIds16( WORD w1, WORD w2 ) -{ - FIXME( "%x %x: stub\n", w1, w2 ); - return 0; -} - -/*********************************************************************** * CM_Connect_MachineA (SETUPAPI.@) */ CONFIGRET WINAPI CM_Connect_MachineA(PCSTR name, PHMACHINE machine) diff --git a/dlls/setupapi/tests/misc.c b/dlls/setupapi/tests/misc.c index 4b8bd0378c3..848f64c08df 100644 --- a/dlls/setupapi/tests/misc.c +++ b/dlls/setupapi/tests/misc.c @@ -198,13 +198,13 @@ static void test_SetupCopyOEMInf(void) SetLastError(0xdeadbeef); res = pSetupCopyOEMInfA(tmpfile, NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL); ok(res == FALSE, "Expected FALSE, got %d\n", res); - if (GetLastError() == ERROR_WRONG_INF_TYPE) + if (GetLastError() == ERROR_WRONG_INF_TYPE || GetLastError() == ERROR_UNSUPPORTED_TYPE /* Win7 */) { /* FIXME: * Vista needs a [Manufacturer] entry in the inf file. Doing this will give some * popups during the installation though as it also needs a catalog file (signed?). */ - win_skip("Needs a different inf file on Vista/W2K8\n"); + win_skip("Needs a different inf file on Vista+\n"); DeleteFile(tmpfile); return; } diff --git a/dlls/setupapi/tests/query.c b/dlls/setupapi/tests/query.c index 0b7883c6289..6e956a2a096 100644 --- a/dlls/setupapi/tests/query.c +++ b/dlls/setupapi/tests/query.c @@ -167,14 +167,15 @@ static void test_SetupGetInfInformation(void) broken(GetLastError() == ERROR_FILE_NOT_FOUND) || /* win98 */ broken(GetLastError() == ERROR_PATH_NOT_FOUND) || /* NT4 */ broken(GetLastError() == ERROR_INVALID_NAME) || /* win2k */ - broken(GetLastError() == ERROR_GENERAL_SYNTAX), /* another win2k */ + broken(GetLastError() == ERROR_GENERAL_SYNTAX), /* another win2k / winMe */ "Expected ERROR_INVALID_HANDLE, got %d\n", GetLastError()); ok(size == 0xdeadbeef, "Expected size to remain unchanged\n"); /* try an invalid inf filename */ - /* do not use NULL as absolute inf filename on win9x (crash) */ + /* do not use NULL as absolute inf filename on win9x/winMe (crash) */ if ((GetLastError() != ERROR_BAD_PATHNAME) && /* win95 */ - (GetLastError() != ERROR_FILE_NOT_FOUND)) /* win98 */ + (GetLastError() != ERROR_FILE_NOT_FOUND) && /* win98 */ + (GetLastError() != ERROR_GENERAL_SYNTAX)) /* winMe */ { size = 0xdeadbeef; SetLastError(0xbeefcafe); diff --git a/dlls/version/Makefile.in b/dlls/setupx.dll16/Makefile.in similarity index 50% copy from dlls/version/Makefile.in copy to dlls/setupx.dll16/Makefile.in index 9fc0fbec52b..78aca1697aa 100644 --- a/dlls/version/Makefile.in +++ b/dlls/setupx.dll16/Makefile.in @@ -2,21 +2,16 @@ TOPSRCDIR = @top_srcdir@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ -MODULE = version.dll -IMPORTLIB = version -IMPORTS = lz32 kernel32 ntdll +MODULE = setupx.dll16 +IMPORTS = setupapi user32 advapi32 kernel32 -C_SRCS = \ - info.c \ - install.c \ - resource.c - -RC_SRCS = version.rc +EXTRADLLFLAGS = -Wb,--subsystem,win16,--main-module,setupapi.dll -C_SRCS16 = \ - ver16.c - -SPEC_SRCS16 = ver.spec +C_SRCS = \ + devinst16.c \ + infparse.c \ + setupx_main.c \ + virtcopy.c @MAKE_DLL_RULES@ diff --git a/dlls/setupapi/devinst16.c b/dlls/setupx.dll16/devinst16.c similarity index 100% rename from dlls/setupapi/devinst16.c rename to dlls/setupx.dll16/devinst16.c diff --git a/dlls/setupapi/infparse.c b/dlls/setupx.dll16/infparse.c similarity index 69% rename from dlls/setupapi/infparse.c rename to dlls/setupx.dll16/infparse.c index d56e45bae4a..d6cbed0085b 100644 --- a/dlls/setupapi/infparse.c +++ b/dlls/setupx.dll16/infparse.c @@ -27,6 +27,7 @@ #include #include +#include #include "windef.h" #include "winbase.h" @@ -37,7 +38,6 @@ #include "winnls.h" #include "setupapi.h" #include "setupx16.h" -#include "setupapi_private.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(setupapi); @@ -96,6 +96,91 @@ static RETERR16 get_last_error(void) } } +/* string substitution support, duplicated from setupapi/parser.c */ + +static const char *get_string_subst( HINF hinf, const char *str, unsigned int *len, + char subst[MAX_INF_STRING_LENGTH], BOOL no_trailing_slash ) +{ + int dirid; + char *end; + INFCONTEXT context; + char buffer[MAX_INF_STRING_LENGTH]; + + if (!*len) /* empty string (%%) is replaced by single percent */ + { + *len = 1; + return "%"; + } + memcpy( buffer, str, *len ); + buffer[*len] = 0; + + if (SetupFindFirstLineA( hinf, "Strings", buffer, &context ) && + SetupGetStringFieldA( &context, 0, subst, MAX_INF_STRING_LENGTH, NULL )) + { + *len = strlen( subst ); + return subst; + } + + /* check for integer id */ + dirid = strtoul( buffer, &end, 10 ); + if (!*end && !CtlGetLddPath16( dirid, subst )) + { + *len = strlen( subst ); + if (no_trailing_slash && *len && subst[*len - 1] == '\\') *len -= 1; + return subst; + } + return NULL; +} + +static unsigned int string_subst( HINF hinf, const char *text, char *buffer ) +{ + const char *start, *subst, *p; + unsigned int len, total = 0; + int inside = 0; + unsigned int size = MAX_INF_STRING_LENGTH; + char tmp[MAX_INF_STRING_LENGTH]; + + for (p = start = text; *p; p++) + { + if (*p != '%') continue; + inside = !inside; + if (inside) /* start of a %xx% string */ + { + len = p - start; + if (len > size - 1) len = size - 1; + if (buffer) memcpy( buffer + total, start, len ); + total += len; + size -= len; + start = p; + } + else /* end of the %xx% string, find substitution */ + { + len = p - start - 1; + subst = get_string_subst( hinf, start + 1, &len, tmp, p[1] == '\\' ); + if (!subst) + { + subst = start; + len = p - start + 1; + } + if (len > size - 1) len = size - 1; + if (buffer) memcpy( buffer + total, subst, len ); + total += len; + size -= len; + start = p + 1; + } + } + + if (start != p) /* unfinished string, copy it */ + { + len = p - start; + if (len > size - 1) len = size - 1; + if (buffer) memcpy( buffer + total, start, len ); + total += len; + } + if (buffer && size) buffer[total] = 0; + return total; +} + /*********************************************************************** * IpOpen (SETUPX.2) @@ -146,14 +231,11 @@ RETERR16 WINAPI IpGetProfileString16( HINF16 hinf16, LPCSTR section, LPCSTR entr */ void WINAPI GenFormStrWithoutPlaceHolders16( LPSTR dst, LPCSTR src, HINF16 hinf16 ) { - UNICODE_STRING srcW; HINF hinf = get_hinf( hinf16 ); if (!hinf) return; - if (!RtlCreateUnicodeStringFromAsciiz( &srcW, src )) return; - PARSER_string_substA( hinf, srcW.Buffer, dst, MAX_INF_STRING_LENGTH ); - RtlFreeUnicodeString( &srcW ); + string_subst( hinf, src, dst ); TRACE( "%s -> %s\n", debugstr_a(src), debugstr_a(dst) ); } diff --git a/dlls/setupapi/setupx.spec b/dlls/setupx.dll16/setupx.dll16.spec similarity index 100% rename from dlls/setupapi/setupx.spec rename to dlls/setupx.dll16/setupx.dll16.spec diff --git a/dlls/setupapi/setupx16.h b/dlls/setupx.dll16/setupx16.h similarity index 100% rename from dlls/setupapi/setupx16.h rename to dlls/setupx.dll16/setupx16.h diff --git a/dlls/setupapi/setupx_main.c b/dlls/setupx.dll16/setupx_main.c similarity index 96% rename from dlls/setupapi/setupx_main.c rename to dlls/setupx.dll16/setupx_main.c index 06903336683..de3a3975327 100644 --- a/dlls/setupapi/setupx_main.c +++ b/dlls/setupx.dll16/setupx_main.c @@ -66,7 +66,6 @@ #include "winnls.h" #include "setupapi.h" #include "setupx16.h" -#include "setupapi_private.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(setupapi); @@ -95,6 +94,24 @@ DWORD WINAPI SURegQueryValueEx( HKEY hkey, LPSTR lpszValueName, lpbData, lpcbData ); } +/*********************************************************************** + * TPWriteProfileString (SETUPX.62) + */ +BOOL WINAPI TPWriteProfileString16( LPCSTR section, LPCSTR entry, LPCSTR string ) +{ + FIXME( "%s %s %s: stub\n", debugstr_a(section), debugstr_a(entry), debugstr_a(string) ); + return TRUE; +} + + +/*********************************************************************** + * suErrorToIds (SETUPX.61) + */ +DWORD WINAPI suErrorToIds16( WORD w1, WORD w2 ) +{ + FIXME( "%x %x: stub\n", w1, w2 ); + return 0; +} /*********************************************************************** * InstallHinfSection (SETUPX.527) diff --git a/dlls/setupapi/virtcopy.c b/dlls/setupx.dll16/virtcopy.c similarity index 97% rename from dlls/setupapi/virtcopy.c rename to dlls/setupx.dll16/virtcopy.c index 2506a6a29bd..a15f1a1d2b1 100644 --- a/dlls/setupapi/virtcopy.c +++ b/dlls/setupx.dll16/virtcopy.c @@ -31,11 +31,20 @@ #include "winnls.h" #include "setupapi.h" #include "setupx16.h" -#include "setupapi_private.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(setupapi); +/* copied from setupapi */ +#define COPYFILEDLGORD 1000 +#define SOURCESTRORD 500 +#define DESTSTRORD 501 +#define PROGRESSORD 502 + +#define REG_INSTALLEDFILES "System\\CurrentControlSet\\Control\\InstalledFiles" +#define REGPART_RENAME "\\Rename" +#define REG_VERSIONCONFLICT "Software\\Microsoft\\VersionConflictManager" + static FARPROC16 VCP_Proc = NULL; static LPARAM VCP_MsgRef = 0; @@ -43,6 +52,8 @@ static BOOL VCP_opened = FALSE; static VCPSTATUS vcp_status; +static HMODULE SETUPAPI_hInstance; + static WORD VCP_Callback( LPVOID obj, UINT16 msg, WPARAM16 wParam, LPARAM lParam, LPARAM lParamRef ) { WORD args[8]; @@ -214,10 +225,10 @@ static RETERR16 VCP_VirtnodeCreate(const VCPFILESPEC *vfsSrc, const VCPFILESPEC vn_num += 20; if (pvnlist) pvnlist = HeapReAlloc(heap, HEAP_ZERO_MEMORY, pvnlist, - sizeof(LPVIRTNODE *) * vn_num); + sizeof(LPVIRTNODE *) * vn_num); else - pvnlist = HeapAlloc(heap, HEAP_ZERO_MEMORY, - sizeof(LPVIRTNODE *) * vn_num); + pvnlist = HeapAlloc(heap, HEAP_ZERO_MEMORY, + sizeof(LPVIRTNODE *) * vn_num); } pvnlist[vn_last] = HeapAlloc(heap, HEAP_ZERO_MEMORY, sizeof(VIRTNODE)); lpvn = pvnlist[vn_last]; @@ -584,6 +595,8 @@ static void VCP_UI_RegisterProgressClass(void) wndClass.lpszClassName = "setupx_progress"; RegisterClassA (&wndClass); + + SETUPAPI_hInstance = LoadLibraryA( "setupapi.dll" ); } static RETERR16 VCP_UI_NodeCompare(LPVIRTNODE vn1, LPVIRTNODE vn2) diff --git a/dlls/shell32/tests/shellpath.c b/dlls/shell32/tests/shellpath.c index b5b196747ac..f9f59e16dde 100644 --- a/dlls/shell32/tests/shellpath.c +++ b/dlls/shell32/tests/shellpath.c @@ -43,6 +43,9 @@ #endif /* from pidl.h, not included here: */ +#ifndef PT_CPL /* Guess, Win7 uses this for CSIDL_CONTROLS */ +#define PT_CPL 0x01 /* no path */ +#endif #ifndef PT_GUID #define PT_GUID 0x1f /* no path */ #endif @@ -93,7 +96,7 @@ static UINT (WINAPI *pGetSystemWow64DirectoryA)(LPSTR,UINT); static DLLVERSIONINFO shellVersion = { 0 }; static LPMALLOC pMalloc; static const BYTE guidType[] = { PT_GUID }; -static const BYTE controlPanelType[] = { PT_SHELLEXT, PT_GUID }; +static const BYTE controlPanelType[] = { PT_SHELLEXT, PT_GUID, PT_CPL }; static const BYTE folderType[] = { PT_FOLDER, PT_FOLDERW }; static const BYTE favoritesType[] = { PT_FOLDER, PT_FOLDERW, 0, PT_IESPECIAL2 /* Win98 */ }; static const BYTE folderOrSpecialType[] = { PT_FOLDER, PT_IESPECIAL2 }; diff --git a/dlls/shell32/tests/shlexec.c b/dlls/shell32/tests/shlexec.c index 7ddeee33da9..889743c942b 100644 --- a/dlls/shell32/tests/shlexec.c +++ b/dlls/shell32/tests/shlexec.c @@ -56,6 +56,7 @@ static char** myARGV; static char tmpdir[MAX_PATH]; static char child_file[MAX_PATH]; static DLLVERSIONINFO dllver; +static BOOL skip_noassoc_tests = FALSE; /*** @@ -117,7 +118,18 @@ static int shell_execute(LPCSTR operation, LPCSTR file, LPCSTR parameters, LPCST { int wait_rc; wait_rc=WaitForSingleObject(hEvent, 5000); - ok(wait_rc==WAIT_OBJECT_0, "WaitForSingleObject returned %d\n", wait_rc); + if (wait_rc == WAIT_TIMEOUT) + { + HWND wnd = FindWindowA("#32770", "Windows"); + if (wnd != NULL) + { + SendMessage(wnd, WM_CLOSE, 0, 0); + win_skip("Skipping shellexecute of file with unassociated extension\n"); + skip_noassoc_tests = TRUE; + rc = SE_ERR_NOASSOC; + } + } + ok(wait_rc==WAIT_OBJECT_0 || rc <= 32, "WaitForSingleObject returned %d\n", wait_rc); } /* The child process may have changed the result file, so let profile * functions know about it @@ -462,11 +474,67 @@ static void childPrintf(HANDLE h, const char* fmt, ...) WriteFile(h, buffer, strlen(buffer), &w, NULL); } +static DWORD ddeInst; +static HSZ hszTopic; +static char ddeExec[MAX_PATH], ddeApplication[MAX_PATH]; +static BOOL post_quit_on_execute; + +static HDDEDATA CALLBACK ddeCb(UINT uType, UINT uFmt, HCONV hConv, + HSZ hsz1, HSZ hsz2, HDDEDATA hData, + ULONG_PTR dwData1, ULONG_PTR dwData2) +{ + DWORD size = 0; + + if (winetest_debug > 2) + trace("dde_cb: %04x, %04x, %p, %p, %p, %p, %08lx, %08lx\n", + uType, uFmt, hConv, hsz1, hsz2, hData, dwData1, dwData2); + + switch (uType) + { + case XTYP_CONNECT: + if (!DdeCmpStringHandles(hsz1, hszTopic)) + { + size = DdeQueryString(ddeInst, hsz2, ddeApplication, MAX_PATH, CP_WINANSI); + assert(size < MAX_PATH); + return (HDDEDATA)TRUE; + } + return (HDDEDATA)FALSE; + + case XTYP_EXECUTE: + size = DdeGetData(hData, (LPBYTE)ddeExec, MAX_PATH, 0L); + assert(size < MAX_PATH); + DdeFreeDataHandle(hData); + if (post_quit_on_execute) + PostQuitMessage(0); + return (HDDEDATA)DDE_FACK; + + default: + return NULL; + } +} + +/* + * This is just to make sure the child won't run forever stuck in a GetMessage() + * loop when DDE fails for some reason. + */ +static void CALLBACK childTimeout(HWND wnd, UINT msg, UINT_PTR timer, DWORD time) +{ + trace("childTimeout called\n"); + + PostQuitMessage(0); +} + static void doChild(int argc, char** argv) { char* filename; - HANDLE hFile; + HANDLE hFile, map; int i; + int rc; + HSZ hszApplication; + UINT_PTR timer; + HANDLE dde_ready; + MSG msg; + char *shared_block; filename=argv[2]; hFile=CreateFileA(filename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); @@ -484,6 +552,51 @@ static void doChild(int argc, char** argv) trace("argvA%d=%s\n", i, argv[i]); childPrintf(hFile, "argvA%d=%s\r\n", i, encodeA(argv[i])); } + + map = OpenFileMappingA(FILE_MAP_READ, FALSE, "winetest_shlexec_dde_map"); + if (map != NULL) + { + shared_block = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 4096); + CloseHandle(map); + if (shared_block[0] != '\0' || shared_block[1] != '\0') + { + post_quit_on_execute = TRUE; + ddeInst = 0; + rc = DdeInitializeA(&ddeInst, ddeCb, CBF_SKIP_ALLNOTIFICATIONS | CBF_FAIL_ADVISES | + CBF_FAIL_POKES | CBF_FAIL_REQUESTS, 0L); + assert(rc == DMLERR_NO_ERROR); + hszApplication = DdeCreateStringHandleA(ddeInst, shared_block, CP_WINANSI); + hszTopic = DdeCreateStringHandleA(ddeInst, shared_block + strlen(shared_block) + 1, CP_WINANSI); + assert(hszApplication && hszTopic); + assert(DdeNameService(ddeInst, hszApplication, 0L, DNS_REGISTER | DNS_FILTEROFF)); + + timer = SetTimer(NULL, 0, 2500, childTimeout); + + dde_ready = CreateEvent(NULL, FALSE, FALSE, "winetest_shlexec_dde_ready"); + SetEvent(dde_ready); + CloseHandle(dde_ready); + + while (GetMessage(&msg, NULL, 0, 0)) + DispatchMessage(&msg); + + KillTimer(NULL, timer); + assert(DdeNameService(ddeInst, hszApplication, 0L, DNS_UNREGISTER)); + assert(DdeFreeStringHandle(ddeInst, hszTopic)); + assert(DdeFreeStringHandle(ddeInst, hszApplication)); + assert(DdeUninitialize(ddeInst)); + } + else + { + dde_ready = CreateEvent(NULL, FALSE, FALSE, "winetest_shlexec_dde_ready"); + SetEvent(dde_ready); + CloseHandle(dde_ready); + } + + UnmapViewOfFile(shared_block); + + childPrintf(hFile, "ddeExec=%s\r\n", encodeA(ddeExec)); + } + CloseHandle(hFile); init_event(filename); @@ -751,6 +864,13 @@ static void test_filename(void) { BOOL quotedfile = FALSE; + if (skip_noassoc_tests && test->rc == SE_ERR_NOASSOC) + { + win_skip("Skipping shellexecute of file with unassociated extension\n"); + test++; + continue; + } + sprintf(filename, test->basename, tmpdir); if (strchr(filename, '/')) { @@ -1117,7 +1237,7 @@ static void test_lnks(void) { okChildInt("argcA", 5); } - else + else { okChildInt("argcA", 5); } @@ -1159,14 +1279,21 @@ static void test_exes(void) okChildInt("argcA", 4); okChildString("argvA3", "Exec"); - sprintf(filename, "%s\\test file.noassoc", tmpdir); - if (CopyFile(argv0, filename, FALSE)) + if (! skip_noassoc_tests) { - rc=shell_execute(NULL, filename, params, NULL); - todo_wine { - ok(rc==SE_ERR_NOASSOC, "%s succeeded: rc=%d\n", shell_call, rc); + sprintf(filename, "%s\\test file.noassoc", tmpdir); + if (CopyFile(argv0, filename, FALSE)) + { + rc=shell_execute(NULL, filename, params, NULL); + todo_wine { + ok(rc==SE_ERR_NOASSOC, "%s succeeded: rc=%d\n", shell_call, rc); + } } } + else + { + win_skip("Skipping shellexecute of file with unassociated extension\n"); + } } static void test_exes_long(void) @@ -1190,14 +1317,21 @@ static void test_exes_long(void) okChildInt("argcA", 4); okChildString("argvA3", longparam); - sprintf(filename, "%s\\test file.noassoc", tmpdir); - if (CopyFile(argv0, filename, FALSE)) + if (! skip_noassoc_tests) { - rc=shell_execute(NULL, filename, params, NULL); - todo_wine { - ok(rc==SE_ERR_NOASSOC, "%s succeeded: rc=%d\n", shell_call, rc); + sprintf(filename, "%s\\test file.noassoc", tmpdir); + if (CopyFile(argv0, filename, FALSE)) + { + rc=shell_execute(NULL, filename, params, NULL); + todo_wine { + ok(rc==SE_ERR_NOASSOC, "%s succeeded: rc=%d\n", shell_call, rc); + } } } + else + { + win_skip("Skipping shellexecute of file with unassociated extension\n"); + } } typedef struct @@ -1210,115 +1344,123 @@ typedef struct int expectedArgs; const char* expectedDdeExec; int todo; - int rc; } dde_tests_t; static dde_tests_t dde_tests[] = { /* Test passing and not passing command-line * argument, no DDE */ - {"", NULL, NULL, NULL, NULL, FALSE, "", 0x0, 33}, - {"\"%1\"", NULL, NULL, NULL, NULL, TRUE, "", 0x0, 33}, + {"", NULL, NULL, NULL, NULL, FALSE, "", 0x0}, + {"\"%1\"", NULL, NULL, NULL, NULL, TRUE, "", 0x0}, /* Test passing and not passing command-line * argument, with DDE */ - {"", "[open(\"%1\")]", "shlexec", "dde", NULL, FALSE, "[open(\"%s\")]", 0x0, 33}, - {"\"%1\"", "[open(\"%1\")]", "shlexec", "dde", NULL, TRUE, "[open(\"%s\")]", 0x0, 33}, + {"", "[open(\"%1\")]", "shlexec", "dde", NULL, FALSE, "[open(\"%s\")]", 0x0}, + {"\"%1\"", "[open(\"%1\")]", "shlexec", "dde", NULL, TRUE, "[open(\"%s\")]", 0x0}, /* Test unquoted %1 in command and ddeexec * (test filename has space) */ - {"%1", "[open(%1)]", "shlexec", "dde", NULL, 2, "[open(%s)]", 0x0, 33}, + {"%1", "[open(%1)]", "shlexec", "dde", NULL, 2, "[open(%s)]", 0x0}, /* Test ifexec precedence over ddeexec */ - {"", "[open(\"%1\")]", "shlexec", "dde", "[ifexec(\"%1\")]", FALSE, "[ifexec(\"%s\")]", 0x0, 33}, + {"", "[open(\"%1\")]", "shlexec", "dde", "[ifexec(\"%1\")]", FALSE, "[ifexec(\"%s\")]", 0x0}, /* Test default DDE topic */ - {"", "[open(\"%1\")]", "shlexec", NULL, NULL, FALSE, "[open(\"%s\")]", 0x0, 33}, + {"", "[open(\"%1\")]", "shlexec", NULL, NULL, FALSE, "[open(\"%s\")]", 0x0}, /* Test default DDE application */ - {"", "[open(\"%1\")]", NULL, "dde", NULL, FALSE, "[open(\"%s\")]", 0x0, 33}, + {"", "[open(\"%1\")]", NULL, "dde", NULL, FALSE, "[open(\"%s\")]", 0x0}, - {NULL, NULL, NULL, NULL, NULL, 0, 0x0, 0} + {NULL, NULL, NULL, NULL, NULL, 0, 0x0} }; -static DWORD ddeInst; -static HSZ hszTopic; -static char ddeExec[MAX_PATH], ddeApplication[MAX_PATH]; -static BOOL denyNextConnection; - -static HDDEDATA CALLBACK ddeCb(UINT uType, UINT uFmt, HCONV hConv, - HSZ hsz1, HSZ hsz2, HDDEDATA hData, - ULONG_PTR dwData1, ULONG_PTR dwData2) +static DWORD WINAPI hooked_WaitForInputIdle(HANDLE process, DWORD timeout) { - DWORD size = 0; + HANDLE dde_ready; + DWORD wait_result; - if (winetest_debug > 2) - trace("dde_cb: %04x, %04x, %p, %p, %p, %p, %08lx, %08lx\n", - uType, uFmt, hConv, hsz1, hsz2, hData, dwData1, dwData2); + dde_ready = CreateEventA(NULL, FALSE, FALSE, "winetest_shlexec_dde_ready"); + wait_result = WaitForSingleObject(dde_ready, timeout); + CloseHandle(dde_ready); - switch (uType) + return wait_result; +} + +/* + * WaitForInputIdle() will normally return immediately for console apps. That's + * a problem for us because ShellExecute will assume that an app is ready to + * receive DDE messages after it has called WaitForInputIdle() on that app. + * To work around that we install our own version of WaitForInputIdle() that + * will wait for the child to explicitly tell it it's ready. We do that by + * changing the entry for WaitForInputIdle() in the shell32 import address + * table. + */ +static void hook_WaitForInputIdle(void *new_func) +{ + char *base; + PIMAGE_NT_HEADERS nt_headers; + DWORD import_directory_rva; + PIMAGE_IMPORT_DESCRIPTOR import_descriptor; + + base = (char *) GetModuleHandleA("shell32.dll"); + nt_headers = (PIMAGE_NT_HEADERS)(base + ((PIMAGE_DOS_HEADER) base)->e_lfanew); + import_directory_rva = nt_headers->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress; + + /* Search for the correct imported module by walking the import descriptors */ + import_descriptor = (PIMAGE_IMPORT_DESCRIPTOR)(base + import_directory_rva); + while (import_descriptor->OriginalFirstThunk != 0) { - case XTYP_CONNECT: - if (!DdeCmpStringHandles(hsz1, hszTopic)) + char *import_module_name; + + import_module_name = base + import_descriptor->Name; + if (lstrcmpiA(import_module_name, "user32.dll") == 0 || + lstrcmpiA(import_module_name, "user32") == 0) + { + PIMAGE_THUNK_DATA int_entry; + PIMAGE_THUNK_DATA iat_entry; + + /* The import name table and import address table are two parallel + * arrays. We need the import name table to find the imported + * routine and the import address table to patch the address, so + * walk them side by side */ + int_entry = (PIMAGE_THUNK_DATA)(base + import_descriptor->OriginalFirstThunk); + iat_entry = (PIMAGE_THUNK_DATA)(base + import_descriptor->FirstThunk); + while (int_entry->u1.Ordinal != 0) { - if (denyNextConnection) - denyNextConnection = FALSE; - else + if (! IMAGE_SNAP_BY_ORDINAL(int_entry->u1.Ordinal)) { - size = DdeQueryString(ddeInst, hsz2, ddeApplication, MAX_PATH, CP_WINANSI); - assert(size < MAX_PATH); - return (HDDEDATA)TRUE; + PIMAGE_IMPORT_BY_NAME import_by_name; + import_by_name = (PIMAGE_IMPORT_BY_NAME)(base + int_entry->u1.AddressOfData); + if (lstrcmpA((char *) import_by_name->Name, "WaitForInputIdle") == 0) + { + /* Found the correct routine in the correct imported module. Patch it. */ + DWORD old_prot; + VirtualProtect(&iat_entry->u1.Function, sizeof(ULONG_PTR), PAGE_READWRITE, &old_prot); + iat_entry->u1.Function = (ULONG_PTR) new_func; + VirtualProtect(&iat_entry->u1.Function, sizeof(ULONG_PTR), old_prot, &old_prot); + break; + } } + int_entry++; + iat_entry++; } - return (HDDEDATA)FALSE; - - case XTYP_EXECUTE: - size = DdeGetData(hData, (LPBYTE)ddeExec, MAX_PATH, 0L); - assert(size < MAX_PATH); - DdeFreeDataHandle(hData); - return (HDDEDATA)DDE_FACK; + break; + } - default: - return NULL; + import_descriptor++; } } -typedef struct -{ - char *filename; - DWORD threadIdParent; -} dde_thread_info_t; - -static DWORD CALLBACK ddeThread(LPVOID arg) -{ - dde_thread_info_t *info = arg; - assert(info && info->filename); - PostThreadMessage(info->threadIdParent, - WM_QUIT, - shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, info->filename, NULL, NULL), - 0L); - ExitThread(0); -} - -/* ShellExecute won't successfully send DDE commands to console applications after starting them, - * so we run a DDE server in this application, deny the first connection request to make - * ShellExecute start the application, and then process the next DDE connection in this application - * to see the execute command that is sent. */ static void test_dde(void) { char filename[MAX_PATH], defApplication[MAX_PATH]; - HSZ hszApplication; - dde_thread_info_t info = { filename, GetCurrentThreadId() }; const dde_tests_t* test; char params[1024]; - DWORD threadId; - MSG msg; int rc; + HANDLE map; + char *shared_block; - ddeInst = 0; - rc = DdeInitializeA(&ddeInst, ddeCb, CBF_SKIP_ALLNOTIFICATIONS | CBF_FAIL_ADVISES | - CBF_FAIL_POKES | CBF_FAIL_REQUESTS, 0L); - assert(rc == DMLERR_NO_ERROR); + hook_WaitForInputIdle((void *) hooked_WaitForInputIdle); sprintf(filename, "%s\\test file.sde", tmpdir); @@ -1326,6 +1468,10 @@ static void test_dde(void) strcpy(defApplication, strrchr(argv0, '\\')+1); *strchr(defApplication, '.') = 0; + map = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, + 4096, "winetest_shlexec_dde_map"); + shared_block = MapViewOfFile(map, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 4096); + test = dde_tests; while (test->command) { @@ -1336,29 +1482,31 @@ static void test_dde(void) } create_test_verb_dde(".sde", "Open", 0, test->command, test->ddeexec, test->application, test->topic, test->ifexec); - hszApplication = DdeCreateStringHandleA(ddeInst, test->application ? - test->application : defApplication, CP_WINANSI); - hszTopic = DdeCreateStringHandleA(ddeInst, test->topic ? test->topic : SZDDESYS_TOPIC, - CP_WINANSI); - assert(hszApplication && hszTopic); - assert(DdeNameService(ddeInst, hszApplication, 0L, DNS_REGISTER)); - denyNextConnection = TRUE; + + if (test->application != NULL || test->topic != NULL) + { + strcpy(shared_block, test->application ? test->application : defApplication); + strcpy(shared_block + strlen(shared_block) + 1, test->topic ? test->topic : SZDDESYS_TOPIC); + } + else + { + shared_block[0] = '\0'; + shared_block[1] = '\0'; + } ddeExec[0] = 0; - assert(CreateThread(NULL, 0, ddeThread, &info, 0, &threadId)); - while (GetMessage(&msg, NULL, 0, 0)) DispatchMessage(&msg); - rc = msg.wParam > 32 ? 33 : msg.wParam; + rc = shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, filename, NULL, NULL); if ((test->todo & 0x1)==0) { - ok(rc==test->rc, "%s failed: rc=%d err=%d\n", shell_call, + ok(32 < rc, "%s failed: rc=%d err=%d\n", shell_call, rc, GetLastError()); } else todo_wine { - ok(rc==test->rc, "%s failed: rc=%d err=%d\n", shell_call, + ok(32 < rc, "%s failed: rc=%d err=%d\n", shell_call, rc, GetLastError()); } - if (rc == 33) + if (32 < rc) { if ((test->todo & 0x2)==0) { @@ -1382,25 +1530,22 @@ static void test_dde(void) if ((test->todo & 0x8) == 0) { sprintf(params, test->expectedDdeExec, filename); - ok(StrCmpPath(params, ddeExec) == 0, - "ddeexec expected '%s', got '%s'\n", params, ddeExec); + okChildPath("ddeExec", params); } else todo_wine { sprintf(params, test->expectedDdeExec, filename); - ok(StrCmpPath(params, ddeExec) == 0, - "ddeexec expected '%s', got '%s'\n", params, ddeExec); + okChildPath("ddeExec", params); } } - assert(DdeNameService(ddeInst, hszApplication, 0L, DNS_UNREGISTER)); - assert(DdeFreeStringHandle(ddeInst, hszTopic)); - assert(DdeFreeStringHandle(ddeInst, hszApplication)); delete_test_association(".sde"); test++; } - assert(DdeUninitialize(ddeInst)); + UnmapViewOfFile(shared_block); + CloseHandle(map); + hook_WaitForInputIdle((void *) WaitForInputIdle); } #define DDE_DEFAULT_APP_VARIANTS 2 @@ -1454,6 +1599,23 @@ static dde_default_app_tests_t dde_default_app_tests[] = {NULL, {NULL}, 0, {0}} }; +typedef struct +{ + char *filename; + DWORD threadIdParent; +} dde_thread_info_t; + +static DWORD CALLBACK ddeThread(LPVOID arg) +{ + dde_thread_info_t *info = arg; + assert(info && info->filename); + PostThreadMessage(info->threadIdParent, + WM_QUIT, + shell_execute_ex(SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI, NULL, info->filename, NULL, NULL), + 0L); + ExitThread(0); +} + static void test_dde_default_app(void) { char filename[MAX_PATH]; @@ -1465,6 +1627,7 @@ static void test_dde_default_app(void) MSG msg; int rc, which = 0; + post_quit_on_execute = FALSE; ddeInst = 0; rc = DdeInitializeA(&ddeInst, ddeCb, CBF_SKIP_ALLNOTIFICATIONS | CBF_FAIL_ADVISES | CBF_FAIL_POKES | CBF_FAIL_REQUESTS, 0L); @@ -1491,7 +1654,6 @@ static void test_dde_default_app(void) sprintf(params, test->command, tmpdir); create_test_verb_dde(".sde", "Open", 1, params, "[test]", NULL, "shlexec", NULL); - denyNextConnection = FALSE; ddeApplication[0] = 0; /* No application will be run as we will respond to the first DDE event, diff --git a/dlls/shlwapi/regstream.c b/dlls/shlwapi/regstream.c index 6aca8f937ef..eb906a7dc8d 100644 --- a/dlls/shlwapi/regstream.c +++ b/dlls/shlwapi/regstream.c @@ -43,6 +43,12 @@ typedef struct LPBYTE pbBuffer; DWORD dwLength; DWORD dwPos; + DWORD dwMode; + union { + LPSTR keyNameA; + LPWSTR keyNameW; + }u; + BOOL bUnicode; } ISHRegStream; /************************************************************************** @@ -98,11 +104,34 @@ static ULONG WINAPI IStream_fnRelease(IStream *iface) { TRACE(" destroying SHReg IStream (%p)\n",This); - HeapFree(GetProcessHeap(),0,This->pbBuffer); - if (This->hKey) + { + /* write back data in REG_BINARY */ + if (This->dwMode == STGM_READWRITE || This->dwMode == STGM_WRITE) + { + if (This->dwLength) + { + if (This->bUnicode) + RegSetValueExW(This->hKey, This->u.keyNameW, 0, REG_BINARY, + (const BYTE *) This->pbBuffer, This->dwLength); + else + RegSetValueExA(This->hKey, This->u.keyNameA, 0, REG_BINARY, + (const BYTE *) This->pbBuffer, This->dwLength); + } + else + { + if (This->bUnicode) + RegDeleteValueW(This->hKey, This->u.keyNameW); + else + RegDeleteValueA(This->hKey, This->u.keyNameA); + } + } + RegCloseKey(This->hKey); + } + HeapFree(GetProcessHeap(),0,This->u.keyNameA); + HeapFree(GetProcessHeap(),0,This->pbBuffer); HeapFree(GetProcessHeap(),0,This); return 0; } @@ -116,24 +145,21 @@ static ULONG WINAPI IStream_fnRelease(IStream *iface) static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG* pcbRead) { ISHRegStream *This = (ISHRegStream *)iface; - - DWORD dwBytesToRead, dwBytesLeft; + DWORD dwBytesToRead; TRACE("(%p)->(%p,0x%08x,%p)\n",This, pv, cb, pcbRead); - if (!pv) - return STG_E_INVALIDPOINTER; - - dwBytesLeft = This->dwLength - This->dwPos; + if (This->dwPos >= This->dwLength) + dwBytesToRead = 0; + else + dwBytesToRead = This->dwLength - This->dwPos; - if ( 0 >= dwBytesLeft ) /* end of buffer */ - return S_FALSE; - - dwBytesToRead = ( cb > dwBytesLeft) ? dwBytesLeft : cb; - - memmove ( pv, (This->pbBuffer) + (This->dwPos), dwBytesToRead); - - This->dwPos += dwBytesToRead; /* adjust pointer */ + dwBytesToRead = (cb > dwBytesToRead) ? dwBytesToRead : cb; + if (dwBytesToRead != 0) /* not at end of buffer and we want to read something */ + { + memmove(pv, This->pbBuffer + This->dwPos, dwBytesToRead); + This->dwPos += dwBytesToRead; /* adjust pointer */ + } if (pcbRead) *pcbRead = dwBytesToRead; @@ -147,13 +173,29 @@ static HRESULT WINAPI IStream_fnRead (IStream * iface, void* pv, ULONG cb, ULONG static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb, ULONG* pcbWritten) { ISHRegStream *This = (ISHRegStream *)iface; + DWORD newLen = This->dwPos + cb; - TRACE("(%p)\n",This); + TRACE("(%p, %p, %d, %p)\n",This, pv, cb, pcbWritten); + + if (newLen < This->dwPos) /* overflow */ + return STG_E_INSUFFICIENTMEMORY; + + if (newLen > This->dwLength) + { + LPBYTE newBuf = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pbBuffer, newLen); + if (!newBuf) + return STG_E_INSUFFICIENTMEMORY; + + This->dwLength = newLen; + This->pbBuffer = newBuf; + } + memmove(This->pbBuffer + This->dwPos, pv, cb); + This->dwPos += cb; /* adjust pointer */ if (pcbWritten) - *pcbWritten = 0; + *pcbWritten = cb; - return E_NOTIMPL; + return S_OK; } /************************************************************************** @@ -162,12 +204,28 @@ static HRESULT WINAPI IStream_fnWrite (IStream * iface, const void* pv, ULONG cb static HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER* plibNewPosition) { ISHRegStream *This = (ISHRegStream *)iface; + LARGE_INTEGER tmp; + TRACE("(%p, %s, %d %p)\n", This, + wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, plibNewPosition); - TRACE("(%p)\n",This); + if (dwOrigin == STREAM_SEEK_SET) + tmp = dlibMove; + else if (dwOrigin == STREAM_SEEK_CUR) + tmp.QuadPart = This->dwPos + dlibMove.QuadPart; + else if (dwOrigin == STREAM_SEEK_END) + tmp.QuadPart = This->dwLength + dlibMove.QuadPart; + else + return STG_E_INVALIDPARAMETER; + + if (tmp.QuadPart < 0) + return STG_E_INVALIDFUNCTION; + + /* we cut off the high part here */ + This->dwPos = tmp.LowPart; if (plibNewPosition) - plibNewPosition->QuadPart = 0; - return E_NOTIMPL; + plibNewPosition->QuadPart = This->dwPos; + return S_OK; } /************************************************************************** @@ -176,9 +234,21 @@ static HRESULT WINAPI IStream_fnSeek (IStream * iface, LARGE_INTEGER dlibMove, D static HRESULT WINAPI IStream_fnSetSize (IStream * iface, ULARGE_INTEGER libNewSize) { ISHRegStream *This = (ISHRegStream *)iface; + DWORD newLen; + LPBYTE newBuf; - TRACE("(%p)\n",This); - return E_NOTIMPL; + TRACE("(%p, %s)\n", This, wine_dbgstr_longlong(libNewSize.QuadPart)); + + /* we cut off the high part here */ + newLen = libNewSize.LowPart; + newBuf = HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->pbBuffer, newLen); + if (!newBuf) + return STG_E_INSUFFICIENTMEMORY; + + This->pbBuffer = newBuf; + This->dwLength = newLen; + + return S_OK; } /************************************************************************** @@ -193,6 +263,8 @@ static HRESULT WINAPI IStream_fnCopyTo (IStream * iface, IStream* pstm, ULARGE_I pcbRead->QuadPart = 0; if (pcbWritten) pcbWritten->QuadPart = 0; + + /* TODO implement */ return E_NOTIMPL; } @@ -205,6 +277,7 @@ static HRESULT WINAPI IStream_fnCommit (IStream * iface, DWORD grfCommitFlags) TRACE("(%p)\n",This); + /* commit not supported by this stream */ return E_NOTIMPL; } @@ -217,6 +290,7 @@ static HRESULT WINAPI IStream_fnRevert (IStream * iface) TRACE("(%p)\n",This); + /* revert not supported by this stream */ return E_NOTIMPL; } @@ -229,19 +303,35 @@ static HRESULT WINAPI IStream_fnLockUnlockRegion (IStream * iface, ULARGE_INTEGE TRACE("(%p)\n",This); + /* lock/unlock not supported by this stream */ return E_NOTIMPL; } /************************************************************************* * IStream_fnStat */ -static HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD grfStatFlag) +static HRESULT WINAPI IStream_fnStat (IStream * iface, STATSTG* pstatstg, DWORD grfStatFlag) { ISHRegStream *This = (ISHRegStream *)iface; - TRACE("(%p)\n",This); + TRACE("(%p, %p, %d)\n",This,pstatstg,grfStatFlag); + + pstatstg->pwcsName = NULL; + pstatstg->type = STGTY_STREAM; + pstatstg->cbSize.QuadPart = This->dwLength; + pstatstg->mtime.dwHighDateTime = 0; + pstatstg->mtime.dwLowDateTime = 0; + pstatstg->ctime.dwHighDateTime = 0; + pstatstg->ctime.dwLowDateTime = 0; + pstatstg->atime.dwHighDateTime = 0; + pstatstg->atime.dwLowDateTime = 0; + pstatstg->grfMode = This->dwMode; + pstatstg->grfLocksSupported = 0; + pstatstg->clsid = CLSID_NULL; + pstatstg->grfStateBits = 0; + pstatstg->reserved = 0; - return E_NOTIMPL; + return S_OK; } /************************************************************************* @@ -252,8 +342,9 @@ static HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm) ISHRegStream *This = (ISHRegStream *)iface; TRACE("(%p)\n",This); - if (ppstm) - *ppstm = NULL; + *ppstm = NULL; + + /* clone not supported by this stream */ return E_NOTIMPL; } @@ -333,7 +424,10 @@ static ISHRegStream rsDummyRegStream = NULL, NULL, 0, - 0 + 0, + STGM_READWRITE, + {NULL}, + FALSE }; /************************************************************************** @@ -341,7 +435,7 @@ static ISHRegStream rsDummyRegStream = * * Internal helper: Create and initialise a new registry stream object. */ -static IStream *IStream_Create(HKEY hKey, LPBYTE pbBuffer, DWORD dwLength) +static ISHRegStream *IStream_Create(HKEY hKey, LPBYTE pbBuffer, DWORD dwLength) { ISHRegStream* regStream; @@ -355,9 +449,12 @@ static IStream *IStream_Create(HKEY hKey, LPBYTE pbBuffer, DWORD dwLength) regStream->pbBuffer = pbBuffer; regStream->dwLength = dwLength; regStream->dwPos = 0; + regStream->dwMode = STGM_READWRITE; + regStream->u.keyNameA = NULL; + regStream->bUnicode = FALSE; } TRACE ("Returning %p\n", regStream); - return (IStream *)regStream; + return regStream; } /************************************************************************* @@ -378,21 +475,52 @@ static IStream *IStream_Create(HKEY hKey, LPBYTE pbBuffer, DWORD dwLength) IStream * WINAPI SHOpenRegStream2A(HKEY hKey, LPCSTR pszSubkey, LPCSTR pszValue,DWORD dwMode) { + ISHRegStream *tmp; HKEY hStrKey = NULL; LPBYTE lpBuff = NULL; - DWORD dwLength, dwType; + DWORD dwLength = 0; + LONG ret; TRACE("(%p,%s,%s,0x%08x)\n", hKey, pszSubkey, pszValue, dwMode); - /* Open the key, read in binary data and create stream */ - if (!RegOpenKeyExA (hKey, pszSubkey, 0, KEY_READ, &hStrKey) && - !RegQueryValueExA (hStrKey, pszValue, 0, 0, 0, &dwLength) && - (lpBuff = HeapAlloc (GetProcessHeap(), 0, dwLength)) && - !RegQueryValueExA (hStrKey, pszValue, 0, &dwType, lpBuff, &dwLength) && - dwType == REG_BINARY) - return IStream_Create(hStrKey, lpBuff, dwLength); + if (dwMode == STGM_READ) + ret = RegOpenKeyExA(hKey, pszSubkey, 0, KEY_READ, &hStrKey); + else /* in write mode we make sure the subkey exits */ + ret = RegCreateKeyExA(hKey, pszSubkey, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &hStrKey, NULL); + + if (ret == ERROR_SUCCESS) + { + if (dwMode == STGM_READ || dwMode == STGM_READWRITE) + { + /* read initial data */ + ret = RegQueryValueExA(hStrKey, pszValue, 0, 0, 0, &dwLength); + if (ret == ERROR_SUCCESS && dwLength) + { + lpBuff = HeapAlloc(GetProcessHeap(), 0, dwLength); + RegQueryValueExA(hStrKey, pszValue, 0, 0, lpBuff, &dwLength); + } + } + + if (!dwLength) + lpBuff = HeapAlloc(GetProcessHeap(), 0, dwLength); + + tmp = IStream_Create(hStrKey, lpBuff, dwLength); + if(tmp) + { + if(pszValue) + { + int len = lstrlenA(pszValue) + 1; + tmp->u.keyNameA = HeapAlloc(GetProcessHeap(), 0, len); + memcpy(tmp->u.keyNameA, pszValue, len); + } + + tmp->dwMode = dwMode; + tmp->bUnicode = FALSE; + return (IStream *)tmp; + } + } - HeapFree (GetProcessHeap(), 0, lpBuff); + HeapFree(GetProcessHeap(), 0, lpBuff); if (hStrKey) RegCloseKey(hStrKey); return NULL; @@ -406,22 +534,53 @@ IStream * WINAPI SHOpenRegStream2A(HKEY hKey, LPCSTR pszSubkey, IStream * WINAPI SHOpenRegStream2W(HKEY hKey, LPCWSTR pszSubkey, LPCWSTR pszValue, DWORD dwMode) { + ISHRegStream *tmp; HKEY hStrKey = NULL; LPBYTE lpBuff = NULL; - DWORD dwLength, dwType; + DWORD dwLength = 0; + LONG ret; TRACE("(%p,%s,%s,0x%08x)\n", hKey, debugstr_w(pszSubkey), debugstr_w(pszValue), dwMode); - /* Open the key, read in binary data and create stream */ - if (!RegOpenKeyExW (hKey, pszSubkey, 0, KEY_READ, &hStrKey) && - !RegQueryValueExW (hStrKey, pszValue, 0, 0, 0, &dwLength) && - (lpBuff = HeapAlloc (GetProcessHeap(), 0, dwLength)) && - !RegQueryValueExW (hStrKey, pszValue, 0, &dwType, lpBuff, &dwLength) && - dwType == REG_BINARY) - return IStream_Create(hStrKey, lpBuff, dwLength); + if (dwMode == STGM_READ) + ret = RegOpenKeyExW(hKey, pszSubkey, 0, KEY_READ, &hStrKey); + else /* in write mode we make sure the subkey exits */ + ret = RegCreateKeyExW(hKey, pszSubkey, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &hStrKey, NULL); - HeapFree (GetProcessHeap(), 0, lpBuff); + if (ret == ERROR_SUCCESS) + { + if (dwMode == STGM_READ || dwMode == STGM_READWRITE) + { + /* read initial data */ + ret = RegQueryValueExW(hStrKey, pszValue, 0, 0, 0, &dwLength); + if (ret == ERROR_SUCCESS && dwLength) + { + lpBuff = HeapAlloc(GetProcessHeap(), 0, dwLength); + RegQueryValueExW(hStrKey, pszValue, 0, 0, lpBuff, &dwLength); + } + } + + if (!dwLength) + lpBuff = HeapAlloc(GetProcessHeap(), 0, dwLength); + + tmp = IStream_Create(hStrKey, lpBuff, dwLength); + if(tmp) + { + if(pszValue) + { + int len = lstrlenW(pszValue) + 1; + tmp->u.keyNameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + memcpy(tmp->u.keyNameW, pszValue, len * sizeof(WCHAR)); + } + + tmp->dwMode = dwMode; + tmp->bUnicode = TRUE; + return (IStream *)tmp; + } + } + + HeapFree(GetProcessHeap(), 0, lpBuff); if (hStrKey) RegCloseKey(hStrKey); return NULL; @@ -487,24 +646,25 @@ IStream * WINAPI SHOpenRegStreamW(HKEY hkey, LPCWSTR pszSubkey, * A copy of the memory pointed to by lpbData is made, and is freed * when the stream is released. */ -IStream * WINAPI SHCreateMemStream(LPBYTE lpbData, DWORD dwDataLen) +IStream * WINAPI SHCreateMemStream(const BYTE *lpbData, UINT dwDataLen) { IStream *iStrmRet = NULL; + LPBYTE lpbDup; TRACE("(%p,%d)\n", lpbData, dwDataLen); - if (lpbData) - { - LPBYTE lpbDup = HeapAlloc(GetProcessHeap(), 0, dwDataLen); + if (!lpbData) + dwDataLen = 0; - if (lpbDup) - { - memcpy(lpbDup, lpbData, dwDataLen); - iStrmRet = IStream_Create(NULL, lpbDup, dwDataLen); + lpbDup = HeapAlloc(GetProcessHeap(), 0, dwDataLen); - if (!iStrmRet) - HeapFree(GetProcessHeap(), 0, lpbDup); - } + if (lpbDup) + { + memcpy(lpbDup, lpbData, dwDataLen); + iStrmRet = (IStream *)IStream_Create(NULL, lpbDup, dwDataLen); + + if (!iStrmRet) + HeapFree(GetProcessHeap(), 0, lpbDup); } return iStrmRet; } @@ -539,7 +699,7 @@ HRESULT WINAPI SHCreateStreamWrapper(LPBYTE lpbData, DWORD dwDataLen, if(dwReserved || !lppStream) return E_INVALIDARG; - lpStream = IStream_Create(NULL, lpbData, dwDataLen); + lpStream = (IStream *)IStream_Create(NULL, lpbData, dwDataLen); if(!lpStream) return E_OUTOFMEMORY; diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index 342772285cb..1a791745308 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -643,7 +643,7 @@ @ stdcall PathQuoteSpacesA (str) @ stdcall PathQuoteSpacesW (wstr) @ stdcall PathRelativePathToA(ptr str long str long) -@ stdcall PathRelativePathToW(ptr str long str long) +@ stdcall PathRelativePathToW(ptr wstr long wstr long) @ stdcall PathRemoveArgsA(str) @ stdcall PathRemoveArgsW(wstr) @ stdcall PathRemoveBackslashA (str) @@ -700,9 +700,9 @@ @ stdcall SHGetValueW ( long wstr wstr ptr ptr ptr ) @ stdcall SHIsLowMemoryMachine(long) @ stdcall SHOpenRegStream2A(long str str long) -@ stdcall SHOpenRegStream2W(long wstr str long) +@ stdcall SHOpenRegStream2W(long wstr wstr long) @ stdcall SHOpenRegStreamA(long str str long) -@ stdcall SHOpenRegStreamW(long wstr str long) +@ stdcall SHOpenRegStreamW(long wstr wstr long) @ stdcall SHQueryInfoKeyA(long ptr ptr ptr ptr) @ stdcall SHQueryInfoKeyW(long ptr ptr ptr ptr) @ stdcall SHQueryValueExA(long str ptr ptr ptr ptr) @@ -738,7 +738,7 @@ @ stdcall SHRegSetUSValueA ( str str long ptr long long) @ stdcall SHRegSetUSValueW ( wstr wstr long ptr long long) @ stdcall SHRegWriteUSValueA (long str long ptr long long) -@ stdcall SHRegWriteUSValueW (long str long ptr long long) +@ stdcall SHRegWriteUSValueW (long wstr long ptr long long) @ stdcall SHRegisterValidateTemplate(wstr long) @ stdcall SHReleaseThreadRef() @ stdcall SHSetThreadRef (ptr) @@ -785,7 +785,7 @@ @ stdcall StrPBrkW(wstr wstr) @ stdcall StrRChrA (str str long) @ stdcall StrRChrIA (str str long) -@ stdcall StrRChrIW (str str long) +@ stdcall StrRChrIW (wstr wstr long) @ stdcall StrRChrW (wstr wstr long) @ stdcall StrRStrIA (str str str) @ stdcall StrRStrIW (wstr wstr wstr) diff --git a/dlls/jscript/tests/Makefile.in b/dlls/sti/tests/Makefile.in similarity index 65% copy from dlls/jscript/tests/Makefile.in copy to dlls/sti/tests/Makefile.in index 1730cae3403..b2587d4c388 100644 --- a/dlls/jscript/tests/Makefile.in +++ b/dlls/sti/tests/Makefile.in @@ -1,15 +1,14 @@ +EXTRADEFS = -DCOM_NO_WINDOWS_H TOPSRCDIR = @top_srcdir@ TOPOBJDIR = ../../.. SRCDIR = @srcdir@ VPATH = @srcdir@ -TESTDLL = jscript.dll -IMPORTS = oleaut32 ole32 kernel32 +TESTDLL = sti.dll +IMPORTS = ole32 kernel32 +EXTRALIBS = -luuid CTESTS = \ - jscript.c \ - run.c - -RC_SRCS = rsrc.rc + sti.c @MAKE_TEST_RULES@ diff --git a/dlls/sti/tests/sti.c b/dlls/sti/tests/sti.c new file mode 100644 index 00000000000..524ff9c6afb --- /dev/null +++ b/dlls/sti/tests/sti.c @@ -0,0 +1,154 @@ +/* + * General still image implementation + * + * Copyright 2009 Damjan Jovanovic + * + * 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 +#include +#include "windef.h" +#include "winbase.h" +#define COBJMACROS +#include +#include +#include +#include +#include + +#include "wine/test.h" + +static HMODULE sti_dll; +static HRESULT (WINAPI *pStiCreateInstance)(HINSTANCE,DWORD,PSTIW*,LPUNKNOWN); +static HRESULT (WINAPI *pStiCreateInstanceA)(HINSTANCE,DWORD,PSTIA*,LPUNKNOWN); +static HRESULT (WINAPI *pStiCreateInstanceW)(HINSTANCE,DWORD,PSTIW*,LPUNKNOWN); + +static BOOL init_function_pointers(void) +{ + sti_dll = LoadLibrary("sti.dll"); + if (sti_dll) + { + pStiCreateInstance = (void*) + GetProcAddress(sti_dll, "StiCreateInstance"); + pStiCreateInstanceA = (void*) + GetProcAddress(sti_dll, "StiCreateInstanceA"); + pStiCreateInstanceW = (void*) + GetProcAddress(sti_dll, "StiCreateInstanceW"); + return TRUE; + } + return FALSE; +} + +void test_version_flag_versus_aw(void) +{ + HRESULT hr; + + /* Who wins, the STI_VERSION_FLAG_UNICODE or the A/W function? And what about the neutral StiCreateInstance function? */ + + if (pStiCreateInstance) + { + PSTIW pStiW; + hr = pStiCreateInstance(GetModuleHandle(NULL), STI_VERSION_REAL, &pStiW, NULL); + if (SUCCEEDED(hr)) + { + IUnknown *pUnknown; + hr = IUnknown_QueryInterface((IUnknown*)pStiW, &IID_IStillImageW, (void**)&pUnknown); + if (SUCCEEDED(hr)) + { + ok(pUnknown == (IUnknown*)pStiW, "created interface was not IID_IStillImageW\n"); + IUnknown_Release(pUnknown); + } + IUnknown_Release((IUnknown*)pStiW); + } + else + todo_wine ok(0, "could not create StillImageA, hr = 0x%X\n", hr); + hr = pStiCreateInstance(GetModuleHandle(NULL), STI_VERSION_REAL | STI_VERSION_FLAG_UNICODE, &pStiW, NULL); + if (SUCCEEDED(hr)) + { + IUnknown *pUnknown; + hr = IUnknown_QueryInterface((IUnknown*)pStiW, &IID_IStillImageW, (void**)&pUnknown); + if (SUCCEEDED(hr)) + { + ok(pUnknown == (IUnknown*)pStiW, "created interface was not IID_IStillImageW\n"); + IUnknown_Release(pUnknown); + } + IUnknown_Release((IUnknown*)pStiW); + } + else + todo_wine ok(0, "could not create StillImageW, hr = 0x%X\n", hr); + } + else + skip("No StiCreateInstance function\n"); + + if (pStiCreateInstanceA) + { + PSTIA pStiA; + hr = pStiCreateInstanceA(GetModuleHandle(NULL), STI_VERSION_REAL | STI_VERSION_FLAG_UNICODE, &pStiA, NULL); + if (SUCCEEDED(hr)) + { + IUnknown *pUnknown; + hr = IUnknown_QueryInterface((IUnknown*)pStiA, &IID_IStillImageA, (void**)&pUnknown); + if (SUCCEEDED(hr)) + { + ok(pUnknown == (IUnknown*)pStiA, "created interface was not IID_IStillImageA\n"); + IUnknown_Release(pUnknown); + } + IUnknown_Release((IUnknown*)pStiA); + } + else + todo_wine ok(0, "could not create StillImageA, hr = 0x%X\n", hr); + } + else + skip("No StiCreateInstanceA function\n"); + + if (pStiCreateInstanceW) + { + PSTIW pStiW; + hr = pStiCreateInstanceW(GetModuleHandle(NULL), STI_VERSION_REAL, &pStiW, NULL); + if (SUCCEEDED(hr)) + { + IUnknown *pUnknown; + hr = IUnknown_QueryInterface((IUnknown*)pStiW, &IID_IStillImageW, (void**)&pUnknown); + if (SUCCEEDED(hr)) + { + ok(pUnknown == (IUnknown*)pStiW, "created interface was not IID_IStillImageW\n"); + IUnknown_Release((IUnknown*)pUnknown); + } + IUnknown_Release((IUnknown*)pStiW); + } + else + todo_wine ok(0, "could not create StillImageW, hr = 0x%X\n", hr); + } + else + skip("No StiCreateInstanceW function\n"); +} + +START_TEST(sti) +{ + if (SUCCEEDED(CoInitialize(NULL))) + { + if (init_function_pointers()) + { + test_version_flag_versus_aw(); + FreeLibrary(sti_dll); + } + else + skip("could not load sti.dll\n"); + CoUninitialize(); + } + else + skip("CoInitialize failed\n"); +} diff --git a/dlls/system.drv16/Makefile.in b/dlls/system.drv16/Makefile.in new file mode 100644 index 00000000000..f3e64b0f7e2 --- /dev/null +++ b/dlls/system.drv16/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = system.drv16 +IMPORTS = kernel32 ntdll +EXTRADLLFLAGS = -Wb,--subsystem,win16 + +C_SRCS = system.c + +@MAKE_DLL_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/kernel32/system.c b/dlls/system.drv16/system.c similarity index 96% rename from dlls/kernel32/system.c rename to dlls/system.drv16/system.c index 9395d83302a..46ab04ec93d 100644 --- a/dlls/kernel32/system.c +++ b/dlls/system.drv16/system.c @@ -122,6 +122,7 @@ static void SYSTEM_StopTicks(void) DWORD WINAPI InquireSystem16( WORD code, WORD arg ) { WORD drivetype; + WCHAR root[3]; switch(code) { @@ -129,7 +130,12 @@ DWORD WINAPI InquireSystem16( WORD code, WORD arg ) return SYS_TIMER_RATE; case 1: /* Get drive type */ - drivetype = GetDriveType16( arg ); + root[0] = 'A' + arg; + root[1] = ':'; + root[2] = 0; + drivetype = GetDriveTypeW( root ); + if (drivetype == DRIVE_CDROM) drivetype = DRIVE_REMOTE; + else if (drivetype == DRIVE_NO_ROOT_DIR) drivetype = DRIVE_UNKNOWN; return MAKELONG( drivetype, drivetype ); case 2: /* Enable one-drive logic */ diff --git a/dlls/kernel32/system.drv.spec b/dlls/system.drv16/system.drv16.spec similarity index 100% rename from dlls/kernel32/system.drv.spec rename to dlls/system.drv16/system.drv16.spec diff --git a/dlls/toolhelp.dll16/Makefile.in b/dlls/toolhelp.dll16/Makefile.in new file mode 100644 index 00000000000..75d88420c10 --- /dev/null +++ b/dlls/toolhelp.dll16/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = toolhelp.dll16 +IMPORTS = kernel32 ntdll +EXTRADLLFLAGS = -Wb,--subsystem,win16 + +C_SRCS = toolhelp.c + +@MAKE_DLL_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/toolhelp.dll16/toolhelp.c b/dlls/toolhelp.dll16/toolhelp.c new file mode 100644 index 00000000000..fb001ea3dc4 --- /dev/null +++ b/dlls/toolhelp.dll16/toolhelp.c @@ -0,0 +1,737 @@ +/* + * Toolhelp functions + * + * Copyright 1996 Marcus Meissner + * Copyright 2009 Alexandre Julliard + * + * 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 "config.h" + +#define NONAMELESSUNION +#define NONAMELESSSTRUCT +#include +#include +#include +#ifdef HAVE_UNISTD_H +# include +#endif +#include +#include +#include "windef.h" +#include "winbase.h" +#include "winternl.h" +#include "wownt32.h" + +#include "wine/winbase16.h" +#include "toolhelp.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(toolhelp); + +#include "pshpack1.h" + +typedef struct +{ + void *base; /* Base address (0 if discarded) */ + DWORD size; /* Size in bytes (0 indicates a free block) */ + HGLOBAL16 handle; /* Handle for this block */ + HGLOBAL16 hOwner; /* Owner of this block */ + BYTE lockCount; /* Count of GlobalFix() calls */ + BYTE pageLockCount; /* Count of GlobalPageLock() calls */ + BYTE flags; /* Allocation flags */ + BYTE selCount; /* Number of selectors allocated for this block */ +} GLOBALARENA; + +#define GLOBAL_MAX_COUNT 8192 /* Max number of allocated blocks */ + +typedef struct +{ + WORD check; /* 00 Heap checking flag */ + WORD freeze; /* 02 Heap frozen flag */ + WORD items; /* 04 Count of items on the heap */ + WORD first; /* 06 First item of the heap */ + WORD pad1; /* 08 Always 0 */ + WORD last; /* 0a Last item of the heap */ + WORD pad2; /* 0c Always 0 */ + BYTE ncompact; /* 0e Compactions counter */ + BYTE dislevel; /* 0f Discard level */ + DWORD distotal; /* 10 Total bytes discarded */ + WORD htable; /* 14 Pointer to handle table */ + WORD hfree; /* 16 Pointer to free handle table */ + WORD hdelta; /* 18 Delta to expand the handle table */ + WORD expand; /* 1a Pointer to expand function (unused) */ + WORD pstat; /* 1c Pointer to status structure (unused) */ + FARPROC16 notify; /* 1e Pointer to LocalNotify() function */ + WORD lock; /* 22 Lock count for the heap */ + WORD extra; /* 24 Extra bytes to allocate when expanding */ + WORD minsize; /* 26 Minimum size of the heap */ + WORD magic; /* 28 Magic number */ +} LOCALHEAPINFO; + +typedef struct +{ +/* Arena header */ + WORD prev; /* Previous arena | arena type */ + WORD next; /* Next arena */ +/* Start of the memory block or free-list info */ + WORD size; /* Size of the free block */ + WORD free_prev; /* Previous free block */ + WORD free_next; /* Next free block */ +} LOCALARENA; + +#define LOCAL_ARENA_HEADER_SIZE 4 +#define LOCAL_ARENA_HEADER( handle) ((handle) - LOCAL_ARENA_HEADER_SIZE) +#define LOCAL_ARENA_PTR(ptr,arena) ((LOCALARENA *)((char *)(ptr)+(arena))) + +typedef struct +{ + WORD null; /* Always 0 */ + DWORD old_ss_sp; /* Stack pointer; used by SwitchTaskTo() */ + WORD heap; /* Pointer to the local heap information (if any) */ + WORD atomtable; /* Pointer to the local atom table (if any) */ + WORD stacktop; /* Top of the stack */ + WORD stackmin; /* Lowest stack address used so far */ + WORD stackbottom; /* Bottom of the stack */ +} INSTANCEDATA; + +typedef struct _THHOOK +{ + HANDLE16 hGlobalHeap; /* 00 (handle BURGERMASTER) */ + WORD pGlobalHeap; /* 02 (selector BURGERMASTER) */ + HMODULE16 hExeHead; /* 04 hFirstModule */ + HMODULE16 hExeSweep; /* 06 (unused) */ + HANDLE16 TopPDB; /* 08 (handle of KERNEL PDB) */ + HANDLE16 HeadPDB; /* 0A (first PDB in list) */ + HANDLE16 TopSizePDB; /* 0C (unused) */ + HTASK16 HeadTDB; /* 0E hFirstTask */ + HTASK16 CurTDB; /* 10 hCurrentTask */ + HTASK16 LoadTDB; /* 12 (unused) */ + HTASK16 LockTDB; /* 14 hLockedTask */ +} THHOOK; + +typedef struct _NE_MODULE +{ + WORD ne_magic; /* 00 'NE' signature */ + WORD count; /* 02 Usage count (ne_ver/ne_rev on disk) */ + WORD ne_enttab; /* 04 Near ptr to entry table */ + HMODULE16 next; /* 06 Selector to next module (ne_cbenttab on disk) */ + WORD dgroup_entry; /* 08 Near ptr to segment entry for DGROUP (ne_crc on disk) */ + WORD fileinfo; /* 0a Near ptr to file info (OFSTRUCT) (ne_crc on disk) */ + WORD ne_flags; /* 0c Module flags */ + WORD ne_autodata; /* 0e Logical segment for DGROUP */ + WORD ne_heap; /* 10 Initial heap size */ + WORD ne_stack; /* 12 Initial stack size */ + DWORD ne_csip; /* 14 Initial cs:ip */ + DWORD ne_sssp; /* 18 Initial ss:sp */ + WORD ne_cseg; /* 1c Number of segments in segment table */ + WORD ne_cmod; /* 1e Number of module references */ + WORD ne_cbnrestab; /* 20 Size of non-resident names table */ + WORD ne_segtab; /* 22 Near ptr to segment table */ + WORD ne_rsrctab; /* 24 Near ptr to resource table */ + WORD ne_restab; /* 26 Near ptr to resident names table */ + WORD ne_modtab; /* 28 Near ptr to module reference table */ + WORD ne_imptab; /* 2a Near ptr to imported names table */ + DWORD ne_nrestab; /* 2c File offset of non-resident names table */ + WORD ne_cmovent; /* 30 Number of moveable entries in entry table*/ + WORD ne_align; /* 32 Alignment shift count */ + WORD ne_cres; /* 34 # of resource segments */ + BYTE ne_exetyp; /* 36 Operating system flags */ + BYTE ne_flagsothers; /* 37 Misc. flags */ + HANDLE16 dlls_to_init; /* 38 List of DLLs to initialize (ne_pretthunks on disk) */ + HANDLE16 nrname_handle; /* 3a Handle to non-resident name table (ne_psegrefbytes on disk) */ + WORD ne_swaparea; /* 3c Min. swap area size */ + WORD ne_expver; /* 3e Expected Windows version */ + /* From here, these are extra fields not present in normal Windows */ + HMODULE module32; /* PE module handle for Win32 modules */ + HMODULE owner32; /* PE module containing this one for 16-bit builtins */ + HMODULE16 self; /* Handle for this module */ + WORD self_loading_sel; /* Selector used for self-loading apps. */ + LPVOID rsrc32_map; /* HRSRC 16->32 map (for 32-bit modules) */ + LPCVOID mapping; /* mapping of the binary file */ + SIZE_T mapping_size; /* size of the file mapping */ +} NE_MODULE; + +#include "poppack.h" + +#define TDB_MAGIC ('T' | ('D' << 8)) + +/* FIXME: to make this work, we have to call back all these registered + * functions from all over the WINE code. Someone with more knowledge than + * me please do that. -Marcus + */ + +static struct notify +{ + HTASK16 htask; + FARPROC16 lpfnCallback; + WORD wFlags; +} *notifys = NULL; + +static int nrofnotifys = 0; + +static THHOOK *get_thhook(void) +{ + static THHOOK *thhook; + + if (!thhook) thhook = MapSL( (SEGPTR)GetProcAddress16( GetModuleHandle16("KERNEL"), (LPCSTR)332 )); + return thhook; +} + +static GLOBALARENA *get_global_arena(void) +{ + return *(GLOBALARENA **)get_thhook(); +} + +static LOCALHEAPINFO *get_local_heap( HANDLE16 ds ) +{ + INSTANCEDATA *ptr = MapSL( MAKESEGPTR( ds, 0 )); + + if (!ptr || !ptr->heap) return NULL; + return (LOCALHEAPINFO*)((char*)ptr + ptr->heap); +} + + +/*********************************************************************** + * GlobalHandleToSel (TOOLHELP.50) + */ +WORD WINAPI GlobalHandleToSel16( HGLOBAL16 handle ) +{ + if (!handle) return 0; + if (!(handle & 7)) return handle - 1; + return handle | 7; +} + + +/*********************************************************************** + * GlobalFirst (TOOLHELP.51) + */ +BOOL16 WINAPI GlobalFirst16( GLOBALENTRY *pGlobal, WORD wFlags ) +{ + if (wFlags == GLOBAL_LRU) return FALSE; + pGlobal->dwNext = 0; + return GlobalNext16( pGlobal, wFlags ); +} + + +/*********************************************************************** + * GlobalNext (TOOLHELP.52) + */ +BOOL16 WINAPI GlobalNext16( GLOBALENTRY *pGlobal, WORD wFlags) +{ + GLOBALARENA *pGlobalArena = get_global_arena(); + GLOBALARENA *pArena; + + if (pGlobal->dwNext >= GLOBAL_MAX_COUNT) return FALSE; + pArena = pGlobalArena + pGlobal->dwNext; + if (wFlags == GLOBAL_FREE) /* only free blocks */ + { + int i; + for (i = pGlobal->dwNext; i < GLOBAL_MAX_COUNT; i++, pArena++) + if (pArena->size == 0) break; /* block is free */ + if (i >= GLOBAL_MAX_COUNT) return FALSE; + pGlobal->dwNext = i; + } + + pGlobal->dwAddress = (DWORD_PTR)pArena->base; + pGlobal->dwBlockSize = pArena->size; + pGlobal->hBlock = pArena->handle; + pGlobal->wcLock = pArena->lockCount; + pGlobal->wcPageLock = pArena->pageLockCount; + pGlobal->wFlags = (GetCurrentPDB16() == pArena->hOwner); + pGlobal->wHeapPresent = FALSE; + pGlobal->hOwner = pArena->hOwner; + pGlobal->wType = GT_UNKNOWN; + pGlobal->wData = 0; + pGlobal->dwNext++; + return TRUE; +} + + +/*********************************************************************** + * GlobalInfo (TOOLHELP.53) + */ +BOOL16 WINAPI GlobalInfo16( GLOBALINFO *pInfo ) +{ + GLOBALARENA *pGlobalArena = get_global_arena(); + GLOBALARENA *pArena; + int i; + + pInfo->wcItems = GLOBAL_MAX_COUNT; + pInfo->wcItemsFree = 0; + pInfo->wcItemsLRU = 0; + for (i = 0, pArena = pGlobalArena; i < GLOBAL_MAX_COUNT; i++, pArena++) + if (pArena->size == 0) pInfo->wcItemsFree++; + return TRUE; +} + + +/*********************************************************************** + * GlobalEntryHandle (TOOLHELP.54) + */ +BOOL16 WINAPI GlobalEntryHandle16( GLOBALENTRY *pGlobal, HGLOBAL16 hItem ) +{ + GLOBALARENA *pGlobalArena = get_global_arena(); + GLOBALARENA *pArena = pGlobalArena + (hItem >> __AHSHIFT); + + pGlobal->dwAddress = (DWORD_PTR)pArena->base; + pGlobal->dwBlockSize = pArena->size; + pGlobal->hBlock = pArena->handle; + pGlobal->wcLock = pArena->lockCount; + pGlobal->wcPageLock = pArena->pageLockCount; + pGlobal->wFlags = (GetCurrentPDB16() == pArena->hOwner); + pGlobal->wHeapPresent = FALSE; + pGlobal->hOwner = pArena->hOwner; + pGlobal->wType = GT_UNKNOWN; + pGlobal->wData = 0; + pGlobal->dwNext++; + return TRUE; +} + + +/*********************************************************************** + * GlobalEntryModule (TOOLHELP.55) + */ +BOOL16 WINAPI GlobalEntryModule16( GLOBALENTRY *pGlobal, HMODULE16 hModule, + WORD wSeg ) +{ + FIXME("(%p, 0x%04x, 0x%04x), stub.\n", pGlobal, hModule, wSeg); + return FALSE; +} + + +/*********************************************************************** + * LocalInfo (TOOLHELP.56) + */ +BOOL16 WINAPI LocalInfo16( LOCALINFO *pLocalInfo, HGLOBAL16 handle ) +{ + LOCALHEAPINFO *pInfo = get_local_heap( SELECTOROF(WOWGlobalLock16(handle)) ); + if (!pInfo) return FALSE; + pLocalInfo->wcItems = pInfo->items; + return TRUE; +} + + +/*********************************************************************** + * LocalFirst (TOOLHELP.57) + */ +BOOL16 WINAPI LocalFirst16( LOCALENTRY *pLocalEntry, HGLOBAL16 handle ) +{ + WORD ds = GlobalHandleToSel16( handle ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); + LOCALHEAPINFO *pInfo = get_local_heap( ds ); + if (!pInfo) return FALSE; + + pLocalEntry->hHandle = pInfo->first + LOCAL_ARENA_HEADER_SIZE; + pLocalEntry->wAddress = pLocalEntry->hHandle; + pLocalEntry->wFlags = LF_FIXED; + pLocalEntry->wcLock = 0; + pLocalEntry->wType = LT_NORMAL; + pLocalEntry->hHeap = handle; + pLocalEntry->wHeapType = NORMAL_HEAP; + pLocalEntry->wNext = LOCAL_ARENA_PTR(ptr,pInfo->first)->next; + pLocalEntry->wSize = pLocalEntry->wNext - pLocalEntry->hHandle; + return TRUE; +} + + +/*********************************************************************** + * LocalNext (TOOLHELP.58) + */ +BOOL16 WINAPI LocalNext16( LOCALENTRY *pLocalEntry ) +{ + WORD ds = GlobalHandleToSel16( pLocalEntry->hHeap ); + char *ptr = MapSL( MAKESEGPTR( ds, 0 ) ); + LOCALARENA *pArena; + + if (!get_local_heap( ds )) return FALSE; + if (!pLocalEntry->wNext) return FALSE; + pArena = LOCAL_ARENA_PTR( ptr, pLocalEntry->wNext ); + + pLocalEntry->hHandle = pLocalEntry->wNext + LOCAL_ARENA_HEADER_SIZE; + pLocalEntry->wAddress = pLocalEntry->hHandle; + pLocalEntry->wFlags = (pArena->prev & 3) + 1; + pLocalEntry->wcLock = 0; + pLocalEntry->wType = LT_NORMAL; + if (pArena->next != pLocalEntry->wNext) /* last one? */ + pLocalEntry->wNext = pArena->next; + else + pLocalEntry->wNext = 0; + pLocalEntry->wSize = pLocalEntry->wNext - pLocalEntry->hHandle; + return TRUE; +} + + +/********************************************************************** + * ModuleFirst (TOOLHELP.59) + */ +BOOL16 WINAPI ModuleFirst16( MODULEENTRY *lpme ) +{ + lpme->wNext = get_thhook()->hExeHead; + return ModuleNext16( lpme ); +} + + +/********************************************************************** + * ModuleNext (TOOLHELP.60) + */ +BOOL16 WINAPI ModuleNext16( MODULEENTRY *lpme ) +{ + NE_MODULE *pModule; + char *name; + + if (!lpme->wNext) return FALSE; + if (!(pModule = GlobalLock16( GetExePtr(lpme->wNext) ))) return FALSE; + name = (char *)pModule + pModule->ne_restab; + memcpy( lpme->szModule, name + 1, min(*name, MAX_MODULE_NAME) ); + lpme->szModule[min(*name, MAX_MODULE_NAME)] = '\0'; + lpme->hModule = lpme->wNext; + lpme->wcUsage = pModule->count; + name = ((OFSTRUCT *)((char*)pModule + pModule->fileinfo))->szPathName; + lstrcpynA( lpme->szExePath, name, sizeof(lpme->szExePath) ); + lpme->wNext = pModule->next; + return TRUE; +} + + +/********************************************************************** + * ModuleFindName (TOOLHELP.61) + */ +BOOL16 WINAPI ModuleFindName16( MODULEENTRY *lpme, LPCSTR name ) +{ + lpme->wNext = GetModuleHandle16( name ); + return ModuleNext16( lpme ); +} + + +/********************************************************************** + * ModuleFindHandle (TOOLHELP.62) + */ +BOOL16 WINAPI ModuleFindHandle16( MODULEENTRY *lpme, HMODULE16 hModule ) +{ + hModule = GetExePtr( hModule ); + lpme->wNext = hModule; + return ModuleNext16( lpme ); +} + + +/*********************************************************************** + * TaskFirst (TOOLHELP.63) + */ +BOOL16 WINAPI TaskFirst16( TASKENTRY *lpte ) +{ + lpte->hNext = get_thhook()->HeadTDB; + return TaskNext16( lpte ); +} + + +/*********************************************************************** + * TaskNext (TOOLHELP.64) + */ +BOOL16 WINAPI TaskNext16( TASKENTRY *lpte ) +{ + TDB *pTask; + INSTANCEDATA *pInstData; + + TRACE_(toolhelp)("(%p): task=%04x\n", lpte, lpte->hNext ); + if (!lpte->hNext) return FALSE; + + /* make sure that task and hInstance are valid (skip initial Wine task !) */ + while (1) { + pTask = GlobalLock16( lpte->hNext ); + if (!pTask || pTask->magic != TDB_MAGIC) return FALSE; + if (pTask->hInstance) + break; + lpte->hNext = pTask->hNext; + } + pInstData = MapSL( MAKESEGPTR( GlobalHandleToSel16(pTask->hInstance), 0 ) ); + lpte->hTask = lpte->hNext; + lpte->hTaskParent = pTask->hParent; + lpte->hInst = pTask->hInstance; + lpte->hModule = pTask->hModule; + lpte->wSS = SELECTOROF( pTask->teb->WOW32Reserved ); + lpte->wSP = OFFSETOF( pTask->teb->WOW32Reserved ); + lpte->wStackTop = pInstData->stacktop; + lpte->wStackMinimum = pInstData->stackmin; + lpte->wStackBottom = pInstData->stackbottom; + lpte->wcEvents = pTask->nEvents; + lpte->hQueue = pTask->hQueue; + lstrcpynA( lpte->szModule, pTask->module_name, sizeof(lpte->szModule) ); + lpte->wPSPOffset = 0x100; /*??*/ + lpte->hNext = pTask->hNext; + return TRUE; +} + + +/*********************************************************************** + * TaskFindHandle (TOOLHELP.65) + */ +BOOL16 WINAPI TaskFindHandle16( TASKENTRY *lpte, HTASK16 hTask ) +{ + lpte->hNext = hTask; + return TaskNext16( lpte ); +} + + +/*********************************************************************** + * MemManInfo (TOOLHELP.72) + */ +BOOL16 WINAPI MemManInfo16( MEMMANINFO *info ) +{ + MEMORYSTATUS status; + + /* + * Not unsurprisingly although the documentation says you + * _must_ provide the size in the dwSize field, this function + * (under Windows) always fills the structure and returns true. + */ + GlobalMemoryStatus( &status ); + info->wPageSize = getpagesize(); + info->dwLargestFreeBlock = status.dwAvailVirtual; + info->dwMaxPagesAvailable = info->dwLargestFreeBlock / info->wPageSize; + info->dwMaxPagesLockable = info->dwMaxPagesAvailable; + info->dwTotalLinearSpace = status.dwTotalVirtual / info->wPageSize; + info->dwTotalUnlockedPages = info->dwTotalLinearSpace; + info->dwFreePages = info->dwMaxPagesAvailable; + info->dwTotalPages = info->dwTotalLinearSpace; + info->dwFreeLinearSpace = info->dwMaxPagesAvailable; + info->dwSwapFilePages = status.dwTotalPageFile / info->wPageSize; + return TRUE; +} + + +/*********************************************************************** + * NotifyRegister (TOOLHELP.73) + */ +BOOL16 WINAPI NotifyRegister16( HTASK16 htask, FARPROC16 lpfnCallback, + WORD wFlags ) +{ + int i; + + FIXME("(%x,%x,%x), semi-stub.\n", + htask, (DWORD)lpfnCallback, wFlags ); + if (!htask) htask = GetCurrentTask(); + for (i=0;i limit) return 0; + if (offset + count > limit + 1) count = limit + 1 - offset; + memcpy( buffer, (char *)wine_ldt_get_base(&entry) + offset, count ); + return count; +} + + +/*********************************************************************** + * MemoryWrite (TOOLHELP.79) + */ +DWORD WINAPI MemoryWrite16( WORD sel, DWORD offset, void *buffer, DWORD count ) +{ + LDT_ENTRY entry; + DWORD limit; + + wine_ldt_get_entry( sel, &entry ); + if (wine_ldt_is_empty( &entry )) return 0; + limit = wine_ldt_get_limit( &entry ); + if (offset > limit) return 0; + if (offset + count > limit) count = limit + 1 - offset; + memcpy( (char *)wine_ldt_get_base(&entry) + offset, buffer, count ); + return count; +} + +/*********************************************************************** + * TimerCount (TOOLHELP.80) + */ +BOOL16 WINAPI TimerCount16( TIMERINFO *pTimerInfo ) +{ + /* FIXME + * In standard mode, dwmsSinceStart = dwmsThisVM + * + * I tested this, under Windows in enhanced mode, and + * if you never switch VM (ie start/stop DOS) these + * values should be the same as well. + * + * Also, Wine should adjust for the hardware timer + * to reduce the amount of error to ~1ms. + * I can't be bothered, can you? + */ + pTimerInfo->dwmsSinceStart = pTimerInfo->dwmsThisVM = GetTickCount(); + return TRUE; +} + +/*********************************************************************** + * SystemHeapInfo (TOOLHELP.71) + */ +BOOL16 WINAPI SystemHeapInfo16( SYSHEAPINFO *pHeapInfo ) +{ + STACK16FRAME* stack16 = MapSL((SEGPTR)NtCurrentTeb()->WOW32Reserved); + HANDLE16 oldDS = stack16->ds; + WORD user = LoadLibrary16( "USER.EXE" ); + WORD gdi = LoadLibrary16( "GDI.EXE" ); + stack16->ds = user; + pHeapInfo->wUserFreePercent = (int)LocalCountFree16() * 100 / LocalHeapSize16(); + stack16->ds = gdi; + pHeapInfo->wGDIFreePercent = (int)LocalCountFree16() * 100 / LocalHeapSize16(); + stack16->ds = oldDS; + pHeapInfo->hUserSegment = user; + pHeapInfo->hGDISegment = gdi; + FreeLibrary16( user ); + FreeLibrary16( gdi ); + return TRUE; +} + +/*********************************************************************** + * Local32Info (TOOLHELP.84) + */ +BOOL16 WINAPI Local32Info16( LOCAL32INFO *pLocal32Info, HGLOBAL16 handle ) +{ + FIXME( "Call Local32Info16 in kernel\n" ); + return FALSE; +} + +/*********************************************************************** + * Local32First (TOOLHELP.85) + */ +BOOL16 WINAPI Local32First16( LOCAL32ENTRY *pLocal32Entry, HGLOBAL16 handle ) +{ + FIXME( "Call Local32First16 in kernel\n" ); + return FALSE; +} + +/*********************************************************************** + * Local32Next (TOOLHELP.86) + */ +BOOL16 WINAPI Local32Next16( LOCAL32ENTRY *pLocal32Entry ) +{ + FIXME( "Call Local32Next16 in kernel\n" ); + return FALSE; +} diff --git a/dlls/kernel32/toolhelp.spec b/dlls/toolhelp.dll16/toolhelp.dll16.spec similarity index 100% rename from dlls/kernel32/toolhelp.spec rename to dlls/toolhelp.dll16/toolhelp.dll16.spec diff --git a/dlls/kernel32/toolhelp.h b/dlls/toolhelp.dll16/toolhelp.h similarity index 96% rename from dlls/kernel32/toolhelp.h rename to dlls/toolhelp.dll16/toolhelp.h index 6506aaeccf7..da41a888c79 100644 --- a/dlls/kernel32/toolhelp.h +++ b/dlls/toolhelp.dll16/toolhelp.h @@ -102,13 +102,6 @@ BOOL16 WINAPI GlobalEntryHandle16( GLOBALENTRY *pGlobal, HGLOBAL16 hItem ); BOOL16 WINAPI GlobalEntryModule16( GLOBALENTRY *pGlobal, HMODULE16 hModule, WORD wSeg ); -/* FIXME: Wine internal functions */ -extern HGLOBAL16 GLOBAL_CreateBlock( UINT16 flags, void *ptr, DWORD size, - HGLOBAL16 hOwner, unsigned char selflags ); -extern BOOL16 GLOBAL_FreeBlock( HGLOBAL16 handle ); -extern BOOL16 GLOBAL_MoveBlock( HGLOBAL16 handle, void *ptr, DWORD size ); -extern HGLOBAL16 GLOBAL_Alloc( WORD flags, DWORD size, HGLOBAL16 hOwner, unsigned char selflags ); - /* Local heap */ typedef struct diff --git a/dlls/urlmon/sec_mgr.c b/dlls/urlmon/sec_mgr.c index 9d0e7994cbf..7a1255a49ad 100644 --- a/dlls/urlmon/sec_mgr.c +++ b/dlls/urlmon/sec_mgr.c @@ -238,6 +238,7 @@ static HRESULT get_action_policy(DWORD zone, DWORD action, BYTE *policy, DWORD s switch(action) { case URLACTION_SCRIPT_OVERRIDE_SAFETY: + case URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY: *(DWORD*)policy = URLPOLICY_DISALLOW; return S_OK; } @@ -536,7 +537,7 @@ static HRESULT WINAPI SecManagerImpl_ProcessUrlAction(IInternetSecurityManager * return hres; } - if(pContext || cbContext || dwFlags || dwReserved) + if(dwFlags || dwReserved) FIXME("Unsupported arguments\n"); if(!pwszUrl) @@ -551,6 +552,8 @@ static HRESULT WINAPI SecManagerImpl_ProcessUrlAction(IInternetSecurityManager * return hres; TRACE("policy %x\n", policy); + if(cbPolicy >= sizeof(DWORD)) + *(DWORD*)pPolicy = policy; switch(GetUrlPolicyPermissions(policy)) { case URLPOLICY_ALLOW: @@ -588,8 +591,8 @@ static HRESULT WINAPI SecManagerImpl_QueryCustomPolicy(IInternetSecurityManager return hres; } - FIXME("Default action is not implemented\n"); - return E_NOTIMPL; + WARN("Unknown guidKey %s\n", debugstr_guid(guidKey)); + return HRESULT_FROM_WIN32(ERROR_NOT_FOUND); } static HRESULT WINAPI SecManagerImpl_SetZoneMapping(IInternetSecurityManager *iface, diff --git a/dlls/urlmon/tests/sec_mgr.c b/dlls/urlmon/tests/sec_mgr.c index 9d9e19c0209..62471cf8de5 100644 --- a/dlls/urlmon/tests/sec_mgr.c +++ b/dlls/urlmon/tests/sec_mgr.c @@ -68,6 +68,13 @@ static const BYTE secid10[] = static const BYTE secid10_2[] = {'f','i','l','e',':','s','o','m','e',' ','f','i','l','e','.','j','p','g',3,0,0,0}; +static const GUID CLSID_TestActiveX = + {0x178fc163,0xf585,0x4e24,{0x9c,0x13,0x4b,0xb7,0xfa,0xf8,0x06,0x46}}; + +/* Defined as extern in urlmon.idl, but not exported by uuid.lib */ +const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY = + {0x10200490,0xfa38,0x11d0,{0xac,0x0e,0x00,0xa0,0xc9,0xf,0xff,0xc0}}; + static struct secmgr_test { LPCWSTR url; DWORD zone; @@ -213,13 +220,15 @@ static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManag policy = 0xdeadbeef; hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy, sizeof(WCHAR), NULL, 0, 0, 0); - ok(hres == E_FAIL, "ProcessUrlAction(%x) failed: %08x, expected E_FAIL\n", action, hres); + ok(hres == E_FAIL || broken(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)), + "(0x%x) got 0x%x (expected E_FAIL)\n", action, hres); ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy); policy = 0xdeadbeef; hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, action, (BYTE*)&policy, sizeof(DWORD), URLZONEREG_DEFAULT); - ok(hres == E_FAIL, "GetZoneActionPolicy failed: %08x, expected E_FAIL\n", hres); + ok(hres == E_FAIL || broken(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)), + "(0x%x) got 0x%x (expected E_FAIL)\n", action, hres); ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy); return; } @@ -240,6 +249,33 @@ static void test_url_action(IInternetSecurityManager *secmgr, IInternetZoneManag else ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres); ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy); + + policy = 0xdeadbeef; + hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy, + 2, NULL, 0, 0, 0); + if(reg_policy == URLPOLICY_DISALLOW) + ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres); + else + ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres); + ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy); + + policy = 0xdeadbeef; + hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy, + sizeof(DWORD), NULL, 0, 0, 0); + if(reg_policy == URLPOLICY_DISALLOW) + ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres); + else + ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres); + ok(policy == reg_policy, "(%x) policy=%x\n", action, policy); + + policy = 0xdeadbeef; + hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url9, action, (BYTE*)&policy, + sizeof(WCHAR), (BYTE*)0xdeadbeef, 16, 0, 0); + if(reg_policy == URLPOLICY_DISALLOW) + ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres); + else + ok(hres == S_OK, "ProcessUrlAction(%x) failed: %08x\n", action, hres); + ok(policy == 0xdeadbeef, "(%x) policy=%x\n", action, policy); }else { skip("IE running in Enhanced Security Configuration\n"); } @@ -261,6 +297,33 @@ static void test_special_url_action(IInternetSecurityManager *secmgr, IInternetZ hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, action, (BYTE*)&policy, sizeof(WCHAR), NULL, 0, 0, 0); ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres); + + policy = 0xdeadbeef; + hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, action, (BYTE*)&policy, + sizeof(DWORD), NULL, 0, 0, 0); + ok(hres == S_FALSE, "ProcessUrlAction(%x) failed: %08x, expected S_FALSE\n", action, hres); + ok(policy == URLPOLICY_DISALLOW, "policy = %x\n", policy); +} + +static void test_activex(IInternetSecurityManager *secmgr) +{ + DWORD policy, policy_size; + struct CONFIRMSAFETY cs; + BYTE *ppolicy; + HRESULT hres; + + policy = 0xdeadbeef; + hres = IInternetSecurityManager_ProcessUrlAction(secmgr, url1, URLACTION_ACTIVEX_RUN, (BYTE*)&policy, + sizeof(DWORD), (BYTE*)&CLSID_TestActiveX, sizeof(CLSID), 0, 0); + ok(hres == S_OK, "ProcessUrlAction(URLACTION_ACTIVEX_RUN) failed: %08x\n", hres); + ok(policy == URLPOLICY_ALLOW || policy == URLPOLICY_DISALLOW, "policy = %x\n", policy); + + cs.clsid = CLSID_TestActiveX; + cs.pUnk = (IUnknown*)0xdeadbeef; + cs.dwFlags = 0; + hres = IInternetSecurityManager_QueryCustomPolicy(secmgr, url1, &GUID_CUSTOM_CONFIRMOBJECTSAFETY, + &ppolicy, &policy_size, (BYTE*)&cs, sizeof(cs), 0); + ok(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND), "QueryCusromPolicy failed: %08x\n", hres); } static void test_polices(void) @@ -275,11 +338,15 @@ static void test_polices(void) ok(hres == S_OK, "CoInternetCreateZoneManager failed: %08x\n", hres); test_url_action(secmgr, zonemgr, URLACTION_SCRIPT_RUN); + test_url_action(secmgr, zonemgr, URLACTION_ACTIVEX_RUN); test_url_action(secmgr, zonemgr, URLACTION_ACTIVEX_OVERRIDE_OBJECT_SAFETY); test_url_action(secmgr, zonemgr, URLACTION_CHANNEL_SOFTDIST_PERMISSIONS); test_url_action(secmgr, zonemgr, 0xdeadbeef); test_special_url_action(secmgr, zonemgr, URLACTION_SCRIPT_OVERRIDE_SAFETY); + test_special_url_action(secmgr, zonemgr, URLACTION_ACTIVEX_OVERRIDE_SCRIPT_SAFETY); + + test_activex(secmgr); IInternetSecurityManager_Release(secmgr); IInternetZoneManager_Release(zonemgr); @@ -425,7 +492,8 @@ static void test_GetZoneActionPolicy(void) hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 3, 0x1fff, buf, sizeof(DWORD), URLZONEREG_DEFAULT); - ok(hres == E_FAIL, "GetZoneActionPolicy failed: %08x, expected E_FAIL\n", hres); + ok(hres == E_FAIL || broken(hres == HRESULT_FROM_WIN32(ERROR_NOT_FOUND)), + "(0x%x) got 0x%x (expected E_FAIL)\n", action, hres); hres = IInternetZoneManager_GetZoneActionPolicy(zonemgr, 13, action, buf, sizeof(DWORD), URLZONEREG_DEFAULT); diff --git a/dlls/user32/message.c b/dlls/user32/message.c index 3f7a4cd21c5..4e9a62c9820 100644 --- a/dlls/user32/message.c +++ b/dlls/user32/message.c @@ -43,6 +43,7 @@ #include "win.h" #include "controls.h" #include "wine/debug.h" +#include "wine/exception.h" WINE_DEFAULT_DEBUG_CHANNEL(msg); WINE_DECLARE_DEBUG_CHANNEL(relay); @@ -3065,8 +3066,20 @@ LRESULT WINAPI DispatchMessageA( const MSG* msg ) /* Process timer messages */ if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) { - if (msg->lParam) return CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd, - msg->message, msg->wParam, GetTickCount() ); + if (msg->lParam) + { + __TRY + { + retval = CallWindowProcA( (WNDPROC)msg->lParam, msg->hwnd, + msg->message, msg->wParam, GetTickCount() ); + } + __EXCEPT_PAGE_FAULT + { + retval = 0; + } + __ENDTRY + return retval; + } } if (!msg->hwnd) return 0; @@ -3103,7 +3116,8 @@ LRESULT WINAPI DispatchMessageA( const MSG* msg ) * If the lpMsg parameter points to a WM_TIMER message and the * parameter of the WM_TIMER message is not NULL, the lParam parameter * points to the function that is called instead of the window - * procedure. + * procedure. The function stored in lParam (timer callback) is protected + * from causing page-faults. * * The message must be valid. * @@ -3123,8 +3137,20 @@ LRESULT WINAPI DispatchMessageW( const MSG* msg ) /* Process timer messages */ if ((msg->message == WM_TIMER) || (msg->message == WM_SYSTIMER)) { - if (msg->lParam) return CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd, - msg->message, msg->wParam, GetTickCount() ); + if (msg->lParam) + { + __TRY + { + retval = CallWindowProcW( (WNDPROC)msg->lParam, msg->hwnd, + msg->message, msg->wParam, GetTickCount() ); + } + __EXCEPT_PAGE_FAULT + { + retval = 0; + } + __ENDTRY + return retval; + } } if (!msg->hwnd) return 0; diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 94757a30613..8d8140457ac 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -2317,8 +2317,15 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, WINE_SPI_FIXME(SPI_SETMOUSESONAR); /* 0x101D _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/ WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCK); /* 0x101E _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/ WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCK); /* 0x101F _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/ - WINE_SPI_FIXME(SPI_GETMOUSEVANISH); /* 0x1020 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/ - WINE_SPI_FIXME(SPI_SETMOUSEVANISH); /* 0x1021 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/ + + case SPI_GETMOUSEVANISH: + ret = get_user_pref_param( 2, 0x01, pvParam ); + break; + + case SPI_SETMOUSEVANISH: + ret = set_user_pref_param( 2, 0x01, PtrToUlong(pvParam), fWinIni ); + break; + case SPI_GETFLATMENU: ret = get_user_pref_param( 2, 0x02, pvParam ); break; @@ -2327,8 +2334,14 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam, ret = set_user_pref_param( 2, 0x02, PtrToUlong(pvParam), fWinIni ); break; - WINE_SPI_FIXME(SPI_GETDROPSHADOW); /* 0x1024 _WIN32_WINNT >= 0x510 */ - WINE_SPI_FIXME(SPI_SETDROPSHADOW); /* 0x1025 _WIN32_WINNT >= 0x510 */ + case SPI_GETDROPSHADOW: + ret = get_user_pref_param( 2, 0x04, pvParam ); + break; + + case SPI_SETDROPSHADOW: + ret = set_user_pref_param( 2, 0x04, PtrToUlong(pvParam), fWinIni ); + break; + WINE_SPI_FIXME(SPI_GETBLOCKSENDINPUTRESETS); WINE_SPI_FIXME(SPI_SETBLOCKSENDINPUTRESETS); case SPI_GETUIEFFECTS: diff --git a/dlls/user32/tests/msg.c b/dlls/user32/tests/msg.c index 9208c9d997e..761f3aa8ddc 100644 --- a/dlls/user32/tests/msg.c +++ b/dlls/user32/tests/msg.c @@ -5257,7 +5257,7 @@ static WNDPROC old_button_proc; static LRESULT CALLBACK button_hook_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static long defwndproc_counter = 0; + static LONG defwndproc_counter = 0; LRESULT ret; struct recvd_message msg; @@ -5458,7 +5458,7 @@ static WNDPROC old_static_proc; static LRESULT CALLBACK static_hook_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static long defwndproc_counter = 0; + static LONG defwndproc_counter = 0; LRESULT ret; struct recvd_message msg; @@ -5553,7 +5553,7 @@ static WNDPROC old_combobox_proc; static LRESULT CALLBACK combobox_hook_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static long defwndproc_counter = 0; + static LONG defwndproc_counter = 0; LRESULT ret; struct recvd_message msg; @@ -7813,6 +7813,12 @@ static VOID CALLBACK tfunc(HWND hwnd, UINT uMsg, UINT_PTR id, DWORD dwTime) { } +static VOID CALLBACK tfunc_crash(HWND hwnd, UINT uMsg, UINT_PTR id, DWORD dwTime) +{ + /* Crash on purpose */ + *(volatile int *)0 = 2; +} + #define TIMER_ID 0x19 static DWORD WINAPI timer_thread_proc(LPVOID x) @@ -7834,6 +7840,7 @@ static void test_timers(void) { struct timer_info info; DWORD id; + MSG msg; info.hWnd = CreateWindow ("TestWindowClass", NULL, WS_OVERLAPPEDWINDOW , @@ -7856,6 +7863,26 @@ static void test_timers(void) ok( KillTimer(info.hWnd, TIMER_ID), "KillTimer failed\n"); ok(DestroyWindow(info.hWnd), "failed to destroy window\n"); + + /* Test timer callback with crash */ + SetLastError(0xdeadbeef); + info.hWnd = CreateWindowW(testWindowClassW, NULL, + WS_OVERLAPPEDWINDOW , + CW_USEDEFAULT, CW_USEDEFAULT, 300, 300, 0, + NULL, NULL, 0); + if ((!info.hWnd && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) || /* Win9x/Me */ + (!pGetMenuInfo)) /* Win95/NT4 */ + { + win_skip("Test would crash on Win9x/WinMe/NT4\n"); + DestroyWindow(info.hWnd); + return; + } + info.id = SetTimer(info.hWnd, TIMER_ID, 0, tfunc_crash); + ok(info.id, "SetTimer failed\n"); + Sleep(150); + while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) DispatchMessage(&msg); + + ok(DestroyWindow(info.hWnd), "failed to destroy window\n"); } static int count = 0; @@ -8984,7 +9011,7 @@ static WNDPROC old_edit_proc; static LRESULT CALLBACK edit_hook_proc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) { - static long defwndproc_counter = 0; + static LONG defwndproc_counter = 0; LRESULT ret; struct recvd_message msg; diff --git a/dlls/user32/tests/text.c b/dlls/user32/tests/text.c index 080e5dd59f5..88ea6b566c0 100644 --- a/dlls/user32/tests/text.c +++ b/dlls/user32/tests/text.c @@ -80,7 +80,7 @@ static void test_DrawTextCalcRect(void) ok( textheight, "DrawTextA error %u\n", GetLastError()); trace("MM_HIENGLISH rect.bottom %d\n", rect.bottom); - todo_wine ok(rect.bottom < 0, "In MM_HIENGLISH, DrawText with " + ok(rect.bottom < 0, "In MM_HIENGLISH, DrawText with " "DT_CALCRECT should return a negative rectangle bottom. " "(bot=%d)\n", rect.bottom); diff --git a/dlls/user32/text.c b/dlls/user32/text.c index b8aad0b6f26..e34877fe739 100644 --- a/dlls/user32/text.c +++ b/dlls/user32/text.c @@ -855,6 +855,7 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count, int tabwidth /* to keep gcc happy */ = 0; int prefix_offset; ellipsis_data ellip; + int invert_y=0; TRACE("%s, %d, [%s] %08x\n", debugstr_wn (str, count), count, wine_dbgstr_rect(rect), flags); @@ -898,6 +899,15 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count, } } + if (GetGraphicsMode(hdc) == GM_COMPATIBLE) + { + SIZE window_ext, viewport_ext; + GetWindowExtEx(hdc, &window_ext); + GetViewportExtEx(hdc, &viewport_ext); + if ((window_ext.cy > 0) != (viewport_ext.cy > 0)) + invert_y = 1; + } + if (dtp) { lmargin = dtp->iLeftMargin; @@ -932,7 +942,10 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count, do { len = sizeof(line)/sizeof(line[0]); - last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom; + if (invert_y) + last_line = !(flags & DT_NOCLIP) && y - ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) < rect->bottom; + else + last_line = !(flags & DT_NOCLIP) && y + ((flags & DT_EDITCONTROL) ? 2*lh-1 : lh) > rect->bottom; strPtr = TEXT_NextLineW(hdc, strPtr, &count, line, &len, width, flags, &size, last_line, &p_retstr, tabwidth, &prefix_offset, &ellip); if (flags & DT_CENTER) x = (rect->left + rect->right - @@ -1001,7 +1014,10 @@ INT WINAPI DrawTextExW( HDC hdc, LPWSTR str, INT i_count, else if (size.cx > max_width) max_width = size.cx; - y += lh; + if (invert_y) + y -= lh; + else + y += lh; if (dtp) dtp->uiLengthDrawn += len; } diff --git a/dlls/ver.dll16/Makefile.in b/dlls/ver.dll16/Makefile.in new file mode 100644 index 00000000000..6d0c30a26cd --- /dev/null +++ b/dlls/ver.dll16/Makefile.in @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = ver.dll16 +IMPORTS = version lz32 kernel32 + +EXTRADLLFLAGS = -Wb,--subsystem,win16,--main-module,version.dll + +C_SRCS = version.c + +@MAKE_DLL_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/version/ver.spec b/dlls/ver.dll16/ver.dll16.spec similarity index 100% rename from dlls/version/ver.spec rename to dlls/ver.dll16/ver.dll16.spec diff --git a/dlls/version/resource.c b/dlls/ver.dll16/version.c similarity index 75% copy from dlls/version/resource.c copy to dlls/ver.dll16/version.c index efd9115045a..950b650ca3f 100644 --- a/dlls/version/resource.c +++ b/dlls/ver.dll16/version.c @@ -1,7 +1,7 @@ /* - * Implementation of VERSION.DLL - Resource Access routines + * Implementation of VER.DLL * - * Copyright 1996,1997 Marcus Meissner + * Copyright 1996, 1997 Marcus Meissner * Copyright 1997 David Cuthbert * Copyright 1999 Ulrich Weigand * @@ -20,30 +20,27 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include -#include #include #include #include -#ifdef HAVE_UNISTD_H -# include -#endif #define NONAMELESSUNION #define NONAMELESSSTRUCT #include "windef.h" -#include "winbase.h" +#include "wine/winbase16.h" +#include "winver.h" #include "lzexpand.h" - #include "wine/unicode.h" -#include "wine/winbase16.h" - #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(ver); +#ifndef SEEK_SET +#define SEEK_SET 0 +#define SEEK_CUR 1 +#define SEEK_END 2 +#endif /********************************************************************** * find_entry_by_id @@ -390,38 +387,46 @@ static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, } +/*********************************************************************** + * find_resource [internal] + */ +static DWORD find_resource( HFILE lzfd, LPCSTR type, LPCSTR id, DWORD *reslen, DWORD *offset ) +{ + DWORD magic = read_xx_header( lzfd ); + + switch (magic) + { + case IMAGE_OS2_SIGNATURE: + if (!find_ne_resource( lzfd, type, id, reslen, offset )) magic = 0; + break; + case IMAGE_NT_SIGNATURE: + if (!find_pe_resource( lzfd, type, id, reslen, offset )) magic = 0; + break; + } + return magic; +} + + /************************************************************************* * GetFileResourceSize [VER.2] */ DWORD WINAPI GetFileResourceSize16( LPCSTR lpszFileName, LPCSTR lpszResType, LPCSTR lpszResId, LPDWORD lpdwFileOffset ) { - BOOL retv = FALSE; HFILE lzfd; OFSTRUCT ofs; - DWORD reslen; + DWORD reslen = 0; TRACE("(%s,type=%p,id=%p,off=%p)\n", debugstr_a(lpszFileName), lpszResType, lpszResId, lpszResId ); lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ ); - if ( lzfd < 0 ) return 0; - - switch ( read_xx_header( lzfd ) ) + if (lzfd >= 0) { - case IMAGE_OS2_SIGNATURE: - retv = find_ne_resource( lzfd, lpszResType, lpszResId, - &reslen, lpdwFileOffset ); - break; - - case IMAGE_NT_SIGNATURE: - retv = find_pe_resource( lzfd, lpszResType, lpszResId, - &reslen, lpdwFileOffset ); - break; + if (!find_resource( lzfd, lpszResType, lpszResId, &reslen, lpdwFileOffset )) reslen = 0; + LZClose( lzfd ); } - - LZClose( lzfd ); - return retv? reslen : 0; + return reslen; } @@ -432,7 +437,6 @@ DWORD WINAPI GetFileResource16( LPCSTR lpszFileName, LPCSTR lpszResType, LPCSTR lpszResId, DWORD dwFileOffset, DWORD dwResLen, LPVOID lpvData ) { - BOOL retv = FALSE; HFILE lzfd; OFSTRUCT ofs; DWORD reslen = dwResLen; @@ -446,20 +450,7 @@ DWORD WINAPI GetFileResource16( LPCSTR lpszFileName, LPCSTR lpszResType, if ( !dwFileOffset ) { - switch ( read_xx_header( lzfd ) ) - { - case IMAGE_OS2_SIGNATURE: - retv = find_ne_resource( lzfd, lpszResType, lpszResId, - &reslen, &dwFileOffset ); - break; - - case IMAGE_NT_SIGNATURE: - retv = find_pe_resource( lzfd, lpszResType, lpszResId, - &reslen, &dwFileOffset ); - break; - } - - if ( !retv ) + if (!find_resource( lzfd, lpszResType, lpszResId, &reslen, &dwFileOffset )) { LZClose( lzfd ); return 0; @@ -472,3 +463,96 @@ DWORD WINAPI GetFileResource16( LPCSTR lpszFileName, LPCSTR lpszResType, return reslen; } + +/************************************************************************* + * GetFileVersionInfoSize [VER.6] + */ +DWORD WINAPI GetFileVersionInfoSize16( LPCSTR lpszFileName, LPDWORD lpdwHandle ) +{ + TRACE("(%s, %p)\n", debugstr_a(lpszFileName), lpdwHandle ); + return GetFileVersionInfoSizeA( lpszFileName, lpdwHandle ); +} + +/************************************************************************* + * GetFileVersionInfo [VER.7] + */ +DWORD WINAPI GetFileVersionInfo16( LPCSTR lpszFileName, DWORD handle, + DWORD cbBuf, LPVOID lpvData ) +{ + TRACE("(%s, %08x, %d, %p)\n", + debugstr_a(lpszFileName), handle, cbBuf, lpvData ); + + return GetFileVersionInfoA( lpszFileName, handle, cbBuf, lpvData ); +} + +/************************************************************************* + * VerFindFile [VER.8] + */ +DWORD WINAPI VerFindFile16( UINT16 flags, LPSTR lpszFilename, + LPSTR lpszWinDir, LPSTR lpszAppDir, + LPSTR lpszCurDir, UINT16 *lpuCurDirLen, + LPSTR lpszDestDir, UINT16 *lpuDestDirLen ) +{ + UINT curDirLen, destDirLen; + DWORD retv = VerFindFileA( flags, lpszFilename, lpszWinDir, lpszAppDir, + lpszCurDir, &curDirLen, lpszDestDir, &destDirLen ); + + *lpuCurDirLen = (UINT16)curDirLen; + *lpuDestDirLen = (UINT16)destDirLen; + return retv; +} + +/************************************************************************* + * VerInstallFile [VER.9] + */ +DWORD WINAPI VerInstallFile16( UINT16 flags, + LPSTR lpszSrcFilename, LPSTR lpszDestFilename, + LPSTR lpszSrcDir, LPSTR lpszDestDir, LPSTR lpszCurDir, + LPSTR lpszTmpFile, UINT16 *lpwTmpFileLen ) +{ + UINT filelen; + DWORD retv = VerInstallFileA( flags, lpszSrcFilename, lpszDestFilename, + lpszSrcDir, lpszDestDir, lpszCurDir, + lpszTmpFile, &filelen); + + *lpwTmpFileLen = (UINT16)filelen; + return retv; +} + +/************************************************************************* + * VerLanguageName [VER.10] + */ +DWORD WINAPI VerLanguageName16( UINT16 uLang, LPSTR lpszLang, UINT16 cbLang ) +{ + return VerLanguageNameA( uLang, lpszLang, cbLang ); +} + +/************************************************************************* + * VerQueryValue [VER.11] + */ +DWORD WINAPI VerQueryValue16( SEGPTR spvBlock, LPSTR lpszSubBlock, + SEGPTR *lpspBuffer, UINT16 *lpcb ) +{ + LPVOID lpvBlock = MapSL( spvBlock ); + LPVOID buffer = lpvBlock; + UINT buflen; + DWORD retv; + + TRACE("(%p, %s, %p, %p)\n", + lpvBlock, debugstr_a(lpszSubBlock), lpspBuffer, lpcb ); + + retv = VerQueryValueA( lpvBlock, lpszSubBlock, &buffer, &buflen ); + if ( !retv ) return FALSE; + + if ( OFFSETOF( spvBlock ) + ((char *) buffer - (char *) lpvBlock) >= 0x10000 ) + { + FIXME("offset %08X too large relative to %04X:%04X\n", + (char *) buffer - (char *) lpvBlock, SELECTOROF( spvBlock ), OFFSETOF( spvBlock ) ); + return FALSE; + } + + if (lpcb) *lpcb = buflen; + *lpspBuffer = (SEGPTR) ((char *) spvBlock + ((char *) buffer - (char *) lpvBlock)); + + return retv; +} diff --git a/dlls/version/Makefile.in b/dlls/version/Makefile.in index 9fc0fbec52b..7f7ce74415b 100644 --- a/dlls/version/Makefile.in +++ b/dlls/version/Makefile.in @@ -13,11 +13,6 @@ C_SRCS = \ RC_SRCS = version.rc -C_SRCS16 = \ - ver16.c - -SPEC_SRCS16 = ver.spec - @MAKE_DLL_RULES@ @DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/version/info.c b/dlls/version/info.c index 95dadafe87a..de6dd4ba52e 100644 --- a/dlls/version/info.c +++ b/dlls/version/info.c @@ -30,6 +30,7 @@ #include "winbase.h" #include "winver.h" #include "winternl.h" +#include "lzexpand.h" #include "wine/winuser16.h" #include "wine/unicode.h" #include "winerror.h" @@ -37,6 +38,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(ver); +extern DWORD find_version_resource( HFILE lzfd, DWORD *reslen, DWORD *offset ); + /****************************************************************************** * * This function will print via standard TRACE, debug info regarding @@ -344,23 +347,29 @@ static DWORD VERSION_GetFileVersionInfo_16( LPCSTR filename, DWORD datasize, LPV } /* first try without loading a 16-bit module */ - if (is_builtin) - len = 0; - else - len = GetFileResourceSize16( filename, - MAKEINTRESOURCEA(VS_FILE_INFO), - MAKEINTRESOURCEA(VS_VERSION_INFO), - &offset ); - if (len) - { - if (!data) return len; - - len = GetFileResource16( filename, - MAKEINTRESOURCEA(VS_FILE_INFO), - MAKEINTRESOURCEA(VS_VERSION_INFO), - offset, datasize, data ); + len = 0; + if (!is_builtin) + { + OFSTRUCT ofs; + HFILE lzfd = LZOpenFileA( (LPSTR)filename, &ofs, OF_READ ); + + if (lzfd >= 0) + { + if (find_version_resource( lzfd, &len, &offset )) + { + if (data) + { + LZSeek( lzfd, offset, 0 /* SEEK_SET */ ); + len = LZRead( lzfd, data, min( len, datasize ) ); + } + } + LZClose( lzfd ); + } + if (len) { + if (!data) return len; + vffi = (VS_FIXEDFILEINFO *)VersionInfo16_Value( (VS_VERSION_INFO_STRUCT16 *)data ); if ( vffi->dwSignature == VS_FFI_SIGNATURE ) diff --git a/dlls/version/resource.c b/dlls/version/resource.c index efd9115045a..9af07fed756 100644 --- a/dlls/version/resource.c +++ b/dlls/version/resource.c @@ -36,6 +36,7 @@ #include "windef.h" #include "winbase.h" #include "lzexpand.h" +#include "winver.h" #include "wine/unicode.h" #include "wine/winbase16.h" @@ -88,56 +89,6 @@ static const IMAGE_RESOURCE_DIRECTORY *find_entry_default( const IMAGE_RESOURCE_ } -/********************************************************************** - * find_entry_by_name - * - * Find an entry by name in a resource directory - * Copied from loader/pe_resource.c - */ -static const IMAGE_RESOURCE_DIRECTORY *find_entry_by_name( const IMAGE_RESOURCE_DIRECTORY *dir, - LPCSTR name, const void *root ) -{ - const IMAGE_RESOURCE_DIRECTORY *ret = NULL; - LPWSTR nameW; - DWORD namelen; - - if (!HIWORD(name)) return find_entry_by_id( dir, LOWORD(name), root ); - if (name[0] == '#') - { - return find_entry_by_id( dir, atoi(name+1), root ); - } - - namelen = MultiByteToWideChar( CP_ACP, 0, name, -1, NULL, 0 ); - if ((nameW = HeapAlloc( GetProcessHeap(), 0, namelen * sizeof(WCHAR) ))) - { - const IMAGE_RESOURCE_DIRECTORY_ENTRY *entry; - const IMAGE_RESOURCE_DIR_STRING_U *str; - int min, max, res, pos; - - MultiByteToWideChar( CP_ACP, 0, name, -1, nameW, namelen ); - namelen--; /* remove terminating null */ - entry = (const IMAGE_RESOURCE_DIRECTORY_ENTRY *)(dir + 1); - min = 0; - max = dir->NumberOfNamedEntries - 1; - while (min <= max) - { - pos = (min + max) / 2; - str = (const IMAGE_RESOURCE_DIR_STRING_U *)((const char *)root + entry[pos].u1.s1.NameOffset); - res = strncmpiW( nameW, str->NameString, str->Length ); - if (!res && namelen == str->Length) - { - ret = (const IMAGE_RESOURCE_DIRECTORY *)((const char *)root + entry[pos].u2.s3.OffsetToDirectory); - break; - } - if (res < 0) max = pos - 1; - else min = pos + 1; - } - HeapFree( GetProcessHeap(), 0, nameW ); - } - return ret; -} - - /*********************************************************************** * read_xx_header [internal] */ @@ -171,9 +122,10 @@ static int read_xx_header( HFILE lzfd ) /*********************************************************************** * find_ne_resource [internal] */ -static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, - DWORD *resLen, DWORD *resOff ) +static BOOL find_ne_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff ) { + const WORD typeid = VS_FILE_INFO | 0x8000; + const WORD resid = VS_VERSION_INFO | 0x8000; IMAGE_OS2_HEADER nehd; NE_TYPEINFO *typeInfo; NE_NAMEINFO *nameInfo; @@ -206,55 +158,23 @@ static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, /* Find resource */ typeInfo = (NE_TYPEINFO *)(resTab + 2); - - if (HIWORD(typeid) != 0) /* named type */ + while (typeInfo->type_id) { - BYTE len = strlen( typeid ); - while (typeInfo->type_id) - { - if (!(typeInfo->type_id & 0x8000)) - { - BYTE *p = resTab + typeInfo->type_id; - if ((*p == len) && !strncasecmp( (char*)p+1, typeid, len )) goto found_type; - } - typeInfo = (NE_TYPEINFO *)((char *)(typeInfo + 1) + - typeInfo->count * sizeof(NE_NAMEINFO)); - } + if (typeInfo->type_id == typeid) goto found_type; + typeInfo = (NE_TYPEINFO *)((char *)(typeInfo + 1) + + typeInfo->count * sizeof(NE_NAMEINFO)); } - else /* numeric type id */ - { - WORD id = LOWORD(typeid) | 0x8000; - while (typeInfo->type_id) - { - if (typeInfo->type_id == id) goto found_type; - typeInfo = (NE_TYPEINFO *)((char *)(typeInfo + 1) + - typeInfo->count * sizeof(NE_NAMEINFO)); - } - } - TRACE("No typeid entry found for %p\n", typeid ); + TRACE("No typeid entry found\n" ); HeapFree( GetProcessHeap(), 0, resTab ); return FALSE; found_type: nameInfo = (NE_NAMEINFO *)(typeInfo + 1); - if (HIWORD(resid) != 0) /* named resource */ - { - BYTE len = strlen( resid ); - for (count = typeInfo->count; count > 0; count--, nameInfo++) - { - BYTE *p = resTab + nameInfo->id; - if (nameInfo->id & 0x8000) continue; - if ((*p == len) && !strncasecmp( (char*)p+1, resid, len )) goto found_name; - } - } - else /* numeric resource id */ - { - WORD id = LOWORD(resid) | 0x8000; - for (count = typeInfo->count; count > 0; count--, nameInfo++) - if (nameInfo->id == id) goto found_name; - } - TRACE("No resid entry found for %p\n", typeid ); + for (count = typeInfo->count; count > 0; count--, nameInfo++) + if (nameInfo->id == resid) goto found_name; + + TRACE("No resid entry found\n" ); HeapFree( GetProcessHeap(), 0, resTab ); return FALSE; @@ -270,8 +190,7 @@ static BOOL find_ne_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, /*********************************************************************** * find_pe_resource [internal] */ -static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, - DWORD *resLen, DWORD *resOff ) +static BOOL find_pe_resource( HFILE lzfd, DWORD *resLen, DWORD *resOff ) { IMAGE_NT_HEADERS pehd; DWORD pehdoffset; @@ -344,22 +263,22 @@ static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, resDir = resSection + (resDataDir->VirtualAddress - sections[i].VirtualAddress); resPtr = resDir; - resPtr = find_entry_by_name( resPtr, typeid, resDir ); + resPtr = find_entry_by_id( resPtr, VS_FILE_INFO, resDir ); if ( !resPtr ) { - TRACE("No typeid entry found for %p\n", typeid ); + TRACE("No typeid entry found\n" ); goto done; } - resPtr = find_entry_by_name( resPtr, resid, resDir ); + resPtr = find_entry_by_id( resPtr, VS_VERSION_INFO, resDir ); if ( !resPtr ) { - TRACE("No resid entry found for %p\n", resid ); + TRACE("No resid entry found\n" ); goto done; } resPtr = find_entry_default( resPtr, resDir ); if ( !resPtr ) { - TRACE("No default language entry found for %p\n", resid ); + TRACE("No default language entry found\n" ); goto done; } @@ -390,85 +309,21 @@ static BOOL find_pe_resource( HFILE lzfd, LPCSTR typeid, LPCSTR resid, } -/************************************************************************* - * GetFileResourceSize [VER.2] +/*********************************************************************** + * find_version_resource [internal] */ -DWORD WINAPI GetFileResourceSize16( LPCSTR lpszFileName, LPCSTR lpszResType, - LPCSTR lpszResId, LPDWORD lpdwFileOffset ) +DWORD find_version_resource( HFILE lzfd, DWORD *reslen, DWORD *offset ) { - BOOL retv = FALSE; - HFILE lzfd; - OFSTRUCT ofs; - DWORD reslen; - - TRACE("(%s,type=%p,id=%p,off=%p)\n", - debugstr_a(lpszFileName), lpszResType, lpszResId, lpszResId ); + DWORD magic = read_xx_header( lzfd ); - lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ ); - if ( lzfd < 0 ) return 0; - - switch ( read_xx_header( lzfd ) ) + switch (magic) { case IMAGE_OS2_SIGNATURE: - retv = find_ne_resource( lzfd, lpszResType, lpszResId, - &reslen, lpdwFileOffset ); + if (!find_ne_resource( lzfd, reslen, offset )) magic = 0; break; - case IMAGE_NT_SIGNATURE: - retv = find_pe_resource( lzfd, lpszResType, lpszResId, - &reslen, lpdwFileOffset ); + if (!find_pe_resource( lzfd, reslen, offset )) magic = 0; break; } - - LZClose( lzfd ); - return retv? reslen : 0; -} - - -/************************************************************************* - * GetFileResource [VER.3] - */ -DWORD WINAPI GetFileResource16( LPCSTR lpszFileName, LPCSTR lpszResType, - LPCSTR lpszResId, DWORD dwFileOffset, - DWORD dwResLen, LPVOID lpvData ) -{ - BOOL retv = FALSE; - HFILE lzfd; - OFSTRUCT ofs; - DWORD reslen = dwResLen; - - TRACE("(%s,type=%p,id=%p,off=%d,len=%d,data=%p)\n", - debugstr_a(lpszFileName), lpszResType, lpszResId, - dwFileOffset, dwResLen, lpvData ); - - lzfd = LZOpenFileA( (LPSTR)lpszFileName, &ofs, OF_READ ); - if ( lzfd < 0 ) return 0; - - if ( !dwFileOffset ) - { - switch ( read_xx_header( lzfd ) ) - { - case IMAGE_OS2_SIGNATURE: - retv = find_ne_resource( lzfd, lpszResType, lpszResId, - &reslen, &dwFileOffset ); - break; - - case IMAGE_NT_SIGNATURE: - retv = find_pe_resource( lzfd, lpszResType, lpszResId, - &reslen, &dwFileOffset ); - break; - } - - if ( !retv ) - { - LZClose( lzfd ); - return 0; - } - } - - LZSeek( lzfd, dwFileOffset, SEEK_SET ); - reslen = LZRead( lzfd, lpvData, min( reslen, dwResLen ) ); - LZClose( lzfd ); - - return reslen; + return magic; } diff --git a/dlls/version/ver16.c b/dlls/version/ver16.c deleted file mode 100644 index 3ffb920708f..00000000000 --- a/dlls/version/ver16.c +++ /dev/null @@ -1,122 +0,0 @@ -/* - * Implementation of VER.DLL - * - * Copyright 1999 Ulrich Weigand - * - * 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 - -#include "windef.h" -#include "wine/winbase16.h" -#include "winver.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(ver); - - -/************************************************************************* - * GetFileVersionInfoSize [VER.6] - */ -DWORD WINAPI GetFileVersionInfoSize16( LPCSTR lpszFileName, LPDWORD lpdwHandle ) -{ - TRACE("(%s, %p)\n", debugstr_a(lpszFileName), lpdwHandle ); - return GetFileVersionInfoSizeA( lpszFileName, lpdwHandle ); -} - -/************************************************************************* - * GetFileVersionInfo [VER.7] - */ -DWORD WINAPI GetFileVersionInfo16( LPCSTR lpszFileName, DWORD handle, - DWORD cbBuf, LPVOID lpvData ) -{ - TRACE("(%s, %08x, %d, %p)\n", - debugstr_a(lpszFileName), handle, cbBuf, lpvData ); - - return GetFileVersionInfoA( lpszFileName, handle, cbBuf, lpvData ); -} - -/************************************************************************* - * VerFindFile [VER.8] - */ -DWORD WINAPI VerFindFile16( UINT16 flags, LPSTR lpszFilename, - LPSTR lpszWinDir, LPSTR lpszAppDir, - LPSTR lpszCurDir, UINT16 *lpuCurDirLen, - LPSTR lpszDestDir, UINT16 *lpuDestDirLen ) -{ - UINT curDirLen, destDirLen; - DWORD retv = VerFindFileA( flags, lpszFilename, lpszWinDir, lpszAppDir, - lpszCurDir, &curDirLen, lpszDestDir, &destDirLen ); - - *lpuCurDirLen = (UINT16)curDirLen; - *lpuDestDirLen = (UINT16)destDirLen; - return retv; -} - -/************************************************************************* - * VerInstallFile [VER.9] - */ -DWORD WINAPI VerInstallFile16( UINT16 flags, - LPSTR lpszSrcFilename, LPSTR lpszDestFilename, - LPSTR lpszSrcDir, LPSTR lpszDestDir, LPSTR lpszCurDir, - LPSTR lpszTmpFile, UINT16 *lpwTmpFileLen ) -{ - UINT filelen; - DWORD retv = VerInstallFileA( flags, lpszSrcFilename, lpszDestFilename, - lpszSrcDir, lpszDestDir, lpszCurDir, - lpszTmpFile, &filelen); - - *lpwTmpFileLen = (UINT16)filelen; - return retv; -} - -/************************************************************************* - * VerLanguageName [VER.10] - */ -DWORD WINAPI VerLanguageName16( UINT16 uLang, LPSTR lpszLang, UINT16 cbLang ) -{ - return VerLanguageNameA( uLang, lpszLang, cbLang ); -} - -/************************************************************************* - * VerQueryValue [VER.11] - */ -DWORD WINAPI VerQueryValue16( SEGPTR spvBlock, LPSTR lpszSubBlock, - SEGPTR *lpspBuffer, UINT16 *lpcb ) -{ - LPVOID lpvBlock = MapSL( spvBlock ); - LPVOID buffer = lpvBlock; - UINT buflen; - DWORD retv; - - TRACE("(%p, %s, %p, %p)\n", - lpvBlock, debugstr_a(lpszSubBlock), lpspBuffer, lpcb ); - - retv = VerQueryValueA( lpvBlock, lpszSubBlock, &buffer, &buflen ); - if ( !retv ) return FALSE; - - if ( OFFSETOF( spvBlock ) + ((char *) buffer - (char *) lpvBlock) >= 0x10000 ) - { - FIXME("offset %08X too large relative to %04X:%04X\n", - (char *) buffer - (char *) lpvBlock, SELECTOROF( spvBlock ), OFFSETOF( spvBlock ) ); - return FALSE; - } - - if (lpcb) *lpcb = buflen; - *lpspBuffer = (SEGPTR) ((char *) spvBlock + ((char *) buffer - (char *) lpvBlock)); - - return retv; -} diff --git a/dlls/windowscodecs/bmpencode.c b/dlls/windowscodecs/bmpencode.c index 11c39e89867..abe9977e830 100644 --- a/dlls/windowscodecs/bmpencode.c +++ b/dlls/windowscodecs/bmpencode.c @@ -342,7 +342,7 @@ static HRESULT WINAPI BmpFrameEncode_Commit(IWICBitmapFrameEncode *iface) bfh.bfOffBits = sizeof(BITMAPFILEHEADER) + info_size; pos.QuadPart = 0; - hr = IStream_Seek(This->stream, pos, STREAM_SEEK_SET, NULL);\ + hr = IStream_Seek(This->stream, pos, STREAM_SEEK_SET, NULL); if (FAILED(hr)) return hr; hr = IStream_Write(This->stream, &bfh, sizeof(BITMAPFILEHEADER), &byteswritten); diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index b541a6aeba1..f1218adc509 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -52,7 +52,8 @@ static BOOL need_mova_const(IWineD3DBaseShader *shader, const struct wined3d_gl_ /* Returns TRUE if result.clip from GL_NV_vertex_program2 should be used and FALSE otherwise */ static inline BOOL use_nv_clip(const struct wined3d_gl_info *gl_info) { - return GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION); + return GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION) && + !(GLINFO_LOCATION.quirks & WINED3D_QUIRK_NV_CLIP_BROKEN); } static BOOL need_helper_const(const struct wined3d_gl_info *gl_info) @@ -1577,7 +1578,6 @@ static void shader_hw_map2gl(const struct wined3d_shader_instruction *ins) case WINED3DSIH_SLT: instruction = "SLT"; break; case WINED3DSIH_SUB: instruction = "SUB"; break; case WINED3DSIH_MOVA:instruction = "ARR"; break; - case WINED3DSIH_SGN: instruction = "SSG"; break; case WINED3DSIH_DSX: instruction = "DDX"; break; default: instruction = ""; FIXME("Unhandled opcode %#x\n", ins->handler_idx); @@ -2454,13 +2454,14 @@ static void shader_hw_sgn(const struct wined3d_shader_instruction *ins) char src_name[50]; struct shader_arb_ctx_priv *ctx = ins->ctx->backend_data; + shader_arb_get_dst_param(ins, &ins->dst[0], dst_name); + shader_arb_get_src_param(ins, &ins->src[0], 0, src_name); + /* SGN is only valid in vertex shaders */ - if(ctx->target_version == NV2) { - shader_hw_map2gl(ins); + if(ctx->target_version >= NV2) { + shader_addline(buffer, "SSG%s %s, %s;\n", shader_arb_get_modifier(ins), dst_name, src_name); return; } - shader_arb_get_dst_param(ins, &ins->dst[0], dst_name); - shader_arb_get_src_param(ins, &ins->src[0], 0, src_name); /* If SRC > 0.0, -SRC < SRC = TRUE, otherwise false. * if SRC < 0.0, SRC < -SRC = TRUE. If neither is true, src = 0.0 diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 70656b7dfe8..90da2a06060 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -588,273 +588,31 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateIndexBuffer(IWineD3DDevice *iface return WINED3D_OK; } -static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, WINED3DSTATEBLOCKTYPE Type, IWineD3DStateBlock** ppStateBlock, IUnknown *parent) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; +static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice *iface, + WINED3DSTATEBLOCKTYPE type, IWineD3DStateBlock **stateblock, IUnknown *parent) +{ + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DStateBlockImpl *object; - unsigned int i, j; - HRESULT temp_result; + HRESULT hr; object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); if(!object) { - ERR("Out of memory\n"); - *ppStateBlock = NULL; - return WINED3DERR_OUTOFVIDEOMEMORY; - } - - object->lpVtbl = &IWineD3DStateBlock_Vtbl; - object->wineD3DDevice = This; - object->parent = parent; - object->ref = 1; - object->blockType = Type; - - *ppStateBlock = (IWineD3DStateBlock *)object; - - for(i = 0; i < LIGHTMAP_SIZE; i++) { - list_init(&object->lightMap[i]); + ERR("Failed to allocate stateblock memory.\n"); + return E_OUTOFMEMORY; } - temp_result = allocate_shader_constants(object); - if (FAILED(temp_result)) + hr = stateblock_init(object, This, type, parent); + if (FAILED(hr)) { + WARN("Failed to initialize stateblock, hr %#x.\n", hr); HeapFree(GetProcessHeap(), 0, object); - return temp_result; - } - - /* Special case - Used during initialization to produce a placeholder stateblock - so other functions called can update a state block */ - if (Type == WINED3DSBT_INIT || Type == WINED3DSBT_RECORDED) - { - /* Don't bother increasing the reference count otherwise a device will never - be freed due to circular dependencies */ - return WINED3D_OK; + return hr; } - /* Otherwise, might as well set the whole state block to the appropriate values */ - if (This->stateBlock != NULL) - stateblock_copy((IWineD3DStateBlock*) object, (IWineD3DStateBlock*) This->stateBlock); - else - memset(object->streamFreq, 1, sizeof(object->streamFreq)); - - /* Reset the ref and type after kludging it */ - object->wineD3DDevice = This; - object->ref = 1; - object->blockType = Type; - - TRACE("Updating changed flags appropriate for type %d\n", Type); - - if (Type == WINED3DSBT_ALL) { - - TRACE("ALL => Pretend everything has changed\n"); - stateblock_savedstates_set((IWineD3DStateBlock*) object, &object->changed, TRUE); - - /* Lights are not part of the changed / set structure */ - for(j = 0; j < LIGHTMAP_SIZE; j++) { - struct list *e; - LIST_FOR_EACH(e, &object->lightMap[j]) { - PLIGHTINFOEL *light = LIST_ENTRY(e, PLIGHTINFOEL, entry); - light->changed = TRUE; - light->enabledChanged = TRUE; - } - } - for(j = 1; j <= WINEHIGHEST_RENDER_STATE; j++) { - object->contained_render_states[j - 1] = j; - } - object->num_contained_render_states = WINEHIGHEST_RENDER_STATE; - /* TODO: Filter unused transforms between TEXTURE8 and WORLD0? */ - for(j = 1; j <= HIGHEST_TRANSFORMSTATE; j++) { - object->contained_transform_states[j - 1] = j; - } - object->num_contained_transform_states = HIGHEST_TRANSFORMSTATE; - for(j = 0; j < GL_LIMITS(vshader_constantsF); j++) { - object->contained_vs_consts_f[j] = j; - } - object->num_contained_vs_consts_f = GL_LIMITS(vshader_constantsF); - for(j = 0; j < MAX_CONST_I; j++) { - object->contained_vs_consts_i[j] = j; - } - object->num_contained_vs_consts_i = MAX_CONST_I; - for(j = 0; j < MAX_CONST_B; j++) { - object->contained_vs_consts_b[j] = j; - } - object->num_contained_vs_consts_b = MAX_CONST_B; - for(j = 0; j < GL_LIMITS(pshader_constantsF); j++) { - object->contained_ps_consts_f[j] = j; - } - object->num_contained_ps_consts_f = GL_LIMITS(pshader_constantsF); - for(j = 0; j < MAX_CONST_I; j++) { - object->contained_ps_consts_i[j] = j; - } - object->num_contained_ps_consts_i = MAX_CONST_I; - for(j = 0; j < MAX_CONST_B; j++) { - object->contained_ps_consts_b[j] = j; - } - object->num_contained_ps_consts_b = MAX_CONST_B; - for(i = 0; i < MAX_TEXTURES; i++) { - for (j = 0; j <= WINED3D_HIGHEST_TEXTURE_STATE; ++j) - { - object->contained_tss_states[object->num_contained_tss_states].stage = i; - object->contained_tss_states[object->num_contained_tss_states].state = j; - object->num_contained_tss_states++; - } - } - for(i = 0; i < MAX_COMBINED_SAMPLERS; i++) { - for(j = 1; j <= WINED3D_HIGHEST_SAMPLER_STATE; j++) { - object->contained_sampler_states[object->num_contained_sampler_states].stage = i; - object->contained_sampler_states[object->num_contained_sampler_states].state = j; - object->num_contained_sampler_states++; - } - } - - for(i = 0; i < MAX_STREAMS; i++) { - if(object->streamSource[i]) { - IWineD3DBuffer_AddRef(object->streamSource[i]); - } - } - if(object->pIndexData) { - IWineD3DBuffer_AddRef(object->pIndexData); - } - if(object->vertexShader) { - IWineD3DVertexShader_AddRef(object->vertexShader); - } - if(object->pixelShader) { - IWineD3DPixelShader_AddRef(object->pixelShader); - } - - } else if (Type == WINED3DSBT_PIXELSTATE) { - - TRACE("PIXELSTATE => Pretend all pixel shates have changed\n"); - stateblock_savedstates_set((IWineD3DStateBlock*) object, &object->changed, FALSE); - - object->changed.pixelShader = TRUE; - - /* Pixel Shader Constants */ - for (i = 0; i < GL_LIMITS(pshader_constantsF); ++i) { - object->contained_ps_consts_f[i] = i; - object->changed.pixelShaderConstantsF[i] = TRUE; - } - object->num_contained_ps_consts_f = GL_LIMITS(pshader_constantsF); - for (i = 0; i < MAX_CONST_B; ++i) { - object->contained_ps_consts_b[i] = i; - object->changed.pixelShaderConstantsB |= (1 << i); - } - object->num_contained_ps_consts_b = MAX_CONST_B; - for (i = 0; i < MAX_CONST_I; ++i) { - object->contained_ps_consts_i[i] = i; - object->changed.pixelShaderConstantsI |= (1 << i); - } - object->num_contained_ps_consts_i = MAX_CONST_I; - - for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) { - DWORD rs = SavedPixelStates_R[i]; - object->changed.renderState[rs >> 5] |= 1 << (rs & 0x1f); - object->contained_render_states[i] = rs; - } - object->num_contained_render_states = NUM_SAVEDPIXELSTATES_R; - for (j = 0; j < MAX_TEXTURES; j++) { - for (i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) { - DWORD state = SavedPixelStates_T[i]; - object->changed.textureState[j] |= 1 << state; - object->contained_tss_states[object->num_contained_tss_states].stage = j; - object->contained_tss_states[object->num_contained_tss_states].state = state; - object->num_contained_tss_states++; - } - } - for (j = 0 ; j < MAX_COMBINED_SAMPLERS; j++) { - for (i =0; i < NUM_SAVEDPIXELSTATES_S;i++) { - DWORD state = SavedPixelStates_S[i]; - object->changed.samplerState[j] |= 1 << state; - object->contained_sampler_states[object->num_contained_sampler_states].stage = j; - object->contained_sampler_states[object->num_contained_sampler_states].state = state; - object->num_contained_sampler_states++; - } - } - if(object->pixelShader) { - IWineD3DPixelShader_AddRef(object->pixelShader); - } - - /* Pixel state blocks do not contain vertex buffers. Set them to NULL to avoid wrong refcounting - * on them. This makes releasing the buffer easier - */ - for(i = 0; i < MAX_STREAMS; i++) { - object->streamSource[i] = NULL; - } - object->pIndexData = NULL; - object->vertexShader = NULL; + TRACE("Created stateblock %p.\n", object); + *stateblock = (IWineD3DStateBlock *)object; - } else if (Type == WINED3DSBT_VERTEXSTATE) { - - TRACE("VERTEXSTATE => Pretend all vertex shates have changed\n"); - stateblock_savedstates_set((IWineD3DStateBlock*) object, &object->changed, FALSE); - - object->changed.vertexShader = TRUE; - - /* Vertex Shader Constants */ - for (i = 0; i < GL_LIMITS(vshader_constantsF); ++i) { - object->changed.vertexShaderConstantsF[i] = TRUE; - object->contained_vs_consts_f[i] = i; - } - object->num_contained_vs_consts_f = GL_LIMITS(vshader_constantsF); - for (i = 0; i < MAX_CONST_B; ++i) { - object->contained_vs_consts_b[i] = i; - object->changed.vertexShaderConstantsB |= (1 << i); - } - object->num_contained_vs_consts_b = MAX_CONST_B; - for (i = 0; i < MAX_CONST_I; ++i) { - object->contained_vs_consts_i[i] = i; - object->changed.vertexShaderConstantsI |= (1 << i); - } - object->num_contained_vs_consts_i = MAX_CONST_I; - for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) { - DWORD rs = SavedVertexStates_R[i]; - object->changed.renderState[rs >> 5] |= 1 << (rs & 0x1f); - object->contained_render_states[i] = rs; - } - object->num_contained_render_states = NUM_SAVEDVERTEXSTATES_R; - for (j = 0; j < MAX_TEXTURES; j++) { - for (i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) { - DWORD state = SavedVertexStates_T[i]; - object->changed.textureState[j] |= 1 << state; - object->contained_tss_states[object->num_contained_tss_states].stage = j; - object->contained_tss_states[object->num_contained_tss_states].state = state; - object->num_contained_tss_states++; - } - } - for (j = 0 ; j < MAX_COMBINED_SAMPLERS; j++){ - for (i =0; i < NUM_SAVEDVERTEXSTATES_S;i++) { - DWORD state = SavedVertexStates_S[i]; - object->changed.samplerState[j] |= 1 << state; - object->contained_sampler_states[object->num_contained_sampler_states].stage = j; - object->contained_sampler_states[object->num_contained_sampler_states].state = state; - object->num_contained_sampler_states++; - } - } - - for(j = 0; j < LIGHTMAP_SIZE; j++) { - struct list *e; - LIST_FOR_EACH(e, &object->lightMap[j]) { - PLIGHTINFOEL *light = LIST_ENTRY(e, PLIGHTINFOEL, entry); - light->changed = TRUE; - light->enabledChanged = TRUE; - } - } - - for(i = 0; i < MAX_STREAMS; i++) { - if(object->streamSource[i]) { - IWineD3DBuffer_AddRef(object->streamSource[i]); - } - } - if(object->vertexShader) { - IWineD3DVertexShader_AddRef(object->vertexShader); - } - object->pIndexData = NULL; - object->pixelShader = NULL; - } else { - FIXME("Unrecognized state block type %d\n", Type); - } - - TRACE("(%p) returning token (ptr to stateblock) of %p\n", This, object); return WINED3D_OK; } @@ -3328,6 +3086,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexDeclaration(IWineD3DDevice* if TRACE("(%p) : pDecl=%p\n", This, pDecl); + if (pDecl) IWineD3DVertexDeclaration_AddRef(pDecl); + if (oldDecl) IWineD3DVertexDeclaration_Release(oldDecl); + This->updateStateBlock->vertexDecl = pDecl; This->updateStateBlock->changed.vertexDecl = TRUE; @@ -4426,104 +4187,113 @@ static HRESULT WINAPI IWineD3DDeviceImpl_GetTextureStageState(IWineD3DDevice *if /***** * Get / Set Texture *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, DWORD Stage, IWineD3DBaseTexture* pTexture) { +static HRESULT WINAPI IWineD3DDeviceImpl_SetTexture(IWineD3DDevice *iface, + DWORD stage, IWineD3DBaseTexture *texture) +{ IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - IWineD3DBaseTexture *oldTexture; + IWineD3DBaseTexture *prev; - TRACE("(%p) : Stage %#x, Texture %p\n", This, Stage, pTexture); + TRACE("iface %p, stage %u, texture %p.\n", iface, stage, texture); - if (Stage >= WINED3DVERTEXTEXTURESAMPLER0 && Stage <= WINED3DVERTEXTEXTURESAMPLER3) { - Stage -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); - } + if (stage >= WINED3DVERTEXTEXTURESAMPLER0 && stage <= WINED3DVERTEXTEXTURESAMPLER3) + stage -= (WINED3DVERTEXTEXTURESAMPLER0 - MAX_FRAGMENT_SAMPLERS); - if (Stage >= sizeof(This->stateBlock->textures)/sizeof(This->stateBlock->textures[0])) { - ERR("Current stage overflows textures array (stage %d)\n", Stage); - return WINED3D_OK; /* Windows accepts overflowing this array ... we do not. */ + /* Windows accepts overflowing this array... we do not. */ + if (stage >= sizeof(This->stateBlock->textures) / sizeof(*This->stateBlock->textures)) + { + WARN("Ignoring invalid stage %u.\n", stage); + return WINED3D_OK; } - oldTexture = This->updateStateBlock->textures[Stage]; - /* SetTexture isn't allowed on textures in WINED3DPOOL_SCRATCH */ - if (pTexture && ((IWineD3DTextureImpl*)pTexture)->resource.pool == WINED3DPOOL_SCRATCH) + if (texture && ((IWineD3DTextureImpl *)texture)->resource.pool == WINED3DPOOL_SCRATCH) { - WARN("(%p) Attempt to set scratch texture rejected\n", pTexture); + WARN("Rejecting attempt to set scratch texture.\n"); return WINED3DERR_INVALIDCALL; } - TRACE("GL_LIMITS %d\n",GL_LIMITS(sampler_stages)); - TRACE("(%p) : oldtexture(%p)\n", This,oldTexture); + This->updateStateBlock->changed.textures |= 1 << stage; - This->updateStateBlock->changed.textures |= 1 << Stage; - TRACE("(%p) : setting new texture to %p\n", This, pTexture); - This->updateStateBlock->textures[Stage] = pTexture; + prev = This->updateStateBlock->textures[stage]; + TRACE("Previous texture %p.\n", prev); - /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); + if (texture == prev) + { + TRACE("App is setting the same texture again, nothing to do.\n"); return WINED3D_OK; } - if(oldTexture == pTexture) { - TRACE("App is setting the same texture again, nothing to do\n"); + TRACE("Setting new texture to %p.\n", texture); + This->updateStateBlock->textures[stage] = texture; + + if (This->isRecordingState) + { + TRACE("Recording... not performing anything\n"); + + if (texture) IWineD3DBaseTexture_AddRef(texture); + if (prev) IWineD3DBaseTexture_Release(prev); + return WINED3D_OK; } - /** NOTE: MSDN says that setTexture increases the reference count, - * and that the application must set the texture back to null (or have a leaky application), - * This means we should pass the refcount up to the parent - *******************************/ - if (NULL != This->updateStateBlock->textures[Stage]) { - IWineD3DBaseTextureImpl *new = (IWineD3DBaseTextureImpl *) This->updateStateBlock->textures[Stage]; - ULONG bindCount = InterlockedIncrement(&new->baseTexture.bindCount); - UINT dimensions = IWineD3DBaseTexture_GetTextureDimensions(pTexture); + if (texture) + { + IWineD3DBaseTextureImpl *t = (IWineD3DBaseTextureImpl *)texture; + LONG bind_count = InterlockedIncrement(&t->baseTexture.bindCount); + UINT dimensions = IWineD3DBaseTexture_GetTextureDimensions(texture); - IWineD3DBaseTexture_AddRef(This->updateStateBlock->textures[Stage]); + IWineD3DBaseTexture_AddRef(texture); - if (!oldTexture || dimensions != IWineD3DBaseTexture_GetTextureDimensions(oldTexture)) + if (!prev || dimensions != IWineD3DBaseTexture_GetTextureDimensions(prev)) { IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADER); } - if(oldTexture == NULL && Stage < MAX_TEXTURES) { - /* The source arguments for color and alpha ops have different meanings when a NULL texture is bound, - * so the COLOROP and ALPHAOP have to be dirtified. - */ - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(Stage, WINED3DTSS_COLOROP)); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(Stage, WINED3DTSS_ALPHAOP)); - } - if(bindCount == 1) { - new->baseTexture.sampler = Stage; + if (!prev && stage < MAX_TEXTURES) + { + /* The source arguments for color and alpha ops have different + * meanings when a NULL texture is bound, so the COLOROP and + * ALPHAOP have to be dirtified. */ + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP)); + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP)); } - /* More than one assignment? Doesn't matter, we only need one gl texture unit to use for uploading */ + if (bind_count == 1) t->baseTexture.sampler = stage; } - if (NULL != oldTexture) { - IWineD3DBaseTextureImpl *old = (IWineD3DBaseTextureImpl *) oldTexture; - LONG bindCount = InterlockedDecrement(&old->baseTexture.bindCount); + if (prev) + { + IWineD3DBaseTextureImpl *t = (IWineD3DBaseTextureImpl *)prev; + LONG bind_count = InterlockedDecrement(&t->baseTexture.bindCount); + + IWineD3DBaseTexture_Release(prev); - IWineD3DBaseTexture_Release(oldTexture); - if(pTexture == NULL && Stage < MAX_TEXTURES) { - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(Stage, WINED3DTSS_COLOROP)); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(Stage, WINED3DTSS_ALPHAOP)); + if (!texture && stage < MAX_TEXTURES) + { + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_COLOROP)); + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_TEXTURESTAGE(stage, WINED3DTSS_ALPHAOP)); } - if(bindCount && old->baseTexture.sampler == Stage) { - int i; - /* Have to do a search for the other sampler(s) where the texture is bound to - * Shouldn't happen as long as apps bind a texture only to one stage - */ - TRACE("Searcing for other sampler / stage id where the texture is bound to\n"); - for(i = 0; i < MAX_COMBINED_SAMPLERS; i++) { - if(This->updateStateBlock->textures[i] == oldTexture) { - old->baseTexture.sampler = i; + if (bind_count && t->baseTexture.sampler == stage) + { + unsigned int i; + + /* Search for other stages the texture is bound to. Shouldn't + * happen if applications bind textures to a single stage only. */ + TRACE("Searching for other stages the texture is bound to.\n"); + for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) + { + if (This->updateStateBlock->textures[i] == prev) + { + TRACE("Texture is also bound to stage %u.\n", i); + t->baseTexture.sampler = i; break; } } } } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(Stage)); + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(stage)); return WINED3D_OK; } @@ -4636,7 +4406,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_BeginStateBlock(IWineD3DDevice *iface) static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IWineD3DStateBlock** ppStateBlock) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - unsigned int i, j; IWineD3DStateBlockImpl *object = This->updateStateBlock; if (!This->isRecordingState) { @@ -4645,93 +4414,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IW return WINED3DERR_INVALIDCALL; } - for (i = 0; i <= WINEHIGHEST_RENDER_STATE >> 5; ++i) - { - DWORD map = object->changed.renderState[i]; - for (j = 0; map; map >>= 1, ++j) - { - if (!(map & 1)) continue; - - object->contained_render_states[object->num_contained_render_states++] = (i << 5) | j; - } - } - - for (i = 0; i <= HIGHEST_TRANSFORMSTATE >> 5; ++i) - { - DWORD map = object->changed.transform[i]; - for (j = 0; map; map >>= 1, ++j) - { - if (!(map & 1)) continue; - - object->contained_transform_states[object->num_contained_transform_states++] = (i << 5) | j; - } - } - for(i = 0; i < GL_LIMITS(vshader_constantsF); i++) { - if(object->changed.vertexShaderConstantsF[i]) { - object->contained_vs_consts_f[object->num_contained_vs_consts_f] = i; - object->num_contained_vs_consts_f++; - } - } - for(i = 0; i < MAX_CONST_I; i++) { - if (object->changed.vertexShaderConstantsI & (1 << i)) - { - object->contained_vs_consts_i[object->num_contained_vs_consts_i] = i; - object->num_contained_vs_consts_i++; - } - } - for(i = 0; i < MAX_CONST_B; i++) { - if (object->changed.vertexShaderConstantsB & (1 << i)) - { - object->contained_vs_consts_b[object->num_contained_vs_consts_b] = i; - object->num_contained_vs_consts_b++; - } - } - for (i = 0; i < GL_LIMITS(pshader_constantsF); ++i) - { - if (object->changed.pixelShaderConstantsF[i]) - { - object->contained_ps_consts_f[object->num_contained_ps_consts_f] = i; - ++object->num_contained_ps_consts_f; - } - } - for(i = 0; i < MAX_CONST_I; i++) { - if (object->changed.pixelShaderConstantsI & (1 << i)) - { - object->contained_ps_consts_i[object->num_contained_ps_consts_i] = i; - object->num_contained_ps_consts_i++; - } - } - for(i = 0; i < MAX_CONST_B; i++) { - if (object->changed.pixelShaderConstantsB & (1 << i)) - { - object->contained_ps_consts_b[object->num_contained_ps_consts_b] = i; - object->num_contained_ps_consts_b++; - } - } - for(i = 0; i < MAX_TEXTURES; i++) { - DWORD map = object->changed.textureState[i]; - - for(j = 0; map; map >>= 1, ++j) - { - if (!(map & 1)) continue; - - object->contained_tss_states[object->num_contained_tss_states].stage = i; - object->contained_tss_states[object->num_contained_tss_states].state = j; - ++object->num_contained_tss_states; - } - } - for(i = 0; i < MAX_COMBINED_SAMPLERS; i++){ - DWORD map = object->changed.samplerState[i]; - - for (j = 0; map; map >>= 1, ++j) - { - if (!(map & 1)) continue; - - object->contained_sampler_states[object->num_contained_sampler_states].stage = i; - object->contained_sampler_states[object->num_contained_sampler_states].state = j; - ++object->num_contained_sampler_states; - } - } + stateblock_init_contained_states(object); *ppStateBlock = (IWineD3DStateBlock*) object; This->isRecordingState = FALSE; @@ -6447,7 +6130,7 @@ void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, DWORD RenderTargetIndex, IWineD3DSurface *pRenderTarget) { IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - WINED3DVIEWPORT viewport; + int dxVersion = ( (IWineD3DImpl *) This->wineD3D)->dxVersion; TRACE("(%p) : Setting rendertarget %d to %p\n", This, RenderTargetIndex, pRenderTarget); @@ -6480,15 +6163,24 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetRenderTarget(IWineD3DDevice *iface, This->render_targets[RenderTargetIndex] = pRenderTarget; /* Render target 0 is special */ - if(RenderTargetIndex == 0) { - /* Finally, reset the viewport as the MSDN states. */ - viewport.Height = ((IWineD3DSurfaceImpl *)This->render_targets[0])->currentDesc.Height; - viewport.Width = ((IWineD3DSurfaceImpl *)This->render_targets[0])->currentDesc.Width; - viewport.X = 0; - viewport.Y = 0; - viewport.MaxZ = 1.0f; - viewport.MinZ = 0.0f; - IWineD3DDeviceImpl_SetViewport(iface, &viewport); + if(RenderTargetIndex == 0 && dxVersion > 7) { + /* Finally, reset the viewport and scissor rect as the MSDN states. + * Tests show that stateblock recording is ignored, the change goes + * directly into the primary stateblock. + */ + This->stateBlock->viewport.Height = ((IWineD3DSurfaceImpl *)This->render_targets[0])->currentDesc.Height; + This->stateBlock->viewport.Width = ((IWineD3DSurfaceImpl *)This->render_targets[0])->currentDesc.Width; + This->stateBlock->viewport.X = 0; + This->stateBlock->viewport.Y = 0; + This->stateBlock->viewport.MaxZ = 1.0f; + This->stateBlock->viewport.MinZ = 0.0f; + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VIEWPORT); + + This->stateBlock->scissorRect.top = 0; + This->stateBlock->scissorRect.left = 0; + This->stateBlock->scissorRect.right = This->stateBlock->viewport.Width; + This->stateBlock->scissorRect.bottom = This->stateBlock->viewport.Height; + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SCISSORRECT); } return WINED3D_OK; } @@ -7487,124 +7179,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = IWineD3DDeviceImpl_EnumResources }; -const DWORD SavedPixelStates_R[NUM_SAVEDPIXELSTATES_R] = { - WINED3DRS_ALPHABLENDENABLE , - WINED3DRS_ALPHAFUNC , - WINED3DRS_ALPHAREF , - WINED3DRS_ALPHATESTENABLE , - WINED3DRS_BLENDOP , - WINED3DRS_COLORWRITEENABLE , - WINED3DRS_DESTBLEND , - WINED3DRS_DITHERENABLE , - WINED3DRS_FILLMODE , - WINED3DRS_FOGDENSITY , - WINED3DRS_FOGEND , - WINED3DRS_FOGSTART , - WINED3DRS_LASTPIXEL , - WINED3DRS_SHADEMODE , - WINED3DRS_SRCBLEND , - WINED3DRS_STENCILENABLE , - WINED3DRS_STENCILFAIL , - WINED3DRS_STENCILFUNC , - WINED3DRS_STENCILMASK , - WINED3DRS_STENCILPASS , - WINED3DRS_STENCILREF , - WINED3DRS_STENCILWRITEMASK , - WINED3DRS_STENCILZFAIL , - WINED3DRS_TEXTUREFACTOR , - WINED3DRS_WRAP0 , - WINED3DRS_WRAP1 , - WINED3DRS_WRAP2 , - WINED3DRS_WRAP3 , - WINED3DRS_WRAP4 , - WINED3DRS_WRAP5 , - WINED3DRS_WRAP6 , - WINED3DRS_WRAP7 , - WINED3DRS_ZENABLE , - WINED3DRS_ZFUNC , - WINED3DRS_ZWRITEENABLE -}; - -const DWORD SavedPixelStates_T[NUM_SAVEDPIXELSTATES_T] = { - WINED3DTSS_ALPHAARG0 , - WINED3DTSS_ALPHAARG1 , - WINED3DTSS_ALPHAARG2 , - WINED3DTSS_ALPHAOP , - WINED3DTSS_BUMPENVLOFFSET , - WINED3DTSS_BUMPENVLSCALE , - WINED3DTSS_BUMPENVMAT00 , - WINED3DTSS_BUMPENVMAT01 , - WINED3DTSS_BUMPENVMAT10 , - WINED3DTSS_BUMPENVMAT11 , - WINED3DTSS_COLORARG0 , - WINED3DTSS_COLORARG1 , - WINED3DTSS_COLORARG2 , - WINED3DTSS_COLOROP , - WINED3DTSS_RESULTARG , - WINED3DTSS_TEXCOORDINDEX , - WINED3DTSS_TEXTURETRANSFORMFLAGS -}; - -const DWORD SavedPixelStates_S[NUM_SAVEDPIXELSTATES_S] = { - WINED3DSAMP_ADDRESSU , - WINED3DSAMP_ADDRESSV , - WINED3DSAMP_ADDRESSW , - WINED3DSAMP_BORDERCOLOR , - WINED3DSAMP_MAGFILTER , - WINED3DSAMP_MINFILTER , - WINED3DSAMP_MIPFILTER , - WINED3DSAMP_MIPMAPLODBIAS , - WINED3DSAMP_MAXMIPLEVEL , - WINED3DSAMP_MAXANISOTROPY , - WINED3DSAMP_SRGBTEXTURE , - WINED3DSAMP_ELEMENTINDEX -}; - -const DWORD SavedVertexStates_R[NUM_SAVEDVERTEXSTATES_R] = { - WINED3DRS_AMBIENT , - WINED3DRS_AMBIENTMATERIALSOURCE , - WINED3DRS_CLIPPING , - WINED3DRS_CLIPPLANEENABLE , - WINED3DRS_COLORVERTEX , - WINED3DRS_DIFFUSEMATERIALSOURCE , - WINED3DRS_EMISSIVEMATERIALSOURCE , - WINED3DRS_FOGDENSITY , - WINED3DRS_FOGEND , - WINED3DRS_FOGSTART , - WINED3DRS_FOGTABLEMODE , - WINED3DRS_FOGVERTEXMODE , - WINED3DRS_INDEXEDVERTEXBLENDENABLE , - WINED3DRS_LIGHTING , - WINED3DRS_LOCALVIEWER , - WINED3DRS_MULTISAMPLEANTIALIAS , - WINED3DRS_MULTISAMPLEMASK , - WINED3DRS_NORMALIZENORMALS , - WINED3DRS_PATCHEDGESTYLE , - WINED3DRS_POINTSCALE_A , - WINED3DRS_POINTSCALE_B , - WINED3DRS_POINTSCALE_C , - WINED3DRS_POINTSCALEENABLE , - WINED3DRS_POINTSIZE , - WINED3DRS_POINTSIZE_MAX , - WINED3DRS_POINTSIZE_MIN , - WINED3DRS_POINTSPRITEENABLE , - WINED3DRS_RANGEFOGENABLE , - WINED3DRS_SPECULARMATERIALSOURCE , - WINED3DRS_TWEENFACTOR , - WINED3DRS_VERTEXBLEND , - WINED3DRS_CULLMODE , - WINED3DRS_FOGCOLOR -}; - -const DWORD SavedVertexStates_T[NUM_SAVEDVERTEXSTATES_T] = { - WINED3DTSS_TEXCOORDINDEX , - WINED3DTSS_TEXTURETRANSFORMFLAGS -}; - -const DWORD SavedVertexStates_S[NUM_SAVEDVERTEXSTATES_S] = { - WINED3DSAMP_DMAPOFFSET -}; - void IWineD3DDeviceImpl_MarkStateDirty(IWineD3DDeviceImpl *This, DWORD state) { DWORD rep = This->StateTable[state].representative; struct wined3d_context *context; diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index de9b6fb644b..5d494ecb0f7 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -666,6 +666,58 @@ static BOOL match_allows_spec_alpha(const struct wined3d_gl_info *gl_info, const } } +static BOOL match_apple_nvts(const struct wined3d_gl_info *gl_info, const char *gl_renderer) +{ + if(!match_apple(gl_info, gl_renderer)) return FALSE; + return GL_SUPPORT(NV_TEXTURE_SHADER); +} + +/* A GL context is provided by the caller */ +static BOOL match_broken_nv_clip(const struct wined3d_gl_info *gl_info, const char *gl_renderer) +{ + GLuint prog; + BOOL ret = FALSE; + GLint pos; + const char *testcode = + "!!ARBvp1.0\n" + "OPTION NV_vertex_program2;\n" + "MOV result.clip[0], 0.0;\n" + "MOV result.position, 0.0;\n" + "END\n"; + + if(!GL_SUPPORT(NV_VERTEX_PROGRAM2_OPTION)) return FALSE; + + ENTER_GL(); + while(glGetError()); + + GL_EXTCALL(glGenProgramsARB(1, &prog)); + if(!prog) + { + ERR("Failed to create the NVvp clip test program\n"); + LEAVE_GL(); + return FALSE; + } + GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, prog)); + GL_EXTCALL(glProgramStringARB(GL_VERTEX_PROGRAM_ARB, GL_PROGRAM_FORMAT_ASCII_ARB, + strlen(testcode), testcode)); + glGetIntegerv(GL_PROGRAM_ERROR_POSITION_ARB, &pos); + if(pos != -1) + { + WARN("GL_NV_vertex_program2_option result.clip[] test failed\n"); + TRACE("error: %s\n", debugstr_a((const char *)glGetString(GL_PROGRAM_ERROR_STRING_ARB))); + ret = TRUE; + while(glGetError()); + } + else TRACE("GL_NV_vertex_program2_option result.clip[] test passed\n"); + + GL_EXTCALL(glBindProgramARB(GL_VERTEX_PROGRAM_ARB, 0)); + GL_EXTCALL(glDeleteProgramsARB(1, &prog)); + checkGLcall("GL_NV_vertex_program2_option result.clip[] test cleanup"); + + LEAVE_GL(); + return ret; +} + static void quirk_arb_constants(struct wined3d_gl_info *gl_info) { TRACE_(d3d_caps)("Using ARB vs constant limit(=%u) for GLSL.\n", gl_info->vs_arb_constantsF); @@ -783,6 +835,18 @@ static void quirk_allows_specular_alpha(struct wined3d_gl_info *gl_info) gl_info->quirks |= WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA; } +static void quirk_apple_nvts(struct wined3d_gl_info *gl_info) +{ + gl_info->supported[NV_TEXTURE_SHADER] = FALSE; + gl_info->supported[NV_TEXTURE_SHADER2] = FALSE; + gl_info->supported[NV_TEXTURE_SHADER3] = FALSE; +} + +static void quirk_disable_nvvp_clip(struct wined3d_gl_info *gl_info) +{ + gl_info->quirks |= WINED3D_QUIRK_NV_CLIP_BROKEN; +} + struct driver_quirk { BOOL (*match)(const struct wined3d_gl_info *gl_info, const char *gl_renderer); @@ -847,7 +911,20 @@ static const struct driver_quirk quirk_table[] = match_allows_spec_alpha, quirk_allows_specular_alpha, "Allow specular alpha quirk" - } + }, + { + /* The pixel formats provided by GL_NV_texture_shader are broken on OSX + * (rdar://5682521). + */ + match_apple_nvts, + quirk_apple_nvts, + "Apple NV_texture_shader disable" + }, + { + match_broken_nv_clip, + quirk_disable_nvvp_clip, + "Apple NV_vertex_program clip bug quirk" + }, }; /* Certain applications (Steam) complain if we report an outdated driver version. In general, diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index cf61117d4f7..a8922d89f35 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -1956,7 +1956,6 @@ static void shader_glsl_map2gl(const struct wined3d_shader_instruction *ins) case WINED3DSIH_FRC: instruction = "fract"; break; case WINED3DSIH_NRM: instruction = "normalize"; break; case WINED3DSIH_EXP: instruction = "exp2"; break; - case WINED3DSIH_SGN: instruction = "sign"; break; case WINED3DSIH_DSX: instruction = "dFdx"; break; case WINED3DSIH_DSY: instruction = "ycorrection.y * dFdy"; break; default: instruction = ""; @@ -2449,6 +2448,21 @@ static void shader_glsl_sincos(const struct wined3d_shader_instruction *ins) } } +/* sgn in vs_2_0 has 2 extra parameters(registers for temporary storage) which we don't use + * here. But those extra parameters require a dedicated function for sgn, since map2gl would + * generate invalid code + */ +static void shader_glsl_sgn(const struct wined3d_shader_instruction *ins) +{ + glsl_src_param_t src0_param; + DWORD write_mask; + + write_mask = shader_glsl_append_dst(ins->ctx->buffer, ins); + shader_glsl_add_src_param(ins, &ins->src[0], write_mask, &src0_param); + + shader_addline(ins->ctx->buffer, "sign(%s));\n", src0_param.param_str); +} + /** Process the WINED3DSIO_LOOP instruction in GLSL: * Start a for() loop where src1.y is the initial value of aL, * increment aL by src1.z for a total of src1.x iterations. @@ -4719,7 +4733,7 @@ static const SHADER_HANDLER shader_glsl_instruction_handler_table[WINED3DSIH_TAB /* WINED3DSIH_RSQ */ shader_glsl_rsq, /* WINED3DSIH_SETP */ NULL, /* WINED3DSIH_SGE */ shader_glsl_compare, - /* WINED3DSIH_SGN */ shader_glsl_map2gl, + /* WINED3DSIH_SGN */ shader_glsl_sgn, /* WINED3DSIH_SINCOS */ shader_glsl_sincos, /* WINED3DSIH_SLT */ shader_glsl_compare, /* WINED3DSIH_SUB */ shader_glsl_arith, diff --git a/dlls/wined3d/shader_sm1.c b/dlls/wined3d/shader_sm1.c index ead2769e34c..e84132e37af 100644 --- a/dlls/wined3d/shader_sm1.c +++ b/dlls/wined3d/shader_sm1.c @@ -145,7 +145,8 @@ static const struct wined3d_sm1_opcode_info vs_opcode_table[] = {WINED3DSIO_FRC, 1, 2, WINED3DSIH_FRC, 0, 0 }, {WINED3DSIO_POW, 1, 3, WINED3DSIH_POW, 0, 0 }, {WINED3DSIO_CRS, 1, 3, WINED3DSIH_CRS, 0, 0 }, - {WINED3DSIO_SGN, 1, 2, WINED3DSIH_SGN, 0, 0 }, + {WINED3DSIO_SGN, 1, 4, WINED3DSIH_SGN, WINED3D_SHADER_VERSION(2,0), WINED3D_SHADER_VERSION(2,1)}, + {WINED3DSIO_SGN, 1, 2, WINED3DSIH_SGN, WINED3D_SHADER_VERSION(3,0), -1 }, {WINED3DSIO_NRM, 1, 2, WINED3DSIH_NRM, 0, 0 }, {WINED3DSIO_SINCOS, 1, 4, WINED3DSIH_SINCOS, WINED3D_SHADER_VERSION(2,0), WINED3D_SHADER_VERSION(2,1)}, {WINED3DSIO_SINCOS, 1, 2, WINED3DSIH_SINCOS, WINED3D_SHADER_VERSION(3,0), -1 }, diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 944d8f70d88..637bec666c8 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -4642,24 +4642,25 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, s static void viewport_miscpart(DWORD state, IWineD3DStateBlockImpl *stateblock, struct wined3d_context *context) { UINT width, height; - IWineD3DSurfaceImpl *target; + IWineD3DSurfaceImpl *target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0]; + WINED3DVIEWPORT vp = stateblock->viewport; + + if(vp.Width > target->currentDesc.Width) vp.Width = target->currentDesc.Width; + if(vp.Height > target->currentDesc.Height) vp.Height = target->currentDesc.Height; - glDepthRange(stateblock->viewport.MinZ, stateblock->viewport.MaxZ); + glDepthRange(vp.MinZ, vp.MaxZ); checkGLcall("glDepthRange"); /* Note: GL requires lower left, DirectX supplies upper left. This is reversed when using offscreen rendering */ if (context->render_offscreen) { - glViewport(stateblock->viewport.X, - stateblock->viewport.Y, - stateblock->viewport.Width, stateblock->viewport.Height); + glViewport(vp.X, vp.Y, vp.Width, vp.Height); } else { - target = (IWineD3DSurfaceImpl *) stateblock->wineD3DDevice->render_targets[0]; target->get_drawable_size(context, &width, &height); - glViewport(stateblock->viewport.X, - (height - (stateblock->viewport.Y + stateblock->viewport.Height)), - stateblock->viewport.Width, stateblock->viewport.Height); + glViewport(vp.X, + (height - (vp.Y + vp.Height)), + vp.Width, vp.Height); } checkGLcall("glViewport"); diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index feb980862c1..ef33a2ae644 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -5,6 +5,7 @@ * Copyright 2004 Jason Edmeades * Copyright 2005 Oliver Stieber * Copyright 2007 Stefan Dösinger for CodeWeavers + * Copyright 2009 Henri Verbeet for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -27,14 +28,134 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d); #define GLINFO_LOCATION This->wineD3DDevice->adapter->gl_info -/*************************************** - * Stateblock helper functions follow - **************************************/ +static const DWORD pixel_states_render[] = +{ + WINED3DRS_ALPHABLENDENABLE, + WINED3DRS_ALPHAFUNC, + WINED3DRS_ALPHAREF, + WINED3DRS_ALPHATESTENABLE, + WINED3DRS_BLENDOP, + WINED3DRS_COLORWRITEENABLE, + WINED3DRS_DESTBLEND, + WINED3DRS_DITHERENABLE, + WINED3DRS_FILLMODE, + WINED3DRS_FOGDENSITY, + WINED3DRS_FOGEND, + WINED3DRS_FOGSTART, + WINED3DRS_LASTPIXEL, + WINED3DRS_SHADEMODE, + WINED3DRS_SRCBLEND, + WINED3DRS_STENCILENABLE, + WINED3DRS_STENCILFAIL, + WINED3DRS_STENCILFUNC, + WINED3DRS_STENCILMASK, + WINED3DRS_STENCILPASS, + WINED3DRS_STENCILREF, + WINED3DRS_STENCILWRITEMASK, + WINED3DRS_STENCILZFAIL, + WINED3DRS_TEXTUREFACTOR, + WINED3DRS_WRAP0, + WINED3DRS_WRAP1, + WINED3DRS_WRAP2, + WINED3DRS_WRAP3, + WINED3DRS_WRAP4, + WINED3DRS_WRAP5, + WINED3DRS_WRAP6, + WINED3DRS_WRAP7, + WINED3DRS_ZENABLE, + WINED3DRS_ZFUNC, + WINED3DRS_ZWRITEENABLE, +}; + +static const DWORD pixel_states_texture[] = +{ + WINED3DTSS_ALPHAARG0, + WINED3DTSS_ALPHAARG1, + WINED3DTSS_ALPHAARG2, + WINED3DTSS_ALPHAOP, + WINED3DTSS_BUMPENVLOFFSET, + WINED3DTSS_BUMPENVLSCALE, + WINED3DTSS_BUMPENVMAT00, + WINED3DTSS_BUMPENVMAT01, + WINED3DTSS_BUMPENVMAT10, + WINED3DTSS_BUMPENVMAT11, + WINED3DTSS_COLORARG0, + WINED3DTSS_COLORARG1, + WINED3DTSS_COLORARG2, + WINED3DTSS_COLOROP, + WINED3DTSS_RESULTARG, + WINED3DTSS_TEXCOORDINDEX, + WINED3DTSS_TEXTURETRANSFORMFLAGS, +}; + +static const DWORD pixel_states_sampler[] = +{ + WINED3DSAMP_ADDRESSU, + WINED3DSAMP_ADDRESSV, + WINED3DSAMP_ADDRESSW, + WINED3DSAMP_BORDERCOLOR, + WINED3DSAMP_MAGFILTER, + WINED3DSAMP_MINFILTER, + WINED3DSAMP_MIPFILTER, + WINED3DSAMP_MIPMAPLODBIAS, + WINED3DSAMP_MAXMIPLEVEL, + WINED3DSAMP_MAXANISOTROPY, + WINED3DSAMP_SRGBTEXTURE, + WINED3DSAMP_ELEMENTINDEX, +}; + +static const DWORD vertex_states_render[] = +{ + WINED3DRS_AMBIENT, + WINED3DRS_AMBIENTMATERIALSOURCE, + WINED3DRS_CLIPPING, + WINED3DRS_CLIPPLANEENABLE, + WINED3DRS_COLORVERTEX, + WINED3DRS_DIFFUSEMATERIALSOURCE, + WINED3DRS_EMISSIVEMATERIALSOURCE, + WINED3DRS_FOGDENSITY, + WINED3DRS_FOGEND, + WINED3DRS_FOGSTART, + WINED3DRS_FOGTABLEMODE, + WINED3DRS_FOGVERTEXMODE, + WINED3DRS_INDEXEDVERTEXBLENDENABLE, + WINED3DRS_LIGHTING, + WINED3DRS_LOCALVIEWER, + WINED3DRS_MULTISAMPLEANTIALIAS, + WINED3DRS_MULTISAMPLEMASK, + WINED3DRS_NORMALIZENORMALS, + WINED3DRS_PATCHEDGESTYLE, + WINED3DRS_POINTSCALE_A, + WINED3DRS_POINTSCALE_B, + WINED3DRS_POINTSCALE_C, + WINED3DRS_POINTSCALEENABLE, + WINED3DRS_POINTSIZE, + WINED3DRS_POINTSIZE_MAX, + WINED3DRS_POINTSIZE_MIN, + WINED3DRS_POINTSPRITEENABLE, + WINED3DRS_RANGEFOGENABLE, + WINED3DRS_SPECULARMATERIALSOURCE, + WINED3DRS_TWEENFACTOR, + WINED3DRS_VERTEXBLEND, + WINED3DRS_CULLMODE, + WINED3DRS_FOGCOLOR, +}; + +static const DWORD vertex_states_texture[] = +{ + WINED3DTSS_TEXCOORDINDEX, + WINED3DTSS_TEXTURETRANSFORMFLAGS, +}; + +static const DWORD vertex_states_sampler[] = +{ + WINED3DSAMP_DMAPOFFSET, +}; /* Allocates the correct amount of space for pixel and vertex shader constants, * along with their set/changed flags on the given stateblock object */ -HRESULT allocate_shader_constants(IWineD3DStateBlockImpl* object) +static HRESULT stateblock_allocate_shader_constants(IWineD3DStateBlockImpl *object) { IWineD3DStateBlockImpl *This = object; @@ -70,41 +191,6 @@ fail: return E_OUTOFMEMORY; } -/** Copy all members of one stateblock to another */ -static void stateblock_savedstates_copy(IWineD3DStateBlock* iface, SAVEDSTATES *dest, const SAVEDSTATES *source) -{ - IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; - unsigned bsize = sizeof(BOOL); - - /* Single values */ - dest->primitive_type = source->primitive_type; - dest->indices = source->indices; - dest->material = source->material; - dest->viewport = source->viewport; - dest->vertexDecl = source->vertexDecl; - dest->pixelShader = source->pixelShader; - dest->vertexShader = source->vertexShader; - dest->scissorRect = dest->scissorRect; - - /* Fixed size arrays */ - dest->streamSource = source->streamSource; - dest->streamFreq = source->streamFreq; - dest->textures = source->textures; - memcpy(dest->transform, source->transform, sizeof(source->transform)); - memcpy(dest->renderState, source->renderState, sizeof(source->renderState)); - memcpy(dest->textureState, source->textureState, sizeof(source->textureState)); - memcpy(dest->samplerState, source->samplerState, sizeof(source->samplerState)); - dest->clipplane = source->clipplane; - dest->pixelShaderConstantsB = source->pixelShaderConstantsB; - dest->pixelShaderConstantsI = source->pixelShaderConstantsI; - dest->vertexShaderConstantsB = source->vertexShaderConstantsB; - dest->vertexShaderConstantsI = source->vertexShaderConstantsI; - - /* Dynamically sized arrays */ - memcpy(dest->pixelShaderConstantsF, source->pixelShaderConstantsF, bsize * GL_LIMITS(pshader_constantsF)); - memcpy(dest->vertexShaderConstantsF, source->vertexShaderConstantsF, bsize * GL_LIMITS(vshader_constantsF)); -} - static inline void stateblock_set_bits(DWORD *map, UINT map_size) { DWORD mask = (1 << (map_size & 0x1f)) - 1; @@ -112,135 +198,266 @@ static inline void stateblock_set_bits(DWORD *map, UINT map_size) if (mask) map[map_size >> 5] = mask; } -/** Set all members of a stateblock savedstate to the given value */ -void stateblock_savedstates_set(IWineD3DStateBlock *iface, SAVEDSTATES *states, BOOL value) +/* Set all members of a stateblock savedstate to the given value */ +static void stateblock_savedstates_set_all(SAVEDSTATES *states, const struct wined3d_gl_info *gl_info) { - IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)iface; - unsigned bsize = sizeof(BOOL); + unsigned int i; /* Single values */ - states->primitive_type = value; - states->indices = value; - states->material = value; - states->viewport = value; - states->vertexDecl = value; - states->pixelShader = value; - states->vertexShader = value; - states->scissorRect = value; + states->primitive_type = 1; + states->indices = 1; + states->material = 1; + states->viewport = 1; + states->vertexDecl = 1; + states->pixelShader = 1; + states->vertexShader = 1; + states->scissorRect = 1; /* Fixed size arrays */ - if (value) - { - int i; - states->streamSource = 0xffff; - states->streamFreq = 0xffff; - states->textures = 0xfffff; - stateblock_set_bits(states->transform, HIGHEST_TRANSFORMSTATE + 1); - stateblock_set_bits(states->renderState, WINEHIGHEST_RENDER_STATE + 1); - for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = 0x3ffff; - for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = 0x3fff; - states->clipplane = 0xffffffff; - states->pixelShaderConstantsB = 0xffff; - states->pixelShaderConstantsI = 0xffff; - states->vertexShaderConstantsB = 0xffff; - states->vertexShaderConstantsI = 0xffff; - } - else + states->streamSource = 0xffff; + states->streamFreq = 0xffff; + states->textures = 0xfffff; + stateblock_set_bits(states->transform, HIGHEST_TRANSFORMSTATE + 1); + stateblock_set_bits(states->renderState, WINEHIGHEST_RENDER_STATE + 1); + for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = 0x3ffff; + for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = 0x3fff; + states->clipplane = 0xffffffff; + states->pixelShaderConstantsB = 0xffff; + states->pixelShaderConstantsI = 0xffff; + states->vertexShaderConstantsB = 0xffff; + states->vertexShaderConstantsI = 0xffff; + + /* Dynamically sized arrays */ + memset(states->pixelShaderConstantsF, TRUE, sizeof(BOOL) * gl_info->max_pshader_constantsF); + memset(states->vertexShaderConstantsF, TRUE, sizeof(BOOL) * gl_info->max_vshader_constantsF); +} + +static void stateblock_savedstates_set_pixel(SAVEDSTATES *states, const struct wined3d_gl_info *gl_info) +{ + DWORD texture_mask = 0; + WORD sampler_mask = 0; + unsigned int i; + + states->pixelShader = 1; + + for (i = 0; i < sizeof(pixel_states_render) / sizeof(*pixel_states_render); ++i) { - states->streamSource = 0; - states->streamFreq = 0; - states->textures = 0; - memset(states->transform, 0, sizeof(states->transform)); - memset(states->renderState, 0, sizeof(states->renderState)); - memset(states->textureState, 0, sizeof(states->textureState)); - memset(states->samplerState, 0, sizeof(states->samplerState)); - states->clipplane = 0; - states->pixelShaderConstantsB = 0; - states->pixelShaderConstantsI = 0; - states->vertexShaderConstantsB = 0; - states->vertexShaderConstantsI = 0; + DWORD rs = pixel_states_render[i]; + states->renderState[rs >> 5] |= 1 << (rs & 0x1f); } - /* Dynamically sized arrays */ - memset(states->pixelShaderConstantsF, value, bsize * GL_LIMITS(pshader_constantsF)); - memset(states->vertexShaderConstantsF, value, bsize * GL_LIMITS(vshader_constantsF)); + for (i = 0; i < sizeof(pixel_states_texture) / sizeof(*pixel_states_texture); ++i) + texture_mask |= 1 << pixel_states_texture[i]; + for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = texture_mask; + for (i = 0; i < sizeof(pixel_states_sampler) / sizeof(*pixel_states_sampler); ++i) + sampler_mask |= 1 << pixel_states_sampler[i]; + for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = sampler_mask; + states->pixelShaderConstantsB = 0xffff; + states->pixelShaderConstantsI = 0xffff; + + memset(states->pixelShaderConstantsF, TRUE, sizeof(BOOL) * gl_info->max_pshader_constantsF); } -void stateblock_copy( - IWineD3DStateBlock* destination, - IWineD3DStateBlock* source) { - int l; +static void stateblock_savedstates_set_vertex(SAVEDSTATES *states, const struct wined3d_gl_info *gl_info) +{ + DWORD texture_mask = 0; + WORD sampler_mask = 0; + unsigned int i; + + states->vertexShader = 1; - IWineD3DStateBlockImpl *This = (IWineD3DStateBlockImpl *)source; - IWineD3DStateBlockImpl *Dest = (IWineD3DStateBlockImpl *)destination; + for (i = 0; i < sizeof(vertex_states_render) / sizeof(*vertex_states_render); ++i) + { + DWORD rs = vertex_states_render[i]; + states->renderState[rs >> 5] |= 1 << (rs & 0x1f); + } - /* IUnknown fields */ - Dest->lpVtbl = This->lpVtbl; - Dest->ref = This->ref; + for (i = 0; i < sizeof(vertex_states_texture) / sizeof(*vertex_states_texture); ++i) + texture_mask |= 1 << vertex_states_texture[i]; + for (i = 0; i < MAX_TEXTURES; ++i) states->textureState[i] = texture_mask; + for (i = 0; i < sizeof(vertex_states_sampler) / sizeof(*vertex_states_sampler); ++i) + sampler_mask |= 1 << vertex_states_sampler[i]; + for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) states->samplerState[i] = sampler_mask; + states->vertexShaderConstantsB = 0xffff; + states->vertexShaderConstantsI = 0xffff; - /* IWineD3DStateBlock information */ - Dest->parent = This->parent; - Dest->wineD3DDevice = This->wineD3DDevice; - Dest->blockType = This->blockType; + memset(states->vertexShaderConstantsF, TRUE, sizeof(BOOL) * gl_info->max_vshader_constantsF); +} - /* Saved states */ - stateblock_savedstates_copy(source, &Dest->changed, &This->changed); +static void stateblock_copy_values(IWineD3DStateBlockImpl *dst, const IWineD3DStateBlockImpl *src, + const struct wined3d_gl_info *gl_info) +{ + unsigned int l; /* Single items */ - Dest->gl_primitive_type = This->gl_primitive_type; - Dest->vertexDecl = This->vertexDecl; - Dest->vertexShader = This->vertexShader; - Dest->streamIsUP = This->streamIsUP; - Dest->pIndexData = This->pIndexData; - Dest->IndexFmt = This->IndexFmt; - Dest->baseVertexIndex = This->baseVertexIndex; - /* Dest->lights = This->lights; */ - Dest->clip_status = This->clip_status; - Dest->viewport = This->viewport; - Dest->material = This->material; - Dest->pixelShader = This->pixelShader; - Dest->scissorRect = This->scissorRect; + dst->gl_primitive_type = src->gl_primitive_type; + dst->vertexDecl = src->vertexDecl; + dst->vertexShader = src->vertexShader; + dst->streamIsUP = src->streamIsUP; + dst->pIndexData = src->pIndexData; + dst->IndexFmt = src->IndexFmt; + dst->baseVertexIndex = src->baseVertexIndex; + dst->clip_status = src->clip_status; + dst->viewport = src->viewport; + dst->material = src->material; + dst->pixelShader = src->pixelShader; + dst->scissorRect = src->scissorRect; /* Lights */ - memset(This->activeLights, 0, sizeof(This->activeLights)); - for(l = 0; l < LIGHTMAP_SIZE; l++) { + memset(dst->activeLights, 0, sizeof(dst->activeLights)); + for (l = 0; l < LIGHTMAP_SIZE; ++l) + { struct list *e1, *e2; - LIST_FOR_EACH_SAFE(e1, e2, &Dest->lightMap[l]) { + LIST_FOR_EACH_SAFE(e1, e2, &dst->lightMap[l]) + { PLIGHTINFOEL *light = LIST_ENTRY(e1, PLIGHTINFOEL, entry); list_remove(&light->entry); HeapFree(GetProcessHeap(), 0, light); } - LIST_FOR_EACH(e1, &This->lightMap[l]) { + LIST_FOR_EACH(e1, &src->lightMap[l]) + { PLIGHTINFOEL *light = LIST_ENTRY(e1, PLIGHTINFOEL, entry), *light2; light2 = HeapAlloc(GetProcessHeap(), 0, sizeof(*light)); *light2 = *light; - list_add_tail(&Dest->lightMap[l], &light2->entry); - if(light2->glIndex != -1) Dest->activeLights[light2->glIndex] = light2; + list_add_tail(&dst->lightMap[l], &light2->entry); + if (light2->glIndex != -1) dst->activeLights[light2->glIndex] = light2; } } /* Fixed size arrays */ - memcpy(Dest->vertexShaderConstantB, This->vertexShaderConstantB, sizeof(BOOL) * MAX_CONST_B); - memcpy(Dest->vertexShaderConstantI, This->vertexShaderConstantI, sizeof(INT) * MAX_CONST_I * 4); - memcpy(Dest->pixelShaderConstantB, This->pixelShaderConstantB, sizeof(BOOL) * MAX_CONST_B); - memcpy(Dest->pixelShaderConstantI, This->pixelShaderConstantI, sizeof(INT) * MAX_CONST_I * 4); - - memcpy(Dest->streamStride, This->streamStride, sizeof(UINT) * MAX_STREAMS); - memcpy(Dest->streamOffset, This->streamOffset, sizeof(UINT) * MAX_STREAMS); - memcpy(Dest->streamSource, This->streamSource, sizeof(IWineD3DBuffer *) * MAX_STREAMS); - memcpy(Dest->streamFreq, This->streamFreq, sizeof(UINT) * MAX_STREAMS); - memcpy(Dest->streamFlags, This->streamFlags, sizeof(UINT) * MAX_STREAMS); - memcpy(Dest->transforms, This->transforms, sizeof(WINED3DMATRIX) * (HIGHEST_TRANSFORMSTATE + 1)); - memcpy(Dest->clipplane, This->clipplane, sizeof(double) * MAX_CLIPPLANES * 4); - memcpy(Dest->renderState, This->renderState, sizeof(DWORD) * (WINEHIGHEST_RENDER_STATE + 1)); - memcpy(Dest->textures, This->textures, sizeof(IWineD3DBaseTexture*) * MAX_COMBINED_SAMPLERS); - memcpy(Dest->textureState, This->textureState, sizeof(DWORD) * MAX_TEXTURES * (WINED3D_HIGHEST_TEXTURE_STATE + 1)); - memcpy(Dest->samplerState, This->samplerState, sizeof(DWORD) * MAX_COMBINED_SAMPLERS * (WINED3D_HIGHEST_SAMPLER_STATE + 1)); + memcpy(dst->vertexShaderConstantB, src->vertexShaderConstantB, sizeof(dst->vertexShaderConstantB)); + memcpy(dst->vertexShaderConstantI, src->vertexShaderConstantI, sizeof(dst->vertexShaderConstantI)); + memcpy(dst->pixelShaderConstantB, src->pixelShaderConstantB, sizeof(dst->pixelShaderConstantB)); + memcpy(dst->pixelShaderConstantI, src->pixelShaderConstantI, sizeof(dst->pixelShaderConstantI)); + + memcpy(dst->streamStride, src->streamStride, sizeof(dst->streamStride)); + memcpy(dst->streamOffset, src->streamOffset, sizeof(dst->streamOffset)); + memcpy(dst->streamSource, src->streamSource, sizeof(dst->streamSource)); + memcpy(dst->streamFreq, src->streamFreq, sizeof(dst->streamFreq)); + memcpy(dst->streamFlags, src->streamFlags, sizeof(dst->streamFlags)); + memcpy(dst->transforms, src->transforms, sizeof(dst->transforms)); + memcpy(dst->clipplane, src->clipplane, sizeof(dst->clipplane)); + memcpy(dst->renderState, src->renderState, sizeof(dst->renderState)); + memcpy(dst->textures, src->textures, sizeof(dst->textures)); + memcpy(dst->textureState, src->textureState, sizeof(dst->textureState)); + memcpy(dst->samplerState, src->samplerState, sizeof(dst->samplerState)); /* Dynamically sized arrays */ - memcpy(Dest->vertexShaderConstantF, This->vertexShaderConstantF, sizeof(float) * GL_LIMITS(vshader_constantsF) * 4); - memcpy(Dest->pixelShaderConstantF, This->pixelShaderConstantF, sizeof(float) * GL_LIMITS(pshader_constantsF) * 4); + memcpy(dst->vertexShaderConstantF, src->vertexShaderConstantF, sizeof(float) * gl_info->max_vshader_constantsF * 4); + memcpy(dst->pixelShaderConstantF, src->pixelShaderConstantF, sizeof(float) * gl_info->max_pshader_constantsF * 4); +} + +void stateblock_init_contained_states(IWineD3DStateBlockImpl *stateblock) +{ + const struct wined3d_gl_info *gl_info = &stateblock->wineD3DDevice->adapter->gl_info; + unsigned int i, j; + + for (i = 0; i <= WINEHIGHEST_RENDER_STATE >> 5; ++i) + { + DWORD map = stateblock->changed.renderState[i]; + for (j = 0; map; map >>= 1, ++j) + { + if (!(map & 1)) continue; + + stateblock->contained_render_states[stateblock->num_contained_render_states] = (i << 5) | j; + ++stateblock->num_contained_render_states; + } + } + + for (i = 0; i <= HIGHEST_TRANSFORMSTATE >> 5; ++i) + { + DWORD map = stateblock->changed.transform[i]; + for (j = 0; map; map >>= 1, ++j) + { + if (!(map & 1)) continue; + + stateblock->contained_transform_states[stateblock->num_contained_transform_states] = (i << 5) | j; + ++stateblock->num_contained_transform_states; + } + } + + for (i = 0; i < gl_info->max_vshader_constantsF; ++i) + { + if (stateblock->changed.vertexShaderConstantsF[i]) + { + stateblock->contained_vs_consts_f[stateblock->num_contained_vs_consts_f] = i; + ++stateblock->num_contained_vs_consts_f; + } + } + + for (i = 0; i < MAX_CONST_I; ++i) + { + if (stateblock->changed.vertexShaderConstantsI & (1 << i)) + { + stateblock->contained_vs_consts_i[stateblock->num_contained_vs_consts_i] = i; + ++stateblock->num_contained_vs_consts_i; + } + } + + for (i = 0; i < MAX_CONST_B; ++i) + { + if (stateblock->changed.vertexShaderConstantsB & (1 << i)) + { + stateblock->contained_vs_consts_b[stateblock->num_contained_vs_consts_b] = i; + ++stateblock->num_contained_vs_consts_b; + } + } + + for (i = 0; i < gl_info->max_pshader_constantsF; ++i) + { + if (stateblock->changed.pixelShaderConstantsF[i]) + { + stateblock->contained_ps_consts_f[stateblock->num_contained_ps_consts_f] = i; + ++stateblock->num_contained_ps_consts_f; + } + } + + for (i = 0; i < MAX_CONST_I; ++i) + { + if (stateblock->changed.pixelShaderConstantsI & (1 << i)) + { + stateblock->contained_ps_consts_i[stateblock->num_contained_ps_consts_i] = i; + ++stateblock->num_contained_ps_consts_i; + } + } + + for (i = 0; i < MAX_CONST_B; ++i) + { + if (stateblock->changed.pixelShaderConstantsB & (1 << i)) + { + stateblock->contained_ps_consts_b[stateblock->num_contained_ps_consts_b] = i; + ++stateblock->num_contained_ps_consts_b; + } + } + + for (i = 0; i < MAX_TEXTURES; ++i) + { + DWORD map = stateblock->changed.textureState[i]; + + for(j = 0; map; map >>= 1, ++j) + { + if (!(map & 1)) continue; + + stateblock->contained_tss_states[stateblock->num_contained_tss_states].stage = i; + stateblock->contained_tss_states[stateblock->num_contained_tss_states].state = j; + ++stateblock->num_contained_tss_states; + } + } + + for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) + { + DWORD map = stateblock->changed.samplerState[i]; + + for (j = 0; map; map >>= 1, ++j) + { + if (!(map & 1)) continue; + + stateblock->contained_sampler_states[stateblock->num_contained_sampler_states].stage = i; + stateblock->contained_sampler_states[stateblock->num_contained_sampler_states].state = j; + ++stateblock->num_contained_sampler_states; + } + } } /********************************************************** @@ -278,17 +495,11 @@ static ULONG WINAPI IWineD3DStateBlockImpl_Release(IWineD3DStateBlock *iface) { if (!refCount) { int counter; - /* type 0 represents the primary stateblock, so free all the resources */ - if (This->blockType == WINED3DSBT_INIT) { - /* NOTE: according to MSDN: The application is responsible for making sure the texture references are cleared down */ - for (counter = 0; counter < MAX_COMBINED_SAMPLERS; counter++) { - if (This->textures[counter]) { - /* release our 'internal' hold on the texture */ - if(0 != IWineD3DBaseTexture_Release(This->textures[counter])) { - TRACE("Texture still referenced by stateblock, applications has leaked Stage = %u Texture = %p\n", counter, This->textures[counter]); - } - } - } + if (This->vertexDecl) IWineD3DVertexDeclaration_Release(This->vertexDecl); + + for (counter = 0; counter < MAX_COMBINED_SAMPLERS; counter++) + { + if (This->textures[counter]) IWineD3DBaseTexture_Release(This->textures[counter]); } for (counter = 0; counter < MAX_STREAMS; counter++) { @@ -343,7 +554,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_GetDevice(IWineD3DStateBlock *ifac } -static inline void record_lights(IWineD3DStateBlockImpl *This, IWineD3DStateBlockImpl *targetStateBlock) { +static void record_lights(IWineD3DStateBlockImpl *This, const IWineD3DStateBlockImpl *targetStateBlock) +{ UINT i; /* Lights... For a recorded state block, we just had a chain of actions to perform, @@ -518,6 +730,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) if(This->changed.vertexDecl && This->vertexDecl != targetStateBlock->vertexDecl){ TRACE("Updating vertex declaration from %p to %p\n", This->vertexDecl, targetStateBlock->vertexDecl); + if (targetStateBlock->vertexDecl) IWineD3DVertexDeclaration_AddRef(targetStateBlock->vertexDecl); + if (This->vertexDecl) IWineD3DVertexDeclaration_Release(This->vertexDecl); This->vertexDecl = targetStateBlock->vertexDecl; } @@ -605,13 +819,14 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) } /* Samplers */ - /* TODO: move over to using memcpy */ map = This->changed.textures; for (i = 0; map; map >>= 1, ++i) { if (!(map & 1)) continue; TRACE("Updating texture %u to %p (was %p)\n", i, targetStateBlock->textures[i], This->textures[i]); + if (targetStateBlock->textures[i]) IWineD3DBaseTexture_AddRef(targetStateBlock->textures[i]); + if (This->textures[i]) IWineD3DBaseTexture_Release(This->textures[i]); This->textures[i] = targetStateBlock->textures[i]; } @@ -630,7 +845,6 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) record_lights(This, targetStateBlock); } else if(This->blockType == WINED3DSBT_ALL) { - This->vertexDecl = targetStateBlock->vertexDecl; memcpy(This->vertexShaderConstantB, targetStateBlock->vertexShaderConstantB, sizeof(This->vertexShaderConstantI)); memcpy(This->vertexShaderConstantI, targetStateBlock->vertexShaderConstantI, sizeof(This->vertexShaderConstantF)); memcpy(This->vertexShaderConstantF, targetStateBlock->vertexShaderConstantF, sizeof(float) * GL_LIMITS(vshader_constantsF) * 4); @@ -650,11 +864,27 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) memcpy(This->pixelShaderConstantI, targetStateBlock->pixelShaderConstantI, sizeof(This->pixelShaderConstantF)); memcpy(This->pixelShaderConstantF, targetStateBlock->pixelShaderConstantF, sizeof(float) * GL_LIMITS(pshader_constantsF) * 4); memcpy(This->renderState, targetStateBlock->renderState, sizeof(This->renderState)); - memcpy(This->textures, targetStateBlock->textures, sizeof(This->textures)); memcpy(This->textureState, targetStateBlock->textureState, sizeof(This->textureState)); memcpy(This->samplerState, targetStateBlock->samplerState, sizeof(This->samplerState)); This->scissorRect = targetStateBlock->scissorRect; + if (This->vertexDecl != targetStateBlock->vertexDecl) + { + if (targetStateBlock->vertexDecl) IWineD3DVertexDeclaration_AddRef(targetStateBlock->vertexDecl); + if (This->vertexDecl) IWineD3DVertexDeclaration_Release(This->vertexDecl); + This->vertexDecl = targetStateBlock->vertexDecl; + } + + for (i = 0; i < MAX_COMBINED_SAMPLERS; ++i) + { + if (targetStateBlock->textures[i] != This->textures[i]) + { + if (targetStateBlock->textures[i]) IWineD3DBaseTexture_AddRef(targetStateBlock->textures[i]); + if (This->textures[i]) IWineD3DBaseTexture_Release(This->textures[i]); + This->textures[i] = targetStateBlock->textures[i]; + } + } + if(targetStateBlock->pIndexData != This->pIndexData || targetStateBlock->IndexFmt != This->IndexFmt) { if (targetStateBlock->pIndexData) IWineD3DBuffer_AddRef(targetStateBlock->pIndexData); @@ -684,17 +914,20 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) memcpy(This->vertexShaderConstantI, targetStateBlock->vertexShaderConstantI, sizeof(This->vertexShaderConstantF)); memcpy(This->vertexShaderConstantF, targetStateBlock->vertexShaderConstantF, sizeof(float) * GL_LIMITS(vshader_constantsF) * 4); record_lights(This, targetStateBlock); - for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) { - This->renderState[SavedVertexStates_R[i]] = targetStateBlock->renderState[SavedVertexStates_R[i]]; + for (i = 0; i < sizeof(vertex_states_render) / sizeof(*vertex_states_render); ++i) + { + This->renderState[vertex_states_render[i]] = targetStateBlock->renderState[vertex_states_render[i]]; } for (j = 0; j < MAX_COMBINED_SAMPLERS; j++) { - for (i = 0; i < NUM_SAVEDVERTEXSTATES_S; i++) { - This->samplerState[j][SavedVertexStates_S[i]] = targetStateBlock->samplerState[j][SavedVertexStates_S[i]]; + for (i = 0; i < sizeof(vertex_states_sampler) / sizeof(*vertex_states_sampler); ++i) + { + This->samplerState[j][vertex_states_sampler[i]] = targetStateBlock->samplerState[j][vertex_states_sampler[i]]; } } for (j = 0; j < MAX_TEXTURES; j++) { - for (i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) { - This->textureState[j][SavedVertexStates_R[i]] = targetStateBlock->textureState[j][SavedVertexStates_R[i]]; + for (i = 0; i < sizeof(vertex_states_render) / sizeof(*vertex_states_render); ++i) + { + This->textureState[j][vertex_states_render[i]] = targetStateBlock->textureState[j][vertex_states_render[i]]; } } for(i = 0; i < MAX_STREAMS; i++) { @@ -713,17 +946,20 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) memcpy(This->pixelShaderConstantB, targetStateBlock->pixelShaderConstantB, sizeof(This->pixelShaderConstantI)); memcpy(This->pixelShaderConstantI, targetStateBlock->pixelShaderConstantI, sizeof(This->pixelShaderConstantF)); memcpy(This->pixelShaderConstantF, targetStateBlock->pixelShaderConstantF, sizeof(float) * GL_LIMITS(pshader_constantsF) * 4); - for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) { - This->renderState[SavedPixelStates_R[i]] = targetStateBlock->renderState[SavedPixelStates_R[i]]; + for (i = 0; i < sizeof(pixel_states_render) / sizeof(*pixel_states_render); ++i) + { + This->renderState[pixel_states_render[i]] = targetStateBlock->renderState[pixel_states_render[i]]; } for (j = 0; j < MAX_COMBINED_SAMPLERS; j++) { - for (i = 0; i < NUM_SAVEDPIXELSTATES_S; i++) { - This->samplerState[j][SavedPixelStates_S[i]] = targetStateBlock->samplerState[j][SavedPixelStates_S[i]]; + for (i = 0; i < sizeof(pixel_states_sampler) / sizeof(*pixel_states_sampler); ++i) + { + This->samplerState[j][pixel_states_sampler[i]] = targetStateBlock->samplerState[j][pixel_states_sampler[i]]; } } for (j = 0; j < MAX_TEXTURES; j++) { - for (i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) { - This->textureState[j][SavedPixelStates_R[i]] = targetStateBlock->textureState[j][SavedPixelStates_R[i]]; + for (i = 0; i < sizeof(pixel_states_render) / sizeof(*pixel_states_render); ++i) + { + This->textureState[j][pixel_states_render[i]] = targetStateBlock->textureState[j][pixel_states_render[i]]; } } if(This->pixelShader != targetStateBlock->pixelShader) { @@ -738,7 +974,8 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) return WINED3D_OK; } -static inline void apply_lights(IWineD3DDevice *pDevice, IWineD3DStateBlockImpl *This) { +static void apply_lights(IWineD3DDevice *pDevice, const IWineD3DStateBlockImpl *This) +{ UINT i; for(i = 0; i < LIGHTMAP_SIZE; i++) { struct list *e; @@ -917,28 +1154,30 @@ should really perform a delta so that only the changes get updated*/ apply_lights(pDevice, This); - for(i = 0; i < NUM_SAVEDVERTEXSTATES_R; i++) { - IWineD3DDevice_SetRenderState(pDevice, SavedVertexStates_R[i], This->renderState[SavedVertexStates_R[i]]); + for (i = 0; i < sizeof(vertex_states_render) / sizeof(*vertex_states_render); ++i) + { + IWineD3DDevice_SetRenderState(pDevice, vertex_states_render[i], This->renderState[vertex_states_render[i]]); } for(j = 0; j < MAX_TEXTURES; j++) { - for(i = 0; i < NUM_SAVEDVERTEXSTATES_T; i++) { - IWineD3DDevice_SetTextureStageState(pDevice, j, SavedVertexStates_T[i], - This->textureState[j][SavedVertexStates_T[i]]); + for (i = 0; i < sizeof(vertex_states_texture) / sizeof(*vertex_states_texture); ++i) + { + IWineD3DDevice_SetTextureStageState(pDevice, j, vertex_states_texture[i], + This->textureState[j][vertex_states_texture[i]]); } } for(j = 0; j < MAX_FRAGMENT_SAMPLERS; j++) { - for(i = 0; i < NUM_SAVEDVERTEXSTATES_S; i++) { - IWineD3DDevice_SetSamplerState(pDevice, j, SavedVertexStates_S[i], - This->samplerState[j][SavedVertexStates_S[i]]); + for (i = 0; i < sizeof(vertex_states_sampler) / sizeof(*vertex_states_sampler); ++i) + { + IWineD3DDevice_SetSamplerState(pDevice, j, vertex_states_sampler[i], + This->samplerState[j][vertex_states_sampler[i]]); } } for(j = MAX_FRAGMENT_SAMPLERS; j < MAX_COMBINED_SAMPLERS; j++) { - for(i = 0; i < NUM_SAVEDVERTEXSTATES_S; i++) { - IWineD3DDevice_SetSamplerState(pDevice, - WINED3DVERTEXTEXTURESAMPLER0 + j - MAX_FRAGMENT_SAMPLERS, - SavedVertexStates_S[i], - This->samplerState[j][SavedVertexStates_S[i]]); + for (i = 0; i < sizeof(vertex_states_sampler) / sizeof(*vertex_states_sampler); ++i) + { + IWineD3DDevice_SetSamplerState(pDevice, WINED3DVERTEXTEXTURESAMPLER0 + j - MAX_FRAGMENT_SAMPLERS, + vertex_states_sampler[i], This->samplerState[j][vertex_states_sampler[i]]); } } } else if(This->blockType == WINED3DSBT_PIXELSTATE) { @@ -956,28 +1195,30 @@ should really perform a delta so that only the changes get updated*/ This->pixelShaderConstantB + i, 1); } - for(i = 0; i < NUM_SAVEDPIXELSTATES_R; i++) { - IWineD3DDevice_SetRenderState(pDevice, SavedPixelStates_R[i], This->renderState[SavedPixelStates_R[i]]); + for (i = 0; i < sizeof(pixel_states_render) / sizeof(*pixel_states_render); ++i) + { + IWineD3DDevice_SetRenderState(pDevice, pixel_states_render[i], This->renderState[pixel_states_render[i]]); } for(j = 0; j < MAX_TEXTURES; j++) { - for(i = 0; i < NUM_SAVEDPIXELSTATES_T; i++) { - IWineD3DDevice_SetTextureStageState(pDevice, j, SavedPixelStates_T[i], - This->textureState[j][SavedPixelStates_T[i]]); + for (i = 0; i < sizeof(pixel_states_texture) / sizeof(*pixel_states_texture); ++i) + { + IWineD3DDevice_SetTextureStageState(pDevice, j, pixel_states_texture[i], + This->textureState[j][pixel_states_texture[i]]); } } for(j = 0; j < MAX_FRAGMENT_SAMPLERS; j++) { - for(i = 0; i < NUM_SAVEDPIXELSTATES_S; i++) { - IWineD3DDevice_SetSamplerState(pDevice, j, SavedPixelStates_S[i], - This->samplerState[j][SavedPixelStates_S[i]]); + for (i = 0; i < sizeof(pixel_states_sampler) / sizeof(*pixel_states_sampler); ++i) + { + IWineD3DDevice_SetSamplerState(pDevice, j, pixel_states_sampler[i], + This->samplerState[j][pixel_states_sampler[i]]); } } for(j = MAX_FRAGMENT_SAMPLERS; j < MAX_COMBINED_SAMPLERS; j++) { - for(i = 0; i < NUM_SAVEDPIXELSTATES_S; i++) { - IWineD3DDevice_SetSamplerState(pDevice, - WINED3DVERTEXTEXTURESAMPLER0 + j - MAX_FRAGMENT_SAMPLERS, - SavedPixelStates_S[i], - This->samplerState[j][SavedPixelStates_S[i]]); + for (i = 0; i < sizeof(pixel_states_sampler) / sizeof(*pixel_states_sampler); ++i) + { + IWineD3DDevice_SetSamplerState(pDevice, WINED3DVERTEXTEXTURESAMPLER0 + j - MAX_FRAGMENT_SAMPLERS, + pixel_states_sampler[i], This->samplerState[j][pixel_states_sampler[i]]); } } } else if(This->blockType == WINED3DSBT_ALL) { @@ -1330,7 +1571,7 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_InitStartupStateBlock(IWineD3DStat * IWineD3DStateBlock VTbl follows **********************************************************/ -const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl = +static const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl = { /* IUnknown */ IWineD3DStateBlockImpl_QueryInterface, @@ -1343,3 +1584,125 @@ const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl = IWineD3DStateBlockImpl_Apply, IWineD3DStateBlockImpl_InitStartupStateBlock }; + +HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *device, + WINED3DSTATEBLOCKTYPE type, IUnknown *parent) +{ + const struct wined3d_gl_info *gl_info = &device->adapter->gl_info; + unsigned int i; + HRESULT hr; + + stateblock->lpVtbl = &IWineD3DStateBlock_Vtbl; + stateblock->ref = 1; + stateblock->parent = parent; + stateblock->wineD3DDevice = device; + stateblock->blockType = type; + + for (i = 0; i < LIGHTMAP_SIZE; i++) + { + list_init(&stateblock->lightMap[i]); + } + + hr = stateblock_allocate_shader_constants(stateblock); + if (FAILED(hr)) return hr; + + /* The WINED3DSBT_INIT stateblock type is used during initialization to + * produce a placeholder stateblock so other functions called can update a + * state block. */ + if (type == WINED3DSBT_INIT || type == WINED3DSBT_RECORDED) return WINED3D_OK; + + /* Otherwise, might as well set the whole state block to the appropriate values */ + if (device->stateBlock) + { + /* Saved values */ + stateblock_copy_values(stateblock, device->stateBlock, gl_info); + } + else + { + memset(stateblock->streamFreq, 1, sizeof(stateblock->streamFreq)); + } + + TRACE("Updating changed flags appropriate for type %#x.\n", type); + + if (type == WINED3DSBT_ALL) + { + TRACE("ALL => Pretend everything has changed.\n"); + + stateblock_savedstates_set_all(&stateblock->changed, gl_info); + stateblock_init_contained_states(stateblock); + + /* Lights are not part of the changed / set structure. */ + for (i = 0; i < LIGHTMAP_SIZE; ++i) + { + struct list *e; + LIST_FOR_EACH(e, &stateblock->lightMap[i]) + { + PLIGHTINFOEL *light = LIST_ENTRY(e, PLIGHTINFOEL, entry); + light->changed = TRUE; + light->enabledChanged = TRUE; + } + } + + for (i = 0; i < MAX_STREAMS; ++i) + { + if (stateblock->streamSource[i]) IWineD3DBuffer_AddRef(stateblock->streamSource[i]); + } + + if (stateblock->pIndexData) IWineD3DBuffer_AddRef(stateblock->pIndexData); + if (stateblock->vertexShader) IWineD3DVertexShader_AddRef(stateblock->vertexShader); + if (stateblock->pixelShader) IWineD3DPixelShader_AddRef(stateblock->pixelShader); + } + else if (type == WINED3DSBT_PIXELSTATE) + { + TRACE("PIXELSTATE => Pretend all pixel states have changed.\n"); + + stateblock_savedstates_set_pixel(&stateblock->changed, gl_info); + stateblock_init_contained_states(stateblock); + + if (stateblock->pixelShader) IWineD3DPixelShader_AddRef(stateblock->pixelShader); + + /* Pixel state blocks do not contain vertex buffers. Set them to NULL + * to avoid wrong refcounting on them. This makes releasing the buffer + * easier. */ + for (i = 0; i < MAX_STREAMS; ++i) + { + stateblock->streamSource[i] = NULL; + } + stateblock->pIndexData = NULL; + stateblock->vertexShader = NULL; + } + else if (type == WINED3DSBT_VERTEXSTATE) + { + TRACE("VERTEXSTATE => Pretend all vertex shates have changed.\n"); + + stateblock_savedstates_set_vertex(&stateblock->changed, gl_info); + stateblock_init_contained_states(stateblock); + + for (i = 0; i < LIGHTMAP_SIZE; ++i) + { + struct list *e; + LIST_FOR_EACH(e, &stateblock->lightMap[i]) + { + PLIGHTINFOEL *light = LIST_ENTRY(e, PLIGHTINFOEL, entry); + light->changed = TRUE; + light->enabledChanged = TRUE; + } + } + + for (i = 0; i < MAX_STREAMS; ++i) + { + if (stateblock->streamSource[i]) IWineD3DBuffer_AddRef(stateblock->streamSource[i]); + } + + if (stateblock->vertexShader) IWineD3DVertexShader_AddRef(stateblock->vertexShader); + + stateblock->pIndexData = NULL; + stateblock->pixelShader = NULL; + } + else + { + FIXME("Unrecognized state block type %#x.\n", type); + } + + return WINED3D_OK; +} diff --git a/dlls/wined3d/vertexdeclaration.c b/dlls/wined3d/vertexdeclaration.c index db595be82ad..6d617eda84b 100644 --- a/dlls/wined3d/vertexdeclaration.c +++ b/dlls/wined3d/vertexdeclaration.c @@ -68,12 +68,8 @@ static ULONG WINAPI IWineD3DVertexDeclarationImpl_Release(IWineD3DVertexDeclarat ULONG ref; TRACE("(%p) : Releasing from %d\n", This, This->ref); ref = InterlockedDecrement(&This->ref); - if (ref == 0) { - if(iface == This->wineD3DDevice->stateBlock->vertexDecl) { - /* See comment in PixelShader::Release */ - IWineD3DDeviceImpl_MarkStateDirty(This->wineD3DDevice, STATE_VDECL); - } - + if (!ref) + { HeapFree(GetProcessHeap(), 0, This->elements); This->parent_ops->wined3d_object_destroyed(This->parent); HeapFree(GetProcessHeap(), 0, This); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 24066c9562e..4ab5459b25b 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -48,6 +48,7 @@ #define WINED3D_QUIRK_SET_TEXCOORD_W 0x00000002 #define WINED3D_QUIRK_GLSL_CLIP_VARYING 0x00000004 #define WINED3D_QUIRK_ALLOWS_SPECULAR_ALPHA 0x00000008 +#define WINED3D_QUIRK_NV_CLIP_BROKEN 0x00000010 /* Texture format fixups */ @@ -147,21 +148,6 @@ void wined3d_rb_free(void *ptr) DECLSPEC_HIDDEN; #define MAX_ACTIVE_LIGHTS 8 #define MAX_CLIPPLANES WINED3DMAXUSERCLIPPLANES -/* Used for CreateStateBlock */ -#define NUM_SAVEDPIXELSTATES_R 35 -#define NUM_SAVEDPIXELSTATES_T 18 -#define NUM_SAVEDPIXELSTATES_S 12 -#define NUM_SAVEDVERTEXSTATES_R 34 -#define NUM_SAVEDVERTEXSTATES_T 2 -#define NUM_SAVEDVERTEXSTATES_S 1 - -extern const DWORD SavedPixelStates_R[NUM_SAVEDPIXELSTATES_R] DECLSPEC_HIDDEN; -extern const DWORD SavedPixelStates_T[NUM_SAVEDPIXELSTATES_T] DECLSPEC_HIDDEN; -extern const DWORD SavedPixelStates_S[NUM_SAVEDPIXELSTATES_S] DECLSPEC_HIDDEN; -extern const DWORD SavedVertexStates_R[NUM_SAVEDVERTEXSTATES_R] DECLSPEC_HIDDEN; -extern const DWORD SavedVertexStates_T[NUM_SAVEDVERTEXSTATES_T] DECLSPEC_HIDDEN; -extern const DWORD SavedVertexStates_S[NUM_SAVEDVERTEXSTATES_S] DECLSPEC_HIDDEN; - typedef enum _WINELOOKUP { WINELOOKUP_WARPPARAM = 0, MAX_LOOKUPS = 1 @@ -2292,7 +2278,7 @@ struct IWineD3DStateBlockImpl /* Light hashmap . Collisions are handled using standard wine double linked lists */ #define LIGHTMAP_SIZE 43 /* Use of a prime number recommended. Set to 1 for a linked list! */ #define LIGHTMAP_HASHFUNC(x) ((x) % LIGHTMAP_SIZE) /* Primitive and simple function */ - struct list lightMap[LIGHTMAP_SIZE]; /* Mashmap containing the lights */ + struct list lightMap[LIGHTMAP_SIZE]; /* Hash map containing the lights */ PLIGHTINFOEL *activeLights[MAX_ACTIVE_LIGHTS]; /* Map of opengl lights to d3d lights */ /* Clipping */ @@ -2351,10 +2337,9 @@ struct IWineD3DStateBlockImpl unsigned int num_contained_sampler_states; }; -extern void stateblock_savedstates_set(IWineD3DStateBlock *iface, SAVEDSTATES *states, BOOL value) DECLSPEC_HIDDEN; -extern void stateblock_copy(IWineD3DStateBlock *destination, IWineD3DStateBlock *source) DECLSPEC_HIDDEN; - -extern const IWineD3DStateBlockVtbl IWineD3DStateBlock_Vtbl DECLSPEC_HIDDEN; +HRESULT stateblock_init(IWineD3DStateBlockImpl *stateblock, IWineD3DDeviceImpl *device, + WINED3DSTATEBLOCKTYPE type, IUnknown *parent) DECLSPEC_HIDDEN; +void stateblock_init_contained_states(IWineD3DStateBlockImpl *object) DECLSPEC_HIDDEN; /* Direct3D terminology with little modifications. We do not have an issued state * because only the driver knows about it, but we have a created state because d3d diff --git a/dlls/winedos/dosmem.c b/dlls/winedos/dosmem.c index d453da35ede..06823f854c3 100644 --- a/dlls/winedos/dosmem.c +++ b/dlls/winedos/dosmem.c @@ -224,10 +224,25 @@ static void DOSMEM_FillBiosSegments(void) * * Increment the BIOS tick counter. Called by timer signal handler. */ -void BiosTick( WORD timer ) +static void CALLBACK BiosTick( LPVOID arg, DWORD low, DWORD high ) { - BIOSDATA *pBiosData = DOSVM_BiosData(); - if (pBiosData) pBiosData->Ticks++; + BIOSDATA *pBiosData = arg; + pBiosData->Ticks++; +} + +/*********************************************************************** + * timer_thread + */ +static DWORD CALLBACK timer_thread( void *arg ) +{ + LARGE_INTEGER when; + HANDLE timer; + + if (!(timer = CreateWaitableTimerA( NULL, FALSE, NULL ))) return 0; + + when.u.LowPart = when.u.HighPart = 0; + SetWaitableTimer( timer, &when, 55 /* actually 54.925 */, BiosTick, arg, FALSE ); + for (;;) SleepEx( INFINITE, TRUE ); } /*********************************************************************** @@ -488,6 +503,8 @@ BOOL DOSMEM_InitDosMemory(void) * Set DOS memory base and initialize conventional memory. */ DOSMEM_InitMemory(DOSMEM_dosmem + reserve); + + CloseHandle( CreateThread( NULL, 0, timer_thread, DOSVM_BiosData(), 0, NULL )); return TRUE; } diff --git a/dlls/winedos/winedos.spec b/dlls/winedos/winedos.spec index 98f9048d44c..68478747de8 100644 --- a/dlls/winedos/winedos.spec +++ b/dlls/winedos/winedos.spec @@ -11,6 +11,3 @@ @ cdecl FreeDosBlock(ptr) DOSMEM_FreeBlock @ cdecl AllocDosBlock(long ptr) DOSMEM_AllocBlock @ cdecl ResizeDosBlock(ptr long long) DOSMEM_ResizeBlock - -# BIOS functions -@ cdecl BiosTick(long) diff --git a/dlls/wineps.drv/Makefile.in b/dlls/wineps.drv/Makefile.in index 7e8efdca99a..34d3473d5a2 100644 --- a/dlls/wineps.drv/Makefile.in +++ b/dlls/wineps.drv/Makefile.in @@ -6,8 +6,6 @@ MODULE = wineps.drv IMPORTS = user32 gdi32 winspool advapi32 kernel32 EXTRAINCL = @FREETYPEINCL@ @CUPSINCL@ -SPEC_SRCS16 = wineps16.drv.spec - C_SRCS = \ afm.c \ bitblt.c \ diff --git a/dlls/wineps.drv/brush.c b/dlls/wineps.drv/brush.c index e55bf1a8c1b..fb063ec80f0 100644 --- a/dlls/wineps.drv/brush.c +++ b/dlls/wineps.drv/brush.c @@ -233,7 +233,7 @@ BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO) case BS_DIBPATTERN: { - BITMAPINFO *bmi = GlobalLock16(logbrush.lbHatch); + BITMAPINFO *bmi = GlobalLock( (HGLOBAL)logbrush.lbHatch ); UINT usage = logbrush.lbColor; TRACE("size %dx%dx%d\n", bmi->bmiHeader.biWidth, bmi->bmiHeader.biHeight, bmi->bmiHeader.biBitCount); @@ -246,7 +246,7 @@ BOOL PSDRV_Brush(PSDRV_PDEVICE *physDev, BOOL EO) FIXME("Trying to set a pattern brush on a level 1 printer\n"); ret = FALSE; } - GlobalUnlock16(logbrush.lbHatch); + GlobalUnlock( (HGLOBAL)logbrush.lbHatch ); } break; diff --git a/dlls/wineps.drv/driver.c b/dlls/wineps.drv/driver.c index 904f97a1809..378f4feaa7a 100644 --- a/dlls/wineps.drv/driver.c +++ b/dlls/wineps.drv/driver.c @@ -176,19 +176,6 @@ void PSDRV_MergeDevmodes(PSDRV_DEVMODEA *dm1, PSDRV_DEVMODEA *dm2, } -/************************************************************** - * AdvancedSetupDialog [WINEPS16.93] - * - */ -WORD WINAPI PSDRV_AdvancedSetupDialog16(HWND16 hwnd, HANDLE16 hDriver, - LPDEVMODEA devin, LPDEVMODEA devout) -{ - - TRACE("hwnd = %04x, hDriver = %04x devin=%p devout=%p\n", hwnd, - hDriver, devin, devout); - return IDCANCEL; -} - /**************************************************************** * PSDRV_PaperDlgProc * @@ -406,21 +393,6 @@ INT CDECL PSDRV_ExtDeviceMode(LPSTR lpszDriver, HWND hwnd, LPDEVMODEA lpdmOutput } return IDOK; } -/*************************************************************** - * ExtDeviceMode [WINEPS16.90] - * - */ - -INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver, - LPDEVMODEA lpdmOutput, LPSTR lpszDevice, - LPSTR lpszPort, LPDEVMODEA lpdmInput, - LPSTR lpszProfile, WORD fwMode) - -{ - return PSDRV_ExtDeviceMode(NULL, HWND_32(hwnd), lpdmOutput, lpszDevice, - lpszPort, lpdmInput, lpszProfile, (DWORD) fwMode); -} - /*********************************************************************** * PSDRV_DeviceCapabilities * @@ -722,29 +694,6 @@ DWORD CDECL PSDRV_DeviceCapabilities(LPSTR lpszDriver, LPCSTR lpszDevice, LPCSTR return -1; } -/************************************************************** - * DeviceCapabilities [WINEPS16.91] - */ -DWORD WINAPI PSDRV_DeviceCapabilities16(LPCSTR lpszDevice, - LPCSTR lpszPort, WORD fwCapability, - LPSTR lpszOutput, LPDEVMODEA lpdm) -{ - return PSDRV_DeviceCapabilities(NULL, lpszDevice, lpszPort, fwCapability, - lpszOutput, lpdm); -} - -/*************************************************************** - * DeviceMode [WINEPS16.13] - * - */ -void WINAPI PSDRV_DeviceMode16(HWND16 hwnd, HANDLE16 hDriver, -LPSTR lpszDevice, LPSTR lpszPort) -{ - PSDRV_ExtDeviceMode16( hwnd, hDriver, NULL, lpszDevice, lpszPort, NULL, - NULL, DM_PROMPT ); - return; -} - #if 0 typedef struct { DWORD nPages; diff --git a/dlls/wineps.drv/psdrv.h b/dlls/wineps.drv/psdrv.h index fb90aebff83..c9a4a4e9612 100644 --- a/dlls/wineps.drv/psdrv.h +++ b/dlls/wineps.drv/psdrv.h @@ -397,11 +397,6 @@ extern const UNICODEGLYPH PSDRV_AGLbyName[]; /* duplicates omitted */ extern const INT PSDRV_AGLbyUVSize; /* sorted by UV - */ extern const UNICODEGLYPH PSDRV_AGLbyUV[]; /* duplicates included */ - -extern INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver, - LPDEVMODEA lpdmOutput, LPSTR lpszDevice, LPSTR lpszPort, - LPDEVMODEA lpdmInput, LPSTR lpszProfile, WORD fwMode); - extern HINSTANCE PSDRV_hInstance; extern HANDLE PSDRV_Heap; extern char *PSDRV_ANSIVector[256]; diff --git a/dlls/wineps16.drv16/Makefile.in b/dlls/wineps16.drv16/Makefile.in new file mode 100644 index 00000000000..ceeb97c28c6 --- /dev/null +++ b/dlls/wineps16.drv16/Makefile.in @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = wineps16.drv16 +IMPORTS = kernel32 + +EXTRADLLFLAGS = -Wb,--subsystem,win16 + +C_SRCS = driver.c + +@MAKE_DLL_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/wineps16.drv16/driver.c b/dlls/wineps16.drv16/driver.c new file mode 100644 index 00000000000..64dcbfb7d49 --- /dev/null +++ b/dlls/wineps16.drv16/driver.c @@ -0,0 +1,89 @@ +/* + * Exported functions from the PostScript driver. + * + * Copyright 1998 Huw D M Davies + * + * 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 "config.h" + +#include + +#include "windef.h" +#include "wine/winuser16.h" +#include "wownt32.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(psdrv); + +static HMODULE wineps; +static INT (CDECL *pExtDeviceMode)(LPSTR,HWND,LPDEVMODEA,LPSTR,LPSTR,LPDEVMODEA,LPSTR,DWORD); +static DWORD (CDECL *pDeviceCapabilities)(LPSTR,LPCSTR,LPCSTR,WORD,LPSTR,LPDEVMODEA); + +static HMODULE load_wineps(void) +{ + if (!wineps) + { + wineps = LoadLibraryA( "wineps.drv" ); + pExtDeviceMode = (void *)GetProcAddress( wineps, "ExtDeviceMode" ); + pDeviceCapabilities = (void *)GetProcAddress( wineps, "DeviceCapabilities" ); + } + return wineps; +} + +/************************************************************** + * AdvancedSetupDialog [WINEPS16.93] + */ +WORD WINAPI PSDRV_AdvancedSetupDialog16(HWND16 hwnd, HANDLE16 hDriver, + LPDEVMODEA devin, LPDEVMODEA devout) +{ + TRACE("hwnd = %04x, hDriver = %04x devin=%p devout=%p\n", hwnd, hDriver, devin, devout); + return IDCANCEL; +} + +/*************************************************************** + * ExtDeviceMode [WINEPS16.90] + */ +INT16 WINAPI PSDRV_ExtDeviceMode16(HWND16 hwnd, HANDLE16 hDriver, + LPDEVMODEA lpdmOutput, LPSTR lpszDevice, + LPSTR lpszPort, LPDEVMODEA lpdmInput, + LPSTR lpszProfile, WORD fwMode) + +{ + if (!load_wineps() || !pExtDeviceMode) return -1; + return pExtDeviceMode( NULL, HWND_32(hwnd), lpdmOutput, lpszDevice, + lpszPort, lpdmInput, lpszProfile, fwMode ); +} + +/************************************************************** + * DeviceCapabilities [WINEPS16.91] + */ +DWORD WINAPI PSDRV_DeviceCapabilities16(LPCSTR lpszDevice, + LPCSTR lpszPort, WORD fwCapability, + LPSTR lpszOutput, LPDEVMODEA lpdm) +{ + if (!load_wineps() || !pDeviceCapabilities) return 0; + return pDeviceCapabilities( NULL, lpszDevice, lpszPort, fwCapability, lpszOutput, lpdm ); +} + +/*************************************************************** + * DeviceMode [WINEPS16.13] + * + */ +void WINAPI PSDRV_DeviceMode16(HWND16 hwnd, HANDLE16 hDriver, LPSTR lpszDevice, LPSTR lpszPort) +{ + PSDRV_ExtDeviceMode16( hwnd, hDriver, NULL, lpszDevice, lpszPort, NULL, NULL, DM_PROMPT ); +} diff --git a/dlls/wineps.drv/wineps16.drv.spec b/dlls/wineps16.drv16/wineps16.drv16.spec similarity index 100% rename from dlls/wineps.drv/wineps16.drv.spec rename to dlls/wineps16.drv16/wineps16.drv16.spec diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c index 119ac5bd13c..435e2c21a1e 100644 --- a/dlls/winex11.drv/bitblt.c +++ b/dlls/winex11.drv/bitblt.c @@ -1231,19 +1231,137 @@ static BOOL BITBLT_GetVisRectangles( X11DRV_PDEVICE *physDevDst, INT xDst, INT y /*********************************************************************** - * BITBLT_InternalStretchBlt - * - * Implementation of PatBlt(), BitBlt() and StretchBlt(). + * client_side_dib_copy + */ +static BOOL client_side_dib_copy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, + X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, + INT width, INT height ) +{ + DIBSECTION srcDib, dstDib; + BYTE *srcPtr, *dstPtr; + INT srcRowOffset, dstRowOffset; + INT bytesPerPixel; + INT bytesToCopy; + INT y; + static RECT unusedRect; + + if (GetObjectW(physDevSrc->bitmap->hbitmap, sizeof(srcDib), &srcDib) != sizeof(srcDib)) + return FALSE; + if (GetObjectW(physDevDst->bitmap->hbitmap, sizeof(dstDib), &dstDib) != sizeof(dstDib)) + return FALSE; + + /* check for oversized values, just like X11DRV_DIB_CopyDIBSection() */ + if (xSrc > srcDib.dsBm.bmWidth || ySrc > srcDib.dsBm.bmHeight) + return FALSE; + if (xSrc + width > srcDib.dsBm.bmWidth) + width = srcDib.dsBm.bmWidth - xSrc; + if (ySrc + height > srcDib.dsBm.bmHeight) + height = srcDib.dsBm.bmHeight - ySrc; + + if (GetRgnBox(physDevDst->region, &unusedRect) == COMPLEXREGION) + { + /* for simple regions, the clipping was already done by BITBLT_GetVisRectangles */ + FIXME("potential optimization: client-side complex region clipping\n"); + return FALSE; + } + if (dstDib.dsBm.bmBitsPixel <= 8) + { + FIXME("potential optimization: client-side color-index mode DIB copy\n"); + return FALSE; + } + if (!(srcDib.dsBmih.biCompression == BI_BITFIELDS && + dstDib.dsBmih.biCompression == BI_BITFIELDS && + !memcmp(srcDib.dsBitfields, dstDib.dsBitfields, 3*sizeof(DWORD))) + && !(srcDib.dsBmih.biCompression == BI_RGB && + dstDib.dsBmih.biCompression == BI_RGB)) + { + FIXME("potential optimization: client-side compressed DIB copy\n"); + return FALSE; + } + if (srcDib.dsBm.bmBitsPixel != dstDib.dsBm.bmBitsPixel) + { + FIXME("potential optimization: pixel format conversion\n"); + return FALSE; + } + if (srcDib.dsBmih.biWidth < 0 || dstDib.dsBmih.biWidth < 0) + { + FIXME("negative widths not yet implemented\n"); + return FALSE; + } + + switch (dstDib.dsBm.bmBitsPixel) + { + case 15: + case 16: + bytesPerPixel = 2; + break; + case 24: + bytesPerPixel = 3; + break; + case 32: + bytesPerPixel = 4; + break; + default: + FIXME("don't know how to work with a depth of %d\n", physDevSrc->depth); + return FALSE; + } + + bytesToCopy = width * bytesPerPixel; + + if (srcDib.dsBmih.biHeight < 0) + { + srcPtr = &physDevSrc->bitmap->base[ySrc*srcDib.dsBm.bmWidthBytes + xSrc*bytesPerPixel]; + srcRowOffset = srcDib.dsBm.bmWidthBytes; + } + else + { + srcPtr = &physDevSrc->bitmap->base[(srcDib.dsBm.bmHeight-ySrc-1)*srcDib.dsBm.bmWidthBytes + + xSrc*bytesPerPixel]; + srcRowOffset = -srcDib.dsBm.bmWidthBytes; + } + if (dstDib.dsBmih.biHeight < 0) + { + dstPtr = &physDevDst->bitmap->base[yDst*dstDib.dsBm.bmWidthBytes + xDst*bytesPerPixel]; + dstRowOffset = dstDib.dsBm.bmWidthBytes; + } + else + { + dstPtr = &physDevDst->bitmap->base[(dstDib.dsBm.bmHeight-yDst-1)*dstDib.dsBm.bmWidthBytes + + xDst*bytesPerPixel]; + dstRowOffset = -dstDib.dsBm.bmWidthBytes; + } + + /* Handle overlapping regions on the same DIB */ + if (physDevSrc == physDevDst && ySrc < yDst) + { + srcPtr += srcRowOffset * (height - 1); + srcRowOffset = -srcRowOffset; + dstPtr += dstRowOffset * (height - 1); + dstRowOffset = -dstRowOffset; + } + + for (y = yDst; y < yDst + height; ++y) + { + memmove(dstPtr, srcPtr, bytesToCopy); + srcPtr += srcRowOffset; + dstPtr += dstRowOffset; + } + + return TRUE; +} + + +/*********************************************************************** + * X11DRV_StretchBlt */ -static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, - INT widthDst, INT heightDst, - X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, - INT widthSrc, INT heightSrc, - DWORD rop ) +BOOL CDECL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT widthDst, INT heightDst, + X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, + DWORD rop ) { BOOL usePat, useSrc, useDst, destUsed, fStretch, fNullBrush; RECT visRectDst, visRectSrc; INT width, height; + INT sDst, sSrc = DIB_Status_None; const BYTE *opcode; Pixmap pixmaps[3] = { 0, 0, 0 }; /* pixmaps for DST, SRC, TMP */ GC tmpGC = 0; @@ -1305,6 +1423,8 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT visRectSrc.right, visRectSrc.bottom, visRectDst.left, visRectDst.top, visRectDst.right, visRectDst.bottom ); + if (physDevDst != physDevSrc) + sSrc = X11DRV_LockDIBSection( physDevSrc, DIB_Status_None ); } else { @@ -1320,6 +1440,21 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT width = visRectDst.right - visRectDst.left; height = visRectDst.bottom - visRectDst.top; + sDst = X11DRV_LockDIBSection( physDevDst, DIB_Status_None ); + if (physDevDst == physDevSrc) sSrc = sDst; + + /* try client-side DIB copy */ + if (!fStretch && rop == SRCCOPY && + sSrc == DIB_Status_AppMod && sDst == DIB_Status_AppMod && + physDevSrc->depth == physDevDst->depth) + { + if (client_side_dib_copy( physDevSrc, visRectSrc.left, visRectSrc.top, + physDevDst, visRectDst.left, visRectDst.top, width, height )) + goto done; + } + + X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod ); + opcode = BITBLT_Opcodes[(rop >> 16) & 0xff]; /* a few optimizations for single-op ROPs */ @@ -1346,7 +1481,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT physDevDst->dc_rect.top + visRectDst.top, width, height ); wine_tsx11_unlock(); - return TRUE; + goto done; } break; case DSTINVERT: /* 0x55 */ @@ -1366,7 +1501,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT physDevDst->dc_rect.top + visRectDst.top, width, height ); wine_tsx11_unlock(); - return TRUE; + goto done; } break; } @@ -1380,7 +1515,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT width, height ); wine_tsx11_unlock(); } - return TRUE; + goto done; } else if (OP_SRCDST(*opcode) == OP_ARGS(SRC,DST)) { @@ -1388,6 +1523,19 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT { wine_tsx11_lock(); XSetFunction( gdi_display, physDevDst->gc, OP_ROP(*opcode) ); + wine_tsx11_unlock(); + + if (physDevSrc != physDevDst) + { + if (sSrc == DIB_Status_AppMod) + { + X11DRV_DIB_CopyDIBSection( physDevSrc, physDevDst, visRectSrc.left, visRectSrc.top, + visRectDst.left, visRectDst.top, width, height ); + goto done; + } + X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod ); + } + wine_tsx11_lock(); XCopyArea( gdi_display, physDevSrc->drawable, physDevDst->drawable, physDevDst->gc, physDevSrc->dc_rect.left + visRectSrc.left, @@ -1397,14 +1545,15 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT physDevDst->dc_rect.top + visRectDst.top ); physDevDst->exposures++; wine_tsx11_unlock(); - return TRUE; + goto done; } if (physDevSrc->depth == 1) { int fg, bg; + + X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod ); get_colors(physDevDst, physDevSrc, &fg, &bg); wine_tsx11_lock(); - XSetBackground( gdi_display, physDevDst->gc, fg ); XSetForeground( gdi_display, physDevDst->gc, bg ); XSetFunction( gdi_display, physDevDst->gc, OP_ROP(*opcode) ); @@ -1417,7 +1566,7 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT physDevDst->dc_rect.top + visRectDst.top, 1 ); physDevDst->exposures++; wine_tsx11_unlock(); - return TRUE; + goto done; } } } @@ -1437,6 +1586,8 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT physDevDst->depth ); wine_tsx11_unlock(); + if (physDevDst != physDevSrc) X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod ); + if(!X11DRV_XRender_GetSrcAreaStretch( physDevSrc, physDevDst, pixmaps[SRC], tmpGC, widthSrc, heightSrc, widthDst, heightDst, &visRectSrc, &visRectDst)) @@ -1501,263 +1652,9 @@ static BOOL BITBLT_InternalStretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT if (pixmaps[TMP]) XFreePixmap( gdi_display, pixmaps[TMP] ); XFreeGC( gdi_display, tmpGC ); wine_tsx11_unlock(); - return TRUE; -} - -/*********************************************************************** - * X11DRV_PatBlt - */ -BOOL CDECL X11DRV_PatBlt( X11DRV_PDEVICE *physDev, INT left, INT top, INT width, INT height, DWORD rop ) -{ - BOOL result; - - X11DRV_LockDIBSection( physDev, DIB_Status_GdiMod ); - result = BITBLT_InternalStretchBlt( physDev, left, top, width, height, NULL, 0, 0, 0, 0, rop ); - X11DRV_UnlockDIBSection( physDev, TRUE ); - return result; -} - - -/*********************************************************************** - * X11DRV_ClientSideDIBCopy - */ -static BOOL X11DRV_ClientSideDIBCopy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, - X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, - INT width, INT height ) -{ - DIBSECTION srcDib, dstDib; - BYTE *srcPtr, *dstPtr; - INT srcRowOffset, dstRowOffset; - INT bytesPerPixel; - INT bytesToCopy; - INT y; - static RECT unusedRect; - - if (GetObjectW(physDevSrc->bitmap->hbitmap, sizeof(srcDib), &srcDib) != sizeof(srcDib)) - return FALSE; - if (GetObjectW(physDevDst->bitmap->hbitmap, sizeof(dstDib), &dstDib) != sizeof(dstDib)) - return FALSE; - - /* check for oversized values, just like X11DRV_DIB_CopyDIBSection() */ - if (xSrc > srcDib.dsBm.bmWidth || ySrc > srcDib.dsBm.bmHeight) - return FALSE; - if (xSrc + width > srcDib.dsBm.bmWidth) - width = srcDib.dsBm.bmWidth - xSrc; - if (ySrc + height > srcDib.dsBm.bmHeight) - height = srcDib.dsBm.bmHeight - ySrc; - - if (GetRgnBox(physDevDst->region, &unusedRect) == COMPLEXREGION) - { - /* for simple regions, the clipping was already done by BITBLT_GetVisRectangles */ - FIXME("potential optimization: client-side complex region clipping\n"); - return FALSE; - } - if (dstDib.dsBm.bmBitsPixel <= 8) - { - FIXME("potential optimization: client-side color-index mode DIB copy\n"); - return FALSE; - } - if (!(srcDib.dsBmih.biCompression == BI_BITFIELDS && - dstDib.dsBmih.biCompression == BI_BITFIELDS && - !memcmp(srcDib.dsBitfields, dstDib.dsBitfields, 3*sizeof(DWORD))) - && !(srcDib.dsBmih.biCompression == BI_RGB && - dstDib.dsBmih.biCompression == BI_RGB)) - { - FIXME("potential optimization: client-side compressed DIB copy\n"); - return FALSE; - } - if (srcDib.dsBm.bmBitsPixel != dstDib.dsBm.bmBitsPixel) - { - FIXME("potential optimization: pixel format conversion\n"); - return FALSE; - } - if (srcDib.dsBmih.biWidth < 0 || dstDib.dsBmih.biWidth < 0) - { - FIXME("negative widths not yet implemented\n"); - return FALSE; - } - - switch (dstDib.dsBm.bmBitsPixel) - { - case 15: - case 16: - bytesPerPixel = 2; - break; - case 24: - bytesPerPixel = 3; - break; - case 32: - bytesPerPixel = 4; - break; - default: - FIXME("don't know how to work with a depth of %d\n", physDevSrc->depth); - return FALSE; - } - - bytesToCopy = width * bytesPerPixel; - - if (srcDib.dsBmih.biHeight < 0) - { - srcPtr = &physDevSrc->bitmap->base[ySrc*srcDib.dsBm.bmWidthBytes + xSrc*bytesPerPixel]; - srcRowOffset = srcDib.dsBm.bmWidthBytes; - } - else - { - srcPtr = &physDevSrc->bitmap->base[(srcDib.dsBm.bmHeight-ySrc-1)*srcDib.dsBm.bmWidthBytes - + xSrc*bytesPerPixel]; - srcRowOffset = -srcDib.dsBm.bmWidthBytes; - } - if (dstDib.dsBmih.biHeight < 0) - { - dstPtr = &physDevDst->bitmap->base[yDst*dstDib.dsBm.bmWidthBytes + xDst*bytesPerPixel]; - dstRowOffset = dstDib.dsBm.bmWidthBytes; - } - else - { - dstPtr = &physDevDst->bitmap->base[(dstDib.dsBm.bmHeight-yDst-1)*dstDib.dsBm.bmWidthBytes - + xDst*bytesPerPixel]; - dstRowOffset = -dstDib.dsBm.bmWidthBytes; - } - - /* Handle overlapping regions on the same DIB */ - if (physDevSrc == physDevDst && ySrc < yDst) - { - srcPtr += srcRowOffset * (height - 1); - srcRowOffset = -srcRowOffset; - dstPtr += dstRowOffset * (height - 1); - dstRowOffset = -dstRowOffset; - } - - for (y = yDst; y < yDst + height; ++y) - { - memmove(dstPtr, srcPtr, bytesToCopy); - srcPtr += srcRowOffset; - dstPtr += dstRowOffset; - } - - return TRUE; -} - - -/*********************************************************************** - * X11DRV_BitBlt - */ -BOOL CDECL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, - INT width, INT height, X11DRV_PDEVICE *physDevSrc, - INT xSrc, INT ySrc, DWORD rop ) -{ - BOOL result = FALSE; - INT sSrc, sDst; - RECT visRectDst, visRectSrc; - - if (((rop >> 16) & 0x55) == ((rop >> 17) & 0x55)) { - /* FIXME: seems the ROP doesn't include destination; - * now if the destination area include the entire dcDst, - * we can pass TRUE instead of FALSE to CoerceDIBSection(dcDst...), - * which may avoid a copy in some situations */ - } - - sDst = X11DRV_LockDIBSection( physDevDst, DIB_Status_None ); - if (physDevDst != physDevSrc) - sSrc = X11DRV_LockDIBSection( physDevSrc, DIB_Status_None ); - else - sSrc = sDst; - - if ((sSrc == DIB_Status_AppMod) && (rop == SRCCOPY) && - (physDevSrc->depth == physDevDst->depth)) - { - POINT pts[2]; - /* do everything ourselves; map coordinates */ - - pts[0].x = xSrc; - pts[0].y = ySrc; - pts[1].x = xSrc + width; - pts[1].y = ySrc + height; - - LPtoDP(physDevSrc->hdc, pts, 2); - width = pts[1].x - pts[0].x; - height = pts[1].y - pts[0].y; - xSrc = pts[0].x; - ySrc = pts[0].y; - - pts[0].x = xDst; - pts[0].y = yDst; - LPtoDP(physDevDst->hdc, pts, 1); - - xDst = pts[0].x; - yDst = pts[0].y; - - /* Perform basic clipping */ - if (!BITBLT_GetVisRectangles( physDevDst, xDst, yDst, width, height, - physDevSrc, xSrc, ySrc, width, height, - &visRectSrc, &visRectDst )) - { - result = TRUE; - goto END; - } - - xSrc = visRectSrc.left; - ySrc = visRectSrc.top; - xDst = visRectDst.left; - yDst = visRectDst.top; - width = visRectDst.right - visRectDst.left; - height = visRectDst.bottom - visRectDst.top; - - if (sDst == DIB_Status_AppMod) { - result = X11DRV_ClientSideDIBCopy( physDevSrc, xSrc, ySrc, - physDevDst, xDst, yDst, - width, height ); - if (result) - goto END; - /* fall back to X server copying */ - } - X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod ); - - wine_tsx11_lock(); - XSetFunction( gdi_display, physDevDst->gc, GXcopy ); - wine_tsx11_unlock(); - - X11DRV_DIB_CopyDIBSection( physDevSrc, physDevDst, xSrc, ySrc, xDst, yDst, width, height ); - result = TRUE; - goto END; - } - - X11DRV_CoerceDIBSection( physDevDst, DIB_Status_GdiMod ); - if (physDevDst != physDevSrc) - X11DRV_CoerceDIBSection( physDevSrc, DIB_Status_GdiMod ); - - result = BITBLT_InternalStretchBlt( physDevDst, xDst, yDst, width, height, - physDevSrc, xSrc, ySrc, width, height, rop ); - -END: - if (physDevDst != physDevSrc) - X11DRV_UnlockDIBSection( physDevSrc, FALSE ); - X11DRV_UnlockDIBSection( physDevDst, TRUE ); - - return result; -} - - -/*********************************************************************** - * X11DRV_StretchBlt - */ -BOOL CDECL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, - INT widthDst, INT heightDst, - X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, - INT widthSrc, INT heightSrc, DWORD rop ) -{ - BOOL result; - - X11DRV_LockDIBSection( physDevDst, DIB_Status_GdiMod ); - if (physDevDst != physDevSrc) - X11DRV_LockDIBSection( physDevSrc, DIB_Status_GdiMod ); - - result = BITBLT_InternalStretchBlt( physDevDst, xDst, yDst, widthDst, heightDst, - physDevSrc, xSrc, ySrc, widthSrc, heightSrc, rop ); - - if (physDevDst != physDevSrc) - X11DRV_UnlockDIBSection( physDevSrc, FALSE ); +done: + if (useSrc && physDevDst != physDevSrc) X11DRV_UnlockDIBSection( physDevSrc, FALSE ); X11DRV_UnlockDIBSection( physDevDst, TRUE ); - return result; + return TRUE; } diff --git a/dlls/winex11.drv/brush.c b/dlls/winex11.drv/brush.c index 372cb130960..ffbf4cb0342 100644 --- a/dlls/winex11.drv/brush.c +++ b/dlls/winex11.drv/brush.c @@ -298,7 +298,7 @@ HBRUSH CDECL X11DRV_SelectBrush( X11DRV_PDEVICE *physDev, HBRUSH hbrush ) case BS_DIBPATTERN: TRACE("BS_DIBPATTERN\n"); - if ((bmpInfo = GlobalLock16( logbrush.lbHatch ))) + if ((bmpInfo = GlobalLock( (HGLOBAL)logbrush.lbHatch ))) { int size = bitmap_info_size( bmpInfo, logbrush.lbColor ); hBitmap = CreateDIBitmap( physDev->hdc, &bmpInfo->bmiHeader, @@ -307,7 +307,7 @@ HBRUSH CDECL X11DRV_SelectBrush( X11DRV_PDEVICE *physDev, HBRUSH hbrush ) (WORD)logbrush.lbColor ); BRUSH_SelectPatternBrush( physDev, hBitmap ); DeleteObject( hBitmap ); - GlobalUnlock16( logbrush.lbHatch ); + GlobalUnlock( (HGLOBAL)logbrush.lbHatch ); } break; diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c index 4b15569f7a8..1fc8812c5ff 100644 --- a/dlls/winex11.drv/dib.c +++ b/dlls/winex11.drv/dib.c @@ -4744,19 +4744,23 @@ HBITMAP CDECL X11DRV_CreateDIBSection( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, &physBitmap->nColorMap ); } - /* create pixmap and X image */ - wine_tsx11_lock(); - if(dib.dsBm.bmBitsPixel == 1) - { - physBitmap->pixmap_depth = 1; - physBitmap->trueColor = FALSE; - } - else + if (!X11DRV_XRender_SetPhysBitmapDepth( physBitmap, &dib )) { - physBitmap->pixmap_depth = screen_depth; - physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts; - physBitmap->trueColor = (visual->class == TrueColor || visual->class == DirectColor); + if (dib.dsBm.bmBitsPixel == 1) + { + physBitmap->pixmap_depth = 1; + physBitmap->trueColor = FALSE; + } + else + { + physBitmap->pixmap_depth = screen_depth; + physBitmap->pixmap_color_shifts = X11DRV_PALETTE_default_shifts; + physBitmap->trueColor = (visual->class == TrueColor || visual->class == DirectColor); + } } + + /* create pixmap and X image */ + wine_tsx11_lock(); #ifdef HAVE_LIBXXSHM physBitmap->shminfo.shmid = -1; @@ -4803,6 +4807,19 @@ HBITMAP CDECL X11DRV_CreateDIBSection( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, wine_tsx11_unlock(); if (!physBitmap->pixmap || !physBitmap->image) return 0; + if (physBitmap->trueColor) + { + ColorShifts *shifts = &physBitmap->pixmap_color_shifts; + + /* When XRender is around and used, we also support dibsections in other formats like 16-bit. In these + * cases we need to override the mask of XImages. The reason is that during XImage creation the masks are + * derived from a 24-bit visual (no 16-bit ones are around when X runs at 24-bit). SetImageBits and other + * functions rely on the color masks for proper color conversion, so we need to override the masks here. */ + physBitmap->image->red_mask = shifts->physicalRed.max << shifts->physicalRed.shift; + physBitmap->image->green_mask = shifts->physicalGreen.max << shifts->physicalGreen.shift; + physBitmap->image->blue_mask = shifts->physicalBlue.max << shifts->physicalBlue.shift; + } + /* install fault handler */ InitializeCriticalSection( &physBitmap->lock ); physBitmap->lock.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": X_PHYSBITMAP.lock"); diff --git a/dlls/winex11.drv/event.c b/dlls/winex11.drv/event.c index 542fce892eb..956e4f1c884 100644 --- a/dlls/winex11.drv/event.c +++ b/dlls/winex11.drv/event.c @@ -323,7 +323,7 @@ static inline void call_event_handler( Display *display, XEvent *event ) /*********************************************************************** * process_events */ -static int process_events( Display *display, Bool (*filter)(), ULONG_PTR arg ) +static int process_events( Display *display, Bool (*filter)(Display*, XEvent*,XPointer), ULONG_PTR arg ) { XEvent event, prev_event; int count = 0; diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index fdd32b3a90a..6fd8831ffad 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -2,7 +2,6 @@ @ cdecl AlphaBlend(ptr long long long long ptr long long long long long) X11DRV_AlphaBlend @ cdecl Arc(ptr long long long long long long long long) X11DRV_Arc -@ cdecl BitBlt(ptr long long long long ptr long long long) X11DRV_BitBlt @ cdecl ChoosePixelFormat(ptr ptr) X11DRV_ChoosePixelFormat @ cdecl Chord(ptr long long long long long long long long) X11DRV_Chord @ cdecl CreateBitmap(ptr long ptr) X11DRV_CreateBitmap @@ -31,7 +30,6 @@ @ cdecl GetTextMetrics(ptr ptr) X11DRV_GetTextMetrics @ cdecl LineTo(ptr long long) X11DRV_LineTo @ cdecl PaintRgn(ptr long) X11DRV_PaintRgn -@ cdecl PatBlt(ptr long long long long long) X11DRV_PatBlt @ cdecl Pie(ptr long long long long long long long long) X11DRV_Pie @ cdecl PolyPolygon(ptr ptr ptr long) X11DRV_PolyPolygon @ cdecl PolyPolyline(ptr ptr ptr long) X11DRV_PolyPolyline diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index e97bbea6c76..922855de944 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -178,9 +178,6 @@ extern BOOL CDECL X11DRV_AlphaBlend( X11DRV_PDEVICE *physDevDst, INT xDst, INT y INT widthDst, INT heightDst, X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, INT widthSrc, INT heightSrc, BLENDFUNCTION blendfn ); -extern BOOL CDECL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, - INT width, INT height, X11DRV_PDEVICE *physDevSrc, - INT xSrc, INT ySrc, DWORD rop ); extern BOOL CDECL X11DRV_EnumDeviceFonts( X11DRV_PDEVICE *physDev, LPLOGFONTW plf, FONTENUMPROCW dfeproc, LPARAM lp ); extern LONG CDECL X11DRV_GetBitmapBits( HBITMAP hbitmap, void *bits, LONG count ); @@ -190,8 +187,6 @@ extern BOOL CDECL X11DRV_GetDCOrgEx( X11DRV_PDEVICE *physDev, LPPOINT lpp ); extern BOOL CDECL X11DRV_GetTextExtentExPoint( X11DRV_PDEVICE *physDev, LPCWSTR str, INT count, INT maxExt, LPINT lpnFit, LPINT alpDx, LPSIZE size ); extern BOOL CDECL X11DRV_GetTextMetrics(X11DRV_PDEVICE *physDev, TEXTMETRICW *metrics); -extern BOOL CDECL X11DRV_PatBlt( X11DRV_PDEVICE *physDev, INT left, INT top, - INT width, INT height, DWORD rop ); extern BOOL CDECL X11DRV_StretchBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst, INT widthDst, INT heightDst, X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc, @@ -291,6 +286,7 @@ extern void X11DRV_XRender_CopyBrush(X11DRV_PDEVICE *physDev, X_PHYSBITMAP *phys extern BOOL X11DRV_XRender_ExtTextOut(X11DRV_PDEVICE *physDev, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR wstr, UINT count, const INT *lpDx); +extern BOOL X11DRV_XRender_SetPhysBitmapDepth(X_PHYSBITMAP *physBitmap, const DIBSECTION *dib); BOOL X11DRV_XRender_GetSrcAreaStretch(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst, Pixmap pixmap, GC gc, INT widthSrc, INT heightSrc, diff --git a/dlls/winex11.drv/xrender.c b/dlls/winex11.drv/xrender.c index 9280ce3273c..076b6d4770d 100644 --- a/dlls/winex11.drv/xrender.c +++ b/dlls/winex11.drv/xrender.c @@ -2,6 +2,7 @@ * Functions to use the XRender extension * * Copyright 2001, 2002 Huw D M Davies for CodeWeavers + * Copyright 2009 Roderick Colenbrander * * Some parts also: * Copyright 2000 Keith Packard, member of The XFree86 Project, Inc. @@ -835,6 +836,33 @@ void X11DRV_XRender_DeleteDC(X11DRV_PDEVICE *physDev) return; } +BOOL X11DRV_XRender_SetPhysBitmapDepth(X_PHYSBITMAP *physBitmap, const DIBSECTION *dib) +{ + WineXRenderFormat *fmt; + ColorShifts shifts; + + /* When XRender is not around we can only use the screen_depth and when needed we perform depth conversion + * in software. Further we also return the screen depth for paletted formats or TrueColor formats with a low + * number of bits because XRender can't handle paletted formats and 8-bit TrueColor does not exist for XRender. */ + if(!X11DRV_XRender_Installed || dib->dsBm.bmBitsPixel <= 8) + return FALSE; + + X11DRV_PALETTE_ComputeColorShifts(&shifts, dib->dsBitfields[0], dib->dsBitfields[1], dib->dsBitfields[2]); + + /* Common formats should be in our picture format table. */ + fmt = get_xrender_format_from_color_shifts(dib->dsBm.bmBitsPixel, &shifts); + if(fmt) + { + physBitmap->pixmap_depth = fmt->pict_format->depth; + physBitmap->trueColor = TRUE; + physBitmap->pixmap_color_shifts = shifts; + return TRUE; + } + TRACE("Unhandled dibsection format bpp=%d, redMask=%x, greenMask=%x, blueMask=%x\n", + dib->dsBm.bmBitsPixel, dib->dsBitfields[0], dib->dsBitfields[1], dib->dsBitfields[2]); + return FALSE; +} + /*********************************************************************** * X11DRV_XRender_UpdateDrawable * @@ -2172,6 +2200,11 @@ void X11DRV_XRender_CopyBrush(X11DRV_PDEVICE *physDev, X_PHYSBITMAP *physBitmap, wine_tsx11_unlock(); } +BOOL X11DRV_XRender_SetPhysBitmapDepth(X_PHYSBITMAP *physBitmap, const DIBSECTION *dib) +{ + return FALSE; +} + BOOL X11DRV_XRender_GetSrcAreaStretch(X11DRV_PDEVICE *physDevSrc, X11DRV_PDEVICE *physDevDst, Pixmap pixmap, GC gc, INT widthSrc, INT heightSrc, diff --git a/dlls/wing.dll16/Makefile.in b/dlls/wing.dll16/Makefile.in new file mode 100644 index 00000000000..a3e42f26cfd --- /dev/null +++ b/dlls/wing.dll16/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = wing.dll16 +IMPORTS = gdi32 kernel32 +EXTRADLLFLAGS = -Wb,--subsystem,win16 + +C_SRCS = wing.c + +@MAKE_DLL_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/gdi32/wing.c b/dlls/wing.dll16/wing.c similarity index 77% rename from dlls/gdi32/wing.c rename to dlls/wing.dll16/wing.c index f20cc4c9ecf..750c8daec04 100644 --- a/dlls/gdi32/wing.c +++ b/dlls/wing.dll16/wing.c @@ -26,7 +26,6 @@ #include "winbase.h" #include "wingdi.h" #include "wownt32.h" -#include "gdi_private.h" #include "wine/wingdi16.h" #include "wine/debug.h" @@ -51,19 +50,6 @@ typedef enum WING_DITHER_TYPE WING_DISPERSED_4x4, WING_DISPERSED_8x8, WING_CLUSTERED_4x4 } WING_DITHER_TYPE; -/* - * WinG DIB bitmaps can be selected into DC and then scribbled upon - * by GDI functions. They can also be changed directly. This gives us - * three choices - * - use original WinG 16-bit DLL - * requires working 16-bit driver interface - * - implement DIB graphics driver from scratch - * see wing.zip size - * - use shared pixmaps - * won't work with some videocards and/or videomodes - * 961208 - AK - */ - /*********************************************************************** * WinGCreateDC (WING.1001) * @@ -79,7 +65,7 @@ typedef enum WING_DITHER_TYPE HDC16 WINAPI WinGCreateDC16(void) { TRACE("(void)\n"); - return CreateCompatibleDC16(0); + return HDC_16( CreateCompatibleDC( 0 )); } /*********************************************************************** @@ -130,13 +116,38 @@ BOOL16 WINAPI WinGRecommendDIBFormat16(BITMAPINFO *bmpi) * Success: A handle to the created bitmap. * Failure: A NULL handle. */ -HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi, - SEGPTR *bits) +HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi, SEGPTR *bits) { - TRACE("(%d,%p,%p)\n", hdc, bmpi, bits); - TRACE(": create %dx%dx%d bitmap\n", bmpi->bmiHeader.biWidth, - bmpi->bmiHeader.biHeight, bmpi->bmiHeader.biPlanes); - return CreateDIBSection16(hdc, bmpi, 0, bits, 0, 0); + LPVOID bits32; + HBITMAP hbitmap; + + TRACE("(%d,%p,%p): create %dx%dx%d bitmap\n", hdc, bmpi, bits, + bmpi->bmiHeader.biWidth, bmpi->bmiHeader.biHeight, bmpi->bmiHeader.biPlanes); + + hbitmap = CreateDIBSection( HDC_32(hdc), bmpi, BI_RGB, &bits32, 0, 0 ); + if (hbitmap) + { + DIBSECTION dib; + DWORD size; + WORD count, sel; + int i; + + GetObjectW( hbitmap, sizeof(dib), &dib ); + size = dib.dsBm.bmHeight * dib.dsBm.bmWidthBytes; + + /* calculate number of sel's needed for size with 64K steps */ + count = (size + 0xffff) / 0x10000; + sel = AllocSelectorArray16(count); + + for (i = 0; i < count; i++) + { + SetSelectorBase(sel + (i << __AHSHIFT), (DWORD)bits32 + i * 0x10000); + SetSelectorLimit16(sel + (i << __AHSHIFT), size - 1); /* yep, limit is correct */ + size -= 0x10000; + } + if (bits) *bits = MAKESEGPTR( sel, 0 ); + } + return HBITMAP_16(hbitmap); } /*********************************************************************** @@ -144,17 +155,8 @@ HBITMAP16 WINAPI WinGCreateBitmap16(HDC16 hdc, BITMAPINFO *bmpi, */ SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi) { - BITMAPOBJ* bmp = GDI_GetObjPtr( HBITMAP_32(hWinGBitmap), OBJ_BITMAP ); - SEGPTR res = 0; - - TRACE("(%d,%p)\n", hWinGBitmap, bmpi); - if (!bmp) return 0; - - if (bmpi) FIXME(": Todo - implement setting BITMAPINFO\n"); - - res = bmp->segptr_bits; - GDI_ReleaseObj( HBITMAP_32(hWinGBitmap) ); - return res; + FIXME("%x, %p: not supported\n", hWinGBitmap, bmpi ); + return 0; } /*********************************************************************** @@ -171,11 +173,10 @@ SEGPTR WINAPI WinGGetDIBPointer16(HBITMAP16 hWinGBitmap, BITMAPINFO* bmpi) * RETURNS * The number of entries set. */ -UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, - RGBQUAD *colors) +UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, RGBQUAD *colors) { TRACE("(%d,%d,%d,%p)\n", hdc, start, num, colors); - return SetDIBColorTable16(hdc, start, num, colors); + return SetDIBColorTable( HDC_32(hdc), start, num, colors ); } /*********************************************************************** @@ -192,11 +193,10 @@ UINT16 WINAPI WinGSetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, * RETURNS * The number of entries retrieved. */ -UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, - RGBQUAD *colors) +UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, RGBQUAD *colors) { TRACE("(%d,%d,%d,%p)\n", hdc, start, num, colors); - return GetDIBColorTable16(hdc, start, num, colors); + return GetDIBColorTable( HDC_32(hdc), start, num, colors ); } /*********************************************************************** @@ -213,10 +213,10 @@ UINT16 WINAPI WinGGetDIBColorTable16(HDC16 hdc, UINT16 start, UINT16 num, */ HPALETTE16 WINAPI WinGCreateHalfTonePalette16(void) { - HDC16 hdc = CreateCompatibleDC16(0); - HPALETTE16 ret = CreateHalftonePalette16(hdc); + HDC hdc = CreateCompatibleDC(0); + HPALETTE16 ret = HPALETTE_16( CreateHalftonePalette( hdc )); TRACE("(void)\n"); - DeleteDC16(hdc); + DeleteDC( hdc ); return ret; } @@ -238,7 +238,7 @@ HBRUSH16 WINAPI WinGCreateHalfToneBrush16(HDC16 winDC, COLORREF col, WING_DITHER_TYPE type) { TRACE("(%d,%d,%d)\n", winDC, col, type); - return CreateSolidBrush16(col); + return HBRUSH_16( CreateSolidBrush( col )); } /*********************************************************************** @@ -251,12 +251,12 @@ BOOL16 WINAPI WinGStretchBlt16(HDC16 destDC, INT16 xDest, INT16 yDest, HDC16 srcDC, INT16 xSrc, INT16 ySrc, INT16 widSrc, INT16 heiSrc) { - BOOL16 retval; + BOOL retval; TRACE("(%d,%d,...)\n", destDC, srcDC); - SetStretchBltMode16 ( destDC, COLORONCOLOR ); - retval=StretchBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC, - xSrc, ySrc, widSrc, heiSrc, SRCCOPY); - SetStretchBltMode16 ( destDC, BLACKONWHITE ); + SetStretchBltMode( HDC_32(destDC), COLORONCOLOR ); + retval = StretchBlt( HDC_32(destDC), xDest, yDest, widDest, heiDest, + HDC_32(srcDC), xSrc, ySrc, widSrc, heiSrc, SRCCOPY ); + SetStretchBltMode( HDC_32(destDC), BLACKONWHITE ); return retval; } @@ -270,6 +270,5 @@ BOOL16 WINAPI WinGBitBlt16(HDC16 destDC, INT16 xDest, INT16 yDest, INT16 xSrc, INT16 ySrc) { TRACE("(%d,%d,...)\n", destDC, srcDC); - return BitBlt16(destDC, xDest, yDest, widDest, heiDest, srcDC, - xSrc, ySrc, SRCCOPY); + return BitBlt( HDC_32(destDC), xDest, yDest, widDest, heiDest, HDC_32(srcDC), xSrc, ySrc, SRCCOPY ); } diff --git a/dlls/gdi32/wing.spec b/dlls/wing.dll16/wing.dll16.spec similarity index 100% rename from dlls/gdi32/wing.spec rename to dlls/wing.dll16/wing.dll16.spec diff --git a/dlls/winhttp/request.c b/dlls/winhttp/request.c index 0d179a4d60b..ea0ecdae75b 100644 --- a/dlls/winhttp/request.c +++ b/dlls/winhttp/request.c @@ -839,7 +839,6 @@ static BOOL secure_proxy_connect( request_t *request ) { static const WCHAR verbConnect[] = {'C','O','N','N','E','C','T',0}; static const WCHAR fmt[] = {'%','s',':','%','d',0}; - static const WCHAR http1_1[] = {'H','T','T','P','/','1','.','1',0}; BOOL ret = FALSE; LPWSTR path; connect_t *connect = request->connect; diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c index e94e5cc1bd0..f8749206f9f 100644 --- a/dlls/wininet/http.c +++ b/dlls/wininet/http.c @@ -4319,7 +4319,7 @@ static INT HTTP_GetResponseHeaders(http_request_t *lpwhr, BOOL clear) else if (!codeHundred) { FIXME("Non status line at head of response (%s)\n",debugstr_w(buffer)); - continue; + goto lend; } } while (codeHundred); diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c index 1a77fd8fa3e..619674ef3be 100644 --- a/dlls/wininet/internet.c +++ b/dlls/wininet/internet.c @@ -290,6 +290,8 @@ BOOL WINAPI DllMain (HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) case DLL_PROCESS_DETACH: + NETCON_unload(); + URLCacheContainers_DeleteAll(); if (g_dwTlsErrIndex != TLS_OUT_OF_INDEXES) @@ -1424,8 +1426,11 @@ BOOL WINAPI InternetCrackUrlW(LPCWSTR lpszUrl_orig, DWORD dwUrlLength_orig, DWOR lpUC->nPort = INTERNET_INVALID_PORT_NUMBER; /* Parse */ - if (!(lpszParam = memchrW(lpszap, ';', dwUrlLength - (lpszap - lpszUrl)))) + lpszParam = memchrW(lpszap, ';', dwUrlLength - (lpszap - lpszUrl)); + if(!lpszParam) lpszParam = memchrW(lpszap, '?', dwUrlLength - (lpszap - lpszUrl)); + if(!lpszParam) + lpszParam = memchrW(lpszap, '#', dwUrlLength - (lpszap - lpszUrl)); SetUrlComponentValueW(&lpUC->lpszExtraInfo, &lpUC->dwExtraInfoLength, lpszParam, lpszParam ? dwUrlLength-(lpszParam-lpszUrl) : 0); diff --git a/dlls/wininet/internet.h b/dlls/wininet/internet.h index 39d80831ad0..75568faf253 100644 --- a/dlls/wininet/internet.h +++ b/dlls/wininet/internet.h @@ -429,6 +429,7 @@ VOID INTERNET_SendCallback(object_header_t *hdr, DWORD_PTR dwContext, BOOL NETCON_connected(WININET_NETCONNECTION *connection); BOOL NETCON_init(WININET_NETCONNECTION *connnection, BOOL useSSL); +void NETCON_unload(void); BOOL NETCON_create(WININET_NETCONNECTION *connection, int domain, int type, int protocol); BOOL NETCON_close(WININET_NETCONNECTION *connection); diff --git a/dlls/wininet/netconnection.c b/dlls/wininet/netconnection.c index b5ca18aa4ea..97c764fc345 100644 --- a/dlls/wininet/netconnection.c +++ b/dlls/wininet/netconnection.c @@ -98,6 +98,16 @@ WINE_DEFAULT_DEBUG_CHANNEL(wininet); #include +static CRITICAL_SECTION init_ssl_cs; +static CRITICAL_SECTION_DEBUG init_ssl_cs_debug = +{ + 0, 0, &init_ssl_cs, + { &init_ssl_cs_debug.ProcessLocksList, + &init_ssl_cs_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": init_ssl_cs") } +}; +static CRITICAL_SECTION init_ssl_cs = { &init_ssl_cs_debug, -1, 0, 0, 0, 0 }; + static void *OpenSSL_ssl_handle; static void *OpenSSL_crypto_handle; @@ -110,6 +120,7 @@ static SSL_CTX *ctx; MAKE_FUNCPTR(SSL_library_init); MAKE_FUNCPTR(SSL_load_error_strings); MAKE_FUNCPTR(SSLv23_method); +MAKE_FUNCPTR(SSL_CTX_free); MAKE_FUNCPTR(SSL_CTX_new); MAKE_FUNCPTR(SSL_new); MAKE_FUNCPTR(SSL_free); @@ -127,11 +138,29 @@ MAKE_FUNCPTR(SSL_CTX_set_default_verify_paths); /* OpenSSL's libcrypto functions that we use */ MAKE_FUNCPTR(BIO_new_fp); +MAKE_FUNCPTR(CRYPTO_num_locks); +MAKE_FUNCPTR(CRYPTO_set_id_callback); +MAKE_FUNCPTR(CRYPTO_set_locking_callback); MAKE_FUNCPTR(ERR_get_error); MAKE_FUNCPTR(ERR_error_string); MAKE_FUNCPTR(i2d_X509); #undef MAKE_FUNCPTR +static CRITICAL_SECTION *ssl_locks; + +static unsigned long ssl_thread_id(void) +{ + return GetCurrentThreadId(); +} + +static void ssl_lock_callback(int mode, int type, const char *file, int line) +{ + if (mode & CRYPTO_LOCK) + EnterCriticalSection(&ssl_locks[type]); + else + LeaveCriticalSection(&ssl_locks[type]); +} + #endif BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) @@ -141,15 +170,22 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) if (useSSL) { #if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO) + int i; + TRACE("using SSL connection\n"); + EnterCriticalSection(&init_ssl_cs); if (OpenSSL_ssl_handle) /* already initialized everything */ + { + LeaveCriticalSection(&init_ssl_cs); return TRUE; + } OpenSSL_ssl_handle = wine_dlopen(SONAME_LIBSSL, RTLD_NOW, NULL, 0); if (!OpenSSL_ssl_handle) { ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n", SONAME_LIBSSL); INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); + LeaveCriticalSection(&init_ssl_cs); return FALSE; } OpenSSL_crypto_handle = wine_dlopen(SONAME_LIBCRYPTO, RTLD_NOW, NULL, 0); @@ -158,6 +194,7 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) ERR("trying to use a SSL connection, but couldn't load %s. Expect trouble.\n", SONAME_LIBCRYPTO); INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); + LeaveCriticalSection(&init_ssl_cs); return FALSE; } @@ -168,12 +205,14 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) { \ ERR("failed to load symbol %s\n", #x); \ INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); \ + LeaveCriticalSection(&init_ssl_cs); \ return FALSE; \ } DYNSSL(SSL_library_init); DYNSSL(SSL_load_error_strings); DYNSSL(SSLv23_method); + DYNSSL(SSL_CTX_free); DYNSSL(SSL_CTX_new); DYNSSL(SSL_new); DYNSSL(SSL_free); @@ -196,9 +235,13 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) { \ ERR("failed to load symbol %s\n", #x); \ INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); \ + LeaveCriticalSection(&init_ssl_cs); \ return FALSE; \ } DYNCRYPTO(BIO_new_fp); + DYNCRYPTO(CRYPTO_num_locks); + DYNCRYPTO(CRYPTO_set_id_callback); + DYNCRYPTO(CRYPTO_set_locking_callback); DYNCRYPTO(ERR_get_error); DYNCRYPTO(ERR_error_string); DYNCRYPTO(i2d_X509); @@ -209,6 +252,29 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) pBIO_new_fp(stderr, BIO_NOCLOSE); /* FIXME: should use winedebug stuff */ meth = pSSLv23_method(); + ctx = pSSL_CTX_new(meth); + if (!pSSL_CTX_set_default_verify_paths(ctx)) + { + ERR("SSL_CTX_set_default_verify_paths failed: %s\n", + pERR_error_string(pERR_get_error(), 0)); + INTERNET_SetLastError(ERROR_OUTOFMEMORY); + LeaveCriticalSection(&init_ssl_cs); + return FALSE; + } + + pCRYPTO_set_id_callback(ssl_thread_id); + ssl_locks = HeapAlloc(GetProcessHeap(), 0, + pCRYPTO_num_locks() * sizeof(CRITICAL_SECTION)); + if (!ssl_locks) + { + INTERNET_SetLastError(ERROR_OUTOFMEMORY); + LeaveCriticalSection(&init_ssl_cs); + return FALSE; + } + for (i = 0; i < pCRYPTO_num_locks(); i++) + InitializeCriticalSection(&ssl_locks[i]); + pCRYPTO_set_locking_callback(ssl_lock_callback); + LeaveCriticalSection(&init_ssl_cs); #else FIXME("can't use SSL, not compiled in.\n"); INTERNET_SetLastError(ERROR_INTERNET_SECURITY_CHANNEL_ERROR); @@ -218,6 +284,30 @@ BOOL NETCON_init(WININET_NETCONNECTION *connection, BOOL useSSL) return TRUE; } +void NETCON_unload(void) +{ +#if defined(SONAME_LIBSSL) && defined(SONAME_LIBCRYPTO) + if (OpenSSL_crypto_handle) + { + if (ssl_locks) + { + int i; + + for (i = 0; i < pCRYPTO_num_locks(); i++) + DeleteCriticalSection(&ssl_locks[i]); + HeapFree(GetProcessHeap(), 0, ssl_locks); + } + wine_dlclose(OpenSSL_crypto_handle, NULL, 0); + } + if (OpenSSL_ssl_handle) + { + if (ctx) + pSSL_CTX_free(ctx); + wine_dlclose(OpenSSL_ssl_handle, NULL, 0); + } +#endif +} + BOOL NETCON_connected(WININET_NETCONNECTION *connection) { if (connection->socketFD == -1) @@ -371,14 +461,6 @@ BOOL NETCON_secure_connect(WININET_NETCONNECTION *connection, LPCWSTR hostname) return FALSE; } - ctx = pSSL_CTX_new(meth); - if (!pSSL_CTX_set_default_verify_paths(ctx)) - { - ERR("SSL_CTX_set_default_verify_paths failed: %s\n", - pERR_error_string(pERR_get_error(), 0)); - INTERNET_SetLastError(ERROR_OUTOFMEMORY); - return FALSE; - } connection->ssl_s = pSSL_new(ctx); if (!connection->ssl_s) { diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index dda4a410b11..281b4e756c3 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -1735,6 +1735,10 @@ static DWORD CALLBACK server_thread(LPVOID param) send(c, okmsg, sizeof okmsg-1, 0); send(c, page1, sizeof page1-1, 0); } + if (strstr(buffer, "GET /testG")) + { + send(c, page1, sizeof page1-1, 0); + } shutdown(c, 2); closesocket(c); @@ -2218,6 +2222,69 @@ static void test_invalid_response_headers(int port) InternetCloseHandle(session); } +static void test_response_without_headers(int port) +{ + HINTERNET hi, hc, hr; + DWORD r, count, size, status; + char buffer[1024]; + + SetLastError(0xdeadbeef); + hi = InternetOpen(NULL, INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, 0); + ok(hi != NULL, "open failed %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + hc = InternetConnect(hi, "localhost", port, NULL, NULL, INTERNET_SERVICE_HTTP, 0, 0); + ok(hc != NULL, "connect failed %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + hr = HttpOpenRequest(hc, NULL, "/testG", NULL, NULL, NULL, 0, 0); + ok(hr != NULL, "HttpOpenRequest failed %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + r = HttpSendRequest(hr, NULL, 0, NULL, 0); + todo_wine ok(r, "HttpSendRequest failed %u\n", GetLastError()); + + count = 0; + memset(buffer, 0, sizeof buffer); + SetLastError(0xdeadbeef); + r = InternetReadFile(hr, buffer, sizeof buffer, &count); + ok(r, "InternetReadFile failed %u\n", GetLastError()); + todo_wine ok(count == sizeof page1 - 1, "count was wrong\n"); + todo_wine ok(!memcmp(buffer, page1, sizeof page1), "http data wrong\n"); + + status = 0; + size = sizeof(status); + SetLastError(0xdeadbeef); + r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_CODE | HTTP_QUERY_FLAG_NUMBER, &status, &size, NULL ); + todo_wine ok(r, "HttpQueryInfo failed %u\n", GetLastError()); + todo_wine ok(status == 200, "expected status 200 got %u\n", status); + + buffer[0] = 0; + size = sizeof(buffer); + SetLastError(0xdeadbeef); + r = HttpQueryInfo(hr, HTTP_QUERY_STATUS_TEXT, buffer, &size, NULL ); + todo_wine ok(r, "HttpQueryInfo failed %u\n", GetLastError()); + todo_wine ok(!strcmp(buffer, "OK"), "expected OK got: \"%s\"\n", buffer); + + buffer[0] = 0; + size = sizeof(buffer); + SetLastError(0xdeadbeef); + r = HttpQueryInfo(hr, HTTP_QUERY_VERSION, buffer, &size, NULL); + ok(r, "HttpQueryInfo failed %u\n", GetLastError()); + todo_wine ok(!strcmp(buffer, "HTTP/1.0"), "expected HTTP/1.0 got: \"%s\"\n", buffer); + + buffer[0] = 0; + size = sizeof(buffer); + SetLastError(0xdeadbeef); + r = HttpQueryInfo(hr, HTTP_QUERY_RAW_HEADERS, buffer, &size, NULL); + ok(r, "HttpQueryInfo failed %u\n", GetLastError()); + todo_wine ok(!strcmp(buffer, "HTTP/1.0 200 OK"), "raw headers wrong: \"%s\"\n", buffer); + + InternetCloseHandle(hr); + InternetCloseHandle(hc); + InternetCloseHandle(hi); +} + static void test_HttpQueryInfo(int port) { HINTERNET hi, hc, hr; @@ -2353,6 +2420,7 @@ static void test_http_connection(void) test_cookie_header(si.port); test_basic_authentication(si.port); test_invalid_response_headers(si.port); + test_response_without_headers(si.port); test_HttpQueryInfo(si.port); test_HttpSendRequestW(si.port); diff --git a/dlls/wininet/tests/url.c b/dlls/wininet/tests/url.c index 39c02863351..18df3924337 100644 --- a/dlls/wininet/tests/url.c +++ b/dlls/wininet/tests/url.c @@ -30,9 +30,10 @@ #include "wine/test.h" -#define TEST_URL "http://www.winehq.org/site/about" +#define TEST_URL "http://www.winehq.org/site/about#hi" #define TEST_URL_HOST "www.winehq.org" #define TEST_URL_PATH "/site/about" +#define TEST_URL_HASH "#hi" #define TEST_URL2 "http://www.myserver.com/myscript.php?arg=1" #define TEST_URL2_SERVER "www.myserver.com" #define TEST_URL2_PATH "/myscript.php" @@ -147,10 +148,10 @@ static void InternetCrackUrl_test(void) ok(urlComponents.nScheme == INTERNET_SCHEME_HTTP,"urlComponents->nScheme should have been INTERNET_SCHEME_HTTP instead of %d\n", urlComponents.nScheme); ok(!urlComponents.lpszUserName, ".lpszUserName should have been set to NULL\n"); ok(!urlComponents.lpszPassword, ".lpszPassword should have been set to NULL\n"); - ok(!urlComponents.lpszExtraInfo, ".lpszExtraInfo should have been set to NULL\n"); + ok(urlComponents.dwExtraInfoLength == strlen(TEST_URL_HASH),".dwExtraInfoLength should be %d, but is %d\n", lstrlenA(TEST_URL_HASH), urlComponents.dwExtraInfoLength); + ok(!strncmp(urlComponents.lpszExtraInfo,TEST_URL_HASH,strlen(TEST_URL_HASH)), ".lpszExtraInfo should be %s but is %s\n", TEST_URL_HASH, urlComponents.lpszExtraInfo); ok(!urlComponents.dwUserNameLength,".dwUserNameLength should be 0, but is %d\n", urlComponents.dwUserNameLength); ok(!urlComponents.dwPasswordLength,".dwPasswordLength should be 0, but is %d\n", urlComponents.dwPasswordLength); - ok(!urlComponents.dwExtraInfoLength,".dwExtraInfoLength should be 0, but is %d\n", urlComponents.dwExtraInfoLength); /*3. Check for %20 */ copy_compsA(&urlSrc, &urlComponents, 32, 1024, 1024, 1024, 2048, 1024); diff --git a/dlls/winsock.dll16/Makefile.in b/dlls/winsock.dll16/Makefile.in new file mode 100644 index 00000000000..fc90dc4d414 --- /dev/null +++ b/dlls/winsock.dll16/Makefile.in @@ -0,0 +1,14 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +MODULE = winsock.dll16 +IMPORTS = ws2_32 kernel32 +DELAYIMPORTS = user32 +EXTRADLLFLAGS = -Wb,--subsystem,win16,--main-module,ws2_32.dll + +C_SRCS = socket.c + +@MAKE_DLL_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/winsock.dll16/socket.c b/dlls/winsock.dll16/socket.c new file mode 100644 index 00000000000..ac325cd67a6 --- /dev/null +++ b/dlls/winsock.dll16/socket.c @@ -0,0 +1,1026 @@ +/* + * 16-bit socket functions + * + * Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka + * Copyright (C) 2003 Alexandre Julliard + * + * 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 "config.h" + +#include "winsock2.h" +#include "wine/winbase16.h" +#include "winsock16.h" +#include "wownt32.h" +#include "winuser.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(winsock); + +struct async_query_header +{ + HWND hWnd; + UINT uMsg; + SEGPTR sbuf; + INT sbuflen; + HANDLE16 handle; +}; + +struct async_query_gethostbyname +{ + struct async_query_header query; + char *host_name; +}; + +struct async_query_gethostbyaddr +{ + struct async_query_header query; + char *host_addr; + int host_len; + int host_type; +}; + +struct async_query_getprotobyname +{ + struct async_query_header query; + char *proto_name; +}; + +struct async_query_getprotobynumber +{ + struct async_query_header query; + int proto_number; +}; + +struct async_query_getservbyname +{ + struct async_query_header query; + char *serv_name; + char *serv_proto; +}; + +struct async_query_getservbyport +{ + struct async_query_header query; + char *serv_proto; + int serv_port; +}; + +static INT num_startup; /* reference counter */ +static void *he_buffer; +static SEGPTR he_buffer_seg; +static void *se_buffer; +static SEGPTR se_buffer_seg; +static void *pe_buffer; +static SEGPTR pe_buffer_seg; +static SEGPTR dbuffer_seg; + +extern int WINAPI WS_gethostname(char *name, int namelen); + +static fd_set *ws_fdset_16_to_32( const ws_fd_set16 *set16, fd_set *set32 ) +{ + UINT i; + set32->fd_count = set16->fd_count; + for (i = 0; i < set32->fd_count; i++) set32->fd_array[i] = set16->fd_array[i]; + return set32; +} + +static ws_fd_set16 *ws_fdset_32_to_16( const fd_set *set32, ws_fd_set16 *set16 ) +{ + UINT i; + set16->fd_count = set32->fd_count; + for (i = 0; i < set16->fd_count; i++) set16->fd_array[i] = set32->fd_array[i]; + return set16; +} + +static DWORD finish_query( struct async_query_header *query, LPARAM lparam ) +{ + PostMessageW( query->hWnd, query->uMsg, (WPARAM)query->handle, lparam ); + HeapFree( GetProcessHeap(), 0, query ); + return 0; +} + +static int list_size(char** l, int item_size) +{ + int i,j = 0; + if(l) + { + for(i=0;l[i];i++) + j += (item_size) ? item_size : strlen(l[i]) + 1; + j += (i + 1) * sizeof(char*); + } + return j; +} + +static int list_dup(char** l_src, SEGPTR base, int item_size) +{ + int i, offset; + char *ref = MapSL(base); + SEGPTR *l_to = (SEGPTR *)ref; + + for (i = 0; l_src[i]; i++) ; + offset = (i + 1) * sizeof(char*); + for (i = 0; l_src[i]; i++) + { + int count = item_size ? item_size : strlen(l_src[i]) + 1; + memcpy( ref + offset, l_src[i], count ); + l_to[i] = base + offset; + offset += count; + } + l_to[i] = 0; + return offset; +} + +static SEGPTR get_buffer_he(int size) +{ + static int he_len; + if (he_buffer) + { + if (he_len >= size ) return he_buffer_seg; + UnMapLS( he_buffer_seg ); + HeapFree( GetProcessHeap(), 0, he_buffer ); + } + he_buffer = HeapAlloc( GetProcessHeap(), 0, (he_len = size) ); + he_buffer_seg = MapLS( he_buffer ); + return he_buffer_seg; +} + +static SEGPTR get_buffer_se(int size) +{ + static int se_len; + if (se_buffer) + { + if (se_len >= size ) return se_buffer_seg; + UnMapLS( se_buffer_seg ); + HeapFree( GetProcessHeap(), 0, se_buffer ); + } + se_buffer = HeapAlloc( GetProcessHeap(), 0, (se_len = size) ); + se_buffer_seg = MapLS( se_buffer ); + return se_buffer_seg; +} + +static SEGPTR get_buffer_pe(int size) +{ + static int pe_len; + if (pe_buffer) + { + if (pe_len >= size ) return pe_buffer_seg; + UnMapLS( pe_buffer_seg ); + HeapFree( GetProcessHeap(), 0, pe_buffer ); + } + pe_buffer = HeapAlloc( GetProcessHeap(), 0, (pe_len = size) ); + pe_buffer_seg = MapLS( pe_buffer ); + return pe_buffer_seg; +} + +/* duplicate hostent entry + * and handle all Win16/Win32 dependent things (struct size, ...) *correctly*. + * Ditto for protoent and servent. + */ +static SEGPTR ws_hostent_32_to_16( const struct hostent* he, SEGPTR base, int *buff_size ) +{ + char *p; + struct ws_hostent16 *p_to; + + int size = (sizeof(*p_to) + + strlen(he->h_name) + 1 + + list_size(he->h_aliases, 0) + + list_size(he->h_addr_list, he->h_length)); + + if (buff_size) + { + if (*buff_size < size) + { + *buff_size = size; + return 0; + } + *buff_size = size; + } + else base = get_buffer_he(size); + p_to = MapSL(base); + + p_to->h_addrtype = he->h_addrtype; + p_to->h_length = he->h_length; + + p = (char *)(p_to + 1); + p_to->h_name = base + (p - (char *)p_to); + strcpy(p, he->h_name); + p += strlen(p) + 1; + + p_to->h_aliases = base + (p - (char *)p_to); + p += list_dup(he->h_aliases, p_to->h_aliases, 0); + + p_to->h_addr_list = base + (p - (char *)p_to); + list_dup(he->h_addr_list, p_to->h_addr_list, he->h_length); + + return base; +} + +static SEGPTR ws_protoent_32_to_16( const struct protoent *pe, SEGPTR base, int *buff_size ) +{ + char *p; + struct ws_protoent16 *p_to; + + int size = (sizeof(*p_to) + + strlen(pe->p_name) + 1 + + list_size(pe->p_aliases, 0)); + + if (buff_size) + { + if (*buff_size < size) + { + *buff_size = size; + return 0; + } + *buff_size = size; + } + else base = get_buffer_pe(size); + p_to = MapSL(base); + + p_to->p_proto = pe->p_proto; + p = (char *)(p_to + 1); + + p_to->p_name = base + (p - (char *)p_to); + strcpy(p, pe->p_name); + p += strlen(p) + 1; + + p_to->p_aliases = base + (p - (char *)p_to); + list_dup(pe->p_aliases, p_to->p_aliases, 0); + + return base; +} + +static SEGPTR ws_servent_32_to_16( const struct servent *se, SEGPTR base, int *buff_size ) +{ + char *p; + struct ws_servent16 *p_to; + + int size = (sizeof(*p_to) + + strlen(se->s_proto) + 1 + + strlen(se->s_name) + 1 + + list_size(se->s_aliases, 0)); + + if (buff_size) + { + if (*buff_size < size) + { + *buff_size = size; + return 0; + } + *buff_size = size; + } + else base = get_buffer_se(size); + p_to = MapSL(base); + + p_to->s_port = se->s_port; + p = (char *)(p_to + 1); + + p_to->s_name = base + (p - (char *)p_to); + strcpy(p, se->s_name); + p += strlen(p) + 1; + + p_to->s_proto = base + (p - (char *)p_to); + strcpy(p, se->s_proto); + p += strlen(p) + 1; + + p_to->s_aliases = base + (p - (char *)p_to); + list_dup(se->s_aliases, p_to->s_aliases, 0); + + return base; +} + +static DWORD WINAPI async_gethostbyname(LPVOID arg) +{ + struct async_query_gethostbyname *aq = arg; + int size = 0; + WORD fail = 0; + struct hostent *he; + + if ((he = gethostbyname( aq->host_name ))) + { + size = aq->query.sbuflen; + if (!ws_hostent_32_to_16( he, aq->query.sbuf, &size )) fail = WSAENOBUFS; + } + else fail = GetLastError(); + + return finish_query( &aq->query, MAKELPARAM( size, fail )); +} + +static DWORD WINAPI async_gethostbyaddr(LPVOID arg) +{ + struct async_query_gethostbyaddr *aq = arg; + int size = 0; + WORD fail = 0; + struct hostent *he; + + if ((he = gethostbyaddr(aq->host_addr,aq->host_len,aq->host_type))) + { + size = aq->query.sbuflen; + if (!ws_hostent_32_to_16( he, aq->query.sbuf, &size )) fail = WSAENOBUFS; + } + else fail = GetLastError(); + + return finish_query( &aq->query, MAKELPARAM( size, fail )); +} + +static DWORD WINAPI async_getprotobyname(LPVOID arg) +{ + struct async_query_getprotobyname *aq = arg; + int size = 0; + WORD fail = 0; + struct protoent *pe; + + if ((pe = getprotobyname(aq->proto_name))) + { + size = aq->query.sbuflen; + if (!ws_protoent_32_to_16( pe, aq->query.sbuf, &size )) fail = WSAENOBUFS; + } + else fail = GetLastError(); + + return finish_query( &aq->query, MAKELPARAM( size, fail )); +} + +static DWORD WINAPI async_getprotobynumber(LPVOID arg) +{ + struct async_query_getprotobynumber *aq = arg; + int size = 0; + WORD fail = 0; + struct protoent *pe; + + if ((pe = getprotobynumber(aq->proto_number))) + { + size = aq->query.sbuflen; + if (!ws_protoent_32_to_16( pe, aq->query.sbuf, &size )) fail = WSAENOBUFS; + } + else fail = GetLastError(); + + return finish_query( &aq->query, MAKELPARAM( size, fail )); +} + +static DWORD WINAPI async_getservbyname(LPVOID arg) +{ + struct async_query_getservbyname *aq = arg; + int size = 0; + WORD fail = 0; + struct servent *se; + + if ((se = getservbyname(aq->serv_name,aq->serv_proto))) + { + size = aq->query.sbuflen; + if (!ws_servent_32_to_16( se, aq->query.sbuf, &size )) fail = WSAENOBUFS; + } + else fail = GetLastError(); + + return finish_query( &aq->query, MAKELPARAM( size, fail )); +} + +static DWORD WINAPI async_getservbyport(LPVOID arg) +{ + struct async_query_getservbyport *aq = arg; + int size = 0; + WORD fail = 0; + struct servent *se; + + if ((se = getservbyport(aq->serv_port,aq->serv_proto))) + { + size = aq->query.sbuflen; + if (!ws_servent_32_to_16( se, aq->query.sbuf, &size )) fail = WSAENOBUFS; + } + else fail = GetLastError(); + + return finish_query( &aq->query, MAKELPARAM( size, fail )); +} + +/**************************************************************************** + * The main async help function. + * + * It either starts a thread or just calls the function directly for platforms + * with no thread support. This relies on the fact that PostMessage() does + * not actually call the windowproc before the function returns. + */ +static HANDLE16 run_query( HWND16 hWnd, UINT uMsg, LPTHREAD_START_ROUTINE func, + struct async_query_header *query, SEGPTR sbuf, INT sbuflen ) +{ + static LONG next_handle = 0xdead; + HANDLE thread; + ULONG handle = LOWORD( InterlockedIncrement( &next_handle )); + + /* avoid handle 0 */ + while (!handle) handle = LOWORD( InterlockedIncrement( &next_handle )); + + query->hWnd = HWND_32(hWnd); + query->uMsg = uMsg; + query->handle = handle; + query->sbuf = sbuf; + query->sbuflen = sbuflen; + + thread = CreateThread( NULL, 0, func, query, 0, NULL ); + if (!thread) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + CloseHandle( thread ); + return handle; +} + +/*********************************************************************** + * accept (WINSOCK.1) + */ +SOCKET16 WINAPI accept16(SOCKET16 s, struct sockaddr* addr, INT16* addrlen16 ) +{ + INT addrlen32 = addrlen16 ? *addrlen16 : 0; + SOCKET retSocket = accept( s, addr, &addrlen32 ); + if( addrlen16 ) *addrlen16 = addrlen32; + return retSocket; +} + +/*********************************************************************** + * bind (WINSOCK.2) + */ +INT16 WINAPI bind16(SOCKET16 s, struct sockaddr *name, INT16 namelen) +{ + return bind( s, name, namelen ); +} + +/*********************************************************************** + * closesocket (WINSOCK.3) + */ +INT16 WINAPI closesocket16(SOCKET16 s) +{ + return closesocket(s); +} + +/*********************************************************************** + * connect (WINSOCK.4) + */ +INT16 WINAPI connect16(SOCKET16 s, struct sockaddr *name, INT16 namelen) +{ + return connect( s, name, namelen ); +} + +/*********************************************************************** + * getpeername (WINSOCK.5) + */ +INT16 WINAPI getpeername16(SOCKET16 s, struct sockaddr *name, INT16 *namelen16) +{ + INT namelen32 = *namelen16; + INT retVal = getpeername( s, name, &namelen32 ); + *namelen16 = namelen32; + return retVal; +} + +/*********************************************************************** + * getsockname (WINSOCK.6) + */ +INT16 WINAPI getsockname16(SOCKET16 s, struct sockaddr *name, INT16 *namelen16) +{ + INT retVal; + + if( namelen16 ) + { + INT namelen32 = *namelen16; + retVal = getsockname( s, name, &namelen32 ); + *namelen16 = namelen32; + } + else retVal = SOCKET_ERROR; + return retVal; +} + +/*********************************************************************** + * getsockopt (WINSOCK.7) + */ +INT16 WINAPI getsockopt16(SOCKET16 s, INT16 level, INT16 optname, char *optval, INT16 *optlen) +{ + INT optlen32; + INT *p = &optlen32; + INT retVal; + + if( optlen ) optlen32 = *optlen; else p = NULL; + retVal = getsockopt( s, (WORD)level, optname, optval, p ); + if( optlen ) *optlen = optlen32; + return retVal; +} + +/*********************************************************************** + * htonl (WINSOCK.8) + */ +u_long WINAPI htonl16(u_long hostlong) +{ + return htonl(hostlong); +} + + +/*********************************************************************** + * htons (WINSOCK.9) + */ +u_short WINAPI htons16(u_short hostshort) +{ + return htons(hostshort); +} + +/*********************************************************************** + * inet_addr (WINSOCK.10) + */ +u_long WINAPI inet_addr16(const char *cp) +{ + if (!cp) return INADDR_NONE; + return inet_addr(cp); +} + + +/*********************************************************************** + * inet_ntoa (WINSOCK.11) + */ +SEGPTR WINAPI inet_ntoa16(struct in_addr in) +{ + char* retVal; + if (!(retVal = inet_ntoa( in ))) return 0; + if (!dbuffer_seg) dbuffer_seg = MapLS( retVal ); + return dbuffer_seg; +} + +/*********************************************************************** + * ioctlsocket (WINSOCK.12) + */ +INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, u_long *argp) +{ + return ioctlsocket( s, cmd, argp ); +} + +/*********************************************************************** + * listen (WINSOCK.13) + */ +INT16 WINAPI listen16(SOCKET16 s, INT16 backlog) +{ + return listen( s, backlog ); +} + +/*********************************************************************** + * ntohl (WINSOCK.14) + */ +u_long WINAPI ntohl16(u_long netlong) +{ + return ntohl(netlong); +} + + +/*********************************************************************** + * ntohs (WINSOCK.15) + */ +u_short WINAPI ntohs16(u_short netshort) +{ + return ntohs(netshort); +} + +/*********************************************************************** + * recv (WINSOCK.16) + */ +INT16 WINAPI recv16(SOCKET16 s, char *buf, INT16 len, INT16 flags) +{ + return recv( s, buf, len, flags ); +} + +/*********************************************************************** + * recvfrom (WINSOCK.17) + */ +INT16 WINAPI recvfrom16(SOCKET16 s, char *buf, INT16 len, INT16 flags, + struct sockaddr *from, INT16 *fromlen16) +{ + if (fromlen16) + { + INT fromlen32 = *fromlen16; + INT retVal = recvfrom( s, buf, len, flags, from, &fromlen32 ); + *fromlen16 = fromlen32; + return retVal; + } + else return recvfrom( s, buf, len, flags, from, NULL ); +} + +/*********************************************************************** + * select (WINSOCK.18) + */ +INT16 WINAPI select16(INT16 nfds, ws_fd_set16 *ws_readfds, + ws_fd_set16 *ws_writefds, ws_fd_set16 *ws_exceptfds, + struct timeval* timeout) +{ + fd_set read_set, write_set, except_set; + fd_set *pread_set = NULL, *pwrite_set = NULL, *pexcept_set = NULL; + int ret; + + if (ws_readfds) pread_set = ws_fdset_16_to_32( ws_readfds, &read_set ); + if (ws_writefds) pwrite_set = ws_fdset_16_to_32( ws_writefds, &write_set ); + if (ws_exceptfds) pexcept_set = ws_fdset_16_to_32( ws_exceptfds, &except_set ); + /* struct timeval is the same for both 32- and 16-bit code */ + ret = select( nfds, pread_set, pwrite_set, pexcept_set, timeout ); + if (ws_readfds) ws_fdset_32_to_16( &read_set, ws_readfds ); + if (ws_writefds) ws_fdset_32_to_16( &write_set, ws_writefds ); + if (ws_exceptfds) ws_fdset_32_to_16( &except_set, ws_exceptfds ); + return ret; +} + +/*********************************************************************** + * send (WINSOCK.19) + */ +INT16 WINAPI send16(SOCKET16 s, char *buf, INT16 len, INT16 flags) +{ + return send( s, buf, len, flags ); +} + +/*********************************************************************** + * sendto (WINSOCK.20) + */ +INT16 WINAPI sendto16(SOCKET16 s, char *buf, INT16 len, INT16 flags, + struct sockaddr *to, INT16 tolen) +{ + return sendto( s, buf, len, flags, to, tolen ); +} + +/*********************************************************************** + * setsockopt (WINSOCK.21) + */ +INT16 WINAPI setsockopt16(SOCKET16 s, INT16 level, INT16 optname, + char *optval, INT16 optlen) +{ + if( !optval ) return SOCKET_ERROR; + return setsockopt( s, (WORD)level, optname, optval, optlen ); +} + +/*********************************************************************** + * shutdown (WINSOCK.22) + */ +INT16 WINAPI shutdown16(SOCKET16 s, INT16 how) +{ + return shutdown( s, how ); +} + +/*********************************************************************** + * socket (WINSOCK.23) + */ +SOCKET16 WINAPI socket16(INT16 af, INT16 type, INT16 protocol) +{ + return socket( af, type, protocol ); +} + +/*********************************************************************** + * gethostbyaddr (WINSOCK.51) + */ +SEGPTR WINAPI gethostbyaddr16(const char *addr, INT16 len, INT16 type) +{ + struct hostent *he; + + if (!(he = gethostbyaddr( addr, len, type ))) return 0; + return ws_hostent_32_to_16( he, 0, NULL ); +} + +/*********************************************************************** + * gethostbyname (WINSOCK.52) + */ +SEGPTR WINAPI gethostbyname16(const char *name) +{ + struct hostent *he; + + if (!(he = gethostbyname( name ))) return 0; + return ws_hostent_32_to_16( he, 0, NULL ); +} + +/*********************************************************************** + * getprotobyname (WINSOCK.53) + */ +SEGPTR WINAPI getprotobyname16(const char *name) +{ + struct protoent *pe; + + if (!(pe = getprotobyname( name ))) return 0; + return ws_protoent_32_to_16( pe, 0, NULL ); +} + +/*********************************************************************** + * getprotobynumber (WINSOCK.54) + */ +SEGPTR WINAPI getprotobynumber16(INT16 number) +{ + struct protoent *pe; + + if (!(pe = getprotobynumber( number ))) return 0; + return ws_protoent_32_to_16( pe, 0, NULL ); +} + +/*********************************************************************** + * getservbyname (WINSOCK.55) + */ +SEGPTR WINAPI getservbyname16(const char *name, const char *proto) +{ + struct servent *se; + + if (!(se = getservbyname( name, proto ))) return 0; + return ws_servent_32_to_16( se, 0, NULL ); +} + +/*********************************************************************** + * getservbyport (WINSOCK.56) + */ +SEGPTR WINAPI getservbyport16(INT16 port, const char *proto) +{ + struct servent *se; + + if (!(se = getservbyport( port, proto ))) return 0; + return ws_servent_32_to_16( se, 0, NULL ); +} + +/*********************************************************************** + * gethostname (WINSOCK.57) + */ +INT16 WINAPI gethostname16(char *name, INT16 namelen) +{ + extern int WINAPI gethostname(char *name, INT namelen); + return gethostname(name, namelen); +} + +/*********************************************************************** + * WSAAsyncSelect (WINSOCK.101) + */ +INT16 WINAPI WSAAsyncSelect16(SOCKET16 s, HWND16 hWnd, UINT16 wMsg, LONG lEvent) +{ + return WSAAsyncSelect( s, HWND_32(hWnd), wMsg, lEvent ); +} + +/*********************************************************************** + * WSAAsyncGetHostByAddr (WINSOCK.102) + */ +HANDLE16 WINAPI WSAAsyncGetHostByAddr16(HWND16 hWnd, UINT16 uMsg, LPCSTR addr, + INT16 len, INT16 type, SEGPTR sbuf, INT16 buflen) +{ + struct async_query_gethostbyaddr *aq; + + TRACE("hwnd %04x, msg %04x, addr %p[%i]\n", hWnd, uMsg, addr, len ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->host_addr = (char *)(aq + 1); + aq->host_len = len; + aq->host_type = type; + memcpy( aq->host_addr, addr, len ); + return run_query( hWnd, uMsg, async_gethostbyaddr, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSAAsyncGetHostByName (WINSOCK.103) + */ +HANDLE16 WINAPI WSAAsyncGetHostByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name, + SEGPTR sbuf, INT16 buflen) +{ + struct async_query_gethostbyname *aq; + unsigned int len = strlen(name) + 1; + + TRACE("hwnd %04x, msg %04x, host %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->host_name = (char *)(aq + 1); + strcpy( aq->host_name, name ); + return run_query( hWnd, uMsg, async_gethostbyname, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSAAsyncGetProtoByNumber (WINSOCK.104) + */ +HANDLE16 WINAPI WSAAsyncGetProtoByNumber16(HWND16 hWnd,UINT16 uMsg,INT16 number, + SEGPTR sbuf, INT16 buflen) +{ + struct async_query_getprotobynumber *aq; + + TRACE("hwnd %04x, msg %04x, num %i\n", hWnd, uMsg, number ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->proto_number = number; + return run_query( hWnd, uMsg, async_getprotobynumber, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSAAsyncGetProtoByName (WINSOCK.105) + */ +HANDLE16 WINAPI WSAAsyncGetProtoByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name, + SEGPTR sbuf, INT16 buflen) +{ + struct async_query_getprotobyname *aq; + unsigned int len = strlen(name) + 1; + + TRACE("hwnd %04x, msg %04x, proto %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->proto_name = (char *)(aq + 1); + strcpy( aq->proto_name, name ); + return run_query( hWnd, uMsg, async_getprotobyname, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSAAsyncGetServByPort (WINSOCK.106) + */ +HANDLE16 WINAPI WSAAsyncGetServByPort16(HWND16 hWnd, UINT16 uMsg, INT16 port, + LPCSTR proto, SEGPTR sbuf, INT16 buflen) +{ + struct async_query_getservbyport *aq; + unsigned int len = strlen(proto) + 1; + + TRACE("hwnd %04x, msg %04x, port %i, proto %s\n", hWnd, uMsg, port, debugstr_a(proto)); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->serv_proto = (char *)(aq + 1); + aq->serv_port = port; + strcpy( aq->serv_proto, proto ); + return run_query( hWnd, uMsg, async_getservbyport, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSAAsyncGetServByName (WINSOCK.107) + */ +HANDLE16 WINAPI WSAAsyncGetServByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name, + LPCSTR proto, SEGPTR sbuf, INT16 buflen) +{ + struct async_query_getservbyname *aq; + unsigned int len1 = strlen(name) + 1; + unsigned int len2 = strlen(proto) + 1; + + TRACE("hwnd %04x, msg %04x, name %s, proto %s\n", hWnd, uMsg, debugstr_a(name), debugstr_a(proto)); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len1 + len2 ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->serv_name = (char *)(aq + 1); + aq->serv_proto = aq->serv_name + len1; + strcpy( aq->serv_name, name ); + strcpy( aq->serv_proto, proto ); + return run_query( hWnd, uMsg, async_getservbyname, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSACancelAsyncRequest (WINSOCK.108) + */ +INT16 WINAPI WSACancelAsyncRequest16(HANDLE16 hAsyncTaskHandle) +{ + FIXME("(%04x),stub\n", hAsyncTaskHandle); + return 0; +} + +/*********************************************************************** + * WSASetBlockingHook (WINSOCK.109) + */ +FARPROC16 WINAPI WSASetBlockingHook16(FARPROC16 lpBlockFunc) +{ + /* FIXME: should deal with 16-bit proc */ + return (FARPROC16)WSASetBlockingHook( (FARPROC)lpBlockFunc ); +} + +/*********************************************************************** + * WSAUnhookBlockingHook (WINSOCK.110) + */ +INT16 WINAPI WSAUnhookBlockingHook16(void) +{ + return WSAUnhookBlockingHook(); +} + +/*********************************************************************** + * WSAGetLastError (WINSOCK.111) + */ +INT WINAPI WSAGetLastError16(void) +{ + return WSAGetLastError(); +} + +/*********************************************************************** + * WSASetLastError (WINSOCK.112) + */ +void WINAPI WSASetLastError16(INT16 iError) +{ + WSASetLastError(iError); +} + +/*********************************************************************** + * WSACancelBlockingCall (WINSOCK.113) + */ +INT WINAPI WSACancelBlockingCall16(void) +{ + return WSACancelBlockingCall(); +} + +/*********************************************************************** + * WSAIsBlocking (WINSOCK.114) + */ +BOOL WINAPI WSAIsBlocking16(void) +{ + return WSAIsBlocking(); +} + +/*********************************************************************** + * WSAStartup (WINSOCK.115) + * + * Create socket control struct, attach it to the global list and + * update a pointer in the task struct. + */ +INT16 WINAPI WSAStartup16(UINT16 wVersionRequested, LPWSADATA16 lpWSAData) +{ + WSADATA data; + INT ret = WSAStartup( wVersionRequested, &data ); + + if (!ret) + { + lpWSAData->wVersion = 0x0101; + lpWSAData->wHighVersion = 0x0101; + strcpy( lpWSAData->szDescription, data.szDescription ); + strcpy( lpWSAData->szSystemStatus, data.szSystemStatus ); + lpWSAData->iMaxSockets = data.iMaxSockets; + lpWSAData->iMaxUdpDg = data.iMaxUdpDg; + lpWSAData->lpVendorInfo = 0; + num_startup++; + } + return ret; +} + +/*********************************************************************** + * WSACleanup (WINSOCK.116) + */ +INT WINAPI WSACleanup16(void) +{ + if (num_startup) + { + if (!--num_startup) + { + /* delete scratch buffers */ + UnMapLS( he_buffer_seg ); + UnMapLS( se_buffer_seg ); + UnMapLS( pe_buffer_seg ); + UnMapLS( dbuffer_seg ); + he_buffer_seg = 0; + se_buffer_seg = 0; + pe_buffer_seg = 0; + dbuffer_seg = 0; + HeapFree( GetProcessHeap(), 0, he_buffer ); + HeapFree( GetProcessHeap(), 0, se_buffer ); + HeapFree( GetProcessHeap(), 0, pe_buffer ); + he_buffer = NULL; + se_buffer = NULL; + pe_buffer = NULL; + } + } + return WSACleanup(); +} + + +/*********************************************************************** + * __WSAFDIsSet (WINSOCK.151) + */ +INT16 WINAPI __WSAFDIsSet16(SOCKET16 s, ws_fd_set16 *set) +{ + int i = set->fd_count; + + TRACE("(%d,%p(%i))\n", s, set, i); + + while (i--) + if (set->fd_array[i] == s) return 1; + return 0; +} + +/*********************************************************************** + * WSARecvEx (WINSOCK.1107) + * + * See description for WSARecvEx() + */ +INT16 WINAPI WSARecvEx16(SOCKET16 s, char *buf, INT16 len, INT16 *flags) +{ + FIXME("(WSARecvEx16) partial packet return value not set\n"); + return recv16(s, buf, len, *flags); +} diff --git a/dlls/ws2_32/winsock.spec b/dlls/winsock.dll16/winsock.dll16.spec similarity index 87% rename from dlls/ws2_32/winsock.spec rename to dlls/winsock.dll16/winsock.dll16.spec index 94fe71a8cfb..4e99af5f3dd 100644 --- a/dlls/ws2_32/winsock.spec +++ b/dlls/winsock.dll16/winsock.dll16.spec @@ -5,14 +5,14 @@ 5 pascal -ret16 getpeername(word ptr ptr) getpeername16 6 pascal -ret16 getsockname(word ptr ptr) getsockname16 7 pascal -ret16 getsockopt(word word word ptr ptr) getsockopt16 -8 pascal htonl(long) WS_htonl -9 pascal -ret16 htons(word) WS_htons -10 pascal inet_addr(ptr) WS_inet_addr +8 pascal htonl(long) htonl16 +9 pascal -ret16 htons(word) htons16 +10 pascal inet_addr(ptr) inet_addr16 11 pascal inet_ntoa(long) inet_ntoa16 12 pascal -ret16 ioctlsocket(word long ptr) ioctlsocket16 13 pascal -ret16 listen(word word) listen16 -14 pascal ntohl(long) WS_ntohl -15 pascal -ret16 ntohs(word) WS_ntohs +14 pascal ntohl(long) ntohl16 +15 pascal -ret16 ntohs(word) ntohs16 16 pascal -ret16 recv(word ptr word word) recv16 17 pascal -ret16 recvfrom(word ptr word word ptr ptr) recvfrom16 18 pascal -ret16 select(word ptr ptr ptr ptr) select16 @@ -38,10 +38,10 @@ 108 pascal -ret16 WSACancelAsyncRequest(word) WSACancelAsyncRequest16 109 pascal -ret16 WSASetBlockingHook(segptr) WSASetBlockingHook16 110 pascal -ret16 WSAUnhookBlockingHook() WSAUnhookBlockingHook16 -111 pascal -ret16 WSAGetLastError() WSAGetLastError +111 pascal -ret16 WSAGetLastError() WSAGetLastError16 112 pascal WSASetLastError(word) WSASetLastError16 -113 pascal -ret16 WSACancelBlockingCall() WSACancelBlockingCall -114 pascal -ret16 WSAIsBlocking() WSAIsBlocking +113 pascal -ret16 WSACancelBlockingCall() WSACancelBlockingCall16 +114 pascal -ret16 WSAIsBlocking() WSAIsBlocking16 115 pascal WSAStartup(word ptr) WSAStartup16 116 pascal WSACleanup() WSACleanup16 151 pascal -ret16 __WSAFDIsSet(word ptr) __WSAFDIsSet16 diff --git a/include/wine/winsock16.h b/dlls/winsock.dll16/winsock16.h similarity index 97% rename from include/wine/winsock16.h rename to dlls/winsock.dll16/winsock16.h index c803666a385..6cf9def5961 100644 --- a/include/wine/winsock16.h +++ b/dlls/winsock.dll16/winsock16.h @@ -19,9 +19,6 @@ #ifndef __WINE_WINE_WINSOCK16_H #define __WINE_WINE_WINSOCK16_H -#include -#include -#include #include typedef UINT16 SOCKET16; @@ -29,7 +26,7 @@ typedef UINT16 SOCKET16; typedef struct { UINT16 fd_count; /* how many are SET? */ - SOCKET16 fd_array[WS_FD_SETSIZE]; /* an array of SOCKETs */ + SOCKET16 fd_array[FD_SETSIZE]; /* an array of SOCKETs */ } ws_fd_set16; /* ws_hostent16, ws_protoent16, ws_servent16, ws_netent16 diff --git a/dlls/winspool.drv/info.c b/dlls/winspool.drv/info.c index 95908b368c3..4bd88a262b9 100644 --- a/dlls/winspool.drv/info.c +++ b/dlls/winspool.drv/info.c @@ -64,16 +64,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(winspool); /* ############################### */ -static CRITICAL_SECTION monitor_handles_cs; -static CRITICAL_SECTION_DEBUG monitor_handles_cs_debug = -{ - 0, 0, &monitor_handles_cs, - { &monitor_handles_cs_debug.ProcessLocksList, &monitor_handles_cs_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": monitor_handles_cs") } -}; -static CRITICAL_SECTION monitor_handles_cs = { &monitor_handles_cs_debug, -1, 0, 0, 0, 0 }; - - static CRITICAL_SECTION printer_handles_cs; static CRITICAL_SECTION_DEBUG printer_handles_cs_debug = { @@ -86,17 +76,6 @@ static CRITICAL_SECTION printer_handles_cs = { &printer_handles_cs_debug, -1, 0, /* ############################### */ typedef struct { - struct list entry; - LPWSTR name; - LPWSTR dllname; - PMONITORUI monitorUI; - LPMONITOR monitor; - HMODULE hdll; - DWORD refcount; - DWORD dwMonitorSize; -} monitor_t; - -typedef struct { DWORD job_id; HANDLE hf; } started_doc_t; @@ -132,9 +111,6 @@ typedef struct { /* ############################### */ -static struct list monitor_handles = LIST_INIT( monitor_handles ); -static monitor_t * pm_localport; - static opened_printer_t **printer_handles; static UINT nb_printer_handles; static LONG next_job_id = 1; @@ -154,12 +130,6 @@ static const WCHAR DriversW[] = { 'S','y','s','t','e','m','\\', 'E','n','v','i','r','o','n','m','e','n','t','s','\\', '%','s','\\','D','r','i','v','e','r','s','%','s',0 }; -static const WCHAR MonitorsW[] = { 'S','y','s','t','e','m','\\', - 'C','u', 'r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', - 'C','o','n','t','r','o','l','\\', - 'P','r','i','n','t','\\', - 'M','o','n','i','t','o','r','s','\\',0}; - static const WCHAR PrintersW[] = {'S','y','s','t','e','m','\\', 'C','u', 'r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', 'C','o','n','t','r','o','l','\\', @@ -221,7 +191,6 @@ static const WCHAR Help_FileW[] = {'H','e','l','p',' ','F','i','l','e',0}; static const WCHAR LocationW[] = {'L','o','c','a','t','i','o','n',0}; static const WCHAR ManufacturerW[] = {'M','a','n','u','f','a','c','t','u','r','e','r',0}; static const WCHAR MonitorW[] = {'M','o','n','i','t','o','r',0}; -static const WCHAR MonitorUIW[] = {'M','o','n','i','t','o','r','U','I',0}; static const WCHAR NameW[] = {'N','a','m','e',0}; static const WCHAR ObjectGUIDW[] = {'O','b','j','e','c','t','G','U','I','D',0}; static const WCHAR OEM_UrlW[] = {'O','E','M',' ','U','r','l',0}; @@ -762,292 +731,6 @@ static inline DWORD set_reg_szW(HKEY hkey, const WCHAR *keyname, const WCHAR *va } /****************************************************************** - * monitor_unload [internal] - * - * release a printmonitor and unload it from memory, when needed - * - */ -static void monitor_unload(monitor_t * pm) -{ - if (pm == NULL) return; - TRACE("%p (refcount: %d) %s\n", pm, pm->refcount, debugstr_w(pm->name)); - - EnterCriticalSection(&monitor_handles_cs); - - if (pm->refcount) pm->refcount--; - - if (pm->refcount == 0) { - list_remove(&pm->entry); - FreeLibrary(pm->hdll); - HeapFree(GetProcessHeap(), 0, pm->name); - HeapFree(GetProcessHeap(), 0, pm->dllname); - HeapFree(GetProcessHeap(), 0, pm); - } - LeaveCriticalSection(&monitor_handles_cs); -} - -/****************************************************************** - * monitor_load [internal] - * - * load a printmonitor, get the dllname from the registry, when needed - * initialize the monitor and dump found function-pointers - * - * On failure, SetLastError() is called and NULL is returned - */ - -static monitor_t * monitor_load(LPCWSTR name, LPWSTR dllname) -{ - LPMONITOR2 (WINAPI *pInitializePrintMonitor2) (PMONITORINIT, LPHANDLE); - PMONITORUI (WINAPI *pInitializePrintMonitorUI)(VOID); - LPMONITOREX (WINAPI *pInitializePrintMonitor) (LPWSTR); - DWORD (WINAPI *pInitializeMonitorEx)(LPWSTR, LPMONITOR); - DWORD (WINAPI *pInitializeMonitor) (LPWSTR); - - monitor_t * pm = NULL; - monitor_t * cursor; - LPWSTR regroot = NULL; - LPWSTR driver = dllname; - - TRACE("(%s, %s)\n", debugstr_w(name), debugstr_w(dllname)); - /* Is the Monitor already loaded? */ - EnterCriticalSection(&monitor_handles_cs); - - if (name) { - LIST_FOR_EACH_ENTRY(cursor, &monitor_handles, monitor_t, entry) - { - if (cursor->name && (lstrcmpW(name, cursor->name) == 0)) { - pm = cursor; - break; - } - } - } - - if (pm == NULL) { - pm = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(monitor_t)); - if (pm == NULL) goto cleanup; - list_add_tail(&monitor_handles, &pm->entry); - } - pm->refcount++; - - if (pm->name == NULL) { - /* Load the monitor */ - LPMONITOREX pmonitorEx; - DWORD len; - - if (name) { - len = lstrlenW(MonitorsW) + lstrlenW(name) + 2; - regroot = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - } - - if (regroot) { - lstrcpyW(regroot, MonitorsW); - lstrcatW(regroot, name); - /* Get the Driver from the Registry */ - if (driver == NULL) { - HKEY hroot; - DWORD namesize; - if (RegOpenKeyW(HKEY_LOCAL_MACHINE, regroot, &hroot) == ERROR_SUCCESS) { - if (RegQueryValueExW(hroot, DriverW, NULL, NULL, NULL, - &namesize) == ERROR_SUCCESS) { - driver = HeapAlloc(GetProcessHeap(), 0, namesize); - RegQueryValueExW(hroot, DriverW, NULL, NULL, (LPBYTE) driver, &namesize) ; - } - RegCloseKey(hroot); - } - } - } - - pm->name = strdupW(name); - pm->dllname = strdupW(driver); - - if ((name && (!regroot || !pm->name)) || !pm->dllname) { - monitor_unload(pm); - SetLastError(ERROR_NOT_ENOUGH_MEMORY); - pm = NULL; - goto cleanup; - } - - pm->hdll = LoadLibraryW(driver); - TRACE("%p: LoadLibrary(%s) => %d\n", pm->hdll, debugstr_w(driver), GetLastError()); - - if (pm->hdll == NULL) { - monitor_unload(pm); - SetLastError(ERROR_MOD_NOT_FOUND); - pm = NULL; - goto cleanup; - } - - pInitializePrintMonitor2 = (void *)GetProcAddress(pm->hdll, "InitializePrintMonitor2"); - pInitializePrintMonitorUI = (void *)GetProcAddress(pm->hdll, "InitializePrintMonitorUI"); - pInitializePrintMonitor = (void *)GetProcAddress(pm->hdll, "InitializePrintMonitor"); - pInitializeMonitorEx = (void *)GetProcAddress(pm->hdll, "InitializeMonitorEx"); - pInitializeMonitor = (void *)GetProcAddress(pm->hdll, "InitializeMonitor"); - - - TRACE("%p: %s,pInitializePrintMonitor2\n", pInitializePrintMonitor2, debugstr_w(driver)); - TRACE("%p: %s,pInitializePrintMonitorUI\n", pInitializePrintMonitorUI, debugstr_w(driver)); - TRACE("%p: %s,pInitializePrintMonitor\n", pInitializePrintMonitor, debugstr_w(driver)); - TRACE("%p: %s,pInitializeMonitorEx\n", pInitializeMonitorEx, debugstr_w(driver)); - TRACE("%p: %s,pInitializeMonitor\n", pInitializeMonitor, debugstr_w(driver)); - - if (pInitializePrintMonitorUI != NULL) { - pm->monitorUI = pInitializePrintMonitorUI(); - TRACE("%p: MONITORUI from %s,InitializePrintMonitorUI()\n", pm->monitorUI, debugstr_w(driver)); - if (pm->monitorUI) { - TRACE( "0x%08x: dwMonitorSize (%d)\n", - pm->monitorUI->dwMonitorUISize, pm->monitorUI->dwMonitorUISize ); - - } - } - - if (pInitializePrintMonitor && regroot) { - pmonitorEx = pInitializePrintMonitor(regroot); - TRACE( "%p: LPMONITOREX from %s,InitializePrintMonitor(%s)\n", - pmonitorEx, debugstr_w(driver), debugstr_w(regroot)); - - if (pmonitorEx) { - pm->dwMonitorSize = pmonitorEx->dwMonitorSize; - pm->monitor = &(pmonitorEx->Monitor); - } - } - - if (pm->monitor) { - TRACE( "0x%08x: dwMonitorSize (%d)\n", pm->dwMonitorSize, pm->dwMonitorSize ); - - } - - if (!pm->monitor && regroot) { - if (pInitializePrintMonitor2 != NULL) { - FIXME("%s,InitializePrintMonitor2 not implemented\n", debugstr_w(driver)); - } - if (pInitializeMonitorEx != NULL) { - FIXME("%s,InitializeMonitorEx not implemented\n", debugstr_w(driver)); - } - if (pInitializeMonitor != NULL) { - FIXME("%s,InitializeMonitor not implemented\n", debugstr_w(driver)); - } - } - if (!pm->monitor && !pm->monitorUI) { - monitor_unload(pm); - SetLastError(ERROR_PROC_NOT_FOUND); - pm = NULL; - } - } -cleanup: - if ((pm_localport == NULL) && (pm != NULL) && (lstrcmpW(pm->name, LocalPortW) == 0)) { - pm->refcount++; - pm_localport = pm; - } - LeaveCriticalSection(&monitor_handles_cs); - if (driver != dllname) HeapFree(GetProcessHeap(), 0, driver); - HeapFree(GetProcessHeap(), 0, regroot); - TRACE("=> %p\n", pm); - return pm; -} - -/****************************************************************** - * monitor_loadui [internal] - * - * load the userinterface-dll for a given portmonitor - * - * On failure, NULL is returned - */ - -static monitor_t * monitor_loadui(monitor_t * pm) -{ - monitor_t * pui = NULL; - LPWSTR buffer[MAX_PATH]; - HANDLE hXcv; - DWORD len; - DWORD res; - - if (pm == NULL) return NULL; - TRACE("(%p) => dllname: %s\n", pm, debugstr_w(pm->dllname)); - - /* Try the Portmonitor first; works for many monitors */ - if (pm->monitorUI) { - EnterCriticalSection(&monitor_handles_cs); - pm->refcount++; - LeaveCriticalSection(&monitor_handles_cs); - return pm; - } - - /* query the userinterface-dllname from the Portmonitor */ - if ((pm->monitor) && (pm->monitor->pfnXcvDataPort)) { - /* building (",XcvMonitor %s",pm->name) not needed yet */ - res = pm->monitor->pfnXcvOpenPort(emptyStringW, SERVER_ACCESS_ADMINISTER, &hXcv); - TRACE("got %u with %p\n", res, hXcv); - if (res) { - res = pm->monitor->pfnXcvDataPort(hXcv, MonitorUIW, NULL, 0, (BYTE *) buffer, sizeof(buffer), &len); - TRACE("got %u with %s\n", res, debugstr_w((LPWSTR) buffer)); - if (res == ERROR_SUCCESS) pui = monitor_load(NULL, (LPWSTR) buffer); - pm->monitor->pfnXcvClosePort(hXcv); - } - } - return pui; -} - - -/****************************************************************** - * monitor_load_by_port [internal] - * - * load a printmonitor for a given port - * - * On failure, NULL is returned - */ - -static monitor_t * monitor_load_by_port(LPCWSTR portname) -{ - HKEY hroot; - HKEY hport; - LPWSTR buffer; - monitor_t * pm = NULL; - DWORD registered = 0; - DWORD id = 0; - DWORD len; - - TRACE("(%s)\n", debugstr_w(portname)); - - /* Try the Local Monitor first */ - if (RegOpenKeyW(HKEY_LOCAL_MACHINE, WinNT_CV_PortsW, &hroot) == ERROR_SUCCESS) { - if (RegQueryValueExW(hroot, portname, NULL, NULL, NULL, &len) == ERROR_SUCCESS) { - /* found the portname */ - RegCloseKey(hroot); - return monitor_load(LocalPortW, NULL); - } - RegCloseKey(hroot); - } - - len = MAX_PATH + lstrlenW(bs_Ports_bsW) + lstrlenW(portname) + 1; - buffer = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); - if (buffer == NULL) return NULL; - - if (RegOpenKeyW(HKEY_LOCAL_MACHINE, MonitorsW, &hroot) == ERROR_SUCCESS) { - EnterCriticalSection(&monitor_handles_cs); - RegQueryInfoKeyW(hroot, NULL, NULL, NULL, ®istered, NULL, NULL, NULL, NULL, NULL, NULL, NULL); - - while ((pm == NULL) && (id < registered)) { - buffer[0] = '\0'; - RegEnumKeyW(hroot, id, buffer, MAX_PATH); - TRACE("testing %s\n", debugstr_w(buffer)); - len = lstrlenW(buffer); - lstrcatW(buffer, bs_Ports_bsW); - lstrcatW(buffer, portname); - if (RegOpenKeyW(hroot, buffer, &hport) == ERROR_SUCCESS) { - RegCloseKey(hport); - buffer[len] = '\0'; /* use only the Monitor-Name */ - pm = monitor_load(buffer, NULL); - } - id++; - } - LeaveCriticalSection(&monitor_handles_cs); - RegCloseKey(hroot); - } - HeapFree(GetProcessHeap(), 0, buffer); - return pm; -} - -/****************************************************************** * get_servername_from_name (internal) * * for an external server, a copy of the serverpart from the full name is returned @@ -2229,57 +1912,16 @@ BOOL WINAPI DeletePortA (LPSTR pName, HWND hWnd, LPSTR pPortName) */ BOOL WINAPI DeletePortW (LPWSTR pName, HWND hWnd, LPWSTR pPortName) { - monitor_t * pm; - monitor_t * pui; - DWORD res; - TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pPortName)); - if (pName && pName[0]) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } + if ((backend == NULL) && !load_backend()) return FALSE; if (!pPortName) { SetLastError(RPC_X_NULL_REF_POINTER); return FALSE; } - /* an empty Portname is Invalid */ - if (!pPortName[0]) { - SetLastError(ERROR_NOT_SUPPORTED); - return FALSE; - } - - pm = monitor_load_by_port(pPortName); - if (pm && pm->monitor && pm->monitor->pfnDeletePort) { - TRACE("Using %s for %s (%p: %s)\n", debugstr_w(pm->name), debugstr_w(pPortName), pm, debugstr_w(pm->dllname)); - res = pm->monitor->pfnDeletePort(pName, hWnd, pPortName); - TRACE("got %d with %u\n", res, GetLastError()); - } - else - { - pui = monitor_loadui(pm); - if (pui && pui->monitorUI && pui->monitorUI->pfnDeletePortUI) { - TRACE("use %s for %s (%p: %s)\n", debugstr_w(pui->name), debugstr_w(pPortName), pui, debugstr_w(pui->dllname)); - res = pui->monitorUI->pfnDeletePortUI(pName, hWnd, pPortName); - TRACE("got %d with %u\n", res, GetLastError()); - } - else - { - FIXME("not implemented for %s (%p: %s => %p: %s)\n", debugstr_w(pPortName), - pm, debugstr_w(pm ? pm->dllname : NULL), pui, debugstr_w(pui ? pui->dllname : NULL)); - - /* XP: ERROR_NOT_SUPPORTED, NT351,9x: ERROR_INVALID_PARAMETER */ - SetLastError(ERROR_NOT_SUPPORTED); - res = FALSE; - } - monitor_unload(pui); - } - monitor_unload(pm); - - TRACE("returning %d with %u\n", res, GetLastError()); - return res; + return backend->fpDeletePort(pName, hWnd, pPortName); } /****************************************************************************** @@ -6116,57 +5758,16 @@ BOOL WINAPI AddPortA(LPSTR pName, HWND hWnd, LPSTR pMonitorName) */ BOOL WINAPI AddPortW(LPWSTR pName, HWND hWnd, LPWSTR pMonitorName) { - monitor_t * pm; - monitor_t * pui; - DWORD res; - TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pMonitorName)); - if (pName && pName[0]) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } + if ((backend == NULL) && !load_backend()) return FALSE; if (!pMonitorName) { SetLastError(RPC_X_NULL_REF_POINTER); return FALSE; } - /* an empty Monitorname is Invalid */ - if (!pMonitorName[0]) { - SetLastError(ERROR_NOT_SUPPORTED); - return FALSE; - } - - pm = monitor_load(pMonitorName, NULL); - if (pm && pm->monitor && pm->monitor->pfnAddPort) { - res = pm->monitor->pfnAddPort(pName, hWnd, pMonitorName); - TRACE("got %d with %u\n", res, GetLastError()); - res = TRUE; - } - else - { - pui = monitor_loadui(pm); - if (pui && pui->monitorUI && pui->monitorUI->pfnAddPortUI) { - TRACE("use %p: %s\n", pui, debugstr_w(pui->dllname)); - res = pui->monitorUI->pfnAddPortUI(pName, hWnd, pMonitorName, NULL); - TRACE("got %d with %u\n", res, GetLastError()); - res = TRUE; - } - else - { - FIXME("not implemented for %s (%p: %s => %p: %s)\n", debugstr_w(pMonitorName), - pm, debugstr_w(pm ? pm->dllname : NULL), pui, debugstr_w(pui ? pui->dllname : NULL)); - - /* XP: ERROR_NOT_SUPPORTED, NT351,9x: ERROR_INVALID_PARAMETER */ - SetLastError(ERROR_NOT_SUPPORTED); - res = FALSE; - } - monitor_unload(pui); - } - monitor_unload(pm); - TRACE("returning %d with %u\n", res, GetLastError()); - return res; + return backend->fpAddPort(pName, hWnd, pMonitorName); } /****************************************************************************** @@ -6265,8 +5866,6 @@ BOOL WINAPI AddPortExA(LPSTR pName, DWORD level, LPBYTE pBuffer, LPSTR pMonitorN BOOL WINAPI AddPortExW(LPWSTR pName, DWORD level, LPBYTE pBuffer, LPWSTR pMonitorName) { PORT_INFO_2W * pi2; - monitor_t * pm; - DWORD res = FALSE; pi2 = (PORT_INFO_2W *) pBuffer; @@ -6275,34 +5874,14 @@ BOOL WINAPI AddPortExW(LPWSTR pName, DWORD level, LPBYTE pBuffer, LPWSTR pMonito debugstr_w(((level > 1) && pi2) ? pi2->pMonitorName : NULL), debugstr_w(((level > 1) && pi2) ? pi2->pDescription : NULL)); - - if ((level < 1) || (level > 2)) { - SetLastError(ERROR_INVALID_LEVEL); - return FALSE; - } + if ((backend == NULL) && !load_backend()) return FALSE; if ((!pi2) || (!pMonitorName) || (!pMonitorName[0])) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } - /* load the Monitor */ - pm = monitor_load(pMonitorName, NULL); - if (!pm) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } - - if (pm->monitor && pm->monitor->pfnAddPortEx) { - res = pm->monitor->pfnAddPortEx(pName, level, pBuffer, pMonitorName); - TRACE("got %u with %u\n", res, GetLastError()); - } - else - { - FIXME("not implemented for %s (%p)\n", debugstr_w(pMonitorName), pm->monitor); - } - monitor_unload(pm); - return res; + return backend->fpAddPortEx(pName, level, pBuffer, pMonitorName); } /****************************************************************************** @@ -6555,57 +6134,17 @@ BOOL WINAPI ConfigurePortA(LPSTR pName, HWND hWnd, LPSTR pPortName) */ BOOL WINAPI ConfigurePortW(LPWSTR pName, HWND hWnd, LPWSTR pPortName) { - monitor_t * pm; - monitor_t * pui; - DWORD res; TRACE("(%s, %p, %s)\n", debugstr_w(pName), hWnd, debugstr_w(pPortName)); - if (pName && pName[0]) { - SetLastError(ERROR_INVALID_PARAMETER); - return FALSE; - } + if ((backend == NULL) && !load_backend()) return FALSE; if (!pPortName) { SetLastError(RPC_X_NULL_REF_POINTER); return FALSE; } - /* an empty Portname is Invalid, but can popup a Dialog */ - if (!pPortName[0]) { - SetLastError(ERROR_NOT_SUPPORTED); - return FALSE; - } - - pm = monitor_load_by_port(pPortName); - if (pm && pm->monitor && pm->monitor->pfnConfigurePort) { - TRACE("Using %s for %s (%p: %s)\n", debugstr_w(pm->name), debugstr_w(pPortName), pm, debugstr_w(pm->dllname)); - res = pm->monitor->pfnConfigurePort(pName, hWnd, pPortName); - TRACE("got %d with %u\n", res, GetLastError()); - } - else - { - pui = monitor_loadui(pm); - if (pui && pui->monitorUI && pui->monitorUI->pfnConfigurePortUI) { - TRACE("Use %s for %s (%p: %s)\n", debugstr_w(pui->name), debugstr_w(pPortName), pui, debugstr_w(pui->dllname)); - res = pui->monitorUI->pfnConfigurePortUI(pName, hWnd, pPortName); - TRACE("got %d with %u\n", res, GetLastError()); - } - else - { - FIXME("not implemented for %s (%p: %s => %p: %s)\n", debugstr_w(pPortName), - pm, debugstr_w(pm ? pm->dllname : NULL), pui, debugstr_w(pui ? pui->dllname : NULL)); - - /* XP: ERROR_NOT_SUPPORTED, NT351,9x: ERROR_INVALID_PARAMETER */ - SetLastError(ERROR_NOT_SUPPORTED); - res = FALSE; - } - monitor_unload(pui); - } - monitor_unload(pm); - - TRACE("returning %d with %u\n", res, GetLastError()); - return res; + return backend->fpConfigurePort(pName, hWnd, pPortName); } /****************************************************************************** diff --git a/dlls/wnaspi32/winaspi32.c b/dlls/wnaspi32/winaspi32.c index 84b54f0684d..342fb822b18 100644 --- a/dlls/wnaspi32/winaspi32.c +++ b/dlls/wnaspi32/winaspi32.c @@ -270,7 +270,7 @@ ASPI_DebugPrintResult(SRB_ExecSCSICmd *prb) static DWORD WNASPI32_DoPosting( SRB_ExecSCSICmd *lpPRB, DWORD status ) { - void (*SRB_PostProc)() = lpPRB->SRB_PostProc; + void (*SRB_PostProc)(SRB_ExecSCSICmd *) = lpPRB->SRB_PostProc; BYTE SRB_Flags = lpPRB->SRB_Flags; if( status == SS_PENDING ) { diff --git a/dlls/ws2_32/Makefile.in b/dlls/ws2_32/Makefile.in index 9924e2d0875..d858ba5386b 100644 --- a/dlls/ws2_32/Makefile.in +++ b/dlls/ws2_32/Makefile.in @@ -14,10 +14,6 @@ C_SRCS = \ protocol.c \ socket.c -C_SRCS16 = socket16.c - -SPEC_SRCS16 = winsock.spec - RC_SRCS = version.rc @MAKE_DLL_RULES@ diff --git a/dlls/ws2_32/async.c b/dlls/ws2_32/async.c dissimilarity index 78% index 8651141d052..2f799689be2 100644 --- a/dlls/ws2_32/async.c +++ b/dlls/ws2_32/async.c @@ -1,773 +1,454 @@ -/* Async WINSOCK DNS services - * - * Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka. - * Copyright (C) 1999 Marcus Meissner - * - * 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 - * - * NOTE: If you make any changes to fix a particular app, make sure - * they don't break something else like Netscape or telnet and ftp - * clients and servers (www.winsite.com got a lot of those). - * - * FIXME: - * - Add WSACancel* and correct handle management. (works rather well for - * now without it.) - * - Verify & Check all calls for correctness - * (currently only WSAGetHostByName*, WSAGetServByPort* calls) - * - Check error returns. - * - mirc/mirc32 Finger @linux.kernel.org sometimes fails in threaded mode. - * (not sure why) - * - This implementation did ignore the "NOTE:" section above (since the - * whole stuff did not work anyway to other changes). - */ - -#include "config.h" -#include "wine/port.h" - -#include -#include -#include -#ifdef HAVE_SYS_IPC_H -# include -#endif -#ifdef HAVE_SYS_IOCTL_H -# include -#endif -#ifdef HAVE_SYS_FILIO_H -# include -#endif -#if defined(__svr4__) -#include -#ifdef HAVE_SYS_SOCKIO_H -# include -#endif -#endif - -#if defined(__EMX__) -# include -#endif - -#ifdef HAVE_SYS_PARAM_H -# include -#endif - -#ifdef HAVE_SYS_MSG_H -# include -#endif -#ifdef HAVE_SYS_WAIT_H -#include -#endif -#ifdef HAVE_SYS_SOCKET_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -# include -#endif -#ifdef HAVE_ARPA_INET_H -# include -#endif -#include -#include -#include -#ifdef HAVE_SYS_ERRNO_H -#include -#endif -#ifdef HAVE_NETDB_H -#include -#endif -#ifdef HAVE_UNISTD_H -# include -#endif -#include -#ifdef HAVE_ARPA_NAMESER_H -# include -#endif -#ifdef HAVE_RESOLV_H -# include -#endif - -#include "wine/winbase16.h" -#include "windef.h" -#include "winbase.h" -#include "wingdi.h" -#include "winuser.h" -#include "winsock2.h" -#include "ws2spi.h" -#include "wownt32.h" -#include "wine/winsock16.h" -#include "winnt.h" - -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(winsock); - - -/* critical section to protect some non-reentrant net function */ -CRITICAL_SECTION csWSgetXXXbyYYY; -static CRITICAL_SECTION_DEBUG critsect_debug = -{ - 0, 0, &csWSgetXXXbyYYY, - { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, - 0, 0, { (DWORD_PTR)(__FILE__ ": csWSgetXXXbyYYY") } -}; -CRITICAL_SECTION csWSgetXXXbyYYY = { &critsect_debug, -1, 0, 0, 0, 0 }; - -/* prototypes of some functions in socket.c - */ -UINT wsaErrno(void); -UINT wsaHerrno(int errnr); - -#define AQ_WIN16 0x00 -#define AQ_WIN32 0x04 -#define HB_WIN32(hb) (hb->flags & AQ_WIN32) -#define AQ_NUMBER 0x00 -#define AQ_NAME 0x08 -#define AQ_COPYPTR1 0x10 -#define AQ_DUPLOWPTR1 0x20 -#define AQ_MASKPTR1 0x30 -#define AQ_COPYPTR2 0x40 -#define AQ_DUPLOWPTR2 0x80 -#define AQ_MASKPTR2 0xC0 - -#define AQ_GETHOST 0 -#define AQ_GETPROTO 1 -#define AQ_GETSERV 2 -#define AQ_GETMASK 3 - -/* The handles used are pseudo-handles that can be simply casted. */ -/* 16-bit values are used internally (to be sure handle comparison works right in 16-bit apps). */ -#define WSA_H32(h16) ((HANDLE)(ULONG_PTR)(h16)) - -/* ----------------------------------- helper functions - */ - -static int list_size(char** l, int item_size) -{ - int i,j = 0; - if(l) - { for(i=0;l[i];i++) - j += (item_size) ? item_size : strlen(l[i]) + 1; - j += (i + 1) * sizeof(char*); } - return j; -} - -static int list_dup(char** l_src, char* ref, char* base, int item_size) -{ - /* base is either either equal to ref or 0 or SEGPTR */ - - char* p = ref; - char** l_to = (char**)ref; - int i,j,k; - - for(j=0;l_src[j];j++) ; - p += (j + 1) * sizeof(char*); - for(i=0;ih_name) + 1; - size += list_size(p_he->h_aliases, 0); - size += list_size(p_he->h_addr_list, p_he->h_length ); } - return size; -} - -/* Copy hostent to p_to, fix up inside pointers using p_base (different for - * Win16 (linear vs. segmented). Return -neededsize on overrun. - */ -static int WS_copy_he(char *p_to,char *p_base,int t_size,struct hostent* p_he, int flag) -{ - char* p_name,*p_aliases,*p_addr,*p; - struct ws_hostent16 *p_to16 = (struct ws_hostent16*)p_to; - struct WS_hostent *p_to32 = (struct WS_hostent*)p_to; - int size = hostent_size(p_he) + - ( - (flag & AQ_WIN32) ? sizeof(struct WS_hostent) : sizeof(struct ws_hostent16) - - sizeof(struct hostent) - ); - - if (t_size < size) - return -size; - p = p_to; - p += (flag & AQ_WIN32) ? - sizeof(struct WS_hostent) : sizeof(struct ws_hostent16); - p_name = p; - strcpy(p, p_he->h_name); p += strlen(p) + 1; - p_aliases = p; - p += list_dup(p_he->h_aliases, p, p_base + (p - p_to), 0); - p_addr = p; - list_dup(p_he->h_addr_list, p, p_base + (p - p_to), p_he->h_length); - - if (flag & AQ_WIN32) - { - p_to32->h_addrtype = p_he->h_addrtype; - p_to32->h_length = p_he->h_length; - p_to32->h_name = (p_base + (p_name - p_to)); - p_to32->h_aliases = (char **)(p_base + (p_aliases - p_to)); - p_to32->h_addr_list = (char **)(p_base + (p_addr - p_to)); - } - else - { - p_to16->h_addrtype = (INT16)p_he->h_addrtype; - p_to16->h_length = (INT16)p_he->h_length; - p_to16->h_name = (SEGPTR)(p_base + (p_name - p_to)); - p_to16->h_aliases = (SEGPTR)(p_base + (p_aliases - p_to)); - p_to16->h_addr_list = (SEGPTR)(p_base + (p_addr - p_to)); - } - - return size; -} - -/* ----- protoent */ - -static int protoent_size(struct protoent* p_pe) -{ - int size = 0; - if( p_pe ) - { size = sizeof(struct protoent); - size += strlen(p_pe->p_name) + 1; - size += list_size(p_pe->p_aliases, 0); } - return size; -} - -/* Copy protoent to p_to, fix up inside pointers using p_base (different for - * Win16 (linear vs. segmented). Return -neededsize on overrun. - */ -static int WS_copy_pe(char *p_to,char *p_base,int t_size,struct protoent* p_pe, int flag) -{ - char* p_name,*p_aliases,*p; - struct ws_protoent16 *p_to16 = (struct ws_protoent16*)p_to; - struct WS_protoent *p_to32 = (struct WS_protoent*)p_to; - int size = protoent_size(p_pe) + - ( - (flag & AQ_WIN32) ? sizeof(struct WS_protoent) : sizeof(struct ws_protoent16) - - sizeof(struct protoent) - ); - - if (t_size < size) - return -size; - p = p_to; - p += (flag & AQ_WIN32) ? sizeof(struct WS_protoent) : sizeof(struct ws_protoent16); - p_name = p; - strcpy(p, p_pe->p_name); p += strlen(p) + 1; - p_aliases = p; - list_dup(p_pe->p_aliases, p, p_base + (p - p_to), 0); - - if (flag & AQ_WIN32) - { - p_to32->p_proto = p_pe->p_proto; - p_to32->p_name = (p_base) + (p_name - p_to); - p_to32->p_aliases = (char **)((p_base) + (p_aliases - p_to)); - } - else - { - p_to16->p_proto = (INT16)p_pe->p_proto; - p_to16->p_name = (SEGPTR)(p_base) + (p_name - p_to); - p_to16->p_aliases = (SEGPTR)((p_base) + (p_aliases - p_to)); - } - - return size; -} - -/* ----- servent */ - -static int servent_size(struct servent* p_se) -{ - int size = 0; - if( p_se ) { - size += sizeof(struct servent); - size += strlen(p_se->s_proto) + strlen(p_se->s_name) + 2; - size += list_size(p_se->s_aliases, 0); - } - return size; -} - -/* Copy servent to p_to, fix up inside pointers using p_base (different for - * Win16 (linear vs. segmented). Return -neededsize on overrun. - * Take care of different Win16/Win32 servent structs (packing !) - */ -static int WS_copy_se(char *p_to,char *p_base,int t_size,struct servent* p_se, int flag) -{ - char* p_name,*p_aliases,*p_proto,*p; - struct ws_servent16 *p_to16 = (struct ws_servent16*)p_to; - struct WS_servent *p_to32 = (struct WS_servent*)p_to; - int size = servent_size(p_se) + - ( - (flag & AQ_WIN32) ? sizeof(struct WS_servent) : sizeof(struct ws_servent16) - - sizeof(struct servent) - ); - - if (t_size < size) - return -size; - p = p_to; - p += (flag & AQ_WIN32) ? sizeof(struct WS_servent) : sizeof(struct ws_servent16); - p_name = p; - strcpy(p, p_se->s_name); p += strlen(p) + 1; - p_proto = p; - strcpy(p, p_se->s_proto); p += strlen(p) + 1; - p_aliases = p; - list_dup(p_se->s_aliases, p, p_base + (p - p_to), 0); - - if (flag & AQ_WIN32) - { - p_to32->s_port = p_se->s_port; - p_to32->s_name = (p_base + (p_name - p_to)); - p_to32->s_proto = (p_base + (p_proto - p_to)); - p_to32->s_aliases = (char **)(p_base + (p_aliases - p_to)); - } - else - { - p_to16->s_port = (INT16)p_se->s_port; - p_to16->s_name = (SEGPTR)(p_base + (p_name - p_to)); - p_to16->s_proto = (SEGPTR)(p_base + (p_proto - p_to)); - p_to16->s_aliases = (SEGPTR)(p_base + (p_aliases - p_to)); - } - - return size; -} - -static HANDLE16 __ws_async_handle = 0xdead; - -/* Generic async query struct. we use symbolic names for the different queries - * for readability. - */ -typedef struct _async_query { - HWND16 hWnd; - UINT16 uMsg; - LPCSTR ptr1; -#define host_name ptr1 -#define host_addr ptr1 -#define serv_name ptr1 -#define proto_name ptr1 - LPCSTR ptr2; -#define serv_proto ptr2 - int int1; -#define host_len int1 -#define proto_number int1 -#define serv_port int1 - int int2; -#define host_type int2 - SEGPTR sbuf; - INT16 sbuflen; - - HANDLE16 async_handle; - int flags; - int qt; - char xbuf[1]; -} async_query; - - -/**************************************************************************** - * The async query function. - * - * It is either called as a thread startup routine or directly. It has - * to free the passed arg from the process heap and PostMessageA the async - * result or the error code. - * - * FIXME: - * - errorhandling not verified. - */ -static DWORD WINAPI _async_queryfun(LPVOID arg) { - async_query *aq = (async_query*)arg; - int size = 0; - WORD fail = 0; - char *targetptr = (HB_WIN32(aq)?(char*)aq->sbuf:(char*)MapSL(aq->sbuf)); - - switch (aq->flags & AQ_GETMASK) { - case AQ_GETHOST: { - struct hostent *he; - char *copy_hostent = targetptr; -#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6 - char *extrabuf; - int ebufsize=1024; - struct hostent hostentry; - int locerr = ENOBUFS; -#endif - char buf[100]; - if( !(aq->host_name)) { - aq->host_name = buf; - if( gethostname( buf, 100) == -1) { - fail = WSAENOBUFS; /* appropriate ? */ - break; - } - } -#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6 - he = NULL; - extrabuf=HeapAlloc(GetProcessHeap(),0,ebufsize) ; - while(extrabuf) { - int res = (aq->flags & AQ_NAME) ? - gethostbyname_r(aq->host_name, - &hostentry, extrabuf, ebufsize, &he, &locerr): - gethostbyaddr_r(aq->host_addr,aq->host_len,aq->host_type, - &hostentry, extrabuf, ebufsize, &he, &locerr); - if( res != ERANGE) break; - ebufsize *=2; - extrabuf=HeapReAlloc(GetProcessHeap(),0,extrabuf,ebufsize) ; - } - if (!he) fail = ((locerr < 0) ? wsaErrno() : wsaHerrno(locerr)); -#else - EnterCriticalSection( &csWSgetXXXbyYYY ); - he = (aq->flags & AQ_NAME) ? - gethostbyname(aq->host_name): - gethostbyaddr(aq->host_addr,aq->host_len,aq->host_type); - if (!he) fail = ((h_errno < 0) ? wsaErrno() : wsaHerrno(h_errno)); -#endif - if (he) { - size = WS_copy_he(copy_hostent,(char*)aq->sbuf,aq->sbuflen,he,aq->flags); - if (size < 0) { - fail = WSAENOBUFS; - size = -size; - } - } -#ifdef HAVE_LINUX_GETHOSTBYNAME_R_6 - HeapFree(GetProcessHeap(),0,extrabuf); -#else - LeaveCriticalSection( &csWSgetXXXbyYYY ); -#endif - } - break; - case AQ_GETPROTO: { -#if defined(HAVE_GETPROTOBYNAME) && defined(HAVE_GETPROTOBYNUMBER) - struct protoent *pe; - char *copy_protoent = targetptr; - EnterCriticalSection( &csWSgetXXXbyYYY ); - pe = (aq->flags & AQ_NAME)? - getprotobyname(aq->proto_name) : - getprotobynumber(aq->proto_number); - if (pe) { - size = WS_copy_pe(copy_protoent,(char*)aq->sbuf,aq->sbuflen,pe,aq->flags); - if (size < 0) { - fail = WSAENOBUFS; - size = -size; - } - } else { - if (aq->flags & AQ_NAME) - MESSAGE("protocol %s not found; You might want to add " - "this to /etc/protocols\n", debugstr_a(aq->proto_name) ); - else - MESSAGE("protocol number %d not found; You might want to add " - "this to /etc/protocols\n", aq->proto_number ); - fail = WSANO_DATA; - } - LeaveCriticalSection( &csWSgetXXXbyYYY ); -#else - fail = WSANO_DATA; -#endif - } - break; - case AQ_GETSERV: { - struct servent *se; - char *copy_servent = targetptr; - EnterCriticalSection( &csWSgetXXXbyYYY ); - se = (aq->flags & AQ_NAME)? - getservbyname(aq->serv_name,aq->serv_proto) : -#ifdef HAVE_GETSERVBYPORT - getservbyport(aq->serv_port,aq->serv_proto); -#else - NULL; -#endif - if (se) { - size = WS_copy_se(copy_servent,(char*)aq->sbuf,aq->sbuflen,se,aq->flags); - if (size < 0) { - fail = WSAENOBUFS; - size = -size; - } - } else { - if (aq->flags & AQ_NAME) - MESSAGE("service %s protocol %s not found; You might want to add " - "this to /etc/services\n", debugstr_a(aq->serv_name) , - aq->serv_proto ? debugstr_a(aq->serv_proto ):"*"); - else - MESSAGE("service on port %d protocol %s not found; You might want to add " - "this to /etc/services\n", aq->serv_port, - aq->serv_proto ? debugstr_a(aq->serv_proto ):"*"); - fail = WSANO_DATA; - } - LeaveCriticalSection( &csWSgetXXXbyYYY ); - } - break; - } - PostMessageA(HWND_32(aq->hWnd),aq->uMsg,(WPARAM) aq->async_handle,size|(fail<<16)); - HeapFree(GetProcessHeap(),0,arg); - return 0; -} - -/**************************************************************************** - * The main async help function. - * - * It either starts a thread or just calls the function directly for platforms - * with no thread support. This relies on the fact that PostMessage() does - * not actually call the windowproc before the function returns. - */ -static HANDLE16 __WSAsyncDBQuery( - HWND hWnd, UINT uMsg,INT int1,LPCSTR ptr1, INT int2, LPCSTR ptr2, - void *sbuf, INT sbuflen, UINT flags -) -{ - async_query* aq; - char* pto; - LPCSTR pfm; - int xbuflen = 0; - - /* allocate buffer to copy protocol- and service name to */ - /* note: this is done in the calling thread so we can return */ - /* a decent error code if the Alloc fails */ - - switch (flags & AQ_MASKPTR1) { - case 0: break; - case AQ_COPYPTR1: xbuflen += int1; break; - case AQ_DUPLOWPTR1: xbuflen += strlen(ptr1) + 1; break; - } - - switch (flags & AQ_MASKPTR2) { - case 0: break; - case AQ_COPYPTR2: xbuflen += int2; break; - case AQ_DUPLOWPTR2: xbuflen += strlen(ptr2) + 1; break; - } - - if(!(aq = HeapAlloc(GetProcessHeap(),0,sizeof(async_query) + xbuflen))) { - SetLastError(WSAEWOULDBLOCK); /* insufficient resources */ - return 0; - } - - pto = aq->xbuf; - if (ptr1) switch (flags & AQ_MASKPTR1) { - case 0: break; - case AQ_COPYPTR1: memcpy(pto, ptr1, int1); ptr1 = pto; pto += int1; break; - case AQ_DUPLOWPTR1: pfm = ptr1; ptr1 = pto; do *pto++ = tolower(*pfm); while (*pfm++); break; - } - if (ptr2) switch (flags & AQ_MASKPTR2) { - case 0: break; - case AQ_COPYPTR2: memcpy(pto, ptr2, int2); ptr2 = pto; pto += int2; break; - case AQ_DUPLOWPTR2: pfm = ptr2; ptr2 = pto; do *pto++ = tolower(*pfm); while (*pfm++); break; - } - - aq->hWnd = HWND_16(hWnd); - aq->uMsg = uMsg; - aq->int1 = int1; - aq->ptr1 = ptr1; - aq->int2 = int2; - aq->ptr2 = ptr2; - /* avoid async_handle = 0 */ - aq->async_handle = (++__ws_async_handle ? __ws_async_handle : ++__ws_async_handle); - aq->flags = flags; - aq->sbuf = (SEGPTR)sbuf; - aq->sbuflen = sbuflen; - -#if 1 - if (CreateThread(NULL,0,_async_queryfun,aq,0,NULL) == INVALID_HANDLE_VALUE) -#endif - _async_queryfun(aq); - return __ws_async_handle; -} - - -/*********************************************************************** - * WSAAsyncGetHostByAddr (WINSOCK.102) - */ -HANDLE16 WINAPI WSAAsyncGetHostByAddr16(HWND16 hWnd, UINT16 uMsg, LPCSTR addr, - INT16 len, INT16 type, SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %04x, addr %08x[%i]\n", - hWnd, uMsg, (unsigned)addr , len ); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,len,addr,type,NULL, - (void*)sbuf,buflen, - AQ_NUMBER|AQ_COPYPTR1|AQ_WIN16|AQ_GETHOST); -} - -/*********************************************************************** - * WSAAsyncGetHostByAddr (WS2_32.102) - */ -HANDLE WINAPI WSAAsyncGetHostByAddr(HWND hWnd, UINT uMsg, LPCSTR addr, - INT len, INT type, LPSTR sbuf, INT buflen) -{ - TRACE("hwnd %p, msg %04x, addr %08x[%i]\n", - hWnd, uMsg, (unsigned)addr , len ); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,len,addr,type,NULL,sbuf,buflen, - AQ_NUMBER|AQ_COPYPTR1|AQ_WIN32|AQ_GETHOST)); -} - -/*********************************************************************** - * WSAAsyncGetHostByName (WINSOCK.103) - */ -HANDLE16 WINAPI WSAAsyncGetHostByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name, - SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %04x, host %s, buffer %i\n", - hWnd, uMsg, (name)?name:"", (int)buflen ); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,0,name,0,NULL, - (void*)sbuf,buflen, - AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN16|AQ_GETHOST); -} - -/*********************************************************************** - * WSAAsyncGetHostByName (WS2_32.103) - */ -HANDLE WINAPI WSAAsyncGetHostByName(HWND hWnd, UINT uMsg, LPCSTR name, - LPSTR sbuf, INT buflen) -{ - TRACE("hwnd %p, msg %08x, host %s, buffer %i\n", - hWnd, uMsg, (name)?name:"", buflen ); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,0,name,0,NULL,sbuf,buflen, - AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN32|AQ_GETHOST)); -} - -/*********************************************************************** - * WSAAsyncGetProtoByName (WINSOCK.105) - */ -HANDLE16 WINAPI WSAAsyncGetProtoByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name, - SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %08x, protocol %s\n", - hWnd, uMsg, (name)?name:"" ); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,0,name,0,NULL, - (void*)sbuf,buflen, - AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN16|AQ_GETPROTO); -} - -/*********************************************************************** - * WSAAsyncGetProtoByName (WS2_32.105) - */ -HANDLE WINAPI WSAAsyncGetProtoByName(HWND hWnd, UINT uMsg, LPCSTR name, - LPSTR sbuf, INT buflen) -{ - TRACE("hwnd %p, msg %08x, protocol %s\n", - hWnd, uMsg, (name)?name:"" ); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,0,name,0,NULL,sbuf,buflen, - AQ_NAME|AQ_DUPLOWPTR1|AQ_WIN32|AQ_GETPROTO)); -} - - -/*********************************************************************** - * WSAAsyncGetProtoByNumber (WINSOCK.104) - */ -HANDLE16 WINAPI WSAAsyncGetProtoByNumber16(HWND16 hWnd,UINT16 uMsg,INT16 number, - SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %04x, num %i\n", hWnd, uMsg, number ); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,number,NULL,0,NULL, - (void*)sbuf,buflen, - AQ_GETPROTO|AQ_NUMBER|AQ_WIN16); -} - -/*********************************************************************** - * WSAAsyncGetProtoByNumber (WS2_32.104) - */ -HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND hWnd, UINT uMsg, INT number, - LPSTR sbuf, INT buflen) -{ - TRACE("hwnd %p, msg %04x, num %i\n", hWnd, uMsg, number ); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,number,NULL,0,NULL,sbuf,buflen, - AQ_GETPROTO|AQ_NUMBER|AQ_WIN32)); -} - -/*********************************************************************** - * WSAAsyncGetServByName (WINSOCK.107) - */ -HANDLE16 WINAPI WSAAsyncGetServByName16(HWND16 hWnd, UINT16 uMsg, LPCSTR name, - LPCSTR proto, SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %04x, name %s, proto %s\n", - hWnd, uMsg, (name)?name:"", (proto)?proto:""); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,0,name,0,proto, - (void*)sbuf,buflen, - AQ_GETSERV|AQ_NAME|AQ_DUPLOWPTR1|AQ_DUPLOWPTR2|AQ_WIN16); -} - -/*********************************************************************** - * WSAAsyncGetServByName (WS2_32.107) - */ -HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name, - LPCSTR proto, LPSTR sbuf, INT buflen) -{ - TRACE("hwnd %p, msg %04x, name %s, proto %s\n", - hWnd, uMsg, (name)?name:"", (proto)?proto:""); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,0,name,0,proto,sbuf,buflen, - AQ_GETSERV|AQ_NAME|AQ_DUPLOWPTR1|AQ_DUPLOWPTR2|AQ_WIN32)); -} - -/*********************************************************************** - * WSAAsyncGetServByPort (WINSOCK.106) - */ -HANDLE16 WINAPI WSAAsyncGetServByPort16(HWND16 hWnd, UINT16 uMsg, INT16 port, - LPCSTR proto, SEGPTR sbuf, INT16 buflen) -{ - TRACE("hwnd %04x, msg %04x, port %i, proto %s\n", - hWnd, uMsg, port, (proto)?proto:"" ); - return __WSAsyncDBQuery(HWND_32(hWnd),uMsg,port,NULL,0,proto, - (void*)sbuf,buflen, - AQ_GETSERV|AQ_NUMBER|AQ_DUPLOWPTR2|AQ_WIN16); -} - -/*********************************************************************** - * WSAAsyncGetServByPort (WS2_32.106) - */ -HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port, - LPCSTR proto, LPSTR sbuf, INT buflen) -{ - TRACE("hwnd %p, msg %04x, port %i, proto %s\n", - hWnd, uMsg, port, (proto)?proto:"" ); - return WSA_H32( __WSAsyncDBQuery(hWnd,uMsg,port,NULL,0,proto,sbuf,buflen, - AQ_GETSERV|AQ_NUMBER|AQ_DUPLOWPTR2|AQ_WIN32)); -} - -/*********************************************************************** - * WSACancelAsyncRequest (WS2_32.108) - */ -INT WINAPI WSACancelAsyncRequest(HANDLE hAsyncTaskHandle) -{ - FIXME("(%p),stub\n", hAsyncTaskHandle); - return 0; -} - -/*********************************************************************** - * WSACancelAsyncRequest (WINSOCK.108) - */ -INT16 WINAPI WSACancelAsyncRequest16(HANDLE16 hAsyncTaskHandle) -{ - return (INT16)WSACancelAsyncRequest(WSA_H32 (hAsyncTaskHandle)); -} - -/*********************************************************************** - * WSApSetPostRoutine (WS2_32.24) - */ -INT WINAPI WSApSetPostRoutine(LPWPUPOSTMESSAGE lpPostRoutine) -{ - FIXME("(%p), stub !\n", lpPostRoutine); - return 0; -} - -/*********************************************************************** - * (WS2_32.25) - */ -WSAEVENT WINAPI WPUCompleteOverlappedRequest(SOCKET s, LPWSAOVERLAPPED overlapped, - DWORD error, DWORD transferred, LPINT errcode) -{ - FIXME("(0x%08lx,%p,0x%08x,0x%08x,%p), stub !\n", s, overlapped, error, transferred, errcode); - - if (errcode) - *errcode = WSAEINVAL; - - return NULL; -} +/* Async WINSOCK DNS services + * + * Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka. + * Copyright (C) 1999 Marcus Meissner + * Copyright (C) 2009 Alexandre Julliard + * + * 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 + * + * NOTE: If you make any changes to fix a particular app, make sure + * they don't break something else like Netscape or telnet and ftp + * clients and servers (www.winsite.com got a lot of those). + * + * FIXME: + * - Add WSACancel* and correct handle management. (works rather well for + * now without it.) + * - Verify & Check all calls for correctness + * (currently only WSAGetHostByName*, WSAGetServByPort* calls) + * - Check error returns. + * - mirc/mirc32 Finger @linux.kernel.org sometimes fails in threaded mode. + * (not sure why) + * - This implementation did ignore the "NOTE:" section above (since the + * whole stuff did not work anyway to other changes). + */ + +#include "config.h" +#include "wine/port.h" + +#include +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winsock2.h" +#include "ws2spi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(winsock); + + +struct async_query_header +{ + HWND hWnd; + UINT uMsg; + void *sbuf; + INT sbuflen; + HANDLE handle; +}; + +struct async_query_gethostbyname +{ + struct async_query_header query; + char *host_name; +}; + +struct async_query_gethostbyaddr +{ + struct async_query_header query; + char *host_addr; + int host_len; + int host_type; +}; + +struct async_query_getprotobyname +{ + struct async_query_header query; + char *proto_name; +}; + +struct async_query_getprotobynumber +{ + struct async_query_header query; + int proto_number; +}; + +struct async_query_getservbyname +{ + struct async_query_header query; + char *serv_name; + char *serv_proto; +}; + +struct async_query_getservbyport +{ + struct async_query_header query; + char *serv_proto; + int serv_port; +}; + + +/* ----------------------------------- helper functions - */ + +static int list_size(char** l, int item_size) +{ + int i,j = 0; + if(l) + { for(i=0;l[i];i++) + j += (item_size) ? item_size : strlen(l[i]) + 1; + j += (i + 1) * sizeof(char*); } + return j; +} + +static int list_dup(char** l_src, char* ref, int item_size) +{ + char* p = ref; + char** l_to = (char**)ref; + int i,j,k; + + for(j=0;l_src[j];j++) ; + p += (j + 1) * sizeof(char*); + for(i=0;ihWnd, query->uMsg, (WPARAM)query->handle, lparam ); + HeapFree( GetProcessHeap(), 0, query ); + return 0; +} + +/* ----- hostent */ + +static LPARAM copy_he(void *base, int size, const struct WS_hostent *he) +{ + char *p; + int needed; + struct WS_hostent *to = base; + + if (!he) return MAKELPARAM( 0, GetLastError() ); + + needed = sizeof(struct WS_hostent) + strlen(he->h_name) + 1 + + list_size(he->h_aliases, 0) + + list_size(he->h_addr_list, he->h_length ); + if (size < needed) return MAKELPARAM( needed, WSAENOBUFS ); + + to->h_addrtype = he->h_addrtype; + to->h_length = he->h_length; + p = (char *)(to + 1); + to->h_name = p; + strcpy(p, he->h_name); p += strlen(p) + 1; + to->h_aliases = (char **)p; + p += list_dup(he->h_aliases, p, 0); + to->h_addr_list = (char **)p; + list_dup(he->h_addr_list, p, he->h_length); + return MAKELPARAM( needed, 0 ); +} + +static DWORD WINAPI async_gethostbyname(LPVOID arg) +{ + struct async_query_gethostbyname *aq = arg; + struct WS_hostent *he = WS_gethostbyname( aq->host_name ); + + return finish_query( &aq->query, copy_he( aq->query.sbuf, aq->query.sbuflen, he )); +} + +static DWORD WINAPI async_gethostbyaddr(LPVOID arg) +{ + struct async_query_gethostbyaddr *aq = arg; + struct WS_hostent *he = WS_gethostbyaddr( aq->host_addr, aq->host_len, aq->host_type ); + + return finish_query( &aq->query, copy_he( aq->query.sbuf, aq->query.sbuflen, he )); +} + +/* ----- protoent */ + +static LPARAM copy_pe(void *base, int size, const struct WS_protoent* pe) +{ + char *p; + int needed; + struct WS_protoent *to = base; + + if (!pe) return MAKELPARAM( 0, GetLastError() ); + + needed = sizeof(struct WS_protoent) + strlen(pe->p_name) + 1 + list_size(pe->p_aliases, 0); + if (size < needed) return MAKELPARAM( needed, WSAENOBUFS ); + + to->p_proto = pe->p_proto; + p = (char *)(to + 1); + to->p_name = p; + strcpy(p, pe->p_name); p += strlen(p) + 1; + to->p_aliases = (char **)p; + list_dup(pe->p_aliases, p, 0); + return MAKELPARAM( needed, 0 ); +} + +static DWORD WINAPI async_getprotobyname(LPVOID arg) +{ + struct async_query_getprotobyname *aq = arg; + struct WS_protoent *pe = WS_getprotobyname( aq->proto_name ); + + return finish_query( &aq->query, copy_pe( aq->query.sbuf, aq->query.sbuflen, pe )); +} + +static DWORD WINAPI async_getprotobynumber(LPVOID arg) +{ + struct async_query_getprotobynumber *aq = arg; + struct WS_protoent *pe = WS_getprotobynumber( aq->proto_number ); + + return finish_query( &aq->query, copy_pe( aq->query.sbuf, aq->query.sbuflen, pe )); +} + +/* ----- servent */ + +static LPARAM copy_se(void *base, int size, const struct WS_servent* se) +{ + char *p; + int needed; + struct WS_servent *to = base; + + if (!se) return MAKELPARAM( 0, GetLastError() ); + + needed = sizeof(struct WS_servent) + strlen(se->s_proto) + strlen(se->s_name) + 2 + list_size(se->s_aliases, 0); + if (size < needed) return MAKELPARAM( needed, WSAENOBUFS ); + + to->s_port = se->s_port; + p = (char *)(to + 1); + to->s_name = p; + strcpy(p, se->s_name); p += strlen(p) + 1; + to->s_proto = p; + strcpy(p, se->s_proto); p += strlen(p) + 1; + to->s_aliases = (char **)p; + list_dup(se->s_aliases, p, 0); + return MAKELPARAM( needed, 0 ); +} + +static DWORD WINAPI async_getservbyname(LPVOID arg) +{ + struct async_query_getservbyname *aq = arg; + struct WS_servent *se = WS_getservbyname( aq->serv_name, aq->serv_proto ); + + return finish_query( &aq->query, copy_se( aq->query.sbuf, aq->query.sbuflen, se )); +} + +static DWORD WINAPI async_getservbyport(LPVOID arg) +{ + struct async_query_getservbyport *aq = arg; + struct WS_servent *se = WS_getservbyport( aq->serv_port, aq->serv_proto ); + + return finish_query( &aq->query, copy_se( aq->query.sbuf, aq->query.sbuflen, se )); +} + + +/**************************************************************************** + * The main async help function. + * + * It either starts a thread or just calls the function directly for platforms + * with no thread support. This relies on the fact that PostMessage() does + * not actually call the windowproc before the function returns. + */ +static HANDLE run_query( HWND hWnd, UINT uMsg, LPTHREAD_START_ROUTINE func, + struct async_query_header *query, void *sbuf, INT sbuflen ) +{ + static LONG next_handle = 0xdead; + HANDLE thread; + ULONG handle = LOWORD( InterlockedIncrement( &next_handle )); + + /* avoid handle 0 */ + while (!handle) handle = LOWORD( InterlockedIncrement( &next_handle )); + + query->hWnd = hWnd; + query->uMsg = uMsg; + query->handle = UlongToHandle( handle ); + query->sbuf = sbuf; + query->sbuflen = sbuflen; + + thread = CreateThread( NULL, 0, func, query, 0, NULL ); + if (!thread) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + CloseHandle( thread ); + return UlongToHandle( handle ); +} + + +/*********************************************************************** + * WSAAsyncGetHostByAddr (WS2_32.102) + */ +HANDLE WINAPI WSAAsyncGetHostByAddr(HWND hWnd, UINT uMsg, LPCSTR addr, + INT len, INT type, LPSTR sbuf, INT buflen) +{ + struct async_query_gethostbyaddr *aq; + + TRACE("hwnd %p, msg %04x, addr %p[%i]\n", hWnd, uMsg, addr, len ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->host_addr = (char *)(aq + 1); + aq->host_len = len; + aq->host_type = type; + memcpy( aq->host_addr, addr, len ); + return run_query( hWnd, uMsg, async_gethostbyaddr, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSAAsyncGetHostByName (WS2_32.103) + */ +HANDLE WINAPI WSAAsyncGetHostByName(HWND hWnd, UINT uMsg, LPCSTR name, + LPSTR sbuf, INT buflen) +{ + struct async_query_gethostbyname *aq; + unsigned int len = strlen(name) + 1; + + TRACE("hwnd %p, msg %04x, host %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->host_name = (char *)(aq + 1); + strcpy( aq->host_name, name ); + return run_query( hWnd, uMsg, async_gethostbyname, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSAAsyncGetProtoByName (WS2_32.105) + */ +HANDLE WINAPI WSAAsyncGetProtoByName(HWND hWnd, UINT uMsg, LPCSTR name, + LPSTR sbuf, INT buflen) +{ + struct async_query_getprotobyname *aq; + unsigned int len = strlen(name) + 1; + + TRACE("hwnd %p, msg %04x, proto %s, buffer %i\n", hWnd, uMsg, debugstr_a(name), buflen ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->proto_name = (char *)(aq + 1); + strcpy( aq->proto_name, name ); + return run_query( hWnd, uMsg, async_getprotobyname, &aq->query, sbuf, buflen ); +} + + +/*********************************************************************** + * WSAAsyncGetProtoByNumber (WS2_32.104) + */ +HANDLE WINAPI WSAAsyncGetProtoByNumber(HWND hWnd, UINT uMsg, INT number, + LPSTR sbuf, INT buflen) +{ + struct async_query_getprotobynumber *aq; + + TRACE("hwnd %p, msg %04x, num %i\n", hWnd, uMsg, number ); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->proto_number = number; + return run_query( hWnd, uMsg, async_getprotobynumber, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSAAsyncGetServByName (WS2_32.107) + */ +HANDLE WINAPI WSAAsyncGetServByName(HWND hWnd, UINT uMsg, LPCSTR name, + LPCSTR proto, LPSTR sbuf, INT buflen) +{ + struct async_query_getservbyname *aq; + unsigned int len1 = strlen(name) + 1; + unsigned int len2 = strlen(proto) + 1; + + TRACE("hwnd %p, msg %04x, name %s, proto %s\n", hWnd, uMsg, debugstr_a(name), debugstr_a(proto)); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len1 + len2 ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->serv_name = (char *)(aq + 1); + aq->serv_proto = aq->serv_name + len1; + strcpy( aq->serv_name, name ); + strcpy( aq->serv_proto, proto ); + return run_query( hWnd, uMsg, async_getservbyname, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSAAsyncGetServByPort (WS2_32.106) + */ +HANDLE WINAPI WSAAsyncGetServByPort(HWND hWnd, UINT uMsg, INT port, + LPCSTR proto, LPSTR sbuf, INT buflen) +{ + struct async_query_getservbyport *aq; + unsigned int len = strlen(proto) + 1; + + TRACE("hwnd %p, msg %04x, port %i, proto %s\n", hWnd, uMsg, port, debugstr_a(proto)); + + if (!(aq = HeapAlloc( GetProcessHeap(), 0, sizeof(*aq) + len ))) + { + SetLastError( WSAEWOULDBLOCK ); + return 0; + } + aq->serv_proto = (char *)(aq + 1); + aq->serv_port = port; + strcpy( aq->serv_proto, proto ); + return run_query( hWnd, uMsg, async_getservbyport, &aq->query, sbuf, buflen ); +} + +/*********************************************************************** + * WSACancelAsyncRequest (WS2_32.108) + */ +INT WINAPI WSACancelAsyncRequest(HANDLE hAsyncTaskHandle) +{ + FIXME("(%p),stub\n", hAsyncTaskHandle); + return 0; +} + +/*********************************************************************** + * WSApSetPostRoutine (WS2_32.24) + */ +INT WINAPI WSApSetPostRoutine(LPWPUPOSTMESSAGE lpPostRoutine) +{ + FIXME("(%p), stub !\n", lpPostRoutine); + return 0; +} + +/*********************************************************************** + * WPUCompleteOverlappedRequest (WS2_32.25) + */ +WSAEVENT WINAPI WPUCompleteOverlappedRequest(SOCKET s, LPWSAOVERLAPPED overlapped, + DWORD error, DWORD transferred, LPINT errcode) +{ + FIXME("(0x%08lx,%p,0x%08x,0x%08x,%p), stub !\n", s, overlapped, error, transferred, errcode); + + if (errcode) + *errcode = WSAEINVAL; + + return NULL; +} diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index 4462a9ab93c..fdc7aec58e8 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -168,7 +168,14 @@ WINE_DEFAULT_DEBUG_CHANNEL(winsock); /* critical section to protect some non-reentrant net function */ -extern CRITICAL_SECTION csWSgetXXXbyYYY; +static CRITICAL_SECTION csWSgetXXXbyYYY; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &csWSgetXXXbyYYY, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": csWSgetXXXbyYYY") } +}; +static CRITICAL_SECTION csWSgetXXXbyYYY = { &critsect_debug, -1, 0, 0, 0, 0 }; union generic_unix_sockaddr { @@ -815,7 +822,6 @@ INT WINAPI WSACleanup(void) /*********************************************************************** - * WSAGetLastError (WINSOCK.111) * WSAGetLastError (WS2_32.111) */ INT WINAPI WSAGetLastError(void) @@ -2137,7 +2143,6 @@ INT WINAPI WS_getsockopt(SOCKET s, INT level, } /*********************************************************************** - * htonl (WINSOCK.8) * htonl (WS2_32.8) */ WS_u_long WINAPI WS_htonl(WS_u_long hostlong) @@ -2147,7 +2152,6 @@ WS_u_long WINAPI WS_htonl(WS_u_long hostlong) /*********************************************************************** - * htons (WINSOCK.9) * htons (WS2_32.9) */ WS_u_short WINAPI WS_htons(WS_u_short hostshort) @@ -2194,7 +2198,6 @@ int WINAPI WSAHtons(SOCKET s, WS_u_short hostshort, WS_u_short *lpnetshort) /*********************************************************************** - * inet_addr (WINSOCK.10) * inet_addr (WS2_32.11) */ WS_u_long WINAPI WS_inet_addr(const char *cp) @@ -2205,7 +2208,6 @@ WS_u_long WINAPI WS_inet_addr(const char *cp) /*********************************************************************** - * ntohl (WINSOCK.14) * ntohl (WS2_32.14) */ WS_u_long WINAPI WS_ntohl(WS_u_long netlong) @@ -2215,7 +2217,6 @@ WS_u_long WINAPI WS_ntohl(WS_u_long netlong) /*********************************************************************** - * ntohs (WINSOCK.15) * ntohs (WS2_32.15) */ WS_u_short WINAPI WS_ntohs(WS_u_short netshort) @@ -4245,7 +4246,6 @@ int WINAPI __WSAFDIsSet(SOCKET s, WS_fd_set *set) } /*********************************************************************** - * WSAIsBlocking (WINSOCK.114) * WSAIsBlocking (WS2_32.114) */ BOOL WINAPI WSAIsBlocking(void) @@ -4263,7 +4263,6 @@ BOOL WINAPI WSAIsBlocking(void) } /*********************************************************************** - * WSACancelBlockingCall (WINSOCK.113) * WSACancelBlockingCall (WS2_32.113) */ INT WINAPI WSACancelBlockingCall(void) diff --git a/dlls/ws2_32/socket16.c b/dlls/ws2_32/socket16.c deleted file mode 100644 index 3cd500fe4a7..00000000000 --- a/dlls/ws2_32/socket16.c +++ /dev/null @@ -1,605 +0,0 @@ -/* - * 16-bit socket functions - * - * Copyright (C) 1993,1994,1996,1997 John Brezak, Erik Bos, Alex Korobka - * Copyright (C) 2003 Alexandre Julliard - * - * 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 "config.h" -#include "wine/port.h" - -#include "winsock2.h" -#include "wine/winbase16.h" -#include "wine/winsock16.h" -#include "wownt32.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(winsock); - -static INT num_startup; /* reference counter */ -static void *he_buffer; -static SEGPTR he_buffer_seg; -static void *se_buffer; -static SEGPTR se_buffer_seg; -static void *pe_buffer; -static SEGPTR pe_buffer_seg; -static SEGPTR dbuffer_seg; - -extern int WINAPI WS_gethostname(char *name, int namelen); - -static WS_fd_set *ws_fdset_16_to_32( const ws_fd_set16 *set16, WS_fd_set *set32 ) -{ - UINT i; - set32->fd_count = set16->fd_count; - for (i = 0; i < set32->fd_count; i++) set32->fd_array[i] = set16->fd_array[i]; - return set32; -} - -static ws_fd_set16 *ws_fdset_32_to_16( const WS_fd_set *set32, ws_fd_set16 *set16 ) -{ - UINT i; - set16->fd_count = set32->fd_count; - for (i = 0; i < set16->fd_count; i++) set16->fd_array[i] = set32->fd_array[i]; - return set16; -} - -static int list_size(char** l, int item_size) -{ - int i,j = 0; - if(l) - { - for(i=0;l[i];i++) - j += (item_size) ? item_size : strlen(l[i]) + 1; - j += (i + 1) * sizeof(char*); - } - return j; -} - -static int list_dup(char** l_src, SEGPTR base, int item_size) -{ - int i, offset; - char *ref = MapSL(base); - SEGPTR *l_to = (SEGPTR *)ref; - - for (i = 0; l_src[i]; i++) ; - offset = (i + 1) * sizeof(char*); - for (i = 0; l_src[i]; i++) - { - int count = item_size ? item_size : strlen(l_src[i]) + 1; - memcpy( ref + offset, l_src[i], count ); - l_to[i] = base + offset; - offset += count; - } - l_to[i] = 0; - return offset; -} - -static SEGPTR get_buffer_he(int size) -{ - static int he_len; - if (he_buffer) - { - if (he_len >= size ) return he_buffer_seg; - UnMapLS( he_buffer_seg ); - HeapFree( GetProcessHeap(), 0, he_buffer ); - } - he_buffer = HeapAlloc( GetProcessHeap(), 0, (he_len = size) ); - he_buffer_seg = MapLS( he_buffer ); - return he_buffer_seg; -} - -static SEGPTR get_buffer_se(int size) -{ - static int se_len; - if (se_buffer) - { - if (se_len >= size ) return se_buffer_seg; - UnMapLS( se_buffer_seg ); - HeapFree( GetProcessHeap(), 0, se_buffer ); - } - se_buffer = HeapAlloc( GetProcessHeap(), 0, (se_len = size) ); - se_buffer_seg = MapLS( se_buffer ); - return se_buffer_seg; -} - -static SEGPTR get_buffer_pe(int size) -{ - static int pe_len; - if (pe_buffer) - { - if (pe_len >= size ) return pe_buffer_seg; - UnMapLS( pe_buffer_seg ); - HeapFree( GetProcessHeap(), 0, pe_buffer ); - } - pe_buffer = HeapAlloc( GetProcessHeap(), 0, (pe_len = size) ); - pe_buffer_seg = MapLS( pe_buffer ); - return pe_buffer_seg; -} - -/* duplicate hostent entry - * and handle all Win16/Win32 dependent things (struct size, ...) *correctly*. - * Ditto for protoent and servent. - */ -static SEGPTR ws_hostent_32_to_16( const struct WS_hostent* he ) -{ - char *p; - SEGPTR base; - struct ws_hostent16 *p_to; - - int size = (sizeof(*he) + - strlen(he->h_name) + 1 + - list_size(he->h_aliases, 0) + - list_size(he->h_addr_list, he->h_length)); - - base = get_buffer_he(size); - p_to = MapSL(base); - - p_to->h_addrtype = he->h_addrtype; - p_to->h_length = he->h_length; - - p = (char *)(p_to + 1); - p_to->h_name = base + (p - (char *)p_to); - strcpy(p, he->h_name); - p += strlen(p) + 1; - - p_to->h_aliases = base + (p - (char *)p_to); - p += list_dup(he->h_aliases, p_to->h_aliases, 0); - - p_to->h_addr_list = base + (p - (char *)p_to); - list_dup(he->h_addr_list, p_to->h_addr_list, he->h_length); - - return base; -} - -static SEGPTR ws_protoent_32_to_16( const struct WS_protoent *pe ) -{ - char *p; - SEGPTR base; - struct ws_protoent16 *p_to; - - int size = (sizeof(*pe) + - strlen(pe->p_name) + 1 + - list_size(pe->p_aliases, 0)); - - base = get_buffer_pe(size); - p_to = MapSL(base); - - p_to->p_proto = pe->p_proto; - p = (char *)(p_to + 1); - - p_to->p_name = base + (p - (char *)p_to); - strcpy(p, pe->p_name); - p += strlen(p) + 1; - - p_to->p_aliases = base + (p - (char *)p_to); - list_dup(pe->p_aliases, p_to->p_aliases, 0); - - return base; -} - -static SEGPTR ws_servent_32_to_16( const struct WS_servent *se ) -{ - char *p; - SEGPTR base; - struct ws_servent16 *p_to; - - int size = (sizeof(*se) + - strlen(se->s_proto) + 1 + - strlen(se->s_name) + 1 + - list_size(se->s_aliases, 0)); - - base = get_buffer_se(size); - p_to = MapSL(base); - - p_to->s_port = se->s_port; - p = (char *)(p_to + 1); - - p_to->s_name = base + (p - (char *)p_to); - strcpy(p, se->s_name); - p += strlen(p) + 1; - - p_to->s_proto = base + (p - (char *)p_to); - strcpy(p, se->s_proto); - p += strlen(p) + 1; - - p_to->s_aliases = base + (p - (char *)p_to); - list_dup(se->s_aliases, p_to->s_aliases, 0); - - return base; -} - - -/*********************************************************************** - * accept (WINSOCK.1) - */ -SOCKET16 WINAPI accept16(SOCKET16 s, struct WS_sockaddr* addr, INT16* addrlen16 ) -{ - INT addrlen32 = addrlen16 ? *addrlen16 : 0; - SOCKET retSocket = WS_accept( s, addr, &addrlen32 ); - if( addrlen16 ) *addrlen16 = addrlen32; - return retSocket; -} - -/*********************************************************************** - * bind (WINSOCK.2) - */ -INT16 WINAPI bind16(SOCKET16 s, struct WS_sockaddr *name, INT16 namelen) -{ - return WS_bind( s, name, namelen ); -} - -/*********************************************************************** - * closesocket (WINSOCK.3) - */ -INT16 WINAPI closesocket16(SOCKET16 s) -{ - return WS_closesocket(s); -} - -/*********************************************************************** - * connect (WINSOCK.4) - */ -INT16 WINAPI connect16(SOCKET16 s, struct WS_sockaddr *name, INT16 namelen) -{ - return WS_connect( s, name, namelen ); -} - -/*********************************************************************** - * getpeername (WINSOCK.5) - */ -INT16 WINAPI getpeername16(SOCKET16 s, struct WS_sockaddr *name, INT16 *namelen16) -{ - INT namelen32 = *namelen16; - INT retVal = WS_getpeername( s, name, &namelen32 ); - *namelen16 = namelen32; - return retVal; -} - -/*********************************************************************** - * getsockname (WINSOCK.6) - */ -INT16 WINAPI getsockname16(SOCKET16 s, struct WS_sockaddr *name, INT16 *namelen16) -{ - INT retVal; - - if( namelen16 ) - { - INT namelen32 = *namelen16; - retVal = WS_getsockname( s, name, &namelen32 ); - *namelen16 = namelen32; - } - else retVal = SOCKET_ERROR; - return retVal; -} - -/*********************************************************************** - * getsockopt (WINSOCK.7) - */ -INT16 WINAPI getsockopt16(SOCKET16 s, INT16 level, INT16 optname, char *optval, INT16 *optlen) -{ - INT optlen32; - INT *p = &optlen32; - INT retVal; - - if( optlen ) optlen32 = *optlen; else p = NULL; - retVal = WS_getsockopt( s, (WORD)level, optname, optval, p ); - if( optlen ) *optlen = optlen32; - return retVal; -} - -/*********************************************************************** - * inet_ntoa (WINSOCK.11) - */ -SEGPTR WINAPI inet_ntoa16(struct WS_in_addr in) -{ - char* retVal; - if (!(retVal = WS_inet_ntoa( in ))) return 0; - if (!dbuffer_seg) dbuffer_seg = MapLS( retVal ); - return dbuffer_seg; -} - -/*********************************************************************** - * ioctlsocket (WINSOCK.12) - */ -INT16 WINAPI ioctlsocket16(SOCKET16 s, LONG cmd, ULONG *argp) -{ - return WS_ioctlsocket( s, cmd, argp ); -} - -/*********************************************************************** - * listen (WINSOCK.13) - */ -INT16 WINAPI listen16(SOCKET16 s, INT16 backlog) -{ - return WS_listen( s, backlog ); -} - -/*********************************************************************** - * recv (WINSOCK.16) - */ -INT16 WINAPI recv16(SOCKET16 s, char *buf, INT16 len, INT16 flags) -{ - return WS_recv( s, buf, len, flags ); -} - -/*********************************************************************** - * recvfrom (WINSOCK.17) - */ -INT16 WINAPI recvfrom16(SOCKET16 s, char *buf, INT16 len, INT16 flags, - struct WS_sockaddr *from, INT16 *fromlen16) -{ - if (fromlen16) - { - INT fromlen32 = *fromlen16; - INT retVal = WS_recvfrom( s, buf, len, flags, from, &fromlen32 ); - *fromlen16 = fromlen32; - return retVal; - } - else return WS_recvfrom( s, buf, len, flags, from, NULL ); -} - -/*********************************************************************** - * select (WINSOCK.18) - */ -INT16 WINAPI select16(INT16 nfds, ws_fd_set16 *ws_readfds, - ws_fd_set16 *ws_writefds, ws_fd_set16 *ws_exceptfds, - struct WS_timeval* timeout) -{ - WS_fd_set read_set, write_set, except_set; - WS_fd_set *pread_set = NULL, *pwrite_set = NULL, *pexcept_set = NULL; - int ret; - - if (ws_readfds) pread_set = ws_fdset_16_to_32( ws_readfds, &read_set ); - if (ws_writefds) pwrite_set = ws_fdset_16_to_32( ws_writefds, &write_set ); - if (ws_exceptfds) pexcept_set = ws_fdset_16_to_32( ws_exceptfds, &except_set ); - /* struct timeval is the same for both 32- and 16-bit code */ - ret = WS_select( nfds, pread_set, pwrite_set, pexcept_set, timeout ); - if (ws_readfds) ws_fdset_32_to_16( &read_set, ws_readfds ); - if (ws_writefds) ws_fdset_32_to_16( &write_set, ws_writefds ); - if (ws_exceptfds) ws_fdset_32_to_16( &except_set, ws_exceptfds ); - return ret; -} - -/*********************************************************************** - * send (WINSOCK.19) - */ -INT16 WINAPI send16(SOCKET16 s, char *buf, INT16 len, INT16 flags) -{ - return WS_send( s, buf, len, flags ); -} - -/*********************************************************************** - * sendto (WINSOCK.20) - */ -INT16 WINAPI sendto16(SOCKET16 s, char *buf, INT16 len, INT16 flags, - struct WS_sockaddr *to, INT16 tolen) -{ - return WS_sendto( s, buf, len, flags, to, tolen ); -} - -/*********************************************************************** - * setsockopt (WINSOCK.21) - */ -INT16 WINAPI setsockopt16(SOCKET16 s, INT16 level, INT16 optname, - char *optval, INT16 optlen) -{ - if( !optval ) return SOCKET_ERROR; - return WS_setsockopt( s, (WORD)level, optname, optval, optlen ); -} - -/*********************************************************************** - * shutdown (WINSOCK.22) - */ -INT16 WINAPI shutdown16(SOCKET16 s, INT16 how) -{ - return WS_shutdown( s, how ); -} - -/*********************************************************************** - * socket (WINSOCK.23) - */ -SOCKET16 WINAPI socket16(INT16 af, INT16 type, INT16 protocol) -{ - return WS_socket( af, type, protocol ); -} - -/*********************************************************************** - * gethostbyaddr (WINSOCK.51) - */ -SEGPTR WINAPI gethostbyaddr16(const char *addr, INT16 len, INT16 type) -{ - struct WS_hostent *he; - - if (!(he = WS_gethostbyaddr( addr, len, type ))) return 0; - return ws_hostent_32_to_16( he ); -} - -/*********************************************************************** - * gethostbyname (WINSOCK.52) - */ -SEGPTR WINAPI gethostbyname16(const char *name) -{ - struct WS_hostent *he; - - if (!(he = WS_gethostbyname( name ))) return 0; - return ws_hostent_32_to_16( he ); -} - -/*********************************************************************** - * getprotobyname (WINSOCK.53) - */ -SEGPTR WINAPI getprotobyname16(const char *name) -{ - struct WS_protoent *pe; - - if (!(pe = WS_getprotobyname( name ))) return 0; - return ws_protoent_32_to_16( pe ); -} - -/*********************************************************************** - * getprotobynumber (WINSOCK.54) - */ -SEGPTR WINAPI getprotobynumber16(INT16 number) -{ - struct WS_protoent *pe; - - if (!(pe = WS_getprotobynumber( number ))) return 0; - return ws_protoent_32_to_16( pe ); -} - -/*********************************************************************** - * getservbyname (WINSOCK.55) - */ -SEGPTR WINAPI getservbyname16(const char *name, const char *proto) -{ - struct WS_servent *se; - - if (!(se = WS_getservbyname( name, proto ))) return 0; - return ws_servent_32_to_16( se ); -} - -/*********************************************************************** - * getservbyport (WINSOCK.56) - */ -SEGPTR WINAPI getservbyport16(INT16 port, const char *proto) -{ - struct WS_servent *se; - - if (!(se = WS_getservbyport( port, proto ))) return 0; - return ws_servent_32_to_16( se ); -} - -/*********************************************************************** - * gethostname (WINSOCK.57) - */ -INT16 WINAPI gethostname16(char *name, INT16 namelen) -{ - return WS_gethostname(name, namelen); -} - -/*********************************************************************** - * WSAAsyncSelect (WINSOCK.101) - */ -INT16 WINAPI WSAAsyncSelect16(SOCKET16 s, HWND16 hWnd, UINT16 wMsg, LONG lEvent) -{ - return WSAAsyncSelect( s, HWND_32(hWnd), wMsg, lEvent ); -} - -/*********************************************************************** - * WSASetBlockingHook (WINSOCK.109) - */ -FARPROC16 WINAPI WSASetBlockingHook16(FARPROC16 lpBlockFunc) -{ - /* FIXME: should deal with 16-bit proc */ - return (FARPROC16)WSASetBlockingHook( (FARPROC)lpBlockFunc ); -} - -/*********************************************************************** - * WSAUnhookBlockingHook (WINSOCK.110) - */ -INT16 WINAPI WSAUnhookBlockingHook16(void) -{ - return WSAUnhookBlockingHook(); -} - -/*********************************************************************** - * WSASetLastError (WINSOCK.112) - */ -void WINAPI WSASetLastError16(INT16 iError) -{ - WSASetLastError(iError); -} - -/*********************************************************************** - * WSAStartup (WINSOCK.115) - * - * Create socket control struct, attach it to the global list and - * update a pointer in the task struct. - */ -INT16 WINAPI WSAStartup16(UINT16 wVersionRequested, LPWSADATA16 lpWSAData) -{ - WSADATA data; - INT ret = WSAStartup( wVersionRequested, &data ); - - if (!ret) - { - lpWSAData->wVersion = 0x0101; - lpWSAData->wHighVersion = 0x0101; - strcpy( lpWSAData->szDescription, data.szDescription ); - strcpy( lpWSAData->szSystemStatus, data.szSystemStatus ); - lpWSAData->iMaxSockets = data.iMaxSockets; - lpWSAData->iMaxUdpDg = data.iMaxUdpDg; - lpWSAData->lpVendorInfo = 0; - num_startup++; - } - return ret; -} - -/*********************************************************************** - * WSACleanup (WINSOCK.116) - */ -INT WINAPI WSACleanup16(void) -{ - if (num_startup) - { - if (!--num_startup) - { - /* delete scratch buffers */ - UnMapLS( he_buffer_seg ); - UnMapLS( se_buffer_seg ); - UnMapLS( pe_buffer_seg ); - UnMapLS( dbuffer_seg ); - he_buffer_seg = 0; - se_buffer_seg = 0; - pe_buffer_seg = 0; - dbuffer_seg = 0; - HeapFree( GetProcessHeap(), 0, he_buffer ); - HeapFree( GetProcessHeap(), 0, se_buffer ); - HeapFree( GetProcessHeap(), 0, pe_buffer ); - he_buffer = NULL; - se_buffer = NULL; - pe_buffer = NULL; - } - } - return WSACleanup(); -} - - -/*********************************************************************** - * __WSAFDIsSet (WINSOCK.151) - */ -INT16 WINAPI __WSAFDIsSet16(SOCKET16 s, ws_fd_set16 *set) -{ - int i = set->fd_count; - - TRACE("(%d,%p(%i))\n", s, set, i); - - while (i--) - if (set->fd_array[i] == s) return 1; - return 0; -} - -/*********************************************************************** - * WSARecvEx (WINSOCK.1107) - * - * See description for WSARecvEx() - */ -INT16 WINAPI WSARecvEx16(SOCKET16 s, char *buf, INT16 len, INT16 *flags) -{ - FIXME("(WSARecvEx16) partial packet return value not set\n"); - return recv16(s, buf, len, *flags); -} diff --git a/include/commctrl.h b/include/commctrl.h index ae417c07e4d..6a42e2e5110 100644 --- a/include/commctrl.h +++ b/include/commctrl.h @@ -4702,8 +4702,15 @@ typedef struct { POINT pt; UINT uHit; SYSTEMTIME st; + /* Vista */ + RECT rc; + INT iOffset; + INT iRow; + INT iCol; } MCHITTESTINFO, *PMCHITTESTINFO; +#define MCHITTESTINFO_V1_SIZE CCSIZEOF_STRUCT(MCHITTESTINFO, st) + typedef struct tagNMSELCHANGE { NMHDR nmhdr; diff --git a/include/config.h.in b/include/config.h.in index d4bbce64070..0be8f4dde28 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -645,6 +645,9 @@ /* Define to 1 if you have the header file. */ #undef HAVE_SCHED_H +/* Define to 1 if you have the `sched_setaffinity' function. */ +#undef HAVE_SCHED_SETAFFINITY + /* Define to 1 if you have the `sched_yield' function. */ #undef HAVE_SCHED_YIELD diff --git a/include/d3d10shader.h b/include/d3d10shader.h index 4033c9b2708..59221cc217b 100644 --- a/include/d3d10shader.h +++ b/include/d3d10shader.h @@ -82,6 +82,12 @@ typedef enum _D3D10_SHADER_VARIABLE_TYPE D3D10_SVT_FORCE_DWORD = 0x7fffffff } D3D10_SHADER_VARIABLE_TYPE, *LPD3D10_SHADER_VARIABLE_TYPE; +typedef enum D3D10_CBUFFER_TYPE +{ + D3D10_CT_CBUFFER = 0, + D3D10_CT_TBUFFER = 1 +} D3D10_CBUFFER_TYPE, *LPD3D10_CBUFFER_TYPE; + typedef enum D3D10_NAME { D3D10_NAME_UNDEFINED = 0, diff --git a/include/ddk/winsplp.h b/include/ddk/winsplp.h index 4dfdb5b834e..c532be901f7 100644 --- a/include/ddk/winsplp.h +++ b/include/ddk/winsplp.h @@ -280,8 +280,7 @@ typedef struct _PRINTPROVIDOR { HANDLE (WINAPI *fpFindFirstPrinterChangeNotification)(HANDLE hPrinter, DWORD fdwFlags, DWORD fdwOptions, LPVOID pPrinterNotifyOptions); BOOL (WINAPI *fpFindClosePrinterChangeNotification)(HANDLE hChange); - BOOL (WINAPI *fpAddPortEx)(HANDLE hMonitor, LPWSTR pName, DWORD Level, - LPBYTE lpBuffer, LPWSTR lpMonitorName); + BOOL (WINAPI *fpAddPortEx)(LPWSTR, DWORD, LPBYTE, LPWSTR); BOOL (WINAPI *fpShutDown)(LPVOID pvReserved); BOOL (WINAPI *fpRefreshPrinterChangeNotification)(HANDLE hPrinter, DWORD Reserved, PVOID pvReserved, PVOID pPrinterNotifyInfo); diff --git a/include/mapidefs.h b/include/mapidefs.h index 27444275137..f06c61f63d2 100644 --- a/include/mapidefs.h +++ b/include/mapidefs.h @@ -1,5 +1,6 @@ /* * Copyright (C) 1998 Justin Bradford + * Copyright (c) 2009 Owen Rudge for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -83,25 +84,19 @@ typedef struct IAddrBook IAddrBook; typedef IAddrBook *LPADRBOOK; typedef struct IABContainer IABContainer; typedef IABContainer *LPABCONT; -typedef struct IAttach IAttach; -typedef IAttach *LPATTACH; +typedef struct IAttach *LPATTACH; typedef struct IDistList IDistList; typedef IDistList *LPDISTLIST; typedef struct IMailUser IMailUser; typedef IMailUser *LPMAILUSER; typedef struct IMAPIAdviseSink *LPMAPIADVISESINK; -typedef struct IMAPIContainer IMAPIContainer; -typedef IMAPIContainer *LPMAPICONTAINER; -typedef struct IMAPIFolder IMAPIFolder; -typedef IMAPIFolder *LPMAPIFOLDER; +typedef struct IMAPIContainer *LPMAPICONTAINER; +typedef struct IMAPIFolder *LPMAPIFOLDER; typedef struct IMAPIProgress IMAPIProgress; typedef IMAPIProgress *LPMAPIPROGRESS; typedef struct IMAPIStatus IMAPIStatus; typedef IMAPIStatus *LPMAPISTATUS; -typedef struct IMessage IMessage; -typedef IMessage *LPMESSAGE; -typedef struct IMsgStore IMsgStore; -typedef IMsgStore *LPMDB; +typedef struct IMessage *LPMESSAGE; typedef struct IProfSect IProfSect; typedef IProfSect *LPPROFSECT; typedef struct IProviderAdmin IProviderAdmin; @@ -156,12 +151,14 @@ typedef struct _MAPIUID /* Flags for various calls */ #define MAPI_MODIFY 0x00000001U /* Object can be modified */ +#define MAPI_CREATE 0x00000002U /* Object can be created */ #define MAPI_ACCESS_MODIFY MAPI_MODIFY /* Want write access */ #define MAPI_ACCESS_READ 0x00000002U /* Want read access */ #define MAPI_ACCESS_DELETE 0x00000004U /* Want delete access */ #define MAPI_ACCESS_CREATE_HIERARCHY 0x00000008U #define MAPI_ACCESS_CREATE_CONTENTS 0x00000010U #define MAPI_ACCESS_CREATE_ASSOCIATED 0x00000020U +#define MAPI_USE_DEFAULT 0x00000040U #define MAPI_UNICODE 0x80000000U /* Strings in this call are Unicode */ #if defined (UNICODE) || defined (__WINESRC__) @@ -170,6 +167,9 @@ typedef struct _MAPIUID #define fMapiUnicode 0U #endif +/* IMAPISession::OpenMessageStore() flags */ +#define MDB_NO_DIALOG 0x00000001 + /* Types of message receivers */ #ifndef MAPI_ORIG #define MAPI_ORIG 0 /* The original author */ @@ -761,6 +761,9 @@ typedef struct _NOTIFICATION typedef LONG (WINAPI NOTIFCALLBACK)(LPVOID,ULONG,LPNOTIFICATION); typedef NOTIFCALLBACK *LPNOTIFCALLBACK; +/* IMAPIContainer::OpenEntry flags */ +#define MAPI_BEST_ACCESS 0x00000010 + /***************************************************************************** * IMAPITable interface * @@ -895,21 +898,263 @@ DECLARE_INTERFACE_(IMAPIProp,IUnknown) #define IMAPIProp_AddRef(p) (p)->lpVtbl->AddRef(p) #define IMAPIProp_Release(p) (p)->lpVtbl->Release(p) /*** IMAPIProp methods ***/ -#define IMAPIProp_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) -#define IMAPIProp_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) -#define IMAPIProp_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) -#define IMAPIProp_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) -#define IMAPIProp_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) -#define IMAPIProp_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) -#define IMAPIProp_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) -#define IMAPIProp_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) -#define IMAPIProp_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) -#define IMAPIProp_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) -#define IMAPIProp_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) +#define IMAPIProp_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IMAPIProp_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IMAPIProp_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IMAPIProp_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IMAPIProp_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IMAPIProp_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IMAPIProp_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IMAPIProp_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IMAPIProp_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IMAPIProp_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IMAPIProp_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) #endif typedef IMAPIProp *LPMAPIPROP; +#define KEEP_OPEN_READONLY (0x00000001U) +#define KEEP_OPEN_READWRITE (0x00000002U) +#define FORCE_SAVE (0x00000004U) + +/***************************************************************************** + * IMsgStore interface + */ +#define INTERFACE IMsgStore +DECLARE_INTERFACE_(IMsgStore,IMAPIProp) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMAPIProp methods ***/ + STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; + STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; + STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE; + STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, + LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, + LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; + STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) PURE; + STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE; + /*** IMsgStore methods ***/ + STDMETHOD(Advise)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulEventMask, LPMAPIADVISESINK lpAdviseSink, + ULONG * lpulConnection) PURE; + STDMETHOD(Unadvise)(THIS_ ULONG ulConnection) PURE; + STDMETHOD(CompareEntryIDs)(THIS_ ULONG cbEntryID1, LPENTRYID lpEntryID1, ULONG cbEntryID2, LPENTRYID lpEntryID2, + ULONG ulFlags, ULONG * lpulResult) PURE; + STDMETHOD(OpenEntry)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, ULONG *lpulObjType, + LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetReceiveFolder)(THIS_ LPSTR lpszMessageClass, ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID) PURE; + STDMETHOD(GetReceiveFolder)(THIS_ LPSTR lpszMessageClass, ULONG ulFlags, ULONG * lpcbEntryID, LPENTRYID *lppEntryID, + LPSTR *lppszExplicitClass) PURE; + STDMETHOD(GetReceiveFolderTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(StoreLogoff)(THIS_ ULONG * lpulFlags) PURE; + STDMETHOD(AbortSubmit)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulFlags) PURE; + STDMETHOD(GetOutgoingQueue)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(SetLockState)(THIS_ LPMESSAGE lpMessage, ULONG ulLockState) PURE; + STDMETHOD(FinishedMsg)(THIS_ ULONG ulFlags, ULONG cbEntryID, LPENTRYID lpEntryID) PURE; + STDMETHOD(NotifyNewMail)(THIS_ LPNOTIFICATION lpNotification) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) + /*** IUnknown methods ***/ +#define IMsgStore_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IMsgStore_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IMsgStore_Release(p) (p)->lpVtbl->Release(p) + /*** IMAPIProp methods ***/ +#define IMsgStore_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IMsgStore_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IMsgStore_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IMsgStore_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IMsgStore_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IMsgStore_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IMsgStore_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IMsgStore_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IMsgStore_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IMsgStore_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IMsgStore_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) + /*** IMsgStore methods ***/ +#define IMsgStore_Advise(p,a,b,c,d,e) (p)->lpVtbl->Advise(p,a,b,c,d,e) +#define IMsgStore_Unadvise(p,a) (p)->lpVtbl->Unadvise(p,a) +#define IMsgStore_CompareEntryIDs(p,a,b,c,d,e,f) (p)->lpVtbl->CompareEntryIDs(p,a,b,c,d,e,f) +#define IMsgStore_OpenEntry(p,a,b,c,d,e,f) (p)->lpVtbl->OpenEntry(p,a,b,c,d,e,f) +#define IMsgStore_SetReceiveFolder(p,a,b,c,d) (p)->lpVtbl->SetReceiveFolder(p,a,b,c,d) +#define IMsgStore_GetReceiveFolder(p,a,b,c,d,e) (p)->lpVtbl->GetReceiveFolder(p,a,b,c,d,e) +#define IMsgStore_GetReceiveFolderTable(p,a,b) (p)->lpVtbl->GetReceiveFolderTable(p,a,b) +#define IMsgStore_StoreLogoff(p,a) (p)->lpVtbl->StoreLogoff(p,a) +#define IMsgStore_AbortSubmit(p,a,b,c) (p)->lpVtbl->AbortSubmit(p,a,b,c) +#define IMsgStore_GetOutgoingQueue(p,a,b) (p)->lpVtbl->GetOutgoingQueue(p,a,b) +#define IMsgStore_SetLockState(p,a,b) (p)->lpVtbl->SetLockState(p,a,b) +#define IMsgStore_FinishedMsg(p,a,b,c) (p)->lpVtbl->FinishedMsg(p,a,b,c) +#define IMsgStore_NotifyNewMail(p,a) (p)->lpVtbl->NotifyNewMail(p,a) + +#endif + +typedef IMsgStore *LPMDB; + +/***************************************************************************** + * IMAPIContainer interface + */ +#define INTERFACE IMAPIContainer +DECLARE_INTERFACE_(IMAPIContainer,IMAPIProp) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMAPIProp methods ***/ + STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; + STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; + STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE; + STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, + LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, + LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; + STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) PURE; + STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE; + /*** IMAPIContainer methods ***/ + STDMETHOD(GetContentsTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(GetHierarchyTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(OpenEntry)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, + ULONG * lpulObjType, LPUNKNOWN * lppUnk) PURE; + STDMETHOD(SetSearchCriteria)(THIS_ LPSRestriction lpRestriction, LPENTRYLIST lpContainerList, ULONG ulSearchFlags) PURE; + STDMETHOD(GetSearchCriteria)(THIS_ ULONG ulFlags, LPSRestriction * lppRestriction, LPENTRYLIST * lppContainerList, + ULONG * lpulSearchState) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) + /*** IUnknown methods ***/ +#define IMAPIContainer_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IMAPIContainer_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IMAPIContainer_Release(p) (p)->lpVtbl->Release(p) + /*** IMAPIProp methods ***/ +#define IMAPIContainer_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IMAPIContainer_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IMAPIContainer_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IMAPIContainer_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IMAPIContainer_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IMAPIContainer_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IMAPIContainer_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IMAPIContainer_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IMAPIContainer_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IMAPIContainer_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IMAPIContainer_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) + /*** IMAPIContainer methods ***/ +#define IMAPIContainer_GetContentsTable(p,a,b) (p)->lpVtbl->GetContentsTable(p,a,b) +#define IMAPIContainer_GetHierarchyTable(p,a,b) (p)->lpVtbl->GetHierarchyTable(p,a,b) +#define IMAPIContainer_OpenEntry(p,a,b,c,d,e,f) (p)->lpVtbl->OpenEntry(p,a,b,c,d,e,f) +#define IMAPIContainer_SetSearchCriteria(p,a,b,c) (p)->lpVtbl->SetSearchCriteria(p,a,b,c) +#define IMAPIContainer_GetSearchCriteria(p,a,b,c,d) (p)->lpVtbl->GetSearchCriteria(p,a,b,c,d) + +#endif + +/***************************************************************************** + * IMAPIFolder interface + */ +#define INTERFACE IMAPIFolder +DECLARE_INTERFACE_(IMAPIFolder,IMAPIContainer) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMAPIProp methods ***/ + STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; + STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; + STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE; + STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, + LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, + LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; + STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) PURE; + STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE; + /*** IMAPIContainer methods ***/ + STDMETHOD(GetContentsTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(GetHierarchyTable)(THIS_ ULONG ulFlags, LPMAPITABLE * lppTable) PURE; + STDMETHOD(OpenEntry)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, ULONG ulFlags, + ULONG * lpulObjType, LPUNKNOWN * lppUnk) PURE; + STDMETHOD(SetSearchCriteria)(THIS_ LPSRestriction lpRestriction, LPENTRYLIST lpContainerList, ULONG ulSearchFlags) PURE; + STDMETHOD(GetSearchCriteria)(THIS_ ULONG ulFlags, LPSRestriction * lppRestriction, LPENTRYLIST * lppContainerList, + ULONG * lpulSearchState) PURE; + /*** IMAPIFolder methods ***/ + STDMETHOD(CreateMessage)(THIS_ LPCIID lpInterface, ULONG ulFlags, LPMESSAGE *lppMessage) PURE; + STDMETHOD(CopyMessages)(THIS_ LPENTRYLIST lpMsgList, LPCIID lpInterface, LPVOID lpDestFolder, ULONG ulUIParam, + LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; + STDMETHOD(DeleteMessages)(THIS_ LPENTRYLIST lpMsgList, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; + STDMETHOD(CreateFolder)(THIS_ ULONG ulFolderType, LPSTR lpszFolderName, LPSTR lpszFolderComment, LPCIID lpInterface, + ULONG ulFlags, LPMAPIFOLDER lppFolder) PURE; + STDMETHOD(CopyFolder)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, LPCIID lpInterface, LPVOID lpDestFolder, + LPSTR lpszNewFolderName, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; + STDMETHOD(DeleteFolder)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, + ULONG ulFlags) PURE; + STDMETHOD(SetReadFlags)(THIS_ LPENTRYLIST lpMsgList, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; + STDMETHOD(GetMessageStatus)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulFlags, ULONG * lpulMessageStatus) PURE; + STDMETHOD(SetMessageStatus)(THIS_ ULONG cbEntryID, LPENTRYID lpEntryID, ULONG ulNewStatus, + ULONG ulNewStatusMask, ULONG * lpulOldStatus) PURE; + STDMETHOD(SaveContentsSort)(THIS_ LPSSortOrderSet lpSortCriteria, ULONG ulFlags) PURE; + STDMETHOD(EmptyFolder) (THIS_ ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) + /*** IUnknown methods ***/ +#define IMAPIFolder_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IMAPIFolder_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IMAPIFolder_Release(p) (p)->lpVtbl->Release(p) + /*** IMAPIProp methods ***/ +#define IMAPIFolder_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IMAPIFolder_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IMAPIFolder_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IMAPIFolder_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IMAPIFolder_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IMAPIFolder_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IMAPIFolder_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IMAPIFolder_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IMAPIFolder_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IMAPIFolder_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IMAPIFolder_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) + /*** IMAPIContainer methods ***/ +#define IMAPIFolder_GetContentsTable(p,a,b) (p)->lpVtbl->GetContentsTable(p,a,b) +#define IMAPIFolder_GetHierarchyTable(p,a,b) (p)->lpVtbl->GetHierarchyTable(p,a,b) +#define IMAPIFolder_OpenEntry(p,a,b,c,d,e,f) (p)->lpVtbl->OpenEntry(p,a,b,c,d,e,f) +#define IMAPIFolder_SetSearchCriteria(p,a,b,c) (p)->lpVtbl->SetSearchCriteria(p,a,b,c) +#define IMAPIFolder_GetSearchCriteria(p,a,b,c,d) (p)->lpVtbl->GetSearchCriteria(p,a,b,c,d) + /*** IMAPIFolder methods ***/ +#define IMAPIFolder_CreateMessage(p,a,b,c) (p)->lpVtbl->CreateMessage(p,a,b,c) +#define IMAPIFolder_CopyMessages(p,a,b,c,d,e,f) (p)->lpVtbl->CopyMessages(p,a,b,c,d,e,f) +#define IMAPIFolder_DeleteMessages(p,a,b,c,d) (p)->lpVtbl->DeleteMessages(p,a,b,c,d) +#define IMAPIFolder_CreateFolder(p,a,b,c,d,e,f) (p)->lpVtbl->CreateFolder(p,a,b,c,d,e,f) +#define IMAPIFolder_CopyFolder(p,a,b,c,d,e,f,g,h) (p)->lpVtbl->CopyFolder(p,a,b,c,d,e,f,g,h) +#define IMAPIFolder_DeleteFolder(p,a,b,c,d,e) (p)->lpVtbl->CreateFolder(p,a,b,c,d,e) +#define IMAPIFolder_SetReadFlags(p,a,b,c,d) (p)->lpVtbl->SetReadFlags(p,a,b,c,d) +#define IMAPIFolder_GetMessageStatus(p,a,b,c,d) (p)->lpVtbl->GetMessageStatus(p,a,b,c,d) +#define IMAPIFolder_SetMessageStatus(p,a,b,c,d,e) (p)->lpVtbl->SetMessageStatus(p,a,b,c,d,e) +#define IMAPIFolder_SaveContentsSort(p,a,b) (p)->lpVtbl->SaveContentsSort(p,a,b) +#define IMAPIFolder_EmptyFolder(p,a,b,c) (p)->lpVtbl->EmptyFolder(p,a,b,c) + +#endif + typedef struct { ULONG cb; @@ -949,4 +1194,133 @@ typedef struct _ADRLIST ADRENTRY aEntries[MAPI_DIM]; } ADRLIST, *LPADRLIST; +/***************************************************************************** + * IMessage interface + */ +#define INTERFACE IMessage +DECLARE_INTERFACE_(IMessage,IMAPIProp) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMAPIProp methods ***/ + STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; + STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; + STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE; + STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, + LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, + LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; + STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) PURE; + STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE; + /*** IMessage methods ***/ + STDMETHOD(GetAttachmentTable)(THIS_ ULONG ulFlags, LPMAPITABLE *lppTable) PURE; + STDMETHOD(OpenAttach)(THIS_ ULONG ulAttachmentNum, LPCIID lpInterface, ULONG ulFlags, LPATTACH *lppAttach) PURE; + STDMETHOD(CreateAttach)(THIS_ LPCIID lpInterface, ULONG ulFlags, ULONG *lpulAttachmentNum, LPATTACH *lppAttach) PURE; + STDMETHOD(DeleteAttach)(THIS_ ULONG ulAttachmentNum, ULONG ulUIParam, LPMAPIPROGRESS lpProgress, ULONG ulFlags) PURE; + STDMETHOD(GetRecipientTable)(THIS_ ULONG ulFlags, LPMAPITABLE *lppTable) PURE; + STDMETHOD(ModifyRecipients)(THIS_ ULONG ulFlags, LPADRLIST lpMods) PURE; + STDMETHOD(SubmitMessage)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(SetReadFlag)(THIS_ ULONG ulFlags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) + /*** IUnknown methods ***/ +#define IMessage_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IMessage_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IMessage_Release(p) (p)->lpVtbl->Release(p) + /*** IMAPIProp methods ***/ +#define IMessage_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IMessage_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IMessage_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IMessage_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IMessage_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IMessage_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IMessage_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IMessage_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IMessage_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IMessage_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IMessage_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) + /*** IMessage methods ***/ +#define IMessage_GetAttachmentTable(p,a,b) (p)->lpVtbl->GetAttachmentTable(p,a,b) +#define IMessage_OpenAttach(p,a,b,c,d) (p)->lpVtbl->OpenAttach(p,a,b,c,d) +#define IMessage_CreateAttach(p,a,b,c,d) (p)->lpVtbl->CreateAttach(p,a,b,c,d) +#define IMessage_DeleteAttach(p,a,b,c,d) (p)->lpVtbl->DeleteAttach(p,a,b,c,d) +#define IMessage_GetRecipientTable(p,a,b) (p)->lpVtbl->GetRecipientTable(p,a,b) +#define IMessage_ModifyRecipients(p,a,b) (p)->lpVtbl->ModifyRecipients(p,a,b) +#define IMessage_SubmitMessage(p,a) (p)->lpVtbl->SubmitMessage(p,a) +#define IMessage_SetReadFlag(p,a) (p)->lpVtbl->SetReadFlag(p,a) + +#endif + +/* Message flags (PR_MESSAGE_FLAGS) */ + +#define MSGFLAG_READ 0x00000001U +#define MSGFLAG_UNMODIFIED 0x00000002U +#define MSGFLAG_SUBMIT 0x00000004U +#define MSGFLAG_UNSENT 0x00000008U +#define MSGFLAG_HASATTACH 0x00000010U +#define MSGFLAG_FROMME 0x00000020U + +/***************************************************************************** + * IAttach interface + */ +#define INTERFACE IAttach +DECLARE_INTERFACE_(IAttach,IMAPIProp) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IMAPIProp methods ***/ + STDMETHOD(GetLastError)(THIS_ HRESULT hRes, ULONG ulFlags, LPMAPIERROR *lppErr) PURE; + STDMETHOD(SaveChanges)(THIS_ ULONG ulFlags) PURE; + STDMETHOD(GetProps)(THIS_ LPSPropTagArray lpPropTags, ULONG ulFlags, ULONG *lpValues, LPSPropValue *lppProps) PURE; + STDMETHOD(GetPropList)(THIS_ ULONG ulFlags, LPSPropTagArray *lppPropTagArray) PURE; + STDMETHOD(OpenProperty)(THIS_ ULONG ulPropTag, LPCIID lpIid, ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lppUnk) PURE; + STDMETHOD(SetProps)(THIS_ ULONG cValues, LPSPropValue lpProps, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(DeleteProps)(THIS_ LPSPropTagArray lpPropTags, LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyTo)(THIS_ ULONG ciidExclude, LPCIID lpIid, LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface,LPVOID lpDest, ULONG ulFlags, + LPSPropProblemArray *lppProbs) PURE; + STDMETHOD(CopyProps)(THIS_ LPSPropTagArray lpIncludeProps, ULONG ulParam, LPMAPIPROGRESS lpProgress, + LPCIID lpIid, LPVOID lpDestObj, ULONG ulFlags, LPSPropProblemArray *lppProblems) PURE; + STDMETHOD(GetNamesFromIDs)(THIS_ LPSPropTagArray *lppPropTags, LPGUID lpIid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) PURE; + STDMETHOD(GetIDsFromNames)(THIS_ ULONG cPropNames, LPMAPINAMEID *lppNames, ULONG ulFlags, LPSPropTagArray *lppPropTags) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) + /*** IUnknown methods ***/ +#define IAttach_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IAttach_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IAttach_Release(p) (p)->lpVtbl->Release(p) + /*** IMAPIProp methods ***/ +#define IAttach_GetLastError(p,a,b,c) (p)->lpVtbl->GetLastError(p,a,b,c) +#define IAttach_SaveChanges(p,a) (p)->lpVtbl->SaveChanges(p,a) +#define IAttach_GetProps(p,a,b,c,d) (p)->lpVtbl->GetProps(p,a,b,c,d) +#define IAttach_GetPropList(p,a,b) (p)->lpVtbl->GetPropList(p,a,b) +#define IAttach_OpenProperty(p,a,b,c,d,e) (p)->lpVtbl->OpenProperty(p,a,b,c,d,e) +#define IAttach_SetProps(p,a,b,c) (p)->lpVtbl->SetProps(p,a,b,c) +#define IAttach_DeleteProps(p,a,b) (p)->lpVtbl->DeleteProps(p,a,b) +#define IAttach_CopyTo(p,a,b,c,d,e,f,g,h,i) (p)->lpVtbl->CopyTo(p,a,b,c,d,e,f,g,h,i) +#define IAttach_CopyProps(p,a,b,c,d,e,f,g) (p)->lpVtbl->CopyProps(p,a,b,c,d,e,f,g) +#define IAttach_GetNamesFromIDs(p,a,b,c,d,e) (p)->lpVtbl->GetNamesFromIDs(p,a,b,c,d,e) +#define IAttach_GetIDsFromNames(p,a,b,c,d) (p)->lpVtbl->GetIDsFromNames(p,a,b,c,d) +#endif + +/* Attachment flags */ + +#define NO_ATTACHMENT 0x00000000U +#define ATTACH_BY_VALUE 0x00000001U + #endif /*MAPIDEFS_H*/ diff --git a/include/mapitags.h b/include/mapitags.h index abeee4845b1..48f4dc133ec 100644 --- a/include/mapitags.h +++ b/include/mapitags.h @@ -452,6 +452,7 @@ #define PR_AB_PROVIDER_ID PROP_TAG(PT_BINARY,0x3615) #define PR_DEFAULT_VIEW_ENTRYID PROP_TAG(PT_BINARY,0x3616) #define PR_ASSOC_CONTENT_COUNT PROP_TAG(PT_I4,0x3617) +#define PR_IPM_DRAFTS_ENTRYID PROP_TAG(PT_BINARY,0x36D7) #define PR_ATTACHMENT_X400_PARAMETERS PROP_TAG(PT_BINARY,0x3700) #define PR_ATTACH_DATA_OBJ PROP_TAG(PT_OBJECT,0x3701) #define PR_ATTACH_DATA_BIN PROP_TAG(PT_BINARY,0x3701) diff --git a/include/mshtmdid.h b/include/mshtmdid.h index 980fbdd4681..7dc257ac17a 100644 --- a/include/mshtmdid.h +++ b/include/mshtmdid.h @@ -20,6 +20,8 @@ #define __MSHTMDID_H__ #define DISPID_NORMAL_FIRST 1000 +#define DISPID_IE8_NORMAL_FIRST (DISPID_NORMAL_FIRST+150) + #define DISPID_OMDOCUMENT DISPID_NORMAL_FIRST #define DISPID_DATATRANSFER DISPID_NORMAL_FIRST #define DISPID_ANCHOR DISPID_NORMAL_FIRST @@ -97,6 +99,31 @@ #define DISPID_GENERIC DISPID_NORMAL_FIRST #define DISPID_DOMIMPLEMENTATION DISPID_NORMAL_FIRST +#define DISPID_IE8_ANCHOR DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_AREA DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_BASE DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_BODY DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_FORM DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_HEAD DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_IMG DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_INPUT DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_LINK DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_MOD DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_SCRIPT DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_ATTR DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_NAMEDNODEMAP DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_COLLECTION DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_PARAM DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_EMBED DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_BLOCK DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_META DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_STYLE DISPID_IE8_NORMAL_FIRST +#define DISPID_IE8_SELECT DISPID_IE8_NORMAL_FIRST + +#define DISPID_IE8_ELEMENTBASE (DISPID_ELEMENT+200) +#define DISPID_IE8_ELEMENTMAX (DISPID_SITE-1) +#define DISPID_IE8_ELEMENT DISPID_IE8_ELEMENTBASE + #define DISPID_COLLECTION (DISPID_NORMAL_FIRST+500) #define DISPID_OPTIONS_COL (DISPID_NORMAL_FIRST+500) #define DISPID_IMG (DISPID_IMGBASE+1000) @@ -1001,6 +1028,13 @@ /* IHTMLElementCollection3 */ #define DISPID_IHTMLELEMENTCOLLECTION3_NAMEDITEM DISPID_COLLECTION+6 +/* IHTMLAttributeCollection3 */ +#define DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_GETNAMEDITEM DISPID_IE8_NAMEDNODEMAP +#define DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_SETNAMEDITEM DISPID_IE8_NAMEDNODEMAP+1 +#define DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_REMOVENAMEDITEM DISPID_IE8_NAMEDNODEMAP+2 +#define DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_ITEM DISPID_IE8_NAMEDNODEMAP+4 +#define DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_LENGTH DISPID_IE8_NAMEDNODEMAP+3 + /* IHTMLDOMChildrenCollection */ #define DISPID_IHTMLDOMCHILDRENCOLLECTION_LENGTH DISPID_COLLECTION #define DISPID_IHTMLDOMCHILDRENCOLLECTION__NEWENUM DISPID_NEWENUM @@ -1302,6 +1336,49 @@ #define DISPID_IHTMLELEMENT4_ONFOCUSIN DISPID_EVPROP_ONFOCUSIN #define DISPID_IHTMLELEMENT4_ONFOCUSOUT DISPID_EVPROP_ONFOCUSOUT +/* IElementSelector */ +#define DISPID_IELEMENTSELECTOR_QUERYSELECTOR DISPID_ELEMENT+114 +#define DISPID_IELEMENTSELECTOR_QUERYSELECTORALL DISPID_ELEMENT+115 + +/* IHTMLElement5 */ +#define DISPID_IHTMLELEMENT5_IE8_GETATTRIBUTENODE DISPID_IE8_ELEMENT +#define DISPID_IHTMLELEMENT5_IE8_SETATTRIBUTENODE DISPID_IE8_ELEMENT+1 +#define DISPID_IHTMLELEMENT5_IE8_REMOVEATTRIBUTENODE DISPID_IE8_ELEMENT+2 +#define DISPID_IHTMLELEMENT5_HASATTRIBUTE DISPID_IE8_ELEMENT+3 +#define DISPID_IHTMLELEMENT5_ROLE DISPID_IE8_ELEMENT+4 +#define DISPID_IHTMLELEMENT5_ARIABUSY DISPID_IE8_ELEMENT+5 +#define DISPID_IHTMLELEMENT5_ARIACHECKED DISPID_IE8_ELEMENT+6 +#define DISPID_IHTMLELEMENT5_ARIADISABLED DISPID_IE8_ELEMENT+7 +#define DISPID_IHTMLELEMENT5_ARIAEXPANDED DISPID_IE8_ELEMENT+8 +#define DISPID_IHTMLELEMENT5_ARIAHASPOPUP DISPID_IE8_ELEMENT+9 +#define DISPID_IHTMLELEMENT5_ARIAHIDDEN DISPID_IE8_ELEMENT+10 +#define DISPID_IHTMLELEMENT5_ARIAINVALID DISPID_IE8_ELEMENT+11 +#define DISPID_IHTMLELEMENT5_ARIAMULTISELECTABLE DISPID_IE8_ELEMENT+12 +#define DISPID_IHTMLELEMENT5_ARIAPRESSED DISPID_IE8_ELEMENT+13 +#define DISPID_IHTMLELEMENT5_ARIAREADONLY DISPID_IE8_ELEMENT+14 +#define DISPID_IHTMLELEMENT5_ARIAREQUIRED DISPID_IE8_ELEMENT+15 +#define DISPID_IHTMLELEMENT5_ARIASECRET DISPID_IE8_ELEMENT+16 +#define DISPID_IHTMLELEMENT5_ARIASELECTED DISPID_IE8_ELEMENT+17 +#define DISPID_IHTMLELEMENT5_IE8_GETATTRIBUTE DISPID_IE8_ELEMENT+18 +#define DISPID_IHTMLELEMENT5_IE8_SETATTRIBUTE DISPID_IE8_ELEMENT+19 +#define DISPID_IHTMLELEMENT5_IE8_REMOVEATTRIBUTE DISPID_IE8_ELEMENT+20 +#define DISPID_IHTMLELEMENT5_IE8_ATTRIBUTES DISPID_IE8_ELEMENT+21 +#define DISPID_IHTMLELEMENT5_ARIAVALUENOW DISPID_IE8_ELEMENT+22 +#define DISPID_IHTMLELEMENT5_ARIAPOSINSET DISPID_IE8_ELEMENT+23 +#define DISPID_IHTMLELEMENT5_ARIASETSIZE DISPID_IE8_ELEMENT+24 +#define DISPID_IHTMLELEMENT5_ARIALEVEL DISPID_IE8_ELEMENT+25 +#define DISPID_IHTMLELEMENT5_ARIAVALUEMIN DISPID_IE8_ELEMENT+26 +#define DISPID_IHTMLELEMENT5_ARIAVALUEMAX DISPID_IE8_ELEMENT+27 +#define DISPID_IHTMLELEMENT5_ARIACONTROLS DISPID_IE8_ELEMENT+28 +#define DISPID_IHTMLELEMENT5_ARIADESCRIBEDBY DISPID_IE8_ELEMENT+29 +#define DISPID_IHTMLELEMENT5_ARIAFLOWTO DISPID_IE8_ELEMENT+30 +#define DISPID_IHTMLELEMENT5_ARIALABELLEDBY DISPID_IE8_ELEMENT+31 +#define DISPID_IHTMLELEMENT5_ARIAACTIVEDESCENDANT DISPID_IE8_ELEMENT+32 +#define DISPID_IHTMLELEMENT5_ARIAOWNS DISPID_IE8_ELEMENT+33 +#define DISPID_IHTMLELEMENT5_HASATTRIBUTES DISPID_IE8_ELEMENT+34 +#define DISPID_IHTMLELEMENT5_ARIALIVE DISPID_IE8_ELEMENT+35 +#define DISPID_IHTMLELEMENT5_ARIARELEVANT DISPID_IE8_ELEMENT+36 + /* IHTMLGenericElement */ #define DISPID_IHTMLGENERICELEMENT_RECORDSET DISPID_GENERIC+1 #define DISPID_IHTMLGENERICELEMENT_NAMEDRECORDSET DISPID_GENERIC+2 @@ -1998,6 +2075,26 @@ #define DISPID_IHTMLDOMATTRIBUTE_NODEVALUE DISPID_DOMATTRIBUTE+2 #define DISPID_IHTMLDOMATTRIBUTE_SPECIFIED DISPID_DOMATTRIBUTE+1 +/* IHTMLDOMAttribute2 */ +#define DISPID_IHTMLDOMATTRIBUTE2_NAME DISPID_DOMATTRIBUTE+3 +#define DISPID_IHTMLDOMATTRIBUTE2_VALUE DISPID_DOMATTRIBUTE+4 +#define DISPID_IHTMLDOMATTRIBUTE2_EXPANDO DISPID_DOMATTRIBUTE+5 +#define DISPID_IHTMLDOMATTRIBUTE2_NODETYPE DISPID_DOMATTRIBUTE+6 +#define DISPID_IHTMLDOMATTRIBUTE2_PARENTNODE DISPID_DOMATTRIBUTE+7 +#define DISPID_IHTMLDOMATTRIBUTE2_CHILDNODES DISPID_DOMATTRIBUTE+8 +#define DISPID_IHTMLDOMATTRIBUTE2_FIRSTCHILD DISPID_DOMATTRIBUTE+9 +#define DISPID_IHTMLDOMATTRIBUTE2_LASTCHILD DISPID_DOMATTRIBUTE+10 +#define DISPID_IHTMLDOMATTRIBUTE2_PREVIOUSSIBLING DISPID_DOMATTRIBUTE+11 +#define DISPID_IHTMLDOMATTRIBUTE2_NEXTSIBLING DISPID_DOMATTRIBUTE+12 +#define DISPID_IHTMLDOMATTRIBUTE2_ATTRIBUTES DISPID_DOMATTRIBUTE+13 +#define DISPID_IHTMLDOMATTRIBUTE2_OWNERDOCUMENT DISPID_DOMATTRIBUTE+14 +#define DISPID_IHTMLDOMATTRIBUTE2_INSERTBEFORE DISPID_DOMATTRIBUTE+15 +#define DISPID_IHTMLDOMATTRIBUTE2_REPLACECHILD DISPID_DOMATTRIBUTE+16 +#define DISPID_IHTMLDOMATTRIBUTE2_REMOVECHILD DISPID_DOMATTRIBUTE+17 +#define DISPID_IHTMLDOMATTRIBUTE2_APPENDCHILD DISPID_DOMATTRIBUTE+18 +#define DISPID_IHTMLDOMATTRIBUTE2_HASCHILDNODES DISPID_DOMATTRIBUTE+19 +#define DISPID_IHTMLDOMATTRIBUTE2_CLONENODE DISPID_DOMATTRIBUTE+20 + /* IHTMLBodyElement */ #define DISPID_IHTMLBODYELEMENT_BACKGROUND DISPID_A_BACKGROUNDIMAGE #define DISPID_IHTMLBODYELEMENT_BGPROPERTIES DISPID_A_BACKGROUNDATTACHMENT @@ -2047,6 +2144,18 @@ #define DISPID_IHTMLANCHORELEMENT_FOCUS DISPID_SITE+0 #define DISPID_IHTMLANCHORELEMENT_BLUR DISPID_SITE+2 +/* IHTMLAnchorElement2 */ +#define DISPID_IHTMLANCHORELEMENT2_CHARSET DISPID_ANCHOR+23 +#define DISPID_IHTMLANCHORELEMENT2_COORDS DISPID_ANCHOR+24 +#define DISPID_IHTMLANCHORELEMENT2_HREFLANG DISPID_ANCHOR+25 +#define DISPID_IHTMLANCHORELEMENT2_SHAPE DISPID_ANCHOR+26 +#define DISPID_IHTMLANCHORELEMENT2_TYPE DISPID_ANCHOR+27 + +/* IHTMLAnchorElement3 */ +#define DISPID_IHTMLANCHORELEMENT3_IE8_SHAPE DISPID_IE8_ANCHOR+1 +#define DISPID_IHTMLANCHORELEMENT3_IE8_COORDS DISPID_IE8_ANCHOR+2 +#define DISPID_IHTMLANCHORELEMENT3_IE8_HREF DISPID_IE8_ANCHOR+3 + /* IHTMLTxtRange */ #define DISPID_IHTMLTXTRANGE_HTMLTEXT DISPID_RANGE+3 #define DISPID_IHTMLTXTRANGE_TEXT DISPID_RANGE+4 diff --git a/include/mshtml.idl b/include/mshtml.idl index 8fab91b33d6..0ef2be059a5 100644 --- a/include/mshtml.idl +++ b/include/mshtml.idl @@ -919,10 +919,10 @@ interface IHTMLStyle2 : IDispatch * IHTMLRuleStyle interface */ [ - odl, - oleautomation, - dual, - uuid(3050F3CF-98B5-11CF-BB82-00AA00BDCE0B) + odl, + oleautomation, + dual, + uuid(3050F3CF-98B5-11CF-BB82-00AA00BDCE0B) ] interface IHTMLRuleStyle : IDispatch { @@ -3441,6 +3441,87 @@ interface IHTMLDOMAttribute : IDispatch } /***************************************************************************** + * IHTMLDOMAttribute2 interface + */ +[ + odl, + oleautomation, + dual, + uuid(3050f810-98b5-11cf-bb82-00aa00bdce0b) +] +interface IHTMLDOMAttribute2 : IDispatch +{ + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_NAME)] + HRESULT name([retval, out] BSTR *p); + + [propput, id(DISPID_IHTMLDOMATTRIBUTE2_VALUE)] + HRESULT value([in] BSTR v); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_VALUE)] + HRESULT value([retval, out] BSTR *p); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_EXPANDO)] + HRESULT expando([retval, out] VARIANT_BOOL *p); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_NODETYPE)] + HRESULT nodeType([retval, out] long *p); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_PARENTNODE)] + HRESULT parentNode([retval, out] IHTMLDOMNode **p); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_CHILDNODES)] + HRESULT childNodes([retval, out] IDispatch **p); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_FIRSTCHILD)] + HRESULT firstChild([retval, out] IHTMLDOMNode **p); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_LASTCHILD)] + HRESULT lastChild([retval, out] IHTMLDOMNode **p); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_PREVIOUSSIBLING)] + HRESULT previousSibling([retval, out] IHTMLDOMNode **p); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_NEXTSIBLING)] + HRESULT nextSibling([retval, out] IHTMLDOMNode **p); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_ATTRIBUTES)] + HRESULT attributes([retval, out] IDispatch **p); + + [propget, id(DISPID_IHTMLDOMATTRIBUTE2_OWNERDOCUMENT)] + HRESULT ownerDocument([retval, out] IDispatch **p); + + [id(DISPID_IHTMLDOMATTRIBUTE2_INSERTBEFORE)] + HRESULT insertBefore( + [in] IHTMLDOMNode *newChild, + [optional, in] VARIANT refChild, + [retval, out] IHTMLDOMNode **node); + + [id(DISPID_IHTMLDOMATTRIBUTE2_REPLACECHILD)] + HRESULT replaceChild( + [in] IHTMLDOMNode *newChild, + [in] IHTMLDOMNode *oldChild, + [retval, out] IHTMLDOMNode **node); + + [id(DISPID_IHTMLDOMATTRIBUTE2_REMOVECHILD)] + HRESULT removeChild( + [in] IHTMLDOMNode *oldChild, + [retval, out] IHTMLDOMNode **node); + + [id(DISPID_IHTMLDOMATTRIBUTE2_APPENDCHILD)] + HRESULT appendChild( + [in] IHTMLDOMNode *newChild, + [retval, out] IHTMLDOMNode **node); + + [id(DISPID_IHTMLDOMATTRIBUTE2_HASCHILDNODES)] + HRESULT hasChildNodes([retval, out] VARIANT_BOOL *fChildren); + + [id(DISPID_IHTMLDOMATTRIBUTE2_CLONENODE)] + HRESULT cloneNode( + [in] VARIANT_BOOL fDeep, + [retval, out] IHTMLDOMAttribute **clonedNode); +} + +/***************************************************************************** * IHTMLDOMTextNode interface */ [ @@ -3646,6 +3727,41 @@ methods: } /***************************************************************************** + * IHTMLAttributeCollection3 interface + */ +[ + odl, + oleautomation, + dual, + uuid(30510469-98b5-11cf-bb82-00aa00bdce0b) +] +interface IHTMLAttributeCollection3 : IDispatch +{ + [id(DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_GETNAMEDITEM)] + HRESULT getNamedItem( + [in] BSTR bstrName, + [retval, out] IHTMLDOMAttribute **ppNodeOut); + + [id(DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_SETNAMEDITEM)] + HRESULT setNamedItem( + [in] IHTMLDOMAttribute *pNodeIn, + [retval, out] IHTMLDOMAttribute **ppNodeOut); + + [id(DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_REMOVENAMEDITEM)] + HRESULT removeNamedItem( + [in] BSTR bstrName, + [retval, out] IHTMLDOMAttribute **ppNodeOut); + + [id(DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_ITEM)] + HRESULT item( + [in] long index, + [retval, out] IHTMLDOMAttribute **ppNodeOut); + + [propget, id(DISPID_IHTMLATTRIBUTECOLLECTION3_IE8_LENGTH)] + HRESULT length([retval, out] long *p); +} + +/***************************************************************************** * IHTMLDOMChildrenCollection interface */ [ @@ -3975,6 +4091,278 @@ interface IHTMLElement : IDispatch HRESULT all([retval, out] IDispatch **p); } +#define WINE_IHTMLELEMENT_DISPINTERFACE_DECL \ + [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] \ + void setAttribute( \ + [in] BSTR strAttributeName, \ + [in] VARIANT AttValue, \ + [defaultvalue(1), in] LONG lFlags); \ + \ + [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] \ + VARIANT getAttribute( \ + [in] BSTR strAttributeName, \ + [defaultvalue(0), in] LONG lFlags); \ + \ + [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] \ + VARIANT_BOOL removeAttribute( \ + [in] BSTR strAttributeName, \ + [defaultvalue(1), in] LONG lFlags); \ + \ + [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] \ + void className(BSTR v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] \ + BSTR className(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ID), bindable] \ + void id(BSTR v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ID), bindable] \ + BSTR id(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] \ + BSTR tagName(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] \ + IHTMLElement *parentElement(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] \ + IHTMLStyle *style(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] \ + void onhelp(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] \ + VARIANT onhelp(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] \ + void onclick(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] \ + VARIANT onclick(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable]\ + void ondblclick(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable]\ + VARIANT ondblclick(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] \ + void onkeydown(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] \ + VARIANT onkeydown(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] \ + void onkeyup(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] \ + VARIANT onkeyup(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable]\ + void onkeypress(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable]\ + VARIANT onkeypress(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable]\ + void onmouseout(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable]\ + VARIANT onmouseout(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] \ + void onmouseover(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] \ + VARIANT onmouseover(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] \ + void onmousemove(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] \ + VARIANT onmousemove(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] \ + void onmousedown(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] \ + VARIANT onmousedown(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] \ + void onmouseup(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] \ + VARIANT onmouseup(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] IDispatch* document(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] \ + void title(BSTR v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] \ + BSTR title(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] \ + void language(BSTR v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] \ + BSTR language(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] \ + void onselectstart(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] \ + VARIANT onselectstart(); \ + \ + [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] \ + void scrollIntoView([optional, in] VARIANT varargStart); \ + \ + [id(DISPID_IHTMLELEMENT_CONTAINS)] \ + VARIANT_BOOL contains([in] IHTMLElement* pChild); \ + \ + [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] \ + LONG sourceIndex(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] \ + VARIANT recordNumber(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_LANG)] \ + void lang(BSTR v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_LANG)] \ + BSTR lang(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] \ + LONG offsetLeft(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] \ + LONG offsetTop(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] \ + LONG offsetWidth(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] \ + LONG offsetHeight(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] \ + IHTMLElement* offsetParent(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] \ + void innerHTML(BSTR v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] \ + BSTR innerHTML(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] \ + void innerText(BSTR v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] \ + BSTR innerText(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] \ + void outerHTML(BSTR v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] \ + BSTR outerHTML(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] \ + void outerText(BSTR v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] \ + BSTR outerText(); \ + \ + [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] \ + void insertAdjacentHTML( \ + [in] BSTR where, \ + [in] BSTR html); \ + \ + [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] \ + void insertAdjacentText( \ + [in] BSTR where, \ + [in] BSTR text); \ + \ + [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] \ + IHTMLElement* parentTextEdit(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] \ + VARIANT_BOOL isTextEdit(); \ + \ + [id(DISPID_IHTMLELEMENT_CLICK)] \ + void click(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_FILTERS)] \ + IHTMLFiltersCollection* filters(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] \ + void ondragstart(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] \ + VARIANT ondragstart(); \ + \ + [id(DISPID_IHTMLELEMENT_TOSTRING)] \ + BSTR toString(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] \ + void onbeforeupdate(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] \ + VARIANT onbeforeupdate(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] \ + void onafterupdate(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] \ + VARIANT onafterupdate(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] \ + void onerrorupdate(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] \ + VARIANT onerrorupdate(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] \ + void onrowexit(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] \ + VARIANT onrowexit(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] \ + void onrowenter(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] \ + VARIANT onrowenter(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] \ + void ondatasetchanged(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] \ + VARIANT ondatasetchanged(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] \ + void ondataavailable(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] \ + VARIANT ondataavailable(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] \ + void ondatasetcomplete(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] \ + VARIANT ondatasetcomplete(); \ + \ + [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] \ + void onfilterchange(VARIANT v); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] \ + VARIANT onfilterchange(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] \ + IDispatch* children(); \ + \ + [propget, id(DISPID_IHTMLELEMENT_ALL)] \ + IDispatch* all() + /***************************************************************************** * IHTMLElement2 interface */ @@ -4542,277 +4930,7 @@ dispinterface DispHTMLGenericElement { properties: methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttributeValue, - [in, defaultvalue(1)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(0)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(1)] LONG lFlags); - - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); - - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); - - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); - - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement *parentElement(); - - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle *style(); - - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); - - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] - IDispatch *document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([in, optional] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement *pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement *offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement *parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] - void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection *filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); - - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); - - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); - - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); - - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch *children(); - - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch *all(); + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] BSTR scopeName(); @@ -6264,283 +6382,13 @@ dispinterface DispHTMLImg { properties: methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttributeValue, - [in, defaultvalue(1)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(0)] LONG lFlags); + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(1)] LONG lFlags); + [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] + BSTR scopeName(); - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); - - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); - - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); - - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement *parentElement(); - - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle *style(); - - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); - - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] - IDispatch *document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([in, optional] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement *pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement *offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement *parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] - void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection *filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); - - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); - - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); - - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); - - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch *children(); - - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch *all(); - - [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] - BSTR scopeName(); - - [id(DISPID_IHTMLELEMENT2_SETCAPTURE)] - void setCapture([in, defaultvalue(-1)] VARIANT_BOOL containerCapture); + [id(DISPID_IHTMLELEMENT2_SETCAPTURE)] + void setCapture([in, defaultvalue(-1)] VARIANT_BOOL containerCapture); [id(DISPID_IHTMLELEMENT2_RELEASECAPTURE)] void releaseCapture(); @@ -7512,359 +7360,91 @@ dispinterface DispHTMLBody { properties: methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttValue, - [defaultvalue(1), in] LONG lFlags); + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [defaultvalue(0), in] LONG lFlags); + [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] + BSTR scopeName(); - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [defaultvalue(1), in] LONG lFlags); + [id(DISPID_IHTMLELEMENT2_SETCAPTURE)] + void setCapture([defaultvalue(-1), in] VARIANT_BOOL containerCapture); - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); + [id(DISPID_IHTMLELEMENT2_RELEASECAPTURE)] + void releaseCapture(); - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); + [propput, id(DISPID_IHTMLELEMENT2_ONLOSECAPTURE), displaybind, bindable] + void onlosecapture(VARIANT v); - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); + [propget, id(DISPID_IHTMLELEMENT2_ONLOSECAPTURE), displaybind, bindable] + VARIANT onlosecapture(); - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); + [id(DISPID_IHTMLELEMENT2_COMPONENTFROMPOINT)] + BSTR componentFromPoint([in] LONG x,[in] LONG y); - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); + [id(DISPID_IHTMLELEMENT2_DOSCROLL)] + void doScroll([optional, in] VARIANT component); - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement* parentElement(); + [propput, id(DISPID_IHTMLELEMENT2_ONSCROLL), displaybind, bindable] + void onscroll(VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle* style(); + [propget, id(DISPID_IHTMLELEMENT2_ONSCROLL), displaybind, bindable] + VARIANT onscroll(); - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); + [propput, id(DISPID_IHTMLELEMENT2_ONDRAG), displaybind, bindable] + void ondrag(VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); + [propget, id(DISPID_IHTMLELEMENT2_ONDRAG), displaybind, bindable] + VARIANT ondrag(); - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); + [propput, id(DISPID_IHTMLELEMENT2_ONDRAGEND), displaybind, bindable] + void ondragend(VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); + [propget, id(DISPID_IHTMLELEMENT2_ONDRAGEND), displaybind, bindable] + VARIANT ondragend(); - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); + [propput, id(DISPID_IHTMLELEMENT2_ONDRAGENTER), displaybind, bindable] + void ondragenter(VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); + [propget, id(DISPID_IHTMLELEMENT2_ONDRAGENTER), displaybind, bindable] + VARIANT ondragenter(); - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); + [propput, id(DISPID_IHTMLELEMENT2_ONDRAGOVER), displaybind, bindable] + void ondragover(VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); + [propget, id(DISPID_IHTMLELEMENT2_ONDRAGOVER), displaybind, bindable] + VARIANT ondragover(); - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); + [propput, id(DISPID_IHTMLELEMENT2_ONDRAGLEAVE), displaybind, bindable] + void ondragleave(VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); + [propget, id(DISPID_IHTMLELEMENT2_ONDRAGLEAVE), displaybind, bindable] + VARIANT ondragleave(); - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); + [propput, id(DISPID_IHTMLELEMENT2_ONDROP), displaybind, bindable] + void ondrop(VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); + [propget, id(DISPID_IHTMLELEMENT2_ONDROP), displaybind, bindable] + VARIANT ondrop(); - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); + [propput, id(DISPID_IHTMLELEMENT2_ONBEFORECUT), displaybind, bindable] + void onbeforecut(VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); + [propget, id(DISPID_IHTMLELEMENT2_ONBEFORECUT), displaybind, bindable] + VARIANT onbeforecut(); - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); + [propput, id(DISPID_IHTMLELEMENT2_ONCUT), displaybind, bindable] + void oncut(VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); + [propget, id(DISPID_IHTMLELEMENT2_ONCUT), displaybind, bindable] + VARIANT oncut(); - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); + [propput, id(DISPID_IHTMLELEMENT2_ONBEFORECOPY), displaybind, bindable] + void onbeforecopy(VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); + [propget, id(DISPID_IHTMLELEMENT2_ONBEFORECOPY), displaybind, bindable] + VARIANT onbeforecopy(); - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] IDispatch* document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([optional, in] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement* pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement* offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement* parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection* filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); - - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); - - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); - - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); - - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch* children(); - - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch* all(); - - [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] - BSTR scopeName(); - - [id(DISPID_IHTMLELEMENT2_SETCAPTURE)] - void setCapture([defaultvalue(-1), in] VARIANT_BOOL containerCapture); - - [id(DISPID_IHTMLELEMENT2_RELEASECAPTURE)] - void releaseCapture(); - - [propput, id(DISPID_IHTMLELEMENT2_ONLOSECAPTURE), displaybind, bindable] - void onlosecapture(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONLOSECAPTURE), displaybind, bindable] - VARIANT onlosecapture(); - - [id(DISPID_IHTMLELEMENT2_COMPONENTFROMPOINT)] - BSTR componentFromPoint([in] LONG x,[in] LONG y); - - [id(DISPID_IHTMLELEMENT2_DOSCROLL)] - void doScroll([optional, in] VARIANT component); - - [propput, id(DISPID_IHTMLELEMENT2_ONSCROLL), displaybind, bindable] - void onscroll(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONSCROLL), displaybind, bindable] - VARIANT onscroll(); - - [propput, id(DISPID_IHTMLELEMENT2_ONDRAG), displaybind, bindable] - void ondrag(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONDRAG), displaybind, bindable] - VARIANT ondrag(); - - [propput, id(DISPID_IHTMLELEMENT2_ONDRAGEND), displaybind, bindable] - void ondragend(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONDRAGEND), displaybind, bindable] - VARIANT ondragend(); - - [propput, id(DISPID_IHTMLELEMENT2_ONDRAGENTER), displaybind, bindable] - void ondragenter(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONDRAGENTER), displaybind, bindable] - VARIANT ondragenter(); - - [propput, id(DISPID_IHTMLELEMENT2_ONDRAGOVER), displaybind, bindable] - void ondragover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONDRAGOVER), displaybind, bindable] - VARIANT ondragover(); - - [propput, id(DISPID_IHTMLELEMENT2_ONDRAGLEAVE), displaybind, bindable] - void ondragleave(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONDRAGLEAVE), displaybind, bindable] - VARIANT ondragleave(); - - [propput, id(DISPID_IHTMLELEMENT2_ONDROP), displaybind, bindable] - void ondrop(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONDROP), displaybind, bindable] - VARIANT ondrop(); - - [propput, id(DISPID_IHTMLELEMENT2_ONBEFORECUT), displaybind, bindable] - void onbeforecut(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONBEFORECUT), displaybind, bindable] - VARIANT onbeforecut(); - - [propput, id(DISPID_IHTMLELEMENT2_ONCUT), displaybind, bindable] - void oncut(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONCUT), displaybind, bindable] - VARIANT oncut(); - - [propput, id(DISPID_IHTMLELEMENT2_ONBEFORECOPY), displaybind, bindable] - void onbeforecopy(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT2_ONBEFORECOPY), displaybind, bindable] - VARIANT onbeforecopy(); - - [propput, id(DISPID_IHTMLELEMENT2_ONCOPY), displaybind, bindable] - void oncopy(VARIANT v); + [propput, id(DISPID_IHTMLELEMENT2_ONCOPY), displaybind, bindable] + void oncopy(VARIANT v); [propget, id(DISPID_IHTMLELEMENT2_ONCOPY), displaybind, bindable] VARIANT oncopy(); @@ -8596,59 +8176,975 @@ interface IHTMLAnchorElement : IDispatch } /***************************************************************************** - * IHTMLElementCollection interface + * DispHTMLAnchorElement dispinterface */ [ - odl, - oleautomation, - dual, - uuid(3050F21F-98B5-11CF-BB82-00AA00BDCE0B) + hidden, + uuid(3050f502-98b5-11cf-bb82-00aa00bdce0b) ] -interface IHTMLElementCollection : IDispatch +dispinterface DispHTMLAnchorElement { - [id(DISPID_IHTMLELEMENTCOLLECTION_TOSTRING)] - HRESULT toString([retval, out] BSTR *String); +properties: +methods: + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; - [propput, id(DISPID_IHTMLELEMENTCOLLECTION_LENGTH)] - HRESULT length([in] LONG v); + [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] + BSTR scopeName(); - [propget, id(DISPID_IHTMLELEMENTCOLLECTION_LENGTH)] - HRESULT length([retval, out] LONG *p); + [id(DISPID_IHTMLELEMENT2_SETCAPTURE)] + void setCapture([defaultvalue(-1), in] VARIANT_BOOL containerCapture); - [propget, id(DISPID_IHTMLELEMENTCOLLECTION__NEWENUM)] - HRESULT _newEnum([retval, out] IUnknown **p); + [id(DISPID_IHTMLELEMENT2_RELEASECAPTURE)] + void releaseCapture(); - [id(DISPID_IHTMLELEMENTCOLLECTION_ITEM)] - HRESULT item( - [optional, in] VARIANT name, - [optional, in] VARIANT index, - [retval, out] IDispatch **pdisp); + [propput, id(DISPID_IHTMLELEMENT2_ONLOSECAPTURE), displaybind, bindable] + void onlosecapture(VARIANT v); - [id(DISPID_IHTMLELEMENTCOLLECTION_TAGS)] - HRESULT tags( - [in] VARIANT tagName, - [retval, out] IDispatch **pdisp); -} + [propget, id(DISPID_IHTMLELEMENT2_ONLOSECAPTURE), displaybind, bindable] + VARIANT onlosecapture(); -/***************************************************************************** - * DispHTMLElementCollection dispinterface - */ -[ - hidden, - uuid(3050f56b-98b5-11cf-bb82-00aa00bdce0b) -] -dispinterface DispHTMLElementCollection -{ -properties: -methods: - [id(DISPID_IHTMLELEMENTCOLLECTION_TOSTRING)] - BSTR toString(); + [id(DISPID_IHTMLELEMENT2_COMPONENTFROMPOINT)] + BSTR componentFromPoint([in] LONG x,[in] LONG y); - [propput, id(DISPID_IHTMLELEMENTCOLLECTION_LENGTH)] - void length(LONG v); + [id(DISPID_IHTMLELEMENT2_DOSCROLL)] + void doScroll([optional, in] VARIANT component); - [propget, id(DISPID_IHTMLELEMENTCOLLECTION_LENGTH)] - LONG length(); + [propput, id(DISPID_IHTMLELEMENT2_ONSCROLL), displaybind, bindable] + void onscroll(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONSCROLL), displaybind, bindable] + VARIANT onscroll(); + + [propput, id(DISPID_IHTMLELEMENT2_ONDRAG), displaybind, bindable] + void ondrag(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONDRAG), displaybind, bindable] + VARIANT ondrag(); + + [propput, id(DISPID_IHTMLELEMENT2_ONDRAGEND), displaybind, bindable] + void ondragend(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONDRAGEND), displaybind, bindable] + VARIANT ondragend(); + + [propput, id(DISPID_IHTMLELEMENT2_ONDRAGENTER), displaybind, bindable] + void ondragenter(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONDRAGENTER), displaybind, bindable] + VARIANT ondragenter(); + + [propput, id(DISPID_IHTMLELEMENT2_ONDRAGOVER), displaybind, bindable] + void ondragover(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONDRAGOVER), displaybind, bindable] + VARIANT ondragover(); + + [propput, id(DISPID_IHTMLELEMENT2_ONDRAGLEAVE), displaybind, bindable] + void ondragleave(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONDRAGLEAVE), displaybind, bindable] + VARIANT ondragleave(); + + [propput, id(DISPID_IHTMLELEMENT2_ONDROP), displaybind, bindable] + void ondrop(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONDROP), displaybind, bindable] + VARIANT ondrop(); + + [propput, id(DISPID_IHTMLELEMENT2_ONBEFORECUT), displaybind, bindable] + void onbeforecut(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONBEFORECUT), displaybind, bindable] + VARIANT onbeforecut(); + + [propput, id(DISPID_IHTMLELEMENT2_ONCUT), displaybind, bindable] + void oncut(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONCUT), displaybind, bindable] + VARIANT oncut(); + + [propput, id(DISPID_IHTMLELEMENT2_ONBEFORECOPY), displaybind, bindable] + void onbeforecopy(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONBEFORECOPY), displaybind, bindable] + VARIANT onbeforecopy(); + + [propput, id(DISPID_IHTMLELEMENT2_ONCOPY), displaybind, bindable] + void oncopy(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONCOPY), displaybind, bindable] + VARIANT oncopy(); + + [propput, id(DISPID_IHTMLELEMENT2_ONBEFOREPASTE), displaybind, bindable] + void onbeforepaste(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONBEFOREPASTE), displaybind, bindable] + VARIANT onbeforepaste(); + + [propput, id(DISPID_IHTMLELEMENT2_ONPASTE), displaybind, bindable] + void onpaste(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONPASTE), displaybind, bindable] + VARIANT onpaste(); + + [propget, id(DISPID_IHTMLELEMENT2_CURRENTSTYLE), nonbrowsable] + IHTMLCurrentStyle* currentStyle(); + + [propput, id(DISPID_IHTMLELEMENT2_ONPROPERTYCHANGE), displaybind, bindable] + void onpropertychange(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONPROPERTYCHANGE), displaybind, bindable] + VARIANT onpropertychange(); + + [id(DISPID_IHTMLELEMENT2_GETCLIENTRECTS)] + IHTMLRectCollection* getClientRects(); + + [id(DISPID_IHTMLELEMENT2_GETBOUNDINGCLIENTRECT)] + IHTMLRect* getBoundingClientRect(); + + [id(DISPID_IHTMLELEMENT2_SETEXPRESSION)] + void setExpression( + [in] BSTR propname, + [in] BSTR expr, + [defaultvalue(""), in] BSTR lang); + + [id(DISPID_IHTMLELEMENT2_GETEXPRESSION)] + VARIANT getExpression([in] BSTR propname); + + [id(DISPID_IHTMLELEMENT2_REMOVEEXPRESSION)] + VARIANT_BOOL removeExpression([in] BSTR propname); + + [propput, id(DISPID_IHTMLELEMENT2_TABINDEX), displaybind, bindable] + void tabIndex(short v); + + [propget, id(DISPID_IHTMLELEMENT2_TABINDEX), displaybind, bindable] + short tabIndex(); + + [id(DISPID_IHTMLELEMENT2_FOCUS)] + void focus(); + + [propput, id(DISPID_IHTMLELEMENT2_ACCESSKEY), displaybind, bindable] + void accessKey(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT2_ACCESSKEY), displaybind, bindable] + BSTR accessKey(); + + [propput, id(DISPID_IHTMLELEMENT2_ONBLUR), displaybind, bindable] + void onblur(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONBLUR), displaybind, bindable] + VARIANT onblur(); + + [propput, id(DISPID_IHTMLELEMENT2_ONFOCUS), displaybind, bindable] + void onfocus(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONFOCUS), displaybind, bindable] + VARIANT onfocus(); + + [propput, id(DISPID_IHTMLELEMENT2_ONRESIZE), displaybind, bindable] + void onresize(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONRESIZE), displaybind, bindable] + VARIANT onresize(); + + [id(DISPID_IHTMLELEMENT2_BLUR)] + void blur(); + + [id(DISPID_IHTMLELEMENT2_ADDFILTER)] + void addFilter([in] IUnknown* pUnk); + + [id(DISPID_IHTMLELEMENT2_REMOVEFILTER)] + void removeFilter([in] IUnknown* pUnk); + + [propget, id(DISPID_IHTMLELEMENT2_CLIENTHEIGHT), displaybind, bindable] + LONG clientHeight(); + + [propget, id(DISPID_IHTMLELEMENT2_CLIENTWIDTH), displaybind, bindable] + LONG clientWidth(); + + [propget, id(DISPID_IHTMLELEMENT2_CLIENTTOP), displaybind, bindable] + LONG clientTop(); + + [propget, id(DISPID_IHTMLELEMENT2_CLIENTLEFT), displaybind, bindable] + LONG clientLeft(); + + [id(DISPID_IHTMLELEMENT2_ATTACHEVENT)] + VARIANT_BOOL attachEvent( + [in] BSTR event, + [in] IDispatch* pDisp); + + [id(DISPID_IHTMLELEMENT2_DETACHEVENT)] + void detachEvent( + [in] BSTR event, + [in] IDispatch* pDisp); + + [propget, id(DISPID_IHTMLELEMENT2_READYSTATE)] VARIANT readyState(); + + [propput, id(DISPID_IHTMLELEMENT2_ONREADYSTATECHANGE), displaybind, bindable] + void onreadystatechange(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONREADYSTATECHANGE), displaybind, bindable] + VARIANT onreadystatechange(); + + [propput, id(DISPID_IHTMLELEMENT2_ONROWSDELETE), displaybind, bindable] + void onrowsdelete(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONROWSDELETE), displaybind, bindable] + VARIANT onrowsdelete(); + + [propput, id(DISPID_IHTMLELEMENT2_ONROWSINSERTED), displaybind, bindable] + void onrowsinserted(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONROWSINSERTED), displaybind, bindable] + VARIANT onrowsinserted(); + + [propput, id(DISPID_IHTMLELEMENT2_ONCELLCHANGE), displaybind, bindable] + void oncellchange(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONCELLCHANGE), displaybind, bindable] + VARIANT oncellchange(); + + [propput, id(DISPID_IHTMLELEMENT2_DIR), displaybind, bindable] + void dir(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT2_DIR), displaybind, bindable] + BSTR dir(); + + [id(DISPID_IHTMLELEMENT2_CREATECONTROLRANGE)] + IDispatch* createControlRange(); + + [propget, id(DISPID_IHTMLELEMENT2_SCROLLHEIGHT), displaybind, bindable] + LONG scrollHeight(); + + [propget, id(DISPID_IHTMLELEMENT2_SCROLLWIDTH), displaybind, bindable] + LONG scrollWidth(); + + [propput, id(DISPID_IHTMLELEMENT2_SCROLLTOP), displaybind, bindable] + void scrollTop(LONG v); + + [propget, id(DISPID_IHTMLELEMENT2_SCROLLTOP), displaybind, bindable] + LONG scrollTop(); + + [propput, id(DISPID_IHTMLELEMENT2_SCROLLLEFT), displaybind, bindable] + void scrollLeft(LONG v); + + [propget, id(DISPID_IHTMLELEMENT2_SCROLLLEFT), displaybind, bindable] + LONG scrollLeft(); + + [id(DISPID_IHTMLELEMENT2_CLEARATTRIBUTES)] + void clearAttributes(); + + [propput, id(DISPID_IHTMLELEMENT2_ONCONTEXTMENU), displaybind, bindable] + void oncontextmenu(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONCONTEXTMENU), displaybind, bindable] + VARIANT oncontextmenu(); + + [id(DISPID_IHTMLELEMENT2_INSERTADJACENTELEMENT)] + IHTMLElement* insertAdjacentElement( + [in] BSTR where, + [in] IHTMLElement* insertedElement); + + [id(DISPID_IHTMLELEMENT2_APPLYELEMENT)] + IHTMLElement* applyElement([in] IHTMLElement* apply,[in] BSTR where); + + [id(DISPID_IHTMLELEMENT2_GETADJACENTTEXT)] + BSTR getAdjacentText([in] BSTR where); + + [id(DISPID_IHTMLELEMENT2_REPLACEADJACENTTEXT)] + BSTR replaceAdjacentText([in] BSTR where,[in] BSTR newText); + + [propget, id(DISPID_IHTMLELEMENT2_CANHAVECHILDREN)] + VARIANT_BOOL canHaveChildren(); + + [id(DISPID_IHTMLELEMENT2_ADDBEHAVIOR)] + LONG addBehavior([in] BSTR bstrUrl,[optional, in] VARIANT* pvarFactory); + + [id(DISPID_IHTMLELEMENT2_REMOVEBEHAVIOR)] + VARIANT_BOOL removeBehavior([in] LONG cookie); + + [propget, id(DISPID_IHTMLELEMENT2_RUNTIMESTYLE), nonbrowsable] + IHTMLStyle* runtimeStyle(); + + [propget, id(DISPID_IHTMLELEMENT2_BEHAVIORURNS)] + IDispatch* behaviorUrns(); + + [propput, id(DISPID_IHTMLELEMENT2_TAGURN)] + void tagUrn(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT2_TAGURN)] + BSTR tagUrn(); + + [propput, id(DISPID_IHTMLELEMENT2_ONBEFOREEDITFOCUS), displaybind, bindable] + void onbeforeeditfocus(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT2_ONBEFOREEDITFOCUS), displaybind, bindable] + VARIANT onbeforeeditfocus(); + + [propget, id(DISPID_IHTMLELEMENT2_READYSTATEVALUE), hidden, restricted] + LONG readyStateValue(); + + [id(DISPID_IHTMLELEMENT2_GETELEMENTSBYTAGNAME)] + IHTMLElementCollection* getElementsByTagName([in] BSTR v); + + [id(DISPID_IHTMLELEMENT3_MERGEATTRIBUTES)] + void mergeAttributes( + [in] IHTMLElement* mergeThis, + [optional, in] VARIANT* pvarFlags); + + [propget, id(DISPID_IHTMLELEMENT3_ISMULTILINE)] + VARIANT_BOOL isMultiLine(); + + [propget, id(DISPID_IHTMLELEMENT3_CANHAVEHTML)] + VARIANT_BOOL canHaveHTML(); + + [propput, id(DISPID_IHTMLELEMENT3_ONLAYOUTCOMPLETE), displaybind, bindable] + void onlayoutcomplete(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONLAYOUTCOMPLETE), displaybind, bindable] + VARIANT onlayoutcomplete(); + + [propput, id(DISPID_IHTMLELEMENT3_ONPAGE), displaybind, bindable] + void onpage(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONPAGE), displaybind, bindable] + VARIANT onpage(); + + [propput, id(DISPID_IHTMLELEMENT3_INFLATEBLOCK), hidden, restricted, nonbrowsable] + void inflateBlock(VARIANT_BOOL v); + + [propget, id(DISPID_IHTMLELEMENT3_INFLATEBLOCK), hidden, restricted, nonbrowsable] + VARIANT_BOOL inflateBlock(); + + [propput, id(DISPID_IHTMLELEMENT3_ONBEFOREDEACTIVATE), displaybind, bindable] + void onbeforedeactivate(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONBEFOREDEACTIVATE), displaybind, bindable] + VARIANT onbeforedeactivate(); + + [id(DISPID_IHTMLELEMENT3_SETACTIVE)] + void setActive(); + + [propput, id(DISPID_IHTMLELEMENT3_CONTENTEDITABLE), displaybind, bindable] + void contentEditable(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT3_CONTENTEDITABLE), displaybind, bindable] + BSTR contentEditable(); + + [propget, id(DISPID_IHTMLELEMENT3_ISCONTENTEDITABLE)] + VARIANT_BOOL isContentEditable(); + + [propput, id(DISPID_IHTMLELEMENT3_HIDEFOCUS), displaybind, bindable] + void hideFocus(VARIANT_BOOL v); + + [propget, id(DISPID_IHTMLELEMENT3_HIDEFOCUS), displaybind, bindable] + VARIANT_BOOL hideFocus(); + + [propput, id(DISPID_IHTMLELEMENT3_DISABLED), displaybind, bindable] + void disabled(VARIANT_BOOL v); + + [propget, id(DISPID_IHTMLELEMENT3_DISABLED), displaybind, bindable] + VARIANT_BOOL disabled(); + + [propget, id(DISPID_IHTMLELEMENT3_ISDISABLED)] + VARIANT_BOOL isDisabled(); + + [propput, id(DISPID_IHTMLELEMENT3_ONMOVE), displaybind, bindable] + void onmove(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONMOVE), displaybind, bindable] + VARIANT onmove(); + + [propput, id(DISPID_IHTMLELEMENT3_ONCONTROLSELECT), displaybind, bindable] + void oncontrolselect(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONCONTROLSELECT), displaybind, bindable] + VARIANT oncontrolselect(); + + [id(DISPID_IHTMLELEMENT3_FIREEVENT)] + VARIANT_BOOL fireEvent( + [in] BSTR bstrEventName, + [optional, in] VARIANT* pvarEventObject); + + [propput, id(DISPID_IHTMLELEMENT3_ONRESIZESTART), displaybind, bindable] + void onresizestart(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONRESIZESTART), displaybind, bindable] + VARIANT onresizestart(); + + [propput, id(DISPID_IHTMLELEMENT3_ONRESIZEEND), displaybind, bindable] + void onresizeend(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONRESIZEEND), displaybind, bindable] + VARIANT onresizeend(); + + [propput, id(DISPID_IHTMLELEMENT3_ONMOVESTART), displaybind, bindable] + void onmovestart(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONMOVESTART), displaybind, bindable] + VARIANT onmovestart(); + + [propput, id(DISPID_IHTMLELEMENT3_ONMOVEEND), displaybind, bindable] + void onmoveend(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONMOVEEND), displaybind, bindable] + VARIANT onmoveend(); + + [propput, id(DISPID_IHTMLELEMENT3_ONMOUSEENTER), displaybind, bindable] + void onmouseenter(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONMOUSEENTER), displaybind, bindable] + VARIANT onmouseenter(); + + [propput, id(DISPID_IHTMLELEMENT3_ONMOUSELEAVE), displaybind, bindable] + void onmouseleave(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONMOUSELEAVE), displaybind, bindable] + VARIANT onmouseleave(); + + [propput, id(DISPID_IHTMLELEMENT3_ONACTIVATE), displaybind, bindable] + void onactivate(VARIANT v); + [propget, id(DISPID_IHTMLELEMENT3_ONACTIVATE), displaybind, bindable] VARIANT onactivate(); + + [propput, id(DISPID_IHTMLELEMENT3_ONDEACTIVATE), displaybind, bindable] + void ondeactivate(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT3_ONDEACTIVATE), displaybind, bindable] + VARIANT ondeactivate(); + + [id(DISPID_IHTMLELEMENT3_DRAGDROP)] + VARIANT_BOOL dragDrop(); + + [propget, id(DISPID_IHTMLELEMENT3_GLYPHMODE), hidden, restricted, nonbrowsable] + LONG glyphMode(); + + [propput, id(DISPID_IHTMLELEMENT4_ONMOUSEWHEEL), displaybind, bindable] + void onmousewheel(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT4_ONMOUSEWHEEL), displaybind, bindable] + VARIANT onmousewheel(); + + [id(DISPID_IHTMLELEMENT4_NORMALIZE)] + void normalize(); + + [id(DISPID_IHTMLELEMENT4_GETATTRIBUTENODE)] + IHTMLDOMAttribute* getAttributeNode([in] BSTR bstrname); + + [id(DISPID_IHTMLELEMENT4_SETATTRIBUTENODE)] + IHTMLDOMAttribute* setAttributeNode([in] IHTMLDOMAttribute* pattr); + + [id(DISPID_IHTMLELEMENT4_REMOVEATTRIBUTENODE)] + IHTMLDOMAttribute* removeAttributeNode([in] IHTMLDOMAttribute* pattr); + + [propput, id(DISPID_IHTMLELEMENT4_ONBEFOREACTIVATE), displaybind, bindable] + void onbeforeactivate(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT4_ONBEFOREACTIVATE), displaybind, bindable] + VARIANT onbeforeactivate(); + + [propput, id(DISPID_IHTMLELEMENT4_ONFOCUSIN), displaybind, bindable] + void onfocusin(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT4_ONFOCUSIN), displaybind, bindable] + VARIANT onfocusin(); + + [propput, id(DISPID_IHTMLELEMENT4_ONFOCUSOUT), displaybind, bindable] + void onfocusout(VARIANT v); + + [propget, id(DISPID_IHTMLELEMENT4_ONFOCUSOUT), displaybind, bindable] + VARIANT onfocusout(); + + [propget, id(DISPID_IHTMLUNIQUENAME_UNIQUENUMBER), hidden] + LONG uniqueNumber(); + + [propget, id(DISPID_IHTMLUNIQUENAME_UNIQUEID), hidden] + BSTR uniqueID(); + + [propget, id(DISPID_IHTMLDOMNODE_NODETYPE)] + LONG nodeType(); + + [propget, id(DISPID_IHTMLDOMNODE_PARENTNODE)] + IHTMLDOMNode* parentNode(); + + [id(DISPID_IHTMLDOMNODE_HASCHILDNODES)] + VARIANT_BOOL hasChildNodes(); + + [propget, id(DISPID_IHTMLDOMNODE_CHILDNODES)] + IDispatch* childNodes(); + + [propget, id(DISPID_IHTMLDOMNODE_ATTRIBUTES)] + IDispatch* attributes(); + + [id(DISPID_IHTMLDOMNODE_INSERTBEFORE)] + IHTMLDOMNode* insertBefore( + [in] IHTMLDOMNode* newChild, + [optional, in] VARIANT refChild); + + [id(DISPID_IHTMLDOMNODE_REMOVECHILD)] + IHTMLDOMNode* removeChild([in] IHTMLDOMNode* oldChild); + + [id(DISPID_IHTMLDOMNODE_REPLACECHILD)] + IHTMLDOMNode* replaceChild( + [in] IHTMLDOMNode* newChild, + [in] IHTMLDOMNode* oldChild); + + [id(DISPID_IHTMLDOMNODE_CLONENODE)] + IHTMLDOMNode* cloneNode([in] VARIANT_BOOL fDeep); + + [id(DISPID_IHTMLDOMNODE_REMOVENODE)] + IHTMLDOMNode* removeNode([defaultvalue(0), in] VARIANT_BOOL fDeep); + + [id(DISPID_IHTMLDOMNODE_SWAPNODE)] + IHTMLDOMNode* swapNode([in] IHTMLDOMNode* otherNode); + + [id(DISPID_IHTMLDOMNODE_REPLACENODE)] + IHTMLDOMNode* replaceNode([in] IHTMLDOMNode* replacement); + + [id(DISPID_IHTMLDOMNODE_APPENDCHILD)] + IHTMLDOMNode* appendChild([in] IHTMLDOMNode* newChild); + + [propget, id(DISPID_IHTMLDOMNODE_NODENAME)] + BSTR nodeName(); + + [propput, id(DISPID_IHTMLDOMNODE_NODEVALUE)] + void nodeValue(VARIANT v); + + [propget, id(DISPID_IHTMLDOMNODE_NODEVALUE)] + VARIANT nodeValue(); + + [propget, id(DISPID_IHTMLDOMNODE_FIRSTCHILD)] + IHTMLDOMNode* firstChild(); + + [propget, id(DISPID_IHTMLDOMNODE_LASTCHILD)] + IHTMLDOMNode* lastChild(); + + [propget, id(DISPID_IHTMLDOMNODE_PREVIOUSSIBLING)] + IHTMLDOMNode* previousSibling(); + + [propget, id(DISPID_IHTMLDOMNODE_NEXTSIBLING)] + IHTMLDOMNode* nextSibling(); + + [propget, id(DISPID_IHTMLDOMNODE2_OWNERDOCUMENT)] + IDispatch* ownerDocument(); + + [propput, id(DISPID_IHTMLDATABINDING_DATAFLD)] + void dataFld(BSTR v); + + [propget, id(DISPID_IHTMLDATABINDING_DATAFLD)] + BSTR dataFld(); + + [propput, id(DISPID_IHTMLDATABINDING_DATASRC)] + void dataSrc(BSTR v); + + [propget, id(DISPID_IHTMLDATABINDING_DATASRC)] + BSTR dataSrc(); + + [propput, id(DISPID_IHTMLDATABINDING_DATAFORMATAS)] + void dataFormatAs(BSTR v); + + [propget, id(DISPID_IHTMLDATABINDING_DATAFORMATAS)] + BSTR dataFormatAs(); + + [id(DISPID_IHTMLELEMENT5_IE8_GETATTRIBUTENODE)] + IHTMLDOMAttribute2 *ie8_getAttributeNode([in] BSTR bstrname); + + [id(DISPID_IHTMLELEMENT5_IE8_SETATTRIBUTENODE)] + IHTMLDOMAttribute2 *ie8_setAttributeNode([in] IHTMLDOMAttribute2 *pattr); + + [id(DISPID_IHTMLELEMENT5_IE8_REMOVEATTRIBUTENODE)] + IHTMLDOMAttribute2 *ie8_removeAttributeNode([in] IHTMLDOMAttribute2 *pattr); + + [id(DISPID_IHTMLELEMENT5_HASATTRIBUTE)] + VARIANT_BOOL hasAttribute([in] BSTR name); + + [propput, id(DISPID_IHTMLELEMENT5_ROLE), displaybind, bindable] + void role(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ROLE), displaybind, bindable] + BSTR role(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIABUSY), displaybind, bindable] + void ariaBusy(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIABUSY), displaybind, bindable] + BSTR ariaBusy(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIACHECKED), displaybind, bindable] + void ariaChecked(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIACHECKED), displaybind, bindable] + BSTR ariaChecked(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIADISABLED), displaybind, bindable] + void ariaDisabled(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIADISABLED), displaybind, bindable] + BSTR ariaDisabled(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAEXPANDED), displaybind, bindable] + void ariaExpanded(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAEXPANDED), displaybind, bindable] + BSTR ariaExpanded(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAHASPOPUP), displaybind, bindable] + void ariaHaspopup(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAHASPOPUP), displaybind, bindable] + BSTR ariaHaspopup(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAHIDDEN), displaybind, bindable] + void ariaHidden(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAHIDDEN), displaybind, bindable] + BSTR ariaHidden(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAINVALID), displaybind, bindable] + void ariaInvalid(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAINVALID), displaybind, bindable] + BSTR ariaInvalid(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAMULTISELECTABLE), displaybind, bindable] + void ariaMultiselectable(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAMULTISELECTABLE), displaybind, bindable] + BSTR ariaMultiselectable(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAPRESSED), displaybind, bindable] + void ariaPressed(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAPRESSED), displaybind, bindable] + BSTR ariaPressed(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAREADONLY), displaybind, bindable] + void ariaReadonly(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAREADONLY), displaybind, bindable] + BSTR ariaReadonly(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAREQUIRED), displaybind, bindable] + void ariaRequired(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAREQUIRED), displaybind, bindable] + BSTR ariaRequired(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIASECRET), displaybind, bindable] + void ariaSecret(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIASECRET), displaybind, bindable] + BSTR ariaSecret(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIASELECTED), displaybind, bindable] + void ariaSelected(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIASELECTED), displaybind, bindable] + BSTR ariaSelected(); + + [id(DISPID_IHTMLELEMENT5_IE8_GETATTRIBUTE)] + VARIANT ie8_getAttribute([in] BSTR strAttributeName); + + [id(DISPID_IHTMLELEMENT5_IE8_SETATTRIBUTE)] + void ie8_setAttribute([in] BSTR strAttributeName,[in] VARIANT AttributeValue); + + [id(DISPID_IHTMLELEMENT5_IE8_REMOVEATTRIBUTE)] + VARIANT_BOOL ie8_removeAttribute([in] BSTR strAttributeName); + + [propget, id(DISPID_IHTMLELEMENT5_IE8_ATTRIBUTES)] + IHTMLAttributeCollection3 *ie8_attributes(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAVALUENOW), displaybind, bindable] + void ariaValuenow(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAVALUENOW), displaybind, bindable] + BSTR ariaValuenow(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAPOSINSET), displaybind, bindable] + void ariaPosinset(short v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAPOSINSET), displaybind, bindable] + short ariaPosinset(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIASETSIZE), displaybind, bindable] + void ariaSetsize(short v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIASETSIZE), displaybind, bindable] + short ariaSetsize(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIALEVEL), displaybind, bindable] + void ariaLevel(short v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIALEVEL), displaybind, bindable] + short ariaLevel(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAVALUEMIN), displaybind, bindable] + void ariaValuemin(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAVALUEMIN), displaybind, bindable] + BSTR ariaValuemin(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAVALUEMAX), displaybind, bindable] + void ariaValuemax(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAVALUEMAX), displaybind, bindable] + BSTR ariaValuemax(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIACONTROLS), displaybind, bindable] + void ariaControls(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIACONTROLS), displaybind, bindable] + BSTR ariaControls(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIADESCRIBEDBY), displaybind, bindable] + void ariaDescribedby(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIADESCRIBEDBY), displaybind, bindable] + BSTR ariaDescribedby(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAFLOWTO), displaybind, bindable] + void ariaFlowto(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAFLOWTO), displaybind, bindable] + BSTR ariaFlowto(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIALABELLEDBY), displaybind, bindable] + void ariaLabelledby(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIALABELLEDBY), displaybind, bindable] + BSTR ariaLabelledby(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAACTIVEDESCENDANT), displaybind, bindable] + void ariaActivedescendant(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAACTIVEDESCENDANT), displaybind, bindable] + BSTR ariaActivedescendant(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIAOWNS), displaybind, bindable] + void ariaOwns(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIAOWNS), displaybind, bindable] + BSTR ariaOwns(); + + [id(DISPID_IHTMLELEMENT5_HASATTRIBUTES)] + VARIANT_BOOL hasAttributes(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIALIVE), displaybind, bindable] + void ariaLive(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIALIVE), displaybind, bindable] + BSTR ariaLive(); + + [propput, id(DISPID_IHTMLELEMENT5_ARIARELEVANT), displaybind, bindable] + void ariaRelevant(BSTR v); + + [propget, id(DISPID_IHTMLELEMENT5_ARIARELEVANT), displaybind, bindable] + BSTR ariaRelevant(); + + [id(DISPID_IELEMENTSELECTOR_QUERYSELECTOR)] + IHTMLElement *querySelector([in] BSTR v); + + [id(DISPID_IELEMENTSELECTOR_QUERYSELECTORALL)] + IHTMLDOMChildrenCollection *querySelectorAll([in] BSTR v); + + [propget, id(DISPID_IHTMLDOMCONSTRUCTOR_CONSTRUCTOR), hidden] + IDispatch *constructor(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_HREF), displaybind, bindable] + void href(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_HREF), displaybind, bindable] + BSTR href(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_TARGET), displaybind, bindable] + void target(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_TARGET), displaybind, bindable] + BSTR target(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_REL), displaybind, bindable] + void rel(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_REL), displaybind, bindable] + BSTR rel(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_REV), displaybind, bindable] + void rev(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_REV), displaybind, bindable] + BSTR rev(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_URN), displaybind, bindable] + void urn(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_URN), displaybind, bindable] + BSTR urn(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_METHODS), displaybind, bindable] + void Methods(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_METHODS), displaybind, bindable] + BSTR Methods(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_NAME), displaybind, bindable] + void name(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_NAME), displaybind, bindable] + BSTR name(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_HOST)] + void host(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_HOST)] + BSTR host(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_HOSTNAME)] + void hostname(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_HOSTNAME)] + BSTR hostname(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_PATHNAME)] + void pathname(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_PATHNAME)] + BSTR pathname(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_PORT)] + void port(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_PORT)] + BSTR port(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_PROTOCOL)] + void protocol(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_PROTOCOL)] + BSTR protocol(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_SEARCH)] + void search(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_SEARCH)] + BSTR search(); + + [propput, id(DISPID_IHTMLANCHORELEMENT_HASH)] + void hash(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT_HASH)] + BSTR hash(); + + [propget, id(DISPID_IHTMLANCHORELEMENT_PROTOCOLLONG)] + BSTR protocolLong(); + + [propget, id(DISPID_IHTMLANCHORELEMENT_MIMETYPE)] + BSTR mimeType(); + + [propget, id(DISPID_IHTMLANCHORELEMENT_NAMEPROP)] + BSTR nameProp(); + + [propput, id(DISPID_IHTMLANCHORELEMENT2_CHARSET), displaybind, bindable] + void charset(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT2_CHARSET), displaybind, bindable] + BSTR charset(); + + [propput, id(DISPID_IHTMLANCHORELEMENT2_COORDS), displaybind, bindable] + void coords(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT2_COORDS), displaybind, bindable] + BSTR coords(); + + [propput, id(DISPID_IHTMLANCHORELEMENT2_HREFLANG), displaybind, bindable] + void hreflang(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT2_HREFLANG), displaybind, bindable] + BSTR hreflang(); + + [propput, id(DISPID_IHTMLANCHORELEMENT2_SHAPE), displaybind, bindable] + void shape(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT2_SHAPE), displaybind, bindable] + BSTR shape(); + + [propput, id(DISPID_IHTMLANCHORELEMENT2_TYPE), displaybind, bindable] + void type(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT2_TYPE), displaybind, bindable] + BSTR type(); + + [propput, id(DISPID_IHTMLANCHORELEMENT3_IE8_SHAPE)] + void ie8_shape(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT3_IE8_SHAPE)] + BSTR ie8_shape(); + + [propput, id(DISPID_IHTMLANCHORELEMENT3_IE8_COORDS)] + void ie8_coords(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT3_IE8_COORDS)] + BSTR ie8_coords(); + + [propput, id(DISPID_IHTMLANCHORELEMENT3_IE8_HREF)] + void ie8_href(BSTR v); + + [propget, id(DISPID_IHTMLANCHORELEMENT3_IE8_HREF)] + BSTR ie8_href(); +} + +/***************************************************************************** + * IHTMLElementCollection interface + */ +[ + odl, + oleautomation, + dual, + uuid(3050F21F-98B5-11CF-BB82-00AA00BDCE0B) +] +interface IHTMLElementCollection : IDispatch +{ + [id(DISPID_IHTMLELEMENTCOLLECTION_TOSTRING)] + HRESULT toString([retval, out] BSTR *String); + + [propput, id(DISPID_IHTMLELEMENTCOLLECTION_LENGTH)] + HRESULT length([in] LONG v); + + [propget, id(DISPID_IHTMLELEMENTCOLLECTION_LENGTH)] + HRESULT length([retval, out] LONG *p); + + [propget, id(DISPID_IHTMLELEMENTCOLLECTION__NEWENUM)] + HRESULT _newEnum([retval, out] IUnknown **p); + + [id(DISPID_IHTMLELEMENTCOLLECTION_ITEM)] + HRESULT item( + [optional, in] VARIANT name, + [optional, in] VARIANT index, + [retval, out] IDispatch **pdisp); + + [id(DISPID_IHTMLELEMENTCOLLECTION_TAGS)] + HRESULT tags( + [in] VARIANT tagName, + [retval, out] IDispatch **pdisp); +} + +/***************************************************************************** + * DispHTMLElementCollection dispinterface + */ +[ + hidden, + uuid(3050f56b-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLElementCollection +{ +properties: +methods: + [id(DISPID_IHTMLELEMENTCOLLECTION_TOSTRING)] + BSTR toString(); + + [propput, id(DISPID_IHTMLELEMENTCOLLECTION_LENGTH)] + void length(LONG v); + + [propget, id(DISPID_IHTMLELEMENTCOLLECTION_LENGTH)] + LONG length(); [propget, id(DISPID_IHTMLELEMENTCOLLECTION__NEWENUM), hidden, restricted] IUnknown *_newEnum(); @@ -8734,314 +9230,44 @@ interface IHTMLSelectElement : IDispatch [id(DISPID_IHTMLSELECTELEMENT_ADD)] HRESULT add( [in] IHTMLElement *element, - [optional, in] VARIANT before); - - [id(DISPID_IHTMLSELECTELEMENT_REMOVE)] - HRESULT remove([defaultvalue(-1), in] LONG index); - - [propput, id(DISPID_IHTMLSELECTELEMENT_LENGTH)] - HRESULT length([in] LONG v); - - [propget, id(DISPID_IHTMLSELECTELEMENT_LENGTH)] - HRESULT length([retval, out] LONG *p); - - [propget, id(DISPID_IHTMLSELECTELEMENT__NEWENUM), hidden, restricted] - HRESULT _newEnum([retval, out] IUnknown **p); - - [id(DISPID_IHTMLSELECTELEMENT_ITEM)] - HRESULT item( - [optional, in] VARIANT name, - [optional, in] VARIANT index, - [retval, out] IDispatch **pdisp); - - [id(DISPID_IHTMLSELECTELEMENT_TAGS)] - HRESULT tags( - [in] VARIANT tagName, - [retval, out] IDispatch **pdisp); -} - -/***************************************************************************** - * DispHTMLSelectElement dispinterface - */ -[ - hidden, - uuid(3050f531-98b5-11cf-bb82-00aa00bdce0b) -] -dispinterface DispHTMLSelectElement -{ -properties: -methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttributeValue, - [in, defaultvalue(1)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(0)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(1)] LONG lFlags); - - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); - - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); - - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); - - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement *parentElement(); - - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle *style(); - - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); - - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] - IDispatch *document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([in, optional] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement *pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement *offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement *parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] - void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection *filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); - - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); - - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); + [optional, in] VARIANT before); - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); + [id(DISPID_IHTMLSELECTELEMENT_REMOVE)] + HRESULT remove([defaultvalue(-1), in] LONG index); - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); + [propput, id(DISPID_IHTMLSELECTELEMENT_LENGTH)] + HRESULT length([in] LONG v); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); + [propget, id(DISPID_IHTMLSELECTELEMENT_LENGTH)] + HRESULT length([retval, out] LONG *p); - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); + [propget, id(DISPID_IHTMLSELECTELEMENT__NEWENUM), hidden, restricted] + HRESULT _newEnum([retval, out] IUnknown **p); - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); + [id(DISPID_IHTMLSELECTELEMENT_ITEM)] + HRESULT item( + [optional, in] VARIANT name, + [optional, in] VARIANT index, + [retval, out] IDispatch **pdisp); - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch *children(); + [id(DISPID_IHTMLSELECTELEMENT_TAGS)] + HRESULT tags( + [in] VARIANT tagName, + [retval, out] IDispatch **pdisp); +} - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch *all(); +/***************************************************************************** + * DispHTMLSelectElement dispinterface + */ +[ + hidden, + uuid(3050f531-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLSelectElement +{ +properties: +methods: + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] BSTR scopeName(); @@ -9747,333 +9973,63 @@ interface IHTMLOptionElement : IDispatch [propget, id(DISPID_IHTMLOPTIONELEMENT_INDEX)] HRESULT index([retval, out] LONG *p); - [propput, id(DISPID_IHTMLOPTIONELEMENT_TEXT)] - HRESULT text([in] BSTR v); - - [propget, id(DISPID_IHTMLOPTIONELEMENT_TEXT)] - HRESULT text([retval, out] BSTR *p); - - [propget, id(DISPID_IHTMLOPTIONELEMENT_FORM)] - HRESULT form([retval, out] IHTMLFormElement **p); -} - -[ - odl, - oleautomation, - dual, - uuid(3050f820-98b5-11cf-bb82-00aa00bdce0b) -] -interface IHTMLOptionElement3 : IDispatch -{ - [propput, id(DISPID_IHTMLOPTIONELEMENT3_LABEL), displaybind, bindable] - HRESULT label([in] BSTR v); - - [propget, id(DISPID_IHTMLOPTIONELEMENT3_LABEL), displaybind, bindable] - HRESULT label([retval, out] BSTR * p); -} - -/***************************************************************************** - * IHTMLOptionElementFactory interface - */ -[ - odl, - oleautomation, - dual, - uuid(3050F38C-98B5-11Cf-BB82-00AA00BDCE0B) -] -interface IHTMLOptionElementFactory : IDispatch -{ - [id(DISPID_IHTMLOPTIONELEMENTFACTORY_CREATE)] - HRESULT create( - [optional, in] VARIANT text, - [optional, in] VARIANT value, - [optional, in] VARIANT defaultselected, - [optional, in] VARIANT selected, - [retval, out] IHTMLOptionElement **optelem); -} - -/***************************************************************************** - * DispHTMLOptionElement dispinterface - */ -[ - hidden, - uuid(3050f52b-98b5-11cf-bb82-00aa00bdce0b) -] -dispinterface DispHTMLOptionElement -{ -properties: -methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttributeValue, - [in, defaultvalue(1)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(0)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(1)] LONG lFlags); - - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); - - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); - - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); - - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement *parentElement(); - - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle *style(); - - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); - - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] - IDispatch *document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([in, optional] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement *pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement *offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement *parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] - void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection *filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); - - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); - - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); + [propput, id(DISPID_IHTMLOPTIONELEMENT_TEXT)] + HRESULT text([in] BSTR v); - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); + [propget, id(DISPID_IHTMLOPTIONELEMENT_TEXT)] + HRESULT text([retval, out] BSTR *p); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); + [propget, id(DISPID_IHTMLOPTIONELEMENT_FORM)] + HRESULT form([retval, out] IHTMLFormElement **p); +} - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); +[ + odl, + oleautomation, + dual, + uuid(3050f820-98b5-11cf-bb82-00aa00bdce0b) +] +interface IHTMLOptionElement3 : IDispatch +{ + [propput, id(DISPID_IHTMLOPTIONELEMENT3_LABEL), displaybind, bindable] + HRESULT label([in] BSTR v); - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); + [propget, id(DISPID_IHTMLOPTIONELEMENT3_LABEL), displaybind, bindable] + HRESULT label([retval, out] BSTR * p); +} - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch *children(); +/***************************************************************************** + * IHTMLOptionElementFactory interface + */ +[ + odl, + oleautomation, + dual, + uuid(3050F38C-98B5-11Cf-BB82-00AA00BDCE0B) +] +interface IHTMLOptionElementFactory : IDispatch +{ + [id(DISPID_IHTMLOPTIONELEMENTFACTORY_CREATE)] + HRESULT create( + [optional, in] VARIANT text, + [optional, in] VARIANT value, + [optional, in] VARIANT defaultselected, + [optional, in] VARIANT selected, + [retval, out] IHTMLOptionElement **optelem); +} - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch *all(); +/***************************************************************************** + * DispHTMLOptionElement dispinterface + */ +[ + hidden, + uuid(3050f52b-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLOptionElement +{ +properties: +methods: + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] BSTR scopeName(); @@ -10943,337 +10899,67 @@ interface IHTMLInputTextElement : IDispatch [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_STATUS)] HRESULT status([retval, out] VARIANT *p); - [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_DISABLED), displaybind, bindable] - HRESULT disabled([in] VARIANT_BOOL v); - - [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_DISABLED), displaybind, bindable] - HRESULT disabled([retval, out] VARIANT_BOOL *p); - - [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_FORM)] - HRESULT form([retval, out] IHTMLFormElement **p); - - [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_DEFAULTVALUE), displaybind, bindable, hidden] - HRESULT defaultValue([in] BSTR v); - - [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_DEFAULTVALUE), displaybind, bindable, hidden] - HRESULT defaultValue([retval, out] BSTR *p); - - [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_SIZE), displaybind, bindable] - HRESULT size([in] LONG v); - - [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_SIZE), displaybind, bindable] - HRESULT size([retval, out] LONG *p); - - [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_MAXLENGTH), displaybind, bindable] - HRESULT maxLength([in] LONG v); - - [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_MAXLENGTH), displaybind, bindable] - HRESULT maxLength([retval, out] LONG *p); - - [id(DISPID_IHTMLINPUTTEXTELEMENT_SELECT)] - HRESULT select(); - - [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_ONCHANGE), displaybind, bindable] - HRESULT onchange([in] VARIANT v); - - [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_ONCHANGE), displaybind, bindable] - HRESULT onchange([retval, out] VARIANT *p); - - [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_ONSELECT), displaybind, bindable] - HRESULT onselect([in] VARIANT v); - - [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_ONSELECT), displaybind, bindable] - HRESULT onselect([retval, out] VARIANT *p); - - [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_READONLY), displaybind, bindable] - HRESULT readOnly([in] VARIANT_BOOL v); - - [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_READONLY), displaybind, bindable] - HRESULT readOnly([retval, out] VARIANT_BOOL *p); - - [id(DISPID_IHTMLINPUTTEXTELEMENT_CREATETEXTRANGE)] - HRESULT createTextRange([retval, out] IHTMLTxtRange **range); -} - -[ - hidden, - uuid(3050f57d-98b5-11cf-bb82-00aa00bdce0b) -] -dispinterface DispHTMLInputElement -{ -properties: -methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttributeValue, - [in, defaultvalue(1)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(0)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(1)] LONG lFlags); - - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); - - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); - - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); - - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement *parentElement(); - - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle *style(); - - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); - - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] - IDispatch *document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([in, optional] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement *pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement *offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement *parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] - void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection *filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); - - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); - - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); + [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_DISABLED), displaybind, bindable] + HRESULT disabled([in] VARIANT_BOOL v); - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); + [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_DISABLED), displaybind, bindable] + HRESULT disabled([retval, out] VARIANT_BOOL *p); - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); + [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_FORM)] + HRESULT form([retval, out] IHTMLFormElement **p); - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); + [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_DEFAULTVALUE), displaybind, bindable, hidden] + HRESULT defaultValue([in] BSTR v); - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); + [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_DEFAULTVALUE), displaybind, bindable, hidden] + HRESULT defaultValue([retval, out] BSTR *p); - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); + [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_SIZE), displaybind, bindable] + HRESULT size([in] LONG v); - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); + [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_SIZE), displaybind, bindable] + HRESULT size([retval, out] LONG *p); - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); + [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_MAXLENGTH), displaybind, bindable] + HRESULT maxLength([in] LONG v); - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); + [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_MAXLENGTH), displaybind, bindable] + HRESULT maxLength([retval, out] LONG *p); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); + [id(DISPID_IHTMLINPUTTEXTELEMENT_SELECT)] + HRESULT select(); - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); + [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_ONCHANGE), displaybind, bindable] + HRESULT onchange([in] VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); + [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_ONCHANGE), displaybind, bindable] + HRESULT onchange([retval, out] VARIANT *p); - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); + [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_ONSELECT), displaybind, bindable] + HRESULT onselect([in] VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); + [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_ONSELECT), displaybind, bindable] + HRESULT onselect([retval, out] VARIANT *p); - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); + [propput, id(DISPID_IHTMLINPUTTEXTELEMENT_READONLY), displaybind, bindable] + HRESULT readOnly([in] VARIANT_BOOL v); - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); + [propget, id(DISPID_IHTMLINPUTTEXTELEMENT_READONLY), displaybind, bindable] + HRESULT readOnly([retval, out] VARIANT_BOOL *p); - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch *children(); + [id(DISPID_IHTMLINPUTTEXTELEMENT_CREATETEXTRANGE)] + HRESULT createTextRange([retval, out] IHTMLTxtRange **range); +} - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch *all(); +[ + hidden, + uuid(3050f57d-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLInputElement +{ +properties: +methods: + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] BSTR scopeName(); @@ -12105,315 +11791,45 @@ interface IHTMLTextAreaElement : IDispatch HRESULT onselect([retval, out] VARIANT *p); [propput, id(DISPID_IHTMLTEXTAREAELEMENT_READONLY), displaybind, bindable] - HRESULT readOnly([in] VARIANT_BOOL v); - - [propget, id(DISPID_IHTMLTEXTAREAELEMENT_READONLY), displaybind, bindable] - HRESULT readOnly([retval, out] VARIANT_BOOL *p); - - [propput, id(DISPID_IHTMLTEXTAREAELEMENT_ROWS), displaybind, bindable] - HRESULT rows([in] LONG v); - - [propget, id(DISPID_IHTMLTEXTAREAELEMENT_ROWS), displaybind, bindable] - HRESULT rows([retval, out] LONG *p); - - [propput, id(DISPID_IHTMLTEXTAREAELEMENT_COLS), displaybind, bindable] - HRESULT cols([in] LONG v); - - [propget, id(DISPID_IHTMLTEXTAREAELEMENT_COLS), displaybind, bindable] - HRESULT cols([retval, out] LONG *p); - - [propput, id(DISPID_IHTMLTEXTAREAELEMENT_WRAP), displaybind, bindable] - HRESULT wrap([in] BSTR v); - - [propget, id(DISPID_IHTMLTEXTAREAELEMENT_WRAP), displaybind, bindable] - HRESULT wrap([retval, out] BSTR *p); - - [id(DISPID_IHTMLTEXTAREAELEMENT_CREATETEXTRANGE)] - HRESULT createTextRange([retval, out] IHTMLTxtRange **range); -} - -/***************************************************************************** - * DispHTMLUnknownElement interface - */ -[ - hidden, - uuid(3050f539-98b5-11cf-bb82-00aa00bdce0b) -] -dispinterface DispHTMLUnknownElement -{ -properties: -methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttributeValue, - [in, defaultvalue(1)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(0)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(1)] LONG lFlags); - - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); - - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); - - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); - - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement *parentElement(); - - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle *style(); - - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); - - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] - IDispatch *document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([in, optional] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement *pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement *offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement *parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] - void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection *filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); - - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); - - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); + HRESULT readOnly([in] VARIANT_BOOL v); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); + [propget, id(DISPID_IHTMLTEXTAREAELEMENT_READONLY), displaybind, bindable] + HRESULT readOnly([retval, out] VARIANT_BOOL *p); - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); + [propput, id(DISPID_IHTMLTEXTAREAELEMENT_ROWS), displaybind, bindable] + HRESULT rows([in] LONG v); - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); + [propget, id(DISPID_IHTMLTEXTAREAELEMENT_ROWS), displaybind, bindable] + HRESULT rows([retval, out] LONG *p); - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); + [propput, id(DISPID_IHTMLTEXTAREAELEMENT_COLS), displaybind, bindable] + HRESULT cols([in] LONG v); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); + [propget, id(DISPID_IHTMLTEXTAREAELEMENT_COLS), displaybind, bindable] + HRESULT cols([retval, out] LONG *p); - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); + [propput, id(DISPID_IHTMLTEXTAREAELEMENT_WRAP), displaybind, bindable] + HRESULT wrap([in] BSTR v); - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); + [propget, id(DISPID_IHTMLTEXTAREAELEMENT_WRAP), displaybind, bindable] + HRESULT wrap([retval, out] BSTR *p); - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch *children(); + [id(DISPID_IHTMLTEXTAREAELEMENT_CREATETEXTRANGE)] + HRESULT createTextRange([retval, out] IHTMLTxtRange **range); +} - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch *all(); +/***************************************************************************** + * DispHTMLUnknownElement interface + */ +[ + hidden, + uuid(3050f539-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLUnknownElement +{ +properties: +methods: + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] BSTR scopeName(); @@ -13126,10 +12542,10 @@ coclass COpsProfile * IOmNavigator interface */ [ - odl, - oleautomation, - dual, - uuid(FECEAAA5-8405-11CF-8BA1-00AA00476DA6) + odl, + oleautomation, + dual, + uuid(FECEAAA5-8405-11CF-8BA1-00AA00476DA6) ] interface IOmNavigator : IDispatch { @@ -16955,333 +16371,63 @@ interface IHTMLCommentElement : IDispatch } /***************************************************************************** - * IHTMLCommentElement2 interface - */ -[ - odl, - oleautomation, - dual, - uuid(3050f813-98b5-11cf-bb82-00aa00bdce0b) -] -interface IHTMLCommentElement2 : IDispatch -{ - [propput, id(DISPID_IHTMLCOMMENTELEMENT2_DATA)] - HRESULT data([in] BSTR v); - - [propget, id(DISPID_IHTMLCOMMENTELEMENT2_DATA)] - HRESULT data([out, retval] BSTR *p); - - [propget, id(DISPID_IHTMLCOMMENTELEMENT2_LENGTH)] - HRESULT length([out, retval] LONG *p); - - [id(DISPID_IHTMLCOMMENTELEMENT2_SUBSTRINGDATA)] - HRESULT substringData( - [in] LONG offset, - [in] LONG Count, - [out, retval] BSTR *pbstrsubString); - - [id(DISPID_IHTMLCOMMENTELEMENT2_APPENDDATA)] - HRESULT appendData([in] BSTR bstrstring); - - [id(DISPID_IHTMLCOMMENTELEMENT2_INSERTDATA)] - HRESULT insertData( - [in] LONG offset, - [in] BSTR bstrstring); - - [id(DISPID_IHTMLCOMMENTELEMENT2_DELETEDATA)] - HRESULT deleteData( - [in] LONG offset, - [in] LONG Count); - - [id(DISPID_IHTMLCOMMENTELEMENT2_REPLACEDATA)] - HRESULT replaceData( - [in] LONG offset, - [in] LONG Count, - [in] BSTR bstrstring); -} - -/***************************************************************************** - * DispHTMLCommentElement dispinterface - */ -[ - hidden, - uuid(3050f50a-98b5-11cf-bb82-00aa00bdce0b) -] -dispinterface DispHTMLCommentElement -{ -properties: -methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttributeValue, - [in, defaultvalue(1)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(0)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(1)] LONG lFlags); - - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); - - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); - - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); - - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement *parentElement(); - - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle *style(); - - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); - - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] - IDispatch *document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([in, optional] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement *pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement *offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement *parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] - void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection *filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); - - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); - - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); + * IHTMLCommentElement2 interface + */ +[ + odl, + oleautomation, + dual, + uuid(3050f813-98b5-11cf-bb82-00aa00bdce0b) +] +interface IHTMLCommentElement2 : IDispatch +{ + [propput, id(DISPID_IHTMLCOMMENTELEMENT2_DATA)] + HRESULT data([in] BSTR v); - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); + [propget, id(DISPID_IHTMLCOMMENTELEMENT2_DATA)] + HRESULT data([out, retval] BSTR *p); - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); + [propget, id(DISPID_IHTMLCOMMENTELEMENT2_LENGTH)] + HRESULT length([out, retval] LONG *p); - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); + [id(DISPID_IHTMLCOMMENTELEMENT2_SUBSTRINGDATA)] + HRESULT substringData( + [in] LONG offset, + [in] LONG Count, + [out, retval] BSTR *pbstrsubString); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); + [id(DISPID_IHTMLCOMMENTELEMENT2_APPENDDATA)] + HRESULT appendData([in] BSTR bstrstring); - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); + [id(DISPID_IHTMLCOMMENTELEMENT2_INSERTDATA)] + HRESULT insertData( + [in] LONG offset, + [in] BSTR bstrstring); - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); + [id(DISPID_IHTMLCOMMENTELEMENT2_DELETEDATA)] + HRESULT deleteData( + [in] LONG offset, + [in] LONG Count); - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch *children(); + [id(DISPID_IHTMLCOMMENTELEMENT2_REPLACEDATA)] + HRESULT replaceData( + [in] LONG offset, + [in] LONG Count, + [in] BSTR bstrstring); +} - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch *all(); +/***************************************************************************** + * DispHTMLCommentElement dispinterface + */ +[ + hidden, + uuid(3050f50a-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLCommentElement +{ +properties: +methods: + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] BSTR scopeName(); @@ -19003,324 +18149,54 @@ interface IHTMLTableRow : IDispatch [propget, id(DISPID_IHTMLTABLEROW_BGCOLOR)] HRESULT bgColor([out, retval] VARIANT *p); - [propput, id(DISPID_IHTMLTABLEROW_BORDERCOLOR)] - HRESULT borderColor([in] VARIANT v); - - [propget, id(DISPID_IHTMLTABLEROW_BORDERCOLOR)] - HRESULT borderColor([out, retval] VARIANT *p); - - [propput, id(DISPID_IHTMLTABLEROW_BORDERCOLORLIGHT)] - HRESULT borderColorLight([in] VARIANT v); - - [propget, id(DISPID_IHTMLTABLEROW_BORDERCOLORLIGHT)] - HRESULT borderColorLight([out, retval] VARIANT *p); - - [propput, id(DISPID_IHTMLTABLEROW_BORDERCOLORDARK)] - HRESULT borderColorDark([in] VARIANT v); - - [propget, id(DISPID_IHTMLTABLEROW_BORDERCOLORDARK)] - HRESULT borderColorDark([out, retval] VARIANT *p); - - [propget, id(DISPID_IHTMLTABLEROW_ROWINDEX)] - HRESULT rowIndex([out, retval] LONG *p); - - [propget, id(DISPID_IHTMLTABLEROW_SECTIONROWINDEX)] - HRESULT sectionRowIndex([out, retval] LONG *p); - - [propget, id(DISPID_IHTMLTABLEROW_CELLS)] - HRESULT cells([out, retval] IHTMLElementCollection **p); - - [id(DISPID_IHTMLTABLEROW_INSERTCELL)] - HRESULT insertCell( - [in, defaultvalue(-1)] LONG index, - [out, retval] IDispatch **row); - - [id(DISPID_IHTMLTABLEROW_DELETECELL)] - HRESULT deleteCell([in, defaultvalue(-1)] LONG index); -} - -/***************************************************************************** - * DispHTMLTable interface - */ -[ - hidden, - uuid(3050f532-98b5-11cf-bb82-00aa00bdce0b) -] -dispinterface DispHTMLTable -{ -properties: -methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttributeValue, - [in, defaultvalue(1)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(0)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(1)] LONG lFlags); - - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); - - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); - - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); - - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement *parentElement(); - - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle *style(); - - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); - - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] - IDispatch *document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([in, optional] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement *pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement *offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement *parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] - void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection *filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); - - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); - - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); + [propput, id(DISPID_IHTMLTABLEROW_BORDERCOLOR)] + HRESULT borderColor([in] VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); + [propget, id(DISPID_IHTMLTABLEROW_BORDERCOLOR)] + HRESULT borderColor([out, retval] VARIANT *p); - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); + [propput, id(DISPID_IHTMLTABLEROW_BORDERCOLORLIGHT)] + HRESULT borderColorLight([in] VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); + [propget, id(DISPID_IHTMLTABLEROW_BORDERCOLORLIGHT)] + HRESULT borderColorLight([out, retval] VARIANT *p); - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); + [propput, id(DISPID_IHTMLTABLEROW_BORDERCOLORDARK)] + HRESULT borderColorDark([in] VARIANT v); - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); + [propget, id(DISPID_IHTMLTABLEROW_BORDERCOLORDARK)] + HRESULT borderColorDark([out, retval] VARIANT *p); - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); + [propget, id(DISPID_IHTMLTABLEROW_ROWINDEX)] + HRESULT rowIndex([out, retval] LONG *p); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); + [propget, id(DISPID_IHTMLTABLEROW_SECTIONROWINDEX)] + HRESULT sectionRowIndex([out, retval] LONG *p); - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); + [propget, id(DISPID_IHTMLTABLEROW_CELLS)] + HRESULT cells([out, retval] IHTMLElementCollection **p); - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); + [id(DISPID_IHTMLTABLEROW_INSERTCELL)] + HRESULT insertCell( + [in, defaultvalue(-1)] LONG index, + [out, retval] IDispatch **row); - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch *children(); + [id(DISPID_IHTMLTABLEROW_DELETECELL)] + HRESULT deleteCell([in, defaultvalue(-1)] LONG index); +} - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch *all(); +/***************************************************************************** + * DispHTMLTable interface + */ +[ + hidden, + uuid(3050f532-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLTable +{ +properties: +methods: + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] BSTR scopeName(); @@ -19981,356 +18857,86 @@ methods: VARIANT height(); [propput, id(DISPID_IHTMLTABLE_DATAPAGESIZE)] - void dataPageSize(LONG v); - - [propget, id(DISPID_IHTMLTABLE_DATAPAGESIZE)] - LONG dataPageSize(); - - [id(DISPID_IHTMLTABLE_NEXTPAGE)] - void nextPage(); - - [id(DISPID_IHTMLTABLE_PREVIOUSPAGE)] - void previousPage(); - - [propget, id(DISPID_IHTMLTABLE_THEAD)] - IHTMLTableSection *tHead(); - - [propget, id(DISPID_IHTMLTABLE_TFOOT)] - IHTMLTableSection *tFoot(); - - [propget, id(DISPID_IHTMLTABLE_TBODIES)] - IHTMLElementCollection *tBodies(); - - [propget, id(DISPID_IHTMLTABLE_CAPTION)] - IHTMLTableCaption *caption(); - - [id(DISPID_IHTMLTABLE_CREATETHEAD)] - IDispatch *createTHead(); - - [id(DISPID_IHTMLTABLE_DELETETHEAD)] - void deleteTHead(); - - [id(DISPID_IHTMLTABLE_CREATETFOOT)] - IDispatch *createTFoot(); - - [id(DISPID_IHTMLTABLE_DELETETFOOT)] - void deleteTFoot(); - - [id(DISPID_IHTMLTABLE_CREATECAPTION)] - IHTMLTableCaption *createCaption(); - - [id(DISPID_IHTMLTABLE_DELETECAPTION)] - void deleteCaption(); - - [id(DISPID_IHTMLTABLE_INSERTROW)] - IDispatch *insertRow([in, defaultvalue(-1)] LONG index); - - [id(DISPID_IHTMLTABLE_DELETEROW)] - void deleteRow([in, defaultvalue(-1)] LONG index); - - [id(DISPID_IHTMLTABLE2_FIRSTPAGE)] - void firstPage(); - - [id(DISPID_IHTMLTABLE2_LASTPAGE)] - void lastPage(); - - [propget, id(DISPID_IHTMLTABLE2_CELLS)] - IHTMLElementCollection *cells(); - - [id(DISPID_IHTMLTABLE2_MOVEROW)] - IDispatch *moveRow( - [in, defaultvalue(-1)] LONG indexFrom, - [in, defaultvalue(-1)] LONG indexTo); - - [propput, id(DISPID_IHTMLTABLE3_SUMMARY), displaybind, bindable] - void summary(BSTR v); - - [propget, id(DISPID_IHTMLTABLE3_SUMMARY), displaybind, bindable] - BSTR summary(); -} - -/***************************************************************************** - * DispHTMLTableRow dispinterface - */ -[ - hidden, - uuid(3050f535-98b5-11cf-bb82-00aa00bdce0b) -] -dispinterface DispHTMLTableRow -{ -properties: -methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttributeValue, - [in, defaultvalue(1)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(0)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(1)] LONG lFlags); - - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); - - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); - - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); - - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement *parentElement(); - - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle *style(); - - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); - - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] - IDispatch *document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([in, optional] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement *pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement *offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement *parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] - void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection *filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); + void dataPageSize(LONG v); - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); + [propget, id(DISPID_IHTMLTABLE_DATAPAGESIZE)] + LONG dataPageSize(); - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); + [id(DISPID_IHTMLTABLE_NEXTPAGE)] + void nextPage(); - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); + [id(DISPID_IHTMLTABLE_PREVIOUSPAGE)] + void previousPage(); - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); + [propget, id(DISPID_IHTMLTABLE_THEAD)] + IHTMLTableSection *tHead(); - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); + [propget, id(DISPID_IHTMLTABLE_TFOOT)] + IHTMLTableSection *tFoot(); - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); + [propget, id(DISPID_IHTMLTABLE_TBODIES)] + IHTMLElementCollection *tBodies(); - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); + [propget, id(DISPID_IHTMLTABLE_CAPTION)] + IHTMLTableCaption *caption(); - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); + [id(DISPID_IHTMLTABLE_CREATETHEAD)] + IDispatch *createTHead(); - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); + [id(DISPID_IHTMLTABLE_DELETETHEAD)] + void deleteTHead(); - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); + [id(DISPID_IHTMLTABLE_CREATETFOOT)] + IDispatch *createTFoot(); - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); + [id(DISPID_IHTMLTABLE_DELETETFOOT)] + void deleteTFoot(); - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); + [id(DISPID_IHTMLTABLE_CREATECAPTION)] + IHTMLTableCaption *createCaption(); - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); + [id(DISPID_IHTMLTABLE_DELETECAPTION)] + void deleteCaption(); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); + [id(DISPID_IHTMLTABLE_INSERTROW)] + IDispatch *insertRow([in, defaultvalue(-1)] LONG index); - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); + [id(DISPID_IHTMLTABLE_DELETEROW)] + void deleteRow([in, defaultvalue(-1)] LONG index); - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); + [id(DISPID_IHTMLTABLE2_FIRSTPAGE)] + void firstPage(); - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); + [id(DISPID_IHTMLTABLE2_LASTPAGE)] + void lastPage(); - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); + [propget, id(DISPID_IHTMLTABLE2_CELLS)] + IHTMLElementCollection *cells(); - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); + [id(DISPID_IHTMLTABLE2_MOVEROW)] + IDispatch *moveRow( + [in, defaultvalue(-1)] LONG indexFrom, + [in, defaultvalue(-1)] LONG indexTo); - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); + [propput, id(DISPID_IHTMLTABLE3_SUMMARY), displaybind, bindable] + void summary(BSTR v); - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch *children(); + [propget, id(DISPID_IHTMLTABLE3_SUMMARY), displaybind, bindable] + BSTR summary(); +} - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch *all(); +/***************************************************************************** + * DispHTMLTableRow dispinterface + */ +[ + hidden, + uuid(3050f535-98b5-11cf-bb82-00aa00bdce0b) +] +dispinterface DispHTMLTableRow +{ +properties: +methods: + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] BSTR scopeName(); @@ -21140,280 +19746,7 @@ dispinterface DispHTMLIFrame { properties: methods: - [id(DISPID_IHTMLELEMENT_SETATTRIBUTE)] - void setAttribute( - [in] BSTR strAttributeName, - [in] VARIANT AttributeValue, - [in, defaultvalue(1)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_GETATTRIBUTE)] - VARIANT getAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(0)] LONG lFlags); - - [id(DISPID_IHTMLELEMENT_REMOVEATTRIBUTE)] - VARIANT_BOOL removeAttribute( - [in] BSTR strAttributeName, - [in, defaultvalue(1)] LONG lFlags); - - [propput, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - void className(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_CLASSNAME), bindable] - BSTR className(); - - [propput, id(DISPID_IHTMLELEMENT_ID), bindable] - void id(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_ID), bindable] - BSTR id(); - - [propget, id(DISPID_IHTMLELEMENT_TAGNAME)] - BSTR tagName(); - - [propget, id(DISPID_IHTMLELEMENT_PARENTELEMENT)] - IHTMLElement *parentElement(); - - [propget, id(DISPID_IHTMLELEMENT_STYLE), nonbrowsable] - IHTMLStyle *style(); - - [propput, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - void onhelp(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONHELP), displaybind, bindable] - VARIANT onhelp(); - - [propput, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - void onclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONCLICK), displaybind, bindable] - VARIANT onclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - void ondblclick(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDBLCLICK), displaybind, bindable] - VARIANT ondblclick(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - void onkeydown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYDOWN), displaybind, bindable] - VARIANT onkeydown(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - void onkeyup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYUP), displaybind, bindable] - VARIANT onkeyup(); - - [propput, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - void onkeypress(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONKEYPRESS), displaybind, bindable] - VARIANT onkeypress(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - void onmouseout(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOUT), displaybind, bindable] - VARIANT onmouseout(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - void onmouseover(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEOVER), displaybind, bindable] - VARIANT onmouseover(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - void onmousemove(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEMOVE), displaybind, bindable] - VARIANT onmousemove(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - void onmousedown(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEDOWN), displaybind, bindable] - VARIANT onmousedown(); - - [propput, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - void onmouseup(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONMOUSEUP), displaybind, bindable] - VARIANT onmouseup(); - - [propget, id(DISPID_IHTMLELEMENT_DOCUMENT)] - IDispatch *document(); - - [propput, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - void title(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_TITLE), displaybind, bindable] - BSTR title(); - - [propput, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - void language(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANGUAGE), displaybind, bindable] - BSTR language(); - - [propput, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - void onselectstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONSELECTSTART), displaybind, bindable] - VARIANT onselectstart(); - - [id(DISPID_IHTMLELEMENT_SCROLLINTOVIEW)] - void scrollIntoView([in, optional] VARIANT varargStart); - - [id(DISPID_IHTMLELEMENT_CONTAINS)] - VARIANT_BOOL contains([in] IHTMLElement *pChild); - - [propget, id(DISPID_IHTMLELEMENT_SOURCEINDEX), bindable] - LONG sourceIndex(); - - [propget, id(DISPID_IHTMLELEMENT_RECORDNUMBER)] - VARIANT recordNumber(); - - [propput, id(DISPID_IHTMLELEMENT_LANG)] - void lang(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_LANG)] - BSTR lang(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETLEFT)] - LONG offsetLeft(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETTOP)] - LONG offsetTop(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETWIDTH)] - LONG offsetWidth(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETHEIGHT)] - LONG offsetHeight(); - - [propget, id(DISPID_IHTMLELEMENT_OFFSETPARENT)] - IHTMLElement *offsetParent(); - - [propput, id(DISPID_IHTMLELEMENT_INNERHTML)] - void innerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERHTML)] - BSTR innerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_INNERTEXT)] - void innerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_INNERTEXT)] - BSTR innerText(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERHTML)] - void outerHTML(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERHTML)] - BSTR outerHTML(); - - [propput, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - void outerText(BSTR v); - - [propget, id(DISPID_IHTMLELEMENT_OUTERTEXT)] - BSTR outerText(); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTHTML)] - void insertAdjacentHTML( - [in] BSTR where, - [in] BSTR html); - - [id(DISPID_IHTMLELEMENT_INSERTADJACENTTEXT)] - void insertAdjacentText( - [in] BSTR where, - [in] BSTR text); - - [propget, id(DISPID_IHTMLELEMENT_PARENTTEXTEDIT)] - IHTMLElement *parentTextEdit(); - - [propget, id(DISPID_IHTMLELEMENT_ISTEXTEDIT)] - VARIANT_BOOL isTextEdit(); - - [id(DISPID_IHTMLELEMENT_CLICK)] - void click(); - - [propget, id(DISPID_IHTMLELEMENT_FILTERS)] - IHTMLFiltersCollection *filters(); - - [propput, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - void ondragstart(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDRAGSTART), displaybind, bindable] - VARIANT ondragstart(); - - [id(DISPID_IHTMLELEMENT_TOSTRING)] - BSTR toString(); - - [propput, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - void onbeforeupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONBEFOREUPDATE), displaybind, bindable] - VARIANT onbeforeupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - void onafterupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONAFTERUPDATE), displaybind, bindable] - VARIANT onafterupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - void onerrorupdate(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONERRORUPDATE), displaybind, bindable] - VARIANT onerrorupdate(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - void onrowexit(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWEXIT), displaybind, bindable] - VARIANT onrowexit(); - - [propput, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - void onrowenter(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONROWENTER), displaybind, bindable] - VARIANT onrowenter(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - void ondatasetchanged(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCHANGED), displaybind, bindable] - VARIANT ondatasetchanged(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - void ondataavailable(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATAAVAILABLE), displaybind, bindable] - VARIANT ondataavailable(); - - [propput, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - void ondatasetcomplete(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONDATASETCOMPLETE), displaybind, bindable] - VARIANT ondatasetcomplete(); - - [propput, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - void onfilterchange(VARIANT v); - - [propget, id(DISPID_IHTMLELEMENT_ONFILTERCHANGE), displaybind, bindable] - VARIANT onfilterchange(); - - [propget, id(DISPID_IHTMLELEMENT_CHILDREN)] - IDispatch *children(); - - [propget, id(DISPID_IHTMLELEMENT_ALL)] - IDispatch *all(); - - [propget, id(DISPID_IHTMLELEMENT2_SCOPENAME)] - BSTR scopeName(); + WINE_IHTMLELEMENT_DISPINTERFACE_DECL; [id(DISPID_IHTMLELEMENT2_SETCAPTURE)] void setCapture([in, defaultvalue(-1)] VARIANT_BOOL containerCapture); diff --git a/include/sti.h b/include/sti.h index cafdc6e8118..204492d9a2f 100644 --- a/include/sti.h +++ b/include/sti.h @@ -49,9 +49,128 @@ DEFINE_GUID(IID_IStillImageA, 0xA7B1F740, 0x1D7F, 0x11D1, 0xAC, 0xA9, 0x00, 0xA0 typedef struct IStillImageA *PSTIA; typedef struct IStillImageW *PSTIW; DECL_WINELIB_TYPE_AW(PSTI) +typedef struct IStillImageA *LPSTILLIMAGEA; +typedef struct IStillImageW *LPSTILLIMAGEW; +DECL_WINELIB_TYPE_AW(LPSTILLIMAGE) +typedef struct IStiDeviceA *PSTIDEVICEA; +typedef struct IStiDeviceW *PSTIDEVICEW; +DECL_WINELIB_TYPE_AW(PSTIDEVICE) HRESULT WINAPI StiCreateInstanceA(HINSTANCE hinst, DWORD dwVer, PSTIA *ppSti, LPUNKNOWN pUnkOuter); HRESULT WINAPI StiCreateInstanceW(HINSTANCE hinst, DWORD dwVer, PSTIW *ppSti, LPUNKNOWN pUnkOuter); +#define StiCreateInstance WINELIB_NAME_AW(StiCreateInstance) + +typedef DWORD STI_DEVICE_TYPE; +typedef enum _STI_DEVICE_MJ_TYPE +{ + StiDeviceTypeDefault = 0, + StiDeviceTypeScanner = 1, + StiDeviceTypeDigitalCamera = 2, + StiDeviceTypeStreamingVideo = 3 +} STI_DEVICE_MJ_TYPE; + +#define GET_STIDEVICE_TYPE(dwDevType) HIWORD(dwDevType) +#define GET_STIDEVICE_SUBTYPE(dwDevType) LOWORD(dwDevType) + +typedef struct _STI_DEV_CAPS { + DWORD dwGeneric; +} STI_DEV_CAPS, *PSTI_DEV_CAPS; + +#define STI_MAX_INTERNAL_NAME_LENGTH 128 + +typedef struct _STI_DEVICE_INFORMATIONW { + DWORD dwSize; + STI_DEVICE_TYPE DeviceType; + WCHAR szDeviceInternalName[STI_MAX_INTERNAL_NAME_LENGTH]; + STI_DEV_CAPS DeviceCapabilities; + DWORD dwHardwareConfiguration; + LPWSTR pszVendorDescription; + LPWSTR pszDeviceDescription; + LPWSTR pszPortName; + LPWSTR pszPropProvider; + LPWSTR pszLocalName; +} STI_DEVICE_INFORMATIONW, *PSTI_DEVICE_INFORMATIONW; + +typedef STI_DEVICE_INFORMATIONW STI_DEVICE_INFORMATION; +typedef PSTI_DEVICE_INFORMATIONW PSTI_DEVICE_INFORMATION; + +#define MAX_NOTIFICATION_DATA 64 + +typedef struct _STINOTIFY { + DWORD dwSize; + GUID guidNotificationCode; + BYTE abNotificationData[MAX_NOTIFICATION_DATA]; +} STINOTIFY,*LPSTINOTIFY; + +#define INTERFACE IStillImageW +DECLARE_INTERFACE_(IStillImageW, IUnknown) +{ + /*** IUnknown methods ***/ + STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; + STDMETHOD_(ULONG,AddRef)(THIS) PURE; + STDMETHOD_(ULONG,Release)(THIS) PURE; + /*** IStillImageW methods ***/ + STDMETHOD(Initialize)(THIS_ HINSTANCE hinst, DWORD dwVersion) PURE; + STDMETHOD(GetDeviceList)(THIS_ DWORD dwType, DWORD dwFlags, DWORD *pdwItemsReturned, LPVOID *ppBuffer) PURE; + STDMETHOD(GetDeviceInfo)(THIS_ LPWSTR pwszDeviceName, LPVOID *ppBuffer) PURE; + STDMETHOD(CreateDevice)(THIS_ LPWSTR pwszDeviceName, DWORD dwMode, PSTIDEVICEW *pDevice, LPUNKNOWN pUnkOuter) PURE; + STDMETHOD(GetDeviceValue)(THIS_ LPWSTR pwszDeviceName, LPWSTR pValueName, LPDWORD pType, LPBYTE pData, LPDWORD cbData) PURE; + STDMETHOD(SetDeviceValue)(THIS_ LPWSTR pwszDeviceName, LPWSTR pValueName, DWORD type, LPBYTE pData, DWORD cbData) PURE; + STDMETHOD(GetSTILaunchInformation)(THIS_ LPWSTR pwszDeviceName, DWORD *pdwEventCode, LPWSTR pwszEventName) PURE; + STDMETHOD(RegisterLaunchApplication)(THIS_ LPWSTR pwszAppName, LPWSTR pwszCommandLine) PURE; + STDMETHOD(UnregisterLaunchApplication)(THIS_ LPWSTR pwszAppName) PURE; + STDMETHOD(EnableHwNotifications)(THIS_ LPCWSTR pwszDeviceName, BOOL bNewState) PURE; + STDMETHOD(GetHwNotificationState)(THIS_ LPCWSTR pwszDeviceName, BOOL *pbCurrentState) PURE; + STDMETHOD(RefreshDeviceBus)(THIS_ LPCWSTR pwszDeviceName) PURE; + STDMETHOD(LaunchApplicationForDevice)(THIS_ LPWSTR pwszDeviceName, LPWSTR pwszAppName, LPSTINOTIFY pStiNotify); + STDMETHOD(SetupDeviceParameters)(THIS_ PSTI_DEVICE_INFORMATIONW pDevInfo); + STDMETHOD(WriteToErrorLog)(THIS_ DWORD dwMessageType, LPCWSTR pszMessage) PURE; +}; +#undef INTERFACE + +#if !defined(__cplusplus) || defined(CINTERFACE) +/*** IUnknown methods ***/ +#define IStillImage_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) +#define IStillImage_AddRef(p) (p)->lpVtbl->AddRef(p) +#define IStillImage_Release(p) (p)->lpVtbl->Release(p) +/*** IStillImage methods ***/ +#define IStillImage_Initialize(p,a,b) (p)->lpVtbl->Initialize(p,a,b) +#define IStillImage_GetDeviceList(p,a,b,c,d) (p)->lpVtbl->GetDeviceList(p,a,b,c,d) +#define IStillImage_GetDeviceInfo(p,a,b) (p)->lpVtbl->GetDeviceInfo(p,a,b) +#define IStillImage_CreateDevice(p,a,b,c,d) (p)->lpVtbl->CreateDevice(p,a,b,c,d) +#define IStillImage_GetDeviceValue(p,a,b,c,d,e) (p)->lpVtbl->GetDeviceValue(p,a,b,c,d,e) +#define IStillImage_SetDeviceValue(p,a,b,c,d,e) (p)->lpVtbl->SetDeviceValue(p,a,b,c,d,e) +#define IStillImage_GetSTILaunchInformation(p,a,b,c) (p)->lpVtbl->GetSTILaunchInformation(p,a,b,c) +#define IStillImage_RegisterLaunchApplication(p,a,b) (p)->lpVtbl->RegisterLaunchApplication(p,a,b) +#define IStillImage_UnregisterLaunchApplication(p,a) (p)->lpVtbl->UnregisterLaunchApplication(p,a) +#define IStillImage_EnableHwNotifications(p,a,b) (p)->lpVtbl->EnableHwNotifications(p,a,b) +#define IStillImage_GetHwNotificationState(p,a,b) (p)->lpVtbl->GetHwNotificationState(p,a,b) +#define IStillImage_RefreshDeviceBus(p,a) (p)->lpVtbl->RefreshDeviceBus(p,a) +#define IStillImage_LaunchApplicationForDevice(p,a,b,c) (p)->lpVtbl->LaunchApplicationForDevice(p,a,b,c) +#define IStillImage_SetupDeviceParameters(p,a) (p)->lpVtbl->SetupDeviceParameters(p,a) +#define IStillImage_WriteToErrorLog(p,a,b) (p)->lpVtbl->WriteToErrorLog(p,a,b) +#else +/*** IUnknown methods ***/ +#define IStillImage_QueryInterface(p,a,b) (p)->QueryInterface(a,b) +#define IStillImage_AddRef(p) (p)->AddRef() +#define IStillImage_Release(p) (p)->Release() +/*** IStillImage methods ***/ +#define IStillImage_Initialize(p,a,b) (p)->Initialize(a,b) +#define IStillImage_GetDeviceList(p,a,b,c,d) (p)->GetDeviceList(a,b,c,d) +#define IStillImage_GetDeviceInfo(p,a,b) (p)->GetDeviceInfo(a,b) +#define IStillImage_CreateDevice(p,a,b,c,d) (p)->CreateDevice(a,b,c,d) +#define IStillImage_GetDeviceValue(p,a,b,c,d,e) (p)->GetDeviceValue(a,b,c,d,e) +#define IStillImage_SetDeviceValue(p,a,b,c,d,e) (p)->SetDeviceValue(a,b,c,d,e) +#define IStillImage_GetSTILaunchInformation(p,a,b,c) (p)->GetSTILaunchInformation(a,b,c) +#define IStillImage_RegisterLaunchApplication(p,a,b) (p)->RegisterLaunchApplication(a,b) +#define IStillImage_UnregisterLaunchApplication(p,a) (p)->UnregisterLaunchApplication(a) +#define IStillImage_EnableHwNotifications(p,a,b) (p)->EnableHwNotifications(a,b) +#define IStillImage_GetHwNotificationState(p,a,b) (p)->GetHwNotificationState(a,b) +#define IStillImage_RefreshDeviceBus(p,a) (p)->RefreshDeviceBus(a) +#define IStillImage_LaunchApplicationForDevice(p,a,b,c) (p)->LaunchApplicationForDevice(a,b,c) +#define IStillImage_SetupDeviceParameters(p,a) (p)->SetupDeviceParameters(a) +#define IStillImage_WriteToErrorLog(p,a,b) (p)->WriteToErrorLog(a,b) +#endif #ifdef __cplusplus }; diff --git a/include/urlmon.idl b/include/urlmon.idl index 3c6576bb13a..78afd1691c9 100644 --- a/include/urlmon.idl +++ b/include/urlmon.idl @@ -1065,6 +1065,42 @@ cpp_quote("#define MAX_SIZE_SECURITY_ID 512") [in] DWORD dwFlags); } +/***************************************************************************** + * IInternetHostSecurityManager interface + */ +cpp_quote("#define SID_SInternetHostSecurityManager IID_IInternetHostSecurityManager") + +[ + local, + object, + uuid(3af280b6-cb3f-11d0-891e-00c04fb6bfc4), + pointer_default(unique) +] +interface IInternetHostSecurityManager : IUnknown +{ + HRESULT GetSecurityId( + [out, size_is(*pcbSecurityId)] BYTE *pbSecurityId, + [in, out] DWORD *pcbSecurityId, + [in] DWORD_PTR dwReserved); + + HRESULT ProcessUrlAction( + [in] DWORD dwAction, + [out, size_is(cbPolicy)] BYTE *pPolicy, + [in] DWORD cbPolicy, + [in] BYTE *pContext, + [in] DWORD cbContext, + [in] DWORD dwFlags, + [in] DWORD dwReserved); + + HRESULT QueryCustomPolicy( + [in] REFGUID guidKey, + [out, size_is(,*pcbPolicy)] BYTE **ppPolicy, + [out] DWORD *pcbPolicy, + [in] BYTE *pContext, + [in] DWORD cbContext, + [in] DWORD dwReserved); +} + cpp_quote("#define URLACTION_MIN 0x00001000") cpp_quote("#define URLACTION_DOWNLOAD_MIN 0x00001000") cpp_quote("#define URLACTION_DOWNLOAD_SIGNED_ACTIVEX 0x00001001") @@ -1643,6 +1679,17 @@ interface IInternetProtocolEx : IInternetProtocol [in] HANDLE *dwReserved); } +cpp_quote("#define CONFIRMSAFETYACTION_LOADOBJECT 0x00000001") + +struct CONFIRMSAFETY +{ + CLSID clsid; + IUnknown *pUnk; + DWORD dwFlags; +}; + +cpp_quote("EXTERN_C const GUID GUID_CUSTOM_CONFIRMOBJECTSAFETY;") + cpp_quote("DEFINE_GUID(CLSID_InternetSecurityManager, 0x7b8a2d94, 0x0ac9, 0x11d1, 0x89, 0x6c, 0x00, 0xc0, 0x4f, 0xB6, 0xbf, 0xc4);") cpp_quote("DEFINE_GUID(CLSID_InternetZoneManager, 0x7B8A2D95, 0x0AC9, 0x11D1, 0x89, 0x6C, 0x00, 0xC0, 0x4F, 0xB6, 0xBF, 0xC4);") cpp_quote("DEFINE_GUID(IID_IAsyncMoniker, 0x79EAC9D3, 0xBAF9, 0x11CE, 0x8C, 0x82, 0x00, 0xAA, 0x00, 0x4B, 0xA9, 0x0B);") diff --git a/include/wine/library.h b/include/wine/library.h index 474cfb2d44f..9ff1910e6e6 100644 --- a/include/wine/library.h +++ b/include/wine/library.h @@ -102,19 +102,8 @@ static inline void wine_ldt_init_fs( unsigned short sel, const LDT_ENTRY *entry static inline void wine_ldt_free_fs( unsigned short sel ) { } #endif /* __i386__ */ - /* the local copy of the LDT */ -#ifdef __CYGWIN__ -# ifdef WINE_EXPORT_LDT_COPY -# define WINE_LDT_EXTERN __declspec(dllexport) -# else -# define WINE_LDT_EXTERN __declspec(dllimport) -# endif -#else -# define WINE_LDT_EXTERN extern -#endif - -WINE_LDT_EXTERN struct __wine_ldt_copy +extern struct __wine_ldt_copy { void *base[8192]; /* base address or 0 if entry is free */ unsigned long limit[8192]; /* limit in bytes or 0 if entry is free */ diff --git a/include/wine/winbase16.h b/include/wine/winbase16.h index 680bb694a4c..0e41cba7aa4 100644 --- a/include/wine/winbase16.h +++ b/include/wine/winbase16.h @@ -522,10 +522,4 @@ BOOL16 WINAPI WritePrivateProfileSection16(LPCSTR,LPCSTR,LPCSTR); BOOL16 WINAPI WritePrivateProfileStruct16(LPCSTR,LPCSTR,LPVOID,UINT16,LPCSTR); BOOL16 WINAPI WriteProfileSection16(LPCSTR,LPCSTR); -/* Some optimizations */ -extern inline LPVOID WINAPI MapSL( SEGPTR segptr ) -{ - return (char *)wine_ldt_copy.base[SELECTOROF(segptr) >> __AHSHIFT] + OFFSETOF(segptr); -} - #endif /* __WINE_WINE_WINBASE16_H */ diff --git a/include/winerror.h b/include/winerror.h index c7427d7a41e..a1fa985cc83 100644 --- a/include/winerror.h +++ b/include/winerror.h @@ -1558,6 +1558,7 @@ static inline HRESULT HRESULT_FROM_WIN32(unsigned int x) #define ERROR_SXS_WRONG_SECTION_TYPE 14009 #define ERROR_SXS_THREAD_QUERIES_DISABLED 14010 #define ERROR_SXS_PROCESS_DEFAULT_ALREADY_SET 14011 +#define ERROR_SXS_CORRUPTION 14083 /* HRESULT values for OLE, SHELL and other Interface stuff */ /* the codes 4000-40ff are reserved for OLE */ diff --git a/include/wnaspi32.h b/include/wnaspi32.h index 09ada9c8173..6a20fb0efeb 100644 --- a/include/wnaspi32.h +++ b/include/wnaspi32.h @@ -150,7 +150,7 @@ typedef struct tagSRB32_ExecSCSICmd { BYTE SRB_CDBLen; /* 15 CDB Length */ BYTE SRB_HaStat; /* 16 Host Adapter Status */ BYTE SRB_TargStat; /* 17 Target Status */ - void (*SRB_PostProc)(); /* 18 Post routine */ + void (*SRB_PostProc)( struct tagSRB32_ExecSCSICmd * ); /* 18 Post routine */ void *SRB_Rsvd2; /* 1C Reserved */ BYTE SRB_Rsvd3[16]; /* 20 Reserved for expansion */ BYTE CDBByte[16]; /* 30 SCSI CDB */ @@ -179,7 +179,7 @@ typedef struct tagSRB32_BusDeviceReset { BYTE SRB_Rsvd1[12]; /* 0A Reserved for Alignment */ BYTE SRB_HaStat; /* 16 Host Adapter Status */ BYTE SRB_TargStat; /* 17 Target Status */ - void (*SRB_PostProc)(); /* 18 Post routine */ + void (*SRB_PostProc)( struct tagSRB32_BusDeviceReset * ); /* 18 Post routine */ void *SRB_Rsvd2; /* 1c Reserved */ BYTE SRB_Rsvd3[32]; /* 20 Reserved */ } SRB_BusDeviceReset, *PSRB_BusDeviceReset; diff --git a/libs/port/interlocked.c b/libs/port/interlocked.c index 51794d343d9..b2d4b52d9ef 100644 --- a/libs/port/interlocked.c +++ b/libs/port/interlocked.c @@ -268,77 +268,6 @@ void* interlocked_xchg_ptr( void** dest, void* val ) return ret; } -#elif defined(__sparc__) && defined(__sun__) - -/* - * As the earlier Sparc processors lack necessary atomic instructions, - * I'm simply falling back to the library-provided _lwp_mutex routines - * to ensure mutual exclusion in a way appropriate for the current - * architecture. - * - * FIXME: If we have the compare-and-swap instruction (Sparc v9 and above) - * we could use this to speed up the Interlocked operations ... - */ -#include -static lwp_mutex_t interlocked_mutex = DEFAULTMUTEX; - -int interlocked_cmpxchg( int *dest, int xchg, int compare ) -{ - _lwp_mutex_lock( &interlocked_mutex ); - if (*dest == compare) *dest = xchg; - else compare = *dest; - _lwp_mutex_unlock( &interlocked_mutex ); - return compare; -} - -void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare ) -{ - _lwp_mutex_lock( &interlocked_mutex ); - if (*dest == compare) *dest = xchg; - else compare = *dest; - _lwp_mutex_unlock( &interlocked_mutex ); - return compare; -} - -__int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare ) -{ - _lwp_mutex_lock( &interlocked_mutex ); - if (*dest == compare) *dest = xchg; - else compare = *dest; - _lwp_mutex_unlock( &interlocked_mutex ); - return compare; -} - -int interlocked_xchg( int *dest, int val ) -{ - int retv; - _lwp_mutex_lock( &interlocked_mutex ); - retv = *dest; - *dest = val; - _lwp_mutex_unlock( &interlocked_mutex ); - return retv; -} - -void *interlocked_xchg_ptr( void **dest, void *val ) -{ - void *retv; - _lwp_mutex_lock( &interlocked_mutex ); - retv = *dest; - *dest = val; - _lwp_mutex_unlock( &interlocked_mutex ); - return retv; -} - -int interlocked_xchg_add( int *dest, int incr ) -{ - int retv; - _lwp_mutex_lock( &interlocked_mutex ); - retv = *dest; - *dest += incr; - _lwp_mutex_unlock( &interlocked_mutex ); - return retv; -} - #elif defined(__ALPHA__) && defined(__GNUC__) __ASM_GLOBAL_FUNC(interlocked_cmpxchg, @@ -395,6 +324,80 @@ __ASM_GLOBAL_FUNC(interlocked_xchg_add, "beq $1,L0xchg_add\n\t" "mb") + #else -# error You must implement the interlocked* functions for your CPU + +#include + +static pthread_mutex_t interlocked_mutex = PTHREAD_MUTEX_INITIALIZER; + +int interlocked_cmpxchg( int *dest, int xchg, int compare ) +{ + pthread_mutex_lock( &interlocked_mutex ); + + if (*dest == compare) + *dest = xchg; + else + compare = *dest; + + pthread_mutex_unlock( &interlocked_mutex ); + return compare; +} + +void *interlocked_cmpxchg_ptr( void **dest, void *xchg, void *compare ) +{ + pthread_mutex_lock( &interlocked_mutex ); + + if (*dest == compare) + *dest = xchg; + else + compare = *dest; + + pthread_mutex_unlock( &interlocked_mutex ); + return compare; +} + +__int64 interlocked_cmpxchg64( __int64 *dest, __int64 xchg, __int64 compare ) +{ + pthread_mutex_lock( &interlocked_mutex ); + + if (*dest == compare) + *dest = xchg; + else + compare = *dest; + + pthread_mutex_unlock( &interlocked_mutex ); + return compare; +} + +int interlocked_xchg( int *dest, int val ) +{ + int retv; + pthread_mutex_lock( &interlocked_mutex ); + retv = *dest; + *dest = val; + pthread_mutex_unlock( &interlocked_mutex ); + return retv; +} + +void *interlocked_xchg_ptr( void **dest, void *val ) +{ + void *retv; + pthread_mutex_lock( &interlocked_mutex ); + retv = *dest; + *dest = val; + pthread_mutex_unlock( &interlocked_mutex ); + return retv; +} + +int interlocked_xchg_add( int *dest, int incr ) +{ + int retv; + pthread_mutex_lock( &interlocked_mutex ); + retv = *dest; + *dest += incr; + pthread_mutex_unlock( &interlocked_mutex ); + return retv; +} + #endif diff --git a/libs/wine/ldt.c b/libs/wine/ldt.c index 80ceba85db7..7475d51af45 100644 --- a/libs/wine/ldt.c +++ b/libs/wine/ldt.c @@ -31,7 +31,6 @@ #include "windef.h" #include "winbase.h" -#define WINE_EXPORT_LDT_COPY #include "wine/library.h" #ifdef __i386__ diff --git a/libs/wine/port.c b/libs/wine/port.c index 1e05e2b0b26..ce32653c8f9 100644 --- a/libs/wine/port.c +++ b/libs/wine/port.c @@ -171,6 +171,20 @@ __ASM_GLOBAL_FUNC( wine_call_on_stack, "lwz 0, 4(1)\n\t" /* fetch return address */ "mtlr 0\n\t" /* return address -> lr */ "blr") /* return */ +#elif defined(__arm__) +__ASM_GLOBAL_FUNC( wine_call_on_stack, + "str r14, [r13, #4]\n\t" /* save return address on stack */ + "sub r2, r2, #16\n\t" /* reserve space on new stack */ + "str r13, [r2, #12]\n\t" /* store old sp */ + "mov r3, r0\n\t" /* func */ + "mov r0, r1\n\t" /* arg */ + "mov r13, r2\n\t" /* stack */ + "mov r2, #0\n\t" /* zero */ + "str r2, [r13]\n\t" /* bottom of stack */ + "sub r13, r13, #16\n\t" /* create a frame for this function */ + "blx r3\n\t" /* call func */ + "ldr r13, [r13, #28]\n\t" /* fetch old sp */ + "ldr r15, [r13, #4]") /* fetch return address and return */ #else #error You must implement wine_switch_to_stack for your platform #endif diff --git a/libs/wine/wine.def b/libs/wine/wine.def index 0978ca40f57..f81eaa8535c 100644 --- a/libs/wine/wine.def +++ b/libs/wine/wine.def @@ -88,7 +88,6 @@ EXPORTS wine_init_argv0_path wine_is_dbcs_leadbyte wine_ldt_alloc_entries - wine_ldt_copy wine_ldt_free_entries wine_ldt_get_entry wine_ldt_get_ptr diff --git a/libs/wpp/ppl.l b/libs/wpp/ppl.l index e71bf6ecf20..062ac22ef18 100644 --- a/libs/wpp/ppl.l +++ b/libs/wpp/ppl.l @@ -437,7 +437,7 @@ includelogicentry_t *pp_includelogiclist = NULL; /* * Handle left side of #define */ -{cident}\( ppy_lval.cptr = pp_xstrdup(ppy_text); ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO; +{cident}\( ppy_lval.cptr = pp_xstrdup(ppy_text); if(ppy_lval.cptr) ppy_lval.cptr[ppy_leng-1] = '\0'; yy_pp_state(pp_macro); return tMACRO; {cident} ppy_lval.cptr = pp_xstrdup(ppy_text); yy_pp_state(pp_define); return tDEFINE; {ws}+ ; \\\r?\n newline(0); @@ -639,7 +639,7 @@ includelogicentry_t *pp_includelogiclist = NULL; if(yy_current_state() == pp_inc) ppy_error("Expected include filename"); - if(yy_current_state() == pp_if) + else if(yy_current_state() == pp_if) { ppy_lval.cptr = pp_xstrdup(ppy_text); return tIDENT; @@ -808,7 +808,10 @@ static int make_number(int radix, YYSTYPE *val, const char *str, int len) ext[0] = len > 2 ? toupper(str[len-3]) : ' '; if(!strcmp(ext, "LUL")) + { ppy_error("Invalid constant suffix"); + return 0; + } else if(!strcmp(ext, "LLU") || !strcmp(ext, "ULL")) { is_ll++; @@ -905,19 +908,26 @@ static void expand_special(pp_entry_t *ppp) { const char *dbgtext = "?"; static char *buf = NULL; + char *new_buf; assert(ppp->type == def_special); if(!strcmp(ppp->ident, "__LINE__")) { dbgtext = "def_special(__LINE__)"; - buf = pp_xrealloc(buf, 32); + new_buf = pp_xrealloc(buf, 32); + if(!new_buf) + return; + buf = new_buf; sprintf(buf, "%d", pp_status.line_number); } else if(!strcmp(ppp->ident, "__FILE__")) { dbgtext = "def_special(__FILE__)"; - buf = pp_xrealloc(buf, strlen(pp_status.input) + 3); + new_buf = pp_xrealloc(buf, strlen(pp_status.input) + 3); + if(!new_buf) + return; + buf = new_buf; sprintf(buf, "\"%s\"", pp_status.input); } else @@ -962,12 +972,19 @@ static char *curdef_text = NULL; static void add_text(const char *str, int len) { + int new_alloc; + char *new_text; + if(len == 0) return; if(curdef_idx >= curdef_alloc || curdef_alloc - curdef_idx < len) { - curdef_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1); - curdef_text = pp_xrealloc(curdef_text, curdef_alloc * sizeof(curdef_text[0])); + new_alloc = curdef_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1)); + new_text = pp_xrealloc(curdef_text, new_alloc * sizeof(curdef_text[0])); + if(!new_text) + return; + curdef_text = new_text; + curdef_alloc = new_alloc; if(curdef_alloc > 65536) ppy_warning("Reallocating macro-expansion buffer larger than 64kB"); } @@ -1085,7 +1102,10 @@ static void expand_macro(macexpstackentry_t *mep) assert(ppp->expanding == 0); if((ppp->nargs >= 0 && nargs != ppp->nargs) || (ppp->nargs < 0 && nargs < -ppp->nargs)) + { ppy_error("Too %s macro arguments (%d)", nargs < abs(ppp->nargs) ? "few" : "many", nargs); + return; + } for(n = 0; n < nargs; n++) nnl += mep->nnls[n]; @@ -1162,12 +1182,19 @@ static void new_string(void) static void add_string(const char *str, int len) { + int new_alloc; + char *new_buffer; + if(len == 0) return; if(strbuf_idx >= strbuf_alloc || strbuf_alloc - strbuf_idx < len) { - strbuf_alloc += (len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1); - strbuffer = pp_xrealloc(strbuffer, strbuf_alloc * sizeof(strbuffer[0])); + new_alloc = strbuf_alloc + ((len + ALLOCBLOCKSIZE-1) & ~(ALLOCBLOCKSIZE-1)); + new_buffer = pp_xrealloc(strbuffer, new_alloc * sizeof(strbuffer[0])); + if(!new_buffer) + return; + strbuffer = new_buffer; + strbuf_alloc = new_alloc; if(strbuf_alloc > 65536) ppy_warning("Reallocating string buffer larger than 64kB"); } @@ -1178,6 +1205,8 @@ static void add_string(const char *str, int len) static char *get_string(void) { char *str = pp_xmalloc(strbuf_idx + 1); + if(!str) + return NULL; memcpy(str, strbuffer, strbuf_idx); str[strbuf_idx] = '\0'; #ifdef DEBUG @@ -1253,14 +1282,10 @@ static bufferstackentry_t *pop_buffer(void) bufferstack[bufferstackidx].define->expanding = 0; else { - pp_status.line_number = bufferstack[bufferstackidx].line_number; - pp_status.char_number = bufferstack[bufferstackidx].char_number; - pp_status.input = bufferstack[bufferstackidx].filename; - ncontinuations = bufferstack[bufferstackidx].ncontinuations; if(!bufferstack[bufferstackidx].should_pop) { fclose(ppy_in); - fprintf(ppy_out, "# %d \"%s\" 2\n", pp_status.line_number, pp_status.input); + fprintf(ppy_out, "# %d \"%s\" 2\n", bufferstack[bufferstackidx].line_number, bufferstack[bufferstackidx].filename); /* We have EOF, check the include logic */ if(pp_incl_state.state == 2 && !pp_incl_state.seen_junk && pp_incl_state.ppp) @@ -1269,6 +1294,9 @@ static bufferstackentry_t *pop_buffer(void) if(ppp) { includelogicentry_t *iep = pp_xmalloc(sizeof(includelogicentry_t)); + if(!iep) + return NULL; + iep->ppp = ppp; ppp->iep = iep; iep->filename = bufferstack[bufferstackidx].include_filename; @@ -1278,7 +1306,7 @@ static bufferstackentry_t *pop_buffer(void) iep->next->prev = iep; pp_includelogiclist = iep; if(pp_status.debug) - fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", pp_status.input, pp_status.line_number, pp_incl_state.ppp, iep->filename); + fprintf(stderr, "pop_buffer: %s:%d: includelogic added, include_ppp='%s', file='%s'\n", bufferstack[bufferstackidx].filename, bufferstack[bufferstackidx].line_number, pp_incl_state.ppp, iep->filename); } else free(bufferstack[bufferstackidx].include_filename); @@ -1287,6 +1315,10 @@ static bufferstackentry_t *pop_buffer(void) pp_incl_state = bufferstack[bufferstackidx].incl; } + pp_status.line_number = bufferstack[bufferstackidx].line_number; + pp_status.char_number = bufferstack[bufferstackidx].char_number; + pp_status.input = bufferstack[bufferstackidx].filename; + ncontinuations = bufferstack[bufferstackidx].ncontinuations; } if(ppy_debug) @@ -1323,9 +1355,14 @@ static bufferstackentry_t *pop_buffer(void) static void push_macro(pp_entry_t *ppp) { if(macexpstackidx >= MAXMACEXPSTACK) + { ppy_error("Too many nested macros"); + return; + } macexpstack[macexpstackidx] = pp_xmalloc(sizeof(macexpstack[0][0])); + if(!macexpstack[macexpstackidx]) + return; memset( macexpstack[macexpstackidx], 0, sizeof(macexpstack[0][0])); macexpstack[macexpstackidx]->ppp = ppp; macexpstackidx++; @@ -1363,8 +1400,13 @@ static void add_text_to_macro(const char *text, int len) if(mep->curargalloc - mep->curargsize <= len+1) /* +1 for '\0' */ { - mep->curargalloc += (ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1; - mep->curarg = pp_xrealloc(mep->curarg, mep->curargalloc * sizeof(mep->curarg[0])); + char *new_curarg; + int new_alloc = mep->curargalloc + (ALLOCBLOCKSIZE > len+1) ? ALLOCBLOCKSIZE : len+1; + new_curarg = pp_xrealloc(mep->curarg, new_alloc * sizeof(mep->curarg[0])); + if(!new_curarg) + return; + mep->curarg = new_curarg; + mep->curargalloc = new_alloc; } memcpy(mep->curarg + mep->curargsize, text, len); mep->curargsize += len; @@ -1375,14 +1417,30 @@ static void macro_add_arg(int last) { int nnl = 0; char *cptr; + char **new_args, **new_ppargs; + int *new_nnls; macexpstackentry_t *mep = top_macro(); assert(mep->ppp->expanding == 0); - mep->args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0])); - mep->ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0])); - mep->nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0])); + new_args = pp_xrealloc(mep->args, (mep->nargs+1) * sizeof(mep->args[0])); + if(!new_args) + return; + mep->args = new_args; + + new_ppargs = pp_xrealloc(mep->ppargs, (mep->nargs+1) * sizeof(mep->ppargs[0])); + if(!new_ppargs) + return; + mep->ppargs = new_ppargs; + + new_nnls = pp_xrealloc(mep->nnls, (mep->nargs+1) * sizeof(mep->nnls[0])); + if(!new_nnls) + return; + mep->nnls = new_nnls; + mep->args[mep->nargs] = pp_xstrdup(mep->curarg ? mep->curarg : ""); + if(!mep->args[mep->nargs]) + return; cptr = mep->args[mep->nargs]-1; while((cptr = strchr(cptr+1, '\n'))) { @@ -1427,7 +1485,7 @@ static void macro_add_expansion(void) pp_status.input, pp_status.line_number, mep->nargs-1, - mep->ppargs[mep->nargs-1]); + mep->ppargs[mep->nargs-1] ? mep->ppargs[mep->nargs-1] : ""); } @@ -1472,13 +1530,19 @@ void pp_do_include(char *fname, int type) n = strlen(fname); if(n <= 2) + { ppy_error("Empty include filename"); + return; + } /* Undo the effect of the quotation */ fname[n-1] = '\0'; if((ppy_in = pp_open_include(fname+1, type ? pp_status.input : NULL, &newpath)) == NULL) + { ppy_error("Unable to open include file %s", fname+1); + return; + } fname[n-1] = *fname; /* Redo the quotes */ push_buffer(NULL, newpath, fname, 0); diff --git a/libs/wpp/ppy.y b/libs/wpp/ppy.y index fc94bb54aca..ba883206073 100644 --- a/libs/wpp/ppy.y +++ b/libs/wpp/ppy.y @@ -224,6 +224,9 @@ preprocessor case if_elsetrue: case if_elsefalse: ppy_error("#elif cannot follow #else"); + break; + case if_error: + break; default: pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #elif directive", s); } @@ -247,24 +250,29 @@ preprocessor case if_elsetrue: case if_elsefalse: ppy_error("#else clause already defined"); + break; + case if_error: + break; default: pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d) in #else directive", s); } } | tENDIF tNL { - pp_pop_if(); - if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1) + if(pp_pop_if() != if_error) { - pp_incl_state.state = 2; - pp_incl_state.seen_junk = 0; + if(pp_incl_state.ifdepth == pp_get_if_depth() && pp_incl_state.state == 1) + { + pp_incl_state.state = 2; + pp_incl_state.seen_junk = 0; + } + else if(pp_incl_state.state != 1) + { + pp_incl_state.state = -1; + } + if(pp_status.debug) + fprintf(stderr, "tENDIF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", + pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth); } - else if(pp_incl_state.state != 1) - { - pp_incl_state.state = -1; - } - if(pp_status.debug) - fprintf(stderr, "tENDIF: %s:%d: include_state=%d, include_ppp='%s', include_ifdepth=%d\n", - pp_status.input, pp_status.line_number, pp_incl_state.state, pp_incl_state.ppp, pp_incl_state.ifdepth); } | tUNDEF tIDENT tNL { pp_del_define($2); free($2); } | tDEFINE opt_text tNL { pp_add_define($1, $2); } @@ -287,11 +295,17 @@ preprocessor | tPRAGMA opt_text tNL { fprintf(ppy_out, "#pragma %s\n", $2 ? $2 : ""); free($2); } | tPPIDENT opt_text tNL { if(pp_status.pedantic) ppy_warning("#ident ignored (arg: '%s')", $2); free($2); } | tRCINCLUDE tRCINCLUDEPATH { - int nl=strlen($2) +3; - char *fn=pp_xmalloc(nl); - sprintf(fn,"\"%s\"",$2); - free($2); - pp_do_include(fn,1); + if($2) + { + int nl=strlen($2) +3; + char *fn=pp_xmalloc(nl); + if(fn) + { + sprintf(fn,"\"%s\"",$2); + pp_do_include(fn,1); + } + free($2); + } } | tRCINCLUDE tDQSTRING { pp_do_include($2,1); @@ -346,13 +360,14 @@ mtext : tLITERAL { $$ = new_mtext($1, 0, exp_text); } int mat = marg_index($2); if(mat < 0) ppy_error("Stringification identifier must be an argument parameter"); - $$ = new_mtext(NULL, mat, exp_stringize); + else + $$ = new_mtext(NULL, mat, exp_stringize); } | tIDENT { int mat = marg_index($1); if(mat >= 0) $$ = new_mtext(NULL, mat, exp_subst); - else + else if($1) $$ = new_mtext($1, 0, exp_text); } ; @@ -537,6 +552,8 @@ static int boolean(cval_t *v) static marg_t *new_marg(char *str, def_arg_t type) { marg_t *ma = pp_xmalloc(sizeof(marg_t)); + if(!ma) + return NULL; ma->arg = str; ma->type = type; ma->nnl = 0; @@ -545,16 +562,27 @@ static marg_t *new_marg(char *str, def_arg_t type) static marg_t *add_new_marg(char *str, def_arg_t type) { - marg_t *ma = new_marg(str, type); + marg_t **new_macro_args; + marg_t *ma; + if(!str) + return NULL; + new_macro_args = pp_xrealloc(macro_args, (nmacro_args+1) * sizeof(macro_args[0])); + if(!new_macro_args) + return NULL; + macro_args = new_macro_args; + ma = new_marg(str, type); + if(!ma) + return NULL; + macro_args[nmacro_args] = ma; nmacro_args++; - macro_args = pp_xrealloc(macro_args, nmacro_args * sizeof(macro_args[0])); - macro_args[nmacro_args-1] = ma; return ma; } static int marg_index(char *id) { int t; + if(!id) + return -1; for(t = 0; t < nmacro_args; t++) { if(!strcmp(id, macro_args[t]->arg)) @@ -566,6 +594,8 @@ static int marg_index(char *id) static mtext_t *new_mtext(char *str, int idx, def_exp_t type) { mtext_t *mt = pp_xmalloc(sizeof(mtext_t)); + if(!mt) + return NULL; if(str == NULL) mt->subst.argidx = idx; else @@ -585,7 +615,11 @@ static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp) if(tail->type == exp_text && mtp->type == exp_text) { - tail->subst.text = pp_xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1); + char *new_text; + new_text = pp_xrealloc(tail->subst.text, strlen(tail->subst.text)+strlen(mtp->subst.text)+1); + if(!new_text) + return mtp; + tail->subst.text = new_text; strcat(tail->subst.text, mtp->subst.text); free(mtp->subst.text); free(mtp); @@ -649,9 +683,22 @@ static mtext_t *combine_mtext(mtext_t *tail, mtext_t *mtp) static char *merge_text(char *s1, char *s2) { - int l1 = strlen(s1); - int l2 = strlen(s2); - s1 = pp_xrealloc(s1, l1+l2+1); + int l1; + int l2; + char *snew; + if(!s1) + return s2; + if(!s2) + return s1; + l1 = strlen(s1); + l2 = strlen(s2); + snew = pp_xrealloc(s1, l1+l2+1); + if(!snew) + { + free(s2); + return s1; + } + s1 = snew; memcpy(s1+l1, s2, l2+1); free(s2); return s1; diff --git a/libs/wpp/preproc.c b/libs/wpp/preproc.c index 63455ce3a69..1d9aed65387 100644 --- a/libs/wpp/preproc.c +++ b/libs/wpp/preproc.c @@ -110,6 +110,8 @@ char *pp_xstrdup(const char *str) assert(str != NULL); len = strlen(str)+1; s = pp_xmalloc(len); + if(!s) + return NULL; return memcpy(s, str, len); } @@ -124,9 +126,12 @@ static int pphash(const char *str) pp_entry_t *pplookup(const char *ident) { - int idx = pphash(ident); + int idx; pp_entry_t *ppp; + if(!ident) + return NULL; + idx = pphash(ident); for(ppp = pp_def_state->defines[idx]; ppp; ppp = ppp->next) { if(!strcmp(ident, ppp->ident)) @@ -218,9 +223,12 @@ pp_entry_t *pp_add_define(char *def, char *text) { int len; char *cptr; - int idx = pphash(def); + int idx; pp_entry_t *ppp; + if(!def) + return NULL; + idx = pphash(def); if((ppp = pplookup(def)) != NULL) { if(pp_status.pedantic) @@ -228,11 +236,18 @@ pp_entry_t *pp_add_define(char *def, char *text) pp_del_define(def); } ppp = pp_xmalloc(sizeof(pp_entry_t)); + if(!ppp) + return NULL; memset( ppp, 0, sizeof(*ppp) ); ppp->ident = def; ppp->type = def_define; ppp->subst.text = text; ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : ""); + if(!ppp->filename) + { + free(ppp); + return NULL; + } ppp->linenumber = pp_status.input ? pp_status.line_number : 0; ppp->next = pp_def_state->defines[idx]; pp_def_state->defines[idx] = ppp; @@ -260,9 +275,12 @@ pp_entry_t *pp_add_define(char *def, char *text) pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp) { - int idx = pphash(id); + int idx; pp_entry_t *ppp; + if(!id) + return NULL; + idx = pphash(id); if((ppp = pplookup(id)) != NULL) { if(pp_status.pedantic) @@ -270,6 +288,8 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp) pp_del_define(id); } ppp = pp_xmalloc(sizeof(pp_entry_t)); + if(!ppp) + return NULL; memset( ppp, 0, sizeof(*ppp) ); ppp->ident = id; ppp->type = def_macro; @@ -277,6 +297,11 @@ pp_entry_t *pp_add_macro(char *id, marg_t *args[], int nargs, mtext_t *exp) ppp->nargs = nargs; ppp->subst.mtext= exp; ppp->filename = pp_xstrdup(pp_status.input ? pp_status.input : ""); + if(!ppp->filename) + { + free(ppp); + return NULL; + } ppp->linenumber = pp_status.input ? pp_status.line_number : 0; ppp->next = pp_def_state->defines[idx]; pp_def_state->defines[idx] = ppp; @@ -519,13 +544,18 @@ void pp_push_if(pp_if_state_t s) case if_ignore: pp_push_ignore_state(); break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d)", (int)pp_if_state()); } } pp_if_state_t pp_pop_if(void) { if(if_stack_idx <= 0) + { ppy_error("#{endif,else,elif} without #{if,ifdef,ifndef} (#if-stack underflow)"); + return if_error; + } switch(pp_if_state()) { @@ -538,6 +568,8 @@ pp_if_state_t pp_pop_if(void) case if_ignore: pp_pop_ignore_state(); break; + default: + pp_internal_error(__FILE__, __LINE__, "Invalid pp_if_state (%d)", (int)pp_if_state()); } if(pp_flex_debug) diff --git a/libs/wpp/wpp.c b/libs/wpp/wpp.c index d149591f790..a7597ec290c 100644 --- a/libs/wpp/wpp.c +++ b/libs/wpp/wpp.c @@ -144,6 +144,7 @@ int wpp_parse( const char *input, FILE *output ) int ret; pp_status.input = NULL; + pp_status.state = 0; pp_push_define_state(); add_cmdline_defines(); @@ -152,8 +153,8 @@ int wpp_parse( const char *input, FILE *output ) if (!input) ppy_in = stdin; else if (!(ppy_in = fopen(input, "rt"))) { - fprintf(stderr,"Could not open %s\n", input); - exit(2); + ppy_error("Could not open %s\n", input); + return 2; } pp_status.input = input; @@ -162,6 +163,8 @@ int wpp_parse( const char *input, FILE *output ) fprintf(ppy_out, "# 1 \"%s\" 1\n", input ? input : ""); ret = ppy_parse(); + /* If there were errors during processing, return an error code */ + if(!ret && pp_status.state) ret = pp_status.state; if (input) fclose(ppy_in); pp_pop_define_state(); @@ -184,14 +187,14 @@ int wpp_parse_temp( const char *input, const char *output_base, char **output_na if((fd = mkstemps( temp_name, 0 )) == -1) { - fprintf(stderr, "Could not generate a temp name from %s\n", temp_name); - exit(2); + ppy_error("Could not generate a temp name from %s\n", temp_name); + return 2; } if (!(output = fdopen(fd, "wt"))) { - fprintf(stderr,"Could not open fd %s for writing\n", temp_name); - exit(2); + ppy_error("Could not open fd %s for writing\n", temp_name); + return 2; } *output_name = temp_name; diff --git a/libs/wpp/wpp_private.h b/libs/wpp/wpp_private.h index 24ed6b844b5..b485d70009f 100644 --- a/libs/wpp/wpp_private.h +++ b/libs/wpp/wpp_private.h @@ -113,7 +113,8 @@ typedef enum { if_elif, if_elsefalse, if_elsetrue, - if_ignore + if_ignore, + if_error } pp_if_state_t; @@ -228,6 +229,7 @@ struct pp_status const char *input; /* current input file name */ int line_number; /* current line number */ int char_number; /* current char number in line */ + int state; /* current error state */ int pedantic; /* pedantic option */ int debug; /* debug messages flag */ }; diff --git a/programs/winetest/main.c b/programs/winetest/main.c index 4287066e9b1..bab7f11066f 100644 --- a/programs/winetest/main.c +++ b/programs/winetest/main.c @@ -135,8 +135,11 @@ static int running_on_visible_desktop (void) { HWND desktop; HMODULE huser32 = GetModuleHandle("user32.dll"); - FARPROC pGetProcessWindowStation = GetProcAddress(huser32, "GetProcessWindowStation"); - FARPROC pGetUserObjectInformationA = GetProcAddress(huser32, "GetUserObjectInformationA"); + HWINSTA (WINAPI *pGetProcessWindowStation)(void); + BOOL (WINAPI *pGetUserObjectInformationA)(HANDLE,INT,LPVOID,DWORD,LPDWORD); + + pGetProcessWindowStation = (void *)GetProcAddress(huser32, "GetProcessWindowStation"); + pGetUserObjectInformationA = (void *)GetProcAddress(huser32, "GetUserObjectInformationA"); desktop = GetDesktopWindow(); if (!GetWindowLongPtrW(desktop, GWLP_WNDPROC)) /* Win9x */ @@ -155,6 +158,20 @@ static int running_on_visible_desktop (void) return IsWindowVisible(desktop); } +/* check for wine fake dll module */ +static BOOL is_fake_dll( HMODULE module ) +{ + static const char fakedll_signature[] = "Wine placeholder DLL"; + const IMAGE_DOS_HEADER *dos; + + if (!((ULONG_PTR)module & 1)) return FALSE; /* not loaded as datafile */ + dos = (const IMAGE_DOS_HEADER *)((const char *)module - 1); + if (dos->e_magic != IMAGE_DOS_SIGNATURE) return FALSE; + if (dos->e_lfanew >= sizeof(*dos) + sizeof(fakedll_signature) && + !memcmp( dos + 1, fakedll_signature, sizeof(fakedll_signature) )) return TRUE; + return FALSE; +} + /* check if Gecko is present, trying to trigger the install if not */ static BOOL gecko_check(void) { @@ -570,12 +587,13 @@ static BOOL get_main_clsid(const char *name, CLSID *clsid) return FALSE; } -static HMODULE load_com_dll(const char *name) +static HMODULE load_com_dll(const char *name, char **path, char *filename) { HMODULE dll = NULL; HKEY hkey; char keyname[100]; char dllname[MAX_PATH]; + char *p; CLSID clsid; if(!get_main_clsid(name, &clsid)) return NULL; @@ -589,7 +607,15 @@ static HMODULE load_com_dll(const char *name) { LONG size = sizeof(dllname); if(RegQueryValueA(hkey, NULL, dllname, &size) == ERROR_SUCCESS) - dll = LoadLibraryA(dllname); + { + if ((dll = LoadLibraryExA(dllname, NULL, LOAD_LIBRARY_AS_DATAFILE))) + { + strcpy( filename, dllname ); + p = strrchr(dllname, '\\'); + if (p) *p = 0; + *path = heap_strdup( dllname ); + } + } RegCloseKey(hkey); } @@ -628,10 +654,17 @@ extract_test_proc (HMODULE hModule, LPCTSTR lpszType, strcpy(filename, dllname); dll = LoadLibraryExA(dllname, NULL, LOAD_LIBRARY_AS_DATAFILE); - if(!dll) + if (!dll) dll = load_com_dll(dllname, &wine_tests[nr_of_files].maindllpath, filename); + + if (dll && running_under_wine() && ((ULONG_PTR)dll & 1)) { - dll = load_com_dll(dllname); - if(dll) get_dll_path(dll, &wine_tests[nr_of_files].maindllpath, filename); + /* builtin dlls can't be loaded as datafile, so we must have native or fake dll */ + if (!is_fake_dll(dll)) + { + FreeLibrary(dll); + xprintf (" %s=load error Configured as native\n", dllname); + return TRUE; + } } if (!dll && pLoadLibraryShim) diff --git a/server/fd.c b/server/fd.c index d2da6247ad7..72ebcfe61d2 100644 --- a/server/fd.c +++ b/server/fd.c @@ -192,8 +192,8 @@ struct fd unsigned int sharing; /* file sharing mode */ int unix_fd; /* unix file descriptor */ unsigned int no_fd_status;/* status to return when unix_fd is -1 */ - int signaled :1; /* is the fd signaled? */ - int fs_locks :1; /* can we use filesystem locks for this fd? */ + unsigned int signaled :1; /* is the fd signaled? */ + unsigned int fs_locks :1; /* can we use filesystem locks for this fd? */ int poll_index; /* index of fd in poll array */ struct async_queue *read_q; /* async readers of this fd */ struct async_queue *write_q; /* async writers of this fd */ diff --git a/server/process.c b/server/process.c index 8df9f394221..31d352729c9 100644 --- a/server/process.c +++ b/server/process.c @@ -1095,6 +1095,18 @@ DECL_HANDLER(get_process_info) } } +static void set_process_affinity( struct process *process, affinity_t affinity ) +{ + struct thread *thread; + + process->affinity = affinity; + + LIST_FOR_EACH_ENTRY( thread, &process->thread_list, struct thread, proc_entry ) + { + set_thread_affinity( thread, affinity ); + } +} + /* set information about a process */ DECL_HANDLER(set_process_info) { @@ -1103,7 +1115,7 @@ DECL_HANDLER(set_process_info) if ((process = get_process_from_handle( req->handle, PROCESS_SET_INFORMATION ))) { if (req->mask & SET_PROCESS_INFO_PRIORITY) process->priority = req->priority; - if (req->mask & SET_PROCESS_INFO_AFFINITY) process->affinity = req->affinity; + if (req->mask & SET_PROCESS_INFO_AFFINITY) set_process_affinity( process, req->affinity ); release_object( process ); } } diff --git a/server/thread.c b/server/thread.c index 2ea892913d4..f45be2436b1 100644 --- a/server/thread.c +++ b/server/thread.c @@ -35,6 +35,9 @@ #ifdef HAVE_POLL_H #include #endif +#ifdef HAVE_SCHED_H +#include +#endif #include "ntstatus.h" #define WIN32_NO_STATUS @@ -404,6 +407,35 @@ struct thread *get_thread_from_pid( int pid ) return NULL; } +void set_thread_affinity( struct thread *thread, affinity_t affinity ) +{ + if ((affinity & thread->process->affinity) != affinity) + { + set_error( STATUS_INVALID_PARAMETER ); + return; + } +#ifdef HAVE_SCHED_SETAFFINITY + if (thread->unix_pid != -1) + { + cpu_set_t set; + int i; + affinity_t mask; + + CPU_ZERO( &set ); + for (i = 0, mask = 1; mask; i++, mask <<= 1) + if (affinity & mask) CPU_SET( i, &set ); + + if (!sched_setaffinity( thread->unix_pid, sizeof(set), &set )) + thread->affinity = affinity; + else + file_set_error(); + } + else set_error( STATUS_ACCESS_DENIED ); +#else + thread->affinity = affinity; +#endif +} + #define THREAD_PRIORITY_REALTIME_HIGHEST 6 #define THREAD_PRIORITY_REALTIME_LOWEST -7 @@ -428,7 +460,7 @@ static void set_thread_info( struct thread *thread, set_error( STATUS_INVALID_PARAMETER ); } if (req->mask & SET_THREAD_INFO_AFFINITY) - thread->affinity = req->affinity; + set_thread_affinity( thread, req->affinity ); if (req->mask & SET_THREAD_INFO_TOKEN) security_set_thread_token( thread, req->token ); } diff --git a/server/thread.h b/server/thread.h index b6c1cf589e5..90f6061fb80 100644 --- a/server/thread.h +++ b/server/thread.h @@ -118,6 +118,7 @@ extern int thread_add_inflight_fd( struct thread *thread, int client, int server extern int thread_get_inflight_fd( struct thread *thread, int client ); extern struct thread_snapshot *thread_snap( int *count ); extern struct token *thread_get_impersonation_token( struct thread *thread ); +extern void set_thread_affinity( struct thread *thread, affinity_t affinity ); /* ptrace functions */ diff --git a/tools/widl/widl.c b/tools/widl/widl.c index 60322d3f58f..c1c3832df2c 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -252,7 +252,8 @@ static void set_target( const char *target ) { "x86_64", SYS_WIN64 }, { "sparc", SYS_WIN32 }, { "alpha", SYS_WIN32 }, - { "powerpc", SYS_WIN32 } + { "powerpc", SYS_WIN32 }, + { "arm", SYS_WIN32 } }; unsigned int i; diff --git a/tools/winedump/main.c b/tools/winedump/main.c index 2aba30a95ff..3524a1e3788 100644 --- a/tools/winedump/main.c +++ b/tools/winedump/main.c @@ -80,13 +80,13 @@ static void do_dump (const char *arg) } -static void do_code (void) +static void do_code (const char *arg) { globals.do_code = 1; } -static void do_trace (void) +static void do_trace (const char *arg) { globals.do_trace = 1; globals.do_code = 1; @@ -100,18 +100,18 @@ static void do_forward (const char *arg) globals.do_code = 1; } -static void do_document (void) +static void do_document (const char *arg) { globals.do_documentation = 1; } -static void do_cdecl (void) +static void do_cdecl (const char *arg) { globals.do_cdecl = 1; } -static void do_quiet (void) +static void do_quiet (const char *arg) { globals.do_quiet = 1; } @@ -157,18 +157,18 @@ static void do_symfile (const char *arg) } -static void do_verbose (void) +static void do_verbose (const char *arg) { globals.do_verbose = 1; } -static void do_symdmngl (void) +static void do_symdmngl (const char *arg) { globals.do_demangle = 1; } -static void do_dumphead (void) +static void do_dumphead (const char *arg) { globals.do_dumpheader = 1; } @@ -178,12 +178,12 @@ static void do_dumpsect (const char* arg) globals.dumpsect = arg; } -static void do_rawdebug (void) +static void do_rawdebug (const char *arg) { globals.do_debug = 1; } -static void do_dumpall(void) +static void do_dumpall(const char *arg) { globals.do_dumpheader = 1; globals.do_dump_rawdata = 1; @@ -195,7 +195,7 @@ struct my_option const char *name; Mode mode; int has_arg; - void (*func) (); + void (*func)(const char *arg); const char *usage; }; @@ -226,7 +226,7 @@ static const struct my_option option_table[] = { {NULL, NONE, 0, NULL, NULL} }; -void do_usage (void) +void do_usage (const char *arg) { const struct my_option *opt; printf ("Usage: winedump [-h | sym | spec | dump ]\n"); @@ -466,7 +466,7 @@ int main (int argc, char *argv[]) return 1; break; case NONE: - do_usage(); + do_usage(0); break; case DUMP: if (globals.input_name == NULL) diff --git a/tools/winedump/winedump.h b/tools/winedump/winedump.h index 4b8984210b9..15a8cdbbfd4 100644 --- a/tools/winedump/winedump.h +++ b/tools/winedump/winedump.h @@ -268,10 +268,10 @@ void dump_frame_pointer_omission(unsigned long base, unsigned long len); FILE *open_file (const char *name, const char *ext, const char *mode); #ifdef __GNUC__ -void do_usage (void) __attribute__ ((noreturn)); +void do_usage (const char *arg) __attribute__ ((noreturn)); void fatal (const char *message) __attribute__ ((noreturn)); #else -void do_usage (void); +void do_usage (const char *arg); void fatal (const char *message); #endif -- 2.11.4.GIT