From 347e2c1650d38ded6c7bad6efbdeb3115d61fa37 Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Fri, 19 Dec 2008 21:43:13 +0100 Subject: [PATCH] push 818f085f73990f577927aeb76c81fa65ee9c5568 --- .gitignore | 1 + configure | 148 +- configure.ac | 21 +- dlls/advapi32/service.c | 2 +- dlls/amstream/Makefile.in | 3 +- dlls/amstream/amstream.c | 36 +- dlls/amstream/amstream_private.h | 2 + dlls/amstream/main.c | 1 + dlls/amstream/mediastream.c | 143 +- dlls/amstream/mediastreamfilter.c | 313 +++ dlls/amstream/regsvr.c | 3 +- dlls/avifil32/regsvr.c | 3 +- dlls/browseui/regsvr.c | 3 +- dlls/comctl32/tests/comboex.c | 1 + dlls/comctl32/theme_button.c | 3 - dlls/comdlg32/cdlg_De.rc | 2 +- dlls/crtdll/crtdll.spec | 32 +- dlls/crtdll/crtdll_main.c | 2 - dlls/crypt32/context.c | 2 +- dlls/crypt32/crypt32_Fr.rc | 69 +- dlls/crypt32/crypt32_private.h | 2 - dlls/cryptdlg/cryptdlg.rc | 1 + .../{msvcr71/msvcr71.c => cryptdlg/cryptdlg_Fr.rc} | 36 +- dlls/cryptui/Makefile.in | 5 +- dlls/cryptui/cert.bmp | Bin 0 -> 630 bytes dlls/cryptui/certerror.bmp | Bin 0 -> 630 bytes dlls/cryptui/certwarning.bmp | Bin 0 -> 630 bytes dlls/cryptui/checks.bmp | Bin 0 -> 3126 bytes dlls/{cryptdlg/cryptdlg.rc => cryptui/cryptui.rc} | 25 +- dlls/cryptui/cryptui.spec | 2 +- dlls/cryptui/cryptui_En.rc | 185 ++ dlls/cryptui/cryptuires.h | 134 + dlls/cryptui/main.c | 2889 +++++++++++++++++++- dlls/cryptui/smallicons.bmp | Bin 0 -> 2358 bytes dlls/d3d8/d3d8_private.h | 27 +- dlls/d3d8/device.c | 167 +- dlls/d3d8/pixelshader.c | 24 - dlls/d3d8/tests/device.c | 10 + dlls/d3d8/vertexshader.c | 31 +- dlls/d3d9/device.c | 16 +- dlls/d3d9/stateblock.c | 2 +- dlls/d3d9/tests/shader.c | 10 +- dlls/d3d9/tests/stateblock.c | 107 +- dlls/d3d9/tests/vertexdeclaration.c | 46 +- dlls/d3drm/math.c | 4 - dlls/d3dx8/mesh.c | 4 - dlls/d3dx9_24/d3dx9_24_main.c | 3 - dlls/d3dx9_25/d3dx9_25_main.c | 3 - dlls/d3dx9_26/d3dx9_26_main.c | 3 - dlls/d3dx9_27/d3dx9_27_main.c | 3 - dlls/d3dx9_28/d3dx9_28_main.c | 3 - dlls/d3dx9_29/d3dx9_29_main.c | 3 - dlls/d3dx9_30/d3dx9_30_main.c | 3 - dlls/d3dx9_31/d3dx9_31_main.c | 3 - dlls/d3dx9_32/d3dx9_32_main.c | 3 - dlls/d3dx9_33/d3dx9_33_main.c | 3 - dlls/d3dx9_34/d3dx9_34_main.c | 3 - dlls/d3dx9_35/d3dx9_35_main.c | 3 - dlls/d3dx9_36/d3dx9_36_main.c | 3 - dlls/d3dx9_37/d3dx9_37_main.c | 3 - dlls/d3dxof/Makefile.in | 2 +- dlls/d3dxof/d3dxof.c | 158 +- dlls/d3dxof/d3dxof_private.h | 4 +- dlls/d3dxof/regsvr.c | 3 +- dlls/d3dxof/tests/d3dxof.c | 179 ++ dlls/ddraw/regsvr.c | 3 +- dlls/ddraw/tests/dsurface.c | 6 +- dlls/ddraw/tests/visual.c | 2 +- dlls/devenum/devenum.rc | 12 +- dlls/dinput/regsvr.c | 3 +- dlls/dmband/Makefile.in | 2 +- dlls/dmband/regsvr.c | 3 +- dlls/dmcompos/Makefile.in | 2 +- dlls/dmcompos/regsvr.c | 3 +- dlls/dmime/performance.c | 6 +- dlls/dmime/regsvr.c | 3 +- dlls/dmime/segmentstate.c | 3 + dlls/dmloader/Makefile.in | 2 +- dlls/dmloader/loader.c | 2 +- dlls/dmloader/regsvr.c | 3 +- dlls/dmscript/Makefile.in | 2 +- dlls/dmscript/regsvr.c | 3 +- dlls/dmstyle/Makefile.in | 2 +- dlls/dmstyle/regsvr.c | 3 +- dlls/dmsynth/Makefile.in | 2 +- dlls/dmsynth/regsvr.c | 3 +- dlls/dmusic/Makefile.in | 2 +- dlls/dmusic/regsvr.c | 3 +- dlls/dplayx/dplobby.c | 2 +- dlls/dplayx/regsvr.c | 3 +- dlls/dpnet/Makefile.in | 2 +- dlls/dpnet/regsvr.c | 3 +- dlls/dsound/Makefile.in | 2 +- dlls/dsound/regsvr.c | 3 +- dlls/dswave/Makefile.in | 2 +- dlls/dswave/dswave.c | 1 + dlls/dswave/regsvr.c | 3 +- dlls/dxdiagn/regsvr.c | 4 +- dlls/gdi32/bitmap.c | 2 +- dlls/gdi32/dc.c | 4 +- dlls/gdi32/gdi.exe.spec | 6 +- dlls/gdi32/gdi16.c | 6 +- dlls/gdi32/gdiobj.c | 2 +- dlls/gdi32/tests/bitmap.c | 16 +- dlls/gdiplus/font.c | 1 + dlls/gdiplus/gdiplus.spec | 4 +- dlls/gdiplus/graphicspath.c | 22 + dlls/gdiplus/tests/font.c | 4 +- dlls/gdiplus/tests/graphicspath.c | 40 + dlls/hal/Makefile.in | 2 + dlls/{oleacc/oleacc.rc => hal/version.rc} | 16 +- dlls/hhctrl.ocx/regsvr.c | 3 +- dlls/imm32/tests/imm32.c | 16 +- dlls/inetcomm/regsvr.c | 3 +- dlls/inseng/Makefile.in | 2 +- dlls/inseng/regsvr.c | 3 +- dlls/jscript/engine.c | 29 +- dlls/jscript/jscript.c | 41 +- dlls/jscript/jscript.h | 1 + dlls/jscript/parser.y | 4 - dlls/jscript/tests/run.c | 61 +- dlls/kernel32/console.c | 23 + dlls/kernel32/fiber.c | 3 - dlls/kernel32/instr.c | 2 +- dlls/kernel32/kernel32.spec | 2 +- dlls/kernel32/kernel_main.c | 2 +- dlls/kernel32/kernel_private.h | 1 - dlls/kernel32/locale.c | 4 +- dlls/kernel32/process.c | 2 +- dlls/kernel32/snoop16.c | 8 +- dlls/mlang/Makefile.in | 2 +- dlls/mlang/regsvr.c | 4 +- dlls/mlang/tests/mlang.c | 2 +- dlls/mscat32/mscat32.spec | 34 +- dlls/mshtml/htmlinput.c | 3 +- dlls/mshtml/htmlstyle.c | 6 +- dlls/mshtml/mshtml_private.h | 2 + dlls/mshtml/navigate.c | 6 +- dlls/mshtml/nsembed.c | 2 + dlls/mshtml/nsio.c | 51 +- dlls/msi/action.c | 143 +- dlls/msi/events.c | 2 +- dlls/msi/helpers.c | 7 + dlls/msi/msi.c | 281 +- dlls/msi/msi.spec | 4 +- dlls/msi/msipriv.h | 18 +- dlls/msi/package.c | 1 + dlls/msi/record.c | 7 +- dlls/msi/registry.c | 97 +- dlls/msi/regsvr.c | 3 +- dlls/msi/tests/db.c | 2 +- dlls/msi/tests/msi.c | 1018 ++++++- dlls/msi/tests/package.c | 2 +- dlls/msi/tests/record.c | 10 + dlls/msvcr71/msvcr71.c | 3 - dlls/msvcr71/msvcr71.spec | 98 +- dlls/msvcrt/ctype.c | 8 +- dlls/msvcrt/file.c | 4 +- dlls/msvcrt/locale.c | 8 - dlls/msvcrt/lock.c | 3 +- dlls/msvcrt/math.c | 23 - dlls/msvcrt/mbcs.c | 5 +- dlls/msvcrt/msvcrt.h | 8 +- dlls/msvcrt/msvcrt.spec | 99 +- dlls/msvcrt/mtdll.h | 4 +- dlls/msvcrt/process.c | 141 +- dlls/msvcrt/tests/file.c | 39 + dlls/msvcrt/time.c | 4 +- dlls/msvcrt20/msvcrt20.spec | 82 +- dlls/msvcrt40/msvcrt40.c | 3 - dlls/msvcrt40/msvcrt40.spec | 84 +- dlls/msvcrtd/msvcrtd.spec | 96 +- dlls/{hal => msvfw32/tests}/Makefile.in | 12 +- dlls/msvfw32/tests/msvfw.c | 59 + dlls/msxml3/element.c | 15 +- dlls/msxml3/regsvr.c | 3 +- dlls/msxml3/tests/domdoc.c | 10 + dlls/ntdll/directory.c | 6 +- dlls/ntdll/file.c | 8 +- dlls/ntdll/loader.c | 52 +- dlls/ntdll/ntdll.spec | 2 +- dlls/ntdll/ntdll_misc.h | 3 +- dlls/ntdll/path.c | 2 +- dlls/ntdll/process.c | 2 +- dlls/ntdll/rtlstr.c | 4 +- dlls/ntdll/server.c | 8 +- dlls/ntdll/signal_i386.c | 2 +- dlls/ntdll/signal_powerpc.c | 2 +- dlls/ntdll/signal_sparc.c | 2 +- dlls/ntdll/signal_x86_64.c | 2 +- dlls/ntdll/sync.c | 131 +- dlls/ntdll/thread.c | 4 + dlls/ntdll/virtual.c | 14 +- dlls/ntoskrnl.exe/ntoskrnl.c | 27 +- dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 4 +- dlls/objsel/Makefile.in | 2 +- dlls/objsel/regsvr.c | 3 +- dlls/ole32/clipboard.c | 9 + dlls/ole32/oleproxy.c | 4 - dlls/ole32/regsvr.c | 3 +- dlls/ole32/storage.spec | 9 +- dlls/ole32/tests/clipboard.c | 2 - dlls/oleacc/oleacc.rc | 1 + dlls/oleacc/oleacc_Fr.rc | 90 + dlls/oleaut32/regsvr.c | 3 +- dlls/oleaut32/tests/olepicture.c | 6 - dlls/oleaut32/tests/tmarshal.c | 66 +- dlls/{cryptui => pidgen}/Makefile.in | 7 +- dlls/pidgen/bink.bin | Bin 0 -> 368 bytes dlls/{msvcr71/msvcr71.c => pidgen/main.c} | 21 +- dlls/pidgen/pidgen.spec | 7 + dlls/{oleacc/oleacc.rc => pidgen/rsrc.rc} | 13 +- dlls/quartz/avisplit.c | 2 +- dlls/quartz/filtergraph.c | 75 +- dlls/quartz/regsvr.c | 3 +- dlls/quartz/tests/filtermapper.c | 32 +- dlls/riched20/caret.c | 35 +- dlls/riched20/editor.c | 649 +++-- dlls/riched20/editstr.h | 4 +- dlls/riched20/paint.c | 103 +- dlls/riched20/rtf.h | 3 - dlls/riched20/run.c | 2 +- dlls/riched20/tests/editor.c | 225 +- dlls/riched20/tests/txtsrv.c | 120 +- dlls/riched20/wrap.c | 24 +- dlls/rpcrt4/tests/cstub.c | 2 +- dlls/rpcrt4/tests/rpc.c | 2 +- dlls/rpcrt4/tests/server.c | 6 +- dlls/setupapi/setupx.spec | 2 +- dlls/setupapi/setupx_main.c | 11 + dlls/setupapi/tests/devinst.c | 2 +- dlls/setupapi/tests/misc.c | 16 +- dlls/shell32/dialogs.c | 30 +- dlls/shell32/regsvr.c | 5 +- dlls/shell32/shell32_Fr.rc | 8 +- dlls/shell32/shlexec.c | 21 +- dlls/shlwapi/tests/shreg.c | 21 +- dlls/urlmon/regsvr.c | 3 +- dlls/urlmon/tests/url.c | 2 +- dlls/user32/driver.c | 13 - dlls/user32/input.c | 56 +- dlls/user32/menu.c | 14 +- dlls/user32/spy.c | 5 +- dlls/user32/sysparams.c | 2 +- dlls/user32/tests/win.c | 3 + dlls/user32/user_private.h | 1 - dlls/winealsa.drv/midi.c | 7 +- dlls/wineaudioio.drv/wineaudioio.drv.spec | 1 + dlls/wined3d/Makefile.in | 1 + dlls/wined3d/arb_program_shader.c | 133 +- dlls/wined3d/ati_fragment_shader.c | 25 + dlls/wined3d/baseshader.c | 245 +- dlls/wined3d/context.c | 70 +- dlls/wined3d/device.c | 342 +-- dlls/wined3d/directx.c | 58 +- dlls/wined3d/drawprim.c | 12 +- dlls/wined3d/gl_compat.c | 535 ++++ dlls/wined3d/glsl_shader.c | 204 +- dlls/wined3d/nvidia_texture_shader.c | 20 +- dlls/wined3d/pixelshader.c | 85 +- dlls/wined3d/state.c | 175 +- dlls/wined3d/stateblock.c | 12 - dlls/wined3d/surface.c | 43 +- dlls/wined3d/utils.c | 16 +- dlls/wined3d/vertexshader.c | 35 +- dlls/wined3d/wined3d_gl.h | 45 +- dlls/wined3d/wined3d_private.h | 87 +- dlls/wineesd.drv/audio.c | 8 +- dlls/winejack.drv/audio.c | 24 +- dlls/wineoss.drv/midi.c | 4 +- dlls/wineps.drv/type42.c | 2 +- dlls/winex11.drv/desktop.c | 2 +- dlls/winex11.drv/keyboard.c | 160 +- dlls/winex11.drv/mouse.c | 30 +- dlls/winex11.drv/systray.c | 2 +- dlls/winex11.drv/winex11.drv.spec | 4 - dlls/winex11.drv/wintab.c | 16 +- dlls/winex11.drv/x11drv.h | 11 +- dlls/wininet/tests/http.c | 4 +- dlls/winmm/lolvldrv.c | 5 +- dlls/wintab32/wintab32.c | 8 +- dlls/wintab32/wintab_internal.h | 8 +- dlls/wintrust/crypt.c | 203 +- dlls/wintrust/tests/crypt.c | 228 +- dlls/ws2_32/socket.c | 10 +- dlls/{inseng => wuapi}/Makefile.in | 15 +- dlls/wuapi/downloader.c | 267 ++ dlls/wuapi/installer.c | 253 ++ dlls/wuapi/main.c | 148 + dlls/{ddraw => wuapi}/regsvr.c | 64 +- dlls/wuapi/searcher.c | 257 ++ dlls/wuapi/session.c | 236 ++ dlls/wuapi/updates.c | 221 ++ dlls/wuapi/wuapi.spec | 4 + dlls/{oleacc/oleacc.rc => wuapi/wuapi_private.h} | 15 +- dlls/xinput1_3/tests/xinput.c | 18 +- include/Makefile.in | 1 + include/amstream.idl | 1 + include/cfgmgr32.h | 14 + include/commdlg.h | 25 +- include/config.h.in | 6 - include/cryptuiapi.h | 87 + include/ddk/wdm.h | 2 + include/gdiplusflat.h | 2 + include/mshtml.idl | 4 +- include/msi.h | 4 + include/msvcrt/conio.h | 34 +- include/msvcrt/crtdbg.h | 16 +- include/msvcrt/ctype.h | 74 +- include/msvcrt/direct.h | 26 +- include/msvcrt/dos.h | 2 +- include/msvcrt/eh.h | 24 +- include/msvcrt/errno.h | 2 +- include/msvcrt/float.h | 16 +- include/msvcrt/io.h | 100 +- include/msvcrt/locale.h | 6 +- include/msvcrt/malloc.h | 44 +- include/msvcrt/math.h | 62 +- include/msvcrt/mbctype.h | 36 +- include/msvcrt/mbstring.h | 243 +- include/msvcrt/memory.h | 12 +- include/msvcrt/process.h | 106 +- include/msvcrt/search.h | 12 +- include/msvcrt/setjmp.h | 4 +- include/msvcrt/signal.h | 6 +- include/msvcrt/stddef.h | 6 +- include/msvcrt/stdio.h | 210 +- include/msvcrt/stdlib.h | 238 +- include/msvcrt/string.h | 120 +- include/msvcrt/sys/stat.h | 20 +- include/msvcrt/sys/timeb.h | 2 +- include/msvcrt/sys/utime.h | 7 +- include/msvcrt/time.h | 53 +- include/msvcrt/wchar.h | 308 +-- include/msvcrt/wctype.h | 34 +- include/setupapi.h | 1 + include/textserv.h | 4 +- include/wincon.h | 3 + include/wine/library.h | 6 + include/wine/port.h | 14 - include/wine/server.h | 8 +- include/wine/server_protocol.h | 72 +- include/wine/wined3d.idl | 6 - include/winnt.h | 5 +- include/winternl.h | 6 +- include/wuapi.idl | 359 +++ programs/cmd/wcmdmain.c | 4 +- programs/explorer/appbar.c | 2 +- programs/explorer/desktop.c | 2 +- programs/explorer/systray.c | 2 +- programs/msiexec/service.c | 2 +- programs/net/net.c | 4 +- programs/oleview/Ko.rc | 2 +- programs/rpcss/rpcss_main.c | 2 +- programs/services/rpc.c | 2 +- programs/wineboot/wineboot.c | 2 +- programs/winecfg/drive.c | 2 +- programs/winecfg/driveui.c | 8 +- programs/winedevice/device.c | 2 +- programs/winemenubuilder/winemenubuilder.c | 1 + programs/winetest/main.c | 35 +- programs/winhlp32/En.rc | 4 +- programs/winhlp32/Fr.rc | 12 +- programs/winver/Makefile.in | 2 + .../oleacc/oleacc.rc => programs/winver/version.rc | 17 +- programs/wordpad/Fr.rc | 5 + server/async.c | 8 +- server/completion.c | 9 +- server/fd.c | 4 +- server/file.h | 7 +- server/mapping.c | 12 +- server/protocol.def | 70 +- server/trace.c | 168 +- tools/make_requests | 11 +- tools/widl/proxy.c | 2 +- tools/widl/typegen.c | 16 +- tools/winapi/winapi.pm | 5 +- tools/wine.inf.in | 2 + tools/winebuild/import.c | 75 +- tools/winebuild/parser.c | 2 +- tools/wrc/newstruc.c | 10 +- 381 files changed, 12930 insertions(+), 4295 deletions(-) create mode 100644 dlls/amstream/mediastreamfilter.c copy dlls/{msvcr71/msvcr71.c => cryptdlg/cryptdlg_Fr.rc} (57%) create mode 100644 dlls/cryptui/cert.bmp create mode 100644 dlls/cryptui/certerror.bmp create mode 100644 dlls/cryptui/certwarning.bmp create mode 100644 dlls/cryptui/checks.bmp copy dlls/{cryptdlg/cryptdlg.rc => cryptui/cryptui.rc} (60%) create mode 100644 dlls/cryptui/cryptui_En.rc create mode 100644 dlls/cryptui/cryptuires.h create mode 100644 dlls/cryptui/smallicons.bmp copy dlls/{oleacc/oleacc.rc => hal/version.rc} (72%) copy dlls/{hal => msvfw32/tests}/Makefile.in (56%) create mode 100644 dlls/msvfw32/tests/msvfw.c create mode 100644 dlls/oleacc/oleacc_Fr.rc copy dlls/{cryptui => pidgen}/Makefile.in (73%) create mode 100644 dlls/pidgen/bink.bin copy dlls/{msvcr71/msvcr71.c => pidgen/main.c} (72%) create mode 100644 dlls/pidgen/pidgen.spec copy dlls/{oleacc/oleacc.rc => pidgen/rsrc.rc} (80%) create mode 100644 dlls/wined3d/gl_compat.c copy dlls/{inseng => wuapi}/Makefile.in (59%) create mode 100644 dlls/wuapi/downloader.c create mode 100644 dlls/wuapi/installer.c create mode 100644 dlls/wuapi/main.c copy dlls/{ddraw => wuapi}/regsvr.c (90%) create mode 100644 dlls/wuapi/searcher.c create mode 100644 dlls/wuapi/session.c create mode 100644 dlls/wuapi/updates.c create mode 100644 dlls/wuapi/wuapi.spec copy dlls/{oleacc/oleacc.rc => wuapi/wuapi_private.h} (63%) rewrite include/msvcrt/mbstring.h (75%) create mode 100644 include/wuapi.idl copy dlls/oleacc/oleacc.rc => programs/winver/version.rc (67%) diff --git a/.gitignore b/.gitignore index dd819050eba..ab0eef774eb 100644 --- a/.gitignore +++ b/.gitignore @@ -202,6 +202,7 @@ include/wine/itss.h include/wine/svcctl.h include/wine/wined3d.h include/wtypes.h +include/wuapi.h include/xmldom.h include/xmldso.h libs/wpp/ppl.yy.c diff --git a/configure b/configure index 61667b7720b..960764a73ba 100755 --- a/configure +++ b/configure @@ -14471,127 +14471,6 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for va_copy" >&5 -echo $ECHO_N "checking for va_copy... $ECHO_C" >&6; } -if test "${ac_cv_c_va_copy+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -va_list ap1, ap2; va_copy(ap1,ap2); - ; - 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_c_va_copy="yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c_va_copy="no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c_va_copy" >&5 -echo "${ECHO_T}$ac_cv_c_va_copy" >&6; } -if test "$ac_cv_c_va_copy" = "yes" -then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_VA_COPY 1 -_ACEOF - -fi -{ echo "$as_me:$LINENO: checking for __va_copy" >&5 -echo $ECHO_N "checking for __va_copy... $ECHO_C" >&6; } -if test "${ac_cv_c___va_copy+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#include -int -main () -{ -va_list ap1, ap2; __va_copy(ap1,ap2); - ; - 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_c___va_copy="yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_c___va_copy="no" -fi - -rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ echo "$as_me:$LINENO: result: $ac_cv_c___va_copy" >&5 -echo "${ECHO_T}$ac_cv_c___va_copy" >&6; } -if test "$ac_cv_c___va_copy" = "yes" -then - -cat >>confdefs.h <<\_ACEOF -#define HAVE___VA_COPY 1 -_ACEOF - -fi - { echo "$as_me:$LINENO: checking for pthread_rwlock_t" >&5 echo $ECHO_N "checking for pthread_rwlock_t... $ECHO_C" >&6; } if test "${ac_cv_type_pthread_rwlock_t+set}" = set; then @@ -24231,6 +24110,14 @@ dlls/msvfw32/Makefile: dlls/msvfw32/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/msvfw32/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/msvfw32/tests/Makefile" +test "x$enable_tests" != xno && ALL_TEST_DIRS="$ALL_TEST_DIRS \\ + msvfw32/tests" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/msvfw32/tests/Makefile: dlls/msvfw32/tests/Makefile.in dlls/Maketest.rules" +ac_config_files="$ac_config_files dlls/msvfw32/tests/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/msvidc32/Makefile" test "x$enable_msvidc32" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ msvidc32" @@ -24503,6 +24390,14 @@ dlls/pdh/tests/Makefile: dlls/pdh/tests/Makefile.in dlls/Maketest.rules" ac_config_files="$ac_config_files dlls/pdh/tests/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/pidgen/Makefile" +test "x$enable_pidgen" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + pidgen" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/pidgen/Makefile: dlls/pidgen/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/pidgen/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/powrprof/Makefile" test "x$enable_powrprof" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ powrprof" @@ -25511,6 +25406,14 @@ dlls/wtsapi32/Makefile: dlls/wtsapi32/Makefile.in dlls/Makedll.rules" ac_config_files="$ac_config_files dlls/wtsapi32/Makefile" ALL_MAKEFILES="$ALL_MAKEFILES \\ + dlls/wuapi/Makefile" +test "x$enable_wuapi" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ + wuapi" +ALL_MAKEFILE_DEPENDS="$ALL_MAKEFILE_DEPENDS +dlls/wuapi/Makefile: dlls/wuapi/Makefile.in dlls/Makedll.rules" +ac_config_files="$ac_config_files dlls/wuapi/Makefile" + +ALL_MAKEFILES="$ALL_MAKEFILES \\ dlls/xinput1_1/Makefile" test "x$enable_xinput1_1" != xno && ALL_DLL_DIRS="$ALL_DLL_DIRS \\ xinput1_1" @@ -26885,6 +26788,7 @@ do "dlls/msvcrtd/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msvcrtd/Makefile" ;; "dlls/msvcrtd/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msvcrtd/tests/Makefile" ;; "dlls/msvfw32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msvfw32/Makefile" ;; + "dlls/msvfw32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msvfw32/tests/Makefile" ;; "dlls/msvidc32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msvidc32/Makefile" ;; "dlls/mswsock/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/mswsock/Makefile" ;; "dlls/msxml3/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/msxml3/Makefile" ;; @@ -26919,6 +26823,7 @@ do "dlls/opengl32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/opengl32/tests/Makefile" ;; "dlls/pdh/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/pdh/Makefile" ;; "dlls/pdh/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/pdh/tests/Makefile" ;; + "dlls/pidgen/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/pidgen/Makefile" ;; "dlls/powrprof/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/powrprof/Makefile" ;; "dlls/printui/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/printui/Makefile" ;; "dlls/propsys/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/propsys/Makefile" ;; @@ -27045,6 +26950,7 @@ do "dlls/ws2_32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/ws2_32/tests/Makefile" ;; "dlls/wsock32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wsock32/Makefile" ;; "dlls/wtsapi32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wtsapi32/Makefile" ;; + "dlls/wuapi/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/wuapi/Makefile" ;; "dlls/xinput1_1/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/xinput1_1/Makefile" ;; "dlls/xinput1_2/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/xinput1_2/Makefile" ;; "dlls/xinput1_3/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/xinput1_3/Makefile" ;; diff --git a/configure.ac b/configure.ac index 50a14afda4a..293ca62e146 100644 --- a/configure.ac +++ b/configure.ac @@ -1076,24 +1076,6 @@ then AC_DEFINE(HAVE_PPDEV, 1, [Define if we can use ppdev.h for parallel port access]) fi -dnl **** Check for va_copy **** -AC_CACHE_CHECK([for va_copy], ac_cv_c_va_copy, - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[va_list ap1, ap2; va_copy(ap1,ap2);]])], - [ac_cv_c_va_copy="yes"],[ac_cv_c_va_copy="no"]) - ) -if test "$ac_cv_c_va_copy" = "yes" -then - AC_DEFINE(HAVE_VA_COPY, 1, [Define if we have va_copy]) -fi -AC_CACHE_CHECK([for __va_copy], ac_cv_c___va_copy, - AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include ]], [[va_list ap1, ap2; __va_copy(ap1,ap2);]])], - [ac_cv_c___va_copy="yes"],[ac_cv_c___va_copy="no"]) - ) -if test "$ac_cv_c___va_copy" = "yes" -then - AC_DEFINE(HAVE___VA_COPY, 1, [Define if we have __va_copy]) -fi - dnl **** Check for pthread_rwlock_t **** AC_CHECK_TYPES([pthread_rwlock_t, pthread_rwlockattr_t],,,[#define _GNU_SOURCE #include ]) @@ -1971,6 +1953,7 @@ WINE_CONFIG_MAKEFILE([dlls/msvcrt40/Makefile],[dlls/Makedll.rules],[dlls],[ALL_D WINE_CONFIG_MAKEFILE([dlls/msvcrtd/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/msvcrtd/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/msvfw32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/msvfw32/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/msvidc32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/mswsock/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/msxml3/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) @@ -2005,6 +1988,7 @@ WINE_CONFIG_MAKEFILE([dlls/opengl32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_D WINE_CONFIG_MAKEFILE([dlls/opengl32/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/pdh/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/pdh/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) +WINE_CONFIG_MAKEFILE([dlls/pidgen/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/powrprof/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/printui/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/propsys/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) @@ -2131,6 +2115,7 @@ WINE_CONFIG_MAKEFILE([dlls/ws2_32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL WINE_CONFIG_MAKEFILE([dlls/ws2_32/tests/Makefile],[dlls/Maketest.rules],[dlls],[ALL_TEST_DIRS],[enable_tests]) WINE_CONFIG_MAKEFILE([dlls/wsock32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/wtsapi32/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) +WINE_CONFIG_MAKEFILE([dlls/wuapi/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/xinput1_1/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/xinput1_2/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) WINE_CONFIG_MAKEFILE([dlls/xinput1_3/Makefile],[dlls/Makedll.rules],[dlls],[ALL_DLL_DIRS]) diff --git a/dlls/advapi32/service.c b/dlls/advapi32/service.c index 0724035b444..cf58e2c44d6 100644 --- a/dlls/advapi32/service.c +++ b/dlls/advapi32/service.c @@ -102,7 +102,7 @@ static service_data **services; static unsigned int nb_services; static HANDLE service_event; -extern HANDLE __wine_make_process_system(void); +extern HANDLE CDECL __wine_make_process_system(void); /****************************************************************************** * SC_HANDLEs diff --git a/dlls/amstream/Makefile.in b/dlls/amstream/Makefile.in index 63d4093bde1..e141df0bc09 100644 --- a/dlls/amstream/Makefile.in +++ b/dlls/amstream/Makefile.in @@ -3,12 +3,13 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = amstream.dll -IMPORTS = strmiids uuid ole32 user32 advapi32 kernel32 +IMPORTS = strmiids uuid ole32 advapi32 kernel32 C_SRCS = \ amstream.c \ main.c \ mediastream.c \ + mediastreamfilter.c \ regsvr.c RC_SRCS = version.rc diff --git a/dlls/amstream/amstream.c b/dlls/amstream/amstream.c index 692403bce66..7c8a94bc21a 100644 --- a/dlls/amstream/amstream.c +++ b/dlls/amstream/amstream.c @@ -57,6 +57,11 @@ HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj) return CLASS_E_NOAGGREGATION; object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAMMultiMediaStreamImpl)); + if (!object) + { + ERR("Out of memory\n"); + return E_OUTOFMEMORY; + } object->lpVtbl.lpVtbl = &AM_Vtbl; object->ref = 1; @@ -71,7 +76,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_QueryInterface(IAMMultiMediaStream { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); + TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IAMMultiMediaStream)) @@ -113,7 +118,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetInformation(IAMMultiMediaStream { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pdwFlags, pStreamType); + FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pdwFlags, pStreamType); return E_NOTIMPL; } @@ -144,7 +149,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_EnumMediaStreams(IAMMultiMediaStre { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%ld,%p) stub!\n", This, iface, Index, ppMediaStream); + FIXME("(%p/%p)->(%ld,%p) stub!\n", This, iface, Index, ppMediaStream); return E_NOTIMPL; } @@ -153,7 +158,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetState(IAMMultiMediaStream* ifac { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentState); + FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentState); return E_NOTIMPL; } @@ -162,7 +167,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_SetState(IAMMultiMediaStream* ifac { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->() stub!\n", This, iface); + FIXME("(%p/%p)->() stub!\n", This, iface); return E_NOTIMPL; } @@ -171,7 +176,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetTime(IAMMultiMediaStream* iface { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentTime); + FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentTime); return E_NOTIMPL; } @@ -180,7 +185,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetDuration(IAMMultiMediaStream* i { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDuration); + FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDuration); return E_NOTIMPL; } @@ -189,7 +194,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Seek(IAMMultiMediaStream* iface, S { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->() stub!\n", This, iface); + FIXME("(%p/%p)->() stub!\n", This, iface); return E_NOTIMPL; } @@ -198,7 +203,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetEndOfStream(IAMMultiMediaStream { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%p) stub!\n", This, iface, phEOS); + FIXME("(%p/%p)->(%p) stub!\n", This, iface, phEOS); return E_NOTIMPL; } @@ -233,7 +238,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppGraphBuilder); + FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppGraphBuilder); return E_NOTIMPL; } @@ -257,7 +262,11 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_AddMediaStream(IAMMultiMediaStream FIXME("(%p/%p)->(%p,%p,%x,%p) partial stub!\n", This, iface, pStreamObject, PurposeId, dwFlags, ppNewStream); - hr = MediaStream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream); + if (IsEqualGUID(PurposeId, &MSPID_PrimaryVideo)) + hr = DirectDrawMediaStream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream); + else + hr = MediaStream_create((IMultiMediaStream*)iface, PurposeId, This->StreamType, &pStream); + if (SUCCEEDED(hr)) { pNewStreams = CoTaskMemAlloc((This->nbStreams+1)*sizeof(IMediaStream*)); @@ -339,7 +348,8 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_OpenFile(IAMMultiMediaStream* ifac } ret = IGraphBuilder_AddSourceFilter(This->GraphBuilder, pszFileName, pszFileName, &BaseFilter); - end: + +end: IBaseFilter_Release(BaseFilter); IFileSourceFilter_Release(SourceFilter); return ret; @@ -358,7 +368,7 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_Render(IAMMultiMediaStream* iface, { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%x)\n", This, iface, dwFlags); + FIXME("(%p/%p)->(%x) partial stub!\n", This, iface, dwFlags); if(dwFlags != AMMSF_NOCLOCK) return E_INVALIDARG; diff --git a/dlls/amstream/amstream_private.h b/dlls/amstream/amstream_private.h index cb457f9212c..b10b632b6df 100644 --- a/dlls/amstream/amstream_private.h +++ b/dlls/amstream/amstream_private.h @@ -35,6 +35,8 @@ #include "mmstream.h" HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj); +HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj); HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream); +HRESULT DirectDrawMediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream); #endif /* __AMSTREAM_PRIVATE_INCLUDED__ */ diff --git a/dlls/amstream/main.c b/dlls/amstream/main.c index 7bebe901fbe..8af5619b13d 100644 --- a/dlls/amstream/main.c +++ b/dlls/amstream/main.c @@ -75,6 +75,7 @@ static const struct object_creation_info object_creation[] = { { &CLSID_AMMultiMediaStream, AM_create }, { &CLSID_AMDirectDrawStream, AM_create }, + { &CLSID_MediaStreamFilter, MediaStreamFilter_create } }; static HRESULT WINAPI diff --git a/dlls/amstream/mediastream.c b/dlls/amstream/mediastream.c index 2cb7ce6821d..39e9a280957 100644 --- a/dlls/amstream/mediastream.c +++ b/dlls/amstream/mediastream.c @@ -1,7 +1,7 @@ /* * Implementation of IMediaStream Interface * - * Copyright 2005 Christian Costa + * Copyright 2005, 2008 Christian Costa * * This file contains the (internal) driver registration functions, * driver enumeration APIs and DirectDraw creation functions. @@ -31,6 +31,8 @@ #include "amstream_private.h" #include "amstream.h" +#include "ddstream.h" + WINE_DEFAULT_DEBUG_CHANNEL(amstream); typedef struct { @@ -41,7 +43,16 @@ typedef struct { STREAM_TYPE StreamType; } IMediaStreamImpl; +typedef struct { + IDirectDrawMediaStream lpVtbl; + LONG ref; + IMultiMediaStream* Parent; + MSPID PurposeId; + STREAM_TYPE StreamType; +} IDirectDrawMediaStreamImpl; + static const struct IMediaStreamVtbl MediaStream_Vtbl; +static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStream_Vtbl; HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream) { @@ -50,7 +61,12 @@ HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, S TRACE("(%p,%p,%p)\n", Parent, pPurposeId, ppMediaStream); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamImpl)); - + if (!object) + { + ERR("Out of memory\n"); + return E_OUTOFMEMORY; + } + object->lpVtbl.lpVtbl = &MediaStream_Vtbl; object->ref = 1; @@ -59,7 +75,7 @@ HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, S object->StreamType = StreamType; *ppMediaStream = (IMediaStream*)object; - + return S_OK; } @@ -71,7 +87,7 @@ static HRESULT WINAPI IMediaStreamImpl_QueryInterface(IMediaStream* iface, REFII TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); if (IsEqualGUID(riid, &IID_IUnknown) || - IsEqualGUID(riid, &IID_IAMMultiMediaStream)) + IsEqualGUID(riid, &IID_IMediaStream)) { IClassFactory_AddRef(iface); *ppvObject = This; @@ -109,7 +125,7 @@ static HRESULT WINAPI IMediaStreamImpl_GetMultiMediaStream(IMediaStream* iface, { IMediaStreamImpl *This = (IMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppMultiMediaStream); + FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppMultiMediaStream); return S_FALSE; } @@ -177,3 +193,120 @@ static const struct IMediaStreamVtbl MediaStream_Vtbl = IMediaStreamImpl_CreateSharedSample, IMediaStreamImpl_SendEndOfStream }; + +HRESULT DirectDrawMediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream) +{ + IDirectDrawMediaStreamImpl* object; + + TRACE("(%p,%p,%p)\n", Parent, pPurposeId, ppMediaStream); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamImpl)); + if (!object) + { + ERR("Out of memory\n"); + return E_OUTOFMEMORY; + } + + object->lpVtbl.lpVtbl = &DirectDrawMediaStream_Vtbl; + object->ref = 1; + + object->Parent = Parent; + object->PurposeId = *pPurposeId; + object->StreamType = StreamType; + + *ppMediaStream = (IMediaStream*)object; + + return S_OK; +} + +static HRESULT WINAPI IDirectDrawMediaStreamImpl_QueryInterface(IDirectDrawMediaStream* iface, REFIID riid, void** ppvObject) +{ + IMediaStreamImpl *This = (IMediaStreamImpl *)iface; + + TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); + + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IMediaStream) || + IsEqualGUID(riid, &IID_IDirectDrawMediaStream)) + { + IClassFactory_AddRef(iface); + *ppvObject = This; + return S_OK; + } + + ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject); + return E_NOINTERFACE; +} + +static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetFormat(IDirectDrawMediaStream* iface, DDSURFACEDESC *pDDSDCurrent, + IDirectDrawPalette **ppDirectDrawPalette, DDSURFACEDESC *pDDSDDesired, DWORD *pdwFlags) +{ + FIXME("(%p)->(%p,%p,%p,%p) stub!\n", iface, pDDSDCurrent, ppDirectDrawPalette, pDDSDDesired, pdwFlags); + + return E_NOTIMPL; + +} + +static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetFormat(IDirectDrawMediaStream* iface, const DDSURFACEDESC *pDDSurfaceDesc, + IDirectDrawPalette *pDirectDrawPalette) +{ + FIXME("(%p)->(%p,%p) stub!\n", iface, pDDSurfaceDesc, pDirectDrawPalette); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetDirectDraw(IDirectDrawMediaStream* iface, IDirectDraw **ppDirectDraw) +{ + FIXME("(%p)->(%p) stub!\n", iface, ppDirectDraw); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IDirectDrawMediaStreamImpl_SetDirectDraw(IDirectDrawMediaStream* iface, IDirectDraw *pDirectDraw) +{ + FIXME("(%p)->(%p) stub!\n", iface, pDirectDraw); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IDirectDrawMediaStreamImpl_CreateSample(IDirectDrawMediaStream* iface, IDirectDrawSurface *pSurface, const RECT *pRect, + DWORD dwFlags, IDirectDrawStreamSample **ppSample) +{ + FIXME("(%p)->(%p,%p,%x,%p) stub!\n", iface, pSurface, pRect, dwFlags, ppSample); + + return E_NOTIMPL; +} + +static HRESULT WINAPI IDirectDrawMediaStreamImpl_GetTimePerFrame(IDirectDrawMediaStream* iface, STREAM_TIME *pFrameTime) +{ + FIXME("(%p)->(%p) stub!\n", iface, pFrameTime); + + return E_NOTIMPL; +} + +/* Note: Hack so we can reuse the old functions without compiler warnings */ +#if !defined(__STRICT_ANSI__) && defined(__GNUC__) +# define XCAST(fun) (typeof(DirectDrawMediaStream_Vtbl.fun)) +#else +# define XCAST(fun) (void*) +#endif + +static const struct IDirectDrawMediaStreamVtbl DirectDrawMediaStream_Vtbl = +{ + IDirectDrawMediaStreamImpl_QueryInterface, + XCAST(AddRef)IMediaStreamImpl_AddRef, + XCAST(Release)IMediaStreamImpl_Release, + XCAST(GetMultiMediaStream)IMediaStreamImpl_GetMultiMediaStream, + XCAST(GetInformation)IMediaStreamImpl_GetInformation, + XCAST(SetSameFormat)IMediaStreamImpl_SetSameFormat, + XCAST(AllocateSample)IMediaStreamImpl_AllocateSample, + XCAST(CreateSharedSample)IMediaStreamImpl_CreateSharedSample, + XCAST(SendEndOfStream)IMediaStreamImpl_SendEndOfStream, + IDirectDrawMediaStreamImpl_GetFormat, + IDirectDrawMediaStreamImpl_SetFormat, + IDirectDrawMediaStreamImpl_GetDirectDraw, + IDirectDrawMediaStreamImpl_SetDirectDraw, + IDirectDrawMediaStreamImpl_CreateSample, + IDirectDrawMediaStreamImpl_GetTimePerFrame +}; +#undef XCAST diff --git a/dlls/amstream/mediastreamfilter.c b/dlls/amstream/mediastreamfilter.c new file mode 100644 index 00000000000..7f57e607113 --- /dev/null +++ b/dlls/amstream/mediastreamfilter.c @@ -0,0 +1,313 @@ +/* + * Implementation of MediaStream Filter + * + * Copyright 2008 Christian Costa + * + * This file contains the (internal) driver registration functions, + * driver enumeration APIs and DirectDraw creation functions. + * + * 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 "wine/debug.h" + +#define COBJMACROS + +#include "winbase.h" +#include "wingdi.h" + +#include "amstream_private.h" +#include "amstream.h" + +#include "ddstream.h" + +WINE_DEFAULT_DEBUG_CHANNEL(amstream); + +typedef struct { + IMediaStreamFilter lpVtbl; + LONG ref; + CRITICAL_SECTION csFilter; + FILTER_STATE state; + REFERENCE_TIME rtStreamStart; + IReferenceClock * pClock; + FILTER_INFO filterInfo; +} IMediaStreamFilterImpl; + +static const struct IMediaStreamFilterVtbl MediaStreamFilter_Vtbl; + +HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj) +{ + IMediaStreamFilterImpl* object; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + if( pUnkOuter ) + return CLASS_E_NOAGGREGATION; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamFilterImpl)); + if (!object) + { + ERR("Out of memory\n"); + return E_OUTOFMEMORY; + } + + object->lpVtbl.lpVtbl = &MediaStreamFilter_Vtbl; + object->ref = 1; + + *ppObj = object; + + return S_OK; +} + +/*** IUnknown methods ***/ + +static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter * iface, REFIID riid, LPVOID * ppv) +{ + IMediaStreamFilterImpl *This = (IMediaStreamFilterImpl *)iface; + + TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); + + *ppv = NULL; + + if (IsEqualIID(riid, &IID_IUnknown)) + *ppv = (LPVOID)This; + else if (IsEqualIID(riid, &IID_IPersist)) + *ppv = (LPVOID)This; + else if (IsEqualIID(riid, &IID_IMediaFilter)) + *ppv = (LPVOID)This; + else if (IsEqualIID(riid, &IID_IBaseFilter)) + *ppv = (LPVOID)This; + else if (IsEqualIID(riid, &IID_IMediaStreamFilter)) + *ppv = (LPVOID)This; + + if (*ppv) + { + IUnknown_AddRef((IUnknown *)(*ppv)); + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI MediaStreamFilterImpl_AddRef(IMediaStreamFilter * iface) +{ + IMediaStreamFilterImpl *This = (IMediaStreamFilterImpl *)iface; + ULONG refCount = InterlockedIncrement(&This->ref); + + TRACE("(%p)->() AddRef from %d\n", iface, refCount - 1); + + return refCount; +} + +static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter * iface) +{ + IMediaStreamFilterImpl *This = (IMediaStreamFilterImpl *)iface; + ULONG refCount = InterlockedDecrement(&This->ref); + + TRACE("(%p)->() Release from %d\n", iface, refCount + 1); + + if (!refCount) + { + This->lpVtbl.lpVtbl = NULL; + HeapFree(GetProcessHeap(), 0, This); + } + + return refCount; +} + +/*** IPersist methods ***/ + +static HRESULT WINAPI MediaStreamFilterImpl_GetClassID(IMediaStreamFilter * iface, CLSID * pClsid) +{ + TRACE("(%p)->(%p)\n", iface, pClsid); + + *pClsid = CLSID_MediaStreamFilter; + + return S_OK; +} + +/*** IMediaFilter methods ***/ + +static HRESULT WINAPI MediaStreamFilterImpl_Stop(IMediaStreamFilter * iface) +{ + FIXME("(%p)->(): Stub!\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_Pause(IMediaStreamFilter * iface) +{ + FIXME("(%p)->(): Stub!\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_Run(IMediaStreamFilter * iface, REFERENCE_TIME tStart) +{ + FIXME("(%p)->(%s): Stub!\n", iface, wine_dbgstr_longlong(tStart)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_GetState(IMediaStreamFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState) +{ + FIXME("(%p)->(%d,%p): Stub!\n", iface, dwMilliSecsTimeout, pState); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_SetSyncSource(IMediaStreamFilter * iface, IReferenceClock *pClock) +{ + TRACE("(%p)->(%p): Stub!\n", iface, pClock); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_GetSyncSource(IMediaStreamFilter * iface, IReferenceClock **ppClock) +{ + FIXME("(%p)->(%p): Stub!\n", iface, ppClock); + + return E_NOTIMPL; +} + +/*** IBaseFilter methods ***/ + +static HRESULT WINAPI MediaStreamFilterImpl_EnumPins(IMediaStreamFilter * iface, IEnumPins **ppEnum) +{ + FIXME("(%p)->(%p): Stub!\n", iface, ppEnum); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_FindPin(IMediaStreamFilter * iface, LPCWSTR Id, IPin **ppPin) +{ + FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_w(Id), ppPin); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_QueryFilterInfo(IMediaStreamFilter * iface, FILTER_INFO *pInfo) +{ + FIXME("(%p)->(%p): Stub!\n", iface, pInfo); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_JoinFilterGraph(IMediaStreamFilter * iface, IFilterGraph *pGraph, LPCWSTR pName) +{ + FIXME("(%p)->(%p, %s): Stub!\n", iface, pGraph, debugstr_w(pName)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_QueryVendorInfo(IMediaStreamFilter * iface, LPWSTR *pVendorInfo) +{ + FIXME("(%p)->(%p): Stub!\n", iface, pVendorInfo); + + return E_NOTIMPL; +} + +/*** IMediaStreamFilter methods ***/ + +static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* iface, IAMMediaStream *pAMMediaStream) +{ + FIXME("(%p)->(%p): Stub!\n", iface, pAMMediaStream); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_GetMediaStream(IMediaStreamFilter* iface, REFMSPID idPurpose, IMediaStream **ppMediaStream) +{ + FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_guid(idPurpose), ppMediaStream); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_EnumMediaStreams(IMediaStreamFilter* iface, long Index, IMediaStream **ppMediaStream) +{ + FIXME("(%p)->(%ld,%p): Stub!\n", iface, Index, ppMediaStream); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_SupportSeeking(IMediaStreamFilter* iface, BOOL bRenderer) +{ + FIXME("(%p)->(%d): Stub!\n", iface, bRenderer); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_ReferenceTimeToStreamTime(IMediaStreamFilter* iface, REFERENCE_TIME *pTime) +{ + FIXME("(%p)->(%p): Stub!\n", iface, pTime); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_GetCurrentStreamTime(IMediaStreamFilter* iface, REFERENCE_TIME *pCurrentStreamTime) +{ + FIXME("(%p)->(%p): Stub!\n", iface, pCurrentStreamTime); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_WaitUntil(IMediaStreamFilter* iface, REFERENCE_TIME WaitStreamTime) +{ + FIXME("(%p)->(%s): Stub!\n", iface, wine_dbgstr_longlong(WaitStreamTime)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_Flush(IMediaStreamFilter* iface, BOOL bCancelEOS) +{ + FIXME("(%p)->(%d): Stub!\n", iface, bCancelEOS); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_EndOfStream(IMediaStreamFilter* iface) +{ + FIXME("(%p)->(): Stub!\n", iface); + + return E_NOTIMPL; +} + +static const IMediaStreamFilterVtbl MediaStreamFilter_Vtbl = +{ + MediaStreamFilterImpl_QueryInterface, + MediaStreamFilterImpl_AddRef, + MediaStreamFilterImpl_Release, + MediaStreamFilterImpl_GetClassID, + MediaStreamFilterImpl_Stop, + MediaStreamFilterImpl_Pause, + MediaStreamFilterImpl_Run, + MediaStreamFilterImpl_GetState, + MediaStreamFilterImpl_SetSyncSource, + MediaStreamFilterImpl_GetSyncSource, + MediaStreamFilterImpl_EnumPins, + MediaStreamFilterImpl_FindPin, + MediaStreamFilterImpl_QueryFilterInfo, + MediaStreamFilterImpl_JoinFilterGraph, + MediaStreamFilterImpl_QueryVendorInfo, + MediaStreamFilterImpl_AddMediaStream, + MediaStreamFilterImpl_GetMediaStream, + MediaStreamFilterImpl_EnumMediaStreams, + MediaStreamFilterImpl_SupportSeeking, + MediaStreamFilterImpl_ReferenceTimeToStreamTime, + MediaStreamFilterImpl_GetCurrentStreamTime, + MediaStreamFilterImpl_WaitUntil, + MediaStreamFilterImpl_Flush, + MediaStreamFilterImpl_EndOfStream +}; diff --git a/dlls/amstream/regsvr.c b/dlls/amstream/regsvr.c index 478818f2a5d..028c68de754 100644 --- a/dlls/amstream/regsvr.c +++ b/dlls/amstream/regsvr.c @@ -33,6 +33,7 @@ #include "amstream.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(amstream); @@ -159,7 +160,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/avifil32/regsvr.c b/dlls/avifil32/regsvr.c index 6ec40856368..ef642acf3d0 100644 --- a/dlls/avifil32/regsvr.c +++ b/dlls/avifil32/regsvr.c @@ -32,6 +32,7 @@ #include "avifile_private.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(avifile); @@ -158,7 +159,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/browseui/regsvr.c b/dlls/browseui/regsvr.c index 5c265f466cb..62b4ea60caa 100644 --- a/dlls/browseui/regsvr.c +++ b/dlls/browseui/regsvr.c @@ -33,6 +33,7 @@ #include "browseui.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(browseui); @@ -159,7 +160,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/comctl32/tests/comboex.c b/dlls/comctl32/tests/comboex.c index 7add84bfb43..f59d1d1f810 100644 --- a/dlls/comctl32/tests/comboex.c +++ b/dlls/comctl32/tests/comboex.c @@ -351,6 +351,7 @@ static void cleanup(void) DispatchMessageA(&msg); } + DestroyWindow(hComboExParentWnd); UnregisterClassA(ComboExTestClass, GetModuleHandleA(NULL)); } diff --git a/dlls/comctl32/theme_button.c b/dlls/comctl32/theme_button.c index 7d389c7f8ab..113e851b14f 100644 --- a/dlls/comctl32/theme_button.c +++ b/dlls/comctl32/theme_button.c @@ -30,9 +30,6 @@ #include "uxtheme.h" #include "tmschema.h" #include "comctl32.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(themingbutton); #define BUTTON_TYPE 0x0f /* bit mask for the available button types */ diff --git a/dlls/comdlg32/cdlg_De.rc b/dlls/comdlg32/cdlg_De.rc index 721b20c406b..ed2c9445e2f 100644 --- a/dlls/comdlg32/cdlg_De.rc +++ b/dlls/comdlg32/cdlg_De.rc @@ -400,7 +400,7 @@ Bitte geben sie einen Wert zwischen %d und %d an." PD32_GENERIC_ERROR "Ein unbekannter Fehler ist aufgetreten." PD32_DRIVER_UNKNOWN "Unbekannter Druckertreiber." PD32_NO_DEVICES "Bevor Sie drucker-relevante Aufgaben ausführen können, \ - wie die Seiteneinrichtung oder ein Dokument zu drucken,\ + wie die Seiteneinrichtung oder ein Dokument zu drucken, \ müssen Sie einen Drucker installieren. Bitte führen Sie dies zuerst aus und versuchen Sie es erneut." PD32_DEFAULT_PRINTER "Standard Drucker; " diff --git a/dlls/crtdll/crtdll.spec b/dlls/crtdll/crtdll.spec index 505a6e9aa66..7584467ee60 100644 --- a/dlls/crtdll/crtdll.spec +++ b/dlls/crtdll/crtdll.spec @@ -3,22 +3,22 @@ @ cdecl ??2@YAPAXI@Z(long) msvcrt.??2@YAPAXI@Z @ cdecl ??3@YAXPAX@Z(ptr) msvcrt.??3@YAXPAX@Z @ cdecl ?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z(ptr) msvcrt.?_set_new_handler@@YAP6AHI@ZP6AHI@Z@Z -@ cdecl _CIacos() msvcrt._CIacos -@ cdecl _CIasin() msvcrt._CIasin -@ cdecl _CIatan() msvcrt._CIatan -@ cdecl _CIatan2() msvcrt._CIatan2 -@ cdecl _CIcos() msvcrt._CIcos -@ cdecl _CIcosh() msvcrt._CIcosh -@ cdecl _CIexp() msvcrt._CIexp -@ cdecl _CIfmod() msvcrt._CIfmod -@ cdecl _CIlog() msvcrt._CIlog -@ cdecl _CIlog10() msvcrt._CIlog10 -@ cdecl _CIpow() msvcrt._CIpow -@ cdecl _CIsin() msvcrt._CIsin -@ cdecl _CIsinh() msvcrt._CIsinh -@ cdecl _CIsqrt() msvcrt._CIsqrt -@ cdecl _CItan() msvcrt._CItan -@ cdecl _CItanh() msvcrt._CItanh +@ cdecl -arch=i386 _CIacos() msvcrt._CIacos +@ cdecl -arch=i386 _CIasin() msvcrt._CIasin +@ cdecl -arch=i386 _CIatan() msvcrt._CIatan +@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2 +@ cdecl -arch=i386 _CIcos() msvcrt._CIcos +@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh +@ cdecl -arch=i386 _CIexp() msvcrt._CIexp +@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod +@ cdecl -arch=i386 _CIlog() msvcrt._CIlog +@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10 +@ cdecl -arch=i386 _CIpow() msvcrt._CIpow +@ cdecl -arch=i386 _CIsin() msvcrt._CIsin +@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh +@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt +@ cdecl -arch=i386 _CItan() msvcrt._CItan +@ cdecl -arch=i386 _CItanh() msvcrt._CItanh @ extern _HUGE_dll msvcrt._HUGE @ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter @ cdecl __GetMainArgs(ptr ptr ptr long) diff --git a/dlls/crtdll/crtdll_main.c b/dlls/crtdll/crtdll_main.c index 60c42647bc7..a09f6f62d2e 100644 --- a/dlls/crtdll/crtdll_main.c +++ b/dlls/crtdll/crtdll_main.c @@ -122,7 +122,6 @@ void CDECL __GetMainArgs( int *argc, char ***argv, char ***envp, int expand_wild */ int CDECL CRTDLL__fstat(int fd, struct crtdll_stat* buf) { - extern int _fstat(int,struct _stat*); struct _stat st; int ret; @@ -136,7 +135,6 @@ int CDECL CRTDLL__fstat(int fd, struct crtdll_stat* buf) */ int CDECL CRTDLL__stat(const char* path, struct crtdll_stat * buf) { - extern int _stat(const char*,struct _stat*); struct _stat st; int ret; diff --git a/dlls/crypt32/context.c b/dlls/crypt32/context.c index fa085817ac6..fa7922f84e0 100644 --- a/dlls/crypt32/context.c +++ b/dlls/crypt32/context.c @@ -288,7 +288,7 @@ void ContextList_Delete(struct ContextList *list, void *context) list->contextInterface->free(context); } -void ContextList_Empty(struct ContextList *list) +static void ContextList_Empty(struct ContextList *list) { struct list *entry, *next; diff --git a/dlls/crypt32/crypt32_Fr.rc b/dlls/crypt32/crypt32_Fr.rc index 06a11f9e39a..08a1898852e 100644 --- a/dlls/crypt32/crypt32_Fr.rc +++ b/dlls/crypt32/crypt32_Fr.rc @@ -87,7 +87,7 @@ STRINGTABLE DISCARDABLE IDS_ENROLLMENT_NAME_VALUE_PAIR "Enrollment Name Value Pair" IDS_OS_VERSION "Version du système d'exploitation" IDS_ENROLLMENT_CSP "Enrollment CSP" - IDS_CRL_NUMBER "CRL Number" + IDS_CRL_NUMBER "Numéro CRL" IDS_DELTA_CRL_INDICATOR "Delta CRL Indicator" IDS_ISSUING_DIST_POINT "Issuing Distribution Point" IDS_FRESHEST_CRL "Freshest CRL" @@ -98,8 +98,8 @@ STRINGTABLE DISCARDABLE IDS_APPLICATION_POLICIES "Application Policies" IDS_APPLICATION_POLICY_MAPPINGS "Application Policy Mappings" IDS_APPLICATION_POLICY_CONSTRAINTS "Application Policy Constraints" - IDS_CMC_DATA "CMC Data" - IDS_CMC_RESPONSE "CMC Response" + IDS_CMC_DATA "Données CMC" + IDS_CMC_RESPONSE "Réponse CMC" IDS_UNSIGNED_CMC_REQUEST "Unsigned CMC Request" IDS_CMC_STATUS_INFO "CMC Status Info" IDS_CMC_EXTENSIONS "CMC Extensions" @@ -172,3 +172,66 @@ STRINGTABLE DISCARDABLE IDS_LOCALIZEDNAME_CA "Autorités intermédiaires" IDS_LOCALIZEDNAME_ADDRESSBOOK "Autres personnes" } + +STRINGTABLE DISCARDABLE +{ + IDS_KEY_ID "KeyID=" + IDS_CERT_ISSUER "Certificate Issuer" + IDS_CERT_SERIAL_NUMBER "Certificate Serial Number=" + IDS_ALT_NAME_OTHER_NAME "Other Name=" + IDS_ALT_NAME_RFC822_NAME "Email Address=" + IDS_ALT_NAME_DNS_NAME "DNS Name=" + IDS_ALT_NAME_DIRECTORY_NAME "Directory Address" + IDS_ALT_NAME_URL "URL=" + IDS_ALT_NAME_IP_ADDRESS "Adresse IP=" + IDS_ALT_NAME_MASK "Mask=" + IDS_ALT_NAME_REGISTERED_ID "Registered ID=" + IDS_USAGE_UNKNOWN "Unknown Key Usage" + IDS_SUBJECT_TYPE "Subject Type=" + IDS_SUBJECT_TYPE_CA "CA" + IDS_SUBJECT_TYPE_END_CERT "End Entity" + IDS_PATH_LENGTH "Path Length Constraint=" + IDS_PATH_LENGTH_NONE "Aucune" + IDS_INFO_NOT_AVAILABLE "Information Not Available" + IDS_AIA "Authority Info Access" + IDS_ACCESS_METHOD "Access Method=" + IDS_ACCESS_METHOD_OCSP "OCSP" + IDS_ACCESS_METHOD_CA_ISSUERS "CA Issuers" + IDS_ACCESS_METHOD_UNKNOWN "Unknown Access Method" + IDS_ACCESS_LOCATION "Alternative Name" + IDS_CRL_DIST_POINT "CRL Distribution Point" + IDS_CRL_DIST_POINT_NAME "Distribution Point Name" + IDS_CRL_DIST_POINT_FULL_NAME "Full Name" + IDS_CRL_DIST_POINT_RDN_NAME "RDN Name" + IDS_CRL_DIST_POINT_REASON "CRL Reason=" + IDS_CRL_DIST_POINT_ISSUER "CRL Issuer" + IDS_REASON_KEY_COMPROMISE "Key Compromise" + IDS_REASON_CA_COMPROMISE "CA Compromise" + IDS_REASON_AFFILIATION_CHANGED "Affiliation Changed" + IDS_REASON_SUPERSEDED "Superseded" + IDS_REASON_CESSATION_OF_OPERATION "Operation Ceased" + IDS_REASON_CERTIFICATE_HOLD "Certificate Hold" + IDS_FINANCIAL_CRITERIA "Financial Information=" + IDS_FINANCIAL_CRITERIA_AVAILABLE "Available" + IDS_FINANCIAL_CRITERIA_NOT_AVAILABLE "Not Available" + IDS_FINANCIAL_CRITERIA_MEETS_CRITERIA "Meets Criteria=" + IDS_YES "Oui" + IDS_NO "Non" + IDS_DIGITAL_SIGNATURE "Signature numérique" + IDS_NON_REPUDIATION "Non-répudiation" + IDS_KEY_ENCIPHERMENT "Key Encipherment" + IDS_DATA_ENCIPHERMENT "Data Encipherment" + IDS_KEY_AGREEMENT "Key Agreement" + IDS_CERT_SIGN "Certificate Signing" + IDS_OFFLINE_CRL_SIGN "Off-line CRL Signing" + IDS_CRL_SIGN "CRL Signing" + IDS_ENCIPHER_ONLY "Chiffrement seul" + IDS_DECIPHER_ONLY "Déchiffrement seul" + IDS_NETSCAPE_SSL_CLIENT "SSL Client Authentication" + IDS_NETSCAPE_SSL_SERVER "SSL Server Authentication" + IDS_NETSCAPE_SMIME "S/MIME" + IDS_NETSCAPE_SIGN "Signature" + IDS_NETSCAPE_SSL_CA "SSL CA" + IDS_NETSCAPE_SMIME_CA "S/MIME CA" + IDS_NETSCAPE_SIGN_CA "Signature CA" +} diff --git a/dlls/crypt32/crypt32_private.h b/dlls/crypt32/crypt32_private.h index b0f6101e793..46d4797b680 100644 --- a/dlls/crypt32/crypt32_private.h +++ b/dlls/crypt32/crypt32_private.h @@ -379,8 +379,6 @@ void *ContextList_Enum(struct ContextList *list, void *pPrev); void ContextList_Delete(struct ContextList *list, void *context); -void ContextList_Empty(struct ContextList *list); - void ContextList_Free(struct ContextList *list); /** diff --git a/dlls/cryptdlg/cryptdlg.rc b/dlls/cryptdlg/cryptdlg.rc index eb68dffa0f3..b56dd71685f 100644 --- a/dlls/cryptdlg/cryptdlg.rc +++ b/dlls/cryptdlg/cryptdlg.rc @@ -23,4 +23,5 @@ #include "cryptres.h" #include "cryptdlg_En.rc" +#include "cryptdlg_Fr.rc" #include "cryptdlg_Ko.rc" diff --git a/dlls/msvcr71/msvcr71.c b/dlls/cryptdlg/cryptdlg_Fr.rc similarity index 57% copy from dlls/msvcr71/msvcr71.c copy to dlls/cryptdlg/cryptdlg_Fr.rc index 3ada089ed44..23de9ebd572 100644 --- a/dlls/msvcr71/msvcr71.c +++ b/dlls/cryptdlg/cryptdlg_Fr.rc @@ -1,7 +1,7 @@ /* - * msvcr71 main file + * cryptdlg dll French resources * - * Copyright (C) 2008 Hans Leidekker + * Copyright 2008 Jonathan Ernst * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,25 +18,19 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include +LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL -#include "windef.h" -#include "winbase.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(msvcr71); - -BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) +STRINGTABLE DISCARDABLE { - switch (reason) - { - case DLL_WINE_PREATTACH: - return FALSE; /* prefer native version */ - case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls( inst ); - break; - case DLL_PROCESS_DETACH: - break; - } - return TRUE; + IDS_CERT_POLICY "Politique de certificat" + IDS_POLICY_ID "Identifiant de politique : " + IDS_POLICY_QUALIFIER_INFO "Policy Qualifier Info" + IDS_POLICY_QUALIFIER_ID "Policy Qualifier Id=" + IDS_CPS "CPS" + IDS_USER_NOTICE "User Notice" + IDS_QUALIFIER "Qualifier" + IDS_NOTICE_REF "Notice Reference" + IDS_ORGANIZATION "Organisation=" + IDS_NOTICE_NUM "Notice Number=" + IDS_NOTICE_TEXT "Notice Text=" } diff --git a/dlls/cryptui/Makefile.in b/dlls/cryptui/Makefile.in index abb0b2737bf..e268be61cf7 100644 --- a/dlls/cryptui/Makefile.in +++ b/dlls/cryptui/Makefile.in @@ -3,12 +3,15 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = cryptui.dll -IMPORTS = crypt32 kernel32 +IMPORTS = uuid crypt32 ole32 comctl32 user32 gdi32 kernel32 +DELAYIMPORTS = wintrust urlmon IMPORTLIB = cryptui C_SRCS = \ main.c +RC_SRCS = cryptui.rc + @MAKE_DLL_RULES@ @DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/cryptui/cert.bmp b/dlls/cryptui/cert.bmp new file mode 100644 index 0000000000000000000000000000000000000000..1f44f367ab2bb92eff3562623c2259d2d470fc10 GIT binary patch literal 630 zcwTezEn{K;gEAo20Ad9wW@KQ2NI>O5K!5=mG=LF9Lj!~YL68uTIB?(qP~<-tG5r4z zp+FEM1SIYbGEjixFNRtpRKTl@3V4k=kO5F0g^xwPdq>A^Agcuk!17SO2MB=WcX#hb z(Z3t00!cp#A1uFnM~e#tfaQVO;e3!hl5r6INa{iM@7}!|SwD!6Y(Ba?x_%7vkpWO1 IfB4k`074fU_W%F@ literal 0 HcwPel00001 diff --git a/dlls/cryptui/certerror.bmp b/dlls/cryptui/certerror.bmp new file mode 100644 index 0000000000000000000000000000000000000000..98bce50b179e0accb2a8afa568fc10d49afa00b3 GIT binary patch literal 630 zcwV)TJr2S!421(?VW`9rkh(DE2#A%tFmKDg--0~eg^gVs$z-mdf}hJEPqn&l>B8W3-p2Ng;I3QvB{Q-9q80bFc;p84eU zeb1a~vVn+q=0IG*1>%8u^pXHjPVM<%QqJvz7p~)?w0~4D?-S9uU;I%2gU|cF=8wgE Js`USo$~Q9*F6#gQ literal 0 HcwPel00001 diff --git a/dlls/cryptui/certwarning.bmp b/dlls/cryptui/certwarning.bmp new file mode 100644 index 0000000000000000000000000000000000000000..5961d9fa6c547a3fcc8b55f6074c3ea2d2bb4e93 GIT binary patch literal 630 zcwU{5Jqm+B5QQfaP*{WtGxZ= zn>RDd?&V%56jWoKu#UQRv=>8t)`4Q#Fv(gucyI{YIF5)+VbV0o!GlBCUVlpNZDxE5 zr!yNLL=jhyHIv!$D}7NY@2M$8X8>lB7b?T~ROF=-8SY1AUMO2|pM88`_}$<kF*Em9c9c5t{m@=T!AJSR>`OaQsE_jbe!MfTXI}C*{O|go N{;}Y%wfvu|c>{Bb1ikj$lDUAEx9z`xC@dZ-wgNOhC literal 0 HcwPel00001 diff --git a/dlls/cryptdlg/cryptdlg.rc b/dlls/cryptui/cryptui.rc similarity index 60% copy from dlls/cryptdlg/cryptdlg.rc copy to dlls/cryptui/cryptui.rc index eb68dffa0f3..71dc3a08084 100644 --- a/dlls/cryptdlg/cryptdlg.rc +++ b/dlls/cryptui/cryptui.rc @@ -1,5 +1,5 @@ /* - * cryptdlg dll resources + * cryptui dll resources * * Copyright 2008 Juan Lang * @@ -20,7 +20,24 @@ #include "windef.h" #include "winbase.h" #include "winuser.h" -#include "cryptres.h" +#include "commctrl.h" +#include "dlgs.h" -#include "cryptdlg_En.rc" -#include "cryptdlg_Ko.rc" +#include "cryptuires.h" + +/* @makedep: smallicons.bmp */ +IDB_SMALL_ICONS BITMAP LOADONCALL DISCARDABLE smallicons.bmp + +/* @makedep: cert.bmp */ +IDB_CERT BITMAP LOADONCALL DISCARDABLE cert.bmp + +/* @makedep: certerror.bmp */ +IDB_CERT_ERROR BITMAP LOADONCALL DISCARDABLE certerror.bmp + +/* @makedep: certwarning.bmp */ +IDB_CERT_WARNING BITMAP LOADONCALL DISCARDABLE certwarning.bmp + +/* @makedep: checks.bmp */ +IDB_CHECKS BITMAP LOADONCALL DISCARDABLE checks.bmp + +#include "cryptui_En.rc" diff --git a/dlls/cryptui/cryptui.spec b/dlls/cryptui/cryptui.spec index 201282f75fd..9c5a8612640 100644 --- a/dlls/cryptui/cryptui.spec +++ b/dlls/cryptui/cryptui.spec @@ -15,7 +15,7 @@ 15 stub CryptUIDlgViewCertificatePropertiesA 16 stub CryptUIDlgViewCertificatePropertiesW 17 stdcall CryptUIDlgViewCertificateW(ptr ptr) -18 stub CryptUIDlgViewContext +18 stdcall CryptUIDlgViewContext(long ptr ptr wstr long ptr) 19 stub CryptUIDlgViewSignerInfoA 20 stub CryptUIDlgViewSignerInfoW 21 stub CryptUIFreeCertificatePropertiesPagesA diff --git a/dlls/cryptui/cryptui_En.rc b/dlls/cryptui/cryptui_En.rc new file mode 100644 index 00000000000..f904fa7d6ac --- /dev/null +++ b/dlls/cryptui/cryptui_En.rc @@ -0,0 +1,185 @@ +/* + * cryptui dll resources + * + * Copyright 2008 Juan Lang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT + +STRINGTABLE DISCARDABLE +{ + IDS_CERTIFICATE "Certificate" + IDS_CERTIFICATEINFORMATION "Certificate Information" + IDS_CERT_INFO_BAD_SIG "This certificate has an invalid signature. The certificate may have been altered or corrupted." + IDS_CERT_INFO_UNTRUSTED_CA "This root certificate is not trusted. To trust it, add it to your system's trusted root certificate store." + IDS_CERT_INFO_UNTRUSTED_ROOT "This certificate could not be validated to a trusted root certificate." + IDS_CERT_INFO_PARTIAL_CHAIN "This certificate's issuer could not be found." + IDS_CERT_INFO_BAD_PURPOSES "All the intended purposes of this certificate could not be verified." + IDS_CERT_INFO_PURPOSES "This cerificate is intended for the following purposes:" + IDS_SUBJECT_HEADING "Issued to: " + IDS_ISSUER_HEADING "Issued by: " + IDS_VALID_FROM "Valid from " + IDS_VALID_TO " to " + IDS_CERTIFICATE_BAD_SIGNATURE "This certificate has an invalid signature." + IDS_CERTIFICATE_BAD_TIME "This certificate has expired or is not yet valid." + IDS_CERTIFICATE_BAD_TIMENEST "This certificate's validity period exceeds that of its issuer." + IDS_CERTIFICATE_REVOKED "This certificate was revoked by its issuer." + IDS_CERTIFICATE_VALID "This certificate is OK." + IDS_FIELD "Field" + IDS_VALUE "Value" + IDS_FIELDS_ALL "" + IDS_FIELDS_V1 "Version 1 Fields Only" + IDS_FIELDS_EXTENSIONS "Extensions Only" + IDS_FIELDS_CRITICAL_EXTENSIONS "Critical Extensions Only" + IDS_FIELDS_PROPERTIES "Properties Only" + IDS_FIELD_VERSION "Version" + IDS_FIELD_SERIAL_NUMBER "Serial number" + IDS_FIELD_ISSUER "Issuer" + IDS_FIELD_VALID_FROM "Valid from" + IDS_FIELD_VALID_TO "Valid to" + IDS_FIELD_SUBJECT "Subject" + IDS_FIELD_PUBLIC_KEY "Public key" + IDS_FIELD_PUBLIC_KEY_FORMAT "%s (%d bits)" + IDS_PROP_HASH "SHA1 hash" + IDS_PROP_ENHKEY_USAGE "Enhanced key usage (property)" + IDS_PROP_FRIENDLY_NAME "Friendly name" + IDS_PROP_DESCRIPTION "Description" + IDS_CERTIFICATE_PROPERTIES "Certificate Properties" + IDS_CERTIFICATE_PURPOSE_ERROR "Please enter an OID in the form 1.2.3.4" + IDS_CERTIFICATE_PURPOSE_EXISTS "The OID you entered already exists." + IDS_PURPOSE_SERVER_AUTH "Ensures the identify of a remote computer" + IDS_PURPOSE_CLIENT_AUTH "Proves your identity to a remote computer" + IDS_PURPOSE_CODE_SIGNING "Ensures software came from software publisher\nProtects software from alteration after publication" + IDS_PURPOSE_EMAIL_PROTECTION "Protects e-mail messges" + IDS_PURPOSE_IPSEC "Allows secure communication over the Internet" + IDS_PURPOSE_TIMESTAMP_SIGNING "Allows data to be signed with the current time" + IDS_PURPOSE_CTL_USAGE_SIGNING "Allows you to digitally sign a certificate trust list" + IDS_PURPOSE_EFS "Allows data on disk to be encrypted" + IDS_PURPOSE_EFS_RECOVERY "File Recovery" + IDS_PURPOSE_WHQL "Windows Hardware Driver Verification" + IDS_PURPOSE_NT5 "Windows System Component Verification" + IDS_PURPOSE_OEM_WHQL "OEM Windows System Component Verification" + IDS_PURPOSE_EMBEDDED_NT "Embedded Windows System Component Verification" + IDS_PURPOSE_ROOT_LIST_SIGNER "Root List Signer" + IDS_PURPOSE_QUALIFIED_SUBORDINATION "Qualified Subordination" + IDS_PURPOSE_KEY_RECOVERY "Key Recovery" + IDS_PURPOSE_DOCUMENT_SIGNING "Document Signing" + IDS_PURPOSE_LIFETIME_SIGNING "Lifetime Signing" + IDS_PURPOSE_DRM "Digital Rights" + IDS_PURPOSE_LICENSES "Key Pack Licenses" + IDS_PURPOSE_LICENSE_SERVER "License Server Verification" + IDS_PURPOSE_ENROLLMENT_AGENT "Certificate Request Agent" + IDS_PURPOSE_SMARTCARD_LOGON "Smart Card Logon" + IDS_PURPOSE_CA_EXCHANGE "Private Key Archival" + IDS_PURPOSE_KEY_RECOVERY_AGENT "Key Recovery Agent" + IDS_PURPOSE_DS_EMAIL_REPLICATION "Directory Service Email Replication" +} + +IDD_GENERAL DIALOG DISCARDABLE 0, 0, 255, 236 +CAPTION "General" +STYLE WS_VISIBLE +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "", IDC_STATIC, "Static", WS_BORDER|SS_WHITERECT, 6,10,241,200 + CONTROL "", IDC_CERTIFICATE_ICON,"RichEdit20W", + ES_READONLY|WS_DISABLED,8,11,26,26 + CONTROL "", IDC_CERTIFICATE_INFO,"RichEdit20W", + ES_READONLY|WS_DISABLED,34,11,212,26 + CONTROL "", IDC_STATIC, "Static", SS_BLACKFRAME, 16,37,222,1 + CONTROL "", IDC_CERTIFICATE_STATUS,"RichEdit20W", + ES_READONLY|ES_MULTILINE|WS_DISABLED,8,38,238,78 + CONTROL "", IDC_STATIC, "Static", SS_BLACKFRAME, 16,116,222,1 + CONTROL "", IDC_CERTIFICATE_NAMES,"RichEdit20W", + ES_READONLY|ES_MULTILINE|WS_DISABLED,8,117,238,91 + PUSHBUTTON "&Install Certificate...", IDC_ADDTOSTORE,103,216,70,14 + PUSHBUTTON "Issuer &Statement", IDC_ISSUERSTATEMENT,177,216,70,14 +END + +IDD_DETAIL DIALOG DISCARDABLE 0, 0, 255, 236 +CAPTION "Details" +STYLE WS_VISIBLE +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Show:", stc1, 6,12,40,14 + COMBOBOX IDC_DETAIL_SELECT, 28,10,100,14, + CBS_DROPDOWNLIST|WS_BORDER|WS_VSCROLL|WS_TABSTOP + CONTROL "", IDC_DETAIL_LIST, "SysListView32", + LVS_REPORT|LVS_SINGLESEL|WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER, + 6,28,241,100 + CONTROL "", IDC_DETAIL_VALUE, "RichEdit20W", + ES_READONLY|ES_MULTILINE|WS_TABSTOP, 6,136,241,70 + PUSHBUTTON "&Edit Properties...", IDC_EDITPROPERTIES,103,216,70,14 + PUSHBUTTON "&Copy to File...", IDC_EXPORT,177,216,70,14 +END + +IDD_HIERARCHY DIALOG DISCARDABLE 0, 0, 255, 236 +CAPTION "Certification Path" +STYLE WS_VISIBLE +FONT 8, "MS Shell Dlg" +BEGIN + GROUPBOX "Certification &path", grp1,6,10,245,165, BS_GROUPBOX + CONTROL "",IDC_CERTPATH, "SysTreeView32", TVS_HASLINES|WS_BORDER, + 13,22,231,130 + PUSHBUTTON "&View Certificate", IDC_VIEWCERTIFICATE,175,156,70,14 + LTEXT "Certificate &status:", IDC_CERTIFICATESTATUS,6,183,70,14 + CONTROL "", IDC_CERTIFICATESTATUSTEXT,"RichEdit20W", + WS_BORDER|ES_READONLY|ES_MULTILINE|WS_DISABLED,6,195,245,36 +END + +IDD_USERNOTICE DIALOG DISCARDABLE 0, 0, 255, 256 +CAPTION "Disclaimer" +STYLE WS_VISIBLE +FONT 8, "MS Shell Dlg" +BEGIN + CONTROL "", IDC_USERNOTICE,"RichEdit20W", + WS_BORDER|ES_READONLY|ES_MULTILINE|WS_DISABLED,6,10,241,200 + PUSHBUTTON "Close", IDOK,103,216,70,14 + PUSHBUTTON "More &Info", IDC_CPS,177,216,70,14 +END + +IDD_CERT_PROPERTIES_GENERAL DIALOG DISCARDABLE 0, 0, 255, 236 +CAPTION "General" +STYLE WS_VISIBLE +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "&Friendly name:", stc1, 6,14,60,14 + EDITTEXT IDC_FRIENDLY_NAME, 60,12,191,14, ES_AUTOHSCROLL|WS_TABSTOP + LTEXT "&Description:", stc2, 6,32,60,14 + EDITTEXT IDC_DESCRIPTION, 60,30,191,14, ES_AUTOVSCROLL|ES_MULTILINE|WS_TABSTOP|WS_VSCROLL + GROUPBOX "Certificate purposes", grp1,6,48,245,165, BS_GROUPBOX + AUTORADIOBUTTON "&Enable all purposes for this certificate", + IDC_ENABLE_ALL_PURPOSES, 12,58,180,14, BS_AUTORADIOBUTTON|WS_TABSTOP + AUTORADIOBUTTON "D&isable all purposes for this certificate", + IDC_DISABLE_ALL_PURPOSES, 12,70,180,14, BS_AUTORADIOBUTTON + AUTORADIOBUTTON "Enable &only the following purposes for this certificate:", + IDC_ENABLE_SELECTED_PURPOSES, 12,82,180,14, BS_AUTORADIOBUTTON + CONTROL "", IDC_CERTIFICATE_USAGES,"SysListView32", + LVS_REPORT|LVS_NOCOLUMNHEADER|LVS_SINGLESEL|WS_CHILD|WS_VISIBLE|WS_TABSTOP|WS_BORDER, + 24,100,220,90 + PUSHBUTTON "Add &Purpose...", IDC_ADD_PURPOSE,184,194,60,14 +END + +IDD_ADD_CERT_PURPOSE DIALOG DISCARDABLE 0,0,200,68 +CAPTION "Add Purpose" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Add the object identifier (OID) for the certificate purpose you wish to add:", + stc1, 6,6,190,28 + EDITTEXT IDC_NEW_PURPOSE, 6,28,190,14, ES_AUTOVSCROLL|ES_MULTILINE|WS_TABSTOP|WS_VSCROLL + PUSHBUTTON "OK", IDOK, 33,48,60,14 + PUSHBUTTON "Cancel", IDCANCEL, 100,48,60,14 +END diff --git a/dlls/cryptui/cryptuires.h b/dlls/cryptui/cryptuires.h new file mode 100644 index 00000000000..9e188524594 --- /dev/null +++ b/dlls/cryptui/cryptuires.h @@ -0,0 +1,134 @@ +/* + * Copyright 2008 Juan Lang + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ +#ifndef __CRYPTUIRES_H_ +#define __CRYPTUIRES_H_ + +#define IDS_CERTIFICATE 1000 +#define IDS_CERTIFICATEINFORMATION 1001 +#define IDS_CERT_INFO_BAD_SIG 1002 +#define IDS_CERT_INFO_UNTRUSTED_CA 1003 +#define IDS_CERT_INFO_UNTRUSTED_ROOT 1004 +#define IDS_CERT_INFO_PARTIAL_CHAIN 1005 +#define IDS_CERT_INFO_BAD_PURPOSES 1006 +#define IDS_CERT_INFO_PURPOSES 1007 + +#define IDS_SUBJECT_HEADING 1010 +#define IDS_ISSUER_HEADING 1011 +#define IDS_VALID_FROM 1012 +#define IDS_VALID_TO 1013 +#define IDS_CERTIFICATE_BAD_SIGNATURE 1014 +#define IDS_CERTIFICATE_BAD_TIME 1015 +#define IDS_CERTIFICATE_BAD_TIMENEST 1016 +#define IDS_CERTIFICATE_REVOKED 1017 +#define IDS_CERTIFICATE_VALID 1018 +#define IDS_FIELD 1019 +#define IDS_VALUE 1020 +#define IDS_FIELDS_ALL 1021 +#define IDS_FIELDS_V1 1022 +#define IDS_FIELDS_EXTENSIONS 1023 +#define IDS_FIELDS_CRITICAL_EXTENSIONS 1024 +#define IDS_FIELDS_PROPERTIES 1025 +#define IDS_FIELD_VERSION 1026 +#define IDS_FIELD_SERIAL_NUMBER 1027 +#define IDS_FIELD_ISSUER 1028 +#define IDS_FIELD_VALID_FROM 1029 +#define IDS_FIELD_VALID_TO 1030 +#define IDS_FIELD_SUBJECT 1031 +#define IDS_FIELD_PUBLIC_KEY 1032 +#define IDS_FIELD_PUBLIC_KEY_FORMAT 1033 +#define IDS_PROP_HASH 1034 +#define IDS_PROP_ENHKEY_USAGE 1035 +#define IDS_PROP_FRIENDLY_NAME 1036 +#define IDS_PROP_DESCRIPTION 1037 +#define IDS_CERTIFICATE_PROPERTIES 1038 +#define IDS_CERTIFICATE_PURPOSE_ERROR 1039 +#define IDS_CERTIFICATE_PURPOSE_EXISTS 1040 + +#define IDS_PURPOSE_SERVER_AUTH 1100 +#define IDS_PURPOSE_CLIENT_AUTH 1101 +#define IDS_PURPOSE_CODE_SIGNING 1102 +#define IDS_PURPOSE_EMAIL_PROTECTION 1103 +#define IDS_PURPOSE_IPSEC 1104 +#define IDS_PURPOSE_TIMESTAMP_SIGNING 1105 +#define IDS_PURPOSE_CTL_USAGE_SIGNING 1106 +#define IDS_PURPOSE_EFS 1107 +#define IDS_PURPOSE_EFS_RECOVERY 1108 +#define IDS_PURPOSE_WHQL 1109 +#define IDS_PURPOSE_NT5 1110 +#define IDS_PURPOSE_OEM_WHQL 1111 +#define IDS_PURPOSE_EMBEDDED_NT 1112 +#define IDS_PURPOSE_ROOT_LIST_SIGNER 1113 +#define IDS_PURPOSE_QUALIFIED_SUBORDINATION 1114 +#define IDS_PURPOSE_KEY_RECOVERY 1115 +#define IDS_PURPOSE_DOCUMENT_SIGNING 1116 +#define IDS_PURPOSE_LIFETIME_SIGNING 1117 +#define IDS_PURPOSE_DRM 1118 +#define IDS_PURPOSE_LICENSES 1119 +#define IDS_PURPOSE_LICENSE_SERVER 1120 +#define IDS_PURPOSE_ENROLLMENT_AGENT 1121 +#define IDS_PURPOSE_SMARTCARD_LOGON 1122 +#define IDS_PURPOSE_CA_EXCHANGE 1123 +#define IDS_PURPOSE_KEY_RECOVERY_AGENT 1124 +#define IDS_PURPOSE_DS_EMAIL_REPLICATION 1125 + +#define IDD_GENERAL 100 +#define IDD_DETAIL 101 +#define IDD_HIERARCHY 102 +#define IDD_USERNOTICE 103 +#define IDD_CERT_PROPERTIES_GENERAL 104 +#define IDD_ADD_CERT_PURPOSE 105 + +#define IDB_SMALL_ICONS 200 +#define IDB_CERT 201 +#define IDB_CERT_ERROR 202 +#define IDB_CERT_WARNING 203 +#define IDB_CHECKS 204 + +#define IDC_STATIC 2000 +#define IDC_CERTIFICATE_ICON 2001 +#define IDC_CERTIFICATE_INFO 2002 +#define IDC_CERTIFICATE_STATUS 2003 +#define IDC_CERTIFICATE_NAMES 2004 +#define IDC_ADDTOSTORE 2005 +#define IDC_ISSUERSTATEMENT 2006 + +#define IDC_DETAIL_SELECT 2100 +#define IDC_DETAIL_LIST 2101 +#define IDC_DETAIL_VALUE 2102 +#define IDC_EDITPROPERTIES 2103 +#define IDC_EXPORT 2104 + +#define IDC_VIEWCERTIFICATE 2200 +#define IDC_CERTPATH 2201 +#define IDC_CERTIFICATESTATUS 2202 +#define IDC_CERTIFICATESTATUSTEXT 2203 + +#define IDC_USERNOTICE 2300 +#define IDC_CPS 2301 + +#define IDC_FRIENDLY_NAME 2400 +#define IDC_DESCRIPTION 2401 +#define IDC_ENABLE_ALL_PURPOSES 2402 +#define IDC_DISABLE_ALL_PURPOSES 2403 +#define IDC_ENABLE_SELECTED_PURPOSES 2404 +#define IDC_CERTIFICATE_USAGES 2405 +#define IDC_ADD_PURPOSE 2406 + +#define IDC_NEW_PURPOSE 2500 + +#endif /* ndef __CRYPTUIRES_H_ */ diff --git a/dlls/cryptui/main.c b/dlls/cryptui/main.c index 692196c5650..169d0cd33dc 100644 --- a/dlls/cryptui/main.c +++ b/dlls/cryptui/main.c @@ -20,17 +20,30 @@ #include +#define COBJMACROS #define NONAMELESSUNION #include "windef.h" #include "winbase.h" #include "winnls.h" #include "winuser.h" +#include "softpub.h" +#include "wingdi.h" +#include "richedit.h" +#include "ole2.h" +#include "richole.h" +#include "commctrl.h" #include "cryptuiapi.h" +#include "cryptuires.h" +#include "urlmon.h" +#include "hlink.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(cryptui); +static HINSTANCE hInstance; + BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { TRACE("(0x%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); @@ -40,6 +53,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) case DLL_WINE_PREATTACH: return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: + hInstance = hinstDLL; DisableThreadLibraryCalls(hinstDLL); break; case DLL_PROCESS_DETACH: @@ -59,6 +73,9 @@ BOOL WINAPI CryptUIDlgCertMgr(PCCRYPTUI_CERT_MGR_STRUCT pCryptUICertMgr) return FALSE; } +/*********************************************************************** + * CryptUIDlgViewCertificateA (CRYPTUI.@) + */ BOOL WINAPI CryptUIDlgViewCertificateA( PCCRYPTUI_VIEWCERTIFICATE_STRUCTA pCertViewInfo, BOOL *pfPropertiesChanged) { @@ -87,18 +104,2880 @@ BOOL WINAPI CryptUIDlgViewCertificateA( goto error; } } + if (pCertViewInfo->cPropSheetPages) + { + FIXME("ignoring additional prop sheet pages\n"); + viewInfo.cPropSheetPages = 0; + } ret = CryptUIDlgViewCertificateW(&viewInfo, pfPropertiesChanged); HeapFree(GetProcessHeap(), 0, title); error: return ret; } -BOOL WINAPI CryptUIDlgViewCertificateW(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, - BOOL *pfPropertiesChanged) +struct ReadStringStruct { - FIXME("(%p, %p): stub\n", pCertViewInfo, pfPropertiesChanged); - if (pfPropertiesChanged) *pfPropertiesChanged = FALSE; - return TRUE; + LPCWSTR buf; + LONG pos; + LONG len; +}; + +static DWORD CALLBACK read_text_callback(DWORD_PTR dwCookie, LPBYTE buf, + LONG cb, LONG *pcb) +{ + struct ReadStringStruct *string = (struct ReadStringStruct *)dwCookie; + LONG cch = min(cb / sizeof(WCHAR), string->len - string->pos); + + TRACE("(%p, %p, %d, %p)\n", string, buf, cb, pcb); + + memmove(buf, string->buf + string->pos, cch * sizeof(WCHAR)); + string->pos += cch; + *pcb = cch * sizeof(WCHAR); + return 0; +} + +static void add_unformatted_text_to_control(HWND hwnd, LPCWSTR text, LONG len) +{ + struct ReadStringStruct string; + EDITSTREAM editstream; + + TRACE("(%p, %s)\n", hwnd, debugstr_wn(text, len)); + + string.buf = text; + string.pos = 0; + string.len = len; + editstream.dwCookie = (DWORD_PTR)&string; + editstream.dwError = 0; + editstream.pfnCallback = read_text_callback; + SendMessageW(hwnd, EM_STREAMIN, SF_TEXT | SFF_SELECTION | SF_UNICODE, + (LPARAM)&editstream); +} + +static void add_string_resource_to_control(HWND hwnd, int id) +{ + LPWSTR str; + LONG len; + + len = LoadStringW(hInstance, id, (LPWSTR)&str, 0); + add_unformatted_text_to_control(hwnd, str, len); +} + +static void add_text_with_paraformat_to_control(HWND hwnd, LPCWSTR text, + LONG len, const PARAFORMAT2 *fmt) +{ + add_unformatted_text_to_control(hwnd, text, len); + SendMessageW(hwnd, EM_SETPARAFORMAT, 0, (LPARAM)fmt); +} + +static void add_string_resource_with_paraformat_to_control(HWND hwnd, int id, + const PARAFORMAT2 *fmt) +{ + LPWSTR str; + LONG len; + + len = LoadStringW(hInstance, id, (LPWSTR)&str, 0); + add_text_with_paraformat_to_control(hwnd, str, len, fmt); +} + +static LPWSTR get_cert_name_string(PCCERT_CONTEXT pCertContext, DWORD dwType, + DWORD dwFlags) +{ + LPWSTR buf = NULL; + DWORD len; + + len = CertGetNameStringW(pCertContext, dwType, dwFlags, NULL, NULL, 0); + if (len) + { + buf = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (buf) + CertGetNameStringW(pCertContext, dwType, dwFlags, NULL, buf, len); + } + return buf; +} + +static void add_cert_string_to_control(HWND hwnd, PCCERT_CONTEXT pCertContext, + DWORD dwType, DWORD dwFlags) +{ + LPWSTR name = get_cert_name_string(pCertContext, dwType, dwFlags); + + if (name) + { + /* Don't include NULL-terminator in output */ + DWORD len = lstrlenW(name); + + add_unformatted_text_to_control(hwnd, name, len); + HeapFree(GetProcessHeap(), 0, name); + } +} + +static void add_icon_to_control(HWND hwnd, int id) +{ + HRESULT hr; + LPRICHEDITOLE richEditOle = NULL; + LPOLEOBJECT object = NULL; + CLSID clsid; + LPOLECACHE oleCache = NULL; + FORMATETC formatEtc; + DWORD conn; + LPDATAOBJECT dataObject = NULL; + HBITMAP bitmap = NULL; + RECT rect; + STGMEDIUM stgm; + REOBJECT reObject; + + TRACE("(%p, %d)\n", hwnd, id); + + SendMessageW(hwnd, EM_GETOLEINTERFACE, 0, (LPARAM)&richEditOle); + if (!richEditOle) + goto end; + hr = OleCreateDefaultHandler(&CLSID_NULL, NULL, &IID_IOleObject, + (void**)&object); + if (FAILED(hr)) + goto end; + hr = IOleObject_GetUserClassID(object, &clsid); + if (FAILED(hr)) + goto end; + hr = IOleObject_QueryInterface(object, &IID_IOleCache, (void**)&oleCache); + if (FAILED(hr)) + goto end; + formatEtc.cfFormat = CF_BITMAP; + formatEtc.ptd = NULL; + formatEtc.dwAspect = DVASPECT_CONTENT; + formatEtc.lindex = -1; + formatEtc.tymed = TYMED_GDI; + hr = IOleCache_Cache(oleCache, &formatEtc, 0, &conn); + if (FAILED(hr)) + goto end; + hr = IOleObject_QueryInterface(object, &IID_IDataObject, + (void**)&dataObject); + if (FAILED(hr)) + goto end; + bitmap = LoadImageW(hInstance, MAKEINTRESOURCEW(id), IMAGE_BITMAP, 0, 0, + LR_DEFAULTSIZE | LR_LOADTRANSPARENT); + if (!bitmap) + goto end; + rect.left = rect.top = 0; + rect.right = GetSystemMetrics(SM_CXICON); + rect.bottom = GetSystemMetrics(SM_CYICON); + stgm.tymed = TYMED_GDI; + stgm.u.hBitmap = bitmap; + stgm.pUnkForRelease = NULL; + hr = IDataObject_SetData(dataObject, &formatEtc, &stgm, TRUE); + if (FAILED(hr)) + goto end; + + reObject.cbStruct = sizeof(reObject); + reObject.cp = REO_CP_SELECTION; + reObject.clsid = clsid; + reObject.poleobj = object; + reObject.pstg = NULL; + reObject.polesite = NULL; + reObject.sizel.cx = reObject.sizel.cy = 0; + reObject.dvaspect = DVASPECT_CONTENT; + reObject.dwFlags = 0; + reObject.dwUser = 0; + + IRichEditOle_InsertObject(richEditOle, &reObject); + +end: + if (dataObject) + IDataObject_Release(dataObject); + if (oleCache) + IOleCache_Release(oleCache); + if (object) + IOleObject_Release(object); + if (richEditOle) + IRichEditOle_Release(richEditOle); +} + +#define MY_INDENT 200 + +static void add_oid_text_to_control(HWND hwnd, char *oid) +{ + WCHAR nl = '\n'; + PCCRYPT_OID_INFO oidInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, oid, 0); + PARAFORMAT2 parFmt; + + parFmt.cbSize = sizeof(parFmt); + parFmt.dwMask = PFM_STARTINDENT; + parFmt.dxStartIndent = MY_INDENT * 3; + if (oidInfo) + { + add_text_with_paraformat_to_control(hwnd, oidInfo->pwszName, + lstrlenW(oidInfo->pwszName), &parFmt); + add_unformatted_text_to_control(hwnd, &nl, 1); + } +} + +#define MAX_STRING_LEN 512 + +struct OIDToString +{ + LPCSTR oid; + int id; +}; + +/* The following list MUST be lexicographically sorted by OID */ +static struct OIDToString oidMap[] = { + /* 1.3.6.1.4.1.311.10.3.1 */ + { szOID_KP_CTL_USAGE_SIGNING, IDS_PURPOSE_CTL_USAGE_SIGNING }, + /* 1.3.6.1.4.1.311.10.3.4 */ + { szOID_KP_EFS, IDS_PURPOSE_EFS }, + /* 1.3.6.1.4.1.311.10.3.4.1 */ + { szOID_EFS_RECOVERY, IDS_PURPOSE_EFS_RECOVERY }, + /* 1.3.6.1.4.1.311.10.3.5 */ + { szOID_WHQL_CRYPTO, IDS_PURPOSE_WHQL }, + /* 1.3.6.1.4.1.311.10.3.6 */ + { szOID_NT5_CRYPTO, IDS_PURPOSE_NT5 }, + /* 1.3.6.1.4.1.311.10.3.7 */ + { szOID_OEM_WHQL_CRYPTO, IDS_PURPOSE_OEM_WHQL }, + /* 1.3.6.1.4.1.311.10.3.8 */ + { szOID_EMBEDDED_NT_CRYPTO, IDS_PURPOSE_EMBEDDED_NT }, + /* 1.3.6.1.4.1.311.10.3.9 */ + { szOID_ROOT_LIST_SIGNER, IDS_PURPOSE_ROOT_LIST_SIGNER }, + /* 1.3.6.1.4.1.311.10.3.10 */ + { szOID_KP_QUALIFIED_SUBORDINATION, IDS_PURPOSE_QUALIFIED_SUBORDINATION }, + /* 1.3.6.1.4.1.311.10.3.11 */ + { szOID_KP_KEY_RECOVERY, IDS_PURPOSE_KEY_RECOVERY }, + /* 1.3.6.1.4.1.311.10.3.12 */ + { szOID_KP_DOCUMENT_SIGNING, IDS_PURPOSE_DOCUMENT_SIGNING }, + /* 1.3.6.1.4.1.311.10.3.13 */ + { szOID_KP_LIFETIME_SIGNING, IDS_PURPOSE_LIFETIME_SIGNING }, + /* 1.3.6.1.4.1.311.10.5.1 */ + { szOID_DRM, IDS_PURPOSE_DRM }, + /* 1.3.6.1.4.1.311.10.6.1 */ + { szOID_LICENSES, IDS_PURPOSE_LICENSES }, + /* 1.3.6.1.4.1.311.10.6.2 */ + { szOID_LICENSE_SERVER, IDS_PURPOSE_LICENSE_SERVER }, + /* 1.3.6.1.4.1.311.20.2.1 */ + { szOID_ENROLLMENT_AGENT, IDS_PURPOSE_ENROLLMENT_AGENT }, + /* 1.3.6.1.4.1.311.20.2.2 */ + { szOID_KP_SMARTCARD_LOGON, IDS_PURPOSE_SMARTCARD_LOGON }, + /* 1.3.6.1.4.1.311.21.5 */ + { szOID_KP_CA_EXCHANGE, IDS_PURPOSE_CA_EXCHANGE }, + /* 1.3.6.1.4.1.311.21.6 */ + { szOID_KP_KEY_RECOVERY_AGENT, IDS_PURPOSE_KEY_RECOVERY_AGENT }, + /* 1.3.6.1.4.1.311.21.19 */ + { szOID_DS_EMAIL_REPLICATION, IDS_PURPOSE_DS_EMAIL_REPLICATION }, + /* 1.3.6.1.5.5.7.3.1 */ + { szOID_PKIX_KP_SERVER_AUTH, IDS_PURPOSE_SERVER_AUTH }, + /* 1.3.6.1.5.5.7.3.2 */ + { szOID_PKIX_KP_CLIENT_AUTH, IDS_PURPOSE_CLIENT_AUTH }, + /* 1.3.6.1.5.5.7.3.3 */ + { szOID_PKIX_KP_CODE_SIGNING, IDS_PURPOSE_CODE_SIGNING }, + /* 1.3.6.1.5.5.7.3.4 */ + { szOID_PKIX_KP_EMAIL_PROTECTION, IDS_PURPOSE_EMAIL_PROTECTION }, + /* 1.3.6.1.5.5.7.3.5 */ + { szOID_PKIX_KP_IPSEC_END_SYSTEM, IDS_PURPOSE_IPSEC }, + /* 1.3.6.1.5.5.7.3.6 */ + { szOID_PKIX_KP_IPSEC_TUNNEL, IDS_PURPOSE_IPSEC }, + /* 1.3.6.1.5.5.7.3.7 */ + { szOID_PKIX_KP_IPSEC_USER, IDS_PURPOSE_IPSEC }, + /* 1.3.6.1.5.5.7.3.8 */ + { szOID_PKIX_KP_TIMESTAMP_SIGNING, IDS_PURPOSE_TIMESTAMP_SIGNING }, +}; + +static struct OIDToString *findSupportedOID(LPCSTR oid) +{ + int indexHigh = sizeof(oidMap) / sizeof(oidMap[0]) - 1, indexLow = 0, i; + struct OIDToString *ret = NULL; + + for (i = (indexLow + indexHigh) / 2; !ret && indexLow <= indexHigh; + i = (indexLow + indexHigh) / 2) + { + int cmp; + + cmp = strcmp(oid, oidMap[i].oid); + if (!cmp) + ret = &oidMap[i]; + else if (cmp > 0) + indexLow = i + 1; + else + indexHigh = i - 1; + } + return ret; +} + +static void add_local_oid_text_to_control(HWND text, LPCSTR oid) +{ + struct OIDToString *entry; + WCHAR nl = '\n'; + PARAFORMAT2 parFmt; + + parFmt.cbSize = sizeof(parFmt); + parFmt.dwMask = PFM_STARTINDENT; + parFmt.dxStartIndent = MY_INDENT * 3; + if ((entry = findSupportedOID(oid))) + { + WCHAR *str, *linebreak, *ptr; + BOOL multiline = FALSE; + int len; + + len = LoadStringW(hInstance, entry->id, (LPWSTR)&str, 0); + ptr = str; + do { + if ((linebreak = memchrW(ptr, '\n', len))) + { + WCHAR copy[MAX_STRING_LEN]; + + multiline = TRUE; + /* The source string contains a newline, which the richedit + * control won't find since it's interpreted as a paragraph + * break. Therefore copy up to the newline. lstrcpynW always + * NULL-terminates, so pass one more than the length of the + * source line so the copy includes the entire line and the + * NULL-terminator. + */ + lstrcpynW(copy, ptr, linebreak - ptr + 1); + add_text_with_paraformat_to_control(text, copy, + linebreak - ptr, &parFmt); + ptr = linebreak + 1; + add_unformatted_text_to_control(text, &nl, 1); + } + else if (multiline && *ptr) + { + /* Add the last line */ + add_text_with_paraformat_to_control(text, ptr, + len - (ptr - str), &parFmt); + add_unformatted_text_to_control(text, &nl, 1); + } + } while (linebreak); + if (!multiline) + { + add_text_with_paraformat_to_control(text, str, len, &parFmt); + add_unformatted_text_to_control(text, &nl, 1); + } + } + else + { + WCHAR *oidW = HeapAlloc(GetProcessHeap(), 0, + (strlen(oid) + 1) * sizeof(WCHAR)); + + if (oidW) + { + LPCSTR src; + WCHAR *dst; + + for (src = oid, dst = oidW; *src; src++, dst++) + *dst = *src; + *dst = 0; + add_text_with_paraformat_to_control(text, oidW, lstrlenW(oidW), + &parFmt); + add_unformatted_text_to_control(text, &nl, 1); + HeapFree(GetProcessHeap(), 0, oidW); + } + } +} + +static void display_app_usages(HWND text, PCCERT_CONTEXT cert, + BOOL *anyUsageAdded) +{ + static char any_app_policy[] = szOID_ANY_APPLICATION_POLICY; + WCHAR nl = '\n'; + CHARFORMATW charFmt; + PCERT_EXTENSION policyExt; + if (!*anyUsageAdded) + { + PARAFORMAT2 parFmt; + + parFmt.cbSize = sizeof(parFmt); + parFmt.dwMask = PFM_STARTINDENT; + parFmt.dxStartIndent = MY_INDENT; + add_string_resource_with_paraformat_to_control(text, + IDS_CERT_INFO_PURPOSES, &parFmt); + add_unformatted_text_to_control(text, &nl, 1); + *anyUsageAdded = TRUE; + } + memset(&charFmt, 0, sizeof(charFmt)); + charFmt.cbSize = sizeof(charFmt); + charFmt.dwMask = CFM_BOLD; + charFmt.dwEffects = 0; + SendMessageW(text, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&charFmt); + if ((policyExt = CertFindExtension(szOID_APPLICATION_CERT_POLICIES, + cert->pCertInfo->cExtension, cert->pCertInfo->rgExtension))) + { + CERT_POLICIES_INFO *policies; + DWORD size; + + if (CryptDecodeObjectEx(X509_ASN_ENCODING, X509_CERT_POLICIES, + policyExt->Value.pbData, policyExt->Value.cbData, + CRYPT_DECODE_ALLOC_FLAG, NULL, &policies, &size)) + { + DWORD i; + + for (i = 0; i < policies->cPolicyInfo; i++) + { + DWORD j; + + for (j = 0; j < policies->rgPolicyInfo[i].cPolicyQualifier; j++) + add_local_oid_text_to_control(text, + policies->rgPolicyInfo[i].rgPolicyQualifier[j]. + pszPolicyQualifierId); + } + LocalFree(policies); + } + } + else + add_oid_text_to_control(text, any_app_policy); +} + +static BOOL display_cert_usages(HWND text, PCCERT_CONTEXT cert, + BOOL *anyUsageAdded) +{ + WCHAR nl = '\n'; + DWORD size; + BOOL badUsages = FALSE; + + if (CertGetEnhancedKeyUsage(cert, 0, NULL, &size)) + { + CHARFORMATW charFmt; + static char any_cert_policy[] = szOID_ANY_CERT_POLICY; + PCERT_ENHKEY_USAGE usage = HeapAlloc(GetProcessHeap(), 0, size); + + if (usage) + { + if (CertGetEnhancedKeyUsage(cert, 0, usage, &size)) + { + DWORD i; + + if (!*anyUsageAdded) + { + PARAFORMAT2 parFmt; + + parFmt.cbSize = sizeof(parFmt); + parFmt.dwMask = PFM_STARTINDENT; + parFmt.dxStartIndent = MY_INDENT; + add_string_resource_with_paraformat_to_control(text, + IDS_CERT_INFO_PURPOSES, &parFmt); + add_unformatted_text_to_control(text, &nl, 1); + *anyUsageAdded = TRUE; + } + memset(&charFmt, 0, sizeof(charFmt)); + charFmt.cbSize = sizeof(charFmt); + charFmt.dwMask = CFM_BOLD; + charFmt.dwEffects = 0; + SendMessageW(text, EM_SETCHARFORMAT, SCF_SELECTION, + (LPARAM)&charFmt); + if (!usage->cUsageIdentifier) + add_oid_text_to_control(text, any_cert_policy); + else + for (i = 0; i < usage->cUsageIdentifier; i++) + add_local_oid_text_to_control(text, + usage->rgpszUsageIdentifier[i]); + } + else + badUsages = TRUE; + HeapFree(GetProcessHeap(), 0, usage); + } + else + badUsages = TRUE; + } + else + badUsages = TRUE; + return badUsages; +} + +static void set_policy_text(HWND text, + PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo) +{ + BOOL includeCertUsages = FALSE, includeAppUsages = FALSE; + BOOL badUsages = FALSE, anyUsageAdded = FALSE; + + if (pCertViewInfo->cPurposes) + { + DWORD i; + + for (i = 0; i < pCertViewInfo->cPurposes; i++) + { + if (!strcmp(pCertViewInfo->rgszPurposes[i], szOID_ANY_CERT_POLICY)) + includeCertUsages = TRUE; + else if (!strcmp(pCertViewInfo->rgszPurposes[i], + szOID_ANY_APPLICATION_POLICY)) + includeAppUsages = TRUE; + else + badUsages = TRUE; + } + } + else + includeAppUsages = includeCertUsages = TRUE; + if (includeAppUsages) + display_app_usages(text, pCertViewInfo->pCertContext, &anyUsageAdded); + if (includeCertUsages) + badUsages = display_cert_usages(text, pCertViewInfo->pCertContext, + &anyUsageAdded); + if (badUsages) + { + PARAFORMAT2 parFmt; + + parFmt.cbSize = sizeof(parFmt); + parFmt.dwMask = PFM_STARTINDENT; + parFmt.dxStartIndent = MY_INDENT; + add_string_resource_with_paraformat_to_control(text, + IDS_CERT_INFO_BAD_PURPOSES, &parFmt); + } +} + +static CRYPT_OBJID_BLOB *find_policy_qualifier(CERT_POLICIES_INFO *policies, + LPCSTR policyOid) +{ + CRYPT_OBJID_BLOB *ret = NULL; + DWORD i; + + for (i = 0; !ret && i < policies->cPolicyInfo; i++) + { + DWORD j; + + for (j = 0; !ret && j < policies->rgPolicyInfo[i].cPolicyQualifier; j++) + if (!strcmp(policies->rgPolicyInfo[i].rgPolicyQualifier[j]. + pszPolicyQualifierId, policyOid)) + ret = &policies->rgPolicyInfo[i].rgPolicyQualifier[j]. + Qualifier; + } + return ret; +} + +static WCHAR *get_cps_str_from_qualifier(CRYPT_OBJID_BLOB *qualifier) +{ + LPWSTR qualifierStr = NULL; + CERT_NAME_VALUE *qualifierValue; + DWORD size; + + if (CryptDecodeObjectEx(X509_ASN_ENCODING, X509_NAME_VALUE, + qualifier->pbData, qualifier->cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, + &qualifierValue, &size)) + { + size = CertRDNValueToStrW(qualifierValue->dwValueType, + &qualifierValue->Value, NULL, 0); + qualifierStr = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)); + if (qualifierStr) + CertRDNValueToStrW(qualifierValue->dwValueType, + &qualifierValue->Value, qualifierStr, size); + LocalFree(qualifierValue); + } + return qualifierStr; +} + +static WCHAR *get_user_notice_from_qualifier(CRYPT_OBJID_BLOB *qualifier) +{ + LPWSTR str = NULL; + CERT_POLICY_QUALIFIER_USER_NOTICE *qualifierValue; + DWORD size; + + if (CryptDecodeObjectEx(X509_ASN_ENCODING, + X509_PKIX_POLICY_QUALIFIER_USERNOTICE, + qualifier->pbData, qualifier->cbData, CRYPT_DECODE_ALLOC_FLAG, NULL, + &qualifierValue, &size)) + { + str = HeapAlloc(GetProcessHeap(), 0, + (strlenW(qualifierValue->pszDisplayText) + 1) * sizeof(WCHAR)); + if (str) + strcpyW(str, qualifierValue->pszDisplayText); + LocalFree(qualifierValue); + } + return str; +} + +struct IssuerStatement +{ + LPWSTR cps; + LPWSTR userNotice; +}; + +static void set_issuer_statement(HWND hwnd, + PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo) +{ + PCERT_EXTENSION policyExt; + + if (!(pCertViewInfo->dwFlags & CRYPTUI_DISABLE_ISSUERSTATEMENT) && + (policyExt = CertFindExtension(szOID_CERT_POLICIES, + pCertViewInfo->pCertContext->pCertInfo->cExtension, + pCertViewInfo->pCertContext->pCertInfo->rgExtension))) + { + CERT_POLICIES_INFO *policies; + DWORD size; + + if (CryptDecodeObjectEx(X509_ASN_ENCODING, policyExt->pszObjId, + policyExt->Value.pbData, policyExt->Value.cbData, + CRYPT_DECODE_ALLOC_FLAG, NULL, &policies, &size)) + { + CRYPT_OBJID_BLOB *qualifier; + LPWSTR cps = NULL, userNotice = NULL; + + if ((qualifier = find_policy_qualifier(policies, + szOID_PKIX_POLICY_QUALIFIER_CPS))) + cps = get_cps_str_from_qualifier(qualifier); + if ((qualifier = find_policy_qualifier(policies, + szOID_PKIX_POLICY_QUALIFIER_USERNOTICE))) + userNotice = get_user_notice_from_qualifier(qualifier); + if (cps || userNotice) + { + struct IssuerStatement *issuerStatement = + HeapAlloc(GetProcessHeap(), 0, sizeof(struct IssuerStatement)); + + if (issuerStatement) + { + issuerStatement->cps = cps; + issuerStatement->userNotice = userNotice; + EnableWindow(GetDlgItem(hwnd, IDC_ISSUERSTATEMENT), TRUE); + SetWindowLongPtrW(hwnd, DWLP_USER, + (ULONG_PTR)issuerStatement); + } + } + LocalFree(policies); + } + } +} + +static void set_cert_info(HWND hwnd, + PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo) +{ + CHARFORMATW charFmt; + PARAFORMAT2 parFmt; + HWND icon = GetDlgItem(hwnd, IDC_CERTIFICATE_ICON); + HWND text = GetDlgItem(hwnd, IDC_CERTIFICATE_INFO); + CRYPT_PROVIDER_SGNR *provSigner = WTHelperGetProvSignerFromChain( + (CRYPT_PROVIDER_DATA *)pCertViewInfo->u.pCryptProviderData, + pCertViewInfo->idxSigner, pCertViewInfo->fCounterSigner, + pCertViewInfo->idxCounterSigner); + CRYPT_PROVIDER_CERT *root = + &provSigner->pasCertChain[provSigner->csCertChain - 1]; + + if (!provSigner->pChainContext || + (provSigner->pChainContext->TrustStatus.dwErrorStatus & + CERT_TRUST_IS_PARTIAL_CHAIN)) + add_icon_to_control(icon, IDB_CERT_WARNING); + else if (!root->fTrustedRoot) + add_icon_to_control(icon, IDB_CERT_ERROR); + else + add_icon_to_control(icon, IDB_CERT); + + memset(&charFmt, 0, sizeof(charFmt)); + charFmt.cbSize = sizeof(charFmt); + charFmt.dwMask = CFM_BOLD; + charFmt.dwEffects = CFE_BOLD; + SendMessageW(text, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&charFmt); + /* FIXME: vertically center text */ + parFmt.cbSize = sizeof(parFmt); + parFmt.dwMask = PFM_STARTINDENT; + parFmt.dxStartIndent = MY_INDENT; + add_string_resource_with_paraformat_to_control(text, + IDS_CERTIFICATEINFORMATION, &parFmt); + + text = GetDlgItem(hwnd, IDC_CERTIFICATE_STATUS); + SendMessageW(text, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&charFmt); + if (provSigner->dwError == TRUST_E_CERT_SIGNATURE) + add_string_resource_with_paraformat_to_control(text, + IDS_CERT_INFO_BAD_SIG, &parFmt); + else if (!provSigner->pChainContext || + (provSigner->pChainContext->TrustStatus.dwErrorStatus & + CERT_TRUST_IS_PARTIAL_CHAIN)) + add_string_resource_with_paraformat_to_control(text, + IDS_CERT_INFO_PARTIAL_CHAIN, &parFmt); + else if (!root->fTrustedRoot) + { + if (provSigner->csCertChain == 1 && root->fSelfSigned) + add_string_resource_with_paraformat_to_control(text, + IDS_CERT_INFO_UNTRUSTED_CA, &parFmt); + else + add_string_resource_with_paraformat_to_control(text, + IDS_CERT_INFO_UNTRUSTED_ROOT, &parFmt); + } + else + { + set_policy_text(text, pCertViewInfo); + set_issuer_statement(hwnd, pCertViewInfo); + } +} + +static void set_cert_name_string(HWND hwnd, PCCERT_CONTEXT cert, + DWORD nameFlags, int heading) +{ + WCHAR nl = '\n'; + HWND text = GetDlgItem(hwnd, IDC_CERTIFICATE_NAMES); + CHARFORMATW charFmt; + PARAFORMAT2 parFmt; + + memset(&charFmt, 0, sizeof(charFmt)); + charFmt.cbSize = sizeof(charFmt); + charFmt.dwMask = CFM_BOLD; + charFmt.dwEffects = CFE_BOLD; + SendMessageW(text, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&charFmt); + parFmt.cbSize = sizeof(parFmt); + parFmt.dwMask = PFM_STARTINDENT; + parFmt.dxStartIndent = MY_INDENT * 3; + add_string_resource_with_paraformat_to_control(text, heading, &parFmt); + charFmt.dwEffects = 0; + SendMessageW(text, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&charFmt); + add_cert_string_to_control(text, cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, + nameFlags); + add_unformatted_text_to_control(text, &nl, 1); + add_unformatted_text_to_control(text, &nl, 1); + add_unformatted_text_to_control(text, &nl, 1); + +} + +static void add_date_string_to_control(HWND hwnd, const FILETIME *fileTime) +{ + WCHAR dateFmt[80]; /* sufficient for all versions of LOCALE_SSHORTDATE */ + WCHAR date[80]; + SYSTEMTIME sysTime; + + GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SSHORTDATE, dateFmt, + sizeof(dateFmt) / sizeof(dateFmt[0])); + FileTimeToSystemTime(fileTime, &sysTime); + GetDateFormatW(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, date, + sizeof(date) / sizeof(date[0])); + add_unformatted_text_to_control(hwnd, date, lstrlenW(date)); +} + +static void set_cert_validity_period(HWND hwnd, PCCERT_CONTEXT cert) +{ + WCHAR nl = '\n'; + HWND text = GetDlgItem(hwnd, IDC_CERTIFICATE_NAMES); + CHARFORMATW charFmt; + PARAFORMAT2 parFmt; + + memset(&charFmt, 0, sizeof(charFmt)); + charFmt.cbSize = sizeof(charFmt); + charFmt.dwMask = CFM_BOLD; + charFmt.dwEffects = CFE_BOLD; + SendMessageW(text, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&charFmt); + parFmt.cbSize = sizeof(parFmt); + parFmt.dwMask = PFM_STARTINDENT; + parFmt.dxStartIndent = MY_INDENT * 3; + add_string_resource_with_paraformat_to_control(text, IDS_VALID_FROM, + &parFmt); + charFmt.dwEffects = 0; + SendMessageW(text, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&charFmt); + add_date_string_to_control(text, &cert->pCertInfo->NotBefore); + charFmt.dwEffects = CFE_BOLD; + SendMessageW(text, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&charFmt); + add_string_resource_to_control(text, IDS_VALID_TO); + charFmt.dwEffects = 0; + SendMessageW(text, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&charFmt); + add_date_string_to_control(text, &cert->pCertInfo->NotAfter); + add_unformatted_text_to_control(text, &nl, 1); +} + +static void set_general_info(HWND hwnd, + PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo) +{ + set_cert_info(hwnd, pCertViewInfo); + set_cert_name_string(hwnd, pCertViewInfo->pCertContext, 0, + IDS_SUBJECT_HEADING); + set_cert_name_string(hwnd, pCertViewInfo->pCertContext, + CERT_NAME_ISSUER_FLAG, IDS_ISSUER_HEADING); + set_cert_validity_period(hwnd, pCertViewInfo->pCertContext); +} + +static LRESULT CALLBACK user_notice_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, + LPARAM lp) +{ + LRESULT ret = 0; + HWND text; + struct IssuerStatement *issuerStatement; + + switch (msg) + { + case WM_INITDIALOG: + text = GetDlgItem(hwnd, IDC_USERNOTICE); + issuerStatement = (struct IssuerStatement *)lp; + add_unformatted_text_to_control(text, issuerStatement->userNotice, + strlenW(issuerStatement->userNotice)); + if (issuerStatement->cps) + SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)issuerStatement->cps); + else + EnableWindow(GetDlgItem(hwnd, IDC_CPS), FALSE); + break; + case WM_COMMAND: + switch (wp) + { + case IDOK: + EndDialog(hwnd, IDOK); + ret = TRUE; + break; + case IDC_CPS: + { + IBindCtx *bctx = NULL; + LPWSTR cps; + + CreateBindCtx(0, &bctx); + cps = (LPWSTR)GetWindowLongPtrW(hwnd, DWLP_USER); + HlinkSimpleNavigateToString(cps, NULL, NULL, NULL, bctx, NULL, + HLNF_OPENINNEWWINDOW, 0); + IBindCtx_Release(bctx); + break; + } + } + } + return ret; +} + +static void show_user_notice(HWND hwnd, struct IssuerStatement *issuerStatement) +{ + DialogBoxParamW(hInstance, MAKEINTRESOURCEW(IDD_USERNOTICE), hwnd, + user_notice_dlg_proc, (LPARAM)issuerStatement); +} + +static LRESULT CALLBACK general_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, + LPARAM lp) +{ + PROPSHEETPAGEW *page; + PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo; + + TRACE("(%p, %08x, %08lx, %08lx)\n", hwnd, msg, wp, lp); + + switch (msg) + { + case WM_INITDIALOG: + page = (PROPSHEETPAGEW *)lp; + pCertViewInfo = (PCCRYPTUI_VIEWCERTIFICATE_STRUCTW)page->lParam; + if (pCertViewInfo->dwFlags & CRYPTUI_DISABLE_ADDTOSTORE) + ShowWindow(GetDlgItem(hwnd, IDC_ADDTOSTORE), FALSE); + EnableWindow(GetDlgItem(hwnd, IDC_ISSUERSTATEMENT), FALSE); + set_general_info(hwnd, pCertViewInfo); + break; + case WM_COMMAND: + switch (wp) + { + case IDC_ADDTOSTORE: + FIXME("call CryptUIWizImport\n"); + break; + case IDC_ISSUERSTATEMENT: + { + struct IssuerStatement *issuerStatement = + (struct IssuerStatement *)GetWindowLongPtrW(hwnd, DWLP_USER); + + if (issuerStatement) + { + if (issuerStatement->userNotice) + show_user_notice(hwnd, issuerStatement); + else if (issuerStatement->cps) + { + IBindCtx *bctx = NULL; + + CreateBindCtx(0, &bctx); + HlinkSimpleNavigateToString(issuerStatement->cps, NULL, + NULL, NULL, bctx, NULL, HLNF_OPENINNEWWINDOW, 0); + IBindCtx_Release(bctx); + } + } + break; + } + } + break; + } + return 0; +} + +static UINT CALLBACK general_callback_proc(HWND hwnd, UINT msg, + PROPSHEETPAGEW *page) +{ + struct IssuerStatement *issuerStatement; + + switch (msg) + { + case PSPCB_RELEASE: + issuerStatement = + (struct IssuerStatement *)GetWindowLongPtrW(hwnd, DWLP_USER); + if (issuerStatement) + { + HeapFree(GetProcessHeap(), 0, issuerStatement->cps); + HeapFree(GetProcessHeap(), 0, issuerStatement->userNotice); + HeapFree(GetProcessHeap(), 0, issuerStatement); + } + break; + } + return 1; +} + +static void init_general_page(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, + PROPSHEETPAGEW *page) +{ + memset(page, 0, sizeof(PROPSHEETPAGEW)); + page->dwSize = sizeof(PROPSHEETPAGEW); + page->dwFlags = PSP_USECALLBACK; + page->pfnCallback = general_callback_proc; + page->hInstance = hInstance; + page->u.pszTemplate = MAKEINTRESOURCEW(IDD_GENERAL); + page->pfnDlgProc = general_dlg_proc; + page->lParam = (LPARAM)pCertViewInfo; +} + +typedef WCHAR * (*field_format_func)(PCCERT_CONTEXT cert); + +static WCHAR *field_format_version(PCCERT_CONTEXT cert) +{ + static const WCHAR fmt[] = { 'V','%','d',0 }; + WCHAR *buf = HeapAlloc(GetProcessHeap(), 0, 12 * sizeof(WCHAR)); + + if (buf) + sprintfW(buf, fmt, cert->pCertInfo->dwVersion); + return buf; +} + +static WCHAR *format_hex_string(void *pb, DWORD cb) +{ + WCHAR *buf = HeapAlloc(GetProcessHeap(), 0, (cb * 3 + 1) * sizeof(WCHAR)); + + if (buf) + { + static const WCHAR fmt[] = { '%','0','2','x',' ',0 }; + DWORD i; + WCHAR *ptr; + + for (i = 0, ptr = buf; i < cb; i++, ptr += 3) + sprintfW(ptr, fmt, ((BYTE *)pb)[i]); + } + return buf; +} + +static WCHAR *field_format_serial_number(PCCERT_CONTEXT cert) +{ + return format_hex_string(cert->pCertInfo->SerialNumber.pbData, + cert->pCertInfo->SerialNumber.cbData); +} + +static WCHAR *field_format_issuer(PCCERT_CONTEXT cert) +{ + return get_cert_name_string(cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, + CERT_NAME_ISSUER_FLAG); +} + +static WCHAR *field_format_detailed_cert_name(PCERT_NAME_BLOB name) +{ + WCHAR *str = NULL; + DWORD len = CertNameToStrW(X509_ASN_ENCODING, name, + CERT_X500_NAME_STR | CERT_NAME_STR_CRLF_FLAG, NULL, 0); + + if (len) + { + str = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (str) + CertNameToStrW(X509_ASN_ENCODING, name, + CERT_X500_NAME_STR | CERT_NAME_STR_CRLF_FLAG, str, len); + } + return str; +} + +static WCHAR *field_format_detailed_issuer(PCCERT_CONTEXT cert, void *param) +{ + return field_format_detailed_cert_name(&cert->pCertInfo->Issuer); +} + +static WCHAR *field_format_subject(PCCERT_CONTEXT cert) +{ + return get_cert_name_string(cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0); +} + +static WCHAR *field_format_detailed_subject(PCCERT_CONTEXT cert, void *param) +{ + return field_format_detailed_cert_name(&cert->pCertInfo->Subject); +} + +static WCHAR *format_long_date(const FILETIME *fileTime) +{ + WCHAR dateFmt[80]; /* long enough for LOCALE_SLONGDATE */ + DWORD len; + WCHAR *buf = NULL; + SYSTEMTIME sysTime; + + /* FIXME: format isn't quite right, want time too */ + GetLocaleInfoW(LOCALE_SYSTEM_DEFAULT, LOCALE_SLONGDATE, dateFmt, + sizeof(dateFmt) / sizeof(dateFmt[0])); + FileTimeToSystemTime(fileTime, &sysTime); + len = GetDateFormatW(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, NULL, 0); + if (len) + { + buf = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + if (buf) + GetDateFormatW(LOCALE_SYSTEM_DEFAULT, 0, &sysTime, dateFmt, buf, + len); + } + return buf; +} + +static WCHAR *field_format_from_date(PCCERT_CONTEXT cert) +{ + return format_long_date(&cert->pCertInfo->NotBefore); +} + +static WCHAR *field_format_to_date(PCCERT_CONTEXT cert) +{ + return format_long_date(&cert->pCertInfo->NotAfter); +} + +static WCHAR *field_format_public_key(PCCERT_CONTEXT cert) +{ + PCCRYPT_OID_INFO oidInfo; + WCHAR *buf = NULL; + + oidInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, + cert->pCertInfo->SubjectPublicKeyInfo.Algorithm.pszObjId, 0); + if (oidInfo) + { + WCHAR fmt[MAX_STRING_LEN]; + + if (LoadStringW(hInstance, IDS_FIELD_PUBLIC_KEY_FORMAT, fmt, + sizeof(fmt) / sizeof(fmt[0]))) + { + /* Allocate the output buffer. Use the number of bytes in the + * public key as a conservative (high) estimate for the number of + * digits in its output. + * The output is of the form (in English) + * " ( bits)". + * Ordinarily having two positional parameters in a string is not a + * good idea, but as this isn't a sentence fragment, it shouldn't + * be word-order dependent. + */ + buf = HeapAlloc(GetProcessHeap(), 0, + (strlenW(fmt) + strlenW(oidInfo->pwszName) + + cert->pCertInfo->SubjectPublicKeyInfo.PublicKey.cbData * 8) + * sizeof(WCHAR)); + if (buf) + sprintfW(buf, fmt, oidInfo->pwszName, + CertGetPublicKeyLength(X509_ASN_ENCODING, + &cert->pCertInfo->SubjectPublicKeyInfo)); + } + } + return buf; +} + +static WCHAR *field_format_detailed_public_key(PCCERT_CONTEXT cert, void *param) +{ + return format_hex_string( + cert->pCertInfo->SubjectPublicKeyInfo.PublicKey.pbData, + cert->pCertInfo->SubjectPublicKeyInfo.PublicKey.cbData); +} + +struct field_value_data; +struct detail_data +{ + PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo; + BOOL *pfPropertiesChanged; + int cFields; + struct field_value_data *fields; + HIMAGELIST imageList; +}; + +typedef void (*add_fields_func)(HWND hwnd, struct detail_data *data); + +typedef WCHAR *(*create_detailed_value_func)(PCCERT_CONTEXT cert, void *param); + +struct field_value_data +{ + create_detailed_value_func create; + LPWSTR detailed_value; + void *param; +}; + +static void add_field_value_data(struct detail_data *data, + create_detailed_value_func create, void *param) +{ + if (data->cFields) + data->fields = HeapReAlloc(GetProcessHeap(), 0, data->fields, + (data->cFields + 1) * sizeof(struct field_value_data)); + else + data->fields = HeapAlloc(GetProcessHeap(), 0, + sizeof(struct field_value_data)); + if (data->fields) + { + data->fields[data->cFields].create = create; + data->fields[data->cFields].detailed_value = NULL; + data->fields[data->cFields].param = param; + data->cFields++; + } +} + +static void add_field_and_value_to_list(HWND hwnd, struct detail_data *data, + LPWSTR field, LPWSTR value, create_detailed_value_func create, void *param) +{ + LVITEMW item; + int iItem = SendMessageW(hwnd, LVM_GETITEMCOUNT, 0, 0); + + item.mask = LVIF_TEXT | LVIF_PARAM; + item.iItem = iItem; + item.iSubItem = 0; + item.pszText = field; + item.lParam = (LPARAM)data; + SendMessageW(hwnd, LVM_INSERTITEMW, 0, (LPARAM)&item); + if (value) + { + item.pszText = value; + item.iSubItem = 1; + SendMessageW(hwnd, LVM_SETITEMTEXTW, iItem, (LPARAM)&item); + } + add_field_value_data(data, create, param); +} + +static void add_string_id_and_value_to_list(HWND hwnd, struct detail_data *data, + int id, LPWSTR value, create_detailed_value_func create, void *param) +{ + WCHAR buf[MAX_STRING_LEN]; + + LoadStringW(hInstance, id, buf, sizeof(buf) / sizeof(buf[0])); + add_field_and_value_to_list(hwnd, data, buf, value, create, param); +} + +struct v1_field +{ + int id; + field_format_func format; + create_detailed_value_func create_detailed_value; +}; + +static void add_v1_field(HWND hwnd, struct detail_data *data, + const struct v1_field *field) +{ + WCHAR *val = field->format(data->pCertViewInfo->pCertContext); + + if (val) + { + add_string_id_and_value_to_list(hwnd, data, field->id, val, + field->create_detailed_value, NULL); + HeapFree(GetProcessHeap(), 0, val); + } +} + +static const struct v1_field v1_fields[] = { + { IDS_FIELD_VERSION, field_format_version, NULL }, + { IDS_FIELD_SERIAL_NUMBER, field_format_serial_number, NULL }, + { IDS_FIELD_ISSUER, field_format_issuer, field_format_detailed_issuer }, + { IDS_FIELD_VALID_FROM, field_format_from_date, NULL }, + { IDS_FIELD_VALID_TO, field_format_to_date, NULL }, + { IDS_FIELD_SUBJECT, field_format_subject, field_format_detailed_subject }, + { IDS_FIELD_PUBLIC_KEY, field_format_public_key, + field_format_detailed_public_key } +}; + +static void add_v1_fields(HWND hwnd, struct detail_data *data) +{ + int i; + PCCERT_CONTEXT cert = data->pCertViewInfo->pCertContext; + + /* The last item in v1_fields is the public key, which is not in the loop + * because it's a special case. + */ + for (i = 0; i < sizeof(v1_fields) / sizeof(v1_fields[0]) - 1; i++) + add_v1_field(hwnd, data, &v1_fields[i]); + if (cert->pCertInfo->SubjectPublicKeyInfo.PublicKey.cbData) + add_v1_field(hwnd, data, &v1_fields[i]); +} + +static WCHAR *crypt_format_extension(PCERT_EXTENSION ext, DWORD formatStrType) +{ + WCHAR *str = NULL; + DWORD size; + + if (CryptFormatObject(X509_ASN_ENCODING, 0, formatStrType, NULL, + ext->pszObjId, ext->Value.pbData, ext->Value.cbData, NULL, &size)) + { + str = HeapAlloc(GetProcessHeap(), 0, size); + CryptFormatObject(X509_ASN_ENCODING, 0, formatStrType, NULL, + ext->pszObjId, ext->Value.pbData, ext->Value.cbData, str, &size); + } + return str; +} + +static WCHAR *field_format_extension_hex_with_ascii(PCERT_EXTENSION ext) +{ + WCHAR *str = NULL; + + if (ext->Value.cbData) + { + /* The output is formatted as: + * \n + * where is a string of up to 8 bytes, output as %02x, + * and is the ASCII equivalent of each byte, or '.' if + * the byte is not printable. + * So, for example, the extension value consisting of the following + * bytes: + * 0x30,0x14,0x31,0x12,0x30,0x10,0x06,0x03,0x55,0x04,0x03, + * 0x13,0x09,0x4a,0x75,0x61,0x6e,0x20,0x4c,0x61,0x6e,0x67 + * is output as: + * 30 14 31 12 30 10 06 03 0.1.0... + * 55 04 03 13 09 4a 75 61 U....Jua + * 6e 20 4c 61 6e 67 n Lang + * The allocation size therefore requires: + * - 4 characters per character in an 8-byte line + * (2 for the hex format, one for the space, one for the ASCII value) + * - 3 more characters per 8-byte line (two spaces and a newline) + * - 1 character for the terminating nul + * FIXME: should use a fixed-width font for this + */ + DWORD lines = (ext->Value.cbData + 7) / 8; + + str = HeapAlloc(GetProcessHeap(), 0, + (lines * 8 * 4 + lines * 3 + 1) * sizeof(WCHAR)); + if (str) + { + static const WCHAR fmt[] = { '%','0','2','x',' ',0 }; + DWORD i, j; + WCHAR *ptr; + + for (i = 0, ptr = str; i < ext->Value.cbData; i += 8) + { + /* Output as hex bytes first */ + for (j = i; j < min(i + 8, ext->Value.cbData); j++, ptr += 3) + sprintfW(ptr, fmt, ext->Value.pbData[j]); + /* Pad the hex output with spaces for alignment */ + if (j == ext->Value.cbData && j % 8) + { + static const WCHAR pad[] = { ' ',' ',' ' }; + + for (; j % 8; j++, ptr += sizeof(pad) / sizeof(pad[0])) + memcpy(ptr, pad, sizeof(pad)); + } + /* The last sprintfW included a space, so just insert one + * more space between the hex bytes and the ASCII output + */ + *ptr++ = ' '; + /* Output as ASCII bytes */ + for (j = i; j < min(i + 8, ext->Value.cbData); j++, ptr++) + { + if (isprintW(ext->Value.pbData[j]) && + !isspaceW(ext->Value.pbData[j])) + *ptr = ext->Value.pbData[j]; + else + *ptr = '.'; + } + *ptr++ = '\n'; + } + *ptr++ = '\0'; + } + } + return str; +} + +static WCHAR *field_format_detailed_extension(PCCERT_CONTEXT cert, void *param) +{ + PCERT_EXTENSION ext = param; + LPWSTR str = crypt_format_extension(ext, + CRYPT_FORMAT_STR_MULTI_LINE | CRYPT_FORMAT_STR_NO_HEX); + + if (!str) + str = field_format_extension_hex_with_ascii(ext); + return str; +} + +static void add_cert_extension_detail(HWND hwnd, struct detail_data *data, + PCERT_EXTENSION ext) +{ + PCCRYPT_OID_INFO oidInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, + ext->pszObjId, 0); + LPWSTR val = crypt_format_extension(ext, 0); + + if (oidInfo) + add_field_and_value_to_list(hwnd, data, (LPWSTR)oidInfo->pwszName, + val, field_format_detailed_extension, ext); + else + { + DWORD len = strlen(ext->pszObjId); + LPWSTR oidW = HeapAlloc(GetProcessHeap(), 0, (len + 1) * sizeof(WCHAR)); + + if (oidW) + { + DWORD i; + + for (i = 0; i <= len; i++) + oidW[i] = ext->pszObjId[i]; + add_field_and_value_to_list(hwnd, data, oidW, val, + field_format_detailed_extension, ext); + HeapFree(GetProcessHeap(), 0, oidW); + } + } + HeapFree(GetProcessHeap(), 0, val); +} + +static void add_all_extensions(HWND hwnd, struct detail_data *data) +{ + DWORD i; + PCCERT_CONTEXT cert = data->pCertViewInfo->pCertContext; + + for (i = 0; i < cert->pCertInfo->cExtension; i++) + add_cert_extension_detail(hwnd, data, &cert->pCertInfo->rgExtension[i]); +} + +static void add_critical_extensions(HWND hwnd, struct detail_data *data) +{ + DWORD i; + PCCERT_CONTEXT cert = data->pCertViewInfo->pCertContext; + + for (i = 0; i < cert->pCertInfo->cExtension; i++) + if (cert->pCertInfo->rgExtension[i].fCritical) + add_cert_extension_detail(hwnd, data, + &cert->pCertInfo->rgExtension[i]); +} + +typedef WCHAR * (*prop_to_value_func)(void *pb, DWORD cb); + +struct prop_id_to_string_id +{ + DWORD prop; + int id; + BOOL prop_is_string; + prop_to_value_func prop_to_value; +}; + +static WCHAR *format_enhanced_key_usage_value(void *pb, DWORD cb) +{ + CERT_EXTENSION ext; + + ext.pszObjId = (LPSTR)X509_ENHANCED_KEY_USAGE; + ext.fCritical = FALSE; + ext.Value.pbData = pb; + ext.Value.cbData = cb; + return crypt_format_extension(&ext, 0); +} + +/* Logically the access state should also be checked, and IDC_EDITPROPERTIES + * disabled for read-only certificates, but native doesn't appear to do that. + */ +static const struct prop_id_to_string_id prop_id_map[] = { + { CERT_HASH_PROP_ID, IDS_PROP_HASH, FALSE, format_hex_string }, + { CERT_FRIENDLY_NAME_PROP_ID, IDS_PROP_FRIENDLY_NAME, TRUE, NULL }, + { CERT_DESCRIPTION_PROP_ID, IDS_PROP_DESCRIPTION, TRUE, NULL }, + { CERT_ENHKEY_USAGE_PROP_ID, IDS_PROP_ENHKEY_USAGE, FALSE, + format_enhanced_key_usage_value }, +}; + +static void add_properties(HWND hwnd, struct detail_data *data) +{ + DWORD i; + PCCERT_CONTEXT cert = data->pCertViewInfo->pCertContext; + + for (i = 0; i < sizeof(prop_id_map) / sizeof(prop_id_map[0]); i++) + { + DWORD cb; + + if (CertGetCertificateContextProperty(cert, prop_id_map[i].prop, NULL, + &cb)) + { + BYTE *pb; + WCHAR *val = NULL; + + /* FIXME: MS adds a separate value for the signature hash + * algorithm. + */ + pb = HeapAlloc(GetProcessHeap(), 0, cb); + if (pb) + { + if (CertGetCertificateContextProperty(cert, + prop_id_map[i].prop, pb, &cb)) + { + if (prop_id_map[i].prop_is_string) + { + val = (LPWSTR)pb; + /* Don't double-free pb */ + pb = NULL; + } + else + val = prop_id_map[i].prop_to_value(pb, cb); + } + HeapFree(GetProcessHeap(), 0, pb); + } + add_string_id_and_value_to_list(hwnd, data, prop_id_map[i].id, val, + NULL, NULL); + } + } +} + +static void add_all_fields(HWND hwnd, struct detail_data *data) +{ + add_v1_fields(hwnd, data); + add_all_extensions(hwnd, data); + add_properties(hwnd, data); +} + +struct selection_list_item +{ + int id; + add_fields_func add; +}; + +const struct selection_list_item listItems[] = { + { IDS_FIELDS_ALL, add_all_fields }, + { IDS_FIELDS_V1, add_v1_fields }, + { IDS_FIELDS_EXTENSIONS, add_all_extensions }, + { IDS_FIELDS_CRITICAL_EXTENSIONS, add_critical_extensions }, + { IDS_FIELDS_PROPERTIES, add_properties }, +}; + +static void create_show_list(HWND hwnd, struct detail_data *data) +{ + HWND cb = GetDlgItem(hwnd, IDC_DETAIL_SELECT); + WCHAR buf[MAX_STRING_LEN]; + int i; + + for (i = 0; i < sizeof(listItems) / sizeof(listItems[0]); i++) + { + int index; + + LoadStringW(hInstance, listItems[i].id, buf, + sizeof(buf) / sizeof(buf[0])); + index = SendMessageW(cb, CB_INSERTSTRING, -1, (LPARAM)buf); + SendMessageW(cb, CB_SETITEMDATA, index, (LPARAM)data); + } + SendMessageW(cb, CB_SETCURSEL, 0, 0); +} + +static void create_listview_columns(HWND hwnd) +{ + HWND lv = GetDlgItem(hwnd, IDC_DETAIL_LIST); + RECT rc; + WCHAR buf[MAX_STRING_LEN]; + LVCOLUMNW column; + + SendMessageW(lv, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT); + GetWindowRect(lv, &rc); + LoadStringW(hInstance, IDS_FIELD, buf, sizeof(buf) / sizeof(buf[0])); + column.mask = LVCF_WIDTH | LVCF_TEXT; + column.cx = (rc.right - rc.left) / 2 - 2; + column.pszText = buf; + SendMessageW(lv, LVM_INSERTCOLUMNW, 0, (LPARAM)&column); + LoadStringW(hInstance, IDS_VALUE, buf, sizeof(buf) / sizeof(buf[0])); + SendMessageW(lv, LVM_INSERTCOLUMNW, 1, (LPARAM)&column); +} + +static void set_fields_selection(HWND hwnd, struct detail_data *data, int sel) +{ + HWND list = GetDlgItem(hwnd, IDC_DETAIL_LIST); + + if (sel >= 0 && sel < sizeof(listItems) / sizeof(listItems[0])) + { + SendMessageW(list, LVM_DELETEALLITEMS, 0, 0); + listItems[sel].add(list, data); + } +} + +static void create_cert_details_list(HWND hwnd, struct detail_data *data) +{ + create_show_list(hwnd, data); + create_listview_columns(hwnd); + set_fields_selection(hwnd, data, 0); +} + +typedef enum { + CheckBitmapIndexUnchecked = 1, + CheckBitmapIndexChecked = 2, + CheckBitmapIndexDisabledUnchecked = 3, + CheckBitmapIndexDisabledChecked = 4 +} CheckBitmapIndex; + +static void add_purpose(HWND hwnd, LPCSTR oid) +{ + HWND lv = GetDlgItem(hwnd, IDC_CERTIFICATE_USAGES); + PCRYPT_OID_INFO info = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(CRYPT_OID_INFO)); + + if (info) + { + char *oidCopy = HeapAlloc(GetProcessHeap(), 0, strlen(oid) + 1); + + if (oidCopy) + { + LVITEMA item; + + strcpy(oidCopy, oid); + info->cbSize = sizeof(CRYPT_OID_INFO); + info->pszOID = oidCopy; + item.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM; + item.state = INDEXTOSTATEIMAGEMASK(CheckBitmapIndexChecked); + item.stateMask = LVIS_STATEIMAGEMASK; + item.iItem = SendMessageW(lv, LVM_GETITEMCOUNT, 0, 0); + item.iSubItem = 0; + item.lParam = (LPARAM)info; + item.pszText = oidCopy; + SendMessageA(lv, LVM_INSERTITEMA, 0, (LPARAM)&item); + } + else + HeapFree(GetProcessHeap(), 0, info); + } +} + +static BOOL is_valid_oid(LPCSTR oid) +{ + BOOL ret; + + if (oid[0] != '0' && oid[0] != '1' && oid[0] != '2') + ret = FALSE; + else if (oid[1] != '.') + ret = FALSE; + else if (!oid[2]) + ret = FALSE; + else + { + const char *ptr; + BOOL expectNum = TRUE; + + for (ptr = oid + 2, ret = TRUE; ret && *ptr; ptr++) + { + if (expectNum) + { + if (!isdigit(*ptr)) + ret = FALSE; + else if (*(ptr + 1) == '.') + expectNum = FALSE; + } + else + { + if (*ptr != '.') + ret = FALSE; + else if (!(*(ptr + 1))) + ret = FALSE; + else + expectNum = TRUE; + } + } + } + return ret; +} + +static BOOL is_oid_in_list(HWND hwnd, LPCSTR oid) +{ + HWND lv = GetDlgItem(hwnd, IDC_CERTIFICATE_USAGES); + PCCRYPT_OID_INFO oidInfo = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, + (void *)oid, CRYPT_ENHKEY_USAGE_OID_GROUP_ID); + BOOL ret = FALSE; + + if (oidInfo) + { + LVFINDINFOW findInfo; + + findInfo.flags = LVFI_PARAM; + findInfo.lParam = (LPARAM)oidInfo; + if (SendMessageW(lv, LVM_FINDITEMW, -1, (LPARAM)&findInfo) != -1) + ret = TRUE; + } + else + { + LVFINDINFOA findInfo; + + findInfo.flags = LVFI_STRING; + findInfo.psz = oid; + if (SendMessageW(lv, LVM_FINDITEMA, -1, (LPARAM)&findInfo) != -1) + ret = TRUE; + } + return ret; +} + +#define MAX_PURPOSE 255 + +static LRESULT CALLBACK add_purpose_dlg_proc(HWND hwnd, UINT msg, + WPARAM wp, LPARAM lp) +{ + LRESULT ret = 0; + char buf[MAX_PURPOSE + 1]; + + switch (msg) + { + case WM_INITDIALOG: + SendMessageW(GetDlgItem(hwnd, IDC_NEW_PURPOSE), EM_SETLIMITTEXT, + MAX_PURPOSE, 0); + ShowScrollBar(GetDlgItem(hwnd, IDC_NEW_PURPOSE), SB_VERT, FALSE); + SetWindowLongPtrW(hwnd, DWLP_USER, lp); + break; + case WM_COMMAND: + switch (HIWORD(wp)) + { + case EN_CHANGE: + if (LOWORD(wp) == IDC_NEW_PURPOSE) + { + /* Show/hide scroll bar on description depending on how much + * text it has. + */ + HWND description = GetDlgItem(hwnd, IDC_NEW_PURPOSE); + int lines = SendMessageW(description, EM_GETLINECOUNT, 0, 0); + + ShowScrollBar(description, SB_VERT, lines > 1); + } + break; + case BN_CLICKED: + switch (LOWORD(wp)) + { + case IDOK: + SendMessageA(GetDlgItem(hwnd, IDC_NEW_PURPOSE), WM_GETTEXT, + sizeof(buf) / sizeof(buf[0]), (LPARAM)buf); + if (!buf[0]) + { + /* An empty purpose is the same as cancelling */ + EndDialog(hwnd, IDCANCEL); + ret = TRUE; + } + else if (!is_valid_oid(buf)) + { + WCHAR title[MAX_STRING_LEN], error[MAX_STRING_LEN]; + + LoadStringW(hInstance, IDS_CERTIFICATE_PURPOSE_ERROR, error, + sizeof(error) / sizeof(error[0])); + LoadStringW(hInstance, IDS_CERTIFICATE_PROPERTIES, title, + sizeof(title) / sizeof(title[0])); + MessageBoxW(hwnd, error, title, MB_ICONERROR | MB_OK); + } + else if (is_oid_in_list( + (HWND)GetWindowLongPtrW(hwnd, DWLP_USER), buf)) + { + WCHAR title[MAX_STRING_LEN], error[MAX_STRING_LEN]; + + LoadStringW(hInstance, IDS_CERTIFICATE_PURPOSE_EXISTS, + error, sizeof(error) / sizeof(error[0])); + LoadStringW(hInstance, IDS_CERTIFICATE_PROPERTIES, title, + sizeof(title) / sizeof(title[0])); + MessageBoxW(hwnd, error, title, MB_ICONEXCLAMATION | MB_OK); + } + else + { + HWND parent = (HWND)GetWindowLongPtrW(hwnd, DWLP_USER); + + add_purpose(parent, buf); + EndDialog(hwnd, wp); + ret = TRUE; + } + break; + case IDCANCEL: + EndDialog(hwnd, wp); + ret = TRUE; + break; + } + break; + } + break; + } + return ret; +} + +static WCHAR *get_cert_property_as_string(PCCERT_CONTEXT cert, DWORD prop) +{ + WCHAR *name = NULL; + DWORD cb; + + if (CertGetCertificateContextProperty(cert, prop, NULL, &cb)) + { + name = HeapAlloc(GetProcessHeap(), 0, cb); + if (name) + { + if (!CertGetCertificateContextProperty(cert, prop, (LPBYTE)name, + &cb)) + { + HeapFree(GetProcessHeap(), 0, name); + name = NULL; + } + } + } + return name; +} + +static void redraw_states(HWND list, BOOL enabled) +{ + int items = SendMessageW(list, LVM_GETITEMCOUNT, 0, 0), i; + + for (i = 0; i < items; i++) + { + BOOL change = FALSE; + int state; + + state = SendMessageW(list, LVM_GETITEMSTATE, i, LVIS_STATEIMAGEMASK); + /* This reverses the INDEXTOSTATEIMAGEMASK shift. There doesn't appear + * to be a handy macro for it. + */ + state >>= 12; + if (enabled) + { + if (state == CheckBitmapIndexDisabledChecked) + { + state = CheckBitmapIndexChecked; + change = TRUE; + } + if (state == CheckBitmapIndexDisabledUnchecked) + { + state = CheckBitmapIndexUnchecked; + change = TRUE; + } + } + else + { + if (state == CheckBitmapIndexChecked) + { + state = CheckBitmapIndexDisabledChecked; + change = TRUE; + } + if (state == CheckBitmapIndexUnchecked) + { + state = CheckBitmapIndexDisabledUnchecked; + change = TRUE; + } + } + if (change) + { + LVITEMW item; + + item.state = INDEXTOSTATEIMAGEMASK(state); + item.stateMask = LVIS_STATEIMAGEMASK; + SendMessageW(list, LVM_SETITEMSTATE, i, (LPARAM)&item); + } + } +} + +typedef enum { + PurposeEnableAll = 0, + PurposeDisableAll, + PurposeEnableSelected +} PurposeSelection; + +static void select_purposes(HWND hwnd, PurposeSelection selection) +{ + HWND lv = GetDlgItem(hwnd, IDC_CERTIFICATE_USAGES); + + switch (selection) + { + case PurposeEnableAll: + case PurposeDisableAll: + EnableWindow(lv, FALSE); + redraw_states(lv, FALSE); + EnableWindow(GetDlgItem(hwnd, IDC_ADD_PURPOSE), FALSE); + break; + case PurposeEnableSelected: + EnableWindow(lv, TRUE); + redraw_states(lv, TRUE); + EnableWindow(GetDlgItem(hwnd, IDC_ADD_PURPOSE), TRUE); + } +} + +extern BOOL WINAPI WTHelperGetKnownUsages(DWORD action, + PCCRYPT_OID_INFO **usages); + +static void add_known_usage(HWND lv, PCCRYPT_OID_INFO info) +{ + LVITEMW item; + + item.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM; + item.state = INDEXTOSTATEIMAGEMASK(CheckBitmapIndexDisabledChecked); + item.stateMask = LVIS_STATEIMAGEMASK; + item.iItem = SendMessageW(lv, LVM_GETITEMCOUNT, 0, 0); + item.iSubItem = 0; + item.lParam = (LPARAM)info; + item.pszText = (LPWSTR)info->pwszName; + SendMessageW(lv, LVM_INSERTITEMW, 0, (LPARAM)&item); +} + +static void show_cert_usages(HWND hwnd, struct detail_data *data) +{ + PCCERT_CONTEXT cert = data->pCertViewInfo->pCertContext; + HWND lv = GetDlgItem(hwnd, IDC_CERTIFICATE_USAGES); + PCERT_ENHKEY_USAGE usage; + DWORD size; + PCCRYPT_OID_INFO *usages; + RECT rc; + LVCOLUMNW column; + PurposeSelection purposeSelection; + + GetWindowRect(lv, &rc); + column.mask = LVCF_WIDTH; + column.cx = rc.right - rc.left; + SendMessageW(lv, LVM_INSERTCOLUMNW, 0, (LPARAM)&column); + SendMessageW(lv, LVM_SETIMAGELIST, LVSIL_STATE, (LPARAM)data->imageList); + + /* Get enhanced key usage. Have to check for a property and an extension + * separately, because CertGetEnhancedKeyUsage will succeed and return an + * empty usage if neither is set. Unfortunately an empty usage implies + * no usage is allowed, so we have to distinguish between the two cases. + */ + if (CertGetEnhancedKeyUsage(cert, CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG, + NULL, &size)) + { + usage = HeapAlloc(GetProcessHeap(), 0, size); + if (!CertGetEnhancedKeyUsage(cert, + CERT_FIND_PROP_ONLY_ENHKEY_USAGE_FLAG, usage, &size)) + { + HeapFree(GetProcessHeap(), 0, usage); + usage = NULL; + } + else if (usage->cUsageIdentifier) + purposeSelection = PurposeEnableSelected; + else + purposeSelection = PurposeDisableAll; + } + else if (CertGetEnhancedKeyUsage(cert, CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG, + NULL, &size)) + { + usage = HeapAlloc(GetProcessHeap(), 0, size); + if (!CertGetEnhancedKeyUsage(cert, + CERT_FIND_EXT_ONLY_ENHKEY_USAGE_FLAG, usage, &size)) + { + HeapFree(GetProcessHeap(), 0, usage); + usage = NULL; + } + else if (usage->cUsageIdentifier) + purposeSelection = PurposeEnableAll; + else + purposeSelection = PurposeDisableAll; + } + else + { + purposeSelection = PurposeEnableAll; + usage = NULL; + } + if (usage) + { + DWORD i; + + for (i = 0; i < usage->cUsageIdentifier; i++) + { + PCCRYPT_OID_INFO info = CryptFindOIDInfo(CRYPT_OID_INFO_OID_KEY, + usage->rgpszUsageIdentifier[i], CRYPT_ENHKEY_USAGE_OID_GROUP_ID); + + if (info) + add_known_usage(lv, info); + else + add_purpose(hwnd, usage->rgpszUsageIdentifier[i]); + } + HeapFree(GetProcessHeap(), 0, usage); + } + else + { + if (WTHelperGetKnownUsages(1, &usages)) + { + PCCRYPT_OID_INFO *ptr; + + for (ptr = usages; *ptr; ptr++) + add_known_usage(lv, *ptr); + WTHelperGetKnownUsages(2, &usages); + } + } + select_purposes(hwnd, purposeSelection); + SendMessageW(GetDlgItem(hwnd, IDC_ENABLE_ALL_PURPOSES + purposeSelection), + BM_CLICK, 0, 0); +} + +static void set_general_cert_properties(HWND hwnd, struct detail_data *data) +{ + PCCERT_CONTEXT cert = data->pCertViewInfo->pCertContext; + WCHAR *str; + + if ((str = get_cert_property_as_string(cert, CERT_FRIENDLY_NAME_PROP_ID))) + { + SendMessageW(GetDlgItem(hwnd, IDC_FRIENDLY_NAME), WM_SETTEXT, 0, + (LPARAM)str); + HeapFree(GetProcessHeap(), 0, str); + } + if ((str = get_cert_property_as_string(cert, CERT_DESCRIPTION_PROP_ID))) + { + SendMessageW(GetDlgItem(hwnd, IDC_DESCRIPTION), WM_SETTEXT, 0, + (LPARAM)str); + HeapFree(GetProcessHeap(), 0, str); + } + show_cert_usages(hwnd, data); +} + +static void toggle_usage(HWND hwnd, int iItem) +{ + LVITEMW item; + int res; + HWND lv = GetDlgItem(hwnd, IDC_CERTIFICATE_USAGES); + + item.mask = LVIF_STATE; + item.iItem = iItem; + item.iSubItem = 0; + item.stateMask = LVIS_STATEIMAGEMASK; + res = SendMessageW(lv, LVM_GETITEMW, 0, (LPARAM)&item); + if (res) + { + int state = item.state >> 12; + + item.state = INDEXTOSTATEIMAGEMASK( + state == CheckBitmapIndexChecked ? CheckBitmapIndexUnchecked : + CheckBitmapIndexChecked); + SendMessageW(lv, LVM_SETITEMSTATE, iItem, (LPARAM)&item); + } +} + +static void set_cert_string_property(PCCERT_CONTEXT cert, DWORD prop, + LPWSTR str) +{ + if (str && strlenW(str)) + { + CRYPT_DATA_BLOB blob; + + blob.pbData = (BYTE *)str; + blob.cbData = (strlenW(str) + 1) * sizeof(WCHAR); + CertSetCertificateContextProperty(cert, prop, 0, &blob); + } + else + CertSetCertificateContextProperty(cert, prop, 0, NULL); +} + +#define WM_REFRESH_VIEW WM_USER + 0 + +static BOOL CALLBACK refresh_propsheet_pages(HWND hwnd, LPARAM lParam) +{ + if ((GetClassLongW(hwnd, GCW_ATOM) == WC_DIALOG)) + SendMessageW(hwnd, WM_REFRESH_VIEW, 0, 0); + return TRUE; +} + +#define MAX_FRIENDLY_NAME 40 +#define MAX_DESCRIPTION 255 + +static void apply_general_changes(HWND hwnd) +{ + WCHAR buf[MAX_DESCRIPTION + 1]; + struct detail_data *data = + (struct detail_data *)GetWindowLongPtrW(hwnd, DWLP_USER); + + SendMessageW(GetDlgItem(hwnd, IDC_FRIENDLY_NAME), WM_GETTEXT, + sizeof(buf) / sizeof(buf[0]), (LPARAM)buf); + set_cert_string_property(data->pCertViewInfo->pCertContext, + CERT_FRIENDLY_NAME_PROP_ID, buf); + SendMessageW(GetDlgItem(hwnd, IDC_DESCRIPTION), WM_GETTEXT, + sizeof(buf) / sizeof(buf[0]), (LPARAM)buf); + set_cert_string_property(data->pCertViewInfo->pCertContext, + CERT_DESCRIPTION_PROP_ID, buf); + if (IsDlgButtonChecked(hwnd, IDC_ENABLE_ALL_PURPOSES)) + { + /* Setting a NULL usage removes the enhanced key usage property. */ + CertSetEnhancedKeyUsage(data->pCertViewInfo->pCertContext, NULL); + } + else if (IsDlgButtonChecked(hwnd, IDC_DISABLE_ALL_PURPOSES)) + { + CERT_ENHKEY_USAGE usage = { 0, NULL }; + + CertSetEnhancedKeyUsage(data->pCertViewInfo->pCertContext, &usage); + } + else if (IsDlgButtonChecked(hwnd, IDC_ENABLE_SELECTED_PURPOSES)) + { + HWND lv = GetDlgItem(hwnd, IDC_CERTIFICATE_USAGES); + CERT_ENHKEY_USAGE usage = { 0, NULL }; + int purposes = SendMessageW(lv, LVM_GETITEMCOUNT, 0, 0), i; + LVITEMW item; + + item.mask = LVIF_STATE | LVIF_PARAM; + item.iSubItem = 0; + item.stateMask = LVIS_STATEIMAGEMASK; + for (i = 0; i < purposes; i++) + { + item.iItem = i; + if (SendMessageW(lv, LVM_GETITEMW, 0, (LPARAM)&item)) + { + int state = item.state >> 12; + + if (state == CheckBitmapIndexChecked) + { + CRYPT_OID_INFO *info = (CRYPT_OID_INFO *)item.lParam; + + if (usage.cUsageIdentifier) + usage.rgpszUsageIdentifier = + HeapReAlloc(GetProcessHeap(), 0, + usage.rgpszUsageIdentifier, + (usage.cUsageIdentifier + 1) * sizeof(LPSTR)); + else + usage.rgpszUsageIdentifier = + HeapAlloc(GetProcessHeap(), 0, sizeof(LPSTR)); + if (usage.rgpszUsageIdentifier) + usage.rgpszUsageIdentifier[usage.cUsageIdentifier++] = + (LPSTR)info->pszOID; + } + } + } + CertSetEnhancedKeyUsage(data->pCertViewInfo->pCertContext, &usage); + HeapFree(GetProcessHeap(), 0, usage.rgpszUsageIdentifier); + } + EnumChildWindows(GetParent(GetParent(hwnd)), refresh_propsheet_pages, 0); + if (data->pfPropertiesChanged) + *data->pfPropertiesChanged = TRUE; +} + +static LRESULT CALLBACK cert_properties_general_dlg_proc(HWND hwnd, UINT msg, + WPARAM wp, LPARAM lp) +{ + PROPSHEETPAGEW *page; + struct detail_data *data; + + TRACE("(%p, %08x, %08lx, %08lx)\n", hwnd, msg, wp, lp); + + switch (msg) + { + case WM_INITDIALOG: + { + HWND description = GetDlgItem(hwnd, IDC_DESCRIPTION); + + page = (PROPSHEETPAGEW *)lp; + data = (struct detail_data *)page->lParam; + SendMessageW(GetDlgItem(hwnd, IDC_FRIENDLY_NAME), EM_SETLIMITTEXT, + MAX_FRIENDLY_NAME, 0); + SendMessageW(description, EM_SETLIMITTEXT, MAX_DESCRIPTION, 0); + ShowScrollBar(description, SB_VERT, FALSE); + set_general_cert_properties(hwnd, data); + SetWindowLongPtrW(hwnd, DWLP_USER, (LPARAM)data); + break; + } + case WM_NOTIFY: + { + NMHDR *hdr = (NMHDR *)lp; + NMITEMACTIVATE *nm; + + switch (hdr->code) + { + case NM_CLICK: + nm = (NMITEMACTIVATE *)lp; + toggle_usage(hwnd, nm->iItem); + SendMessageW(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0); + break; + case PSN_APPLY: + apply_general_changes(hwnd); + break; + } + break; + } + case WM_COMMAND: + switch (HIWORD(wp)) + { + case EN_CHANGE: + SendMessageW(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0); + if (LOWORD(wp) == IDC_DESCRIPTION) + { + /* Show/hide scroll bar on description depending on how much + * text it has. + */ + HWND description = GetDlgItem(hwnd, IDC_DESCRIPTION); + int lines = SendMessageW(description, EM_GETLINECOUNT, 0, 0); + + ShowScrollBar(description, SB_VERT, lines > 1); + } + break; + case BN_CLICKED: + switch (LOWORD(wp)) + { + case IDC_ADD_PURPOSE: + if (DialogBoxParamW(hInstance, + MAKEINTRESOURCEW(IDD_ADD_CERT_PURPOSE), hwnd, + add_purpose_dlg_proc, (LPARAM)hwnd) == IDOK) + SendMessageW(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0); + break; + case IDC_ENABLE_ALL_PURPOSES: + case IDC_DISABLE_ALL_PURPOSES: + case IDC_ENABLE_SELECTED_PURPOSES: + SendMessageW(GetParent(hwnd), PSM_CHANGED, (WPARAM)hwnd, 0); + select_purposes(hwnd, LOWORD(wp) - IDC_ENABLE_ALL_PURPOSES); + break; + } + break; + } + break; + } + return 0; +} + +static UINT CALLBACK cert_properties_general_callback(HWND hwnd, UINT msg, + PROPSHEETPAGEW *page) +{ + HWND lv; + int cItem, i; + + switch (msg) + { + case PSPCB_RELEASE: + lv = GetDlgItem(hwnd, IDC_CERTIFICATE_USAGES); + cItem = SendMessageW(lv, LVM_GETITEMCOUNT, 0, 0); + for (i = 0; i < cItem; i++) + { + LVITEMW item; + + item.mask = LVIF_PARAM; + item.iItem = i; + item.iSubItem = 0; + if (SendMessageW(lv, LVM_GETITEMW, 0, (LPARAM)&item) && item.lParam) + { + PCRYPT_OID_INFO info = (PCRYPT_OID_INFO)item.lParam; + + if (info->cbSize == sizeof(CRYPT_OID_INFO) && !info->dwGroupId) + { + HeapFree(GetProcessHeap(), 0, (LPSTR)info->pszOID); + HeapFree(GetProcessHeap(), 0, info); + } + } + } + break; + } + return 1; +} + +static void show_edit_cert_properties_dialog(HWND parent, + struct detail_data *data) +{ + PROPSHEETHEADERW hdr; + PROPSHEETPAGEW page; /* FIXME: need to add a cross-certificate page */ + + TRACE("(%p)\n", data); + + memset(&page, 0, sizeof(PROPSHEETPAGEW)); + page.dwSize = sizeof(page); + page.dwFlags = PSP_USECALLBACK; + page.pfnCallback = cert_properties_general_callback; + page.hInstance = hInstance; + page.u.pszTemplate = MAKEINTRESOURCEW(IDD_CERT_PROPERTIES_GENERAL); + page.pfnDlgProc = cert_properties_general_dlg_proc; + page.lParam = (LPARAM)data; + + memset(&hdr, 0, sizeof(hdr)); + hdr.dwSize = sizeof(hdr); + hdr.hwndParent = parent; + hdr.dwFlags = PSH_PROPSHEETPAGE; + hdr.hInstance = hInstance; + hdr.pszCaption = MAKEINTRESOURCEW(IDS_CERTIFICATE_PROPERTIES); + hdr.u3.ppsp = &page; + hdr.nPages = 1; + PropertySheetW(&hdr); +} + +static void free_detail_fields(struct detail_data *data) +{ + DWORD i; + + for (i = 0; i < data->cFields; i++) + HeapFree(GetProcessHeap(), 0, data->fields[i].detailed_value); + HeapFree(GetProcessHeap(), 0, data->fields); + data->fields = NULL; + data->cFields = 0; +} + +static void refresh_details_view(HWND hwnd) +{ + HWND cb = GetDlgItem(hwnd, IDC_DETAIL_SELECT); + int curSel; + struct detail_data *data; + + curSel = SendMessageW(cb, CB_GETCURSEL, 0, 0); + /* Actually, any index will do, since they all store the same data value */ + data = (struct detail_data *)SendMessageW(cb, CB_GETITEMDATA, curSel, 0); + free_detail_fields(data); + set_fields_selection(hwnd, data, curSel); +} + +static LRESULT CALLBACK detail_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, + LPARAM lp) +{ + PROPSHEETPAGEW *page; + struct detail_data *data; + + TRACE("(%p, %08x, %08lx, %08lx)\n", hwnd, msg, wp, lp); + + switch (msg) + { + case WM_INITDIALOG: + page = (PROPSHEETPAGEW *)lp; + data = (struct detail_data *)page->lParam; + create_cert_details_list(hwnd, data); + if (!(data->pCertViewInfo->dwFlags & CRYPTUI_ENABLE_EDITPROPERTIES)) + EnableWindow(GetDlgItem(hwnd, IDC_EDITPROPERTIES), FALSE); + if (data->pCertViewInfo->dwFlags & CRYPTUI_DISABLE_EXPORT) + EnableWindow(GetDlgItem(hwnd, IDC_EXPORT), FALSE); + break; + case WM_NOTIFY: + { + NMITEMACTIVATE *nm; + HWND list = GetDlgItem(hwnd, IDC_DETAIL_LIST); + + nm = (NMITEMACTIVATE*)lp; + if (nm->hdr.hwndFrom == list && nm->uNewState & LVN_ITEMACTIVATE + && nm->hdr.code == LVN_ITEMCHANGED) + { + data = (struct detail_data *)nm->lParam; + if (nm->iItem >= 0 && data && nm->iItem < data->cFields) + { + WCHAR buf[MAX_STRING_LEN], *val = NULL; + HWND valueCtl = GetDlgItem(hwnd, IDC_DETAIL_VALUE); + + if (data->fields[nm->iItem].create) + val = data->fields[nm->iItem].create( + data->pCertViewInfo->pCertContext, + data->fields[nm->iItem].param); + else + { + LVITEMW item; + int res; + + item.cchTextMax = sizeof(buf) / sizeof(buf[0]); + item.mask = LVIF_TEXT; + item.pszText = buf; + item.iItem = nm->iItem; + item.iSubItem = 1; + res = SendMessageW(list, LVM_GETITEMW, 0, (LPARAM)&item); + if (res) + val = buf; + } + /* Select all the text in the control, the next update will + * replace it + */ + SendMessageW(valueCtl, EM_SETSEL, 0, -1); + add_unformatted_text_to_control(valueCtl, val, + val ? strlenW(val) : 0); + if (val != buf) + HeapFree(GetProcessHeap(), 0, val); + } + } + break; + } + case WM_COMMAND: + switch (wp) + { + case IDC_EXPORT: + FIXME("call CryptUIWizExport\n"); + break; + case IDC_EDITPROPERTIES: + { + HWND cb = GetDlgItem(hwnd, IDC_DETAIL_SELECT); + int curSel; + + curSel = SendMessageW(cb, CB_GETCURSEL, 0, 0); + /* Actually, any index will do, since they all store the same + * data value + */ + data = (struct detail_data *)SendMessageW(cb, CB_GETITEMDATA, + curSel, 0); + show_edit_cert_properties_dialog(GetParent(hwnd), data); + break; + } + case ((CBN_SELCHANGE << 16) | IDC_DETAIL_SELECT): + refresh_details_view(hwnd); + break; + } + break; + case WM_REFRESH_VIEW: + refresh_details_view(hwnd); + break; + } + return 0; +} + +static UINT CALLBACK detail_callback(HWND hwnd, UINT msg, + PROPSHEETPAGEW *page) +{ + struct detail_data *data; + + switch (msg) + { + case PSPCB_RELEASE: + data = (struct detail_data *)page->lParam; + free_detail_fields(data); + ImageList_Destroy(data->imageList); + HeapFree(GetProcessHeap(), 0, data); + break; + } + return 0; +} + +static BOOL init_detail_page(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, + BOOL *pfPropertiesChanged, PROPSHEETPAGEW *page) +{ + BOOL ret; + struct detail_data *data = HeapAlloc(GetProcessHeap(), 0, + sizeof(struct detail_data)); + + if (data) + { + data->pCertViewInfo = pCertViewInfo; + data->pfPropertiesChanged = pfPropertiesChanged; + data->cFields = 0; + data->fields = NULL; + data->imageList = ImageList_Create(16, 16, ILC_COLOR4 | ILC_MASK, 4, 0); + if (data->imageList) + { + HBITMAP bmp; + COLORREF backColor = RGB(255, 0, 255); + + bmp = LoadBitmapW(hInstance, MAKEINTRESOURCEW(IDB_CHECKS)); + ImageList_AddMasked(data->imageList, bmp, backColor); + DeleteObject(bmp); + ImageList_SetBkColor(data->imageList, CLR_NONE); + } + memset(page, 0, sizeof(PROPSHEETPAGEW)); + page->dwSize = sizeof(PROPSHEETPAGEW); + page->dwFlags = PSP_USECALLBACK; + page->pfnCallback = detail_callback; + page->hInstance = hInstance; + page->u.pszTemplate = MAKEINTRESOURCEW(IDD_DETAIL); + page->pfnDlgProc = detail_dlg_proc; + page->lParam = (LPARAM)data; + ret = TRUE; + } + else + ret = FALSE; + return ret; +} + +struct hierarchy_data +{ + PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo; + HIMAGELIST imageList; + DWORD selectedCert; +}; + +static LPARAM index_to_lparam(struct hierarchy_data *data, DWORD index) +{ + CRYPT_PROVIDER_SGNR *provSigner = WTHelperGetProvSignerFromChain( + (CRYPT_PROVIDER_DATA *)data->pCertViewInfo->u.pCryptProviderData, + data->pCertViewInfo->idxSigner, data->pCertViewInfo->fCounterSigner, + data->pCertViewInfo->idxCounterSigner); + + /* Takes advantage of the fact that a pointer is 32-bit aligned, and + * therefore always even. + */ + if (index == provSigner->csCertChain - 1) + return (LPARAM)data; + return index << 1 | 1; +} + +static inline DWORD lparam_to_index(struct hierarchy_data *data, LPARAM lp) +{ + CRYPT_PROVIDER_SGNR *provSigner = WTHelperGetProvSignerFromChain( + (CRYPT_PROVIDER_DATA *)data->pCertViewInfo->u.pCryptProviderData, + data->pCertViewInfo->idxSigner, data->pCertViewInfo->fCounterSigner, + data->pCertViewInfo->idxCounterSigner); + + if (!(lp & 1)) + return provSigner->csCertChain - 1; + return lp >> 1; +} + +static struct hierarchy_data *get_hierarchy_data_from_tree_item(HWND tree, + HTREEITEM hItem) +{ + struct hierarchy_data *data = NULL; + HTREEITEM root = NULL; + + do { + HTREEITEM parent = (HTREEITEM)SendMessageW(tree, TVM_GETNEXTITEM, + TVGN_PARENT, (LPARAM)hItem); + + if (!parent) + root = hItem; + hItem = parent; + } while (hItem); + if (root) + { + TVITEMW item; + + item.mask = TVIF_PARAM; + item.hItem = root; + SendMessageW(tree, TVM_GETITEMW, 0, (LPARAM)&item); + data = (struct hierarchy_data *)item.lParam; + } + return data; +} + +static WCHAR *get_cert_display_name(PCCERT_CONTEXT cert) +{ + WCHAR *name = get_cert_property_as_string(cert, CERT_FRIENDLY_NAME_PROP_ID); + + if (!name) + name = get_cert_name_string(cert, CERT_NAME_SIMPLE_DISPLAY_TYPE, 0); + return name; +} + +static void show_cert_chain(HWND hwnd, struct hierarchy_data *data) +{ + HWND tree = GetDlgItem(hwnd, IDC_CERTPATH); + CRYPT_PROVIDER_SGNR *provSigner = WTHelperGetProvSignerFromChain( + (CRYPT_PROVIDER_DATA *)data->pCertViewInfo->u.pCryptProviderData, + data->pCertViewInfo->idxSigner, data->pCertViewInfo->fCounterSigner, + data->pCertViewInfo->idxCounterSigner); + DWORD i; + HTREEITEM parent = NULL; + + SendMessageW(tree, TVM_SETIMAGELIST, TVSIL_NORMAL, (LPARAM)data->imageList); + for (i = provSigner->csCertChain; i; i--) + { + LPWSTR name; + + name = get_cert_display_name(provSigner->pasCertChain[i - 1].pCert); + if (name) + { + TVINSERTSTRUCTW tvis; + + tvis.hParent = parent; + tvis.hInsertAfter = TVI_LAST; + tvis.u.item.mask = TVIF_TEXT | TVIF_STATE | TVIF_IMAGE | + TVIF_SELECTEDIMAGE | TVIF_PARAM; + tvis.u.item.pszText = name; + tvis.u.item.state = TVIS_EXPANDED; + tvis.u.item.stateMask = TVIS_EXPANDED; + if (i == 1 && + (provSigner->pChainContext->TrustStatus.dwErrorStatus & + CERT_TRUST_IS_PARTIAL_CHAIN)) + { + /* The root of the chain has a special case: if the chain is + * a partial chain, the icon is a warning icon rather than an + * error icon. + */ + tvis.u.item.iImage = 2; + } + else if (provSigner->pasCertChain[i - 1].pChainElement->TrustStatus. + dwErrorStatus == 0) + tvis.u.item.iImage = 0; + else + tvis.u.item.iImage = 1; + tvis.u.item.iSelectedImage = tvis.u.item.iImage; + tvis.u.item.lParam = index_to_lparam(data, i - 1); + parent = (HTREEITEM)SendMessageW(tree, TVM_INSERTITEMW, 0, + (LPARAM)&tvis); + HeapFree(GetProcessHeap(), 0, name); + } + } +} + +static void set_certificate_status(HWND hwnd, CRYPT_PROVIDER_CERT *cert) +{ + /* Select all the text in the control, the next update will replace it */ + SendMessageW(hwnd, EM_SETSEL, 0, -1); + /* Set the highest priority error messages first. */ + if (!(cert->dwConfidence & CERT_CONFIDENCE_SIG)) + add_string_resource_to_control(hwnd, IDS_CERTIFICATE_BAD_SIGNATURE); + else if (!(cert->dwConfidence & CERT_CONFIDENCE_TIME)) + add_string_resource_to_control(hwnd, IDS_CERTIFICATE_BAD_TIME); + else if (!(cert->dwConfidence & CERT_CONFIDENCE_TIMENEST)) + add_string_resource_to_control(hwnd, IDS_CERTIFICATE_BAD_TIMENEST); + else if (cert->dwRevokedReason) + add_string_resource_to_control(hwnd, IDS_CERTIFICATE_REVOKED); + else + add_string_resource_to_control(hwnd, IDS_CERTIFICATE_VALID); +} + +static void set_certificate_status_for_end_cert(HWND hwnd, + PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo) +{ + HWND status = GetDlgItem(hwnd, IDC_CERTIFICATESTATUSTEXT); + CRYPT_PROVIDER_SGNR *provSigner = WTHelperGetProvSignerFromChain( + (CRYPT_PROVIDER_DATA *)pCertViewInfo->u.pCryptProviderData, + pCertViewInfo->idxSigner, pCertViewInfo->fCounterSigner, + pCertViewInfo->idxCounterSigner); + CRYPT_PROVIDER_CERT *provCert = WTHelperGetProvCertFromChain(provSigner, + pCertViewInfo->idxCert); + + set_certificate_status(status, provCert); +} + +static void show_cert_hierarchy(HWND hwnd, struct hierarchy_data *data) +{ + /* Disable view certificate button until a certificate is selected */ + EnableWindow(GetDlgItem(hwnd, IDC_VIEWCERTIFICATE), FALSE); + show_cert_chain(hwnd, data); + set_certificate_status_for_end_cert(hwnd, data->pCertViewInfo); +} + +static void show_dialog_for_selected_cert(HWND hwnd) +{ + HWND tree = GetDlgItem(hwnd, IDC_CERTPATH); + TVITEMW item; + struct hierarchy_data *data; + DWORD selection; + + memset(&item, 0, sizeof(item)); + item.mask = TVIF_HANDLE | TVIF_PARAM; + item.hItem = (HTREEITEM)SendMessageW(tree, TVM_GETNEXTITEM, TVGN_CARET, + (LPARAM)NULL); + SendMessageW(tree, TVM_GETITEMW, 0, (LPARAM)&item); + data = get_hierarchy_data_from_tree_item(tree, item.hItem); + selection = lparam_to_index(data, item.lParam); + if (selection != 0) + { + CRYPT_PROVIDER_SGNR *provSigner; + CRYPTUI_VIEWCERTIFICATE_STRUCTW viewInfo; + BOOL changed = FALSE; + + provSigner = WTHelperGetProvSignerFromChain( + (CRYPT_PROVIDER_DATA *)data->pCertViewInfo->u.pCryptProviderData, + data->pCertViewInfo->idxSigner, + data->pCertViewInfo->fCounterSigner, + data->pCertViewInfo->idxCounterSigner); + memset(&viewInfo, 0, sizeof(viewInfo)); + viewInfo.dwSize = sizeof(viewInfo); + viewInfo.dwFlags = data->pCertViewInfo->dwFlags; + viewInfo.szTitle = data->pCertViewInfo->szTitle; + viewInfo.pCertContext = provSigner->pasCertChain[selection].pCert; + viewInfo.cStores = data->pCertViewInfo->cStores; + viewInfo.rghStores = data->pCertViewInfo->rghStores; + viewInfo.cPropSheetPages = data->pCertViewInfo->cPropSheetPages; + viewInfo.rgPropSheetPages = data->pCertViewInfo->rgPropSheetPages; + viewInfo.nStartPage = data->pCertViewInfo->nStartPage; + CryptUIDlgViewCertificateW(&viewInfo, &changed); + if (changed) + { + /* Delete the contents of the tree */ + SendMessageW(tree, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT); + /* Reinitialize the tree */ + show_cert_hierarchy(hwnd, data); + } + } +} + +static LRESULT CALLBACK hierarchy_dlg_proc(HWND hwnd, UINT msg, WPARAM wp, + LPARAM lp) +{ + PROPSHEETPAGEW *page; + struct hierarchy_data *data; + LRESULT ret = 0; + HWND tree = GetDlgItem(hwnd, IDC_CERTPATH); + + TRACE("(%p, %08x, %08lx, %08lx)\n", hwnd, msg, wp, lp); + + switch (msg) + { + case WM_INITDIALOG: + page = (PROPSHEETPAGEW *)lp; + data = (struct hierarchy_data *)page->lParam; + show_cert_hierarchy(hwnd, data); + break; + case WM_NOTIFY: + { + NMHDR *hdr; + + hdr = (NMHDR *)lp; + switch (hdr->code) + { + case TVN_SELCHANGEDW: + { + NMTREEVIEWW *nm = (NMTREEVIEWW*)lp; + DWORD selection; + CRYPT_PROVIDER_SGNR *provSigner; + + data = get_hierarchy_data_from_tree_item(tree, nm->itemNew.hItem); + selection = lparam_to_index(data, nm->itemNew.lParam); + provSigner = WTHelperGetProvSignerFromChain( + (CRYPT_PROVIDER_DATA *)data->pCertViewInfo->u.pCryptProviderData, + data->pCertViewInfo->idxSigner, + data->pCertViewInfo->fCounterSigner, + data->pCertViewInfo->idxCounterSigner); + EnableWindow(GetDlgItem(hwnd, IDC_VIEWCERTIFICATE), selection != 0); + set_certificate_status(GetDlgItem(hwnd, IDC_CERTIFICATESTATUSTEXT), + &provSigner->pasCertChain[selection]); + break; + } + case NM_DBLCLK: + show_dialog_for_selected_cert(hwnd); + SetWindowLongPtrW(hwnd, DWLP_MSGRESULT, 1); + ret = 1; + break; + } + break; + } + case WM_COMMAND: + switch (wp) + { + case IDC_VIEWCERTIFICATE: + show_dialog_for_selected_cert(hwnd); + break; + } + break; + case WM_REFRESH_VIEW: + { + TVITEMW item; + + /* Get hierarchy data */ + memset(&item, 0, sizeof(item)); + item.mask = TVIF_HANDLE | TVIF_PARAM; + item.hItem = (HTREEITEM)SendMessageW(tree, TVM_GETNEXTITEM, TVGN_ROOT, + (LPARAM)NULL); + data = get_hierarchy_data_from_tree_item(tree, item.hItem); + /* Delete the contents of the tree */ + SendMessageW(tree, TVM_DELETEITEM, 0, (LPARAM)TVI_ROOT); + /* Reinitialize the tree */ + show_cert_hierarchy(hwnd, data); + break; + } + } + return ret; +} + +static UINT CALLBACK hierarchy_callback(HWND hwnd, UINT msg, + PROPSHEETPAGEW *page) +{ + struct hierarchy_data *data; + + switch (msg) + { + case PSPCB_RELEASE: + data = (struct hierarchy_data *)page->lParam; + ImageList_Destroy(data->imageList); + HeapFree(GetProcessHeap(), 0, data); + break; + } + return 0; +} + +static BOOL init_hierarchy_page(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, + PROPSHEETPAGEW *page) +{ + struct hierarchy_data *data = HeapAlloc(GetProcessHeap(), 0, + sizeof(struct hierarchy_data)); + BOOL ret = FALSE; + + if (data) + { + data->imageList = ImageList_Create(16, 16, ILC_COLOR4 | ILC_MASK, 2, 0); + if (data->imageList) + { + HBITMAP bmp; + COLORREF backColor = RGB(255, 0, 255); + + data->pCertViewInfo = pCertViewInfo; + data->selectedCert = 0xffffffff; + + bmp = LoadBitmapW(hInstance, MAKEINTRESOURCEW(IDB_SMALL_ICONS)); + ImageList_AddMasked(data->imageList, bmp, backColor); + DeleteObject(bmp); + ImageList_SetBkColor(data->imageList, CLR_NONE); + + memset(page, 0, sizeof(PROPSHEETPAGEW)); + page->dwSize = sizeof(PROPSHEETPAGEW); + page->dwFlags = PSP_USECALLBACK; + page->hInstance = hInstance; + page->u.pszTemplate = MAKEINTRESOURCEW(IDD_HIERARCHY); + page->pfnDlgProc = hierarchy_dlg_proc; + page->lParam = (LPARAM)data; + page->pfnCallback = hierarchy_callback; + ret = TRUE; + } + else + HeapFree(GetProcessHeap(), 0, data); + } + return ret; +} + +static int CALLBACK cert_prop_sheet_proc(HWND hwnd, UINT msg, LPARAM lp) +{ + RECT rc; + POINT topLeft; + + TRACE("(%p, %08x, %08lx)\n", hwnd, msg, lp); + + switch (msg) + { + case PSCB_INITIALIZED: + /* Get cancel button's position.. */ + GetWindowRect(GetDlgItem(hwnd, IDCANCEL), &rc); + topLeft.x = rc.left; + topLeft.y = rc.top; + ScreenToClient(hwnd, &topLeft); + /* hide the cancel button.. */ + ShowWindow(GetDlgItem(hwnd, IDCANCEL), FALSE); + /* get the OK button's size.. */ + GetWindowRect(GetDlgItem(hwnd, IDOK), &rc); + /* and move the OK button to the cancel button's original position. */ + MoveWindow(GetDlgItem(hwnd, IDOK), topLeft.x, topLeft.y, + rc.right - rc.left, rc.bottom - rc.top, FALSE); + GetWindowRect(GetDlgItem(hwnd, IDOK), &rc); + break; + } + return 0; +} + +static BOOL show_cert_dialog(PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, + CRYPT_PROVIDER_CERT *provCert, BOOL *pfPropertiesChanged) +{ + static const WCHAR riched[] = { 'r','i','c','h','e','d','2','0',0 }; + DWORD nPages; + PROPSHEETPAGEW *pages; + BOOL ret = FALSE; + HMODULE lib = LoadLibraryW(riched); + + nPages = pCertViewInfo->cPropSheetPages + 1; /* one for the General tab */ + if (!(pCertViewInfo->dwFlags & CRYPTUI_HIDE_DETAILPAGE)) + nPages++; + if (!(pCertViewInfo->dwFlags & CRYPTUI_HIDE_HIERARCHYPAGE)) + nPages++; + pages = HeapAlloc(GetProcessHeap(), 0, nPages * sizeof(PROPSHEETPAGEW)); + if (pages) + { + PROPSHEETHEADERW hdr; + CRYPTUI_INITDIALOG_STRUCT *init = NULL; + DWORD i; + + memset(&hdr, 0, sizeof(hdr)); + hdr.dwSize = sizeof(hdr); + hdr.dwFlags = PSH_NOAPPLYNOW | PSH_PROPSHEETPAGE | PSH_USECALLBACK; + hdr.hInstance = hInstance; + if (pCertViewInfo->szTitle) + hdr.pszCaption = pCertViewInfo->szTitle; + else + hdr.pszCaption = MAKEINTRESOURCEW(IDS_CERTIFICATE); + init_general_page(pCertViewInfo, &pages[hdr.nPages++]); + if (!(pCertViewInfo->dwFlags & CRYPTUI_HIDE_DETAILPAGE)) + { + if (init_detail_page(pCertViewInfo, pfPropertiesChanged, + &pages[hdr.nPages])) + hdr.nPages++; + } + if (!(pCertViewInfo->dwFlags & CRYPTUI_HIDE_HIERARCHYPAGE)) + { + if (init_hierarchy_page(pCertViewInfo, &pages[hdr.nPages])) + hdr.nPages++; + } + /* Copy each additional page, and create the init dialog struct for it + */ + if (pCertViewInfo->cPropSheetPages) + { + init = HeapAlloc(GetProcessHeap(), 0, + pCertViewInfo->cPropSheetPages * + sizeof(CRYPTUI_INITDIALOG_STRUCT)); + if (init) + { + for (i = 0; i < pCertViewInfo->cPropSheetPages; i++) + { + memcpy(&pages[hdr.nPages + i], + &pCertViewInfo->rgPropSheetPages[i], + sizeof(PROPSHEETPAGEW)); + init[i].lParam = pCertViewInfo->rgPropSheetPages[i].lParam; + init[i].pCertContext = pCertViewInfo->pCertContext; + pages[hdr.nPages + i].lParam = (LPARAM)&init[i]; + } + if (pCertViewInfo->nStartPage & 0x8000) + { + /* Start page index is relative to the number of default + * pages + */ + hdr.u2.nStartPage = pCertViewInfo->nStartPage + hdr.nPages; + } + else + hdr.u2.nStartPage = pCertViewInfo->nStartPage; + hdr.nPages = nPages; + ret = TRUE; + } + else + SetLastError(ERROR_OUTOFMEMORY); + } + else + { + /* Ignore the relative flag if there aren't any additional pages */ + hdr.u2.nStartPage = pCertViewInfo->nStartPage & 0x7fff; + ret = TRUE; + } + if (ret) + { + INT_PTR l; + + hdr.u3.ppsp = pages; + hdr.pfnCallback = cert_prop_sheet_proc; + l = PropertySheetW(&hdr); + if (l == 0) + { + SetLastError(ERROR_CANCELLED); + ret = FALSE; + } + } + HeapFree(GetProcessHeap(), 0, init); + HeapFree(GetProcessHeap(), 0, pages); + } + else + SetLastError(ERROR_OUTOFMEMORY); + FreeLibrary(lib); + return ret; +} + +/*********************************************************************** + * CryptUIDlgViewCertificateW (CRYPTUI.@) + */ +BOOL WINAPI CryptUIDlgViewCertificateW( + PCCRYPTUI_VIEWCERTIFICATE_STRUCTW pCertViewInfo, BOOL *pfPropertiesChanged) +{ + static GUID generic_cert_verify = WINTRUST_ACTION_GENERIC_CERT_VERIFY; + CRYPTUI_VIEWCERTIFICATE_STRUCTW viewInfo; + WINTRUST_DATA wvt; + WINTRUST_CERT_INFO cert; + BOOL ret = FALSE; + CRYPT_PROVIDER_SGNR *signer; + CRYPT_PROVIDER_CERT *provCert = NULL; + + TRACE("(%p, %p)\n", pCertViewInfo, pfPropertiesChanged); + + if (pCertViewInfo->dwSize != sizeof(CRYPTUI_VIEWCERTIFICATE_STRUCTW)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + /* Make a local copy in case we have to call WinVerifyTrust ourselves */ + memcpy(&viewInfo, pCertViewInfo, sizeof(viewInfo)); + if (!viewInfo.u.hWVTStateData) + { + memset(&wvt, 0, sizeof(wvt)); + wvt.cbStruct = sizeof(wvt); + wvt.dwUIChoice = WTD_UI_NONE; + if (viewInfo.dwFlags & + CRYPTUI_ENABLE_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT) + wvt.fdwRevocationChecks |= WTD_REVOCATION_CHECK_CHAIN_EXCLUDE_ROOT; + if (viewInfo.dwFlags & CRYPTUI_ENABLE_REVOCATION_CHECK_END_CERT) + wvt.fdwRevocationChecks |= WTD_REVOCATION_CHECK_END_CERT; + if (viewInfo.dwFlags & CRYPTUI_ENABLE_REVOCATION_CHECK_CHAIN) + wvt.fdwRevocationChecks |= WTD_REVOCATION_CHECK_CHAIN; + wvt.dwUnionChoice = WTD_CHOICE_CERT; + memset(&cert, 0, sizeof(cert)); + cert.cbStruct = sizeof(cert); + cert.psCertContext = (CERT_CONTEXT *)viewInfo.pCertContext; + cert.chStores = viewInfo.cStores; + cert.pahStores = viewInfo.rghStores; + wvt.u.pCert = &cert; + wvt.dwStateAction = WTD_STATEACTION_VERIFY; + WinVerifyTrust(NULL, &generic_cert_verify, &wvt); + viewInfo.u.pCryptProviderData = + WTHelperProvDataFromStateData(wvt.hWVTStateData); + signer = WTHelperGetProvSignerFromChain( + (CRYPT_PROVIDER_DATA *)viewInfo.u.pCryptProviderData, 0, FALSE, 0); + provCert = WTHelperGetProvCertFromChain(signer, 0); + ret = TRUE; + } + else + { + viewInfo.u.pCryptProviderData = + WTHelperProvDataFromStateData(viewInfo.u.hWVTStateData); + signer = WTHelperGetProvSignerFromChain( + (CRYPT_PROVIDER_DATA *)viewInfo.u.pCryptProviderData, + viewInfo.idxSigner, viewInfo.fCounterSigner, + viewInfo.idxCounterSigner); + provCert = WTHelperGetProvCertFromChain(signer, viewInfo.idxCert); + ret = TRUE; + } + if (ret) + { + ret = show_cert_dialog(&viewInfo, provCert, pfPropertiesChanged); + if (!viewInfo.u.hWVTStateData) + { + wvt.dwStateAction = WTD_STATEACTION_CLOSE; + WinVerifyTrust(NULL, &generic_cert_verify, &wvt); + } + } + return ret; +} + +/*********************************************************************** + * CryptUIDlgViewContext (CRYPTUI.@) + */ +BOOL WINAPI CryptUIDlgViewContext(DWORD dwContextType, LPVOID pvContext, + HWND hwnd, LPCWSTR pwszTitle, DWORD dwFlags, LPVOID pvReserved) +{ + BOOL ret; + + TRACE("(%d, %p, %p, %s, %08x, %p)\n", dwContextType, pvContext, hwnd, + debugstr_w(pwszTitle), dwFlags, pvReserved); + + switch (dwContextType) + { + case CERT_STORE_CERTIFICATE_CONTEXT: + { + CRYPTUI_VIEWCERTIFICATE_STRUCTW viewInfo; + + memset(&viewInfo, 0, sizeof(viewInfo)); + viewInfo.dwSize = sizeof(viewInfo); + viewInfo.hwndParent = hwnd; + viewInfo.szTitle = pwszTitle; + viewInfo.pCertContext = pvContext; + ret = CryptUIDlgViewCertificateW(&viewInfo, NULL); + break; + } + default: + FIXME("unimplemented for context type %d\n", dwContextType); + SetLastError(E_INVALIDARG); + ret = FALSE; + } + return ret; } static PCCERT_CONTEXT make_cert_from_file(LPCWSTR fileName) diff --git a/dlls/cryptui/smallicons.bmp b/dlls/cryptui/smallicons.bmp new file mode 100644 index 0000000000000000000000000000000000000000..a936781472d771f50525ddb044257de8d7de0865 GIT binary patch literal 2358 zcwX(4I}XDj42IpYTgM)uW2YRTd++3<P=`LLzD-qRJ5O>sQp zc*b#y;{x}*vFu9=5YF@(;5ZTx?g|ibgD37%5~SIHsCmH4OgsY6d={*(>pEaU2xelG z5`gBQR#qNbojXh>w_Cs@3`0CtZ;_nh&=Hv&GoyC8RJ_#a+dNjU7@TH}tdG|(N1u^Y zzZhnzPh6z5DfZN-)^km&W?6lc2iNHG_S_PM)0yY#r0B}J`I pM})p*oP317AXR!gGI#Zh-@9M$@re5TBBH literal 0 HcwPel00001 diff --git a/dlls/d3d8/d3d8_private.h b/dlls/d3d8/d3d8_private.h index c8051dcd8e3..b9850b6aa80 100644 --- a/dlls/d3d8/d3d8_private.h +++ b/dlls/d3d8/d3d8_private.h @@ -170,7 +170,7 @@ typedef void * shader_handle; struct FvfToDecl { DWORD fvf; - IWineD3DVertexDeclaration *decl; + struct IDirect3DVertexDeclaration8 *decl; }; struct IDirect3DDevice8Impl @@ -531,11 +531,12 @@ typedef struct { DWORD elements_size; /* Size of elements, in bytes */ IWineD3DVertexDeclaration *wined3d_vertex_declaration; + DWORD shader_handle; } IDirect3DVertexDeclaration8Impl; /***************************************************************************** - * IDirect3DVertexShader9 interface + * IDirect3DVertexShader8 interface */ #define INTERFACE IDirect3DVertexShader8 DECLARE_INTERFACE_(IDirect3DVertexShader8, IUnknown) @@ -544,9 +545,6 @@ DECLARE_INTERFACE_(IDirect3DVertexShader8, IUnknown) STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; - /*** IDirect3DVertexShader9 methods ***/ - STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice8** ppDevice) PURE; - STDMETHOD(GetFunction)(THIS_ void*, UINT* pSizeOfData) PURE; }; #undef INTERFACE @@ -554,16 +552,13 @@ DECLARE_INTERFACE_(IDirect3DVertexShader8, IUnknown) #define IDirect3DVertexShader8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) #define IDirect3DVertexShader8_AddRef(p) (p)->lpVtbl->AddRef(p) #define IDirect3DVertexShader8_Release(p) (p)->lpVtbl->Release(p) -/*** IDirect3DVertexShader8 methods ***/ -#define IDirect3DVertexShader8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DVertexShader8_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) /* ------------------------- */ /* IDirect3DVertexShader8Impl */ /* ------------------------- */ /***************************************************************************** - * IDirect3DPixelShader9 interface + * IDirect3DPixelShader8 interface */ #define INTERFACE IDirect3DPixelShader8 DECLARE_INTERFACE_(IDirect3DPixelShader8,IUnknown) @@ -572,9 +567,6 @@ DECLARE_INTERFACE_(IDirect3DPixelShader8,IUnknown) STDMETHOD_(HRESULT,QueryInterface)(THIS_ REFIID riid, void** ppvObject) PURE; STDMETHOD_(ULONG,AddRef)(THIS) PURE; STDMETHOD_(ULONG,Release)(THIS) PURE; - /*** IDirect3DPixelShader8 methods ***/ - STDMETHOD(GetDevice)(THIS_ struct IDirect3DDevice8** ppDevice) PURE; - STDMETHOD(GetFunction)(THIS_ void*, UINT* pSizeOfData) PURE; }; #undef INTERFACE @@ -582,10 +574,6 @@ DECLARE_INTERFACE_(IDirect3DPixelShader8,IUnknown) #define IDirect3DPixelShader8_QueryInterface(p,a,b) (p)->lpVtbl->QueryInterface(p,a,b) #define IDirect3DPixelShader8_AddRef(p) (p)->lpVtbl->AddRef(p) #define IDirect3DPixelShader8_Release(p) (p)->lpVtbl->Release(p) -/*** IDirect3DPixelShader8 methods ***/ -#define IDirect3DPixelShader8_GetDevice(p,a) (p)->lpVtbl->GetDevice(p,a) -#define IDirect3DPixelShader8_GetFunction(p,a,b) (p)->lpVtbl->GetFunction(p,a,b) - /***************************************************************************** * Predeclare the interface implementation structures @@ -600,7 +588,6 @@ struct IDirect3DVertexShader8Impl { const IDirect3DVertexShader8Vtbl *lpVtbl; LONG ref; - DWORD handle; IDirect3DVertexDeclaration8 *vertex_declaration; IWineD3DVertexShader *wineD3DVertexShader; }; @@ -624,7 +611,6 @@ typedef struct IDirect3DPixelShader8Impl { LONG ref; DWORD handle; - /* The device, to be replaced by an IDirect3DDeviceImpl */ IWineD3DPixelShader *wineD3DPixelShader; } IDirect3DPixelShader8Impl; @@ -638,11 +624,6 @@ UINT convert_to_wined3d_declaration(const DWORD *d3d8_elements, DWORD *d3d8_elem size_t parse_token(const DWORD* pToken); /* Callbacks */ -extern HRESULT WINAPI D3D8CB_CreateSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height, - WINED3DFORMAT Format, DWORD Usage, WINED3DPOOL Pool, UINT Level, - WINED3DCUBEMAP_FACES Face, IWineD3DSurface** ppSurface, - HANDLE* pSharedHandle); - extern HRESULT WINAPI D3D8CB_CreateVolume(IUnknown *pDevice, IUnknown *pSuperior, UINT Width, UINT Height, UINT Depth, WINED3DFORMAT Format, WINED3DPOOL Pool, DWORD Usage, IWineD3DVolume **ppVolume, diff --git a/dlls/d3d8/device.c b/dlls/d3d8/device.c index f9a0150b4fa..648422532fa 100644 --- a/dlls/d3d8/device.c +++ b/dlls/d3d8/device.c @@ -36,6 +36,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(d3d8); +static HRESULT WINAPI D3D8CB_CreateSurface(IUnknown*,IUnknown*,UINT,UINT,WINED3DFORMAT,DWORD,WINED3DPOOL,UINT,WINED3DCUBEMAP_FACES,IWineD3DSurface**,HANDLE*); + + /* Shader handle functions */ static shader_handle *alloc_shader_handle(IDirect3DDevice8Impl *This) { if (This->free_shader_handles) { @@ -104,7 +107,7 @@ static ULONG WINAPI IDirect3DDevice8Impl_Release(LPDIRECT3DDEVICE8 iface) { This->inDestruction = TRUE; for(i = 0; i < This->numConvertedDecls; i++) { - IWineD3DVertexDeclaration_Release(This->decls[i].decl); + IDirect3DVertexDeclaration8_Release(This->decls[i].decl); } HeapFree(GetProcessHeap(), 0, This->decls); @@ -1537,6 +1540,7 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8 IDirect3DVertexShader8Impl *object; IWineD3DVertexDeclaration *wined3d_vertex_declaration; const DWORD *token = pDeclaration; + shader_handle *handle; /* Test if the vertex declaration is valid */ while (D3DVSD_END() != *token) { @@ -1575,41 +1579,57 @@ static HRESULT WINAPI IDirect3DDevice8Impl_CreateVertexShader(LPDIRECT3DDEVICE8 *ppShader = 0; return D3DERR_INVALIDCALL; } - wined3d_vertex_declaration = ((IDirect3DVertexDeclaration8Impl *)object->vertex_declaration)->wined3d_vertex_declaration; - /* Usage is missing ... Use SetRenderState to set the sw vp render state in SetVertexShader */ - hrc = IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, wined3d_vertex_declaration, pFunction, &object->wineD3DVertexShader, (IUnknown *)object); - - if (FAILED(hrc)) { - /* free up object */ - FIXME("Call to IWineD3DDevice_CreateVertexShader failed\n"); + handle = alloc_shader_handle(This); + if (!handle) + { + ERR("Failed to allocate shader handle\n"); + LeaveCriticalSection(&d3d8_cs); + IDirect3DVertexDeclaration8_Release(object->vertex_declaration); HeapFree(GetProcessHeap(), 0, object); *ppShader = 0; - } else { - /* TODO: Store the VS declarations locally so that they can be dereferenced with a value higher than VS_HIGHESTFIXEDFXF */ - shader_handle *handle = alloc_shader_handle(This); - if (!handle) { - ERR("Failed to allocate shader handle\n"); - IDirect3DVertexShader8_Release((IUnknown *)object); - hrc = E_OUTOFMEMORY; - } else { - *handle = object; - object->handle = (handle - This->shader_handles) + VS_HIGHESTFIXEDFXF + 1; - *ppShader = object->handle; + return E_OUTOFMEMORY; + } + else + { + DWORD shader_handle = (handle - This->shader_handles) + VS_HIGHESTFIXEDFXF + 1; + *handle = object; + *ppShader = ((IDirect3DVertexDeclaration8Impl *)object->vertex_declaration)->shader_handle = shader_handle; + } + wined3d_vertex_declaration = ((IDirect3DVertexDeclaration8Impl *)object->vertex_declaration)->wined3d_vertex_declaration; + + if (pFunction) + { + /* Usage is missing ... Use SetRenderState to set the sw vp render state in SetVertexShader */ + hrc = IWineD3DDevice_CreateVertexShader(This->WineD3DDevice, wined3d_vertex_declaration, + pFunction, &object->wineD3DVertexShader, (IUnknown *)object); + + if (FAILED(hrc)) + { + /* free up object */ + FIXME("Call to IWineD3DDevice_CreateVertexShader failed\n"); + free_shader_handle(This, handle); + IDirect3DVertexDeclaration8_Release(object->vertex_declaration); + HeapFree(GetProcessHeap(), 0, object); + *ppShader = 0; + } + else + { load_local_constants(pDeclaration, object->wineD3DVertexShader); TRACE("(%p) : returning %p (handle %#x)\n", This, object, *ppShader); } } + LeaveCriticalSection(&d3d8_cs); return hrc; } -static IWineD3DVertexDeclaration *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8Impl *This, DWORD fvf) +static IDirect3DVertexDeclaration8Impl *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8Impl *This, DWORD fvf) { + IDirect3DVertexDeclaration8Impl *d3d8_declaration; HRESULT hr; - IWineD3DVertexDeclaration* pDecl = NULL; int p, low, high; /* deliberately signed */ struct FvfToDecl *convertedDecls = This->decls; @@ -1622,7 +1642,7 @@ static IWineD3DVertexDeclaration *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8 TRACE("%d ", p); if(convertedDecls[p].fvf == fvf) { TRACE("found %p\n", convertedDecls[p].decl); - return convertedDecls[p].decl; + return (IDirect3DVertexDeclaration8Impl *)convertedDecls[p].decl; } else if(convertedDecls[p].fvf < fvf) { low = p + 1; } else { @@ -1631,11 +1651,27 @@ static IWineD3DVertexDeclaration *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8 } TRACE("not found. Creating and inserting at position %d.\n", low); + d3d8_declaration = HeapAlloc(GetProcessHeap(), 0, sizeof(*d3d8_declaration)); + if (!d3d8_declaration) + { + ERR("Memory allocation failed.\n"); + return NULL; + } + + d3d8_declaration->ref_count = 1; + d3d8_declaration->lpVtbl = &Direct3DVertexDeclaration8_Vtbl; + d3d8_declaration->elements = NULL; + d3d8_declaration->elements_size = 0; + d3d8_declaration->shader_handle = fvf; + hr = IWineD3DDevice_CreateVertexDeclarationFromFVF(This->WineD3DDevice, - &pDecl, - (IUnknown *) This, - fvf); - if (FAILED(hr)) return NULL; + &d3d8_declaration->wined3d_vertex_declaration, (IUnknown *)d3d8_declaration, fvf); + if (FAILED(hr)) + { + ERR("Failed to create wined3d vertex declaration.\n"); + HeapFree(GetProcessHeap(), 0, d3d8_declaration); + return NULL; + } if(This->declArraySize == This->numConvertedDecls) { int grow = This->declArraySize / 2; @@ -1643,7 +1679,7 @@ static IWineD3DVertexDeclaration *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8 sizeof(convertedDecls[0]) * (This->numConvertedDecls + grow)); if(!convertedDecls) { /* This will destroy it */ - IWineD3DVertexDeclaration_Release(pDecl); + IDirect3DVertexDeclaration8_Release((IDirect3DVertexDeclaration8 *)d3d8_declaration); return NULL; } This->decls = convertedDecls; @@ -1651,12 +1687,12 @@ static IWineD3DVertexDeclaration *IDirect3DDevice8Impl_FindDecl(IDirect3DDevice8 } memmove(convertedDecls + low + 1, convertedDecls + low, sizeof(convertedDecls[0]) * (This->numConvertedDecls - low)); - convertedDecls[low].decl = pDecl; + convertedDecls[low].decl = (IDirect3DVertexDeclaration8 *)d3d8_declaration; convertedDecls[low].fvf = fvf; This->numConvertedDecls++; - TRACE("Returning %p. %d decls in array\n", pDecl, This->numConvertedDecls); - return pDecl; + TRACE("Returning %p. %u decls in array\n", d3d8_declaration, This->numConvertedDecls); + return d3d8_declaration; } static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 iface, DWORD pShader) { @@ -1666,9 +1702,9 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa TRACE("(%p) : Relay\n", This); EnterCriticalSection(&d3d8_cs); if (VS_HIGHESTFIXEDFXF >= pShader) { - TRACE("Setting FVF, %d %d\n", VS_HIGHESTFIXEDFXF, pShader); - IWineD3DDevice_SetFVF(This->WineD3DDevice, pShader); - IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice, IDirect3DDevice8Impl_FindDecl(This, pShader)); + TRACE("Setting FVF, %#x\n", pShader); + IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice, + IDirect3DDevice8Impl_FindDecl(This, pShader)->wined3d_vertex_declaration); IWineD3DDevice_SetVertexShader(This->WineD3DDevice, NULL); } else { TRACE("Setting shader\n"); @@ -1677,9 +1713,19 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa hrc = D3DERR_INVALIDCALL; } else { IDirect3DVertexShader8Impl *shader = This->shader_handles[pShader - (VS_HIGHESTFIXEDFXF + 1)]; - IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice, - shader ? ((IDirect3DVertexDeclaration8Impl *)shader->vertex_declaration)->wined3d_vertex_declaration : NULL); - hrc = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, 0 == shader ? NULL : shader->wineD3DVertexShader); + + if (shader) + { + hrc = IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice, + ((IDirect3DVertexDeclaration8Impl *)shader->vertex_declaration)->wined3d_vertex_declaration); + if (SUCCEEDED(hrc)) + hrc = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, shader->wineD3DVertexShader); + } + else + { + hrc = IWineD3DDevice_SetVertexDeclaration(This->WineD3DDevice, NULL); + if (SUCCEEDED(hrc)) hrc = IWineD3DDevice_SetVertexShader(This->WineD3DDevice, NULL); + } } } TRACE("(%p) : returning hr(%u)\n", This, hrc); @@ -1690,24 +1736,36 @@ static HRESULT WINAPI IDirect3DDevice8Impl_SetVertexShader(LPDIRECT3DDEVICE8 ifa static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShader(LPDIRECT3DDEVICE8 iface, DWORD* ppShader) { IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - IWineD3DVertexShader *pShader; - HRESULT hrc = D3D_OK; + IWineD3DVertexDeclaration *wined3d_declaration; + HRESULT hrc; TRACE("(%p) : Relay device@%p\n", This, This->WineD3DDevice); EnterCriticalSection(&d3d8_cs); - hrc = IWineD3DDevice_GetVertexShader(This->WineD3DDevice, &pShader); - if (D3D_OK == hrc) { - if(0 != pShader) { - IDirect3DVertexShader8Impl *d3d8_shader; - hrc = IWineD3DVertexShader_GetParent(pShader, (IUnknown **)&d3d8_shader); - IWineD3DVertexShader_Release(pShader); - *ppShader = d3d8_shader->handle; - } else { + + hrc = IWineD3DDevice_GetVertexDeclaration(This->WineD3DDevice, &wined3d_declaration); + if (SUCCEEDED(hrc)) + { + if (wined3d_declaration) + { + IDirect3DVertexDeclaration8 *d3d8_declaration; + hrc = IWineD3DVertexDeclaration_GetParent(wined3d_declaration, (IUnknown **)&d3d8_declaration); + IWineD3DVertexDeclaration_Release(wined3d_declaration); + if (SUCCEEDED(hrc)) + { + *ppShader = ((IDirect3DVertexDeclaration8Impl *)d3d8_declaration)->shader_handle; + IDirect3DVertexDeclaration8_Release(d3d8_declaration); + } + } + else + { *ppShader = 0; hrc = D3D_OK; } - } else { - WARN("(%p) : Call to IWineD3DDevice_GetVertexShader failed %u (device %p)\n", This, hrc, This->WineD3DDevice); + } + else + { + WARN("(%p) : Call to IWineD3DDevice_GetVertexDeclaration failed %#x (device %p)\n", + This, hrc, This->WineD3DDevice); } TRACE("(%p) : returning %#x\n", This, *ppShader); LeaveCriticalSection(&d3d8_cs); @@ -1819,7 +1877,16 @@ static HRESULT WINAPI IDirect3DDevice8Impl_GetVertexShaderFunction(LPDIRECT3DDEV } shader = This->shader_handles[pVertexShader - (VS_HIGHESTFIXEDFXF + 1)]; - hr = IWineD3DVertexShader_GetFunction(shader->wineD3DVertexShader, pData, pSizeOfData); + if (shader->wineD3DVertexShader) + { + hr = IWineD3DVertexShader_GetFunction(shader->wineD3DVertexShader, pData, pSizeOfData); + } + else + { + *pSizeOfData = 0; + hr = D3D_OK; + } + LeaveCriticalSection(&d3d8_cs); return hr; } @@ -2207,7 +2274,7 @@ const IDirect3DDevice8Vtbl Direct3DDevice8_Vtbl = }; /* Internal function called back during the CreateDevice to create a render target */ -HRESULT WINAPI D3D8CB_CreateSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height, +static HRESULT WINAPI D3D8CB_CreateSurface(IUnknown *device, IUnknown *pSuperior, UINT Width, UINT Height, WINED3DFORMAT Format, DWORD Usage, WINED3DPOOL Pool, UINT Level, WINED3DCUBEMAP_FACES Face, IWineD3DSurface **ppSurface, HANDLE *pSharedHandle) { diff --git a/dlls/d3d8/pixelshader.c b/dlls/d3d8/pixelshader.c index 3ad39e6a439..5cfb0ca25a4 100644 --- a/dlls/d3d8/pixelshader.c +++ b/dlls/d3d8/pixelshader.c @@ -62,34 +62,10 @@ static ULONG WINAPI IDirect3DPixelShader8Impl_Release(IDirect3DPixelShader8 * if return ref; } -/* IDirect3DPixelShader8 Interface follow: */ -static HRESULT WINAPI IDirect3DPixelShader8Impl_GetDevice(IDirect3DPixelShader8 *iface, IDirect3DDevice8 **ppDevice) { - IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface; - IWineD3DDevice *myDevice = NULL; - - TRACE("(%p) : Relay\n", This); - - IWineD3DPixelShader_GetDevice(This->wineD3DPixelShader, &myDevice); - IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice); - IWineD3DDevice_Release(myDevice); - TRACE("(%p) returning (%p)\n", This, *ppDevice); - return D3D_OK; -} - -static HRESULT WINAPI IDirect3DPixelShader8Impl_GetFunction(IDirect3DPixelShader8 *iface, VOID *pData, UINT *pSizeOfData) { - IDirect3DPixelShader8Impl *This = (IDirect3DPixelShader8Impl *)iface; - TRACE("(%p) Relay\n", This); - return IWineD3DPixelShader_GetFunction(This->wineD3DPixelShader, pData, pSizeOfData); -} - - const IDirect3DPixelShader8Vtbl Direct3DPixelShader8_Vtbl = { /* IUnknown */ IDirect3DPixelShader8Impl_QueryInterface, IDirect3DPixelShader8Impl_AddRef, IDirect3DPixelShader8Impl_Release, - /* IDirect3DPixelShader8 */ - IDirect3DPixelShader8Impl_GetDevice, - IDirect3DPixelShader8Impl_GetFunction }; diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 717f79c2839..444d89d6db1 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -869,6 +869,7 @@ static void test_shader(void) DWORD hPixelShader2 = 0, hVertexShader2 = 0; DWORD hTempHandle; D3DCAPS8 caps; + DWORD fvf = D3DFVF_XYZ | D3DFVF_DIFFUSE; DWORD data_size; void *data; @@ -928,7 +929,16 @@ static void test_shader(void) } IDirect3DDevice8_GetDeviceCaps(pDevice, &caps); + /* Test setting and retrieving a FVF */ + hr = IDirect3DDevice8_SetVertexShader(pDevice, fvf); + ok(SUCCEEDED(hr), "IDirect3DDevice8_SetVertexShader returned %#08x\n", hr); + hr = IDirect3DDevice8_GetVertexShader(pDevice, &hTempHandle); + ok(SUCCEEDED(hr), "IDirect3DDevice8_GetVertexShader returned %#08x\n", hr); + ok(hTempHandle == fvf, "Vertex shader %#08x is set, expected %#08x\n", hTempHandle, fvf); + /* First create a vertex shader */ + hr = IDirect3DDevice8_SetVertexShader(pDevice, 0); + ok(SUCCEEDED(hr), "IDirect3DDevice8_SetVertexShader returned %#08x\n", hr); hr = IDirect3DDevice8_CreateVertexShader(pDevice, dwVertexDecl, simple_vs, &hVertexShader, 0); ok(hr == D3D_OK, "IDirect3DDevice8_CreateVertexShader returned %#08x\n", hr); /* Msdn says that the new vertex shader is set immediately. This is wrong, apparently */ diff --git a/dlls/d3d8/vertexshader.c b/dlls/d3d8/vertexshader.c index 16a809ebd17..8cd822b2744 100644 --- a/dlls/d3d8/vertexshader.c +++ b/dlls/d3d8/vertexshader.c @@ -57,45 +57,16 @@ static ULONG WINAPI IDirect3DVertexShader8Impl_Release(IDirect3DVertexShader8 *i if (ref == 0) { IDirect3DVertexDeclaration8_Release(This->vertex_declaration); - IWineD3DVertexShader_Release(This->wineD3DVertexShader); + if (This->wineD3DVertexShader) IWineD3DVertexShader_Release(This->wineD3DVertexShader); HeapFree(GetProcessHeap(), 0, This); } return ref; } -/* IDirect3DVertexShader8 Interface follow: */ -static HRESULT WINAPI IDirect3DVertexShader8Impl_GetDevice(IDirect3DVertexShader8 *iface, IDirect3DDevice8** ppDevice) { - IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface; - IWineD3DDevice *myDevice = NULL; - HRESULT hr; - TRACE("(%p) : Relay\n", This); - - hr = IWineD3DVertexShader_GetDevice(This->wineD3DVertexShader, &myDevice); - if (WINED3D_OK == hr && myDevice != NULL) { - hr = IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice); - IWineD3DDevice_Release(myDevice); - } else { - *ppDevice = NULL; - } - TRACE("(%p) returning (%p)\n", This, *ppDevice); - return hr; -} - -static HRESULT WINAPI IDirect3DVertexShader8Impl_GetFunction(IDirect3DVertexShader8 *iface, VOID* pData, UINT* pSizeOfData) { - IDirect3DVertexShader8Impl *This = (IDirect3DVertexShader8Impl *)iface; - - TRACE("(%p) : Relay\n", This); - return IWineD3DVertexShader_GetFunction(This->wineD3DVertexShader, pData, pSizeOfData); -} - - const IDirect3DVertexShader8Vtbl Direct3DVertexShader8_Vtbl = { /* IUnknown */ IDirect3DVertexShader8Impl_QueryInterface, IDirect3DVertexShader8Impl_AddRef, IDirect3DVertexShader8Impl_Release, - /* IDirect3DVertexShader8 */ - IDirect3DVertexShader8Impl_GetDevice, - IDirect3DVertexShader8Impl_GetFunction }; diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 3bdd8ae8a94..693b82f7d9e 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -1314,7 +1314,6 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWO return hr; } } - hr = IWineD3DDevice_SetFVF(This->WineD3DDevice, FVF); LeaveCriticalSection(&d3d9_cs); return hr; @@ -1322,12 +1321,21 @@ static HRESULT WINAPI IDirect3DDevice9Impl_SetFVF(LPDIRECT3DDEVICE9EX iface, DWO static HRESULT WINAPI IDirect3DDevice9Impl_GetFVF(LPDIRECT3DDEVICE9EX iface, DWORD* pFVF) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; + IDirect3DVertexDeclaration9 *decl; HRESULT hr; TRACE("(%p) Relay\n" , This); - EnterCriticalSection(&d3d9_cs); - hr = IWineD3DDevice_GetFVF(This->WineD3DDevice, pFVF); - LeaveCriticalSection(&d3d9_cs); + hr = IDirect3DDevice9_GetVertexDeclaration(iface, &decl); + if (FAILED(hr)) + { + WARN("Failed to get vertex declaration, %#x\n", hr); + *pFVF = 0; + return hr; + } + + *pFVF = ((IDirect3DVertexDeclaration9Impl *)decl)->convFVF; + TRACE("Returning FVF %#x\n", *pFVF); + return hr; } diff --git a/dlls/d3d9/stateblock.c b/dlls/d3d9/stateblock.c index 22e1926026e..30b42c51adc 100644 --- a/dlls/d3d9/stateblock.c +++ b/dlls/d3d9/stateblock.c @@ -188,6 +188,6 @@ HRESULT WINAPI IDirect3DDevice9Impl_EndStateBlock(LPDIRECT3DDEVICE9EX iface, I IDirect3DDevice9Ex_AddRef(iface); object->parentDevice = iface; *ppSB=(IDirect3DStateBlock9*)object; - TRACE("(%p)Returning %p %p\n", This, *ppSB, wineD3DStateBlock); + TRACE("(%p) Returning *ppSB %p, wineD3DStateBlock %p\n", This, *ppSB, wineD3DStateBlock); return D3D_OK; } diff --git a/dlls/d3d9/tests/shader.c b/dlls/d3d9/tests/shader.c index dcf88519dc5..522f1280f2e 100644 --- a/dlls/d3d9/tests/shader.c +++ b/dlls/d3d9/tests/shader.c @@ -90,7 +90,11 @@ static void test_get_set_vertex_shader(IDirect3DDevice9 *device_ptr) HRESULT hret = 0; int shader_refcount = 0; int i = 0; - + + hret = IDirect3DDevice9_CreateVertexShader(device_ptr, NULL, &shader_ptr); + ok(hret == D3DERR_INVALIDCALL, "CreateVertexShader returned %#x, expected D3DERR_INVALIDCALL (%#x).\n", + hret, D3DERR_INVALIDCALL); + hret = IDirect3DDevice9_CreateVertexShader(device_ptr, simple_vs, &shader_ptr); ok(hret == D3D_OK && shader_ptr != NULL, "CreateVertexShader returned: hret 0x%x, shader_ptr %p. " "Expected hret 0x%x, shader_ptr != %p. Aborting.\n", hret, shader_ptr, D3D_OK, NULL); @@ -155,6 +159,10 @@ static void test_get_set_pixel_shader(IDirect3DDevice9 *device_ptr) int shader_refcount = 0; int i = 0; + hret = IDirect3DDevice9_CreatePixelShader(device_ptr, NULL, &shader_ptr); + ok(hret == D3DERR_INVALIDCALL, "CreatePixelShader returned %#x, expected D3DERR_INVALIDCALL (%#x).\n", + hret, D3DERR_INVALIDCALL); + hret = IDirect3DDevice9_CreatePixelShader(device_ptr, simple_ps, &shader_ptr); ok(hret == D3D_OK && shader_ptr != NULL, "CreatePixelShader returned: hret 0x%x, shader_ptr %p. " "Expected hret 0x%x, shader_ptr != %p. Aborting.\n", hret, shader_ptr, D3D_OK, NULL); diff --git a/dlls/d3d9/tests/stateblock.c b/dlls/d3d9/tests/stateblock.c index d2bfcba53ad..f8ee57dfd09 100644 --- a/dlls/d3d9/tests/stateblock.c +++ b/dlls/d3d9/tests/stateblock.c @@ -581,7 +581,7 @@ static const shader_constant_data shader_constant_default_data = { static const shader_constant_data shader_constant_test_data = { { 0xdead0000, 0xdead0001, 0xdead0002, 0xdead0003 }, - { 0.0f, 0.0f, 0.0f, 0.0f }, + { 5.0f, 6.0f, 7.0f, 8.0f }, { TRUE, FALSE, FALSE, TRUE } }; @@ -1459,6 +1459,110 @@ static void test_state_management( execute_test_chain_all(device, tests, tcount); } +static void test_shader_constant_apply(IDirect3DDevice9 *device) +{ + static const float initial[] = {0.0f, 0.0f, 0.0f, 0.0f}; + static const float vs_const[] = {1.0f, 2.0f, 3.0f, 4.0f}; + static const float ps_const[] = {5.0f, 6.0f, 7.0f, 8.0f}; + IDirect3DStateBlock9 *stateblock; + float ret[4]; + HRESULT hr; + + hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, initial, 1); + ok(SUCCEEDED(hr), "SetVertexShaderConstantF returned %#x\n", hr); + hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 1, initial, 1); + ok(SUCCEEDED(hr), "SetVertexShaderConstantF returned %#x\n", hr); + hr = IDirect3DDevice9_SetPixelShaderConstantF(device, 0, initial, 1); + ok(SUCCEEDED(hr), "SetPixelShaderConstantF returned %#x\n", hr); + hr = IDirect3DDevice9_SetPixelShaderConstantF(device, 1, initial, 1); + ok(SUCCEEDED(hr), "SetPixelShaderConstantF returned %#x\n", hr); + + hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, ret, 1); + ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 1, ret, 1); + ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 0, ret, 1); + ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "GetpixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 1, ret, 1); + ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "GetPixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + + hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 0, vs_const, 1); + ok(SUCCEEDED(hr), "SetVertexShaderConstantF returned %#x\n", hr); + hr = IDirect3DDevice9_SetPixelShaderConstantF(device, 0, ps_const, 1); + ok(SUCCEEDED(hr), "SetPixelShaderConstantF returned %#x\n", hr); + + hr = IDirect3DDevice9_BeginStateBlock(device); + ok(SUCCEEDED(hr), "BeginStateBlock returned %#x\n", hr); + + hr = IDirect3DDevice9_SetVertexShaderConstantF(device, 1, vs_const, 1); + ok(SUCCEEDED(hr), "SetVertexShaderConstantF returned %#x\n", hr); + hr = IDirect3DDevice9_SetPixelShaderConstantF(device, 1, ps_const, 1); + ok(SUCCEEDED(hr), "SetPixelShaderConstantF returned %#x\n", hr); + + hr = IDirect3DDevice9_EndStateBlock(device, &stateblock); + ok(SUCCEEDED(hr), "EndStateBlock returned %#x\n", hr); + + hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, ret, 1); + ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, vs_const, sizeof(vs_const)), + "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); + hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 1, ret, 1); + ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 0, ret, 1); + ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, ps_const, sizeof(ps_const)), + "GetPixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); + hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 1, ret, 1); + ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, initial, sizeof(initial)), + "GetPixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], initial[0], initial[1], initial[2], initial[3]); + + hr = IDirect3DStateBlock9_Apply(stateblock); + ok(SUCCEEDED(hr), "Apply returned %#x\n", hr); + + /* Apply doesn't overwrite constants that aren't explicitly set on the source stateblock. */ + hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 0, ret, 1); + ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, vs_const, sizeof(vs_const)), + "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); + hr = IDirect3DDevice9_GetVertexShaderConstantF(device, 1, ret, 1); + ok(SUCCEEDED(hr), "GetVertexShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, vs_const, sizeof(vs_const)), + "GetVertexShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], vs_const[0], vs_const[1], vs_const[2], vs_const[3]); + hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 0, ret, 1); + ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, ps_const, sizeof(ps_const)), + "GetPixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); + hr = IDirect3DDevice9_GetPixelShaderConstantF(device, 1, ret, 1); + ok(SUCCEEDED(hr), "GetPixelShaderConstantF returned %#x\n", hr); + ok(!memcmp(ret, ps_const, sizeof(ps_const)), + "GetPixelShaderConstantF got {%f, %f, %f, %f}, expected {%f, %f, %f, %f}\n", + ret[0], ret[1], ret[2], ret[3], ps_const[0], ps_const[1], ps_const[2], ps_const[3]); + + IDirect3DStateBlock9_Release(stateblock); +} + START_TEST(stateblock) { IDirect3DDevice9 *device_ptr = NULL; @@ -1477,6 +1581,7 @@ START_TEST(stateblock) test_begin_end_state_block(device_ptr); test_state_management(device_ptr, &device_pparams); + test_shader_constant_apply(device_ptr); if (device_ptr) IUnknown_Release(device_ptr); } diff --git a/dlls/d3d9/tests/vertexdeclaration.c b/dlls/d3d9/tests/vertexdeclaration.c index e0b28203179..36d22b46bbc 100644 --- a/dlls/d3d9/tests/vertexdeclaration.c +++ b/dlls/d3d9/tests/vertexdeclaration.c @@ -279,11 +279,8 @@ static HRESULT test_fvf_to_decl( return E_FAIL; } -static HRESULT test_decl_to_fvf( - IDirect3DDevice9* device, - DWORD default_fvf, - CONST D3DVERTEXELEMENT9 test_decl[], - DWORD test_fvf) +static HRESULT test_decl_to_fvf(IDirect3DDevice9* device, DWORD default_fvf, + const D3DVERTEXELEMENT9 test_decl[], DWORD test_fvf, BOOL todo) { HRESULT hr; @@ -310,9 +307,8 @@ static HRESULT test_decl_to_fvf( hr = IDirect3DDevice9_GetFVF( device, &result_fvf); ok(SUCCEEDED(hr), "GetFVF returned %#x, expected %#x\n", hr, D3D_OK); if (FAILED(hr)) goto fail; - todo_wine { - ok(test_fvf == result_fvf, "result FVF was: %#x, expected: %#x\n", result_fvf, test_fvf); - } + if (todo) todo_wine ok(test_fvf == result_fvf, "result FVF was: %#x, expected: %#x\n", result_fvf, test_fvf); + else ok(test_fvf == result_fvf, "result FVF was: %#x, expected: %#x\n", result_fvf, test_fvf); if (test_fvf != result_fvf) goto fail; IDirect3DDevice9_SetVertexDeclaration ( device, NULL ); @@ -348,64 +344,64 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice) { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 0 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZ)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZ, TRUE)); } { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_POSITIONT, 0 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZRHW)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, D3DFVF_XYZRHW, TRUE)); } for (i = 0; i < 4; i++) { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT1+i, 0, D3DDECLUSAGE_BLENDWEIGHT, 0}, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_UBYTE4, 0, D3DDECLUSAGE_BLENDINDICES, 0}, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_NORMAL, 0 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT1, 0, D3DDECLUSAGE_PSIZE, 0 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_D3DCOLOR, 0, D3DDECLUSAGE_COLOR, 0 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_D3DCOLOR, 0, D3DDECLUSAGE_COLOR, 1 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } /* Make sure textures of different sizes work */ { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT1, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_TEXCOORD, 0 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } /* Make sure the TEXCOORD index works correctly - try several textures */ @@ -415,25 +411,25 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice) { 0, 4, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_TEXCOORD, 1 }, { 0, 16, D3DDECLTYPE_FLOAT2, 0, D3DDECLUSAGE_TEXCOORD, 2 }, { 0, 24, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_TEXCOORD, 3 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } /* No FVF mapping available */ { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 1 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } { CONST D3DVERTEXELEMENT9 test_buffer[] = { { 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_NORMAL, 1 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } /* Try empty declaration */ { CONST D3DVERTEXELEMENT9 test_buffer[] = { D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } /* Now try a combination test */ @@ -445,7 +441,7 @@ static void test_fvf_decl_conversion(IDirect3DDevice9 *pDevice) { 0, 28, D3DDECLTYPE_D3DCOLOR, 0, D3DDECLUSAGE_COLOR, 1 }, { 0, 32, D3DDECLTYPE_FLOAT1, 0, D3DDECLUSAGE_TEXCOORD, 0 }, { 0, 44, D3DDECLTYPE_FLOAT4, 0, D3DDECLUSAGE_TEXCOORD, 1 }, D3DDECL_END() }; - VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0)); + VDECL_CHECK(test_decl_to_fvf(pDevice, default_fvf, test_buffer, 0, FALSE)); } /* Test conversions from FVF to a vertex declaration diff --git a/dlls/d3drm/math.c b/dlls/d3drm/math.c index 76b73c033e0..ff416b63841 100644 --- a/dlls/d3drm/math.c +++ b/dlls/d3drm/math.c @@ -30,10 +30,6 @@ #include "wingdi.h" #include "d3drmdef.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3drm); - /* Create a RGB color from its components */ D3DCOLOR WINAPI D3DRMCreateColorRGB(D3DVALUE red, D3DVALUE green, D3DVALUE blue) { diff --git a/dlls/d3dx8/mesh.c b/dlls/d3dx8/mesh.c index b9ba9760647..c1d242bf07c 100644 --- a/dlls/d3dx8/mesh.c +++ b/dlls/d3dx8/mesh.c @@ -20,10 +20,6 @@ #include "wingdi.h" #include "d3dx8.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *pmin, CONST D3DXVECTOR3 *pmax, CONST D3DXVECTOR3 *prayposition, CONST D3DXVECTOR3 *praydirection) /* Algorithm taken from the article: An Efficient and Robust Ray-Box Intersection Algoritm diff --git a/dlls/d3dx9_24/d3dx9_24_main.c b/dlls/d3dx9_24/d3dx9_24_main.c index bd3e5bd0a9b..cc6ffbf04e9 100644 --- a/dlls/d3dx9_24/d3dx9_24_main.c +++ b/dlls/d3dx9_24/d3dx9_24_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_25/d3dx9_25_main.c b/dlls/d3dx9_25/d3dx9_25_main.c index 2820664b6b1..57a066964a8 100644 --- a/dlls/d3dx9_25/d3dx9_25_main.c +++ b/dlls/d3dx9_25/d3dx9_25_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_26/d3dx9_26_main.c b/dlls/d3dx9_26/d3dx9_26_main.c index 3924412511e..1ce818b5b50 100644 --- a/dlls/d3dx9_26/d3dx9_26_main.c +++ b/dlls/d3dx9_26/d3dx9_26_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_27/d3dx9_27_main.c b/dlls/d3dx9_27/d3dx9_27_main.c index 1dfe8e02b19..15919832ccd 100644 --- a/dlls/d3dx9_27/d3dx9_27_main.c +++ b/dlls/d3dx9_27/d3dx9_27_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_28/d3dx9_28_main.c b/dlls/d3dx9_28/d3dx9_28_main.c index 044c47059c5..2157eec4324 100644 --- a/dlls/d3dx9_28/d3dx9_28_main.c +++ b/dlls/d3dx9_28/d3dx9_28_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_29/d3dx9_29_main.c b/dlls/d3dx9_29/d3dx9_29_main.c index a111c3a70f4..5782417710e 100644 --- a/dlls/d3dx9_29/d3dx9_29_main.c +++ b/dlls/d3dx9_29/d3dx9_29_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_30/d3dx9_30_main.c b/dlls/d3dx9_30/d3dx9_30_main.c index f22a9344cbb..ae131156924 100644 --- a/dlls/d3dx9_30/d3dx9_30_main.c +++ b/dlls/d3dx9_30/d3dx9_30_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_31/d3dx9_31_main.c b/dlls/d3dx9_31/d3dx9_31_main.c index 44dd5342027..3f38b840b53 100644 --- a/dlls/d3dx9_31/d3dx9_31_main.c +++ b/dlls/d3dx9_31/d3dx9_31_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_32/d3dx9_32_main.c b/dlls/d3dx9_32/d3dx9_32_main.c index 74745fb3da2..90888225952 100644 --- a/dlls/d3dx9_32/d3dx9_32_main.c +++ b/dlls/d3dx9_32/d3dx9_32_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_33/d3dx9_33_main.c b/dlls/d3dx9_33/d3dx9_33_main.c index 862e0f13923..afe8947b1b6 100644 --- a/dlls/d3dx9_33/d3dx9_33_main.c +++ b/dlls/d3dx9_33/d3dx9_33_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_34/d3dx9_34_main.c b/dlls/d3dx9_34/d3dx9_34_main.c index 05c0e724449..18acc11e909 100644 --- a/dlls/d3dx9_34/d3dx9_34_main.c +++ b/dlls/d3dx9_34/d3dx9_34_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_35/d3dx9_35_main.c b/dlls/d3dx9_35/d3dx9_35_main.c index 6d5e4d5f389..f87861883fa 100644 --- a/dlls/d3dx9_35/d3dx9_35_main.c +++ b/dlls/d3dx9_35/d3dx9_35_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_36/d3dx9_36_main.c b/dlls/d3dx9_36/d3dx9_36_main.c index 0cdba0c9e04..e9c700444ef 100644 --- a/dlls/d3dx9_36/d3dx9_36_main.c +++ b/dlls/d3dx9_36/d3dx9_36_main.c @@ -30,12 +30,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dx9_37/d3dx9_37_main.c b/dlls/d3dx9_37/d3dx9_37_main.c index b0d6b729f57..21700098a23 100644 --- a/dlls/d3dx9_37/d3dx9_37_main.c +++ b/dlls/d3dx9_37/d3dx9_37_main.c @@ -28,12 +28,9 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" -#include "wine/debug.h" #include "d3dx9.h" -WINE_DEFAULT_DEBUG_CHANNEL(d3dx); - /*********************************************************************** * DllMain. */ diff --git a/dlls/d3dxof/Makefile.in b/dlls/d3dxof/Makefile.in index 2319c8b2cc5..4e0d77c1ac8 100644 --- a/dlls/d3dxof/Makefile.in +++ b/dlls/d3dxof/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = d3dxof.dll IMPORTLIB = d3dxof -IMPORTS = dxguid uuid ole32 user32 advapi32 kernel32 +IMPORTS = dxguid uuid ole32 advapi32 kernel32 C_SRCS = \ main.c \ diff --git a/dlls/d3dxof/d3dxof.c b/dlls/d3dxof/d3dxof.c index 4be62bdf940..d7892d4e61f 100644 --- a/dlls/d3dxof/d3dxof.c +++ b/dlls/d3dxof/d3dxof.c @@ -98,6 +98,7 @@ static WORD check_TOKEN(parse_buffer * buf); static BOOL parse_template(parse_buffer * buf); static HRESULT IDirectXFileDataReferenceImpl_Create(IDirectXFileDataReferenceImpl** ppObj); static HRESULT IDirectXFileEnumObjectImpl_Create(IDirectXFileEnumObjectImpl** ppObj); +static HRESULT IDirectXFileSaveObjectImpl_Create(IDirectXFileSaveObjectImpl** ppObj); static void dump_template(xtemplate* templates_array, xtemplate* ptemplate) { @@ -147,7 +148,12 @@ HRESULT IDirectXFileImpl_Create(IUnknown* pUnkOuter, LPVOID* ppObj) TRACE("(%p,%p)\n", pUnkOuter, ppObj); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileImpl)); - + if (!object) + { + ERR("Out of memory\n"); + return DXFILEERR_BADALLOC; + } + object->lpVtbl.lpVtbl = &IDirectXFile_Vtbl; object->ref = 1; @@ -310,7 +316,7 @@ static HRESULT WINAPI IDirectXFileImpl_CreateEnumObject(IDirectXFile* iface, LPV object->buf.buffer = HeapAlloc(GetProcessHeap(), 0, MAX_INPUT_SIZE+1); if (!object->buf.buffer) { - WARN("Out of memory\n"); + ERR("Out of memory\n"); hr = DXFILEERR_BADALLOC; goto error; } @@ -372,9 +378,12 @@ static HRESULT WINAPI IDirectXFileImpl_CreateSaveObject(IDirectXFile* iface, LPC { IDirectXFileImpl *This = (IDirectXFileImpl *)iface; - FIXME("(%p/%p)->(%s,%x,%p) stub!\n", This, iface, szFileName, dwFileFormat, ppSaveObj); + FIXME("(%p/%p)->(%s,%x,%p) partial stub!\n", This, iface, szFileName, dwFileFormat, ppSaveObj); - return DXFILEERR_BADVALUE; + if (!szFileName || !ppSaveObj) + return E_POINTER; + + return IDirectXFileSaveObjectImpl_Create((IDirectXFileSaveObjectImpl**)ppSaveObj); } static BOOL read_bytes(parse_buffer * buf, LPVOID data, DWORD size) @@ -1338,6 +1347,27 @@ static const IDirectXFileVtbl IDirectXFile_Vtbl = IDirectXFileImpl_RegisterTemplates }; +static HRESULT IDirectXFileBinaryImpl_Create(IDirectXFileBinaryImpl** ppObj) +{ + IDirectXFileBinaryImpl* object; + + TRACE("(%p)\n", ppObj); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileBinaryImpl)); + if (!object) + { + ERR("Out of memory\n"); + return DXFILEERR_BADALLOC; + } + + object->lpVtbl.lpVtbl = &IDirectXFileBinary_Vtbl; + object->ref = 1; + + *ppObj = object; + + return DXFILE_OK; +} + /*** IUnknown methods ***/ static HRESULT WINAPI IDirectXFileBinaryImpl_QueryInterface(IDirectXFileBinary* iface, REFIID riid, void** ppvObject) { @@ -1452,7 +1482,12 @@ static HRESULT IDirectXFileDataImpl_Create(IDirectXFileDataImpl** ppObj) TRACE("(%p)\n", ppObj); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileDataImpl)); - + if (!object) + { + ERR("Out of memory\n"); + return DXFILEERR_BADALLOC; + } + object->lpVtbl.lpVtbl = &IDirectXFileData_Vtbl; object->ref = 1; @@ -1592,13 +1627,23 @@ static HRESULT WINAPI IDirectXFileDataImpl_GetNextObject(IDirectXFileData* iface return DXFILEERR_NOMOREOBJECTS; } - if (This->pobj->childs[This->cur_enum_object]->ptarget) + if (This->pobj->childs[This->cur_enum_object]->binary) + { + IDirectXFileBinaryImpl *object; + + hr = IDirectXFileBinaryImpl_Create(&object); + if (FAILED(hr)) + return hr; + + *ppChildObj = (LPDIRECTXFILEOBJECT)object; + } + else if (This->pobj->childs[This->cur_enum_object]->ptarget) { IDirectXFileDataReferenceImpl *object; hr = IDirectXFileDataReferenceImpl_Create(&object); - if (hr != S_OK) - return DXFILEERR_BADVALUE; + if (FAILED(hr)) + return hr; object->ptarget = This->pobj->childs[This->cur_enum_object++]->ptarget; @@ -1609,8 +1654,8 @@ static HRESULT WINAPI IDirectXFileDataImpl_GetNextObject(IDirectXFileData* iface IDirectXFileDataImpl *object; hr = IDirectXFileDataImpl_Create(&object); - if (hr != S_OK) - return DXFILEERR_BADVALUE; + if (FAILED(hr)) + return hr; object->pobj = This->pobj->childs[This->cur_enum_object++]; object->cur_enum_object = 0; @@ -1672,6 +1717,11 @@ static HRESULT IDirectXFileDataReferenceImpl_Create(IDirectXFileDataReferenceImp TRACE("(%p)\n", ppObj); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileDataReferenceImpl)); + if (!object) + { + ERR("Out of memory\n"); + return DXFILEERR_BADALLOC; + } object->lpVtbl.lpVtbl = &IDirectXFileDataReference_Vtbl; object->ref = 1; @@ -1770,8 +1820,8 @@ static HRESULT WINAPI IDirectXFileDataReferenceImpl_Resolve(IDirectXFileDataRefe return DXFILEERR_BADVALUE; hr = IDirectXFileDataImpl_Create(&object); - if (hr != S_OK) - return DXFILEERR_BADVALUE; + if (FAILED(hr)) + return hr; object->pobj = This->ptarget; object->cur_enum_object = 0; @@ -1800,6 +1850,11 @@ static HRESULT IDirectXFileEnumObjectImpl_Create(IDirectXFileEnumObjectImpl** pp TRACE("(%p)\n", ppObj); object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileEnumObjectImpl)); + if (!object) + { + ERR("Out of memory\n"); + return DXFILEERR_BADALLOC; + } object->lpVtbl.lpVtbl = &IDirectXFileEnumObject_Vtbl; object->ref = 1; @@ -2192,7 +2247,7 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE pdata = HeapAlloc(GetProcessHeap(), 0, MAX_DATA_SIZE); if (!pdata) { - WARN("Out of memory\n"); + ERR("Out of memory\n"); return DXFILEERR_BADALLOC; } This->buf.cur_pdata = This->buf.pdata = pdata; @@ -2200,7 +2255,7 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE pstrings = HeapAlloc(GetProcessHeap(), 0, MAX_STRINGS_BUFFER); if (!pstrings) { - WARN("Out of memory\n"); + ERR("Out of memory\n"); HeapFree(GetProcessHeap(), 0, This->buf.pxo->pdata); return DXFILEERR_BADALLOC; } @@ -2262,76 +2317,27 @@ static const IDirectXFileEnumObjectVtbl IDirectXFileEnumObject_Vtbl = IDirectXFileEnumObjectImpl_GetDataObjectByName }; -/*** IUnknown methods ***/ -static HRESULT WINAPI IDirectXFileObjectImpl_QueryInterface(IDirectXFileObject* iface, REFIID riid, void** ppvObject) +static HRESULT IDirectXFileSaveObjectImpl_Create(IDirectXFileSaveObjectImpl** ppObj) { - IDirectXFileObjectImpl *This = (IDirectXFileObjectImpl *)iface; - - TRACE("(%p/%p)->(%s,%p)\n", iface, This, debugstr_guid(riid), ppvObject); + IDirectXFileSaveObjectImpl* object; - if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IDirectXFileObject)) - { - IClassFactory_AddRef(iface); - *ppvObject = This; - return S_OK; - } - - ERR("(%p)->(%s,%p),not found\n",This,debugstr_guid(riid),ppvObject); - return E_NOINTERFACE; -} - -static ULONG WINAPI IDirectXFileObjectImpl_AddRef(IDirectXFileObject* iface) -{ - IDirectXFileObjectImpl *This = (IDirectXFileObjectImpl *)iface; - ULONG ref = InterlockedIncrement(&This->ref); - - TRACE("(%p/%p): AddRef from %d\n", iface, This, ref - 1); - - return ref; -} - -static ULONG WINAPI IDirectXFileObjectImpl_Release(IDirectXFileObject* iface) -{ - IDirectXFileObjectImpl *This = (IDirectXFileObjectImpl *)iface; - ULONG ref = InterlockedDecrement(&This->ref); - - TRACE("(%p/%p): ReleaseRef to %d\n", iface, This, ref); - - if (!ref) - HeapFree(GetProcessHeap(), 0, This); - - return ref; -} - -/*** IDirectXFileObject methods ***/ -static HRESULT WINAPI IDirectXFileObjectImpl_GetName(IDirectXFileObject* iface, LPSTR pstrNameBuf, LPDWORD pdwBufLen) -{ - IDirectXFileDataReferenceImpl *This = (IDirectXFileDataReferenceImpl *)iface; - - FIXME("(%p/%p)->(%p,%p) stub!\n", This, iface, pstrNameBuf, pdwBufLen); + TRACE("(%p)\n", ppObj); - return DXFILEERR_BADVALUE; -} + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectXFileSaveObjectImpl)); + if (!object) + { + ERR("Out of memory\n"); + return DXFILEERR_BADALLOC; + } -static HRESULT WINAPI IDirectXFileObjectImpl_GetId(IDirectXFileObject* iface, LPGUID pGuid) -{ - IDirectXFileObjectImpl *This = (IDirectXFileObjectImpl *)iface; + object->lpVtbl.lpVtbl = &IDirectXFileSaveObject_Vtbl; + object->ref = 1; - FIXME("(%p/%p)->(%p) stub!\n", This, iface, pGuid); + *ppObj = object; - return DXFILEERR_BADVALUE; + return S_OK; } -static const IDirectXFileObjectVtbl IDirectXFileObject_Vtbl = -{ - IDirectXFileObjectImpl_QueryInterface, - IDirectXFileObjectImpl_AddRef, - IDirectXFileObjectImpl_Release, - IDirectXFileObjectImpl_GetName, - IDirectXFileObjectImpl_GetId -}; - /*** IUnknown methods ***/ static HRESULT WINAPI IDirectXFileSaveObjectImpl_QueryInterface(IDirectXFileSaveObject* iface, REFIID riid, void** ppvObject) { diff --git a/dlls/d3dxof/d3dxof_private.h b/dlls/d3dxof/d3dxof_private.h index 798097fbc3a..7cb82cd41ab 100644 --- a/dlls/d3dxof/d3dxof_private.h +++ b/dlls/d3dxof/d3dxof_private.h @@ -40,7 +40,7 @@ #define MAX_TEMPLATES 200 #define MAX_OBJECTS 500 #define MAX_SUBOBJECTS 500 -#define MAX_STRINGS_BUFFER 1000 +#define MAX_STRINGS_BUFFER 10000 typedef struct { DWORD type; @@ -55,6 +55,7 @@ typedef struct { char name[MAX_NAME_LEN]; GUID class_id; BOOL open; + BOOL binary; ULONG nb_childs; char childs[MAX_CHILDS][MAX_NAME_LEN]; ULONG nb_members; @@ -68,6 +69,7 @@ typedef struct { } xobject_member; struct _xobject { + BOOL binary; struct _xobject* ptarget; char name[MAX_NAME_LEN]; GUID class_id; diff --git a/dlls/d3dxof/regsvr.c b/dlls/d3dxof/regsvr.c index 34c5827fc20..e50917f68dd 100644 --- a/dlls/d3dxof/regsvr.c +++ b/dlls/d3dxof/regsvr.c @@ -34,6 +34,7 @@ #include "dxfile.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(d3dxof); @@ -160,7 +161,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/d3dxof/tests/d3dxof.c b/dlls/d3dxof/tests/d3dxof.c index bdc1431034e..3315721416c 100644 --- a/dlls/d3dxof/tests/d3dxof.c +++ b/dlls/d3dxof/tests/d3dxof.c @@ -20,9 +20,19 @@ #define COBJMACROS #include +#include #include "wine/test.h" +#include "initguid.h" #include "dxfile.h" +static inline void debugstr_guid( char* buf, CONST GUID *id ) +{ + sprintf(buf, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", + id->Data1, id->Data2, id->Data3, + id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3], + id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] ); +} + static HMODULE hd3dxof; static HRESULT (WINAPI *pDirectXFileCreate)(LPDIRECTXFILE*); @@ -86,11 +96,180 @@ static void test_d3dxof(void) ok(ref == 0, "Got refcount %ld, expected 1\n", ref); } +/* Set it to 1 to expand the string when dumping the object. This is usefull when there is + * only one string in a sub-object (very common). Use with care, this may lead to a crash. */ +#define EXPAND_STRING 0 + +static void process_data(LPDIRECTXFILEDATA lpDirectXFileData, int* plevel) +{ + HRESULT hr; + char name[100]; + GUID clsid; + CONST GUID* clsid_type = NULL; + char str_clsid[40]; + char str_clsid_type[40]; + DWORD len= 100; + LPDIRECTXFILEOBJECT pChildObj; + int i,k; + int j = 0; + LPBYTE pData; + DWORD size; + + hr = IDirectXFileData_GetId(lpDirectXFileData, &clsid); + ok(hr == DXFILE_OK, "IDirectXFileData_GetId: %x\n", hr); + hr = IDirectXFileData_GetName(lpDirectXFileData, name, &len); + ok(hr == DXFILE_OK, "IDirectXFileData_GetName: %x\n", hr); + hr = IDirectXFileData_GetType(lpDirectXFileData, &clsid_type); + ok(hr == DXFILE_OK, "IDirectXFileData_GetType: %x\n", hr); + hr = IDirectXFileData_GetData(lpDirectXFileData, NULL, &size, (void**)&pData); + ok(hr == DXFILE_OK, "IDirectXFileData_GetData: %x\n", hr); + for (i = 0; i < *plevel; i++) + printf(" "); + debugstr_guid(str_clsid, &clsid); + debugstr_guid(str_clsid_type, clsid_type); + printf("Found object '%s' - %s - %s - %d\n", name, str_clsid, str_clsid_type, size); + + if (EXPAND_STRING && size == 4) + { + char * str = *(char**)pData; + printf("string %s\n", str); + } + else if (size) + { + for (k = 0; k < size; k++) + { + if (k && !(k%16)) + printf("\n"); + printf("%02x ", pData[k]); + } + printf("\n"); + } + (*plevel)++; + while (SUCCEEDED(hr = IDirectXFileData_GetNextObject(lpDirectXFileData, &pChildObj))) + { + LPDIRECTXFILEDATA p1; + LPDIRECTXFILEDATAREFERENCE p2; + LPDIRECTXFILEBINARY p3; + j++; + + hr = IDirectXFileObject_QueryInterface(pChildObj, &IID_IDirectXFileData, (void **) &p1); + if (SUCCEEDED(hr)) + { + for (i = 0; i < *plevel; i++) + printf(" "); + printf("Found Data (%d)\n", j); + process_data(p1, plevel); + IDirectXFileData_Release(p1); + } + hr = IDirectXFileObject_QueryInterface(pChildObj, &IID_IDirectXFileDataReference, (void **) &p2); + if (SUCCEEDED(hr)) + { + LPDIRECTXFILEDATA pfdo; + for (i = 0; i < *plevel; i++) + printf(" "); + printf("Found Data Reference (%d)\n", j); +#if 0 + hr = IDirectXFileDataReference_GetId(lpDirectXFileData, &clsid); + ok(hr == DXFILE_OK, "IDirectXFileData_GetId: %x\n", hr); + hr = IDirectXFileDataReference_GetName(lpDirectXFileData, name, &len); + ok(hr == DXFILE_OK, "IDirectXFileData_GetName: %x\n", hr); +#endif + IDirectXFileDataReference_Resolve(p2, &pfdo); + process_data(pfdo, plevel); + IDirectXFileData_Release(pfdo); + IDirectXFileDataReference_Release(p2); + } + hr = IDirectXFileObject_QueryInterface(pChildObj, &IID_IDirectXFileBinary, (void **) &p3); + if (SUCCEEDED(hr)) + { + for (i = 0; i < *plevel; i++) + printf(" "); + printf("Found Binary (%d)\n", j); + IDirectXFileBinary_Release(p3); + } + } + (*plevel)--; + ok(hr == DXFILE_OK || hr == DXFILEERR_NOMOREOBJECTS, "IDirectXFileData_GetNextObject: %x\n", hr); +} + +static void test_dump(void) +{ + HRESULT hr; + unsigned long ref; + LPDIRECTXFILE lpDirectXFile = NULL; + LPDIRECTXFILEENUMOBJECT lpDirectXFileEnumObject = NULL; + LPDIRECTXFILEDATA lpDirectXFileData = NULL; + HANDLE hFile; + LPVOID pvData = NULL; + DWORD cbSize; + + if (!pDirectXFileCreate) + { + win_skip("DirectXFileCreate is not available\n"); + goto exit; + } + + /* Dump data only if there is an object and a template */ + hFile = CreateFileA("objects.txt", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + if (hFile == INVALID_HANDLE_VALUE) + return; + CloseHandle(hFile); + + hFile = CreateFileA("templates.txt", GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + if (hFile == INVALID_HANDLE_VALUE) + return; + + pvData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 10000); + + if (!ReadFile(hFile, pvData, 10000, &cbSize, NULL)) + { + skip("Template file is too big\n"); + goto exit; + } + + printf("Load %d (%d) bytes\n", cbSize, strlen(pvData)); + + hr = pDirectXFileCreate(&lpDirectXFile); + ok(hr == DXFILE_OK, "DirectXFileCreate: %x\n", hr); + if(!lpDirectXFile) + { + skip("Couldn't create DirectXFile interface\n"); + goto exit; + } + + hr = IDirectXFile_RegisterTemplates(lpDirectXFile, pvData, strlen(pvData)); + ok(hr == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates: %x\n", hr); + + hr = IDirectXFile_CreateEnumObject(lpDirectXFile, (LPVOID)"objects.txt", DXFILELOAD_FROMFILE, &lpDirectXFileEnumObject); + ok(hr == DXFILE_OK, "IDirectXFile_CreateEnumObject: %x\n", hr); + + while (SUCCEEDED(hr = IDirectXFileEnumObject_GetNextDataObject(lpDirectXFileEnumObject, &lpDirectXFileData))) + { + int level = 0; + printf("\n"); + process_data(lpDirectXFileData, &level); + IDirectXFileData_Release(lpDirectXFileData); + } + ok(hr == DXFILE_OK || hr == DXFILEERR_NOMOREOBJECTS, "IDirectXFileEnumObject_GetNextDataObject: %x\n", hr); + + ref = IDirectXFile_Release(lpDirectXFileEnumObject); + ok(ref == 0, "Got refcount %ld, expected 0\n", ref); + + ref = IDirectXFile_Release(lpDirectXFile); + ok(ref == 0, "Got refcount %ld, expected 0\n", ref); + + CloseHandle(hFile); + +exit: + HeapFree(GetProcessHeap(), 0, pvData); +} + START_TEST(d3dxof) { init_function_pointers(); test_d3dxof(); + test_dump(); FreeLibrary(hd3dxof); } diff --git a/dlls/ddraw/regsvr.c b/dlls/ddraw/regsvr.c index d851454d0b1..6ab75d12043 100644 --- a/dlls/ddraw/regsvr.c +++ b/dlls/ddraw/regsvr.c @@ -31,6 +31,7 @@ #include "ddraw.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(ddraw); @@ -150,7 +151,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/ddraw/tests/dsurface.c b/dlls/ddraw/tests/dsurface.c index 80cf9b13417..1ad07ec073c 100644 --- a/dlls/ddraw/tests/dsurface.c +++ b/dlls/ddraw/tests/dsurface.c @@ -1025,7 +1025,7 @@ static void EnumTest(void) IDirectDrawSurface_Release(surface); } -HRESULT WINAPI SurfaceCounter(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context) +static HRESULT WINAPI SurfaceCounter(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context) { UINT *num = context; (*num)++; @@ -1418,7 +1418,7 @@ struct compare UINT mips; }; -HRESULT WINAPI CubeTestLvl2Enum(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context) +static HRESULT WINAPI CubeTestLvl2Enum(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context) { UINT *mips = context; @@ -1430,7 +1430,7 @@ HRESULT WINAPI CubeTestLvl2Enum(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *de return DDENUMRET_OK; } -HRESULT WINAPI CubeTestLvl1Enum(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context) +static HRESULT WINAPI CubeTestLvl1Enum(IDirectDrawSurface7 *surface, DDSURFACEDESC2 *desc, void *context) { UINT mips = 0; UINT *num = (UINT *) context; diff --git a/dlls/ddraw/tests/visual.c b/dlls/ddraw/tests/visual.c index 185cc334b07..030354a3ca4 100644 --- a/dlls/ddraw/tests/visual.c +++ b/dlls/ddraw/tests/visual.c @@ -1027,7 +1027,7 @@ out: ptr = ((D3DTRIANGLE*)(ptr))+1;\ } while (0) -HRESULT CALLBACK TextureFormatEnumCallback(LPDDSURFACEDESC lpDDSD, LPVOID lpContext) +static HRESULT CALLBACK TextureFormatEnumCallback(LPDDSURFACEDESC lpDDSD, LPVOID lpContext) { if (lpDDSD->ddpfPixelFormat.dwFlags & DDPF_PALETTEINDEXED8) { *(BOOL*)lpContext = TRUE; diff --git a/dlls/devenum/devenum.rc b/dlls/devenum/devenum.rc index 7aa6c5047a1..c5ad0fc1d7d 100644 --- a/dlls/devenum/devenum.rc +++ b/dlls/devenum/devenum.rc @@ -24,7 +24,7 @@ #include "winbase.h" #include "winnls.h" -LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #define WINE_FILEDESCRIPTION_STR "Wine Device Enumerator Library" #define WINE_FILENAME_STR "devenum.dll" @@ -63,7 +63,7 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL } STRINGTABLE DISCARDABLE -LANGUAGE LANG_ITALIAN, SUBLANG_DEFAULT +LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL { 7 "DirectSound di Default" 8 "DirectSound: %s" @@ -72,7 +72,7 @@ LANGUAGE LANG_ITALIAN, SUBLANG_DEFAULT } STRINGTABLE DISCARDABLE -LANGUAGE LANG_PORTUGUESE, SUBLANG_DEFAULT +LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN { 7 "DirectSound padrão" 8 "DirectSound: %s" @@ -81,7 +81,7 @@ LANGUAGE LANG_PORTUGUESE, SUBLANG_DEFAULT } STRINGTABLE DISCARDABLE -LANGUAGE LANG_SPANISH, SUBLANG_DEFAULT +LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL { 7 "DirectSound por defecto" 8 "DirectSound: %s" @@ -117,7 +117,7 @@ LANGUAGE LANG_NORWEGIAN, SUBLANG_NORWEGIAN_BOKMAL } STRINGTABLE DISCARDABLE -LANGUAGE LANG_DUTCH, SUBLANG_DEFAULT +LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL { 7 "Standaard DirectSound" 8 "DirectSound: %s" @@ -126,7 +126,7 @@ LANGUAGE LANG_DUTCH, SUBLANG_DEFAULT } STRINGTABLE DISCARDABLE -LANGUAGE LANG_ROMANIAN, SUBLANG_DEFAULT +LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL { 7 "DirectSound implicit" 8 "DirectSound: %s" diff --git a/dlls/dinput/regsvr.c b/dlls/dinput/regsvr.c index ac1ffc1690d..54f5be5b160 100644 --- a/dlls/dinput/regsvr.c +++ b/dlls/dinput/regsvr.c @@ -31,6 +31,7 @@ #include "dinput.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dinput); @@ -157,7 +158,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dmband/Makefile.in b/dlls/dmband/Makefile.in index 26b8976d98a..157ba5ed571 100644 --- a/dlls/dmband/Makefile.in +++ b/dlls/dmband/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dmband.dll -IMPORTS = dxguid uuid ole32 user32 advapi32 kernel32 +IMPORTS = dxguid uuid ole32 advapi32 kernel32 C_SRCS = \ band.c \ diff --git a/dlls/dmband/regsvr.c b/dlls/dmband/regsvr.c index 4c4fc0fa2f9..c2c7841c57f 100644 --- a/dlls/dmband/regsvr.c +++ b/dlls/dmband/regsvr.c @@ -19,6 +19,7 @@ */ #include "dmband_private.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dmband); @@ -142,7 +143,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dmcompos/Makefile.in b/dlls/dmcompos/Makefile.in index 4fdb3559e13..9b51cd9be21 100644 --- a/dlls/dmcompos/Makefile.in +++ b/dlls/dmcompos/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dmcompos.dll -IMPORTS = dxguid uuid ole32 user32 advapi32 kernel32 +IMPORTS = dxguid uuid ole32 advapi32 kernel32 C_SRCS = \ chordmap.c \ diff --git a/dlls/dmcompos/regsvr.c b/dlls/dmcompos/regsvr.c index 2fcbf8986b2..ebb8e952030 100644 --- a/dlls/dmcompos/regsvr.c +++ b/dlls/dmcompos/regsvr.c @@ -19,6 +19,7 @@ */ #include "dmcompos_private.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dmcompos); @@ -142,7 +143,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dmime/performance.c b/dlls/dmime/performance.c index 0523cd7578e..b98652de798 100644 --- a/dlls/dmime/performance.c +++ b/dlls/dmime/performance.c @@ -253,6 +253,8 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_PlaySegment (LPDIRECTMUSICPER IDirectMusicPerformance8Impl *This = (IDirectMusicPerformance8Impl *)iface; FIXME("(%p, %p, %d, 0x%s, %p): stub\n", This, pSegment, dwFlags, wine_dbgstr_longlong(i64StartTime), ppSegmentState); + if (ppSegmentState) + return DMUSIC_CreateDirectMusicSegmentStateImpl(&IID_IDirectMusicSegmentState, (LPVOID*)ppSegmentState, NULL); return S_OK; } @@ -787,7 +789,9 @@ static HRESULT WINAPI IDirectMusicPerformance8Impl_PlaySegmentEx (LPDIRECTMUSICP IDirectMusicPerformance8Impl *This = (IDirectMusicPerformance8Impl *)iface; FIXME("(%p, %p, %p, %p, %d, 0x%s, %p, %p, %p): stub\n", This, pSource, pwzSegmentName, pTransition, dwFlags, wine_dbgstr_longlong(i64StartTime), ppSegmentState, pFrom, pAudioPath); - return DMUS_E_SEGMENT_INIT_FAILED; + if (ppSegmentState) + return DMUSIC_CreateDirectMusicSegmentStateImpl(&IID_IDirectMusicSegmentState, (LPVOID*)ppSegmentState, NULL); + return S_OK; } static HRESULT WINAPI IDirectMusicPerformance8Impl_StopEx (LPDIRECTMUSICPERFORMANCE8 iface, IUnknown* pObjectToStop, __int64 i64StopTime, DWORD dwFlags) { diff --git a/dlls/dmime/regsvr.c b/dlls/dmime/regsvr.c index b0212a92000..33795315724 100644 --- a/dlls/dmime/regsvr.c +++ b/dlls/dmime/regsvr.c @@ -19,6 +19,7 @@ */ #include "dmime_private.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dmime); @@ -142,7 +143,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dmime/segmentstate.c b/dlls/dmime/segmentstate.c index 191b2f0bae1..afa67c03009 100644 --- a/dlls/dmime/segmentstate.c +++ b/dlls/dmime/segmentstate.c @@ -26,6 +26,9 @@ static HRESULT WINAPI IDirectMusicSegmentState8Impl_QueryInterface (LPDIRECTMUSI IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; TRACE("(%p, %s, %p)\n", This, debugstr_dmguid(riid), ppobj); + if (!riid || !ppobj) + return E_POINTER; + if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IDirectMusicSegmentState) || IsEqualIID(riid, &IID_IDirectMusicSegmentState8)) { diff --git a/dlls/dmloader/Makefile.in b/dlls/dmloader/Makefile.in index 1dde79dcca1..0edebeea197 100644 --- a/dlls/dmloader/Makefile.in +++ b/dlls/dmloader/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dmloader.dll -IMPORTS = dxguid uuid ole32 user32 advapi32 kernel32 +IMPORTS = dxguid uuid ole32 advapi32 kernel32 C_SRCS = \ classfactory.c \ diff --git a/dlls/dmloader/loader.c b/dlls/dmloader/loader.c index f97a2308e29..059760a18f0 100644 --- a/dlls/dmloader/loader.c +++ b/dlls/dmloader/loader.c @@ -26,7 +26,7 @@ static HRESULT DMUSIC_GetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pCl static HRESULT DMUSIC_SetLoaderSettings (LPDIRECTMUSICLOADER8 iface, REFGUID pClassID, WCHAR* wszSearchPath, LPBOOL pbCache); static HRESULT DMUSIC_CopyDescriptor (LPDMUS_OBJECTDESC pDst, LPDMUS_OBJECTDESC pSrc) { - TRACE(": copy \n%s", debugstr_DMUS_OBJECTDESC(pSrc)); + TRACE(": copy \n%s\n", debugstr_DMUS_OBJECTDESC(pSrc)); /* copy field by field */ if (pSrc->dwValidData & DMUS_OBJ_CLASS) pDst->guidClass = pSrc->guidClass; if (pSrc->dwValidData & DMUS_OBJ_OBJECT) pDst->guidObject = pSrc->guidObject; diff --git a/dlls/dmloader/regsvr.c b/dlls/dmloader/regsvr.c index cd4de3554d7..e8601bed5de 100644 --- a/dlls/dmloader/regsvr.c +++ b/dlls/dmloader/regsvr.c @@ -19,6 +19,7 @@ */ #include "dmloader_private.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dmloader); @@ -142,7 +143,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dmscript/Makefile.in b/dlls/dmscript/Makefile.in index 46ac121bfc1..1f99f5c9d07 100644 --- a/dlls/dmscript/Makefile.in +++ b/dlls/dmscript/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dmscript.dll -IMPORTS = dxguid uuid ole32 user32 advapi32 kernel32 +IMPORTS = dxguid uuid ole32 advapi32 kernel32 C_SRCS = \ dmscript_main.c \ diff --git a/dlls/dmscript/regsvr.c b/dlls/dmscript/regsvr.c index def675f5708..f60aea5fc5e 100644 --- a/dlls/dmscript/regsvr.c +++ b/dlls/dmscript/regsvr.c @@ -19,6 +19,7 @@ */ #include "dmscript_private.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dmscript); @@ -142,7 +143,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dmstyle/Makefile.in b/dlls/dmstyle/Makefile.in index b01f419c05f..c85a76cd0ba 100644 --- a/dlls/dmstyle/Makefile.in +++ b/dlls/dmstyle/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dmstyle.dll -IMPORTS = dxguid uuid ole32 user32 advapi32 kernel32 +IMPORTS = dxguid uuid ole32 advapi32 kernel32 C_SRCS = \ auditiontrack.c \ diff --git a/dlls/dmstyle/regsvr.c b/dlls/dmstyle/regsvr.c index 95c805901de..4addbd47fe8 100644 --- a/dlls/dmstyle/regsvr.c +++ b/dlls/dmstyle/regsvr.c @@ -19,6 +19,7 @@ */ #include "dmstyle_private.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dmstyle); @@ -142,7 +143,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dmsynth/Makefile.in b/dlls/dmsynth/Makefile.in index 35cadc5e095..03db464c81e 100644 --- a/dlls/dmsynth/Makefile.in +++ b/dlls/dmsynth/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dmsynth.dll -IMPORTS = dxguid uuid ole32 user32 advapi32 kernel32 +IMPORTS = dxguid uuid ole32 advapi32 kernel32 C_SRCS = \ dmsynth_main.c \ diff --git a/dlls/dmsynth/regsvr.c b/dlls/dmsynth/regsvr.c index 322190e38e4..4e271ea07de 100644 --- a/dlls/dmsynth/regsvr.c +++ b/dlls/dmsynth/regsvr.c @@ -19,6 +19,7 @@ */ #include "dmsynth_private.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dmsynth); @@ -142,7 +143,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dmusic/Makefile.in b/dlls/dmusic/Makefile.in index a3c114a90ea..3b1b9628214 100644 --- a/dlls/dmusic/Makefile.in +++ b/dlls/dmusic/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dmusic.dll -IMPORTS = dxguid uuid ole32 user32 advapi32 kernel32 +IMPORTS = dxguid uuid ole32 advapi32 kernel32 C_SRCS = \ buffer.c \ diff --git a/dlls/dmusic/regsvr.c b/dlls/dmusic/regsvr.c index ab7774cb505..e3b5d36ff95 100644 --- a/dlls/dmusic/regsvr.c +++ b/dlls/dmusic/regsvr.c @@ -19,6 +19,7 @@ */ #include "dmusic_private.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dmusic); @@ -142,7 +143,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dplayx/dplobby.c b/dlls/dplayx/dplobby.c index 901c375eabe..bd620a4e5d4 100644 --- a/dlls/dplayx/dplobby.c +++ b/dlls/dplayx/dplobby.c @@ -1834,7 +1834,7 @@ static const IDirectPlayLobby2Vtbl directPlayLobby2AVT = /* Note: Hack so we can reuse the old functions without compiler warnings */ #if !defined(__STRICT_ANSI__) && defined(__GNUC__) -# define XCAST(fun) (typeof(directPlayLobby2AVT.fun)) +# define XCAST(fun) (typeof(directPlayLobby2WVT.fun)) #else # define XCAST(fun) (void*) #endif diff --git a/dlls/dplayx/regsvr.c b/dlls/dplayx/regsvr.c index 6bfc81207b8..0c2857cf5f6 100644 --- a/dlls/dplayx/regsvr.c +++ b/dlls/dplayx/regsvr.c @@ -31,6 +31,7 @@ #include "dplobby.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dplay); @@ -157,7 +158,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dpnet/Makefile.in b/dlls/dpnet/Makefile.in index 8d6b31959c1..49ce6b68f80 100644 --- a/dlls/dpnet/Makefile.in +++ b/dlls/dpnet/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dpnet.dll IMPORTLIB = dpnet -IMPORTS = dxguid uuid ole32 user32 advapi32 kernel32 +IMPORTS = dxguid uuid ole32 advapi32 kernel32 C_SRCS = \ address.c \ diff --git a/dlls/dpnet/regsvr.c b/dlls/dpnet/regsvr.c index 578d1ea0371..69cc52546eb 100644 --- a/dlls/dpnet/regsvr.c +++ b/dlls/dpnet/regsvr.c @@ -33,6 +33,7 @@ #include "dplobby8.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dpnet); @@ -159,7 +160,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dsound/Makefile.in b/dlls/dsound/Makefile.in index e6892c10018..bbac7f905f4 100644 --- a/dlls/dsound/Makefile.in +++ b/dlls/dsound/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dsound.dll IMPORTLIB = dsound -IMPORTS = dxguid uuid winmm ole32 user32 advapi32 kernel32 ntdll +IMPORTS = dxguid uuid winmm ole32 advapi32 kernel32 ntdll C_SRCS = \ buffer.c \ diff --git a/dlls/dsound/regsvr.c b/dlls/dsound/regsvr.c index 514cfc97752..49c648a9199 100644 --- a/dlls/dsound/regsvr.c +++ b/dlls/dsound/regsvr.c @@ -31,6 +31,7 @@ #include "dsound.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dsound); @@ -160,7 +161,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dswave/Makefile.in b/dlls/dswave/Makefile.in index fb13f1d02cb..fb2e28aba10 100644 --- a/dlls/dswave/Makefile.in +++ b/dlls/dswave/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = dswave.dll -IMPORTS = dxguid uuid ole32 user32 advapi32 kernel32 +IMPORTS = dxguid uuid ole32 advapi32 kernel32 C_SRCS = \ dswave.c \ diff --git a/dlls/dswave/dswave.c b/dlls/dswave/dswave.c index 7b1a33ab823..927aeceef93 100644 --- a/dlls/dswave/dswave.c +++ b/dlls/dswave/dswave.c @@ -732,6 +732,7 @@ HRESULT WINAPI DMUSIC_CreateDirectMusicWaveImpl (LPCGUID lpcGUID, LPVOID* ppobj, return E_OUTOFMEMORY; } obj->UnknownVtbl = &DirectMusicWave_Unknown_Vtbl; + obj->SegmentVtbl = &DirectMusicSegment8_Segment_Vtbl; obj->ObjectVtbl = &DirectMusicWave_Object_Vtbl; obj->PersistStreamVtbl = &DirectMusicWave_PersistStream_Vtbl; obj->pDesc = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DMUS_OBJECTDESC)); diff --git a/dlls/dswave/regsvr.c b/dlls/dswave/regsvr.c index d88e4b8e76c..eab1980ea20 100644 --- a/dlls/dswave/regsvr.c +++ b/dlls/dswave/regsvr.c @@ -19,6 +19,7 @@ */ #include "dswave_private.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dswave); @@ -142,7 +143,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/dxdiagn/regsvr.c b/dlls/dxdiagn/regsvr.c index 949c4d2c5cd..c5ba37e1e04 100644 --- a/dlls/dxdiagn/regsvr.c +++ b/dlls/dxdiagn/regsvr.c @@ -30,7 +30,9 @@ #include "initguid.h" #include "dxdiag_private.h" + #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(dxdiag); @@ -157,7 +159,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/gdi32/bitmap.c b/dlls/gdi32/bitmap.c index e7370a24650..2a083c50591 100644 --- a/dlls/gdi32/bitmap.c +++ b/dlls/gdi32/bitmap.c @@ -274,7 +274,7 @@ HBITMAP WINAPI CreateBitmapIndirect( const BITMAP *bmp ) /* Windows ignores the provided bm.bmWidthBytes */ bm.bmWidthBytes = BITMAP_GetWidthBytes( bm.bmWidth, bm.bmBitsPixel ); /* XP doesn't allow to create bitmaps larger than 128 Mb */ - if (bm.bmHeight * bm.bmWidthBytes > 128 * 1024 * 1024) + if (bm.bmHeight > 128 * 1024 * 1024 / bm.bmWidthBytes) { SetLastError( ERROR_NOT_ENOUGH_MEMORY ); return 0; diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c index 8e4601ddf7f..c8a3c4cf3e7 100644 --- a/dlls/gdi32/dc.c +++ b/dlls/gdi32/dc.c @@ -327,7 +327,7 @@ void DC_UpdateXforms( DC *dc ) /*********************************************************************** * GetDCState (Not a Windows API) */ -HDC WINAPI GetDCState( HDC hdc ) +static HDC GetDCState( HDC hdc ) { DC * newdc, * dc; HGDIOBJ handle; @@ -428,7 +428,7 @@ HDC WINAPI GetDCState( HDC hdc ) /*********************************************************************** * SetDCState (Not a Windows API) */ -void WINAPI SetDCState( HDC hdc, HDC hdcs ) +static void SetDCState( HDC hdc, HDC hdcs ) { DC *dc, *dcs; diff --git a/dlls/gdi32/gdi.exe.spec b/dlls/gdi32/gdi.exe.spec index 6c7aa677b40..cade1c24b42 100644 --- a/dlls/gdi32/gdi.exe.spec +++ b/dlls/gdi32/gdi.exe.spec @@ -231,9 +231,9 @@ 301 pascal -ret16 EngineDeleteFont(ptr) EngineDeleteFont16 302 pascal EngineRealizeFont(ptr ptr ptr) EngineRealizeFont16 303 pascal -ret16 EngineGetCharWidth(ptr word word ptr) EngineGetCharWidth16 -304 stub ENGINESETFONTCONTEXT -305 stub ENGINEGETGLYPHBMP -306 stub ENGINEMAKEFONTDIR +304 pascal -ret16 EngineSetFontContext(ptr word) EngineSetFontContext16 +305 pascal -ret16 EngineGetGlyphBMP(word ptr word word ptr long ptr) EngineGetGlyphBMP16 +306 pascal EngineMakeFontDir(word ptr ptr) EngineMakeFontDir16 307 pascal -ret16 GetCharABCWidths(word word word ptr) GetCharABCWidths16 308 pascal -ret16 GetOutlineTextMetrics(word word ptr) GetOutlineTextMetrics16 309 pascal GetGlyphOutline(word word word ptr long ptr ptr) GetGlyphOutline16 diff --git a/dlls/gdi32/gdi16.c b/dlls/gdi32/gdi16.c index a1bbe1ccdab..b70b44ed04e 100644 --- a/dlls/gdi32/gdi16.c +++ b/dlls/gdi32/gdi16.c @@ -1897,7 +1897,7 @@ WORD WINAPI EngineGetCharWidth16(LPFONTINFO16 lpFontInfo, BYTE firstChar, BYTE l /*********************************************************************** * EngineSetFontContext (GDI.304) */ -WORD WINAPI EngineSetFontContext(LPFONTINFO16 lpFontInfo, WORD data) +WORD WINAPI EngineSetFontContext16(LPFONTINFO16 lpFontInfo, WORD data) { FIXME("stub?\n"); return 0; @@ -1906,7 +1906,7 @@ WORD WINAPI EngineSetFontContext(LPFONTINFO16 lpFontInfo, WORD data) /*********************************************************************** * EngineGetGlyphBMP (GDI.305) */ -WORD WINAPI EngineGetGlyphBMP(WORD word, LPFONTINFO16 lpFontInfo, WORD w1, WORD w2, +WORD WINAPI EngineGetGlyphBMP16(WORD word, LPFONTINFO16 lpFontInfo, WORD w1, WORD w2, LPSTR string, DWORD dword, /*LPBITMAPMETRICS16*/ LPVOID metrics) { FIXME("stub?\n"); @@ -1917,7 +1917,7 @@ WORD WINAPI EngineGetGlyphBMP(WORD word, LPFONTINFO16 lpFontInfo, WORD w1, WORD /*********************************************************************** * EngineMakeFontDir (GDI.306) */ -DWORD WINAPI EngineMakeFontDir(HDC16 hdc, LPFONTDIR16 fontdir, LPCSTR string) +DWORD WINAPI EngineMakeFontDir16(HDC16 hdc, LPFONTDIR16 fontdir, LPCSTR string) { FIXME(" stub! (always fails)\n"); return ~0UL; /* error */ diff --git a/dlls/gdi32/gdiobj.c b/dlls/gdi32/gdiobj.c index 910f49b6492..906cd2a6748 100644 --- a/dlls/gdi32/gdiobj.c +++ b/dlls/gdi32/gdiobj.c @@ -442,7 +442,7 @@ static const struct DefaultFontInfo default_fonts[] = * For a description of the GDI object magics and their flags, * see "Undocumented Windows" (wrong about the OBJECT_NOSYSTEM flag, though). */ -void __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set) +void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set) { GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE ); diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c index 7683d351424..3f8a67442d4 100644 --- a/dlls/gdi32/tests/bitmap.c +++ b/dlls/gdi32/tests/bitmap.c @@ -1018,9 +1018,12 @@ static void test_bitmap(void) SetLastError(0xdeadbeef); hbmp = CreateBitmap(0x7ffffff + 1, 1, 1, 1, NULL); - ok(!hbmp, "CreateBitmap should fail\n"); - ok(GetLastError() == ERROR_INVALID_PARAMETER, - "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError()); + ok(!hbmp || broken(hbmp != NULL /* Win9x */), "CreateBitmap should fail\n"); + if (!hbmp) + ok(GetLastError() == ERROR_INVALID_PARAMETER, + "expected ERROR_INVALID_PARAMETER, got %u\n", GetLastError()); + else + DeleteObject(hbmp); hbmp = CreateBitmap(15, 15, 1, 1, NULL); assert(hbmp != NULL); @@ -1040,7 +1043,8 @@ static void test_bitmap(void) assert(sizeof(buf) == sizeof(buf_cmp)); ret = GetBitmapBits(hbmp, 0, NULL); - ok(ret == bm.bmWidthBytes * bm.bmHeight, "%d != %d\n", ret, bm.bmWidthBytes * bm.bmHeight); + ok(ret == bm.bmWidthBytes * bm.bmHeight || broken(ret == 0 /* Win9x */), + "%d != %d\n", ret, bm.bmWidthBytes * bm.bmHeight); memset(buf_cmp, 0xAA, sizeof(buf_cmp)); memset(buf_cmp, 0, bm.bmWidthBytes * bm.bmHeight); @@ -1323,6 +1327,8 @@ static void test_GetDIBits_selected_DDB(BOOL monochrome) /* Get the palette indices */ res = GetDIBits(dc, ddb, 0, 0, NULL, info2, DIB_PAL_COLORS); + if (res == 0 && GetLastError() == ERROR_INVALID_PARAMETER) /* Win9x */ + res = GetDIBits(dc, ddb, 0, height, NULL, info2, DIB_PAL_COLORS); ok(res, "GetDIBits failed\n"); for (i=0;i < 1 << info->bmiHeader.biSizeImage; i++) @@ -1465,7 +1471,7 @@ static void test_GetDIBits(void) ok(!bm.bmBits, "wrong bmBits %p\n", bm.bmBits); bytes = GetBitmapBits(hbmp, 0, NULL); - ok(bytes == sizeof(bmp_bits_1), "expected 16*2 got %d bytes\n", bytes); + ok(bytes == sizeof(bmp_bits_1) || broken(bytes == 0 /* Win9x */), "expected 16*2 got %d bytes\n", bytes); bytes = GetBitmapBits(hbmp, sizeof(buf), buf); ok(bytes == sizeof(bmp_bits_1), "expected 16*2 got %d bytes\n", bytes); ok(!memcmp(buf, bmp_bits_1, sizeof(bmp_bits_1)), "bitmap bits don't match\n"); diff --git a/dlls/gdiplus/font.c b/dlls/gdiplus/font.c index 220409b7a05..22fd3936949 100644 --- a/dlls/gdiplus/font.c +++ b/dlls/gdiplus/font.c @@ -195,6 +195,7 @@ GpStatus WINGDIPAPI GdipCreateFontFromLogfontW(HDC hdc, (*font)->lfw.lfHeight = -textmet.tmHeight; (*font)->lfw.lfWeight = textmet.tmWeight; + (*font)->lfw.lfCharSet = textmet.tmCharSet; (*font)->height = 1; /* FIXME: need NEWTEXTMETRIC.ntmSizeEM here */ (*font)->line_spacing = textmet.tmAscent + textmet.tmDescent + textmet.tmExternalLeading; diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 9473f1b937d..d380d74c4c8 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -10,8 +10,8 @@ @ stdcall GdipAddPathClosedCurveI(ptr ptr long) @ stdcall GdipAddPathCurve2(ptr ptr long long) @ stdcall GdipAddPathCurve2I(ptr ptr long long) -@ stub GdipAddPathCurve3 -@ stub GdipAddPathCurve3I +@ stdcall GdipAddPathCurve3(ptr ptr long long long long) +@ stdcall GdipAddPathCurve3I(ptr ptr long long long long) @ stdcall GdipAddPathCurve(ptr ptr long) @ stdcall GdipAddPathCurveI(ptr ptr long) @ stdcall GdipAddPathEllipse(ptr long long long long) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 20a3b2cb855..042d4a2f51e 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -524,6 +524,28 @@ GpStatus WINGDIPAPI GdipAddPathCurve2I(GpPath *path, GDIPCONST GpPoint *points, return stat; } +GpStatus WINGDIPAPI GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points, + INT count, INT offset, INT nseg, REAL tension) +{ + TRACE("(%p, %p, %d, %d, %d, %.2f)\n", path, points, count, offset, nseg, tension); + + if(!path || !points || offset + 1 >= count || count - offset < nseg + 1) + return InvalidParameter; + + return GdipAddPathCurve2(path, &points[offset], nseg + 1, tension); +} + +GpStatus WINGDIPAPI GdipAddPathCurve3I(GpPath *path, GDIPCONST GpPoint *points, + INT count, INT offset, INT nseg, REAL tension) +{ + TRACE("(%p, %p, %d, %d, %d, %.2f)\n", path, points, count, offset, nseg, tension); + + if(!path || !points || offset + 1 >= count || count - offset < nseg + 1) + return InvalidParameter; + + return GdipAddPathCurve2I(path, &points[offset], nseg + 1, tension); +} + GpStatus WINGDIPAPI GdipAddPathEllipse(GpPath *path, REAL x, REAL y, REAL width, REAL height) { diff --git a/dlls/gdiplus/tests/font.c b/dlls/gdiplus/tests/font.c index 7ff5afc6aff..125535df45a 100644 --- a/dlls/gdiplus/tests/font.c +++ b/dlls/gdiplus/tests/font.c @@ -134,7 +134,7 @@ static void test_logfont(void) expect(0, lfw2.lfItalic); expect(0, lfw2.lfUnderline); expect(0, lfw2.lfStrikeOut); - expect(0, lfw2.lfCharSet); + expect(GetTextCharset(hdc), lfw2.lfCharSet); expect(0, lfw2.lfOutPrecision); expect(0, lfw2.lfClipPrecision); expect(0, lfw2.lfQuality); @@ -164,7 +164,7 @@ static void test_logfont(void) expect(TRUE, lfw2.lfItalic); expect(TRUE, lfw2.lfUnderline); expect(TRUE, lfw2.lfStrikeOut); - expect(0, lfw2.lfCharSet); + expect(GetTextCharset(hdc), lfw2.lfCharSet); expect(0, lfw2.lfOutPrecision); expect(0, lfw2.lfClipPrecision); expect(0, lfw2.lfQuality); diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 168c4b57ec6..416d80caa90 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -726,6 +726,15 @@ static path_test_t addcurve_path2[] = { {23.3, 13.3, PathPointTypeBezier, 0, 0}, /*10*/ {30.0, 10.0, PathPointTypeBezier, 0, 0} /*11*/ }; +static path_test_t addcurve_path3[] = { + {10.0, 10.0, PathPointTypeStart, 0, 0}, /*0*/ + {13.3, 16.7, PathPointTypeBezier, 0, 1}, /*1*/ + {3.3, 20.0, PathPointTypeBezier, 0, 0}, /*2*/ + {10.0, 20.0, PathPointTypeBezier, 0, 0}, /*3*/ + {16.7, 20.0, PathPointTypeBezier, 0, 0}, /*4*/ + {23.3, 13.3, PathPointTypeBezier, 0, 0}, /*5*/ + {30.0, 10.0, PathPointTypeBezier, 0, 0} /*6*/ + }; static void test_addcurve(void) { GpStatus status; @@ -765,6 +774,37 @@ static void test_addcurve(void) status = GdipAddPathCurve2(path, points, 4, 1.0); expect(Ok, status); ok_path(path, addcurve_path2, sizeof(addcurve_path2)/sizeof(path_test_t), FALSE); + + /* NULL args */ + GdipResetPath(path); + status = GdipAddPathCurve3(NULL, NULL, 0, 0, 0, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, NULL, 0, 0, 0, 0.0); + expect(InvalidParameter, status); + /* wrong count, offset.. */ + status = GdipAddPathCurve3(path, points, 0, 0, 0, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, points, 4, 0, 0, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, points, 4, 0, 4, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, points, 4, 1, 3, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, points, 4, 1, 0, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, points, 4, 3, 1, 0.0); + expect(InvalidParameter, status); + + /* use all points */ + status = GdipAddPathCurve3(path, points, 4, 0, 3, 1.0); + expect(Ok, status); + ok_path(path, addcurve_path, sizeof(addcurve_path)/sizeof(path_test_t), FALSE); + GdipResetPath(path); + + status = GdipAddPathCurve3(path, points, 4, 1, 2, 1.0); + expect(Ok, status); + ok_path(path, addcurve_path3, sizeof(addcurve_path3)/sizeof(path_test_t), FALSE); + GdipDeletePath(path); } diff --git a/dlls/hal/Makefile.in b/dlls/hal/Makefile.in index 4f3cf1cfb45..026268adc4e 100644 --- a/dlls/hal/Makefile.in +++ b/dlls/hal/Makefile.in @@ -8,6 +8,8 @@ IMPORTS = kernel32 ntdll C_SRCS = \ hal.c +RC_SRCS = version.rc + @MAKE_DLL_RULES@ @DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/oleacc/oleacc.rc b/dlls/hal/version.rc similarity index 72% copy from dlls/oleacc/oleacc.rc copy to dlls/hal/version.rc index 4b36b3db914..126fe318ab5 100644 --- a/dlls/oleacc/oleacc.rc +++ b/dlls/hal/version.rc @@ -1,7 +1,5 @@ /* - * Top level resource file for oleacc - * - * Copyright 2008 Nikolay Sivov + * Copyright 2008 Hans Leidekker * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,9 +16,11 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "windef.h" -#include "oleacc.h" +#define WINE_FILENAME_STR "hal.dll" + +#define WINE_FILEVERSION 5,1,2600,5512 +#define WINE_FILEVERSION_STR "5.1.2600.5512" +#define WINE_PRODUCTVERSION 5,1,2600,5512 +#define WINE_PRODUCTVERSION_STR "5.1.2600.5512" -#include "oleacc_En.rc" -#include "oleacc_Ko.rc" -#include "oleacc_Nl.rc" +#include "wine/wine_common_ver.rc" diff --git a/dlls/hhctrl.ocx/regsvr.c b/dlls/hhctrl.ocx/regsvr.c index fc247c65694..d2fb310cd1b 100644 --- a/dlls/hhctrl.ocx/regsvr.c +++ b/dlls/hhctrl.ocx/regsvr.c @@ -31,6 +31,7 @@ #include "ole2.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(htmlhelp); @@ -157,7 +158,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/imm32/tests/imm32.c b/dlls/imm32/tests/imm32.c index ce736390bbf..3329928a888 100644 --- a/dlls/imm32/tests/imm32.c +++ b/dlls/imm32/tests/imm32.c @@ -262,32 +262,24 @@ static void test_ImmSetCompositionString(void) if (!imc) return; - SetLastError(0xdeadbeef); ret = ImmSetCompositionStringW(imc, SCS_SETSTR, NULL, 0, NULL, 0); todo_wine - ok(!ret, "ImmSetCompositionStringW() failed. Last error: %u\n", - GetLastError()); + ok(!ret, "ImmSetCompositionStringW() succeeded.\n"); - SetLastError(0xdeadbeef); ret = ImmSetCompositionStringW(imc, SCS_SETSTR | SCS_CHANGEATTR, NULL, 0, NULL, 0); todo_wine - ok(!ret, "ImmSetCompositionStringW() failed. Last error: %u\n", - GetLastError()); + ok(!ret, "ImmSetCompositionStringW() succeeded.\n"); - SetLastError(0xdeadbeef); ret = ImmSetCompositionStringW(imc, SCS_SETSTR | SCS_CHANGECLAUSE, NULL, 0, NULL, 0); todo_wine - ok(!ret, "ImmSetCompositionStringW() failed. Last error: %u\n", - GetLastError()); + ok(!ret, "ImmSetCompositionStringW() succeeded.\n"); - SetLastError(0xdeadbeef); ret = ImmSetCompositionStringW(imc, SCS_CHANGEATTR | SCS_CHANGECLAUSE, NULL, 0, NULL, 0); todo_wine - ok(!ret, "ImmSetCompositionStringW() failed. Last error: %u\n", - GetLastError()); + ok(!ret, "ImmSetCompositionStringW() succeeded.\n"); ImmReleaseContext(hwnd, imc); } diff --git a/dlls/inetcomm/regsvr.c b/dlls/inetcomm/regsvr.c index 8ac982e85dd..993e9ae9032 100644 --- a/dlls/inetcomm/regsvr.c +++ b/dlls/inetcomm/regsvr.c @@ -35,6 +35,7 @@ #include "inetcomm_private.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(inetcomm); @@ -151,7 +152,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/inseng/Makefile.in b/dlls/inseng/Makefile.in index 4173760685c..e47847974fa 100644 --- a/dlls/inseng/Makefile.in +++ b/dlls/inseng/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = inseng.dll -IMPORTS = uuid ole32 user32 advapi32 kernel32 +IMPORTS = uuid ole32 advapi32 kernel32 EXTRADEFS = -DCOM_NO_WINDOWS_H C_SRCS = \ diff --git a/dlls/inseng/regsvr.c b/dlls/inseng/regsvr.c index 54eee1e6b40..daa6a66da9b 100644 --- a/dlls/inseng/regsvr.c +++ b/dlls/inseng/regsvr.c @@ -33,6 +33,7 @@ #include "initguid.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(inseng); @@ -162,7 +163,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c index f4d47963199..423df46ccb3 100644 --- a/dlls/jscript/engine.c +++ b/dlls/jscript/engine.c @@ -459,6 +459,27 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, ex for(item = ctx->parser->script->named_items; item; item = item->next) { if((item->flags & SCRIPTITEM_ISVISIBLE) && !strcmpW(item->name, identifier)) { + if(!item->disp) { + IUnknown *unk; + + if(!ctx->parser->script->site) + break; + + hres = IActiveScriptSite_GetItemInfo(ctx->parser->script->site, identifier, + SCRIPTINFO_IUNKNOWN, &unk, NULL); + if(FAILED(hres)) { + WARN("GetItemInfo failed: %08x\n", hres); + break; + } + + hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&item->disp); + IUnknown_Release(unk); + if(FAILED(hres)) { + WARN("object does not implement IDispatch\n"); + break; + } + } + ret->type = EXPRVAL_VARIANT; V_VT(&ret->u.var) = VT_DISPATCH; V_DISPATCH(&ret->u.var) = item->disp; @@ -468,9 +489,11 @@ static HRESULT identifier_eval(exec_ctx_t *ctx, BSTR identifier, DWORD flags, ex } for(item = ctx->parser->script->named_items; item; item = item->next) { - hres = disp_get_id(item->disp, identifier, 0, &id); - if(SUCCEEDED(hres)) - break; + if(item->flags & SCRIPTITEM_GLOBALMEMBERS) { + hres = disp_get_id(item->disp, identifier, 0, &id); + if(SUCCEEDED(hres)) + break; + } } if(item) { diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c index c2fb987e5d5..bc182f48e7f 100644 --- a/dlls/jscript/jscript.c +++ b/dlls/jscript/jscript.c @@ -144,6 +144,9 @@ static HRESULT set_ctx_site(JScript *This) if(FAILED(hres)) return hres; + IActiveScriptSite_AddRef(This->site); + This->ctx->site = This->site; + change_state(This, SCRIPTSTATE_INITIALIZED); return S_OK; } @@ -325,7 +328,8 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface) while(iter) { iter2 = iter->next; - IDispatch_Release(iter->disp); + if(iter->disp) + IDispatch_Release(iter->disp); heap_free(iter->name); heap_free(iter); iter = iter2; @@ -334,6 +338,11 @@ static HRESULT WINAPI JScript_Close(IActiveScript *iface) This->ctx->named_items = NULL; } + if(This->ctx->site) { + IActiveScriptSite_Release(This->ctx->site); + This->ctx->site = NULL; + } + if (This->site) change_state(This, SCRIPTSTATE_CLOSED); @@ -361,8 +370,7 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface, { JScript *This = ACTSCRIPT_THIS(iface); named_item_t *item; - IDispatch *disp; - IUnknown *unk; + IDispatch *disp = NULL; HRESULT hres; TRACE("(%p)->(%s %x)\n", This, debugstr_w(pstrName), dwFlags); @@ -370,22 +378,27 @@ static HRESULT WINAPI JScript_AddNamedItem(IActiveScript *iface, if(This->thread_id != GetCurrentThreadId() || !This->ctx || This->ctx->state == SCRIPTSTATE_CLOSED) return E_UNEXPECTED; - hres = IActiveScriptSite_GetItemInfo(This->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL); - if(FAILED(hres)) { - WARN("GetItemInfo failed: %08x\n", hres); - return hres; - } + if(dwFlags & SCRIPTITEM_GLOBALMEMBERS) { + IUnknown *unk; - hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp); - IUnknown_Release(unk); - if(FAILED(hres)) { - WARN("object does not implement IDispatch\n"); - return hres; + hres = IActiveScriptSite_GetItemInfo(This->site, pstrName, SCRIPTINFO_IUNKNOWN, &unk, NULL); + if(FAILED(hres)) { + WARN("GetItemInfo failed: %08x\n", hres); + return hres; + } + + hres = IUnknown_QueryInterface(unk, &IID_IDispatch, (void**)&disp); + IUnknown_Release(unk); + if(FAILED(hres)) { + WARN("object does not implement IDispatch\n"); + return hres; + } } item = heap_alloc(sizeof(*item)); if(!item) { - IDispatch_Release(disp); + if(disp) + IDispatch_Release(disp); return E_OUTOFMEMORY; } diff --git a/dlls/jscript/jscript.h b/dlls/jscript/jscript.h index 6930ec65c4c..4862b28f55f 100644 --- a/dlls/jscript/jscript.h +++ b/dlls/jscript/jscript.h @@ -165,6 +165,7 @@ struct _script_ctx_t { SCRIPTSTATE state; exec_ctx_t *exec_ctx; named_item_t *named_items; + IActiveScriptSite *site; LCID lcid; jsheap_t tmp_heap; diff --git a/dlls/jscript/parser.y b/dlls/jscript/parser.y index 9f3b6d4b51e..96ba29cb091 100644 --- a/dlls/jscript/parser.y +++ b/dlls/jscript/parser.y @@ -21,10 +21,6 @@ #include "jscript.h" #include "engine.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(jscript); - #define YYLEX_PARAM ctx #define YYPARSE_PARAM ctx diff --git a/dlls/jscript/tests/run.c b/dlls/jscript/tests/run.c index 20d710d9e52..81de5795209 100644 --- a/dlls/jscript/tests/run.c +++ b/dlls/jscript/tests/run.c @@ -64,6 +64,7 @@ DEFINE_EXPECT(global_propput_i); DEFINE_EXPECT(global_success_d); DEFINE_EXPECT(global_success_i); DEFINE_EXPECT(testobj_delete); +DEFINE_EXPECT(GetItemInfo_testVal); #define DISPID_GLOBAL_TESTPROPGET 0x1000 #define DISPID_GLOBAL_TESTPROPPUT 0x1001 @@ -74,6 +75,9 @@ DEFINE_EXPECT(testobj_delete); #define DISPID_GLOBAL_TESTOBJ 0x1006 static const WCHAR testW[] = {'t','e','s','t',0}; +static const CHAR testA[] = "test"; +static const WCHAR test_valW[] = {'t','e','s','t','V','a','l',0}; +static const CHAR test_valA[] = "testVal"; static BOOL strict_dispid_check; static const char *test_name = "(null)"; @@ -485,10 +489,14 @@ static HRESULT WINAPI ActiveScriptSite_GetLCID(IActiveScriptSite *iface, LCID *p static HRESULT WINAPI ActiveScriptSite_GetItemInfo(IActiveScriptSite *iface, LPCOLESTR pstrName, DWORD dwReturnMask, IUnknown **ppiunkItem, ITypeInfo **ppti) { - ok(!lstrcmpW(pstrName, testW), "unexpected pstrName %s\n", debugstr_w(pstrName)); ok(dwReturnMask == SCRIPTINFO_IUNKNOWN, "unexpected dwReturnMask %x\n", dwReturnMask); ok(!ppti, "ppti != NULL\n"); + if(!strcmp_wa(pstrName, test_valA)) + CHECK_EXPECT(GetItemInfo_testVal); + else if(strcmp_wa(pstrName, testA)) + ok(0, "unexpected pstrName %s\n", debugstr_w(pstrName)); + *ppiunkItem = (IUnknown*)&Global; return S_OK; } @@ -673,6 +681,54 @@ static void run_from_res(const char *name) SysFreeString(str); } +static void test_isvisible(BOOL global_members) +{ + IActiveScriptParse *parser; + IActiveScript *engine; + HRESULT hres; + + static const WCHAR script_textW[] = + {'v','a','r',' ','v',' ','=',' ','t','e','s','t','V','a','l',';',0}; + + engine = create_script(); + if(!engine) + return; + + hres = IActiveScript_QueryInterface(engine, &IID_IActiveScriptParse, (void**)&parser); + ok(hres == S_OK, "Could not get IActiveScriptParse: %08x\n", hres); + + hres = IActiveScriptParse_InitNew(parser); + ok(hres == S_OK, "InitNew failed: %08x\n", hres); + + hres = IActiveScript_SetScriptSite(engine, &ActiveScriptSite); + ok(hres == S_OK, "SetScriptSite failed: %08x\n", hres); + + if(global_members) + SET_EXPECT(GetItemInfo_testVal); + hres = IActiveScript_AddNamedItem(engine, test_valW, + SCRIPTITEM_ISVISIBLE|SCRIPTITEM_ISSOURCE| + (global_members ? SCRIPTITEM_GLOBALMEMBERS : 0)); + ok(hres == S_OK, "AddNamedItem failed: %08x\n", hres); + if(global_members) + CHECK_CALLED(GetItemInfo_testVal); + + hres = IActiveScript_SetScriptState(engine, SCRIPTSTATE_STARTED); + ok(hres == S_OK, "SetScriptState(SCRIPTSTATE_STARTED) failed: %08x\n", hres); + + if(!global_members) + SET_EXPECT(GetItemInfo_testVal); + hres = IActiveScriptParse_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + if(!global_members) + CHECK_CALLED(GetItemInfo_testVal); + + hres = IActiveScriptParse_ParseScriptText(parser, script_textW, NULL, NULL, NULL, 0, 0, 0, NULL, NULL); + ok(hres == S_OK, "ParseScriptText failed: %08x\n", hres); + + IActiveScript_Release(engine); + IActiveScriptParse_Release(parser); +} + static void run_tests(void) { strict_dispid_check = TRUE; @@ -707,6 +763,9 @@ static void run_tests(void) run_from_res("lang.js"); run_from_res("api.js"); run_from_res("regexp.js"); + + test_isvisible(FALSE); + test_isvisible(TRUE); } START_TEST(run) diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c index 878452fa3c3..a872b1fd14c 100644 --- a/dlls/kernel32/console.c +++ b/dlls/kernel32/console.c @@ -2666,3 +2666,26 @@ BOOL CONSOLE_GetEditionMode(HANDLE hConIn, int* mode) SERVER_END_REQ; return ret; } + +/****************************************************************** + * GetConsoleAliasW + * + * + * RETURNS + * 0 if an error occurred, non-zero for success + * + */ +DWORD WINAPI GetConsoleAliasW(LPWSTR lpSource, LPWSTR lpTargetBuffer, + DWORD TargetBufferLength, LPWSTR lpExename) +{ + static const WCHAR empty[] = {' ',0}; + + FIXME("(%s,%p,%d,%s): stub\n", debugstr_w(lpSource), lpTargetBuffer, TargetBufferLength, debugstr_w(lpExename)); + + if(TargetBufferLength < sizeof(empty)/sizeof(WCHAR)) + return 0; + + lstrcpyW(lpTargetBuffer, empty); + + return 1; +} diff --git a/dlls/kernel32/fiber.c b/dlls/kernel32/fiber.c index fda5f924833..f828cdc3a1b 100644 --- a/dlls/kernel32/fiber.c +++ b/dlls/kernel32/fiber.c @@ -34,9 +34,6 @@ #include "winternl.h" #include "wine/exception.h" #include "wine/library.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(fiber); struct fiber_data { diff --git a/dlls/kernel32/instr.c b/dlls/kernel32/instr.c index 757f0c52778..73edf7b756d 100644 --- a/dlls/kernel32/instr.c +++ b/dlls/kernel32/instr.c @@ -895,7 +895,7 @@ LONG CALLBACK INSTR_vectored_handler( EXCEPTION_POINTERS *ptrs ) /*********************************************************************** * INSTR_CallBuiltinHandler */ -void INSTR_CallBuiltinHandler( CONTEXT86 *context, BYTE intnum ) +static void INSTR_CallBuiltinHandler( CONTEXT86 *context, BYTE intnum ) { if (!winedos.CallBuiltinHandler) load_winedos(); if (winedos.CallBuiltinHandler) winedos.CallBuiltinHandler( context, intnum ); diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 76dd351374a..32e352361c5 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -452,7 +452,7 @@ @ stub GetConsoleAliasExesLengthA @ stub GetConsoleAliasExesLengthW @ stub GetConsoleAliasExesW -@ stub GetConsoleAliasW +@ stdcall GetConsoleAliasW(wstr ptr long wstr) @ stub GetConsoleAliasesA @ stub GetConsoleAliasesLengthA @ stub GetConsoleAliasesLengthW diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c index be1212f2849..3699ff73be2 100644 --- a/dlls/kernel32/kernel_main.c +++ b/dlls/kernel32/kernel_main.c @@ -43,7 +43,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(process); -extern int __wine_set_signal_handler(unsigned, int (*)(unsigned)); +extern int CDECL __wine_set_signal_handler(unsigned, int (*)(unsigned)); static ULONGLONG server_start_time; diff --git a/dlls/kernel32/kernel_private.h b/dlls/kernel32/kernel_private.h index 5ce1e32fe2b..f83b6c38546 100644 --- a/dlls/kernel32/kernel_private.h +++ b/dlls/kernel32/kernel_private.h @@ -80,7 +80,6 @@ extern DWORD FILE_name_WtoA( LPCWSTR src, INT srclen, LPSTR dest, INT destlen ); extern DWORD __wine_emulate_instruction( EXCEPTION_RECORD *rec, CONTEXT86 *context ); extern LONG CALLBACK INSTR_vectored_handler( EXCEPTION_POINTERS *ptrs ); -extern void INSTR_CallBuiltinHandler( CONTEXT86 *context, BYTE intnum ); /* return values for MODULE_GetBinaryType */ enum binary_type diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index 9874a24e15c..1b994ec9d53 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -2857,8 +2857,8 @@ int WINAPI lstrcmpiW(LPCWSTR str1, LPCWSTR str2) */ void LOCALE_Init(void) { - extern void __wine_init_codepages( const union cptable *ansi_cp, const union cptable *oem_cp, - const union cptable *unix_cp ); + extern void CDECL __wine_init_codepages( const union cptable *ansi_cp, const union cptable *oem_cp, + const union cptable *unix_cp ); UINT ansi_cp = 1252, oem_cp = 437, mac_cp = 10000, unix_cp; diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c index ca941aac819..918ce3e3a29 100644 --- a/dlls/kernel32/process.c +++ b/dlls/kernel32/process.c @@ -786,7 +786,7 @@ done: */ static void init_windows_dirs(void) { - extern void __wine_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir ); + extern void CDECL __wine_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir ); static const WCHAR windirW[] = {'w','i','n','d','i','r',0}; static const WCHAR winsysdirW[] = {'w','i','n','s','y','s','d','i','r',0}; diff --git a/dlls/kernel32/snoop16.c b/dlls/kernel32/snoop16.c index b3190886a69..8c79269e8ed 100644 --- a/dlls/kernel32/snoop16.c +++ b/dlls/kernel32/snoop16.c @@ -42,8 +42,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(snoop); #include "pshpack1.h" -void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context); -void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context); +static void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context); +static void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context); typedef struct tagSNOOP16_FUN { /* code part */ @@ -241,7 +241,7 @@ SNOOP16_GetProcAddress16(HMODULE16 hmod,DWORD ordinal,FARPROC16 origfun) { } #define CALLER1REF (*(DWORD*)(MapSL( MAKESEGPTR(context->SegSs,LOWORD(context->Esp)+4)))) -void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) { +static void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) { DWORD ordinal=0; DWORD entry=(DWORD)MapSL( MAKESEGPTR(context->SegCs,LOWORD(context->Eip)) )-5; WORD xcs = context->SegCs; @@ -308,7 +308,7 @@ void WINAPI SNOOP16_Entry(FARPROC proc, LPBYTE args, CONTEXT86 *context) { DPRINTF(") ret=%04x:%04x\n",HIWORD(ret->origreturn),LOWORD(ret->origreturn)); } -void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context) { +static void WINAPI SNOOP16_Return(FARPROC proc, LPBYTE args, CONTEXT86 *context) { SNOOP16_RETURNENTRY *ret = (SNOOP16_RETURNENTRY*)((char *) MapSL( MAKESEGPTR(context->SegCs,LOWORD(context->Eip)) )-5); /* We haven't found out the nrofargs yet. If we called a cdecl diff --git a/dlls/mlang/Makefile.in b/dlls/mlang/Makefile.in index 6bf166122d9..cc721247be1 100644 --- a/dlls/mlang/Makefile.in +++ b/dlls/mlang/Makefile.in @@ -4,7 +4,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = mlang.dll IMPORTLIB = mlang -IMPORTS = uuid ole32 user32 gdi32 advapi32 kernel32 +IMPORTS = uuid ole32 gdi32 advapi32 kernel32 DELAYIMPORTS = oleaut32 EXTRADEFS = -DCOM_NO_WINDOWS_H diff --git a/dlls/mlang/regsvr.c b/dlls/mlang/regsvr.c index f5292bff704..eb6cbd4cc78 100644 --- a/dlls/mlang/regsvr.c +++ b/dlls/mlang/regsvr.c @@ -33,6 +33,8 @@ #include "mlang.h" #include "wine/debug.h" +#include "wine/unicode.h" + #include "initguid.h" WINE_DEFAULT_DEBUG_CHANNEL(mlang); @@ -163,7 +165,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/mlang/tests/mlang.c b/dlls/mlang/tests/mlang.c index fe1edf9b1be..37b62242242 100644 --- a/dlls/mlang/tests/mlang.c +++ b/dlls/mlang/tests/mlang.c @@ -711,7 +711,7 @@ static void IMLangFontLink_Test(IMLangFontLink* iMLFL) } /* copied from libs/wine/string.c */ -WCHAR *strstrW(const WCHAR *str, const WCHAR *sub) +static WCHAR *strstrW(const WCHAR *str, const WCHAR *sub) { while (*str) { diff --git a/dlls/mscat32/mscat32.spec b/dlls/mscat32/mscat32.spec index 5d277deca02..37f6e74aaea 100644 --- a/dlls/mscat32/mscat32.spec +++ b/dlls/mscat32/mscat32.spec @@ -5,30 +5,30 @@ @ stdcall CryptCATAdminEnumCatalogFromHash(long ptr long long ptr) wintrust.CryptCATAdminEnumCatalogFromHash @ stdcall CryptCATAdminReleaseCatalogContext(long long long) wintrust.CryptCATAdminReleaseCatalogContext @ stdcall CryptCATAdminReleaseContext(long long) wintrust.CryptCATAdminReleaseContext -@ stub CryptCATCDFClose +@ stdcall CryptCATCDFClose(ptr) wintrust.CryptCATCDFClose @ stub CryptCATCDFEnumAttributes -@ stub CryptCATCDFEnumAttributesWithCDFTag -@ stub CryptCATCDFEnumCatAttributes +@ stdcall CryptCATCDFEnumAttributesWithCDFTag(ptr wstr ptr ptr ptr) wintrust.CryptCATCDFEnumAttributesWithCDFTag +@ stdcall CryptCATCDFEnumCatAttributes(ptr ptr ptr) wintrust.CryptCATCDFEnumCatAttributes @ stub CryptCATCDFEnumMembers @ stub CryptCATCDFEnumMembersByCDFTag -@ stub CryptCATCDFOpen -@ stub CryptCATCatalogInfoFromContext +@ stdcall CryptCATCDFOpen(wstr ptr) wintrust.CryptCATCDFOpen +@ stdcall CryptCATCatalogInfoFromContext(ptr ptr long) wintrust.CryptCATCatalogInfoFromContext @ stdcall CryptCATClose(long) wintrust.CryptCATClose -@ stub CryptCATEnumerateAttr -@ stub CryptCATEnumerateCatAttr +@ stdcall CryptCATEnumerateAttr(ptr ptr ptr) wintrust.CryptCATEnumerateAttr +@ stdcall CryptCATEnumerateCatAttr(ptr ptr) wintrust.CryptCATEnumerateCatAttr @ stdcall CryptCATEnumerateMember(long ptr) wintrust.CryptCATEnumerateMember -@ stub CryptCATGetAttrInfo -@ stub CryptCATGetCatAttrInfo -@ stub CryptCATGetMemberInfo -@ stub CryptCATHandleFromStore +@ stdcall CryptCATGetAttrInfo(ptr ptr wstr) wintrust.CryptCATGetAttrInfo +@ stdcall CryptCATGetCatAttrInfo(ptr wstr) wintrust.CryptCATGetCatAttrInfo +@ stdcall CryptCATGetMemberInfo(ptr wstr) wintrust.CryptCATGetMemberInfo +@ stdcall CryptCATHandleFromStore(ptr) wintrust.CryptCATHandleFromStore @ stdcall CryptCATOpen(wstr long long long long) wintrust.CryptCATOpen -@ stub CryptCATPersistStore -@ stub CryptCATPutAttrInfo -@ stub CryptCATPutCatAttrInfo -@ stub CryptCATPutMemberInfo -@ stub CryptCATStoreFromHandle +@ stdcall CryptCATPersistStore(ptr) wintrust.CryptCATPersistStore +@ stdcall CryptCATPutAttrInfo(ptr ptr wstr long long ptr) wintrust.CryptCATPutAttrInfo +@ stdcall CryptCATPutCatAttrInfo(ptr wstr long long ptr) wintrust.CryptCATPutCatAttrInfo +@ stdcall CryptCATPutMemberInfo(ptr wstr wstr ptr long long ptr) wintrust.CryptCATPutMemberInfo +@ stdcall CryptCATStoreFromHandle(ptr) wintrust.CryptCATStoreFromHandle @ stdcall -private DllRegisterServer() wintrust.mscat32DllRegisterServer @ stdcall -private DllUnregisterServer() wintrust.mscat32DllUnregisterServer -@ stub IsCatalogFile +@ stdcall IsCatalogFile(ptr wstr) wintrust.IsCatalogFile @ stub MsCatConstructHashTag @ stub MsCatFreeHashTag diff --git a/dlls/mshtml/htmlinput.c b/dlls/mshtml/htmlinput.c index abb6e2e800a..3c851183fe2 100644 --- a/dlls/mshtml/htmlinput.c +++ b/dlls/mshtml/htmlinput.c @@ -1082,7 +1082,7 @@ static HRESULT HTMLInputElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv) *ppv = HTMLINPUT(This); }else if(IsEqualGUID(&IID_IHTMLInputTextElement, riid)) { TRACE("(%p)->(IID_IHTMLInputTextElement %p)\n", This, ppv); - *ppv = HTMLINPUT(This); + *ppv = HTMLINPUTTEXT(This); } if(*ppv) { @@ -1145,6 +1145,7 @@ HTMLElement *HTMLInputElement_Create(nsIDOMHTMLElement *nselem) nsresult nsres; ret->lpHTMLInputElementVtbl = &HTMLInputElementVtbl; + ret->lpHTMLInputTextElementVtbl = &HTMLInputTextElementVtbl; ret->element.node.vtbl = &HTMLInputElementImplVtbl; init_dispex(&ret->element.node.dispex, (IUnknown*)HTMLINPUT(ret), &HTMLInputElement_dispex); diff --git a/dlls/mshtml/htmlstyle.c b/dlls/mshtml/htmlstyle.c index c8f85946735..705f44a4638 100644 --- a/dlls/mshtml/htmlstyle.c +++ b/dlls/mshtml/htmlstyle.c @@ -715,8 +715,10 @@ static HRESULT WINAPI HTMLStyle_put_backgroundImage(IHTMLStyle *iface, BSTR v) static HRESULT WINAPI HTMLStyle_get_backgroundImage(IHTMLStyle *iface, BSTR *p) { HTMLStyle *This = HTMLSTYLE_THIS(iface); - FIXME("(%p)->(%p)\n", This, p); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, p); + + return get_style_attr(This, STYLEID_BACKGROUND_IMAGE, p); } static HRESULT WINAPI HTMLStyle_put_backgroundRepeat(IHTMLStyle *iface, BSTR v) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 60e250db181..6cb41bdde3d 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -348,6 +348,7 @@ typedef struct { nsIInputStream *post_data_stream; nsILoadGroup *load_group; nsIInterfaceRequestor *notif_callback; + nsISupports *owner; nsLoadFlags load_flags; nsIURI *original_uri; char *content_type; @@ -500,6 +501,7 @@ BOOL load_gecko(BOOL); void close_gecko(void); void register_nsservice(nsIComponentRegistrar*,nsIServiceManager*); void init_nsio(nsIComponentManager*,nsIComponentRegistrar*); +void release_nsio(void); BOOL install_wine_gecko(BOOL); HRESULT nsuri_to_url(LPCWSTR,BSTR*); diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 0a543a789ea..188cdd7ba00 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -180,10 +180,10 @@ static nsresult NSAPI nsInputStream_ReadSegments(nsIInputStream *iface, if(!This->buf_size) return S_OK; - if(This->buf_size > aCount) - FIXME("buf_size > aCount\n"); + if(aCount > This->buf_size) + aCount = This->buf_size; - nsres = aWriter(NSINSTREAM(This), aClousure, This->buf, 0, This->buf_size, &written); + nsres = aWriter(NSINSTREAM(This), aClousure, This->buf, 0, aCount, &written); if(NS_FAILED(nsres)) TRACE("aWritter failed: %08x\n", nsres); else if(written != This->buf_size) diff --git a/dlls/mshtml/nsembed.c b/dlls/mshtml/nsembed.c index 923604d05df..34bc6d5dc89 100644 --- a/dlls/mshtml/nsembed.c +++ b/dlls/mshtml/nsembed.c @@ -865,6 +865,8 @@ void close_gecko(void) { TRACE("()\n"); + release_nsio(); + if(pCompMgr) nsIComponentManager_Release(pCompMgr); diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 31fb89710f0..1dca2a49eb1 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -47,6 +47,7 @@ static const IID NS_IOSERVICE_CID = {0x9ac9e770, 0x18bc, 0x11d3, {0x93, 0x37, 0x00, 0x10, 0x4b, 0xa0, 0xfd, 0x40}}; static nsIIOService *nsio = NULL; +static nsINetUtil *net_util; static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0}; @@ -416,8 +417,11 @@ static nsresult NSAPI nsChannel_GetOwner(nsIHttpChannel *iface, nsISupports **aO if(This->channel) return nsIChannel_GetOwner(This->channel, aOwner); - FIXME("default action not implemented\n"); - return NS_ERROR_NOT_IMPLEMENTED; + if(This->owner) + nsISupports_AddRef(This->owner); + *aOwner = This->owner; + + return NS_OK; } static nsresult NSAPI nsChannel_SetOwner(nsIHttpChannel *iface, nsISupports *aOwner) @@ -429,8 +433,13 @@ static nsresult NSAPI nsChannel_SetOwner(nsIHttpChannel *iface, nsISupports *aOw if(This->channel) return nsIChannel_SetOwner(This->channel, aOwner); - FIXME("default action not implemented\n"); - return NS_ERROR_NOT_IMPLEMENTED; + if(aOwner) + nsISupports_AddRef(aOwner); + if(This->owner) + nsISupports_Release(This->owner); + This->owner = aOwner; + + return NS_OK; } static nsresult NSAPI nsChannel_GetNotificationCallbacks(nsIHttpChannel *iface, @@ -2260,21 +2269,9 @@ static nsrefcnt NSAPI nsNetUtil_Release(nsINetUtil *iface) static nsresult NSAPI nsNetUtil_ParseContentType(nsINetUtil *iface, const nsACString *aTypeHeader, nsACString *aCharset, PRBool *aHadCharset, nsACString *aContentType) { - nsINetUtil *net_util; - nsresult nsres; - TRACE("(%p %p %p %p)\n", aTypeHeader, aCharset, aHadCharset, aContentType); - nsres = nsIIOService_QueryInterface(nsio, &IID_nsINetUtil, (void**)&net_util); - if(NS_FAILED(nsres)) { - WARN("Could not get nsINetUtil interface: %08x\n", nsres); - return nsres; - } - - nsres = nsINetUtil_ParseContentType(net_util, aTypeHeader, aCharset, aHadCharset, aContentType); - - nsINetUtil_Release(net_util); - return nsres; + return nsINetUtil_ParseContentType(net_util, aTypeHeader, aCharset, aHadCharset, aContentType); } static const nsINetUtilVtbl nsNetUtilVtbl = { @@ -2380,6 +2377,13 @@ void init_nsio(nsIComponentManager *component_manager, nsIComponentRegistrar *re return; } + nsres = nsIIOService_QueryInterface(nsio, &IID_nsINetUtil, (void**)&net_util); + if(NS_FAILED(nsres)) { + WARN("Could not get nsINetUtil interface: %08x\n", nsres); + nsIIOService_Release(nsio); + return; + } + nsres = nsIComponentRegistrar_UnregisterFactory(registrar, &NS_IOSERVICE_CID, old_factory); nsIFactory_Release(old_factory); if(NS_FAILED(nsres)) @@ -2390,3 +2394,16 @@ void init_nsio(nsIComponentManager *component_manager, nsIComponentRegistrar *re if(NS_FAILED(nsres)) ERR("RegisterFactory failed: %08x\n", nsres); } + +void release_nsio(void) +{ + if(net_util) { + nsINetUtil_Release(net_util); + net_util = NULL; + } + + if(nsio) { + nsIIOService_Release(nsio); + nsio = NULL; + } +} diff --git a/dlls/msi/action.c b/dlls/msi/action.c index 654a7d05f60..3a32a064c95 100644 --- a/dlls/msi/action.c +++ b/dlls/msi/action.c @@ -480,6 +480,44 @@ static UINT msi_check_patch_applicable( MSIPACKAGE *package, MSISUMMARYINFO *si return ret; } +static UINT msi_set_media_source_prop(MSIPACKAGE *package) +{ + MSIQUERY *view; + MSIRECORD *rec = NULL; + LPWSTR patch; + LPCWSTR prop; + UINT r; + + static const WCHAR szPatch[] = {'P','A','T','C','H',0}; + static const WCHAR query[] = {'S','E','L','E','C','T',' ', + '`','S','o','u','r','c','e','`',' ','F','R','O','M',' ', + '`','M','e','d','i','a','`',' ','W','H','E','R','E',' ', + '`','S','o','u','r','c','e','`',' ','I','S',' ', + 'N','O','T',' ','N','U','L','L',0}; + + r = MSI_DatabaseOpenViewW(package->db, query, &view); + if (r != ERROR_SUCCESS) + return r; + + r = MSI_ViewExecute(view, 0); + if (r != ERROR_SUCCESS) + goto done; + + if (MSI_ViewFetch(view, &rec) == ERROR_SUCCESS) + { + prop = MSI_RecordGetString(rec, 1); + patch = msi_dup_property(package, szPatch); + MSI_SetPropertyW(package, prop, patch); + msi_free(patch); + } + +done: + if (rec) msiobj_release(&rec->hdr); + msiobj_release(&view->hdr); + + return r; +} + static UINT msi_parse_patch_summary( MSIPACKAGE *package, MSIDATABASE *patch_db ) { MSISUMMARYINFO *si; @@ -490,20 +528,33 @@ static UINT msi_parse_patch_summary( MSIPACKAGE *package, MSIDATABASE *patch_db if (!si) return ERROR_FUNCTION_FAILED; - msi_check_patch_applicable( package, si ); + if (msi_check_patch_applicable( package, si ) != ERROR_SUCCESS) + { + TRACE("Patch not applicable\n"); + return ERROR_SUCCESS; + } + + package->patch = msi_alloc(sizeof(MSIPATCHINFO)); + if (!package->patch) + return ERROR_OUTOFMEMORY; + + package->patch->patchcode = msi_suminfo_dup_string(si, PID_REVNUMBER); + if (!package->patch->patchcode) + return ERROR_OUTOFMEMORY; /* enumerate the substorage */ str = msi_suminfo_dup_string( si, PID_LASTAUTHOR ); + package->patch->transforms = str; + substorage = msi_split_string( str, ';' ); for ( i = 0; substorage && substorage[i] && r == ERROR_SUCCESS; i++ ) r = msi_apply_substorage_transform( package, patch_db, substorage[i] ); - msi_free( substorage ); - msi_free( str ); - - /* FIXME: parse the sources in PID_REVNUMBER and do something with them... */ + msi_free( substorage ); msiobj_release( &si->hdr ); + msi_set_media_source_prop(package); + return r; } @@ -3568,6 +3619,39 @@ static BOOL msi_check_unpublish(MSIPACKAGE *package) return TRUE; } +static UINT msi_publish_patch(MSIPACKAGE *package, HKEY prodkey, HKEY hudkey) +{ + WCHAR patch_squashed[GUID_SIZE]; + HKEY patches; + LONG res; + UINT r = ERROR_FUNCTION_FAILED; + + static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0}; + + res = RegCreateKeyExW(prodkey, szPatches, 0, NULL, 0, KEY_ALL_ACCESS, NULL, + &patches, NULL); + if (res != ERROR_SUCCESS) + return ERROR_FUNCTION_FAILED; + + squash_guid(package->patch->patchcode, patch_squashed); + + res = RegSetValueExW(patches, szPatches, 0, REG_MULTI_SZ, + (const BYTE *)patch_squashed, + (lstrlenW(patch_squashed) + 1) * sizeof(WCHAR)); + if (res != ERROR_SUCCESS) + goto done; + + res = RegSetValueExW(patches, patch_squashed, 0, REG_SZ, + (const BYTE *)package->patch->transforms, + (lstrlenW(package->patch->transforms) + 1) * sizeof(WCHAR)); + if (res == ERROR_SUCCESS) + r = ERROR_SUCCESS; + +done: + RegCloseKey(patches); + return r; +} + /* * 99% of the work done here is only done for * advertised installs. However this is where the @@ -3589,25 +3673,22 @@ static UINT ACTION_PublishProduct(MSIPACKAGE *package) if (rc != ERROR_SUCCESS) goto end; - if (package->Context == MSIINSTALLCONTEXT_MACHINE) - { - rc = MSIREG_OpenUserDataProductKey(package->ProductCode, szLocalSid, - &hudkey, TRUE); - if (rc != ERROR_SUCCESS) - goto end; - } - else - { - rc = MSIREG_OpenUserDataProductKey(package->ProductCode, NULL, - &hudkey, TRUE); - if (rc != ERROR_SUCCESS) - goto end; - } + rc = MSIREG_OpenUserDataProductKey(package->ProductCode, package->Context, + NULL, &hudkey, TRUE); + if (rc != ERROR_SUCCESS) + goto end; rc = msi_publish_upgrade_code(package); if (rc != ERROR_SUCCESS) goto end; + if (package->patch) + { + rc = msi_publish_patch(package, hukey, hudkey); + if (rc != ERROR_SUCCESS) + goto end; + } + rc = msi_publish_product_properties(package, hukey); if (rc != ERROR_SUCCESS) goto end; @@ -4168,19 +4249,10 @@ static UINT ACTION_RegisterProduct(MSIPACKAGE *package) if (rc != ERROR_SUCCESS) return rc; - if (package->Context == MSIINSTALLCONTEXT_MACHINE) - { - rc = MSIREG_OpenInstallProps(package->ProductCode, szLocalSid, - &props, TRUE); - if (rc != ERROR_SUCCESS) - goto done; - } - else - { - rc = MSIREG_OpenCurrentUserInstallProps(package->ProductCode, &props, TRUE); - if (rc != ERROR_SUCCESS) - goto done; - } + rc = MSIREG_OpenInstallProps(package->ProductCode, package->Context, + NULL, &props, TRUE); + if (rc != ERROR_SUCCESS) + goto done; msi_make_package_local(package, props); @@ -4438,11 +4510,8 @@ static UINT ACTION_RegisterUser(MSIPACKAGE *package) if (!productid) return ERROR_SUCCESS; - if (package->Context == MSIINSTALLCONTEXT_MACHINE) - rc = MSIREG_OpenInstallProps(package->ProductCode, szLocalSid, &hkey, TRUE); - else - rc = MSIREG_OpenCurrentUserInstallProps(package->ProductCode, &hkey, TRUE); - + rc = MSIREG_OpenInstallProps(package->ProductCode, package->Context, + NULL, &hkey, TRUE); if (rc != ERROR_SUCCESS) goto end; diff --git a/dlls/msi/events.c b/dlls/msi/events.c index 79e1f663462..cb70b69c66c 100644 --- a/dlls/msi/events.c +++ b/dlls/msi/events.c @@ -104,7 +104,7 @@ static UINT ControlEvent_EndDialog(MSIPACKAGE* package, LPCWSTR argument, else if (lstrcmpW(argument, szRetry) == 0) package->CurrentInstallState = ERROR_INSTALL_SUSPEND; else if (lstrcmpW(argument, szIgnore) == 0) - package->CurrentInstallState = -1; + package->CurrentInstallState = ERROR_SUCCESS; else if (lstrcmpW(argument, szReturn) == 0) { msi_dialog *parent = msi_dialog_get_parent(dialog); diff --git a/dlls/msi/helpers.c b/dlls/msi/helpers.c index 5c9dfd017ec..ea36b3d5f9c 100644 --- a/dlls/msi/helpers.c +++ b/dlls/msi/helpers.c @@ -661,6 +661,13 @@ void ACTION_free_package_structures( MSIPACKAGE* package) msi_free(package->script); } + if (package->patch) + { + msi_free(package->patch->patchcode); + msi_free(package->patch->transforms); + msi_free(package->patch); + } + msi_free(package->BaseURL); msi_free(package->PackagePath); msi_free(package->ProductCode); diff --git a/dlls/msi/msi.c b/dlls/msi/msi.c index ef1b8718018..9a5c54a74e0 100644 --- a/dlls/msi/msi.c +++ b/dlls/msi/msi.c @@ -107,12 +107,7 @@ static UINT MSI_OpenProductW(LPCWSTR szProduct, MSIPACKAGE **package) if (r != ERROR_SUCCESS) return r; - if (context == MSIINSTALLCONTEXT_MACHINE) - r = MSIREG_OpenInstallProps(szProduct, szLocalSid, &props, FALSE); - else if (context == MSIINSTALLCONTEXT_USERMANAGED || - context == MSIINSTALLCONTEXT_USERUNMANAGED) - r = MSIREG_OpenCurrentUserInstallProps(szProduct, &props, FALSE); - + r = MSIREG_OpenInstallProps(szProduct, context, NULL, &props, FALSE); if (r != ERROR_SUCCESS) return ERROR_UNKNOWN_PRODUCT; @@ -406,11 +401,8 @@ static UINT msi_open_package(LPCWSTR product, MSIINSTALLCONTEXT context, static const WCHAR szLocalPackage[] = { 'L','o','c','a','l','P','a','c','k','a','g','e',0}; - if (context == MSIINSTALLCONTEXT_MACHINE) - r = MSIREG_OpenInstallProps(product, szLocalSid, &props, FALSE); - else - r = MSIREG_OpenCurrentUserInstallProps(product, &props, FALSE); + r = MSIREG_OpenInstallProps(product, context, NULL, &props, FALSE); if (r != ERROR_SUCCESS) return ERROR_BAD_CONFIGURATION; @@ -693,12 +685,12 @@ static LPWSTR msi_reg_get_value(HKEY hkey, LPCWSTR name, DWORD *type) static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, awstring *szValue, LPDWORD pcchValueBuf) { + MSIINSTALLCONTEXT context = MSIINSTALLCONTEXT_USERUNMANAGED; UINT r = ERROR_UNKNOWN_PROPERTY; HKEY prodkey, userdata, source; LPWSTR val = NULL; WCHAR squished_pc[GUID_SIZE]; WCHAR packagecode[GUID_SIZE]; - BOOL classes = FALSE; BOOL badconfig = FALSE; LONG res; DWORD save, type = REG_NONE; @@ -729,13 +721,10 @@ static UINT MSI_GetProductInfo(LPCWSTR szProduct, LPCWSTR szAttribute, (r = MSIREG_OpenProductKey(szProduct, MSIINSTALLCONTEXT_MACHINE, &prodkey, FALSE)) == ERROR_SUCCESS) { - classes = TRUE; + context = MSIINSTALLCONTEXT_MACHINE; } - if (classes) - MSIREG_OpenInstallProps(szProduct, szLocalSid, &userdata, FALSE); - else - MSIREG_OpenCurrentUserInstallProps(szProduct, &userdata, FALSE); + MSIREG_OpenInstallProps(szProduct, context, NULL, &userdata, FALSE); if (!lstrcmpW(szAttribute, INSTALLPROPERTY_HELPLINKW) || !lstrcmpW(szAttribute, INSTALLPROPERTY_HELPTELEPHONEW) || @@ -1038,15 +1027,17 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid) return ERROR_INVALID_PARAMETER; + /* FIXME: dwContext is provided, no need to search for it */ MSIREG_OpenProductKey(szProductCode, MSIINSTALLCONTEXT_USERMANAGED, &managed, FALSE); MSIREG_OpenProductKey(szProductCode, MSIINSTALLCONTEXT_USERUNMANAGED, &prod, FALSE); + MSIREG_OpenInstallProps(szProductCode, dwContext, NULL, &props, FALSE); + if (dwContext == MSIINSTALLCONTEXT_USERUNMANAGED) { package = INSTALLPROPERTY_LOCALPACKAGEW; - MSIREG_OpenCurrentUserInstallProps(szProductCode, &props, FALSE); if (!props && !prod) goto done; @@ -1054,7 +1045,6 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, else if (dwContext == MSIINSTALLCONTEXT_USERMANAGED) { package = managed_local_package; - MSIREG_OpenCurrentUserInstallProps(szProductCode, &props, FALSE); if (!props && !managed) goto done; @@ -1062,7 +1052,6 @@ UINT WINAPI MsiGetProductInfoExW(LPCWSTR szProductCode, LPCWSTR szUserSid, else if (dwContext == MSIINSTALLCONTEXT_MACHINE) { package = INSTALLPROPERTY_LOCALPACKAGEW; - MSIREG_OpenInstallProps(szProductCode, szLocalSid, &props, FALSE); MSIREG_OpenProductKey(szProductCode, dwContext, &classes, FALSE); if (!props && !classes) @@ -1190,6 +1179,223 @@ done: return r; } +UINT WINAPI MsiGetPatchInfoExA(LPCSTR szPatchCode, LPCSTR szProductCode, + LPCSTR szUserSid, MSIINSTALLCONTEXT dwContext, + LPCSTR szProperty, LPSTR lpValue, DWORD *pcchValue) +{ + LPWSTR patch = NULL, product = NULL, usersid = NULL; + LPWSTR property = NULL, val = NULL; + DWORD len; + UINT r; + + TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_a(szPatchCode), + debugstr_a(szProductCode), debugstr_a(szUserSid), dwContext, + debugstr_a(szProperty), lpValue, pcchValue); + + if (lpValue && !pcchValue) + return ERROR_INVALID_PARAMETER; + + if (szPatchCode) patch = strdupAtoW(szPatchCode); + if (szProductCode) product = strdupAtoW(szProductCode); + if (szUserSid) usersid = strdupAtoW(szUserSid); + if (szProperty) property = strdupAtoW(szProperty); + + len = 0; + r = MsiGetPatchInfoExW(patch, product, usersid, dwContext, property, + NULL, &len); + if (r != ERROR_SUCCESS) + goto done; + + val = msi_alloc(++len * sizeof(WCHAR)); + if (!val) + { + r = ERROR_OUTOFMEMORY; + goto done; + } + + r = MsiGetPatchInfoExW(patch, product, usersid, dwContext, property, + val, &len); + if (r != ERROR_SUCCESS || !pcchValue) + goto done; + + if (lpValue) + WideCharToMultiByte(CP_ACP, 0, val, -1, lpValue, + *pcchValue - 1, NULL, NULL); + + len = lstrlenW(val); + if ((*val && *pcchValue < len + 1) || !lpValue) + { + if (lpValue) + { + r = ERROR_MORE_DATA; + lpValue[*pcchValue - 1] = '\0'; + } + + *pcchValue = len * sizeof(WCHAR); + } + else + *pcchValue = len; + +done: + msi_free(val); + msi_free(patch); + msi_free(product); + msi_free(usersid); + msi_free(property); + + return r; +} + +UINT WINAPI MsiGetPatchInfoExW(LPCWSTR szPatchCode, LPCWSTR szProductCode, + LPCWSTR szUserSid, MSIINSTALLCONTEXT dwContext, + LPCWSTR szProperty, LPWSTR lpValue, DWORD *pcchValue) +{ + WCHAR squished_pc[GUID_SIZE]; + WCHAR squished_patch[GUID_SIZE]; + HKEY udprod = 0, prod = 0, props = 0; + HKEY patch = 0, patches = 0; + HKEY udpatch = 0, datakey = 0; + HKEY prodpatches = 0; + LPWSTR val = NULL; + UINT r = ERROR_UNKNOWN_PRODUCT; + DWORD len; + LONG res; + + static const WCHAR szEmpty[] = {0}; + static const WCHAR szPatches[] = {'P','a','t','c','h','e','s',0}; + static const WCHAR szInstalled[] = {'I','n','s','t','a','l','l','e','d',0}; + static const WCHAR szManagedPackage[] = {'M','a','n','a','g','e','d', + 'L','o','c','a','l','P','a','c','k','a','g','e',0}; + + TRACE("(%s, %s, %s, %d, %s, %p, %p)\n", debugstr_w(szPatchCode), + debugstr_w(szProductCode), debugstr_w(szUserSid), dwContext, + debugstr_w(szProperty), lpValue, pcchValue); + + if (!szProductCode || !squash_guid(szProductCode, squished_pc)) + return ERROR_INVALID_PARAMETER; + + if (!szPatchCode || !squash_guid(szPatchCode, squished_patch)) + return ERROR_INVALID_PARAMETER; + + if (!szProperty) + return ERROR_INVALID_PARAMETER; + + if (lpValue && !pcchValue) + return ERROR_INVALID_PARAMETER; + + if (dwContext != MSIINSTALLCONTEXT_USERMANAGED && + dwContext != MSIINSTALLCONTEXT_USERUNMANAGED && + dwContext != MSIINSTALLCONTEXT_MACHINE) + return ERROR_INVALID_PARAMETER; + + if (dwContext == MSIINSTALLCONTEXT_MACHINE && szUserSid) + return ERROR_INVALID_PARAMETER; + + if (!lstrcmpW(szUserSid, szLocalSid)) + return ERROR_INVALID_PARAMETER; + + if (MSIREG_OpenUserDataProductKey(szProductCode, dwContext, NULL, + &udprod, FALSE) != ERROR_SUCCESS) + goto done; + + if (MSIREG_OpenInstallProps(szProductCode, dwContext, NULL, + &props, FALSE) != ERROR_SUCCESS) + goto done; + + r = ERROR_UNKNOWN_PATCH; + + res = RegOpenKeyExW(udprod, szPatches, 0, KEY_READ, &patches); + if (res != ERROR_SUCCESS) + goto done; + + res = RegOpenKeyExW(patches, squished_patch, 0, KEY_READ, &patch); + if (res != ERROR_SUCCESS) + goto done; + + if (!lstrcmpW(szProperty, INSTALLPROPERTY_TRANSFORMSW)) + { + if (MSIREG_OpenProductKey(szProductCode, dwContext, + &prod, FALSE) != ERROR_SUCCESS) + goto done; + + res = RegOpenKeyExW(prod, szPatches, 0, KEY_ALL_ACCESS, &prodpatches); + if (res != ERROR_SUCCESS) + goto done; + + datakey = prodpatches; + szProperty = squished_patch; + } + else + { + if (MSIREG_OpenUserDataPatchKey(szPatchCode, dwContext, + &udpatch, FALSE) != ERROR_SUCCESS) + goto done; + + if (!lstrcmpW(szProperty, INSTALLPROPERTY_LOCALPACKAGEW)) + { + if (dwContext == MSIINSTALLCONTEXT_USERMANAGED) + szProperty = szManagedPackage; + datakey = udpatch; + } + else if (!lstrcmpW(szProperty, INSTALLPROPERTY_INSTALLDATEW)) + { + datakey = patch; + szProperty = szInstalled; + } + else if (!lstrcmpW(szProperty, INSTALLPROPERTY_LOCALPACKAGEW)) + { + datakey = udpatch; + } + else if (!lstrcmpW(szProperty, INSTALLPROPERTY_UNINSTALLABLEW) || + !lstrcmpW(szProperty, INSTALLPROPERTY_PATCHSTATEW) || + !lstrcmpW(szProperty, INSTALLPROPERTY_DISPLAYNAMEW) || + !lstrcmpW(szProperty, INSTALLPROPERTY_MOREINFOURLW)) + { + datakey = patch; + } + else + { + r = ERROR_UNKNOWN_PROPERTY; + goto done; + } + } + + val = msi_reg_get_val_str(datakey, szProperty); + if (!val) + val = strdupW(szEmpty); + + r = ERROR_SUCCESS; + + if (!pcchValue) + goto done; + + if (lpValue) + lstrcpynW(lpValue, val, *pcchValue); + + len = lstrlenW(val); + if ((*val && *pcchValue < len + 1) || !lpValue) + { + if (lpValue) + r = ERROR_MORE_DATA; + + *pcchValue = len * sizeof(WCHAR); + } + + *pcchValue = len; + +done: + msi_free(val); + RegCloseKey(prodpatches); + RegCloseKey(prod); + RegCloseKey(patch); + RegCloseKey(patches); + RegCloseKey(udpatch); + RegCloseKey(props); + RegCloseKey(udprod); + + return r; +} + UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes) { LPWSTR szwLogFile = NULL; @@ -1295,11 +1501,7 @@ static BOOL msi_comp_find_package(LPCWSTR prodcode, MSIINSTALLCONTEXT context) 'M','a','n','a','g','e','d','L','o','c','a','l','P','a','c','k','a','g','e',0 }; - if (context == MSIINSTALLCONTEXT_MACHINE) - r = MSIREG_OpenInstallProps(prodcode, szLocalSid, &hkey, FALSE); - else - r = MSIREG_OpenCurrentUserInstallProps(prodcode, &hkey, FALSE); - + r = MSIREG_OpenInstallProps(prodcode, context, NULL, &hkey, FALSE); if (r != ERROR_SUCCESS) return FALSE; @@ -1413,9 +1615,9 @@ INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct) INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct) { + MSIINSTALLCONTEXT context = MSIINSTALLCONTEXT_USERUNMANAGED; INSTALLSTATE state = INSTALLSTATE_ADVERTISED; HKEY prodkey = 0, userdata = 0; - BOOL user = TRUE; DWORD val; UINT r; @@ -1437,21 +1639,12 @@ INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct) MSIREG_OpenProductKey(szProduct, MSIINSTALLCONTEXT_MACHINE, &prodkey, FALSE) == ERROR_SUCCESS) { - user = FALSE; + context = MSIINSTALLCONTEXT_MACHINE; } - if (user) - { - r = MSIREG_OpenCurrentUserInstallProps(szProduct, &userdata, FALSE); - if (r != ERROR_SUCCESS) - goto done; - } - else - { - r = MSIREG_OpenInstallProps(szProduct, szLocalSid, &userdata, FALSE); - if (r != ERROR_SUCCESS) - goto done; - } + r = MSIREG_OpenInstallProps(szProduct, context, NULL, &userdata, FALSE); + if (r != ERROR_SUCCESS) + goto done; if (!msi_reg_get_val_dword(userdata, szWindowsInstaller, &val)) goto done; @@ -1909,8 +2102,10 @@ static INSTALLSTATE MSI_GetComponentPath(LPCWSTR szProduct, LPCWSTR szComponent, state = INSTALLSTATE_ABSENT; - if ((MSIREG_OpenInstallProps(szProduct, szLocalSid, &hkey, FALSE) == ERROR_SUCCESS || - MSIREG_OpenUserDataProductKey(szProduct, NULL, &hkey, FALSE) == ERROR_SUCCESS) && + if ((MSIREG_OpenInstallProps(szProduct, MSIINSTALLCONTEXT_MACHINE, NULL, + &hkey, FALSE) == ERROR_SUCCESS || + MSIREG_OpenUserDataProductKey(szProduct, MSIINSTALLCONTEXT_USERUNMANAGED, + NULL, &hkey, FALSE) == ERROR_SUCCESS) && msi_reg_get_val_dword(hkey, wininstaller, &version) && GetFileAttributesW(path) != INVALID_FILE_ATTRIBUTES) { @@ -2573,8 +2768,10 @@ static USERINFOSTATE MSI_GetUserInfo(LPCWSTR szProduct, return USERINFOSTATE_UNKNOWN; } - if (MSIREG_OpenCurrentUserInstallProps(szProduct, &props, FALSE) != ERROR_SUCCESS && - MSIREG_OpenInstallProps(szProduct, szLocalSid, &props, FALSE) != ERROR_SUCCESS) + if (MSIREG_OpenInstallProps(szProduct, MSIINSTALLCONTEXT_USERUNMANAGED, + NULL, &props, FALSE) != ERROR_SUCCESS && + MSIREG_OpenInstallProps(szProduct, MSIINSTALLCONTEXT_MACHINE, + NULL, &props, FALSE) != ERROR_SUCCESS) { RegCloseKey(hkey); return USERINFOSTATE_ABSENT; diff --git a/dlls/msi/msi.spec b/dlls/msi/msi.spec index db7aa902e1c..017fdbe4adb 100644 --- a/dlls/msi/msi.spec +++ b/dlls/msi/msi.spec @@ -236,8 +236,8 @@ 240 stub MsiApplyMultiplePatchesW 241 stub MsiExtractPatchXMLDataA 242 stub MsiExtractPatchXMLDataW -243 stub MsiGetPatchInfoExA -244 stub MsiGetPatchInfoExW +243 stdcall MsiGetPatchInfoExA(str str str long str ptr ptr) +244 stdcall MsiGetPatchInfoExW(wstr wstr wstr long wstr ptr ptr) 245 stdcall MsiEnumProductsExA(str str long long ptr ptr ptr ptr) 246 stdcall MsiEnumProductsExW(wstr wstr long long ptr ptr ptr ptr) 247 stdcall MsiGetProductInfoExA(str str long str ptr ptr) diff --git a/dlls/msi/msipriv.h b/dlls/msi/msipriv.h index 99eff8fbdd6..7c788d40426 100644 --- a/dlls/msi/msipriv.h +++ b/dlls/msi/msipriv.h @@ -144,6 +144,12 @@ typedef struct tagMSIMEDIAINFO WCHAR source[MAX_PATH]; } MSIMEDIAINFO; +typedef struct tagMSIPATCHINFO +{ + LPWSTR patchcode; + LPWSTR transforms; +} MSIPATCHINFO; + typedef struct _column_info { LPCWSTR table; @@ -294,6 +300,7 @@ typedef struct tagMSIPACKAGE { MSIOBJECTHDR hdr; MSIDATABASE *db; + MSIPATCHINFO *patch; struct list components; struct list features; struct list files; @@ -776,11 +783,12 @@ extern UINT MSIREG_OpenUserComponentsKey(LPCWSTR szComponent, HKEY* key, BOOL cr extern UINT MSIREG_OpenUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid, HKEY *key, BOOL create); extern UINT MSIREG_OpenPatchesKey(LPCWSTR szPatch, HKEY* key, BOOL create); -extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, - HKEY* key, BOOL create); -extern UINT MSIREG_OpenCurrentUserInstallProps(LPCWSTR szProduct, HKEY* key, BOOL create); -extern UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID, - HKEY *key, BOOL create); +extern UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, + LPCWSTR szUserSid, HKEY *key, BOOL create); +extern UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, + HKEY *key, BOOL create); +extern UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, + LPCWSTR szUserSid, HKEY *key, BOOL create); extern UINT MSIREG_OpenUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_OpenUserUpgradeCodesKey(LPCWSTR szProduct, HKEY* key, BOOL create); extern UINT MSIREG_DeleteProductKey(LPCWSTR szProduct); diff --git a/dlls/msi/package.c b/dlls/msi/package.c index f6ef1993e2b..018389a140c 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -731,6 +731,7 @@ static MSIPACKAGE *msi_alloc_package( void ) list_init( &package->sourcelist_info ); list_init( &package->sourcelist_media ); + package->patch = NULL; package->ActionFormat = NULL; package->LastAction = NULL; package->dialog = NULL; diff --git a/dlls/msi/record.c b/dlls/msi/record.c index 8b987f8f738..b02fcd10b9a 100644 --- a/dlls/msi/record.c +++ b/dlls/msi/record.c @@ -358,15 +358,16 @@ UINT MSI_RecordGetStringA(MSIRECORD *rec, UINT iField, case MSIFIELD_WSTR: len = WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1, NULL, 0 , NULL, NULL); - WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1, - szValue, *pcchValue, NULL, NULL); + if (szValue) + WideCharToMultiByte( CP_ACP, 0, rec->fields[iField].u.szwVal, -1, + szValue, *pcchValue, NULL, NULL); if( szValue && *pcchValue && len>*pcchValue ) szValue[*pcchValue-1] = 0; if( len ) len--; break; case MSIFIELD_NULL: - if( *pcchValue > 0 ) + if( szValue && *pcchValue > 0 ) szValue[0] = 0; break; default: diff --git a/dlls/msi/registry.c b/dlls/msi/registry.c index db9ec65dfc5..9c6f7ff8952 100644 --- a/dlls/msi/registry.c +++ b/dlls/msi/registry.c @@ -799,8 +799,8 @@ UINT MSIREG_DeleteUserDataComponentKey(LPCWSTR szComponent, LPCWSTR szUserSid) return RegDeleteTreeW(HKEY_LOCAL_MACHINE, keypath); } -UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, - HKEY *key, BOOL create) +UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, + LPCWSTR szUserSid, HKEY *key, BOOL create) { UINT rc; WCHAR squished_pc[GUID_SIZE]; @@ -812,7 +812,11 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(squished_pc)); - if (!szUserSid) + if (dwContext == MSIINSTALLCONTEXT_MACHINE) + sprintfW(keypath, szUserDataProd_fmt, szLocalSid, squished_pc); + else if (szUserSid) + sprintfW(keypath, szUserDataProd_fmt, usersid, squished_pc); + else { rc = get_user_sid(&usersid); if (rc != ERROR_SUCCESS || !usersid) @@ -824,8 +828,6 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, sprintfW(keypath, szUserDataProd_fmt, usersid, squished_pc); LocalFree(usersid); } - else - sprintfW(keypath, szUserDataProd_fmt, szUserSid, squished_pc); if (create) rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); @@ -835,36 +837,45 @@ UINT MSIREG_OpenUserDataProductKey(LPCWSTR szProduct, LPCWSTR szUserSid, return rc; } -UINT MSIREG_OpenUserDataPatchKey(LPWSTR patch, HKEY *key, BOOL create) +UINT MSIREG_OpenUserDataPatchKey(LPCWSTR szPatch, MSIINSTALLCONTEXT dwContext, + HKEY *key, BOOL create) { UINT rc; + WCHAR squished_patch[GUID_SIZE]; WCHAR keypath[0x200]; LPWSTR usersid; - TRACE("\n"); + TRACE("%s\n", debugstr_w(szPatch)); + if (!squash_guid(szPatch, squished_patch)) + return ERROR_FUNCTION_FAILED; + TRACE("squished (%s)\n", debugstr_w(squished_patch)); - rc = get_user_sid(&usersid); - if (rc != ERROR_SUCCESS || !usersid) + if (dwContext == MSIINSTALLCONTEXT_MACHINE) + sprintfW(keypath, szUserDataPatch_fmt, szLocalSid, squished_patch); + else { - ERR("Failed to retrieve user SID: %d\n", rc); - return rc; - } + rc = get_user_sid(&usersid); + if (rc != ERROR_SUCCESS || !usersid) + { + ERR("Failed to retrieve user SID: %d\n", rc); + return rc; + } - sprintfW(keypath, szUserDataPatch_fmt, usersid, patch); + sprintfW(keypath, szUserDataPatch_fmt, usersid, squished_patch); + LocalFree(usersid); + } if (create) - rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); - else - rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); + return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); - LocalFree(usersid); - return rc; + return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); } -UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID, - HKEY *key, BOOL create) +UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, MSIINSTALLCONTEXT dwContext, + LPCWSTR szUserSid, HKEY *key, BOOL create) { UINT rc; + LPWSTR usersid; WCHAR squished_pc[GUID_SIZE]; WCHAR keypath[0x200]; @@ -873,33 +884,27 @@ UINT MSIREG_OpenInstallProps(LPCWSTR szProduct, LPCWSTR szUserSID, return ERROR_FUNCTION_FAILED; TRACE("squished (%s)\n", debugstr_w(squished_pc)); - sprintfW(keypath, szInstallProperties_fmt, szUserSID, squished_pc); - - if (create) - rc = RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); + if (dwContext == MSIINSTALLCONTEXT_MACHINE) + sprintfW(keypath, szInstallProperties_fmt, szLocalSid, squished_pc); + else if (szUserSid) + sprintfW(keypath, szInstallProperties_fmt, szUserSid, squished_pc); else - rc = RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); - - return rc; -} - -UINT MSIREG_OpenCurrentUserInstallProps(LPCWSTR szProduct, HKEY *key, - BOOL create) -{ - UINT rc; - LPWSTR usersid; - - rc = get_user_sid(&usersid); - if (rc != ERROR_SUCCESS || !usersid) { - ERR("Failed to retrieve user SID: %d\n", rc); - return rc; + rc = get_user_sid(&usersid); + if (rc != ERROR_SUCCESS || !usersid) + { + ERR("Failed to retrieve user SID: %d\n", rc); + return rc; + } + + sprintfW(keypath, szInstallProperties_fmt, usersid, squished_pc); + LocalFree(usersid); } - rc = MSIREG_OpenInstallProps(szProduct, usersid, key, create); + if (create) + return RegCreateKeyW(HKEY_LOCAL_MACHINE, keypath, key); - LocalFree(usersid); - return rc; + return RegOpenKeyW(HKEY_LOCAL_MACHINE, keypath, key); } UINT MSIREG_DeleteUserDataProductKey(LPCWSTR szProduct) @@ -1679,7 +1684,8 @@ static UINT msi_get_patch_state(LPCWSTR prodcode, LPCWSTR usersid, *state = MSIPATCHSTATE_INVALID; /* FIXME: usersid might not be current user */ - r = MSIREG_OpenUserDataProductKey(prodcode, NULL, &prod, FALSE); + r = MSIREG_OpenUserDataProductKey(prodcode, MSIINSTALLCONTEXT_USERUNMANAGED, + NULL, &prod, FALSE); if (r != ERROR_SUCCESS) return ERROR_NO_MORE_ITEMS; @@ -1816,7 +1822,8 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, } else { - temp = MSIREG_OpenUserDataPatchKey(ptr, &patchkey, FALSE); + temp = MSIREG_OpenUserDataPatchKey(patch, context, + &patchkey, FALSE); RegCloseKey(patchkey); if (temp != ERROR_SUCCESS) continue; @@ -1826,7 +1833,7 @@ static UINT msi_check_product_patches(LPCWSTR prodcode, LPCWSTR usersid, { usersid = szEmpty; - if (MSIREG_OpenUserDataProductKey(prodcode, szLocalSid, &localprod, FALSE) == ERROR_SUCCESS && + if (MSIREG_OpenUserDataProductKey(prodcode, context, NULL, &localprod, FALSE) == ERROR_SUCCESS && RegOpenKeyExW(localprod, szPatches, 0, KEY_READ, &localpatch) == ERROR_SUCCESS && RegOpenKeyExW(localpatch, ptr, 0, KEY_READ, &patchkey) == ERROR_SUCCESS) { diff --git a/dlls/msi/regsvr.c b/dlls/msi/regsvr.c index 15fc1260dcf..11a296524bb 100644 --- a/dlls/msi/regsvr.c +++ b/dlls/msi/regsvr.c @@ -36,6 +36,7 @@ #include "oleauto.h" #include "wine/debug.h" +#include "wine/unicode.h" #include "msi.h" #include "initguid.h" @@ -179,7 +180,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c index 6f92a21f28c..475b10b970a 100644 --- a/dlls/msi/tests/db.c +++ b/dlls/msi/tests/db.c @@ -4694,7 +4694,7 @@ static const struct { {_StringPool, data14, sizeof data14}, }; -void enum_stream_names(IStorage *stg) +static void enum_stream_names(IStorage *stg) { IEnumSTATSTG *stgenum = NULL; IStream *stm; diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index 8d8e6f2acf2..7201329e969 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -49,7 +49,9 @@ static UINT (WINAPI *pMsiEnumPatchesExA) static UINT (WINAPI *pMsiQueryComponentStateA) (LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, INSTALLSTATE*); static INSTALLSTATE (WINAPI *pMsiUseFeatureExA) - (LPCSTR, LPCSTR ,DWORD, DWORD ); + (LPCSTR, LPCSTR ,DWORD, DWORD); +static UINT (WINAPI *pMsiGetPatchInfoExA) + (LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, LPSTR, DWORD *); static void init_functionpointers(void) { @@ -69,6 +71,7 @@ static void init_functionpointers(void) GET_PROC(hmsi, MsiEnumPatchesExA) GET_PROC(hmsi, MsiQueryComponentStateA) GET_PROC(hmsi, MsiUseFeatureExA) + GET_PROC(hmsi, MsiGetPatchInfoExA) GET_PROC(hadvapi32, ConvertSidToStringSidA) @@ -9700,6 +9703,1018 @@ static void test_MsiEnumPatches(void) RegCloseKey(prodkey); } +static void test_MsiGetPatchInfoEx(void) +{ + CHAR keypath[MAX_PATH], val[MAX_PATH]; + CHAR patchcode[MAX_PATH], patch_squashed[MAX_PATH]; + CHAR prodcode[MAX_PATH], prod_squashed[MAX_PATH]; + HKEY prodkey, patches, udprod, props; + HKEY hpatch, udpatch, prodpatches; + LPSTR usersid; + DWORD size; + LONG res; + UINT r; + + if (!pMsiGetPatchInfoExA) + { + win_skip("MsiGetPatchInfoEx not implemented\n"); + return; + } + + create_test_guid(prodcode, prod_squashed); + create_test_guid(patchcode, patch_squashed); + get_user_sid(&usersid); + + /* NULL szPatchCode */ + lstrcpyA(val, "apple"); + size = MAX_PATH; + r = pMsiGetPatchInfoExA(NULL, prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* empty szPatchCode */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA("", prodcode, NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* garbage szPatchCode */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA("garbage", prodcode, NULL, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* guid without brackets */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA("6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", prodcode, + NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* guid with brackets */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA("{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", prodcode, + NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, + "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* same length as guid, but random */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA("A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", prodcode, + NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* NULL szProductCode */ + lstrcpyA(val, "apple"); + size = MAX_PATH; + r = pMsiGetPatchInfoExA(patchcode, NULL, NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* empty szProductCode */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, "", NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* garbage szProductCode */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, "garbage", NULL, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* guid without brackets */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, "6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D", + NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* guid with brackets */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, "{6700E8CF-95AB-4D9C-BC2C-15840DEA7A5D}", + NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, + "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* same length as guid, but random */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, "A938G02JF-2NF3N93-VN3-2NNF-3KGKALDNF93", + NULL, MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* szUserSid cannot be S-1-5-18 for MSIINSTALLCONTEXT_USERMANAGED */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, "S-1-5-18", + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* szUserSid cannot be S-1-5-18 for MSIINSTALLCONTEXT_USERUNMANAGED */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, "S-1-5-18", + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* szUserSid cannot be S-1-5-18 for MSIINSTALLCONTEXT_MACHINE */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, "S-1-5-18", + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* szUserSid must be NULL for MSIINSTALLCONTEXT_MACHINE */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* dwContext is out of range */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_NONE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* dwContext is out of range */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_ALL, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* dwContext is invalid */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, 3, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + /* MSIINSTALLCONTEXT_USERMANAGED */ + + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, + "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); + lstrcatA(keypath, usersid); + lstrcatA(keypath, "\\Products\\"); + lstrcatA(keypath, prod_squashed); + + res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udprod); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* local UserData product key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, + "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(udprod, "InstallProperties", &props); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* InstallProperties key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(udprod, "Patches", &patches); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(patches, patch_squashed, &hpatch); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\Managed\\"); + lstrcatA(keypath, usersid); + lstrcatA(keypath, "\\Installer\\Products\\"); + lstrcatA(keypath, prod_squashed); + + res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* managed product key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(prodkey, "Patches", &prodpatches); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegSetValueExA(prodpatches, patch_squashed, 0, REG_SZ, + (const BYTE *)"transforms", 11); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* specific patch value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); + lstrcatA(keypath, usersid); + lstrcatA(keypath, "\\Patches\\"); + lstrcatA(keypath, patch_squashed); + + res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udpatch); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* UserData Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val); + ok(size == 0, "Expected 0, got %d\n", size); + + res = RegSetValueExA(udpatch, "ManagedLocalPackage", 0, REG_SZ, + (const BYTE *)"pack", 5); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* ManagedLocalPatch value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); + ok(size == 4, "Expected 4, got %d\n", size); + + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_TRANSFORMS, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "transforms"), "Expected \"transforms\", got \"%s\"\n", val); + ok(size == 10, "Expected 10, got %d\n", size); + + res = RegSetValueExA(hpatch, "Installed", 0, REG_SZ, + (const BYTE *)"mydate", 7); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Installed value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_INSTALLDATE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "mydate"), "Expected \"mydate\", got \"%s\"\n", val); + ok(size == 6, "Expected 6, got %d\n", size); + + res = RegSetValueExA(hpatch, "Uninstallable", 0, REG_SZ, + (const BYTE *)"yes", 4); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Uninstallable value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_UNINSTALLABLE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "yes"), "Expected \"yes\", got \"%s\"\n", val); + ok(size == 3, "Expected 3, got %d\n", size); + + res = RegSetValueExA(hpatch, "State", 0, REG_SZ, + (const BYTE *)"good", 5); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* State value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_PATCHSTATE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "good"), "Expected \"good\", got \"%s\"\n", val); + ok(size == 4, "Expected 4, got %d\n", size); + + size = 1; + res = RegSetValueExA(hpatch, "State", 0, REG_DWORD, + (const BYTE *)&size, sizeof(DWORD)); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* State value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_PATCHSTATE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + todo_wine ok(!lstrcmpA(val, "1"), "Expected \"1\", got \"%s\"\n", val); + ok(size == 1, "Expected 1, got %d\n", size); + + res = RegSetValueExA(hpatch, "DisplayName", 0, REG_SZ, + (const BYTE *)"display", 8); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* DisplayName value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_DISPLAYNAME, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "display"), "Expected \"display\", got \"%s\"\n", val); + ok(size == 7, "Expected 7, got %d\n", size); + + res = RegSetValueExA(hpatch, "MoreInfoURL", 0, REG_SZ, + (const BYTE *)"moreinfo", 9); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* MoreInfoURL value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_MOREINFOURL, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "moreinfo"), "Expected \"moreinfo\", got \"%s\"\n", val); + ok(size == 8, "Expected 8, got %d\n", size); + + /* szProperty is invalid */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + "IDontExist", val, &size); + ok(r == ERROR_UNKNOWN_PROPERTY, + "Expected ERROR_UNKNOWN_PROPERTY, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected \"apple\", got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size); + + /* lpValue is NULL, while pcchValue is non-NULL */ + size = MAX_PATH; + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_MOREINFOURL, NULL, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(size == 16, "Expected 16, got %d\n", size); + + /* pcchValue is NULL, while lpValue is non-NULL */ + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_MOREINFOURL, val, NULL); + ok(r == ERROR_INVALID_PARAMETER, + "Expected ERROR_INVALID_PARAMETER, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected \"apple\", got \"%s\"\n", val); + + /* both lpValue and pcchValue are NULL */ + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_MOREINFOURL, NULL, NULL); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + + /* pcchValue doesn't have enough room for NULL terminator */ + size = 8; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_MOREINFOURL, val, &size); + ok(r == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got %d\n", r); + ok(!lstrcmpA(val, "moreinf"), + "Expected \"moreinf\", got \"%s\"\n", val); + ok(size == 16, "Expected 16, got %d\n", size); + + /* pcchValue has exactly enough room for NULL terminator */ + size = 9; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_MOREINFOURL, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "moreinfo"), + "Expected \"moreinfo\", got \"%s\"\n", val); + ok(size == 8, "Expected 8, got %d\n", size); + + /* pcchValue is too small, lpValue is NULL */ + size = 0; + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_MOREINFOURL, NULL, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(size == 16, "Expected 16, got %d\n", size); + + RegDeleteValueA(prodpatches, patch_squashed); + RegDeleteKeyA(prodpatches, ""); + RegCloseKey(prodpatches); + RegDeleteKeyA(prodkey, ""); + RegCloseKey(prodkey); + + /* UserData is sufficient for all properties + * except INSTALLPROPERTY_TRANSFORMS + */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); + ok(size == 4, "Expected 4, got %d\n", size); + + /* UserData is sufficient for all properties + * except INSTALLPROPERTY_TRANSFORMS + */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERMANAGED, + INSTALLPROPERTY_TRANSFORMS, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected \"apple\", got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size); + + RegDeleteValueA(hpatch, "MoreInfoURL"); + RegDeleteValueA(hpatch, "Display"); + RegDeleteValueA(hpatch, "State"); + RegDeleteValueA(hpatch, "Uninstallable"); + RegDeleteValueA(hpatch, "Installed"); + RegDeleteValueA(udpatch, "ManagedLocalPackage"); + RegDeleteKeyA(udpatch, ""); + RegCloseKey(udpatch); + RegDeleteKeyA(hpatch, ""); + RegCloseKey(hpatch); + RegDeleteKeyA(patches, ""); + RegCloseKey(patches); + RegDeleteKeyA(props, ""); + RegCloseKey(props); + RegDeleteKeyA(udprod, ""); + RegCloseKey(udprod); + + /* MSIINSTALLCONTEXT_USERUNMANAGED */ + + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, + "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); + lstrcatA(keypath, usersid); + lstrcatA(keypath, "\\Products\\"); + lstrcatA(keypath, prod_squashed); + + res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udprod); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* local UserData product key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, + "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(udprod, "InstallProperties", &props); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* InstallProperties key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(udprod, "Patches", &patches); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(patches, patch_squashed, &hpatch); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + lstrcpyA(keypath, "Software\\Microsoft\\Installer\\Products\\"); + lstrcatA(keypath, prod_squashed); + + res = RegCreateKeyA(HKEY_CURRENT_USER, keypath, &prodkey); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* current user product key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(prodkey, "Patches", &prodpatches); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegSetValueExA(prodpatches, patch_squashed, 0, REG_SZ, + (const BYTE *)"transforms", 11); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* specific patch value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer\\UserData\\"); + lstrcatA(keypath, usersid); + lstrcatA(keypath, "\\Patches\\"); + lstrcatA(keypath, patch_squashed); + + res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udpatch); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* UserData Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val); + ok(size == 0, "Expected 0, got %d\n", size); + + res = RegSetValueExA(udpatch, "LocalPackage", 0, REG_SZ, + (const BYTE *)"pack", 5); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* LocalPatch value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); + ok(size == 4, "Expected 4, got %d\n", size); + + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_TRANSFORMS, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "transforms"), "Expected \"transforms\", got \"%s\"\n", val); + ok(size == 10, "Expected 10, got %d\n", size); + + RegDeleteValueA(prodpatches, patch_squashed); + RegDeleteKeyA(prodpatches, ""); + RegCloseKey(prodpatches); + RegDeleteKeyA(prodkey, ""); + RegCloseKey(prodkey); + + /* UserData is sufficient for all properties + * except INSTALLPROPERTY_TRANSFORMS + */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); + ok(size == 4, "Expected 4, got %d\n", size); + + /* UserData is sufficient for all properties + * except INSTALLPROPERTY_TRANSFORMS + */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, usersid, + MSIINSTALLCONTEXT_USERUNMANAGED, + INSTALLPROPERTY_TRANSFORMS, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected \"apple\", got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size); + + RegDeleteValueA(udpatch, "LocalPackage"); + RegDeleteKeyA(udpatch, ""); + RegCloseKey(udpatch); + RegDeleteKeyA(hpatch, ""); + RegCloseKey(hpatch); + RegDeleteKeyA(patches, ""); + RegCloseKey(patches); + RegDeleteKeyA(props, ""); + RegCloseKey(props); + RegDeleteKeyA(udprod, ""); + RegCloseKey(udprod); + + /* MSIINSTALLCONTEXT_MACHINE */ + + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, + "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"); + lstrcatA(keypath, "\\UserData\\S-1-5-18\\Products\\"); + lstrcatA(keypath, prod_squashed); + + res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udprod); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* local UserData product key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PRODUCT, + "Expected ERROR_UNKNOWN_PRODUCT, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(udprod, "InstallProperties", &props); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* InstallProperties key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(udprod, "Patches", &patches); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(patches, patch_squashed, &hpatch); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + lstrcpyA(keypath, "Software\\Classes\\Installer\\Products\\"); + lstrcatA(keypath, prod_squashed); + + res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &prodkey); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* local product key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegCreateKeyA(prodkey, "Patches", &prodpatches); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + res = RegSetValueExA(prodpatches, patch_squashed, 0, REG_SZ, + (const BYTE *)"transforms", 11); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* specific patch value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), + "Expected val to be unchanged, got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected size to be unchanged, got %d\n", size); + + lstrcpyA(keypath, "Software\\Microsoft\\Windows\\CurrentVersion\\Installer"); + lstrcatA(keypath, "\\UserData\\S-1-5-18\\Patches\\"); + lstrcatA(keypath, patch_squashed); + + res = RegCreateKeyA(HKEY_LOCAL_MACHINE, keypath, &udpatch); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* UserData Patches key exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, ""), "Expected \"\", got \"%s\"\n", val); + ok(size == 0, "Expected 0, got %d\n", size); + + res = RegSetValueExA(udpatch, "LocalPackage", 0, REG_SZ, + (const BYTE *)"pack", 5); + ok(res == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", res); + + /* LocalPatch value exists */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); + ok(size == 4, "Expected 4, got %d\n", size); + + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_TRANSFORMS, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "transforms"), "Expected \"transforms\", got \"%s\"\n", val); + ok(size == 10, "Expected 10, got %d\n", size); + + RegDeleteValueA(prodpatches, patch_squashed); + RegDeleteKeyA(prodpatches, ""); + RegCloseKey(prodpatches); + RegDeleteKeyA(prodkey, ""); + RegCloseKey(prodkey); + + /* UserData is sufficient for all properties + * except INSTALLPROPERTY_TRANSFORMS + */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_LOCALPACKAGE, val, &size); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); + ok(!lstrcmpA(val, "pack"), "Expected \"pack\", got \"%s\"\n", val); + ok(size == 4, "Expected 4, got %d\n", size); + + /* UserData is sufficient for all properties + * except INSTALLPROPERTY_TRANSFORMS + */ + size = MAX_PATH; + lstrcpyA(val, "apple"); + r = pMsiGetPatchInfoExA(patchcode, prodcode, NULL, + MSIINSTALLCONTEXT_MACHINE, + INSTALLPROPERTY_TRANSFORMS, val, &size); + ok(r == ERROR_UNKNOWN_PATCH, "Expected ERROR_UNKNOWN_PATCH, got %d\n", r); + ok(!lstrcmpA(val, "apple"), "Expected \"apple\", got \"%s\"\n", val); + ok(size == MAX_PATH, "Expected MAX_PATH, got %d\n", size); + + RegDeleteValueA(udpatch, "LocalPackage"); + RegDeleteKeyA(udpatch, ""); + RegCloseKey(udpatch); + RegDeleteKeyA(hpatch, ""); + RegCloseKey(hpatch); + RegDeleteKeyA(patches, ""); + RegCloseKey(patches); + RegDeleteKeyA(props, ""); + RegCloseKey(props); + RegDeleteKeyA(udprod, ""); + RegCloseKey(udprod); +} + START_TEST(msi) { init_functionpointers(); @@ -9726,6 +10741,7 @@ START_TEST(msi) test_MsiOpenProduct(); test_MsiEnumPatchesEx(); test_MsiEnumPatches(); + test_MsiGetPatchInfoEx(); } test_MsiGetFileVersion(); diff --git a/dlls/msi/tests/package.c b/dlls/msi/tests/package.c index e3565efb5f6..5ad1d385bd8 100644 --- a/dlls/msi/tests/package.c +++ b/dlls/msi/tests/package.c @@ -54,7 +54,7 @@ static void get_user_sid(LPSTR *usersid) } /* RegDeleteTreeW from dlls/advapi32/registry.c */ -LSTATUS WINAPI package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey) +static LSTATUS package_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey) { LONG ret; DWORD dwMaxSubkeyLen, dwMaxValueLen; diff --git a/dlls/msi/tests/record.c b/dlls/msi/tests/record.c index f21131823cd..29a57a04f30 100644 --- a/dlls/msi/tests/record.c +++ b/dlls/msi/tests/record.c @@ -362,6 +362,11 @@ static void test_MsiRecordGetString(void) ok(rec != 0, "Expected a valid handle\n"); sz = MAX_PATH; + r = MsiRecordGetString(rec, 1, NULL, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n",r); + ok(sz == 0, "Expected 0, got %d\n",sz); + + sz = MAX_PATH; lstrcpyA(buf, "apple"); r = MsiRecordGetString(rec, 1, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); @@ -384,6 +389,11 @@ static void test_MsiRecordGetString(void) ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); sz = MAX_PATH; + r = MsiRecordGetString(rec, 1, NULL, &sz); + ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n",r); + ok(sz == 1, "Expected 1, got %d\n",sz); + + sz = MAX_PATH; lstrcpyA(buf, "apple"); r = MsiRecordGetString(rec, 1, buf, &sz); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", r); diff --git a/dlls/msvcr71/msvcr71.c b/dlls/msvcr71/msvcr71.c index 3ada089ed44..6134982192b 100644 --- a/dlls/msvcr71/msvcr71.c +++ b/dlls/msvcr71/msvcr71.c @@ -22,9 +22,6 @@ #include "windef.h" #include "winbase.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(msvcr71); BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) { diff --git a/dlls/msvcr71/msvcr71.spec b/dlls/msvcr71/msvcr71.spec index 968e8b5844b..fc693bd82dd 100644 --- a/dlls/msvcr71/msvcr71.spec +++ b/dlls/msvcr71/msvcr71.spec @@ -50,22 +50,22 @@ @ stub ?vswprintf@@YAHPA_WIPB_WPAD@Z @ cdecl -i386 ?what@exception@@UBEPBDXZ() msvcrt.?what@exception@@UBEPBDXZ @ cdecl $I10_OUTPUT() msvcrt.$I10_OUTPUT -@ cdecl _CIacos() msvcrt._CIacos -@ cdecl _CIasin() msvcrt._CIasin -@ cdecl _CIatan() msvcrt._CIatan -@ cdecl _CIatan2() msvcrt._CIatan2 -@ cdecl _CIcos() msvcrt._CIcos -@ cdecl _CIcosh() msvcrt._CIcosh -@ cdecl _CIexp() msvcrt._CIexp -@ cdecl _CIfmod() msvcrt._CIfmod -@ cdecl _CIlog() msvcrt._CIlog -@ cdecl _CIlog10() msvcrt._CIlog10 -@ cdecl _CIpow() msvcrt._CIpow -@ cdecl _CIsin() msvcrt._CIsin -@ cdecl _CIsinh() msvcrt._CIsinh -@ cdecl _CIsqrt() msvcrt._CIsqrt -@ cdecl _CItan() msvcrt._CItan -@ cdecl _CItanh() msvcrt._CItanh +@ cdecl -arch=i386 _CIacos() msvcrt._CIacos +@ cdecl -arch=i386 _CIasin() msvcrt._CIasin +@ cdecl -arch=i386 _CIatan() msvcrt._CIatan +@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2 +@ cdecl -arch=i386 _CIcos() msvcrt._CIcos +@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh +@ cdecl -arch=i386 _CIexp() msvcrt._CIexp +@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod +@ cdecl -arch=i386 _CIlog() msvcrt._CIlog +@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10 +@ cdecl -arch=i386 _CIpow() msvcrt._CIpow +@ cdecl -arch=i386 _CIsin() msvcrt._CIsin +@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh +@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt +@ cdecl -arch=i386 _CItan() msvcrt._CItan +@ cdecl -arch=i386 _CItanh() msvcrt._CItanh @ stub _CRT_RTC_INIT @ cdecl _CxxThrowException(long long) msvcrt._CxxThrowException @ cdecl -i386 _EH_prolog() msvcrt._EH_prolog @@ -90,10 +90,10 @@ @ cdecl __RTDynamicCast(ptr long ptr ptr long) msvcrt.__RTDynamicCast @ cdecl __RTtypeid(ptr) msvcrt.__RTtypeid @ cdecl __STRINGTOLD(ptr ptr str long) msvcrt.__STRINGTOLD -@ stub ___lc_codepage_func -@ stub ___lc_collate_cp_func -@ stub ___lc_handle_func -@ stub ___mb_cur_max_func +@ cdecl ___lc_codepage_func() msvcrt.___lc_codepage_func +@ cdecl ___lc_collate_cp_func() msvcrt.___lc_collate_cp_func +@ cdecl ___lc_handle_func() msvcrt.___lc_handle_func +@ cdecl ___mb_cur_max_func() msvcrt.___mb_cur_max_func @ cdecl ___setlc_active_func() msvcrt.___setlc_active_func @ cdecl ___unguarded_readlc_active_add_func() msvcrt.___unguarded_readlc_active_add_func @ extern __argc msvcrt.__argc @@ -121,36 +121,36 @@ @ extern __lc_handle msvcrt.__lc_handle @ cdecl __lconv_init() msvcrt.__lconv_init @ extern __mb_cur_max msvcrt.__mb_cur_max -@ cdecl __p___argc() msvcrt.__p___argc -@ cdecl __p___argv() msvcrt.__p___argv -@ cdecl __p___initenv() msvcrt.__p___initenv -@ cdecl __p___mb_cur_max() msvcrt.__p___mb_cur_max -@ cdecl __p___wargv() msvcrt.__p___wargv -@ cdecl __p___winitenv() msvcrt.__p___winitenv -@ cdecl __p__acmdln() msvcrt.__p__acmdln -@ cdecl __p__amblksiz() msvcrt.__p__amblksiz -@ cdecl __p__commode() msvcrt.__p__commode -@ cdecl __p__daylight() msvcrt.__p__daylight -@ cdecl __p__dstbias() msvcrt.__p__dstbias -@ cdecl __p__environ() msvcrt.__p__environ -@ cdecl __p__fileinfo() msvcrt.__p__fileinfo -@ cdecl __p__fmode() msvcrt.__p__fmode +@ cdecl -arch=i386 __p___argc() msvcrt.__p___argc +@ cdecl -arch=i386 __p___argv() msvcrt.__p___argv +@ cdecl -arch=i386 __p___initenv() msvcrt.__p___initenv +@ cdecl -arch=i386 __p___mb_cur_max() msvcrt.__p___mb_cur_max +@ cdecl -arch=i386 __p___wargv() msvcrt.__p___wargv +@ cdecl -arch=i386 __p___winitenv() msvcrt.__p___winitenv +@ cdecl -arch=i386 __p__acmdln() msvcrt.__p__acmdln +@ cdecl -arch=i386 __p__amblksiz() msvcrt.__p__amblksiz +@ cdecl -arch=i386 __p__commode() msvcrt.__p__commode +@ cdecl -arch=i386 __p__daylight() msvcrt.__p__daylight +@ cdecl -arch=i386 __p__dstbias() msvcrt.__p__dstbias +@ cdecl -arch=i386 __p__environ() msvcrt.__p__environ +@ cdecl -arch=i386 __p__fileinfo() msvcrt.__p__fileinfo +@ cdecl -arch=i386 __p__fmode() msvcrt.__p__fmode @ cdecl -arch=i386 __p__iob() msvcrt.__p__iob -@ cdecl __p__mbcasemap() msvcrt.__p__mbcasemap -@ cdecl __p__mbctype() msvcrt.__p__mbctype -@ cdecl __p__osver() msvcrt.__p__osver -@ cdecl __p__pctype() msvcrt.__p__pctype -@ cdecl __p__pgmptr() msvcrt.__p__pgmptr -@ cdecl __p__pwctype() msvcrt.__p__pwctype -@ cdecl __p__timezone() msvcrt.__p__timezone -@ cdecl __p__tzname() msvcrt.__p__tzname -@ cdecl __p__wcmdln() msvcrt.__p__wcmdln -@ cdecl __p__wenviron() msvcrt.__p__wenviron -@ cdecl __p__winmajor() msvcrt.__p__winmajor -@ cdecl __p__winminor() msvcrt.__p__winminor -@ cdecl __p__winver() msvcrt.__p__winver -@ cdecl __p__wpgmptr() msvcrt.__p__wpgmptr -@ cdecl __pctype_func() msvcrt.__p__pctype +@ cdecl -arch=i386 __p__mbcasemap() msvcrt.__p__mbcasemap +@ cdecl -arch=i386 __p__mbctype() msvcrt.__p__mbctype +@ cdecl -arch=i386 __p__osver() msvcrt.__p__osver +@ cdecl -arch=i386 __p__pctype() msvcrt.__p__pctype +@ cdecl -arch=i386 __p__pgmptr() msvcrt.__p__pgmptr +@ cdecl -arch=i386 __p__pwctype() msvcrt.__p__pwctype +@ cdecl -arch=i386 __p__timezone() msvcrt.__p__timezone +@ cdecl -arch=i386 __p__tzname() msvcrt.__p__tzname +@ cdecl -arch=i386 __p__wcmdln() msvcrt.__p__wcmdln +@ cdecl -arch=i386 __p__wenviron() msvcrt.__p__wenviron +@ cdecl -arch=i386 __p__winmajor() msvcrt.__p__winmajor +@ cdecl -arch=i386 __p__winminor() msvcrt.__p__winminor +@ cdecl -arch=i386 __p__winver() msvcrt.__p__winver +@ cdecl -arch=i386 __p__wpgmptr() msvcrt.__p__wpgmptr +@ cdecl __pctype_func() msvcrt.__pctype_func @ extern __pioinfo msvcrt.__pioinfo @ stub __pwctype_func @ cdecl __pxcptinfoptrs() msvcrt.__pxcptinfoptrs diff --git a/dlls/msvcrt/ctype.c b/dlls/msvcrt/ctype.c index 7b8c1fa5863..39d13ea0218 100644 --- a/dlls/msvcrt/ctype.c +++ b/dlls/msvcrt/ctype.c @@ -60,14 +60,10 @@ WORD MSVCRT_current_ctype[257]; */ WORD* MSVCRT__pctype = MSVCRT_current_ctype + 1; -/* mbctype data */ -extern int MSVCRT___mb_cur_max; -extern LCID MSVCRT_current_lc_all_lcid; - /********************************************************************* - * __p__pctype (MSVCRT.@) + * __pctype_func (MSVCRT.@) */ -WORD** CDECL __p__pctype(void) +WORD** CDECL MSVCRT___pctype_func(void) { return &MSVCRT__pctype; } diff --git a/dlls/msvcrt/file.c b/dlls/msvcrt/file.c index 888f90c51ac..055ccac7e46 100644 --- a/dlls/msvcrt/file.c +++ b/dlls/msvcrt/file.c @@ -2309,7 +2309,7 @@ MSVCRT_wint_t CDECL MSVCRT_fgetwc(MSVCRT_FILE* file) } c = MSVCRT_fgetc(file); - if ((*__p___mb_cur_max() > 1) && MSVCRT_isleadbyte(c)) + if ((MSVCRT___mb_cur_max > 1) && MSVCRT_isleadbyte(c)) { FIXME("Treat Multibyte characters\n"); } @@ -2597,6 +2597,7 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm /* first buffered data */ if(file->_cnt>0) { + while (file->_cnt>0 && rcnt > 0) { int pcnt= (rcnt>file->_cnt)? file->_cnt:rcnt; memcpy(ptr, file->_ptr, pcnt); file->_cnt -= pcnt; @@ -2606,6 +2607,7 @@ MSVCRT_size_t CDECL MSVCRT_fread(void *ptr, MSVCRT_size_t size, MSVCRT_size_t nm read += pcnt ; rcnt -= pcnt ; ptr = (char*)ptr + pcnt; + } } else if(!(file->_flag & MSVCRT__IOREAD )) { if(file->_flag & MSVCRT__IORW) { file->_flag |= MSVCRT__IOREAD; diff --git a/dlls/msvcrt/locale.c b/dlls/msvcrt/locale.c index 1d27eaf0814..e0ddb94e973 100644 --- a/dlls/msvcrt/locale.c +++ b/dlls/msvcrt/locale.c @@ -52,14 +52,6 @@ HANDLE MSVCRT___lc_handle[MSVCRT_LC_MAX - MSVCRT_LC_MIN + 1] = { 0 }; #define LOCK_LOCALE _mlock(_SETLOCALE_LOCK); #define UNLOCK_LOCALE _munlock(_SETLOCALE_LOCK); -/* ctype data modified when the locale changes */ -extern WORD MSVCRT__ctype [257]; -extern WORD MSVCRT_current_ctype[257]; -extern WORD* MSVCRT__pctype; - -/* mbctype data modified when the locale changes */ -extern int MSVCRT___mb_cur_max; - #define MSVCRT_LEADBYTE 0x8000 /* Friendly country strings & iso codes for synonym support. diff --git a/dlls/msvcrt/lock.c b/dlls/msvcrt/lock.c index a273fe192ef..464c66b8d8a 100644 --- a/dlls/msvcrt/lock.c +++ b/dlls/msvcrt/lock.c @@ -18,11 +18,10 @@ #include -#include "mtdll.h" - #include "wine/debug.h" #include "windef.h" #include "winbase.h" +#include "mtdll.h" WINE_DEFAULT_DEBUG_CHANNEL(msvcrt); diff --git a/dlls/msvcrt/math.c b/dlls/msvcrt/math.c index 9ea82458e8f..0c6290c83b9 100644 --- a/dlls/msvcrt/math.c +++ b/dlls/msvcrt/math.c @@ -357,29 +357,6 @@ double CDECL _CItanh(void) return MSVCRT_tanh(x); } -#else /* defined(__GNUC__) && defined(__i386__) */ - -/* The above cannot be called on non x86 platforms, stub them for linking */ - -#define IX86_ONLY(func) double func(void) { return 0.0; } - -IX86_ONLY(_CIacos) -IX86_ONLY(_CIasin) -IX86_ONLY(_CIatan) -IX86_ONLY(_CIatan2) -IX86_ONLY(_CIcos) -IX86_ONLY(_CIcosh) -IX86_ONLY(_CIexp) -IX86_ONLY(_CIfmod) -IX86_ONLY(_CIlog) -IX86_ONLY(_CIlog10) -IX86_ONLY(_CIpow) -IX86_ONLY(_CIsin) -IX86_ONLY(_CIsinh) -IX86_ONLY(_CIsqrt) -IX86_ONLY(_CItan) -IX86_ONLY(_CItanh) - #endif /* defined(__GNUC__) && defined(__i386__) */ /********************************************************************* diff --git a/dlls/msvcrt/mbcs.c b/dlls/msvcrt/mbcs.c index 22cfea0bdf0..d1a84e7e221 100644 --- a/dlls/msvcrt/mbcs.c +++ b/dlls/msvcrt/mbcs.c @@ -33,7 +33,6 @@ unsigned char MSVCRT_mbctype[257] = { 0 }; static int g_mbcp_is_multibyte = 0; int MSVCRT___mb_cur_max = 1; -extern int MSVCRT___lc_collate_cp; /* It seems that the data about valid trail bytes is not available from kernel32 * so we have to store is here. The format is the same as for lead bytes in CPINFO */ @@ -144,9 +143,9 @@ unsigned char* CDECL __p__mbctype(void) } /********************************************************************* - * __p___mb_cur_max(MSVCRT.@) + * ___mb_cur_max_func(MSVCRT.@) */ -int* CDECL __p___mb_cur_max(void) +int* CDECL MSVCRT____mb_cur_max_func(void) { return &MSVCRT___mb_cur_max; } diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 2b2934e2e9d..3a894e9457b 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -113,6 +113,12 @@ typedef struct __thread_data thread_data_t; extern thread_data_t *msvcrt_get_thread_data(void); extern int MSVCRT___lc_codepage; +extern int MSVCRT___lc_collate_cp; +extern int MSVCRT___mb_cur_max; +extern LCID MSVCRT_current_lc_all_lcid; +extern WORD MSVCRT__ctype [257]; +extern WORD MSVCRT_current_ctype[257]; +extern WORD* MSVCRT__pctype; void msvcrt_set_errno(int); @@ -689,7 +695,7 @@ MSVCRT_wchar_t*** __cdecl __p__wenviron(void); char* __cdecl _strdate(char* date); char* __cdecl _strtime(char* date); int __cdecl _setmbcp(int); -void __cdecl _ftime(struct MSVCRT__timeb *buf); +void __cdecl MSVCRT__ftime(struct MSVCRT__timeb *buf); int __cdecl MSVCRT__close(int); int __cdecl MSVCRT__dup(int); int __cdecl MSVCRT__dup2(int, int); diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 7a9c654e55d..c432d61d574 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -51,22 +51,22 @@ @ cdecl ?terminate@@YAXXZ() MSVCRT_terminate @ cdecl ?unexpected@@YAXXZ() MSVCRT_unexpected @ cdecl -i386 -norelay ?what@exception@@UBEPBDXZ() __thiscall_MSVCRT_what_exception -@ cdecl _CIacos() -@ cdecl _CIasin() -@ cdecl _CIatan() -@ cdecl _CIatan2() -@ cdecl _CIcos() -@ cdecl _CIcosh() -@ cdecl _CIexp() -@ cdecl _CIfmod() -@ cdecl _CIlog() -@ cdecl _CIlog10() -@ cdecl _CIpow() -@ cdecl _CIsin() -@ cdecl _CIsinh() -@ cdecl _CIsqrt() -@ cdecl _CItan() -@ cdecl _CItanh() +@ cdecl -arch=i386 _CIacos() +@ cdecl -arch=i386 _CIasin() +@ cdecl -arch=i386 _CIatan() +@ cdecl -arch=i386 _CIatan2() +@ cdecl -arch=i386 _CIcos() +@ cdecl -arch=i386 _CIcosh() +@ cdecl -arch=i386 _CIexp() +@ cdecl -arch=i386 _CIfmod() +@ cdecl -arch=i386 _CIlog() +@ cdecl -arch=i386 _CIlog10() +@ cdecl -arch=i386 _CIpow() +@ cdecl -arch=i386 _CIsin() +@ cdecl -arch=i386 _CIsinh() +@ cdecl -arch=i386 _CIsqrt() +@ cdecl -arch=i386 _CItan() +@ cdecl -arch=i386 _CItanh() @ cdecl _CxxThrowException(long long) @ cdecl -i386 -norelay _EH_prolog() @ cdecl _Getdays() @@ -84,6 +84,12 @@ @ cdecl __RTDynamicCast(ptr long ptr ptr long) MSVCRT___RTDynamicCast @ cdecl __RTtypeid(ptr) MSVCRT___RTtypeid @ cdecl __STRINGTOLD(ptr ptr str long) +@ stub ___lc_codepage_func +@ stub ___lc_collate_cp_func +@ stub ___lc_handle_func +@ cdecl ___mb_cur_max_func() MSVCRT____mb_cur_max_func +@ cdecl ___setlc_active_func() MSVCRT____setlc_active_func +@ cdecl ___unguarded_readlc_active_add_func() MSVCRT____unguarded_readlc_active_add_func @ extern __argc MSVCRT___argc @ extern __argv MSVCRT___argv @ extern __badioinfo MSVCRT___badioinfo @@ -107,40 +113,40 @@ @ extern __lc_handle MSVCRT___lc_handle @ cdecl __lconv_init() @ extern __mb_cur_max MSVCRT___mb_cur_max -@ cdecl __p___argc() -@ cdecl __p___argv() -@ cdecl __p___initenv() -@ cdecl __p___mb_cur_max() -@ cdecl __p___wargv() -@ cdecl __p___winitenv() -@ cdecl __p__acmdln() -@ cdecl __p__amblksiz() -@ cdecl __p__commode() -@ cdecl __p__daylight() MSVCRT___p__daylight -@ cdecl __p__dstbias() -@ cdecl __p__environ() -@ stub __p__fileinfo #() -@ cdecl __p__fmode() +@ cdecl -arch=i386 __p___argc() +@ cdecl -arch=i386 __p___argv() +@ cdecl -arch=i386 __p___initenv() +@ cdecl -arch=i386 __p___mb_cur_max() MSVCRT____mb_cur_max_func +@ cdecl -arch=i386 __p___wargv() +@ cdecl -arch=i386 __p___winitenv() +@ cdecl -arch=i386 __p__acmdln() +@ cdecl -arch=i386 __p__amblksiz() +@ cdecl -arch=i386 __p__commode() +@ cdecl -arch=i386 __p__daylight() MSVCRT___p__daylight +@ cdecl -arch=i386 __p__dstbias() +@ cdecl -arch=i386 __p__environ() +@ stub -arch=i386 __p__fileinfo #() +@ cdecl -arch=i386 __p__fmode() @ cdecl -arch=i386 __p__iob() MSVCRT___iob_func -@ stub __p__mbcasemap #() -@ cdecl __p__mbctype() -@ cdecl __p__osver() -@ cdecl __p__pctype() -@ cdecl __p__pgmptr() -@ stub __p__pwctype #() -@ cdecl __p__timezone() MSVCRT___p__timezone -@ cdecl __p__tzname() -@ cdecl __p__wcmdln() -@ cdecl __p__wenviron() -@ cdecl __p__winmajor() -@ cdecl __p__winminor() -@ cdecl __p__winver() -@ cdecl __p__wpgmptr() +@ stub -arch=i386 __p__mbcasemap #() +@ cdecl -arch=i386 __p__mbctype() +@ cdecl -arch=i386 __p__osver() +@ cdecl -arch=i386 __p__pctype() MSVCRT___pctype_func +@ cdecl -arch=i386 __p__pgmptr() +@ stub -arch=i386 __p__pwctype #() +@ cdecl -arch=i386 __p__timezone() MSVCRT___p__timezone +@ cdecl -arch=i386 __p__tzname() +@ cdecl -arch=i386 __p__wcmdln() +@ cdecl -arch=i386 __p__wenviron() +@ cdecl -arch=i386 __p__winmajor() +@ cdecl -arch=i386 __p__winminor() +@ cdecl -arch=i386 __p__winver() +@ cdecl -arch=i386 __p__wpgmptr() +@ cdecl __pctype_func() MSVCRT___pctype_func @ extern __pioinfo MSVCRT___pioinfo @ stub __pxcptinfoptrs #() @ cdecl __set_app_type(long) MSVCRT___set_app_type @ extern __setlc_active MSVCRT___setlc_active -@ cdecl ___setlc_active_func() MSVCRT____setlc_active_func @ cdecl __setusermatherr(ptr) MSVCRT___setusermatherr @ cdecl __threadhandle() kernel32.GetCurrentThread @ cdecl __threadid() kernel32.GetCurrentThreadId @@ -148,7 +154,6 @@ @ cdecl __unDName(ptr str long ptr ptr long) @ cdecl __unDNameEx(ptr str long ptr ptr ptr long) @ extern __unguarded_readlc_active MSVCRT___unguarded_readlc_active -@ cdecl ___unguarded_readlc_active_add_func() MSVCRT____unguarded_readlc_active_add_func @ extern __wargv MSVCRT___wargv @ cdecl __wgetmainargs(ptr ptr ptr long ptr) @ extern __winitenv MSVCRT___winitenv @@ -257,7 +262,7 @@ @ cdecl _fstat(long ptr) MSVCRT__fstat @ cdecl _fstat64(long ptr) MSVCRT__fstat64 @ cdecl _fstati64(long ptr) MSVCRT__fstati64 -@ cdecl _ftime(ptr) +@ cdecl _ftime(ptr) MSVCRT__ftime @ cdecl -ret64 _ftol() ntdll._ftol @ cdecl _fullpath(ptr str long) @ cdecl _futime(long ptr) diff --git a/dlls/msvcrt/mtdll.h b/dlls/msvcrt/mtdll.h index b5473a50e6a..c01beaff93c 100644 --- a/dlls/msvcrt/mtdll.h +++ b/dlls/msvcrt/mtdll.h @@ -24,8 +24,8 @@ #define _mlock(locknum) _lock(locknum) #define _munlock(locknum) _unlock(locknum) -void _unlock( int locknum ); -void _lock( int locknum ); +void __cdecl _unlock( int locknum ); +void __cdecl _lock( int locknum ); #else diff --git a/dlls/msvcrt/process.c b/dlls/msvcrt/process.c index 5298520e746..bb57b9f79c3 100644 --- a/dlls/msvcrt/process.c +++ b/dlls/msvcrt/process.c @@ -271,52 +271,34 @@ static MSVCRT_wchar_t *msvcrt_argvtos_aw(const char * const *arg, MSVCRT_wchar_t */ static MSVCRT_wchar_t *msvcrt_valisttos(const MSVCRT_wchar_t *arg0, va_list alist, MSVCRT_wchar_t delim) { - va_list alist2; - unsigned long len; - const MSVCRT_wchar_t *arg; - MSVCRT_wchar_t *p, *ret; - -#ifdef HAVE_VA_COPY - va_copy(alist2,alist); -#else -# ifdef HAVE___VA_COPY - __va_copy(alist2,alist); -# else - alist2 = alist; -# endif -#endif - - if (!arg0) - { - /* Return NULL for an empty environment list */ - return NULL; - } + unsigned int size = 0, pos = 0; + const MSVCRT_wchar_t *arg; + MSVCRT_wchar_t *new, *ret = NULL; - /* get length */ - arg = arg0; - len = 0; - do { - len += strlenW(arg) + 1; - arg = va_arg(alist, MSVCRT_wchar_t*); - } while (arg != NULL); - - ret = MSVCRT_malloc((len + 1) * sizeof(MSVCRT_wchar_t)); - if (!ret) - return NULL; - - /* fill string */ - arg = arg0; - p = ret; - do { - len = strlenW(arg); - memcpy(p, arg, len * sizeof(MSVCRT_wchar_t)); - p += len; - *p++ = delim; - arg = va_arg(alist2, MSVCRT_wchar_t*); - } while (arg != NULL); - if (delim && p > ret) p[-1] = 0; - else *p = 0; - return ret; + for (arg = arg0; arg; arg = va_arg( alist, MSVCRT_wchar_t * )) + { + unsigned int len = strlenW( arg ) + 1; + if (pos + len >= size) + { + size = max( 256, size * 2 ); + size = max( size, pos + len + 1 ); + if (!(new = MSVCRT_realloc( ret, size * sizeof(MSVCRT_wchar_t) ))) + { + MSVCRT_free( ret ); + return NULL; + } + ret = new; + } + strcpyW( ret + pos, arg ); + pos += len; + ret[pos - 1] = delim; + } + if (pos) + { + if (delim) ret[pos - 1] = 0; + else ret[pos] = 0; + } + return ret; } /* INTERNAL: Convert ansi va_list to a single 'delim'-separated wide string, with an @@ -324,50 +306,33 @@ static MSVCRT_wchar_t *msvcrt_valisttos(const MSVCRT_wchar_t *arg0, va_list alis */ static MSVCRT_wchar_t *msvcrt_valisttos_aw(const char *arg0, va_list alist, MSVCRT_wchar_t delim) { - va_list alist2; - unsigned long len; - const char *arg; - MSVCRT_wchar_t *p, *ret; - -#ifdef HAVE_VA_COPY - va_copy(alist2,alist); -#else -# ifdef HAVE___VA_COPY - __va_copy(alist2,alist); -# else - alist2 = alist; -# endif -#endif - - if (!arg0) - { - /* Return NULL for an empty environment list */ - return NULL; - } + unsigned int size = 0, pos = 0; + const char *arg; + MSVCRT_wchar_t *new, *ret = NULL; - /* get length */ - arg = arg0; - len = 0; - do { - len += MultiByteToWideChar(CP_ACP, 0, arg, -1, NULL, 0); - arg = va_arg(alist, char*); - } while (arg != NULL); - - ret = MSVCRT_malloc((len + 1) * sizeof(MSVCRT_wchar_t)); - if (!ret) - return NULL; - - /* fill string */ - arg = arg0; - p = ret; - do { - p += MultiByteToWideChar(CP_ACP, 0, arg, strlen(arg), p, len - (p - ret)); - *p++ = delim; - arg = va_arg(alist2, char*); - } while (arg != NULL); - if (delim && p > ret) p[-1] = 0; - else *p = 0; - return ret; + for (arg = arg0; arg; arg = va_arg( alist, char * )) + { + unsigned int len = MultiByteToWideChar( CP_ACP, 0, arg, -1, NULL, 0 ); + if (pos + len >= size) + { + size = max( 256, size * 2 ); + size = max( size, pos + len + 1 ); + if (!(new = MSVCRT_realloc( ret, size * sizeof(MSVCRT_wchar_t) ))) + { + MSVCRT_free( ret ); + return NULL; + } + ret = new; + } + pos += MultiByteToWideChar( CP_ACP, 0, arg, -1, ret + pos, size - pos ); + ret[pos - 1] = delim; + } + if (pos) + { + if (delim) ret[pos - 1] = 0; + else ret[pos] = 0; + } + return ret; } /* INTERNAL: retrieve COMSPEC environment variable */ diff --git a/dlls/msvcrt/tests/file.c b/dlls/msvcrt/tests/file.c index 9642d755fcd..38f16c1e24d 100644 --- a/dlls/msvcrt/tests/file.c +++ b/dlls/msvcrt/tests/file.c @@ -306,6 +306,44 @@ static void test_asciimode(void) unlink("ascii.tst"); } +static void test_asciimode2(void) +{ + /* Error sequence from one app was getchar followed by small fread + * with one \r removed had last byte of buffer filled with + * next byte of *unbuffered* data rather than next byte from buffer + * Test case is a short string of one byte followed by a newline + * followed by filler to fill out the sector, then a sector of + * some different byte. + */ + + FILE *fp; + char ibuf[4]; + int i; + static const char obuf[] = +"00\n\ +000000000000000000000000000000000000000000000000000000000000000000000000000000\n\ +000000000000000000000000000000000000000000000000000000000000000000000000000000\n\ +000000000000000000000000000000000000000000000000000000000000000000000000000000\n\ +000000000000000000000000000000000000000000000000000000000000000000000000000000\n\ +000000000000000000000000000000000000000000000000000000000000000000000000000000\n\ +000000000000000000000000000000000000000000000000000000000000000000000000000000\n\ +000000000000000000\n\ +1111111111111111111"; + + fp = fopen("ascii2.tst", "wt"); + fwrite(obuf, 1, sizeof(obuf), fp); + fclose(fp); + + fp = fopen("ascii2.tst", "rt"); + ok(getc(fp) == '0', "first char not 0\n"); + memset(ibuf, 0, sizeof(ibuf)); + i = fread(ibuf, 1, sizeof(ibuf), fp); + ok(i == sizeof(ibuf), "fread i %d != sizeof(ibuf) %d\n", i, sizeof(ibuf)); + ok(0 == strncmp(ibuf, obuf+1, sizeof(ibuf)), "ibuf != obuf\n"); + fclose(fp); + unlink("ascii2.tst"); +} + static WCHAR* AtoW( const char* p ) { WCHAR* buffer; @@ -1113,6 +1151,7 @@ START_TEST(file) test_fopen_fclose_fcloseall(); test_fileops(); test_asciimode(); + test_asciimode2(); test_readmode(FALSE); /* binary mode */ test_readmode(TRUE); /* ascii mode */ test_fgetc(); diff --git a/dlls/msvcrt/time.c b/dlls/msvcrt/time.c index 2b4327bce8f..f95b8b6a047 100644 --- a/dlls/msvcrt/time.c +++ b/dlls/msvcrt/time.c @@ -233,7 +233,7 @@ double CDECL MSVCRT_difftime(MSVCRT_time_t time1, MSVCRT_time_t time2) /********************************************************************* * _ftime (MSVCRT.@) */ -void CDECL _ftime(struct MSVCRT__timeb *buf) +void CDECL MSVCRT__ftime(struct MSVCRT__timeb *buf) { TIME_ZONE_INFORMATION tzinfo; FILETIME ft; @@ -260,7 +260,7 @@ MSVCRT_time_t CDECL MSVCRT_time(MSVCRT_time_t* buf) MSVCRT_time_t curtime; struct MSVCRT__timeb tb; - _ftime(&tb); + MSVCRT__ftime(&tb); curtime = tb.time; return buf ? *buf = curtime : curtime; diff --git a/dlls/msvcrt20/msvcrt20.spec b/dlls/msvcrt20/msvcrt20.spec index d7a0b55e3f3..56f961ca3df 100644 --- a/dlls/msvcrt20/msvcrt20.spec +++ b/dlls/msvcrt20/msvcrt20.spec @@ -437,22 +437,22 @@ @ stub ?xsgetn@streambuf@@UAEHPADH@Z # @ stub ?xsputn@streambuf@@UAEHPBDH@Z # @ stub $I10_OUTPUT # -@ cdecl _CIacos() msvcrt._CIacos -@ cdecl _CIasin() msvcrt._CIasin -@ cdecl _CIatan() msvcrt._CIatan -@ cdecl _CIatan2() msvcrt._CIatan2 -@ cdecl _CIcos() msvcrt._CIcos -@ cdecl _CIcosh() msvcrt._CIcosh -@ cdecl _CIexp() msvcrt._CIexp -@ cdecl _CIfmod() msvcrt._CIfmod -@ cdecl _CIlog() msvcrt._CIlog -@ cdecl _CIlog10() msvcrt._CIlog10 -@ cdecl _CIpow() msvcrt._CIpow -@ cdecl _CIsin() msvcrt._CIsin -@ cdecl _CIsinh() msvcrt._CIsinh -@ cdecl _CIsqrt() msvcrt._CIsqrt -@ cdecl _CItan() msvcrt._CItan -@ cdecl _CItanh() msvcrt._CItanh +@ cdecl -arch=i386 _CIacos() msvcrt._CIacos +@ cdecl -arch=i386 _CIasin() msvcrt._CIasin +@ cdecl -arch=i386 _CIatan() msvcrt._CIatan +@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2 +@ cdecl -arch=i386 _CIcos() msvcrt._CIcos +@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh +@ cdecl -arch=i386 _CIexp() msvcrt._CIexp +@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod +@ cdecl -arch=i386 _CIlog() msvcrt._CIlog +@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10 +@ cdecl -arch=i386 _CIpow() msvcrt._CIpow +@ cdecl -arch=i386 _CIsin() msvcrt._CIsin +@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh +@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt +@ cdecl -arch=i386 _CItan() msvcrt._CItan +@ cdecl -arch=i386 _CItanh() msvcrt._CItanh @ cdecl _CxxThrowException(long long) msvcrt._CxxThrowException @ extern _HUGE msvcrt._HUGE @ cdecl _XcptFilter(long ptr) msvcrt._XcptFilter @@ -471,32 +471,32 @@ @ cdecl __iscsymf(long) msvcrt.__iscsymf @ cdecl __lconv_init() msvcrt.__lconv_init @ extern __mb_cur_max msvcrt.__mb_cur_max -@ cdecl __p___argc() msvcrt.__p___argc -@ cdecl __p___argv() msvcrt.__p___argv -@ cdecl __p___initenv() msvcrt.__p___initenv -@ cdecl __p___mb_cur_max() msvcrt.__p___mb_cur_max -@ cdecl __p___wargv() msvcrt.__p___wargv -@ cdecl __p___winitenv() msvcrt.__p___winitenv -@ cdecl __p__acmdln() msvcrt.__p__acmdln -@ cdecl __p__amblksiz() msvcrt.__p__amblksiz -@ cdecl __p__commode() msvcrt.__p__commode -@ cdecl __p__daylight() msvcrt.__p__daylight -@ cdecl __p__environ() msvcrt.__p__environ -@ cdecl __p__fmode() msvcrt.__p__fmode +@ cdecl -arch=i386 __p___argc() msvcrt.__p___argc +@ cdecl -arch=i386 __p___argv() msvcrt.__p___argv +@ cdecl -arch=i386 __p___initenv() msvcrt.__p___initenv +@ cdecl -arch=i386 __p___mb_cur_max() msvcrt.__p___mb_cur_max +@ cdecl -arch=i386 __p___wargv() msvcrt.__p___wargv +@ cdecl -arch=i386 __p___winitenv() msvcrt.__p___winitenv +@ cdecl -arch=i386 __p__acmdln() msvcrt.__p__acmdln +@ cdecl -arch=i386 __p__amblksiz() msvcrt.__p__amblksiz +@ cdecl -arch=i386 __p__commode() msvcrt.__p__commode +@ cdecl -arch=i386 __p__daylight() msvcrt.__p__daylight +@ cdecl -arch=i386 __p__environ() msvcrt.__p__environ +@ cdecl -arch=i386 __p__fmode() msvcrt.__p__fmode @ cdecl -arch=i386 __p__iob() msvcrt.__p__iob -@ cdecl __p__mbctype() msvcrt.__p__mbctype -@ cdecl __p__osver() msvcrt.__p__osver -@ cdecl __p__pctype() msvcrt.__p__pctype -@ cdecl __p__pgmptr() msvcrt.__p__pgmptr -@ cdecl __p__pwctype() msvcrt.__p__pwctype -@ cdecl __p__timezone() msvcrt.__p__timezone -@ cdecl __p__tzname() msvcrt.__p__tzname -@ cdecl __p__wcmdln() msvcrt.__p__wcmdln -@ cdecl __p__wenviron() msvcrt.__p__wenviron -@ cdecl __p__winmajor() msvcrt.__p__winmajor -@ cdecl __p__winminor() msvcrt.__p__winminor -@ cdecl __p__winver() msvcrt.__p__winver -@ cdecl __p__wpgmptr() msvcrt.__p__wpgmptr +@ cdecl -arch=i386 __p__mbctype() msvcrt.__p__mbctype +@ cdecl -arch=i386 __p__osver() msvcrt.__p__osver +@ cdecl -arch=i386 __p__pctype() msvcrt.__p__pctype +@ cdecl -arch=i386 __p__pgmptr() msvcrt.__p__pgmptr +@ cdecl -arch=i386 __p__pwctype() msvcrt.__p__pwctype +@ cdecl -arch=i386 __p__timezone() msvcrt.__p__timezone +@ cdecl -arch=i386 __p__tzname() msvcrt.__p__tzname +@ cdecl -arch=i386 __p__wcmdln() msvcrt.__p__wcmdln +@ cdecl -arch=i386 __p__wenviron() msvcrt.__p__wenviron +@ cdecl -arch=i386 __p__winmajor() msvcrt.__p__winmajor +@ cdecl -arch=i386 __p__winminor() msvcrt.__p__winminor +@ cdecl -arch=i386 __p__winver() msvcrt.__p__winver +@ cdecl -arch=i386 __p__wpgmptr() msvcrt.__p__wpgmptr @ cdecl __pxcptinfoptrs() msvcrt.__pxcptinfoptrs @ cdecl __threadhandle() msvcrt.__threadhandle @ cdecl __threadid() msvcrt.__threadid diff --git a/dlls/msvcrt40/msvcrt40.c b/dlls/msvcrt40/msvcrt40.c index 48e4af0da59..f178ea0bafa 100644 --- a/dlls/msvcrt40/msvcrt40.c +++ b/dlls/msvcrt40/msvcrt40.c @@ -22,9 +22,6 @@ #include "windef.h" #include "winbase.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(msvcrt40); BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) { diff --git a/dlls/msvcrt40/msvcrt40.spec b/dlls/msvcrt40/msvcrt40.spec index ff14676a36f..fd2559a7a45 100644 --- a/dlls/msvcrt40/msvcrt40.spec +++ b/dlls/msvcrt40/msvcrt40.spec @@ -481,22 +481,22 @@ @ stub ?xsgetn@streambuf@@UAEHPADH@Z @ stub ?xsputn@streambuf@@UAEHPBDH@Z @ cdecl $I10_OUTPUT() msvcrt.$I10_OUTPUT -@ cdecl _CIacos() msvcrt._CIacos -@ cdecl _CIasin() msvcrt._CIasin -@ cdecl _CIatan() msvcrt._CIatan -@ cdecl _CIatan2() msvcrt._CIatan2 -@ cdecl _CIcos() msvcrt._CIcos -@ cdecl _CIcosh() msvcrt._CIcosh -@ cdecl _CIexp() msvcrt._CIexp -@ cdecl _CIfmod() msvcrt._CIfmod -@ cdecl _CIlog() msvcrt._CIlog -@ cdecl _CIlog10() msvcrt._CIlog10 -@ cdecl _CIpow() msvcrt._CIpow -@ cdecl _CIsin() msvcrt._CIsin -@ cdecl _CIsinh() msvcrt._CIsinh -@ cdecl _CIsqrt() msvcrt._CIsqrt -@ cdecl _CItan() msvcrt._CItan -@ cdecl _CItanh() msvcrt._CItanh +@ cdecl -arch=i386 _CIacos() msvcrt._CIacos +@ cdecl -arch=i386 _CIasin() msvcrt._CIasin +@ cdecl -arch=i386 _CIatan() msvcrt._CIatan +@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2 +@ cdecl -arch=i386 _CIcos() msvcrt._CIcos +@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh +@ cdecl -arch=i386 _CIexp() msvcrt._CIexp +@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod +@ cdecl -arch=i386 _CIlog() msvcrt._CIlog +@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10 +@ cdecl -arch=i386 _CIpow() msvcrt._CIpow +@ cdecl -arch=i386 _CIsin() msvcrt._CIsin +@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh +@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt +@ cdecl -arch=i386 _CItan() msvcrt._CItan +@ cdecl -arch=i386 _CItanh() msvcrt._CItanh @ cdecl _CxxThrowException(long long) msvcrt._CxxThrowException @ cdecl -i386 _EH_prolog() msvcrt._EH_prolog @ extern _HUGE msvcrt._HUGE @@ -519,33 +519,33 @@ @ cdecl __iscsymf(long) msvcrt.__iscsymf @ cdecl __lconv_init() msvcrt.__lconv_init @ extern __mb_cur_max msvcrt.__mb_cur_max -@ cdecl __p___argc() msvcrt.__p___argc -@ cdecl __p___argv() msvcrt.__p___argv -@ cdecl __p___initenv() msvcrt.__p___initenv -@ cdecl __p___mb_cur_max() msvcrt.__p___mb_cur_max -@ cdecl __p___wargv() msvcrt.__p___wargv -@ cdecl __p___winitenv() msvcrt.__p___winitenv -@ cdecl __p__acmdln() msvcrt.__p__acmdln -@ cdecl __p__amblksiz() msvcrt.__p__amblksiz -@ cdecl __p__commode() msvcrt.__p__commode -@ cdecl __p__daylight() msvcrt.__p__daylight -@ cdecl __p__dstbias() msvcrt.__p__dstbias -@ cdecl __p__environ() msvcrt.__p__environ -@ cdecl __p__fmode() msvcrt.__p__fmode +@ cdecl -arch=i386 __p___argc() msvcrt.__p___argc +@ cdecl -arch=i386 __p___argv() msvcrt.__p___argv +@ cdecl -arch=i386 __p___initenv() msvcrt.__p___initenv +@ cdecl -arch=i386 __p___mb_cur_max() msvcrt.__p___mb_cur_max +@ cdecl -arch=i386 __p___wargv() msvcrt.__p___wargv +@ cdecl -arch=i386 __p___winitenv() msvcrt.__p___winitenv +@ cdecl -arch=i386 __p__acmdln() msvcrt.__p__acmdln +@ cdecl -arch=i386 __p__amblksiz() msvcrt.__p__amblksiz +@ cdecl -arch=i386 __p__commode() msvcrt.__p__commode +@ cdecl -arch=i386 __p__daylight() msvcrt.__p__daylight +@ cdecl -arch=i386 __p__dstbias() msvcrt.__p__dstbias +@ cdecl -arch=i386 __p__environ() msvcrt.__p__environ +@ cdecl -arch=i386 __p__fmode() msvcrt.__p__fmode @ cdecl -arch=i386 __p__iob() msvcrt.__p__iob -@ cdecl __p__mbctype() msvcrt.__p__mbctype -@ cdecl __p__osver() msvcrt.__p__osver -@ cdecl __p__pctype() msvcrt.__p__pctype -@ cdecl __p__pgmptr() msvcrt.__p__pgmptr -@ cdecl __p__pwctype() msvcrt.__p__pwctype -@ cdecl __p__timezone() msvcrt.__p__timezone -@ cdecl __p__tzname() msvcrt.__p__tzname -@ cdecl __p__wcmdln() msvcrt.__p__wcmdln -@ cdecl __p__wenviron() msvcrt.__p__wenviron -@ cdecl __p__winmajor() msvcrt.__p__winmajor -@ cdecl __p__winminor() msvcrt.__p__winminor -@ cdecl __p__winver() msvcrt.__p__winver -@ cdecl __p__wpgmptr() msvcrt.__p__wpgmptr +@ cdecl -arch=i386 __p__mbctype() msvcrt.__p__mbctype +@ cdecl -arch=i386 __p__osver() msvcrt.__p__osver +@ cdecl -arch=i386 __p__pctype() msvcrt.__p__pctype +@ cdecl -arch=i386 __p__pgmptr() msvcrt.__p__pgmptr +@ cdecl -arch=i386 __p__pwctype() msvcrt.__p__pwctype +@ cdecl -arch=i386 __p__timezone() msvcrt.__p__timezone +@ cdecl -arch=i386 __p__tzname() msvcrt.__p__tzname +@ cdecl -arch=i386 __p__wcmdln() msvcrt.__p__wcmdln +@ cdecl -arch=i386 __p__wenviron() msvcrt.__p__wenviron +@ cdecl -arch=i386 __p__winmajor() msvcrt.__p__winmajor +@ cdecl -arch=i386 __p__winminor() msvcrt.__p__winminor +@ cdecl -arch=i386 __p__winver() msvcrt.__p__winver +@ cdecl -arch=i386 __p__wpgmptr() msvcrt.__p__wpgmptr @ cdecl __pxcptinfoptrs() msvcrt.__pxcptinfoptrs @ cdecl __set_app_type(long) msvcrt.__set_app_type @ cdecl __setusermatherr(ptr) msvcrt.__setusermatherr diff --git a/dlls/msvcrtd/msvcrtd.spec b/dlls/msvcrtd/msvcrtd.spec index d05892264e4..e65bec8d39b 100644 --- a/dlls/msvcrtd/msvcrtd.spec +++ b/dlls/msvcrtd/msvcrtd.spec @@ -50,22 +50,22 @@ @ cdecl ?terminate@@YAXXZ() msvcrt.?terminate@@YAXXZ @ cdecl ?unexpected@@YAXXZ() msvcrt.?unexpected@@YAXXZ @ cdecl -i386 ?what@exception@@UBEPBDXZ() msvcrt.?what@exception@@UBEPBDXZ -@ cdecl _CIacos() msvcrt._CIacos -@ cdecl _CIasin() msvcrt._CIasin -@ cdecl _CIatan() msvcrt._CIatan -@ cdecl _CIatan2() msvcrt._CIatan2 -@ cdecl _CIcos() msvcrt._CIcos -@ cdecl _CIcosh() msvcrt._CIcosh -@ cdecl _CIexp() msvcrt._CIexp -@ cdecl _CIfmod() msvcrt._CIfmod -@ cdecl _CIlog() msvcrt._CIlog -@ cdecl _CIlog10() msvcrt._CIlog10 -@ cdecl _CIpow() msvcrt._CIpow -@ cdecl _CIsin() msvcrt._CIsin -@ cdecl _CIsinh() msvcrt._CIsinh -@ cdecl _CIsqrt() msvcrt._CIsqrt -@ cdecl _CItan() msvcrt._CItan -@ cdecl _CItanh() msvcrt._CItanh +@ cdecl -arch=i386 _CIacos() msvcrt._CIacos +@ cdecl -arch=i386 _CIasin() msvcrt._CIasin +@ cdecl -arch=i386 _CIatan() msvcrt._CIatan +@ cdecl -arch=i386 _CIatan2() msvcrt._CIatan2 +@ cdecl -arch=i386 _CIcos() msvcrt._CIcos +@ cdecl -arch=i386 _CIcosh() msvcrt._CIcosh +@ cdecl -arch=i386 _CIexp() msvcrt._CIexp +@ cdecl -arch=i386 _CIfmod() msvcrt._CIfmod +@ cdecl -arch=i386 _CIlog() msvcrt._CIlog +@ cdecl -arch=i386 _CIlog10() msvcrt._CIlog10 +@ cdecl -arch=i386 _CIpow() msvcrt._CIpow +@ cdecl -arch=i386 _CIsin() msvcrt._CIsin +@ cdecl -arch=i386 _CIsinh() msvcrt._CIsinh +@ cdecl -arch=i386 _CIsqrt() msvcrt._CIsqrt +@ cdecl -arch=i386 _CItan() msvcrt._CItan +@ cdecl -arch=i386 _CItanh() msvcrt._CItanh @ cdecl _CrtCheckMemory() @ stub _CrtDbgBreak @ varargs _CrtDbgReport(long ptr long ptr ptr) @@ -100,6 +100,7 @@ @ cdecl __RTDynamicCast(ptr long ptr ptr long) msvcrt.__RTDynamicCast @ cdecl __RTtypeid(ptr) msvcrt.__RTtypeid @ cdecl __STRINGTOLD(ptr ptr str long) msvcrt.__STRINGTOLD +@ cdecl ___mb_cur_max_func() msvcrt.___mb_cur_max_func @ extern __argc msvcrt.__argc @ extern __argv msvcrt.__argv @ extern __badioinfo msvcrt.__badioinfo @@ -119,38 +120,39 @@ @ extern __lc_handle msvcrt.__lc_handle @ cdecl __lconv_init() msvcrt.__lconv_init @ extern __mb_cur_max msvcrt.__mb_cur_max -@ cdecl __p___argc() msvcrt.__p___argc -@ cdecl __p___argv() msvcrt.__p___argv -@ cdecl __p___initenv() msvcrt.__p___initenv -@ cdecl __p___mb_cur_max() msvcrt.__p___mb_cur_max -@ cdecl __p___wargv() msvcrt.__p___wargv -@ cdecl __p___winitenv() msvcrt.__p___winitenv -@ cdecl __p__acmdln() msvcrt.__p__acmdln -@ cdecl __p__amblksiz() msvcrt.__p__amblksiz -@ cdecl __p__commode() msvcrt.__p__commode -@ cdecl __p__crtAssertBusy() -@ cdecl __p__crtBreakAlloc() -@ cdecl __p__crtDbgFlag() -@ cdecl __p__daylight() msvcrt.__p__daylight -@ cdecl __p__dstbias() msvcrt.__p__dstbias -@ cdecl __p__environ() msvcrt.__p__environ -@ cdecl __p__fileinfo() msvcrt.__p__fileinfo -@ cdecl __p__fmode() msvcrt.__p__fmode +@ cdecl -arch=i386 __p___argc() msvcrt.__p___argc +@ cdecl -arch=i386 __p___argv() msvcrt.__p___argv +@ cdecl -arch=i386 __p___initenv() msvcrt.__p___initenv +@ cdecl -arch=i386 __p___mb_cur_max() msvcrt.__p___mb_cur_max +@ cdecl -arch=i386 __p___wargv() msvcrt.__p___wargv +@ cdecl -arch=i386 __p___winitenv() msvcrt.__p___winitenv +@ cdecl -arch=i386 __p__acmdln() msvcrt.__p__acmdln +@ cdecl -arch=i386 __p__amblksiz() msvcrt.__p__amblksiz +@ cdecl -arch=i386 __p__commode() msvcrt.__p__commode +@ cdecl -arch=i386 __p__crtAssertBusy() +@ cdecl -arch=i386 __p__crtBreakAlloc() +@ cdecl -arch=i386 __p__crtDbgFlag() +@ cdecl -arch=i386 __p__daylight() msvcrt.__p__daylight +@ cdecl -arch=i386 __p__dstbias() msvcrt.__p__dstbias +@ cdecl -arch=i386 __p__environ() msvcrt.__p__environ +@ cdecl -arch=i386 __p__fileinfo() msvcrt.__p__fileinfo +@ cdecl -arch=i386 __p__fmode() msvcrt.__p__fmode @ cdecl -arch=i386 __p__iob() msvcrt.__p__iob -@ cdecl __p__mbcasemap() msvcrt.__p__mbcasemap -@ cdecl __p__mbctype() msvcrt.__p__mbctype -@ cdecl __p__osver() msvcrt.__p__osver -@ cdecl __p__pctype() msvcrt.__p__pctype -@ cdecl __p__pgmptr() msvcrt.__p__pgmptr -@ cdecl __p__pwctype() msvcrt.__p__pwctype -@ cdecl __p__timezone() msvcrt.__p__timezone -@ cdecl __p__tzname() msvcrt.__p__tzname -@ cdecl __p__wcmdln() msvcrt.__p__wcmdln -@ cdecl __p__wenviron() msvcrt.__p__wenviron -@ cdecl __p__winmajor() msvcrt.__p__winmajor -@ cdecl __p__winminor() msvcrt.__p__winminor -@ cdecl __p__winver() msvcrt.__p__winver -@ cdecl __p__wpgmptr() msvcrt.__p__wpgmptr +@ cdecl -arch=i386 __p__mbcasemap() msvcrt.__p__mbcasemap +@ cdecl -arch=i386 __p__mbctype() msvcrt.__p__mbctype +@ cdecl -arch=i386 __p__osver() msvcrt.__p__osver +@ cdecl -arch=i386 __p__pctype() msvcrt.__p__pctype +@ cdecl -arch=i386 __p__pgmptr() msvcrt.__p__pgmptr +@ cdecl -arch=i386 __p__pwctype() msvcrt.__p__pwctype +@ cdecl -arch=i386 __p__timezone() msvcrt.__p__timezone +@ cdecl -arch=i386 __p__tzname() msvcrt.__p__tzname +@ cdecl -arch=i386 __p__wcmdln() msvcrt.__p__wcmdln +@ cdecl -arch=i386 __p__wenviron() msvcrt.__p__wenviron +@ cdecl -arch=i386 __p__winmajor() msvcrt.__p__winmajor +@ cdecl -arch=i386 __p__winminor() msvcrt.__p__winminor +@ cdecl -arch=i386 __p__winver() msvcrt.__p__winver +@ cdecl -arch=i386 __p__wpgmptr() msvcrt.__p__wpgmptr +@ cdecl __pctype_func() msvcrt.__pctype_func @ extern __pioinfo msvcrt.__pioinfo @ cdecl __pxcptinfoptrs() msvcrt.__pxcptinfoptrs @ cdecl __set_app_type(long) msvcrt.__set_app_type diff --git a/dlls/hal/Makefile.in b/dlls/msvfw32/tests/Makefile.in similarity index 56% copy from dlls/hal/Makefile.in copy to dlls/msvfw32/tests/Makefile.in index 4f3cf1cfb45..feb67c62fa4 100644 --- a/dlls/hal/Makefile.in +++ b/dlls/msvfw32/tests/Makefile.in @@ -1,13 +1,13 @@ TOPSRCDIR = @top_srcdir@ -TOPOBJDIR = ../.. +TOPOBJDIR = ../../.. SRCDIR = @srcdir@ VPATH = @srcdir@ -MODULE = hal.dll -IMPORTS = kernel32 ntdll +TESTDLL = msvfw32.dll +IMPORTS = msvfw32 kernel32 -C_SRCS = \ - hal.c +CTESTS = \ + msvfw.c -@MAKE_DLL_RULES@ +@MAKE_TEST_RULES@ @DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/msvfw32/tests/msvfw.c b/dlls/msvfw32/tests/msvfw.c new file mode 100644 index 00000000000..537c230ffeb --- /dev/null +++ b/dlls/msvfw32/tests/msvfw.c @@ -0,0 +1,59 @@ +/* + * Unit tests for video playback + * + * Copyright 2008 Jörg Höhle + * Copyright 2008 Austin English + * + * 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 + */ + +#define WIN32_LEAN_AND_MEAN +#include +#include + +#include "wine/test.h" + +static void test_OpenCase(void) +{ + HIC h; + /* Open a compressor with combinations of lowercase + * and uppercase compressortype and handler. + */ + h = ICOpen(mmioFOURCC('v','i','d','c'),mmioFOURCC('m','s','v','c'),ICMODE_DECOMPRESS); + ok(0!=h,"ICOpen(vidc.msvc) failed\n"); + if (h) { + ok(ICClose(h)==ICERR_OK,"ICClose failed\n"); + } + h = ICOpen(mmioFOURCC('v','i','d','c'),mmioFOURCC('M','S','V','C'),ICMODE_DECOMPRESS); + ok(0!=h,"ICOpen(vidc.MSVC) failed\n"); + if (h) { + ok(ICClose(h)==ICERR_OK,"ICClose failed\n"); + } + h = ICOpen(mmioFOURCC('V','I','D','C'),mmioFOURCC('m','s','v','c'),ICMODE_DECOMPRESS); + todo_wine ok(0!=h,"ICOpen(VIDC.msvc) failed\n"); + if (h) { + ok(ICClose(h)==ICERR_OK,"ICClose failed\n"); + } + h = ICOpen(mmioFOURCC('V','I','D','C'),mmioFOURCC('M','S','V','C'),ICMODE_DECOMPRESS); + todo_wine ok(0!=h,"ICOpen(VIDC.MSVC) failed\n"); + if (h) { + ok(ICClose(h)==ICERR_OK,"ICClose failed\n"); + } +} + +START_TEST(msvfw) +{ + test_OpenCase(); +} diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c index a31f80ef799..f4793958f8a 100644 --- a/dlls/msxml3/element.c +++ b/dlls/msxml3/element.c @@ -587,23 +587,32 @@ static HRESULT WINAPI domelem_getAttributeNode( xmlNodePtr element; xmlAttrPtr attr; IUnknown *unk; - HRESULT hr = E_FAIL; + HRESULT hr = S_FALSE; TRACE("(%p)->(%s %p)\n", This, debugstr_w(p), attributeNode); + if(!attributeNode) + return E_FAIL; + + *attributeNode = NULL; + element = get_element( This ); if ( !element ) return E_FAIL; xml_name = xmlChar_from_wchar(p); + if(!xmlValidateNameValue(xml_name)) + { + HeapFree(GetProcessHeap(), 0, xml_name); + return E_FAIL; + } + attr = xmlHasProp(element, xml_name); if(attr) { unk = create_attribute((xmlNodePtr)attr); hr = IUnknown_QueryInterface(unk, &IID_IXMLDOMAttribute, (void**)attributeNode); IUnknown_Release(unk); - }else { - *attributeNode = NULL; } HeapFree(GetProcessHeap(), 0, xml_name); diff --git a/dlls/msxml3/regsvr.c b/dlls/msxml3/regsvr.c index 320d51e280d..a6ed0ee72d2 100644 --- a/dlls/msxml3/regsvr.c +++ b/dlls/msxml3/regsvr.c @@ -45,6 +45,7 @@ #include "msxml_private.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -180,7 +181,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c index bac7e3fa7a7..73ba9321a12 100644 --- a/dlls/msxml3/tests/domdoc.c +++ b/dlls/msxml3/tests/domdoc.c @@ -958,12 +958,22 @@ static void test_domnode( void ) ok( V_VT(&var) == VT_NULL || V_VT(&var) == VT_EMPTY, "vt = %x\n", V_VT(&var)); VariantClear(&var); + r = IXMLDOMElement_getAttributeNode( element, str, NULL); + ok( r == E_FAIL, "getAttributeNode ret %08x\n", r ); + attr = (IXMLDOMAttribute*)0xdeadbeef; r = IXMLDOMElement_getAttributeNode( element, str, &attr); ok( r == E_FAIL, "getAttributeNode ret %08x\n", r ); ok( attr == NULL, "getAttributeNode ret %p, expected NULL\n", attr ); SysFreeString( str ); + attr = (IXMLDOMAttribute*)0xdeadbeef; + str = _bstr_("nonExisitingAttribute"); + r = IXMLDOMElement_getAttributeNode( element, str, &attr); + ok( r == S_FALSE, "getAttributeNode ret %08x\n", r ); + ok( attr == NULL, "getAttributeNode ret %p, expected NULL\n", attr ); + SysFreeString( str ); + str = SysAllocString( szdl ); V_VT(&var) = VT_I4; V_I4(&var) = 0x1234; diff --git a/dlls/ntdll/directory.c b/dlls/ntdll/directory.c index 74699490193..001c0042194 100644 --- a/dlls/ntdll/directory.c +++ b/dlls/ntdll/directory.c @@ -1919,8 +1919,8 @@ static inline int get_dos_prefix_len( const UNICODE_STRING *name ) * element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is * returned, but the unix name is still filled in properly. */ -NTSTATUS wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, - UINT disposition, BOOLEAN check_case ) +NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, + UINT disposition, BOOLEAN check_case ) { static const WCHAR unixW[] = {'u','n','i','x'}; static const WCHAR invalid_charsW[] = { INVALID_NT_CHARS, 0 }; @@ -2302,7 +2302,7 @@ static void WINAPI read_changes_user_apc( void *arg, IO_STATUS_BLOCK *io, ULONG RtlFreeHeap( GetProcessHeap(), 0, info ); } -static NTSTATUS read_changes_apc( void *user, PIO_STATUS_BLOCK iosb, NTSTATUS status, ULONG_PTR *total ) +static NTSTATUS read_changes_apc( void *user, PIO_STATUS_BLOCK iosb, NTSTATUS status, ULONG *total ) { struct read_changes_info *info = user; char path[PATH_MAX]; diff --git a/dlls/ntdll/file.c b/dlls/ntdll/file.c index 50ee3f77c52..9d6ed673c5d 100644 --- a/dlls/ntdll/file.c +++ b/dlls/ntdll/file.c @@ -334,7 +334,7 @@ NTSTATUS FILE_GetNtStatus(void) /*********************************************************************** * FILE_AsyncReadService (INTERNAL) */ -static NTSTATUS FILE_AsyncReadService(void *user, PIO_STATUS_BLOCK iosb, NTSTATUS status, ULONG_PTR *total) +static NTSTATUS FILE_AsyncReadService(void *user, PIO_STATUS_BLOCK iosb, NTSTATUS status, ULONG *total) { async_fileio_read *fileio = user; int fd, needs_close, result; @@ -812,7 +812,7 @@ NTSTATUS WINAPI NtReadFileScatter( HANDLE file, HANDLE event, PIO_APC_ROUTINE ap /*********************************************************************** * FILE_AsyncWriteService (INTERNAL) */ -static NTSTATUS FILE_AsyncWriteService(void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status, ULONG_PTR *total) +static NTSTATUS FILE_AsyncWriteService(void *user, IO_STATUS_BLOCK *iosb, NTSTATUS status, ULONG *total) { async_fileio_write *fileio = user; int result, fd, needs_close; @@ -1146,7 +1146,7 @@ struct async_ioctl }; /* callback for ioctl async I/O completion */ -static NTSTATUS ioctl_completion( void *arg, IO_STATUS_BLOCK *io, NTSTATUS status ) +static NTSTATUS ioctl_completion( void *arg, IO_STATUS_BLOCK *io, NTSTATUS status, ULONG *total ) { struct async_ioctl *async = arg; @@ -1158,7 +1158,7 @@ static NTSTATUS ioctl_completion( void *arg, IO_STATUS_BLOCK *io, NTSTATUS statu req->user_arg = async; wine_server_set_reply( req, async->buffer, async->size ); if (!(status = wine_server_call( req ))) - io->Information = wine_server_reply_size( reply ); + io->Information = *total = wine_server_reply_size( reply ); } SERVER_END_REQ; } diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c index d3a006712db..3bada928eec 100644 --- a/dlls/ntdll/loader.c +++ b/dlls/ntdll/loader.c @@ -172,24 +172,20 @@ static inline BOOL call_dll_entry_point( DLLENTRYPROC proc, void *module, #endif /* __i386__ */ -#ifdef __i386__ +#if defined(__i386__) || defined(__x86_64__) /************************************************************************* * stub_entry_point * * Entry point for stub functions. */ -static void stub_entry_point( const char *dll, const char *name, ... ) +static void stub_entry_point( const char *dll, const char *name, void *ret_addr ) { EXCEPTION_RECORD rec; rec.ExceptionCode = EXCEPTION_WINE_STUB; rec.ExceptionFlags = EH_NONCONTINUABLE; rec.ExceptionRecord = NULL; -#ifdef __GNUC__ - rec.ExceptionAddress = __builtin_return_address(0); -#else - rec.ExceptionAddress = *((void **)&dll - 1); -#endif + rec.ExceptionAddress = ret_addr; rec.NumberParameters = 2; rec.ExceptionInformation[0] = (ULONG_PTR)dll; rec.ExceptionInformation[1] = (ULONG_PTR)name; @@ -198,17 +194,29 @@ static void stub_entry_point( const char *dll, const char *name, ... ) #include "pshpack1.h" +#ifdef __i386__ struct stub { - BYTE popl_eax; /* popl %eax */ BYTE pushl1; /* pushl $name */ const char *name; BYTE pushl2; /* pushl $dll */ const char *dll; - BYTE pushl_eax; /* pushl %eax */ - BYTE jmp; /* jmp stub_entry_point */ + BYTE call; /* call stub_entry_point */ DWORD entry; }; +#else +struct stub +{ + BYTE movq_rdi[2]; /* movq $dll,%rdi */ + const char *dll; + BYTE movq_rsi[2]; /* movq $name,%rsi */ + const char *name; + BYTE movq_rsp_rdx[4]; /* movq (%rsp),%rdx */ + BYTE movq_rax[2]; /* movq $entry, %rax */ + const void* entry; + BYTE jmpq_rax[2]; /* jmp %rax */ +}; +#endif #include "poppack.h" /************************************************************************* @@ -233,14 +241,30 @@ static ULONG_PTR allocate_stub( const char *dll, const char *name ) return 0xdeadbeef; } stub = &stubs[nb_stubs++]; - stub->popl_eax = 0x58; /* popl %eax */ +#ifdef __i386__ stub->pushl1 = 0x68; /* pushl $name */ stub->name = name; stub->pushl2 = 0x68; /* pushl $dll */ stub->dll = dll; - stub->pushl_eax = 0x50; /* pushl %eax */ - stub->jmp = 0xe9; /* jmp stub_entry_point */ + stub->call = 0xe8; /* call stub_entry_point */ stub->entry = (BYTE *)stub_entry_point - (BYTE *)(&stub->entry + 1); +#else + stub->movq_rdi[0] = 0x48; /* movq $dll,%rdi */ + stub->movq_rdi[1] = 0xbf; + stub->dll = dll; + stub->movq_rsi[0] = 0x48; /* movq $name,%rsi */ + stub->movq_rsi[1] = 0xbe; + stub->name = name; + stub->movq_rsp_rdx[0] = 0x48; /* movq (%rsp),%rdx */ + stub->movq_rsp_rdx[1] = 0x8b; + stub->movq_rsp_rdx[2] = 0x14; + stub->movq_rsp_rdx[3] = 0x24; + stub->movq_rax[0] = 0x48; /* movq $entry, %rax */ + stub->movq_rax[1] = 0xb8; + stub->entry = stub_entry_point; + stub->jmpq_rax[0] = 0xff; /* jmp %rax */ + stub->jmpq_rax[1] = 0xe0; +#endif return (ULONG_PTR)stub; } @@ -2588,7 +2612,7 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) * * Windows and system dir initialization once kernel32 has been loaded. */ -void __wine_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir ) +void CDECL __wine_init_windows_dir( const WCHAR *windir, const WCHAR *sysdir ) { PLIST_ENTRY mark, entry; LPWSTR buffer, p; diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index 442516e5986..1e41e4d9bc0 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -144,7 +144,7 @@ @ stdcall NtCreateTimer(ptr long ptr long) @ stub NtCreateToken # @ stub NtCreateWaitablePort -@ stdcall NtCurrentTeb() +@ stdcall -arch=i386,sparc,alpha,powerpc NtCurrentTeb() # @ stub NtDebugActiveProcess # @ stub NtDebugContinue @ stdcall NtDelayExecution(long ptr) diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index 63e121e8fd8..4474f2f9d01 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -211,6 +211,7 @@ static inline struct ntdll_thread_regs *ntdll_get_thread_regs(void) } /* Completion */ -extern NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue, NTSTATUS CompletionStatus, ULONG_PTR Information ); +extern NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue, + NTSTATUS CompletionStatus, ULONG Information ); #endif diff --git a/dlls/ntdll/path.c b/dlls/ntdll/path.c index 6716c6a861b..66d7b7a3d32 100644 --- a/dlls/ntdll/path.c +++ b/dlls/ntdll/path.c @@ -1015,7 +1015,7 @@ NTSTATUS WINAPI RtlSetCurrentDirectory_U(const UNICODE_STRING* dir) /****************************************************************** * wine_unix_to_nt_file_name (NTDLL.@) Not a Windows API */ -NTSTATUS wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt ) +NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt ) { static const WCHAR prefixW[] = {'\\','?','?','\\','A',':','\\'}; unsigned int lenW, lenA = name->Length; diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c index 46213dae145..6ba1433f43b 100644 --- a/dlls/ntdll/process.c +++ b/dlls/ntdll/process.c @@ -77,7 +77,7 @@ PEB * WINAPI RtlGetCurrentPeb(void) * Mark the current process as a system process. * Returns the event that is signaled when all non-system processes have exited. */ -HANDLE __wine_make_process_system(void) +HANDLE CDECL __wine_make_process_system(void) { HANDLE ret = 0; SERVER_START_REQ( make_process_system ) diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c index 7b9e895e015..14993f26879 100644 --- a/dlls/ntdll/rtlstr.c +++ b/dlls/ntdll/rtlstr.c @@ -54,8 +54,8 @@ static const union cptable* unix_table; /* NULL if UTF8 */ * * Set the code page once kernel32 is loaded. Should be done differently. */ -void __wine_init_codepages( const union cptable *ansi, const union cptable *oem, - const union cptable *ucp) +void CDECL __wine_init_codepages( const union cptable *ansi, const union cptable *oem, + const union cptable *ucp) { ansi_table = ansi; oem_table = oem; diff --git a/dlls/ntdll/server.c b/dlls/ntdll/server.c index 9d169fabc83..fd154ff8f2c 100644 --- a/dlls/ntdll/server.c +++ b/dlls/ntdll/server.c @@ -358,7 +358,7 @@ void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset_t *sig * RETURNS * nothing */ -void wine_server_send_fd( int fd ) +void CDECL wine_server_send_fd( int fd ) { #ifndef HAVE_STRUCT_MSGHDR_MSG_ACCRIGHTS struct cmsg_fd cmsg; @@ -627,7 +627,7 @@ done: * RETURNS * NTSTATUS code */ -int wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle ) +int CDECL wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle ) { int ret; @@ -660,7 +660,7 @@ int wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attribut * RETURNS * NTSTATUS code */ -int wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd, +int CDECL wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd, unsigned int *options ) { int needs_close, ret = server_get_unix_fd( handle, access, unix_fd, &needs_close, NULL, options ); @@ -685,7 +685,7 @@ int wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd, * RETURNS * nothing */ -void wine_server_release_fd( HANDLE handle, int unix_fd ) +void CDECL wine_server_release_fd( HANDLE handle, int unix_fd ) { close( unix_fd ); } diff --git a/dlls/ntdll/signal_i386.c b/dlls/ntdll/signal_i386.c index 6a3a8477703..bd1e52b4470 100644 --- a/dlls/ntdll/signal_i386.c +++ b/dlls/ntdll/signal_i386.c @@ -1560,7 +1560,7 @@ size_t get_signal_stack_total_size(void) /*********************************************************************** * __wine_set_signal_handler (NTDLL.@) */ -int __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) +int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) { if (sig >= sizeof(handlers) / sizeof(handlers[0])) return -1; if (handlers[sig] != NULL) return -2; diff --git a/dlls/ntdll/signal_powerpc.c b/dlls/ntdll/signal_powerpc.c index ecb74e1d4d3..4fa44e76c34 100644 --- a/dlls/ntdll/signal_powerpc.c +++ b/dlls/ntdll/signal_powerpc.c @@ -635,7 +635,7 @@ static int set_handler( int sig, void (*func)() ) /*********************************************************************** * __wine_set_signal_handler (NTDLL.@) */ -int __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) +int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) { if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1; if (handlers[sig] != NULL) return -2; diff --git a/dlls/ntdll/signal_sparc.c b/dlls/ntdll/signal_sparc.c index 657d167790c..4c1463399f5 100644 --- a/dlls/ntdll/signal_sparc.c +++ b/dlls/ntdll/signal_sparc.c @@ -448,7 +448,7 @@ static int set_handler( int sig, void (*func)() ) /*********************************************************************** * __wine_set_signal_handler (NTDLL.@) */ -int __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) +int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) { if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1; if (handlers[sig] != NULL) return -2; diff --git a/dlls/ntdll/signal_x86_64.c b/dlls/ntdll/signal_x86_64.c index 4020be0ea4c..35c9f1b6e81 100644 --- a/dlls/ntdll/signal_x86_64.c +++ b/dlls/ntdll/signal_x86_64.c @@ -474,7 +474,7 @@ static int set_handler( int sig, void (*func)() ) /*********************************************************************** * __wine_set_signal_handler (NTDLL.@) */ -int __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) +int CDECL __wine_set_signal_handler(unsigned int sig, wine_signal_handler wsh) { if (sig > sizeof(handlers) / sizeof(handlers[0])) return -1; if (handlers[sig] != NULL) return -2; diff --git a/dlls/ntdll/sync.c b/dlls/ntdll/sync.c index bad6eabf403..002bf428f4b 100644 --- a/dlls/ntdll/sync.c +++ b/dlls/ntdll/sync.c @@ -843,6 +843,7 @@ static int wait_reply( void *cookie ) static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) { BOOL user_apc = FALSE; + SIZE_T size; memset( result, 0, sizeof(*result) ); @@ -868,22 +869,31 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) case APC_VIRTUAL_ALLOC: result->type = call->type; result->virtual_alloc.addr = call->virtual_alloc.addr; - result->virtual_alloc.size = call->virtual_alloc.size; - result->virtual_alloc.status = NtAllocateVirtualMemory( NtCurrentProcess(), - &result->virtual_alloc.addr, - call->virtual_alloc.zero_bits, - &result->virtual_alloc.size, - call->virtual_alloc.op_type, - call->virtual_alloc.prot ); + size = call->virtual_alloc.size; + if (size == call->virtual_alloc.size) /* not truncated */ + { + result->virtual_alloc.status = NtAllocateVirtualMemory( NtCurrentProcess(), + &result->virtual_alloc.addr, + call->virtual_alloc.zero_bits, + &size, + call->virtual_alloc.op_type, + call->virtual_alloc.prot ); + result->virtual_alloc.size = size; + } + else result->virtual_alloc.status = STATUS_WORKING_SET_LIMIT_RANGE; break; case APC_VIRTUAL_FREE: result->type = call->type; result->virtual_free.addr = call->virtual_free.addr; - result->virtual_free.size = call->virtual_free.size; - result->virtual_free.status = NtFreeVirtualMemory( NtCurrentProcess(), - &result->virtual_free.addr, - &result->virtual_free.size, - call->virtual_free.op_type ); + size = call->virtual_free.size; + if (size == call->virtual_free.size) /* not truncated */ + { + result->virtual_free.status = NtFreeVirtualMemory( NtCurrentProcess(), + &result->virtual_free.addr, &size, + call->virtual_free.op_type ); + result->virtual_free.size = size; + } + else result->virtual_free.status = STATUS_INVALID_PARAMETER; break; case APC_VIRTUAL_QUERY: { @@ -908,49 +918,71 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) case APC_VIRTUAL_PROTECT: result->type = call->type; result->virtual_protect.addr = call->virtual_protect.addr; - result->virtual_protect.size = call->virtual_protect.size; - result->virtual_protect.status = NtProtectVirtualMemory( NtCurrentProcess(), - &result->virtual_protect.addr, - &result->virtual_protect.size, - call->virtual_protect.prot, - &result->virtual_protect.prot ); + size = call->virtual_protect.size; + if (size == call->virtual_protect.size) /* not truncated */ + { + result->virtual_protect.status = NtProtectVirtualMemory( NtCurrentProcess(), + &result->virtual_protect.addr, + &size, + call->virtual_protect.prot, + &result->virtual_protect.prot ); + result->virtual_protect.size = size; + } + else result->virtual_protect.status = STATUS_INVALID_PARAMETER; break; case APC_VIRTUAL_FLUSH: result->type = call->type; result->virtual_flush.addr = call->virtual_flush.addr; - result->virtual_flush.size = call->virtual_flush.size; - result->virtual_flush.status = NtFlushVirtualMemory( NtCurrentProcess(), - &result->virtual_flush.addr, - &result->virtual_flush.size, 0 ); + size = call->virtual_flush.size; + if (size == call->virtual_flush.size) /* not truncated */ + { + result->virtual_flush.status = NtFlushVirtualMemory( NtCurrentProcess(), + &result->virtual_flush.addr, &size, 0 ); + result->virtual_flush.size = size; + } + else result->virtual_flush.status = STATUS_INVALID_PARAMETER; break; case APC_VIRTUAL_LOCK: result->type = call->type; result->virtual_lock.addr = call->virtual_lock.addr; - result->virtual_lock.size = call->virtual_lock.size; - result->virtual_lock.status = NtLockVirtualMemory( NtCurrentProcess(), - &result->virtual_lock.addr, - &result->virtual_lock.size, 0 ); + size = call->virtual_lock.size; + if (size == call->virtual_lock.size) /* not truncated */ + { + result->virtual_lock.status = NtLockVirtualMemory( NtCurrentProcess(), + &result->virtual_lock.addr, &size, 0 ); + result->virtual_lock.size = size; + } + else result->virtual_lock.status = STATUS_INVALID_PARAMETER; break; case APC_VIRTUAL_UNLOCK: result->type = call->type; result->virtual_unlock.addr = call->virtual_unlock.addr; - result->virtual_unlock.size = call->virtual_unlock.size; - result->virtual_unlock.status = NtUnlockVirtualMemory( NtCurrentProcess(), - &result->virtual_unlock.addr, - &result->virtual_unlock.size, 0 ); + size = call->virtual_unlock.size; + if (size == call->virtual_unlock.size) /* not truncated */ + { + result->virtual_unlock.status = NtUnlockVirtualMemory( NtCurrentProcess(), + &result->virtual_unlock.addr, &size, 0 ); + result->virtual_unlock.size = size; + } + else result->virtual_unlock.status = STATUS_INVALID_PARAMETER; break; case APC_MAP_VIEW: { LARGE_INTEGER offset; result->type = call->type; result->map_view.addr = call->map_view.addr; - result->map_view.size = call->map_view.size; offset.QuadPart = call->map_view.offset; - result->map_view.status = NtMapViewOfSection( wine_server_ptr_handle(call->map_view.handle), - NtCurrentProcess(), &result->map_view.addr, - call->map_view.zero_bits, 0, &offset, - &result->map_view.size, ViewShare, - call->map_view.alloc_type, call->map_view.prot ); + size = call->map_view.size; + if (size == call->map_view.size) /* not truncated */ + { + result->map_view.status = NtMapViewOfSection( wine_server_ptr_handle(call->map_view.handle), + NtCurrentProcess(), &result->map_view.addr, + call->map_view.zero_bits, 0, + &offset, &size, ViewShare, + call->map_view.alloc_type, call->map_view.prot ); + result->map_view.size = size; + } + else result->map_view.status = STATUS_INVALID_PARAMETER; NtClose( wine_server_ptr_handle(call->map_view.handle) ); break; } @@ -962,16 +994,22 @@ static BOOL invoke_apc( const apc_call_t *call, apc_result_t *result ) { CLIENT_ID id; HANDLE handle; + SIZE_T reserve = call->create_thread.reserve; + SIZE_T commit = call->create_thread.commit; + result->type = call->type; - result->create_thread.status = RtlCreateUserThread( NtCurrentProcess(), NULL, - call->create_thread.suspend, NULL, - call->create_thread.reserve, - call->create_thread.commit, - call->create_thread.func, - call->create_thread.arg, - &handle, &id ); - result->create_thread.handle = wine_server_obj_handle( handle ); - result->create_thread.tid = HandleToULong(id.UniqueThread); + if (reserve == call->create_thread.reserve && commit == call->create_thread.commit) + { + result->create_thread.status = RtlCreateUserThread( NtCurrentProcess(), NULL, + call->create_thread.suspend, NULL, + reserve, commit, + call->create_thread.func, + call->create_thread.arg, + &handle, &id ); + result->create_thread.handle = wine_server_obj_handle( handle ); + result->create_thread.tid = HandleToULong(id.UniqueThread); + } + else result->create_thread.status = STATUS_INVALID_PARAMETER; break; } default: @@ -1393,7 +1431,8 @@ NTSTATUS WINAPI NtQueryIoCompletion( HANDLE CompletionPort, IO_COMPLETION_INFORM return status; } -NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue, NTSTATUS CompletionStatus, ULONG_PTR Information ) +NTSTATUS NTDLL_AddCompletion( HANDLE hFile, ULONG_PTR CompletionValue, + NTSTATUS CompletionStatus, ULONG Information ) { NTSTATUS status; diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 65a27edc68b..89d5ce9d8cb 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -1465,6 +1465,10 @@ __ASM_GLOBAL_FUNC( NtCurrentTeb, ".byte 0x64\n\tmovl 0x18,%eax\n\tret" ) /* Nothing needs to be done. MS C "magically" exports the inline version from winnt.h */ +#elif defined(__x86_64__) && defined(__GNUC__) + +/* not exported on x86_64 */ + #else /**********************************************************************/ diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c index da08e2f5b56..bda8be195d8 100644 --- a/dlls/ntdll/virtual.c +++ b/dlls/ntdll/virtual.c @@ -1967,6 +1967,8 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr, info->Protect = result.virtual_query.prot; info->AllocationProtect = result.virtual_query.alloc_prot; info->Type = result.virtual_query.alloc_type; + if (info->RegionSize != result.virtual_query.size) /* truncated */ + return STATUS_INVALID_PARAMETER; /* FIXME */ if (res_len) *res_len = sizeof(*info); } return result.virtual_query.status; @@ -2208,7 +2210,7 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p SECTION_INHERIT inherit, ULONG alloc_type, ULONG protect ) { NTSTATUS res; - ULONGLONG full_size; + mem_size_t full_size; ACCESS_MASK access; SIZE_T size = 0; SIZE_T mask = get_mask( zero_bits ); @@ -2293,9 +2295,13 @@ NTSTATUS WINAPI NtMapViewOfSection( HANDLE handle, HANDLE process, PVOID *addr_p if (res) return res; size = full_size; - if (sizeof(size) < sizeof(full_size) && (size != full_size)) - ERR( "Sizes larger than 4Gb (%x%08x) not supported on this platform\n", - (DWORD)(full_size >> 32), (DWORD)full_size ); + if (size != full_size) + { + WARN( "Sizes larger than 4Gb (%s) not supported on this platform\n", + wine_dbgstr_longlong(full_size) ); + if (dup_mapping) NtClose( dup_mapping ); + return STATUS_INVALID_PARAMETER; + } if ((res = server_get_unix_fd( handle, 0, &unix_handle, &needs_close, NULL, NULL ))) goto done; diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c index 652f5ffbb91..227e393d207 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.c +++ b/dlls/ntoskrnl.exe/ntoskrnl.c @@ -191,7 +191,7 @@ static NTSTATUS process_ioctl( DEVICE_OBJECT *device, ULONG code, void *in_buff, /*********************************************************************** * wine_ntoskrnl_main_loop (Not a Windows API) */ -NTSTATUS wine_ntoskrnl_main_loop( HANDLE stop_event ) +NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event ) { HANDLE manager = get_device_manager(); obj_handle_t ioctl = 0; @@ -260,6 +260,31 @@ NTSTATUS wine_ntoskrnl_main_loop( HANDLE stop_event ) /*********************************************************************** + * IoAllocateDriverObjectExtension (NTOSKRNL.EXE.@) + */ +NTSTATUS WINAPI IoAllocateDriverObjectExtension( PDRIVER_OBJECT DriverObject, + PVOID ClientIdentificationAddress, + ULONG DriverObjectExtensionSize, + PVOID *DriverObjectExtension ) +{ + FIXME( "%p, %p, %u, %p\n", DriverObject, ClientIdentificationAddress, + DriverObjectExtensionSize, DriverObjectExtension ); + return STATUS_NOT_IMPLEMENTED; +} + + +/*********************************************************************** + * IoGetDriverObjectExtension (NTOSKRNL.EXE.@) + */ +PVOID WINAPI IoGetDriverObjectExtension( PDRIVER_OBJECT DriverObject, + PVOID ClientIdentificationAddress ) +{ + FIXME( "%p, %p\n", DriverObject, ClientIdentificationAddress ); + return NULL; +} + + +/*********************************************************************** * IoInitializeIrp (NTOSKRNL.EXE.@) */ void WINAPI IoInitializeIrp( IRP *irp, USHORT size, CCHAR stack_size ) diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec index cf4c86e5368..946249d82fb 100644 --- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec +++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec @@ -309,7 +309,7 @@ @ stub IoAdapterObjectType @ stub IoAllocateAdapterChannel @ stub IoAllocateController -@ stub IoAllocateDriverObjectExtension +@ stdcall IoAllocateDriverObjectExtension(ptr ptr long ptr) @ stub IoAllocateErrorLogEntry @ stdcall IoAllocateIrp(long long) @ stdcall IoAllocateMdl(ptr long long long ptr) @@ -387,7 +387,7 @@ @ stub IoGetDeviceToVerify @ stub IoGetDiskDeviceObject @ stub IoGetDmaAdapter -@ stub IoGetDriverObjectExtension +@ stdcall IoGetDriverObjectExtension(ptr ptr) @ stub IoGetFileObjectGenericMapping @ stub IoGetInitialStack @ stub IoGetLowerDeviceObject diff --git a/dlls/objsel/Makefile.in b/dlls/objsel/Makefile.in index 6c90bc00136..1885c14aafc 100644 --- a/dlls/objsel/Makefile.in +++ b/dlls/objsel/Makefile.in @@ -3,7 +3,7 @@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = objsel.dll -IMPORTS = strmiids uuid ole32 user32 advapi32 kernel32 +IMPORTS = strmiids uuid ole32 advapi32 kernel32 C_SRCS = \ factory.c \ diff --git a/dlls/objsel/regsvr.c b/dlls/objsel/regsvr.c index bfb4dd1310d..439b798fdc0 100644 --- a/dlls/objsel/regsvr.c +++ b/dlls/objsel/regsvr.c @@ -34,6 +34,7 @@ #include "objsel.h" #include "wine/debug.h" +#include "wine/unicode.h" #include "initguid.h" @@ -168,7 +169,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) { KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c index 5320988227d..762afc7c3bf 100644 --- a/dlls/ole32/clipboard.c +++ b/dlls/ole32/clipboard.c @@ -78,6 +78,8 @@ #include "storage32.h" +#include "compobj_private.h" + #define HANDLE_ERROR(err) { hr = err; TRACE("(HRESULT=%x)\n", (HRESULT)err); goto CLEANUP; } WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -313,6 +315,7 @@ HRESULT WINAPI OleSetClipboard(IDataObject* pDataObj) IEnumFORMATETC* penumFormatetc = NULL; FORMATETC rgelt; BOOL bClipboardOpen = FALSE; + struct oletls *info = COM_CurrentInfo(); /* HGLOBAL hDataObject = 0; OLEClipbrd **ppDataObject; @@ -320,6 +323,12 @@ HRESULT WINAPI OleSetClipboard(IDataObject* pDataObj) TRACE("(%p)\n", pDataObj); + if(!info) + WARN("Could not allocate tls\n"); + else + if(!info->ole_inits) + return CO_E_NOTINITIALIZED; + /* * Make sure we have a clipboard object */ diff --git a/dlls/ole32/oleproxy.c b/dlls/ole32/oleproxy.c index dfc3bc1970c..11a3ad12d8b 100644 --- a/dlls/ole32/oleproxy.c +++ b/dlls/ole32/oleproxy.c @@ -41,10 +41,6 @@ #include "moniker.h" #include "comcat.h" -#include "wine/debug.h" - -WINE_DEFAULT_DEBUG_CHANNEL(ole); - /*********************************************************************** * DllGetClassObject [OLE32.@] */ diff --git a/dlls/ole32/regsvr.c b/dlls/ole32/regsvr.c index 2abd63671dc..17e78eff0fe 100644 --- a/dlls/ole32/regsvr.c +++ b/dlls/ole32/regsvr.c @@ -38,6 +38,7 @@ #include "moniker.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -155,7 +156,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/ole32/storage.spec b/dlls/ole32/storage.spec index 58273caa449..d4933a7f947 100644 --- a/dlls/ole32/storage.spec +++ b/dlls/ole32/storage.spec @@ -22,12 +22,10 @@ 500 cdecl IStorage16_QueryInterface(ptr ptr ptr) IStorage16_fnQueryInterface 501 cdecl IStorage16_AddRef(ptr) IStorage16_fnAddRef 502 cdecl IStorage16_Release(ptr) IStorage16_fnRelease -#503 cdecl IStorage16_CreateStream(ptr str long long long ptr) IStorage16_fnCreateStream -503 stub IStorage16_CreateStream +503 cdecl IStorage16_CreateStream(ptr str long long long ptr) IStorage16_fnCreateStream 504 cdecl IStorage16_OpenStream(ptr str ptr long long ptr) IStorage16_fnOpenStream -#505 cdecl IStorage16_CreateStorage(ptr str long long long ptr) IStorage16_fnCreateStorage -505 stub IStorage16_CreateStorage +505 cdecl IStorage16_CreateStorage(ptr str long long long ptr) IStorage16_fnCreateStorage 506 cdecl IStorage16_OpenStorage(ptr str ptr long ptr long ptr) IStorage16_fnOpenStorage 507 cdecl IStorage16_CopyTo(ptr long ptr ptr ptr) IStorage16_fnCopyTo 508 stub IStorage16_MoveElementTo @@ -46,8 +44,7 @@ 519 cdecl IStream16_AddRef(ptr) IStream16_fnAddRef 520 cdecl IStream16_Release(ptr) IStream16_fnRelease 521 cdecl IStream16_Read(ptr ptr long ptr) IStream16_fnRead -#522 cdecl IStream16_Write(ptr ptr long ptr) IStream16_fnWrite -522 stub IStream16_Write +522 cdecl IStream16_Write(ptr ptr long ptr) IStream16_fnWrite 523 cdecl IStream16_Seek(ptr double long ptr) IStream16_fnSeek 524 stub IStream16_SetSize 525 stub IStream16_CopyTo diff --git a/dlls/ole32/tests/clipboard.c b/dlls/ole32/tests/clipboard.c index e714064b55d..7e3809e620e 100644 --- a/dlls/ole32/tests/clipboard.c +++ b/dlls/ole32/tests/clipboard.c @@ -439,12 +439,10 @@ static void test_set_clipboard(void) return; hr = OleSetClipboard(data1); - todo_wine ok(hr == CO_E_NOTINITIALIZED, "OleSetClipboard should have failed with CO_E_NOTINITIALIZED instead of 0x%08x\n", hr); CoInitialize(NULL); hr = OleSetClipboard(data1); - todo_wine ok(hr == CO_E_NOTINITIALIZED || hr == CLIPBRD_E_CANT_SET, /* win9x */ "OleSetClipboard should have failed with " diff --git a/dlls/oleacc/oleacc.rc b/dlls/oleacc/oleacc.rc index 4b36b3db914..8d4709f6bfa 100644 --- a/dlls/oleacc/oleacc.rc +++ b/dlls/oleacc/oleacc.rc @@ -22,5 +22,6 @@ #include "oleacc.h" #include "oleacc_En.rc" +#include "oleacc_Fr.rc" #include "oleacc_Ko.rc" #include "oleacc_Nl.rc" diff --git a/dlls/oleacc/oleacc_Fr.rc b/dlls/oleacc/oleacc_Fr.rc new file mode 100644 index 00000000000..87bea0b5247 --- /dev/null +++ b/dlls/oleacc/oleacc_Fr.rc @@ -0,0 +1,90 @@ +/* + * French resources for oleacc + * + * Copyright 2008 Jonathan Ernst + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL + +STRINGTABLE DISCARDABLE +{ + 0 "objet inconnu" /* undocumented */ + ROLE_SYSTEM_TITLEBAR "barre de titre" + ROLE_SYSTEM_MENUBAR "barre de menu" + ROLE_SYSTEM_SCROLLBAR "barre de défilement" + ROLE_SYSTEM_GRIP "grip" + ROLE_SYSTEM_SOUND "son" + ROLE_SYSTEM_CURSOR "curseur" + ROLE_SYSTEM_CARET "caret" + ROLE_SYSTEM_ALERT "alerte" + ROLE_SYSTEM_WINDOW "fenêtre" + ROLE_SYSTEM_CLIENT "client" + ROLE_SYSTEM_MENUPOPUP "menu popup" + ROLE_SYSTEM_MENUITEM "élément de menu" + ROLE_SYSTEM_TOOLTIP "infobulle" + ROLE_SYSTEM_APPLICATION "application" + ROLE_SYSTEM_DOCUMENT "document" + ROLE_SYSTEM_PANE "pane" + ROLE_SYSTEM_CHART "chart" + ROLE_SYSTEM_DIALOG "boîte de dialogue" + ROLE_SYSTEM_BORDER "bordure" + ROLE_SYSTEM_GROUPING "grouping" + ROLE_SYSTEM_SEPARATOR "separateur" + ROLE_SYSTEM_TOOLBAR "barre d'outils" + ROLE_SYSTEM_STATUSBAR "barre d'état" + ROLE_SYSTEM_TABLE "table" + ROLE_SYSTEM_COLUMNHEADER "en-tête de colonne" + ROLE_SYSTEM_ROWHEADER "en-tête de ligne" + ROLE_SYSTEM_COLUMN "colonne" + ROLE_SYSTEM_ROW "ligne" + ROLE_SYSTEM_CELL "cellule" + ROLE_SYSTEM_LINK "lien" + ROLE_SYSTEM_HELPBALLOON "bulle d'aide" + ROLE_SYSTEM_CHARACTER "caractère" + ROLE_SYSTEM_LIST "liste" + ROLE_SYSTEM_LISTITEM "élément de liste" + ROLE_SYSTEM_OUTLINE "outline" + ROLE_SYSTEM_OUTLINEITEM "outline item" + ROLE_SYSTEM_PAGETAB "onglet de page" + ROLE_SYSTEM_PROPERTYPAGE "page de propriétés" + ROLE_SYSTEM_INDICATOR "indicateur" + ROLE_SYSTEM_GRAPHIC "image" + ROLE_SYSTEM_STATICTEXT "texte statique" + ROLE_SYSTEM_TEXT "texte" + ROLE_SYSTEM_PUSHBUTTON "bouton pressoir" + ROLE_SYSTEM_CHECKBUTTON "case à cocher" + ROLE_SYSTEM_RADIOBUTTON "bouton radio" + ROLE_SYSTEM_COMBOBOX "combo box" + ROLE_SYSTEM_DROPLIST "drop down" + ROLE_SYSTEM_PROGRESSBAR "barre de progression" + ROLE_SYSTEM_DIAL "dial" + ROLE_SYSTEM_HOTKEYFIELD "hot key field" + ROLE_SYSTEM_SLIDER "slider" + ROLE_SYSTEM_SPINBUTTON "spin box" + ROLE_SYSTEM_DIAGRAM "diagramme" + ROLE_SYSTEM_ANIMATION "animation" + ROLE_SYSTEM_EQUATION "équation" + ROLE_SYSTEM_BUTTONDROPDOWN "drop down button" + ROLE_SYSTEM_BUTTONMENU "bouton de menu" + ROLE_SYSTEM_BUTTONDROPDOWNGRID "grid drop down button" + ROLE_SYSTEM_WHITESPACE "espace blanc" + ROLE_SYSTEM_PAGETABLIST "page tab list" + ROLE_SYSTEM_CLOCK "horloge" + ROLE_SYSTEM_SPLITBUTTON "split button" + ROLE_SYSTEM_IPADDRESS "Adresse IP" + ROLE_SYSTEM_OUTLINEBUTTON "outline button" +} diff --git a/dlls/oleaut32/regsvr.c b/dlls/oleaut32/regsvr.c index a9e34a1024f..9ee36b53ef0 100644 --- a/dlls/oleaut32/regsvr.c +++ b/dlls/oleaut32/regsvr.c @@ -34,6 +34,7 @@ #include "typelib.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -150,7 +151,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/oleaut32/tests/olepicture.c b/dlls/oleaut32/tests/olepicture.c index 89e99dde3d2..2b5b8bb86eb 100644 --- a/dlls/oleaut32/tests/olepicture.c +++ b/dlls/oleaut32/tests/olepicture.c @@ -525,8 +525,6 @@ static void test_apm() ole_expect(IPicture_get_hPal(pict, &handle), E_FAIL); IPicture_Release(pict); IStream_Release(stream); - GlobalUnlock(hglob); - GlobalFree(hglob); } static void test_metafile(void) @@ -545,8 +543,6 @@ static void test_metafile(void) ole_expect(OleLoadPictureEx(stream, sizeof(metafile), TRUE, &IID_IPicture, 100, 100, 0, (LPVOID *)&pict), E_FAIL); IStream_Release(stream); - GlobalUnlock(hglob); - GlobalFree(hglob); } static void test_enhmetafile(void) @@ -584,8 +580,6 @@ static void test_enhmetafile(void) IPicture_Release(pict); IStream_Release(stream); - GlobalUnlock(hglob); - GlobalFree(hglob); } static void test_Render(void) diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index 04f0d4de22e..6193d80f57c 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -297,7 +297,7 @@ typedef struct Widget IUnknown *pDispatchUnknown; } Widget; -HRESULT WINAPI Widget_QueryInterface( +static HRESULT WINAPI Widget_QueryInterface( IWidget *iface, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) @@ -315,7 +315,7 @@ HRESULT WINAPI Widget_QueryInterface( } } -ULONG WINAPI Widget_AddRef( +static ULONG WINAPI Widget_AddRef( IWidget *iface) { Widget *This = (Widget *)iface; @@ -323,7 +323,7 @@ ULONG WINAPI Widget_AddRef( return InterlockedIncrement(&This->refs); } -ULONG WINAPI Widget_Release( +static ULONG WINAPI Widget_Release( IWidget *iface) { Widget *This = (Widget *)iface; @@ -339,7 +339,7 @@ ULONG WINAPI Widget_Release( return refs; } -HRESULT WINAPI Widget_GetTypeInfoCount( +static HRESULT WINAPI Widget_GetTypeInfoCount( IWidget *iface, /* [out] */ UINT __RPC_FAR *pctinfo) { @@ -354,7 +354,7 @@ HRESULT WINAPI Widget_GetTypeInfoCount( return hr; } -HRESULT WINAPI Widget_GetTypeInfo( +static HRESULT WINAPI Widget_GetTypeInfo( IWidget __RPC_FAR * iface, /* [in] */ UINT iTInfo, /* [in] */ LCID lcid, @@ -371,7 +371,7 @@ HRESULT WINAPI Widget_GetTypeInfo( return hr; } -HRESULT WINAPI Widget_GetIDsOfNames( +static HRESULT WINAPI Widget_GetIDsOfNames( IWidget __RPC_FAR * iface, /* [in] */ REFIID riid, /* [size_is][in] */ LPOLESTR __RPC_FAR *rgszNames, @@ -390,7 +390,7 @@ HRESULT WINAPI Widget_GetIDsOfNames( return hr; } -HRESULT WINAPI Widget_Invoke( +static HRESULT WINAPI Widget_Invoke( IWidget __RPC_FAR * iface, /* [in] */ DISPID dispIdMember, /* [in] */ REFIID riid, @@ -412,7 +412,7 @@ HRESULT WINAPI Widget_Invoke( return hr; } -HRESULT WINAPI Widget_put_Name( +static HRESULT WINAPI Widget_put_Name( IWidget __RPC_FAR * iface, /* [in] */ BSTR name) { @@ -420,7 +420,7 @@ HRESULT WINAPI Widget_put_Name( return S_OK; } -HRESULT WINAPI Widget_get_Name( +static HRESULT WINAPI Widget_get_Name( IWidget __RPC_FAR * iface, /* [out] */ BSTR __RPC_FAR *name) { @@ -430,7 +430,7 @@ HRESULT WINAPI Widget_get_Name( return S_OK; } -HRESULT WINAPI Widget_DoSomething( +static HRESULT WINAPI Widget_DoSomething( IWidget __RPC_FAR * iface, /* [in] */ double number, /* [out] */ BSTR *str1, @@ -449,7 +449,7 @@ HRESULT WINAPI Widget_DoSomething( return S_FALSE; } -HRESULT WINAPI Widget_get_State( +static HRESULT WINAPI Widget_get_State( IWidget __RPC_FAR * iface, /* [retval][out] */ STATE __RPC_FAR *state) { @@ -458,7 +458,7 @@ HRESULT WINAPI Widget_get_State( return S_OK; } -HRESULT WINAPI Widget_put_State( +static HRESULT WINAPI Widget_put_State( IWidget __RPC_FAR * iface, /* [in] */ STATE state) { @@ -466,7 +466,7 @@ HRESULT WINAPI Widget_put_State( return S_OK; } -HRESULT WINAPI Widget_Map( +static HRESULT WINAPI Widget_Map( IWidget * iface, BSTR bstrId, BSTR *sValue) @@ -476,7 +476,7 @@ HRESULT WINAPI Widget_Map( return S_OK; } -HRESULT WINAPI Widget_SetOleColor( +static HRESULT WINAPI Widget_SetOleColor( IWidget * iface, OLE_COLOR val) { @@ -484,7 +484,7 @@ HRESULT WINAPI Widget_SetOleColor( return S_OK; } -HRESULT WINAPI Widget_GetOleColor( +static HRESULT WINAPI Widget_GetOleColor( IWidget * iface, OLE_COLOR *pVal) { @@ -493,7 +493,7 @@ HRESULT WINAPI Widget_GetOleColor( return S_FALSE; } -HRESULT WINAPI Widget_Clone( +static HRESULT WINAPI Widget_Clone( IWidget *iface, IWidget **ppVal) { @@ -501,7 +501,7 @@ HRESULT WINAPI Widget_Clone( return Widget_QueryInterface(iface, &IID_IWidget, (void **)ppVal); } -HRESULT WINAPI Widget_CloneDispatch( +static HRESULT WINAPI Widget_CloneDispatch( IWidget *iface, IDispatch **ppVal) { @@ -509,7 +509,7 @@ HRESULT WINAPI Widget_CloneDispatch( return Widget_QueryInterface(iface, &IID_IWidget, (void **)ppVal); } -HRESULT WINAPI Widget_CloneCoclass( +static HRESULT WINAPI Widget_CloneCoclass( IWidget *iface, ApplicationObject2 **ppVal) { @@ -517,7 +517,7 @@ HRESULT WINAPI Widget_CloneCoclass( return S_OK; } -HRESULT WINAPI Widget_Value( +static HRESULT WINAPI Widget_Value( IWidget __RPC_FAR * iface, VARIANT *value, VARIANT *retval) @@ -530,7 +530,7 @@ HRESULT WINAPI Widget_Value( return S_OK; } -HRESULT WINAPI Widget_Array( +static HRESULT WINAPI Widget_Array( IWidget * iface, SAFEARRAY * values) { @@ -538,7 +538,7 @@ HRESULT WINAPI Widget_Array( return S_OK; } -HRESULT WINAPI Widget_VariantArrayPtr( +static HRESULT WINAPI Widget_VariantArrayPtr( IWidget * iface, SAFEARRAY ** values) { @@ -546,7 +546,7 @@ HRESULT WINAPI Widget_VariantArrayPtr( return S_OK; } -void WINAPI Widget_Variant( +static void WINAPI Widget_Variant( IWidget __RPC_FAR * iface, VARIANT var) { @@ -556,7 +556,7 @@ void WINAPI Widget_Variant( ok(S(V_CY(&var)).Lo == 0xdeadbeef, "V_CY(&var).Lo was 0x%x\n", S(V_CY(&var)).Lo); } -void WINAPI Widget_VarArg( +static void WINAPI Widget_VarArg( IWidget * iface, int numexpect, SAFEARRAY * values) @@ -588,7 +588,7 @@ void WINAPI Widget_VarArg( ok(hr == S_OK, "SafeArrayUnaccessData failed with %x\n", hr); } -void WINAPI Widget_StructArgs( +static void WINAPI Widget_StructArgs( IWidget * iface, MYSTRUCT byval, MYSTRUCT *byptr, @@ -600,14 +600,14 @@ void WINAPI Widget_StructArgs( } -HRESULT WINAPI Widget_Error( +static HRESULT WINAPI Widget_Error( IWidget __RPC_FAR * iface) { trace("Error()\n"); return E_NOTIMPL; } -HRESULT WINAPI Widget_CloneInterface( +static HRESULT WINAPI Widget_CloneInterface( IWidget __RPC_FAR * iface, ISomethingFromDispatch **ppVal) { @@ -791,7 +791,7 @@ static IWidget *Widget_Create(void) } } -HRESULT WINAPI KindaEnum_QueryInterface( +static HRESULT WINAPI KindaEnum_QueryInterface( IKindaEnumWidget *iface, /* [in] */ REFIID riid, /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject) @@ -809,7 +809,7 @@ HRESULT WINAPI KindaEnum_QueryInterface( } } -ULONG WINAPI KindaEnum_AddRef( +static ULONG WINAPI KindaEnum_AddRef( IKindaEnumWidget *iface) { KindaEnum *This = (KindaEnum *)iface; @@ -817,7 +817,7 @@ ULONG WINAPI KindaEnum_AddRef( return InterlockedIncrement(&This->refs); } -ULONG WINAPI KindaEnum_Release( +static ULONG WINAPI KindaEnum_Release( IKindaEnumWidget *iface) { KindaEnum *This = (KindaEnum *)iface; @@ -832,7 +832,7 @@ ULONG WINAPI KindaEnum_Release( return refs; } -HRESULT WINAPI KindaEnum_Next( +static HRESULT WINAPI KindaEnum_Next( IKindaEnumWidget *iface, /* [out] */ IWidget __RPC_FAR *__RPC_FAR *widget) { @@ -843,20 +843,20 @@ HRESULT WINAPI KindaEnum_Next( return E_OUTOFMEMORY; } -HRESULT WINAPI KindaEnum_Count( +static HRESULT WINAPI KindaEnum_Count( IKindaEnumWidget *iface, /* [out] */ unsigned long __RPC_FAR *count) { return E_NOTIMPL; } -HRESULT WINAPI KindaEnum_Reset( +static HRESULT WINAPI KindaEnum_Reset( IKindaEnumWidget *iface) { return E_NOTIMPL; } -HRESULT WINAPI KindaEnum_Clone( +static HRESULT WINAPI KindaEnum_Clone( IKindaEnumWidget *iface, /* [out] */ IKindaEnumWidget __RPC_FAR *__RPC_FAR *ppenum) { diff --git a/dlls/cryptui/Makefile.in b/dlls/pidgen/Makefile.in similarity index 73% copy from dlls/cryptui/Makefile.in copy to dlls/pidgen/Makefile.in index abb0b2737bf..e05833d6c28 100644 --- a/dlls/cryptui/Makefile.in +++ b/dlls/pidgen/Makefile.in @@ -2,13 +2,14 @@ TOPSRCDIR = @top_srcdir@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ -MODULE = cryptui.dll -IMPORTS = crypt32 kernel32 -IMPORTLIB = cryptui +MODULE = pidgen.dll +IMPORTS = kernel32 C_SRCS = \ main.c +RS_SRCS = rsrc.rc + @MAKE_DLL_RULES@ @DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/pidgen/bink.bin b/dlls/pidgen/bink.bin new file mode 100644 index 0000000000000000000000000000000000000000..996f8baae6eed0c502a4605ed17c8ebd026a3cb2 GIT binary patch literal 368 qcwP(7%u7`$$Vp62&B)J5Ni9-v^7QjoC`v8PFD*(=Wf%q21zZ3$p$iQF literal 0 HcwPel00001 diff --git a/dlls/msvcr71/msvcr71.c b/dlls/pidgen/main.c similarity index 72% copy from dlls/msvcr71/msvcr71.c copy to dlls/pidgen/main.c index 3ada089ed44..3aa3e844449 100644 --- a/dlls/msvcr71/msvcr71.c +++ b/dlls/pidgen/main.c @@ -1,7 +1,5 @@ /* - * msvcr71 main file - * - * Copyright (C) 2008 Hans Leidekker + * Copyright 2008 Hans Leidekker for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,24 +16,29 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" #include #include "windef.h" #include "winbase.h" #include "wine/debug.h" -WINE_DEFAULT_DEBUG_CHANNEL(msvcr71); +WINE_DEFAULT_DEBUG_CHANNEL(pidgen); -BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) +/***************************************************** + * DllMain + */ +BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved ) { - switch (reason) + TRACE("(%p, %d, %p)\n", hinst, reason, reserved); + + switch(reason) { case DLL_WINE_PREATTACH: return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: - DisableThreadLibraryCalls( inst ); - break; - case DLL_PROCESS_DETACH: + DisableThreadLibraryCalls( hinst ); break; } return TRUE; diff --git a/dlls/pidgen/pidgen.spec b/dlls/pidgen/pidgen.spec new file mode 100644 index 00000000000..ad5c3694a9e --- /dev/null +++ b/dlls/pidgen/pidgen.spec @@ -0,0 +1,7 @@ +@ stub PIDGenA +@ stub PIDGenW +@ stub PIDGenSimpA +@ stub PIDGenSimpW +@ stub SetupPIDGenA +@ stub SetupPIDGenW +@ stub VerifyPIDSequenceW diff --git a/dlls/oleacc/oleacc.rc b/dlls/pidgen/rsrc.rc similarity index 80% copy from dlls/oleacc/oleacc.rc copy to dlls/pidgen/rsrc.rc index 4b36b3db914..549fc8402e5 100644 --- a/dlls/oleacc/oleacc.rc +++ b/dlls/pidgen/rsrc.rc @@ -1,7 +1,5 @@ /* - * Top level resource file for oleacc - * - * Copyright 2008 Nikolay Sivov + * Copyright 2008 Hans Leidekker for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,9 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "windef.h" -#include "oleacc.h" - -#include "oleacc_En.rc" -#include "oleacc_Ko.rc" -#include "oleacc_Nl.rc" +/* @makedep: bink.bin */ +1 BINK "bink.bin" +2 BINK "bink.bin" diff --git a/dlls/quartz/avisplit.c b/dlls/quartz/avisplit.c index 94d2c9bba92..1c9631d0262 100644 --- a/dlls/quartz/avisplit.c +++ b/dlls/quartz/avisplit.c @@ -1081,7 +1081,7 @@ static HRESULT AVISplitter_InputPin_PreConnect(IPin * iface, IPin * pConnectPin, pos += sizeof(RIFFCHUNK) + list.cb; hr = IAsyncReader_SyncRead(This->pReader, pos, sizeof(list), (BYTE *)&list); - while (list.fcc == ckidAVIPADDING || (list.fcc == FOURCC_LIST && list.fccListType == ckidINFO)) + while (list.fcc == ckidAVIPADDING || (list.fcc == FOURCC_LIST && list.fccListType != listtypeAVIMOVIE)) { pos += sizeof(RIFFCHUNK) + list.cb; diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 8480d25c3e2..967a578199b 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -1318,7 +1318,7 @@ static HRESULT WINAPI FilterGraph2_Render(IFilterGraph2 *iface, IPin *ppinOut) GUID clsid; IPin* ppinfilter; IBaseFilter* pfilter = NULL; - IEnumPins* penumpins; + IEnumPins* penumpins = NULL; ULONG pin; hr = GetFilterInfo(pMoniker, &clsid, &var); @@ -1348,40 +1348,61 @@ static HRESULT WINAPI FilterGraph2_Render(IFilterGraph2 *iface, IPin *ppinOut) WARN("Splitter Enumpins (%x)\n", hr); goto error; } - hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin); - IEnumPins_Release(penumpins); - if (FAILED(hr)) { - WARN("Next (%x)\n", hr); - goto error; - } - if (pin == 0) { - WARN("No Pin\n"); - hr = E_FAIL; - goto error; - } - /* Connect the pin to the "Renderer" */ - hr = IPin_Connect(ppinOut, ppinfilter, NULL); - IPin_Release(ppinfilter); + while ((hr = IEnumPins_Next(penumpins, 1, &ppinfilter, &pin)) == S_OK) + { + PIN_DIRECTION dir; - if (FAILED(hr)) { - WARN("Unable to connect %s to renderer (%x)\n", debugstr_w(V_UNION(&var, bstrVal)), hr); - goto error; - } - TRACE("Connected, recursing %s\n", debugstr_w(V_UNION(&var, bstrVal))); + if (pin == 0) { + WARN("No Pin\n"); + hr = E_FAIL; + goto error; + } - VariantClear(&var); + hr = IPin_QueryDirection(ppinfilter, &dir); + if (FAILED(hr)) { + IPin_Release(ppinfilter); + WARN("QueryDirection failed (%x)\n", hr); + goto error; + } + if (dir != PINDIR_INPUT) { + IPin_Release(ppinfilter); + continue; /* Wrong direction */ + } - hr = FilterGraph2_RenderRecurse(This, ppinfilter); - if (FAILED(hr)) { - WARN("Unable to connect recursively (%x)\n", hr); - goto error; + /* Connect the pin to the "Renderer" */ + hr = IPin_Connect(ppinOut, ppinfilter, NULL); + IPin_Release(ppinfilter); + + if (FAILED(hr)) { + WARN("Unable to connect %s to renderer (%x)\n", debugstr_w(V_UNION(&var, bstrVal)), hr); + goto error; + } + TRACE("Connected, recursing %s\n", debugstr_w(V_UNION(&var, bstrVal))); + + VariantClear(&var); + + hr = FilterGraph2_RenderRecurse(This, ppinfilter); + if (FAILED(hr)) { + WARN("Unable to connect recursively (%x)\n", hr); + goto error; + } + IBaseFilter_Release(pfilter); + break; + } + if (SUCCEEDED(hr)) { + IEnumPins_Release(penumpins); + break; /* out of IEnumMoniker_Next loop */ } - IBaseFilter_Release(pfilter); - break; + + /* IEnumPins_Next failed, all other failure case caught by goto error */ + WARN("IEnumPins_Next (%x)\n", hr); + /* goto error */ error: VariantClear(&var); + if (penumpins) + IEnumPins_Release(penumpins); if (pfilter) { IFilterGraph2_RemoveFilter(iface, pfilter); IBaseFilter_Release(pfilter); diff --git a/dlls/quartz/regsvr.c b/dlls/quartz/regsvr.c index 79000bf3db7..e7785c54307 100644 --- a/dlls/quartz/regsvr.c +++ b/dlls/quartz/regsvr.c @@ -36,6 +36,7 @@ #include "strmif.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(quartz); @@ -215,7 +216,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/quartz/tests/filtermapper.c b/dlls/quartz/tests/filtermapper.c index 122c2ee5706..3025b187f64 100644 --- a/dlls/quartz/tests/filtermapper.c +++ b/dlls/quartz/tests/filtermapper.c @@ -57,7 +57,11 @@ static BOOL enum_find_filter(const WCHAR *wszFilterName, IEnumMoniker *pEnum) if (SUCCEEDED(hr)) { - if (!lstrcmpW((WCHAR*)V_UNION(&var, bstrVal), wszFilterName)) found = TRUE; + CHAR val1[512], val2[512]; + + WideCharToMultiByte(CP_ACP, 0, (WCHAR*)V_UNION(&var, bstrVal), -1, val1, sizeof(val1), 0, 0); + WideCharToMultiByte(CP_ACP, 0, wszFilterName, -1, val2, sizeof(val2), 0, 0); + if (!lstrcmpA(val1, val2)) found = TRUE; } IPropertyBag_Release(pPropBagCat); @@ -179,10 +183,13 @@ static void test_legacy_filter_registration(void) IFilterMapper *pMapper = NULL; HRESULT hr; static const WCHAR wszFilterName[] = {'T', 'e', 's', 't', 'f', 'i', 'l', 't', 'e', 'r', 0 }; + static const CHAR szFilterName[] = "Testfilter"; static const WCHAR wszPinName[] = {'P', 'i', 'n', '1', 0 }; CLSID clsidFilter; WCHAR wszRegKey[MAX_PATH]; + CHAR szRegKey[MAX_PATH]; static const WCHAR wszClsid[] = {'C','L','S','I','D', 0}; + static const CHAR szClsid[] = "CLSID"; static const WCHAR wszSlash[] = {'\\', 0}; LONG lRet; HKEY hKey = NULL; @@ -211,15 +218,16 @@ static void test_legacy_filter_registration(void) lRet = StringFromGUID2(&clsidFilter, wszRegKey + lstrlenW(wszRegKey), MAX_PATH - lstrlenW(wszRegKey)); ok(lRet > 0, "StringFromGUID2 failed\n"); if (!lRet) goto out; + WideCharToMultiByte(CP_ACP, 0, wszRegKey, -1, szRegKey, sizeof(szRegKey), 0, 0); /* Register---- functions need a filter class key to write pin and pin media type data to. Create a bogus * class key for it. */ - lRet = RegCreateKeyExW(HKEY_CLASSES_ROOT, wszRegKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL); - ok(lRet == ERROR_SUCCESS, "RegCreateKeyExW failed with %x\n", HRESULT_FROM_WIN32(lRet)); + lRet = RegCreateKeyExA(HKEY_CLASSES_ROOT, szRegKey, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_WRITE, NULL, &hKey, NULL); + ok(lRet == ERROR_SUCCESS, "RegCreateKeyExA failed with %x\n", HRESULT_FROM_WIN32(lRet)); /* Set default value - this is interpreted as "friendly name" later. */ - lRet = RegSetValueExW(hKey, NULL, 0, REG_SZ, (LPBYTE)wszFilterName, (lstrlenW(wszFilterName) + 1) * 2); - ok(lRet == ERROR_SUCCESS, "RegSetValueExW failed with %x\n", HRESULT_FROM_WIN32(lRet)); + lRet = RegSetValueExA(hKey, NULL, 0, REG_SZ, (LPBYTE)szFilterName, lstrlenA(szFilterName) + 1); + ok(lRet == ERROR_SUCCESS, "RegSetValueExA failed with %x\n", HRESULT_FROM_WIN32(lRet)); if (hKey) RegCloseKey(hKey); hKey = NULL; @@ -256,7 +264,10 @@ static void test_legacy_filter_registration(void) while(!found && IEnumRegFilters_Next(pRegEnum, 1, &prgf, &cFetched) == S_OK) { - if (!lstrcmpW(prgf->Name, wszFilterName)) found = TRUE; + CHAR val[512]; + + WideCharToMultiByte(CP_ACP, 0, prgf->Name, -1, val, sizeof(val), 0, 0); + if (!lstrcmpA(val, szFilterName)) found = TRUE; CoTaskMemFree(prgf); } @@ -268,14 +279,15 @@ static void test_legacy_filter_registration(void) hr = IFilterMapper_UnregisterFilter(pMapper, clsidFilter); ok(hr == S_OK, "FilterMapper_UnregisterFilter failed with %x\n", hr); - lRet = RegOpenKeyExW(HKEY_CLASSES_ROOT, wszClsid, 0, KEY_WRITE | DELETE, &hKey); - ok(lRet == ERROR_SUCCESS, "RegOpenKeyExW failed with %x\n", HRESULT_FROM_WIN32(lRet)); + lRet = RegOpenKeyExA(HKEY_CLASSES_ROOT, szClsid, 0, KEY_WRITE | DELETE, &hKey); + ok(lRet == ERROR_SUCCESS, "RegOpenKeyExA failed with %x\n", HRESULT_FROM_WIN32(lRet)); lRet = StringFromGUID2(&clsidFilter, wszRegKey, MAX_PATH); ok(lRet > 0, "StringFromGUID2 failed\n"); + WideCharToMultiByte(CP_ACP, 0, wszRegKey, -1, szRegKey, sizeof(szRegKey), 0, 0); - lRet = RegDeleteKeyW(hKey, wszRegKey); - ok(lRet == ERROR_SUCCESS, "RegDeleteKeyW failed with %x\n", HRESULT_FROM_WIN32(lRet)); + lRet = RegDeleteKeyA(hKey, szRegKey); + ok(lRet == ERROR_SUCCESS, "RegDeleteKeyA failed with %x\n", HRESULT_FROM_WIN32(lRet)); if (hKey) RegCloseKey(hKey); hKey = NULL; diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 1780bc074e4..ab44dac12ff 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -214,8 +214,9 @@ ME_GetCursorCoordinates(ME_TextEditor *editor, ME_Cursor *pCursor, } *height = pSizeRun->member.run.nAscent + pSizeRun->member.run.nDescent; - *x = run->member.run.pt.x + sz.cx; - *y = para->member.para.pt.y + row->member.row.nBaseline + run->member.run.pt.y - pSizeRun->member.run.nAscent - ME_GetYScrollPos(editor); + *x = c.rcView.left + run->member.run.pt.x + sz.cx; + *y = c.rcView.top + para->member.para.pt.y + row->member.row.nBaseline + + run->member.run.pt.y - pSizeRun->member.run.nAscent - ME_GetYScrollPos(editor); ME_DestroyContext(&c, editor->hWnd); return; } @@ -236,10 +237,7 @@ ME_MoveCaret(ME_TextEditor *editor) ME_GetCursorCoordinates(editor, &editor->pCursors[0], &x, &y, &height); if(editor->bHaveFocus && !ME_IsSelection(editor)) { - RECT rect; - - GetClientRect(editor->hWnd, &rect); - x = min(x, rect.right-2); + x = min(x, editor->rcFormat.right-1); CreateCaret(editor->hWnd, NULL, 0, height); SetCaretPos(x, y); } @@ -922,6 +920,9 @@ static BOOL ME_FindPixelPos(ME_TextEditor *editor, int x, int y, int rx = 0; BOOL isExact = TRUE; + x -= editor->rcFormat.left; + y -= editor->rcFormat.top; + if (is_eol) *is_eol = 0; @@ -1109,13 +1110,13 @@ void ME_LButtonDown(ME_TextEditor *editor, int x, int y, int clickNum) ME_FindPixelPos(editor, x, y, &editor->pCursors[0], &editor->bCaretAtEnd); - if (x >= editor->selofs || is_shift) + if (x >= editor->rcFormat.left || is_shift) { if (clickNum > 1) { editor->pCursors[1] = editor->pCursors[0]; if (is_shift) { - if (x >= editor->selofs) + if (x >= editor->rcFormat.left) ME_SelectByType(editor, stWord); else ME_SelectByType(editor, stParagraph); @@ -1177,16 +1178,10 @@ void ME_MouseMove(ME_TextEditor *editor, int x, int y) memcmp(&editor->pCursors[1], &editor->pCursors[3], sizeof(ME_Cursor))) { /* The scroll the cursor towards the other end, since it was the one - * extended by ME_ExtendAnchorSelection - */ - ME_Cursor tmpCursor = editor->pCursors[0]; - editor->pCursors[0] = editor->pCursors[1]; - editor->pCursors[1] = tmpCursor; - SendMessageW(editor->hWnd, EM_SCROLLCARET, 0, 0); - editor->pCursors[1] = editor->pCursors[0]; - editor->pCursors[0] = tmpCursor; + * extended by ME_ExtendAnchorSelection */ + ME_EnsureVisible(editor, editor->pCursors[1].pRun); } else { - SendMessageW(editor->hWnd, EM_SCROLLCARET, 0, 0); + ME_EnsureVisible(editor, editor->pCursors[0].pRun); } ME_InvalidateSelection(editor); @@ -1571,11 +1566,9 @@ void ME_SendSelChange(ME_TextEditor *editor) if (!(editor->nEventMask & ENM_SELCHANGE)) return; - - sc.nmhdr.hwndFrom = editor->hWnd; - sc.nmhdr.idFrom = GetWindowLongW(editor->hWnd, GWLP_ID); + sc.nmhdr.code = EN_SELCHANGE; - SendMessageW(editor->hWnd, EM_EXGETSEL, 0, (LPARAM)&sc.chrg); + ME_GetSelection(editor, &sc.chrg.cpMin, &sc.chrg.cpMax); sc.seltyp = SEL_EMPTY; if (sc.chrg.cpMin != sc.chrg.cpMax) sc.seltyp |= SEL_TEXT; diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index 33310a135c4..a9994bc9820 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -1426,7 +1426,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre ME_DisplayItem *para_item; style = editor->pBuffer->pDefaultStyle; ME_AddRefStyle(style); - SendMessageA(editor->hWnd, EM_SETSEL, 0, 0); + ME_SetSelection(editor, 0, 0); ME_InternalDeleteText(editor, 0, ME_GetTextLength(editor), FALSE); from = to = 0; ME_ClearTempStyle(editor); @@ -1470,7 +1470,6 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre memset(&parser, 0, sizeof parser); RTFSetEditStream(&parser, &inStream); parser.rtfFormat = format&(SF_TEXT|SF_RTF); - parser.hwndEdit = editor->hWnd; parser.editor = editor; parser.style = style; WriterInit(&parser); @@ -1560,7 +1559,7 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre ME_GetSelection(editor, &to, &to2); /* put the cursor at the top */ if (!(format & SFF_SELECTION)) - SendMessageA(editor->hWnd, EM_SETSEL, 0, 0); + ME_SetSelection(editor, 0, 0); } /* Restore saved undo mode */ @@ -1939,6 +1938,73 @@ ME_FindText(ME_TextEditor *editor, DWORD flags, const CHARRANGE *chrg, const WCH return -1; } +static int ME_GetTextEx(ME_TextEditor *editor, GETTEXTEX *ex, LPARAM pText) +{ + int nStart, nCount; /* in chars */ + + if (ex->flags & ~(GT_SELECTION | GT_USECRLF)) + FIXME("GETTEXTEX flags 0x%08x not supported\n", ex->flags & ~(GT_SELECTION | GT_USECRLF)); + + if (ex->flags & GT_SELECTION) + { + ME_GetSelection(editor, &nStart, &nCount); + nCount -= nStart; + } + else + { + nStart = 0; + nCount = 0x7fffffff; + } + if (ex->codepage == 1200) + { + nCount = min(nCount, ex->cb / sizeof(WCHAR) - 1); + return ME_GetTextW(editor, (LPWSTR)pText, nStart, nCount, ex->flags & GT_USECRLF); + } + else + { + /* potentially each char may be a CR, why calculate the exact value with O(N) when + we can just take a bigger buffer? :) + The above assumption still holds with CR/LF counters, since CR->CRLF expansion + occurs only in richedit 2.0 mode, in which line breaks have only one CR + */ + int crlfmul = (ex->flags & GT_USECRLF) ? 2 : 1; + LPWSTR buffer; + DWORD buflen = ex->cb; + LRESULT rc; + DWORD flags = 0; + + nCount = min(nCount, ex->cb - 1); + buffer = heap_alloc((crlfmul*nCount + 1) * sizeof(WCHAR)); + + buflen = ME_GetTextW(editor, buffer, nStart, nCount, ex->flags & GT_USECRLF); + rc = WideCharToMultiByte(ex->codepage, flags, buffer, buflen+1, + (LPSTR)pText, ex->cb, ex->lpDefaultChar, ex->lpUsedDefChar); + if (rc) rc--; /* do not count 0 terminator */ + + heap_free(buffer); + return rc; + } +} + +static int ME_GetTextRange(ME_TextEditor *editor, TEXTRANGEW *rng, BOOL unicode) +{ + if (unicode) + return ME_GetTextW(editor, rng->lpstrText, rng->chrg.cpMin, + rng->chrg.cpMax-rng->chrg.cpMin, 0); + else + { + int nLen = rng->chrg.cpMax-rng->chrg.cpMin; + WCHAR *p = ALLOC_N_OBJ(WCHAR, nLen+1); + int nChars = ME_GetTextW(editor, p, rng->chrg.cpMin, nLen, 0); + /* FIXME this is a potential security hole (buffer overrun) + if you know more about wchar->mbyte conversion please explain + */ + WideCharToMultiByte(CP_ACP, 0, p, nChars+1, (char *)rng->lpstrText, nLen+1, NULL, NULL); + FREE_OBJ(p); + return nChars; + } +} + typedef struct tagME_GlobalDestStruct { HGLOBAL hData; @@ -2179,10 +2245,176 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey) return FALSE; } +static LRESULT ME_Char(ME_TextEditor *editor, WPARAM charCode, + LPARAM flags, BOOL unicode) +{ + WCHAR wstr; + + if (unicode) + wstr = (WCHAR)charCode; + else + { + CHAR charA = charCode; + MultiByteToWideChar(CP_ACP, 0, &charA, 1, &wstr, 1); + } + + if (GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_READONLY) { + MessageBeep(MB_ICONERROR); + return 0; /* FIXME really 0 ? */ + } + + if (((unsigned)wstr)>=' ' + || (wstr=='\r' && (GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_MULTILINE)) + || wstr=='\t') { + ME_Cursor cursor = editor->pCursors[0]; + ME_DisplayItem *para = ME_GetParagraph(cursor.pRun); + int from, to; + BOOL ctrl_is_down = GetKeyState(VK_CONTROL) & 0x8000; + ME_GetSelection(editor, &from, &to); + if (wstr=='\t' + /* v4.1 allows tabs to be inserted with ctrl key down */ + && !(ctrl_is_down && !editor->bEmulateVersion10) + ) + { + ME_DisplayItem *para; + BOOL bSelectedRow = FALSE; + + para = ME_GetParagraph(cursor.pRun); + if (ME_IsSelection(editor) && + cursor.pRun->member.run.nCharOfs + cursor.nOffset == 0 && + to == ME_GetCursorOfs(editor, 0) && + para->member.para.prev_para->type == diParagraph) + { + para = para->member.para.prev_para; + bSelectedRow = TRUE; + } + if (ME_IsInTable(para)) + { + ME_TabPressedInTable(editor, bSelectedRow); + ME_CommitUndo(editor); + return 0; + } + } else if (!editor->bEmulateVersion10) { /* v4.1 */ + if (para->member.para.nFlags & MEPF_ROWEND) { + if (wstr=='\r') { + /* Add a new table row after this row. */ + para = ME_AppendTableRow(editor, para); + para = para->member.para.next_para; + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[0].nOffset = 0; + editor->pCursors[1] = editor->pCursors[0]; + ME_CommitUndo(editor); + ME_CheckTablesForCorruption(editor); + ME_UpdateRepaint(editor); + return 0; + } else if (from == to) { + para = para->member.para.next_para; + if (para->member.para.nFlags & MEPF_ROWSTART) + para = para->member.para.next_para; + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[0].nOffset = 0; + editor->pCursors[1] = editor->pCursors[0]; + } + } + else if (para == ME_GetParagraph(editor->pCursors[1].pRun) && + cursor.nOffset + cursor.pRun->member.run.nCharOfs == 0 && + para->member.para.prev_para->member.para.nFlags & MEPF_ROWSTART && + !para->member.para.prev_para->member.para.nCharOfs) + { + /* Insert a newline before the table. */ + WCHAR endl = '\r'; + para = para->member.para.prev_para; + para->member.para.nFlags &= ~MEPF_ROWSTART; + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[1] = editor->pCursors[0]; + ME_InsertTextFromCursor(editor, 0, &endl, 1, + editor->pCursors[0].pRun->member.run.style); + para = editor->pBuffer->pFirst->member.para.next_para; + ME_SetDefaultParaFormat(para->member.para.pFmt); + para->member.para.nFlags = MEPF_REWRAP; + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[1] = editor->pCursors[0]; + para->member.para.next_para->member.para.nFlags |= MEPF_ROWSTART; + ME_CommitCoalescingUndo(editor); + ME_CheckTablesForCorruption(editor); + ME_UpdateRepaint(editor); + return 0; + } + } else { /* v1.0 - 3.0 */ + ME_DisplayItem *para = ME_GetParagraph(cursor.pRun); + if (ME_IsInTable(cursor.pRun)) + { + if (cursor.pRun->member.run.nFlags & MERF_ENDPARA) + { + if (from == to) { + if (wstr=='\r') { + ME_ContinueCoalescingTransaction(editor); + para = ME_AppendTableRow(editor, para); + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[0].nOffset = 0; + editor->pCursors[1] = editor->pCursors[0]; + ME_CommitCoalescingUndo(editor); + ME_UpdateRepaint(editor); + } else { + /* Text should not be inserted at the end of the table. */ + MessageBeep(-1); + } + return 0; + } + } else if (wstr == '\r') { + ME_ContinueCoalescingTransaction(editor); + if (cursor.pRun->member.run.nCharOfs + cursor.nOffset == 0 && + !ME_IsInTable(para->member.para.prev_para)) + { + /* Insert newline before table */ + WCHAR endl = '\r'; + cursor.pRun = ME_FindItemBack(para, diRun); + if (cursor.pRun) + editor->pCursors[0].pRun = cursor.pRun; + editor->pCursors[0].nOffset = 0; + editor->pCursors[1] = editor->pCursors[0]; + ME_InsertTextFromCursor(editor, 0, &endl, 1, + editor->pCursors[0].pRun->member.run.style); + } else { + editor->pCursors[1] = editor->pCursors[0]; + para = ME_AppendTableRow(editor, para); + editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); + editor->pCursors[0].nOffset = 0; + editor->pCursors[1] = editor->pCursors[0]; + } + ME_CommitCoalescingUndo(editor); + ME_UpdateRepaint(editor); + return 0; + } + } + } + /* FIXME maybe it would make sense to call EM_REPLACESEL instead ? */ + /* WM_CHAR is restricted to nTextLimit */ + if(editor->nTextLimit > ME_GetTextLength(editor) - (to-from)) + { + ME_Style *style = ME_GetInsertStyle(editor, 0); + ME_SaveTempStyle(editor); + ME_ContinueCoalescingTransaction(editor); + if (wstr == '\r' && (GetKeyState(VK_SHIFT) & 0x8000)) + ME_InsertEndRowFromCursor(editor, 0); + else + ME_InsertTextFromCursor(editor, 0, &wstr, 1, style); + ME_ReleaseStyle(style); + ME_CommitCoalescingUndo(editor); + SetCursor(NULL); + } + + if (editor->AutoURLDetect_bEnable) ME_UpdateSelectionLinkAttribute(editor); + + ME_UpdateRepaint(editor); + } + return 0; +} + /* Process the message and calculate the new click count. * * returns: The click count if it is mouse down event, else returns 0. */ -static int ME_CalculateClickCount(HWND hWnd, UINT msg, WPARAM wParam, +static int ME_CalculateClickCount(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam) { static int clickNum = 0; @@ -2204,7 +2436,9 @@ static int ME_CalculateClickCount(HWND hWnd, UINT msg, WPARAM wParam, { static MSG prevClickMsg; MSG clickMsg; - clickMsg.hwnd = hWnd; + /* Compare the editor instead of the hwnd so that the this + * can still be done for windowless richedit controls. */ + clickMsg.hwnd = (HWND)editor; clickMsg.message = msg; clickMsg.wParam = wParam; clickMsg.lParam = lParam; @@ -2258,9 +2492,26 @@ static BOOL ME_SetCursor(ME_TextEditor *editor) } ScreenToClient(editor->hWnd, &pt); - if ((GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_SELECTIONBAR) && - (pt.x < editor->selofs || - (editor->nSelectionType == stLine && GetCapture() == editor->hWnd))) + if (editor->nSelectionType == stLine && GetCapture() == editor->hWnd) { + SetCursor(hLeft); + return TRUE; + } + if (!editor->bEmulateVersion10 /* v4.1 */ && + pt.y < editor->rcFormat.top && + pt.x < editor->rcFormat.left) + { + SetCursor(hLeft); + return TRUE; + } + if (pt.y < editor->rcFormat.top || pt.y > editor->rcFormat.bottom) + { + if (editor->bEmulateVersion10) /* v1.0 - 3.0 */ + SetCursor(LoadCursorW(NULL, (WCHAR*)IDC_ARROW)); + else /* v4.1 */ + SetCursor(LoadCursorW(NULL, (WCHAR*)IDC_IBEAM)); + return TRUE; + } + if (pt.x < editor->rcFormat.left) { SetCursor(hLeft); return TRUE; @@ -2296,6 +2547,16 @@ static BOOL ME_SetCursor(ME_TextEditor *editor) return TRUE; } +static void ME_SetDefaultFormatRect(ME_TextEditor *editor) +{ + DWORD exstyle = GetWindowLongW(editor->hWnd, GWL_EXSTYLE); + + GetClientRect(editor->hWnd, &editor->rcFormat); + editor->rcFormat.top += (exstyle & WS_EX_CLIENTEDGE ? 1 : 0); + editor->rcFormat.left += 1 + editor->selofs; + editor->rcFormat.right -= 1; +} + static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y) { CHARRANGE selrange; @@ -2380,6 +2641,7 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) { ed->selofs = SELECTIONBAR_WIDTH; else ed->selofs = 0; + ed->bDefaultFormatRect = TRUE; ed->nSelectionType = stPosition; if (GetWindowLongW(hWnd, GWL_STYLE) & ES_PASSWORD) @@ -2727,7 +2989,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, { /* these flags are equivalent to the ES_* counterparts */ DWORD mask = ECO_VERTICAL | ECO_AUTOHSCROLL | ECO_AUTOVSCROLL | - ECO_NOHIDESEL | ECO_READONLY | ECO_WANTRETURN; + ECO_NOHIDESEL | ECO_READONLY | ECO_WANTRETURN | ECO_SELECTIONBAR; DWORD settings = GetWindowLongW(hWnd, GWL_STYLE) & mask; return settings; @@ -2742,6 +3004,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ECO_NOHIDESEL | ECO_READONLY | ECO_WANTRETURN | ECO_SELECTIONBAR; DWORD raw = GetWindowLongW(hWnd, GWL_STYLE); DWORD settings = mask & raw; + DWORD oldSettings = settings; + DWORD changedSettings; switch(wParam) { @@ -2759,13 +3023,21 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, } SetWindowLongW(hWnd, GWL_STYLE, (raw & ~mask) | (settings & mask)); + changedSettings = oldSettings ^ settings; + if (settings & ECO_AUTOWORDSELECTION) FIXME("ECO_AUTOWORDSELECTION not implemented yet!\n"); - if (settings & ECO_SELECTIONBAR) + + if (oldSettings ^ settings) { + if (settings & ECO_SELECTIONBAR) { editor->selofs = SELECTIONBAR_WIDTH; - else + editor->rcFormat.left += SELECTIONBAR_WIDTH; + } else { editor->selofs = 0; - ME_WrapMarkedParagraphs(editor); + editor->rcFormat.left -= SELECTIONBAR_WIDTH; + } + ME_WrapMarkedParagraphs(editor); + } if (settings & ECO_VERTICAL) FIXME("ECO_VERTICAL not implemented yet!\n"); @@ -3064,23 +3336,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, return len; } case EM_SCROLLCARET: - { - int top, bottom; /* row's edges relative to document top */ - int nPos; - ME_DisplayItem *para, *row; - - nPos = ME_GetYScrollPos(editor); - row = ME_RowStart(editor->pCursors[0].pRun); - para = ME_GetParagraph(row); - top = para->member.para.pt.y + row->member.row.pt.y; - bottom = top + row->member.row.nHeight; - - if (top < nPos) /* caret above window */ - ME_ScrollAbs(editor, top); - else if (nPos + editor->sizeWindow.cy < bottom) /*below*/ - ME_ScrollAbs(editor, bottom - editor->sizeWindow.cy); + ME_EnsureVisible(editor, editor->pCursors[0].pRun); return 0; - } case WM_SETFONT: { LOGFONTW lf; @@ -3202,7 +3459,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ex.codepage = unicode ? 1200 : CP_ACP; ex.lpDefaultChar = NULL; ex.lpUsedDefChar = NULL; - rc = RichEditWndProc_common(hWnd, EM_GETTEXTEX, (WPARAM)&ex, unicode ? (LPARAM)bufferW : (LPARAM)bufferA, unicode); + + rc = ME_GetTextEx(editor, &ex, unicode ? (LPARAM)bufferW : (LPARAM)bufferA); if (unicode) { @@ -3219,52 +3477,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, return rc; } case EM_GETTEXTEX: - { - GETTEXTEX *ex = (GETTEXTEX*)wParam; - int nStart, nCount; /* in chars */ - - if (ex->flags & ~(GT_SELECTION | GT_USECRLF)) - FIXME("GETTEXTEX flags 0x%08x not supported\n", ex->flags & ~(GT_SELECTION | GT_USECRLF)); - - if (ex->flags & GT_SELECTION) - { - ME_GetSelection(editor, &nStart, &nCount); - nCount -= nStart; - } - else - { - nStart = 0; - nCount = 0x7fffffff; - } - if (ex->codepage == 1200) - { - nCount = min(nCount, ex->cb / sizeof(WCHAR) - 1); - return ME_GetTextW(editor, (LPWSTR)lParam, nStart, nCount, ex->flags & GT_USECRLF); - } - else - { - /* potentially each char may be a CR, why calculate the exact value with O(N) when - we can just take a bigger buffer? :) - The above assumption still holds with CR/LF counters, since CR->CRLF expansion - occurs only in richedit 2.0 mode, in which line breaks have only one CR - */ - int crlfmul = (ex->flags & GT_USECRLF) ? 2 : 1; - LPWSTR buffer; - DWORD buflen = ex->cb; - LRESULT rc; - DWORD flags = 0; - - nCount = min(nCount, ex->cb - 1); - buffer = heap_alloc((crlfmul*nCount + 1) * sizeof(WCHAR)); - - buflen = ME_GetTextW(editor, buffer, nStart, nCount, ex->flags & GT_USECRLF); - rc = WideCharToMultiByte(ex->codepage, flags, buffer, buflen+1, (LPSTR)lParam, ex->cb, ex->lpDefaultChar, ex->lpUsedDefChar); - if (rc) rc--; /* do not count 0 terminator */ - - heap_free(buffer); - return rc; - } - } + return ME_GetTextEx(editor, (GETTEXTEX*)wParam, lParam); case EM_GETSELTEXT: { int from, to; @@ -3273,7 +3486,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, tr.chrg.cpMin = from; tr.chrg.cpMax = to; tr.lpstrText = (WCHAR *)lParam; - return RichEditWndProc_common(hWnd, EM_GETTEXTRANGE, 0, (LPARAM)&tr, unicode); + return ME_GetTextRange(editor, &tr, unicode); } case EM_GETSCROLLPOS: { @@ -3288,20 +3501,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, TRACE("EM_GETTEXTRANGE min=%d max=%d unicode=%d emul1.0=%d length=%d\n", rng->chrg.cpMin, rng->chrg.cpMax, unicode, editor->bEmulateVersion10, ME_GetTextLength(editor)); - if (unicode) - return ME_GetTextW(editor, rng->lpstrText, rng->chrg.cpMin, rng->chrg.cpMax-rng->chrg.cpMin, 0); - else - { - int nLen = rng->chrg.cpMax-rng->chrg.cpMin; - WCHAR *p = ALLOC_N_OBJ(WCHAR, nLen+1); - int nChars = ME_GetTextW(editor, p, rng->chrg.cpMin, nLen, 0); - /* FIXME this is a potential security hole (buffer overrun) - if you know more about wchar->mbyte conversion please explain - */ - WideCharToMultiByte(CP_ACP, 0, p, nChars+1, (char *)rng->lpstrText, nLen+1, NULL, NULL); - FREE_OBJ(p); - return nChars; - } + return ME_GetTextRange(editor, rng, unicode); } case EM_GETLINE: { @@ -3554,13 +3754,10 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, assert(pRun->type == diRun); pt.y = pRun->member.run.pt.y; pt.x = pRun->member.run.pt.x + ME_PointFromChar(editor, &pRun->member.run, nOffset); - pt.y += ME_GetParagraph(pRun)->member.para.pt.y; - pt.x += editor->selofs; - pt.x++; /* for some reason native offsets x by one */ + pt.y += ME_GetParagraph(pRun)->member.para.pt.y + editor->rcFormat.top; + pt.x += editor->rcFormat.left; - si.cbSize = sizeof(si); - si.fMask = SIF_POS; - if (GetScrollInfo(editor->hWnd, SB_VERT, &si)) pt.y -= si.nPos; + pt.y -= editor->vert_si.nPos; si.cbSize = sizeof(si); si.fMask = SIF_POS; if (GetScrollInfo(editor->hWnd, SB_HORZ, &si)) pt.x -= si.nPos; @@ -3574,7 +3771,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, { SCROLLINFO si; - GetClientRect(hWnd, &editor->rcFormat); + ME_SetDefaultFormatRect(editor); if (GetWindowLongW(hWnd, GWL_STYLE) & WS_HSCROLL) { /* Squelch the default horizontal scrollbar it would make */ ShowScrollBar(editor->hWnd, SB_HORZ, FALSE); @@ -3611,7 +3808,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, return 0; SetFocus(hWnd); ME_LButtonDown(editor, (short)LOWORD(lParam), (short)HIWORD(lParam), - ME_CalculateClickCount(hWnd, msg, wParam, lParam)); + ME_CalculateClickCount(editor, msg, wParam, lParam)); SetCapture(hWnd); ME_LinkNotify(editor,msg,wParam,lParam); if (!ME_SetCursor(editor)) goto do_default; @@ -3656,9 +3853,37 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, case WM_PAINT: { HDC hDC; + RECT rc; PAINTSTRUCT ps; hDC = BeginPaint(hWnd, &ps); + /* Erase area outside of the formatting rectangle */ + if (ps.rcPaint.top < editor->rcFormat.top) + { + rc = ps.rcPaint; + rc.bottom = editor->rcFormat.top; + FillRect(hDC, &rc, editor->hbrBackground); + ps.rcPaint.top = editor->rcFormat.top; + } + if (ps.rcPaint.bottom > editor->rcFormat.bottom) { + rc = ps.rcPaint; + rc.top = editor->rcFormat.bottom; + FillRect(hDC, &rc, editor->hbrBackground); + ps.rcPaint.bottom = editor->rcFormat.bottom; + } + if (ps.rcPaint.left < editor->rcFormat.left) { + rc = ps.rcPaint; + rc.right = editor->rcFormat.left; + FillRect(hDC, &rc, editor->hbrBackground); + ps.rcPaint.left = editor->rcFormat.left; + } + if (ps.rcPaint.right > editor->rcFormat.right) { + rc = ps.rcPaint; + rc.left = editor->rcFormat.right; + FillRect(hDC, &rc, editor->hbrBackground); + ps.rcPaint.right = editor->rcFormat.right; + } + ME_PaintContent(editor, hDC, FALSE, &ps.rcPaint); EndPaint(hWnd, &ps); } @@ -3699,170 +3924,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, if (ME_KeyDown(editor, LOWORD(wParam))) return 0; goto do_default; - case WM_CHAR: - { - WCHAR wstr; - - if (unicode) - wstr = (WCHAR)wParam; - else - { - CHAR charA = wParam; - MultiByteToWideChar(CP_ACP, 0, &charA, 1, &wstr, 1); - } - - if (GetWindowLongW(editor->hWnd, GWL_STYLE) & ES_READONLY) { - MessageBeep(MB_ICONERROR); - return 0; /* FIXME really 0 ? */ - } - - if (((unsigned)wstr)>=' ' - || (wstr=='\r' && (GetWindowLongW(hWnd, GWL_STYLE) & ES_MULTILINE)) - || wstr=='\t') { - ME_Cursor cursor = editor->pCursors[0]; - ME_DisplayItem *para = ME_GetParagraph(cursor.pRun); - int from, to; - BOOL ctrl_is_down = GetKeyState(VK_CONTROL) & 0x8000; - ME_GetSelection(editor, &from, &to); - if (wstr=='\t' - /* v4.1 allows tabs to be inserted with ctrl key down */ - && !(ctrl_is_down && !editor->bEmulateVersion10) - ) - { - ME_DisplayItem *para; - BOOL bSelectedRow = FALSE; - - para = ME_GetParagraph(cursor.pRun); - if (ME_IsSelection(editor) && - cursor.pRun->member.run.nCharOfs + cursor.nOffset == 0 && - to == ME_GetCursorOfs(editor, 0) && - para->member.para.prev_para->type == diParagraph) - { - para = para->member.para.prev_para; - bSelectedRow = TRUE; - } - if (ME_IsInTable(para)) - { - ME_TabPressedInTable(editor, bSelectedRow); - ME_CommitUndo(editor); - return 0; - } - } else if (!editor->bEmulateVersion10) { /* v4.1 */ - if (para->member.para.nFlags & MEPF_ROWEND) { - if (wstr=='\r') { - /* Add a new table row after this row. */ - para = ME_AppendTableRow(editor, para); - para = para->member.para.next_para; - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[0].nOffset = 0; - editor->pCursors[1] = editor->pCursors[0]; - ME_CommitUndo(editor); - ME_CheckTablesForCorruption(editor); - ME_UpdateRepaint(editor); - return 0; - } else if (from == to) { - para = para->member.para.next_para; - if (para->member.para.nFlags & MEPF_ROWSTART) - para = para->member.para.next_para; - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[0].nOffset = 0; - editor->pCursors[1] = editor->pCursors[0]; - } - } - else if (para == ME_GetParagraph(editor->pCursors[1].pRun) && - cursor.nOffset + cursor.pRun->member.run.nCharOfs == 0 && - para->member.para.prev_para->member.para.nFlags & MEPF_ROWSTART && - !para->member.para.prev_para->member.para.nCharOfs) - { - /* Insert a newline before the table. */ - WCHAR endl = '\r'; - para = para->member.para.prev_para; - para->member.para.nFlags &= ~MEPF_ROWSTART; - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[1] = editor->pCursors[0]; - ME_InsertTextFromCursor(editor, 0, &endl, 1, - editor->pCursors[0].pRun->member.run.style); - para = editor->pBuffer->pFirst->member.para.next_para; - ME_SetDefaultParaFormat(para->member.para.pFmt); - para->member.para.nFlags = MEPF_REWRAP; - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[1] = editor->pCursors[0]; - para->member.para.next_para->member.para.nFlags |= MEPF_ROWSTART; - ME_CommitCoalescingUndo(editor); - ME_CheckTablesForCorruption(editor); - ME_UpdateRepaint(editor); - return 0; - } - } else { /* v1.0 - 3.0 */ - ME_DisplayItem *para = ME_GetParagraph(cursor.pRun); - if (ME_IsInTable(cursor.pRun)) - { - if (cursor.pRun->member.run.nFlags & MERF_ENDPARA) - { - if (from == to) { - if (wstr=='\r') { - ME_ContinueCoalescingTransaction(editor); - para = ME_AppendTableRow(editor, para); - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[0].nOffset = 0; - editor->pCursors[1] = editor->pCursors[0]; - ME_CommitCoalescingUndo(editor); - ME_UpdateRepaint(editor); - } else { - /* Text should not be inserted at the end of the table. */ - MessageBeep(-1); - } - return 0; - } - } else if (wstr == '\r') { - ME_ContinueCoalescingTransaction(editor); - if (cursor.pRun->member.run.nCharOfs + cursor.nOffset == 0 && - !ME_IsInTable(para->member.para.prev_para)) - { - /* Insert newline before table */ - WCHAR endl = '\r'; - cursor.pRun = ME_FindItemBack(para, diRun); - if (cursor.pRun) - editor->pCursors[0].pRun = cursor.pRun; - editor->pCursors[0].nOffset = 0; - editor->pCursors[1] = editor->pCursors[0]; - ME_InsertTextFromCursor(editor, 0, &endl, 1, - editor->pCursors[0].pRun->member.run.style); - } else { - editor->pCursors[1] = editor->pCursors[0]; - para = ME_AppendTableRow(editor, para); - editor->pCursors[0].pRun = ME_FindItemFwd(para, diRun); - editor->pCursors[0].nOffset = 0; - editor->pCursors[1] = editor->pCursors[0]; - } - ME_CommitCoalescingUndo(editor); - ME_UpdateRepaint(editor); - return 0; - } - } - } - /* FIXME maybe it would make sense to call EM_REPLACESEL instead ? */ - /* WM_CHAR is restricted to nTextLimit */ - if(editor->nTextLimit > ME_GetTextLength(editor) - (to-from)) - { - ME_Style *style = ME_GetInsertStyle(editor, 0); - ME_SaveTempStyle(editor); - ME_ContinueCoalescingTransaction(editor); - if (wstr == '\r' && (GetKeyState(VK_SHIFT) & 0x8000)) - ME_InsertEndRowFromCursor(editor, 0); - else - ME_InsertTextFromCursor(editor, 0, &wstr, 1, style); - ME_ReleaseStyle(style); - ME_CommitCoalescingUndo(editor); - SetCursor(NULL); - } - - if (editor->AutoURLDetect_bEnable) ME_UpdateSelectionLinkAttribute(editor); - - ME_UpdateRepaint(editor); - } - return 0; - } + case WM_CHAR: + return ME_Char(editor, wParam, lParam, unicode); case WM_UNICHAR: if (unicode) { @@ -3872,10 +3935,11 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, if(wParam > 0xffff) /* convert to surrogates */ { wParam -= 0x10000; - SendMessageW(editor->hWnd, WM_CHAR, (wParam >> 10) + 0xd800, 0); - SendMessageW(editor->hWnd, WM_CHAR, (wParam & 0x03ff) + 0xdc00, 0); + ME_Char(editor, (wParam >> 10) + 0xd800, 0, TRUE); + ME_Char(editor, (wParam & 0x03ff) + 0xdc00, 0, TRUE); + } else { + ME_Char(editor, wParam, 0, TRUE); } - else SendMessageW(editor->hWnd, WM_CHAR, wParam, 0); } return 0; } @@ -3941,6 +4005,8 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, case EM_GETRECT: { *((RECT *)lParam) = editor->rcFormat; + if (editor->bDefaultFormatRect) + ((RECT *)lParam)->left -= editor->selofs; return 0; } case EM_SETRECT: @@ -3948,23 +4014,36 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, { if (lParam) { + DWORD exstyle = GetWindowLongW(hWnd, GWL_EXSTYLE); + int border = (exstyle & WS_EX_CLIENTEDGE) ? 1 : 0; + RECT clientRect; RECT *rc = (RECT *)lParam; - - if (wParam) - { - editor->rcFormat.left += rc->left; - editor->rcFormat.top += rc->top; - editor->rcFormat.right += rc->right; - editor->rcFormat.bottom += rc->bottom; - } - else + + GetClientRect(hWnd, &clientRect); + if (wParam == 0) { - editor->rcFormat = *rc; + editor->rcFormat.top = max(0, rc->top - border); + editor->rcFormat.left = max(0, rc->left - border); + editor->rcFormat.bottom = min(clientRect.bottom, rc->bottom); + editor->rcFormat.right = min(clientRect.right, rc->right + border); + } else if (wParam == 1) { + /* MSDN incorrectly says a wParam value of 1 causes the + * lParam rect to be used as a relative offset, + * however, the tests show it just prevents min/max bound + * checking. */ + editor->rcFormat.top = rc->top - border; + editor->rcFormat.left = rc->left - border; + editor->rcFormat.bottom = rc->bottom; + editor->rcFormat.right = rc->right + border; + } else { + return 0; } + editor->bDefaultFormatRect = FALSE; } else { - GetClientRect(hWnd, &editor->rcFormat); + ME_SetDefaultFormatRect(editor); + editor->bDefaultFormatRect = TRUE; } if (msg != EM_SETRECTNP) ME_RewrapRepaint(editor); @@ -3977,7 +4056,16 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, return DefWindowProcW(hWnd, msg, wParam, lParam); case WM_SIZE: { - GetClientRect(hWnd, &editor->rcFormat); + RECT clientRect; + + GetClientRect(hWnd, &clientRect); + if (editor->bDefaultFormatRect) { + ME_SetDefaultFormatRect(editor); + } else { + editor->rcFormat.right += clientRect.right - editor->prevClientRect.right; + editor->rcFormat.bottom += clientRect.bottom - editor->prevClientRect.bottom; + } + editor->prevClientRect = clientRect; ME_RewrapRepaint(editor); return DefWindowProcW(hWnd, msg, wParam, lParam); } @@ -4069,7 +4157,12 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, LRESULT ret; int mask = 0; int changes = 0; - ret = RichEditWndProc_common(hWnd, WM_GETTEXTLENGTH, 0, 0, unicode); + GETTEXTLENGTHEX how; + + /* CR/LF conversion required in 2.0 mode, verbatim in 1.0 mode */ + how.flags = GTL_CLOSE | (editor->bEmulateVersion10 ? 0 : GTL_USECRLF) | GTL_NUMCHARS; + how.codepage = unicode ? 1200 : CP_ACP; + ret = ME_GetTextLengthEx(editor, &how); if (!ret) { /*Check for valid wParam*/ diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index 248cc02be29..0c8435bdad4 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -90,7 +90,7 @@ typedef enum { diUndoPotentialEndTransaction, /* 20 - allows grouping typed chars for undo */ } ME_DIType; -#define SELECTIONBAR_WIDTH 9 +#define SELECTIONBAR_WIDTH 8 /******************************** run flags *************************/ #define MERF_STYLEFLAGS 0x0FFF @@ -350,7 +350,9 @@ typedef struct tagME_TextEditor ME_DisplayItem *pLastSelStartPara, *pLastSelEndPara; ME_FontCacheItem pFontCache[HFONT_CACHE_SIZE]; int nZoomNumerator, nZoomDenominator; + RECT prevClientRect; RECT rcFormat; + BOOL bDefaultFormatRect; BOOL bWordWrap; int nInvalidOfs; int nTextLimit; diff --git a/dlls/riched20/paint.c b/dlls/riched20/paint.c index 40761db64b0..521f646402f 100644 --- a/dlls/riched20/paint.c +++ b/dlls/riched20/paint.c @@ -37,7 +37,7 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT * c.pt.y -= yoffset; while(item != editor->pBuffer->pLast) { int yTextOffset = 0; - int ye; + int ys, ye; assert(item->type == diParagraph); if (item->member.para.pCell != item->member.para.next_para->member.para.pCell) @@ -63,14 +63,20 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT * } if (!bOnlyNew || (item->member.para.nFlags & MEPF_REPAINT)) { + /* Draw the pargraph if any of the paragraph is in the update region. */ BOOL bPaint = (rcUpdate == NULL); + ys = c.pt.y; if (rcUpdate) - bPaint = c.pt.ybottom && ye>rcUpdate->top; + bPaint = ys + c.rcView.top < rcUpdate->bottom && + ye + c.rcView.top > rcUpdate->top; if (bPaint) { c.pt.y += yTextOffset; ME_DrawParagraph(&c, item); - if (!rcUpdate || (rcUpdate->top<=c.pt.y-yTextOffset && rcUpdate->bottom>=ye)) + /* Clear the repaint flag if the whole paragraph is in the + * update region. */ + if (!rcUpdate || (rcUpdate->top <= ys + c.rcView.top && + rcUpdate->bottom >= ye + c.rcView.top)) item->member.para.nFlags &= ~MEPF_REPAINT; } } @@ -103,30 +109,34 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT * } item = item->member.para.next_para; } - if (c.pt.ynTotalLength-yoffset, y2 = editor->nLastTotalLength-yoffset; if (y1left, xe = rcUpdate->right; - if (rcUpdate->top > ys) - ys = rcUpdate->top; - if (rcUpdate->bottom < ye) - ye = rcUpdate->bottom; + /* Clip to update region */ + xs = max(xs, rcUpdate->left); + xe = min(xe, rcUpdate->right); + ys = max(ys, rcUpdate->top); + ye = min(ye, rcUpdate->bottom); } - if (ye>ys) { + if (xe > xs && ye > ys) + { + RECT rc; rc.left = xs; rc.top = ys; rc.right = xe; @@ -441,7 +451,7 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa if (runofs >= nSelFrom && runofs < nSelTo) { ME_HighlightSpace(c, x, y, wszSpace, 1, run->style, 0, 0, 1, - c->pt.y + start->member.row.pt.y, + c->rcView.top + c->pt.y + start->member.row.pt.y, start->member.row.nHeight); } return; @@ -452,8 +462,8 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa /* wszSpace is used instead of the tab character because otherwise * an unwanted symbol can be inserted instead. */ ME_DrawTextWithStyle(c, x, y, wszSpace, 1, run->style, run->nWidth, - nSelFrom-runofs,nSelTo-runofs, - c->pt.y + start->member.row.pt.y, + nSelFrom-runofs, nSelTo-runofs, + c->rcView.top + c->pt.y + start->member.row.pt.y, start->member.row.nHeight); return; } @@ -467,13 +477,17 @@ static void ME_DrawRun(ME_Context *c, int x, int y, ME_DisplayItem *rundi, ME_Pa ME_String *szMasked = ME_MakeStringR(c->editor->cPasswordMask,ME_StrVLen(run->strText)); ME_DrawTextWithStyle(c, x, y, szMasked->szData, ME_StrVLen(szMasked), run->style, run->nWidth, - nSelFrom-runofs,nSelTo-runofs, c->pt.y+start->member.row.pt.y, start->member.row.nHeight); + nSelFrom-runofs,nSelTo-runofs, + c->rcView.top + c->pt.y + start->member.row.pt.y, + start->member.row.nHeight); ME_DestroyString(szMasked); } else ME_DrawTextWithStyle(c, x, y, run->strText->szData, ME_StrVLen(run->strText), run->style, run->nWidth, - nSelFrom-runofs,nSelTo-runofs, c->pt.y+start->member.row.pt.y, start->member.row.nHeight); + nSelFrom-runofs,nSelTo-runofs, + c->rcView.top + c->pt.y + start->member.row.pt.y, + start->member.row.nHeight); } } @@ -728,11 +742,11 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph) int width; BOOL atTop = (para->pCell != para->prev_para->member.para.pCell); BOOL atBottom = (para->pCell != para->next_para->member.para.pCell); - int top = (atTop ? cell->pt.y : para->pt.y) - ME_GetYScrollPos(c->editor); + int top = c->rcView.top + (atTop ? cell->pt.y : para->pt.y) - ME_GetYScrollPos(c->editor); int bottom = (atBottom ? - cell->pt.y + cell->nHeight - ME_GetYScrollPos(c->editor): + c->rcView.top + cell->pt.y + cell->nHeight - ME_GetYScrollPos(c->editor): top + para->nHeight + (atTop ? cell->yTextOffset : 0)); - rc.left = cell->pt.x; + rc.left = c->rcView.left + cell->pt.x; rc.right = rc.left + cell->nWidth; if (atTop) { /* Erase gap before text if not all borders are the same height. */ @@ -798,10 +812,10 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph) ME_DisplayItem *nextEndCell; nextEndCell = ME_FindItemBack(ME_GetTableRowEnd(paraAfterRow), diCell); assert(nextEndCell && !nextEndCell->member.cell.next_cell); - rc.left = nextEndCell->member.cell.pt.x; + rc.left = c->rcView.left + nextEndCell->member.cell.pt.x; /* FIXME: Native draws FROM the bottom of the table rather than * TO the bottom of the table in this case, but just doing so here - * will case the next row to erase the border. */ + * will cause the next row to erase the border. */ /* rc.top = bottom; rc.bottom = rc.top + width; @@ -860,12 +874,12 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph) oldpen = SelectObject(c->hDC, pen); /* Find the start relative to the text */ - firstX = ME_FindItemFwd(paragraph, diRun)->member.run.pt.x; + firstX = c->rcView.left + ME_FindItemFwd(paragraph, diRun)->member.run.pt.x; /* Go back by the horizontal gap, which is stored in dxOffset */ firstX -= ME_twips2pointsX(c, para->pFmt->dxOffset); /* The left edge, stored in dxStartIndent affected just the first edge */ startX = firstX - ME_twips2pointsX(c, para->pFmt->dxStartIndent); - rowY = c->pt.y; + rowY = c->rcView.top + c->pt.y; if (para->pFmt->dwMask & PFM_SPACEBEFORE) rowY += ME_twips2pointsY(c, para->pFmt->dySpaceBefore); nHeight = ME_FindItemFwd(paragraph, diStartRow)->member.row.nHeight; @@ -907,13 +921,14 @@ static void ME_DrawTableBorders(ME_Context *c, ME_DisplayItem *paragraph) } } -void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { +void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) +{ int align = SetTextAlign(c->hDC, TA_BASELINE); ME_DisplayItem *p; ME_Run *run; ME_Paragraph *para = NULL; RECT rc, bounds; - int y = c->pt.y; + int y = c->rcView.top + c->pt.y; int height = 0, baseline = 0, no=0; BOOL visible = FALSE; @@ -928,15 +943,15 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { if (para->pCell) { ME_Cell *cell = ¶->pCell->member.cell; - rc.left = cell->pt.x; + rc.left = c->rcView.left + cell->pt.x; rc.right = rc.left + cell->nWidth; } if (para->nFlags & MEPF_ROWSTART) { ME_Cell *cell = ¶->next_para->member.para.pCell->member.cell; - rc.right = cell->pt.x; + rc.right = c->rcView.left + cell->pt.x; } else if (para->nFlags & MEPF_ROWEND) { ME_Cell *cell = ¶->prev_para->member.para.pCell->member.cell; - rc.left = cell->pt.x + cell->nWidth; + rc.left = c->rcView.left + cell->pt.x + cell->nWidth; } ME_DrawParaDecoration(c, para, y, &bounds); y += bounds.top; @@ -953,7 +968,7 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { ME_Cell *cell = ¶->prev_para->member.para.pCell->member.cell; rc.bottom = y + cell->nHeight; } else { - rc.bottom = y+p->member.row.nHeight; + rc.bottom = y + p->member.row.nHeight; } visible = RectVisible(c->hDC, &rc); if (visible) { @@ -976,10 +991,10 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { assert(para); run = &p->member.run; if (visible && me_debug) { - rc.left = c->rcView.left+run->pt.x; - rc.right = c->rcView.left+run->pt.x+run->nWidth; - rc.top = c->pt.y+run->pt.y; - rc.bottom = c->pt.y+run->pt.y+height; + rc.left = c->rcView.left + run->pt.x; + rc.right = rc.left + run->nWidth; + rc.top = c->rcView.top + c->pt.y + run->pt.y; + rc.bottom = rc.bottom + height; TRACE("rc = (%d, %d, %d, %d)\n", rc.left, rc.top, rc.right, rc.bottom); if (run->nFlags & MERF_SKIPPED) DrawFocusRect(c->hDC, &rc); @@ -987,7 +1002,9 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT)); } if (visible) - ME_DrawRun(c, run->pt.x, c->pt.y+run->pt.y+baseline, p, ¶graph->member.para); + ME_DrawRun(c, c->rcView.left + run->pt.x, + c->rcView.top + c->pt.y + run->pt.y + baseline, + p, ¶graph->member.para); if (me_debug) { /* I'm using %ls, hope wsprintfW is not going to use wrong (4-byte) WCHAR version */ @@ -995,7 +1012,7 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { WCHAR buf[2560]; POINT pt; pt.x = run->pt.x; - pt.y = c->pt.y + run->pt.y; + pt.y = c->rcView.top + c->pt.y + run->pt.y; wsprintfW(buf, wszRunDebug, no, p->member.run.nFlags, p->member.run.strText->szData); ME_DebugWrite(c->hDC, &pt, buf); } @@ -1007,8 +1024,8 @@ void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph) { break; y += height; rc.top = y; - rc.bottom = p->member.cell.pt.y + p->member.cell.nHeight - - ME_GetYScrollPos(c->editor); + rc.bottom = c->rcView.top + p->member.cell.pt.y + + p->member.cell.nHeight - ME_GetYScrollPos(c->editor); if (RectVisible(c->hDC, &rc)) { FillRect(c->hDC, &rc, c->editor->hbrBackground); diff --git a/dlls/riched20/rtf.h b/dlls/riched20/rtf.h index 8fc8abc3400..a276b7c2e92 100644 --- a/dlls/riched20/rtf.h +++ b/dlls/riched20/rtf.h @@ -1157,9 +1157,6 @@ struct _RTF_Info { ME_InStream *stream; - /* edit window to output to */ - HWND hwndEdit; - ME_TextEditor *editor; ME_Style *style; diff --git a/dlls/riched20/run.c b/dlls/riched20/run.c index e2fde47bcd0..28239057011 100644 --- a/dlls/riched20/run.c +++ b/dlls/riched20/run.c @@ -692,7 +692,7 @@ static SIZE ME_GetRunSizeCommon(ME_Context *c, const ME_Paragraph *para, ME_Run { pos += lDefaultTab - (pos % lDefaultTab); } - ppos = ME_twips2pointsX(c, pos) + c->editor->selofs; + ppos = ME_twips2pointsX(c, pos); if (ppos > startx + run->pt.x) { size.cx = ppos - startx - run->pt.x; break; diff --git a/dlls/riched20/tests/editor.c b/dlls/riched20/tests/editor.c index f4f5f1b8241..9e2f5e41507 100644 --- a/dlls/riched20/tests/editor.c +++ b/dlls/riched20/tests/editor.c @@ -44,6 +44,8 @@ static CHAR string1[MAX_PATH], string2[MAX_PATH], string3[MAX_PATH]; static HMODULE hmoduleRichEdit; +static int is_win9x = 0; + static HWND new_window(LPCTSTR lpClassName, DWORD dwStyle, HWND parent) { HWND hwnd; hwnd = CreateWindow(lpClassName, NULL, dwStyle|WS_POPUP|WS_HSCROLL|WS_VSCROLL @@ -59,7 +61,7 @@ static HWND new_richedit(HWND parent) { /* Keeps the window reponsive for the deley_time in seconds. * This is useful for debugging a test to see what is happening. */ -void keep_responsive(time_t delay_time) +static void keep_responsive(time_t delay_time) { MSG msg; time_t end; @@ -4911,9 +4913,7 @@ static void test_unicode_conversions(void) char bufA[64]; WCHAR bufW[64]; HWND hwnd; - int is_win9x, em_settextex_supported, ret; - - is_win9x = GetVersion() & 0x80000000; + int em_settextex_supported, ret; #define set_textA(hwnd, wm_set_text, txt) \ do { \ @@ -5146,8 +5146,12 @@ static void test_EM_GETTEXTLENGTHEX(void) char buffer[64] = {0}; /* single line */ - hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP, - 0, 0, 200, 60, 0, 0, 0, 0); + if (!is_win9x) + hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP, + 0, 0, 200, 60, 0, 0, 0, 0); + else + hwnd = CreateWindowExA(0, "RichEdit20A", NULL, WS_POPUP, + 0, 0, 200, 60, 0, 0, 0, 0); ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError()); gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF; @@ -5191,8 +5195,12 @@ static void test_EM_GETTEXTLENGTHEX(void) DestroyWindow(hwnd); /* multi line */ - hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP | ES_MULTILINE, - 0, 0, 200, 60, 0, 0, 0, 0); + if (!is_win9x) + hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP | ES_MULTILINE, + 0, 0, 200, 60, 0, 0, 0, 0); + else + hwnd = CreateWindowExA(0, "RichEdit20A", NULL, WS_POPUP | ES_MULTILINE, + 0, 0, 200, 60, 0, 0, 0, 0); ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError()); gtl.flags = GTL_NUMCHARS | GTL_PRECISE | GTL_USECRLF; @@ -5431,8 +5439,12 @@ static void test_undo_coalescing(void) char buffer[64] = {0}; /* multi-line control inserts CR normally */ - hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP|ES_MULTILINE, - 0, 0, 200, 60, 0, 0, 0, 0); + if (!is_win9x) + hwnd = CreateWindowExA(0, "RichEdit20W", NULL, WS_POPUP|ES_MULTILINE, + 0, 0, 200, 60, 0, 0, 0, 0); + else + hwnd = CreateWindowExA(0, "RichEdit20A", NULL, WS_POPUP|ES_MULTILINE, + 0, 0, 200, 60, 0, 0, 0, 0); ok(hwnd != 0, "CreateWindowExA error %u\n", GetLastError()); result = SendMessage(hwnd, EM_CANUNDO, 0, 0); @@ -5542,7 +5554,7 @@ static void test_undo_coalescing(void) DestroyWindow(hwnd); } -LONG CALLBACK customWordBreakProc(WCHAR *text, int pos, int bytes, int code) +static LONG CALLBACK customWordBreakProc(WCHAR *text, int pos, int bytes, int code) { int length; @@ -5652,16 +5664,16 @@ static void test_word_movement(void) /* Make sure the behaviour is the same with a unicode richedit window, * and using unicode functions. */ - SetLastError(0xdeadbeef); - hwnd = CreateWindowW(RICHEDIT_CLASS20W, NULL, - ES_MULTILINE|WS_POPUP|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE, - 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL); - if (!hwnd && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + if (is_win9x) { - win_skip("Needed unicode functions are not implemented\n"); + skip("Cannot test with unicode richedit window\n"); return; } + hwnd = CreateWindowW(RICHEDIT_CLASS20W, NULL, + ES_MULTILINE|WS_POPUP|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE, + 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL); + /* Test with a custom word break procedure that uses X as the delimiter. */ result = SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)textW); ok (result == TRUE, "Failed to clear the text.\n"); @@ -5823,12 +5835,190 @@ static void test_auto_yscroll(void) DestroyWindow(hwnd); } + +static void test_format_rect(void) +{ + HWND hwnd; + RECT rc, expected, clientRect; + int n; + DWORD options; + + hwnd = CreateWindowEx(0, RICHEDIT_CLASS, NULL, + ES_MULTILINE|WS_POPUP|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE, + 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL); + ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError()); + + GetClientRect(hwnd, &clientRect); + + expected = clientRect; + expected.left += 1; + expected.right -= 1; + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + + for (n = -3; n <= 3; n++) + { + rc = clientRect; + rc.top += n; + rc.left += n; + rc.bottom -= n; + rc.right -= n; + SendMessageA(hwnd, EM_SETRECT, 0, (LPARAM)&rc); + + expected = rc; + expected.top = max(0, rc.top); + expected.left = max(0, rc.left); + expected.bottom = min(clientRect.bottom, rc.bottom); + expected.right = min(clientRect.right, rc.right); + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "[n=%d] rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + n, rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + } + + rc = clientRect; + SendMessageA(hwnd, EM_SETRECT, 0, (LPARAM)&rc); + expected = clientRect; + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + + /* Adding the selectionbar adds the selectionbar width to the left side. */ + SendMessageA(hwnd, EM_SETOPTIONS, ECOOP_OR, ECO_SELECTIONBAR); + options = SendMessageA(hwnd, EM_GETOPTIONS, 0, 0); + ok(options & ECO_SELECTIONBAR, "EM_SETOPTIONS failed to add selectionbar.\n"); + expected.left += 8; /* selection bar width */ + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + + rc = clientRect; + SendMessageA(hwnd, EM_SETRECT, 0, (LPARAM)&rc); + expected = clientRect; + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + + /* Removing the selectionbar subtracts the selectionbar width from the left side, + * even if the left side is already 0. */ + SendMessageA(hwnd, EM_SETOPTIONS, ECOOP_AND, ~ECO_SELECTIONBAR); + options = SendMessageA(hwnd, EM_GETOPTIONS, 0, 0); + ok(!(options & ECO_SELECTIONBAR), "EM_SETOPTIONS failed to remove selectionbar.\n"); + expected.left -= 8; /* selection bar width */ + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + + /* Set the absolute value of the formatting rectangle. */ + rc = clientRect; + SendMessageA(hwnd, EM_SETRECT, 0, (LPARAM)&rc); + expected = clientRect; + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "[n=%d] rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + n, rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + + /* MSDN documents the EM_SETRECT message as using the rectangle provided in + * LPARAM as being a relative offset when the WPARAM value is 1, but these + * tests show that this isn't true. */ + rc.top = 15; + rc.left = 15; + rc.bottom = clientRect.bottom - 15; + rc.right = clientRect.right - 15; + expected = rc; + SendMessageA(hwnd, EM_SETRECT, 1, (LPARAM)&rc); + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + + /* For some reason it does not limit the values to the client rect with + * a WPARAM value of 1. */ + rc.top = -15; + rc.left = -15; + rc.bottom = clientRect.bottom + 15; + rc.right = clientRect.right + 15; + expected = rc; + SendMessageA(hwnd, EM_SETRECT, 1, (LPARAM)&rc); + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + + DestroyWindow(hwnd); + + /* The extended window style affects the formatting rectangle. */ + hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, RICHEDIT_CLASS, NULL, + ES_MULTILINE|WS_POPUP|WS_HSCROLL|WS_VSCROLL|WS_VISIBLE, + 0, 0, 200, 60, NULL, NULL, hmoduleRichEdit, NULL); + ok(hwnd != NULL, "class: %s, error: %d\n", RICHEDIT_CLASS, (int) GetLastError()); + + GetClientRect(hwnd, &clientRect); + + expected = clientRect; + expected.left += 1; + expected.top += 1; + expected.right -= 1; + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + + rc = clientRect; + rc.top += 5; + rc.left += 5; + rc.bottom -= 5; + rc.right -= 5; + expected = rc; + expected.top -= 1; + expected.left -= 1; + expected.right += 1; + SendMessageA(hwnd, EM_SETRECT, 0, (LPARAM)&rc); + SendMessageA(hwnd, EM_GETRECT, 0, (LPARAM)&rc); + ok(rc.top == expected.top && rc.left == expected.left && + rc.bottom == expected.bottom && rc.right == expected.right, + "rect a(t=%d, l=%d, b=%d, r=%d) != e(t=%d, l=%d, b=%d, r=%d)\n", + rc.top, rc.left, rc.bottom, rc.right, + expected.top, expected.left, expected.bottom, expected.right); + + DestroyWindow(hwnd); +} + START_TEST( editor ) { /* Must explicitly LoadLibrary(). The test has no references to functions in * RICHED20.DLL, so the linker doesn't actually link to it. */ hmoduleRichEdit = LoadLibrary("RICHED20.DLL"); ok(hmoduleRichEdit != NULL, "error: %d\n", (int) GetLastError()); + + is_win9x = GetVersion() & 0x80000000; + test_WM_CHAR(); test_EM_FINDTEXT(); test_EM_GETLINE(); @@ -5872,6 +6062,7 @@ START_TEST( editor ) test_SETPARAFORMAT(); test_word_wrap(); test_auto_yscroll(); + test_format_rect(); /* Set the environment variable WINETEST_RICHED20 to keep windows * responsive and open for 30 seconds. This is useful for debugging. diff --git a/dlls/riched20/tests/txtsrv.c b/dlls/riched20/tests/txtsrv.c index 3d47490d975..a8cb169f248 100644 --- a/dlls/riched20/tests/txtsrv.c +++ b/dlls/riched20/tests/txtsrv.c @@ -120,7 +120,7 @@ static HDC WINAPI ITextHostImpl_TxGetDC(ITextHost *iface) } static INT WINAPI ITextHostImpl_TxReleaseDC(ITextHost *iface, - HDC hdc) + HDC hdc) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxReleaseDC(%p)\n", This); @@ -128,51 +128,51 @@ static INT WINAPI ITextHostImpl_TxReleaseDC(ITextHost *iface, } static BOOL WINAPI ITextHostImpl_TxShowScrollBar(ITextHost *iface, - INT fnBar, - BOOL fShow) + INT fnBar, + BOOL fShow) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxShowScrollBar(%p, fnBar=%d, fShow=%d)\n", This, fnBar, fShow); - return E_NOTIMPL; + return FALSE; } static BOOL WINAPI ITextHostImpl_TxEnableScrollBar(ITextHost *iface, - INT fuSBFlags, - INT fuArrowflags) + INT fuSBFlags, + INT fuArrowflags) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxEnableScrollBar(%p, fuSBFlags=%d, fuArrowflags=%d)\n", This, fuSBFlags, fuArrowflags); - return E_NOTIMPL; + return FALSE; } static BOOL WINAPI ITextHostImpl_TxSetScrollRange(ITextHost *iface, - INT fnBar, - LONG nMinPos, - INT nMaxPos, - BOOL fRedraw) + INT fnBar, + LONG nMinPos, + INT nMaxPos, + BOOL fRedraw) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxSetScrollRange(%p, fnBar=%d, nMinPos=%d, nMaxPos=%d, fRedraw=%d)\n", This, fnBar, nMinPos, nMaxPos, fRedraw); - return E_NOTIMPL; + return FALSE; } static BOOL WINAPI ITextHostImpl_TxSetScrollPos(ITextHost *iface, - INT fnBar, - INT nPos, - BOOL fRedraw) + INT fnBar, + INT nPos, + BOOL fRedraw) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxSetScrollPos(%p, fnBar=%d, nPos=%d, fRedraw=%d)\n", This, fnBar, nPos, fRedraw); - return E_NOTIMPL; + return FALSE; } static void WINAPI ITextHostImpl_TxInvalidateRect(ITextHost *iface, - LPCRECT prc, - BOOL fMode) + LPCRECT prc, + BOOL fMode) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxInvalidateRect(%p, prc=%p, fMode=%d)\n", @@ -187,13 +187,13 @@ static void WINAPI ITextHostImpl_TxViewChange(ITextHost *iface, BOOL fUpdate) } static BOOL WINAPI ITextHostImpl_TxCreateCaret(ITextHost *iface, - HBITMAP hbmp, - INT xWidth, INT yHeight) + HBITMAP hbmp, + INT xWidth, INT yHeight) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxCreateCaret(%p, nbmp=%p, xWidth=%d, yHeight=%d)\n", This, hbmp, xWidth, yHeight); - return E_NOTIMPL; + return FALSE; } static BOOL WINAPI ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow) @@ -201,24 +201,24 @@ static BOOL WINAPI ITextHostImpl_TxShowCaret(ITextHost *iface, BOOL fShow) ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxShowCaret(%p, fShow=%d)\n", This, fShow); - return E_NOTIMPL; + return FALSE; } static BOOL WINAPI ITextHostImpl_TxSetCaretPos(ITextHost *iface, - INT x, INT y) + INT x, INT y) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxSetCaretPos(%p, x=%d, y=%d)\n", This, x, y); - return E_NOTIMPL; + return FALSE; } static BOOL WINAPI ITextHostImpl_TxSetTimer(ITextHost *iface, - UINT idTimer, UINT uTimeout) + UINT idTimer, UINT uTimeout) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxSetTimer(%p, idTimer=%u, uTimeout=%u)\n", This, idTimer, uTimeout); - return E_NOTIMPL; + return FALSE; } static void WINAPI ITextHostImpl_TxKillTimer(ITextHost *iface, UINT idTimer) @@ -228,12 +228,12 @@ static void WINAPI ITextHostImpl_TxKillTimer(ITextHost *iface, UINT idTimer) } static void WINAPI ITextHostImpl_TxScrollWindowEx(ITextHost *iface, - INT dx, INT dy, - LPCRECT lprcScroll, - LPCRECT lprcClip, - HRGN hRgnUpdate, - LPRECT lprcUpdate, - UINT fuScroll) + INT dx, INT dy, + LPCRECT lprcScroll, + LPCRECT lprcClip, + HRGN hRgnUpdate, + LPRECT lprcUpdate, + UINT fuScroll) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxScrollWindowEx(%p, %d, %d, %p, %p, %p, %p, %d)\n", @@ -253,8 +253,8 @@ static void WINAPI ITextHostImpl_TxSetFocus(ITextHost *iface) } static void WINAPI ITextHostImpl_TxSetCursor(ITextHost *iface, - HCURSOR hcur, - BOOL fText) + HCURSOR hcur, + BOOL fText) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxSetCursor(%p, hcur=%p, fText=%d)\n", @@ -262,23 +262,23 @@ static void WINAPI ITextHostImpl_TxSetCursor(ITextHost *iface, } static BOOL WINAPI ITextHostImpl_TxScreenToClient(ITextHost *iface, - LPPOINT lppt) + LPPOINT lppt) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxScreenToClient(%p, lppt=%p)\n", This, lppt); - return E_NOTIMPL; + return FALSE; } static BOOL WINAPI ITextHostImpl_TxClientToScreen(ITextHost *iface, - LPPOINT lppt) + LPPOINT lppt) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxClientToScreen(%p, lppt=%p)\n", This, lppt); - return E_NOTIMPL; + return FALSE; } static HRESULT WINAPI ITextHostImpl_TxActivate(ITextHost *iface, - LONG *plOldState) + LONG *plOldState) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxActivate(%p, plOldState=%p)\n", This, plOldState); @@ -286,7 +286,7 @@ static HRESULT WINAPI ITextHostImpl_TxActivate(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_TxDeactivate(ITextHost *iface, - LONG lNewState) + LONG lNewState) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxDeactivate(%p, lNewState=%d)\n", This, lNewState); @@ -294,7 +294,7 @@ static HRESULT WINAPI ITextHostImpl_TxDeactivate(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_TxGetClientRect(ITextHost *iface, - LPRECT prc) + LPRECT prc) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetClientRect(%p, prc=%p)\n", This, prc); @@ -302,7 +302,7 @@ static HRESULT WINAPI ITextHostImpl_TxGetClientRect(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_TxGetViewInset(ITextHost *iface, - LPRECT prc) + LPRECT prc) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetViewInset(%p, prc=%p)\n", This, prc); @@ -310,7 +310,7 @@ static HRESULT WINAPI ITextHostImpl_TxGetViewInset(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_TxGetCharFormat(ITextHost *iface, - const CHARFORMATW **ppCF) + const CHARFORMATW **ppCF) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetCharFormat(%p, ppCF=%p)\n", This, ppCF); @@ -318,7 +318,7 @@ static HRESULT WINAPI ITextHostImpl_TxGetCharFormat(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_TxGetParaFormat(ITextHost *iface, - const PARAFORMAT **ppPF) + const PARAFORMAT **ppPF) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetParaFormat(%p, ppPF=%p)\n", This, ppPF); @@ -326,7 +326,7 @@ static HRESULT WINAPI ITextHostImpl_TxGetParaFormat(ITextHost *iface, } static COLORREF WINAPI ITextHostImpl_TxGetSysColor(ITextHost *iface, - int nIndex) + int nIndex) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetSysColor(%p, nIndex=%d)\n", This, nIndex); @@ -334,7 +334,7 @@ static COLORREF WINAPI ITextHostImpl_TxGetSysColor(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_TxGetBackStyle(ITextHost *iface, - TXTBACKSTYLE *pStyle) + TXTBACKSTYLE *pStyle) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetBackStyle(%p, pStyle=%p)\n", This, pStyle); @@ -342,24 +342,24 @@ static HRESULT WINAPI ITextHostImpl_TxGetBackStyle(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_TxGetMaxLength(ITextHost *iface, - DWORD *pLength) + DWORD *pLength) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetMaxLength(%p, pLength=%p)\n", This, pLength); return E_NOTIMPL; } -static HRESULT WINAPI ITextHostImpl_TxGetScrollbars(ITextHost *iface, - DWORD *pdwScrollBar) +static HRESULT WINAPI ITextHostImpl_TxGetScrollBars(ITextHost *iface, + DWORD *pdwScrollBar) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; - TRACECALL("Call to TxGetScrollbars(%p, pdwScrollBar=%p)\n", + TRACECALL("Call to TxGetScrollBars(%p, pdwScrollBar=%p)\n", This, pdwScrollBar); return E_NOTIMPL; } static HRESULT WINAPI ITextHostImpl_TxGetPasswordChar(ITextHost *iface, - WCHAR *pch) + WCHAR *pch) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetPasswordChar(%p, pch=%p)\n", This, pch); @@ -367,7 +367,7 @@ static HRESULT WINAPI ITextHostImpl_TxGetPasswordChar(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_TxGetAcceleratorPos(ITextHost *iface, - LONG *pch) + LONG *pch) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetAcceleratorPos(%p, pch=%p)\n", This, pch); @@ -375,7 +375,7 @@ static HRESULT WINAPI ITextHostImpl_TxGetAcceleratorPos(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_TxGetExtent(ITextHost *iface, - LPSIZEL lpExtent) + LPSIZEL lpExtent) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetExtent(%p, lpExtent=%p)\n", This, lpExtent); @@ -383,7 +383,7 @@ static HRESULT WINAPI ITextHostImpl_TxGetExtent(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_OnTxCharFormatChange(ITextHost *iface, - const CHARFORMATW *pcf) + const CHARFORMATW *pcf) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to OnTxCharFormatChange(%p, pcf=%p)\n", This, pcf); @@ -391,7 +391,7 @@ static HRESULT WINAPI ITextHostImpl_OnTxCharFormatChange(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange(ITextHost *iface, - const PARAFORMAT *ppf) + const PARAFORMAT *ppf) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to OnTxParaFormatChange(%p, ppf=%p)\n", This, ppf); @@ -401,8 +401,8 @@ static HRESULT WINAPI ITextHostImpl_OnTxParaFormatChange(ITextHost *iface, /* This must return S_OK for the native ITextServices object to initialize. */ static HRESULT WINAPI ITextHostImpl_TxGetPropertyBits(ITextHost *iface, - DWORD dwMask, - DWORD *pdwBits) + DWORD dwMask, + DWORD *pdwBits) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetPropertyBits(%p, dwMask=0x%08x, pdwBits=%p)\n", @@ -412,7 +412,7 @@ static HRESULT WINAPI ITextHostImpl_TxGetPropertyBits(ITextHost *iface, } static HRESULT WINAPI ITextHostImpl_TxNotify(ITextHost *iface, DWORD iNotify, - void *pv) + void *pv) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxNotify(%p, iNotify=%d, pv=%p)\n", This, iNotify, pv); @@ -433,7 +433,7 @@ static void WINAPI ITextHostImpl_TxImmReleaseContext(ITextHost *iface, HIMC himc } static HRESULT WINAPI ITextHostImpl_TxGetSelectionBarWidth(ITextHost *iface, - LONG *lSelBarWidth) + LONG *lSelBarWidth) { ITextHostTestImpl *This = (ITextHostTestImpl *)iface; TRACECALL("Call to TxGetSelectionBarWidth(%p, lSelBarWidth=%p)\n", @@ -475,7 +475,7 @@ static ITextHostVtbl itextHostVtbl = { ITextHostImpl_TxGetSysColor, ITextHostImpl_TxGetBackStyle, ITextHostImpl_TxGetMaxLength, - ITextHostImpl_TxGetScrollbars, + ITextHostImpl_TxGetScrollBars, ITextHostImpl_TxGetPasswordChar, ITextHostImpl_TxGetAcceleratorPos, ITextHostImpl_TxGetExtent, diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index 3ffe09adea9..d989a2da1cd 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -78,8 +78,7 @@ static void ME_BeginRow(ME_WrapContext *wc, ME_DisplayItem *para) wc->bWordWrap = TRUE; } else { wc->nAvailWidth = wc->context->rcView.right - wc->context->rcView.left - - (wc->nRow ? wc->nLeftMargin : wc->nFirstMargin) - wc->nRightMargin - - wc->context->editor->selofs; + - (wc->nRow ? wc->nLeftMargin : wc->nFirstMargin) - wc->nRightMargin; } wc->pt.x = wc->context->pt.x; if (wc->context->editor->bEmulateVersion10 && /* v1.0 - 3.0 */ @@ -458,7 +457,7 @@ static ME_DisplayItem *ME_WrapHandleRun(ME_WrapContext *wc, ME_DisplayItem *p) static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp); -static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD beginofs) { +static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) { ME_DisplayItem *p; ME_WrapContext wc; int border = 0; @@ -573,7 +572,8 @@ static void ME_PrepareParagraphForWrapping(ME_Context *c, ME_DisplayItem *tp) { } } -BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) { +BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) +{ ME_DisplayItem *item; ME_Context c; BOOL bModified = FALSE; @@ -581,7 +581,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) { int yLastPos = 0; ME_InitContext(&c, editor, GetDC(editor->hWnd)); - c.pt.x = editor->selofs; + c.pt.x = 0; editor->nHeight = 0; item = editor->pBuffer->pFirst->next; while(item != editor->pBuffer->pLast) { @@ -594,7 +594,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) { bRedraw = TRUE; item->member.para.pt = c.pt; - ME_WrapTextParagraph(&c, item, editor->selofs); + ME_WrapTextParagraph(&c, item); if (bRedraw) { @@ -707,7 +707,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) { c.pt.x = item->member.para.pCell->member.cell.pt.x; } else { /* Normal paragraph */ - c.pt.x = editor->selofs; + c.pt.x = 0; } c.pt.y += item->member.para.nHeight; } @@ -749,16 +749,18 @@ void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor) item = editor->pBuffer->pFirst; while(item != editor->pBuffer->pLast) { if (item->member.para.nFlags & MEPF_REPAINT) { - rc.top = item->member.para.pt.y - ofs; - rc.bottom = item->member.para.pt.y + item->member.para.nHeight - ofs; + rc.top = c.rcView.top + item->member.para.pt.y - ofs; + rc.bottom = max(c.rcView.top + item->member.para.pt.y + + item->member.para.nHeight - ofs, + c.rcView.bottom); InvalidateRect(editor->hWnd, &rc, TRUE); } item = item->member.para.next_para; } if (editor->nTotalLength < editor->nLastTotalLength) { - rc.top = editor->nTotalLength - ofs; - rc.bottom = editor->nLastTotalLength - ofs; + rc.top = c.rcView.top + editor->nTotalLength - ofs; + rc.bottom = c.rcView.top + editor->nLastTotalLength - ofs; InvalidateRect(editor->hWnd, &rc, TRUE); } ME_DestroyContext(&c, editor->hWnd); diff --git a/dlls/rpcrt4/tests/cstub.c b/dlls/rpcrt4/tests/cstub.c index 29bcb27e433..f101a6f6cff 100644 --- a/dlls/rpcrt4/tests/cstub.c +++ b/dlls/rpcrt4/tests/cstub.c @@ -434,7 +434,7 @@ static IPSFactoryBuffer *test_NdrDllGetClassObject(void) const CLSID PSDispatch = {0x20420, 0, 0, {0xc0, 0, 0, 0, 0, 0, 0, 0x46}}; const CLSID CLSID_Unknown = {0x45678, 0x1234, 0x6666, {0xff, 0x67, 0x45, 0x98, 0x76, 0x12, 0x34, 0x56}}; HRESULT r; - HMODULE hmod = LoadLibraryA("rpcrt4.dll"); + HMODULE hmod = GetModuleHandleA("rpcrt4.dll"); void *CStd_QueryInterface = GetProcAddress(hmod, "CStdStubBuffer_QueryInterface"); void *CStd_AddRef = GetProcAddress(hmod, "CStdStubBuffer_AddRef"); void *CStd_Release = GetProcAddress(hmod, "NdrCStdStubBuffer_Release"); diff --git a/dlls/rpcrt4/tests/rpc.c b/dlls/rpcrt4/tests/rpc.c index 796e40845ea..069ead13e7c 100644 --- a/dlls/rpcrt4/tests/rpc.c +++ b/dlls/rpcrt4/tests/rpc.c @@ -400,7 +400,7 @@ static void test_towers(void) broken(ret != RPC_S_OK), /* win2k, indeterminate */ "TowerExplode failed with error %ld\n", ret); /* Windows XP SP3 sets address to NULL */ - ok(!address || !strcmp(address, ""), "address was \"%s\" instead of \"\"\n or NULL (XP SP3)", address); + ok(!address || !strcmp(address, ""), "address was \"%s\" instead of \"\" or NULL (XP SP3)\n", address); I_RpcFree(address); I_RpcFree(tower); diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index a2d72de90f1..ed4fef94b27 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -38,6 +38,8 @@ static HANDLE stop_event; static void (WINAPI *pNDRSContextMarshall2)(RPC_BINDING_HANDLE, NDR_SCONTEXT, void*, NDR_RUNDOWN, void*, ULONG); static NDR_SCONTEXT (WINAPI *pNDRSContextUnmarshall2)(RPC_BINDING_HANDLE, void*, ULONG, void*, ULONG); +static RPC_STATUS (WINAPI *pRpcServerRegisterIfEx)(RPC_IF_HANDLE,UUID*, RPC_MGR_EPV*, unsigned int, + unsigned int,RPC_IF_CALLBACK_FN*); static void InitFunctionPointers(void) { @@ -45,6 +47,7 @@ static void InitFunctionPointers(void) pNDRSContextMarshall2 = (void *)GetProcAddress(hrpcrt4, "NDRSContextMarshall2"); pNDRSContextUnmarshall2 = (void *)GetProcAddress(hrpcrt4, "NDRSContextUnmarshall2"); + pRpcServerRegisterIfEx = (void *)GetProcAddress(hrpcrt4, "RpcServerRegisterIfEx"); } void __RPC_FAR *__RPC_USER @@ -1288,8 +1291,6 @@ server(void) static unsigned char np[] = "ncacn_np"; static unsigned char pipe[] = PIPE; RPC_STATUS status, iptcp_status, np_status; - RPC_STATUS (RPC_ENTRY *pRpcServerRegisterIfEx)(RPC_IF_HANDLE,UUID*, - RPC_MGR_EPV*, unsigned int,unsigned int,RPC_IF_CALLBACK_FN*); DWORD ret; iptcp_status = RpcServerUseProtseqEp(iptcp, 20, port, NULL); @@ -1300,7 +1301,6 @@ server(void) else ok(np_status == RPC_S_OK, "RpcServerUseProtseqEp(ncacn_np) failed with status %ld\n", np_status); - pRpcServerRegisterIfEx = (void *)GetProcAddress(GetModuleHandle("rpcrt4.dll"), "RpcServerRegisterIfEx"); if (pRpcServerRegisterIfEx) { trace("Using RpcServerRegisterIfEx\n"); diff --git a/dlls/setupapi/setupx.spec b/dlls/setupapi/setupx.spec index 7243a9749d7..590355fb633 100644 --- a/dlls/setupapi/setupx.spec +++ b/dlls/setupapi/setupx.spec @@ -154,7 +154,7 @@ 318 pascal -ret16 DiCreateDevRegKey (ptr ptr word str word) DiCreateDevRegKey16 319 pascal -ret16 DiOpenDevRegKey (ptr ptr word) DiOpenDevRegKey16 320 stub DiInstallDrvSection #(str str str str long) -321 stub DiInstallClass #(str long) +321 pascal -ret16 DiInstallClass (str long) DiInstallClass16 322 stub DiOpenClassRegKey #(ptr str) 323 stub Display_SetFontSize #(str) 324 stub Display_OpenFontSizeKey #(ptr) diff --git a/dlls/setupapi/setupx_main.c b/dlls/setupapi/setupx_main.c index 82593f37973..06903336683 100644 --- a/dlls/setupapi/setupx_main.c +++ b/dlls/setupapi/setupx_main.c @@ -587,6 +587,17 @@ RETERR16 WINAPI CtlGetLddPath16(LOGDISKID16 ldid, LPSTR szPath) } /*********************************************************************** + * DiInstallClass (SETUPX.321) + * + * Install Class from an INF file (in [ClassInstall] section) + */ +RETERR16 WINAPI DiInstallClass16(LPCSTR lpszInfFileName, DWORD dwFlags) +{ + FIXME("(%s, %u), stub.\n", lpszInfFileName, dwFlags); + return 0; +} + +/*********************************************************************** * CtlSetLddPath (SETUPX.508) * * Sets the path of an LDD. diff --git a/dlls/setupapi/tests/devinst.c b/dlls/setupapi/tests/devinst.c index ada602745ec..78b2ca3ec3a 100644 --- a/dlls/setupapi/tests/devinst.c +++ b/dlls/setupapi/tests/devinst.c @@ -150,7 +150,7 @@ static BOOL remove_device(void) } /* RegDeleteTreeW from dlls/advapi32/registry.c */ -LSTATUS WINAPI devinst_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey) +static LSTATUS devinst_RegDeleteTreeW(HKEY hKey, LPCWSTR lpszSubKey) { LONG ret; DWORD dwMaxSubkeyLen, dwMaxValueLen; diff --git a/dlls/setupapi/tests/misc.c b/dlls/setupapi/tests/misc.c index 7d0d2ea885b..60960b22969 100644 --- a/dlls/setupapi/tests/misc.c +++ b/dlls/setupapi/tests/misc.c @@ -160,8 +160,9 @@ static void test_SetupCopyOEMInf(void) res = pSetupCopyOEMInfA("", NULL, 0, SP_COPY_NOOVERWRITE, NULL, 0, NULL, NULL); ok(res == FALSE, "Expected FALSE, got %d\n", res); ok(GetLastError() == ERROR_FILE_NOT_FOUND || - GetLastError() == ERROR_BAD_PATHNAME, /* Win98 */ - "Expected ERROR_FILE_NOT_FOUND or ERROR_BAD_PATHNAME, got %d\n", GetLastError()); + GetLastError() == ERROR_BAD_PATHNAME || /* Win98 */ + GetLastError() == ERROR_INVALID_PARAMETER, /* Vista, W2K8 */ + "Unexpected error : %d\n", GetLastError()); /* try a relative nonexistent SourceInfFileName */ SetLastError(0xdeadbeef); @@ -196,6 +197,17 @@ 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) + { + /* 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"); + DeleteFile(tmpfile); + return; + } + ok(GetLastError() == ERROR_FILE_NOT_FOUND || GetLastError() == ERROR_FILE_EXISTS, /* Win98 */ "Expected ERROR_FILE_NOT_FOUND or ERROR_FILE_EXISTS, got %d\n", GetLastError()); diff --git a/dlls/shell32/dialogs.c b/dlls/shell32/dialogs.c index 844b8f48311..ac6bf211dcb 100644 --- a/dlls/shell32/dialogs.c +++ b/dlls/shell32/dialogs.c @@ -211,35 +211,29 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR if ((ic = GetWindowTextLengthW (htxt))) { WCHAR *psz, *parent=NULL ; - LPCWSTR working_dir ; + SHELLEXECUTEINFOW sei ; + + ZeroMemory (&sei, sizeof(sei)) ; + sei.cbSize = sizeof(sei) ; psz = HeapAlloc( GetProcessHeap(), 0, (ic + 1)*sizeof(WCHAR) ); GetWindowTextW (htxt, psz, ic + 1) ; /* according to http://www.codeproject.com/KB/shell/runfiledlg.aspx we should send a * WM_NOTIFY before execution */ + sei.hwnd = hwnd; + sei.nShow = SW_SHOWNORMAL; + sei.lpFile = psz; + if (prfdp->lpstrDirectory) - working_dir = prfdp->lpstrDirectory; + sei.lpDirectory = prfdp->lpstrDirectory; else - working_dir = parent = RunDlg_GetParentDir(psz); + sei.lpDirectory = parent = RunDlg_GetParentDir(sei.lpFile); - if (ShellExecuteW(hwnd, NULL, psz, NULL, working_dir, SW_SHOWNORMAL) < (HINSTANCE)33) + if (ShellExecuteExW( &sei ) < 33) { - char *pszSysMsg = NULL ; - char szMsg[256]; - FormatMessageA ( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM | - FORMAT_MESSAGE_IGNORE_INSERTS, - NULL, GetLastError (), - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPSTR)&pszSysMsg, 0, NULL - ) ; - sprintf (szMsg, "Error: %s", pszSysMsg) ; - LocalFree ((HLOCAL)pszSysMsg) ; - MessageBoxA (hwnd, szMsg, "Nix", MB_OK | MB_ICONEXCLAMATION) ; - HeapFree(GetProcessHeap(), 0, psz); + HeapFree(GetProcessHeap(), 0, parent); SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; return TRUE ; } diff --git a/dlls/shell32/regsvr.c b/dlls/shell32/regsvr.c index 028ca0ac97a..3f899173a41 100644 --- a/dlls/shell32/regsvr.c +++ b/dlls/shell32/regsvr.c @@ -1,6 +1,6 @@ /* * self-registerable dll functions for shell32.dll -* + * * Copyright (C) 2003 John K. Hohm * * This library is free software; you can redistribute it and/or @@ -37,6 +37,7 @@ #include "shfldr.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(ole); @@ -191,7 +192,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/shell32/shell32_Fr.rc b/dlls/shell32/shell32_Fr.rc index 4b235807af9..b8308fdbaa3 100644 --- a/dlls/shell32/shell32_Fr.rc +++ b/dlls/shell32/shell32_Fr.rc @@ -229,7 +229,7 @@ STRINGTABLE IDS_DELETEITEM_CAPTION "Confirmer la suppression du fichier" IDS_DELETEFOLDER_CAPTION "Confirmer la suppression du dossier" IDS_DELETEITEM_TEXT "Êtes-vous sûr de vouloir supprimer '%1'?" - IDS_DELETEMULTIPLE_TEXT "Êtes-vous sûr de vouloir supprimer ces %1 éléments ?" + IDS_DELETEMULTIPLE_TEXT "Êtes-vous sûr de vouloir supprimer ces %1 éléments ?" IDS_DELETESELECTED_TEXT "Êtes-vous sûr de vouloir supprimer le(les) élément(s) séléectionné(s) ?" IDS_TRASHITEM_TEXT "Êtes-vous sûr de vouloir mettre « %1 » dans la corbeille ?" IDS_TRASHFOLDER_TEXT "Êtes-vous sûr de vouloir mettre « %1 » et tout ce qu'il contient dans la corbeille ?" @@ -248,6 +248,12 @@ STRINGTABLE IDS_SHUTDOWN_TITLE "Arrêter" IDS_SHUTDOWN_PROMPT "Voulez-vous fermer la session Wine ?" + /* Run File dialog */ + IDS_RUNDLG_ERROR "Impossible d'afficher la boîte de dialogue « Exécuter » (erreur interne)" + IDS_RUNDLG_BROWSE_ERROR "Impossible d'afficher la boîte de dialogue « Parcourir » (erreur interne)" + IDS_RUNDLG_BROWSE_CAPTION "Parcourir" + IDS_RUNDLG_BROWSE_FILTER "Fichiers exécutables\0*.exe\0Tous les fichiers\0*.*\0\0" + /* shell folder path default values */ IDS_PROGRAMS "Menu Démarrer\\Programmes" IDS_PERSONAL "Mes documents" diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index 515bb48648c..8a656364387 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -1447,6 +1447,16 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wFile, LPCWSTR wcmd, return retval; } +static void do_error_dialog( UINT_PTR retval, HWND hwnd ) +{ + WCHAR msg[2048]; + int error_code=GetLastError(); + + FormatMessageW(FORMAT_MESSAGE_FROM_SYSTEM, NULL, error_code, 0, msg, sizeof(msg)/sizeof(WCHAR), NULL); + + MessageBoxW(hwnd, msg, NULL, MB_ICONERROR); +} + /************************************************************************* * SHELL_execute [Internal] */ @@ -1458,7 +1468,7 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) static const WCHAR wHttp[] = {'h','t','t','p',':','/','/',0}; static const DWORD unsupportedFlags = SEE_MASK_INVOKEIDLIST | SEE_MASK_ICON | SEE_MASK_HOTKEY | - SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI | + SEE_MASK_CONNECTNETDRV | SEE_MASK_FLAG_DDEWAIT | SEE_MASK_UNICODE | SEE_MASK_ASYNCOK | SEE_MASK_HMONITOR; WCHAR parametersBuffer[1024], dirBuffer[MAX_PATH], wcmdBuffer[1024]; @@ -1592,6 +1602,8 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) { retval = SHELL_execute_class( wszApplicationName, &sei_tmp, sei, execfunc ); + if (retval <= 32 && !(sei_tmp.fMask & SEE_MASK_FLAG_NO_UI)) + do_error_dialog(retval, sei_tmp.hwnd); HeapFree(GetProcessHeap(), 0, wszApplicationName); if (wszParameters != parametersBuffer) HeapFree(GetProcessHeap(), 0, wszParameters); @@ -1815,6 +1827,9 @@ BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) HeapFree(GetProcessHeap(), 0, wcmd); sei->hInstApp = (HINSTANCE)(retval > 32 ? 33 : retval); + + if (retval <= 32 && !(sei_tmp.fMask & SEE_MASK_FLAG_NO_UI)) + do_error_dialog(retval, sei_tmp.hwnd); return retval > 32; } @@ -1831,7 +1846,7 @@ HINSTANCE WINAPI ShellExecuteA(HWND hWnd, LPCSTR lpOperation,LPCSTR lpFile, debugstr_a(lpParameters), debugstr_a(lpDirectory), iShowCmd); sei.cbSize = sizeof(sei); - sei.fMask = 0; + sei.fMask = SEE_MASK_FLAG_NO_UI; sei.hwnd = hWnd; sei.lpVerb = lpOperation; sei.lpFile = lpFile; @@ -1917,7 +1932,7 @@ HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpOperation, LPCWSTR lpFile, TRACE("\n"); sei.cbSize = sizeof(sei); - sei.fMask = 0; + sei.fMask = SEE_MASK_FLAG_NO_UI; sei.hwnd = hwnd; sei.lpVerb = lpOperation; sei.lpFile = lpFile; diff --git a/dlls/shlwapi/tests/shreg.c b/dlls/shlwapi/tests/shreg.c index 77a47e2240c..f088c2eb0a1 100644 --- a/dlls/shlwapi/tests/shreg.c +++ b/dlls/shlwapi/tests/shreg.c @@ -31,7 +31,7 @@ /* Keys used for testing */ #define REG_TEST_KEY "Software\\Wine\\Test" -#define REG_CURRENT_VERSION "Software\\Microsoft\\Windows\\CurrentVersion" +#define REG_CURRENT_VERSION "Software\\Microsoft\\Windows\\CurrentVersion\\explorer" static HMODULE hshlwapi; typedef DWORD (WINAPI *SHCopyKeyA_func)(HKEY,LPCSTR,HKEY,DWORD); @@ -284,6 +284,12 @@ static void test_SHCopyKey(void) HKEY hKeySrc, hKeyDst; DWORD dwRet; + if (!pSHCopyKeyA) + { + win_skip("SHCopyKeyA is not available\n"); + return; + } + /* Delete existing destination sub keys */ hKeyDst = NULL; if (!RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination", &hKeyDst) && hKeyDst) @@ -305,22 +311,19 @@ static void test_SHCopyKey(void) if (dwRet || !hKeySrc) { ok( 0, "Source couldn't be opened, RegOpenKeyA returned (%u)\n", dwRet); + RegCloseKey(hKeyDst); return; } - - if (pSHCopyKeyA) - { - dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0); - ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%u)\n", dwRet); - } + dwRet = (*pSHCopyKeyA)(hKeySrc, NULL, hKeyDst, 0); + ok ( ERROR_SUCCESS == dwRet, "Copy failed, ret=(%u)\n", dwRet); RegCloseKey(hKeySrc); RegCloseKey(hKeyDst); /* Check we copied the sub keys, i.e. something that's on every windows system (including Wine) */ hKeyDst = NULL; - dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination\\Setup", &hKeyDst); + dwRet = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\\CopyDestination\\Shell Folders", &hKeyDst); if (dwRet || !hKeyDst) { ok ( 0, "Copy couldn't be opened, RegOpenKeyA returned (%u)\n", dwRet); @@ -328,7 +331,7 @@ static void test_SHCopyKey(void) } /* And the we copied the values too */ - ok(!SHQueryValueExA(hKeyDst, "BootDir", NULL, NULL, NULL, NULL), "SHQueryValueExA failed\n"); + ok(!SHQueryValueExA(hKeyDst, "Common AppData", NULL, NULL, NULL, NULL), "SHQueryValueExA failed\n"); RegCloseKey(hKeyDst); } diff --git a/dlls/urlmon/regsvr.c b/dlls/urlmon/regsvr.c index 2fabcc0a8da..2728cedac7a 100644 --- a/dlls/urlmon/regsvr.c +++ b/dlls/urlmon/regsvr.c @@ -26,6 +26,7 @@ #include "advpub.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(urlmon); @@ -152,7 +153,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); diff --git a/dlls/urlmon/tests/url.c b/dlls/urlmon/tests/url.c index 631127b62e2..830ef1a1f49 100644 --- a/dlls/urlmon/tests/url.c +++ b/dlls/urlmon/tests/url.c @@ -2321,7 +2321,7 @@ static void test_BindToObject(int protocol, BOOL emul) todo_wine ok(IMoniker_Release(mon) == 0, "mon should be destroyed here\n"); if(bindf & BINDF_ASYNCHRONOUS) - ok(IBindCtx_Release(bctx) != 0, "bctx should not be destroyed here\n"); + IBindCtx_Release(bctx); else todo_wine ok(IBindCtx_Release(bctx) == 0, "bctx should be destroyed here\n"); } diff --git a/dlls/user32/driver.c b/dlls/user32/driver.c index ed3375fd5d3..2f20b416528 100644 --- a/dlls/user32/driver.c +++ b/dlls/user32/driver.c @@ -77,7 +77,6 @@ static const USER_DRIVER *load_driver(void) GET_USER_FUNC(GetAsyncKeyState); GET_USER_FUNC(GetKeyNameText); GET_USER_FUNC(GetKeyboardLayout); - GET_USER_FUNC(GetKeyboardLayoutList); GET_USER_FUNC(GetKeyboardLayoutName); GET_USER_FUNC(LoadKeyboardLayout); GET_USER_FUNC(MapVirtualKeyEx); @@ -177,11 +176,6 @@ static HKL nulldrv_GetKeyboardLayout( DWORD layout ) return 0; } -static UINT nulldrv_GetKeyboardLayoutList( INT count, HKL *layouts ) -{ - return 0; -} - static BOOL nulldrv_GetKeyboardLayoutName( LPWSTR name ) { return FALSE; @@ -436,7 +430,6 @@ static USER_DRIVER null_driver = nulldrv_GetAsyncKeyState, nulldrv_GetKeyNameText, nulldrv_GetKeyboardLayout, - nulldrv_GetKeyboardLayoutList, nulldrv_GetKeyboardLayoutName, nulldrv_LoadKeyboardLayout, nulldrv_MapVirtualKeyEx, @@ -524,11 +517,6 @@ static HKL loaderdrv_GetKeyboardLayout( DWORD layout ) return load_driver()->pGetKeyboardLayout( layout ); } -static UINT loaderdrv_GetKeyboardLayoutList( INT count, HKL *layouts ) -{ - return load_driver()->pGetKeyboardLayoutList( count, layouts ); -} - static BOOL loaderdrv_GetKeyboardLayoutName( LPWSTR name ) { return load_driver()->pGetKeyboardLayoutName( name ); @@ -783,7 +771,6 @@ static USER_DRIVER lazy_load_driver = loaderdrv_GetAsyncKeyState, loaderdrv_GetKeyNameText, loaderdrv_GetKeyboardLayout, - loaderdrv_GetKeyboardLayoutList, loaderdrv_GetKeyboardLayoutName, loaderdrv_LoadKeyboardLayout, loaderdrv_MapVirtualKeyEx, diff --git a/dlls/user32/input.c b/dlls/user32/input.c index 625ecdcbae6..2b11c7d4196 100644 --- a/dlls/user32/input.c +++ b/dlls/user32/input.c @@ -45,6 +45,7 @@ #include "user_private.h" #include "wine/server.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(win); WINE_DECLARE_DEBUG_CHANNEL(keyboard); @@ -800,9 +801,62 @@ BOOL WINAPI BlockInput(BOOL fBlockIt) */ UINT WINAPI GetKeyboardLayoutList(INT nBuff, HKL *layouts) { + HKEY hKeyKeyboard; + DWORD rc; + INT count = 0; + ULONG_PTR baselayout; + LANGID langid; + static const WCHAR szKeyboardReg[] = {'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','\\','K','e','y','b','o','a','r','d',' ','L','a','y','o','u','t','s',0}; + TRACE_(keyboard)("(%d,%p)\n",nBuff,layouts); - return USER_Driver->pGetKeyboardLayoutList(nBuff, layouts); + baselayout = GetUserDefaultLCID(); + langid = PRIMARYLANGID(LANGIDFROMLCID(baselayout)); + if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN) + baselayout |= 0xe001 << 16; /* IME */ + else + baselayout |= baselayout << 16; + + /* Enumerate the Registry */ + rc = RegOpenKeyW(HKEY_LOCAL_MACHINE,szKeyboardReg,&hKeyKeyboard); + if (rc == ERROR_SUCCESS) + { + do { + WCHAR szKeyName[9]; + HKL layout; + rc = RegEnumKeyW(hKeyKeyboard, count, szKeyName, 9); + if (rc == ERROR_SUCCESS) + { + layout = (HKL)strtoulW(szKeyName,NULL,16); + if (baselayout != 0 && layout == (HKL)baselayout) + baselayout = 0; /* found in the registry do not add again */ + if (nBuff && layouts) + { + if (count >= nBuff ) break; + layouts[count] = layout; + } + count ++; + } + } while (rc == ERROR_SUCCESS); + RegCloseKey(hKeyKeyboard); + } + + /* make sure our base layout is on the list */ + if (baselayout != 0) + { + if (nBuff && layouts) + { + if (count < nBuff) + { + layouts[count] = (HKL)baselayout; + count++; + } + } + else + count++; + } + + return count; } diff --git a/dlls/user32/menu.c b/dlls/user32/menu.c index ed93effc882..3fbb941b138 100644 --- a/dlls/user32/menu.c +++ b/dlls/user32/menu.c @@ -1111,7 +1111,7 @@ static void MENU_PopupMenuCalcSize( LPPOPUPMENU lppop ) { MENUITEM *lpitem; HDC hdc; - int start, i; + UINT start, i; int orgX, orgY, maxX, maxTab, maxTabWidth, maxHeight; lppop->Width = lppop->Height = 0; @@ -1199,7 +1199,8 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect, LPPOPUPMENU lppop, HWND hwndOwner ) { MENUITEM *lpitem; - int start, i, orgX, orgY, maxY, helpPos; + UINT start, i, helpPos; + int orgX, orgY, maxY; if ((lprect == NULL) || (lppop == NULL)) return; if (lppop->nItems == 0) return; @@ -1208,7 +1209,7 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect, lppop->Height = 0; maxY = lprect->top+1; start = 0; - helpPos = -1; + helpPos = ~0U; lppop->maxBmpSize.cx = 0; lppop->maxBmpSize.cy = 0; while (start < lppop->nItems) @@ -1220,7 +1221,7 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect, /* Parse items until line break or end of menu */ for (i = start; i < lppop->nItems; i++, lpitem++) { - if ((helpPos == -1) && (lpitem->fType & MF_RIGHTJUSTIFY)) helpPos = i; + if ((helpPos == ~0U) && (lpitem->fType & MF_RIGHTJUSTIFY)) helpPos = i; if ((i != start) && (lpitem->fType & (MF_MENUBREAK | MF_MENUBARBREAK))) break; @@ -1246,12 +1247,11 @@ static void MENU_MenuBarCalcSize( HDC hdc, LPRECT lprect, /* Flush right all items between the MF_RIGHTJUSTIFY and */ /* the last item (if several lines, only move the last line) */ + if (helpPos == ~0U) return; lpitem = &lppop->items[lppop->nItems-1]; orgY = lpitem->rect.top; orgX = lprect->right; for (i = lppop->nItems - 1; i >= helpPos; i--, lpitem--) { - if ( (helpPos==-1) || (helpPos>i) ) - break; /* done */ if (lpitem->rect.top != orgY) break; /* Other line */ if (lpitem->rect.right >= orgX) break; /* Too far right already */ lpitem->rect.left += orgX - lpitem->rect.right; @@ -2671,7 +2671,7 @@ static LRESULT MENU_DoNextMenu( MTRACKER* pmt, UINT vk, UINT wFlags ) icons such as MDI maximize, restore or close) */ else if ((vk == VK_RIGHT) && !IS_SYSTEM_MENU(menu)) { - int i = menu->FocusedItem + 1; + UINT i = menu->FocusedItem + 1; while (i < menu->nItems) { if ((menu->items[i].wID >= SC_SIZE && menu->items[i].wID <= SC_RESTORE)) { diff --git a/dlls/user32/spy.c b/dlls/user32/spy.c index 2aed05755e3..59fa410c808 100644 --- a/dlls/user32/spy.c +++ b/dlls/user32/spy.c @@ -2653,7 +2653,8 @@ void SPY_ExitMessage( INT iFlag, HWND hWnd, UINT msg, LRESULT lReturn, */ int SPY_Init(void) { - int i, j; + int i; + UINT j; char buffer[1024]; const SPY_NOTIFY *p; const USER_MSG *q; @@ -2700,7 +2701,7 @@ int SPY_Init(void) p = &spnfy_array[0]; j = 0xffffffff; while (p->name) { - if ((UINT)p->value > (UINT)j) { + if (p->value > j) { ERR("Notify message array out of order\n"); ERR(" between values [%08x] %s and [%08x] %s\n", j, (p-1)->name, p->value, p->name); diff --git a/dlls/user32/sysparams.c b/dlls/user32/sysparams.c index 5c3bec56db6..4e482998f9c 100644 --- a/dlls/user32/sysparams.c +++ b/dlls/user32/sysparams.c @@ -368,7 +368,7 @@ static const WORD wPattern55AA[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xa HBRUSH SYSCOLOR_55AABrush = 0; -extern void __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set ); +extern void CDECL __wine_make_gdi_object_system( HGDIOBJ handle, BOOL set ); /* This function is a copy of the one in objects/font.c */ diff --git a/dlls/user32/tests/win.c b/dlls/user32/tests/win.c index ffbb8d2c183..0d9d4264243 100644 --- a/dlls/user32/tests/win.c +++ b/dlls/user32/tests/win.c @@ -5431,4 +5431,7 @@ START_TEST(win) /* add the tests above this line */ UnhookWindowsHookEx(hhook); + + DestroyWindow(hwndMain2); + DestroyWindow(hwndMain); } diff --git a/dlls/user32/user_private.h b/dlls/user32/user_private.h index 744a1412c4a..f25f258f495 100644 --- a/dlls/user32/user_private.h +++ b/dlls/user32/user_private.h @@ -109,7 +109,6 @@ typedef struct tagUSER_DRIVER { SHORT (*pGetAsyncKeyState)(INT); INT (*pGetKeyNameText)(LONG, LPWSTR, INT); HKL (*pGetKeyboardLayout)(DWORD); - UINT (*pGetKeyboardLayoutList)(INT, HKL *); BOOL (*pGetKeyboardLayoutName)(LPWSTR); HKL (*pLoadKeyboardLayout)(LPCWSTR, UINT); UINT (*pMapVirtualKeyEx)(UINT, UINT, HKL); diff --git a/dlls/winealsa.drv/midi.c b/dlls/winealsa.drv/midi.c index cabe9e2a1cb..dedfe0215ce 100644 --- a/dlls/winealsa.drv/midi.c +++ b/dlls/winealsa.drv/midi.c @@ -578,7 +578,10 @@ static DWORD midAddBuffer(WORD wDevID, LPMIDIHDR lpMidiHdr, DWORD dwSize) if (!(lpMidiHdr->dwFlags & MHDR_PREPARED)) return MIDIERR_UNPREPARED; EnterCriticalSection(&crit_sect); + lpMidiHdr->dwFlags &= ~WHDR_DONE; lpMidiHdr->dwFlags |= MHDR_INQUEUE; + lpMidiHdr->dwBytesRecorded = 0; + lpMidiHdr->lpNext = 0; if (MidiInDev[wDevID].lpQueueHdr == 0) { MidiInDev[wDevID].lpQueueHdr = lpMidiHdr; } else { @@ -1311,7 +1314,7 @@ LONG ALSA_MidiInit(void) } /************************************************************************** - * midMessage (WINEOSS.4) + * midMessage (WINEALSA.@) */ DWORD WINAPI ALSA_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2) @@ -1354,7 +1357,7 @@ DWORD WINAPI ALSA_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, } /************************************************************************** - * modMessage (WINEOSS.5) + * modMessage (WINEALSA.@) */ DWORD WINAPI ALSA_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2) diff --git a/dlls/wineaudioio.drv/wineaudioio.drv.spec b/dlls/wineaudioio.drv/wineaudioio.drv.spec index 0424687a9e7..174c49a58f1 100644 --- a/dlls/wineaudioio.drv/wineaudioio.drv.spec +++ b/dlls/wineaudioio.drv/wineaudioio.drv.spec @@ -1,2 +1,3 @@ @ stdcall -private DriverProc(long long long long long) LIBAUDIOIO_DriverProc +@ stdcall -private widMessage(long long long long long) LIBAUDIOIO_widMessage @ stdcall -private wodMessage(long long long long long) LIBAUDIOIO_wodMessage diff --git a/dlls/wined3d/Makefile.in b/dlls/wined3d/Makefile.in index dd0984ef6f7..1653fdec8d5 100644 --- a/dlls/wined3d/Makefile.in +++ b/dlls/wined3d/Makefile.in @@ -17,6 +17,7 @@ C_SRCS = \ device.c \ directx.c \ drawprim.c \ + gl_compat.c \ glsl_shader.c \ indexbuffer.c \ nvidia_texture_shader.c \ diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index f03e23b139e..b31590ae199 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -70,6 +70,7 @@ struct shader_arb_priv { static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, const WineD3D_GL_Info *gl_info, GLuint target_type, unsigned int max_constants, const float *constants, char *dirty_consts) { + DWORD shader_version = This->baseShader.reg_maps.shader_version; local_constant* lconst; DWORD i, j; unsigned int ret; @@ -83,8 +84,8 @@ static unsigned int shader_arb_load_constantsF(IWineD3DBaseShaderImpl* This, con } } /* In 1.X pixel shaders constants are implicitly clamped in the range [-1;1] */ - if(target_type == GL_FRAGMENT_PROGRAM_ARB && - WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1) { + if (target_type == GL_FRAGMENT_PROGRAM_ARB && WINED3DSHADER_VERSION_MAJOR(shader_version) == 1) + { float lcl_const[4]; for(i = 0; i < max_constants; i++) { if(!dirty_consts[i]) continue; @@ -225,6 +226,28 @@ static void shader_arb_load_constants( } } +static void shader_arb_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count) +{ + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + + /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active + * context. On a context switch the old context will be fully dirtified */ + memset(This->activeContext->vshader_const_dirty + start, 1, + sizeof(*This->activeContext->vshader_const_dirty) * count); + This->highest_dirty_vs_const = max(This->highest_dirty_vs_const, start + count + 1); +} + +static void shader_arb_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count) +{ + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + + /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active + * context. On a context switch the old context will be fully dirtified */ + memset(This->activeContext->pshader_const_dirty + start, 1, + sizeof(*This->activeContext->pshader_const_dirty) * count); + This->highest_dirty_ps_const = max(This->highest_dirty_ps_const, start + count + 1); +} + /* Generate the variable & register declarations for the ARB_vertex_program output target */ static void shader_generate_arb_declarations(IWineD3DBaseShader *iface, const shader_reg_maps *reg_maps, SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_info) @@ -232,7 +255,7 @@ static void shader_generate_arb_declarations(IWineD3DBaseShader *iface, const sh IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface; IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; DWORD i, cur; - char pshader = shader_is_pshader_version(This->baseShader.hex_version); + char pshader = shader_is_pshader_version(reg_maps->shader_version); unsigned max_constantsF = min(This->baseShader.limits.constant_float, (pshader ? GL_LIMITS(pshader_constantsF) : GL_LIMITS(vshader_constantsF))); UINT extra_constants_needed = 0; @@ -360,9 +383,8 @@ static const char * const shift_tab[] = { static void shader_arb_get_write_mask(const SHADER_OPCODE_ARG *arg, const DWORD param, char *write_mask) { - IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *) arg->shader; char *ptr = write_mask; - char vshader = shader_is_vshader_version(This->baseShader.hex_version); + char vshader = shader_is_vshader_version(arg->reg_maps->shader_version); if(vshader && shader_get_regtype(param) == WINED3DSPR_ADDR) { *ptr++ = '.'; @@ -787,7 +809,6 @@ static void pshader_hw_bem(const SHADER_OPCODE_ARG *arg) static void pshader_hw_cnd(const SHADER_OPCODE_ARG *arg) { - IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader; SHADER_BUFFER* buffer = arg->buffer; char dst_wmask[20]; char dst_name[50]; @@ -807,8 +828,8 @@ static void pshader_hw_cnd(const SHADER_OPCODE_ARG *arg) pshader_gen_input_modifier_line(arg->shader, buffer, arg->src[2], 2, src_name[2]); /* The coissue flag changes the semantic of the cnd instruction in <= 1.3 shaders */ - if (shader->baseShader.hex_version <= WINED3DPS_VERSION(1, 3) && - arg->opcode_token & WINED3DSI_COISSUE) { + if (arg->reg_maps->shader_version <= WINED3DPS_VERSION(1, 3) && arg->opcode_token & WINED3DSI_COISSUE) + { shader_addline(buffer, "MOV%s %s%s, %s;\n", sat ? "_SAT" : "", dst_name, dst_wmask, src_name[1]); } else { shader_addline(buffer, "ADD TMP, -%s, coefdiv.x;\n", src_name[0]); @@ -877,7 +898,6 @@ static void pshader_hw_dp2add(const SHADER_OPCODE_ARG *arg) /* Map the opcode 1-to-1 to the GL code */ static void shader_hw_map2gl(const SHADER_OPCODE_ARG *arg) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl*)arg->shader; CONST SHADER_OPCODE* curOpcode = arg->opcode; SHADER_BUFFER* buffer = arg->buffer; DWORD dst = arg->dst; @@ -885,7 +905,7 @@ static void shader_hw_map2gl(const SHADER_OPCODE_ARG *arg) char arguments[256]; unsigned int i; - if (shader_is_pshader_version(shader->baseShader.hex_version)) + if (shader_is_pshader_version(arg->reg_maps->shader_version)) { /* Output token related */ char output_rname[256]; @@ -963,8 +983,8 @@ static void shader_hw_mov(const SHADER_OPCODE_ARG *arg) { IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl*)arg->shader; - if ((WINED3DSHADER_VERSION_MAJOR(shader->baseShader.hex_version) == 1 - && !shader_is_pshader_version(shader->baseShader.hex_version) + if ((WINED3DSHADER_VERSION_MAJOR(arg->reg_maps->shader_version) == 1 + && !shader_is_pshader_version(arg->reg_maps->shader_version) && shader_get_regtype(arg->dst) == WINED3DSPR_ADDR) || arg->opcode->opcode == WINED3DSIO_MOVA) { @@ -1008,8 +1028,7 @@ static void shader_hw_mov(const SHADER_OPCODE_ARG *arg) static void pshader_hw_texkill(const SHADER_OPCODE_ARG *arg) { - IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader; - DWORD hex_version = This->baseShader.hex_version; + DWORD shader_version = arg->reg_maps->shader_version; SHADER_BUFFER* buffer = arg->buffer; char reg_dest[40]; @@ -1018,7 +1037,8 @@ static void pshader_hw_texkill(const SHADER_OPCODE_ARG *arg) */ pshader_get_register_name(arg->shader, arg->dst, reg_dest); - if(hex_version >= WINED3DPS_VERSION(2,0)) { + if (shader_version >= WINED3DPS_VERSION(2,0)) + { /* The arb backend doesn't claim ps 2.0 support, but try to eat what the app feeds to us */ shader_addline(buffer, "KIL %s;\n", reg_dest); } else { @@ -1039,7 +1059,7 @@ static void pshader_hw_tex(const SHADER_OPCODE_ARG *arg) DWORD dst = arg->dst; const DWORD *src = arg->src; SHADER_BUFFER* buffer = arg->buffer; - DWORD hex_version = This->baseShader.hex_version; + DWORD shader_version = arg->reg_maps->shader_version; BOOL projected = FALSE, bias = FALSE; char reg_dest[40]; @@ -1053,14 +1073,14 @@ static void pshader_hw_tex(const SHADER_OPCODE_ARG *arg) /* 1.0-1.3: Use destination register as coordinate source. 1.4+: Use provided coordinate source register. */ - if (hex_version < WINED3DPS_VERSION(1,4)) + if (shader_version < WINED3DPS_VERSION(1,4)) strcpy(reg_coord, reg_dest); else pshader_gen_input_modifier_line(arg->shader, buffer, src[0], 0, reg_coord); /* 1.0-1.4: Use destination register number as texture code. 2.0+: Use provided sampler number as texure code. */ - if (hex_version < WINED3DPS_VERSION(2,0)) + if (shader_version < WINED3DPS_VERSION(2,0)) reg_sampler_code = reg_dest_code; else reg_sampler_code = src[1] & WINED3DSP_REGNUM_MASK; @@ -1070,7 +1090,8 @@ static void pshader_hw_tex(const SHADER_OPCODE_ARG *arg) * 1.4: Use WINED3DSPSM_DZ or WINED3DSPSM_DW on src[0] * 2.0+: Use WINED3DSI_TEXLD_PROJECT on the opcode */ - if(hex_version < WINED3DPS_VERSION(1,4)) { + if (shader_version < WINED3DPS_VERSION(1,4)) + { DWORD flags = 0; if(reg_sampler_code < MAX_TEXTURES) { flags = deviceImpl->stateBlock->textureState[reg_sampler_code][WINED3DTSS_TEXTURETRANSFORMFLAGS]; @@ -1078,7 +1099,9 @@ static void pshader_hw_tex(const SHADER_OPCODE_ARG *arg) if (flags & WINED3DTTFF_PROJECTED) { projected = TRUE; } - } else if(hex_version < WINED3DPS_VERSION(2,0)) { + } + else if (shader_version < WINED3DPS_VERSION(2,0)) + { DWORD src_mod = arg->src[0] & WINED3DSP_SRCMOD_MASK; if (src_mod == WINED3DSPSM_DZ) { projected = TRUE; @@ -1098,14 +1121,13 @@ static void pshader_hw_tex(const SHADER_OPCODE_ARG *arg) static void pshader_hw_texcoord(const SHADER_OPCODE_ARG *arg) { - IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader; DWORD dst = arg->dst; SHADER_BUFFER* buffer = arg->buffer; - DWORD hex_version = This->baseShader.hex_version; char tmp[20]; shader_arb_get_write_mask(arg, dst, tmp); - if (hex_version != WINED3DPS_VERSION(1,4)) { + if (arg->reg_maps->shader_version != WINED3DPS_VERSION(1,4)) + { DWORD reg = dst & WINED3DSP_REGNUM_MASK; shader_addline(buffer, "MOV_SAT T%u%s, fragment.texcoord[%u];\n", reg, tmp, reg); } else { @@ -1487,7 +1509,7 @@ static void shader_hw_mnxn(const SHADER_OPCODE_ARG *arg) SHADER_OPCODE_ARG tmpArg; IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)arg->shader; const SHADER_OPCODE *opcode_table = shader->baseShader.shader_ins; - DWORD shader_version = shader->baseShader.hex_version; + DWORD shader_version = arg->reg_maps->shader_version; memset(&tmpArg, 0, sizeof(SHADER_OPCODE_ARG)); @@ -1777,19 +1799,12 @@ static void shader_arb_deselect_depth_blt(IWineD3DDevice *iface) { } } -static void shader_arb_cleanup(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const WineD3D_GL_Info *gl_info = &This->adapter->gl_info; - if (GL_SUPPORT(ARB_VERTEX_PROGRAM)) glDisable(GL_VERTEX_PROGRAM_ARB); - if (GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) glDisable(GL_FRAGMENT_PROGRAM_ARB); -} - static void shader_arb_destroy(IWineD3DBaseShader *iface) { IWineD3DBaseShaderImpl *baseShader = (IWineD3DBaseShaderImpl *) iface; const WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)baseShader->baseShader.device)->adapter->gl_info; - char pshader = shader_is_pshader_version(baseShader->baseShader.hex_version); - if(pshader) { + if (shader_is_pshader_version(baseShader->baseShader.reg_maps.shader_version)) + { IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *) iface; UINT i; @@ -1864,10 +1879,11 @@ static void arbfp_add_sRGB_correction(SHADER_BUFFER *buffer, const char *fragcol /* [0.0;1.0] clamping. Not needed, this is done implicitly */ } -static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) { +static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer, const struct ps_compile_args *args) { IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface; const shader_reg_maps* reg_maps = &This->baseShader.reg_maps; CONST DWORD *function = This->baseShader.function; + DWORD shader_version = reg_maps->shader_version; const char *fragcolor; const WineD3D_GL_Info *gl_info = &((IWineD3DDeviceImpl *)This->baseShader.device)->adapter->gl_info; const local_constant *lconst; @@ -1889,31 +1905,43 @@ static GLuint shader_arb_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUF shader_generate_arb_declarations( (IWineD3DBaseShader*) This, reg_maps, buffer, &GLINFO_LOCATION); /* We need two variables for fog blending */ - shader_addline(buffer, "TEMP TMP_FOG;\n"); - if (This->baseShader.hex_version >= WINED3DPS_VERSION(2,0)) { - shader_addline(buffer, "TEMP TMP_COLOR;\n"); - } + if(args->fog != FOG_OFF) shader_addline(buffer, "TEMP TMP_FOG;\n"); + if (shader_version >= WINED3DPS_VERSION(2,0)) shader_addline(buffer, "TEMP TMP_COLOR;\n"); /* Base Shader Body */ shader_generate_main( (IWineD3DBaseShader*) This, buffer, reg_maps, function); - /* calculate fog and blend it - * NOTE: state.fog.params.y and state.fog.params.z don't hold fog start s and end e but - * -1/(e-s) and e/(e-s) respectively. - */ - shader_addline(buffer, "MAD_SAT TMP_FOG, fragment.fogcoord, state.fog.params.y, state.fog.params.z;\n"); - - if (This->baseShader.hex_version < WINED3DPS_VERSION(2,0)) { + if (shader_version < WINED3DPS_VERSION(2,0)) { fragcolor = "R0"; } else { fragcolor = "TMP_COLOR"; } - if(((IWineD3DDeviceImpl *)This->baseShader.device)->stateBlock->renderState[WINED3DRS_SRGBWRITEENABLE]) { + if(args->srgb_correction) { arbfp_add_sRGB_correction(buffer, fragcolor, "TMP", "TMP2", "TA", "TB"); } - if (This->baseShader.hex_version < WINED3DPS_VERSION(3,0)) { - shader_addline(buffer, "LRP result.color.rgb, TMP_FOG.x, %s, state.fog.color;\n", fragcolor); - shader_addline(buffer, "MOV result.color.a, %s.a;\n", fragcolor); + if (shader_version < WINED3DPS_VERSION(3,0)) { + /* calculate fog and blend it + * NOTE: state.fog.params.y and state.fog.params.z don't hold fog start s and end e but + * -1/(e-s) and e/(e-s) respectively. + */ + switch(args->fog) { + case FOG_OFF: + shader_addline(buffer, "MOV result.color, %s;\n", fragcolor); + break; + case FOG_LINEAR: + shader_addline(buffer, "MAD_SAT TMP_FOG, fragment.fogcoord, state.fog.params.y, state.fog.params.z;\n"); + shader_addline(buffer, "LRP result.color.rgb, TMP_FOG.x, %s, state.fog.color;\n", fragcolor); + shader_addline(buffer, "MOV result.color.a, %s.a;\n", fragcolor); + break; + case FOG_EXP: + FIXME("Implement EXP fog in ARB\n"); + shader_addline(buffer, "MOV result.color, %s;\n", fragcolor); + break; + case FOG_EXP2: + FIXME("Implement EXP2 fog in ARB\n"); + shader_addline(buffer, "MOV result.color, %s;\n", fragcolor); + break; + } } shader_addline(buffer, "END\n"); @@ -2185,8 +2213,9 @@ const shader_backend_t arb_program_shader_backend = { shader_arb_select, shader_arb_select_depth_blt, shader_arb_deselect_depth_blt, + shader_arb_update_float_vertex_constants, + shader_arb_update_float_pixel_constants, shader_arb_load_constants, - shader_arb_cleanup, shader_arb_color_correction, shader_arb_destroy, shader_arb_alloc, @@ -2508,7 +2537,7 @@ static void gen_ffp_instr(SHADER_BUFFER *buffer, unsigned int stage, BOOL color, switch(op) { case WINED3DTOP_DISABLE: - if(stage == 1) shader_addline(buffer, "MOV %s%s, fragment.color.primary;\n", dstreg, dstmask); + if(stage == 0) shader_addline(buffer, "MOV %s%s, fragment.color.primary;\n", dstreg, dstmask); break; case WINED3DTOP_SELECTARG2: @@ -2906,6 +2935,8 @@ static void fragment_prog_arbfp(DWORD state, IWineD3DStateBlockImpl *stateblock, } state_texfactor_arbfp(STATE_RENDER(WINED3DRS_TEXTUREFACTOR), stateblock, context); state_arb_specularenable(STATE_RENDER(WINED3DRS_SPECULARENABLE), stateblock, context); + } else if(use_pshader && !isStateDirty(context, device->StateTable[STATE_VSHADER].representative)) { + device->shader_backend->shader_select((IWineD3DDevice *)stateblock->wineD3DDevice, use_pshader, use_vshader); } return; } diff --git a/dlls/wined3d/ati_fragment_shader.c b/dlls/wined3d/ati_fragment_shader.c index 19334765368..b4c53343e9b 100644 --- a/dlls/wined3d/ati_fragment_shader.c +++ b/dlls/wined3d/ati_fragment_shader.c @@ -881,6 +881,30 @@ static void textransform(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3 } } +static void atifs_apply_pixelshader(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { + IWineD3DDeviceImpl *device = stateblock->wineD3DDevice; + BOOL use_vshader = use_vs(device); + + /* The ATIFS code does not support pixel shaders currently, but we have to provide a state handler + * to call shader_select to select a vertex shader if one is applied because the vertex shader state + * may defer calling the shader backend if the pshader state is dirty. + * + * In theory the application should not be able to mark the pixel shader dirty because it cannot + * create a shader, and thus has no way to set the state to something != NULL. However, a different + * pipeline part may link a different state to its pixelshader handler, thus a pshader state exists + * and can be dirtified. Also the pshader is always dirtified at startup, and blitting disables all + * shaders and dirtifies all shader states. If atifs can deal with this it keeps the rest of the code + * simpler. + */ + if(!isStateDirty(context, device->StateTable[STATE_VSHADER].representative)) { + device->shader_backend->shader_select((IWineD3DDevice *)stateblock->wineD3DDevice, FALSE, use_vshader); + + if (!isStateDirty(context, STATE_VERTEXSHADERCONSTANT) && use_vshader) { + device->StateTable[STATE_VERTEXSHADERCONSTANT].apply(STATE_VERTEXSHADERCONSTANT, stateblock, context); + } + } +} + #undef GLINFO_LOCATION static const struct StateEntryTemplate atifs_fragmentstate_template[] = { @@ -1005,6 +1029,7 @@ static const struct StateEntryTemplate atifs_fragmentstate_template[] = { {STATE_TEXTURESTAGE(5,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(5, WINED3DTSS_TEXTURETRANSFORMFLAGS), textransform }, 0 }, {STATE_TEXTURESTAGE(6,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(6, WINED3DTSS_TEXTURETRANSFORMFLAGS), textransform }, 0 }, {STATE_TEXTURESTAGE(7,WINED3DTSS_TEXTURETRANSFORMFLAGS),{STATE_TEXTURESTAGE(7, WINED3DTSS_TEXTURETRANSFORMFLAGS), textransform }, 0 }, + {STATE_PIXELSHADER, { STATE_PIXELSHADER, atifs_apply_pixelshader }, 0 }, {0 /* Terminate */, { 0, 0 }, 0 }, }; diff --git a/dlls/wined3d/baseshader.c b/dlls/wined3d/baseshader.c index 9bac9319f41..93f86b24217 100644 --- a/dlls/wined3d/baseshader.c +++ b/dlls/wined3d/baseshader.c @@ -131,17 +131,12 @@ static int shader_get_param(const DWORD *pToken, DWORD shader_version, DWORD *pa } /* Return the number of parameters to skip for an opcode */ -static inline int shader_skip_opcode( - IWineD3DBaseShaderImpl* This, - const SHADER_OPCODE* curOpcode, - DWORD opcode_token) { - +static inline int shader_skip_opcode(const SHADER_OPCODE *curOpcode, DWORD opcode_token, DWORD shader_version) +{ /* Shaders >= 2.0 may contain address tokens, but fortunately they * have a useful length mask - use it here. Shaders 1.0 contain no such tokens */ - - return (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2)? - ((opcode_token & WINED3DSI_INSTLENGTH_MASK) >> WINED3DSI_INSTLENGTH_SHIFT): - curOpcode->num_params; + return (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 2) + ? ((opcode_token & WINED3DSI_INSTLENGTH_MASK) >> WINED3DSI_INSTLENGTH_SHIFT) : curOpcode->num_params; } /* Read the parameters of an unrecognized opcode from the input stream @@ -211,7 +206,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m { IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface; const SHADER_OPCODE *shader_ins = This->baseShader.shader_ins; - DWORD shader_version = This->baseShader.hex_version; + DWORD shader_version; unsigned int cur_loop_depth = 0, max_loop_depth = 0; const DWORD* pToken = byte_code; char pshader; @@ -221,13 +216,6 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m memset(reg_maps->bumpmat, 0, sizeof(reg_maps->bumpmat)); memset(reg_maps->luminanceparams, 0, sizeof(reg_maps->luminanceparams)); - if (!pToken) - { - WARN("Got a NULL pFunction, returning.\n"); - This->baseShader.functionLength = 0; - return WINED3D_OK; - } - /* get_registers_used is called on every compile on some 1.x shaders, which can result * in stacking up a collection of local constants. Delete the old constants if existing */ @@ -241,8 +229,7 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m FIXME("First token is not a version token, invalid shader.\n"); return WINED3DERR_INVALIDCALL; } - shader_version = *pToken++; - This->baseShader.hex_version = shader_version; + reg_maps->shader_version = shader_version = *pToken++; pshader = shader_is_pshader_version(shader_version); while (WINED3DVS_END() != *pToken) { @@ -307,7 +294,8 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m memcpy(lconst->value, pToken + 1, 4 * sizeof(DWORD)); /* In pixel shader 1.X shaders, the constants are clamped between [-1;1] */ - if(WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 && pshader) { + if (WINED3DSHADER_VERSION_MAJOR(shader_version) == 1 && pshader) + { float *value = (float *) lconst->value; if(value[0] < -1.0) value[0] = -1.0; else if(value[0] > 1.0) value[0] = 1.0; @@ -366,20 +354,20 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m int i, limit; /* Declare 1.X samplers implicitly, based on the destination reg. number */ - if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 && - pshader /* Filter different instructions with the same enum values in VS */ && - (WINED3DSIO_TEX == curOpcode->opcode || - WINED3DSIO_TEXBEM == curOpcode->opcode || - WINED3DSIO_TEXBEML == curOpcode->opcode || - WINED3DSIO_TEXDP3TEX == curOpcode->opcode || - WINED3DSIO_TEXM3x2TEX == curOpcode->opcode || - WINED3DSIO_TEXM3x3SPEC == curOpcode->opcode || - WINED3DSIO_TEXM3x3TEX == curOpcode->opcode || - WINED3DSIO_TEXM3x3VSPEC == curOpcode->opcode || - WINED3DSIO_TEXREG2AR == curOpcode->opcode || - WINED3DSIO_TEXREG2GB == curOpcode->opcode || - WINED3DSIO_TEXREG2RGB == curOpcode->opcode)) { - + if (WINED3DSHADER_VERSION_MAJOR(shader_version) == 1 + && pshader /* Filter different instructions with the same enum values in VS */ + && (WINED3DSIO_TEX == curOpcode->opcode + || WINED3DSIO_TEXBEM == curOpcode->opcode + || WINED3DSIO_TEXBEML == curOpcode->opcode + || WINED3DSIO_TEXDP3TEX == curOpcode->opcode + || WINED3DSIO_TEXM3x2TEX == curOpcode->opcode + || WINED3DSIO_TEXM3x3SPEC == curOpcode->opcode + || WINED3DSIO_TEXM3x3TEX == curOpcode->opcode + || WINED3DSIO_TEXM3x3VSPEC == curOpcode->opcode + || WINED3DSIO_TEXREG2AR == curOpcode->opcode + || WINED3DSIO_TEXREG2GB == curOpcode->opcode + || WINED3DSIO_TEXREG2RGB == curOpcode->opcode)) + { /* Fake sampler usage, only set reserved bit and ttype */ DWORD sampler_code = *pToken & WINED3DSP_REGNUM_MASK; @@ -481,8 +469,9 @@ HRESULT shader_get_registers_used(IWineD3DBaseShader *iface, struct shader_reg_m * in >= 3.0 shaders. Filter 3.0 shaders to prevent overflows, and also filter pixel shaders because TECRDOUT * isn't used in them, but future register types might cause issues */ - else if(WINED3DSPR_TEXCRDOUT == regtype && i == 0 /* Only look at writes */ && - !pshader && WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) < 3) { + else if (WINED3DSPR_TEXCRDOUT == regtype && i == 0 /* Only look at writes */ + && !pshader && WINED3DSHADER_VERSION_MAJOR(shader_version) < 3) + { reg_maps->texcoord_mask[reg] |= shader_get_writemask(param); } } @@ -767,9 +756,8 @@ static void shader_dump_param(const DWORD param, const DWORD addr_token, int inp } static void shader_color_correction(IWineD3DBaseShaderImpl *shader, - IWineD3DDeviceImpl *device, const struct SHADER_OPCODE_ARG *arg) + IWineD3DDeviceImpl *device, const struct SHADER_OPCODE_ARG *arg, DWORD shader_version) { - DWORD hex_version = shader->baseShader.hex_version; IWineD3DBaseTextureImpl *texture; struct color_fixup_desc fixup; BOOL recorded = FALSE; @@ -779,7 +767,7 @@ static void shader_color_correction(IWineD3DBaseShaderImpl *shader, switch(arg->opcode->opcode) { case WINED3DSIO_TEX: - if (hex_version < WINED3DPS_VERSION(2,0)) sampler_idx = arg->dst & WINED3DSP_REGNUM_MASK; + if (WINED3DSHADER_VERSION_MAJOR(shader_version) < 2) sampler_idx = arg->dst & WINED3DSP_REGNUM_MASK; else sampler_idx = arg->src[1] & WINED3DSP_REGNUM_MASK; break; @@ -827,10 +815,8 @@ static void shader_color_correction(IWineD3DBaseShaderImpl *shader, device->shader_backend->shader_color_correction(arg, fixup); } -/** Shared code in order to generate the bulk of the shader string. - Use the shader_header_fct & shader_footer_fct to add strings - that are specific to pixel or vertex functions - NOTE: A description of how to parse tokens can be found on msdn */ +/* Shared code in order to generate the bulk of the shader string. + * NOTE: A description of how to parse tokens can be found on msdn */ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER* buffer, const shader_reg_maps* reg_maps, CONST DWORD* pFunction) { @@ -838,10 +824,10 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER* buffer, IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; /* To access shader backend callbacks */ const SHADER_OPCODE *opcode_table = This->baseShader.shader_ins; const SHADER_HANDLER *handler_table = device->shader_backend->shader_instruction_handler_table; - DWORD shader_version = This->baseShader.hex_version; + DWORD shader_version = reg_maps->shader_version; const DWORD *pToken = pFunction; - const SHADER_OPCODE *curOpcode = NULL; - SHADER_HANDLER hw_fct = NULL; + const SHADER_OPCODE *curOpcode; + SHADER_HANDLER hw_fct; DWORD i; SHADER_OPCODE_ARG hw_arg; @@ -851,99 +837,92 @@ void shader_generate_main(IWineD3DBaseShader *iface, SHADER_BUFFER* buffer, hw_arg.reg_maps = reg_maps; This->baseShader.parse_state.current_row = 0; - /* Second pass, process opcodes */ - if (NULL != pToken) { - while (WINED3DPS_END() != *pToken) { - - /* Skip version token */ - if (shader_is_version_token(*pToken)) { - ++pToken; - continue; - } - - /* Skip comment tokens */ - if (shader_is_comment(*pToken)) { - DWORD comment_len = (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT; - ++pToken; - TRACE("#%s\n", (const char*)pToken); - pToken += comment_len; - continue; - } - - /* Read opcode */ - hw_arg.opcode_token = *pToken++; - curOpcode = shader_get_opcode(opcode_table, shader_version, hw_arg.opcode_token); - - /* Select handler */ - if (curOpcode == NULL) - hw_fct = NULL; - else - hw_fct = handler_table[curOpcode->handler_idx]; - - /* Unknown opcode and its parameters */ - if (NULL == curOpcode) { - FIXME("Unrecognized opcode: token=0x%08x\n", hw_arg.opcode_token); - pToken += shader_skip_unrecognized(pToken, shader_version); - - /* Nothing to do */ - } else if (WINED3DSIO_DCL == curOpcode->opcode || - WINED3DSIO_NOP == curOpcode->opcode || - WINED3DSIO_DEF == curOpcode->opcode || - WINED3DSIO_DEFI == curOpcode->opcode || - WINED3DSIO_DEFB == curOpcode->opcode || - WINED3DSIO_PHASE == curOpcode->opcode || - WINED3DSIO_RET == curOpcode->opcode) { - - pToken += shader_skip_opcode(This, curOpcode, hw_arg.opcode_token); + while (WINED3DPS_END() != *pToken) + { + /* Skip version token */ + if (shader_is_version_token(*pToken)) + { + ++pToken; + continue; + } - /* If a generator function is set for current shader target, use it */ - } else if (hw_fct != NULL) { + /* Skip comment tokens */ + if (shader_is_comment(*pToken)) + { + pToken += (*pToken & WINED3DSI_COMMENTSIZE_MASK) >> WINED3DSI_COMMENTSIZE_SHIFT; + ++pToken; + continue; + } - hw_arg.opcode = curOpcode; + /* Read opcode */ + hw_arg.opcode_token = *pToken++; + curOpcode = shader_get_opcode(opcode_table, shader_version, hw_arg.opcode_token); - /* Destination token */ - if (curOpcode->dst_token) { + /* Unknown opcode and its parameters */ + if (!curOpcode) + { + FIXME("Unrecognized opcode: token=0x%08x\n", hw_arg.opcode_token); + pToken += shader_skip_unrecognized(pToken, shader_version); + continue; + } - DWORD param, addr_token = 0; - pToken += shader_get_param(pToken, shader_version, ¶m, &addr_token); - hw_arg.dst = param; - hw_arg.dst_addr = addr_token; - } + /* Nothing to do */ + if (WINED3DSIO_DCL == curOpcode->opcode + || WINED3DSIO_NOP == curOpcode->opcode + || WINED3DSIO_DEF == curOpcode->opcode + || WINED3DSIO_DEFI == curOpcode->opcode + || WINED3DSIO_DEFB == curOpcode->opcode + || WINED3DSIO_PHASE == curOpcode->opcode + || WINED3DSIO_RET == curOpcode->opcode) + { + pToken += shader_skip_opcode(curOpcode, hw_arg.opcode_token, shader_version); + continue; + } - /* Predication token */ - if (hw_arg.opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED) - hw_arg.predicate = *pToken++; + /* Select handler */ + hw_fct = handler_table[curOpcode->handler_idx]; - /* Other source tokens */ - for (i = 0; i < (curOpcode->num_params - curOpcode->dst_token); i++) { + /* Unhandled opcode */ + if (!hw_fct) + { + FIXME("Can't handle opcode %s in hwShader\n", curOpcode->name); + pToken += shader_skip_opcode(curOpcode, hw_arg.opcode_token, shader_version); + continue; + } - DWORD param, addr_token = 0; - pToken += shader_get_param(pToken, shader_version, ¶m, &addr_token); - hw_arg.src[i] = param; - hw_arg.src_addr[i] = addr_token; - } + hw_arg.opcode = curOpcode; - /* Call appropriate function for output target */ - hw_fct(&hw_arg); + /* Destination token */ + if (curOpcode->dst_token) + { + DWORD param, addr_token = 0; + pToken += shader_get_param(pToken, shader_version, ¶m, &addr_token); + hw_arg.dst = param; + hw_arg.dst_addr = addr_token; + } - /* Add color correction if needed */ - shader_color_correction(This, device, &hw_arg); + /* Predication token */ + if (hw_arg.opcode_token & WINED3DSHADER_INSTRUCTION_PREDICATED) hw_arg.predicate = *pToken++; - /* Process instruction modifiers for GLSL apps ( _sat, etc. ) */ - /* FIXME: This should be internal to the shader backend. - * Also, right now this is the only reason "shader_mode" exists. */ - if (This->baseShader.shader_mode == SHADER_GLSL) - shader_glsl_add_instruction_modifiers(&hw_arg); + /* Other source tokens */ + for (i = 0; i < (curOpcode->num_params - curOpcode->dst_token); ++i) + { + DWORD param, addr_token = 0; + pToken += shader_get_param(pToken, shader_version, ¶m, &addr_token); + hw_arg.src[i] = param; + hw_arg.src_addr[i] = addr_token; + } - /* Unhandled opcode */ - } else { + /* Call appropriate function for output target */ + hw_fct(&hw_arg); - FIXME("Can't handle opcode %s in hwShader\n", curOpcode->name); - pToken += shader_skip_opcode(This, curOpcode, hw_arg.opcode_token); - } - } - /* TODO: What about result.depth? */ + /* Add color correction if needed */ + shader_color_correction(This, device, &hw_arg, shader_version); + /* Process instruction modifiers for GLSL apps ( _sat, etc. ) */ + /* FIXME: This should be internal to the shader backend. + * Also, right now this is the only reason "shader_mode" exists. */ + if (This->baseShader.shader_mode == SHADER_GLSL) shader_glsl_add_instruction_modifiers(&hw_arg); } } @@ -982,12 +961,6 @@ void shader_trace_init(const DWORD *pFunction, const SHADER_OPCODE *opcode_table TRACE("Parsing %p\n", pFunction); - if (!pFunction) - { - WARN("Got a NULL pFunction, returning.\n"); - return; - } - /* The version token is supposed to be the first token */ if (!shader_is_version_token(*pToken)) { @@ -1149,14 +1122,15 @@ static const SHADER_HANDLER shader_none_instruction_handler_table[WINED3DSIH_TAB static void shader_none_select(IWineD3DDevice *iface, BOOL usePS, BOOL useVS) {} static void shader_none_select_depth_blt(IWineD3DDevice *iface, enum tex_types tex_type) {} static void shader_none_deselect_depth_blt(IWineD3DDevice *iface) {} +static void shader_none_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count) {} +static void shader_none_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count) {} static void shader_none_load_constants(IWineD3DDevice *iface, char usePS, char useVS) {} -static void shader_none_cleanup(IWineD3DDevice *iface) {} static void shader_none_color_correction(const struct SHADER_OPCODE_ARG *arg, struct color_fixup_desc fixup) {} static void shader_none_destroy(IWineD3DBaseShader *iface) {} static HRESULT shader_none_alloc(IWineD3DDevice *iface) {return WINED3D_OK;} static void shader_none_free(IWineD3DDevice *iface) {} static BOOL shader_none_dirty_const(IWineD3DDevice *iface) {return FALSE;} -static GLuint shader_none_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) { +static GLuint shader_none_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer, const struct ps_compile_args *args) { FIXME("NONE shader backend asked to generate a pixel shader\n"); return 0; } @@ -1197,8 +1171,9 @@ const shader_backend_t none_shader_backend = { shader_none_select, shader_none_select_depth_blt, shader_none_deselect_depth_blt, + shader_none_update_float_vertex_constants, + shader_none_update_float_pixel_constants, shader_none_load_constants, - shader_none_cleanup, shader_none_color_correction, shader_none_destroy, shader_none_alloc, diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c index 05afe5d4d26..c0d65bad0a4 100644 --- a/dlls/wined3d/context.c +++ b/dlls/wined3d/context.c @@ -839,12 +839,6 @@ WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *tar checkGLcall("glClear"); - glColor3f(1.0, 1.0, 1.0); - checkGLcall("glColor3f"); - - glEnable(GL_LIGHTING); - checkGLcall("glEnable"); - glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE); checkGLcall("glLightModeli(GL_LIGHT_MODEL_LOCAL_VIEWER, GL_TRUE);"); @@ -1053,7 +1047,7 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *contex /* TODO: Use a display list */ /* Disable shaders */ - This->shader_backend->shader_cleanup((IWineD3DDevice *) This); + This->shader_backend->shader_select((IWineD3DDevice *)This, FALSE, FALSE); Context_MarkStateDirty(context, STATE_VSHADER, StateTable); Context_MarkStateDirty(context, STATE_PIXELSHADER, StateTable); @@ -1066,42 +1060,40 @@ static inline void SetupForBlit(IWineD3DDeviceImpl *This, WineD3DContext *contex /* Disable all textures. The caller can then bind a texture it wants to blit * from + * + * The blitting code uses (for now) the fixed function pipeline, so make sure to reset all fixed + * function texture unit. No need to care for higher samplers */ - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - /* The blitting code uses (for now) the fixed function pipeline, so make sure to reset all fixed - * function texture unit. No need to care for higher samplers - */ - for(i = GL_LIMITS(textures) - 1; i > 0 ; i--) { - sampler = This->rev_tex_unit_map[i]; - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i)); - checkGLcall("glActiveTextureARB"); - - if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { - glDisable(GL_TEXTURE_CUBE_MAP_ARB); - checkGLcall("glDisable GL_TEXTURE_CUBE_MAP_ARB"); - } - glDisable(GL_TEXTURE_3D); - checkGLcall("glDisable GL_TEXTURE_3D"); - if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) { - glDisable(GL_TEXTURE_RECTANGLE_ARB); - checkGLcall("glDisable GL_TEXTURE_RECTANGLE_ARB"); - } - glDisable(GL_TEXTURE_2D); - checkGLcall("glDisable GL_TEXTURE_2D"); + for(i = GL_LIMITS(textures) - 1; i > 0 ; i--) { + sampler = This->rev_tex_unit_map[i]; + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i)); + checkGLcall("glActiveTextureARB"); - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - checkGLcall("glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);"); + if(GL_SUPPORT(ARB_TEXTURE_CUBE_MAP)) { + glDisable(GL_TEXTURE_CUBE_MAP_ARB); + checkGLcall("glDisable GL_TEXTURE_CUBE_MAP_ARB"); + } + glDisable(GL_TEXTURE_3D); + checkGLcall("glDisable GL_TEXTURE_3D"); + if(GL_SUPPORT(ARB_TEXTURE_RECTANGLE)) { + glDisable(GL_TEXTURE_RECTANGLE_ARB); + checkGLcall("glDisable GL_TEXTURE_RECTANGLE_ARB"); + } + glDisable(GL_TEXTURE_2D); + checkGLcall("glDisable GL_TEXTURE_2D"); - if (sampler != -1) { - if (sampler < MAX_TEXTURES) { - Context_MarkStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP), StateTable); - } - Context_MarkStateDirty(context, STATE_SAMPLER(sampler), StateTable); + glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + checkGLcall("glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);"); + + if (sampler != -1) { + if (sampler < MAX_TEXTURES) { + Context_MarkStateDirty(context, STATE_TEXTURESTAGE(sampler, WINED3DTSS_COLOROP), StateTable); } + Context_MarkStateDirty(context, STATE_SAMPLER(sampler), StateTable); } - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); - checkGLcall("glActiveTextureARB"); } + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); + checkGLcall("glActiveTextureARB"); sampler = This->rev_tex_unit_map[0]; @@ -1623,3 +1615,7 @@ void ActivateContext(IWineD3DDeviceImpl *This, IWineD3DSurface *target, ContextU FIXME("Unexpected context usage requested\n"); } } + +WineD3DContext *getActiveContext(void) { + return last_device->activeContext; +} diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index a99ff56f3de..09f47395170 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -340,6 +340,13 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, list_init(&object->lightMap[i]); } + temp_result = allocate_shader_constants(object); + if (FAILED(temp_result)) + { + 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) { @@ -347,10 +354,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateStateBlock(IWineD3DDevice* iface, be freed due to circular dependencies */ return WINED3D_OK; } - - temp_result = allocate_shader_constants(object); - if (WINED3D_OK != temp_result) - return temp_result; /* Otherwise, might as well set the whole state block to the appropriate values */ if (This->stateBlock != NULL) @@ -1874,6 +1877,9 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateVertexShader(IWineD3DDevice *ifac IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; IWineD3DVertexShaderImpl *object; /* NOTE: impl usage is ok, this is a create */ HRESULT hr = WINED3D_OK; + + if (!pFunction) return WINED3DERR_INVALIDCALL; + D3DCREATESHADEROBJECTINSTANCE(object, VertexShader) object->baseShader.shader_ins = IWineD3DVertexShaderImpl_shader_ins; @@ -1900,6 +1906,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreatePixelShader(IWineD3DDevice *iface IWineD3DPixelShaderImpl *object; /* NOTE: impl allowed, this is a create */ HRESULT hr = WINED3D_OK; + if (!pFunction) return WINED3DERR_INVALIDCALL; + D3DCREATESHADEROBJECTINSTANCE(object, PixelShader) object->baseShader.shader_ins = IWineD3DPixelShaderImpl_shader_ins; hr = IWineD3DPixelShader_SetFunction(*ppPixelShader, pFunction); @@ -2028,12 +2036,8 @@ static void create_dummy_textures(IWineD3DDeviceImpl *This) { GLubyte white = 255; /* Make appropriate texture active */ - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i)); - checkGLcall("glActiveTextureARB"); - } else if (i > 0) { - FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); - } + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i)); + checkGLcall("glActiveTextureARB"); /* Generate an opengl texture name */ glGenTextures(1, &This->dummyTextureName[i]); @@ -2084,11 +2088,6 @@ static HRESULT WINAPI IWineD3DDeviceImpl_Init3D(IWineD3DDevice *iface, WINED3DPR This->updateStateBlock = This->stateBlock; IWineD3DStateBlock_AddRef((IWineD3DStateBlock*)This->updateStateBlock); - hr = allocate_shader_constants(This->updateStateBlock); - if (WINED3D_OK != hr) { - goto err_out; - } - This->render_targets = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IWineD3DSurface *) * GL_LIMITS(buffers)); This->draw_buffers = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GLenum) * GL_LIMITS(buffers)); @@ -2537,36 +2536,6 @@ static UINT WINAPI IWineD3DDeviceImpl_GetAvailableTextureMem(IWineD3DDevice *ifa return (This->adapter->TextureRam - This->adapter->UsedTextureRam); } - - -/***** - * Get / Set FVF - *****/ -static HRESULT WINAPI IWineD3DDeviceImpl_SetFVF(IWineD3DDevice *iface, DWORD fvf) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - - /* Update the current state block */ - This->updateStateBlock->changed.fvf = TRUE; - - if(This->updateStateBlock->fvf == fvf) { - TRACE("Application is setting the old fvf over, nothing to do\n"); - return WINED3D_OK; - } - - This->updateStateBlock->fvf = fvf; - TRACE("(%p) : FVF Shader FVF set to %x\n", This, fvf); - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VDECL); - return WINED3D_OK; -} - - -static HRESULT WINAPI IWineD3DDeviceImpl_GetFVF(IWineD3DDevice *iface, DWORD *pfvf) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - TRACE("(%p) : GetFVF returning %x\n", This, This->stateBlock->fvf); - *pfvf = This->stateBlock->fvf; - return WINED3D_OK; -} - /***** * Get / Set Stream Source *****/ @@ -3525,7 +3494,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantB( This->updateStateBlock->changed.vertexShaderConstantsB |= (1 << i); } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT); + if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT); return WINED3D_OK; } @@ -3573,7 +3542,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantI( This->updateStateBlock->changed.vertexShaderConstantsI |= (1 << i); } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT); + if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT); return WINED3D_OK; } @@ -3620,54 +3589,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF( srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]); } - for (i = start; i < count + start; ++i) { - if (!This->updateStateBlock->changed.vertexShaderConstantsF[i]) { - constants_entry *ptr = LIST_ENTRY(list_head(&This->updateStateBlock->set_vconstantsF), constants_entry, entry); - if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx)) { - ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry)); - list_add_head(&This->updateStateBlock->set_vconstantsF, &ptr->entry); - } - ptr->idx[ptr->count++] = i; - This->updateStateBlock->changed.vertexShaderConstantsF[i] = TRUE; - } - } - - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_SetVertexShaderConstantF_DirtyConst( -IWineD3DDevice *iface, -UINT start, -CONST float *srcData, -UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - UINT i; - - TRACE("(iface %p, srcData %p, start %d, count %d)\n", - iface, srcData, start, count); - - /* Specifically test start > limit to catch MAX_UINT overflows when adding start + count */ - if (srcData == NULL || start + count > GL_LIMITS(vshader_constantsF) || start > GL_LIMITS(vshader_constantsF)) - return WINED3DERR_INVALIDCALL; - - memcpy(&This->updateStateBlock->vertexShaderConstantF[start * 4], srcData, count * sizeof(float) * 4); - if(TRACE_ON(d3d)) { - for (i = 0; i < count; i++) - TRACE("Set FLOAT constant %u to { %f, %f, %f, %f }\n", start + i, - srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]); + if (!This->isRecordingState) + { + This->shader_backend->shader_update_float_vertex_constants(iface, start, count); + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT); } - /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active - * context. On a context switch the old context will be fully dirtified - */ - memset(This->activeContext->vshader_const_dirty + start, 1, - sizeof(*This->activeContext->vshader_const_dirty) * count); - This->highest_dirty_vs_const = max(This->highest_dirty_vs_const, start+count+1); - - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_VERTEXSHADERCONSTANT); + memset(This->updateStateBlock->changed.vertexShaderConstantsF + start, 1, + sizeof(*This->updateStateBlock->changed.vertexShaderConstantsF) * count); return WINED3D_OK; } @@ -3958,7 +3887,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantB( This->updateStateBlock->changed.pixelShaderConstantsB |= (1 << i); } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT); + if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT); return WINED3D_OK; } @@ -4006,7 +3935,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantI( This->updateStateBlock->changed.pixelShaderConstantsI |= (1 << i); } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT); + if (!This->isRecordingState) IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT); return WINED3D_OK; } @@ -4053,54 +3982,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF( srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]); } - for (i = start; i < count + start; ++i) { - if (!This->updateStateBlock->changed.pixelShaderConstantsF[i]) { - constants_entry *ptr = LIST_ENTRY(list_head(&This->updateStateBlock->set_pconstantsF), constants_entry, entry); - if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx)) { - ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry)); - list_add_head(&This->updateStateBlock->set_pconstantsF, &ptr->entry); - } - ptr->idx[ptr->count++] = i; - This->updateStateBlock->changed.pixelShaderConstantsF[i] = TRUE; - } + if (!This->isRecordingState) + { + This->shader_backend->shader_update_float_pixel_constants(iface, start, count); + IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT); } - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT); - - return WINED3D_OK; -} - -static HRESULT WINAPI IWineD3DDeviceImpl_SetPixelShaderConstantF_DirtyConst( - IWineD3DDevice *iface, - UINT start, - CONST float *srcData, - UINT count) { - - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - UINT i; - - TRACE("(iface %p, srcData %p, start %d, count %d)\n", - iface, srcData, start, count); - - /* Specifically test start > limit to catch MAX_UINT overflows when adding start + count */ - if (srcData == NULL || start + count > GL_LIMITS(pshader_constantsF) || start > GL_LIMITS(pshader_constantsF)) - return WINED3DERR_INVALIDCALL; - - memcpy(&This->updateStateBlock->pixelShaderConstantF[start * 4], srcData, count * sizeof(float) * 4); - if(TRACE_ON(d3d)) { - for (i = 0; i < count; i++) - TRACE("Set FLOAT constant %u to { %f, %f, %f, %f }\n", start + i, - srcData[i*4], srcData[i*4+1], srcData[i*4+2], srcData[i*4+3]); - } - - /* We don't want shader constant dirtification to be an O(contexts), so just dirtify the active - * context. On a context switch the old context will be fully dirtified - */ - memset(This->activeContext->pshader_const_dirty + start, 1, - sizeof(*This->activeContext->pshader_const_dirty) * count); - This->highest_dirty_ps_const = max(This->highest_dirty_ps_const, start+count+1); - - IWineD3DDeviceImpl_MarkStateDirty(This, STATE_PIXELSHADERCONSTANT); + memset(This->updateStateBlock->changed.pixelShaderConstantsF + start, 1, + sizeof(*This->updateStateBlock->changed.pixelShaderConstantsF) * count); return WINED3D_OK; } @@ -4897,6 +4786,14 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndStateBlock(IWineD3DDevice *iface, IW 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)) { @@ -5886,12 +5783,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_UpdateSurface(IWineD3DDevice *iface, ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - ENTER_GL(); - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); - checkGLcall("glActiveTextureARB"); - LEAVE_GL(); - } + ENTER_GL(); + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); + checkGLcall("glActiveTextureARB"); + LEAVE_GL(); /* Make sure the surface is loaded and up to date */ IWineD3DSurface_PreLoad(pDestinationSurface); @@ -6761,10 +6656,8 @@ static HRESULT WINAPI IWineD3DDeviceImpl_SetCursorProperties(IWineD3DDevice* i } /* Make sure that a proper texture unit is selected */ - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); - checkGLcall("glActiveTextureARB"); - } + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB)); + checkGLcall("glActiveTextureARB"); sampler = This->rev_tex_unit_map[0]; if (sampler != -1) { IWineD3DDeviceImpl_MarkStateDirty(This, STATE_SAMPLER(sampler)); @@ -7545,8 +7438,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = IWineD3DDeviceImpl_GetCurrentTexturePalette, IWineD3DDeviceImpl_SetDepthStencilSurface, IWineD3DDeviceImpl_GetDepthStencilSurface, - IWineD3DDeviceImpl_SetFVF, - IWineD3DDeviceImpl_GetFVF, IWineD3DDeviceImpl_SetGammaRamp, IWineD3DDeviceImpl_GetGammaRamp, IWineD3DDeviceImpl_SetIndices, @@ -7634,151 +7525,6 @@ const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl = IWineD3DDeviceImpl_EnumResources }; -const IWineD3DDeviceVtbl IWineD3DDevice_DirtyConst_Vtbl = -{ - /*** IUnknown methods ***/ - IWineD3DDeviceImpl_QueryInterface, - IWineD3DDeviceImpl_AddRef, - IWineD3DDeviceImpl_Release, - /*** IWineD3DDevice methods ***/ - IWineD3DDeviceImpl_GetParent, - /*** Creation methods**/ - IWineD3DDeviceImpl_CreateVertexBuffer, - IWineD3DDeviceImpl_CreateIndexBuffer, - IWineD3DDeviceImpl_CreateStateBlock, - IWineD3DDeviceImpl_CreateSurface, - IWineD3DDeviceImpl_CreateTexture, - IWineD3DDeviceImpl_CreateVolumeTexture, - IWineD3DDeviceImpl_CreateVolume, - IWineD3DDeviceImpl_CreateCubeTexture, - IWineD3DDeviceImpl_CreateQuery, - IWineD3DDeviceImpl_CreateSwapChain, - IWineD3DDeviceImpl_CreateVertexDeclaration, - IWineD3DDeviceImpl_CreateVertexDeclarationFromFVF, - IWineD3DDeviceImpl_CreateVertexShader, - IWineD3DDeviceImpl_CreatePixelShader, - IWineD3DDeviceImpl_CreatePalette, - /*** Odd functions **/ - IWineD3DDeviceImpl_Init3D, - IWineD3DDeviceImpl_InitGDI, - IWineD3DDeviceImpl_Uninit3D, - IWineD3DDeviceImpl_UninitGDI, - IWineD3DDeviceImpl_SetMultithreaded, - IWineD3DDeviceImpl_EvictManagedResources, - IWineD3DDeviceImpl_GetAvailableTextureMem, - IWineD3DDeviceImpl_GetBackBuffer, - IWineD3DDeviceImpl_GetCreationParameters, - IWineD3DDeviceImpl_GetDeviceCaps, - IWineD3DDeviceImpl_GetDirect3D, - IWineD3DDeviceImpl_GetDisplayMode, - IWineD3DDeviceImpl_SetDisplayMode, - IWineD3DDeviceImpl_GetNumberOfSwapChains, - IWineD3DDeviceImpl_GetRasterStatus, - IWineD3DDeviceImpl_GetSwapChain, - IWineD3DDeviceImpl_Reset, - IWineD3DDeviceImpl_SetDialogBoxMode, - IWineD3DDeviceImpl_SetCursorProperties, - IWineD3DDeviceImpl_SetCursorPosition, - IWineD3DDeviceImpl_ShowCursor, - IWineD3DDeviceImpl_TestCooperativeLevel, - /*** Getters and setters **/ - IWineD3DDeviceImpl_SetClipPlane, - IWineD3DDeviceImpl_GetClipPlane, - IWineD3DDeviceImpl_SetClipStatus, - IWineD3DDeviceImpl_GetClipStatus, - IWineD3DDeviceImpl_SetCurrentTexturePalette, - IWineD3DDeviceImpl_GetCurrentTexturePalette, - IWineD3DDeviceImpl_SetDepthStencilSurface, - IWineD3DDeviceImpl_GetDepthStencilSurface, - IWineD3DDeviceImpl_SetFVF, - IWineD3DDeviceImpl_GetFVF, - IWineD3DDeviceImpl_SetGammaRamp, - IWineD3DDeviceImpl_GetGammaRamp, - IWineD3DDeviceImpl_SetIndices, - IWineD3DDeviceImpl_GetIndices, - IWineD3DDeviceImpl_SetBaseVertexIndex, - IWineD3DDeviceImpl_GetBaseVertexIndex, - IWineD3DDeviceImpl_SetLight, - IWineD3DDeviceImpl_GetLight, - IWineD3DDeviceImpl_SetLightEnable, - IWineD3DDeviceImpl_GetLightEnable, - IWineD3DDeviceImpl_SetMaterial, - IWineD3DDeviceImpl_GetMaterial, - IWineD3DDeviceImpl_SetNPatchMode, - IWineD3DDeviceImpl_GetNPatchMode, - IWineD3DDeviceImpl_SetPaletteEntries, - IWineD3DDeviceImpl_GetPaletteEntries, - IWineD3DDeviceImpl_SetPixelShader, - IWineD3DDeviceImpl_GetPixelShader, - IWineD3DDeviceImpl_SetPixelShaderConstantB, - IWineD3DDeviceImpl_GetPixelShaderConstantB, - IWineD3DDeviceImpl_SetPixelShaderConstantI, - IWineD3DDeviceImpl_GetPixelShaderConstantI, - IWineD3DDeviceImpl_SetPixelShaderConstantF_DirtyConst, - IWineD3DDeviceImpl_GetPixelShaderConstantF, - IWineD3DDeviceImpl_SetRenderState, - IWineD3DDeviceImpl_GetRenderState, - IWineD3DDeviceImpl_SetRenderTarget, - IWineD3DDeviceImpl_GetRenderTarget, - IWineD3DDeviceImpl_SetFrontBackBuffers, - IWineD3DDeviceImpl_SetSamplerState, - IWineD3DDeviceImpl_GetSamplerState, - IWineD3DDeviceImpl_SetScissorRect, - IWineD3DDeviceImpl_GetScissorRect, - IWineD3DDeviceImpl_SetSoftwareVertexProcessing, - IWineD3DDeviceImpl_GetSoftwareVertexProcessing, - IWineD3DDeviceImpl_SetStreamSource, - IWineD3DDeviceImpl_GetStreamSource, - IWineD3DDeviceImpl_SetStreamSourceFreq, - IWineD3DDeviceImpl_GetStreamSourceFreq, - IWineD3DDeviceImpl_SetTexture, - IWineD3DDeviceImpl_GetTexture, - IWineD3DDeviceImpl_SetTextureStageState, - IWineD3DDeviceImpl_GetTextureStageState, - IWineD3DDeviceImpl_SetTransform, - IWineD3DDeviceImpl_GetTransform, - IWineD3DDeviceImpl_SetVertexDeclaration, - IWineD3DDeviceImpl_GetVertexDeclaration, - IWineD3DDeviceImpl_SetVertexShader, - IWineD3DDeviceImpl_GetVertexShader, - IWineD3DDeviceImpl_SetVertexShaderConstantB, - IWineD3DDeviceImpl_GetVertexShaderConstantB, - IWineD3DDeviceImpl_SetVertexShaderConstantI, - IWineD3DDeviceImpl_GetVertexShaderConstantI, - IWineD3DDeviceImpl_SetVertexShaderConstantF_DirtyConst, - IWineD3DDeviceImpl_GetVertexShaderConstantF, - IWineD3DDeviceImpl_SetViewport, - IWineD3DDeviceImpl_GetViewport, - IWineD3DDeviceImpl_MultiplyTransform, - IWineD3DDeviceImpl_ValidateDevice, - IWineD3DDeviceImpl_ProcessVertices, - /*** State block ***/ - IWineD3DDeviceImpl_BeginStateBlock, - IWineD3DDeviceImpl_EndStateBlock, - /*** Scene management ***/ - IWineD3DDeviceImpl_BeginScene, - IWineD3DDeviceImpl_EndScene, - IWineD3DDeviceImpl_Present, - IWineD3DDeviceImpl_Clear, - /*** Drawing ***/ - IWineD3DDeviceImpl_DrawPrimitive, - IWineD3DDeviceImpl_DrawIndexedPrimitive, - IWineD3DDeviceImpl_DrawPrimitiveUP, - IWineD3DDeviceImpl_DrawIndexedPrimitiveUP, - IWineD3DDeviceImpl_DrawPrimitiveStrided, - IWineD3DDeviceImpl_DrawIndexedPrimitiveStrided, - IWineD3DDeviceImpl_DrawRectPatch, - IWineD3DDeviceImpl_DrawTriPatch, - IWineD3DDeviceImpl_DeletePatch, - IWineD3DDeviceImpl_ColorFill, - IWineD3DDeviceImpl_UpdateTexture, - IWineD3DDeviceImpl_UpdateSurface, - IWineD3DDeviceImpl_GetFrontBufferData, - /*** object tracking ***/ - IWineD3DDeviceImpl_ResourceReleased, - IWineD3DDeviceImpl_EnumResources -}; - const DWORD SavedPixelStates_R[NUM_SAVEDPIXELSTATES_R] = { WINED3DRS_ALPHABLENDENABLE , WINED3DRS_ALPHAFUNC , diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index cb66128fa7a..d5fd0a5ec10 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -82,6 +82,7 @@ static const struct { {"GL_ARB_texture_mirrored_repeat", ARB_TEXTURE_MIRRORED_REPEAT, 0 }, {"GL_ARB_texture_non_power_of_two", ARB_TEXTURE_NON_POWER_OF_TWO, MAKEDWORD_VERSION(2, 0) }, {"GL_ARB_texture_rectangle", ARB_TEXTURE_RECTANGLE, 0 }, + {"GL_ARB_texture_rg", ARB_TEXTURE_RG, 0 }, {"GL_ARB_vertex_blend", ARB_VERTEX_BLEND, 0 }, {"GL_ARB_vertex_buffer_object", ARB_VERTEX_BUFFER_OBJECT, 0 }, {"GL_ARB_vertex_program", ARB_VERTEX_PROGRAM, 0 }, @@ -109,6 +110,7 @@ static const struct { {"GL_EXT_texture_env_combine", EXT_TEXTURE_ENV_COMBINE, 0 }, {"GL_EXT_texture_env_dot3", EXT_TEXTURE_ENV_DOT3, 0 }, {"GL_EXT_texture_sRGB", EXT_TEXTURE_SRGB, 0 }, + {"GL_EXT_texture_swizzle", EXT_TEXTURE_SWIZZLE, 0 }, {"GL_EXT_texture_filter_anisotropic", EXT_TEXTURE_FILTER_ANISOTROPIC, 0 }, {"GL_EXT_texture_lod", EXT_TEXTURE_LOD, 0 }, {"GL_EXT_texture_lod_bias", EXT_TEXTURE_LOD_BIAS, 0 }, @@ -187,7 +189,6 @@ glAttribFunc diffuse_funcs[WINED3DDECLTYPE_UNUSED]; glAttribFunc specular_funcs[WINED3DDECLTYPE_UNUSED]; glAttribFunc normal_funcs[WINED3DDECLTYPE_UNUSED]; glMultiTexCoordFunc multi_texcoord_funcs[WINED3DDECLTYPE_UNUSED]; -glAttribFunc texcoord_funcs[WINED3DDECLTYPE_UNUSED]; /** * Note: GL seems to trap if GetDeviceCaps is called before any HWND's created, @@ -714,7 +715,7 @@ static BOOL IWineD3DImpl_FillGLCaps(WineD3D_GL_Info *gl_info) { gl_info->max_texture_stages = 1; gl_info->max_fragment_samplers = 1; gl_info->max_vertex_samplers = 0; - gl_info->max_combined_samplers = 0; + gl_info->max_combined_samplers = gl_info->max_fragment_samplers + gl_info->max_vertex_samplers; gl_info->max_sampler_stages = 1; gl_info->ps_arb_version = PS_VERSION_NOT_SUPPORTED; gl_info->ps_arb_max_temps = 0; @@ -2360,6 +2361,10 @@ static BOOL CheckTextureCapability(UINT Adapter, WINED3DDEVTYPE DeviceType, WINE case WINED3DFMT_G16R16F: case WINED3DFMT_G32R32F: + if(GL_SUPPORT(ARB_TEXTURE_RG)) { + TRACE_(d3d_caps)("[OK]\n"); + return TRUE; + } TRACE_(d3d_caps)("[FAILED]\n"); return FALSE; @@ -3688,14 +3693,6 @@ static HRESULT WINAPI IWineD3DImpl_CreateDevice(IWineD3D *iface, UINT Adapter, object->blitter = select_blit_implementation(Adapter, DeviceType); - /* Prefer the vtable with functions optimized for single dirtifyable objects if the shader - * model can deal with that. It is essentially the same, just with adjusted - * Set*ShaderConstantF implementations - */ - if(object->shader_backend->shader_dirtifyable_constants((IWineD3DDevice *) object)) { - object->lpVtbl = &IWineD3DDevice_DirtyConst_Vtbl; - } - /* set the state of the device to valid */ object->state = WINED3D_OK; @@ -4154,35 +4151,11 @@ static void fillGLAttribFuncs(const WineD3D_GL_Info *gl_info) multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = invalid_texcoord_func; multi_texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = invalid_texcoord_func; } - - texcoord_funcs[WINED3DDECLTYPE_FLOAT1] = (glAttribFunc)glTexCoord1fv; - texcoord_funcs[WINED3DDECLTYPE_FLOAT2] = (glAttribFunc)glTexCoord2fv; - texcoord_funcs[WINED3DDECLTYPE_FLOAT3] = (glAttribFunc)glTexCoord3fv; - texcoord_funcs[WINED3DDECLTYPE_FLOAT4] = (glAttribFunc)glTexCoord4fv; - texcoord_funcs[WINED3DDECLTYPE_D3DCOLOR] = invalid_func; - texcoord_funcs[WINED3DDECLTYPE_UBYTE4] = invalid_func; - texcoord_funcs[WINED3DDECLTYPE_SHORT2] = (glAttribFunc)glTexCoord2sv; - texcoord_funcs[WINED3DDECLTYPE_SHORT4] = (glAttribFunc)glTexCoord4sv; - texcoord_funcs[WINED3DDECLTYPE_UBYTE4N] = invalid_func; - texcoord_funcs[WINED3DDECLTYPE_SHORT2N] = invalid_func; - texcoord_funcs[WINED3DDECLTYPE_SHORT4N] = invalid_func; - texcoord_funcs[WINED3DDECLTYPE_USHORT2N] = invalid_func; - texcoord_funcs[WINED3DDECLTYPE_USHORT4N] = invalid_func; - texcoord_funcs[WINED3DDECLTYPE_UDEC3] = invalid_func; - texcoord_funcs[WINED3DDECLTYPE_DEC3N] = invalid_func; - if (GL_SUPPORT(NV_HALF_FLOAT)) - { - texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = (glAttribFunc)GL_EXTCALL(glTexCoord2hvNV); - texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = (glAttribFunc)GL_EXTCALL(glTexCoord4hvNV); - } else { - texcoord_funcs[WINED3DDECLTYPE_FLOAT16_2] = invalid_func; - texcoord_funcs[WINED3DDECLTYPE_FLOAT16_4] = invalid_func; - } } #define PUSH1(att) attribs[nAttribs++] = (att); BOOL InitAdapters(void) { - static HMODULE mod_gl, mod_win32gl; + static HMODULE mod_gl; BOOL ret; int ps_selected_mode, vs_selected_mode; @@ -4206,11 +4179,6 @@ BOOL InitAdapters(void) { #define USE_GL_FUNC(pfn) pfn = (void*)pwglGetProcAddress(#pfn); /* To bypass the opengl32 thunks load wglGetProcAddress from gdi32 (glXGetProcAddress wrapper) instead of opengl32's */ mod_gl = GetModuleHandleA("gdi32.dll"); - mod_win32gl = LoadLibraryA("opengl32.dll"); - if(!mod_win32gl) { - ERR("Can't load opengl32.dll!\n"); - goto nogl_adapter; - } #endif } @@ -4231,8 +4199,13 @@ BOOL InitAdapters(void) { /* Load glFinish and glFlush from opengl32.dll even if we're not using WIN32 opengl * otherwise because we have to use winex11.drv's override */ - glFinish = (void*)GetProcAddress(mod_win32gl, "glFinish"); - glFlush = (void*)GetProcAddress(mod_win32gl, "glFlush"); +#ifdef USE_WIN32_OPENGL + glFinish = (void*)GetProcAddress(mod_gl, "glFinish"); + glFlush = (void*)GetProcAddress(mod_gl, "glFlush"); +#else + glFinish = (void*)pwglGetProcAddress("wglFinish"); + glFlush = (void*)pwglGetProcAddress("wglFlush"); +#endif /* For now only one default adapter */ { @@ -4375,6 +4348,7 @@ BOOL InitAdapters(void) { } fixup_extensions(&Adapters[0].gl_info); + add_gl_compat_wrappers(&Adapters[0].gl_info); WineD3D_ReleaseFakeGLContext(); diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 243ed61009e..89ab706e1f3 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -440,21 +440,15 @@ static void drawStridedSlow(IWineD3DDevice *iface, const WineDirect3DVertexStrid { int coord_idx; const void *ptr; + int texture_idx; if (!(tmp_tex_mask & 1)) continue; coord_idx = This->stateBlock->textureState[texture][WINED3DTSS_TEXCOORDINDEX]; ptr = texCoords[coord_idx] + (SkipnStrides * sd->u.s.texCoords[coord_idx].dwStride); - if (GL_SUPPORT(ARB_MULTITEXTURE)) - { - int texture_idx = This->texUnitMap[texture]; - multi_texcoord_funcs[sd->u.s.texCoords[coord_idx].dwType](GL_TEXTURE0_ARB + texture_idx, ptr); - } - else - { - texcoord_funcs[sd->u.s.texCoords[coord_idx].dwType](ptr); - } + texture_idx = This->texUnitMap[texture]; + multi_texcoord_funcs[sd->u.s.texCoords[coord_idx].dwType](GL_TEXTURE0_ARB + texture_idx, ptr); } /* Diffuse -------------------------------- */ diff --git a/dlls/wined3d/gl_compat.c b/dlls/wined3d/gl_compat.c new file mode 100644 index 00000000000..466b0038c98 --- /dev/null +++ b/dlls/wined3d/gl_compat.c @@ -0,0 +1,535 @@ +/* + * Compatibility functions for older GL implementations + * + * Copyright 2008 Stefan Dösinger 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 +#ifdef HAVE_FLOAT_H +# include +#endif +#include "wined3d_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gl_compat); + +/* Start GL_ARB_multitexture emulation */ +static void WINE_GLAPI wine_glMultiTexCoord1fARB(GLenum target, GLfloat s) { + if(target != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } + glTexCoord1f(s); +} + +static void WINE_GLAPI wine_glMultiTexCoord1fvARB(GLenum target, const GLfloat *v) { + if(target != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } + glTexCoord1fv(v); +} + +static void WINE_GLAPI wine_glMultiTexCoord2fARB(GLenum target, GLfloat s, GLfloat t) { + if(target != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } + glTexCoord2f(s, t); +} + +static void WINE_GLAPI wine_glMultiTexCoord2fvARB(GLenum target, const GLfloat *v) { + if(target != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } + glTexCoord2fv(v); +} + +static void WINE_GLAPI wine_glMultiTexCoord3fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r) { + if(target != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } + glTexCoord3f(s, t, r); +} + +static void WINE_GLAPI wine_glMultiTexCoord3fvARB(GLenum target, const GLfloat *v) { + if(target != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } + glTexCoord3fv(v); +} + +static void WINE_GLAPI wine_glMultiTexCoord4fARB(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { + if(target != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } + glTexCoord4f(s, t, r, q); +} + +static void WINE_GLAPI wine_glMultiTexCoord4fvARB(GLenum target, const GLfloat *v) { + if(target != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } + glTexCoord4fv(v); +} + +static void WINE_GLAPI wine_glMultiTexCoord2svARB(GLenum target, const GLshort *v) { + if(target != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } + glTexCoord2sv(v); +} + +static void WINE_GLAPI wine_glMultiTexCoord4svARB(GLenum target, const GLshort *v) { + if(target != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } + glTexCoord4sv(v); +} + +static void WINE_GLAPI wine_glActiveTextureARB(GLenum texture) { + if(texture != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } +} + +static void WINE_GLAPI wine_glClientActiveTextureARB(GLenum texture) { + if(texture != GL_TEXTURE0) { + ERR("Texture unit > 0 used, but GL_ARB_multitexture is not supported\n"); + return; + } +} + +static void (WINE_GLAPI *old_multitex_glGetIntegerv) (GLenum pname, GLint* params) = NULL; +static void WINE_GLAPI wine_glGetIntegerv(GLenum pname, GLint* params) { + switch(pname) { + case GL_ACTIVE_TEXTURE: *params = 0; break; + case GL_MAX_TEXTURE_UNITS_ARB: *params = 1; break; + default: old_multitex_glGetIntegerv(pname, params); + } +} + +static void (WINE_GLAPI *old_multitex_glGetFloatv) (GLenum pname, GLfloat* params) = NULL; +static void WINE_GLAPI wine_glGetFloatv(GLenum pname, GLfloat* params) { + if(pname == GL_ACTIVE_TEXTURE) *params = 0.0; + else old_multitex_glGetFloatv(pname, params); +} + +static void (WINE_GLAPI *old_multitex_glGetDoublev) (GLenum pname, GLdouble* params) = NULL; +static void WINE_GLAPI wine_glGetDoublev(GLenum pname, GLdouble* params) { + if(pname == GL_ACTIVE_TEXTURE) *params = 0.0; + else old_multitex_glGetDoublev(pname, params); +} + +/* Start GL_EXT_fogcoord emulation */ +static void (WINE_GLAPI *old_fogcoord_glEnable) (GLenum cap) = NULL; +static void WINE_GLAPI wine_glEnable(GLenum cap) { + if(cap == GL_FOG) { + WineD3DContext *ctx = getActiveContext(); + ctx->fog_enabled = 1; + if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return; + } + old_fogcoord_glEnable(cap); +} + +static void (WINE_GLAPI *old_fogcoord_glDisable) (GLenum cap) = NULL; +static void WINE_GLAPI wine_glDisable(GLenum cap) { + if(cap == GL_FOG) { + WineD3DContext *ctx = getActiveContext(); + ctx->fog_enabled = 0; + if(ctx->gl_fog_source != GL_FRAGMENT_DEPTH_EXT) return; + } + old_fogcoord_glDisable(cap); +} + +static void (WINE_GLAPI *old_fogcoord_glFogi) (GLenum pname, GLint param) = NULL; +static void WINE_GLAPI wine_glFogi(GLenum pname, GLint param) { + if(pname == GL_FOG_COORDINATE_SOURCE_EXT) { + WineD3DContext *ctx = getActiveContext(); + ctx->gl_fog_source = param; + if(param == GL_FRAGMENT_DEPTH_EXT) { + if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG); + } else { + WARN("Fog coords activated, but not supported. Using slow emulation\n"); + old_fogcoord_glDisable(GL_FOG); + } + } else { + if(pname == GL_FOG_START) { + getActiveContext()->fogstart = param; + } else if(pname == GL_FOG_END) { + getActiveContext()->fogend = param; + } + old_fogcoord_glFogi(pname, param); + } +} + +static void (WINE_GLAPI *old_fogcoord_glFogiv) (GLenum pname, const GLint *param) = NULL; +static void WINE_GLAPI wine_glFogiv(GLenum pname, const GLint *param) { + if(pname == GL_FOG_COORDINATE_SOURCE_EXT) { + WineD3DContext *ctx = getActiveContext(); + ctx->gl_fog_source = *param; + if(*param == GL_FRAGMENT_DEPTH_EXT) { + if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG); + } else { + WARN("Fog coords activated, but not supported. Using slow emulation\n"); + old_fogcoord_glDisable(GL_FOG); + } + } else { + if(pname == GL_FOG_START) { + getActiveContext()->fogstart = *param; + } else if(pname == GL_FOG_END) { + getActiveContext()->fogend = *param; + } + old_fogcoord_glFogiv(pname, param); + } +} + +static void (WINE_GLAPI *old_fogcoord_glFogf) (GLenum pname, GLfloat param) = NULL; +static void WINE_GLAPI wine_glFogf(GLenum pname, GLfloat param) { + if(pname == GL_FOG_COORDINATE_SOURCE_EXT) { + WineD3DContext *ctx = getActiveContext(); + ctx->gl_fog_source = (GLint) param; + if(param == GL_FRAGMENT_DEPTH_EXT) { + if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG); + } else { + WARN("Fog coords activated, but not supported. Using slow emulation\n"); + old_fogcoord_glDisable(GL_FOG); + } + } else { + if(pname == GL_FOG_START) { + getActiveContext()->fogstart = param; + } else if(pname == GL_FOG_END) { + getActiveContext()->fogend = param; + } + old_fogcoord_glFogf(pname, param); + } +} + +static void (WINE_GLAPI *old_fogcoord_glFogfv) (GLenum pname, const GLfloat *param) = NULL; +static void WINE_GLAPI wine_glFogfv(GLenum pname, const GLfloat *param) { + if(pname == GL_FOG_COORDINATE_SOURCE_EXT) { + WineD3DContext *ctx = getActiveContext(); + ctx->gl_fog_source = (GLint) *param; + if(*param == GL_FRAGMENT_DEPTH_EXT) { + if(ctx->fog_enabled) old_fogcoord_glEnable(GL_FOG); + } else { + WARN("Fog coords activated, but not supported. Using slow emulation\n"); + old_fogcoord_glDisable(GL_FOG); + } + } else { + if(pname == GL_FOG_COLOR) { + WineD3DContext *ctx = getActiveContext(); + ctx->fogcolor[0] = param[0]; + ctx->fogcolor[1] = param[1]; + ctx->fogcolor[2] = param[2]; + ctx->fogcolor[3] = param[3]; + } else if(pname == GL_FOG_START) { + getActiveContext()->fogstart = *param; + } else if(pname == GL_FOG_END) { + getActiveContext()->fogend = *param; + } + old_fogcoord_glFogfv(pname, param); + } +} + +static void (WINE_GLAPI *old_fogcoord_glVertex4f) (GLfloat x, GLfloat y, GLfloat z, GLfloat w) = NULL; +static void (WINE_GLAPI *old_fogcoord_glVertex4fv) (const GLfloat *pos) = NULL; +static void (WINE_GLAPI *old_fogcoord_glVertex3f) (GLfloat x, GLfloat y, GLfloat z) = NULL; +static void (WINE_GLAPI *old_fogcoord_glVertex3fv) (const GLfloat *pos) = NULL; +static void (WINE_GLAPI *old_fogcoord_glColor4f) (GLfloat r, GLfloat g, GLfloat b, GLfloat a) = NULL; +static void (WINE_GLAPI *old_fogcoord_glColor4fv) (const GLfloat *color) = NULL; +static void (WINE_GLAPI *old_fogcoord_glColor3f) (GLfloat r, GLfloat g, GLfloat b) = NULL; +static void (WINE_GLAPI *old_fogcoord_glColor3fv) (const GLfloat *color) = NULL; +static void (WINE_GLAPI *old_fogcoord_glColor4ub) (GLubyte r, GLubyte g, GLubyte b, GLubyte a) = NULL; +static void (WINE_GLAPI *old_fogcoord_glFogCoordfEXT) (GLfloat f) = NULL; +static void (WINE_GLAPI *old_fogcoord_glFogCoorddEXT) (GLdouble f) = NULL; +static void (WINE_GLAPI *old_fogcoord_glFogCoordfvEXT) (const GLfloat *f) = NULL; +static void (WINE_GLAPI *old_fogcoord_glFogCoorddvEXT) (const GLdouble *f) = NULL; + +static void WINE_GLAPI wine_glVertex4f(GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + WineD3DContext *ctx = getActiveContext(); + if(ctx->gl_fog_source == GL_FOG_COORDINATE_EXT && ctx->fog_enabled) { + GLfloat c[4] = {ctx->color[0], ctx->color[1], ctx->color[2], ctx->color[3]}; + GLfloat i; + + i = (ctx->fogend - ctx->fog_coord_value) / (ctx->fogend - ctx->fogstart); + c[0] = i * c[0] + (1.0 - i) * ctx->fogcolor[0]; + c[1] = i * c[1] + (1.0 - i) * ctx->fogcolor[1]; + c[2] = i * c[2] + (1.0 - i) * ctx->fogcolor[2]; + + old_fogcoord_glColor4f(c[0], c[1], c[2], c[3]); + old_fogcoord_glVertex4f(x, y, z, w); + } else { + old_fogcoord_glVertex4f(x, y, z, w); + } +} + +static void WINE_GLAPI wine_glVertex4fv(const GLfloat *pos) { + wine_glVertex4f(pos[0], pos[1], pos[2], pos[3]); +} + +static void WINE_GLAPI wine_glVertex3f(GLfloat x, GLfloat y, GLfloat z) { + wine_glVertex4f(x, y, z, 1.0); +} + +static void WINE_GLAPI wine_glVertex3fv(const GLfloat *pos) { + wine_glVertex4f(pos[0], pos[1], pos[2], 1.0); +} + +static void wine_glColor4f(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { + WineD3DContext *ctx = getActiveContext(); + ctx->color[0] = r; + ctx->color[1] = g; + ctx->color[2] = b; + ctx->color[3] = a; + old_fogcoord_glColor4f(r, g, b, a); +} + +static void wine_glColor4fv(const GLfloat *c) { + wine_glColor4f(c[0], c[1], c[2], c[3]); +} + +static void wine_glColor3f(GLfloat r, GLfloat g, GLfloat b) { + wine_glColor4f(r, g, b, 1.0); +} + +static void wine_glColor3fv(const GLfloat *c) { + wine_glColor4f(c[0], c[1], c[2], 1.0); +} + +static void wine_glColor4ub(GLubyte r, GLubyte g, GLubyte b, GLubyte a) { + wine_glColor4f(r / 255.0, g / 255.0, b / 255.0, a / 255.0); +} + +/* In D3D the fog coord is a UBYTE, so there's no problem with using the single + * precision function + */ +static void wine_glFogCoordfEXT(GLfloat f) { + WineD3DContext *ctx = getActiveContext(); + ctx->fog_coord_value = f; +} +static void wine_glFogCoorddEXT(GLdouble f) { + wine_glFogCoordfEXT(f); +} +static void wine_glFogCoordfvEXT(const GLfloat *f) { + wine_glFogCoordfEXT(*f); +} +static void wine_glFogCoorddvEXT(const GLdouble *f) { + wine_glFogCoordfEXT(*f); +} + +/* End GL_EXT_fog_coord emulation */ + +#define GLINFO_LOCATION (*gl_info) +void add_gl_compat_wrappers(WineD3D_GL_Info *gl_info) { + if(!GL_SUPPORT(ARB_MULTITEXTURE)) { + TRACE("Applying GL_ARB_multitexture emulation hooks\n"); + gl_info->glActiveTextureARB = wine_glActiveTextureARB; + gl_info->glClientActiveTextureARB = wine_glClientActiveTextureARB; + gl_info->glMultiTexCoord1fARB = wine_glMultiTexCoord1fARB; + gl_info->glMultiTexCoord1fvARB = wine_glMultiTexCoord1fvARB; + gl_info->glMultiTexCoord2fARB = wine_glMultiTexCoord2fARB; + gl_info->glMultiTexCoord2fvARB = wine_glMultiTexCoord2fvARB; + gl_info->glMultiTexCoord3fARB = wine_glMultiTexCoord3fARB; + gl_info->glMultiTexCoord3fvARB = wine_glMultiTexCoord3fvARB; + gl_info->glMultiTexCoord4fARB = wine_glMultiTexCoord4fARB; + gl_info->glMultiTexCoord4fvARB = wine_glMultiTexCoord4fvARB; + gl_info->glMultiTexCoord2svARB = wine_glMultiTexCoord2svARB; + gl_info->glMultiTexCoord4svARB = wine_glMultiTexCoord4svARB; + if(old_multitex_glGetIntegerv) { + FIXME("GL_ARB_multitexture glGetIntegerv hook already applied\n"); + } else { + old_multitex_glGetIntegerv = glGetIntegerv; + glGetIntegerv = wine_glGetIntegerv; + } + if(old_multitex_glGetFloatv) { + FIXME("GL_ARB_multitexture glGetGloatv hook already applied\n"); + } else { + old_multitex_glGetFloatv = glGetFloatv; + glGetFloatv = wine_glGetFloatv; + } + if(old_multitex_glGetDoublev) { + FIXME("GL_ARB_multitexture glGetDoublev hook already applied\n"); + } else { + old_multitex_glGetDoublev = glGetDoublev; + glGetDoublev = wine_glGetDoublev; + } + gl_info->supported[ARB_MULTITEXTURE] = TRUE; + } + + if(!GL_SUPPORT(EXT_FOG_COORD)) { + /* This emulation isn't perfect. There are a number of potential problems, but they should + * not matter in practise: + * + * Fog vs fragment shader: If we are using GL_ARB_fragment_program with the fog option, the + * glDisable(GL_FOG) here won't matter. However, if we have GL_ARB_fragment_program, it is pretty + * unlikely that we don't have GL_EXT_fog_coord. Besides, we probably have GL_ARB_vertex_program + * too, which would allow fog coord emulation in a fixed function vertex pipeline replacement. + * + * Fog vs texture: We apply the fog in the vertex color. An app could set up texturing settings which + * ignore the vertex color, thus effectively disabing our fog. However, in D3D this type of fog is + * a per-vertex fog too, so the apps shouldn't do that. + * + * Fog vs lighting: The app could in theory use D3DFOG_NONE table and D3DFOG_NONE vertex fog with + * untransformed vertices. That enables lighting and fog coords at the same time, and the lighting + * calculations could affect the already blended in fog color. There's nothing we can do against that, + * but most apps using fog color do their own lighting too and often even use RHW vertices. So live + * with it. + */ + TRACE("Applying GL_ARB_fog_coord emulation hooks\n"); + + /* This probably means that the implementation doesn't advertise the extension, but implicitly supports + * it via the GL core version, or someone messed around in the extension table in directx.c. Add version- + * dependent loading for this extension if we ever hit this situation + */ + if(GL_SUPPORT(ARB_FRAGMENT_PROGRAM)) { + FIXME("GL implementation supports GL_ARB_fragment_program but not GL_EXT_fog_coord\n"); + FIXME("The fog coord emulation will most likely fail\n"); + } else if(GL_SUPPORT(ARB_FRAGMENT_SHADER)) { + FIXME("GL implementation supports GL_ARB_fragment_shader but not GL_EXT_fog_coord\n"); + FIXME("The fog coord emulation will most likely fail\n"); + } + + if(old_fogcoord_glFogi) { + FIXME("GL_EXT_fogcoord glFogi hook already applied\n"); + } else { + old_fogcoord_glFogi = glFogi; + glFogi = wine_glFogi; + } + if(old_fogcoord_glFogiv) { + FIXME("GL_EXT_fogcoord glFogiv hook already applied\n"); + } else { + old_fogcoord_glFogiv = glFogiv; + glFogiv = wine_glFogiv; + } + if(old_fogcoord_glFogf) { + FIXME("GL_EXT_fogcoord glFogf hook already applied\n"); + } else { + old_fogcoord_glFogf = glFogf; + glFogf = wine_glFogf; + } + if(old_fogcoord_glFogfv) { + FIXME("GL_EXT_fogcoord glFogfv hook already applied\n"); + } else { + old_fogcoord_glFogfv = glFogfv; + glFogfv = wine_glFogfv; + } + if(old_fogcoord_glEnable) { + FIXME("GL_EXT_fogcoord glEnable hook already applied\n"); + } else { + old_fogcoord_glEnable = glEnable; + glEnable = wine_glEnable; + } + if(old_fogcoord_glDisable) { + FIXME("GL_EXT_fogcoord glDisable hook already applied\n"); + } else { + old_fogcoord_glDisable = glDisable; + glDisable = wine_glDisable; + } + + if(old_fogcoord_glVertex4f) { + FIXME("GL_EXT_fogcoord glVertex4f hook already applied\n"); + } else { + old_fogcoord_glVertex4f = glVertex4f; + glVertex4f = wine_glVertex4f; + } + if(old_fogcoord_glVertex4fv) { + FIXME("GL_EXT_fogcoord glVertex4fv hook already applied\n"); + } else { + old_fogcoord_glVertex4fv = glVertex4fv; + glVertex4fv = wine_glVertex4fv; + } + if(old_fogcoord_glVertex3f) { + FIXME("GL_EXT_fogcoord glVertex3f hook already applied\n"); + } else { + old_fogcoord_glVertex3f = glVertex3f; + glVertex3f = wine_glVertex3f; + } + if(old_fogcoord_glVertex3fv) { + FIXME("GL_EXT_fogcoord glVertex3fv hook already applied\n"); + } else { + old_fogcoord_glVertex3fv = glVertex3fv; + glVertex3fv = wine_glVertex3fv; + } + + if(old_fogcoord_glColor4f) { + FIXME("GL_EXT_fogcoord glColor4f hook already applied\n"); + } else { + old_fogcoord_glColor4f = glColor4f; + glColor4f = wine_glColor4f; + } + if(old_fogcoord_glColor4fv) { + FIXME("GL_EXT_fogcoord glColor4fv hook already applied\n"); + } else { + old_fogcoord_glColor4fv = glColor4fv; + glColor4fv = wine_glColor4fv; + } + if(old_fogcoord_glColor3f) { + FIXME("GL_EXT_fogcoord glColor3f hook already applied\n"); + } else { + old_fogcoord_glColor3f = glColor3f; + glColor3f = wine_glColor3f; + } + if(old_fogcoord_glColor3fv) { + FIXME("GL_EXT_fogcoord glColor3fv hook already applied\n"); + } else { + old_fogcoord_glColor3fv = glColor3fv; + glColor3fv = wine_glColor3fv; + } + if(old_fogcoord_glColor4ub) { + FIXME("GL_EXT_fogcoord glColor4ub hook already applied\n"); + } else { + old_fogcoord_glColor4ub = glColor4ub; + glColor4ub = wine_glColor4ub; + } + + if(old_fogcoord_glFogCoordfEXT) { + FIXME("GL_EXT_fogcoord glFogCoordfEXT hook already applied\n"); + } else { + old_fogcoord_glFogCoordfEXT = gl_info->glFogCoordfEXT; + gl_info->glFogCoordfEXT = wine_glFogCoordfEXT; + } + if(old_fogcoord_glFogCoordfvEXT) { + FIXME("GL_EXT_fogcoord glFogCoordfvEXT hook already applied\n"); + } else { + old_fogcoord_glFogCoordfvEXT = gl_info->glFogCoordfvEXT; + gl_info->glFogCoordfvEXT = wine_glFogCoordfvEXT; + } + if(old_fogcoord_glFogCoorddEXT) { + FIXME("GL_EXT_fogcoord glFogCoorddEXT hook already applied\n"); + } else { + old_fogcoord_glFogCoorddEXT = gl_info->glFogCoorddEXT; + gl_info->glFogCoorddEXT = wine_glFogCoorddEXT; + } + if(old_fogcoord_glFogCoorddvEXT) { + FIXME("GL_EXT_fogcoord glFogCoorddvEXT hook already applied\n"); + } else { + old_fogcoord_glFogCoorddvEXT = gl_info->glFogCoorddvEXT; + gl_info->glFogCoorddvEXT = wine_glFogCoorddvEXT; + } + gl_info->supported[EXT_FOG_COORD] = TRUE; + } +} +#undef GLINFO_LOCATION diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c index 3f54170033e..b9a0e2ef854 100644 --- a/dlls/wined3d/glsl_shader.c +++ b/dlls/wined3d/glsl_shader.c @@ -220,8 +220,9 @@ static void shader_glsl_load_constantsF(IWineD3DBaseShaderImpl *This, const Wine } /* 1.X pshaders have the constants clamped to [-1;1] implicitly. */ - if(WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) == 1 && - shader_is_pshader_version(This->baseShader.hex_version)) { + if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.reg_maps.shader_version) == 1 + && shader_is_pshader_version(This->baseShader.reg_maps.shader_version)) + { float lcl_const[4]; LIST_FOR_EACH_ENTRY(constant, constant_list, constants_entry, entry) { @@ -336,7 +337,7 @@ static void shader_glsl_load_constantsB(IWineD3DBaseShaderImpl *This, const Wine GLhandleARB tmp_loc; unsigned int i; char tmp_name[8]; - char is_pshader = shader_is_pshader_version(This->baseShader.hex_version); + char is_pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version); const char* prefix = is_pshader? "PB":"VB"; struct list* ptr; @@ -497,17 +498,63 @@ static void shader_glsl_load_constants( } } +static void shader_glsl_update_float_vertex_constants(IWineD3DDevice *iface, UINT start, UINT count) +{ + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + UINT i; + + for (i = start; i < count + start; ++i) + { + if (!This->stateBlock->changed.vertexShaderConstantsF[i]) + { + constants_entry *ptr = LIST_ENTRY(list_head(&This->stateBlock->set_vconstantsF), + constants_entry, entry); + + if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx)) + { + ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry)); + list_add_head(&This->stateBlock->set_vconstantsF, &ptr->entry); + } + ptr->idx[ptr->count++] = i; + } + } +} + +static void shader_glsl_update_float_pixel_constants(IWineD3DDevice *iface, UINT start, UINT count) +{ + IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; + UINT i; + + for (i = start; i < count + start; ++i) + { + if (!This->stateBlock->changed.pixelShaderConstantsF[i]) + { + constants_entry *ptr = LIST_ENTRY(list_head(&This->stateBlock->set_pconstantsF), + constants_entry, entry); + + if (!ptr || ptr->count >= sizeof(ptr->idx) / sizeof(*ptr->idx)) + { + ptr = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(constants_entry)); + list_add_head(&This->stateBlock->set_pconstantsF, &ptr->entry); + } + ptr->idx[ptr->count++] = i; + } + } +} + /** Generate the variable & register declarations for the GLSL output target */ static void shader_generate_glsl_declarations(IWineD3DBaseShader *iface, const shader_reg_maps *reg_maps, - SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_info) + SHADER_BUFFER *buffer, const WineD3D_GL_Info *gl_info, + const struct ps_compile_args *ps_args) { IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) iface; IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; + DWORD shader_version = reg_maps->shader_version; unsigned int i, extra_constants_needed = 0; const local_constant *lconst; /* There are some minor differences between pixel and vertex shaders */ - char pshader = shader_is_pshader_version(This->baseShader.hex_version); + char pshader = shader_is_pshader_version(shader_version); char prefix = pshader ? 'P' : 'V'; /* Prototype the subroutines */ @@ -541,7 +588,8 @@ static void shader_generate_glsl_declarations(IWineD3DBaseShader *iface, const s * out. The nvidia driver only does that if the parameter is inout instead of out, hence the * inout. */ - if(This->baseShader.hex_version >= WINED3DVS_VERSION(3, 0)) { + if (shader_version >= WINED3DVS_VERSION(3, 0)) + { shader_addline(buffer, "void order_ps_input(in vec4[%u]);\n", MAX_REG_OUTPUT); } else { shader_addline(buffer, "void order_ps_input();\n"); @@ -571,7 +619,7 @@ static void shader_generate_glsl_declarations(IWineD3DBaseShader *iface, const s ps_impl->numbumpenvmatconsts++; } - if(device->stateBlock->renderState[WINED3DRS_SRGBWRITEENABLE]) { + if(ps_args->srgb_correction) { shader_addline(buffer, "const vec4 srgb_mul_low = vec4(%f, %f, %f, %f);\n", srgb_mul_low, srgb_mul_low, srgb_mul_low, srgb_mul_low); shader_addline(buffer, "const vec4 srgb_comparison = vec4(%f, %f, %f, %f);\n", @@ -642,7 +690,8 @@ static void shader_generate_glsl_declarations(IWineD3DBaseShader *iface, const s /* Declare input register varyings. Only pixel shader, vertex shaders have that declared in the * helper function shader that is linked in at link time */ - if(pshader && This->baseShader.hex_version >= WINED3DPS_VERSION(3, 0)) { + if (pshader && shader_version >= WINED3DPS_VERSION(3, 0)) + { if(use_vs(device)) { shader_addline(buffer, "varying vec4 IN[%u];\n", GL_LIMITS(glsl_varyings) / 4); } else { @@ -812,8 +861,8 @@ static void shader_glsl_get_register_name(const DWORD param, const DWORD addr_to IWineD3DBaseShaderImpl* This = (IWineD3DBaseShaderImpl*) arg->shader; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; const WineD3D_GL_Info* gl_info = &deviceImpl->adapter->gl_info; - - char pshader = shader_is_pshader_version(This->baseShader.hex_version); + DWORD shader_version = This->baseShader.reg_maps.shader_version; + char pshader = shader_is_pshader_version(shader_version); char tmpStr[150]; *is_color = FALSE; @@ -825,7 +874,8 @@ static void shader_glsl_get_register_name(const DWORD param, const DWORD addr_to case WINED3DSPR_INPUT: if (pshader) { /* Pixel shaders >= 3.0 */ - if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) { + if (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 3) + { DWORD in_count = GL_LIMITS(glsl_varyings) / 4; if (param & WINED3DSHADER_ADDRMODE_RELATIVE) { @@ -885,7 +935,8 @@ static void shader_glsl_get_register_name(const DWORD param, const DWORD addr_to /* Relative addressing on shaders 2.0+ have a relative address token, * prior to that, it was hard-coded as "A0.x" because there's only 1 register */ - if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 2) { + if (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 2) + { glsl_src_param_t rel_param; shader_glsl_add_src_param(arg, addr_token, 0, WINED3DSP_WRITEMASK_0, &rel_param); if(reg) { @@ -964,10 +1015,8 @@ static void shader_glsl_get_register_name(const DWORD param, const DWORD addr_to break; case WINED3DSPR_TEXCRDOUT: /* Vertex shaders >= 3.0: WINED3DSPR_OUTPUT */ - if (WINED3DSHADER_VERSION_MAJOR(This->baseShader.hex_version) >= 3) - sprintf(tmpStr, "OUT[%u]", reg); - else - sprintf(tmpStr, "gl_TexCoord[%u]", reg); + if (WINED3DSHADER_VERSION_MAJOR(shader_version) >= 3) sprintf(tmpStr, "OUT[%u]", reg); + else sprintf(tmpStr, "gl_TexCoord[%u]", reg); break; case WINED3DSPR_MISCTYPE: if (reg == 0) { @@ -1316,7 +1365,6 @@ static void shader_glsl_arith(const SHADER_OPCODE_ARG *arg) /* Process the WINED3DSIO_MOV opcode using GLSL (dst = src) */ static void shader_glsl_mov(const SHADER_OPCODE_ARG *arg) { - IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader; SHADER_BUFFER* buffer = arg->buffer; glsl_src_param_t src0_param; DWORD write_mask; @@ -1326,9 +1374,10 @@ static void shader_glsl_mov(const SHADER_OPCODE_ARG *arg) /* In vs_1_1 WINED3DSIO_MOV can write to the address register. In later * shader versions WINED3DSIO_MOVA is used for this. */ - if ((WINED3DSHADER_VERSION_MAJOR(shader->baseShader.hex_version) == 1 && - !shader_is_pshader_version(shader->baseShader.hex_version) && - shader_get_regtype(arg->dst) == WINED3DSPR_ADDR)) { + if ((WINED3DSHADER_VERSION_MAJOR(arg->reg_maps->shader_version) == 1 + && !shader_is_pshader_version(arg->reg_maps->shader_version) + && shader_get_regtype(arg->dst) == WINED3DSPR_ADDR)) + { /* This is a simple floor() */ unsigned int mask_size = shader_glsl_get_write_mask_size(write_mask); if (mask_size > 1) { @@ -1496,12 +1545,12 @@ static void shader_glsl_map2gl(const SHADER_OPCODE_ARG *arg) */ static void shader_glsl_expp(const SHADER_OPCODE_ARG *arg) { - IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)arg->shader; glsl_src_param_t src_param; shader_glsl_add_src_param(arg, arg->src[0], arg->src_addr[0], WINED3DSP_WRITEMASK_0, &src_param); - if (shader->baseShader.hex_version < WINED3DPS_VERSION(2,0)) { + if (arg->reg_maps->shader_version < WINED3DPS_VERSION(2,0)) + { char dst_mask[6]; shader_addline(arg->buffer, "tmp0.x = exp2(floor(%s));\n", src_param.param_str); @@ -1692,14 +1741,14 @@ static void shader_glsl_cmp(const SHADER_OPCODE_ARG *arg) * the compare is done per component of src0. */ static void shader_glsl_cnd(const SHADER_OPCODE_ARG *arg) { - IWineD3DBaseShaderImpl* shader = (IWineD3DBaseShaderImpl*) arg->shader; glsl_src_param_t src0_param; glsl_src_param_t src1_param; glsl_src_param_t src2_param; DWORD write_mask, cmp_channel = 0; unsigned int i, j; - if (shader->baseShader.hex_version < WINED3DPS_VERSION(1, 4)) { + if (arg->reg_maps->shader_version < WINED3DPS_VERSION(1, 4)) + { write_mask = shader_glsl_append_dst(arg->buffer, arg); shader_glsl_add_src_param(arg, arg->src[0], arg->src_addr[0], WINED3DSP_WRITEMASK_0, &src0_param); shader_glsl_add_src_param(arg, arg->src[1], arg->src_addr[1], write_mask, &src1_param); @@ -1758,7 +1807,7 @@ static void shader_glsl_mnxn(const SHADER_OPCODE_ARG *arg) { IWineD3DBaseShaderImpl *shader = (IWineD3DBaseShaderImpl *)arg->shader; const SHADER_OPCODE *opcode_table = shader->baseShader.shader_ins; - DWORD shader_version = shader->baseShader.hex_version; + DWORD shader_version = arg->reg_maps->shader_version; int i; int nComponents = 0; SHADER_OPCODE_ARG tmpArg; @@ -2094,7 +2143,7 @@ static void pshader_glsl_tex(const SHADER_OPCODE_ARG *arg) { IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader; IWineD3DDeviceImpl* deviceImpl = (IWineD3DDeviceImpl*) This->baseShader.device; - DWORD hex_version = This->baseShader.hex_version; + DWORD shader_version = arg->reg_maps->shader_version; char dst_swizzle[6]; glsl_sample_function_t sample_function; DWORD sampler_type; @@ -2107,14 +2156,12 @@ static void pshader_glsl_tex(const SHADER_OPCODE_ARG *arg) /* 1.0-1.4: Use destination register as sampler source. * 2.0+: Use provided sampler source. */ - if (hex_version < WINED3DPS_VERSION(2,0)) { - sampler_idx = arg->dst & WINED3DSP_REGNUM_MASK; - } else { - sampler_idx = arg->src[1] & WINED3DSP_REGNUM_MASK; - } + if (shader_version < WINED3DPS_VERSION(2,0)) sampler_idx = arg->dst & WINED3DSP_REGNUM_MASK; + else sampler_idx = arg->src[1] & WINED3DSP_REGNUM_MASK; sampler_type = arg->reg_maps->samplers[sampler_idx] & WINED3DSP_TEXTURETYPE_MASK; - if (hex_version < WINED3DPS_VERSION(1,4)) { + if (shader_version < WINED3DPS_VERSION(1,4)) + { DWORD flags = deviceImpl->stateBlock->textureState[sampler_idx][WINED3DTSS_TEXTURETRANSFORMFLAGS]; /* Projected cube textures don't make a lot of sense, the resulting coordinates stay the same. */ @@ -2130,7 +2177,9 @@ static void pshader_glsl_tex(const SHADER_OPCODE_ARG *arg) } else { projected = FALSE; } - } else if (hex_version < WINED3DPS_VERSION(2,0)) { + } + else if (shader_version < WINED3DPS_VERSION(2,0)) + { DWORD src_mod = arg->src[0] & WINED3DSP_SRCMOD_MASK; if (src_mod == WINED3DSPSM_DZ) { @@ -2160,15 +2209,13 @@ static void pshader_glsl_tex(const SHADER_OPCODE_ARG *arg) shader_glsl_get_sample_function(sampler_type, projected, texrect, &sample_function); mask |= sample_function.coord_mask; - if (hex_version < WINED3DPS_VERSION(2,0)) { - shader_glsl_get_write_mask(arg->dst, dst_swizzle); - } else { - shader_glsl_get_swizzle(arg->src[1], FALSE, arg->dst, dst_swizzle); - } + if (shader_version < WINED3DPS_VERSION(2,0)) shader_glsl_get_write_mask(arg->dst, dst_swizzle); + else shader_glsl_get_swizzle(arg->src[1], FALSE, arg->dst, dst_swizzle); /* 1.0-1.3: Use destination register as coordinate source. 1.4+: Use provided coordinate source register. */ - if (hex_version < WINED3DPS_VERSION(1,4)) { + if (shader_version < WINED3DPS_VERSION(1,4)) + { char coord_mask[6]; shader_glsl_get_write_mask(mask, coord_mask); shader_addline(arg->buffer, "%s(Psampler%u, T%u%s)%s);\n", @@ -2214,7 +2261,8 @@ static void shader_glsl_texldl(const SHADER_OPCODE_ARG *arg) shader_glsl_add_src_param(arg, arg->src[0], arg->src_addr[0], WINED3DSP_WRITEMASK_3, &lod_param); - if (shader_is_pshader_version(This->baseShader.hex_version)) { + if (shader_is_pshader_version(arg->reg_maps->shader_version)) + { /* The GLSL spec claims the Lod sampling functions are only supported in vertex shaders. * However, they seem to work just fine in fragment shaders as well. */ WARN("Using %sLod in fragment shader.\n", sample_function.name); @@ -2229,17 +2277,15 @@ static void shader_glsl_texldl(const SHADER_OPCODE_ARG *arg) static void pshader_glsl_texcoord(const SHADER_OPCODE_ARG *arg) { /* FIXME: Make this work for more than just 2D textures */ - - IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader; SHADER_BUFFER* buffer = arg->buffer; - DWORD hex_version = This->baseShader.hex_version; DWORD write_mask; char dst_mask[6]; write_mask = shader_glsl_append_dst(arg->buffer, arg); shader_glsl_get_write_mask(write_mask, dst_mask); - if (hex_version != WINED3DPS_VERSION(1,4)) { + if (arg->reg_maps->shader_version != WINED3DPS_VERSION(1,4)) + { DWORD reg = arg->dst & WINED3DSP_REGNUM_MASK; shader_addline(buffer, "clamp(gl_TexCoord[%u], 0.0, 1.0)%s);\n", reg, dst_mask); } else { @@ -2663,13 +2709,12 @@ static void pshader_glsl_texreg2rgb(const SHADER_OPCODE_ARG *arg) * If any of the first 3 components are < 0, discard this pixel */ static void pshader_glsl_texkill(const SHADER_OPCODE_ARG *arg) { - IWineD3DPixelShaderImpl* This = (IWineD3DPixelShaderImpl*) arg->shader; - DWORD hex_version = This->baseShader.hex_version; glsl_dst_param_t dst_param; /* The argument is a destination parameter, and no writemasks are allowed */ shader_glsl_add_dst_param(arg, arg->dst, 0, &dst_param); - if((hex_version >= WINED3DPS_VERSION(2,0))) { + if ((arg->reg_maps->shader_version >= WINED3DPS_VERSION(2,0))) + { /* 2.0 shaders compare all 4 components in texkill */ shader_addline(arg->buffer, "if (any(lessThan(%s.xyzw, vec4(0.0)))) discard;\n", dst_param.reg_name); } else { @@ -2957,8 +3002,8 @@ static GLhandleARB generate_param_reorder_function(IWineD3DVertexShader *vertexs IWineD3DVertexShaderImpl *vs = (IWineD3DVertexShaderImpl *) vertexshader; IWineD3DPixelShaderImpl *ps = (IWineD3DPixelShaderImpl *) pixelshader; IWineD3DDeviceImpl *device; - DWORD vs_major = WINED3DSHADER_VERSION_MAJOR(vs->baseShader.hex_version); - DWORD ps_major = ps ? WINED3DSHADER_VERSION_MAJOR(ps->baseShader.hex_version) : 0; + DWORD vs_major = WINED3DSHADER_VERSION_MAJOR(vs->baseShader.reg_maps.shader_version); + DWORD ps_major = ps ? WINED3DSHADER_VERSION_MAJOR(ps->baseShader.reg_maps.shader_version) : 0; unsigned int i; SHADER_BUFFER buffer; DWORD usage_token; @@ -3270,8 +3315,10 @@ static void set_glsl_shader_program(IWineD3DDevice *iface, BOOL use_ps, BOOL use entry->ycorrection_location = GL_EXTCALL(glGetUniformLocationARB(programId, "ycorrection")); checkGLcall("Find glsl program uniform locations"); - if (pshader && WINED3DSHADER_VERSION_MAJOR(((IWineD3DPixelShaderImpl *)pshader)->baseShader.hex_version) >= 3 - && ((IWineD3DPixelShaderImpl *)pshader)->declared_in_count > GL_LIMITS(glsl_varyings) / 4) { + if (pshader + && WINED3DSHADER_VERSION_MAJOR(((IWineD3DPixelShaderImpl *)pshader)->baseShader.reg_maps.shader_version) >= 3 + && ((IWineD3DPixelShaderImpl *)pshader)->declared_in_count > GL_LIMITS(glsl_varyings) / 4) + { TRACE("Shader %d needs vertex color clamping disabled\n", programId); entry->vertex_color_clamp = GL_FALSE; } else { @@ -3444,12 +3491,6 @@ static void shader_glsl_deselect_depth_blt(IWineD3DDevice *iface) { checkGLcall("glUseProgramObjectARB"); } -static void shader_glsl_cleanup(IWineD3DDevice *iface) { - IWineD3DDeviceImpl *This = (IWineD3DDeviceImpl *)iface; - const WineD3D_GL_Info *gl_info = &This->adapter->gl_info; - GL_EXTCALL(glUseProgramObjectARB(0)); -} - static void shader_glsl_destroy(IWineD3DBaseShader *iface) { const struct list *linked_programs; IWineD3DBaseShaderImpl *This = (IWineD3DBaseShaderImpl *) iface; @@ -3462,7 +3503,7 @@ static void shader_glsl_destroy(IWineD3DBaseShader *iface) { /* Note: Do not use QueryInterface here to find out which shader type this is because this code * can be called from IWineD3DBaseShader::Release */ - char pshader = shader_is_pshader_version(This->baseShader.hex_version); + char pshader = shader_is_pshader_version(This->baseShader.reg_maps.shader_version); if(pshader) { ps = (IWineD3DPixelShaderImpl *) This; @@ -3570,7 +3611,7 @@ static BOOL shader_glsl_dirty_const(IWineD3DDevice *iface) { return FALSE; } -static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer) { +static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer, const struct ps_compile_args *args) { IWineD3DPixelShaderImpl *This = (IWineD3DPixelShaderImpl *)iface; const struct shader_reg_maps *reg_maps = &This->baseShader.reg_maps; CONST DWORD *function = This->baseShader.function; @@ -3593,23 +3634,19 @@ static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface, SHADER_BU } /* Base Declarations */ - shader_generate_glsl_declarations( (IWineD3DBaseShader*) This, reg_maps, buffer, &GLINFO_LOCATION); + shader_generate_glsl_declarations( (IWineD3DBaseShader*) This, reg_maps, buffer, &GLINFO_LOCATION, args); /* Pack 3.0 inputs */ - if (This->baseShader.hex_version >= WINED3DPS_VERSION(3,0)) { - - if(((IWineD3DDeviceImpl *) This->baseShader.device)->strided_streams.u.s.position_transformed) { - pshader_glsl_input_pack(buffer, This->semantics_in, iface, pretransformed); - } else if(!use_vs((IWineD3DDeviceImpl *) This->baseShader.device)) { - pshader_glsl_input_pack(buffer, This->semantics_in, iface, fixedfunction); - } + if (reg_maps->shader_version >= WINED3DPS_VERSION(3,0) && args->vp_mode != vertexshader) { + pshader_glsl_input_pack(buffer, This->semantics_in, iface, args->vp_mode); } /* Base Shader Body */ shader_generate_main( (IWineD3DBaseShader*) This, buffer, reg_maps, function); /* Pixel shaders < 2.0 place the resulting color in R0 implicitly */ - if (This->baseShader.hex_version < WINED3DPS_VERSION(2,0)) { + if (reg_maps->shader_version < WINED3DPS_VERSION(2,0)) + { /* Some older cards like GeforceFX ones don't support multiple buffers, so also not gl_FragData */ if(GL_SUPPORT(ARB_DRAW_BUFFERS)) shader_addline(buffer, "gl_FragData[0] = R0;\n"); @@ -3622,7 +3659,7 @@ static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface, SHADER_BU } else { fragcolor = "gl_FragColor"; } - if(((IWineD3DDeviceImpl *)This->baseShader.device)->stateBlock->renderState[WINED3DRS_SRGBWRITEENABLE]) { + if(args->srgb_correction) { shader_addline(buffer, "tmp0.xyz = pow(%s.xyz, vec3(%f, %f, %f)) * vec3(%f, %f, %f) - vec3(%f, %f, %f);\n", fragcolor, srgb_pow, srgb_pow, srgb_pow, srgb_mul_high, srgb_mul_high, srgb_mul_high, srgb_sub_high, srgb_sub_high, srgb_sub_high); @@ -3638,9 +3675,20 @@ static GLuint shader_glsl_generate_pshader(IWineD3DPixelShader *iface, SHADER_BU * NOTE: gl_Fog.start and gl_Fog.end don't hold fog start s and end e but * -1/(e-s) and e/(e-s) respectively. */ - if(This->baseShader.hex_version < WINED3DPS_VERSION(3,0)) { - shader_addline(buffer, "float Fog = clamp(gl_FogFragCoord * gl_Fog.start + gl_Fog.end, 0.0, 1.0);\n"); - shader_addline(buffer, "%s.xyz = mix(gl_Fog.color.xyz, %s.xyz, Fog);\n", fragcolor, fragcolor); + if(reg_maps->shader_version < WINED3DPS_VERSION(3,0)) { + switch(args->fog) { + case FOG_OFF: break; + case FOG_LINEAR: + shader_addline(buffer, "float Fog = clamp(gl_FogFragCoord * gl_Fog.start + gl_Fog.end, 0.0, 1.0);\n"); + shader_addline(buffer, "%s.xyz = mix(gl_Fog.color.xyz, %s.xyz, Fog);\n", fragcolor, fragcolor); + break; + case FOG_EXP: + FIXME("Implement EXP fog in glsl\n"); + break; + case FOG_EXP2: + FIXME("Implement EXP2 fog in glsl\n"); + break; + } } shader_addline(buffer, "}\n"); @@ -3666,17 +3714,14 @@ static void shader_glsl_generate_vshader(IWineD3DVertexShader *iface, SHADER_BUF shader_addline(buffer, "#version 120\n"); /* Base Declarations */ - shader_generate_glsl_declarations( (IWineD3DBaseShader*) This, reg_maps, buffer, &GLINFO_LOCATION); + shader_generate_glsl_declarations( (IWineD3DBaseShader*) This, reg_maps, buffer, &GLINFO_LOCATION, NULL); /* Base Shader Body */ shader_generate_main( (IWineD3DBaseShader*) This, buffer, reg_maps, function); /* Unpack 3.0 outputs */ - if (This->baseShader.hex_version >= WINED3DVS_VERSION(3,0)) { - shader_addline(buffer, "order_ps_input(OUT);\n"); - } else { - shader_addline(buffer, "order_ps_input();\n"); - } + if (reg_maps->shader_version >= WINED3DVS_VERSION(3,0)) shader_addline(buffer, "order_ps_input(OUT);\n"); + else shader_addline(buffer, "order_ps_input();\n"); /* If this shader doesn't use fog copy the z coord to the fog coord so that we can use table fog */ if (!reg_maps->fog) @@ -3871,8 +3916,9 @@ const shader_backend_t glsl_shader_backend = { shader_glsl_select, shader_glsl_select_depth_blt, shader_glsl_deselect_depth_blt, + shader_glsl_update_float_vertex_constants, + shader_glsl_update_float_pixel_constants, shader_glsl_load_constants, - shader_glsl_cleanup, shader_glsl_color_correction, shader_glsl_destroy, shader_glsl_alloc, diff --git a/dlls/wined3d/nvidia_texture_shader.c b/dlls/wined3d/nvidia_texture_shader.c index 1b31c746f88..a7f96c730f9 100644 --- a/dlls/wined3d/nvidia_texture_shader.c +++ b/dlls/wined3d/nvidia_texture_shader.c @@ -457,26 +457,18 @@ static void nvrc_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3 TRACE("Setting color op for stage %d\n", stage); - if (stateblock->pixelShader && stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE && - ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function) { - /* Using a pixel shader? Don't care for anything here, the shader applying does it */ - return; - } + /* Using a pixel shader? Don't care for anything here, the shader applying does it */ + if (use_ps(stateblock->wineD3DDevice)) return; if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage); if (mapped_stage != -1) { - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - if (tex_used && mapped_stage >= GL_LIMITS(textures)) { - FIXME("Attempt to enable unsupported stage!\n"); - return; - } - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); - checkGLcall("glActiveTextureARB"); - } else if (stage > 0) { - WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); + if (tex_used && mapped_stage >= GL_LIMITS(textures)) { + FIXME("Attempt to enable unsupported stage!\n"); return; } + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); + checkGLcall("glActiveTextureARB"); } if(stateblock->lowest_disabled_stage > 0) { diff --git a/dlls/wined3d/pixelshader.c b/dlls/wined3d/pixelshader.c index 5857ce7f496..15392d8a95d 100644 --- a/dlls/wined3d/pixelshader.c +++ b/dlls/wined3d/pixelshader.c @@ -115,13 +115,10 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_GetFunction(IWineD3DPixelShader* * return D3DERR_MOREDATA. That's not actually true. */ return WINED3DERR_INVALIDCALL; } - if (NULL == This->baseShader.function) { /* no function defined */ - TRACE("(%p) : GetFunction no User Function defined using NULL to %p\n", This, pData); - (*(DWORD **) pData) = NULL; - } else { - TRACE("(%p) : GetFunction copying to %p\n", This, pData); - memcpy(pData, This->baseShader.function, This->baseShader.functionLength); - } + + TRACE("(%p) : GetFunction copying to %p\n", This, pData); + memcpy(pData, This->baseShader.function, This->baseShader.functionLength); + return WINED3D_OK; } @@ -226,7 +223,8 @@ static void pshader_set_limits( This->baseShader.limits.address = 0; This->baseShader.limits.packed_output = 0; - switch (This->baseShader.hex_version) { + switch (This->baseShader.reg_maps.shader_version) + { case WINED3DPS_VERSION(1,0): case WINED3DPS_VERSION(1,1): case WINED3DPS_VERSION(1,2): @@ -293,25 +291,11 @@ static void pshader_set_limits( This->baseShader.limits.sampler = 16; This->baseShader.limits.packed_input = 0; This->baseShader.limits.label = 0; - FIXME("Unrecognized pixel shader version %#x\n", - This->baseShader.hex_version); + FIXME("Unrecognized pixel shader version %#x\n", + This->baseShader.reg_maps.shader_version); } } -/** Generate a pixel shader string using either GL_FRAGMENT_PROGRAM_ARB - or GLSL and send it to the card */ -static inline GLuint IWineD3DPixelShaderImpl_GenerateShader( - IWineD3DPixelShaderImpl *This) { - SHADER_BUFFER buffer; - GLuint shader; - - shader_buffer_init(&buffer); - shader = ((IWineD3DDeviceImpl *)This->baseShader.device)->shader_backend->shader_generate_pshader((IWineD3DPixelShader *)This, &buffer); - shader_buffer_free(&buffer); - - return shader; -} - static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *iface, CONST DWORD *pFunction) { IWineD3DPixelShaderImpl *This =(IWineD3DPixelShaderImpl *)iface; @@ -381,23 +365,17 @@ static HRESULT WINAPI IWineD3DPixelShaderImpl_SetFunction(IWineD3DPixelShader *i This->baseShader.shader_mode = deviceImpl->ps_selected_mode; TRACE("(%p) : Copying the function\n", This); - if (NULL != pFunction) { - void *function; - function = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->baseShader.functionLength); - if (!function) return E_OUTOFMEMORY; - memcpy(function, pFunction, This->baseShader.functionLength); - This->baseShader.function = function; - } else { - This->baseShader.function = NULL; - } + This->baseShader.function = HeapAlloc(GetProcessHeap(), 0, This->baseShader.functionLength); + if (!This->baseShader.function) return E_OUTOFMEMORY; + memcpy(This->baseShader.function, pFunction, This->baseShader.functionLength); return WINED3D_OK; } -static void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseTexture * const *textures, - DWORD shader_version) +static void pixelshader_update_samplers(struct shader_reg_maps *reg_maps, IWineD3DBaseTexture * const *textures) { + DWORD shader_version = reg_maps->shader_version; DWORD *samplers = reg_maps->samplers; unsigned int i; @@ -444,18 +422,22 @@ static GLuint pixelshader_compile(IWineD3DPixelShaderImpl *This, const struct ps { CONST DWORD *function = This->baseShader.function; GLuint retval; + SHADER_BUFFER buffer; + IWineD3DDeviceImpl *device = (IWineD3DDeviceImpl *) This->baseShader.device; TRACE("(%p) : function %p\n", This, function); pixelshader_update_samplers(&This->baseShader.reg_maps, - ((IWineD3DDeviceImpl *)This->baseShader.device)->stateBlock->textures, This->baseShader.hex_version); + ((IWineD3DDeviceImpl *)This->baseShader.device)->stateBlock->textures); /* Reset fields tracking stateblock values being hardcoded in the shader */ This->baseShader.num_sampled_samplers = 0; /* Generate the HW shader */ TRACE("(%p) : Generating hardware program\n", This); - retval = IWineD3DPixelShaderImpl_GenerateShader(This); + shader_buffer_init(&buffer); + retval = device->shader_backend->shader_generate_pshader((IWineD3DPixelShader *)This, &buffer, args); + shader_buffer_free(&buffer); This->baseShader.is_compiled = TRUE; @@ -481,9 +463,9 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImp UINT i, sampler; IWineD3DBaseTextureImpl *tex; + memset(args, 0, sizeof(*args)); /* FIXME: Make sure all bits are set */ args->srgb_correction = stateblock->renderState[WINED3DRS_SRGBWRITEENABLE] ? 1 : 0; - memset(args->color_fixup, 0, sizeof(args->color_fixup)); for(i = 0; i < shader->baseShader.num_sampled_samplers; i++) { sampler = shader->baseShader.sampled_samplers[i]; tex = (IWineD3DBaseTextureImpl *) stateblock->textures[sampler]; @@ -493,7 +475,8 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImp } args->color_fixup[sampler] = tex->baseTexture.shader_color_fixup; } - if(shader->baseShader.hex_version >= WINED3DPS_VERSION(3,0)) { + if (shader->baseShader.reg_maps.shader_version >= WINED3DPS_VERSION(3,0)) + { if(((IWineD3DDeviceImpl *) shader->baseShader.device)->strided_streams.u.s.position_transformed) { args->vp_mode = pretransformed; } else if(use_vs((IWineD3DDeviceImpl *) shader->baseShader.device)) { @@ -501,8 +484,32 @@ void find_ps_compile_args(IWineD3DPixelShaderImpl *shader, IWineD3DStateBlockImp } else { args->vp_mode = fixedfunction; } + args->fog = FOG_OFF; } else { args->vp_mode = vertexshader; + if(stateblock->renderState[WINED3DRS_FOGENABLE]) { + switch(stateblock->renderState[WINED3DRS_FOGTABLEMODE]) { + case WINED3DFOG_NONE: + if(((IWineD3DDeviceImpl *) shader->baseShader.device)->strided_streams.u.s.position_transformed || + use_vs((IWineD3DDeviceImpl *) shader->baseShader.device)) { + args->fog = FOG_LINEAR; + break; + } + switch(stateblock->renderState[WINED3DRS_FOGVERTEXMODE]) { + case WINED3DFOG_NONE: /* Drop through */ + case WINED3DFOG_LINEAR: args->fog = FOG_LINEAR; break; + case WINED3DFOG_EXP: args->fog = FOG_EXP; break; + case WINED3DFOG_EXP2: args->fog = FOG_EXP2; break; + } + break; + + case WINED3DFOG_LINEAR: args->fog = FOG_LINEAR; break; + case WINED3DFOG_EXP: args->fog = FOG_EXP; break; + case WINED3DFOG_EXP2: args->fog = FOG_EXP2; break; + } + } else { + args->fog = FOG_OFF; + } } } diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index f76ccacb132..e4c819d2590 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -1,4 +1,3 @@ - /* * Direct3D state management * @@ -753,14 +752,10 @@ static void state_texfactor(DWORD state, IWineD3DStateBlockImpl *stateblock, Win /* And now the default texture color as well */ for (i = 0; i < GL_LIMITS(texture_stages); i++) { /* Note the WINED3DRS value applies to all textures, but GL has one - * per texture, so apply it now ready to be used! - */ - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i)); - checkGLcall("glActiveTextureARB"); - } else if (i>0) { - FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); - } + * per texture, so apply it now ready to be used! + */ + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + i)); + checkGLcall("glActiveTextureARB"); glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, &col[0]); checkGLcall("glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, color);"); @@ -902,8 +897,9 @@ static void state_stencilwrite(DWORD state, IWineD3DStateBlockImpl *stateblock, static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { BOOL fogenable = stateblock->renderState[WINED3DRS_FOGENABLE]; + IWineD3DPixelShaderImpl *ps_impl = (IWineD3DPixelShaderImpl *)stateblock->pixelShader; BOOL is_ps3 = use_ps(stateblock->wineD3DDevice) - && ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.hex_version >= WINED3DPS_VERSION(3,0); + && ps_impl->baseShader.reg_maps.shader_version >= WINED3DPS_VERSION(3,0); float fogstart, fogend; union { @@ -915,17 +911,6 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo /* No fog? Disable it, and we're done :-) */ glDisable(GL_FOG); checkGLcall("glDisable GL_FOG"); - if( use_ps(stateblock->wineD3DDevice) - && ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.hex_version < WINED3DPS_VERSION(3,0) ) { - /* disable fog in the pixel shader - * NOTE: For pixel shader, GL_FOG_START and GL_FOG_END don't hold fog start s and end e but - * -1/(e-s) and e/(e-s) respectively. - */ - glFogf(GL_FOG_START, 0.0f); - checkGLcall("glFogf(GL_FOG_START, fogstart)"); - glFogf(GL_FOG_END, 1.0f); - checkGLcall("glFogf(GL_FOG_END, fogend)"); - } return; } @@ -991,7 +976,7 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo fogend = 0.0; } - if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) { + if(context->fog_coord) { glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)"); context->fog_coord = FALSE; @@ -1032,7 +1017,7 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo default: FIXME("Unexpected WINED3DRS_FOGVERTEXMODE %d\n", stateblock->renderState[WINED3DRS_FOGVERTEXMODE]); } - if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) { + if(context->fog_coord) { glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)"); context->fog_coord = FALSE; @@ -1052,7 +1037,7 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo if(!context->last_was_rhw) { glFogi(GL_FOG_MODE, GL_EXP); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)"); - if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) { + if(context->fog_coord) { glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)"); context->fog_coord = FALSE; @@ -1064,7 +1049,7 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo if(!context->last_was_rhw) { glFogi(GL_FOG_MODE, GL_EXP2); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)"); - if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) { + if(context->fog_coord) { glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)"); context->fog_coord = FALSE; @@ -1076,7 +1061,7 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo if(!context->last_was_rhw) { glFogi(GL_FOG_MODE, GL_LINEAR); checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)"); - if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) { + if(context->fog_coord) { glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)"); context->fog_coord = FALSE; @@ -1089,20 +1074,15 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo * color contains a fog factor. Set it in drawStridedSlow. * Same happens with Vertexfog on transformed vertices */ - if(GL_SUPPORT(EXT_FOG_COORD)) { - if(context->fog_coord == FALSE) { - glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT); - checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT)"); - context->fog_coord = TRUE; - } - glFogi(GL_FOG_MODE, GL_LINEAR); - checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)"); - fogstart = 0xff; - fogend = 0x0; - } else { - /* Disable GL fog, handle this in software in drawStridedSlow */ - fogenable = FALSE; + if(context->fog_coord == FALSE) { + glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT); + checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FOG_COORDINATE_EXT)"); + context->fog_coord = TRUE; } + glFogi(GL_FOG_MODE, GL_LINEAR); + checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)"); + fogstart = 0xff; + fogend = 0x0; break; } default: FIXME("Unexpected WINED3DRS_FOGVERTEXMODE %d\n", stateblock->renderState[WINED3DRS_FOGVERTEXMODE]); @@ -1116,7 +1096,7 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo case WINED3DFOG_EXP: glFogi(GL_FOG_MODE, GL_EXP); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)"); - if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) { + if(context->fog_coord) { glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)"); context->fog_coord = FALSE; @@ -1126,7 +1106,7 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo case WINED3DFOG_EXP2: glFogi(GL_FOG_MODE, GL_EXP2); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)"); - if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) { + if(context->fog_coord) { glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)"); context->fog_coord = FALSE; @@ -1136,7 +1116,7 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo case WINED3DFOG_LINEAR: glFogi(GL_FOG_MODE, GL_LINEAR); checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)"); - if(GL_SUPPORT(EXT_FOG_COORD) && context->fog_coord) { + if(context->fog_coord) { glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT); checkGLcall("glFogi(GL_FOG_COORDINATE_SOURCE_EXT, GL_FRAGMENT_DEPTH_EXT)"); context->fog_coord = FALSE; @@ -1176,16 +1156,6 @@ static void state_fog(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo } else { glDisable(GL_FOG); checkGLcall("glDisable GL_FOG"); - if( use_ps(stateblock->wineD3DDevice) ) { - /* disable fog in the pixel shader - * NOTE: For pixel shader, GL_FOG_START and GL_FOG_END don't hold fog start s and end e but - * -1/(e-s) and e/(e-s) respectively. - */ - glFogf(GL_FOG_START, 0.0f); - checkGLcall("glFogf(GL_FOG_START, fogstart)"); - glFogf(GL_FOG_END, 1.0f); - checkGLcall("glFogf(GL_FOG_END, fogend)"); - } } } @@ -2916,26 +2886,18 @@ static void tex_colorop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3D TRACE("Setting color op for stage %d\n", stage); - if (stateblock->pixelShader && stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE && - ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function) { - /* Using a pixel shader? Don't care for anything here, the shader applying does it */ - return; - } + /* Using a pixel shader? Don't care for anything here, the shader applying does it */ + if (use_ps(stateblock->wineD3DDevice)) return; if (stage != mapped_stage) WARN("Using non 1:1 mapping: %d -> %d!\n", stage, mapped_stage); if (mapped_stage != -1) { - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - if (tex_used && mapped_stage >= GL_LIMITS(textures)) { - FIXME("Attempt to enable unsupported stage!\n"); - return; - } - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); - checkGLcall("glActiveTextureARB"); - } else if (stage > 0) { - WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); + if (tex_used && mapped_stage >= GL_LIMITS(textures)) { + FIXME("Attempt to enable unsupported stage!\n"); return; } + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); + checkGLcall("glActiveTextureARB"); } if(stage >= stateblock->lowest_disabled_stage) { @@ -2982,18 +2944,12 @@ void tex_alphaop(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext TRACE("Setting alpha op for stage %d\n", stage); /* Do not care for enabled / disabled stages, just assign the settings. colorop disables / enables required stuff */ if (mapped_stage != -1) { - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - if (tex_used && mapped_stage >= GL_LIMITS(textures)) { - FIXME("Attempt to enable unsupported stage!\n"); - return; - } - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); - checkGLcall("glActiveTextureARB"); - } else if (stage > 0) { - /* We can't do anything here */ - WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); + if (tex_used && mapped_stage >= GL_LIMITS(textures)) { + FIXME("Attempt to enable unsupported stage!\n"); return; } + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); + checkGLcall("glActiveTextureARB"); } op = stateblock->textureState[stage][WINED3DTSS_ALPHAOP]; @@ -3093,17 +3049,11 @@ static void transform_texture(DWORD state, IWineD3DStateBlockImpl *stateblock, W if (mapped_stage == -1) return; - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - if(mapped_stage >= GL_LIMITS(textures)) { - return; - } - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); - checkGLcall("glActiveTextureARB"); - } else if (mapped_stage > 0) { - /* We can't do anything here */ - WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); + if(mapped_stage >= GL_LIMITS(textures)) { return; } + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); + checkGLcall("glActiveTextureARB"); generated = (stateblock->textureState[texUnit][WINED3DTSS_TEXCOORDINDEX] & 0xFFFF0000) != WINED3DTSS_TCI_PASSTHRU; coordIdx = min(stateblock->textureState[texUnit][WINED3DTSS_TEXCOORDINDEX & 0x0000FFFF], MAX_TEXTURES - 1); @@ -3141,13 +3091,6 @@ static void loadTexCoords(IWineD3DStateBlockImpl *stateblock, const WineDirect3D unsigned int mapped_stage = 0; unsigned int textureNo = 0; - /* The code below uses glClientActiveTexture and glMultiTexCoord* which are all part of the GL_ARB_multitexture extension. */ - /* Abort if we don't support the extension. */ - if (!GL_SUPPORT(ARB_MULTITEXTURE)) { - FIXME("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); - return; - } - for (textureNo = 0; textureNo < GL_LIMITS(texture_stages); ++textureNo) { int coordIdx = stateblock->textureState[textureNo][WINED3DTSS_TEXCOORDINDEX]; @@ -3201,17 +3144,11 @@ static void tex_coordindex(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine return; } - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - if(mapped_stage >= GL_LIMITS(fragment_samplers)) { - return; - } - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); - checkGLcall("glActiveTextureARB"); - } else if (stage > 0) { - /* We can't do anything here */ - WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); + if(mapped_stage >= GL_LIMITS(fragment_samplers)) { return; } + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); + checkGLcall("glActiveTextureARB"); /* Values 0-7 are indexes into the FVF tex coords - See comments in DrawPrimitive * @@ -3445,17 +3382,11 @@ static void sampler(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCont return; } - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - if (mapped_stage >= GL_LIMITS(combined_samplers)) { - return; - } - GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); - checkGLcall("glActiveTextureARB"); - } else if (sampler > 0) { - /* We can't do anything here */ - WARN("Program using multiple concurrent textures which this opengl implementation doesn't support\n"); + if (mapped_stage >= GL_LIMITS(combined_samplers)) { return; } + GL_EXTCALL(glActiveTextureARB(GL_TEXTURE0_ARB + mapped_stage)); + checkGLcall("glActiveTextureARB"); if(stateblock->textures[sampler]) { IWineD3DBaseTexture_PreLoad(stateblock->textures[sampler]); @@ -4364,13 +4295,7 @@ static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo BOOL load_numbered = FALSE; BOOL load_named = FALSE; - if (device->vs_selected_mode != SHADER_NONE && stateblock->vertexShader && - ((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.function != NULL) { - useVertexShaderFunction = TRUE; - } else { - useVertexShaderFunction = FALSE; - } - + useVertexShaderFunction = (device->vs_selected_mode != SHADER_NONE && stateblock->vertexShader) ? TRUE : FALSE; if(device->up_strided) { /* Note: this is a ddraw fixed-function code path */ @@ -4457,20 +4382,16 @@ static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo } static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { - BOOL useVertexShaderFunction = FALSE, updateFog = FALSE; - BOOL usePixelShaderFunction = stateblock->wineD3DDevice->ps_selected_mode != SHADER_NONE && stateblock->pixelShader - && ((IWineD3DPixelShaderImpl *)stateblock->pixelShader)->baseShader.function; + BOOL updateFog = FALSE; + BOOL useVertexShaderFunction = use_vs(stateblock->wineD3DDevice); + BOOL usePixelShaderFunction = use_ps(stateblock->wineD3DDevice); BOOL transformed; /* Some stuff is in the device until we have per context tracking */ IWineD3DDeviceImpl *device = stateblock->wineD3DDevice; BOOL wasrhw = context->last_was_rhw; - /* Shaders can be implemented using ARB_PROGRAM, GLSL, or software - - * here simply check whether a shader was set, or the user disabled shaders - */ - if (use_vs(device)) { - useVertexShaderFunction = TRUE; - + if (useVertexShaderFunction) + { if(((IWineD3DVertexShaderImpl *)stateblock->vertexShader)->baseShader.reg_maps.fog != context->last_was_foggy_shader) { updateFog = TRUE; } @@ -4479,8 +4400,6 @@ static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, W } transformed = device->strided_streams.u.s.position_transformed; - if (transformed) useVertexShaderFunction = FALSE; - if(transformed != context->last_was_rhw && !useVertexShaderFunction) { updateFog = TRUE; } diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index d568de631ee..b0cb027677e 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -82,7 +82,6 @@ static void stateblock_savedstates_copy(IWineD3DStateBlock* iface, SAVEDSTATES * /* Single values */ dest->indices = source->indices; dest->material = source->material; - dest->fvf = source->fvf; dest->viewport = source->viewport; dest->vertexDecl = source->vertexDecl; dest->pixelShader = source->pixelShader; @@ -120,7 +119,6 @@ void stateblock_savedstates_set( /* Single values */ states->indices = value; states->material = value; - states->fvf = value; states->viewport = value; states->vertexDecl = value; states->pixelShader = value; @@ -167,7 +165,6 @@ void stateblock_copy( stateblock_savedstates_copy(source, &Dest->changed, &This->changed); /* Single items */ - Dest->fvf = This->fvf; Dest->vertexDecl = This->vertexDecl; Dest->vertexShader = This->vertexShader; Dest->streamIsUP = This->streamIsUP; @@ -504,10 +501,6 @@ static HRESULT WINAPI IWineD3DStateBlockImpl_Capture(IWineD3DStateBlock *iface) This->vertexDecl = targetStateBlock->vertexDecl; } - if(This->changed.fvf && This->fvf != targetStateBlock->fvf){ - This->fvf = targetStateBlock->fvf; - } - if (This->changed.material && memcmp(&targetStateBlock->material, &This->material, sizeof(WINED3DMATERIAL)) != 0) { @@ -810,10 +803,6 @@ should really perform a delta so that only the changes get updated*/ IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex); } - if (This->changed.fvf) { - IWineD3DDevice_SetFVF(pDevice, This->fvf); - } - if (This->changed.vertexDecl) { IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl); } @@ -986,7 +975,6 @@ should really perform a delta so that only the changes get updated*/ } IWineD3DDevice_SetIndices(pDevice, This->pIndexData); IWineD3DDevice_SetBaseVertexIndex(pDevice, This->baseVertexIndex); - IWineD3DDevice_SetFVF(pDevice, This->fvf); IWineD3DDevice_SetVertexDeclaration(pDevice, This->vertexDecl); IWineD3DDevice_SetMaterial(pDevice, &This->material); IWineD3DDevice_SetViewport(pDevice, &This->viewport); diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index 01914030911..0eedf231460 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -99,15 +99,11 @@ static void surface_bind_and_dirtify(IWineD3DSurfaceImpl *This) { * * TODO: Track the current active texture per GL context instead of using glGet */ - if (GL_SUPPORT(ARB_MULTITEXTURE)) { - GLint active_texture; - ENTER_GL(); - glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); - LEAVE_GL(); - active_sampler = This->resource.wineD3DDevice->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB]; - } else { - active_sampler = 0; - } + GLint active_texture; + ENTER_GL(); + glGetIntegerv(GL_ACTIVE_TEXTURE, &active_texture); + LEAVE_GL(); + active_sampler = This->resource.wineD3DDevice->rev_tex_unit_map[active_texture - GL_TEXTURE0_ARB]; if (active_sampler != -1) { IWineD3DDeviceImpl_MarkStateDirty(This->resource.wineD3DDevice, STATE_SAMPLER(active_sampler)); @@ -1700,6 +1696,14 @@ HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_ *target_bpp = 2; break; + case WINED3DFMT_G16R16: + *convert = CONVERT_G16R16; + *format = GL_RGB; + *internal = GL_RGB16_EXT; + *type = GL_UNSIGNED_SHORT; + *target_bpp = 6; + break; + default: break; } @@ -2027,6 +2031,27 @@ static HRESULT d3dfmt_convert_surface(const BYTE *src, BYTE *dst, UINT pitch, UI break; } + case CONVERT_G16R16: + { + unsigned int x, y; + const WORD *Source; + WORD *Dest; + + for(y = 0; y < height; y++) { + Source = (const WORD *)(src + y * pitch); + Dest = (WORD *) (dst + y * outpitch); + for (x = 0; x < width; x++ ) { + WORD green = (*Source++); + WORD red = (*Source++); + Dest[0] = green; + Dest[1] = red; + Dest[2] = 0xffff; + Dest += 3; + } + } + break; + } + default: ERR("Unsupported conversation type %d\n", convert); } diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index f65bcdc9063..b9c4bf233eb 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -167,7 +167,7 @@ static const GlPixelFormatDescTemplate gl_formats_template[] = { /* IEEE formats */ {WINED3DFMT_R32F ,GL_RGB32F_ARB ,GL_RGB32F_ARB , 0, GL_RED ,GL_FLOAT ,WINED3DFMT_FLAG_RENDERTARGET }, - {WINED3DFMT_G32R32F ,0 ,0 , 0, 0 ,0 + {WINED3DFMT_G32R32F ,GL_RG32F ,GL_RG32F , 0, GL_RG ,GL_FLOAT ,WINED3DFMT_FLAG_RENDERTARGET }, {WINED3DFMT_A32B32G32R32F ,GL_RGBA32F_ARB ,GL_RGBA32F_ARB , 0, GL_RGBA ,GL_FLOAT ,WINED3DFMT_FLAG_RENDERTARGET }, @@ -177,7 +177,7 @@ static const GlPixelFormatDescTemplate gl_formats_template[] = { /* Float */ {WINED3DFMT_R16F ,GL_RGB16F_ARB ,GL_RGB16F_ARB , 0, GL_RED ,GL_HALF_FLOAT_ARB ,WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET }, - {WINED3DFMT_G16R16F ,0 ,0 , 0, 0 ,0 + {WINED3DFMT_G16R16F ,GL_RG16F ,GL_RG16F , 0, GL_RG ,GL_HALF_FLOAT_ARB ,WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET }, {WINED3DFMT_A16B16G16R16F ,GL_RGBA16F_ARB ,GL_RGBA16F_ARB , 0, GL_RGBA ,GL_HALF_FLOAT_ARB ,WINED3DFMT_FLAG_POSTPIXELSHADER_BLENDING | WINED3DFMT_FLAG_FILTERING | WINED3DFMT_FLAG_RENDERTARGET }, @@ -366,10 +366,22 @@ BOOL initPixelFormats(WineD3D_GL_Info *gl_info) dst = getFmtIdx(WINED3DFMT_R16F); gl_info->gl_formats[dst].color_fixup = create_color_fixup_desc( 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W); + /* When ARB_texture_rg is supported we only require 16-bit for R16F instead of 64-bit RGBA16F */ + if(GL_SUPPORT(ARB_TEXTURE_RG)) + { + gl_info->gl_formats[dst].glInternal = GL_R16F; + gl_info->gl_formats[dst].glGammaInternal = GL_R16F; + } dst = getFmtIdx(WINED3DFMT_R32F); gl_info->gl_formats[dst].color_fixup = create_color_fixup_desc( 0, CHANNEL_SOURCE_X, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_ONE, 0, CHANNEL_SOURCE_W); + /* When ARB_texture_rg is supported we only require 32-bit for R32F instead of 128-bit RGBA32F */ + if(GL_SUPPORT(ARB_TEXTURE_RG)) + { + gl_info->gl_formats[dst].glInternal = GL_R32F; + gl_info->gl_formats[dst].glGammaInternal = GL_R32F; + } dst = getFmtIdx(WINED3DFMT_G16R16); gl_info->gl_formats[dst].color_fixup = create_color_fixup_desc( diff --git a/dlls/wined3d/vertexshader.c b/dlls/wined3d/vertexshader.c index ea8781f15cb..063f5767d5c 100644 --- a/dlls/wined3d/vertexshader.c +++ b/dlls/wined3d/vertexshader.c @@ -120,7 +120,8 @@ static void vshader_set_limits( /* Must match D3DCAPS9.MaxVertexShaderConst: at least 256 for vs_2_0 */ This->baseShader.limits.constant_float = GL_LIMITS(vshader_constantsF); - switch (This->baseShader.hex_version) { + switch (This->baseShader.reg_maps.shader_version) + { case WINED3DVS_VERSION(1,0): case WINED3DVS_VERSION(1,1): This->baseShader.limits.temporary = 12; @@ -161,7 +162,7 @@ static void vshader_set_limits( This->baseShader.limits.sampler = 0; This->baseShader.limits.label = 16; FIXME("Unrecognized vertex shader version %#x\n", - This->baseShader.hex_version); + This->baseShader.reg_maps.shader_version); } } @@ -411,13 +412,10 @@ static HRESULT WINAPI IWineD3DVertexShaderImpl_GetFunction(IWineD3DVertexShader* * return D3DERR_MOREDATA. That's not actually true. */ return WINED3DERR_INVALIDCALL; } - if (NULL == This->baseShader.function) { /* no function defined */ - TRACE("(%p) : GetFunction no User Function defined using NULL to %p\n", This, pData); - (*(DWORD **) pData) = NULL; - } else { - TRACE("(%p) : GetFunction copying to %p\n", This, pData); - memcpy(pData, This->baseShader.function, This->baseShader.functionLength); - } + + TRACE("(%p) : GetFunction copying to %p\n", This, pData); + memcpy(pData, This->baseShader.function, This->baseShader.functionLength); + return WINED3D_OK; } @@ -473,16 +471,9 @@ static HRESULT WINAPI IWineD3DVertexShaderImpl_SetFunction(IWineD3DVertexShader This->baseShader.load_local_constsF = This->baseShader.reg_maps.usesrelconstF && !list_empty(&This->baseShader.constantsF); /* copy the function ... because it will certainly be released by application */ - if (NULL != pFunction) { - void *function; - - function = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->baseShader.functionLength); - if (!function) return E_OUTOFMEMORY; - memcpy(function, pFunction, This->baseShader.functionLength); - This->baseShader.function = function; - } else { - This->baseShader.function = NULL; - } + This->baseShader.function = HeapAlloc(GetProcessHeap(), 0, This->baseShader.functionLength); + if (!This->baseShader.function) return E_OUTOFMEMORY; + memcpy(This->baseShader.function, pFunction, This->baseShader.functionLength); return WINED3D_OK; } @@ -610,12 +601,6 @@ HRESULT IWineD3DVertexShaderImpl_CompileShader(IWineD3DVertexShader *iface) { deviceImpl->shader_backend->shader_destroy((IWineD3DBaseShader *) iface); } - /* We don't need to compile */ - if (!function) { - This->baseShader.is_compiled = TRUE; - return WINED3D_OK; - } - /* Generate the HW shader */ TRACE("(%p) : Generating hardware program\n", This); IWineD3DVertexShaderImpl_GenerateShader(iface, &This->baseShader.reg_maps, function); diff --git a/dlls/wined3d/wined3d_gl.h b/dlls/wined3d/wined3d_gl.h index f92adc6a730..2d9c18af586 100644 --- a/dlls/wined3d/wined3d_gl.h +++ b/dlls/wined3d/wined3d_gl.h @@ -2037,6 +2037,39 @@ typedef void (WINE_GLAPI * PGLFNGLTEXSUBIMAGE3DEXTPROC) (GLenum target, GLint le #define GL_RGBA16F_ARB 0x881A #define GL_RGB16F_ARB 0x881B #endif +/* GL_ARB_texture_rg */ +#ifndef GL_ARB_texture_rg +#define GL_RG 0x8227 +#define GL_RG_INTEGER 0x8228 +#define GL_R8 0x8229 +#define GL_R16 0x822A +#define GL_RG8 0x822B +#define GL_RG16 0x822C +#define GL_R16F 0x822D +#define GL_R32F 0x822E +#define GL_RG16F 0x822F +#define GL_RG32F 0x8230 +#define GL_R8I 0x8231 +#define GL_R8UI 0x8232 +#define GL_R16I 0x8233 +#define GL_R16UI 0x8234 +#define GL_R32I 0x8235 +#define GL_R32UI 0x8236 +#define GL_RG8I 0x8237 +#define GL_RG8UI 0x8238 +#define GL_RG16I 0x8239 +#define GL_RG16UI 0x823A +#define GL_RG32I 0x823B +#define GL_RG32UI 0x823C +#endif +/* GL_EXT_texture_swizzle */ +#ifndef GL_EXT_texture_swizzle +#define GL_TEXTURE_SWIZZLE_R_EXT 0x8E42 +#define GL_TEXTURE_SWIZZLE_G_EXT 0x8E43 +#define GL_TEXTURE_SWIZZLE_B_EXT 0x8E44 +#define GL_TEXTURE_SWIZZLE_A_EXT 0x8E45 +#define GL_TEXTURE_SWIZZLE_RGBA_EXT 0x8E46 +#endif /* GL_ARB_half_float_pixel */ #ifndef GL_ARB_half_float_pixel #define GL_ARB_half_float_pixel @@ -2288,10 +2321,10 @@ typedef void (WINE_GLAPI * PGLFNBLENDEQUATIONSEPARATEEXTPROC) (GLenum modeRGB, G #define GL_FOG_COORDINATE_ARRAY_POINTER_EXT 0x8456 #define GL_FOG_COORDINATE_ARRAY_EXT 0x8457 #endif /* GL_EXT_fog_coord */ -typedef void (WINE_GLAPI * PGLFNGLFOGCOORDFEXTPROC) (GLfloat intesity); -typedef void (WINE_GLAPI * PGLFNGLFOGCOORDFVEXTPROC) (GLfloat intesity); -typedef void (WINE_GLAPI * PGLFNGLFOGCOORDDEXTPROC) (GLfloat intesity); -typedef void (WINE_GLAPI * PGLFNGLFOGCOORDDVEXTPROC) (GLfloat intesity); +typedef void (WINE_GLAPI * PGLFNGLFOGCOORDFEXTPROC) (GLfloat coord); +typedef void (WINE_GLAPI * PGLFNGLFOGCOORDFVEXTPROC) (const GLfloat *coord); +typedef void (WINE_GLAPI * PGLFNGLFOGCOORDDEXTPROC) (GLdouble coord); +typedef void (WINE_GLAPI * PGLFNGLFOGCOORDDVEXTPROC) (const GLdouble *coord); typedef void (WINE_GLAPI * PGLFNGLFOGCOORDPOINTEREXTPROC) (GLenum type, GLsizei stride, GLvoid *data); /* GL_ARB_shader_objects (GLSL) */ #ifndef GL_ARB_shader_objects @@ -3317,6 +3350,7 @@ typedef enum _GL_SupportedExt { ARB_TEXTURE_MIRRORED_REPEAT, ARB_TEXTURE_NON_POWER_OF_TWO, ARB_TEXTURE_RECTANGLE, + ARB_TEXTURE_RG, ARB_VERTEX_PROGRAM, ARB_VERTEX_BLEND, ARB_VERTEX_BUFFER_OBJECT, @@ -3347,6 +3381,7 @@ typedef enum _GL_SupportedExt { EXT_TEXTURE_ENV_COMBINE, EXT_TEXTURE_ENV_DOT3, EXT_TEXTURE_SRGB, + EXT_TEXTURE_SWIZZLE, EXT_GPU_PROGRAM_PARAMETERS, /* NVIDIA */ NV_HALF_FLOAT, @@ -3471,7 +3506,7 @@ typedef enum _GL_SupportedExt { USE_GL_FUNC(PGLFNGLFOGCOORDFEXTPROC, glFogCoordfEXT, EXT_FOG_COORD, NULL )\ USE_GL_FUNC(PGLFNGLFOGCOORDFVEXTPROC, glFogCoordfvEXT, EXT_FOG_COORD, NULL )\ USE_GL_FUNC(PGLFNGLFOGCOORDDEXTPROC, glFogCoorddEXT, EXT_FOG_COORD, NULL )\ - USE_GL_FUNC(PGLFNGLFOGCOORDDVEXTPROC, glFogCoordvEXT, EXT_FOG_COORD, NULL )\ + USE_GL_FUNC(PGLFNGLFOGCOORDDVEXTPROC, glFogCoorddvEXT, EXT_FOG_COORD, NULL )\ USE_GL_FUNC(PGLFNGLFOGCOORDPOINTEREXTPROC, glFogCoordPointerEXT, EXT_FOG_COORD, NULL )\ /* GL_EXT_framebuffer_object */ \ USE_GL_FUNC(PGLFNGLISRENDERBUFFEREXTPROC, glIsRenderbufferEXT, EXT_FRAMEBUFFER_OBJECT, NULL )\ diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 0b444bb2a9e..d433b537a21 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -427,19 +427,50 @@ enum tex_types tex_type_count = 5, }; +enum vertexprocessing_mode { + fixedfunction, + vertexshader, + pretransformed +}; + +struct stb_const_desc { + char texunit; + UINT const_num; +}; + +enum fogmode { + FOG_OFF, + FOG_LINEAR, + FOG_EXP, + FOG_EXP2 +}; + +/* Stateblock dependent parameters which have to be hardcoded + * into the shader code + */ +struct ps_compile_args { + struct color_fixup_desc color_fixup[MAX_FRAGMENT_SAMPLERS]; + BOOL srgb_correction; + enum vertexprocessing_mode vp_mode; + enum fogmode fog; + /* Projected textures(ps 1.0-1.3) */ + /* Texture types(2D, Cube, 3D) in ps 1.x */ +}; + typedef struct { const SHADER_HANDLER *shader_instruction_handler_table; void (*shader_select)(IWineD3DDevice *iface, BOOL usePS, BOOL useVS); void (*shader_select_depth_blt)(IWineD3DDevice *iface, enum tex_types tex_type); void (*shader_deselect_depth_blt)(IWineD3DDevice *iface); + void (*shader_update_float_vertex_constants)(IWineD3DDevice *iface, UINT start, UINT count); + void (*shader_update_float_pixel_constants)(IWineD3DDevice *iface, UINT start, UINT count); void (*shader_load_constants)(IWineD3DDevice *iface, char usePS, char useVS); - void (*shader_cleanup)(IWineD3DDevice *iface); void (*shader_color_correction)(const struct SHADER_OPCODE_ARG *arg, struct color_fixup_desc fixup); void (*shader_destroy)(IWineD3DBaseShader *iface); HRESULT (*shader_alloc_private)(IWineD3DDevice *iface); void (*shader_free_private)(IWineD3DDevice *iface); BOOL (*shader_dirtifyable_constants)(IWineD3DDevice *iface); - GLuint (*shader_generate_pshader)(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer); + GLuint (*shader_generate_pshader)(IWineD3DPixelShader *iface, SHADER_BUFFER *buffer, const struct ps_compile_args *args); void (*shader_generate_vshader)(IWineD3DVertexShader *iface, SHADER_BUFFER *buffer); void (*shader_get_caps)(WINED3DDEVTYPE devtype, const WineD3D_GL_Info *gl_info, struct shader_caps *caps); BOOL (*shader_color_fixup_supported)(struct color_fixup_desc fixup); @@ -637,7 +668,6 @@ extern glAttribFunc diffuse_funcs[WINED3DDECLTYPE_UNUSED]; extern glAttribFunc specular_funcs[WINED3DDECLTYPE_UNUSED]; extern glAttribFunc normal_funcs[WINED3DDECLTYPE_UNUSED]; extern glMultiTexCoordFunc multi_texcoord_funcs[WINED3DDECLTYPE_UNUSED]; -extern glAttribFunc texcoord_funcs[WINED3DDECLTYPE_UNUSED]; #define eps 1e-8 @@ -801,6 +831,12 @@ struct WineD3DContext { struct fbo_entry *current_fbo; GLuint src_fbo; GLuint dst_fbo; + + /* Extension emulation */ + BOOL fog_enabled; + GLint gl_fog_source; + GLfloat fog_coord_value; + GLfloat color[4], fogstart, fogend, fogcolor[4]; }; typedef enum ContextUsage { @@ -811,6 +847,7 @@ typedef enum ContextUsage { } ContextUsage; void ActivateContext(IWineD3DDeviceImpl *device, IWineD3DSurface *target, ContextUsage usage); +WineD3DContext *getActiveContext(void); WineD3DContext *CreateContext(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, HWND win, BOOL create_pbuffer, const WINED3DPRESENT_PARAMETERS *pPresentParms); void DestroyContext(IWineD3DDeviceImpl *This, WineD3DContext *context); void context_resource_released(IWineD3DDevice *iface, IWineD3DResource *resource, WINED3DRESOURCETYPE type); @@ -889,6 +926,7 @@ struct WineD3DAdapter extern BOOL InitAdapters(void); extern BOOL initPixelFormats(WineD3D_GL_Info *gl_info); extern long WineD3DAdapterChangeGLRam(IWineD3DDeviceImpl *D3DDevice, long glram); +extern void add_gl_compat_wrappers(WineD3D_GL_Info *gl_info); /***************************************************************************** * High order patch management @@ -944,12 +982,7 @@ struct texture_stage_op struct ffp_frag_settings { struct texture_stage_op op[MAX_TEXTURES]; - enum { - FOG_OFF, - FOG_LINEAR, - FOG_EXP, - FOG_EXP2 - } fog; + enum fogmode fog; /* Use an int instead of a char to get dword alignment */ unsigned int sRGB_write; }; @@ -1140,7 +1173,7 @@ struct IWineD3DDeviceImpl struct WineD3DRectPatch *currentPatch; }; -extern const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl, IWineD3DDevice_DirtyConst_Vtbl; +extern const IWineD3DDeviceVtbl IWineD3DDevice_Vtbl; HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfaceImpl *target, DWORD Count, CONST WINED3DRECT* pRects, DWORD Flags, WINED3DCOLOR Color, @@ -1679,6 +1712,7 @@ typedef enum { CONVERT_Q8W8V8U8, CONVERT_V16U16, CONVERT_A4L4, + CONVERT_G16R16, } CONVERT_TYPES; HRESULT d3dfmt_get_conv(IWineD3DSurfaceImpl *This, BOOL need_alpha_ck, BOOL use_texturing, GLenum *format, GLenum *internal, GLenum *type, CONVERT_TYPES *convert, int *target_bpp, BOOL srgb_mode); @@ -1729,7 +1763,6 @@ extern const IWineD3DVertexDeclarationVtbl IWineD3DVertexDeclaration_Vtbl; typedef struct SAVEDSTATES { BOOL indices; BOOL material; - BOOL fvf; BOOL streamSource[MAX_STREAMS]; BOOL streamFreq[MAX_STREAMS]; BOOL textures[MAX_COMBINED_SAMPLERS]; @@ -1778,8 +1811,6 @@ struct IWineD3DStateBlockImpl struct list set_vconstantsF; struct list set_pconstantsF; - /* Drawing - Vertex Shader or FVF related */ - DWORD fvf; /* Vertex Shader Declaration */ IWineD3DVertexDeclaration *vertexDecl; @@ -2067,7 +2098,7 @@ typedef struct local_constant { } local_constant; typedef struct shader_reg_maps { - + DWORD shader_version; char texcoord[MAX_REG_TEXCRD]; /* pixel < 3.0 */ char temporary[MAX_REG_TEMP]; /* pixel, vertex */ char address[MAX_REG_ADDR]; /* vertex */ @@ -2185,7 +2216,6 @@ extern void shader_glsl_add_instruction_modifiers(const SHADER_OPCODE_ARG *arg); typedef struct IWineD3DBaseShaderClass { LONG ref; - DWORD hex_version; SHADER_LIMITS limits; SHADER_PARSE_STATE parse_state; CONST SHADER_OPCODE *shader_ins; @@ -2342,29 +2372,6 @@ HRESULT IWineD3DVertexShaderImpl_CompileShader(IWineD3DVertexShader *iface); /***************************************************************************** * IDirect3DPixelShader implementation structure */ - -enum vertexprocessing_mode { - fixedfunction, - vertexshader, - pretransformed -}; - -struct stb_const_desc { - char texunit; - UINT const_num; -}; - -/* Stateblock dependent parameters which have to be hardcoded - * into the shader code - */ -struct ps_compile_args { - struct color_fixup_desc color_fixup[MAX_FRAGMENT_SAMPLERS]; - BOOL srgb_correction; - enum vertexprocessing_mode vp_mode; - /* Projected textures(ps 1.0-1.3) */ - /* Texture types(2D, Cube, 3D) in ps 1.x */ -}; - struct ps_compiled_shader { struct ps_compile_args args; GLuint prgId; @@ -2466,14 +2473,12 @@ const StaticPixelFormatDesc *getFormatDescEntry(WINED3DFORMAT fmt, static inline BOOL use_vs(IWineD3DDeviceImpl *device) { return (device->vs_selected_mode != SHADER_NONE && device->stateBlock->vertexShader - && ((IWineD3DVertexShaderImpl *)device->stateBlock->vertexShader)->baseShader.function && !device->strided_streams.u.s.position_transformed); } static inline BOOL use_ps(IWineD3DDeviceImpl *device) { return (device->ps_selected_mode != SHADER_NONE - && device->stateBlock->pixelShader - && ((IWineD3DPixelShaderImpl *)device->stateBlock->pixelShader)->baseShader.function); + && device->stateBlock->pixelShader); } void stretch_rect_fbo(IWineD3DDevice *iface, IWineD3DSurface *src_surface, WINED3DRECT *src_rect, diff --git a/dlls/wineesd.drv/audio.c b/dlls/wineesd.drv/audio.c index a48e27754a6..8ec468dbf1a 100644 --- a/dlls/wineesd.drv/audio.c +++ b/dlls/wineesd.drv/audio.c @@ -241,7 +241,7 @@ static const char *wodPlayerCmdString[] = { /* Volume functions derived from Alsaplayer source */ /* length is the number of 16 bit samples */ -void volume_effect16(void *bufin, void* bufout, int length, int left, +static void volume_effect16(void *bufin, void* bufout, int length, int left, int right, int nChannels) { short *d_out = (short *)bufout; @@ -368,7 +368,7 @@ static BOOL supportedFormat(LPWAVEFORMATEX wf) return FALSE; } -void copy_format(LPWAVEFORMATEX wf1, LPWAVEFORMATPCMEX wf2) +static void copy_format(LPWAVEFORMATEX wf1, LPWAVEFORMATPCMEX wf2) { ZeroMemory(wf2, sizeof(wf2)); if (wf1->wFormatTag == WAVE_FORMAT_PCM) @@ -383,7 +383,7 @@ void copy_format(LPWAVEFORMATEX wf1, LPWAVEFORMATPCMEX wf2) * ESD_CloseWaveOutDevice * */ -void ESD_CloseWaveOutDevice(WINE_WAVEOUT* wwo) +static void ESD_CloseWaveOutDevice(WINE_WAVEOUT* wwo) { esd_close(wwo->esd_fd); /* close the esd socket fd */ wwo->esd_fd = -1; @@ -398,7 +398,7 @@ void ESD_CloseWaveOutDevice(WINE_WAVEOUT* wwo) * ESD_CloseWaveInDevice * */ -void ESD_CloseWaveInDevice(WINE_WAVEIN* wwi) +static void ESD_CloseWaveInDevice(WINE_WAVEIN* wwi) { esd_close(wwi->esd_fd); /* close the esd socket fd */ wwi->esd_fd = -1; diff --git a/dlls/winejack.drv/audio.c b/dlls/winejack.drv/audio.c index b196e4a4b19..e503f866225 100644 --- a/dlls/winejack.drv/audio.c +++ b/dlls/winejack.drv/audio.c @@ -270,7 +270,7 @@ static DWORD bytes_to_mmtime(LPMMTIME lpTime, DWORD position, /* Alsaplayer function that applies volume changes to a buffer */ /* (C) Andy Lo A Foe */ /* Length is in terms of 32 bit samples */ -void volume_effect32(void *buffer, int length, int left, int right) +static void volume_effect32(void *buffer, int length, int left, int right) { short *data = (short *)buffer; int i, v; @@ -286,7 +286,7 @@ void volume_effect32(void *buffer, int length, int left, int right) } /* move 16 bit mono/stereo to 16 bit stereo */ -void sample_move_d16_d16(short *dst, short *src, +static void sample_move_d16_d16(short *dst, short *src, unsigned long nsamples, int nChannels) { while(nsamples--) @@ -308,7 +308,7 @@ void sample_move_d16_d16(short *dst, short *src, /* channels to a buffer that will hold a single channel stream */ /* nsamples is in terms of 16bit samples */ /* src_skip is in terms of 16bit samples */ -void sample_move_d16_s16 (sample_t *dst, short *src, +static void sample_move_d16_s16 (sample_t *dst, short *src, unsigned long nsamples, unsigned long src_skip) { /* ALERT: signed sign-extension portability !!! */ @@ -325,7 +325,7 @@ void sample_move_d16_s16 (sample_t *dst, short *src, /* to stereo data with alternating left/right channels */ /* nsamples is in terms of float samples */ /* dst_skip is in terms of 16bit samples */ -void sample_move_s16_d16 (short *dst, sample_t *src, +static void sample_move_s16_d16 (short *dst, sample_t *src, unsigned long nsamples, unsigned long dst_skip) { /* ALERT: signed sign-extension portability !!! */ @@ -340,7 +340,7 @@ void sample_move_s16_d16 (short *dst, sample_t *src, /* fill dst buffer with nsamples worth of silence */ -void sample_silence_dS (sample_t *dst, unsigned long nsamples) +static void sample_silence_dS (sample_t *dst, unsigned long nsamples) { /* ALERT: signed sign-extension portability !!! */ while (nsamples--) @@ -356,7 +356,7 @@ void sample_silence_dS (sample_t *dst, unsigned long nsamples) /* everytime the jack server wants something from us it calls this function, so we either deliver it some sound to play or deliver it nothing to play */ -int JACK_callback_wwo (nframes_t nframes, void *arg) +static int JACK_callback_wwo (nframes_t nframes, void *arg) { sample_t* out_l; sample_t* out_r; @@ -492,7 +492,7 @@ int JACK_callback_wwo (nframes_t nframes, void *arg) * Called whenever the jack server changes the max number * of frames passed to JACK_callback */ -int JACK_bufsize_wwo (nframes_t nframes, void *arg) +static int JACK_bufsize_wwo (nframes_t nframes, void *arg) { WINE_WAVEOUT* wwo = (WINE_WAVEOUT*)arg; DWORD buffer_required; @@ -540,7 +540,7 @@ int JACK_bufsize_wwo (nframes_t nframes, void *arg) * Called whenever the jack server changes the max number * of frames passed to JACK_callback */ -int JACK_bufsize_wwi (nframes_t nframes, void *arg) +static int JACK_bufsize_wwi (nframes_t nframes, void *arg) { TRACE("the maximum buffer size is now %u frames\n", nframes); return 0; @@ -549,7 +549,7 @@ int JACK_bufsize_wwi (nframes_t nframes, void *arg) /****************************************************************** * JACK_srate */ -int JACK_srate (nframes_t nframes, void *arg) +static int JACK_srate (nframes_t nframes, void *arg) { TRACE("the sample rate is now %u/sec\n", nframes); return 0; @@ -560,7 +560,7 @@ int JACK_srate (nframes_t nframes, void *arg) * JACK_shutdown_wwo */ /* if this is called then jack shut down... handle this appropriately */ -void JACK_shutdown_wwo(void* arg) +static void JACK_shutdown_wwo(void* arg) { WINE_WAVEOUT* wwo = (WINE_WAVEOUT*)arg; @@ -580,7 +580,7 @@ void JACK_shutdown_wwo(void* arg) * JACK_shutdown_wwi */ /* if this is called then jack shut down... handle this appropriately */ -void JACK_shutdown_wwi(void* arg) +static void JACK_shutdown_wwi(void* arg) { WINE_WAVEIN* wwi = (WINE_WAVEIN*)arg; @@ -1779,7 +1779,7 @@ static DWORD widNotifyClient(WINE_WAVEIN* wwi, WORD wMsg, DWORD dwParam1, DWORD */ /* everytime the jack server wants something from us it calls this function */ -int JACK_callback_wwi (nframes_t nframes, void *arg) +static int JACK_callback_wwi (nframes_t nframes, void *arg) { sample_t* in_l; sample_t* in_r = 0; diff --git a/dlls/wineoss.drv/midi.c b/dlls/wineoss.drv/midi.c index a3a63295742..7d995c25035 100644 --- a/dlls/wineoss.drv/midi.c +++ b/dlls/wineoss.drv/midi.c @@ -1699,7 +1699,7 @@ LRESULT OSS_MidiExit(void) *======================================================================*/ /************************************************************************** - * midMessage (WINEOSS.4) + * midMessage (WINEOSS.@) */ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2) @@ -1742,7 +1742,7 @@ DWORD WINAPI OSS_midMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, } /************************************************************************** - * modMessage (WINEOSS.5) + * modMessage (WINEOSS.@) */ DWORD WINAPI OSS_modMessage(UINT wDevID, UINT wMsg, DWORD_PTR dwUser, DWORD_PTR dwParam1, DWORD_PTR dwParam2) diff --git a/dlls/wineps.drv/type42.c b/dlls/wineps.drv/type42.c index 172072e5cef..23f626c6e84 100644 --- a/dlls/wineps.drv/type42.c +++ b/dlls/wineps.drv/type42.c @@ -166,7 +166,7 @@ TYPE42 *T42_download_header(PSDRV_PDEVICE *physDev, char *ps_name, "currentdict end dup /FontName get exch definefont pop\n"; - t42 = HeapAlloc(GetProcessHeap(), 0, sizeof(*t42)); + t42 = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*t42)); memcpy(t42->tables, tables_templ, sizeof(tables_templ)); t42->loca_tab = t42->glyf_tab = t42->head_tab = t42->hmtx_tab = -1; t42->emsize = emsize; diff --git a/dlls/winex11.drv/desktop.c b/dlls/winex11.drv/desktop.c index c8b202c822b..d6b2888b85a 100644 --- a/dlls/winex11.drv/desktop.c +++ b/dlls/winex11.drv/desktop.c @@ -128,7 +128,7 @@ void X11DRV_init_desktop( Window win, unsigned int width, unsigned int height ) * * Create the X11 desktop window for the desktop mode. */ -Window X11DRV_create_desktop( UINT width, UINT height ) +Window CDECL X11DRV_create_desktop( UINT width, UINT height ) { XSetWindowAttributes win_attr; Window win; diff --git a/dlls/winex11.drv/keyboard.c b/dlls/winex11.drv/keyboard.c index 2a5cd48b195..6312f24d753 100644 --- a/dlls/winex11.drv/keyboard.c +++ b/dlls/winex11.drv/keyboard.c @@ -1604,6 +1604,40 @@ X11DRV_KEYBOARD_DetectLayout( Display *display ) TRACE("detected layout is \"%s\"\n", main_key_tab[kbd_layout].comment); } +static HKL get_locale_kbd_layout(void) +{ + ULONG_PTR layout; + LANGID langid; + + /* FIXME: + * + * layout = main_key_tab[kbd_layout].lcid; + * + * Winword uses return value of GetKeyboardLayout as a codepage + * to translate ANSI keyboard messages to unicode. But we have + * a problem with it: for instance Polish keyboard layout is + * identical to the US one, and therefore instead of the Polish + * locale id we return the US one. + */ + + layout = GetUserDefaultLCID(); + + /* + * Microsoft Office expects this value to be something specific + * for Japanese and Korean Windows with an IME the value is 0xe001 + * We should probably check to see if an IME exists and if so then + * set this word properly. + */ + langid = PRIMARYLANGID(LANGIDFROMLCID(layout)); + if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN) + layout |= 0xe001 << 16; /* IME */ + else + layout |= layout << 16; + + return (HKL)layout; +} + + /********************************************************************** * X11DRV_InitKeyboard */ @@ -1843,6 +1877,17 @@ void X11DRV_InitKeyboard( Display *display ) wine_tsx11_unlock(); } +static BOOL match_x11_keyboard_layout(HKL hkl) +{ + const DWORD isIME = 0xE0000000; + HKL xHkl = get_locale_kbd_layout(); + + /* if the layout is an IME, only match the low word (LCID) */ + if (((ULONG_PTR)hkl & isIME) == isIME) + return (LOWORD(hkl) == LOWORD(xHkl)); + else + return (hkl == xHkl); +} /********************************************************************** * GetAsyncKeyState (X11DRV.@) @@ -1863,77 +1908,19 @@ SHORT X11DRV_GetAsyncKeyState(INT key) /*********************************************************************** - * GetKeyboardLayoutList (X11DRV.@) - */ -UINT X11DRV_GetKeyboardLayoutList(INT size, HKL *hkl) -{ - INT i; - - TRACE("%d, %p\n", size, hkl); - - if (!size) - { - size = 4096; /* hope we will never have that many */ - hkl = NULL; - } - - for (i = 0; main_key_tab[i].comment && (i < size); i++) - { - if (hkl) - { - ULONG_PTR layout = main_key_tab[i].lcid; - LANGID langid; - - /* see comment for GetKeyboardLayout */ - langid = PRIMARYLANGID(LANGIDFROMLCID(layout)); - if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN) - layout |= 0xe001 << 16; /* FIXME */ - else - layout |= layout << 16; - - hkl[i] = (HKL)layout; - } - } - return i; -} - - -/*********************************************************************** * GetKeyboardLayout (X11DRV.@) */ HKL X11DRV_GetKeyboardLayout(DWORD dwThreadid) { - ULONG_PTR layout; - LANGID langid; - - if (dwThreadid && dwThreadid != GetCurrentThreadId()) - FIXME("couldn't return keyboard layout for thread %04x\n", dwThreadid); - -#if 0 - layout = main_key_tab[kbd_layout].lcid; -#else - /* FIXME: - * Winword uses return value of GetKeyboardLayout as a codepage - * to translate ANSI keyboard messages to unicode. But we have - * a problem with it: for instance Polish keyboard layout is - * identical to the US one, and therefore instead of the Polish - * locale id we return the US one. - */ - layout = GetUserDefaultLCID(); -#endif - /* - * Microsoft Office expects this value to be something specific - * for Japanese and Korean Windows with an IME the value is 0xe001 - * We should probably check to see if an IME exists and if so then - * set this word properly. - */ - langid = PRIMARYLANGID(LANGIDFROMLCID(layout)); - if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN) - layout |= 0xe001 << 16; /* FIXME */ + if (!dwThreadid || dwThreadid == GetCurrentThreadId()) + { + struct x11drv_thread_data *thread_data = x11drv_thread_data(); + if (thread_data && thread_data->kbd_layout) return thread_data->kbd_layout; + } else - layout |= layout << 16; + FIXME("couldn't return keyboard layout for thread %04x\n", dwThreadid); - return (HKL)layout; + return get_locale_kbd_layout(); } @@ -1947,7 +1934,7 @@ BOOL X11DRV_GetKeyboardLayoutName(LPWSTR name) LANGID langid; layout = main_key_tab[kbd_layout].lcid; - /* see comment for GetKeyboardLayout */ + /* see comment for get_locale_kbd_layout */ langid = PRIMARYLANGID(LANGIDFROMLCID(layout)); if (langid == LANG_CHINESE || langid == LANG_JAPANESE || langid == LANG_KOREAN) layout |= 0xe001 << 16; /* FIXME */ @@ -1987,9 +1974,40 @@ BOOL X11DRV_UnloadKeyboardLayout(HKL hkl) */ HKL X11DRV_ActivateKeyboardLayout(HKL hkl, UINT flags) { - FIXME("%p, %04x: stub!\n", hkl, flags); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; + HKL oldHkl = 0; + struct x11drv_thread_data *thread_data = x11drv_init_thread_data(); + + FIXME("%p, %04x: semi-stub!\n", hkl, flags); + if (flags & KLF_SETFORPROCESS) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + FIXME("KLF_SETFORPROCESS not supported\n"); + return 0; + } + + if (flags) + FIXME("flags %x not supported\n",flags); + + if (hkl == (HKL)HKL_NEXT || hkl == (HKL)HKL_PREV) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + FIXME("HKL_NEXT and HKL_PREV not supported\n"); + return 0; + } + + if (!match_x11_keyboard_layout(hkl)) + { + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + FIXME("setting keyboard of different locales not supported\n"); + return 0; + } + + oldHkl = thread_data->kbd_layout; + if (!oldHkl) oldHkl = get_locale_kbd_layout(); + + thread_data->kbd_layout = hkl; + + return oldHkl; } @@ -2116,7 +2134,7 @@ UINT X11DRV_MapVirtualKeyEx(UINT wCode, UINT wMapType, HKL hkl) #define returnMVK(value) { TRACE("returning 0x%x.\n",value); return value; } TRACE("wCode=0x%x, wMapType=%d, hkl %p\n", wCode, wMapType, hkl); - if (hkl != X11DRV_GetKeyboardLayout(0)) + if (!match_x11_keyboard_layout(hkl)) FIXME("keyboard layout %p is not supported\n", hkl); switch(wMapType) @@ -2464,7 +2482,7 @@ INT X11DRV_ToUnicodeEx(UINT virtKey, UINT scanCode, const BYTE *lpKeyState, return 0; } - if (hkl != X11DRV_GetKeyboardLayout(0)) + if (!match_x11_keyboard_layout(hkl)) FIXME("keyboard layout %p is not supported\n", hkl); if ((lpKeyState[VK_MENU] & 0x80) && (lpKeyState[VK_CONTROL] & 0x80)) diff --git a/dlls/winex11.drv/mouse.c b/dlls/winex11.drv/mouse.c index bcae0c64def..89587d8f75d 100644 --- a/dlls/winex11.drv/mouse.c +++ b/dlls/winex11.drv/mouse.c @@ -408,6 +408,24 @@ void X11DRV_send_mouse_input( HWND hwnd, DWORD flags, DWORD x, DWORD y, */ static XcursorImage *create_cursor_image( CURSORICONINFO *ptr ) { + static const unsigned char convert_5to8[] = + { + 0x00, 0x08, 0x10, 0x19, 0x21, 0x29, 0x31, 0x3a, + 0x42, 0x4a, 0x52, 0x5a, 0x63, 0x6b, 0x73, 0x7b, + 0x84, 0x8c, 0x94, 0x9c, 0xa5, 0xad, 0xb5, 0xbd, + 0xc5, 0xce, 0xd6, 0xde, 0xe6, 0xef, 0xf7, 0xff, + }; + static const unsigned char convert_6to8[] = + { + 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x18, 0x1c, + 0x20, 0x24, 0x28, 0x2d, 0x31, 0x35, 0x39, 0x3d, + 0x41, 0x45, 0x49, 0x4d, 0x51, 0x55, 0x59, 0x5d, + 0x61, 0x65, 0x69, 0x6d, 0x71, 0x75, 0x79, 0x7d, + 0x82, 0x86, 0x8a, 0x8e, 0x92, 0x96, 0x9a, 0x9e, + 0xa2, 0xa6, 0xaa, 0xae, 0xb2, 0xb6, 0xba, 0xbe, + 0xc2, 0xc6, 0xca, 0xce, 0xd2, 0xd7, 0xdb, 0xdf, + 0xe3, 0xe7, 0xeb, 0xef, 0xf3, 0xf7, 0xfb, 0xff, + }; int x; int y; int and_size; @@ -415,6 +433,7 @@ static XcursorImage *create_cursor_image( CURSORICONINFO *ptr ) int and_width_bytes, xor_width_bytes; XcursorPixel *pixel_ptr; XcursorImage *image; + unsigned char tmp; BOOL alpha_zero = TRUE; and_width_bytes = ptr->nWidth / 8; @@ -500,11 +519,12 @@ static XcursorImage *create_cursor_image( CURSORICONINFO *ptr ) case 16: /* BGR, 5 red, 6 green, 5 blue */ - *pixel_ptr = *xor_ptr * 0x1f; - *pixel_ptr |= (*xor_ptr & 0xe0) << 3; - ++xor_ptr; - *pixel_ptr |= (*xor_ptr & 0x07) << 11; - *pixel_ptr |= (*xor_ptr & 0xf8) << 13; + /* [gggbbbbb][rrrrrggg] -> [xxxxxxxx][rrrrrrrr][gggggggg][bbbbbbbb] */ + *pixel_ptr = convert_5to8[*xor_ptr & 0x1f]; + tmp = (*xor_ptr++ & 0xe0) >> 5; + tmp |= (*xor_ptr & 0x07) << 3; + *pixel_ptr |= convert_6to8[tmp] << 16; + *pixel_ptr |= convert_5to8[*xor_ptr & 0xf8] << 24; break; case 1: diff --git a/dlls/winex11.drv/systray.c b/dlls/winex11.drv/systray.c index 17d3b07de42..ddeb2234644 100644 --- a/dlls/winex11.drv/systray.c +++ b/dlls/winex11.drv/systray.c @@ -415,7 +415,7 @@ static BOOL delete_icon( struct tray_icon *icon ) * * Driver-side implementation of Shell_NotifyIcon. */ -int wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data ) +int CDECL wine_notify_icon( DWORD msg, NOTIFYICONDATAW *data ) { BOOL ret = FALSE; struct tray_icon *icon; diff --git a/dlls/winex11.drv/winex11.drv.spec b/dlls/winex11.drv/winex11.drv.spec index 7cafaac1808..fdd32b3a90a 100644 --- a/dlls/winex11.drv/winex11.drv.spec +++ b/dlls/winex11.drv/winex11.drv.spec @@ -69,7 +69,6 @@ @ cdecl GetAsyncKeyState(long) X11DRV_GetAsyncKeyState @ cdecl GetKeyNameText(long ptr long) X11DRV_GetKeyNameText @ cdecl GetKeyboardLayout(long) X11DRV_GetKeyboardLayout -@ cdecl GetKeyboardLayoutList(long ptr) X11DRV_GetKeyboardLayoutList @ cdecl GetKeyboardLayoutName(ptr) X11DRV_GetKeyboardLayoutName @ cdecl LoadKeyboardLayout(wstr long) X11DRV_LoadKeyboardLayout @ cdecl MapVirtualKeyEx(long long long) X11DRV_MapVirtualKeyEx @@ -134,9 +133,6 @@ # System tray @ cdecl wine_notify_icon(long ptr) -# XIM -@ cdecl ForceXIMReset(long) X11DRV_ForceXIMReset - # OpenGL @ cdecl wglCopyContext(long long long) X11DRV_wglCopyContext @ cdecl wglCreateContext(ptr) X11DRV_wglCreateContext diff --git a/dlls/winex11.drv/wintab.c b/dlls/winex11.drv/wintab.c index c997c7c0c90..30f3e852ee9 100644 --- a/dlls/winex11.drv/wintab.c +++ b/dlls/winex11.drv/wintab.c @@ -484,7 +484,7 @@ static void disable_system_cursors(void) /*********************************************************************** * X11DRV_LoadTabletInfo (X11DRV.@) */ -void X11DRV_LoadTabletInfo(HWND hwnddefault) +void CDECL X11DRV_LoadTabletInfo(HWND hwnddefault) { const WCHAR SZ_CONTEXT_NAME[] = {'W','i','n','e',' ','T','a','b','l','e','t',' ','C','o','n','t','e','x','t',0}; const WCHAR SZ_DEVICE_NAME[] = {'W','i','n','e',' ','T','a','b','l','e','t',' ','D','e','v','i','c','e',0}; @@ -959,7 +959,7 @@ static void proximity_event( HWND hwnd, XEvent *event ) /*********************************************************************** * X11DRV_AttachEventQueueToTablet (X11DRV.@) */ -int X11DRV_AttachEventQueueToTablet(HWND hOwner) +int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner) { struct x11drv_thread_data *data = x11drv_init_thread_data(); int num_devices; @@ -1041,7 +1041,7 @@ int X11DRV_AttachEventQueueToTablet(HWND hOwner) /*********************************************************************** * X11DRV_GetCurrentPacket (X11DRV.@) */ -int X11DRV_GetCurrentPacket(LPWTPACKET packet) +int CDECL X11DRV_GetCurrentPacket(LPWTPACKET packet) { *packet = gMsgPacket; return 1; @@ -1062,7 +1062,7 @@ static inline int CopyTabletData(LPVOID target, LPCVOID src, INT size) /*********************************************************************** * X11DRV_WTInfoW (X11DRV.@) */ -UINT X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) +UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) { /* * It is valid to call WTInfoA with lpOutput == NULL, as per standard. @@ -1488,7 +1488,7 @@ UINT X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) /*********************************************************************** * AttachEventQueueToTablet (X11DRV.@) */ -int X11DRV_AttachEventQueueToTablet(HWND hOwner) +int CDECL X11DRV_AttachEventQueueToTablet(HWND hOwner) { return 0; } @@ -1496,7 +1496,7 @@ int X11DRV_AttachEventQueueToTablet(HWND hOwner) /*********************************************************************** * GetCurrentPacket (X11DRV.@) */ -int X11DRV_GetCurrentPacket(LPWTPACKET packet) +int CDECL X11DRV_GetCurrentPacket(LPWTPACKET packet) { return 0; } @@ -1504,14 +1504,14 @@ int X11DRV_GetCurrentPacket(LPWTPACKET packet) /*********************************************************************** * LoadTabletInfo (X11DRV.@) */ -void X11DRV_LoadTabletInfo(HWND hwnddefault) +void CDECL X11DRV_LoadTabletInfo(HWND hwnddefault) { } /*********************************************************************** * WTInfoW (X11DRV.@) */ -UINT X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) +UINT CDECL X11DRV_WTInfoW(UINT wCategory, UINT nIndex, LPVOID lpOutput) { return 0; } diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h index e5a0fe0fef8..9588a735de7 100644 --- a/dlls/winex11.drv/x11drv.h +++ b/dlls/winex11.drv/x11drv.h @@ -516,6 +516,7 @@ struct x11drv_thread_data XIM xim; /* input method */ XFontSet font_set; /* international text drawing font set */ Window selection_wnd; /* window used for selection interactions */ + HKL kbd_layout; /* active keyboard layout */ }; extern struct x11drv_thread_data *x11drv_init_thread_data(void); @@ -773,11 +774,11 @@ LPDDHALMODEINFO X11DRV_Settings_SetHandlers(const char *name, extern void X11DRV_DDHAL_SwitchMode(DWORD dwModeIndex, LPVOID fb_addr, LPVIDMEM fb_mem); /* XIM support */ -extern BOOL X11DRV_InitXIM( const char *input_style ); -extern XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data); -extern void X11DRV_SetupXIM(void); -extern void X11DRV_XIMLookupChars( const char *str, DWORD count ); -extern void X11DRV_ForceXIMReset(HWND hwnd); +extern BOOL X11DRV_InitXIM( const char *input_style ) DECLSPEC_HIDDEN; +extern XIC X11DRV_CreateIC(XIM xim, struct x11drv_win_data *data) DECLSPEC_HIDDEN; +extern void X11DRV_SetupXIM(void) DECLSPEC_HIDDEN; +extern void X11DRV_XIMLookupChars( const char *str, DWORD count ) DECLSPEC_HIDDEN; +extern void X11DRV_ForceXIMReset(HWND hwnd) DECLSPEC_HIDDEN; /* FIXME: private functions imported from user32 */ extern LRESULT HOOK_CallHooks( INT id, INT code, WPARAM wparam, LPARAM lparam, BOOL unicode ); diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 655468056e8..8b3a8f8a269 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -325,8 +325,8 @@ static void InternetReadFile_test(int flags) SET_EXPECT2(INTERNET_STATUS_REQUEST_SENT, 2); SET_EXPECT2(INTERNET_STATUS_RECEIVING_RESPONSE, 2); SET_EXPECT2(INTERNET_STATUS_RESPONSE_RECEIVED, 2); - SET_EXPECT2(INTERNET_STATUS_CLOSING_CONNECTION, 2); - SET_EXPECT2(INTERNET_STATUS_CONNECTION_CLOSED, 2); + SET_OPTIONAL2(INTERNET_STATUS_CLOSING_CONNECTION, 2); + SET_OPTIONAL2(INTERNET_STATUS_CONNECTION_CLOSED, 2); SET_EXPECT(INTERNET_STATUS_REDIRECT); SET_OPTIONAL(INTERNET_STATUS_CONNECTING_TO_SERVER); SET_OPTIONAL(INTERNET_STATUS_CONNECTED_TO_SERVER); diff --git a/dlls/winmm/lolvldrv.c b/dlls/winmm/lolvldrv.c index 794c1178502..88e3ce4eb10 100644 --- a/dlls/winmm/lolvldrv.c +++ b/dlls/winmm/lolvldrv.c @@ -737,7 +737,7 @@ static BOOL MMDRV_ExitPerType(LPWINE_MM_DRIVER lpDrv, UINT type) */ void MMDRV_Exit(void) { - int i; + unsigned int i; TRACE("()\n"); for (i = 0; i < sizeof(MM_MLDrvs) / sizeof(MM_MLDrvs[0]); i++) @@ -753,7 +753,8 @@ void MMDRV_Exit(void) } /* unload driver, in reverse order of loading */ - for (i = sizeof(MMDrvs) / sizeof(MMDrvs[0]) - 1; i >= 0; i--) + i = sizeof(MMDrvs) / sizeof(MMDrvs[0]); + while (i-- > 0) { MMDRV_ExitPerType(&MMDrvs[i], MMDRV_AUX); MMDRV_ExitPerType(&MMDrvs[i], MMDRV_MIXER); diff --git a/dlls/wintab32/wintab32.c b/dlls/wintab32/wintab32.c index 5f2afb18f8d..b52b429d949 100644 --- a/dlls/wintab32/wintab32.c +++ b/dlls/wintab32/wintab32.c @@ -36,10 +36,10 @@ static const WCHAR WC_TABLETCLASSNAME[] = {'W','i','n','e','T','a','b','l','e','t','C','l','a','s','s',0}; CRITICAL_SECTION csTablet; -int (*pLoadTabletInfo)(HWND hwnddefault) = NULL; -int (*pGetCurrentPacket)(LPWTPACKET packet) = NULL; -int (*pAttachEventQueueToTablet)(HWND hOwner) = NULL; -UINT (*pWTInfoW)(UINT wCategory, UINT nIndex, LPVOID lpOutput) = NULL; +int (CDECL *pLoadTabletInfo)(HWND hwnddefault) = NULL; +int (CDECL *pGetCurrentPacket)(LPWTPACKET packet) = NULL; +int (CDECL *pAttachEventQueueToTablet)(HWND hOwner) = NULL; +UINT (CDECL *pWTInfoW)(UINT wCategory, UINT nIndex, LPVOID lpOutput) = NULL; static LRESULT WINAPI TABLET_WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam); diff --git a/dlls/wintab32/wintab_internal.h b/dlls/wintab32/wintab_internal.h index 4fa4bfd6fcb..b0a2e8fd58f 100644 --- a/dlls/wintab32/wintab_internal.h +++ b/dlls/wintab32/wintab_internal.h @@ -151,10 +151,10 @@ int TABLET_PostTabletMessage(LPOPENCONTEXT newcontext, UINT msg, WPARAM wParam, LPOPENCONTEXT AddPacketToContextQueue(LPWTPACKET packet, HWND hwnd); /* X11drv functions */ -extern int (*pLoadTabletInfo)(HWND hwnddefault); -extern int (*pGetCurrentPacket)(LPWTPACKET packet); -extern int (*pAttachEventQueueToTablet)(HWND hOwner); -extern UINT (*pWTInfoW)(UINT wCategory, UINT nIndex, LPVOID lpOutput); +extern int (CDECL *pLoadTabletInfo)(HWND hwnddefault); +extern int (CDECL *pGetCurrentPacket)(LPWTPACKET packet); +extern int (CDECL *pAttachEventQueueToTablet)(HWND hOwner); +extern UINT (CDECL *pWTInfoW)(UINT wCategory, UINT nIndex, LPVOID lpOutput); extern HWND hwndDefault; extern CRITICAL_SECTION csTablet; diff --git a/dlls/wintrust/crypt.c b/dlls/wintrust/crypt.c index 33cc6de2d66..6337a858c09 100644 --- a/dlls/wintrust/crypt.c +++ b/dlls/wintrust/crypt.c @@ -32,9 +32,25 @@ #include "imagehlp.h" #include "wine/debug.h" +#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(wintrust); +#define CATADMIN_MAGIC 0x43415441 /* 'CATA' */ +#define CATINFO_MAGIC 0x43415449 /* 'CATI' */ + +struct catadmin +{ + DWORD magic; + WCHAR path[MAX_PATH]; +}; + +struct catinfo +{ + DWORD magic; + WCHAR file[MAX_PATH]; +}; + /*********************************************************************** * CryptCATAdminAcquireContext (WINTRUST.@) * @@ -42,7 +58,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wintrust); * * PARAMS * catAdmin [O] Pointer to the context handle. - * sysSystem [I] Pointer to a GUID for the needed subsystem. + * sys [I] Pointer to a GUID for the needed subsystem. * dwFlags [I] Reserved. * * RETURNS @@ -50,19 +66,52 @@ WINE_DEFAULT_DEBUG_CHANNEL(wintrust); * Failure: FALSE. * */ -BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN* catAdmin, - const GUID *sysSystem, DWORD dwFlags ) +BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN *catAdmin, + const GUID *sys, DWORD dwFlags) { - FIXME("%p %s %x\n", catAdmin, debugstr_guid(sysSystem), dwFlags); + static const WCHAR catroot[] = + {'\\','c','a','t','r','o','o','t',0}; + static const WCHAR fmt[] = + {'%','s','\\','{','%','0','8','x','-','%','0','4','x','-','%','0', + '4','x','-','%','0','2','x','%','0','2','x','-','%','0','2','x', + '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x', + '%','0','2','x','}',0}; + static const GUID defsys = + {0x127d0a1d,0x4ef2,0x11d1,{0x86,0x08,0x00,0xc0,0x4f,0xc2,0x95,0xee}}; + + WCHAR catroot_dir[MAX_PATH]; + struct catadmin *ca; + + TRACE("%p %s %x\n", catAdmin, debugstr_guid(sys), dwFlags); if (!catAdmin) { SetLastError(ERROR_INVALID_PARAMETER); return FALSE; } + if (!(ca = HeapAlloc(GetProcessHeap(), 0, sizeof(*ca)))) + { + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + + GetSystemDirectoryW(catroot_dir, MAX_PATH); + strcatW(catroot_dir, catroot); - *catAdmin = (HCATADMIN)0xdeadbeef; + /* create the directory if it doesn't exist */ + CreateDirectoryW(catroot_dir, NULL); + if (!sys) sys = &defsys; + sprintfW(ca->path, fmt, catroot_dir, sys->Data1, sys->Data2, + sys->Data3, sys->Data4[0], sys->Data4[1], sys->Data4[2], + sys->Data4[3], sys->Data4[4], sys->Data4[5], sys->Data4[6], + sys->Data4[7]); + + /* create the directory if it doesn't exist */ + CreateDirectoryW(ca->path, NULL); + + ca->magic = CATADMIN_MAGIC; + *catAdmin = ca; return TRUE; } @@ -72,9 +121,53 @@ BOOL WINAPI CryptCATAdminAcquireContext(HCATADMIN* catAdmin, HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile, PWSTR selectBaseName, DWORD flags) { - FIXME("%p %s %s %d\n", catAdmin, debugstr_w(catalogFile), + static const WCHAR slashW[] = {'\\',0}; + struct catadmin *ca = catAdmin; + struct catinfo *ci; + WCHAR *target; + DWORD len; + + TRACE("%p %s %s %d\n", catAdmin, debugstr_w(catalogFile), debugstr_w(selectBaseName), flags); - return (HCATINFO) 0xdeeeaaadL; + + if (!selectBaseName) + { + FIXME("NULL basename not handled\n"); + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + if (!ca || ca->magic != CATADMIN_MAGIC || !catalogFile || flags) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + len = strlenW(ca->path) + strlenW(selectBaseName) + 2; + if (!(target = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) + { + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + strcpyW(target, ca->path); + strcatW(target, slashW); + strcatW(target, selectBaseName); + + if (!CopyFileW(catalogFile, target, FALSE)) + { + HeapFree(GetProcessHeap(), 0, target); + return NULL; + } + if (!(ci = HeapAlloc(GetProcessHeap(), 0, sizeof(*ci)))) + { + HeapFree(GetProcessHeap(), 0, target); + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + ci->magic = CATINFO_MAGIC; + strcpyW(ci->file, selectBaseName); + + HeapFree(GetProcessHeap(), 0, target); + return ci; } /*********************************************************************** @@ -83,10 +176,59 @@ HCATINFO WINAPI CryptCATAdminAddCatalog(HCATADMIN catAdmin, PWSTR catalogFile, BOOL WINAPI CryptCATAdminCalcHashFromFileHandle(HANDLE hFile, DWORD* pcbHash, BYTE* pbHash, DWORD dwFlags ) { - FIXME("%p %p %p %x\n", hFile, pcbHash, pbHash, dwFlags); + BOOL ret = FALSE; - if (pbHash && pcbHash) memset(pbHash, 0, *pcbHash); - return TRUE; + TRACE("%p %p %p %x\n", hFile, pcbHash, pbHash, dwFlags); + + if (!hFile || !pcbHash || dwFlags) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + if (*pcbHash < 20) + { + *pcbHash = 20; + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return TRUE; + } + + *pcbHash = 20; + if (pbHash) + { + HCRYPTPROV prov; + HCRYPTHASH hash; + DWORD bytes_read; + BYTE *buffer; + + if (!(buffer = HeapAlloc(GetProcessHeap(), 0, 4096))) + { + SetLastError(ERROR_OUTOFMEMORY); + return FALSE; + } + ret = CryptAcquireContextW(&prov, NULL, MS_DEF_PROV_W, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT); + if (!ret) + { + HeapFree(GetProcessHeap(), 0, buffer); + return FALSE; + } + ret = CryptCreateHash(prov, CALG_SHA1, 0, 0, &hash); + if (!ret) + { + HeapFree(GetProcessHeap(), 0, buffer); + CryptReleaseContext(prov, 0); + return FALSE; + } + while ((ret = ReadFile(hFile, buffer, 4096, &bytes_read, NULL)) && bytes_read) + { + CryptHashData(hash, buffer, bytes_read, 0); + } + if (ret) ret = CryptGetHashParam(hash, HP_HASHVAL, pbHash, pcbHash, 0); + + HeapFree(GetProcessHeap(), 0, buffer); + CryptDestroyHash(hash); + CryptReleaseContext(prov, 0); + } + return ret; } /*********************************************************************** @@ -114,15 +256,25 @@ HCATINFO WINAPI CryptCATAdminEnumCatalogFromHash(HCATADMIN hCatAdmin, * * RETURNS * Success: TRUE. - * Failure: FAIL. + * Failure: FALSE. * */ BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN hCatAdmin, HCATINFO hCatInfo, DWORD dwFlags) { - FIXME("%p %p %x\n", hCatAdmin, hCatInfo, dwFlags); - return TRUE; + struct catinfo *ci = hCatInfo; + struct catadmin *ca = hCatAdmin; + + TRACE("%p %p %x\n", hCatAdmin, hCatInfo, dwFlags); + + if (!ca || ca->magic != CATADMIN_MAGIC || !ci || ci->magic != CATINFO_MAGIC) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + ci->magic = 0; + return HeapFree(GetProcessHeap(), 0, ci); } /*********************************************************************** @@ -136,13 +288,22 @@ BOOL WINAPI CryptCATAdminReleaseCatalogContext(HCATADMIN hCatAdmin, * * RETURNS * Success: TRUE. - * Failure: FAIL. + * Failure: FALSE. * */ BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags ) { - FIXME("%p %x\n", hCatAdmin, dwFlags); - return TRUE; + struct catadmin *ca = hCatAdmin; + + TRACE("%p %x\n", hCatAdmin, dwFlags); + + if (!ca || ca->magic != CATADMIN_MAGIC) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + ca->magic = 0; + return HeapFree(GetProcessHeap(), 0, ca); } /*********************************************************************** @@ -162,7 +323,15 @@ BOOL WINAPI CryptCATAdminReleaseContext(HCATADMIN hCatAdmin, DWORD dwFlags ) */ BOOL WINAPI CryptCATAdminRemoveCatalog(HCATADMIN hCatAdmin, LPCWSTR pwszCatalogFile, DWORD dwFlags) { - FIXME("%p %s %x\n", hCatAdmin, debugstr_w(pwszCatalogFile), dwFlags); + struct catadmin *ca = hCatAdmin; + + TRACE("%p %s %x\n", hCatAdmin, debugstr_w(pwszCatalogFile), dwFlags); + + if (!ca || ca->magic != CATADMIN_MAGIC) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } return DeleteFileW(pwszCatalogFile); } diff --git a/dlls/wintrust/tests/crypt.c b/dlls/wintrust/tests/crypt.c index a45f8531369..6811fd473e6 100644 --- a/dlls/wintrust/tests/crypt.c +++ b/dlls/wintrust/tests/crypt.c @@ -1,6 +1,7 @@ /* Unit test suite for wintrust crypt functions * * Copyright 2007 Paul Vriens + * Copyright 2008 Hans Leidekker 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,12 +28,63 @@ #include "wine/test.h" static char selfname[MAX_PATH]; - static CHAR CURR_DIR[MAX_PATH]; +/* + * Minimalistic catalog file. To reconstruct, save text below as winetest.cdf, + * convert to DOS line endings and run 'makecat /cat winetest.cdf' + */ + +/* +[CatalogHeader] +Name=winetest.cat +ResultDir=.\ +PublicVersion=0x00000001 +EncodingType= +CATATTR1=0x10010001:attr1:value1 +CATATTR2=0x10010001:attr2:value2 + +[CatalogFiles] +hashme=.\winetest.cdf +*/ + +const BYTE test_catalog[] = { + 0x30, 0x82, 0x01, 0xbc, 0x06, 0x09, 0x2a, 0x86, 0x48, 0x86, 0xf7, 0x0d, 0x01, 0x07, 0x02, 0xa0, + 0x82, 0x01, 0xad, 0x30, 0x82, 0x01, 0xa9, 0x02, 0x01, 0x01, 0x31, 0x00, 0x30, 0x82, 0x01, 0x9e, + 0x06, 0x09, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0a, 0x01, 0xa0, 0x82, 0x01, 0x8f, 0x30, + 0x82, 0x01, 0x8b, 0x30, 0x0c, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x01, + 0x01, 0x04, 0x10, 0xfa, 0x55, 0x2c, 0xc2, 0xf6, 0xcc, 0xdd, 0x11, 0x2a, 0x9c, 0x00, 0x14, 0x22, + 0xec, 0x8f, 0x3b, 0x17, 0x0d, 0x30, 0x38, 0x31, 0x32, 0x31, 0x38, 0x31, 0x31, 0x32, 0x36, 0x34, + 0x38, 0x5a, 0x30, 0x0e, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x01, 0x02, + 0x05, 0x00, 0x30, 0x81, 0xdd, 0x30, 0x81, 0xda, 0x04, 0x0e, 0x68, 0x00, 0x61, 0x00, 0x73, 0x00, + 0x68, 0x00, 0x6d, 0x00, 0x65, 0x00, 0x00, 0x00, 0x31, 0x81, 0xc7, 0x30, 0x61, 0x06, 0x0a, 0x2b, + 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x04, 0x31, 0x53, 0x30, 0x51, 0x30, 0x2c, 0x06, + 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x02, 0x01, 0x19, 0xa2, 0x1e, 0x80, 0x1c, 0x00, + 0x3c, 0x00, 0x3c, 0x00, 0x3c, 0x00, 0x4f, 0x00, 0x62, 0x00, 0x73, 0x00, 0x6f, 0x00, 0x6c, 0x00, + 0x65, 0x00, 0x74, 0x00, 0x65, 0x00, 0x3e, 0x00, 0x3e, 0x00, 0x3e, 0x30, 0x21, 0x30, 0x09, 0x06, + 0x05, 0x2b, 0x0e, 0x03, 0x02, 0x1a, 0x05, 0x00, 0x04, 0x14, 0xed, 0xd6, 0x9c, 0x9c, 0xb2, 0xfc, + 0xaa, 0x03, 0xe8, 0xd3, 0x20, 0xf6, 0xab, 0x28, 0xc3, 0xff, 0xbd, 0x07, 0x36, 0xf5, 0x30, 0x62, + 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x02, 0x02, 0x31, 0x54, 0x30, 0x52, + 0x1e, 0x4c, 0x00, 0x7b, 0x00, 0x44, 0x00, 0x45, 0x00, 0x33, 0x00, 0x35, 0x00, 0x31, 0x00, 0x41, + 0x00, 0x34, 0x00, 0x32, 0x00, 0x2d, 0x00, 0x38, 0x00, 0x45, 0x00, 0x35, 0x00, 0x39, 0x00, 0x2d, + 0x00, 0x31, 0x00, 0x31, 0x00, 0x44, 0x00, 0x30, 0x00, 0x2d, 0x00, 0x38, 0x00, 0x43, 0x00, 0x34, + 0x00, 0x37, 0x00, 0x2d, 0x00, 0x30, 0x00, 0x30, 0x00, 0x43, 0x00, 0x30, 0x00, 0x34, 0x00, 0x46, + 0x00, 0x43, 0x00, 0x32, 0x00, 0x39, 0x00, 0x35, 0x00, 0x45, 0x00, 0x45, 0x00, 0x7d, 0x02, 0x02, + 0x02, 0x00, 0xa0, 0x6a, 0x30, 0x68, 0x30, 0x32, 0x06, 0x0a, 0x2b, 0x06, 0x01, 0x04, 0x01, 0x82, + 0x37, 0x0c, 0x02, 0x01, 0x04, 0x24, 0x30, 0x22, 0x1e, 0x0a, 0x00, 0x61, 0x00, 0x74, 0x00, 0x74, + 0x00, 0x72, 0x00, 0x32, 0x02, 0x04, 0x10, 0x01, 0x00, 0x01, 0x04, 0x0e, 0x76, 0x00, 0x61, 0x00, + 0x6c, 0x00, 0x75, 0x00, 0x65, 0x00, 0x32, 0x00, 0x00, 0x00, 0x30, 0x32, 0x06, 0x0a, 0x2b, 0x06, + 0x01, 0x04, 0x01, 0x82, 0x37, 0x0c, 0x02, 0x01, 0x04, 0x24, 0x30, 0x22, 0x1e, 0x0a, 0x00, 0x61, + 0x00, 0x74, 0x00, 0x74, 0x00, 0x72, 0x00, 0x31, 0x02, 0x04, 0x10, 0x01, 0x00, 0x01, 0x04, 0x0e, + 0x76, 0x00, 0x61, 0x00, 0x6c, 0x00, 0x75, 0x00, 0x65, 0x00, 0x31, 0x00, 0x00, 0x00, 0x31, 0x00, +}; + static BOOL (WINAPI * pCryptCATAdminAcquireContext)(HCATADMIN*, const GUID*, DWORD); static BOOL (WINAPI * pCryptCATAdminReleaseContext)(HCATADMIN, DWORD); static BOOL (WINAPI * pCryptCATAdminCalcHashFromFileHandle)(HANDLE hFile, DWORD*, BYTE*, DWORD); +static HCATINFO (WINAPI * pCryptCATAdminAddCatalog)(HCATADMIN, PWSTR, PWSTR, DWORD); +static BOOL (WINAPI * pCryptCATAdminRemoveCatalog)(HCATADMIN, LPCWSTR, DWORD); +static BOOL (WINAPI * pCryptCATAdminReleaseCatalogContext)(HCATADMIN, HCATINFO, DWORD); static void InitFunctionPtrs(void) { @@ -47,25 +99,23 @@ static void InitFunctionPtrs(void) WINTRUST_GET_PROC(CryptCATAdminAcquireContext) WINTRUST_GET_PROC(CryptCATAdminReleaseContext) WINTRUST_GET_PROC(CryptCATAdminCalcHashFromFileHandle) + WINTRUST_GET_PROC(CryptCATAdminAddCatalog) + WINTRUST_GET_PROC(CryptCATAdminRemoveCatalog) + WINTRUST_GET_PROC(CryptCATAdminReleaseCatalogContext) #undef WINTRUST_GET_PROC } +static GUID dummy = {0xdeadbeef,0xdead,0xbeef,{0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef}}; + static void test_context(void) { BOOL ret; HCATADMIN hca; - static GUID dummy = { 0xdeadbeef, 0xdead, 0xbeef, { 0xde,0xad,0xbe,0xef,0xde,0xad,0xbe,0xef }}; static GUID unknown = { 0xC689AABA, 0x8E78, 0x11D0, { 0x8C,0x47,0x00,0xC0,0x4F,0xC2,0x95,0xEE }}; /* WINTRUST.DLL */ CHAR windir[MAX_PATH], catroot[MAX_PATH], catroot2[MAX_PATH], dummydir[MAX_PATH]; DWORD attrs; - if (!pCryptCATAdminAcquireContext || !pCryptCATAdminReleaseContext) - { - skip("CryptCATAdminAcquireContext and/or CryptCATAdminReleaseContext are not available\n"); - return; - } - /* When CryptCATAdminAcquireContext is successful it will create * several directories if they don't exist: * @@ -102,23 +152,16 @@ static void test_context(void) "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); /* NULL GUID */ - SetLastError(0xdeadbeef); ret = pCryptCATAdminAcquireContext(&hca, NULL, 0); ok(ret, "Expected success\n"); - ok(GetLastError() == ERROR_SUCCESS || - GetLastError() == 0xdeadbeef /* Vista */, - "Expected ERROR_SUCCESS or 0xdeadbeef, got %d\n", GetLastError()); ok(hca != NULL, "Expected a context handle, got NULL\n"); /* All NULL */ SetLastError(0xdeadbeef); ret = pCryptCATAdminReleaseContext(NULL, 0); - todo_wine - { ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); - } /* Proper release */ SetLastError(0xdeadbeef); @@ -130,12 +173,9 @@ static void test_context(void) /* Try to release a second time */ SetLastError(0xdeadbeef); ret = pCryptCATAdminReleaseContext(hca, 0); - todo_wine - { ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); - } /* NULL context handle and dummy GUID */ SetLastError(0xdeadbeef); @@ -154,12 +194,8 @@ static void test_context(void) * save to remove files and directories from CatRoot/CatRoot2. */ - SetLastError(0xdeadbeef); ret = pCryptCATAdminAcquireContext(&hca, &dummy, 0); ok(ret, "Expected success\n"); - ok(GetLastError() == ERROR_SUCCESS || - GetLastError() == 0xdeadbeef /* Vista */, - "Expected ERROR_SUCCESS or 0xdeadbeef, got %d\n", GetLastError()); ok(hca != NULL, "Expected a context handle, got NULL\n"); GetWindowsDirectoryA(windir, MAX_PATH); @@ -169,20 +205,14 @@ static void test_context(void) lstrcatA(catroot2, "\\system32\\CatRoot2"); attrs = GetFileAttributes(catroot); - /* On a clean Wine this will fail. When a native wintrust.dll was used in the past - * some tests will succeed. - */ - todo_wine - ok(attrs != INVALID_FILE_ATTRIBUTES, - "Expected the CatRoot directory to exist\n"); + ok(attrs != INVALID_FILE_ATTRIBUTES, "Expected the CatRoot directory to exist\n"); /* Windows creates the GUID directory in capitals */ lstrcpyA(dummydir, catroot); lstrcatA(dummydir, "\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF}"); attrs = GetFileAttributes(dummydir); - todo_wine - ok(attrs != INVALID_FILE_ATTRIBUTES, - "Expected CatRoot\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF} directory to exist\n"); + ok(attrs != INVALID_FILE_ATTRIBUTES, + "Expected CatRoot\\{DEADBEEF-DEAD-BEEF-DEAD-BEEFDEADBEEF} directory to exist\n"); /* Only present on XP or higher. */ attrs = GetFileAttributes(catroot2); @@ -199,24 +229,16 @@ static void test_context(void) ok(ret, "Expected success\n"); /* Correct context handle and GUID */ - SetLastError(0xdeadbeef); ret = pCryptCATAdminAcquireContext(&hca, &unknown, 0); ok(ret, "Expected success\n"); - ok(GetLastError() == ERROR_SUCCESS || - GetLastError() == 0xdeadbeef /* Vista */, - "Expected ERROR_SUCCESS or 0xdeadbeef, got %d\n", GetLastError()); ok(hca != NULL, "Expected a context handle, got NULL\n"); ret = pCryptCATAdminReleaseContext(hca, 0); ok(ret, "Expected success\n"); /* Flags not equal to 0 */ - SetLastError(0xdeadbeef); ret = pCryptCATAdminAcquireContext(&hca, &unknown, 1); ok(ret, "Expected success\n"); - ok(GetLastError() == ERROR_SUCCESS || - GetLastError() == 0xdeadbeef /* Vista */, - "Expected ERROR_SUCCESS or 0xdeadbeef, got %d\n", GetLastError()); ok(hca != NULL, "Expected a context handle, got NULL\n"); ret = pCryptCATAdminReleaseContext(hca, 0); @@ -234,84 +256,61 @@ static void test_calchash(void) CHAR temp[MAX_PATH]; DWORD written; - if (!pCryptCATAdminCalcHashFromFileHandle) - { - skip("CryptCATAdminCalcHashFromFileHandle is not available\n"); - return; - } - /* All NULL */ SetLastError(0xdeadbeef); ret = pCryptCATAdminCalcHashFromFileHandle(NULL, NULL, NULL, 0); - todo_wine - { ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); - } /* NULL filehandle, rest is legal */ SetLastError(0xdeadbeef); ret = pCryptCATAdminCalcHashFromFileHandle(NULL, &hashsize, NULL, 0); - todo_wine - { ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); - } /* Correct filehandle, rest is NULL */ file = CreateFileA(selfname, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); SetLastError(0xdeadbeef); ret = pCryptCATAdminCalcHashFromFileHandle(file, NULL, NULL, 0); - todo_wine - { ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); - } CloseHandle(file); /* All OK, but dwFlags set to 1 */ file = CreateFileA(selfname, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); SetLastError(0xdeadbeef); ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, NULL, 1); - todo_wine - { ok(!ret, "Expected failure\n"); ok(GetLastError() == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", GetLastError()); - } CloseHandle(file); /* All OK, requesting the size of the hash */ - file = CreateFileA(selfname, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + file = CreateFileA(selfname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); + ok(file != INVALID_HANDLE_VALUE, "CreateFile failed %u\n", GetLastError()); SetLastError(0xdeadbeef); ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, NULL, 0); - ok(ret, "Expected success\n"); - todo_wine - { + ok(ret, "Expected success %u\n", GetLastError()); ok(hashsize == 20," Expected a hash size of 20, got %d\n", hashsize); ok(GetLastError() == ERROR_INSUFFICIENT_BUFFER, "Expected ERROR_INSUFFICIENT_BUFFER, got %d\n", GetLastError()); - } CloseHandle(file); /* All OK, retrieve the hash * Double the hash buffer to see what happens to the size parameter */ - file = CreateFileA(selfname, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL); + file = CreateFileA(selfname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL); hashsize *= 2; hash = HeapAlloc(GetProcessHeap(), 0, hashsize); SetLastError(0xdeadbeef); ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, hash, 0); - ok(ret, "Expected success\n"); - todo_wine - { + ok(ret, "Expected success %u\n", GetLastError()); ok(hashsize == 20," Expected a hash size of 20, got %d\n", hashsize); ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); - } CloseHandle(file); HeapFree(GetProcessHeap(), 0, hash); @@ -331,20 +330,102 @@ static void test_calchash(void) SetLastError(0xdeadbeef); ret = pCryptCATAdminCalcHashFromFileHandle(file, &hashsize, hash, 0); ok(ret, "Expected success\n"); - todo_wine - { ok(GetLastError() == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", GetLastError()); ok(hashsize == sizeof(expectedhash) && !memcmp(hash, expectedhash, sizeof(expectedhash)), "Hashes didn't match\n"); - } CloseHandle(file); HeapFree(GetProcessHeap(), 0, hash); DeleteFileA(temp); } +static void test_CryptCATAdminAddRemoveCatalog(void) +{ + static WCHAR basenameW[] = {'w','i','n','e','t','e','s','t','.','c','a','t',0}; + HCATADMIN hcatadmin; + HCATINFO hcatinfo; + WCHAR tmpfileW[MAX_PATH]; + char tmpfile[MAX_PATH]; + HANDLE file; + DWORD error, written; + BOOL ret; + + if (!pCryptCATAdminRemoveCatalog) + { + /* NT4 and W2K do have CryptCATAdminAddCatalog !! */ + win_skip("CryptCATAdminRemoveCatalog is not available\n"); + return; + } + + if (!GetTempFileNameA(CURR_DIR, "cat", 0, tmpfile)) return; + DeleteFileA(tmpfile); + file = CreateFileA(tmpfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL); + ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError()); + CloseHandle(file); + + ret = pCryptCATAdminAcquireContext(&hcatadmin, &dummy, 0); + ok(ret, "CryptCATAdminAcquireContext failed %u\n", GetLastError()); + + SetLastError(0xdeadbeef); + hcatinfo = pCryptCATAdminAddCatalog(NULL, NULL, NULL, 0); + error = GetLastError(); + ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n"); + ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMTER\n", GetLastError()); + + SetLastError(0xdeadbeef); + hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, NULL, NULL, 0); + error = GetLastError(); + ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n"); + ok(error == ERROR_INVALID_PARAMETER, "got %u expected INVALID_PARAMTER\n", GetLastError()); + + MultiByteToWideChar(0, 0, tmpfile, -1, tmpfileW, MAX_PATH); + + SetLastError(0xdeadbeef); + hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 0); + error = GetLastError(); + todo_wine { + ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n"); + ok(error == ERROR_BAD_FORMAT, "got %u expected ERROR_BAD_FORMAT\n", GetLastError()); + } + + SetLastError(0xdeadbeef); + hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 1); + error = GetLastError(); + ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n"); + ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMTER\n", GetLastError()); + + SetLastError(0xdeadbeef); + hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, NULL, 0); + error = GetLastError(); + ok(hcatinfo == NULL, "CryptCATAdminAddCatalog succeeded\n"); + todo_wine ok(error == ERROR_BAD_FORMAT, "got %u expected ERROR_BAD_FORMAT\n", GetLastError()); + + DeleteFileA(tmpfile); + file = CreateFileA(tmpfile, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, NULL); + ok(file != INVALID_HANDLE_VALUE, "CreateFileA failed %u\n", GetLastError()); + WriteFile(file, test_catalog, sizeof(test_catalog), &written, NULL); + CloseHandle(file); + + hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, NULL, 0); + todo_wine ok(hcatinfo != NULL, "CryptCATAdminAddCatalog failed %u\n", GetLastError()); + + hcatinfo = pCryptCATAdminAddCatalog(hcatadmin, tmpfileW, basenameW, 0); + ok(hcatinfo != NULL, "CryptCATAdminAddCatalog failed %u\n", GetLastError()); + + ret = pCryptCATAdminReleaseCatalogContext(hcatadmin, hcatinfo, 0); + ok(ret, "CryptCATAdminReleaseCatalogContext failed %u\n", GetLastError()); + + ret = pCryptCATAdminRemoveCatalog(hcatadmin, tmpfileW, 0); + ok(ret, "CryptCATAdminRemoveCatalog failed %u\n", GetLastError()); + + ret = pCryptCATAdminReleaseContext(hcatadmin, 0); + ok(ret, "CryptCATAdminReleaseContext failed %u\n", GetLastError()); + + DeleteFileA(tmpfile); +} + START_TEST(crypt) { int myARGC; @@ -352,6 +433,12 @@ START_TEST(crypt) InitFunctionPtrs(); + if (!pCryptCATAdminAcquireContext) + { + win_skip("CryptCATAdmin functions are not available\n"); + return; + } + myARGC = winetest_get_mainargs(&myARGV); strcpy(selfname, myARGV[0]); @@ -359,4 +446,5 @@ START_TEST(crypt) test_context(); test_calchash(); + test_CryptCATAdminAddRemoveCatalog(); } diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index b05067af428..14f357fc1b5 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -1124,7 +1124,7 @@ static int WS2_recv( int fd, struct ws2_async *wsa ) * * Handler for overlapped recv() operations. */ -static NTSTATUS WS2_async_recv( void* user, IO_STATUS_BLOCK* iosb, NTSTATUS status, ULONG_PTR *total ) +static NTSTATUS WS2_async_recv( void* user, IO_STATUS_BLOCK* iosb, NTSTATUS status, ULONG *total ) { ws2_async* wsa = user; int result = 0, fd; @@ -1225,7 +1225,7 @@ static int WS2_send( int fd, struct ws2_async *wsa ) * * Handler for overlapped send() operations. */ -static NTSTATUS WS2_async_send(void* user, IO_STATUS_BLOCK* iosb, NTSTATUS status, ULONG_PTR *total ) +static NTSTATUS WS2_async_send(void* user, IO_STATUS_BLOCK* iosb, NTSTATUS status, ULONG *total ) { ws2_async* wsa = user; int result = 0, fd; @@ -1280,7 +1280,7 @@ static NTSTATUS WS2_async_send(void* user, IO_STATUS_BLOCK* iosb, NTSTATUS statu * * Handler for shutdown() operations on overlapped sockets. */ -static NTSTATUS WS2_async_shutdown( void* user, PIO_STATUS_BLOCK iosb, NTSTATUS status ) +static NTSTATUS WS2_async_shutdown( void* user, PIO_STATUS_BLOCK iosb, NTSTATUS status, ULONG *total ) { ws2_async* wsa = user; int fd, err = 1; @@ -1300,6 +1300,7 @@ static NTSTATUS WS2_async_shutdown( void* user, PIO_STATUS_BLOCK iosb, NTSTATUS status = err ? wsaErrno() : STATUS_SUCCESS; break; } + *total = 0; iosb->u.Status = status; return status; } @@ -2647,7 +2648,8 @@ int WINAPI WS_select(int nfds, WS_fd_set *ws_readfds, } /* helper to send completion messages for client-only i/o operation case */ -static void WS_AddCompletion( SOCKET sock, ULONG_PTR CompletionValue, NTSTATUS CompletionStatus, ULONG_PTR Information ) +static void WS_AddCompletion( SOCKET sock, ULONG_PTR CompletionValue, NTSTATUS CompletionStatus, + ULONG Information ) { NTSTATUS status; diff --git a/dlls/inseng/Makefile.in b/dlls/wuapi/Makefile.in similarity index 59% copy from dlls/inseng/Makefile.in copy to dlls/wuapi/Makefile.in index 4173760685c..5aefd199535 100644 --- a/dlls/inseng/Makefile.in +++ b/dlls/wuapi/Makefile.in @@ -1,14 +1,19 @@ +EXTRADEFS = -DCOM_NO_WINDOWS_H TOPSRCDIR = @top_srcdir@ TOPOBJDIR = ../.. SRCDIR = @srcdir@ VPATH = @srcdir@ -MODULE = inseng.dll -IMPORTS = uuid ole32 user32 advapi32 kernel32 -EXTRADEFS = -DCOM_NO_WINDOWS_H +MODULE = wuapi.dll +IMPORTS = uuid ole32 advapi32 kernel32 C_SRCS = \ - inseng_main.c \ - regsvr.c + downloader.c \ + installer.c \ + main.c \ + regsvr.c \ + searcher.c \ + session.c \ + updates.c @MAKE_DLL_RULES@ diff --git a/dlls/wuapi/downloader.c b/dlls/wuapi/downloader.c new file mode 100644 index 00000000000..72929661df5 --- /dev/null +++ b/dlls/wuapi/downloader.c @@ -0,0 +1,267 @@ +/* + * IUpdateDownloader implementation + * + * Copyright 2008 Hans Leidekker + * + * 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 + */ + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "initguid.h" +#include "wuapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wuapi); + +typedef struct _update_downloader +{ + const struct IUpdateDownloaderVtbl *vtbl; + LONG refs; +} update_downloader; + +static inline update_downloader *impl_from_IUpdateDownloader( IUpdateDownloader *iface ) +{ + return (update_downloader *)((char *)iface - FIELD_OFFSET( update_downloader, vtbl )); +} + +static ULONG WINAPI update_downloader_AddRef( + IUpdateDownloader *iface ) +{ + update_downloader *update_downloader = impl_from_IUpdateDownloader( iface ); + return InterlockedIncrement( &update_downloader->refs ); +} + +static ULONG WINAPI update_downloader_Release( + IUpdateDownloader *iface ) +{ + update_downloader *update_downloader = impl_from_IUpdateDownloader( iface ); + LONG refs = InterlockedDecrement( &update_downloader->refs ); + if (!refs) + { + TRACE("destroying %p\n", update_downloader); + HeapFree( GetProcessHeap(), 0, update_downloader ); + } + return refs; +} + +static HRESULT WINAPI update_downloader_QueryInterface( + IUpdateDownloader *iface, + REFIID riid, + void **ppvObject ) +{ + update_downloader *This = impl_from_IUpdateDownloader( iface ); + + TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IUpdateDownloader ) || + IsEqualGUID( riid, &IID_IDispatch ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IUpdateDownloader_AddRef( iface ); + return S_OK; +} + +static HRESULT WINAPI update_downloader_GetTypeInfoCount( + IUpdateDownloader *iface, + UINT *pctinfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_GetTypeInfo( + IUpdateDownloader *iface, + UINT iTInfo, + LCID lcid, + ITypeInfo **ppTInfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_GetIDsOfNames( + IUpdateDownloader *iface, + REFIID riid, + LPOLESTR *rgszNames, + UINT cNames, + LCID lcid, + DISPID *rgDispId ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_Invoke( + IUpdateDownloader *iface, + DISPID dispIdMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS *pDispParams, + VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, + UINT *puArgErr ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_get_IsForced( + IUpdateDownloader *This, + VARIANT_BOOL *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_put_IsForced( + IUpdateDownloader *This, + VARIANT_BOOL value ) +{ + FIXME("%p, %d\n", This, value); + return S_OK; +} + +static HRESULT WINAPI update_downloader_get_ClientApplicationID( + IUpdateDownloader *This, + BSTR *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_put_ClientApplicationID( + IUpdateDownloader *This, + BSTR value ) +{ + FIXME("%p, %s\n", This, debugstr_w(value)); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_get_Priority( + IUpdateDownloader *This, + DownloadPriority *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_put_Priority( + IUpdateDownloader *This, + DownloadPriority value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_get_Updates( + IUpdateDownloader *This, + IUpdateCollection **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_put_Updates( + IUpdateDownloader *This, + IUpdateCollection *value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_BeginDownload( + IUpdateDownloader *This, + IUnknown *onProgressChanged, + IUnknown *onCompleted, + VARIANT state, + IDownloadJob **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_Download( + IUpdateDownloader *This, + IDownloadResult **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_downloader_EndDownload( + IUpdateDownloader *This, + IDownloadJob *value, + IDownloadResult **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static const struct IUpdateDownloaderVtbl update_downloader_vtbl = +{ + update_downloader_QueryInterface, + update_downloader_AddRef, + update_downloader_Release, + update_downloader_GetTypeInfoCount, + update_downloader_GetTypeInfo, + update_downloader_GetIDsOfNames, + update_downloader_Invoke, + update_downloader_get_ClientApplicationID, + update_downloader_put_ClientApplicationID, + update_downloader_get_IsForced, + update_downloader_put_IsForced, + update_downloader_get_Priority, + update_downloader_put_Priority, + update_downloader_get_Updates, + update_downloader_put_Updates, + update_downloader_BeginDownload, + update_downloader_Download, + update_downloader_EndDownload +}; + +HRESULT UpdateDownloader_create( IUnknown *pUnkOuter, LPVOID *ppObj ) +{ + update_downloader *downloader; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + downloader = HeapAlloc( GetProcessHeap(), 0, sizeof(*downloader) ); + if (!downloader) return E_OUTOFMEMORY; + + downloader->vtbl = &update_downloader_vtbl; + downloader->refs = 1; + + *ppObj = &downloader->vtbl; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} diff --git a/dlls/wuapi/installer.c b/dlls/wuapi/installer.c new file mode 100644 index 00000000000..1a2c5530a24 --- /dev/null +++ b/dlls/wuapi/installer.c @@ -0,0 +1,253 @@ +/* + * IUpdateInstaller implementation + * + * Copyright 2008 Hans Leidekker + * + * 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 + */ + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "wuapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wuapi); + +typedef struct _update_installer +{ + const struct IUpdateInstallerVtbl *vtbl; + LONG refs; +} update_installer; + +static inline update_installer *impl_from_IUpdateInstaller( IUpdateInstaller *iface ) +{ + return (update_installer *)((char *)iface - FIELD_OFFSET( update_installer, vtbl )); +} + +static ULONG WINAPI update_installer_AddRef( + IUpdateInstaller *iface ) +{ + update_installer *update_installer = impl_from_IUpdateInstaller( iface ); + return InterlockedIncrement( &update_installer->refs ); +} + +static ULONG WINAPI update_installer_Release( + IUpdateInstaller *iface ) +{ + update_installer *update_installer = impl_from_IUpdateInstaller( iface ); + LONG refs = InterlockedDecrement( &update_installer->refs ); + if (!refs) + { + TRACE("destroying %p\n", update_installer); + HeapFree( GetProcessHeap(), 0, update_installer ); + } + return refs; +} + +static HRESULT WINAPI update_installer_QueryInterface( + IUpdateInstaller *iface, + REFIID riid, + void **ppvObject ) +{ + update_installer *This = impl_from_IUpdateInstaller( iface ); + + TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IUpdateInstaller ) || + IsEqualGUID( riid, &IID_IDispatch ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IUpdateInstaller_AddRef( iface ); + return S_OK; +} + +static HRESULT WINAPI update_installer_GetTypeInfoCount( + IUpdateInstaller *iface, + UINT *pctinfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_GetTypeInfo( + IUpdateInstaller *iface, + UINT iTInfo, + LCID lcid, + ITypeInfo **ppTInfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_GetIDsOfNames( + IUpdateInstaller *iface, + REFIID riid, + LPOLESTR *rgszNames, + UINT cNames, + LCID lcid, + DISPID *rgDispId ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_Invoke( + IUpdateInstaller *iface, + DISPID dispIdMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS *pDispParams, + VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, + UINT *puArgErr ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_get_ClientApplicationID( + IUpdateInstaller *This, + BSTR *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_put_ClientApplicationID( + IUpdateInstaller *This, + BSTR value ) +{ + FIXME("%p, %s\n", This, debugstr_w(value)); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_get_IsForced( + IUpdateInstaller *This, + VARIANT_BOOL *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_put_IsForced( + IUpdateInstaller *This, + VARIANT_BOOL value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_get_ParentHwnd( + IUpdateInstaller *This, + HWND *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_put_ParentHwnd( + IUpdateInstaller *This, + HWND value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_put_ParentWindow( + IUpdateInstaller *This, + IUnknown *value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_get_ParentWindow( + IUpdateInstaller *This, + IUnknown **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_get_Updates( + IUpdateInstaller *This, + IUpdateCollection **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_installer_put_Updates( + IUpdateInstaller *This, + IUpdateCollection *value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static const struct IUpdateInstallerVtbl update_installer_vtbl = +{ + update_installer_QueryInterface, + update_installer_AddRef, + update_installer_Release, + update_installer_GetTypeInfoCount, + update_installer_GetTypeInfo, + update_installer_GetIDsOfNames, + update_installer_Invoke, + update_installer_get_ClientApplicationID, + update_installer_put_ClientApplicationID, + update_installer_get_IsForced, + update_installer_put_IsForced, + update_installer_get_ParentHwnd, + update_installer_put_ParentHwnd, + update_installer_put_ParentWindow, + update_installer_get_ParentWindow, + update_installer_get_Updates, + update_installer_put_Updates, +}; + +HRESULT UpdateInstaller_create( IUnknown *pUnkOuter, LPVOID *ppObj ) +{ + update_installer *installer; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + installer = HeapAlloc( GetProcessHeap(), 0, sizeof(*installer) ); + if (!installer) return E_OUTOFMEMORY; + + installer->vtbl = &update_installer_vtbl; + installer->refs = 1; + + *ppObj = &installer->vtbl; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} diff --git a/dlls/wuapi/main.c b/dlls/wuapi/main.c new file mode 100644 index 00000000000..18a86bc5549 --- /dev/null +++ b/dlls/wuapi/main.c @@ -0,0 +1,148 @@ +/* + * WUAPI implementation + * + * Copyright 2008 Hans Leidekker + * + * 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 + */ + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "wuapi.h" + +#include "wine/debug.h" +#include "wuapi_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wuapi); + +typedef HRESULT (*fnCreateInstance)( IUnknown *pUnkOuter, LPVOID *ppObj ); + +typedef struct _wucf +{ + const struct IClassFactoryVtbl *vtbl; + fnCreateInstance pfnCreateInstance; +} wucf; + +static inline wucf *impl_from_IClassFactory( IClassFactory *iface ) +{ + return (wucf *)((char *)iface - FIELD_OFFSET( wucf, vtbl )); +} + +static HRESULT WINAPI wucf_QueryInterface( IClassFactory *iface, REFIID riid, LPVOID *ppobj ) +{ + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IClassFactory)) + { + IClassFactory_AddRef( iface ); + *ppobj = iface; + return S_OK; + } + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI wucf_AddRef( IClassFactory *iface ) +{ + return 2; +} + +static ULONG WINAPI wucf_Release( IClassFactory *iface ) +{ + return 1; +} + +static HRESULT WINAPI wucf_CreateInstance( IClassFactory *iface, LPUNKNOWN pOuter, + REFIID riid, LPVOID *ppobj ) +{ + wucf *This = impl_from_IClassFactory( iface ); + HRESULT r; + IUnknown *punk; + + TRACE("%p %s %p\n", pOuter, debugstr_guid(riid), ppobj); + + *ppobj = NULL; + + if (pOuter) + return CLASS_E_NOAGGREGATION; + + r = This->pfnCreateInstance( pOuter, (LPVOID *)&punk ); + if (FAILED(r)) + return r; + + r = IUnknown_QueryInterface( punk, riid, ppobj ); + if (FAILED(r)) + return r; + + IUnknown_Release( punk ); + return r; +} + +static HRESULT WINAPI wucf_LockServer( IClassFactory *iface, BOOL dolock ) +{ + FIXME("(%p)->(%d)\n", iface, dolock); + return S_OK; +} + +static const struct IClassFactoryVtbl wucf_vtbl = +{ + wucf_QueryInterface, + wucf_AddRef, + wucf_Release, + wucf_CreateInstance, + wucf_LockServer +}; + +static wucf updatecf = { &wucf_vtbl, UpdateSession_create }; + +BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID lpv ) +{ + switch(reason) + { + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls( hinst ); + break; + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + +HRESULT WINAPI DllGetClassObject( REFCLSID rclsid, REFIID iid, LPVOID *ppv ) +{ + IClassFactory *cf = NULL; + + TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv); + + if (IsEqualGUID( rclsid, &CLSID_UpdateSession )) + cf = (IClassFactory *)&updatecf.vtbl; + + if (!cf) return CLASS_E_CLASSNOTAVAILABLE; + return IClassFactory_QueryInterface( cf, iid, ppv ); +} + +HRESULT WINAPI DllCanUnloadNow( void ) +{ + FIXME("\n"); + return S_FALSE; +} diff --git a/dlls/ddraw/regsvr.c b/dlls/wuapi/regsvr.c similarity index 90% copy from dlls/ddraw/regsvr.c copy to dlls/wuapi/regsvr.c index d851454d0b1..875902c6df9 100644 --- a/dlls/ddraw/regsvr.c +++ b/dlls/wuapi/regsvr.c @@ -1,5 +1,5 @@ /* - * self-registerable dll functions for ddraw.dll + * self-registerable dll functions for wuapi.dll * * Copyright (C) 2003 John K. Hohm * @@ -18,24 +18,22 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ + #include #include #include "windef.h" #include "winbase.h" -#include "winreg.h" -#include "wingdi.h" #include "winuser.h" +#include "winreg.h" #include "winerror.h" - -#include "ddraw.h" +#include "objbase.h" +#include "wuapi.h" #include "wine/debug.h" +#include "wine/unicode.h" -WINE_DEFAULT_DEBUG_CHANNEL(ddraw); - -static LSTATUS (WINAPI *pRegDeleteTreeW)(HKEY,LPCWSTR); -static LSTATUS (WINAPI *pRegDeleteTreeA)(HKEY,LPCSTR); +WINE_DEFAULT_DEBUG_CHANNEL(wuapi); /* * Near the bottom of this file are the exported DllRegisterServer and @@ -150,7 +148,7 @@ static HRESULT register_interfaces(struct regsvr_interface const *list) KEY_READ | KEY_WRITE, NULL, &key, NULL); if (res != ERROR_SUCCESS) goto error_close_iid_key; - wsprintfW(buf, fmt, list->num_methods); + sprintfW(buf, fmt, list->num_methods); res = RegSetValueExW(key, NULL, 0, REG_SZ, (CONST BYTE*)buf, (lstrlenW(buf) + 1) * sizeof(WCHAR)); @@ -196,8 +194,8 @@ static HRESULT unregister_interfaces(struct regsvr_interface const *list) WCHAR buf[39]; StringFromGUID2(list->iid, buf, 39); - res = pRegDeleteTreeW(interface_key, buf); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; + res = RegDeleteTreeW(interface_key, buf); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; } RegCloseKey(interface_key); @@ -307,13 +305,13 @@ static HRESULT unregister_coclasses(struct regsvr_coclass const *list) WCHAR buf[39]; StringFromGUID2(list->clsid, buf, 39); - res = pRegDeleteTreeW(coclass_key, buf); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; + res = RegDeleteTreeW(coclass_key, buf); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; if (res != ERROR_SUCCESS) goto error_close_coclass_key; if (list->progid) { - res = pRegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid); - if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; + res = RegDeleteTreeA(HKEY_CLASSES_ROOT, list->progid); + if (res == ERROR_FILE_NOT_FOUND) res = ERROR_SUCCESS; if (res != ERROR_SUCCESS) goto error_close_coclass_key; } } @@ -378,25 +376,12 @@ static LONG register_key_defvalueA( /*********************************************************************** * coclass list */ - static struct regsvr_coclass const coclass_list[] = { - { &CLSID_DirectDraw, - "DirectDraw Object", - NULL, - "ddraw.dll", - "Both" - }, - { &CLSID_DirectDraw7, - "DirectDraw 7 Object", - NULL, - "ddraw.dll", - "Both" - }, - { &CLSID_DirectDrawClipper, - "DirectDraw Clipper Object", - NULL, - "ddraw.dll", - "Both" + { &CLSID_UpdateSession, + "CLSID_UpdateSession", + NULL, + "wuapi.dll", + "Both" }, { NULL } /* list terminator */ }; @@ -404,13 +389,12 @@ static struct regsvr_coclass const coclass_list[] = { /*********************************************************************** * interface list */ - static struct regsvr_interface const interface_list[] = { { NULL } /* list terminator */ }; /*********************************************************************** - * DllRegisterServer (DDRAW.@) + * DllRegisterServer (INETCOMM.@) */ HRESULT WINAPI DllRegisterServer(void) { @@ -425,18 +409,12 @@ HRESULT WINAPI DllRegisterServer(void) } /*********************************************************************** - * DllUnregisterServer (DDRAW.@) + * DllUnregisterServer (INETCOMM.@) */ HRESULT WINAPI DllUnregisterServer(void) { HRESULT hr; - HMODULE advapi32 = GetModuleHandleA("advapi32"); - if (!advapi32) return E_FAIL; - pRegDeleteTreeA = (void *) GetProcAddress(advapi32, "RegDeleteTreeA"); - pRegDeleteTreeW = (void *) GetProcAddress(advapi32, "RegDeleteTreeW"); - if (!pRegDeleteTreeA || !pRegDeleteTreeW) return E_FAIL; - TRACE("\n"); hr = unregister_coclasses(coclass_list); diff --git a/dlls/wuapi/searcher.c b/dlls/wuapi/searcher.c new file mode 100644 index 00000000000..8105681f7a1 --- /dev/null +++ b/dlls/wuapi/searcher.c @@ -0,0 +1,257 @@ +/* + * IUpdateSearcher implementation + * + * Copyright 2008 Hans Leidekker + * + * 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 + */ + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "wuapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wuapi); + +typedef struct _update_searcher +{ + const struct IUpdateSearcherVtbl *vtbl; + LONG refs; +} update_searcher; + +static inline update_searcher *impl_from_IUpdateSearcher( IUpdateSearcher *iface ) +{ + return (update_searcher *)((char *)iface - FIELD_OFFSET( update_searcher, vtbl )); +} + +static ULONG WINAPI update_searcher_AddRef( + IUpdateSearcher *iface ) +{ + update_searcher *update_searcher = impl_from_IUpdateSearcher( iface ); + return InterlockedIncrement( &update_searcher->refs ); +} + +static ULONG WINAPI update_searcher_Release( + IUpdateSearcher *iface ) +{ + update_searcher *update_searcher = impl_from_IUpdateSearcher( iface ); + LONG refs = InterlockedDecrement( &update_searcher->refs ); + if (!refs) + { + TRACE("destroying %p\n", update_searcher); + HeapFree( GetProcessHeap(), 0, update_searcher ); + } + return refs; +} + +static HRESULT WINAPI update_searcher_QueryInterface( + IUpdateSearcher *iface, + REFIID riid, + void **ppvObject ) +{ + update_searcher *This = impl_from_IUpdateSearcher( iface ); + + TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IUpdateSearcher ) || + IsEqualGUID( riid, &IID_IDispatch ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IUpdateSearcher_AddRef( iface ); + return S_OK; +} + +static HRESULT WINAPI update_searcher_GetTypeInfoCount( + IUpdateSearcher *iface, + UINT *pctinfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_GetTypeInfo( + IUpdateSearcher *iface, + UINT iTInfo, + LCID lcid, + ITypeInfo **ppTInfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_GetIDsOfNames( + IUpdateSearcher *iface, + REFIID riid, + LPOLESTR *rgszNames, + UINT cNames, + LCID lcid, + DISPID *rgDispId ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_Invoke( + IUpdateSearcher *iface, + DISPID dispIdMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS *pDispParams, + VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, + UINT *puArgErr ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_get_CanAutomaticallyUpgradeService( + IUpdateSearcher *This, + VARIANT_BOOL *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_put_CanAutomaticallyUpgradeService( + IUpdateSearcher *This, + VARIANT_BOOL value ) +{ + FIXME("%p, %d\n", This, value); + return S_OK; +} + +static HRESULT WINAPI update_searcher_get_ClientApplicationID( + IUpdateSearcher *This, + BSTR *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_put_ClientApplicationID( + IUpdateSearcher *This, + BSTR value ) +{ + FIXME("%p, %s\n", This, debugstr_w(value)); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_get_IncludePotentiallySupersededUpdates( + IUpdateSearcher *This, + VARIANT_BOOL *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_put_IncludePotentiallySupersededUpdates( + IUpdateSearcher *This, + VARIANT_BOOL value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_get_ServerSelection( + IUpdateSearcher *This, + ServerSelection *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_put_ServerSelection( + IUpdateSearcher *This, + ServerSelection value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_BeginSearch( + IUpdateSearcher *This, + BSTR criteria, + IUnknown *onCompleted, + VARIANT state, + ISearchJob **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_searcher_EndSearch( + IUpdateSearcher *This, + ISearchJob *searchJob, + ISearchResult **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static const struct IUpdateSearcherVtbl update_searcher_vtbl = +{ + update_searcher_QueryInterface, + update_searcher_AddRef, + update_searcher_Release, + update_searcher_GetTypeInfoCount, + update_searcher_GetTypeInfo, + update_searcher_GetIDsOfNames, + update_searcher_Invoke, + update_searcher_get_CanAutomaticallyUpgradeService, + update_searcher_put_CanAutomaticallyUpgradeService, + update_searcher_get_ClientApplicationID, + update_searcher_put_ClientApplicationID, + update_searcher_get_IncludePotentiallySupersededUpdates, + update_searcher_put_IncludePotentiallySupersededUpdates, + update_searcher_get_ServerSelection, + update_searcher_put_ServerSelection, + update_searcher_BeginSearch, + update_searcher_EndSearch +}; + +HRESULT UpdateSearcher_create( IUnknown *pUnkOuter, LPVOID *ppObj ) +{ + update_searcher *searcher; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + searcher = HeapAlloc( GetProcessHeap(), 0, sizeof(*searcher) ); + if (!searcher) return E_OUTOFMEMORY; + + searcher->vtbl = &update_searcher_vtbl; + searcher->refs = 1; + + *ppObj = &searcher->vtbl; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} diff --git a/dlls/wuapi/session.c b/dlls/wuapi/session.c new file mode 100644 index 00000000000..5f163c724c5 --- /dev/null +++ b/dlls/wuapi/session.c @@ -0,0 +1,236 @@ +/* + * IUpdateSession implementation + * + * Copyright 2008 Hans Leidekker + * + * 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 + */ + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "wuapi.h" + +#include "wine/debug.h" +#include "wuapi_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wuapi); + +typedef struct _update_session +{ + const struct IUpdateSessionVtbl *vtbl; + LONG refs; +} update_session; + +static inline update_session *impl_from_IUpdateSession( IUpdateSession *iface ) +{ + return (update_session *)((char *)iface - FIELD_OFFSET( update_session, vtbl )); +} + +static ULONG WINAPI update_session_AddRef( + IUpdateSession *iface ) +{ + update_session *update_session = impl_from_IUpdateSession( iface ); + return InterlockedIncrement( &update_session->refs ); +} + +static ULONG WINAPI update_session_Release( + IUpdateSession *iface ) +{ + update_session *update_session = impl_from_IUpdateSession( iface ); + LONG refs = InterlockedDecrement( &update_session->refs ); + if (!refs) + { + TRACE("destroying %p\n", update_session); + HeapFree( GetProcessHeap(), 0, update_session ); + } + return refs; +} + +static HRESULT WINAPI update_session_QueryInterface( + IUpdateSession *iface, + REFIID riid, + void **ppvObject ) +{ + update_session *This = impl_from_IUpdateSession( iface ); + + TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IUpdateSession ) || + IsEqualGUID( riid, &IID_IDispatch ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IUpdateSession_AddRef( iface ); + return S_OK; +} + +static HRESULT WINAPI update_session_GetTypeInfoCount( + IUpdateSession *iface, + UINT *pctinfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_session_GetTypeInfo( + IUpdateSession *iface, + UINT iTInfo, + LCID lcid, + ITypeInfo **ppTInfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_session_GetIDsOfNames( + IUpdateSession *iface, + REFIID riid, + LPOLESTR *rgszNames, + UINT cNames, + LCID lcid, + DISPID *rgDispId ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_session_Invoke( + IUpdateSession *iface, + DISPID dispIdMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS *pDispParams, + VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, + UINT *puArgErr ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_session_get_ClientApplicationID( + IUpdateSession *This, + BSTR *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_session_put_ClientApplicationID( + IUpdateSession *This, + BSTR value ) +{ + FIXME("%p, %s\n", This, debugstr_w(value)); + return S_OK; +} + +static HRESULT WINAPI update_session_get_ReadOnly( + IUpdateSession *This, + VARIANT_BOOL *retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_session_get_WebProxy( + IUpdateSession *This, + IWebProxy **retval ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_session_put_WebProxy( + IUpdateSession *This, + IWebProxy *value ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI update_session_CreateUpdateSearcher( + IUpdateSession *This, + IUpdateSearcher **retval ) +{ + TRACE("%p\n", This); + return UpdateSearcher_create( NULL, (LPVOID *)retval ); +} + +static HRESULT WINAPI update_session_CreateUpdateDownloader( + IUpdateSession *This, + IUpdateDownloader **retval ) +{ + TRACE("%p\n", This); + return UpdateDownloader_create( NULL, (LPVOID *)retval ); +} + +static HRESULT WINAPI update_session_CreateUpdateInstaller( + IUpdateSession *This, + IUpdateInstaller **retval ) +{ + TRACE("%p\n", This); + return UpdateInstaller_create( NULL, (LPVOID *)retval ); +} + +static const struct IUpdateSessionVtbl update_session_vtbl = +{ + update_session_QueryInterface, + update_session_AddRef, + update_session_Release, + update_session_GetTypeInfoCount, + update_session_GetTypeInfo, + update_session_GetIDsOfNames, + update_session_Invoke, + update_session_get_ClientApplicationID, + update_session_put_ClientApplicationID, + update_session_get_ReadOnly, + update_session_get_WebProxy, + update_session_put_WebProxy, + update_session_CreateUpdateSearcher, + update_session_CreateUpdateDownloader, + update_session_CreateUpdateInstaller +}; + +HRESULT UpdateSession_create( IUnknown *pUnkOuter, LPVOID *ppObj ) +{ + update_session *session; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + session = HeapAlloc( GetProcessHeap(), 0, sizeof(*session) ); + if (!session) return E_OUTOFMEMORY; + + session->vtbl = &update_session_vtbl; + session->refs = 1; + + *ppObj = &session->vtbl; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} diff --git a/dlls/wuapi/updates.c b/dlls/wuapi/updates.c new file mode 100644 index 00000000000..1bf063b999f --- /dev/null +++ b/dlls/wuapi/updates.c @@ -0,0 +1,221 @@ +/* + * IAutomaticUpdates implementation + * + * Copyright 2008 Hans Leidekker + * + * 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 + */ + +#define COBJMACROS + +#include "config.h" +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "ole2.h" +#include "wuapi.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wuapi); + +typedef struct _automatic_updates +{ + const struct IAutomaticUpdatesVtbl *vtbl; + LONG refs; +} automatic_updates; + +static inline automatic_updates *impl_from_IAutomaticUpdates( IAutomaticUpdates *iface ) +{ + return (automatic_updates *)((char*)iface - FIELD_OFFSET( automatic_updates, vtbl )); +} + +static ULONG WINAPI automatic_updates_AddRef( + IAutomaticUpdates *iface ) +{ + automatic_updates *automatic_updates = impl_from_IAutomaticUpdates( iface ); + return InterlockedIncrement( &automatic_updates->refs ); +} + +static ULONG WINAPI automatic_updates_Release( + IAutomaticUpdates *iface ) +{ + automatic_updates *automatic_updates = impl_from_IAutomaticUpdates( iface ); + LONG refs = InterlockedDecrement( &automatic_updates->refs ); + if (!refs) + { + TRACE("destroying %p\n", automatic_updates); + HeapFree( GetProcessHeap(), 0, automatic_updates ); + } + return refs; +} + +static HRESULT WINAPI automatic_updates_QueryInterface( + IAutomaticUpdates *iface, + REFIID riid, + void **ppvObject ) +{ + automatic_updates *This = impl_from_IAutomaticUpdates( iface ); + + TRACE("%p %s %p\n", This, debugstr_guid( riid ), ppvObject ); + + if ( IsEqualGUID( riid, &IID_IAutomaticUpdates ) || + IsEqualGUID( riid, &IID_IDispatch ) || + IsEqualGUID( riid, &IID_IUnknown ) ) + { + *ppvObject = iface; + } + else + { + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; + } + IAutomaticUpdates_AddRef( iface ); + return S_OK; +} + +static HRESULT WINAPI automatic_updates_GetTypeInfoCount( + IAutomaticUpdates *iface, + UINT *pctinfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI automatic_updates_GetTypeInfo( + IAutomaticUpdates *iface, + UINT iTInfo, + LCID lcid, + ITypeInfo **ppTInfo ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI automatic_updates_GetIDsOfNames( + IAutomaticUpdates *iface, + REFIID riid, + LPOLESTR *rgszNames, + UINT cNames, + LCID lcid, + DISPID *rgDispId ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI automatic_updates_Invoke( + IAutomaticUpdates *iface, + DISPID dispIdMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS *pDispParams, + VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, + UINT *puArgErr ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI automatic_updates_DetectNow( + IAutomaticUpdates *This ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI automatic_updates_Pause( + IAutomaticUpdates *This ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI automatic_updates_Resume( + IAutomaticUpdates *This ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI automatic_updates_ShowSettingsDialog( + IAutomaticUpdates *This ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI automatic_updates_EnableService( + IAutomaticUpdates *This ) +{ + FIXME("\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI automatic_updates_get_ServiceEnabled( + IAutomaticUpdates *This, + VARIANT_BOOL *retval ) +{ + FIXME("%p\n", retval); + return E_NOTIMPL; +} + +static HRESULT WINAPI automatic_updates_get_Settings( + IAutomaticUpdates *This, + IAutomaticUpdatesSettings **retval ) +{ + FIXME("%p\n", retval); + return E_NOTIMPL; +} + +static const struct IAutomaticUpdatesVtbl automatic_updates_vtbl = +{ + automatic_updates_QueryInterface, + automatic_updates_AddRef, + automatic_updates_Release, + automatic_updates_GetTypeInfoCount, + automatic_updates_GetTypeInfo, + automatic_updates_GetIDsOfNames, + automatic_updates_Invoke, + automatic_updates_DetectNow, + automatic_updates_Pause, + automatic_updates_Resume, + automatic_updates_ShowSettingsDialog, + automatic_updates_get_Settings, + automatic_updates_get_ServiceEnabled, + automatic_updates_EnableService +}; + +HRESULT AutomaticUpdates_create( IUnknown *pUnkOuter, LPVOID *ppObj ) +{ + automatic_updates *updates; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + updates = HeapAlloc( GetProcessHeap(), 0, sizeof(*updates) ); + if (!updates) return E_OUTOFMEMORY; + + updates->vtbl = &automatic_updates_vtbl; + updates->refs = 1; + + *ppObj = &updates->vtbl; + + TRACE("returning iface %p\n", *ppObj); + return S_OK; +} diff --git a/dlls/wuapi/wuapi.spec b/dlls/wuapi/wuapi.spec new file mode 100644 index 00000000000..b16365d0c9f --- /dev/null +++ b/dlls/wuapi/wuapi.spec @@ -0,0 +1,4 @@ +@ stdcall -private DllCanUnloadNow() +@ stdcall -private DllGetClassObject(ptr ptr ptr) +@ stdcall -private DllRegisterServer() +@ stdcall -private DllUnregisterServer() diff --git a/dlls/oleacc/oleacc.rc b/dlls/wuapi/wuapi_private.h similarity index 63% copy from dlls/oleacc/oleacc.rc copy to dlls/wuapi/wuapi_private.h index 4b36b3db914..9c10daf0527 100644 --- a/dlls/oleacc/oleacc.rc +++ b/dlls/wuapi/wuapi_private.h @@ -1,7 +1,5 @@ /* - * Top level resource file for oleacc - * - * Copyright 2008 Nikolay Sivov + * Copyright 2008 Hans Leidekker for CodeWeavers * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,9 +16,8 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "windef.h" -#include "oleacc.h" - -#include "oleacc_En.rc" -#include "oleacc_Ko.rc" -#include "oleacc_Nl.rc" +extern HRESULT AutomaticUpdates_create( IUnknown *pUnkOuter, LPVOID *ppObj ); +extern HRESULT UpdateSession_create( IUnknown *pUnkOuter, LPVOID *ppObj ); +extern HRESULT UpdateSearcher_create( IUnknown *pUnkOuter, LPVOID *ppObj ); +extern HRESULT UpdateDownloader_create( IUnknown *pUnkOuter, LPVOID *ppObj ); +extern HRESULT UpdateInstaller_create( IUnknown *pUnkOuter, LPVOID *ppObj ); diff --git a/dlls/xinput1_3/tests/xinput.c b/dlls/xinput1_3/tests/xinput.c index ffc0d334c8e..1125dcc0b9c 100644 --- a/dlls/xinput1_3/tests/xinput.c +++ b/dlls/xinput1_3/tests/xinput.c @@ -94,15 +94,15 @@ START_TEST(xinput) HMODULE hXinput; hXinput = LoadLibraryA( "xinput1_3.dll" ); - if (hXinput) + if (!hXinput) { - pXInputGetState = (void*)GetProcAddress(hXinput, "XInputGetState"); - pXInputGetCapabilities = (void*)GetProcAddress(hXinput, "XInputGetCapabilities"); - test_get_state(); - test_get_capabilities(); - } - else - { - skip("Could not load xinput1_3.dll\n"); + win_skip("Could not load xinput1_3.dll\n"); + return; } + + pXInputGetState = (void*)GetProcAddress(hXinput, "XInputGetState"); + pXInputGetCapabilities = (void*)GetProcAddress(hXinput, "XInputGetCapabilities"); + test_get_state(); + test_get_capabilities(); + FreeLibrary(hXinput); } diff --git a/include/Makefile.in b/include/Makefile.in index abb89ab428a..8f004f2547c 100644 --- a/include/Makefile.in +++ b/include/Makefile.in @@ -75,6 +75,7 @@ PUBLIC_IDL_H_SRCS = \ wine/itss.idl \ wine/svcctl.idl \ wtypes.idl \ + wuapi.idl \ xmldom.idl \ xmldso.idl diff --git a/include/amstream.idl b/include/amstream.idl index d1cdd4c7e00..2f32d44001f 100644 --- a/include/amstream.idl +++ b/include/amstream.idl @@ -315,3 +315,4 @@ cpp_quote("DEFINE_GUID(CLSID_AMDirectDrawStream, 0x49c47ce4, 0x9ba4, 0x11d0, 0x cpp_quote("DEFINE_GUID(CLSID_AMAudioStream, 0x8496e040, 0xaf4c, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);") cpp_quote("DEFINE_GUID(CLSID_AMAudioData, 0xf2468580, 0xaf8a, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);") cpp_quote("DEFINE_GUID(CLSID_AMMediaTypeStream, 0xcf0f2f7c, 0xf7bf, 0x11d0, 0x90, 0x0d, 0x00, 0xc0, 0x4f, 0xd9, 0x18, 0x9d);") +cpp_quote("DEFINE_GUID(CLSID_MediaStreamFilter, 0x49c47ce0, 0x9ba4, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);") diff --git a/include/cfgmgr32.h b/include/cfgmgr32.h index 5862fa68223..635ac989b9b 100644 --- a/include/cfgmgr32.h +++ b/include/cfgmgr32.h @@ -21,6 +21,13 @@ /* FIXME: #include */ +/* cfgmgr32 doesn't use the normal convention, it adds an underscore before A/W */ +#ifdef WINE_NO_UNICODE_MACROS +# define DECL_WINELIB_CFGMGR32_TYPE_AW(type) /* nothing */ +#else +# define DECL_WINELIB_CFGMGR32_TYPE_AW(type) typedef WINELIB_NAME_AW(type##_) type; +#endif + #define CMAPI typedef DWORD CONFIGRET; @@ -97,6 +104,11 @@ typedef DWORD CONFIGRET; typedef DWORD DEVINST, *PDEVINST; typedef DWORD DEVNODE, *PDEVNODE; typedef HANDLE HMACHINE, *PHMACHINE; +typedef CHAR *DEVNODEID_A, *DEVINSTID_A; +typedef WCHAR *DEVNODEID_W, *DEVINSTID_W; + +DECL_WINELIB_CFGMGR32_TYPE_AW(DEVNODEID) +DECL_WINELIB_CFGMGR32_TYPE_AW(DEVINSTID) #ifdef __cplusplus extern "C" { @@ -122,4 +134,6 @@ CMAPI CONFIGRET WINAPI CM_Get_Device_ID_Size_Ex(PULONG,DEVINST,ULONG,HMACHINE); } #endif +#undef DECL_WINELIB_CFGMGR32_TYPE_AW + #endif /* _CFGMGR32_H_ */ diff --git a/include/commdlg.h b/include/commdlg.h index 914e4c879b6..8d410bdc521 100644 --- a/include/commdlg.h +++ b/include/commdlg.h @@ -26,7 +26,9 @@ extern "C" { #endif #include +#ifndef _WIN64 #include +#endif #ifndef SNDMSG #ifdef __cplusplus @@ -147,6 +149,25 @@ typedef struct DECL_WINELIB_TYPE_AW(OFNOTIFY) DECL_WINELIB_TYPE_AW(LPOFNOTIFY) +typedef struct _OFNOTIFYEXA +{ + NMHDR hdr; + LPOPENFILENAMEA lpOFN; + LPVOID psf; + LPVOID pidl; +} OFNOTIFYEXA, *LPOFNOTIFYEXA; + +typedef struct _OFNOTIFYEXW +{ + NMHDR hdr; + LPOPENFILENAMEW lpOFN; + LPVOID psf; + LPVOID pidl; +} OFNOTIFYEXW, *LPOFNOTIFYEXW; + +DECL_WINELIB_TYPE_AW(OFNOTIFYEX) +DECL_WINELIB_TYPE_AW(LPOFNOTIFYEX) + typedef UINT (CALLBACK *LPCCHOOKPROC) (HWND, UINT, WPARAM, LPARAM); typedef struct { @@ -412,7 +433,6 @@ static const WCHAR HELPMSGSTRINGW[] = { 'c','o','m','m','d','l','g','_', #endif #define HELPMSGSTRING WINELIB_NAME_AW(HELPMSGSTRING) - #define CD_LBSELNOITEMS -1 #define CD_LBSELCHANGE 0 #define CD_LBSELSUB 1 @@ -428,6 +448,7 @@ static const WCHAR HELPMSGSTRINGW[] = { 'c','o','m','m','d','l','g','_', #define CDN_HELP (CDN_FIRST - 0x0004) #define CDN_FILEOK (CDN_FIRST - 0x0005) #define CDN_TYPECHANGE (CDN_FIRST - 0x0006) +#define CDN_INCLUDEITEM (CDN_FIRST - 0x0007) #define CDM_FIRST (WM_USER + 100) #define CDM_LAST (WM_USER + 200) @@ -770,7 +791,9 @@ BOOL WINAPI ChooseFontW(LPCHOOSEFONTW); void COMDLG32_SetCommDlgExtendedError(DWORD err); +#ifndef _WIN64 #include +#endif #ifdef __cplusplus } diff --git a/include/config.h.in b/include/config.h.in index c45765ea1ae..330564ead7a 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -942,9 +942,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_VALGRIND_VALGRIND_H -/* Define if we have va_copy */ -#undef HAVE_VA_COPY - /* Define to 1 if you have the `vsnprintf' function. */ #undef HAVE_VSNPRINTF @@ -1038,9 +1035,6 @@ /* Define to 1 if you have the `_vsnprintf' function. */ #undef HAVE__VSNPRINTF -/* Define if we have __va_copy */ -#undef HAVE___VA_COPY - /* Define to the address where bug reports for this package should be sent. */ #undef PACKAGE_BUGREPORT diff --git a/include/cryptuiapi.h b/include/cryptuiapi.h index 2670b786773..510c7d1c3cb 100644 --- a/include/cryptuiapi.h +++ b/include/cryptuiapi.h @@ -335,6 +335,93 @@ BOOL WINAPI CryptUIWizImport(DWORD dwFlags, HWND hwndParent, LPCWSTR pwszWizardTitle, PCCRYPTUI_WIZ_IMPORT_SRC_INFO pImportSrc, HCERTSTORE hDestCertStore); +/* Definitions missing from PSDK's cryptuiapi.h, but documented on MSDN. */ +typedef BOOL (WINAPI *PFNCCERTDISPLAYPROC)(PCCERT_CONTEXT pCertContext, + HWND hWndSelCertDlg, void *pvCallbackData); + +/* Values for CRYPTUI_SELECTCERTIFICATE_STRUCT's dwFlags */ +#define CRYPTUI_SELECTCERT_MULTISELECT 0x00000001 + +typedef struct _CRYPTUI_SELECTCERTIFICATE_STRUCTA +{ + DWORD dwSize; + HWND hwndParent; + DWORD dwFlags; + LPCWSTR szTitle; + DWORD dwDontUseColumn; + LPCWSTR szDisplayString; + PFNCFILTERPROC pFilterCallback; + PFNCCERTDISPLAYPROC pDisplayCallback; + void *pvCallbackData; + DWORD cStores; + HCERTSTORE *rghStores; + DWORD cPropSheetPages; + LPCPROPSHEETPAGEW rgPropSheetPages; + HCERTSTORE hSelectedCertStore; +} CRYPTUI_SELECTCERTIFICATE_STRUCTA, *PCRYPTUI_SELECTCERTIFICATE_STRUCTA; +typedef const CRYPTUI_SELECTCERTIFICATE_STRUCTA * + PCCRYPTUI_SELECTCERTIFICATE_STRUCTA; + +typedef struct _CRYPTUI_SELECTCERTIFICATE_STRUCTW +{ + DWORD dwSize; + HWND hwndParent; + DWORD dwFlags; + LPCWSTR szTitle; + DWORD dwDontUseColumn; + LPCWSTR szDisplayString; + PFNCFILTERPROC pFilterCallback; + PFNCCERTDISPLAYPROC pDisplayCallback; + void *pvCallbackData; + DWORD cStores; + HCERTSTORE *rghStores; + DWORD cPropSheetPages; + LPCPROPSHEETPAGEW rgPropSheetPages; + HCERTSTORE hSelectedCertStore; +} CRYPTUI_SELECTCERTIFICATE_STRUCTW, *PCRYPTUI_SELECTCERTIFICATE_STRUCTW; +typedef const CRYPTUI_SELECTCERTIFICATE_STRUCTW * + PCCRYPTUI_SELECTCERTIFICATE_STRUCTW; + +PCCERT_CONTEXT WINAPI CryptUIDlgSelectCertificateA( + PCCRYPTUI_SELECTCERTIFICATE_STRUCTA pcsc); +PCCERT_CONTEXT WINAPI CryptUIDlgSelectCertificateW( + PCCRYPTUI_SELECTCERTIFICATE_STRUCTW pcsc); + +typedef struct tagCRYPTUI_VIEWSIGNERINFO_STRUCTA +{ + DWORD dwSize; + HWND hwndParent; + DWORD dwFlags; + LPCSTR szTitle; + CMSG_SIGNER_INFO *pSignerInfo; + HCRYPTMSG hMsg; + LPCSTR pszOID; + DWORD_PTR dwReserved; + DWORD cStores; + HCERTSTORE *rghStores; + DWORD cPropSheetPages; + LPCPROPSHEETPAGEA rgPropSheetPages; +} CRYPTUI_VIEWSIGNERINFO_STRUCTA, *PCRYPTUI_VIEWSIGNERINFO_STRUCTA; + +typedef struct tagCRYPTUI_VIEWSIGNERINFO_STRUCTW +{ + DWORD dwSize; + HWND hwndParent; + DWORD dwFlags; + LPCWSTR szTitle; + CMSG_SIGNER_INFO *pSignerInfo; + HCRYPTMSG hMsg; + LPCSTR pszOID; + DWORD_PTR dwReserved; + DWORD cStores; + HCERTSTORE *rghStores; + DWORD cPropSheetPages; + LPCPROPSHEETPAGEW rgPropSheetPages; +} CRYPTUI_VIEWSIGNERINFO_STRUCTW, *PCRYPTUI_VIEWSIGNERINFO_STRUCTW; + +BOOL WINAPI CryptUIDlgViewSignerInfoA(CRYPTUI_VIEWSIGNERINFO_STRUCTA *pcvsi); +BOOL WINAPI CryptUIDlgViewSignerInfoW(CRYPTUI_VIEWSIGNERINFO_STRUCTW *pcvsi); + #include #ifdef __cplusplus diff --git a/include/ddk/wdm.h b/include/ddk/wdm.h index efc3f6aacb6..0f241b6a708 100644 --- a/include/ddk/wdm.h +++ b/include/ddk/wdm.h @@ -1026,6 +1026,7 @@ PVOID WINAPI ExAllocatePoolWithQuotaTag(POOL_TYPE,SIZE_T,ULONG); void WINAPI ExFreePool(PVOID); void WINAPI ExFreePoolWithTag(PVOID,ULONG); +NTSTATUS WINAPI IoAllocateDriverObjectExtension(PDRIVER_OBJECT,PVOID,ULONG,PVOID*); PIRP WINAPI IoAllocateIrp(CCHAR,BOOLEAN); NTSTATUS WINAPI IoCreateDevice(DRIVER_OBJECT*,ULONG,UNICODE_STRING*,DEVICE_TYPE,ULONG,BOOLEAN,DEVICE_OBJECT**); NTSTATUS WINAPI IoCreateDriver(UNICODE_STRING*,PDRIVER_INITIALIZE); @@ -1036,6 +1037,7 @@ NTSTATUS WINAPI IoDeleteSymbolicLink(UNICODE_STRING*); void WINAPI IoFreeIrp(IRP*); PEPROCESS WINAPI IoGetCurrentProcess(void); NTSTATUS WINAPI IoGetDeviceObjectPointer(UNICODE_STRING*,ACCESS_MASK,PFILE_OBJECT*,PDEVICE_OBJECT*); +PVOID WINAPI IoGetDriverObjectExtension(PDRIVER_OBJECT,PVOID); PDEVICE_OBJECT WINAPI IoGetRelatedDeviceObject(PFILE_OBJECT); void WINAPI IoInitializeIrp(IRP*,USHORT,CCHAR); diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 216b2f39eb9..1a39dee4055 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -256,6 +256,8 @@ GpStatus WINGDIPAPI GdipAddPathCurve(GpPath*,GDIPCONST GpPointF*,INT); GpStatus WINGDIPAPI GdipAddPathCurveI(GpPath*,GDIPCONST GpPoint*,INT); GpStatus WINGDIPAPI GdipAddPathCurve2(GpPath*,GDIPCONST GpPointF*,INT,REAL); GpStatus WINGDIPAPI GdipAddPathCurve2I(GpPath*,GDIPCONST GpPoint*,INT,REAL); +GpStatus WINGDIPAPI GdipAddPathCurve3(GpPath*,GDIPCONST GpPointF*,INT,INT,INT,REAL); +GpStatus WINGDIPAPI GdipAddPathCurve3I(GpPath*,GDIPCONST GpPoint*,INT,INT,INT,REAL); GpStatus WINGDIPAPI GdipAddPathEllipse(GpPath*,REAL,REAL,REAL,REAL); GpStatus WINGDIPAPI GdipAddPathEllipseI(GpPath*,INT,INT,INT,INT); GpStatus WINGDIPAPI GdipAddPathLine(GpPath*,REAL,REAL,REAL,REAL); diff --git a/include/mshtml.idl b/include/mshtml.idl index 8bf3efa2f99..eabf8673fb5 100644 --- a/include/mshtml.idl +++ b/include/mshtml.idl @@ -20188,7 +20188,7 @@ interface IMarkupPointer : IUnknown [ object, pointer_default(unique), - uuid(83f65030-b598-cf11-bb82-00aa00bdce0b) + uuid(3050f683-98b5-11cf-bb82-00aa00bdce0b) ] interface ISegment : IUnknown { @@ -20220,7 +20220,7 @@ interface IElementSegment : ISegment [ object, pointer_default(unique), - uuid(99f65030-b598-cf11-bb82-00aa00bdce0b) + uuid(3050f699-98b5-11cf-bb82-00aa00bdce0b) ] interface ISelectionServicesListener : IUnknown { diff --git a/include/msi.h b/include/msi.h index 2dbe4d3420a..5564fcd1502 100644 --- a/include/msi.h +++ b/include/msi.h @@ -497,6 +497,10 @@ UINT WINAPI MsiGetProductInfoExA(LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, LPST UINT WINAPI MsiGetProductInfoExW(LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, LPCWSTR, LPWSTR, LPDWORD); #define MsiGetProductInfoEx WINELIB_NAME_AW(MsiGetProductInfoEx) +UINT WINAPI MsiGetPatchInfoExA(LPCSTR, LPCSTR, LPCSTR, MSIINSTALLCONTEXT, LPCSTR, LPSTR, LPDWORD); +UINT WINAPI MsiGetPatchInfoExW(LPCWSTR, LPCWSTR, LPCWSTR, MSIINSTALLCONTEXT, LPCWSTR, LPWSTR, LPDWORD); +#define MsiGetPatchInfoEx WINELIB_NAME_AW(MsiGetPatchInfoEx) + UINT WINAPI MsiEnableLogA(DWORD, LPCSTR, DWORD); UINT WINAPI MsiEnableLogW(DWORD, LPCWSTR, DWORD); #define MsiEnableLog WINELIB_NAME_AW(MsiEnableLog) diff --git a/include/msvcrt/conio.h b/include/msvcrt/conio.h index 4384a37aef3..7d4797b41ea 100644 --- a/include/msvcrt/conio.h +++ b/include/msvcrt/conio.h @@ -14,23 +14,23 @@ extern "C" { #endif -char* _cgets(char*); -int _cprintf(const char*,...); -int _cputs(const char*); -int _cscanf(const char*,...); -int _getch(void); -int _getche(void); -int _kbhit(void); -int _putch(int); -int _ungetch(int); +char* __cdecl _cgets(char*); +int __cdecl _cprintf(const char*,...); +int __cdecl _cputs(const char*); +int __cdecl _cscanf(const char*,...); +int __cdecl _getch(void); +int __cdecl _getche(void); +int __cdecl _kbhit(void); +int __cdecl _putch(int); +int __cdecl _ungetch(int); #ifdef _M_IX86 -int _inp(unsigned short); -unsigned long _inpd(unsigned short); -unsigned short _inpw(unsigned short); -int _outp(unsigned short, int); -unsigned long _outpd(unsigned short, unsigned long); -unsigned short _outpw(unsigned short, unsigned short); +int __cdecl _inp(unsigned short); +unsigned long __cdecl _inpd(unsigned short); +unsigned short __cdecl _inpw(unsigned short); +int __cdecl _outp(unsigned short, int); +unsigned long __cdecl _outpd(unsigned short, unsigned long); +unsigned short __cdecl _outpw(unsigned short, unsigned short); #endif #ifdef __cplusplus @@ -53,8 +53,8 @@ static inline unsigned short outpw(unsigned short i, unsigned short j) { return #endif #if defined(__GNUC__) && (__GNUC__ < 4) -extern int cprintf(const char*,...) __attribute__((alias("_cprintf"),format(printf,1,2))); -extern int cscanf(const char*,...) __attribute__((alias("_cscanf"),format(scanf,1,2))); +extern int __cdecl cprintf(const char*,...) __attribute__((alias("_cprintf"),format(printf,1,2))); +extern int __cdecl cscanf(const char*,...) __attribute__((alias("_cscanf"),format(scanf,1,2))); #else #define cprintf _cprintf #define cscanf _cscanf diff --git a/include/msvcrt/crtdbg.h b/include/msvcrt/crtdbg.h index bd984498e61..83cd85e4cc3 100644 --- a/include/msvcrt/crtdbg.h +++ b/include/msvcrt/crtdbg.h @@ -84,14 +84,14 @@ extern int _crtAssertBusy; extern int _crtBreakAlloc; extern int _crtDbgFlag; -int _CrtCheckMemory(void); -int _CrtDbgReport(int reportType, const char *filename, int linenumber, - const char *moduleName, const char *format, ...); -int _CrtDumpMemoryLeaks(void); -int _CrtSetBreakAlloc(int new); -int _CrtSetDbgFlag(int new); -void *_CrtSetDumpClient(void *dumpClient); -int _CrtSetReportMode(int reportType, int reportMode); +int __cdecl _CrtCheckMemory(void); +int __cdecl _CrtDbgReport(int reportType, const char *filename, int linenumber, + const char *moduleName, const char *format, ...); +int __cdecl _CrtDumpMemoryLeaks(void); +int __cdecl _CrtSetBreakAlloc(int new); +int __cdecl _CrtSetDbgFlag(int new); +void *__cdecl _CrtSetDumpClient(void *dumpClient); +int __cdecl _CrtSetReportMode(int reportType, int reportMode); #ifdef __cplusplus } diff --git a/include/msvcrt/ctype.h b/include/msvcrt/ctype.h index bbcdba94424..b44e74cfa98 100644 --- a/include/msvcrt/ctype.h +++ b/include/msvcrt/ctype.h @@ -30,46 +30,46 @@ extern "C" { #define _LEADBYTE 0x8000 #define _ALPHA (0x0100|_UPPER|_LOWER) /* (C1_ALPHA|_UPPER|_LOWER) */ -int __isascii(int); -int __iscsym(int); -int __iscsymf(int); -int __toascii(int); -int _isctype(int,int); -int _tolower(int); -int _toupper(int); -int isalnum(int); -int isalpha(int); -int iscntrl(int); -int isdigit(int); -int isgraph(int); -int islower(int); -int isprint(int); -int ispunct(int); -int isspace(int); -int isupper(int); -int isxdigit(int); -int tolower(int); -int toupper(int); +int __cdecl __isascii(int); +int __cdecl __iscsym(int); +int __cdecl __iscsymf(int); +int __cdecl __toascii(int); +int __cdecl _isctype(int,int); +int __cdecl _tolower(int); +int __cdecl _toupper(int); +int __cdecl isalnum(int); +int __cdecl isalpha(int); +int __cdecl iscntrl(int); +int __cdecl isdigit(int); +int __cdecl isgraph(int); +int __cdecl islower(int); +int __cdecl isprint(int); +int __cdecl ispunct(int); +int __cdecl isspace(int); +int __cdecl isupper(int); +int __cdecl isxdigit(int); +int __cdecl tolower(int); +int __cdecl toupper(int); #ifndef _WCTYPE_DEFINED #define _WCTYPE_DEFINED -int is_wctype(wint_t,wctype_t); -int isleadbyte(int); -int iswalnum(wint_t); -int iswalpha(wint_t); -int iswascii(wint_t); -int iswcntrl(wint_t); -int iswctype(wint_t,wctype_t); -int iswdigit(wint_t); -int iswgraph(wint_t); -int iswlower(wint_t); -int iswprint(wint_t); -int iswpunct(wint_t); -int iswspace(wint_t); -int iswupper(wint_t); -int iswxdigit(wint_t); -wchar_t towlower(wchar_t); -wchar_t towupper(wchar_t); +int __cdecl is_wctype(wint_t,wctype_t); +int __cdecl isleadbyte(int); +int __cdecl iswalnum(wint_t); +int __cdecl iswalpha(wint_t); +int __cdecl iswascii(wint_t); +int __cdecl iswcntrl(wint_t); +int __cdecl iswctype(wint_t,wctype_t); +int __cdecl iswdigit(wint_t); +int __cdecl iswgraph(wint_t); +int __cdecl iswlower(wint_t); +int __cdecl iswprint(wint_t); +int __cdecl iswpunct(wint_t); +int __cdecl iswspace(wint_t); +int __cdecl iswupper(wint_t); +int __cdecl iswxdigit(wint_t); +wchar_t __cdecl towlower(wchar_t); +wchar_t __cdecl towupper(wchar_t); #endif /* _WCTYPE_DEFINED */ #ifdef __cplusplus diff --git a/include/msvcrt/direct.h b/include/msvcrt/direct.h index 4fc3943ec18..dd5f4215454 100644 --- a/include/msvcrt/direct.h +++ b/include/msvcrt/direct.h @@ -26,22 +26,22 @@ struct _diskfree_t { }; #endif /* _DISKFREE_T_DEFINED */ -int _chdir(const char*); -int _chdrive(int); -char* _getcwd(char*,int); -char* _getdcwd(int,char*,int); -int _getdrive(void); -unsigned long _getdrives(void); -int _mkdir(const char*); -int _rmdir(const char*); +int __cdecl _chdir(const char*); +int __cdecl _chdrive(int); +char* __cdecl _getcwd(char*,int); +char* __cdecl _getdcwd(int,char*,int); +int __cdecl _getdrive(void); +unsigned long __cdecl _getdrives(void); +int __cdecl _mkdir(const char*); +int __cdecl _rmdir(const char*); #ifndef _WDIRECT_DEFINED #define _WDIRECT_DEFINED -int _wchdir(const wchar_t*); -wchar_t* _wgetcwd(wchar_t*,int); -wchar_t* _wgetdcwd(int,wchar_t*,int); -int _wmkdir(const wchar_t*); -int _wrmdir(const wchar_t*); +int __cdecl _wchdir(const wchar_t*); +wchar_t* __cdecl _wgetcwd(wchar_t*,int); +wchar_t* __cdecl _wgetdcwd(int,wchar_t*,int); +int __cdecl _wmkdir(const wchar_t*); +int __cdecl _wrmdir(const wchar_t*); #endif /* _WDIRECT_DEFINED */ #ifdef __cplusplus diff --git a/include/msvcrt/dos.h b/include/msvcrt/dos.h index c91468d518d..bc62188a79b 100644 --- a/include/msvcrt/dos.h +++ b/include/msvcrt/dos.h @@ -36,7 +36,7 @@ struct _diskfree_t { extern "C" { #endif -unsigned int _getdiskfree(unsigned int, struct _diskfree_t *); +unsigned int __cdecl _getdiskfree(unsigned int, struct _diskfree_t *); #ifdef __cplusplus } diff --git a/include/msvcrt/eh.h b/include/msvcrt/eh.h index cadc8fe0382..932972fa69b 100644 --- a/include/msvcrt/eh.h +++ b/include/msvcrt/eh.h @@ -30,18 +30,18 @@ struct _EXCEPTION_POINTERS; -typedef void (*terminate_handler)(void); -typedef void (*terminate_function)(void); -typedef void (*unexpected_handler)(void); -typedef void (*unexpected_function)(void); -typedef void (*_se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info); - -terminate_function set_terminate(terminate_function func); -unexpected_function set_unexpected(unexpected_function func); -_se_translator_function _set_se_translator(_se_translator_function func); - -void terminate(void); -void unexpected(void); +typedef void (__cdecl *terminate_handler)(void); +typedef void (__cdecl *terminate_function)(void); +typedef void (__cdecl *unexpected_handler)(void); +typedef void (__cdecl *unexpected_function)(void); +typedef void (__cdecl *_se_translator_function)(unsigned int code, struct _EXCEPTION_POINTERS *info); + +terminate_function __cdecl set_terminate(terminate_function func); +unexpected_function __cdecl set_unexpected(unexpected_function func); +_se_translator_function __cdecl set_se_translator(_se_translator_function func); + +void __cdecl terminate(void); +void __cdecl unexpected(void); #include diff --git a/include/msvcrt/errno.h b/include/msvcrt/errno.h index 6214df9c9af..115c5e4f342 100644 --- a/include/msvcrt/errno.h +++ b/include/msvcrt/errno.h @@ -65,7 +65,7 @@ extern "C" { #endif -extern int* _errno(void); +extern int* __cdecl _errno(void); #ifdef __cplusplus } diff --git a/include/msvcrt/float.h b/include/msvcrt/float.h index 3bb87460ca8..b656e0960a2 100644 --- a/include/msvcrt/float.h +++ b/include/msvcrt/float.h @@ -126,14 +126,14 @@ extern "C" { #define _FPE_STACKUNDERFLOW 0x8b #define _FPE_EXPLICITGEN 0x8c -double _copysign (double, double); -double _chgsign (double); -double _scalb(double, long); -double _logb(double); -double _nextafter(double, double); -int _finite(double); -int _isnan(double); -int _fpclass(double); +double __cdecl _copysign (double, double); +double __cdecl _chgsign (double); +double __cdecl _scalb(double, long); +double __cdecl _logb(double); +double __cdecl _nextafter(double, double); +int __cdecl _finite(double); +int __cdecl _isnan(double); +int __cdecl _fpclass(double); #ifdef __cplusplus } diff --git a/include/msvcrt/io.h b/include/msvcrt/io.h index 0b411faea51..e9a970e3d27 100644 --- a/include/msvcrt/io.h +++ b/include/msvcrt/io.h @@ -74,57 +74,57 @@ struct _wfinddatai64_t { extern "C" { #endif -int _access(const char*,int); -int _chmod(const char*,int); -int _chsize(int,long); -int _close(int); -int _commit(int); -int _creat(const char*,int); -int _dup(int); -int _dup2(int,int); -int _eof(int); -__int64 _filelengthi64(int); -long _filelength(int); -int _findclose(intptr_t); -intptr_t _findfirst(const char*,struct _finddata_t*); -intptr_t _findfirsti64(const char*, struct _finddatai64_t*); -int _findnext(intptr_t,struct _finddata_t*); -int _findnexti64(intptr_t, struct _finddatai64_t*); -intptr_t _get_osfhandle(int); -int _isatty(int); -int _locking(int,int,long); -long _lseek(int,long,int); -__int64 _lseeki64(int,__int64,int); -char* _mktemp(char*); -int _open(const char*,int,...); -int _open_osfhandle(intptr_t,int); -int _pipe(int*,unsigned int,int); -int _read(int,void*,unsigned int); -int _setmode(int,int); -int _sopen(const char*,int,int,...); -long _tell(int); -__int64 _telli64(int); -int _umask(int); -int _unlink(const char*); -int _write(int,const void*,unsigned int); - -int remove(const char*); -int rename(const char*,const char*); +int __cdecl _access(const char*,int); +int __cdecl _chmod(const char*,int); +int __cdecl _chsize(int,long); +int __cdecl _close(int); +int __cdecl _commit(int); +int __cdecl _creat(const char*,int); +int __cdecl _dup(int); +int __cdecl _dup2(int,int); +int __cdecl _eof(int); +__int64 __cdecl _filelengthi64(int); +long __cdecl _filelength(int); +int __cdecl _findclose(intptr_t); +intptr_t __cdecl _findfirst(const char*,struct _finddata_t*); +intptr_t __cdecl _findfirsti64(const char*, struct _finddatai64_t*); +int __cdecl _findnext(intptr_t,struct _finddata_t*); +int __cdecl _findnexti64(intptr_t, struct _finddatai64_t*); +intptr_t __cdecl _get_osfhandle(int); +int __cdecl _isatty(int); +int __cdecl _locking(int,int,long); +long __cdecl _lseek(int,long,int); +__int64 __cdecl _lseeki64(int,__int64,int); +char* __cdecl _mktemp(char*); +int __cdecl _open(const char*,int,...); +int __cdecl _open_osfhandle(intptr_t,int); +int __cdecl _pipe(int*,unsigned int,int); +int __cdecl _read(int,void*,unsigned int); +int __cdecl _setmode(int,int); +int __cdecl _sopen(const char*,int,int,...); +long __cdecl _tell(int); +__int64 __cdecl _telli64(int); +int __cdecl _umask(int); +int __cdecl _unlink(const char*); +int __cdecl _write(int,const void*,unsigned int); + +int __cdecl remove(const char*); +int __cdecl rename(const char*,const char*); #ifndef _WIO_DEFINED #define _WIO_DEFINED -int _waccess(const wchar_t*,int); -int _wchmod(const wchar_t*,int); -int _wcreat(const wchar_t*,int); -intptr_t _wfindfirst(const wchar_t*,struct _wfinddata_t*); -intptr_t _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); -int _wfindnext(intptr_t,struct _wfinddata_t*); -int _wfindnexti64(intptr_t, struct _wfinddatai64_t*); -wchar_t*_wmktemp(wchar_t*); -int _wopen(const wchar_t*,int,...); -int _wrename(const wchar_t*,const wchar_t*); -int _wsopen(const wchar_t*,int,int,...); -int _wunlink(const wchar_t*); +int __cdecl _waccess(const wchar_t*,int); +int __cdecl _wchmod(const wchar_t*,int); +int __cdecl _wcreat(const wchar_t*,int); +intptr_t __cdecl _wfindfirst(const wchar_t*,struct _wfinddata_t*); +intptr_t __cdecl _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); +int __cdecl _wfindnext(intptr_t,struct _wfinddata_t*); +int __cdecl _wfindnexti64(intptr_t, struct _wfinddatai64_t*); +wchar_t * __cdecl _wmktemp(wchar_t*); +int __cdecl _wopen(const wchar_t*,int,...); +int __cdecl _wrename(const wchar_t*,const wchar_t*); +int __cdecl _wsopen(const wchar_t*,int,int,...); +int __cdecl _wunlink(const wchar_t*); #endif /* _WIO_DEFINED */ #ifdef __cplusplus @@ -159,8 +159,8 @@ static inline int unlink(const char* path) { return _unlink(path); } static inline int write(int fd, const void* buf, unsigned int size) { return _write(fd, buf, size); } #if defined(__GNUC__) && (__GNUC__ < 4) -extern int open(const char*,int,...) __attribute__((alias("_open"))); -extern int sopen(const char*,int,int,...) __attribute__((alias("_sopen"))); +extern int __cdecl open(const char*,int,...) __attribute__((alias("_open"))); +extern int __cdecl sopen(const char*,int,int,...) __attribute__((alias("_sopen"))); #else #define open _open #define sopen _sopen diff --git a/include/msvcrt/locale.h b/include/msvcrt/locale.h index aaa30114889..2b97c54b94f 100644 --- a/include/msvcrt/locale.h +++ b/include/msvcrt/locale.h @@ -61,12 +61,12 @@ struct lconv extern "C" { #endif -char* setlocale(int,const char*); -struct lconv* localeconv(void); +char* __cdecl setlocale(int,const char*); +struct lconv* __cdecl localeconv(void); #ifndef _WLOCALE_DEFINED #define _WLOCALE_DEFINED -wchar_t* _wsetlocale(int,const wchar_t*); +wchar_t* __cdecl _wsetlocale(int,const wchar_t*); #endif /* _WLOCALE_DEFINED */ #ifdef __cplusplus diff --git a/include/msvcrt/malloc.h b/include/msvcrt/malloc.h index cc60033f1c2..9224e4bc2e2 100644 --- a/include/msvcrt/malloc.h +++ b/include/msvcrt/malloc.h @@ -43,35 +43,39 @@ typedef struct _heapinfo } _HEAPINFO; #endif /* _HEAPINFO_DEFINED */ -extern unsigned int* __p__amblksiz(void); +#ifdef __i386__ +extern unsigned int* __cdecl __p__amblksiz(void); #define _amblksiz (*__p__amblksiz()); +#else +extern unsigned int _amblksiz; +#endif #ifdef __cplusplus extern "C" { #endif -void* _expand(void*,size_t); -int _heapadd(void*,size_t); -int _heapchk(void); -int _heapmin(void); -int _heapset(unsigned int); -size_t _heapused(size_t*,size_t*); -int _heapwalk(_HEAPINFO*); -size_t _msize(void*); +void* __cdecl _expand(void*,size_t); +int __cdecl _heapadd(void*,size_t); +int __cdecl _heapchk(void); +int __cdecl _heapmin(void); +int __cdecl _heapset(unsigned int); +size_t __cdecl _heapused(size_t*,size_t*); +int __cdecl _heapwalk(_HEAPINFO*); +size_t __cdecl _msize(void*); -void* calloc(size_t,size_t); -void free(void*); -void* malloc(size_t); -void* realloc(void*,size_t); +void* __cdecl calloc(size_t,size_t); +void __cdecl free(void*); +void* __cdecl malloc(size_t); +void* __cdecl realloc(void*,size_t); -void _aligned_free(void*); -void* _aligned_malloc(size_t,size_t); -void* _aligned_offset_malloc(size_t,size_t,size_t); -void* _aligned_realloc(void*,size_t,size_t); -void* _aligned_offset_realloc(void*,size_t,size_t,size_t); +void __cdecl _aligned_free(void*); +void* __cdecl _aligned_malloc(size_t,size_t); +void* __cdecl _aligned_offset_malloc(size_t,size_t,size_t); +void* __cdecl _aligned_realloc(void*,size_t,size_t); +void* __cdecl _aligned_offset_realloc(void*,size_t,size_t,size_t); -size_t _get_sbh_threshold(void); -int _set_sbh_threshold(size_t size); +size_t __cdecl _get_sbh_threshold(void); +int __cdecl _set_sbh_threshold(size_t size); #ifdef __cplusplus } diff --git a/include/msvcrt/math.h b/include/msvcrt/math.h index 5aaf7abc311..a02378d047d 100644 --- a/include/msvcrt/math.h +++ b/include/msvcrt/math.h @@ -45,39 +45,39 @@ struct _complex }; #endif /* _COMPLEX_DEFINED */ -double sin(double); -double cos(double); -double tan(double); -double sinh(double); -double cosh(double); -double tanh(double); -double asin(double); -double acos(double); -double atan(double); -double atan2(double, double); -double exp(double); -double log(double); -double log10(double); -double pow(double, double); -double sqrt(double); -double ceil(double); -double floor(double); -double fabs(double); -double ldexp(double, int); -double frexp(double, int*); -double modf(double, double*); -double fmod(double, double); +double __cdecl sin(double); +double __cdecl cos(double); +double __cdecl tan(double); +double __cdecl sinh(double); +double __cdecl cosh(double); +double __cdecl tanh(double); +double __cdecl asin(double); +double __cdecl acos(double); +double __cdecl atan(double); +double __cdecl atan2(double, double); +double __cdecl exp(double); +double __cdecl log(double); +double __cdecl log10(double); +double __cdecl pow(double, double); +double __cdecl sqrt(double); +double __cdecl ceil(double); +double __cdecl floor(double); +double __cdecl fabs(double); +double __cdecl ldexp(double, int); +double __cdecl frexp(double, int*); +double __cdecl modf(double, double*); +double __cdecl fmod(double, double); -double hypot(double, double); -double j0(double); -double j1(double); -double jn(int, double); -double y0(double); -double y1(double); -double yn(int, double); +double __cdecl hypot(double, double); +double __cdecl j0(double); +double __cdecl j1(double); +double __cdecl jn(int, double); +double __cdecl y0(double); +double __cdecl y1(double); +double __cdecl yn(int, double); -int _matherr(struct _exception*); -double _cabs(struct _complex); +int __cdecl _matherr(struct _exception*); +double __cdecl _cabs(struct _complex); #ifndef HUGE_VAL # if defined(__GNUC__) && (__GNUC__ >= 3) diff --git a/include/msvcrt/mbctype.h b/include/msvcrt/mbctype.h index 7a51399eed6..cb460b9b911 100644 --- a/include/msvcrt/mbctype.h +++ b/include/msvcrt/mbctype.h @@ -26,8 +26,12 @@ extern "C" { #endif -unsigned char* __p__mbctype(void); +#ifdef __i386__ +unsigned char* __cdecl __p__mbctype(void); #define _mbctype (__p__mbctype()) +#else +extern unsigned char MSVCRT_mbctype[]; +#endif #define _MS 0x01 #define _MP 0x02 @@ -49,24 +53,24 @@ unsigned char* __p__mbctype(void); #define _MB_CP_ANSI -3 #define _MB_CP_LOCALE -4 -int _getmbcp(void); -int _ismbbalnum(unsigned int); -int _ismbbalpha(unsigned int); -int _ismbbgraph(unsigned int); -int _ismbbkalnum(unsigned int); -int _ismbbkana(unsigned int); -int _ismbbkprint(unsigned int); -int _ismbbkpunct(unsigned int); -int _ismbbprint(unsigned int); -int _ismbbpunct(unsigned int); -int _setmbcp(int); +int __cdecl _getmbcp(void); +int __cdecl _ismbbalnum(unsigned int); +int __cdecl _ismbbalpha(unsigned int); +int __cdecl _ismbbgraph(unsigned int); +int __cdecl _ismbbkalnum(unsigned int); +int __cdecl _ismbbkana(unsigned int); +int __cdecl _ismbbkprint(unsigned int); +int __cdecl _ismbbkpunct(unsigned int); +int __cdecl _ismbbprint(unsigned int); +int __cdecl _ismbbpunct(unsigned int); +int __cdecl _setmbcp(int); #ifndef _MBLEADTRAIL_DEFINED #define _MBLEADTRAIL_DEFINED -int _ismbblead(unsigned int); -int _ismbbtrail(unsigned int); -int _ismbslead(const unsigned char*,const unsigned char*); -int _ismbstrail(const unsigned char*,const unsigned char*); +int __cdecl _ismbblead(unsigned int); +int __cdecl _ismbbtrail(unsigned int); +int __cdecl _ismbslead(const unsigned char*,const unsigned char*); +int __cdecl _ismbstrail(const unsigned char*,const unsigned char*); #endif /* _MBLEADTRAIL_DEFINED */ #ifdef __cplusplus diff --git a/include/msvcrt/mbstring.h b/include/msvcrt/mbstring.h dissimilarity index 75% index f4fa6970669..f3d7edf9bf2 100644 --- a/include/msvcrt/mbstring.h +++ b/include/msvcrt/mbstring.h @@ -1,123 +1,120 @@ -/* - * Multibyte string definitions - * - * Copyright 2001 Francois Gouget. - * - * 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 - */ -#ifndef __WINE_MBSTRING_H -#define __WINE_MBSTRING_H - -#include - -#include - -#ifndef _NLSCMP_DEFINED -#define _NLSCMPERROR ((unsigned int)0x7fffffff) -#define _NLSCMP_DEFINED -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -int _ismbcalnum(unsigned int); -int _ismbcalpha(unsigned int); -int _ismbcdigit(unsigned int); -int _ismbcgraph(unsigned int); -int _ismbchira(unsigned int); -int _ismbckata(unsigned int); -int _ismbcl0(unsigned int); -int _ismbcl1(unsigned int); -int _ismbcl2(unsigned int); -int _ismbclegal(unsigned int); -int _ismbclower(unsigned int); -int _ismbcprint(unsigned int); -int _ismbcpunct(unsigned int); -int _ismbcspace(unsigned int); -int _ismbcsymbol(unsigned int); -int _ismbcupper(unsigned int); -unsigned int _mbbtombc(unsigned int); -int _mbbtype(unsigned char,int); -#define _mbccmp(_cpc1,_cpc2) _mbsncmp((_cpc1),(_cpc2),1) -void _mbccpy(unsigned char*,const unsigned char*); -unsigned int _mbcjistojms(unsigned int); -unsigned int _mbcjmstojis(unsigned int); -size_t _mbclen(const unsigned char*); -unsigned int _mbctohira(unsigned int); -unsigned int _mbctokata(unsigned int); -unsigned int _mbctolower(unsigned int); -unsigned int _mbctombb(unsigned int); -unsigned int _mbctoupper(unsigned int); -int _mbsbtype(const unsigned char*,size_t); -unsigned char* _mbscat(unsigned char*,const unsigned char*); -unsigned char* _mbschr(const unsigned char*,unsigned int); -int _mbscmp(const unsigned char*,const unsigned char*); -int _mbscoll(const unsigned char*,const unsigned char*); -unsigned char* _mbscpy(unsigned char*,const unsigned char*); -size_t _mbscspn(const unsigned char*,const unsigned char*); -unsigned char* _mbsdec(const unsigned char*,const unsigned char*); -unsigned char* _mbsdup(const unsigned char*); -int _mbsicmp(const unsigned char*,const unsigned char*); -int _mbsicoll(const unsigned char*,const unsigned char*); -unsigned char* _mbsinc(const unsigned char*); -size_t _mbslen(const unsigned char*); -unsigned char* _mbslwr(unsigned char*); -unsigned char* _mbsnbcat(unsigned char*,const unsigned char*,size_t); -int _mbsnbcmp(const unsigned char*,const unsigned char*,size_t); -int _mbsnbcoll(const unsigned char*,const unsigned char*,size_t); -size_t _mbsnbcnt(const unsigned char*,size_t); -unsigned char* _mbsnbcpy(unsigned char*,const unsigned char* -,size_t); -int _mbsnbicmp(const unsigned char*,const unsigned char*,size_t); -int _mbsnbicoll(const unsigned char*,const unsigned char*,size_t); -unsigned char* _mbsnbset(unsigned char*,unsigned int,size_t) -; -unsigned char* _mbsncat(unsigned char*,const unsigned char*, - size_t); -size_t _mbsnccnt(const unsigned char*,size_t); -int _mbsncmp(const unsigned char*,const unsigned char*,size_t); -int _mbsncoll(const unsigned char*,const unsigned char*,size_t); -unsigned char* _mbsncpy(unsigned char*,const unsigned char*,size_t); -unsigned int _mbsnextc (const unsigned char*); -int _mbsnicmp(const unsigned char*,const unsigned char*,size_t); -int _mbsnicoll(const unsigned char*,const unsigned char*,size_t); -unsigned char* _mbsninc(const unsigned char*,size_t); -unsigned char* _mbsnset(unsigned char*,unsigned int,size_t); -unsigned char* _mbspbrk(const unsigned char*,const unsigned char*); -unsigned char* _mbsrchr(const unsigned char*,unsigned int); -unsigned char* _mbsrev(unsigned char*); -unsigned char* _mbsset(unsigned char*,unsigned int); -size_t _mbsspn(const unsigned char*,const unsigned char*); -unsigned char* _mbsspnp(const unsigned char*,const unsigned char*); -unsigned char* _mbsstr(const unsigned char*,const unsigned char*); -unsigned char* _mbstok(unsigned char*,const unsigned char*); -unsigned char* _mbsupr(unsigned char*); - -#ifndef _MBLEADTRAIL_DEFINED -#define _MBLEADTRAIL_DEFINED -int _ismbblead(unsigned int); -int _ismbbtrail(unsigned int); -int _ismbslead(const unsigned char*,const unsigned char*); -int _ismbstrail(const unsigned char*,const unsigned char*); -#endif /* _MBLEADTRAIL_DEFINED */ - -#ifdef __cplusplus -} -#endif - -#include - -#endif /* __WINE_MBSTRING_H */ +/* + * Multibyte string definitions + * + * Copyright 2001 Francois Gouget. + * + * 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 + */ +#ifndef __WINE_MBSTRING_H +#define __WINE_MBSTRING_H + +#include + +#include + +#ifndef _NLSCMP_DEFINED +#define _NLSCMPERROR ((unsigned int)0x7fffffff) +#define _NLSCMP_DEFINED +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +int __cdecl _ismbcalnum(unsigned int); +int __cdecl _ismbcalpha(unsigned int); +int __cdecl _ismbcdigit(unsigned int); +int __cdecl _ismbcgraph(unsigned int); +int __cdecl _ismbchira(unsigned int); +int __cdecl _ismbckata(unsigned int); +int __cdecl _ismbcl0(unsigned int); +int __cdecl _ismbcl1(unsigned int); +int __cdecl _ismbcl2(unsigned int); +int __cdecl _ismbclegal(unsigned int); +int __cdecl _ismbclower(unsigned int); +int __cdecl _ismbcprint(unsigned int); +int __cdecl _ismbcpunct(unsigned int); +int __cdecl _ismbcspace(unsigned int); +int __cdecl _ismbcsymbol(unsigned int); +int __cdecl _ismbcupper(unsigned int); +unsigned int __cdecl _mbbtombc(unsigned int); +int __cdecl _mbbtype(unsigned char,int); +#define _mbccmp(_cpc1,_cpc2) _mbsncmp((_cpc1),(_cpc2),1) +void __cdecl _mbccpy(unsigned char*,const unsigned char*); +unsigned int __cdecl _mbcjistojms(unsigned int); +unsigned int __cdecl _mbcjmstojis(unsigned int); +size_t __cdecl _mbclen(const unsigned char*); +unsigned int __cdecl _mbctohira(unsigned int); +unsigned int __cdecl _mbctokata(unsigned int); +unsigned int __cdecl _mbctolower(unsigned int); +unsigned int __cdecl _mbctombb(unsigned int); +unsigned int __cdecl _mbctoupper(unsigned int); +int __cdecl _mbsbtype(const unsigned char*,size_t); +unsigned char* __cdecl _mbscat(unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbschr(const unsigned char*,unsigned int); +int __cdecl _mbscmp(const unsigned char*,const unsigned char*); +int __cdecl _mbscoll(const unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbscpy(unsigned char*,const unsigned char*); +size_t __cdecl _mbscspn(const unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbsdec(const unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbsdup(const unsigned char*); +int __cdecl _mbsicmp(const unsigned char*,const unsigned char*); +int __cdecl _mbsicoll(const unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbsinc(const unsigned char*); +size_t __cdecl _mbslen(const unsigned char*); +unsigned char* __cdecl _mbslwr(unsigned char*); +unsigned char* __cdecl _mbsnbcat(unsigned char*,const unsigned char*,size_t); +int __cdecl _mbsnbcmp(const unsigned char*,const unsigned char*,size_t); +int __cdecl _mbsnbcoll(const unsigned char*,const unsigned char*,size_t); +size_t __cdecl _mbsnbcnt(const unsigned char*,size_t); +unsigned char* __cdecl _mbsnbcpy(unsigned char*,const unsigned char*,size_t); +int __cdecl _mbsnbicmp(const unsigned char*,const unsigned char*,size_t); +int __cdecl _mbsnbicoll(const unsigned char*,const unsigned char*,size_t); +unsigned char* __cdecl _mbsnbset(unsigned char*,unsigned int,size_t); +unsigned char* __cdecl _mbsncat(unsigned char*,const unsigned char*, size_t); +size_t __cdecl _mbsnccnt(const unsigned char*,size_t); +int __cdecl _mbsncmp(const unsigned char*,const unsigned char*,size_t); +int __cdecl _mbsncoll(const unsigned char*,const unsigned char*,size_t); +unsigned char* __cdecl _mbsncpy(unsigned char*,const unsigned char*,size_t); +unsigned int __cdecl _mbsnextc (const unsigned char*); +int __cdecl _mbsnicmp(const unsigned char*,const unsigned char*,size_t); +int __cdecl _mbsnicoll(const unsigned char*,const unsigned char*,size_t); +unsigned char* __cdecl _mbsninc(const unsigned char*,size_t); +unsigned char* __cdecl _mbsnset(unsigned char*,unsigned int,size_t); +unsigned char* __cdecl _mbspbrk(const unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbsrchr(const unsigned char*,unsigned int); +unsigned char* __cdecl _mbsrev(unsigned char*); +unsigned char* __cdecl _mbsset(unsigned char*,unsigned int); +size_t __cdecl _mbsspn(const unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbsspnp(const unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbsstr(const unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbstok(unsigned char*,const unsigned char*); +unsigned char* __cdecl _mbsupr(unsigned char*); + +#ifndef _MBLEADTRAIL_DEFINED +#define _MBLEADTRAIL_DEFINED +int __cdecl _ismbblead(unsigned int); +int __cdecl _ismbbtrail(unsigned int); +int __cdecl _ismbslead(const unsigned char*,const unsigned char*); +int __cdecl _ismbstrail(const unsigned char*,const unsigned char*); +#endif /* _MBLEADTRAIL_DEFINED */ + +#ifdef __cplusplus +} +#endif + +#include + +#endif /* __WINE_MBSTRING_H */ diff --git a/include/msvcrt/memory.h b/include/msvcrt/memory.h index d501ece4f2e..769fcfc88d6 100644 --- a/include/msvcrt/memory.h +++ b/include/msvcrt/memory.h @@ -17,12 +17,12 @@ extern "C" { #ifndef _CRT_MEMORY_DEFINED #define _CRT_MEMORY_DEFINED -void* memchr(const void*,int,size_t); -int memcmp(const void*,const void*,size_t); -void* memcpy(void*,const void*,size_t); -void* memset(void*,int,size_t); -void* _memccpy(void*,const void*,int,unsigned int); -int _memicmp(const void*,const void*,unsigned int); +void* __cdecl memchr(const void*,int,size_t); +int __cdecl memcmp(const void*,const void*,size_t); +void* __cdecl memcpy(void*,const void*,size_t); +void* __cdecl memset(void*,int,size_t); +void* __cdecl _memccpy(void*,const void*,int,unsigned int); +int __cdecl _memicmp(const void*,const void*,unsigned int); static inline int memicmp(const void* s1, const void* s2, size_t len) { return _memicmp(s1, s2, len); } static inline void* memccpy(void *s1, const void *s2, int c, size_t n) { return _memccpy(s1, s2, c, n); } diff --git a/include/msvcrt/process.h b/include/msvcrt/process.h index e9ac135572f..c02dbcf994a 100644 --- a/include/msvcrt/process.h +++ b/include/msvcrt/process.h @@ -27,55 +27,55 @@ extern "C" { typedef void (*_beginthread_start_routine_t)(void *); typedef unsigned int (__stdcall *_beginthreadex_start_routine_t)(void *); -uintptr_t _beginthread(_beginthread_start_routine_t,unsigned int,void*); -uintptr_t _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*); -intptr_t _cwait(int*,intptr_t,int); -void _endthread(void); -void _endthreadex(unsigned int); -intptr_t _execl(const char*,const char*,...); -intptr_t _execle(const char*,const char*,...); -intptr_t _execlp(const char*,const char*,...); -intptr_t _execlpe(const char*,const char*,...); -intptr_t _execv(const char*,char* const *); -intptr_t _execve(const char*,char* const *,const char* const *); -intptr_t _execvp(const char*,char* const *); -intptr_t _execvpe(const char*,char* const *,const char* const *); -int _getpid(void); -intptr_t _spawnl(int,const char*,const char*,...); -intptr_t _spawnle(int,const char*,const char*,...); -intptr_t _spawnlp(int,const char*,const char*,...); -intptr_t _spawnlpe(int,const char*,const char*,...); -intptr_t _spawnv(int,const char*,const char* const *); -intptr_t _spawnve(int,const char*,const char* const *,const char* const *); -intptr_t _spawnvp(int,const char*,const char* const *); -intptr_t _spawnvpe(int,const char*,const char* const *,const char* const *); +uintptr_t __cdecl _beginthread(_beginthread_start_routine_t,unsigned int,void*); +uintptr_t __cdecl _beginthreadex(void*,unsigned int,_beginthreadex_start_routine_t,void*,unsigned int,unsigned int*); +intptr_t __cdecl _cwait(int*,intptr_t,int); +void __cdecl _endthread(void); +void __cdecl _endthreadex(unsigned int); +intptr_t __cdecl _execl(const char*,const char*,...); +intptr_t __cdecl _execle(const char*,const char*,...); +intptr_t __cdecl _execlp(const char*,const char*,...); +intptr_t __cdecl _execlpe(const char*,const char*,...); +intptr_t __cdecl _execv(const char*,char* const *); +intptr_t __cdecl _execve(const char*,char* const *,const char* const *); +intptr_t __cdecl _execvp(const char*,char* const *); +intptr_t __cdecl _execvpe(const char*,char* const *,const char* const *); +int __cdecl _getpid(void); +intptr_t __cdecl _spawnl(int,const char*,const char*,...); +intptr_t __cdecl _spawnle(int,const char*,const char*,...); +intptr_t __cdecl _spawnlp(int,const char*,const char*,...); +intptr_t __cdecl _spawnlpe(int,const char*,const char*,...); +intptr_t __cdecl _spawnv(int,const char*,const char* const *); +intptr_t __cdecl _spawnve(int,const char*,const char* const *,const char* const *); +intptr_t __cdecl _spawnvp(int,const char*,const char* const *); +intptr_t __cdecl _spawnvpe(int,const char*,const char* const *,const char* const *); -void _c_exit(void); -void _cexit(void); -void _exit(int); -void abort(void); -void exit(int); -int system(const char*); +void __cdecl _c_exit(void); +void __cdecl _cexit(void); +void __cdecl _exit(int); +void __cdecl abort(void); +void __cdecl exit(int); +int __cdecl system(const char*); #ifndef _WPROCESS_DEFINED #define _WPROCESS_DEFINED -intptr_t _wexecl(const wchar_t*,const wchar_t*,...); -intptr_t _wexecle(const wchar_t*,const wchar_t*,...); -intptr_t _wexeclp(const wchar_t*,const wchar_t*,...); -intptr_t _wexeclpe(const wchar_t*,const wchar_t*,...); -intptr_t _wexecv(const wchar_t*,const wchar_t* const *); -intptr_t _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *); -intptr_t _wexecvp(const wchar_t*,const wchar_t* const *); -intptr_t _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *); -intptr_t _wspawnl(int,const wchar_t*,const wchar_t*,...); -intptr_t _wspawnle(int,const wchar_t*,const wchar_t*,...); -intptr_t _wspawnlp(int,const wchar_t*,const wchar_t*,...); -intptr_t _wspawnlpe(int,const wchar_t*,const wchar_t*,...); -intptr_t _wspawnv(int,const wchar_t*,const wchar_t* const *); -intptr_t _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *); -intptr_t _wspawnvp(int,const wchar_t*,const wchar_t* const *); -intptr_t _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *); -int _wsystem(const wchar_t*); +intptr_t __cdecl _wexecl(const wchar_t*,const wchar_t*,...); +intptr_t __cdecl _wexecle(const wchar_t*,const wchar_t*,...); +intptr_t __cdecl _wexeclp(const wchar_t*,const wchar_t*,...); +intptr_t __cdecl _wexeclpe(const wchar_t*,const wchar_t*,...); +intptr_t __cdecl _wexecv(const wchar_t*,const wchar_t* const *); +intptr_t __cdecl _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *); +intptr_t __cdecl _wexecvp(const wchar_t*,const wchar_t* const *); +intptr_t __cdecl _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *); +intptr_t __cdecl _wspawnl(int,const wchar_t*,const wchar_t*,...); +intptr_t __cdecl _wspawnle(int,const wchar_t*,const wchar_t*,...); +intptr_t __cdecl _wspawnlp(int,const wchar_t*,const wchar_t*,...); +intptr_t __cdecl _wspawnlpe(int,const wchar_t*,const wchar_t*,...); +intptr_t __cdecl _wspawnv(int,const wchar_t*,const wchar_t* const *); +intptr_t __cdecl _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *); +intptr_t __cdecl _wspawnvp(int,const wchar_t*,const wchar_t* const *); +intptr_t __cdecl _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *); +int __cdecl _wsystem(const wchar_t*); #endif /* _WPROCESS_DEFINED */ #ifdef __cplusplus @@ -104,14 +104,14 @@ static inline intptr_t spawnvp(int flags, const char* name, const char* const* a static inline intptr_t spawnvpe(int flags, const char* name, const char* const* argv, const char* const* envv) { return _spawnvpe(flags, name, argv, envv); } #if defined(__GNUC__) && (__GNUC__ < 4) -extern intptr_t execl(const char*,const char*,...) __attribute__((alias("_execl"))); -extern intptr_t execle(const char*,const char*,...) __attribute__((alias("_execle"))); -extern intptr_t execlp(const char*,const char*,...) __attribute__((alias("_execlp"))); -extern intptr_t execlpe(const char*,const char*,...) __attribute__((alias("_execlpe"))); -extern intptr_t spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl"))); -extern intptr_t spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle"))); -extern intptr_t spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp"))); -extern intptr_t spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe"))); +extern intptr_t __cdecl execl(const char*,const char*,...) __attribute__((alias("_execl"))); +extern intptr_t __cdecl execle(const char*,const char*,...) __attribute__((alias("_execle"))); +extern intptr_t __cdecl execlp(const char*,const char*,...) __attribute__((alias("_execlp"))); +extern intptr_t __cdecl execlpe(const char*,const char*,...) __attribute__((alias("_execlpe"))); +extern intptr_t __cdecl spawnl(int,const char*,const char*,...) __attribute__((alias("_spawnl"))); +extern intptr_t __cdecl spawnle(int,const char*,const char*,...) __attribute__((alias("_spawnle"))); +extern intptr_t __cdecl spawnlp(int,const char*,const char*,...) __attribute__((alias("_spawnlp"))); +extern intptr_t __cdecl spawnlpe(int,const char*,const char*,...) __attribute__((alias("_spawnlpe"))); #else #define execl _execl #define execle _execle diff --git a/include/msvcrt/search.h b/include/msvcrt/search.h index 67833740666..16a0850eaf6 100644 --- a/include/msvcrt/search.h +++ b/include/msvcrt/search.h @@ -26,14 +26,10 @@ extern "C" { #endif -void* _lfind(const void*,const void*,unsigned int*,unsigned int, - int (*)(const void*,const void*)); -void* _lsearch(const void*,void*,unsigned int*,unsigned int, - int (*)(const void*,const void*)); -void* bsearch(const void*,const void*,size_t,size_t, - int (*)(const void*,const void*)); -void qsort(void*,size_t,size_t, - int (*)(const void*,const void*)); +void* __cdecl _lfind(const void*,const void*,unsigned int*,unsigned int,int (*)(const void*,const void*)); +void* __cdecl _lsearch(const void*,void*,unsigned int*,unsigned int,int (*)(const void*,const void*)); +void* __cdecl bsearch(const void*,const void*,size_t,size_t,int (*)(const void*,const void*)); +void __cdecl qsort(void*,size_t,size_t,int (*)(const void*,const void*)); #ifdef __cplusplus } diff --git a/include/msvcrt/setjmp.h b/include/msvcrt/setjmp.h index a880739dcf8..82d7be65bfc 100644 --- a/include/msvcrt/setjmp.h +++ b/include/msvcrt/setjmp.h @@ -53,8 +53,8 @@ typedef _JBTYPE jmp_buf[_JBLEN]; extern "C" { #endif -int _setjmp(jmp_buf); -int longjmp(jmp_buf,int); +int __cdecl _setjmp(jmp_buf); +int __cdecl longjmp(jmp_buf,int); #ifdef __cplusplus } diff --git a/include/msvcrt/signal.h b/include/msvcrt/signal.h index 2ae6355ae4d..d9f72cc61e9 100644 --- a/include/msvcrt/signal.h +++ b/include/msvcrt/signal.h @@ -36,14 +36,14 @@ extern "C" { #endif -typedef void (*__sighandler_t)(int); +typedef void (__cdecl *__sighandler_t)(int); #define SIG_DFL ((__sighandler_t)0) #define SIG_IGN ((__sighandler_t)1) #define SIG_ERR ((__sighandler_t)-1) -__sighandler_t signal(int sig, __sighandler_t func); -int raise(int sig); +__sighandler_t __cdecl signal(int sig, __sighandler_t func); +int __cdecl raise(int sig); #ifdef __cplusplus } diff --git a/include/msvcrt/stddef.h b/include/msvcrt/stddef.h index c10fad19676..7a0288e8c29 100644 --- a/include/msvcrt/stddef.h +++ b/include/msvcrt/stddef.h @@ -41,9 +41,9 @@ extern "C" { #endif -unsigned long __threadid(void); -unsigned long __threadhandle(void); -#define _threadid (__threadid()) +unsigned long __cdecl __threadid(void); +unsigned long __cdecl __threadhandle(void); +#define _threadid (__threadid()) #ifdef __cplusplus } diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index 36087a3c792..98cc9503e6b 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -81,13 +81,13 @@ extern "C" { #endif #ifndef _STDIO_DEFINED -# ifdef _WIN64 /* __p__iob is not exported in Win64 */ -FILE* __iob_func(void); -# define _iob (__iob_func()) -# else -FILE* __p__iob(void); +# ifdef __i386__ +FILE* __cdecl __p__iob(void); # define _iob (__p__iob()) -# endif /* _WIN64 */ +# else +FILE* __cdecl __iob_func(void); +# define _iob (__iob_func()) +# endif #endif /* _STDIO_DEFINED */ #define stdin (_iob+STDIN_FILENO) @@ -96,108 +96,108 @@ FILE* __p__iob(void); #ifndef _STDIO_DEFINED #define _STDIO_DEFINED -int _fcloseall(void); -FILE* _fdopen(int,const char*); -int _fgetchar(void); -int _filbuf(FILE*); -int _fileno(FILE*); -int _flsbuf(int,FILE*); -int _flushall(void); -int _fputchar(int); -FILE* _fsopen(const char*,const char*,int); -int _getmaxstdio(void); -int _getw(FILE*); -int _pclose(FILE*); -FILE* _popen(const char*,const char*); -int _putw(int,FILE*); -int _rmtmp(void); -int _setmaxstdio(int); -int _snprintf(char*,size_t,const char*,...); -char* _tempnam(const char*,const char*); -int _unlink(const char*); -int _vsnprintf(char*,size_t,const char*,va_list); - -void clearerr(FILE*); -int fclose(FILE*); -int feof(FILE*); -int ferror(FILE*); -int fflush(FILE*); -int fgetc(FILE*); -int fgetpos(FILE*,fpos_t*); -char* fgets(char*,int,FILE*); -FILE* fopen(const char*,const char*); -int fprintf(FILE*,const char*,...); -int fputc(int,FILE*); -int fputs(const char*,FILE*); -size_t fread(void*,size_t,size_t,FILE*); -FILE* freopen(const char*,const char*,FILE*); -int fscanf(FILE*,const char*,...); -int fseek(FILE*,long,int); -int fsetpos(FILE*,fpos_t*); -long ftell(FILE*); -size_t fwrite(const void*,size_t,size_t,FILE*); -int getc(FILE*); -int getchar(void); -char* gets(char*); -void perror(const char*); -int printf(const char*,...); -int putc(int,FILE*); -int putchar(int); -int puts(const char*); -int remove(const char*); -int rename(const char*,const char*); -void rewind(FILE*); -int scanf(const char*,...); -void setbuf(FILE*,char*); -int setvbuf(FILE*,char*,int,size_t); -int sprintf(char*,const char*,...); -int sscanf(const char*,const char*,...); -FILE* tmpfile(void); -char* tmpnam(char*); -int ungetc(int,FILE*); -int vfprintf(FILE*,const char*,va_list); -int vprintf(const char*,va_list); -int vsprintf(char*,const char*,va_list); +int __cdecl _fcloseall(void); +FILE* __cdecl _fdopen(int,const char*); +int __cdecl _fgetchar(void); +int __cdecl _filbuf(FILE*); +int __cdecl _fileno(FILE*); +int __cdecl _flsbuf(int,FILE*); +int __cdecl _flushall(void); +int __cdecl _fputchar(int); +FILE* __cdecl _fsopen(const char*,const char*,int); +int __cdecl _getmaxstdio(void); +int __cdecl _getw(FILE*); +int __cdecl _pclose(FILE*); +FILE* __cdecl _popen(const char*,const char*); +int __cdecl _putw(int,FILE*); +int __cdecl _rmtmp(void); +int __cdecl _setmaxstdio(int); +int __cdecl _snprintf(char*,size_t,const char*,...); +char* __cdecl _tempnam(const char*,const char*); +int __cdecl _unlink(const char*); +int __cdecl _vsnprintf(char*,size_t,const char*,va_list); + +void __cdecl clearerr(FILE*); +int __cdecl fclose(FILE*); +int __cdecl feof(FILE*); +int __cdecl ferror(FILE*); +int __cdecl fflush(FILE*); +int __cdecl fgetc(FILE*); +int __cdecl fgetpos(FILE*,fpos_t*); +char* __cdecl fgets(char*,int,FILE*); +FILE* __cdecl fopen(const char*,const char*); +int __cdecl fprintf(FILE*,const char*,...); +int __cdecl fputc(int,FILE*); +int __cdecl fputs(const char*,FILE*); +size_t __cdecl fread(void*,size_t,size_t,FILE*); +FILE* __cdecl freopen(const char*,const char*,FILE*); +int __cdecl fscanf(FILE*,const char*,...); +int __cdecl fseek(FILE*,long,int); +int __cdecl fsetpos(FILE*,fpos_t*); +long __cdecl ftell(FILE*); +size_t __cdecl fwrite(const void*,size_t,size_t,FILE*); +int __cdecl getc(FILE*); +int __cdecl getchar(void); +char* __cdecl gets(char*); +void __cdecl perror(const char*); +int __cdecl printf(const char*,...); +int __cdecl putc(int,FILE*); +int __cdecl putchar(int); +int __cdecl puts(const char*); +int __cdecl remove(const char*); +int __cdecl rename(const char*,const char*); +void __cdecl rewind(FILE*); +int __cdecl scanf(const char*,...); +void __cdecl setbuf(FILE*,char*); +int __cdecl setvbuf(FILE*,char*,int,size_t); +int __cdecl sprintf(char*,const char*,...); +int __cdecl sscanf(const char*,const char*,...); +FILE* __cdecl tmpfile(void); +char* __cdecl tmpnam(char*); +int __cdecl ungetc(int,FILE*); +int __cdecl vfprintf(FILE*,const char*,va_list); +int __cdecl vprintf(const char*,va_list); +int __cdecl vsprintf(char*,const char*,va_list); #ifndef _WSTDIO_DEFINED #define _WSTDIO_DEFINED -wint_t _fgetwchar(void); -wint_t _fputwchar(wint_t); -wchar_t*_getws(wchar_t*); -int _putws(const wchar_t*); -int _snwprintf(wchar_t*,size_t,const wchar_t*,...); -int _vsnwprintf(wchar_t*,size_t,const wchar_t*,va_list); -FILE* _wfdopen(int,const wchar_t*); -FILE* _wfopen(const wchar_t*,const wchar_t*); -FILE* _wfreopen(const wchar_t*,const wchar_t*,FILE*); -FILE* _wfsopen(const wchar_t*,const wchar_t*,int); -void _wperror(const wchar_t*); -FILE* _wpopen(const wchar_t*,const wchar_t*); -int _wremove(const wchar_t*); -wchar_t*_wtempnam(const wchar_t*,const wchar_t*); -wchar_t*_wtmpnam(wchar_t*); - -wint_t fgetwc(FILE*); -wchar_t*fgetws(wchar_t*,int,FILE*); -wint_t fputwc(wint_t,FILE*); -int fputws(const wchar_t*,FILE*); -int fwprintf(FILE*,const wchar_t*,...); -int fputws(const wchar_t*,FILE*); -int fwscanf(FILE*,const wchar_t*,...); -wint_t getwc(FILE*); -wint_t getwchar(void); -wchar_t*getws(wchar_t*); -wint_t putwc(wint_t,FILE*); -wint_t putwchar(wint_t); -int putws(const wchar_t*); -int swprintf(wchar_t*,const wchar_t*,...); -int swscanf(const wchar_t*,const wchar_t*,...); -wint_t ungetwc(wint_t,FILE*); -int vfwprintf(FILE*,const wchar_t*,va_list); -int vswprintf(wchar_t*,const wchar_t*,va_list); -int vwprintf(const wchar_t*,va_list); -int wprintf(const wchar_t*,...); -int wscanf(const wchar_t*,...); +wint_t __cdecl _fgetwchar(void); +wint_t __cdecl _fputwchar(wint_t); +wchar_t* __cdecl _getws(wchar_t*); +int __cdecl _putws(const wchar_t*); +int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...); +int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,va_list); +FILE* __cdecl _wfdopen(int,const wchar_t*); +FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*); +FILE* __cdecl _wfreopen(const wchar_t*,const wchar_t*,FILE*); +FILE* __cdecl _wfsopen(const wchar_t*,const wchar_t*,int); +void __cdecl _wperror(const wchar_t*); +FILE* __cdecl _wpopen(const wchar_t*,const wchar_t*); +int __cdecl _wremove(const wchar_t*); +wchar_t* __cdecl _wtempnam(const wchar_t*,const wchar_t*); +wchar_t* __cdecl _wtmpnam(wchar_t*); + +wint_t __cdecl fgetwc(FILE*); +wchar_t* __cdecl fgetws(wchar_t*,int,FILE*); +wint_t __cdecl fputwc(wint_t,FILE*); +int __cdecl fputws(const wchar_t*,FILE*); +int __cdecl fwprintf(FILE*,const wchar_t*,...); +int __cdecl fputws(const wchar_t*,FILE*); +int __cdecl fwscanf(FILE*,const wchar_t*,...); +wint_t __cdecl getwc(FILE*); +wint_t __cdecl getwchar(void); +wchar_t* __cdecl getws(wchar_t*); +wint_t __cdecl putwc(wint_t,FILE*); +wint_t __cdecl putwchar(wint_t); +int __cdecl putws(const wchar_t*); +int __cdecl swprintf(wchar_t*,const wchar_t*,...); +int __cdecl swscanf(const wchar_t*,const wchar_t*,...); +wint_t __cdecl ungetwc(wint_t,FILE*); +int __cdecl vfwprintf(FILE*,const wchar_t*,va_list); +int __cdecl vswprintf(wchar_t*,const wchar_t*,va_list); +int __cdecl vwprintf(const wchar_t*,va_list); +int __cdecl wprintf(const wchar_t*,...); +int __cdecl wscanf(const wchar_t*,...); #endif /* _WSTDIO_DEFINED */ #endif /* _STDIO_DEFINED */ diff --git a/include/msvcrt/stdlib.h b/include/msvcrt/stdlib.h index 65c61a2b04e..eae4d53593b 100644 --- a/include/msvcrt/stdlib.h +++ b/include/msvcrt/stdlib.h @@ -76,132 +76,146 @@ typedef struct _ldiv_t { extern "C" { #endif -extern unsigned int* __p__osver(void); -extern unsigned int* __p__winver(void); -extern unsigned int* __p__winmajor(void); -extern unsigned int* __p__winminor(void); +#ifdef __i386__ + +extern unsigned int* __cdecl __p__osver(void); #define _osver (*__p__osver()) +extern unsigned int* __cdecl __p__winver(void); #define _winver (*__p__winver()) +extern unsigned int* __cdecl __p__winmajor(void); #define _winmajor (*__p__winmajor()) +extern unsigned int* __cdecl __p__winminor(void); #define _winminor (*__p__winminor()) - -extern int* __p___argc(void); -extern char*** __p___argv(void); -extern wchar_t*** __p___wargv(void); -extern char*** __p__environ(void); -extern wchar_t*** __p__wenviron(void); -extern int* __p___mb_cur_max(void); -extern unsigned long* __doserrno(void); -extern unsigned int* __p__fmode(void); -/* FIXME: We need functions to access these: - * int _sys_nerr; - * char** _sys_errlist; - */ +extern int* __cdecl __p___argc(void); #define __argc (*__p___argc()) +extern char*** __cdecl __p___argv(void); #define __argv (*__p___argv()) +extern wchar_t*** __cdecl __p___wargv(void); #define __wargv (*__p___wargv()) +extern char*** __cdecl __p__environ(void); #define _environ (*__p__environ()) +extern wchar_t*** __cdecl __p__wenviron(void); #define _wenviron (*__p__wenviron()) -#define __mb_cur_max (*__p___mb_cur_max()) -#define _doserrno (*__doserrno()) -#define _fmode (*_fmode) - - -extern int* _errno(void); -#define errno (*_errno()) - - -typedef int (*_onexit_t)(void); - - -int _atodbl(_CRT_DOUBLE*,char*); -int _atoflt(_CRT_FLOAT*,char*); -__int64 _atoi64(const char*); -long double _atold(const char*); -int _atoldbl(_LDOUBLE*,char*); -void _beep(unsigned int,unsigned int); -char* _ecvt(double,int,int*,int*); -char* _fcvt(double,int,int*,int*); -char* _fullpath(char*,const char*,size_t); -char* _gcvt(double,int,char*); -char* _i64toa(__int64,char*,int); -char* _itoa(int,char*,int); -char* _ltoa(long,char*,int); -unsigned long _lrotl(unsigned long,int); -unsigned long _lrotr(unsigned long,int); -void _makepath(char*,const char*,const char*,const char*,const char*); -size_t _mbstrlen(const char*); -_onexit_t _onexit(_onexit_t); -int _putenv(const char*); -unsigned int _rotl(unsigned int,int); -unsigned int _rotr(unsigned int,int); -void _searchenv(const char*,const char*,char*); -int _set_error_mode(int); -void _seterrormode(int); -void _sleep(unsigned long); -void _splitpath(const char*,char*,char*,char*,char*); -long double _strtold(const char*,char**); -void _swab(char*,char*,int); -char* _ui64toa(unsigned __int64,char*,int); -char* _ultoa(unsigned long,char*,int); - -void _exit(int); -void abort(void); -int abs(int); -int atexit(void (*)(void)); -double atof(const char*); -int atoi(const char*); -long atol(const char*); -void* calloc(size_t,size_t); +extern unsigned int* __cdecl __p__fmode(void); +#define _fmode (*__p__fmode()) + +#else /* __i386__ */ + +extern unsigned int _osver; +extern unsigned int _winver; +extern unsigned int _winmajor; +extern unsigned int _winminor; +extern int __argc; +extern char **__argv; +extern wchar_t **__wargv; +extern char **_environ; +extern wchar_t **_wenviron; +extern unsigned int _fmode; + +#endif /* __i386__ */ + +extern int* __cdecl ___mb_cur_max_func(void); +#define __mb_cur_max (*___mb_cur_max_func()) +extern unsigned long* __cdecl __doserrno(void); +#define _doserrno (*__doserrno()) +extern int* __cdecl _errno(void); +#define errno (*_errno()) + +/* FIXME: We need functions to access these: + * int _sys_nerr; + * char** _sys_errlist; + */ + + +typedef int (__cdecl *_onexit_t)(void); + + +int __cdecl _atodbl(_CRT_DOUBLE*,char*); +int __cdecl _atoflt(_CRT_FLOAT*,char*); +__int64 __cdecl _atoi64(const char*); +long double __cdecl _atold(const char*); +int __cdecl _atoldbl(_LDOUBLE*,char*); +void __cdecl _beep(unsigned int,unsigned int); +char* __cdecl _ecvt(double,int,int*,int*); +char* __cdecl _fcvt(double,int,int*,int*); +char* __cdecl _fullpath(char*,const char*,size_t); +char* __cdecl _gcvt(double,int,char*); +char* __cdecl _i64toa(__int64,char*,int); +char* __cdecl _itoa(int,char*,int); +char* __cdecl _ltoa(long,char*,int); +unsigned long __cdecl _lrotl(unsigned long,int); +unsigned long __cdecl _lrotr(unsigned long,int); +void __cdecl _makepath(char*,const char*,const char*,const char*,const char*); +size_t __cdecl _mbstrlen(const char*); +_onexit_t __cdecl _onexit(_onexit_t); +int __cdecl _putenv(const char*); +unsigned int __cdecl _rotl(unsigned int,int); +unsigned int __cdecl _rotr(unsigned int,int); +void __cdecl _searchenv(const char*,const char*,char*); +int __cdecl _set_error_mode(int); +void __cdecl _seterrormode(int); +void __cdecl _sleep(unsigned long); +void __cdecl _splitpath(const char*,char*,char*,char*,char*); +long double __cdecl _strtold(const char*,char**); +void __cdecl _swab(char*,char*,int); +char* __cdecl _ui64toa(unsigned __int64,char*,int); +char* __cdecl _ultoa(unsigned long,char*,int); + +void __cdecl _exit(int); +void __cdecl abort(void); +int __cdecl abs(int); +int __cdecl atexit(void (*)(void)); +double __cdecl atof(const char*); +int __cdecl atoi(const char*); +long __cdecl atol(const char*); +void* __cdecl calloc(size_t,size_t); #ifndef __i386__ -div_t div(int,int); -ldiv_t ldiv(long,long); +div_t __cdecl div(int,int); +ldiv_t __cdecl ldiv(long,long); #endif -void exit(int); -void free(void*); -char* getenv(const char*); -long labs(long); -void* malloc(size_t); -int mblen(const char*,size_t); -void perror(const char*); -int rand(void); -void* realloc(void*,size_t); -void srand(unsigned int); -double strtod(const char*,char**); -long strtol(const char*,char**,int); -unsigned long strtoul(const char*,char**,int); -int system(const char*); -void* bsearch(const void*,const void*,size_t,size_t, - int (*)(const void*,const void*)); -void qsort(void*,size_t,size_t, - int (*)(const void*,const void*)); +void __cdecl exit(int); +void __cdecl free(void*); +char* __cdecl getenv(const char*); +long __cdecl labs(long); +void* __cdecl malloc(size_t); +int __cdecl mblen(const char*,size_t); +void __cdecl perror(const char*); +int __cdecl rand(void); +void* __cdecl realloc(void*,size_t); +void __cdecl srand(unsigned int); +double __cdecl strtod(const char*,char**); +long __cdecl strtol(const char*,char**,int); +unsigned long __cdecl strtoul(const char*,char**,int); +int __cdecl system(const char*); +void* __cdecl bsearch(const void*,const void*,size_t,size_t,int (*)(const void*,const void*)); +void __cdecl qsort(void*,size_t,size_t,int (*)(const void*,const void*)); #ifndef _WSTDLIB_DEFINED #define _WSTDLIB_DEFINED -wchar_t*_itow(int,wchar_t*,int); -wchar_t*_i64tow(__int64,wchar_t*,int); -wchar_t*_ltow(long,wchar_t*,int); -wchar_t*_ui64tow(unsigned __int64,wchar_t*,int); -wchar_t*_ultow(unsigned long,wchar_t*,int); -wchar_t*_wfullpath(wchar_t*,const wchar_t*,size_t); -wchar_t*_wgetenv(const wchar_t*); -void _wmakepath(wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*); -void _wperror(const wchar_t*); -int _wputenv(const wchar_t*); -void _wsearchenv(const wchar_t*,const wchar_t*,wchar_t*); -void _wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*); -int _wsystem(const wchar_t*); -int _wtoi(const wchar_t*); -__int64 _wtoi64(const wchar_t*); -long _wtol(const wchar_t*); - -size_t mbstowcs(wchar_t*,const char*,size_t); -int mbtowc(wchar_t*,const char*,size_t); -double wcstod(const wchar_t*,wchar_t**); -long wcstol(const wchar_t*,wchar_t**,int); -size_t wcstombs(char*,const wchar_t*,size_t); -unsigned long wcstoul(const wchar_t*,wchar_t**,int); -int wctomb(char*,wchar_t); +wchar_t* __cdecl _itow(int,wchar_t*,int); +wchar_t* __cdecl _i64tow(__int64,wchar_t*,int); +wchar_t* __cdecl _ltow(long,wchar_t*,int); +wchar_t* __cdecl _ui64tow(unsigned __int64,wchar_t*,int); +wchar_t* __cdecl _ultow(unsigned long,wchar_t*,int); +wchar_t* __cdecl _wfullpath(wchar_t*,const wchar_t*,size_t); +wchar_t* __cdecl _wgetenv(const wchar_t*); +void __cdecl _wmakepath(wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*); +void __cdecl _wperror(const wchar_t*); +int __cdecl _wputenv(const wchar_t*); +void __cdecl _wsearchenv(const wchar_t*,const wchar_t*,wchar_t*); +void __cdecl _wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*); +int __cdecl _wsystem(const wchar_t*); +int __cdecl _wtoi(const wchar_t*); +__int64 __cdecl _wtoi64(const wchar_t*); +long __cdecl _wtol(const wchar_t*); + +size_t __cdecl mbstowcs(wchar_t*,const char*,size_t); +int __cdecl mbtowc(wchar_t*,const char*,size_t); +double __cdecl wcstod(const wchar_t*,wchar_t**); +long __cdecl wcstol(const wchar_t*,wchar_t**,int); +size_t __cdecl wcstombs(char*,const wchar_t*,size_t); +unsigned long __cdecl wcstoul(const wchar_t*,wchar_t**,int); +int __cdecl wctomb(char*,wchar_t); #endif /* _WSTDLIB_DEFINED */ #ifdef __cplusplus diff --git a/include/msvcrt/string.h b/include/msvcrt/string.h index 0a9a7a2b83a..03bf4f8fb04 100644 --- a/include/msvcrt/string.h +++ b/include/msvcrt/string.h @@ -29,76 +29,76 @@ extern "C" { #ifndef _CRT_MEMORY_DEFINED #define _CRT_MEMORY_DEFINED -void* memchr(const void*,int,size_t); -int memcmp(const void*,const void*,size_t); -void* memcpy(void*,const void*,size_t); -void* memset(void*,int,size_t); -void* _memccpy(void*,const void*,int,unsigned int); -int _memicmp(const void*,const void*,unsigned int); +void* __cdecl memchr(const void*,int,size_t); +int __cdecl memcmp(const void*,const void*,size_t); +void* __cdecl memcpy(void*,const void*,size_t); +void* __cdecl memset(void*,int,size_t); +void* __cdecl _memccpy(void*,const void*,int,unsigned int); +int __cdecl _memicmp(const void*,const void*,unsigned int); static inline int memicmp(const void* s1, const void* s2, size_t len) { return _memicmp(s1, s2, len); } static inline void* memccpy(void *s1, const void *s2, int c, size_t n) { return _memccpy(s1, s2, c, n); } #endif /* _CRT_MEMORY_DEFINED */ -int _strcmpi(const char*,const char*); -char* _strdup(const char*); -char* _strerror(const char*); -int _stricmp(const char*,const char*); -int _stricoll(const char*,const char*); -char* _strlwr(char*); -int _strnicmp(const char*,const char*,size_t); -char* _strnset(char*,int,size_t); -char* _strrev(char*); -char* _strset(char*,int); -char* _strupr(char*); +int __cdecl _strcmpi(const char*,const char*); +char* __cdecl _strdup(const char*); +char* __cdecl _strerror(const char*); +int __cdecl _stricmp(const char*,const char*); +int __cdecl _stricoll(const char*,const char*); +char* __cdecl _strlwr(char*); +int __cdecl _strnicmp(const char*,const char*,size_t); +char* __cdecl _strnset(char*,int,size_t); +char* __cdecl _strrev(char*); +char* __cdecl _strset(char*,int); +char* __cdecl _strupr(char*); -void* memmove(void*,const void*,size_t); -char* strcat(char*,const char*); -char* strchr(const char*,int); -int strcmp(const char*,const char*); -int strcoll(const char*,const char*); -char* strcpy(char*,const char*); -size_t strcspn(const char*,const char*); -char* strerror(int); -size_t strlen(const char*); -char* strncat(char*,const char*,size_t); -int strncmp(const char*,const char*,size_t); -char* strncpy(char*,const char*,size_t); -char* strpbrk(const char*,const char*); -char* strrchr(const char*,int); -size_t strspn(const char*,const char*); -char* strstr(const char*,const char*); -char* strtok(char*,const char*); -size_t strxfrm(char*,const char*,size_t); +void* __cdecl memmove(void*,const void*,size_t); +char* __cdecl strcat(char*,const char*); +char* __cdecl strchr(const char*,int); +int __cdecl strcmp(const char*,const char*); +int __cdecl strcoll(const char*,const char*); +char* __cdecl strcpy(char*,const char*); +size_t __cdecl strcspn(const char*,const char*); +char* __cdecl strerror(int); +size_t __cdecl strlen(const char*); +char* __cdecl strncat(char*,const char*,size_t); +int __cdecl strncmp(const char*,const char*,size_t); +char* __cdecl strncpy(char*,const char*,size_t); +char* __cdecl strpbrk(const char*,const char*); +char* __cdecl strrchr(const char*,int); +size_t __cdecl strspn(const char*,const char*); +char* __cdecl strstr(const char*,const char*); +char* __cdecl strtok(char*,const char*); +size_t __cdecl strxfrm(char*,const char*,size_t); #ifndef _WSTRING_DEFINED #define _WSTRING_DEFINED -wchar_t*_wcsdup(const wchar_t*); -int _wcsicmp(const wchar_t*,const wchar_t*); -int _wcsicoll(const wchar_t*,const wchar_t*); -wchar_t*_wcslwr(wchar_t*); -int _wcsnicmp(const wchar_t*,const wchar_t*,size_t); -wchar_t*_wcsnset(wchar_t*,wchar_t,size_t); -wchar_t*_wcsrev(wchar_t*); -wchar_t*_wcsset(wchar_t*,wchar_t); -wchar_t*_wcsupr(wchar_t*); +wchar_t* __cdecl _wcsdup(const wchar_t*); +int __cdecl _wcsicmp(const wchar_t*,const wchar_t*); +int __cdecl _wcsicoll(const wchar_t*,const wchar_t*); +wchar_t* __cdecl _wcslwr(wchar_t*); +int __cdecl _wcsnicmp(const wchar_t*,const wchar_t*,size_t); +wchar_t* __cdecl _wcsnset(wchar_t*,wchar_t,size_t); +wchar_t* __cdecl _wcsrev(wchar_t*); +wchar_t* __cdecl _wcsset(wchar_t*,wchar_t); +wchar_t* __cdecl _wcsupr(wchar_t*); -wchar_t*wcscat(wchar_t*,const wchar_t*); -wchar_t*wcschr(const wchar_t*,wchar_t); -int wcscmp(const wchar_t*,const wchar_t*); -int wcscoll(const wchar_t*,const wchar_t*); -wchar_t*wcscpy(wchar_t*,const wchar_t*); -size_t wcscspn(const wchar_t*,const wchar_t*); -size_t wcslen(const wchar_t*); -wchar_t*wcsncat(wchar_t*,const wchar_t*,size_t); -int wcsncmp(const wchar_t*,const wchar_t*,size_t); -wchar_t*wcsncpy(wchar_t*,const wchar_t*,size_t); -wchar_t*wcspbrk(const wchar_t*,const wchar_t*); -wchar_t*wcsrchr(const wchar_t*,wchar_t wcFor); -size_t wcsspn(const wchar_t*,const wchar_t*); -wchar_t*wcsstr(const wchar_t*,const wchar_t*); -wchar_t*wcstok(wchar_t*,const wchar_t*); -size_t wcsxfrm(wchar_t*,const wchar_t*,size_t); +wchar_t* __cdecl wcscat(wchar_t*,const wchar_t*); +wchar_t* __cdecl wcschr(const wchar_t*,wchar_t); +int __cdecl wcscmp(const wchar_t*,const wchar_t*); +int __cdecl wcscoll(const wchar_t*,const wchar_t*); +wchar_t* __cdecl wcscpy(wchar_t*,const wchar_t*); +size_t __cdecl wcscspn(const wchar_t*,const wchar_t*); +size_t __cdecl wcslen(const wchar_t*); +wchar_t* __cdecl wcsncat(wchar_t*,const wchar_t*,size_t); +int __cdecl wcsncmp(const wchar_t*,const wchar_t*,size_t); +wchar_t* __cdecl wcsncpy(wchar_t*,const wchar_t*,size_t); +wchar_t* __cdecl wcspbrk(const wchar_t*,const wchar_t*); +wchar_t* __cdecl wcsrchr(const wchar_t*,wchar_t wcFor); +size_t __cdecl wcsspn(const wchar_t*,const wchar_t*); +wchar_t* __cdecl wcsstr(const wchar_t*,const wchar_t*); +wchar_t* __cdecl wcstok(wchar_t*,const wchar_t*); +size_t __cdecl wcsxfrm(wchar_t*,const wchar_t*,size_t); #endif /* _WSTRING_DEFINED */ #ifdef __cplusplus diff --git a/include/msvcrt/sys/stat.h b/include/msvcrt/sys/stat.h index c29daf68e07..171278885ea 100644 --- a/include/msvcrt/sys/stat.h +++ b/include/msvcrt/sys/stat.h @@ -116,19 +116,19 @@ struct _stat64 { extern "C" { #endif -int _fstat(int,struct _stat*); -int _stat(const char*,struct _stat*); -int _fstati64(int,struct _stati64*); -int _stati64(const char*,struct _stati64*); -int _fstat64(int,struct _stat64*); -int _stat64(const char*,struct _stat64*); -int _umask(int); +int __cdecl _fstat(int,struct _stat*); +int __cdecl _stat(const char*,struct _stat*); +int __cdecl _fstati64(int,struct _stati64*); +int __cdecl _stati64(const char*,struct _stati64*); +int __cdecl _fstat64(int,struct _stat64*); +int __cdecl _stat64(const char*,struct _stat64*); +int __cdecl _umask(int); #ifndef _WSTAT_DEFINED #define _WSTAT_DEFINED -int _wstat(const wchar_t*,struct _stat*); -int _wstati64(const wchar_t*,struct _stati64*); -int _wstat64(const wchar_t*,struct _stat64*); +int __cdecl _wstat(const wchar_t*,struct _stat*); +int __cdecl _wstati64(const wchar_t*,struct _stati64*); +int __cdecl _wstat64(const wchar_t*,struct _stat64*); #endif /* _WSTAT_DEFINED */ #ifdef __cplusplus diff --git a/include/msvcrt/sys/timeb.h b/include/msvcrt/sys/timeb.h index 3e2995a113c..a3259130a60 100644 --- a/include/msvcrt/sys/timeb.h +++ b/include/msvcrt/sys/timeb.h @@ -40,7 +40,7 @@ struct _timeb extern "C" { #endif -void _ftime(struct _timeb*); +void __cdecl _ftime(struct _timeb*); #ifdef __cplusplus } diff --git a/include/msvcrt/sys/utime.h b/include/msvcrt/sys/utime.h index f1315b1691d..95b1f9bc5f9 100644 --- a/include/msvcrt/sys/utime.h +++ b/include/msvcrt/sys/utime.h @@ -37,10 +37,9 @@ struct _utimbuf extern "C" { #endif -int _futime(int,struct _utimbuf*); -int _utime(const char*,struct _utimbuf*); - -int _wutime(const wchar_t*,struct _utimbuf*); +int __cdecl _futime(int,struct _utimbuf*); +int __cdecl _utime(const char*,struct _utimbuf*); +int __cdecl _wutime(const wchar_t*,struct _utimbuf*); #ifdef __cplusplus } diff --git a/include/msvcrt/time.h b/include/msvcrt/time.h index 10446227e7f..7b0eb4c8b13 100644 --- a/include/msvcrt/time.h +++ b/include/msvcrt/time.h @@ -60,39 +60,46 @@ struct tm { extern "C" { #endif +#ifdef __i386__ #define _daylight (*__p__daylight()) #define _dstbias (*__p__dstbias()) #define _timezone (*__p__timezone()) #define _tzname (__p__tzname()) -int *__p__daylight(void); -long *__p__dstbias(void); -long *__p__timezone(void); -char **__p__tzname(void); +int * __cdecl __p__daylight(void); +long * __cdecl __p__dstbias(void); +long * __cdecl __p__timezone(void); +char ** __cdecl __p__tzname(void); +#else +extern int _daylight; +extern long _dstbias; +extern long _timezone; +extern char *_tzname; +#endif -unsigned _getsystime(struct tm*); -unsigned _setsystime(struct tm*,unsigned); -char* _strdate(char*); -char* _strtime(char*); -void _tzset(void); +unsigned __cdecl _getsystime(struct tm*); +unsigned __cdecl _setsystime(struct tm*,unsigned); +char* __cdecl _strdate(char*); +char* __cdecl _strtime(char*); +void __cdecl _tzset(void); -char* asctime(const struct tm*); -clock_t clock(void); -char* ctime(const time_t*); -double difftime(time_t,time_t); -struct tm* gmtime(const time_t*); -struct tm* localtime(const time_t*); -time_t mktime(struct tm*); -size_t strftime(char*,size_t,const char*,const struct tm*); -time_t time(time_t*); +char* __cdecl asctime(const struct tm*); +clock_t __cdecl clock(void); +char* __cdecl ctime(const time_t*); +double __cdecl difftime(time_t,time_t); +struct tm* __cdecl gmtime(const time_t*); +struct tm* __cdecl localtime(const time_t*); +time_t __cdecl mktime(struct tm*); +size_t __cdecl strftime(char*,size_t,const char*,const struct tm*); +time_t __cdecl time(time_t*); #ifndef _WTIME_DEFINED #define _WTIME_DEFINED -wchar_t* _wasctime(const struct tm*); -size_t wcsftime(wchar_t*,size_t,const wchar_t*,const struct tm*); -wchar_t*_wctime(const time_t*); -wchar_t*_wstrdate(wchar_t*); -wchar_t*_wstrtime(wchar_t*); +wchar_t* __cdecl _wasctime(const struct tm*); +size_t __cdecl wcsftime(wchar_t*,size_t,const wchar_t*,const struct tm*); +wchar_t* __cdecl _wctime(const time_t*); +wchar_t* __cdecl _wstrdate(wchar_t*); +wchar_t* __cdecl _wstrtime(wchar_t*); #endif /* _WTIME_DEFINED */ #ifdef __cplusplus diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h index dcefc0f2db4..d966caa1095 100644 --- a/include/msvcrt/wchar.h +++ b/include/msvcrt/wchar.h @@ -191,198 +191,198 @@ struct _stat64 { #ifndef _WCTYPE_DEFINED #define _WCTYPE_DEFINED -int is_wctype(wint_t,wctype_t); -int isleadbyte(int); -int iswalnum(wint_t); -int iswalpha(wint_t); -int iswascii(wint_t); -int iswcntrl(wint_t); -int iswctype(wint_t,wctype_t); -int iswdigit(wint_t); -int iswgraph(wint_t); -int iswlower(wint_t); -int iswprint(wint_t); -int iswpunct(wint_t); -int iswspace(wint_t); -int iswupper(wint_t); -int iswxdigit(wint_t); -wchar_t towlower(wchar_t); -wchar_t towupper(wchar_t); +int __cdecl is_wctype(wint_t,wctype_t); +int __cdecl isleadbyte(int); +int __cdecl iswalnum(wint_t); +int __cdecl iswalpha(wint_t); +int __cdecl iswascii(wint_t); +int __cdecl iswcntrl(wint_t); +int __cdecl iswctype(wint_t,wctype_t); +int __cdecl iswdigit(wint_t); +int __cdecl iswgraph(wint_t); +int __cdecl iswlower(wint_t); +int __cdecl iswprint(wint_t); +int __cdecl iswpunct(wint_t); +int __cdecl iswspace(wint_t); +int __cdecl iswupper(wint_t); +int __cdecl iswxdigit(wint_t); +wchar_t __cdecl towlower(wchar_t); +wchar_t __cdecl towupper(wchar_t); #endif /* _WCTYPE_DEFINED */ #ifndef _WDIRECT_DEFINED #define _WDIRECT_DEFINED -int _wchdir(const wchar_t*); -wchar_t* _wgetcwd(wchar_t*,int); -wchar_t* _wgetdcwd(int,wchar_t*,int); -int _wmkdir(const wchar_t*); -int _wrmdir(const wchar_t*); +int __cdecl _wchdir(const wchar_t*); +wchar_t* __cdecl _wgetcwd(wchar_t*,int); +wchar_t* __cdecl _wgetdcwd(int,wchar_t*,int); +int __cdecl _wmkdir(const wchar_t*); +int __cdecl _wrmdir(const wchar_t*); #endif /* _WDIRECT_DEFINED */ #ifndef _WIO_DEFINED #define _WIO_DEFINED -int _waccess(const wchar_t*,int); -int _wchmod(const wchar_t*,int); -int _wcreat(const wchar_t*,int); -long _wfindfirst(const wchar_t*,struct _wfinddata_t*); -long _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); -int _wfindnext(long,struct _wfinddata_t*); -int _wfindnexti64(long, struct _wfinddatai64_t*); -wchar_t*_wmktemp(wchar_t*); -int _wopen(const wchar_t*,int,...); -int _wrename(const wchar_t*,const wchar_t*); -int _wsopen(const wchar_t*,int,int,...); -int _wunlink(const wchar_t*); +int __cdecl _waccess(const wchar_t*,int); +int __cdecl _wchmod(const wchar_t*,int); +int __cdecl _wcreat(const wchar_t*,int); +long __cdecl _wfindfirst(const wchar_t*,struct _wfinddata_t*); +long __cdecl _wfindfirsti64(const wchar_t*, struct _wfinddatai64_t*); +int __cdecl _wfindnext(long,struct _wfinddata_t*); +int __cdecl _wfindnexti64(long, struct _wfinddatai64_t*); +wchar_t* __cdecl _wmktemp(wchar_t*); +int __cdecl _wopen(const wchar_t*,int,...); +int __cdecl _wrename(const wchar_t*,const wchar_t*); +int __cdecl _wsopen(const wchar_t*,int,int,...); +int __cdecl _wunlink(const wchar_t*); #endif /* _WIO_DEFINED */ #ifndef _WLOCALE_DEFINED #define _WLOCALE_DEFINED -wchar_t* _wsetlocale(int,const wchar_t*); +wchar_t* __cdecl _wsetlocale(int,const wchar_t*); #endif /* _WLOCALE_DEFINED */ #ifndef _WPROCESS_DEFINED #define _WPROCESS_DEFINED -int _wexecl(const wchar_t*,const wchar_t*,...); -int _wexecle(const wchar_t*,const wchar_t*,...); -int _wexeclp(const wchar_t*,const wchar_t*,...); -int _wexeclpe(const wchar_t*,const wchar_t*,...); -int _wexecv(const wchar_t*,const wchar_t* const *); -int _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *); -int _wexecvp(const wchar_t*,const wchar_t* const *); -int _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *); -int _wspawnl(int,const wchar_t*,const wchar_t*,...); -int _wspawnle(int,const wchar_t*,const wchar_t*,...); -int _wspawnlp(int,const wchar_t*,const wchar_t*,...); -int _wspawnlpe(int,const wchar_t*,const wchar_t*,...); -int _wspawnv(int,const wchar_t*,const wchar_t* const *); -int _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *); -int _wspawnvp(int,const wchar_t*,const wchar_t* const *); -int _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *); -int _wsystem(const wchar_t*); +int __cdecl _wexecl(const wchar_t*,const wchar_t*,...); +int __cdecl _wexecle(const wchar_t*,const wchar_t*,...); +int __cdecl _wexeclp(const wchar_t*,const wchar_t*,...); +int __cdecl _wexeclpe(const wchar_t*,const wchar_t*,...); +int __cdecl _wexecv(const wchar_t*,const wchar_t* const *); +int __cdecl _wexecve(const wchar_t*,const wchar_t* const *,const wchar_t* const *); +int __cdecl _wexecvp(const wchar_t*,const wchar_t* const *); +int __cdecl _wexecvpe(const wchar_t*,const wchar_t* const *,const wchar_t* const *); +int __cdecl _wspawnl(int,const wchar_t*,const wchar_t*,...); +int __cdecl _wspawnle(int,const wchar_t*,const wchar_t*,...); +int __cdecl _wspawnlp(int,const wchar_t*,const wchar_t*,...); +int __cdecl _wspawnlpe(int,const wchar_t*,const wchar_t*,...); +int __cdecl _wspawnv(int,const wchar_t*,const wchar_t* const *); +int __cdecl _wspawnve(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *); +int __cdecl _wspawnvp(int,const wchar_t*,const wchar_t* const *); +int __cdecl _wspawnvpe(int,const wchar_t*,const wchar_t* const *,const wchar_t* const *); +int __cdecl _wsystem(const wchar_t*); #endif /* _WPROCESS_DEFINED */ #ifndef _WSTAT_DEFINED #define _WSTAT_DEFINED -int _wstat(const wchar_t*,struct _stat*); -int _wstati64(const wchar_t*,struct _stati64*); -int _wstat64(const wchar_t*,struct _stat64*); +int __cdecl _wstat(const wchar_t*,struct _stat*); +int __cdecl _wstati64(const wchar_t*,struct _stati64*); +int __cdecl _wstat64(const wchar_t*,struct _stat64*); #endif /* _WSTAT_DEFINED */ #ifndef _WSTDIO_DEFINED #define _WSTDIO_DEFINED -wint_t _fgetwchar(void); -wint_t _fputwchar(wint_t); -wchar_t*_getws(wchar_t*); -int _putws(const wchar_t*); -int _snwprintf(wchar_t*,size_t,const wchar_t*,...); -int _vsnwprintf(wchar_t*,size_t,const wchar_t*,va_list); -FILE* _wfdopen(int,const wchar_t*); -FILE* _wfopen(const wchar_t*,const wchar_t*); -FILE* _wfreopen(const wchar_t*,const wchar_t*,FILE*); -FILE* _wfsopen(const wchar_t*,const wchar_t*,int); -void _wperror(const wchar_t*); -FILE* _wpopen(const wchar_t*,const wchar_t*); -int _wremove(const wchar_t*); -wchar_t*_wtempnam(const wchar_t*,const wchar_t*); -wchar_t*_wtmpnam(wchar_t*); - -wint_t fgetwc(FILE*); -wchar_t*fgetws(wchar_t*,int,FILE*); -wint_t fputwc(wint_t,FILE*); -int fputws(const wchar_t*,FILE*); -int fwprintf(FILE*,const wchar_t*,...); -int fputws(const wchar_t*,FILE*); -int fwscanf(FILE*,const wchar_t*,...); -wint_t getwc(FILE*); -wint_t getwchar(void); -wchar_t*getws(wchar_t*); -wint_t putwc(wint_t,FILE*); -wint_t putwchar(wint_t); -int putws(const wchar_t*); -int swprintf(wchar_t*,const wchar_t*,...); -int swscanf(const wchar_t*,const wchar_t*,...); -wint_t ungetwc(wint_t,FILE*); -int vfwprintf(FILE*,const wchar_t*,va_list); -int vswprintf(wchar_t*,const wchar_t*,va_list); -int vwprintf(const wchar_t*,va_list); -int wprintf(const wchar_t*,...); -int wscanf(const wchar_t*,...); +wint_t __cdecl _fgetwchar(void); +wint_t __cdecl _fputwchar(wint_t); +wchar_t* __cdecl _getws(wchar_t*); +int __cdecl _putws(const wchar_t*); +int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...); +int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,va_list); +FILE* __cdecl _wfdopen(int,const wchar_t*); +FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*); +FILE* __cdecl _wfreopen(const wchar_t*,const wchar_t*,FILE*); +FILE* __cdecl _wfsopen(const wchar_t*,const wchar_t*,int); +void __cdecl _wperror(const wchar_t*); +FILE* __cdecl _wpopen(const wchar_t*,const wchar_t*); +int __cdecl _wremove(const wchar_t*); +wchar_t* __cdecl _wtempnam(const wchar_t*,const wchar_t*); +wchar_t* __cdecl _wtmpnam(wchar_t*); + +wint_t __cdecl fgetwc(FILE*); +wchar_t* __cdecl fgetws(wchar_t*,int,FILE*); +wint_t __cdecl fputwc(wint_t,FILE*); +int __cdecl fputws(const wchar_t*,FILE*); +int __cdecl fwprintf(FILE*,const wchar_t*,...); +int __cdecl fputws(const wchar_t*,FILE*); +int __cdecl fwscanf(FILE*,const wchar_t*,...); +wint_t __cdecl getwc(FILE*); +wint_t __cdecl getwchar(void); +wchar_t* __cdecl getws(wchar_t*); +wint_t __cdecl putwc(wint_t,FILE*); +wint_t __cdecl putwchar(wint_t); +int __cdecl putws(const wchar_t*); +int __cdecl swprintf(wchar_t*,const wchar_t*,...); +int __cdecl swscanf(const wchar_t*,const wchar_t*,...); +wint_t __cdecl ungetwc(wint_t,FILE*); +int __cdecl vfwprintf(FILE*,const wchar_t*,va_list); +int __cdecl vswprintf(wchar_t*,const wchar_t*,va_list); +int __cdecl vwprintf(const wchar_t*,va_list); +int __cdecl wprintf(const wchar_t*,...); +int __cdecl wscanf(const wchar_t*,...); #endif /* _WSTDIO_DEFINED */ #ifndef _WSTDLIB_DEFINED #define _WSTDLIB_DEFINED -wchar_t*_itow(int,wchar_t*,int); -wchar_t*_i64tow(__int64,wchar_t*,int); -wchar_t*_ltow(long,wchar_t*,int); -wchar_t*_ui64tow(unsigned __int64,wchar_t*,int); -wchar_t*_ultow(unsigned long,wchar_t*,int); -wchar_t*_wfullpath(wchar_t*,const wchar_t*,size_t); -wchar_t*_wgetenv(const wchar_t*); -void _wmakepath(wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*); -void _wperror(const wchar_t*); -int _wputenv(const wchar_t*); -void _wsearchenv(const wchar_t*,const wchar_t*,wchar_t*); -void _wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*); -int _wsystem(const wchar_t*); -int _wtoi(const wchar_t*); -__int64 _wtoi64(const wchar_t*); -long _wtol(const wchar_t*); - -size_t mbstowcs(wchar_t*,const char*,size_t); -int mbtowc(wchar_t*,const char*,size_t); -double wcstod(const wchar_t*,wchar_t**); -long wcstol(const wchar_t*,wchar_t**,int); -size_t wcstombs(char*,const wchar_t*,size_t); -unsigned long wcstoul(const wchar_t*,wchar_t**,int); -int wctomb(char*,wchar_t); +wchar_t* __cdecl _itow(int,wchar_t*,int); +wchar_t* __cdecl _i64tow(__int64,wchar_t*,int); +wchar_t* __cdecl _ltow(long,wchar_t*,int); +wchar_t* __cdecl _ui64tow(unsigned __int64,wchar_t*,int); +wchar_t* __cdecl _ultow(unsigned long,wchar_t*,int); +wchar_t* __cdecl _wfullpath(wchar_t*,const wchar_t*,size_t); +wchar_t* __cdecl _wgetenv(const wchar_t*); +void __cdecl _wmakepath(wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*,const wchar_t*); +void __cdecl _wperror(const wchar_t*); +int __cdecl _wputenv(const wchar_t*); +void __cdecl _wsearchenv(const wchar_t*,const wchar_t*,wchar_t*); +void __cdecl _wsplitpath(const wchar_t*,wchar_t*,wchar_t*,wchar_t*,wchar_t*); +int __cdecl _wsystem(const wchar_t*); +int __cdecl _wtoi(const wchar_t*); +__int64 __cdecl _wtoi64(const wchar_t*); +long __cdecl _wtol(const wchar_t*); + +size_t __cdecl mbstowcs(wchar_t*,const char*,size_t); +int __cdecl mbtowc(wchar_t*,const char*,size_t); +double __cdecl wcstod(const wchar_t*,wchar_t**); +long __cdecl wcstol(const wchar_t*,wchar_t**,int); +size_t __cdecl wcstombs(char*,const wchar_t*,size_t); +unsigned long __cdecl wcstoul(const wchar_t*,wchar_t**,int); +int __cdecl wctomb(char*,wchar_t); #endif /* _WSTDLIB_DEFINED */ #ifndef _WSTRING_DEFINED #define _WSTRING_DEFINED -wchar_t*_wcsdup(const wchar_t*); -int _wcsicmp(const wchar_t*,const wchar_t*); -int _wcsicoll(const wchar_t*,const wchar_t*); -wchar_t*_wcslwr(wchar_t*); -int _wcsnicmp(const wchar_t*,const wchar_t*,size_t); -wchar_t*_wcsnset(wchar_t*,wchar_t,size_t); -wchar_t*_wcsrev(wchar_t*); -wchar_t*_wcsset(wchar_t*,wchar_t); -wchar_t*_wcsupr(wchar_t*); - -wchar_t*wcscat(wchar_t*,const wchar_t*); -wchar_t*wcschr(const wchar_t*,wchar_t); -int wcscmp(const wchar_t*,const wchar_t*); -int wcscoll(const wchar_t*,const wchar_t*); -wchar_t*wcscpy(wchar_t*,const wchar_t*); -size_t wcscspn(const wchar_t*,const wchar_t*); -size_t wcslen(const wchar_t*); -wchar_t*wcsncat(wchar_t*,const wchar_t*,size_t); -int wcsncmp(const wchar_t*,const wchar_t*,size_t); -wchar_t*wcsncpy(wchar_t*,const wchar_t*,size_t); -wchar_t*wcspbrk(const wchar_t*,const wchar_t*); -wchar_t*wcsrchr(const wchar_t*,wchar_t wcFor); -size_t wcsspn(const wchar_t*,const wchar_t*); -wchar_t*wcsstr(const wchar_t*,const wchar_t*); -wchar_t*wcstok(wchar_t*,const wchar_t*); -size_t wcsxfrm(wchar_t*,const wchar_t*,size_t); +wchar_t* __cdecl _wcsdup(const wchar_t*); +int __cdecl _wcsicmp(const wchar_t*,const wchar_t*); +int __cdecl _wcsicoll(const wchar_t*,const wchar_t*); +wchar_t* __cdecl _wcslwr(wchar_t*); +int __cdecl _wcsnicmp(const wchar_t*,const wchar_t*,size_t); +wchar_t* __cdecl _wcsnset(wchar_t*,wchar_t,size_t); +wchar_t* __cdecl _wcsrev(wchar_t*); +wchar_t* __cdecl _wcsset(wchar_t*,wchar_t); +wchar_t* __cdecl _wcsupr(wchar_t*); + +wchar_t* __cdecl wcscat(wchar_t*,const wchar_t*); +wchar_t* __cdecl wcschr(const wchar_t*,wchar_t); +int __cdecl wcscmp(const wchar_t*,const wchar_t*); +int __cdecl wcscoll(const wchar_t*,const wchar_t*); +wchar_t* __cdecl wcscpy(wchar_t*,const wchar_t*); +size_t __cdecl wcscspn(const wchar_t*,const wchar_t*); +size_t __cdecl wcslen(const wchar_t*); +wchar_t* __cdecl wcsncat(wchar_t*,const wchar_t*,size_t); +int __cdecl wcsncmp(const wchar_t*,const wchar_t*,size_t); +wchar_t* __cdecl wcsncpy(wchar_t*,const wchar_t*,size_t); +wchar_t* __cdecl wcspbrk(const wchar_t*,const wchar_t*); +wchar_t* __cdecl wcsrchr(const wchar_t*,wchar_t wcFor); +size_t __cdecl wcsspn(const wchar_t*,const wchar_t*); +wchar_t* __cdecl wcsstr(const wchar_t*,const wchar_t*); +wchar_t* __cdecl wcstok(wchar_t*,const wchar_t*); +size_t __cdecl wcsxfrm(wchar_t*,const wchar_t*,size_t); #endif /* _WSTRING_DEFINED */ #ifndef _WTIME_DEFINED #define _WTIME_DEFINED -wchar_t*_wasctime(const struct tm*); -size_t wcsftime(wchar_t*,size_t,const wchar_t*,const struct tm*); -wchar_t*_wctime(const time_t*); -wchar_t*_wstrdate(wchar_t*); -wchar_t*_wstrtime(wchar_t*); +wchar_t* __cdecl _wasctime(const struct tm*); +size_t __cdecl wcsftime(wchar_t*,size_t,const wchar_t*,const struct tm*); +wchar_t* __cdecl _wctime(const time_t*); +wchar_t* __cdecl _wstrdate(wchar_t*); +wchar_t* __cdecl _wstrtime(wchar_t*); #endif /* _WTIME_DEFINED */ -wchar_t btowc(int); -size_t mbrlen(const char *,size_t,mbstate_t*); -size_t mbrtowc(wchar_t*,const char*,size_t,mbstate_t*); -size_t mbsrtowcs(wchar_t*,const char**,size_t,mbstate_t*); -size_t wcrtomb(char*,wchar_t,mbstate_t*); -size_t wcsrtombs(char*,const wchar_t**,size_t,mbstate_t*); -int wctob(wint_t); +wchar_t __cdecl btowc(int); +size_t __cdecl mbrlen(const char *,size_t,mbstate_t*); +size_t __cdecl mbrtowc(wchar_t*,const char*,size_t,mbstate_t*); +size_t __cdecl mbsrtowcs(wchar_t*,const char**,size_t,mbstate_t*); +size_t __cdecl wcrtomb(char*,wchar_t,mbstate_t*); +size_t __cdecl wcsrtombs(char*,const wchar_t**,size_t,mbstate_t*); +int __cdecl wctob(wint_t); #ifdef __cplusplus } diff --git a/include/msvcrt/wctype.h b/include/msvcrt/wctype.h index feebb778f57..d6bed604fe0 100644 --- a/include/msvcrt/wctype.h +++ b/include/msvcrt/wctype.h @@ -49,23 +49,23 @@ extern "C" { #ifndef _WCTYPE_DEFINED #define _WCTYPE_DEFINED -int is_wctype(wint_t,wctype_t); -int isleadbyte(int); -int iswalnum(wint_t); -int iswalpha(wint_t); -int iswascii(wint_t); -int iswcntrl(wint_t); -int iswctype(wint_t,wctype_t); -int iswdigit(wint_t); -int iswgraph(wint_t); -int iswlower(wint_t); -int iswprint(wint_t); -int iswpunct(wint_t); -int iswspace(wint_t); -int iswupper(wint_t); -int iswxdigit(wint_t); -wchar_t towlower(wchar_t); -wchar_t towupper(wchar_t); +int __cdecl is_wctype(wint_t,wctype_t); +int __cdecl isleadbyte(int); +int __cdecl iswalnum(wint_t); +int __cdecl iswalpha(wint_t); +int __cdecl iswascii(wint_t); +int __cdecl iswcntrl(wint_t); +int __cdecl iswctype(wint_t,wctype_t); +int __cdecl iswdigit(wint_t); +int __cdecl iswgraph(wint_t); +int __cdecl iswlower(wint_t); +int __cdecl iswprint(wint_t); +int __cdecl iswpunct(wint_t); +int __cdecl iswspace(wint_t); +int __cdecl iswupper(wint_t); +int __cdecl iswxdigit(wint_t); +wchar_t __cdecl towlower(wchar_t); +wchar_t __cdecl towupper(wchar_t); #endif /* _WCTYPE_DEFINED */ #ifdef __cplusplus diff --git a/include/setupapi.h b/include/setupapi.h index 88c35ebe2ab..0e9cbbbecb5 100644 --- a/include/setupapi.h +++ b/include/setupapi.h @@ -1214,6 +1214,7 @@ DECL_WINELIB_SETUPAPI_TYPE_AW(PSP_INF_SIGNER_INFO) #define ERROR_SET_SYSTEM_RESTORE_POINT (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x236) #define ERROR_INCORRECTLY_COPIED_INF (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x237) #define ERROR_SCE_DISABLED (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x238) +#define ERROR_WRONG_INF_TYPE (APPLICATION_ERROR_MASK|ERROR_SEVERITY_ERROR|0x24A) #define ERROR_NO_DEFAULT_INTERFACE_DEVICE ERROR_NO_DEFAULT_DEVICE_INTERFACE #define ERROR_INTERFACE_DEVICE_ACTIVE ERROR_DEVICE_INTERFACE_ACTIVE #define ERROR_INTERFACE_DEVICE_REMOVED ERROR_DEVICE_INTERFACE_REMOVED diff --git a/include/textserv.h b/include/textserv.h index 977b7428165..e9ff4da627e 100644 --- a/include/textserv.h +++ b/include/textserv.h @@ -315,7 +315,7 @@ DECLARE_INTERFACE_(ITextHost,IUnknown) STDMETHOD(TxGetMaxLength)( THIS_ DWORD* plength) PURE; - STDMETHOD(TxGetScrollbars)( THIS_ + STDMETHOD(TxGetScrollBars)( THIS_ DWORD* pdwScrollBar) PURE; STDMETHOD(TxGetPasswordChar)( THIS_ @@ -386,7 +386,7 @@ DECLARE_INTERFACE_(ITextHost,IUnknown) #define ITextHost_TxGetSysColor(p,a) (p)->lpVtbl->TxGetSysColor(p,a) #define ITextHost_TxGetBackStyle(p,a) (p)->lpVtbl->TxGetBackStyle(p,a) #define ITextHost_TxGetMaxLength(p,a) (p)->lpVtbl->TxGetMaxLength(p,a) -#define ITextHost_TxGetScrollbars(p,a) (p)->lpVtbl->TxGetScrollbars(p,a) +#define ITextHost_TxGetScrollBars(p,a) (p)->lpVtbl->TxGetScrollBars(p,a) #define ITextHost_TxGetPasswordChar(p,a) (p)->lpVtbl->TxGetPasswordChar(p,a) #define ITextHost_TxGetAcceleratorPos(p,a) (p)->lpVtbl->TxGetAcceleratorPos(p,a) #define ITextHost_TxGetExtent(p,a) (p)->lpVtbl->TxGetExtent(p,a) diff --git a/include/wincon.h b/include/wincon.h index 3257c21b381..5d1e8e7e58c 100644 --- a/include/wincon.h +++ b/include/wincon.h @@ -205,6 +205,9 @@ WINBASEAPI BOOL WINAPI FreeConsole(VOID); WINBASEAPI BOOL WINAPI GenerateConsoleCtrlEvent( DWORD,DWORD); WINBASEAPI UINT WINAPI GetConsoleCP(VOID); WINBASEAPI BOOL WINAPI GetConsoleCursorInfo( HANDLE,LPCONSOLE_CURSOR_INFO); +WINBASEAPI BOOL WINAPI GetConsoleInputExeNameA(DWORD,LPSTR); +WINBASEAPI BOOL WINAPI GetConsoleInputExeNameW(DWORD,LPWSTR); +#define GetConsoleInputExeName WINELIB_NAME_AW(GetConsoleInputExeName) WINBASEAPI BOOL WINAPI GetConsoleMode( HANDLE,LPDWORD); WINBASEAPI UINT WINAPI GetConsoleOutputCP(VOID); WINBASEAPI BOOL WINAPI GetConsoleScreenBufferInfo(HANDLE,LPCONSOLE_SCREEN_BUFFER_INFO); diff --git a/include/wine/library.h b/include/wine/library.h index 52186c612f2..110239029b6 100644 --- a/include/wine/library.h +++ b/include/wine/library.h @@ -135,6 +135,9 @@ static inline void wine_ldt_set_base( LDT_ENTRY *ent, const void *base ) ent->BaseLow = (WORD)(ULONG_PTR)base; ent->HighWord.Bits.BaseMid = (BYTE)((ULONG_PTR)base >> 16); ent->HighWord.Bits.BaseHi = (BYTE)((ULONG_PTR)base >> 24); +#ifdef _WIN64 + ent->BaseHigh = (ULONG_PTR)base >> 32; +#endif } static inline void wine_ldt_set_limit( LDT_ENTRY *ent, unsigned int limit ) { @@ -145,6 +148,9 @@ static inline void wine_ldt_set_limit( LDT_ENTRY *ent, unsigned int limit ) static inline void *wine_ldt_get_base( const LDT_ENTRY *ent ) { return (void *)(ent->BaseLow | +#ifdef _WIN64 + (ULONG_PTR)ent->BaseHigh << 32 | +#endif (ULONG_PTR)ent->HighWord.Bits.BaseMid << 16 | (ULONG_PTR)ent->HighWord.Bits.BaseHi << 24); } diff --git a/include/wine/port.h b/include/wine/port.h index df341743fe1..fd3769868ed 100644 --- a/include/wine/port.h +++ b/include/wine/port.h @@ -174,10 +174,6 @@ struct statvfs # define S_ISREG(mod) (((mod) & _S_IFMT) == _S_IFREG) #endif -#ifndef S_IWUSR -# define S_IWUSR 0 -#endif - /* So we open files in 64 bit access mode on Linux */ #ifndef O_LARGEFILE # define O_LARGEFILE 0 @@ -191,16 +187,6 @@ struct statvfs # define O_BINARY 0 #endif -#if !defined(S_IXUSR) && defined(S_IEXEC) -# define S_IXUSR S_IEXEC -#endif -#if !defined(S_IXGRP) && defined(S_IEXEC) -# define S_IXGRP S_IEXEC -#endif -#if !defined(S_IXOTH) && defined(S_IEXEC) -# define S_IXOTH S_IEXEC -#endif - /**************************************************************** * Constants diff --git a/include/wine/server.h b/include/wine/server.h index 014885d2f1b..3dab6001ece 100644 --- a/include/wine/server.h +++ b/include/wine/server.h @@ -50,10 +50,10 @@ struct __server_request_info }; extern unsigned int wine_server_call( void *req_ptr ); -extern void wine_server_send_fd( int fd ); -extern int wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle ); -extern int wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd, unsigned int *options ); -extern void wine_server_release_fd( HANDLE handle, int unix_fd ); +extern void CDECL wine_server_send_fd( int fd ); +extern int CDECL wine_server_fd_to_handle( int fd, unsigned int access, unsigned int attributes, HANDLE *handle ); +extern int CDECL wine_server_handle_to_fd( HANDLE handle, unsigned int access, int *unix_fd, unsigned int *options ); +extern void CDECL wine_server_release_fd( HANDLE handle, int unix_fd ); /* do a server call and set the last error code */ static inline unsigned int wine_server_call_err( void *req_ptr ) diff --git a/include/wine/server_protocol.h b/include/wine/server_protocol.h index 963eaa3ead1..e2166aebd8b 100644 --- a/include/wine/server_protocol.h +++ b/include/wine/server_protocol.h @@ -23,6 +23,8 @@ typedef unsigned int thread_id_t; typedef unsigned int data_size_t; typedef unsigned int ioctl_code_t; typedef unsigned long lparam_t; +typedef unsigned __int64 apc_param_t; +typedef unsigned __int64 mem_size_t; typedef unsigned __int64 file_pos_t; struct request_header @@ -164,7 +166,7 @@ typedef struct void *arg; void *apc; obj_handle_t event; - unsigned long cvalue; + apc_param_t cvalue; } async_data_t; @@ -260,7 +262,7 @@ typedef union { enum apc_type type; void (__stdcall *func)(unsigned long,unsigned long,unsigned long); - unsigned long args[3]; + apc_param_t args[3]; } user; struct { @@ -272,7 +274,7 @@ typedef union struct { enum apc_type type; - unsigned int (*func)(void*, void*, unsigned int, unsigned long *); + unsigned int (*func)(void*, void*, unsigned int, unsigned int *); void *user; void *sb; unsigned int status; @@ -281,7 +283,7 @@ typedef union { enum apc_type type; void *addr; - unsigned long size; + mem_size_t size; unsigned int zero_bits; unsigned int op_type; unsigned int prot; @@ -290,7 +292,7 @@ typedef union { enum apc_type type; void *addr; - unsigned long size; + mem_size_t size; unsigned int op_type; } virtual_free; struct @@ -302,33 +304,33 @@ typedef union { enum apc_type type; void *addr; - unsigned long size; + mem_size_t size; unsigned int prot; } virtual_protect; struct { enum apc_type type; const void *addr; - unsigned long size; + mem_size_t size; } virtual_flush; struct { enum apc_type type; void *addr; - unsigned long size; + mem_size_t size; } virtual_lock; struct { enum apc_type type; void *addr; - unsigned long size; + mem_size_t size; } virtual_unlock; struct { enum apc_type type; obj_handle_t handle; void *addr; - unsigned long size; + mem_size_t size; file_pos_t offset; unsigned int zero_bits; unsigned int alloc_type; @@ -344,8 +346,8 @@ typedef union enum apc_type type; void (__stdcall *func)(void*); void *arg; - unsigned long reserve; - unsigned long commit; + mem_size_t reserve; + mem_size_t commit; int suspend; } create_thread; } apc_call_t; @@ -357,21 +359,21 @@ typedef union { enum apc_type type; unsigned int status; - unsigned long total; + unsigned int total; } async_io; struct { enum apc_type type; unsigned int status; void *addr; - unsigned long size; + mem_size_t size; } virtual_alloc; struct { enum apc_type type; unsigned int status; void *addr; - unsigned long size; + mem_size_t size; } virtual_free; struct { @@ -379,7 +381,7 @@ typedef union unsigned int status; void *base; void *alloc_base; - unsigned long size; + mem_size_t size; unsigned int state; unsigned int prot; unsigned int alloc_prot; @@ -390,7 +392,7 @@ typedef union enum apc_type type; unsigned int status; void *addr; - unsigned long size; + mem_size_t size; unsigned int prot; } virtual_protect; struct @@ -398,28 +400,28 @@ typedef union enum apc_type type; unsigned int status; const void *addr; - unsigned long size; + mem_size_t size; } virtual_flush; struct { enum apc_type type; unsigned int status; void *addr; - unsigned long size; + mem_size_t size; } virtual_lock; struct { enum apc_type type; unsigned int status; void *addr; - unsigned long size; + mem_size_t size; } virtual_unlock; struct { enum apc_type type; unsigned int status; void *addr; - unsigned long size; + mem_size_t size; } map_view; struct { @@ -1671,7 +1673,7 @@ struct create_mapping_request struct request_header __header; unsigned int access; unsigned int attributes; - file_pos_t size; + mem_size_t size; unsigned int protect; obj_handle_t file_handle; /* VARARG(objattr,object_attributes); */ @@ -1723,7 +1725,7 @@ struct get_mapping_info_request struct get_mapping_info_reply { struct reply_header __header; - file_pos_t size; + mem_size_t size; int protect; int header_size; void* base; @@ -1742,7 +1744,7 @@ struct get_mapping_committed_range_request struct get_mapping_committed_range_reply { struct reply_header __header; - file_pos_t size; + mem_size_t size; int committed; }; @@ -1753,7 +1755,7 @@ struct add_mapping_committed_range_request struct request_header __header; obj_handle_t handle; file_pos_t offset; - file_pos_t size; + mem_size_t size; }; struct add_mapping_committed_range_reply { @@ -4224,9 +4226,9 @@ struct add_completion_request { struct request_header __header; obj_handle_t handle; - unsigned long ckey; - unsigned long cvalue; - unsigned long information; + apc_param_t ckey; + apc_param_t cvalue; + unsigned int information; unsigned int status; }; struct add_completion_reply @@ -4244,9 +4246,9 @@ struct remove_completion_request struct remove_completion_reply { struct reply_header __header; - unsigned long ckey; - unsigned long cvalue; - unsigned long information; + apc_param_t ckey; + apc_param_t cvalue; + unsigned int information; unsigned int status; }; @@ -4270,7 +4272,7 @@ struct set_completion_info_request struct request_header __header; obj_handle_t handle; obj_handle_t chandle; - unsigned long ckey; + apc_param_t ckey; }; struct set_completion_info_reply { @@ -4283,9 +4285,9 @@ struct add_fd_completion_request { struct request_header __header; obj_handle_t handle; - unsigned long cvalue; + apc_param_t cvalue; unsigned int status; - unsigned long information; + unsigned int information; }; struct add_fd_completion_reply { @@ -5047,6 +5049,6 @@ union generic_reply struct set_window_layered_info_reply set_window_layered_info_reply; }; -#define SERVER_PROTOCOL_VERSION 349 +#define SERVER_PROTOCOL_VERSION 351 #endif /* __WINE_WINE_SERVER_PROTOCOL_H */ diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl index 39ba5981f3a..ae648885da4 100644 --- a/include/wine/wined3d.idl +++ b/include/wine/wined3d.idl @@ -3070,12 +3070,6 @@ interface IWineD3DDevice : IWineD3DBase HRESULT GetDepthStencilSurface( [out] IWineD3DSurface **depth_stencil ); - HRESULT SetFVF( - [in] DWORD fvf - ); - HRESULT GetFVF( - [out] DWORD *fvf - ); void SetGammaRamp( [in] UINT swapchain_idx, [in] DWORD flags, diff --git a/include/winnt.h b/include/winnt.h index 083bd961701..0c8e0a96f9f 100644 --- a/include/winnt.h +++ b/include/winnt.h @@ -846,6 +846,9 @@ typedef struct _LDT_ENTRY { unsigned BaseHi : 8; } Bits; } HighWord; +#ifdef _WIN64 /* FIXME: 64-bit code should not be using the LDT */ + DWORD BaseHigh; +#endif } LDT_ENTRY, *PLDT_ENTRY; /* x86-64 context definitions */ @@ -2258,7 +2261,7 @@ extern inline struct _TEB * WINAPI NtCurrentTeb(void) return teb; } #elif defined(__x86_64__) && defined(__GNUC__) -extern inline struct _TEB * WINAPI NtCurrentTeb(void) +static inline struct _TEB * WINAPI NtCurrentTeb(void) { struct _TEB *teb; __asm__(".byte 0x65\n\tmovq (0x30),%0" : "=r" (teb)); diff --git a/include/winternl.h b/include/winternl.h index 9ee14b9f7bc..d0180a545e7 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -2505,9 +2505,9 @@ NTSYSAPI NTSTATUS WINAPI vDbgPrintExWithPrefix(LPCSTR,ULONG,ULONG,LPCSTR,va_lis /* Wine internal functions */ -NTSYSAPI NTSTATUS wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, - UINT disposition, BOOLEAN check_case ); -NTSYSAPI NTSTATUS wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt ); +NTSYSAPI NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, + UINT disposition, BOOLEAN check_case ); +NTSYSAPI NTSTATUS CDECL wine_unix_to_nt_file_name( const ANSI_STRING *name, UNICODE_STRING *nt ); /*********************************************************************** diff --git a/include/wuapi.idl b/include/wuapi.idl new file mode 100644 index 00000000000..27a3d5f1c10 --- /dev/null +++ b/include/wuapi.idl @@ -0,0 +1,359 @@ +/* + * Copyright 2008 Hans Leidekker 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 + */ + +cpp_quote("DEFINE_GUID(CLSID_AutomaticUpdates, 0xbfe18e9c,0x6d87,0x4450,0xb3,0x7c,0xe0,0x2f,0x0b,0x37,0x38,0x03);") +cpp_quote("DEFINE_GUID(CLSID_UpdateSession, 0x4cb43d7f,0x7eee,0x4906,0x86,0x98,0x60,0xda,0x1c,0x38,0xf2,0xfe);") + +import "oaidl.idl"; + +interface IAutomaticUpdates; +interface IAutomaticUpdatesSettings; +interface IDownloadJob; +interface IDownloadResult; +interface IInstallationJob; +interface IInstallationResult; +interface ISearchJob; +interface ISearchResult; +interface IUpdateCollection; +interface IUpdateDownloader; +interface IUpdateHistoryEntryCollection; +interface IUpdateInstaller; +interface IUpdateSearcher; +interface IUpdateSession; +interface IWebProxy; + +typedef [public] enum tagDownloadPriority +{ + dpLow = 1, + dpNormal = 2, + dpHigh = 3, +} DownloadPriority; + +typedef [public] enum tagServerSelection +{ + ssDefault = 0, + ssManagedServer = 1, + ssWindowsUpdate = 2, + ssOthers = 3, +} ServerSelection; + +[ + object, + uuid(673425bf-c082-4c7c-bdfd-569464b8e0ce), + oleautomation, + dual, + nonextensible, + pointer_default(unique), + hidden +] +interface IAutomaticUpdates : IDispatch +{ + HRESULT DetectNow(); + HRESULT Pause(); + HRESULT Resume(); + HRESULT ShowSettingsDialog(); + + [propget] + HRESULT Settings( + [out, retval] IAutomaticUpdatesSettings **retval); + + [propget] + HRESULT ServiceEnabled( + [out, retval] VARIANT_BOOL *retval); + + HRESULT EnableService(); +} + +[ + object, + uuid(816858a4-260d-4260-933a-2585f1abc76b), + oleautomation, + dual, + nonextensible, + pointer_default(unique), +] +interface IUpdateSession : IDispatch +{ + [propget] + HRESULT ClientApplicationID( + [out, retval] BSTR *retval); + + [propput] + HRESULT ClientApplicationID( + [in] BSTR value); + + [propget] + HRESULT ReadOnly( + [out, retval] VARIANT_BOOL *retval); + + [propget] + HRESULT WebProxy( + [out, retval] IWebProxy **retval); + + [propput] + HRESULT WebProxy( + [in, unique] IWebProxy *value); + + HRESULT CreateUpdateSearcher( + [out, retval] IUpdateSearcher **retval); + + HRESULT CreateUpdateDownloader( + [out, retval] IUpdateDownloader **retval); + + HRESULT CreateUpdateInstaller( + [out, retval] IUpdateInstaller **retval); +} + +[ + object, + uuid(8f45abf1-f9ae-4b95-a933-f0f66e5056ea), + oleautomation, + dual, + nonextensible, + pointer_default(unique), +] +interface IUpdateSearcher : IDispatch +{ + [propget] + HRESULT CanAutomaticallyUpgradeService( + [out, retval] VARIANT_BOOL *retval); + + [propput] + HRESULT CanAutomaticallyUpgradeService( + [in] VARIANT_BOOL value); + + [propget] + HRESULT ClientApplicationID( + [out, retval] BSTR *retval); + + [propput] + HRESULT ClientApplicationID( + [in] BSTR value); + + [propget] + HRESULT IncludePotentiallySupersededUpdates( + [out, retval] VARIANT_BOOL *retval); + + [propput] + HRESULT IncludePotentiallySupersededUpdates( + [in] VARIANT_BOOL value); + + [propget] + HRESULT ServerSelection( + [out, retval] ServerSelection *retval); + + [propput] + HRESULT ServerSelection( + [in] ServerSelection value); + + HRESULT BeginSearch( + [in] BSTR criteria, + [in] IUnknown *onCompleted, + [in] VARIANT state, + [out, retval] ISearchJob **retval); + + HRESULT EndSearch( + [in] ISearchJob *searchJob, + [out, retval] ISearchResult **retval); + + HRESULT EscapeString( + [in] BSTR unescaped, + [out, retval] BSTR *retval); + + HRESULT QueryHistory( + [in] LONG startIndex, + [in] LONG count, + [out, retval] IUpdateHistoryEntryCollection **retval); + + HRESULT Search( + [in] BSTR criteria, + [out, retval] ISearchResult **retval); + + [propget] + HRESULT Online( + [out, retval] VARIANT_BOOL *retval); + + [propput] + HRESULT Online( + [in] VARIANT_BOOL value); + + HRESULT GetTotalHistoryCount( + [out, retval] LONG *retval); + + [propget] + HRESULT ServiceID( + [out, retval] BSTR *retval); + + [propput] + HRESULT ServiceID( + [in] BSTR value); +} + +[ + object, + uuid(68f1c6f9-7ecc-4666-a464-247fe12496c3), + oleautomation, + dual, + nonextensible, + pointer_default(unique), + hidden +] +interface IUpdateDownloader : IDispatch +{ + [propget] + HRESULT ClientApplicationID( + [out, retval] BSTR *retval); + + [propput] + HRESULT ClientApplicationID( + [in] BSTR value); + + [propget] + HRESULT IsForced( + [out, retval] VARIANT_BOOL *retval); + + [propput] + HRESULT IsForced( + [in] VARIANT_BOOL value); + + [propget] + HRESULT Priority( + [out, retval] DownloadPriority *retval); + + [propput] + HRESULT Priority( + [in] DownloadPriority value); + + [propget] + HRESULT Updates( + [out, retval] IUpdateCollection **retval); + + [propput] + HRESULT Updates( + [in] IUpdateCollection *value); + + HRESULT BeginDownload( + [in] IUnknown *onProgressChanged, + [in] IUnknown *onCompleted, + [in] VARIANT state, + [out, retval] IDownloadJob **retval); + + HRESULT Download( + [out, retval] IDownloadResult **retval); + + HRESULT EndDownload( + [in] IDownloadJob *value, + [out, retval] IDownloadResult **retval); +} + +[ + object, + uuid(7b929c68-ccdc-4226-96b1-8724600b54c2), + oleautomation, + dual, + nonextensible, + pointer_default(unique), +] +interface IUpdateInstaller : IDispatch +{ + [propget] + HRESULT ClientApplicationID( + [out, retval] BSTR *retval); + + [propput] + HRESULT ClientApplicationID( + [in] BSTR value); + + [propget] + HRESULT IsForced( + [out, retval] VARIANT_BOOL *retval); + + [propput] + HRESULT IsForced( + [in] VARIANT_BOOL value); + + [propget, restricted] + HRESULT ParentHwnd( + [out, retval] HWND *retval); + + [propput, restricted] + HRESULT ParentHwnd( + [in, unique] HWND value); + + [propput] + HRESULT ParentWindow( + [in, unique] IUnknown *value); + + [propget] + HRESULT ParentWindow( + [out, retval] IUnknown **retval); + + [propget] + HRESULT Updates( + [out, retval] IUpdateCollection **retval); + + [propput] + HRESULT Updates( + [in] IUpdateCollection *value); + + HRESULT BeginInstall( + [in] IUnknown *onProgressChanged, + [in] IUnknown *onCompleted, + [in] VARIANT state, + [out, retval] IInstallationJob **retval); + + HRESULT BeginUninstall( + [in] IUnknown *onProgressChanged, + [in] IUnknown *onCompleted, + [in] VARIANT state, + [out, retval] IInstallationJob **retval); + + HRESULT EndInstall( + [in] IInstallationJob *value, + [out, retval] IInstallationResult **retval); + + HRESULT EndUninstall( + [in] IInstallationJob *value, + [out, retval] IInstallationResult **retval); + + HRESULT Install( + [out, retval] IInstallationResult **retval); + + HRESULT RunWizard( + [in, defaultvalue("")] BSTR dialogTitle, + [out, retval] IInstallationResult **retval); + + [propget] + HRESULT IsBusy( + [out, retval] VARIANT_BOOL *retval); + + HRESULT Uninstall( + [out, retval] IInstallationResult **retval); + + [propget] + HRESULT AllowSourcePrompts( + [out, retval] VARIANT_BOOL *retval); + + [propput] + HRESULT AllowSourcePrompts( + [in] VARIANT_BOOL value); + + [propget] + HRESULT RebootRequiredBeforeInstallation( + [out, retval] VARIANT_BOOL *retval); +} diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c index 0771e2ef6d6..8d587e6d06c 100644 --- a/programs/cmd/wcmdmain.c +++ b/programs/cmd/wcmdmain.c @@ -1975,9 +1975,9 @@ BOOL WCMD_ReadFile(const HANDLE hIn, WCHAR *intoBuf, const DWORD maxChars, /*************************************************************************** * WCMD_DumpCommands * - * Domps out the parsed command line to ensure syntax is correct + * Dumps out the parsed command line to ensure syntax is correct */ -void WCMD_DumpCommands(CMD_LIST *commands) { +static void WCMD_DumpCommands(CMD_LIST *commands) { WCHAR buffer[MAXSTRING]; CMD_LIST *thisCmd = commands; const WCHAR fmt[] = {'%','p',' ','%','d',' ','%','2','.','2','d',' ', diff --git a/programs/explorer/appbar.c b/programs/explorer/appbar.c index 6564f2c1543..f6e1eb1c9e6 100644 --- a/programs/explorer/appbar.c +++ b/programs/explorer/appbar.c @@ -220,7 +220,7 @@ static UINT_PTR handle_appbarmessage(DWORD msg, PAPPBARDATA abd) } } -LRESULT CALLBACK appbar_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) +static LRESULT CALLBACK appbar_wndproc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam) { switch (msg) { diff --git a/programs/explorer/desktop.c b/programs/explorer/desktop.c index a74c621bfcb..480d2450c54 100644 --- a/programs/explorer/desktop.c +++ b/programs/explorer/desktop.c @@ -105,7 +105,7 @@ static unsigned long create_desktop( const WCHAR *name, unsigned int width, unsi HMODULE x11drv = GetModuleHandleA( "winex11.drv" ); HDESK desktop; unsigned long xwin = 0; - unsigned long (*create_desktop_func)(unsigned int, unsigned int); + unsigned long (CDECL *create_desktop_func)(unsigned int, unsigned int); desktop = CreateDesktopW( name, NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL ); if (!desktop) diff --git a/programs/explorer/systray.c b/programs/explorer/systray.c index 37f3551937e..9be95bb8d2c 100644 --- a/programs/explorer/systray.c +++ b/programs/explorer/systray.c @@ -35,7 +35,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(systray); #define IS_OPTION_FALSE(ch) \ ((ch) == 'n' || (ch) == 'N' || (ch) == 'f' || (ch) == 'F' || (ch) == '0') -static int (*wine_notify_icon)(DWORD,NOTIFYICONDATAW *); +static int (CDECL *wine_notify_icon)(DWORD,NOTIFYICONDATAW *); /* an individual systray icon, unpacked from the NOTIFYICONDATA and always in unicode */ struct icon diff --git a/programs/msiexec/service.c b/programs/msiexec/service.c index da552a712e6..3ccdb5bb58b 100644 --- a/programs/msiexec/service.c +++ b/programs/msiexec/service.c @@ -32,7 +32,7 @@ static SERVICE_STATUS_HANDLE hstatus; static HANDLE thread; static HANDLE kill_event; -void KillService(void) +static void KillService(void) { WINE_TRACE("Killing service\n"); SetEvent(kill_event); diff --git a/programs/net/net.c b/programs/net/net.c index 30337a69568..89279fd5f34 100644 --- a/programs/net/net.c +++ b/programs/net/net.c @@ -25,7 +25,7 @@ #define NET_START 0001 #define NET_STOP 0002 -int output_string(int msg, ...) +static int output_string(int msg, ...) { char msg_buffer[8192]; va_list arguments; @@ -37,7 +37,7 @@ int output_string(int msg, ...) return 0; } -BOOL output_error_string(DWORD error) +static BOOL output_error_string(DWORD error) { LPSTR pBuffer; if (FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM | diff --git a/programs/oleview/Ko.rc b/programs/oleview/Ko.rc index 94d5a53077a..23d88bd3a51 100644 --- a/programs/oleview/Ko.rc +++ b/programs/oleview/Ko.rc @@ -98,7 +98,7 @@ STRINGTABLE IDS_ABOUTVER "¹öÁ¯ 1.0" IDS_TYPELIBTITLE "ITypeLib ºä¾î" IDS_OPEN "¿­±â" - IDS_OPEN_TYPELIB_FILTER "TypeLib Files (*.tlb;*.olb;*.dll;*.ocx;*.exe)\0*.tlb;*.olb;*.dll;*.ocx;*.exe\0All Files (*.*)\0*.*\0\0" + IDS_OPEN_TYPELIB_FILTER "TypeLib ÆÄÀÏ (*.tlb;*.olb;*.dll;*.ocx;*.exe)\0*.tlb;*.olb;*.dll;*.ocx;*.exe\0All Files (*.*)\0*.*\0\0" IDM_BIND, "ÆÄÀÏ º°¸íÀ¸·Î ÆÄÀÏ ¿¬°á" IDM_TYPELIB, "ŸÀÔ ¶óÀ̺귯¸® ÆÄÀÏÀ» ¿­°í ³»¿ë º¸±â" diff --git a/programs/rpcss/rpcss_main.c b/programs/rpcss/rpcss_main.c index 5a22b1ccf5e..661da4a9020 100644 --- a/programs/rpcss/rpcss_main.c +++ b/programs/rpcss/rpcss_main.c @@ -62,7 +62,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(ole); static HANDLE exit_event; -extern HANDLE __wine_make_process_system(void); +extern HANDLE CDECL __wine_make_process_system(void); static BOOL RPCSS_Initialize(void) { diff --git a/programs/services/rpc.c b/programs/services/rpc.c index b6ca9f26dcd..830ed9ccc65 100644 --- a/programs/services/rpc.c +++ b/programs/services/rpc.c @@ -34,7 +34,7 @@ #include "services.h" #include "svcctl.h" -extern HANDLE __wine_make_process_system(void); +extern HANDLE CDECL __wine_make_process_system(void); WINE_DEFAULT_DEBUG_CHANNEL(service); diff --git a/programs/wineboot/wineboot.c b/programs/wineboot/wineboot.c index 2201ed56dc5..c647fe65499 100644 --- a/programs/wineboot/wineboot.c +++ b/programs/wineboot/wineboot.c @@ -815,7 +815,7 @@ static const struct option long_options[] = int main( int argc, char *argv[] ) { - extern HANDLE __wine_make_process_system(void); + extern HANDLE CDECL __wine_make_process_system(void); static const WCHAR wineboot_eventW[] = {'_','_','w','i','n','e','b','o','o','t','_','e','v','e','n','t',0}; /* First, set the current directory to SystemRoot */ diff --git a/programs/winecfg/drive.c b/programs/winecfg/drive.c index 1a3671ce893..9e6077cd312 100644 --- a/programs/winecfg/drive.c +++ b/programs/winecfg/drive.c @@ -187,7 +187,7 @@ static void set_drive_serial( char letter, DWORD serial ) HANDLE hFile; filename[0] = letter; - WINE_TRACE("Putting serial number of %08x into file '%s'\n", serial, filename); + WINE_TRACE("Putting serial number of %08X into file '%s'\n", serial, filename); hFile = CreateFile(filename, GENERIC_WRITE, FILE_SHARE_READ, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile != INVALID_HANDLE_VALUE) diff --git a/programs/winecfg/driveui.c b/programs/winecfg/driveui.c index 375eccbce1c..b9bcd2db9b6 100644 --- a/programs/winecfg/driveui.c +++ b/programs/winecfg/driveui.c @@ -520,10 +520,11 @@ static void on_edit_changed(HWND dialog, WORD id) char *serial; serial = get_text(dialog, id); - current_drive->serial = strtoul( serial, NULL, 16 ); + current_drive->serial = serial ? strtoul( serial, NULL, 16 ) : 0; + HeapFree(GetProcessHeap(), 0, serial); current_drive->modified = TRUE; - WINE_TRACE("set serial to %08x\n", current_drive->serial); + WINE_TRACE("set serial to %08X\n", current_drive->serial); /* enable the apply button */ SendMessage(GetParent(dialog), PSM_CHANGED, (WPARAM) dialog, 0); @@ -775,7 +776,8 @@ DriveDlgProc (HWND dialog, UINT msg, WPARAM wParam, LPARAM lParam) current_drive->label = str; str = get_textW(dialog, IDC_EDIT_SERIAL); - current_drive->serial = strtoulW( str, NULL, 16 ); + current_drive->serial = str ? strtoulW( str, NULL, 16 ) : 0; + HeapFree(GetProcessHeap(), 0, str); current_drive->modified = TRUE; /* TODO: we don't have a device at this point */ diff --git a/programs/winedevice/device.c b/programs/winedevice/device.c index 7afe97edf65..5677e197b89 100644 --- a/programs/winedevice/device.c +++ b/programs/winedevice/device.c @@ -38,7 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(winedevice); WINE_DECLARE_DEBUG_CHANNEL(relay); -extern NTSTATUS wine_ntoskrnl_main_loop( HANDLE stop_event ); +extern NTSTATUS CDECL wine_ntoskrnl_main_loop( HANDLE stop_event ); static WCHAR *driver_name; static SERVICE_STATUS_HANDLE service_handle; diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c index 4792d0d7b65..ec7a162aa80 100644 --- a/programs/winemenubuilder/winemenubuilder.c +++ b/programs/winemenubuilder/winemenubuilder.c @@ -1708,6 +1708,7 @@ static BOOL init_xdg(void) xdg_config_dir = heap_printf("%s/.config/menus/applications-merged", getenv("HOME")); if (xdg_config_dir) { + create_directories(xdg_config_dir); if (getenv("XDG_DATA_HOME")) xdg_data_dir = heap_printf("%s", getenv("XDG_DATA_HOME")); else diff --git a/programs/winetest/main.c b/programs/winetest/main.c index a6d44252442..a9ead7d17ce 100644 --- a/programs/winetest/main.c +++ b/programs/winetest/main.c @@ -665,28 +665,28 @@ usage (void) " -t TAG include TAG of characters [-.0-9a-zA-Z] in the report\n"); } -int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, - LPSTR cmdLine, int cmdShow) +int main( int argc, char *argv[] ) { char *logname = NULL; const char *cp, *submit = NULL; int reset_env = 1; int poweroff = 0; int interactive = 1; + int i; if (!LoadStringA( 0, IDS_BUILD_ID, build_id, sizeof(build_id) )) build_id[0] = 0; - cmdLine = strtok (cmdLine, whitespace); - while (cmdLine) { - if (cmdLine[0] != '-' || cmdLine[2]) { + for (i = 1; argv[i]; i++) + { + if (argv[i][0] != '-' || argv[i][2]) { if (nb_filters == sizeof(filters)/sizeof(filters[0])) { report (R_ERROR, "Too many test filters specified"); exit (2); } - filters[nb_filters++] = xstrdup( cmdLine ); + filters[nb_filters++] = argv[i]; } - else switch (cmdLine[1]) { + else switch (argv[i][1]) { case 'c': report (R_TEXTMODE); interactive = 0; @@ -706,16 +706,28 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, interactive = 0; break; case 's': - submit = strtok (NULL, whitespace); + if (!(submit = argv[++i])) + { + usage(); + exit( 2 ); + } if (tag) report (R_WARNING, "ignoring tag for submission"); send_file (submit); break; case 'o': - logname = strtok (NULL, whitespace); + if (!(logname = argv[++i])) + { + usage(); + exit( 2 ); + } break; case 't': - tag = strtok (NULL, whitespace); + if (!(tag = argv[++i])) + { + usage(); + exit( 2 ); + } if (strlen (tag) > MAXTAGLEN) report (R_FATAL, "tag is too long (maximum %d characters)", MAXTAGLEN); @@ -727,11 +739,10 @@ int WINAPI WinMain (HINSTANCE hInst, HINSTANCE hPrevInst, } break; default: - report (R_ERROR, "invalid option: -%c", cmdLine[1]); + report (R_ERROR, "invalid option: -%c", argv[i][1]); usage (); exit (2); } - cmdLine = strtok (NULL, whitespace); } if (!submit) { report (R_STATUS, "Starting up"); diff --git a/programs/winhlp32/En.rc b/programs/winhlp32/En.rc index 1276f9ccc1e..2a11e1a33c2 100644 --- a/programs/winhlp32/En.rc +++ b/programs/winhlp32/En.rc @@ -61,7 +61,7 @@ MAIN_MENU MENU LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT MENUITEM SEPARATOR MENUITEM "&Info...", MNID_HELP_ABOUT #ifdef WINELIB - MENUITEM "&About WINE", MNID_HELP_WINE + MENUITEM "&About Wine", MNID_HELP_WINE #endif } } @@ -85,7 +85,7 @@ CAPTION "Search" /* Strings */ STRINGTABLE DISCARDABLE LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT { -STID_WINE_HELP, "WINE Help" +STID_WINE_HELP, "Wine Help" STID_WHERROR, "ERROR" STID_WARNING, "WARNING" STID_INFO, "Information" diff --git a/programs/winhlp32/Fr.rc b/programs/winhlp32/Fr.rc index 60acba8b5f8..0c5eea63f12 100644 --- a/programs/winhlp32/Fr.rc +++ b/programs/winhlp32/Fr.rc @@ -64,7 +64,7 @@ MAIN_MENU MENU MENUITEM SEPARATOR MENUITEM "&Info...", MNID_HELP_ABOUT #ifdef WINELIB - MENUITEM "À &propos de WINE", MNID_HELP_WINE + MENUITEM "À &propos de Wine", MNID_HELP_WINE #endif } } @@ -77,10 +77,18 @@ CAPTION "Index" LISTBOX IDC_INDEXLIST, 10, 10, 180, 150, LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_BORDER } +IDD_SEARCH DIALOG DISCARDABLE 0, 0, 200, 190 LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +CAPTION "Recherche" +{ + LTEXT "Pas encore implémenté", -1, 10, 10, 180, 150 +} + /* Strings */ STRINGTABLE DISCARDABLE LANGUAGE LANG_FRENCH, SUBLANG_NEUTRAL { -STID_WINE_HELP, "Aide de WINE" +STID_WINE_HELP, "Aide de Wine" STID_WHERROR, "ERREUR" STID_WARNING, "ATTENTION" STID_INFO, "Information" diff --git a/programs/winver/Makefile.in b/programs/winver/Makefile.in index 62571d3e05a..41572a0316a 100644 --- a/programs/winver/Makefile.in +++ b/programs/winver/Makefile.in @@ -9,6 +9,8 @@ IMPORTS = shell32 kernel32 C_SRCS = winver.c +RC_SRCS = version.rc + @MAKE_PROG_RULES@ @DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/oleacc/oleacc.rc b/programs/winver/version.rc similarity index 67% copy from dlls/oleacc/oleacc.rc copy to programs/winver/version.rc index 4b36b3db914..ae042fb82a0 100644 --- a/dlls/oleacc/oleacc.rc +++ b/programs/winver/version.rc @@ -1,7 +1,5 @@ /* - * Top level resource file for oleacc - * - * Copyright 2008 Nikolay Sivov + * Copyright (c) 2004 Mike McCormack * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,9 +16,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "windef.h" -#include "oleacc.h" +#define WINE_FILEDESCRIPTION_STR "Windows Version" +#define WINE_FILENAME_STR "winver.exe" +#define WINE_FILETYPE VFT_APP +#define WINE_FILEVERSION 5,1,2600,0 +#define WINE_FILEVERSION_STR "5.1.2600.0" +#define WINE_PRODUCTVERSION 5,1,2600,0 +#define WINE_PRODUCTVERSION_STR "5.1.2600.0" -#include "oleacc_En.rc" -#include "oleacc_Ko.rc" -#include "oleacc_Nl.rc" +#include "wine/wine_common_ver.rc" diff --git a/programs/wordpad/Fr.rc b/programs/wordpad/Fr.rc index 1345586e58b..23a545ccf85 100644 --- a/programs/wordpad/Fr.rc +++ b/programs/wordpad/Fr.rc @@ -235,4 +235,9 @@ BEGIN "Voulez-vous vraiment continuer ?" STRING_INVALID_NUMBER, "Format de nombre invalide" STRING_OLE_STORAGE_NOT_SUPPORTED, "Les documents conteneur OLE ne sont pas supportés" + STRING_WRITE_FAILED, "Impossible d'enregistrer le fichier." + STRING_WRITE_ACCESS_DENIED, "Vous ne disposez pas des accès nécessaires à l'enregistrement du fichier." + STRING_OPEN_FAILED, "Impossible d'ouvrir le fichier." + STRING_OPEN_ACCESS_DENIED, "Vous ne disposez pas des accès nécessaires à l'ouverture du fichier." + STRING_PRINTING_NOT_IMPLEMENTED, "L'impression n'est pas implémentée" END diff --git a/server/async.c b/server/async.c index 879616d9946..f3186d77255 100644 --- a/server/async.c +++ b/server/async.c @@ -43,7 +43,7 @@ struct async unsigned int timeout_status; /* status to report upon timeout */ struct event *event; struct completion *completion; - unsigned long comp_key; + apc_param_t comp_key; async_data_t data; /* data for async I/O call */ }; @@ -234,7 +234,7 @@ void async_set_timeout( struct async *async, timeout_t timeout, unsigned int sta } /* store the result of the client-side async callback */ -void async_set_result( struct object *obj, unsigned int status, unsigned long total ) +void async_set_result( struct object *obj, unsigned int status, unsigned int total ) { struct async *async = (struct async *)obj; @@ -266,8 +266,8 @@ void async_set_result( struct object *obj, unsigned int status, unsigned long to memset( &data, 0, sizeof(data) ); data.type = APC_USER; data.user.func = async->data.apc; - data.user.args[0] = (unsigned long)async->data.arg; - data.user.args[1] = (unsigned long)async->data.iosb; + data.user.args[0] = (apc_param_t)(unsigned long)async->data.arg; + data.user.args[1] = (apc_param_t)(unsigned long)async->data.iosb; data.user.args[2] = 0; thread_queue_apc( async->thread, NULL, &data ); } diff --git a/server/completion.c b/server/completion.c index 41884882d54..2a8f9ac2cc1 100644 --- a/server/completion.c +++ b/server/completion.c @@ -79,9 +79,9 @@ static const struct object_ops completion_ops = struct comp_msg { struct list queue_entry; - unsigned long ckey; - unsigned long cvalue; - unsigned long information; + apc_param_t ckey; + apc_param_t cvalue; + unsigned int information; unsigned int status; }; @@ -141,7 +141,8 @@ struct completion *get_completion_obj( struct process *process, obj_handle_t han return (struct completion *) get_handle_obj( process, handle, access, &completion_ops ); } -void add_completion( struct completion *completion, unsigned long ckey, unsigned long cvalue, unsigned int status, unsigned long information ) +void add_completion( struct completion *completion, apc_param_t ckey, apc_param_t cvalue, + unsigned int status, unsigned int information ) { struct comp_msg *msg = mem_alloc( sizeof( *msg ) ); diff --git a/server/fd.c b/server/fd.c index f7716d107b9..052e12c3f2c 100644 --- a/server/fd.c +++ b/server/fd.c @@ -199,7 +199,7 @@ struct fd struct async_queue *write_q; /* async writers of this fd */ struct async_queue *wait_q; /* other async waiters of this fd */ struct completion *completion; /* completion object attached to this fd */ - unsigned long comp_key; /* completion key to set in completion events */ + apc_param_t comp_key; /* completion key to set in completion events */ }; static void fd_dump( struct object *obj, int verbose ); @@ -1940,7 +1940,7 @@ static struct fd *get_handle_fd_obj( struct process *process, obj_handle_t handl return fd; } -void fd_assign_completion( struct fd *fd, struct completion **p_port, unsigned long *p_key ) +void fd_assign_completion( struct fd *fd, struct completion **p_port, apc_param_t *p_key ) { *p_key = fd->comp_key; *p_port = fd->completion ? (struct completion *)grab_object( fd->completion ) : NULL; diff --git a/server/file.h b/server/file.h index 2d1d047c2f4..00b1fa7a4e0 100644 --- a/server/file.h +++ b/server/file.h @@ -124,7 +124,8 @@ extern struct object *create_dir_obj( struct fd *fd ); /* completion */ extern struct completion *get_completion_obj( struct process *process, obj_handle_t handle, unsigned int access ); -extern void add_completion( struct completion *completion, unsigned long ckey, unsigned long cvalue, unsigned int status, unsigned long information ); +extern void add_completion( struct completion *completion, apc_param_t ckey, apc_param_t cvalue, + unsigned int status, unsigned int information ); /* serial port functions */ @@ -137,11 +138,11 @@ extern void free_async_queue( struct async_queue *queue ); extern struct async *create_async( struct thread *thread, struct async_queue *queue, const async_data_t *data ); extern void async_set_timeout( struct async *async, timeout_t timeout, unsigned int status ); -extern void async_set_result( struct object *obj, unsigned int status, unsigned long total ); +extern void async_set_result( struct object *obj, unsigned int status, unsigned int total ); extern int async_waiting( struct async_queue *queue ); extern void async_terminate( struct async *async, unsigned int status ); extern void async_wake_up( struct async_queue *queue, unsigned int status ); -extern void fd_assign_completion( struct fd *fd, struct completion **p_port, unsigned long *p_key ); +extern void fd_assign_completion( struct fd *fd, struct completion **p_port, apc_param_t *p_key ); /* access rights that require Unix read permission */ #define FILE_UNIX_READ_ACCESS (FILE_READ_DATA|FILE_READ_ATTRIBUTES|FILE_READ_EA) diff --git a/server/mapping.c b/server/mapping.c index f5df22fdcf6..0982b8659aa 100644 --- a/server/mapping.c +++ b/server/mapping.c @@ -54,7 +54,7 @@ struct ranges struct mapping { struct object obj; /* object header */ - file_pos_t size; /* mapping size */ + mem_size_t size; /* mapping size */ int protect; /* protection flags */ struct file *file; /* file mapped */ int header_size; /* size of headers (for PE image mapping) */ @@ -199,7 +199,7 @@ static void add_committed_range( struct mapping *mapping, file_pos_t start, file } /* find the range containing start and return whether it's committed */ -static int find_committed_range( struct mapping *mapping, file_pos_t start, file_pos_t *size ) +static int find_committed_range( struct mapping *mapping, file_pos_t start, mem_size_t *size ) { unsigned int i; struct range *ranges; @@ -231,7 +231,7 @@ static int build_shared_mapping( struct mapping *mapping, int fd, IMAGE_SECTION_HEADER *sec, unsigned int nb_sec ) { unsigned int i; - file_pos_t total_size; + mem_size_t total_size; size_t file_size, map_size, max_size; off_t shared_pos, read_pos, write_pos; char *buffer = NULL; @@ -360,7 +360,7 @@ static int get_image_params( struct mapping *mapping ) } /* get the size of the unix file associated with the mapping */ -static inline int get_file_size( struct file *file, file_pos_t *size ) +static inline int get_file_size( struct file *file, mem_size_t *size ) { struct stat st; int unix_fd = get_file_unix_fd( file ); @@ -371,7 +371,7 @@ static inline int get_file_size( struct file *file, file_pos_t *size ) } static struct object *create_mapping( struct directory *root, const struct unicode_str *name, - unsigned int attr, file_pos_t size, int protect, + unsigned int attr, mem_size_t size, int protect, obj_handle_t handle, const struct security_descriptor *sd ) { struct mapping *mapping; @@ -440,7 +440,7 @@ static struct object *create_mapping( struct directory *root, const struct unico if (!(mapping->file = create_temp_file( access ))) goto error; if (!grow_file( mapping->file, size )) goto error; } - mapping->size = (size + page_mask) & ~((file_pos_t)page_mask); + mapping->size = (size + page_mask) & ~((mem_size_t)page_mask); mapping->protect = protect; return &mapping->obj; diff --git a/server/protocol.def b/server/protocol.def index 7b345231d66..e80d3024c39 100644 --- a/server/protocol.def +++ b/server/protocol.def @@ -39,6 +39,8 @@ typedef unsigned int thread_id_t; typedef unsigned int data_size_t; typedef unsigned int ioctl_code_t; typedef unsigned long lparam_t; +typedef unsigned __int64 apc_param_t; +typedef unsigned __int64 mem_size_t; typedef unsigned __int64 file_pos_t; struct request_header @@ -180,7 +182,7 @@ typedef struct void *arg; /* opaque user data to pass to callback */ void *apc; /* user apc to call */ obj_handle_t event; /* event to signal when done */ - unsigned long cvalue; /* completion value to use for completion events */ + apc_param_t cvalue; /* completion value to use for completion events */ } async_data_t; /* structures for extra message data */ @@ -276,7 +278,7 @@ typedef union { enum apc_type type; /* APC_USER */ void (__stdcall *func)(unsigned long,unsigned long,unsigned long); - unsigned long args[3]; /* arguments for user function */ + apc_param_t args[3]; /* arguments for user function */ } user; struct { @@ -288,7 +290,7 @@ typedef union struct { enum apc_type type; /* APC_ASYNC_IO */ - unsigned int (*func)(void*, void*, unsigned int, unsigned long *); + unsigned int (*func)(void*, void*, unsigned int, unsigned int *); void *user; /* user pointer */ void *sb; /* status block */ unsigned int status; /* I/O status */ @@ -297,7 +299,7 @@ typedef union { enum apc_type type; /* APC_VIRTUAL_ALLOC */ void *addr; /* requested address */ - unsigned long size; /* allocation size */ + mem_size_t size; /* allocation size */ unsigned int zero_bits; /* allocation alignment */ unsigned int op_type; /* type of operation */ unsigned int prot; /* memory protection flags */ @@ -306,7 +308,7 @@ typedef union { enum apc_type type; /* APC_VIRTUAL_FREE */ void *addr; /* requested address */ - unsigned long size; /* allocation size */ + mem_size_t size; /* allocation size */ unsigned int op_type; /* type of operation */ } virtual_free; struct @@ -318,33 +320,33 @@ typedef union { enum apc_type type; /* APC_VIRTUAL_PROTECT */ void *addr; /* requested address */ - unsigned long size; /* requested address */ + mem_size_t size; /* requested size */ unsigned int prot; /* new protection flags */ } virtual_protect; struct { enum apc_type type; /* APC_VIRTUAL_FLUSH */ const void *addr; /* requested address */ - unsigned long size; /* requested address */ + mem_size_t size; /* requested size */ } virtual_flush; struct { enum apc_type type; /* APC_VIRTUAL_LOCK */ void *addr; /* requested address */ - unsigned long size; /* requested address */ + mem_size_t size; /* requested size */ } virtual_lock; struct { enum apc_type type; /* APC_VIRTUAL_UNLOCK */ void *addr; /* requested address */ - unsigned long size; /* requested address */ + mem_size_t size; /* requested size */ } virtual_unlock; struct { enum apc_type type; /* APC_MAP_VIEW */ obj_handle_t handle; /* mapping handle */ void *addr; /* requested address */ - unsigned long size; /* allocation size */ + mem_size_t size; /* allocation size */ file_pos_t offset; /* file offset */ unsigned int zero_bits; /* allocation alignment */ unsigned int alloc_type;/* allocation type */ @@ -360,8 +362,8 @@ typedef union enum apc_type type; /* APC_CREATE_THREAD */ void (__stdcall *func)(void*); /* start function */ void *arg; /* argument for start function */ - unsigned long reserve; /* reserve size for thread stack */ - unsigned long commit; /* commit size for thread stack */ + mem_size_t reserve; /* reserve size for thread stack */ + mem_size_t commit; /* commit size for thread stack */ int suspend; /* suspended thread? */ } create_thread; } apc_call_t; @@ -373,21 +375,21 @@ typedef union { enum apc_type type; /* APC_ASYNC_IO */ unsigned int status; /* new status of async operation */ - unsigned long total; /* bytes transferred */ + unsigned int total; /* bytes transferred */ } async_io; struct { enum apc_type type; /* APC_VIRTUAL_ALLOC */ unsigned int status; /* status returned by call */ void *addr; /* resulting address */ - unsigned long size; /* resulting size */ + mem_size_t size; /* resulting size */ } virtual_alloc; struct { enum apc_type type; /* APC_VIRTUAL_FREE */ unsigned int status; /* status returned by call */ void *addr; /* resulting address */ - unsigned long size; /* resulting size */ + mem_size_t size; /* resulting size */ } virtual_free; struct { @@ -395,7 +397,7 @@ typedef union unsigned int status; /* status returned by call */ void *base; /* resulting base address */ void *alloc_base;/* resulting allocation base */ - unsigned long size; /* resulting region size */ + mem_size_t size; /* resulting region size */ unsigned int state; /* resulting region state */ unsigned int prot; /* resulting region protection */ unsigned int alloc_prot;/* resulting allocation protection */ @@ -406,7 +408,7 @@ typedef union enum apc_type type; /* APC_VIRTUAL_PROTECT */ unsigned int status; /* status returned by call */ void *addr; /* resulting address */ - unsigned long size; /* resulting size */ + mem_size_t size; /* resulting size */ unsigned int prot; /* old protection flags */ } virtual_protect; struct @@ -414,28 +416,28 @@ typedef union enum apc_type type; /* APC_VIRTUAL_FLUSH */ unsigned int status; /* status returned by call */ const void *addr; /* resulting address */ - unsigned long size; /* resulting size */ + mem_size_t size; /* resulting size */ } virtual_flush; struct { enum apc_type type; /* APC_VIRTUAL_LOCK */ unsigned int status; /* status returned by call */ void *addr; /* resulting address */ - unsigned long size; /* resulting size */ + mem_size_t size; /* resulting size */ } virtual_lock; struct { enum apc_type type; /* APC_VIRTUAL_UNLOCK */ unsigned int status; /* status returned by call */ void *addr; /* resulting address */ - unsigned long size; /* resulting size */ + mem_size_t size; /* resulting size */ } virtual_unlock; struct { enum apc_type type; /* APC_MAP_VIEW */ unsigned int status; /* status returned by call */ void *addr; /* resulting address */ - unsigned long size; /* resulting size */ + mem_size_t size; /* resulting size */ } map_view; struct { @@ -1316,7 +1318,7 @@ enum char_info_mode @REQ(create_mapping) unsigned int access; /* wanted access rights */ unsigned int attributes; /* object attributes */ - file_pos_t size; /* mapping size */ + mem_size_t size; /* mapping size */ unsigned int protect; /* protection flags (see below) */ obj_handle_t file_handle; /* file handle */ VARARG(objattr,object_attributes); /* object attributes */ @@ -1355,7 +1357,7 @@ enum char_info_mode obj_handle_t handle; /* handle to the mapping */ unsigned int access; /* wanted access rights */ @REPLY - file_pos_t size; /* mapping size */ + mem_size_t size; /* mapping size */ int protect; /* protection flags */ int header_size; /* header size (for VPROT_IMAGE mapping) */ void* base; /* default base addr (for VPROT_IMAGE mapping) */ @@ -1369,7 +1371,7 @@ enum char_info_mode obj_handle_t handle; /* handle to the mapping */ file_pos_t offset; /* starting offset (page-aligned, in bytes) */ @REPLY - file_pos_t size; /* size of range starting at offset (page-aligned, in bytes) */ + mem_size_t size; /* size of range starting at offset (page-aligned, in bytes) */ int committed; /* whether it is a committed range */ @END @@ -1378,7 +1380,7 @@ enum char_info_mode @REQ(add_mapping_committed_range) obj_handle_t handle; /* handle to the mapping */ file_pos_t offset; /* starting offset (page-aligned, in bytes) */ - file_pos_t size; /* size to set (page-aligned, in bytes) or 0 if only retrieving */ + mem_size_t size; /* size to set (page-aligned, in bytes) or 0 if only retrieving */ @END @@ -3031,9 +3033,9 @@ enum message_type /* add completion to completion port */ @REQ(add_completion) obj_handle_t handle; /* port handle */ - unsigned long ckey; /* completion key */ - unsigned long cvalue; /* completion value */ - unsigned long information; /* IO_STATUS_BLOCK Information */ + apc_param_t ckey; /* completion key */ + apc_param_t cvalue; /* completion value */ + unsigned int information; /* IO_STATUS_BLOCK Information */ unsigned int status; /* completion result */ @END @@ -3042,9 +3044,9 @@ enum message_type @REQ(remove_completion) obj_handle_t handle; /* port handle */ @REPLY - unsigned long ckey; /* completion key */ - unsigned long cvalue; /* completion value */ - unsigned long information; /* IO_STATUS_BLOCK Information */ + apc_param_t ckey; /* completion key */ + apc_param_t cvalue; /* completion value */ + unsigned int information; /* IO_STATUS_BLOCK Information */ unsigned int status; /* completion result */ @END @@ -3061,16 +3063,16 @@ enum message_type @REQ(set_completion_info) obj_handle_t handle; /* object handle */ obj_handle_t chandle; /* port handle */ - unsigned long ckey; /* completion key */ + apc_param_t ckey; /* completion key */ @END /* check for associated completion and push msg */ @REQ(add_fd_completion) obj_handle_t handle; /* async' object */ - unsigned long cvalue; /* completion value */ + apc_param_t cvalue; /* completion value */ unsigned int status; /* completion status */ - unsigned long information; /* IO_STATUS_BLOCK Information */ + unsigned int information; /* IO_STATUS_BLOCK Information */ @END diff --git a/server/trace.c b/server/trace.c index 31afbb0b1de..c446f63ff11 100644 --- a/server/trace.c +++ b/server/trace.c @@ -70,9 +70,12 @@ static void dump_timeout( const timeout_t *time ) fputs( get_timeout_str(*time), stderr ); } -static void dump_file_pos( const file_pos_t *pos ) +static void dump_uint64( const unsigned __int64 *val ) { - fprintf( stderr, "%x%08x", (unsigned int)(*pos >> 32), (unsigned int)*pos ); + if ((unsigned int)*val != *val) + fprintf( stderr, "%x%08x", (unsigned int)(*val >> 32), (unsigned int)*val ); + else + fprintf( stderr, "%08x", (unsigned int)*val ); } static void dump_rectangle( const rectangle_t *rect ) @@ -111,8 +114,13 @@ static void dump_apc_call( const apc_call_t *call ) fprintf( stderr, "APC_NONE" ); break; case APC_USER: - fprintf( stderr, "APC_USER,args={%lx,%lx,%lx}", - call->user.args[0], call->user.args[1], call->user.args[2] ); + fprintf( stderr, "APC_USER,args={" ); + dump_uint64( &call->user.args[0] ); + fputc( ',', stderr ); + dump_uint64( &call->user.args[1] ); + fputc( ',', stderr ); + dump_uint64( &call->user.args[2] ); + fputc( '}', stderr ); break; case APC_TIMER: fprintf( stderr, "APC_TIMER,time=" ); @@ -125,50 +133,56 @@ static void dump_apc_call( const apc_call_t *call ) get_status_name(call->async_io.status) ); break; case APC_VIRTUAL_ALLOC: - fprintf( stderr, "APC_VIRTUAL_ALLOC,addr=%p,size=%lu,zero_bits=%u,op_type=%x,prot=%x", - call->virtual_alloc.addr, call->virtual_alloc.size, + fprintf( stderr, "APC_VIRTUAL_ALLOC,addr=%p,size=", call->virtual_alloc.addr ); + dump_uint64( &call->virtual_alloc.size ); + fprintf( stderr, ",zero_bits=%u,op_type=%x,prot=%x", call->virtual_alloc.zero_bits, call->virtual_alloc.op_type, call->virtual_alloc.prot ); break; case APC_VIRTUAL_FREE: - fprintf( stderr, "APC_VIRTUAL_FREE,addr=%p,size=%lu,op_type=%x", - call->virtual_free.addr, call->virtual_free.size, - call->virtual_free.op_type ); + fprintf( stderr, "APC_VIRTUAL_FREE,addr=%p,size=", call->virtual_free.addr ); + dump_uint64( &call->virtual_free.size ); + fprintf( stderr, ",op_type=%x", call->virtual_free.op_type ); break; case APC_VIRTUAL_QUERY: fprintf( stderr, "APC_VIRTUAL_QUERY,addr=%p", call->virtual_query.addr ); break; case APC_VIRTUAL_PROTECT: - fprintf( stderr, "APC_VIRTUAL_PROTECT,addr=%p,size=%lu,prot=%x", - call->virtual_protect.addr, call->virtual_protect.size, - call->virtual_protect.prot ); + fprintf( stderr, "APC_VIRTUAL_PROTECT,addr=%p,size=", call->virtual_protect.addr ); + dump_uint64( &call->virtual_protect.size ); + fprintf( stderr, ",prot=%x", call->virtual_protect.prot ); break; case APC_VIRTUAL_FLUSH: - fprintf( stderr, "APC_VIRTUAL_FLUSH,addr=%p,size=%lu", - call->virtual_flush.addr, call->virtual_flush.size ); + fprintf( stderr, "APC_VIRTUAL_FLUSH,addr=%p,size=", call->virtual_flush.addr ); + dump_uint64( &call->virtual_flush.size ); break; case APC_VIRTUAL_LOCK: - fprintf( stderr, "APC_VIRTUAL_LOCK,addr=%p,size=%lu", - call->virtual_lock.addr, call->virtual_lock.size ); + fprintf( stderr, "APC_VIRTUAL_LOCK,addr=%p,size=", call->virtual_lock.addr ); + dump_uint64( &call->virtual_lock.size ); break; case APC_VIRTUAL_UNLOCK: - fprintf( stderr, "APC_VIRTUAL_UNLOCK,addr=%p,size=%lu", - call->virtual_unlock.addr, call->virtual_unlock.size ); + fprintf( stderr, "APC_VIRTUAL_UNLOCK,addr=%p,size=", call->virtual_unlock.addr ); + dump_uint64( &call->virtual_unlock.size ); break; case APC_MAP_VIEW: - fprintf( stderr, "APC_MAP_VIEW,handle=%04x,addr=%p,size=%lu,offset=%x%08x,zero_bits=%u,alloc_type=%x,prot=%x", - call->map_view.handle, call->map_view.addr, call->map_view.size, - (unsigned int)(call->map_view.offset >> 32), (unsigned int)call->map_view.offset, + fprintf( stderr, "APC_MAP_VIEW,handle=%04x,addr=%p,size=", + call->map_view.handle, call->map_view.addr ); + dump_uint64( &call->map_view.size ); + fprintf( stderr, ",offset=" ); + dump_uint64( &call->map_view.offset ); + fprintf( stderr, ",zero_bits=%u,alloc_type=%x,prot=%x", call->map_view.zero_bits, call->map_view.alloc_type, call->map_view.prot ); break; case APC_UNMAP_VIEW: fprintf( stderr, "APC_UNMAP_VIEW,addr=%p", call->unmap_view.addr ); break; case APC_CREATE_THREAD: - fprintf( stderr, "APC_CREATE_THREAD,func=%p,arg=%p,reserve=%lx,commit=%lx,suspend=%u", - call->create_thread.func, call->create_thread.arg, - call->create_thread.reserve, call->create_thread.commit, - call->create_thread.suspend ); + fprintf( stderr, "APC_CREATE_THREAD,func=%p,arg=%p,reserve=", + call->create_thread.func, call->create_thread.arg ); + dump_uint64( &call->create_thread.reserve ); + fprintf( stderr, ",commit=" ); + dump_uint64( &call->create_thread.commit ); + fprintf( stderr, ",suspend=%u", call->create_thread.suspend ); break; default: fprintf( stderr, "type=%u", call->type ); @@ -189,48 +203,49 @@ static void dump_apc_result( const apc_result_t *result ) get_status_name( result->async_io.status ) ); break; case APC_VIRTUAL_ALLOC: - fprintf( stderr, "APC_VIRTUAL_ALLOC,status=%s,addr=%p,size=%lu", - get_status_name( result->virtual_alloc.status ), - result->virtual_alloc.addr, result->virtual_alloc.size ); + fprintf( stderr, "APC_VIRTUAL_ALLOC,status=%s,addr=%p,size=", + get_status_name( result->virtual_alloc.status ), result->virtual_alloc.addr ); + dump_uint64( &result->virtual_alloc.size ); break; case APC_VIRTUAL_FREE: - fprintf( stderr, "APC_VIRTUAL_FREE,status=%s,addr=%p,size=%lu", - get_status_name( result->virtual_free.status ), - result->virtual_free.addr, result->virtual_free.size ); + fprintf( stderr, "APC_VIRTUAL_FREE,status=%s,addr=%p,size=", + get_status_name( result->virtual_free.status ), result->virtual_free.addr ); + dump_uint64( &result->virtual_free.size ); break; case APC_VIRTUAL_QUERY: - fprintf( stderr, "APC_VIRTUAL_QUERY,status=%s,base=%p,alloc_base=%p,size=%lu,state=%x,prot=%x,alloc_prot=%x,alloc_type=%x", + fprintf( stderr, "APC_VIRTUAL_QUERY,status=%s,base=%p,alloc_base=%p,size=", get_status_name( result->virtual_query.status ), - result->virtual_query.base, result->virtual_query.alloc_base, - result->virtual_query.size, result->virtual_query.state, - result->virtual_query.prot, result->virtual_query.alloc_prot, - result->virtual_query.alloc_type ); + result->virtual_query.base, result->virtual_query.alloc_base ); + dump_uint64( &result->virtual_query.size ); + fprintf( stderr, ",state=%x,prot=%x,alloc_prot=%x,alloc_type=%x", + result->virtual_query.state, result->virtual_query.prot, + result->virtual_query.alloc_prot, result->virtual_query.alloc_type ); break; case APC_VIRTUAL_PROTECT: - fprintf( stderr, "APC_VIRTUAL_PROTECT,status=%s,addr=%p,size=%lu,prot=%x", - get_status_name( result->virtual_protect.status ), - result->virtual_protect.addr, result->virtual_protect.size, - result->virtual_protect.prot ); + fprintf( stderr, "APC_VIRTUAL_PROTECT,status=%s,addr=%p,size=", + get_status_name( result->virtual_protect.status ), result->virtual_protect.addr ); + dump_uint64( &result->virtual_protect.size ); + fprintf( stderr, ",prot=%x", result->virtual_protect.prot ); break; case APC_VIRTUAL_FLUSH: - fprintf( stderr, "APC_VIRTUAL_FLUSH,status=%s,addr=%p,size=%lu", - get_status_name( result->virtual_flush.status ), - result->virtual_flush.addr, result->virtual_flush.size ); + fprintf( stderr, "APC_VIRTUAL_FLUSH,status=%s,addr=%p,size=", + get_status_name( result->virtual_flush.status ), result->virtual_flush.addr ); + dump_uint64( &result->virtual_flush.size ); break; case APC_VIRTUAL_LOCK: - fprintf( stderr, "APC_VIRTUAL_LOCK,status=%s,addr=%p,size=%lu", - get_status_name( result->virtual_lock.status ), - result->virtual_lock.addr, result->virtual_lock.size ); + fprintf( stderr, "APC_VIRTUAL_LOCK,status=%s,addr=%p,size=", + get_status_name( result->virtual_lock.status ), result->virtual_lock.addr ); + dump_uint64( &result->virtual_lock.size ); break; case APC_VIRTUAL_UNLOCK: - fprintf( stderr, "APC_VIRTUAL_UNLOCK,status=%s,addr=%p,size=%lu", - get_status_name( result->virtual_unlock.status ), - result->virtual_unlock.addr, result->virtual_unlock.size ); + fprintf( stderr, "APC_VIRTUAL_UNLOCK,status=%s,addr=%p,size=", + get_status_name( result->virtual_unlock.status ), result->virtual_unlock.addr ); + dump_uint64( &result->virtual_unlock.size ); break; case APC_MAP_VIEW: - fprintf( stderr, "APC_MAP_VIEW,status=%s,addr=%p,size=%lu", - get_status_name( result->map_view.status ), - result->map_view.addr, result->map_view.size ); + fprintf( stderr, "APC_MAP_VIEW,status=%s,addr=%p,size=", + get_status_name( result->map_view.status ), result->map_view.addr ); + dump_uint64( &result->map_view.size ); break; case APC_UNMAP_VIEW: fprintf( stderr, "APC_UNMAP_VIEW,status=%s", @@ -1355,10 +1370,10 @@ static void dump_lock_file_request( const struct lock_file_request *req ) { fprintf( stderr, " handle=%04x,", req->handle ); fprintf( stderr, " offset=" ); - dump_file_pos( &req->offset ); + dump_uint64( &req->offset ); fprintf( stderr, "," ); fprintf( stderr, " count=" ); - dump_file_pos( &req->count ); + dump_uint64( &req->count ); fprintf( stderr, "," ); fprintf( stderr, " shared=%d,", req->shared ); fprintf( stderr, " wait=%d", req->wait ); @@ -1374,10 +1389,10 @@ static void dump_unlock_file_request( const struct unlock_file_request *req ) { fprintf( stderr, " handle=%04x,", req->handle ); fprintf( stderr, " offset=" ); - dump_file_pos( &req->offset ); + dump_uint64( &req->offset ); fprintf( stderr, "," ); fprintf( stderr, " count=" ); - dump_file_pos( &req->count ); + dump_uint64( &req->count ); } static void dump_create_socket_request( const struct create_socket_request *req ) @@ -1740,7 +1755,7 @@ static void dump_create_mapping_request( const struct create_mapping_request *re fprintf( stderr, " access=%08x,", req->access ); fprintf( stderr, " attributes=%08x,", req->attributes ); fprintf( stderr, " size=" ); - dump_file_pos( &req->size ); + dump_uint64( &req->size ); fprintf( stderr, "," ); fprintf( stderr, " protect=%08x,", req->protect ); fprintf( stderr, " file_handle=%04x,", req->file_handle ); @@ -1776,7 +1791,7 @@ static void dump_get_mapping_info_request( const struct get_mapping_info_request static void dump_get_mapping_info_reply( const struct get_mapping_info_reply *req ) { fprintf( stderr, " size=" ); - dump_file_pos( &req->size ); + dump_uint64( &req->size ); fprintf( stderr, "," ); fprintf( stderr, " protect=%d,", req->protect ); fprintf( stderr, " header_size=%d,", req->header_size ); @@ -1789,13 +1804,13 @@ static void dump_get_mapping_committed_range_request( const struct get_mapping_c { fprintf( stderr, " handle=%04x,", req->handle ); fprintf( stderr, " offset=" ); - dump_file_pos( &req->offset ); + dump_uint64( &req->offset ); } static void dump_get_mapping_committed_range_reply( const struct get_mapping_committed_range_reply *req ) { fprintf( stderr, " size=" ); - dump_file_pos( &req->size ); + dump_uint64( &req->size ); fprintf( stderr, "," ); fprintf( stderr, " committed=%d", req->committed ); } @@ -1804,10 +1819,10 @@ static void dump_add_mapping_committed_range_request( const struct add_mapping_c { fprintf( stderr, " handle=%04x,", req->handle ); fprintf( stderr, " offset=" ); - dump_file_pos( &req->offset ); + dump_uint64( &req->offset ); fprintf( stderr, "," ); fprintf( stderr, " size=" ); - dump_file_pos( &req->size ); + dump_uint64( &req->size ); } static void dump_create_snapshot_request( const struct create_snapshot_request *req ) @@ -3743,9 +3758,13 @@ static void dump_open_completion_reply( const struct open_completion_reply *req static void dump_add_completion_request( const struct add_completion_request *req ) { fprintf( stderr, " handle=%04x,", req->handle ); - fprintf( stderr, " ckey=%lx,", req->ckey ); - fprintf( stderr, " cvalue=%lx,", req->cvalue ); - fprintf( stderr, " information=%lx,", req->information ); + fprintf( stderr, " ckey=" ); + dump_uint64( &req->ckey ); + fprintf( stderr, "," ); + fprintf( stderr, " cvalue=" ); + dump_uint64( &req->cvalue ); + fprintf( stderr, "," ); + fprintf( stderr, " information=%08x,", req->information ); fprintf( stderr, " status=%08x", req->status ); } @@ -3756,9 +3775,13 @@ static void dump_remove_completion_request( const struct remove_completion_reque static void dump_remove_completion_reply( const struct remove_completion_reply *req ) { - fprintf( stderr, " ckey=%lx,", req->ckey ); - fprintf( stderr, " cvalue=%lx,", req->cvalue ); - fprintf( stderr, " information=%lx,", req->information ); + fprintf( stderr, " ckey=" ); + dump_uint64( &req->ckey ); + fprintf( stderr, "," ); + fprintf( stderr, " cvalue=" ); + dump_uint64( &req->cvalue ); + fprintf( stderr, "," ); + fprintf( stderr, " information=%08x,", req->information ); fprintf( stderr, " status=%08x", req->status ); } @@ -3776,15 +3799,18 @@ static void dump_set_completion_info_request( const struct set_completion_info_r { fprintf( stderr, " handle=%04x,", req->handle ); fprintf( stderr, " chandle=%04x,", req->chandle ); - fprintf( stderr, " ckey=%lx", req->ckey ); + fprintf( stderr, " ckey=" ); + dump_uint64( &req->ckey ); } static void dump_add_fd_completion_request( const struct add_fd_completion_request *req ) { fprintf( stderr, " handle=%04x,", req->handle ); - fprintf( stderr, " cvalue=%lx,", req->cvalue ); + fprintf( stderr, " cvalue=" ); + dump_uint64( &req->cvalue ); + fprintf( stderr, "," ); fprintf( stderr, " status=%08x,", req->status ); - fprintf( stderr, " information=%lx", req->information ); + fprintf( stderr, " information=%08x", req->information ); } static void dump_get_window_layered_info_request( const struct get_window_layered_info_request *req ) diff --git a/tools/make_requests b/tools/make_requests index 214ade471ca..d21d79df837 100755 --- a/tools/make_requests +++ b/tools/make_requests @@ -29,7 +29,6 @@ my %formats = "unsigned char" => [ 1, 1, "%02x" ], "unsigned short"=> [ 2, 2, "%04x" ], "unsigned int" => [ 4, 4, "%08x" ], - "unsigned long" => [ 4, 4, "%lx" ], "void*" => [ 4, 4, "%p" ], "data_size_t" => [ 4, 4, "%u" ], "obj_handle_t" => [ 4, 4, "%04x" ], @@ -38,15 +37,17 @@ my %formats = "process_id_t" => [ 4, 4, "%04x" ], "thread_id_t" => [ 4, 4, "%04x" ], "lparam_t" => [ 4, 4, "%lx" ], + "apc_param_t" => [ 8, 8, "&dump_uint64" ], + "file_pos_t" => [ 8, 8, "&dump_uint64" ], + "mem_size_t" => [ 8, 8, "&dump_uint64" ], "timeout_t" => [ 8, 8, "&dump_timeout" ], "rectangle_t" => [ 16, 4, "&dump_rectangle" ], "char_info_t" => [ 4, 2, "&dump_char_info" ], - "apc_call_t" => [ 32, 4, "&dump_apc_call" ], - "apc_result_t" => [ 28, 4, "&dump_apc_result" ], - "async_data_t" => [ 28, 4, "&dump_async_data" ], + "apc_call_t" => [ 40, 8, "&dump_apc_call" ], + "apc_result_t" => [ 40, 8, "&dump_apc_result" ], + "async_data_t" => [ 28, 8, "&dump_async_data" ], "luid_t" => [ 8, 4, "&dump_luid" ], "ioctl_code_t" => [ 4, 4, "&dump_ioctl_code" ], - "file_pos_t" => [ 8, 8, "&dump_file_pos" ], ); my @requests = (); diff --git a/tools/widl/proxy.c b/tools/widl/proxy.c index 95651fcfe73..dc3c1ae2015 100644 --- a/tools/widl/proxy.c +++ b/tools/widl/proxy.c @@ -249,7 +249,7 @@ static void free_variable( const var_t *arg, const char *local_var_prefix ) iid = get_attrp( arg->attrs, ATTR_IIDIS ); if( iid ) { - print_proxy( "__frame->_StubMsg.MaxCount = (unsigned long) " ); + print_proxy( "__frame->_StubMsg.MaxCount = (ULONG_PTR) " ); write_expr(proxy, iid, 1, 1, NULL, NULL, local_var_prefix); print_proxy( ";\n\n" ); } diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 051d2e872e2..9d55d19a26f 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -2676,8 +2676,8 @@ void print_phase_basetype(FILE *file, int indent, const char *local_var_prefix, } if (phase == PHASE_MARSHAL) - print_file(file, indent, "MIDL_memset(__frame->_StubMsg.Buffer, 0, (0x%x - (long)__frame->_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1); - print_file(file, indent, "__frame->_StubMsg.Buffer = (unsigned char *)(((long)__frame->_StubMsg.Buffer + %u) & ~0x%x);\n", + print_file(file, indent, "MIDL_memset(__frame->_StubMsg.Buffer, 0, (0x%x - (ULONG_PTR)__frame->_StubMsg.Buffer) & 0x%x);\n", alignment, alignment - 1); + print_file(file, indent, "__frame->_StubMsg.Buffer = (unsigned char *)(((ULONG_PTR)__frame->_StubMsg.Buffer + %u) & ~0x%x);\n", alignment - 1, alignment - 1); if (phase == PHASE_MARSHAL) @@ -2759,14 +2759,14 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char { if (type->size_is) { - print_file(file, indent, "__frame->_StubMsg.MaxCount = (unsigned long)"); + print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)"); write_expr(file, type->size_is, 1, 1, NULL, NULL, local_var_prefix); fprintf(file, ";\n\n"); } if (type->length_is) { - print_file(file, indent, "__frame->_StubMsg.Offset = (unsigned long)0;\n"); /* FIXME */ - print_file(file, indent, "__frame->_StubMsg.ActualCount = (unsigned long)"); + print_file(file, indent, "__frame->_StubMsg.Offset = 0;\n"); /* FIXME */ + print_file(file, indent, "__frame->_StubMsg.ActualCount = (ULONG_PTR)"); write_expr(file, type->length_is, 1, 1, NULL, NULL, local_var_prefix); fprintf(file, ";\n\n"); } @@ -2777,7 +2777,7 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char { if (is_conformance_needed_for_phase(phase)) { - print_file(file, indent, "__frame->_StubMsg.MaxCount = (unsigned long)"); + print_file(file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR)"); write_expr(file, get_attrp(var->attrs, ATTR_SWITCHIS), 1, 1, NULL, NULL, local_var_prefix); fprintf(file, ";\n\n"); } @@ -2789,7 +2789,7 @@ static void write_parameter_conf_or_var_exprs(FILE *file, int indent, const char if (is_conformance_needed_for_phase(phase) && (iid = get_attrp( var->attrs, ATTR_IIDIS ))) { - print_file( file, indent, "__frame->_StubMsg.MaxCount = (unsigned long) " ); + print_file( file, indent, "__frame->_StubMsg.MaxCount = (ULONG_PTR) " ); write_expr( file, iid, 1, 1, NULL, NULL, local_var_prefix ); fprintf( file, ";\n\n" ); } @@ -3215,7 +3215,7 @@ int write_expr_eval_routines(FILE *file, const char *iface) print_file (file, 1, "%s *%s = (%s *)(pStubMsg->StackTop - %u);\n", name, var_name, name, eval->baseoff); print_file(file, 1, "pStubMsg->Offset = 0;\n"); /* FIXME */ - print_file(file, 1, "pStubMsg->MaxCount = (unsigned long)"); + print_file(file, 1, "pStubMsg->MaxCount = (ULONG_PTR)"); write_expr(file, eval->expr, 1, 1, var_name_expr, eval->structure, ""); fprintf(file, ";\n"); print_file(file, 0, "}\n\n"); diff --git a/tools/winapi/winapi.pm b/tools/winapi/winapi.pm index 8c552e5b41e..f5279e15827 100644 --- a/tools/winapi/winapi.pm +++ b/tools/winapi/winapi.pm @@ -279,9 +279,10 @@ sub parse_spec_file($$) { } my $ordinal; + my $ARCHES="alpha|i386|powerpc|sparc|x86_64"; if(/^(\d+|@)\s+ (pascal|stdcall|cdecl|varargs)\s+ - ((?:(?:-noname|-norelay|-i386|-ret16|-ret64|-register|-interrupt|-private)\s+)*)(\S+)\s*\(\s*(.*?)\s*\)\s*(\S*)$/x) + ((?:(?:-arch=(?:$ARCHES)(?:,(?:$ARCHES))*|-noname|-norelay|-i386|-ret16|-ret64|-register|-interrupt|-private)\s+)*)(\S+)\s*\(\s*(.*?)\s*\)\s*(\S*)$/x) { my $calling_convention = $2; my $flags = $3; @@ -396,7 +397,7 @@ sub parse_spec_file($$) { } } } - } elsif(/^(\d+|@)\s+stub(?:\s+(-noname|-norelay|-i386|-ret16|-ret64|-private))?\s+(\S+)$/) { + } elsif(/^(\d+|@)\s+stub(?:\s+(-arch=(?:$ARCHES)(?:,(?:$ARCHES))*|-noname|-norelay|-i386|-ret16|-ret64|-private))?\s+(\S+)$/) { $ordinal = $1; my $flags = $2; diff --git a/tools/wine.inf.in b/tools/wine.inf.in index 4756d7d1b3b..a95f1a8119f 100644 --- a/tools/wine.inf.in +++ b/tools/wine.inf.in @@ -2227,6 +2227,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,shdocvw.dll,1 11,,urlmon.dll,1 11,,wintrust.dll,1 +11,,wuapi.dll,1 [FakeDllsSection] ; create some directories first @@ -2263,6 +2264,7 @@ HKLM,%CurrentVersion%\Telephony\Country List\998,"SameAreaRule",,"G" 11,,dsound.vxd 11,,gdi32.dll 11,,glu32.dll +11,,hal.dll 11,,hhctrl.ocx 11,,imaadp32.acm 11,,imagehlp.dll diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 2698430d897..4d52626c747 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -1192,45 +1192,64 @@ void output_stubs( DLLSPEC *spec ) output( "\t%s\n", func_declaration(name) ); output( "%s:\n", asm_name(name) ); - /* flesh out the stub a bit to make safedisc happy */ - output(" \tnop\n" ); - output(" \tnop\n" ); - output(" \tnop\n" ); - output(" \tnop\n" ); - output(" \tnop\n" ); - output(" \tnop\n" ); - output(" \tnop\n" ); - output(" \tnop\n" ); - output(" \tnop\n" ); - - output( "\tsubl $4,%%esp\n" ); - if (UsePIC) + switch (target_cpu) { - output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") ); - output( "1:" ); - if (exp_name) + case CPU_x86: + /* flesh out the stub a bit to make safedisc happy */ + output(" \tnop\n" ); + output(" \tnop\n" ); + output(" \tnop\n" ); + output(" \tnop\n" ); + output(" \tnop\n" ); + output(" \tnop\n" ); + output(" \tnop\n" ); + output(" \tnop\n" ); + output(" \tnop\n" ); + + output( "\tsubl $4,%%esp\n" ); + if (UsePIC) { - output( "\tleal .L%s_string-1b(%%eax),%%ecx\n", name ); + output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") ); + output( "1:" ); + if (exp_name) + { + output( "\tleal .L%s_string-1b(%%eax),%%ecx\n", name ); + output( "\tpushl %%ecx\n" ); + count++; + } + else + output( "\tpushl $%d\n", odp->ordinal ); + output( "\tleal .L__wine_spec_file_name-1b(%%eax),%%ecx\n" ); output( "\tpushl %%ecx\n" ); - count++; } else - output( "\tpushl $%d\n", odp->ordinal ); - output( "\tleal .L__wine_spec_file_name-1b(%%eax),%%ecx\n" ); - output( "\tpushl %%ecx\n" ); - } - else - { + { + if (exp_name) + { + output( "\tpushl $.L%s_string\n", name ); + count++; + } + else + output( "\tpushl $%d\n", odp->ordinal ); + output( "\tpushl $.L__wine_spec_file_name\n" ); + } + output( "\tcall %s\n", asm_name("__wine_spec_unimplemented_stub") ); + break; + case CPU_x86_64: + output( "\tleaq .L__wine_spec_file_name(%%rip),%%rdi\n" ); if (exp_name) { - output( "\tpushl $.L%s_string\n", name ); + output( "leaq .L%s_string(%%rip),%%rsi\n", name ); count++; } else - output( "\tpushl $%d\n", odp->ordinal ); - output( "\tpushl $.L__wine_spec_file_name\n" ); + output( "\tmovq $%d,%%rsi\n", odp->ordinal ); + output( "\tsubq $8,%%rsp\n" ); + output( "\tcall %s\n", asm_name("__wine_spec_unimplemented_stub") ); + break; + default: + assert(0); } - output( "\tcall %s\n", asm_name("__wine_spec_unimplemented_stub") ); output_function_size( name ); } diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c index 84281c51b6a..ee39dcff71d 100644 --- a/tools/winebuild/parser.c +++ b/tools/winebuild/parser.c @@ -377,7 +377,7 @@ static int parse_spec_stub( ORDDEF *odp, DLLSPEC *spec ) { odp->u.func.arg_types[0] = '\0'; odp->link_name = xstrdup(""); - odp->flags |= FLAG_CPU(CPU_x86); /* don't bother generating stubs for Winelib */ + odp->flags |= FLAG_CPU(CPU_x86) | FLAG_CPU(CPU_x86_64); /* don't bother generating stubs for Winelib */ return 1; } diff --git a/tools/wrc/newstruc.c b/tools/wrc/newstruc.c index e35c33218bb..ec9abc4bcd4 100644 --- a/tools/wrc/newstruc.c +++ b/tools/wrc/newstruc.c @@ -745,21 +745,21 @@ static void handle_ani_icon(riff_tag_t *rtp, enum res_e type, int isswapped) if(type == res_anicur && ctype != 2 && !once) { - parser_warning("Animated cursor contains invalid \"icon\" tag cursor-file (%d->%s)", + parser_warning("Animated cursor contains invalid \"icon\" tag cursor-file (%d->%s)\n", ctype, ctype == 1 ? "icontype" : "?"); once++; } else if(type == res_aniico && ctype != 1 && !once) { - parser_warning("Animated icon contains invalid \"icon\" tag icon-file (%d->%s)", + parser_warning("Animated icon contains invalid \"icon\" tag icon-file (%d->%s)\n", ctype, ctype == 2 ? "cursortype" : "?"); once++; } else if(ctype != 1 && ctype != 2 && !once) { - parser_warning("Animated %s contains invalid \"icon\" tag file-type (%d; neither icon nor cursor)", anistr, ctype); + parser_warning("Animated %s contains invalid \"icon\" tag file-type (%d; neither icon nor cursor)\n", anistr, ctype); once++; } @@ -811,7 +811,7 @@ static void handle_ani_list(riff_tag_t *lst, enum res_e type, int isswapped) rtp = NEXT_TAG(rtp); } else - internal_error(__FILE__, __LINE__, "Unknown tag \"%c%c%c%c\" in RIFF file", + internal_error(__FILE__, __LINE__, "Unknown tag \"%c%c%c%c\" in RIFF file\n", isprint(rtp->tag[0]) ? rtp->tag[0] : '.', isprint(rtp->tag[1]) ? rtp->tag[1] : '.', isprint(rtp->tag[2]) ? rtp->tag[2] : '.', @@ -921,7 +921,7 @@ ani_curico_t *new_ani_curico(enum res_e type, raw_data_t *rd, int *memopt) rtp = NEXT_TAG(rtp); } else - internal_error(__FILE__, __LINE__, "Unknown tag \"%c%c%c%c\" in RIFF file", + internal_error(__FILE__, __LINE__, "Unknown tag \"%c%c%c%c\" in RIFF file\n", isprint(rtp->tag[0]) ? rtp->tag[0] : '.', isprint(rtp->tag[1]) ? rtp->tag[1] : '.', isprint(rtp->tag[2]) ? rtp->tag[2] : '.', -- 2.11.4.GIT