diff -urN wine-20041201/ANNOUNCE wine-20050111/ANNOUNCE --- wine-20041201/ANNOUNCE 2004-12-01 18:27:33.000000000 +0100 +++ wine-20050111/ANNOUNCE 2005-01-11 20:08:58.000000000 +0100 @@ -1,13 +1,14 @@ -This is release 20041201 of Wine, a free implementation of Windows on +This is release 20050111 of Wine, a free implementation of Windows on Unix. This is still a developers only release. There are many bugs and unimplemented features. Most applications still do not work correctly. -WHAT'S NEW with Wine-20041201: (see ChangeLog for details) - - Implementation of the RSAENH dll. - - More work on the Direct3D 9 architecture. - - Builtin debugger improvements. - - Reorganisation of the Developer's Guide. +WHAT'S NEW with Wine-20050111: (see ChangeLog for details) + - Many OLE bug fixes and improvements. + - A lot more work on the MSI dll. + - Update regions now handled in the Wine server. + - Beginnings of typelib generation in the IDL compiler. + - Many janitorial cleanups. - Lots of bug fixes. See the README file in the distribution for installation instructions. @@ -16,8 +17,8 @@ the release is available at the ftp sites. The sources will be available from the following locations: - http://www.ibiblio.org/pub/Linux/ALPHA/wine/development/Wine-20041201.tar.gz - http://prdownloads.sourceforge.net/wine/Wine-20041201.tar.gz + http://www.ibiblio.org/pub/Linux/ALPHA/wine/development/Wine-20050111.tar.gz + http://prdownloads.sourceforge.net/wine/Wine-20050111.tar.gz It should also be available from any other site that mirrors ibiblio.org. These locations also hold pre-built documentation packages in various diff -urN wine-20041201/ChangeLog wine-20050111/ChangeLog --- wine-20041201/ChangeLog 2004-12-01 18:27:33.000000000 +0100 +++ wine-20050111/ChangeLog 2005-01-11 20:08:58.000000000 +0100 @@ -1,4 +1,2547 @@ ---------------------------------------------------------------- +2005-01-11 Alexandre Julliard + + * dlls/dmime/audiopath.c, dlls/dmime/dmime_main.c, dlls/dmime/graph.c, + dlls/dmime/lyricstrack.c, dlls/dmime/markertrack.c, + dlls/dmime/paramcontroltrack.c, dlls/dmime/patterntrack.c, + dlls/dmime/performance.c, dlls/dmime/segment.c, + dlls/dmime/segmentstate.c, dlls/dmime/segtriggertrack.c, + dlls/dmime/seqtrack.c, dlls/dmime/sysextrack.c, + dlls/dmime/tempotrack.c, dlls/dmime/timesigtrack.c, + dlls/dmime/tool.c, dlls/dmime/wavetrack.c: + Paul Vriens + - use Interlocked* functions in AddRef and Release. + - store the result of the Interlocked functions and use only this. + + * dlls/ntdll/loader.c: Mike Hearn + Give a more informative error when a DLL fails to initialize during + startup. + + * dlls/user/menu.c: Dmitry Timoshkov + Make Alt press/release test actually pass for not managed windows. + + * dlls/dplayx/dpclassfactory.c, dlls/msi/msi.c: + Paul Vriens + Use Interlocked* functions in AddRef and Release. + + * dlls/user/tests/msg.c: Dmitry Timoshkov + Fix WmCreateCustomDialogSeq message sequence for 256 color mode. + + * dlls/ole32/compobj.c: Bill Medland + Corrected testing for multithreaded (based upon observations by Paul + Vriens, Christian Costa and Robert Shearman). + Added TRACE for investigating OXID errors. + + * dlls/quartz/regsvr.c: Paul Vriens + Add an extra class to register. + + * dlls/user/painting.c, dlls/x11drv/desktop.c, server/window.c: + Desktop window is repainted on WM_ERASEBKGND, it must never get a + WM_PAINT. + + * dlls/x11drv/event.c: Warning fix. + + * dlls/user/comm16.c: Andreas Mohr + Read/write completion functions get Windows error codes, not NT status + codes. + + * dlls/user/user_private.h, dlls/x11drv/clipboard.c, + dlls/x11drv/x11drv.h, windows/clipboard.c: + Jacek Caban + Get rid of W->A calls. + + * dlls/kernel/file.c: Rein Klazes + memicmpW() count are WCHAR's not bytes. Fixes opening CON device. + + * dlls/ole32/storage32.c, dlls/ole32/tests/storage32.c: + Mike McCormack + Tests and fixes for StgOpenStorage. + + * dlls/dmime/performance.c: Christian Costa + Wait until the thread has created its message queue before posting a + message otherwise it will be lost. + + * include/wine/library.h, include/wine/port.h, libs/wpp/preproc.c: + Rémi Assailly + Added missing declarations in some headers. + + * dlls/ole32/tests/marshal.c: Robert Shearman + Add tests for trying to unmarshal from a bad stream and for testing + what interfaces the proxy exposes. + + * dlls/ole32/compobj_private.h, dlls/ole32/marshal.c, dlls/ole32/rpc.c, + dlls/ole32/stubmanager.c: + Robert Shearman + - Document how thread-safety is ensured for each member of the + stub_manager and ifstub structs. + - Make stub_manager ref counted to ensure it doesn't get freed whilst + it is still being used. + - ifstubs are now freed only when the controlling stub_manager is freed. + - Rename stub_manager_ref/unref to stub_manager_ext_addref/release + respectively and make then take an unsigned long to prevent + malicious callers from passing in a negative value and corrupting + the ref count. + + * windows/defwnd.c: Dmitry Timoshkov + Add more tests for keyboard/menu activation behaviour, make the tests + pass under Wine. + + * dlls/ole32/stg_stream.c, dlls/ole32/storage32.c, + dlls/ole32/tests/storage32.c: + Mike McCormack + Test and fix a few problems with OLE storage streams. + + * documentation/ole.sgml: Bill Medland + Minor typo correction and term expansion changes. + + * dlls/kernel/profile.c: Robert Shearman + - Don't use an invalid file handle. In this case invalid file handle + means that the file hasn't yet been created. + - Only call GetFileTime when we are being logged for a tiny + performance improvement. + - Reindent to 4 spaces. + + * dlls/comctl32/monthcal.c: Robert Shearman + Use the DrawFocusRect function to draw the focus rect, instead of a + broken home-brewed solution. + + * dlls/shell32/brsfolder.c: Robert Shearman + Don't sort the children of My Computer in shell browse for folder + dialog. + + * dlls/comctl32/treeview.c: Robert Shearman + Don't highlight text in non-TVS_TRACKSELECT mode. + + * tools/winemaker: Francois Gouget + Fix dll handling. + Take DLL_PATH and LIBRARIES into account. + Simplify a check for paths that don't start with a '/'. + + * tools/widl/typelib_struct.h, tools/widl/write_msft.c: + Huw Davies + Add help* attributes for typeinfos and functions. + + * dlls/user/menu.c, dlls/user/tests/msg.c: + Dmitry Timoshkov + Add more tests for keyboard/menu activation behaviour, make the tests + pass under Wine. + +2005-01-10 Alexandre Julliard + + * dlls/user/listbox.c, dlls/user/tests/listbox.c: + Lauri Tulmin + Fixes to the handling of LBS_EXTENDEDSEL style, with tests. + + * tools/widl/parser.l, tools/widl/parser.y, tools/widl/widltypes.h, + tools/widl/write_msft.c: + Huw Davies + Add support for the help* attributes on type libraries. + + * programs/winebrowser/main.c: Rein Klazes + If the argument is a local file, pass its Unix name to the browser. + + * programs/regedit/childwnd.c, programs/regedit/edit.c, + programs/regedit/framewnd.c, programs/regedit/main.h, + programs/regedit/treeview.c: + Crestez Leonard + Implement Refresh. + Fix bug with all HKEY_ roots always showing expandable. + + * dlls/winsock/async.c, dlls/winsock/socket.c, + dlls/winsock/ws2_32.spec, include/winsock2.h: + Hans Leidekker + Stub implementations for WPUCompleteOverlappedRequest, + WSADuplicateSocketW, WSAEnumNameSpaceProviders{A,W}, WSAGetQOSByName, + WSAGetServiceClassInfo{A,W}, WSAGetServiceClassNameByClassId{A,W}, + WSALookupServiceEnd, WSALookupServiceNext{A,W}, + WSAProviderConfigChange, WSASetService{A,W}, WSCEnableNSProvider, + WSCGetProviderPath, WSCInstallNameSpace, WSCWriteProviderOrder. + Implementations for WSANtohl, WSANtohs, WSASocketA->W crosscall. + Avoid NULL dereferences in WSAStringToAddress{A,W} and + WSAAddressToString{A,W}. + + * dlls/comctl32/imagelist.c: Mike McCormack + Fix image list mask and blending. + + * dlls/msvcrt/file.c: Bill Medland + Only report the unsupported flags. + Keep quiet about hints. + + * dlls/mpr/mpr.rc, dlls/mpr/mpr_En.rc, dlls/mpr/mprres.h, + dlls/mpr/nps.c: + Mike McCormack + Add proxy authentication dialog. + + * programs/winecfg/winecfg.c: Mike Hearn + Delete the \r not the \n in PRINTERROR. + + * programs/winecfg/drive.c: Mike Hearn + Do not apply changes just because QueryDosDevice reversed the + slashes. + Change an ERR to a WARN, it's common for it to occur. + + * dlls/comctl32/header.c: Evan Deaubl + GetItemA/W on header controls should handle message even if index is + invalid. + + * tools/widl/parser.y, tools/widl/widltypes.h, tools/widl/write_msft.c: + Huw Davies + Add support for optional arguments and some suppport for the + defaultvalue attributes. + Better calculation of the typeinfo's res3 member (at least for + interfaces). + + * dlls/mshtml/main.c, dlls/uuid/uuid.c, include/.cvsignore, + include/Makefile.in, include/mshtmdid.h, include/mshtml.idl, + include/olectl.h, include/uuids.h: + Jacek Caban + Added mshtml.idl. + + * dlls/ddraw/d3dtexture.c, dlls/ddraw/d3dviewport.c, + dlls/ddraw/d3ddevice/mesa.c, dlls/mapi32/prop.c, + dlls/mapi32/tests/prop.c, dlls/msi/action.c, dlls/msi/tests/db.c, + dlls/msi/tests/record.c, include/oleauto.h: + Francois Gouget + Assorted spelling fixes. + + * configure, configure.ac, dlls/winmm/winealsa/Makefile.in, + dlls/winmm/winealsa/audio.c, dlls/winmm/winealsa/audio_05.c, + dlls/winmm/winealsa/midi.c, include/config.h.in: + Vincent Béron + Only use Alsa if 1.0 is detected. + + * dlls/commdlg/colordlg.c, dlls/commdlg/filedlg.c, + dlls/commdlg/filedlgbrowser.h: + Jacek Caban + Get rid of W->A calls. + + * tools/widl/write_msft.c: Huw Davies + Add support for hidden, restricted and version attributes on + typeinfos. + + * dlls/oleaut32/typelib2.c: Another warning fix. + + * dlls/gdi/dc.c, dlls/gdi/gdi_private.h: + Rémi Assailly + Implemented GetLayout and SetLayout. + + * dlls/rsaenh/rsaenh.c: Michael Jung + Support for generating and exporting PCT1, SSL2/3 and TLS1 master + secrets. Ensure that these are not used in CPEncrypt, CPDecrypt or + CPDeriveKey. + + * dlls/rsaenh/implglue.c: Michael Jung + Removed check for valid'ness of algid. It's redundant. + + * include/wincrypt.h: Michael Jung + Added SCHANNEL_ALG typedef. + Corrected struct tag in HMAC_INFO typedef. + + * dlls/ole32/storage32.c, dlls/ole32/tests/storage32.c: + Mike McCormack + Test and fix StgCreateDocFile grfModes. + + * dlls/dsound/tests/capture.c, dlls/dsound/tests/ds3d.c, + dlls/dsound/tests/ds3d8.c, dlls/dsound/tests/dsound.c, + dlls/dsound/tests/dsound8.c, dlls/dsound/tests/propset.c: + Robert Reif + Remove unneeded includes. + + * dlls/amstream/amstream.c, dlls/comcat/factory.c, + dlls/comcat/information.c, dlls/comcat/manager.c, + dlls/commdlg/filedlgbrowser.c, dlls/devenum/mediacatenum.c: + Paul Vriens + - use Interlocked* functions in AddRef and Release. + - store the result of the Interlocked functions and use only this. + +2005-01-09 Alexandre Julliard + + * dlls/devenum/mediacatenum.c, dlls/quartz/enummoniker.c, + dlls/quartz/filtergraph.c, dlls/quartz/filtermapper.c: + Christian Costa + Fixed error handling in Graphbuilder_RenderFile. + Improved traces. + + * dlls/msi/record.c, dlls/msi/tests/record.c: + Mike McCormack + Implement MsiRecordSetStreamA/W and add tests for records containing + streams. + + * dlls/oleaut32/typelib2.c: Avoid warnings. + + * libs/wpp/preproc.c: Jacek Caban + - Fixed infinite loop bug. + - Code cleanup. + + * programs/winecfg/drive.c: Mike Hearn + Fix a memory management bug in apply_drive_changes to stop winecfg + deleting all the drive definitions in some cases. + + * programs/winecfg/driveui.c: Mike Hearn + Make the UI update properly when the user adds/removes drives. + + * dlls/oleaut32/typelib.c: Huw Davies + The value of a packed VARIANT can be up to 1L << 26 - 1. + + * tools/widl/parser.l, tools/widl/parser.y, tools/widl/widltypes.h, + tools/widl/write_msft.c: + Huw Davies + Add attributes control, hidden and restricted. + Correctly set the libflags for these attributes. + + * windows/winproc.c: Jacek Caban + Get rid of HEAP_strdupWtoA calls. + + * dlls/d3d8/d3d8_private.h, dlls/d3d8/directx.c, dlls/d3d8/surface.c, + dlls/d3d9/d3d9_private.h, dlls/d3d9/device.c, dlls/d3d9/directx.c, + dlls/d3d9/surface.c, dlls/wined3d/Makefile.in, + dlls/wined3d/basetexture.c, dlls/wined3d/device.c, + dlls/wined3d/directx.c, dlls/wined3d/indexbuffer.c, + dlls/wined3d/resource.c, dlls/wined3d/stateblock.c, + dlls/wined3d/surface.c, dlls/wined3d/utils.c, + dlls/wined3d/vertexbuffer.c, dlls/wined3d/wined3d_private.h, + include/d3d9types.h, include/wine/wined3d_interface.h: + Jason Edmeades + Add render target support, and ensure there is a front and back buffer + created during device creation. + + * dlls/ddraw/d3ddevice/main.c, dlls/ddraw/d3ddevice/mesa.c, + dlls/ddraw/d3dexecutebuffer.c, dlls/ddraw/d3dlight.c, + dlls/ddraw/d3dmaterial.c, dlls/ddraw/d3dvertexbuffer.c, + dlls/ddraw/d3dviewport.c, dlls/ddraw/dclipper/main.c, + dlls/ddraw/ddraw/main.c, dlls/ddraw/dpalette/main.c, + dlls/ddraw/dsurface/main.c, dlls/ddraw/main.c, + dlls/oleaut32/tests/safearray.c, dlls/oleaut32/typelib.c, + dlls/oleaut32/typelib2.c, dlls/ole32/errorinfo.c, dlls/ole32/ifs.c, + dlls/ole32/oleobj.c: + Paul Vriens + - use Interlocked* functions in AddRef and Release. + - store the result of the Interlocked functions and use only this. + + * dlls/quartz/regsvr.c: Christian Costa + Added registration for quartz filters. + + * dlls/dsound/tests/capture.c: Robert Reif + Don't need to worry about windows messages. + + * libs/wpp/wpp.c: Jacek Caban + Added initializing pp_status.input at begin of wpp_parse. + + * dlls/mapi32/prop.c, dlls/mapi32/tests/prop.c, + dlls/msacm/imaadp32/imaadp32.c, dlls/msacm/msadp32/msadp32.c, + dlls/msacm/msg711/msg711.c, dlls/msacm/pcmconverter.c, + dlls/msacm/winemp3/mpegl3.c, dlls/msrle32/msrle32.c, + dlls/ole32/ftmarshal.c, dlls/oleaut32/olepicture.c, + dlls/oleaut32/tmarshal.c, dlls/oleaut32/varformat.c, + dlls/oleaut32/variant.c, dlls/quartz/systemclock.c, + dlls/rsaenh/rsaenh.c, dlls/shdocvw/shdocvw_main.c, + dlls/shell32/shlview.c, dlls/shlwapi/string.c, + dlls/winaspi/winaspi16.c, dlls/wineps/bitmap.c, dlls/wineps/driver.c, + dlls/wineps/escape.c, dlls/x11drv/wintab.c, dlls/x11drv/xfont.c, + dlls/comctl32/comboex.c, dlls/comctl32/datetime.c, + dlls/comctl32/flatsb.c, dlls/comctl32/header.c, + dlls/comctl32/listview.c, dlls/comctl32/monthcal.c, + dlls/comctl32/nativefont.c, dlls/comctl32/pager.c, + dlls/comctl32/propsheet.c, dlls/comctl32/rebar.c, + dlls/comctl32/smoothscroll.c, dlls/comctl32/status.c, + dlls/comctl32/tab.c, dlls/comctl32/toolbar.c, + dlls/comctl32/tooltips.c, dlls/comctl32/trackbar.c, + dlls/comctl32/treeview.c, dlls/commdlg/colordlg.c, + dlls/d3d8/cubetexture.c, dlls/d3d8/texture.c, dlls/d3d8/utils.c, + dlls/d3d9/cubetexture.c, dlls/d3d9/texture.c, + dlls/d3d9/volumetexture.c, dlls/dbghelp/type.c, dlls/ddraw/mesa.c, + dlls/dmband/band.c, dlls/dmcompos/chordmap.c, dlls/dmime/audiopath.c, + dlls/dmime/graph.c, dlls/dmime/performance.c, + dlls/dmloader/container.c, dlls/dmscript/script.c, + dlls/dmstyle/style.c, dlls/dmusic/collection.c, + dlls/dsound/capture.c, dlls/dsound/propset.c, dlls/dswave/dswave.c: + Eric Pouech + Removed excessive statement (break after return or goto, not useful + break, not needed vars...) + + * dlls/user/message.c, include/winuser.h: + Vitaly Lipatov + Added handling of SBM_GETSCROLLBARINFO message. + + * dlls/dsound/tests/capture.c, dlls/dsound/tests/ds3d.c, + dlls/dsound/tests/ds3d8.c, dlls/dsound/tests/dsound.c, + dlls/dsound/tests/dsound8.c, dlls/dsound/tests/propset.c: + Robert Reif + Initialize and uninitialize COM properly. + + * dlls/commdlg/cdlg_Es.rc: José Manuel Ferrer Ortiz + Updated Spanish resource. + + * dlls/wined3d/directx.c: Oliver Stieber + Correct loop check for enum display and include 32bit modes in 24bit. + + * dlls/commdlg/cdlg.h, dlls/commdlg/cdlg_En.rc, + dlls/commdlg/cdlg_Pl.rc, dlls/commdlg/filedlg.c, + dlls/commdlg/filedlg31.c: + Jacek Caban + Moved save* strings to resources. + +2005-01-08 Alexandre Julliard + + * dlls/user/user32.spec: Huw D M Davies + Revert GetScrollBarInfo spec entry back to a stub to fix compilation + failure. + +2005-01-07 Alexandre Julliard + + * tools/c2man.pl: Create the output directory if needed. + + * dlls/Makedll.rules.in: Jon Griffiths + Use the source dir as the documentation root dir. + + * dlls/user/misc.c, dlls/user/user32.spec, include/Makefile.in, + include/winnls32.h: + Diego Pettenň + Added stub implementation for WINNLS* functions. + + * dlls/wininet/http.c, dlls/wininet/internet.c: + Diego Pettenň + Get rid of DPRINTF. + + * dlls/kernel/lcformat.c: Vincent Béron + Use GetLocalTime (tz-dependant) instead of GetSystemTime (UTC) in + GetTimeFormat. + + * dlls/msi/action.c: Aric Stewart + Make all custom type 1 actions happen in a seperate thread and close + all handles for that thread when it exits. Honors the concept of + temporary MSI handles for custom actions. + + * dlls/advapi32/registry.c, dlls/ddraw/dsurface/user.c, + dlls/dplayx/dplay.c, dlls/dplayx/dplayx_messages.c, + dlls/dplayx/dplobby.c, dlls/kernel/comm.c, dlls/kernel/sync.c, + dlls/rpcrt4/rpc_binding.c, dlls/rpcrt4/rpc_server.c, + dlls/shlwapi/thread.c, dlls/user/comm16.c, dlls/winedos/dosvm.c, + dlls/winedos/module.c, dlls/wininet/internet.c, + dlls/winmm/mciavi/mciavi.c, dlls/winmm/mciavi/mmoutput.c, + dlls/winmm/mciwave/mciwave.c, dlls/winsock/socket.c, + dlls/winsock/tests/sock.c: + Mike McCormack + Use CreateEventW in preference to CreateEventA for unnamed events. + + * dlls/quartz/regsvr.c: Paul Vriens + - Media Types (and Extensions) should use "Source Filter" instead of + "File Source". + - Removed filesource_valuename. + - Fixed typo for some class-names. + - Fixed typo in MPEG1System Media Type. + + * dlls/comctl32/treeview.c: Crestez Leonard + Fix bug with Treeview_SelectItem reselecting the same item. + + * dlls/ntdll/cdrom.c: Robert Shearman + - Add a complete, sorted listed of IOCTLS implemented in the file. + - Dump track numbers after they have been filled in. + + * dlls/ole32/compobj_private.h, dlls/ole32/marshal.c, + dlls/ole32/stubmanager.c: + Robert Shearman + Rename iid in wine_marshal_id to ipid and use IPIDs instead of IIDs in + the stub manager. + + * dlls/ole32/rpc.c: Robert Shearman + The current architecture cannot handle pipes changing address, so use + a static array. Fixes memory corruption that sometimes occurs when + using multiple pipes. + + * configure, configure.ac, dlls/capi2032/Makefile.in, + dlls/capi2032/cap20wxx.c, include/config.h.in: + Marcus Meissner + Load libcapi20.so.* dynamically on demand. + +2005-01-06 Alexandre Julliard + + * tools/widl/Makefile.in, tools/widl/hash.c, tools/widl/hash.h, + tools/widl/header.c, tools/widl/parser.y, tools/widl/typelib.c, + tools/widl/typelib.h, tools/widl/typelib_struct.h, + tools/widl/widltypes.h, tools/widl/write_msft.c: + Huw Davies + Initial support for typelib generation. + + * dlls/ntdll/file.c: Rein Klazes + On Linux, use fstatfs instead of fstatvfs. It is too buggy. + + * dlls/ole32/stubmanager.c: Robert Shearman + No need to add a reference to the apartment from new_stub_manager as + we don't hold on to an apartment pointer. + + * dlls/user/tests/msg.c: Dmitry Timoshkov + Add a windows events hook to the message test. + + * dlls/msi/handle.c: Mike McCormack + MsiCloseAllHandles only closes handles allocated in the calling + thread. + + * dlls/msi/tests/.cvsignore, dlls/msi/tests/Makefile.in, + dlls/msi/tests/record.c: + Mike McCormack + Add test for records. + + * dlls/msi/record.c: Mike McCormack + Fix records according to test cases. + + * tools/wine.inf: Vitaly Lipatov + Add VMM32Files section. + + * include/msi.h, include/msiquery.h: + Mike McCormack + Declare more functions. + + * dlls/comctl32/status.c: Ulrich Czekalla + WM_GETTEXTLENGTH should return zero for owner drawn status bars. + + * dlls/commdlg/cdlg.h, dlls/commdlg/cdlg_En.rc, + dlls/commdlg/cdlg_Pl.rc, dlls/commdlg/fontdlg.c: + Jacek Caban + Moved string to resources. + + * documentation/documentation.sgml: Dimitrie O. Paun + Prefer W to A for documentation. Prefer the non-inlined style of + documentation, it's the most commonly used one, we should standardize + on it. + + * dlls/user/sysparams.c, tools/wine.inf: + Justin Chevrier + - Obtain border size of windows from registry if available. + - Obtain icon size from registry if available. + - Create a WindowMetrics section in the default registry and populate + it with all currently supported metrics (that are setup to read from + the registry). + + * dlls/ole32/compobj.c, dlls/ole32/compobj_private.h: + Robert Shearman + - Make struct oletls ref counted so that it is only detached from the + apartment on the final CoUninitialize. + - Decrease the size of the crit sec on destroying an apartment - it is + only needed for touching the apartment list. + - Small cleanups. + + * dlls/ole32/rpc.c: Robert Shearman + ConnectNamedPipe returning ERROR_PIPE_CONNECTED is not an error. + + * dlls/quartz/avidec.c, dlls/quartz/avisplit.c, + dlls/quartz/dsoundrender.c, dlls/quartz/enumfilters.c, + dlls/quartz/enummedia.c, dlls/quartz/enummoniker.c, + dlls/quartz/enumpins.c, dlls/quartz/enumregfilters.c, + dlls/quartz/filesource.c, dlls/quartz/filtergraph.c, + dlls/quartz/filtermapper.c, dlls/quartz/memallocator.c, + dlls/quartz/pin.c, dlls/quartz/systemclock.c, + dlls/quartz/videorenderer.c: + Paul Vriens + - Use Interlocked* functions in AddRef and Release. + - Store the result of the Interlocked functions and use only this. + + * dlls/ntdll/time.c: Tony Lambregts + Add Brazilian standard time. + + * dlls/rsaenh/rsaenh.c: Michael Jung + Register rsaenh as a RSA SChannel provider. + Register rsaenh as default RSA SChannel provider. + + * dlls/msi/action.c: Aric Stewart + - Properly deformat keys written to the registry. + - Because directory mappings can change between the CostFinalize step + and the InstallFiles step we need to do a final resolution of the + target file name before installing. + +2005-01-05 Alexandre Julliard + + * tools/widl/utils.c, tools/widl/widl.c: + Huw Davies + Bring the debug functions into line with the rest of Wine by not + appending a '\n'. + + * dlls/ole32/oleproxy.c: Robert Shearman + The channel buffer can be NULL if the proxy is disconnected, so check + for this before releasing it. + + * dlls/ole32/rpc.c: Robert Shearman + - Fix race on apartment creation. + - Display errors in decimal to make searching for the meaning in + winerror.h easier. + + * dlls/ole32/compobj.c, dlls/ole32/compobj_private.h, + dlls/ole32/errorinfo.c, dlls/ole32/marshal.c, dlls/ole32/rpc.c, + dlls/ole32/stubmanager.c: + Mike Hearn + - Make apartment access thread-safe by introducing refcounting and + wider usage of the apartment lock. + - Rework OLE TLS management to eliminate uninitialised apartments and + parent chaining. + + * programs/winetest/main.c: Ferenc Wagner + Return a true boolean value (0 or 1). + + * dlls/rsaenh/rsaenh.c: Michael Jung + Added list of supported algorithms for SChannel personality. + + * dlls/msi/action.c: Aric Stewart + When checking for an existing .lnk shortcut extension on the filename + do not just search for '.' but actually verify it is '.lnk'. + + * tools/widl/parser.y, tools/widl/typelib.c, tools/widl/typelib.h, + tools/widl/widltypes.h: + Huw Davies + Store interfaces, structs, coclasses and modules that are to be + written into a typelib in a list. + + * dlls/gdi/freetype.c, dlls/gdi/gdiobj.c: + Vitaly Lipatov + Spelling fixes. + + * dlls/msi/Makefile.in, dlls/msi/package.c: + Vitaly Lipatov + Get real screen properties. + + * configure, configure.ac, dlls/msi/Makefile.in, + dlls/msi/tests/.cvsignore, dlls/msi/tests/Makefile.in, + dlls/msi/tests/db.c: + Mike McCormack + Add a simple test case for MSI databases. + + * dlls/gdi/font.c, include/wingdi.h: Vitaly Lipatov + Add description for ExtTextOut (also include comments from Shachar + Shemesh) and missed constants ETO_NUMERICSLOCAL, ETO_NUMERICSLATIN, + ETO_PDY in wingdi.h. + + * tools/winedump/search.c: Peter Berg Larsen + Fix a return type bug after allowing 'foo *functionname()' + prototypes. In 'unsigned char *functionname()' char was not seen; + therefore implicit 'unsigned int'. + + * dlls/dmstyle/dmstyle_private.h, dlls/dmstyle/style.c, + dlls/dmstyle/styletrack.c: + Raphael Junqueira + - handle StyleRefs list on DMStyleTracks + - handle PartRefs list on DMStyles + - begin of Parts list support on DMStyles (for now only some array + checks) + - fix IDirectMusicStyle::QueryInterface + + * dlls/rsaenh/rsaenh.c, dlls/rsaenh/tests/rsaenh.c: + Michael Jung + Set last error if dwFlags are non zero in CPReleaseContext. + Added corresponding test. + + * dlls/ole32/rpc.c: Mike McCormack + Allow COM to start services containing COM servers. + +2005-01-04 Alexandre Julliard + + * dlls/msi/action.c: Aric Stewart + - CustomAction 35 should call SetTargetPath not just set the property. + - TARGETDIR and SOURCEDIR may not be entries 0 in the directory + tables. So when resolving the folder we need to seek them out. + - When we handle SetTargetPath we need to be sure to recalculate the + resulting paths as things with the now set Directory as the parent + will change. + + * dlls/msi/action.c: Aric Stewart + Change how we install files so that we extract files as we need them, + cuts down on extraction time and unused files. + + * dlls/comctl32/commctrl.c, dlls/comctl32/treeview.c, + dlls/dinput/mouse.c, dlls/winmm/wineoss/midi.c: + Francois Gouget + Assorted spelling fixes. + + * dlls/gdi/gdi_private.h, dlls/gdi/printdrv.c, dlls/wineps/escape.c, + dlls/wineps/psdrv.h: + Mike McCormack + Convert StartDoc to Unicode. + + * dlls/wininet/internet.c, dlls/wininet/utility.c: + Lionel Ulmer + Fix 'SendAsyncCallback' when it's really asynchronous. + + * dlls/msvcrt/msvcrt.h, include/msvcrt/stdio.h: + Lionel Ulmer + fpos_t should be 64 bits (verified with native MSVCRT.DLL) + + * dlls/msvcrt/file.c: Lionel Ulmer + Handle buffering in fgetpos / fsetpos. + + * dlls/msi/action.c: Mike McCormack + Remove unneeded whitespace, indent correctly. + + * dlls/version/info.c, dlls/version/tests/info.c: + Robert Reif + Prevent crash from invalid last parameter in GetFileVersionInfo. + Prevent crash in VerQueryValue when return size not requested. + GetFileVersionInfo and VerQueryValue parameter tests added. + + * dlls/commdlg/cdlg_Cn.rc, dlls/commdlg/cdlg_De.rc, + dlls/commdlg/cdlg_En.rc, dlls/commdlg/cdlg_Es.rc, + dlls/commdlg/cdlg_Fr.rc, dlls/commdlg/cdlg_It.rc, + dlls/commdlg/cdlg_Pl.rc, dlls/commdlg/cdlg_Pt.rc, + dlls/commdlg/cdlg_Si.rc, dlls/commdlg/cdlg_Sv.rc, + dlls/commdlg/cdlg_Th.rc: + Robert Shearman + Change dialog templates to not explicitly specify extended window + styles for the static rects on the Page Setup dialog as the ones + specified were wrong anyway. + + * dlls/x11drv/clipboard.c, dlls/x11drv/event.c, dlls/x11drv/x11drv.h, + documentation/samples/config: + Ulrich Czekalla + Always clearAllSelections since not clearing CLIPBOARD can get us into + an odd state. + + * tools/widl/parser.y: Huw Davies + Add the precedence of the conditional operator. + + * dlls/rsaenh/rsaenh.c: Michael Jung + Always set ERROR_SUCCESS in case of success in CPAcquireContext. + + * windows/winpos.c: Huw Davies + Don't touch the rect if hwnd is invalid. + + * dlls/ole32/marshal.c: Robert Shearman + - Add tracing for proxy ref count functions. + - Release the channel on proxy destruction. + + * dlls/ole32/compobj.c: Mike Hearn + Add a DCOM todo list. + + * tools/winedump/Makefile.in, tools/winedump/emf.c, + tools/winedump/main.c, tools/winedump/winedump.h: + Mike McCormack + Extend winedump to allow dumping enhanced meta files. + + * dlls/advapi32/tests/crypt.c: Jakob Eriksson + On NT4 we can also get ERROR_RING2_STACK_IN_USE from + CryptAcquireContext(). + + * include/msi.h: Mike McCormack + Added some extra functions. + Removed parameter name for consistency with other declarations. + + * include/dce.h, windows/dce.c: + Remove the no longer needed DCE_ExcludeRgn function and + DCX_KEEPCLIPRGN style. + + * dlls/user/painting.c: + Use the DC origin to map coordinates in ExcludeUpdateRgn instead of + calling an internal DCE function. + + * dlls/ntdll/error.c, dlls/ntdll/heap.c, dlls/ntdll/ntdll.spec, + include/thread.h, include/winternl.h: + Fixed the FIXME in RtlNtStatusToDosError, and implemented + RtlGetLastNtStatus and RtlSetLastWin32ErrorAndNtStatusFromNtStatus. + + * dlls/ntdll/virtual.c, server/mapping.c: + Support mapping non page-aligned binaries for SEC_IMAGE mappings. + + * dlls/ole32/compobj.c, dlls/ole32/compobj_private.h, + dlls/ole32/marshal.c: + Robert Shearman + Implement proxy manager. + + * documentation/PACKAGING: Marcus Meissner + Removed whitespace at end of lines, updated a bit. + + * include/amstream.idl, include/ddstream.idl, include/mmstream.idl: + Jacek Caban + Uncommented 'optional' attributes. + + * include/Makefile.in, include/cfgmgr32.h: + Mike McCormack + Add cfgmgr32.h header. + + * windows/cursoricon.c: Ulrich Czekalla + When loading a bitmap into a dibsection the result cannot be + compressed. + + * windows/defwnd.c: Aric Stewart + Handle IME messages in the default unicode window procedure too. + + * documentation/compiling.sgml: Dimitrie O. Paun + Augment the compiling documentatin with the actual commands. + + * documentation/wine-devel.sgml: Dimitrie O. Paun + Hide authors, we don't know how to format them. + + * documentation/getting.sgml: Dimitrie O. Paun + Remove bashing of packages, value judgments. + + * documentation/README.de, documentation/README.fr, + documentation/README.it, documentation/README.pt, + documentation/README.pt_br: + Vincent Béron + Keep all REAMDEs in sync. + + * dlls/user/static.c: Robert Shearman + Fix colours used for SS_*RECT, SS_*FRAME. + + * dlls/rsaenh/rsaenh.c: Michael Jung + Added support for machine keysets. + + * dlls/ole32/oleproxy.c: Robert Shearman + Make the ClassFactory proxy support aggregation. + +2005-01-03 Alexandre Julliard + + * dlls/dciman32/dciman32.spec, dlls/ddraw/ddraw.spec, + dlls/user/user.exe.spec, dlls/version/version.spec, + dlls/winmm/winmm.spec: + Get rid of the ThunkData stubs, these are not functions. + + * dlls/avifil32/Makefile.in, dlls/avifil32/avifil32.spec, include/vfw.h: + Fixed CLSID_AVISimpleUnMarshal export. + + * dlls/rasapi32/rasapi.c, dlls/rasapi32/rasapi32.spec: + Avoid dumping the contents of output strings. + + * dlls/unicows/main.c, dlls/unicows/unicows.spec: + Hans Leidekker + Remove most remaining stubs from unicows. + + * dlls/shell32/iconcache.c, dlls/shell32/shell32.spec, + dlls/shell32/shellord.c, include/shellapi.h, include/shlobj.h: + Hans Leidekker + Stub implementations for SHUpdateImageA, SHHandleUpdateImage, + SHObjectProperties, SHGetNewLinkInfo{A,W}, SHStartNetConnectionDialog, + SHEmptyRecycleBin{A,W}, SHFormatDrive, SHQueryRecycleBin{A,W}. + 'HeapAlloc can fail' fix for ExtractIconExA. + Implement ExtractAssociatedIconA -> W. + Correct prototype for SHObjectProperties. + Forward SHGetNewLinkInfo to SHGetNewLinkInfoA. + + * dlls/winspool/info.c, dlls/winspool/winspool.drv.spec: + Hans Leidekker + Stub implementations for AddMonitorW, DeletePrinterDriverW, + DeleteMonitorW, DeletePortW, GetPrintProcessorDirectoryW, + AddPrintProcessor{A,W}, AddPrintProvidor{A,W}, + AdvancedDocumentProperties{A,W}, EnumPortsW, AddPort{A,W}, + ConfigurePort{A,W}, DeletePrintProcessor{A,W}, + DeletePrintProvidor{A,W}, EnumPrintProcessorDatatypes{A,W}, + GetJob{A,W}. + + * dlls/quartz/avidec.c, dlls/quartz/avisplit.c, + dlls/quartz/filtergraph.c, dlls/quartz/pin.c: + Christian Costa + Implemented IMediaControl_Run that explores the graph, counts + renderers and starts filters. + Better implementation of IBaseFilter_Run for AVI SPlitter and AVI + Decompressor. + Use the standard memory allocator when an output pin does not provide + any allocator. + Set allocator properties for AVI Decompressor output pin and update + the buffers size at connection time. + + * dlls/shlwapi/string.c: Jacek Caban + Get rid of W->A calls. + + * dlls/gdi/tests/gdiobj.c: Jakob Eriksson + Add return value to GetObject error message. + + * tools/winedump/function_grep.pl: Peter Berg Larsen + Currently a '//****' is matched as an /* comment - disallow a '/' in + front of the '/*' match. An 'extern "C" {' can be split in several + lines - allow '\n' as space, and lookout for the rest if partial + found. + + * tools/winedump/search.c: Peter Berg Larsen + In function_grep.pl and symbol.c/symbol_clean_string spaces between + the function name and * are removed. Fx. the type 'void * foo()' is + returned as 'void *foo()'. Recognized this as a valid prototype in + symbol_search. + + * tools/winedump/symbol.c: Peter Berg Larsen + Added the word "FLOAT" to be recognized as argument type float. + + * include/dplobby.h: Peter Berg Larsen + Define DirectPlayLobbyCreate to be either the W or A version. + + * include/wincrypt.h: Michael Jung + Added some defines concerning SChannel CSPs. + + * dlls/rsaenh/implglue.c: Michael Jung + Adhere to const'ness of the input data in encrypt_block_impl. + + * dlls/comctl32/tab.c: Vitaly Lipatov + Add comments, fix negative value from GetCurFocus. + + * windows/user.c: + Use ExitProcess to terminate the process in ExitWindowsEx so that it + gets a chance to clean things up. + + * dlls/advapi32/advapi32.spec: Mike McCormack + Add some missing declarations in the spec file. + + * dlls/shlwapi/ordinal.c: Jacek Caban + Get rid of W->A calls. + + * dlls/winedos/dosvm.c, dlls/winedos/interrupts.c, dlls/winedos/vxd.c: + Diego Pettenň + Get rid of DPRINTF. + + * dlls/msi/action.c: Aric Stewart + Improve progress bar tracking. + + * tools/winedump/le.c, tools/winedump/winedump.h: Warning fixes. + + * dlls/advapi32/advapi.c, dlls/advapi32/advapi32.spec, + dlls/advapi32/security.c, dlls/advapi32/service.c, + include/lmserver.h, include/ntsecapi.h, include/winbase.h, + include/winsvc.h: + Hans Leidekker + Stub implementations for GetKernelObjectSecurity, + GetPrivateObjectSecurity, GetServiceKeyName{A,W}, + ImpersonateNamedPipeClient, InitiateSystemShutdown{A,W}, + IsTokenRestricted, LogonUser{A,W}, LookupAccountNameW, + LookupPrivilegeDisplayName{A,W}, MapGenericMask, + ObjectCloseAuditAlarm{A,W}, ObjectOpenAuditAlarm{A,W}, + ObjectPrivilegeAuditAlarm{A,W}, PrivilegedServiceAuditAlarm{A,W}, + QueryServiceLockStatus{A,W}, SetAclInformation, + SetPrivateObjectSecurity, SetSecurityDescriptorControl, + SetServiceBits, LsaSetInformationPolicy, LsaLookupNames, + LsaEnumerateTrustedDomains. + + * dlls/shlwapi/ordinal.c: Jon Griffiths + Documentation fix. + + * dlls/shlwapi/tests/path.c, dlls/shlwapi/url.c: + Hans Leidekker + Implement and test URLIS_URL flag in UrlIs(). + + * dlls/quartz/regsvr.c: Christian Costa + Added registration/unregistration of media types. + + * dlls/mapi32/mapi32.spec, dlls/mapi32/prop.c, + dlls/mapi32/tests/prop.c, dlls/mapi32/util.c: + Jon Griffiths + Implement CreateIProp & most of MAPI's IMAPIProp & IPropData ifaces. + Implement FBadEntryList and make FBadProp use it. + Test CreateIProp, start of tests for IPropData interface. + + * dlls/user/misc.c, dlls/user/user32.spec, include/winuser.h: + Hans Leidekker + Stub implementations for GetAltTabInfo{A,W}. + Forward GetAltTabInfo to GetAltTabInfoA. + + * dlls/user/sysparams.c: Justin Chevrier + Converted system metrics to Unicode. + + * windows/user.c: Francois Gouget + - If given the EWX_FORCE flag, ExitWindowsEx() should not send the + WM_{QUERY}ENDSESSION messages. + - Add support for EWX_FORCEIFHUNG. + - ExitWindowsEx() should return true if it succeeds, even if the user + cancels the shutdown. + - Don't crash if there are no windows. + + * dlls/msi/msi.c, dlls/msi/msi.spec: + Steven Edwards + Add and fix some stubs. + + * LICENSE, include/wine/wine_common_ver.rc: + Ivan Leo Puoti + Update copyright info for the new year. + + * dlls/user/hook.c: Jacek Caban + Get rid of HEAP_strdupWtoA calls. + + * dlls/msi/action.c: Aric Stewart + Be sure that set paths are terminated with a backslash. + + * dlls/advapi32/eventlog.c, dlls/dbghelp/coff.c, + dlls/dmime/performance.c, dlls/kernel/profile.c, + dlls/kernel/resource.c, dlls/ole32/bindctx.c, + dlls/oleaut32/typelib2.c, dlls/wineps/type42.c, dlls/wininet/ftp.c, + dlls/wininet/http.c, dlls/winmm/wineoss/mixer.c, + dlls/x11drv/xrender.c: + Michael Stefaniuc + Do not check for non NULL pointer before HeapFree'ing it. It's + redundant. + + * dlls/gdi/enhmetafile.c, dlls/msvcrt/cpp.c, dlls/oleaut32/safearray.c: + Eric Pouech + Some missing const correctness fixes. + + * tools/winedump/Makefile.in, tools/winedump/le.c, tools/winedump/pe.c: + Robert Reif + Added partial VxD support. + + * windows/clipboard.c: Ulrich Czekalla + Add comment about CLIPBOARD_SetClipboardOwner. + + * dlls/dmband/dmutils.c: Dimitrie O. Paun + Debug fixes and cleanup. + + * documentation/README.es, programs/winefile/Es.rc: + José Manuel Ferrer Ortiz + Added Spanish translation. + + * programs/winecfg/appdefaults.c, programs/winecfg/winecfg.c: + Mike Hearn + - Finish off the "Remove Application" button. + - Allow removal of keys from the overlay. + - One or two whitespace fixes. + + * dlls/x11drv/keyboard.c: Dmitry Timoshkov + - Do not print FIXME in X11DRV_GetKeyboardLayout if dwThreadid + identifies current thread. + - Make X11DRV_GetKeyboardLayoutList follow the same rule as + X11DRV_GetKeyboardLayout and X11DRV_GetKeyboardLayoutName for CJK + locales. + - There is no need to have 0xe001 in the high word of Japanese + keyboard layouts lcids in main_key_tab, the above APIs take care of + it. + - High word of a returned keyboard layout duplicates low word for non + CJK locales under Windows. + + * dlls/kernel/sync.c, dlls/ntdll/file.c, dlls/ntdll/rtl.c: + Eric Pouech + Fixed some regressions from the previous change. + + * dlls/ddraw/ddraw/main.c, dlls/ddraw/dsurface/dib.c: + Christian Costa + Handle correctly DDSD_LINEARSIZE flag for FOURCC textures. + + * dlls/user/tests/listbox.c: Dimitrie O. Paun + Add test for the listbox item height. + + * dlls/itss/itss.c, dlls/itss/moniker.c, dlls/itss/storage.c: + Jacek Caban + Implemented DllCanUnloadNow. + + * dlls/shell32/shell32_main.c: Jacek Caban + Get rid of W->A call. + + * programs/winedbg/winedbg.man: + Jon Griffiths + Typos/grammar fixes. + + * dlls/shlwapi/url.c: Jon Griffiths + Const correctness fix. + + * dlls/shlwapi/tests/shreg.c: Jon Griffiths + Use Ascii functions explicitly. + + * dlls/user/static.c: Dimitrie O. Paun + SS_CENTERIMAGE has been implemented. + + * dlls/rsaenh/rsaenh.c, include/wincrypt.h: + Michael Jung + Implemented parallel hashing in CPEncrypt and CPDecrypt. + Implemented CPHashSessionKey. + + * dlls/ole32/stubmanager.c: Mike Hearn + Comment out an assert, as we don't yet implement IRemUnknown. + + * dlls/gdi/gdi32.spec, dlls/gdi/palette.c: + Hans Leidekker + Stub implementations for GetLogColorSpace{A,W}. + + * dlls/kernel/kernel32.spec, dlls/kernel/lcformat.c: + Hans Leidekker + Stub implementations for EnumDateFormatsEx{A,W}. + + * dlls/rasapi32/rasapi.c, dlls/rasapi32/rasapi32.spec, include/ras.h: + Hans Leidekker + Stub implementations for RasConnectionNotification{A,W}, + RasCreatePhonebookEntry{A,W}, RasDeleteSubEntry{A,W}, RasDial{A,W}, + RasEditPhonebookEntry{A,W}, RasGetConnectStatus{A,W}, + RasGetEntryDialParamsW, RasHangUpW, RasGetEntryPropertiesW, + RasGetErrorString{A,W}, RasGetProjectionInfo{A,W}, + RasRenameEntry{A,W}, RasSetEntryDialParams{A,W}, + RasSetSubEntryProperties{A,W}. + + * dlls/msi/action.c, dlls/msi/msipriv.h, dlls/msi/package.c: + Aric Stewart + Free allocated buffers. + + * README: Hans Leidekker + Remove obsolete info. + + * tools/widl/parser.l, tools/widl/parser.y, tools/widl/widltypes.h: + Jacek Caban + Added optional, defaultvalue and vararg. + + * dlls/rsaenh/mpi.c, dlls/rsaenh/rsa.c: + Michael Jung + Small bugfixes backported from the LibTomCrypt v1.0rc1 release. + + * include/objidl.idl: Robert Shearman + Add definition of IInternalUnknown. + +2004-12-27 Alexandre Julliard + + * dlls/msi/handle.c, dlls/msi/msipriv.h, dlls/msi/record.c: + Mike McCormack + Implement thread safety for records. + + * dlls/ole32/compobj_private.h, dlls/ole32/rpc.c: + Robert Shearman + - Move named pipe macros into rpc.c. + - Remove unneeded function. + + * dlls/ole32/compobj.c, dlls/ole32/compobj_private.h, dlls/ole32/rpc.c: + Robert Shearman + Implement COM local servers using table marshaling to avoid doing the + marshaling in a child thread where COM has not been initialized. + + * dlls/ole32/Makefile.in, dlls/ole32/compobj.c, + dlls/ole32/compobj_private.h, dlls/ole32/marshal.c, dlls/ole32/rpc.c, + dlls/ole32/stubmanager.c, dlls/ole32/tests/marshal.c: + Mike Hearn + - Implement the COM stub manager, refactor the current stub code. + - Begin implementing interface stubs. + + * dlls/msi/action.c: Aric Stewart + Parse out the full features by using the ',' character and do + comparisons based on the full feature names. + + * dlls/msi/action.c: Aric Stewart + Continue when a duplicate component is found and loaded. + + * dlls/msi/action.c: Aric Stewart + - Rework how we handle Feature and Component States. I have confirmed + from testing that, although documented nowhere, having ADDLOCAL on + the install line overrides INSTALLLEVEL. + - Track all files extracted from cabinents as tempfiles so they can be + removed at the end of the install to not leave uninstalled but + uncabbed files laying around. + + * dlls/msi/action.c: Aric Stewart + Move Install Features selection and evaluation into CostFinalize. + + * dlls/msi/action.c: Aric Stewart + Allow for end of install actions. + + * dlls/msi/action.c: Aric Stewart + - Create the shortcut directory if it does not exist. + - Set the INSTALLLEVEL in CostFinalize if it is not set. + + * dlls/msi/action.c: Aric Stewart + Eliminate some fixed length buffers. + + * dlls/advapi32/tests/security.c, dlls/gdi/tests/brush.c, + dlls/gdi/tests/gdiobj.c, dlls/gdi/tests/metafile.c, + dlls/lzexpand/tests/lzexpand_main.c, dlls/mscms/tests/profile.c, + dlls/msvcrt/tests/file.c, dlls/shell32/tests/shellpath.c, + dlls/shlwapi/tests/ordinal.c, dlls/wininet/tests/http.c: + Rein Klazes + Correct cases where arguments of ok() calls depend on the order in + which they are evaluated. + + * dlls/advapi32/service.c: Mike McCormack + Fix CreateService's error code for a service that already exists. + + * dlls/msi/package.c: Aric Stewart + Include a System16Folder definition. + + * include/urlmon.idl: Jacek Caban + Added IInternetBindInfo, IInternetProtocolRoot, IInternetProtocolSink + and IInternetProtocol declarations. + + * dlls/kernel/tests/change.c, dlls/kernel/tests/file.c, + dlls/kernel/tests/process.c, dlls/kernel/tests/thread.c, + dlls/kernel/tests/time.c, dlls/user/tests/clipboard.c, + dlls/user/tests/msg.c, dlls/user/tests/text.c, dlls/user/tests/win.c: + Rein Klazes + Correct cases where arguments of ok() calls depend on the order in + which they are evaluated. + + * dlls/gdi/gdi32.spec, dlls/gdi/palette.c, include/wingdi.h: + Hans Leidekker + Stub implementations for GetICMProfileW, SetICMProfile{A,W}, + UpdateICMRegKey{A,W}. + Forward UpdateICMRegKey to UpdateICMRegKeyA. + + * dlls/oleaut32/typelib2.c: Huw Davies + Fix typelib generation of CARRAYs. + + * dlls/kernel/cpu.c: Lionel Ulmer + Fix non-RTDSC case for QueryPerformanceFrequency. + + * dlls/quartz/avidec.c, dlls/quartz/avisplit.c, + dlls/quartz/dsoundrender.c, dlls/quartz/filesource.c, + dlls/quartz/filtergraph.c, dlls/quartz/pin.c, + dlls/quartz/videorenderer.c: + Christian Costa + Initialize the COM libraries for the newly created worker thread in + the AVI splitter. + Fixed some returned error codes. + Show refcount in the AddRef/Release traces in filter. + Added 24 bits source in the video renderer. + + * tools/widl/widl.c: Vincent Béron + Generate only wanted files. + + * dlls/ddraw/ddraw/main.c, dlls/ddraw/ddraw_private.h: + Christian Costa + Fake line sweeping of the monitor. + + * dlls/advapi32/service.c: Mike McCormack + Don't use RtlCreateUnicodeStringFromAsciiz, it doesn't preserve NULL. + + * dlls/msi/action.c: Aric Stewart + Enable asynchronous dll custom action calls. + + * dlls/atl/atl.spec, dlls/atl/atl_main.c: + Mike McCormack + Stub implementation for AtlModuleRegisterServer. + + * dlls/kernel/heap.c: Paul Vriens + Initialize dwOSVersionInfoSize in GlobalMemoryStatus. + + * dlls/netapi32/tests/access.c: Jakob Eriksson + Fix test failure on Windows 2000. + + * tools/widl/parser.y: Jacek Caban + Fixed defining DIIDs. + + * dlls/x11drv/window.c: Mike Hearn + Fix Xlib locking in create_desktop. + + * dlls/ole32/compobj.c, dlls/ole32/compobj_private.h, + dlls/ole32/marshal.c, dlls/ole32/rpc.c: + Mike Hearn + Propagate apartments through the intermediate threads, make listener + thread apartment scoped. + + * dlls/avifil32/api.c, dlls/avifil32/avifil32.spec, include/vfw.h: + Hans Leidekker + Stub implementations for AVIMakeStreamFromClipboard, AVISave{A,W}. + Forward AVIBuildFilter, AVIFileCreateStream, AVIFileOpen, AVISave, + EditStreamSetInfo, EditStreamSetName to their respective *A variants. + + * dlls/dinput/mouse.c: Neil Olver + The flag for a mouse button down in the structure returned by + GetDeviceState should be 0x80 (only the high bit set), not 0xff. + +2004-12-23 Alexandre Julliard + + * dlls/winedos/vga.c, dlls/wineps/clipping.c, dlls/wineps/escape.c, + dlls/wineps/init.c, dlls/wineps/ppd.c, dlls/wineps/type42.c, + dlls/wininet/cookie.c, dlls/wininet/ftp.c, dlls/wininet/http.c, + dlls/wininet/internet.c, dlls/winmm/driver.c, dlls/winmm/mci.c, + dlls/winmm/mciavi/mciavi.c, dlls/winmm/mciwave/mciwave.c, + dlls/winmm/playsound.c, dlls/winmm/winealsa/midi.c, + dlls/winmm/winearts/audio.c, dlls/winmm/wineoss/dscapture.c, + dlls/winmm/wineoss/dsrender.c, dlls/winmm/wineoss/midi.c, + dlls/winsock/socket.c, dlls/winsock/socket16.c, dlls/winspool/info.c, + dlls/x11drv/dib.c, dlls/x11drv/palette.c, dlls/x11drv/text.c, + dlls/x11drv/xfont.c, dlls/x11drv/xrandr.c, dlls/x11drv/xrender.c, + dlls/mpr/wnet.c, dlls/msacm/internal.c, dlls/msdmo/dmoreg.c, + dlls/msvcrt/data.c, dlls/msvcrt/main.c, dlls/msvideo/drawdib.c, + dlls/msvideo/mciwnd.c, dlls/msvideo/msvideo_main.c, + dlls/netapi32/nbnamecache.c, dlls/ole32/bindctx.c, + dlls/ole32/clipboard.c, dlls/ole32/datacache.c, + dlls/ole32/defaulthandler.c, dlls/ole32/filemoniker.c, + dlls/ole32/itemmoniker.c, dlls/ole32/ole2.c, dlls/ole32/storage32.c, + dlls/oleaut32/olefont.c, dlls/oleaut32/olepicture.c, + dlls/oleaut32/typelib2.c, dlls/opengl32/wgl.c, dlls/kernel/comm.c, + dlls/kernel/console.c, dlls/kernel/editline.c, dlls/kernel/environ.c, + dlls/kernel/file.c, dlls/kernel/file16.c, dlls/kernel/format_msg.c, + dlls/kernel/global16.c, dlls/kernel/lcformat.c, + dlls/kernel/local16.c, dlls/kernel/locale.c, dlls/kernel/ne_module.c, + dlls/kernel/path.c, dlls/kernel/process.c, dlls/kernel/profile.c, + dlls/kernel/resource.c, dlls/kernel/sync.c, + dlls/kernel/tests/alloc.c, dlls/kernel/time.c, dlls/kernel/volume.c, + dlls/lzexpand/lzexpand_main.c, dlls/dmscript/script.c, + dlls/dplayx/dplay.c, dlls/dplayx/dplaysp.c, dlls/dsound/buffer.c, + dlls/dsound/capture.c, dlls/dsound/primary.c, dlls/gdi/bitmap.c, + dlls/gdi/dc.c, dlls/gdi/driver.c, dlls/gdi/font.c, + dlls/gdi/freetype.c, dlls/gdi/gdi16.c, dlls/gdi/metafile.c, + dlls/gdi/palette.c, dlls/gdi/path.c, dlls/gdi/printdrv.c, + dlls/gdi/mfdrv/init.c, dlls/gdi/mfdrv/text.c, dlls/imm32/imm.c, + dlls/iphlpapi/ifenum.c, dlls/d3d8/device.c, dlls/d3d8/stateblock.c, + dlls/d3d8/vertexbuffer.c, dlls/d3dx8/d3dxbuffer.c, + dlls/dbghelp/msc.c, dlls/dbghelp/stabs.c, + dlls/ddraw/d3dexecutebuffer.c, dlls/ddraw/d3dtexture.c, + dlls/devenum/mediacatenum.c, dlls/dinput/joystick_linux.c, + dlls/dinput/joystick_linuxinput.c, dlls/dinput/keyboard.c, + dlls/dinput/mouse.c, dlls/advapi32/registry.c, + dlls/advapi32/security.c, dlls/advapi32/service.c, + dlls/comctl32/animate.c, dlls/comctl32/syslink.c, + dlls/comctl32/toolbar.c, dlls/commdlg/filedlg.c, + dlls/commdlg/filedlg31.c, dlls/commdlg/fontdlg.c, + dlls/commdlg/fontdlg16.c, dlls/commdlg/printdlg.c, + dlls/shlwapi/msgbox.c, dlls/shlwapi/ordinal.c, + dlls/shlwapi/regstream.c, dlls/urlmon/umon.c, dlls/user/button.c, + dlls/user/combo.c, dlls/user/edit.c, dlls/user/listbox.c, + dlls/user/lstr.c, dlls/user/menu.c, dlls/user/message.c, + dlls/vnbt.vxd/vnbt.c, dlls/wined3d/indexbuffer.c, + dlls/wined3d/vertexbuffer.c, windows/cursoricon.c, windows/defwnd.c, + windows/mdi.c, windows/win.c, windows/winproc.c, + dlls/quartz/memallocator.c, dlls/richedit/reader.c, + dlls/rpcrt4/rpc_binding.c, dlls/rpcrt4/rpc_message.c, + dlls/rpcrt4/rpc_server.c, dlls/rsaenh/handle.c, dlls/rsaenh/rsaenh.c, + dlls/serialui/confdlg.c, dlls/setupapi/parser.c, + dlls/setupapi/setupx_main.c, dlls/shell32/autocomplete.c, + dlls/shell32/brsfolder.c, dlls/shell32/pidl.c, + dlls/shell32/shell32_main.c, dlls/shell32/shelllink.c, + dlls/shell32/shlexec.c, dlls/shell32/shlfileop.c, + programs/regedit/regproc.c, programs/rundll32/rundll32.c, + programs/winecfg/appdefaults.c, programs/winecfg/driveui.c, + programs/winecfg/winecfg.c, programs/wineconsole/dialog.c, + programs/wineconsole/wineconsole.c, programs/winedbg/stack.c, + programs/winemenubuilder/winemenubuilder.c, + programs/winhelp/hlpfile.c, programs/winhelp/macro.lex.l: + Michael Stefaniuc + Do not check for non NULL pointer before HeapFree'ing it. It's + redundant. + + * dlls/rpcrt4/rpcrt4.spec, dlls/rpcrt4/rpcrt4_main.c, + dlls/rpcrt4/tests/rpc.c, include/rpcdce.h: + Bill Medland + Implemented DceErrorInqText. + + * dlls/user/sysparams.c: Mike McCormack + Dump known but unimplemented SystemParameterInfo actions. + + * include/winuser.h: Mike McCormack + Declare SetLayeredWindowAttributes. + + * dlls/msi/msi.c, dlls/msi/msi.spec: + Aric Stewart + Added MsiSetExternalUIW. + + * dlls/msi/action.c: Aric Stewart + Make sure to include trailing backslash in path. + + * dlls/wininet/internet.c, dlls/wininet/internet.h, + dlls/wininet/utility.c: + Lionel Ulmer + Added/improved TRACEing. + +2004-12-22 Alexandre Julliard + + * dlls/msi/package.c: Aric Stewart + Blank the property buffers even if the property is not found. + + * dlls/msi/action.c: Aric Stewart + Move around and rename some functions. + + * dlls/gdi/enhmetafile.c, dlls/gdi/metafile.c, dlls/kernel/comm.c, + dlls/ole32/compobj.c, dlls/ole32/stg_bigblockfile.c, + dlls/winedos/devices.c, dlls/winedos/int21.c, dlls/winedos/int25.c, + dlls/winedos/int26.c, dlls/winedos/vga.c, + programs/wineboot/wineboot.c, programs/winecfg/drive.c, + programs/winedbg/dbg.y, programs/winedbg/winedbg.c: + Eric Pouech + ReadFile and WriteFile must be passed a parameter for the number of + handled bytes when no overlapped operation is done. + + * dlls/winsock/socket.c: Robert Shearman + Convert per-process hostent, servent and protent buffers into + per-thread buffers. + + * include/aclapi.h: Mike McCormack + Declare GetSecurityInfo. + + * dlls/msi/package.c: Aric Stewart + Include the trailing backslash on the Windows volume. + + * dlls/msi/action.c: Aric Stewart + Fix incorrect return code check. + + * windows/message.c: Russ Andersson + The WM_MOUSEWHEEL message is specified to have absolute screen + coordinates. + + * dlls/commdlg/cdlg.h, dlls/commdlg/fontdlg.c, dlls/commdlg/fontdlg16.c: + Jacek Caban + Unicodified fontdlg. + + * dlls/x11drv/clipping.c: Eric Pouech + Fixed bug with unsigned index in decreasing loop. + + * dlls/msi/action.c, dlls/msi/package.c: + Aric Stewart + Fix folder resolution. + + * dlls/cabinet/cabextract.c: Revert previous patch, that's not a leak. + + * dlls/advapi32/security.c, dlls/ntdll/sec.c, include/winternl.h: + Fixed prototypes of a couple of ntdll functions. + Replaced the CallWin32ToNt macro by a proper function. + PBOOL cannot be cast to PBOOLEAN, we need to use an intermediate + variable. + + * dlls/msi/action.c: Mike McCormack + Remove more fixed length buffers, rewrite functions to return + malloc'ed memory. + + * dlls/msi/query.h, dlls/msi/table.c, dlls/msi/where.c: + Mike McCormack + Fix selecting string columns and matching against a wildcard. + + * dlls/dmband/band.c, dlls/dmband/bandtrack.c, + dlls/dmcompos/chordmap.c, dlls/dmcompos/chordmaptrack.c, + dlls/dmcompos/signposttrack.c, dlls/dmime/audiopath.c, + dlls/dmime/graph.c, dlls/dmime/lyricstrack.c, + dlls/dmime/markertrack.c, dlls/dmime/paramcontroltrack.c, + dlls/dmime/patterntrack.c, dlls/dmime/segment.c, + dlls/dmime/segmentstate.c, dlls/dmime/segtriggertrack.c, + dlls/dmime/seqtrack.c, dlls/dmime/sysextrack.c, + dlls/dmime/tempotrack.c, dlls/dmime/timesigtrack.c, + dlls/dmime/tool.c, dlls/dmime/wavetrack.c, dlls/dmloader/container.c, + dlls/dmloader/loaderstream.c, dlls/dmscript/scripttrack.c, + dlls/dmstyle/auditiontrack.c, dlls/dmstyle/chordtrack.c, + dlls/dmstyle/commandtrack.c, dlls/dmstyle/motiftrack.c, + dlls/dmstyle/mutetrack.c, dlls/dmstyle/style.c, + dlls/dmstyle/styletrack.c, dlls/dmusic/buffer.c, + dlls/dmusic/collection.c, dlls/dmusic/download.c, + dlls/dmusic/downloadedinstrument.c, dlls/dmusic/instrument.c, + dlls/dswave/dswave.c, dlls/msvideo/msvideo_main.c, + dlls/shlwapi/ordinal.c, dlls/winmm/mmio.c, dlls/wintab32/wintab32.c, + programs/regedit/framewnd.c, programs/regedit/main.c: + Francois Gouget + Remove unneeded NULL casts. + + * dlls/msi/action.c, dlls/msi/msipriv.h, dlls/msi/package.c: + Mike McCormack + Remove a lot of fixed length buffers. + + * dlls/wined3d/device.c, tools/winedump/search.c: + Francois Gouget + Spelling fixes. + + * dlls/commdlg/cdlg.h, dlls/commdlg/cdlg_Cn.rc, + dlls/commdlg/cdlg_De.rc, dlls/commdlg/cdlg_En.rc, + dlls/commdlg/cdlg_Es.rc, dlls/commdlg/cdlg_Fr.rc, + dlls/commdlg/cdlg_It.rc, dlls/commdlg/cdlg_Nl.rc, + dlls/commdlg/cdlg_Pl.rc, dlls/commdlg/cdlg_Pt.rc, + dlls/commdlg/cdlg_Ru.rc, dlls/commdlg/cdlg_Si.rc, + dlls/commdlg/cdlg_Sk.rc, dlls/commdlg/cdlg_Sv.rc, + dlls/commdlg/cdlg_Th.rc, dlls/commdlg/cdlg_Uk.rc, + dlls/commdlg/printdlg.c: + Dmitry Timoshkov + Replace 'All xxx pages' text in common print dialog by simple 'All'. + + * dlls/kernel/profile.c: Dmitry Timoshkov + Perform case insensitive comparison with cached ini file name. + + * dlls/kernel/file.c: Dmitry Timoshkov + Uncomment call to FlushConsoleInputBuffer in FlushFileBuffers. + + * programs/winetest/main.c: Jakob Eriksson + Add a check if we are running on a visible desktop. Credits to Dmitry + Timoshkov for the easy test. + +2004-12-21 Alexandre Julliard + + * dlls/advapi32/advapi32.spec, dlls/advapi32/security.c, + dlls/ntdll/sec.c, include/aclapi.h, include/winbase.h, + include/winsvc.h, include/winternl.h: + Hans Leidekker + Stub implementations for AdjustTokenGroups, AreAllAccessesGranted, + CreatePrivateObjectSecurity, CreateProcessAsUser{A,W}, + DestroyPrivateObjectSecurity, DuplicateToken{,Ex}, + EnumDependentServices{A,W}, GetEffectiveRightsFromAcl{A,W}, + ConvertStringSecurityDescriptorToSecurityDescriptorA. Implementations + for BuildExplicitAccessWithName{A,W}, + BuildTrusteeWithObjectsAndName{A,W}, + BuildTrusteeWithObjectsAndSid{A,W}. + Correct prototype for InitializeAcl, RtlCopySid and RtlGetAce. + Use the CallWin32ToNt macro only with functions that return an + NTSTATUS. + + * dlls/kernel/file.c: Dmitry Timoshkov + Postpone creation disposition check in CreateFile until it's really + used. + + * dlls/advapi32/service.c: Ivan Leo Puoti + In OpenSCManagerW() allow lpDatabaseName to be an empty string. + + * include/d3d.h, include/ddraw.h: Peter Berg Larsen + Added D3DERR_COLORKEYATTACHED and DDGDI_GETHOSTIDENTIFIER. + + * dlls/user/tests/dialog.c, dlls/user/tests/resource.rc, windows/dialog.c: + Ulrich Czekalla + If a dialog with the DS_CONTROL style is not visible then ignore + default focus assignment. + + * dlls/ole32/tests/.cvsignore, dlls/ole32/tests/Makefile.in, + dlls/ole32/tests/marshal.c, dlls/ole32/tests/moniker.c: + Robert Shearman + Add tests for moniker and marshaling functions. + + * dlls/gdi/enhmetafile.c: Mike McCormack + Check values passed in to SetWinMetaFileBits, not our local copy. + + * dlls/gdi/enhmfdrv/graphics.c: Mike McCormack + Output EMR_POLYGON16 records when possible. + + * dlls/ddraw/dsurface/dib.c: Crestez Leonard + Check for malformed source rect in DIB_DirectDrawSurfact_BltFast, and + return DDERR_INVALID_RECT. + + * dlls/gdi/font.c, dlls/gdi/freetype.c: + Dmitry Timoshkov + Fully initialize NEWTEXTMETRICEXW structure for bitmap fonts. + + * dlls/wininet/cookie.c, dlls/wininet/ftp.c, dlls/wininet/http.c, + dlls/wininet/internet.c: + Michael Stefaniuc + Do not check for non NULL pointer before HeepFree'ing it. It's + redundant. + + * dlls/mapi32/tests/imalloc.c: Jakob Eriksson + There may be no default MAPI malloc installed. + + * dlls/user/focus.c, dlls/user/tests/win.c: + Rein Klazes + You can make an invisible window the active window. + + * dlls/advapi32/advapi32.spec, dlls/advapi32/crypt.c: + Michael Jung + Respect the sDescription parameter in CryptSignHash and + CryptVerifySignature. + +2004-12-20 Alexandre Julliard + + * dlls/avifil32/api.c, dlls/avifil32/wavfile.c, + dlls/comctl32/comctl32undoc.c, dlls/dbghelp/mscvpdb.h, + dlls/gdi/enhmfdrv/objects.c, dlls/kernel/tests/directory.c, + dlls/kernel/time.c, dlls/mapi32/util.c, dlls/msrle32/msrle32.c, + dlls/ntdll/tests/rtl.c, dlls/ole32/marshal.c, + dlls/oleaut32/variant.c, dlls/quartz/filtergraph.c, + dlls/rsaenh/handle.c, dlls/rsaenh/mpi.c, dlls/wined3d/device.c, + dlls/winsock/socket.c, documentation/running.sgml: + Francois Gouget + Assorted spelling fixes. + + * dlls/winmm/winealsa/audio.c, dlls/winmm/winearts/audio.c, + dlls/winmm/wineaudioio/audio.c, dlls/winmm/winejack/audio.c, + dlls/winmm/winenas/audio.c, dlls/winmm/wineoss/audio.c: + Robert Reif + A driver does not have to support all formats. + + * dlls/user/comm16.c, dlls/user/dde/ddeml16.c, dlls/user/exticon.c, + dlls/user/focus.c, dlls/user/listbox.c, dlls/user/lstr.c, + dlls/user/misc.c, dlls/user/network.c, dlls/user/property.c, + dlls/user/static.c, dlls/user/text.c, dlls/user/user_main.c, + dlls/x11drv/text.c, dlls/x11drv/window.c, dlls/x11drv/winpos.c, + dlls/x11drv/x11ddraw.c: + Jon Griffiths + Remove unneeded headers to reduce unneeded rebuilds. + + * dlls/urlmon/tests/Makefile.in, dlls/urlmon/tests/url.c, + dlls/urlmon/umon.c, include/urlmon.idl: + Jacek Caban + - Added test of BindToStorage. + - Added some declarations to urlmon.idl. + + * libs/wine/config.c: + Fix long standing regression in the building of the server directory + name (found by Nigel Rowe). + + * dlls/advapi32/crypt.c: Michael Jung + ixed calculation of buffer size in CRYPT_ANSIToUnicode and + CRYPT_UnicodeToANSI. + + * dlls/wininet/internet.h: Steven Edwards + MSVC porting fixes. + + * dlls/winmm/wavemap/wavemap.c: Robert Reif + Return actual result on error. + + * dlls/ddraw/direct3d/mesa.c: Christian Costa + Enable creation of the RGB device. + + * dlls/quartz/avidec.c, dlls/quartz/avisplit.c, + dlls/quartz/dsoundrender.c, dlls/quartz/memallocator.c, + dlls/quartz/videorenderer.c: + Christian Costa + Fixed MediaSample passing. This is the upstream filter that releases + it. + Set ppMediaType to NULL when returning S_FALSE in + IMediaSample_GetMediaType (required by native Quartz dll). + Added support for 32-bit depth source in video renderer. + + * dlls/oleaut32/tmarshal.c: Bill Medland + Fully initialise the structure to prevent ill-defined behaviour. + + * dlls/mscms/Makefile.in, dlls/mscms/mscms.spec, dlls/mscms/profile.c, + dlls/mscms/stub.c, dlls/mscms/tests/profile.c, include/icm.h: + Hans Leidekker + Stub implementations for all documented functions. + + * dlls/rsaenh/rsaenh.c: Michael Jung + Respect sDescription parameter in CPSignHash and CPVerifySignature. + + * dlls/comctl32/datetime.c: Robert Shearman + - Make the month calendar child window auto-size instead of using a + hard coded 200px. + - Use SetFocus when the control is clicked on to get the correct + behaviour when another control clicked on. + - Force the WS_EX_CLIENTEDGE style, instead of emulating it. + + * dlls/user/tests/msg.c: Rein Klazes + - make sure that tests marked as todo_wine and actually succeed under + wine will be counted as failures + - remove todo_wine from a bunch of tests + - log the line numbers of the actual tests, not those of a helper + function. + + * dlls/comctl32/listview.c: Ulrich Czekalla + Add partial handler for WM_PRINTCLIENT. + + * include/rpc.h, include/rpcndr.h: Peter Berg Larsen + Remove compiler warnings for the # not being at the start of the + line. + + * tools/winedump/main.c, tools/winedump/search.c, + tools/winedump/winedump.h: + Peter Berg Larsen + Allow several -I parameters to be given - currently just the last is + used. Remove obvious wrong binaries when searching for the definition + of a functions definition. Really just strip a '.dll' extension and + not also '.dll.foorbar.spec'. + + * tools/winedump/function_grep.pl: Peter Berg Larsen + Warzone 2100 has in a header a definition that ends with a slash. As + '.' does not include '\n' winedump keeps looking ahead until eof. + +2004-12-17 Alexandre Julliard + + * dlls/ntdll/reg.c, dlls/ntdll/rtl.c, dlls/ntdll/rtlbitmap.c, + dlls/ntdll/sec.c, dlls/ntdll/string.c, dlls/ntdll/sync.c, + dlls/ntdll/tests/error.c, dlls/ntdll/tests/large_int.c, + dlls/ntdll/tests/rtl.c, dlls/ntdll/tests/string.c, + dlls/ntdll/version.c, dlls/ntdll/wcstring.c: + Jon Griffiths + Remove unneeded headers to reduce unneeded rebuilds. + + * dlls/x11drv/x11drv.h: Rémi Assailly + - removed unused tagPALETTEOBJ and tagWINDOWPOS + - tagBITMAPOBJ is declared twice, removed one. + + * dlls/shell32/iconcache.c, dlls/shell32/pidl.c, + dlls/shell32/shell32_main.c, dlls/shell32/shlexec.c, + dlls/shell32/shlfileop.c, include/shellapi.h: + Remove some no longer needed AW functions. + + * dlls/oleaut32/tests/vartype.c: + Expand the COPYTEST macro to avoid trouble with 64-bit types. + + * dlls/shlwapi/ordinal.c, dlls/shlwapi/stopwatch.c, + dlls/shlwapi/tests/clsid.c, dlls/shlwapi/tests/ordinal.c: + Jon Griffiths + Remove unneeded headers to reduce unneeded rebuilds. + + * dlls/wined3d/wined3d_private.h: + Raphael Junqueira + Fixed build problem with GL_VERSION_1_2. + + * dlls/ntdll/version.c: Vincent Béron + Better detect a dll's Windows version. + + * dlls/shell32/shell32.spec: Rein Klazes + ShellExecuteEx, ExtractIconEx, SHFileOperation, SHGetFileInfo, + SHGetPathFromIDList spec entries always refer to the Ansi + version. Problem found by Paul Vriens. + + * dlls/winmm/lolvldrv.c: Robert Reif + Return flag for DRVM_MAPPER_PREFERRED_GET. + + * include/mmddk.h: Robert Reif + Added a missing define. + + * dlls/kernel/module.c: Andreas Mohr + Fixed a typo. + + * dlls/kernel/path.c, include/winbase.h: + Andreas Mohr + GetTempPath*() uses DWORD parameters instead of UINT. + + * dlls/oleaut32/typelib.c: Huw Davies + Fix comment to reflect reality and indeed the code. + + * include/objidl.idl: Serge S. Spiridonoff + IMessageFilter::HandleIncomingCall must be HandleInComingCall as per + MS headers. + + * dlls/user/static.c: Robert Shearman + Implement SS_CENTERIMAGE for static control. + + * dlls/comctl32/treeview.c: Robert Shearman + - Add code for hot tracking. + - Draw hot items with underline and with highlight colour with + TVS_TRACKSELECT style. + - Set cursor to hand cursor with TVS_TRACKSELECT style. + - Make sure uInternalStatus is consistent with actual scrollbar state + by forcing scrollbars off in WM_CREATE handler. + + * dlls/comctl32/datetime.c: Robert Shearman + - Implement WM_ENABLE handler to update cached control style when the + control is disabled. + - Move background drawing into WM_ERASEBKGND handler and draw the + background differently when disabled. + - Change WM_PAINT handler to draw text with transparent background and + with the correct colour for the style. + - Initialize selected field to -1 instead of 0 so that the control + notices when field 0 is selected. + + * dlls/user/tests/win.c, dlls/x11drv/mouse.c: + Dmitry Timoshkov + Add a mouse input test case, make the test pass under Wine. + +2004-12-16 Alexandre Julliard + + * dlls/ntdll/version.c: Ivan Leo Puoti + Better EXE version check in VERSION_GetLinkedDllVersion. + + * dlls/unicows/Makefile.in, dlls/unicows/main.c, + dlls/unicows/unicows.spec: + Added a few functions that are now implemented. + + * dlls/shell32/changenotify.c, dlls/shell32/cpanelfolder.c, + dlls/shell32/enumidlist.c, dlls/shell32/folders.c, + dlls/shell32/iconcache.c, dlls/shell32/pidl.c, + dlls/shell32/shellreg.c, dlls/shell32/shfldr_mycomp.c, + dlls/shell32/shlexec.c, dlls/shell32/shlfolder.c, + dlls/shell32/shlfsbind.c, dlls/oleaut32/ole2disp.c, + dlls/oleaut32/tmarshal.c, dlls/oleaut32/typelib.c, + dlls/oleaut32/typelib16.c, dlls/oleaut32/typelib2.c, + dlls/gdi/bitmap.c, dlls/gdi/icm.c, dlls/gdi/wing.c: + Jon Griffiths + Remove unneeded headers to reduce unneeded rebuilds. + + * documentation/README.fr: Vincent Béron + Update FreeBSD infos. + + * dlls/netapi32/netbios.c: Juan Lang + In Netbios(), + - set ncb_retcode and ncb_cmd_cplt for NCB_ADDNAME + - always make sure adapters have been enumerated. + + * dlls/version/tests/info.c: + Stefan Leichter + Fixed tests of GetFileVersionInfoSizeA for win2k3. + + * dlls/msi/sql.y: Aric Stewart + Let negative number be parsed correctly. Needed for accessing actions + with sequences such as -1. + + * dlls/msi/package.c: Vitaly Lipatov + Add ScreenX, ScreenY, ColorBits installer properties. + + * dlls/msi/action.c, include/msiquery.h: + Vitaly Lipatov + Add description for MsiGetMode, MSIRUNMODE constants. + + * dlls/quartz/avisplit.c, dlls/quartz/filtergraph.c, dlls/quartz/pin.c, + dlls/quartz/systemclock.c, dlls/quartz/tests/filtergraph.c: + Christian Costa + Many fixes to the system clock implementation. + Ensure there is a clock before doing any AddRef or Release in the AVI + splitter. + Improved tests a bit. + Misc fixes and traces clean-up. + + * dlls/ole32/ifs.c: Ge van Geldorp + Allocate correct amount of memory. + + * tools/wineprefixcreate.in: Dmitry Timoshkov + Allow wineprefixcreate to run to the end when configuring from the + source tree. + +2004-12-15 Alexandre Julliard + + * dlls/advapi32/crypt.c, dlls/advapi32/crypt_md4.c, + dlls/advapi32/crypt_md5.c, dlls/advapi32/crypt_sha.c, + dlls/comctl32/flatsb.c, dlls/comctl32/smoothscroll.c, + dlls/comctl32/syslink.c, dlls/comctl32/tests/dpa.c, + dlls/kernel/ne_module.c, dlls/kernel/powermgnt.c, dlls/kernel/time.c, + dlls/kernel/utthunk.c: + Jon Griffiths + Remove unneeded headers to reduce unneeded rebuilds. + + * dlls/advpack/advpack.c, dlls/advpack/advpack.spec, + dlls/dciman32/dciman32.spec, dlls/dciman32/dciman_main.c, + dlls/msimg32/msimg32.spec, dlls/msimg32/msimg32_main.c, + dlls/winspool/winspool.drv.spec: + It makes no sense to export the dll entry point as stub. + + * README, libs/wine/mmap.c: Gerald Pfeifer + Make us work on FreeBSD again by working around their different mmap() + implementation. + + * dlls/shlwapi/tests/ordinal.c: + Stefan Leichter + Fixed tests of GetAcceptLanguagesA for win98. + + * dlls/shlwapi/tests/shreg.c: Jon Griffiths + Use the A version of calls when passing ASCII strings. + + * include/gdi.h: Rémi Assailly + PC_SYS_MAPPED is unused, remove it. + + * dlls/shlwapi/wsprintf.c: Jon Griffiths + Include shlwapi.h to get prototypes, and correct 2 wrong ones. + + * dlls/kernel/process.c: Jon Griffiths + Documentation fixes. + + * dlls/kernel/console.c, server/process.c: + Rein Klazes + A starting process must obey the STARTF_USESTDHANDLES flag and use the + standard io handles from the StartupInfo structure, even if it is + starting a new console. + + * dlls/oleaut32/oleaut32.rc, dlls/oleaut32/oleaut32_Ru.rc: + Dmitry Timoshkov + Add Russian translations. + +2004-12-14 Alexandre Julliard + + * dlls/kernel/except.c, dlls/ntdll/exception.c, dlls/ntdll/loader.c, + programs/winedbg/winedbg.c: + Generate stub entries on the fly for missing entry points instead of + returning a deadbeef pointer. + + * dlls/kernel/kernel32.spec, dlls/kernel/lcformat.c: + Ken Belleau + Implemented EnumCalendarInfo(A/W/ExA/ExW). + + * dlls/ole32/marshal.c: Robert Shearman + - Add documentation to several functions. + - Coding style changes according to the style Mike and I have agreed + upon for COM related files. + + * dlls/ole32/compobj.c, dlls/ole32/marshal.c, + dlls/ole32/memlockbytes.c, dlls/ole32/rpc.c: + Robert Shearman + Remove unneeded includes and the unused COMPOBJ_hInstance32 variable. + + * dlls/advapi32/advapi.c: James Hawkins + Minor documentation addition. + + * dlls/advapi32/crypt.c: James Hawkins + Cleanup some documentation. + + * dlls/ole32/marshal.c: Robert Shearman + Use OBJREF on the wire for generic marshaling functions. + + * dlls/msvcrt/msvcrt.h, dlls/msvcrt/process.c: + Juan Lang + Implement _popen and _pclose, and use debugstr_a to avoid a crash + tracing long command lines. + + * dlls/msvcrt/data.c: Juan Lang + Use debugstr_a to avoid crash tracing long command line. + + * dlls/msvcrt/file.c: Juan Lang + - make file functions (mostly) thread-safe + - update a couple traces + + * dlls/d3d9/device.c, dlls/wined3d/device.c, dlls/wined3d/directx.c, + dlls/wined3d/drawprim.c, dlls/wined3d/stateblock.c, + dlls/wined3d/wined3d_private.h, include/wine/wined3d_interface.h: + Jason Edmeades + Add Clear, Present and EndScene support and fix a bug in the drawing + code. + + * windows/msgbox.c: Thomas Weidenmueller + MessageBoxIndirectA() should check whether the MB_USERICON bit is set + to prevent an exception. + + * dlls/msacm/msg711/msg711.c: Robert Reif + Fix a typo that didn't allow pcm to mulaw conversions. + + * dlls/oleaut32/tmarshal.c, dlls/rpcrt4/ndr_midl.c: + Robert Shearman + Implement RPC_E_DISCONNECTED in proxies. + + * programs/winefile/winefile.c: Piotr Caban + Fixed display bug. + + * documentation/winelib-bindlls.sgml, documentation/winelib-intro.sgml, + documentation/winelib-toolkit.sgml: + Francois Gouget + Remove references to ./configure and Makefile.in files. + + * dlls/mscms/tests/profile.c, dlls/msvcrt/tests/file.c, + dlls/rsaenh/tests/rsaenh.c, dlls/user/tests/msg.c: + Francois Gouget + Add trailing '\n's to ok() calls. + + * tools/findfunc, tools/font_convert.sh: + Francois Gouget + Use '=' instead of '==' in /bin/sh scripts to avoid portability + problems. + + * dlls/cabinet/cabinet_main.c, dlls/gdi/region.c, dlls/rsaenh/rsaenh.c, + dlls/shlwapi/string.c, dlls/shlwapi/url.c, dlls/x11drv/palette.c, + dlls/x11drv/window.c: + Michael Stefaniuc + Missing HeapFree's + 1 LocalFree (found by smatch). + + * dlls/ole32/hglobalstream.c: Robert Shearman + Fixed incorrect unsigned test. + +2004-12-13 Alexandre Julliard + + * dlls/comctl32/tests/imagelist.c, dlls/devenum/createdevenum.c, + dlls/devenum/devenum_private.h, dlls/dsound/tests/dsound_test.h, + dlls/glu32/glu.c, dlls/kernel/tests/pipe.c, + dlls/kernel/tests/thread.c, dlls/msacm/wineacm.h, dlls/msi/sql.y, + dlls/msvcrt/msvcrt.h, dlls/ole32/compobj.c, + dlls/ole32/compobj_private.h, dlls/ole32/ifs.h, dlls/ole32/moniker.c, + dlls/ole32/ole2.c, dlls/ole32/oleobj.c, dlls/oleaut32/typelib.c, + dlls/richedit/reader.c, dlls/richedit/rtf2text.h, + dlls/shell32/undocshell.h, dlls/uxtheme/uxthemedll.h, + dlls/winaspi/aspi.c, dlls/winaspi/winescsi.h, dlls/winedos/vga.h, + dlls/wininet/internet.c, dlls/wininet/internet.h, + dlls/winspool/wspool.c, include/imm.h, include/msi.h, + include/msvcrt/eh.h, include/msvcrt/stddef.h, + include/msvcrt/stdlib.h, include/shlwapi.h, include/uxtheme.h: + Eric Pouech + Fixed some errors in function prototypes. + + * dlls/ntdll/ntdll.spec, dlls/ntdll/ntdll_misc.h, dlls/ntdll/sync.c, + dlls/ntdll/time.c, include/wine/server_protocol.h, + include/winternl.h, server/protocol.def, server/request.h, + server/timer.c, server/trace.c: + Robert Shearman + Implement NtQueryTimer. + + * programs/winhelp/Makefile.in, programs/winhelp/callback.c, + programs/winhelp/hlpfile.c, programs/winhelp/macro.c, + programs/winhelp/macro.h, programs/winhelp/macro.lex.l, + programs/winhelp/winhelp.c, programs/winhelp/winhelp.h: + Eric Pouech + - added support plug-in DLLs for winhelp + - added preliminary support for plug-in callback into winhelp + - rewrote all the macros accordingly (macro entry-point has to have + WINAPI calling convention) + - some fixes for embedded images decompression + - misc cleanups + + * dlls/d3d9/device.c, dlls/wined3d/device.c, dlls/wined3d/directx.c, + dlls/wined3d/drawprim.c, dlls/wined3d/stateblock.c, + dlls/wined3d/utils.c, dlls/wined3d/wined3d_private.h, + include/wine/wined3d_interface.h: + Jason Edmeades + Add {G,S}etRenderState and {G,S}etTextureStageState support, and + ensure the stateblock is fully populated at device startup. + + * dlls/msacm/pcmconverter.c: Robert Reif + Make the PCM conversion routines of msacm produce identical results to + the native dll. + Allow any PCM to PCM conversion, not just advertised ones. + + * dlls/oleaut32/oaidl_p.c: Hans Leidekker + Fix compilation with GCC 4. + + * dlls/rsaenh/implglue.c, dlls/rsaenh/rsaenh.c, + dlls/rsaenh/tests/rsaenh.c: + Michael Jung + Implemented CPSignHash and CPVerifySignature. + Added tests for CPVerifySignature. + Fixed minor bugs in implglue.c. + + * dlls/mscms/icc.c, dlls/mscms/mscms.spec, dlls/mscms/mscms_priv.h, + dlls/mscms/profile.c, dlls/mscms/tests/profile.c, include/icm.h: + Hans Leidekker + Test and implement SetColorProfileElement. + Document more functions. + + * dlls/iphlpapi/ifenum.c, dlls/iphlpapi/ifenum.h, + dlls/iphlpapi/iphlpapi_main.c, dlls/iphlpapi/ipstats.c, + dlls/iphlpapi/ipstats.h: + Juan Lang + - use Heap functions rather than libc for mem allocation + - document a bunch of functions + + * dlls/setupapi/queue.c: Gerald Pfeifer + Use proper type for fourth parameter to VerQueryValueW(). + + * fonts/wine_courier.sfd, fonts/wine_sans_serif.sfd, fonts/wine_system.sfd: + Dmitry Timoshkov + Add my name to the fonts copyright string. + + * dlls/dinput/joystick_linux.c, dlls/dinput/joystick_linuxinput.c, + dlls/dinput/keyboard.c, dlls/dinput/mouse.c: + Christian Costa + Handle device class in DX8 enumeration (found by Robert Reif). + Fixed remaining DX8 device types. + Factorized a bit GetCapabilities for keyboard and mouse. + + * include/amstream.idl, include/mlang.idl: + Jacek Caban + Added CMultiLanguage and AMMultiMediaStream coclass declarations. + + * dlls/gdi/freetype.c: Huw Davies + Fix always false test. Spotted by Eric Pouech. + + * dlls/winedos/int21.c, dlls/itss/storage.c: + Eric Pouech + Fixed copy&paste error. + + * dlls/dplayx/dplayx_messages.c, dlls/wininet/utility.c: + Eric Pouech + Fixed array index overflow. + + * tools/winemaker: Michael Jung + Fixed compilation with perl 5.8. + +2004-12-10 Alexandre Julliard + + * dlls/comctl32/comctl32undoc.c, dlls/comctl32/tests/.cvsignore, + dlls/comctl32/tests/Makefile.in, dlls/comctl32/tests/mru.c: + Jon Griffiths + Implement the remaining MRU functions, fix a couple of differences + from native comctl32, add tests of MRU behaviour and documentation. + + * dlls/msvcrt/file.c, dlls/msvcrt/main.c, dlls/msvcrt/msvcrt.spec, + dlls/msvcrt40/msvcrt40.spec: + Rein Klazes + - implement __pioinfo, __badioinfo and _adjust_fdiv + - remove all stubs of data item from the spec file, those actually may + hide problems. + + * dlls/msi/msi.c, dlls/msi/msiquery.c, dlls/msi/table.c: + Michael Stefaniuc + Add missing HeapFree's (found by smatch). + +2004-12-09 Alexandre Julliard + + * dlls/user/combo.c, dlls/x11drv/window.c, dlls/x11drv/winpos.c: + Added some sanity checks on window dimensions. + + * dlls/ntdll/directory.c: + Fixed read_directory_getdents for large directories (found by Rein + Klazes). + + * dlls/advapi32/service.c: Alexander Yaworsky + Check service database name in OpenSCManager(). + + * dlls/msvcrt/file.c, dlls/msvcrt/msvcrt.spec: + Juan Lang + - implement _dup, _dup2, and _pipe + - make max file descriptors 2048 to match MS + - increase max file streams to match + + * dlls/avifil32/avifile.c, dlls/comctl32/datetime.c, + dlls/comctl32/tab.c, dlls/commdlg/printdlg.c, dlls/d3d8/device.c, + dlls/d3d8/drawprim.c, dlls/d3d8/utils.c, + dlls/d3d8/vshaderdeclaration.c, dlls/ddraw/d3ddevice/mesa.c, + dlls/ddraw/d3dtexture.c, dlls/ddraw/d3dvertexbuffer.c, + dlls/ddraw/dsurface/fakezbuffer.c, dlls/ddraw/mesa.c, + dlls/dmime/performance.c, dlls/dmloader/classfactory.c, + dlls/dmloader/loader.c, dlls/dsound/sound3d.c, dlls/itss/chm_lib.c, + dlls/kernel/tests/locale.c, dlls/msvcrt/lock.c, + dlls/ole32/compositemoniker.c, dlls/ole32/storage32.c, + dlls/quartz/systemclock.c, dlls/serialui/confdlg.c, + dlls/shell32/shellole.c, dlls/user/menu.c, dlls/winaspi/winaspi16.c, + dlls/wined3d/device.c, dlls/wined3d/directx.c, + dlls/wined3d/drawprim.c, dlls/wineps/glyphlist.c, + dlls/winmm/mciwave/mciwave.c, programs/regedit/framewnd.c, + programs/uninstaller/main.c, windows/winproc.c: + Janitorial: C booleans must not be compared against TRUE. + + * dlls/user/Makefile.in, dlls/user/sysparams.c, dlls/user/user_main.c, + dlls/user/user_private.h, windows/sysmetrics.c, windows/sysparams.c: + Merged system metrics support into sysparams.c, and moved that file to + the dlls/user directory. + + * dlls/dmcompos/chordmap.c, dlls/dmcompos/chordmaptrack.c, + dlls/dmcompos/composer.c, dlls/dmcompos/dmcompos_main.c, + dlls/dmcompos/dmcompos_private.h, dlls/dmcompos/signposttrack.c: + James Hawkins + Properly implement DllCanUnloadNow ref counting. + + * dlls/shell32/shell32_Es.rc: + José Manuel Ferrer Ortiz + Added some Spanish translations. + + * dlls/gdi/gdi32.spec, windows/nonclient.c: + Remove a few no longer needed 16-bit exports from gdi32. + + * dlls/ttydrv/dc.c, dlls/ttydrv/ttydrv.h, dlls/ttydrv/ttydrv.spec, + dlls/ttydrv/wnd.c: + Use an escape mechanism similar to the x11drv one to set the DC + origin. + + * dlls/d3d9/device.c, dlls/wined3d/Makefile.in, dlls/wined3d/device.c, + dlls/wined3d/drawprim.c, dlls/wined3d/utils.c, + dlls/wined3d/wined3d_private.h, include/wine/wined3d_interface.h: + Jason Edmeades + Add {G,S}etIndices, {G,S}Viewport and enable the basic drawing + functionality into wined3d and call from d3d9. + + * dlls/shell32/shell32_Ca.rc, dlls/shell32/shell32_Cn.rc, + dlls/shell32/shell32_Cs.rc, dlls/shell32/shell32_Da.rc, + dlls/shell32/shell32_De.rc, dlls/shell32/shell32_En.rc, + dlls/shell32/shell32_Eo.rc, dlls/shell32/shell32_Es.rc, + dlls/shell32/shell32_Fi.rc, dlls/shell32/shell32_Fr.rc, + dlls/shell32/shell32_Hu.rc, dlls/shell32/shell32_It.rc, + dlls/shell32/shell32_Ja.rc, dlls/shell32/shell32_Ko.rc, + dlls/shell32/shell32_Nl.rc, dlls/shell32/shell32_No.rc, + dlls/shell32/shell32_Pl.rc, dlls/shell32/shell32_Pt.rc, + dlls/shell32/shell32_Ru.rc, dlls/shell32/shell32_Si.rc, + dlls/shell32/shell32_Sk.rc, dlls/shell32/shell32_Sv.rc, + dlls/shell32/shell32_Uk.rc, dlls/shell32/shell32_Wa.rc, + dlls/shell32/shell32_Zh.rc, dlls/shell32/shell32_main.c: + Klemens Friedl + More Windows-like About dialog. + + * dlls/gdi/tests/metafile.c: Walt Ogburn + Added some tests for win-format metafiles. + + * dlls/devenum/mediacatenum.c: Christian Costa + Initialize the hkey member when creating the propery bag object. + + * dlls/oleaut32/typelib.c: Huw Davies + Remove the remaining dependencies on internal structures from Invoke. + +2004-12-08 Alexandre Julliard + + * dlls/imm32/imm.c: + Revert previous change since it causes a crash in desktop mode. + + * dlls/user/painting.c: Rein Klazes + GetUpdateRect can be called with a NULL rect. + + * dlls/user/message.c, dlls/user/user32.spec, include/winuser.h: + Mike McCormack + Stub implementation for GetLastInputInfo. + + * dlls/comctl32/syslink.c: Thomas Weidenmüller + Free allocated font handles when control is destroyed. + + * dlls/quartz/systemclock.c: Christian Costa + Allocate the proper size for the SystemClock object. + + * dlls/oleaut32/typelib.c: Huw Davies + GetTypeAttr should deep copy the typedesc. + + * dlls/user/button.c, dlls/user/combo.c, dlls/user/comm16.c, + dlls/user/controls.h, dlls/user/desktop.c, dlls/user/dialog16.c, + dlls/user/display.c, dlls/user/edit.c, dlls/user/focus.c, + dlls/user/hook.c, dlls/user/hook16.c, dlls/user/listbox.c, + dlls/user/menu.c, dlls/user/message.c, dlls/user/message.h, + dlls/user/msg16.c, dlls/user/resource.c, dlls/user/scroll.c, + dlls/user/static.c, dlls/user/text.c, dlls/user/uitools.c, + dlls/user/user16.c, dlls/user/user_main.c, dlls/user/user_private.h, + dlls/user/wnd16.c, dlls/x11drv/x11drv.h, dlls/x11drv/x11drv_main.c, + include/user.h, include/win.h, windows/class.c, windows/clipboard.c, + windows/cursoricon.c, windows/dce.c, windows/defwnd.c, + windows/dialog.c, windows/input.c, windows/mdi.c, windows/message.c, + windows/msgbox.c, windows/nonclient.c, windows/queue.c, + windows/scroll.c, windows/spy.c, windows/syscolor.c, + windows/sysmetrics.c, windows/sysparams.c, windows/user.c, + windows/win.c, windows/winpos.c, windows/winproc.c: + Moved private USER definitions to a new user_private.h header, and + removed the global user.h. + + * dlls/ole32/compobj_private.h, dlls/ole32/marshal.c, dlls/ole32/rpc.c: + Robert Shearman + - Make the wine_marshal_id structure more like the DCOM OBJREF + structure, by replacing the process id field by apartment id (OXID), + changing the users of the process id field to use the new field and + renaming the objectid field to oid. + - Fix StdMarshalImpl_UnmarshalInterface to invalidate and release its + stub when doing a same apartment marshal. + + * dlls/oleaut32/typelib.c: Huw Davies + Fix return value of GetVarIndexOfMemId. + + * dlls/user/kbd16.c, dlls/user/mouse16.c, dlls/user/user16.c, + windows/clipboard.c, windows/input.c, windows/syscolor.c, + windows/sysmetrics.c, windows/user.c: + Moved some more 16-bit USER functions to the corresponding 16-bit + files. + + * dlls/user/Makefile.in, dlls/user/user_main.c, include/user.h, + windows/painting.c: + Moved palette functions to user_main.c and removed + windows/painting.c. + + * dlls/ntdll/directory.c: Gerald Pfeifer + Avoid a warning on FreeBSD. + + * dlls/advapi32/advapi32.spec, dlls/advapi32/security.c: + Mike McCormack + Stub implementations for Lsa(Store/Retrieve)PrivateData. + + * dlls/advapi32/service.c: Alexander Yaworsky + Notify StartService when service control dispatcher has been + started. Otherwise StartService terminates service process. + + * dlls/oleaut32/variant.c, include/wtypes.idl: + Robert Shearman + Make the DECIMAL_SETZERO macro take a DECIMAL instead of a DECIMAL* as + in the Microsoft headers and fix up the only caller. + + * dlls/winmm/winemm.h, dlls/winmm/winmm.c, include/dsound.h, + include/mmsystem.h: + Ge van Geldorp + Match PSDK definitions for LPCWAVEFORMATEX. + + * dlls/shlwapi/tests/ordinal.c: + Stefan Leichter + Fixed tests of GetAcceptLanguagesA for win9x/ME. + + * dlls/netapi32/nbt.c: Juan Lang + Convert some registry calls from A to W. + + * dlls/urlmon/tests/url.c, dlls/urlmon/umon.c: + Jacek Caban + - Implemented CreateAsyncBindCtx. + - Added test. + + * dlls/winmm/winejack/Makefile.in, dlls/winmm/winejack/audio.c: + Michael Jung + Fixed linking issues. + + * tools/c2man.pl: Jon Griffiths + Param descriptions can be >1 lines. + Allow '-' in comment names, convert it to space on display. + Allow struct members to be documented (automatically, one day). + Allow for many comments which start with "name (dll.ord) + description". + + * include/commctrl.h: Jon Griffiths + Unicode fixes. + + * dlls/user/hook.c: Dmitry Timoshkov + Indicate that support for HCBT_SYSCOMMAND hooks is implemented. + +2004-12-07 Alexandre Julliard + + * dlls/user/tests/msg.c: + Added a bunch of tests for various behaviors of RedrawWindow. + + * dlls/ttydrv/wnd.c, dlls/user/painting.c, dlls/x11drv/window.c, + dlls/x11drv/winpos.c, dlls/x11drv/x11drv.h, include/win.h, + include/wine/server_protocol.h, server/protocol.def, + server/request.h, server/trace.c, server/window.c, + windows/painting.c, windows/win.c: + Moved update region handling to the server. + + * configure, configure.ac, include/config.h.in, tools/winebuild/main.c, + tools/winegcc/winegcc.c: + Paul Millar + Check for features missing in mingw environment, allowing tools + subdirectory to be cross-built again. + + * dlls/msvcrt/file.c: Juan Lang + Flush file in fputc when character is '\n'. + + * dlls/ole32/compobj.c, dlls/ole32/compobj_private.h, + dlls/ole32/marshal.c, dlls/ole32/rpc.c: + Mike Hearn + Rename the STUBMGR thread to more accurately reflect its purpose. + + * dlls/oleaut32/typelib.c: Huw Davies + Remove Invoke's dependence on the internal TLBFuncDesc structure. + Fix memory leaks in some failure cases. + + * tools/wrc/genres.c: Removed an unused function. + + * dlls/ntdll/Makefile.in, dlls/ntdll/handletable.c, + dlls/ntdll/ntdll.spec, dlls/ntdll/tests/rtl.c, include/winternl.h: + Robert Shearman + Implement handle tables and add tests for them. + + * dlls/mscms/Makefile.in, dlls/mscms/icc.c, dlls/mscms/mscms.spec, + dlls/mscms/mscms_priv.h, dlls/mscms/profile.c, + dlls/mscms/tests/profile.c, include/icm.h: + Hans Leidekker + Move ICC profile handling into its own file. + Test GetColorProfileFromHandle and SetColorProfileHeader. + Test and partially implement {G,S}etStandardColorSpaceProfile{A,W}. + Improve existing tests and fix any bugs they revealed. + + * dlls/devenum/createdevenum.c, dlls/devenum/devenum_main.c, + dlls/devenum/devenum_private.h, dlls/devenum/factory.c, + dlls/devenum/mediacatenum.c, dlls/devenum/parsedisplayname.c: + Robert Shearman + Clean up devenum and properly implement DllCanUnloadNow ref counting. + + * dlls/winmm/winejack/audio.c: Fixed compile error. + + * dlls/d3d9/basetexture.c, dlls/d3d9/d3d9_private.h, + dlls/d3d9/resource.c, dlls/wined3d/Makefile.in, + dlls/wined3d/basetexture.c, dlls/wined3d/wined3d_private.h, + include/wine/wined3d_interface.h: + Jason Edmeades + Add BaseTexture class support, call from d3d9. + + * dlls/comctl32/datetime.c, dlls/comctl32/rebar.c, + dlls/comctl32/tooltips.c: + Filip Navara + - Don't use DrawEdge with NULL device context, it's invalid call and + sets last error. + - Tooltip icons must be destroyed with DestroyIcon and not with + DeleteObject. + - Rebar cursors must be destroyed with DestroyCursor and not with + DeleteObject. + + * dlls/advapi32/service.c: Alexander Yaworsky + Implemented RegisterServiceCtrlHandler, ControlService. + + * dlls/dsound/dsound.c: Tomas Vanek + Fixed no memory condition test in IDirectSoundImpl_Create. + + * dlls/kernel/sync.c: Juan Lang + Use W calls rather than A in CreatePipe. + + * dlls/dinput/dinput_main.c, dlls/dinput/joystick_linux.c, + dlls/dinput/joystick_linuxinput.c: + Christian Costa + Fixed enumeration of joysticks in DX8. + Fixed some traces. + + * dlls/oleaut32/typelib.c: Huw Davies + GetFuncIndexOfMemId should respect invkind and return + TYPE_E_ELEMENTNOTFOUND if the function cannot be found. + +2004-12-06 Alexandre Julliard + + * dlls/winmm/joystick.c, dlls/winmm/joystick/Makefile.in, + dlls/winmm/joystick/joystick.c, dlls/winmm/message16.c, + dlls/winmm/mmsystem.c, dlls/winmm/playsound.c, dlls/winmm/winmm.c, + dlls/winmm/midimap/midimap.c, dlls/winmm/wavemap/wavemap.c, + dlls/winmm/winealsa/audio.c, dlls/winmm/winealsa/audio_05.c, + dlls/winmm/winealsa/midi.c, dlls/winmm/winearts/audio.c, + dlls/winmm/wineaudioio/audio.c, dlls/winmm/winejack/audio.c, + dlls/winmm/winenas/audio.c, dlls/winmm/wineoss/audio.c, + dlls/winmm/wineoss/audio.h, dlls/winmm/wineoss/dscapture.c, + dlls/winmm/wineoss/dsrender.c, dlls/winmm/wineoss/midi.c, + dlls/winmm/wineoss/mixer.c, dlls/winmm/wineoss/mmaux.c: + Eric Pouech + Filip Navara + 32 bit low level drivers now use a Unicode interface (used to be ANSI): + - Send the *_GETDEVCAPS messages in unicode format from the + *GetDevCapsW function and call the *GetDevCapsW from their respective + Ansi versions. + - Modify all low level drivers to correctly process the *_GETDEVCAPS + messages as unicode. + - *_GETDEVCAPS messages are now mapped from/to unicode for 16 bit code. + - Removed all SoundBlaster naming oldies. + Better use of some unicode functions (instead of Ansi) in winmm. + + * dlls/d3d9/vertexshader.c, include/user.h, libs/unicode/utf8.c, + programs/wcmd/directory.c, server/object.c, server/trace.c, + tools/widl/parser.l, tools/widl/typelib.c, tools/winedump/main.c, + tools/winedump/ne.c, tools/winedump/pe.c, tools/winedump/search.c, + tools/wmc/lang.c, tools/wmc/mcl.c, windows/cursoricon.c, + windows/dialog.c, windows/mdi.c, windows/spy.c: + Eric Pouech + Another round of const correctness fixes. + + * dlls/imm32/imm.c: Ivan Leo Puoti + Register the IME class when imm32.dll is loaded. + + * dlls/advapi32/tests/crypt.c: + Stefan Leichter + Fix missing imports on NT4. + + * dlls/dsound/propset.c: Robert Reif + Return the actual device interface name. + Fixes some memory leaks. + + * dlls/x11drv/keyboard.c: Jean-Michel Dault + Added another Canadian keyboard layout. + + * dlls/winsock/socket.c: Fixed a leak in getsockname. + Replaced malloc by HeapAlloc. + + * dlls/ntdll/directory.c: + Use a direct getdents syscall on Linux to avoid relying on + implementation details of seekdir/telldir. + + * tools/fnt2bdf.c, tools/winedump/pe.c, tools/winegcc/winegcc.c, + tools/wrc/dumpres.c, tools/wrc/genres.c, tools/wrc/readres.c: + Eric Pouech + Another couple of missing static definitions. + + * documentation/configuring.sgml, documentation/faq.sgml, + documentation/running.sgml: + Diego Pettenň + Updated the documentation telling to use the + HKEY_CURRENT_USER/Environment key instead of the [wine] section for + Path, Temp and System variables. + + * dlls/user/tests/msg.c, dlls/x11drv/winpos.c: + Dmitry Timoshkov + ShowWindow activates only a being maximized child window, add a couple + of message tests for MDI child activation. + + * programs/winedbg/debugger.h, programs/winedbg/memory.c: + Jeremy White + Properly respect a disassemble x,y command (prior behavior would do + y-x instructions, no matter how wide each instruction was). + + * dlls/ddraw/d3ddevice/mesa.c, dlls/ddraw/ddraw/hal.c: + Dmitry Timoshkov + Avoid crashes in ddraw.dll when loading it without x11drv, for + instance from wineprefixcreate in a text mode console. + + * dlls/setupapi/devinst.c, dlls/setupapi/setupapi.spec: + Mike McCormack + Stub implementation for SetupDiOpenDeviceInterface. + + * dlls/msi/record.c: Ulrich Czekalla + Set the out buffer count to zero on read error. + + * dlls/msi/table.c: Mike McCormack + Fix transposition of 4 byte values when reading in table data from + storage. + + * dlls/advapi32/advapi32.spec, dlls/advapi32/security.c, + dlls/advapi32/service.c: + Mike McCormack + Stub implementations for DecryptFile, EncryptFile and + GetServiceDisplayName. + + * dlls/comctl32/commctrl.c: Eric Kohl + DrawStatusText() must not process prefix characters. + + * programs/notepad/dialog.c: Juan Lang + Send EM_SETMODIFY after saving. + + * dlls/msvcrt/file.c: Juan Lang + Set st_mode bits in _fstati64. + + * include/winuser.h: Rémi Assailly + Added two missing styles. + + * dlls/d3d8/shader.c: Christian Costa + S/W vshader fixes (spotted by Eric Pouech). + + * windows/mdi.c: Filip Navara + Don't call SetScrollInfo with SB_BOTH bar type. + + * dlls/cabinet/fdi.c: Filip Navara + Don't try to free pointer from union that isn't used. + + * dlls/msvcrt/process.c: Juan Lang + msvcrt_spawn should free STARTUPINFOA's lpReserved2, not its address. + + * dlls/wintab32/context.c: Robert North <7ownq0k402@sneakemail.com> + Set the values WTInfoA returns from screen size for CTX_SYSEXTX and + CTX_SYSEXTY context fields, to match Windows behaviour. + + * configure, configure.ac, include/config.h.in: + Vincent Béron + Remove some unused tests. + + * dlls/ole32/clipboard.c, dlls/ole32/ole2.c, dlls/richedit/richedit.c, + dlls/setupapi/virtcopy.c, dlls/shell32/shlview.c, + dlls/shell32/systray.c, dlls/user/tests/input.c, + programs/rundll32/rundll32.c, programs/view/init.c: + Robert Shearman + Remove unnecessary WNDPROC casts. + + * dlls/quartz/filtergraph.c: Christian Costa + Better handling of errors in RenderFile. + + * dlls/shell32/tests/shlfileop.c: + Stefan Leichter + Fix missing imports of the test program on NT4. + + * include/objbase.h: Robert Shearman + Remove duplicate function declaration. + + * dlls/dsound/buffer.c, dlls/dsound/propset.c: + Robert Reif + Always create a property set for secondary buffers. + + * dlls/dbghelp/pe_module.c: James Hawkins + Remove c++-style comment. + + * dlls/wininet/http.c: Mike McCormack + Make sure to insert the proxy authentication header if necessary. + + * dlls/ntdll/time.c: Stewart Allen + Added SAST (South African Standard Time), corrected CAT to Central + African Time. + + * dlls/kernel/computername.c: Dmitry Timoshkov + Perform host name initialization if computer name can't be read from + registry. + + * dlls/rsaenh/implglue.c: Michael Jung + Added a missing break in encrypt_block_impl. + + * dlls/advapi32/service.c: Alexander Yaworsky + Implemented SetServiceStatus, QueryServiceStatus. + + * dlls/advapi32/tests/crypt.c: James Hawkins + Only call test_set_provider_ex() once. + + * dlls/shell32/version.h: Juan Lang + Revert shell32 version to Win2K SP4 level. + +2004-12-02 Alexandre Julliard + + * dlls/oleaut32/typelib.c: Huw Davies + Allocate the TYPEATTR rather than copying it. + For a dual interface the dispinterface's cfuncs should include the + inherited functions, cbSizeVft should just be the size of IDispatch's + vtbl and we should strip TYPEFLAG_FOLEAUTOMATION. + + * documentation/PACKAGING: Jon Griffiths + Spelling/grammar fixes. + + * tools/font_convert.sh: Jon Griffiths + Use mktemp if we don't have tempfile. + Use the installed version of fnt2bdf if present. + Quote the pattern given to `find`. + Copy the fonts to the temp working dir before processing. + Always delete the temp directory before exiting. + Install fonts compressed by default. + + * dlls/advapi32/service.c: Alexander Yaworsky + Basic implementation of service control dispatcher. + + * tools/winebuild/main.c, tools/winegcc/winegcc.c: + Clean up temp files also when killed by a signal. + + * dlls/msvcrt/cppexcept.c, dlls/msvcrt/except.c, + dlls/msvcrt/tests/cpp.c, dlls/ntdll/signal_i386.c, + dlls/ntdll/virtual.c, libs/wine/ldt.c, loader/kthread.c, + loader/preloader.c, server/fd.c: + Peter Chapman <9gfrye202@sneakemail.com> + Fix up several inline assembler blocks so that they produce correct + code with the -fomit-frame-pointer gcc flag. + + * dlls/advpack/advpack.c, dlls/setupapi/Makefile.in, + dlls/setupapi/devinst.c, dlls/setupapi/parser.c, + dlls/setupapi/setupapi.spec, dlls/setupapi/stubs.c, + include/setupapi.h: + Eric Kohl + Implement SetupDiBuildClassInfoList(ExW), + SetupDiClassGuidsFromName(W/ExW), SetupDiClassNameFromGuid(W/ExW), + SetupDiGetActualSectionToInstallW, SetupDiGetClassDescription(W/ExW), + SetupDiInstallClassW partially, SetupDiOpenClassRegKey(ExW), + SetupOpenMasterInf. + + * dlls/kernel/sync.c, dlls/ntdll/ntdll.spec, dlls/ntdll/sync.c, + include/wine/server_protocol.h, include/winternl.h, server/event.c, + server/mutex.c, server/protocol.def, server/semaphore.c, + server/timer.c, server/trace.c: + Eric Pouech + - moved event, semaphore, mutex implementation from kernel32 to ntdll + - added mutant implementation in ntdll, and use it for mutex + implementation in kernel32 + - added access parameter on event, semaphore, timer creation in + wineserver (as ntdll interface requires it) + - added missing definitions in include/winternl.h + + * dlls/cabinet/cabextract.c: James Hawkins + Fix cabextract memory leak. + +2004-12-01 Alexandre Julliard + + * ANNOUNCE, ChangeLog, VERSION, configure: Release 20041201. + +---------------------------------------------------------------- 2004-12-01 Alexandre Julliard * dlls/kernel/thread.c: Dmitry Timoshkov diff -urN wine-20041201/LICENSE wine-20050111/LICENSE --- wine-20041201/LICENSE 2004-01-14 06:10:45.000000000 +0100 +++ wine-20050111/LICENSE 2005-01-03 17:53:50.000000000 +0100 @@ -1,4 +1,4 @@ -Copyright (c) 1993-2004 the Wine project authors (see the file AUTHORS +Copyright (c) 1993-2005 the Wine project authors (see the file AUTHORS for a complete list) Wine is free software; you can redistribute it and/or modify it under diff -urN wine-20041201/README wine-20050111/README --- wine-20041201/README 2004-11-21 16:33:00.000000000 +0100 +++ wine-20050111/README 2005-01-03 15:27:23.000000000 +0100 @@ -44,10 +44,8 @@ it's best to have a current kernel such as 2.4.x. FreeBSD info: - Wine should build on FreeBSD 4.x and FreeBSD 5.x before 5.3, but will - generally not work on these systems due to issues with threading and - mmap(). In fact, even on FreeBSD 5.3 you will need the kernel patch - posted at . + Wine should build on FreeBSD 4.x and FreeBSD 5.x, but versions before + FreeBSD 5.3 will generally not work properly. More information can be found in the FreeBSD ports tree at . @@ -92,9 +90,6 @@ If you want CUPS printing support, please install both cups and cups-devel packages. - For the automatic processing of the test suite scripts, you also need - libperl development header support (libperl-dev package on Debian). - For requirements in case you intend to build the documentation yourself, see "DOCUMENTATION" section. diff -urN wine-20041201/VERSION wine-20050111/VERSION --- wine-20041201/VERSION 2004-12-01 18:27:33.000000000 +0100 +++ wine-20050111/VERSION 2005-01-11 20:08:58.000000000 +0100 @@ -1 +1 @@ -Wine version 20041201 +Wine version 20050111 diff -urN wine-20041201/configure wine-20050111/configure --- wine-20041201/configure 2004-12-01 18:27:33.000000000 +0100 +++ wine-20050111/configure 2005-01-11 20:08:58.000000000 +0100 @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.59 for Wine 20041201. +# Generated by GNU Autoconf 2.59 for Wine 20050111. # # Report bugs to . # @@ -269,8 +269,8 @@ # Identity of this package. PACKAGE_NAME='Wine' PACKAGE_TARNAME='wine' -PACKAGE_VERSION='20041201' -PACKAGE_STRING='Wine 20041201' +PACKAGE_VERSION='20050111' +PACKAGE_STRING='Wine 20050111' PACKAGE_BUGREPORT='wine-devel@winehq.org' ac_unique_file="server/atom.c" @@ -311,7 +311,7 @@ # include #endif" -ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS WIN16_FILES WIN16_INSTALL DLLDEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPPBIN ac_ct_CPPBIN TOOLSDIR CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LEX LEXLIB LEX_OUTPUT_ROOT XLEX BISON AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN EGREP LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS DB2TXT FONTFORGE LIBPTHREAD XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS ft_devel ft_devel2 FREETYPELIBS FREETYPEINCL FONTSSUBDIRS ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS CAPI4LINUXLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS LDLIBWINEFLAGS COREFOUNDATIONLIB IOKITLIB CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS SOCKETLIBS WINE_BINARIES MAIN_BINARY LDD ALLOCA LIBOBJS LTLIBOBJS' +ac_subst_vars='SHELL PATH_SEPARATOR PACKAGE_NAME PACKAGE_TARNAME PACKAGE_VERSION PACKAGE_STRING PACKAGE_BUGREPORT exec_prefix prefix program_transform_name bindir sbindir libexecdir datadir sysconfdir sharedstatedir localstatedir libdir includedir oldincludedir infodir mandir build_alias host_alias target_alias DEFS ECHO_C ECHO_N ECHO_T LIBS WIN16_FILES WIN16_INSTALL DLLDEFS build build_cpu build_vendor build_os host host_cpu host_vendor host_os SET_MAKE CC CFLAGS LDFLAGS CPPFLAGS ac_ct_CC EXEEXT OBJEXT CXX CXXFLAGS ac_ct_CXX CPPBIN ac_ct_CPPBIN TOOLSDIR CPP X_CFLAGS X_PRE_LIBS X_LIBS X_EXTRA_LIBS LEX LEXLIB LEX_OUTPUT_ROOT XLEX BISON AS ac_ct_AS LD ac_ct_LD AR ac_ct_AR RANLIB ac_ct_RANLIB STRIP ac_ct_STRIP WINDRES ac_ct_WINDRES LN_S LN EGREP LDCONFIG INSTALL_PROGRAM INSTALL_SCRIPT INSTALL_DATA LINT LINTFLAGS DB2HTML DB2PDF DB2PS DB2TXT FONTFORGE LIBPTHREAD XLIB XFILES OPENGLFILES GLU32FILES OPENGL_LIBS GLUT_LIBS GLUT32FILES NASLIBS CURSESLIBS sane_devel SANELIBS SANEINCL ICULIBS ft_devel ft_devel2 FREETYPELIBS FREETYPEINCL FONTSSUBDIRS ARTSCCONFIG ARTSLIBS ARTSINCL ALSALIBS AUDIOIOLIBS EXTRACFLAGS DLLEXT DLLFLAGS DLLIBS LDSHARED LDDLLFLAGS LIBEXT IMPLIBEXT DLLTOOL ac_ct_DLLTOOL DLLWRAP ac_ct_DLLWRAP LDEXECFLAGS LDLIBWINEFLAGS COREFOUNDATIONLIB IOKITLIB CROSSTEST CROSSCC CROSSWINDRES LDPATH CRTLIBS SOCKETLIBS WINE_BINARIES MAIN_BINARY LDD ALLOCA LIBOBJS LTLIBOBJS' ac_subst_files='MAKE_RULES MAKE_DLL_RULES MAKE_TEST_RULES MAKE_LIB_RULES MAKE_PROG_RULES' # Initialize some variables set by options. @@ -788,7 +788,7 @@ # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures Wine 20041201 to adapt to many kinds of systems. +\`configure' configures Wine 20050111 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -853,7 +853,7 @@ if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of Wine 20041201:";; + short | recursive ) echo "Configuration of Wine 20050111:";; esac cat <<\_ACEOF @@ -984,7 +984,7 @@ test -n "$ac_init_help" && exit 0 if $ac_init_version; then cat <<\_ACEOF -Wine configure 20041201 +Wine configure 20050111 generated by GNU Autoconf 2.59 Copyright (C) 2003 Free Software Foundation, Inc. @@ -998,7 +998,7 @@ This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by Wine $as_me 20041201, which was +It was created by Wine $as_me 20050111, which was generated by GNU Autoconf 2.59. Invocation command line was $ $0 $@ @@ -7260,19 +7260,6 @@ - - - - - - - - - - - - - for ac_header in \ arpa/inet.h \ arpa/nameser.h \ @@ -7289,8 +7276,6 @@ jpeglib.h \ lcms/lcms.h \ lcms.h \ - libio.h \ - libutil.h \ link.h \ linux/cdrom.h \ linux/compiler.h \ @@ -7309,22 +7294,15 @@ netinet/in_systm.h \ netinet/tcp.h \ netinet/tcp_fsm.h \ - openssl/des.h \ - openssl/md2.h \ - openssl/rc2.h \ - openssl/rc4.h \ - openssl/rsa.h \ openssl/ssl.h \ process.h \ pthread.h \ - pty.h \ pwd.h \ regex.h \ sched.h \ scsi/sg.h \ scsi/scsi.h \ scsi/scsi_ioctl.h \ - socket.h \ stdint.h \ strings.h \ sys/cdio.h \ @@ -7332,9 +7310,7 @@ sys/errno.h \ sys/epoll.h \ sys/exec_elf.h \ - sys/file.h \ sys/filio.h \ - sys/inttypes.h \ sys/ioctl.h \ sys/ipc.h \ sys/link.h \ @@ -7360,8 +7336,6 @@ sys/times.h \ sys/uio.h \ sys/un.h \ - sys/v86.h \ - sys/v86intr.h \ sys/vfs.h \ sys/vm86.h \ sys/wait.h \ @@ -7738,7 +7712,6 @@ - for ac_header in X11/XKBlib.h \ X11/Xutil.h \ X11/extensions/shape.h \ @@ -7746,7 +7719,6 @@ X11/extensions/XShm.h \ X11/extensions/Xrandr.h \ X11/extensions/Xrender.h \ - X11/extensions/Xvlib.h \ X11/extensions/xf86dga.h \ X11/extensions/xf86vmode.h do @@ -8242,83 +8214,6 @@ rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi - if test "$ac_cv_header_X11_extensions_Xvlib_h" = "yes" - then - echo "$as_me:$LINENO: checking for XvShmCreateImage in -lXv" >&5 -echo $ECHO_N "checking for XvShmCreateImage in -lXv... $ECHO_C" >&6 -if test "${ac_cv_lib_Xv_XvShmCreateImage+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lXv $X_LIBS -lXext -lX11 $X_EXTRA_LIBS $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char XvShmCreateImage (); -int -main () -{ -XvShmCreateImage (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_Xv_XvShmCreateImage=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_Xv_XvShmCreateImage=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_Xv_XvShmCreateImage" >&5 -echo "${ECHO_T}$ac_cv_lib_Xv_XvShmCreateImage" >&6 -if test $ac_cv_lib_Xv_XvShmCreateImage = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_XVIDEO 1 -_ACEOF - - X_PRE_LIBS="$X_PRE_LIBS -lXv" - -fi - - fi - if test "$ac_cv_header_X11_extensions_Xrender_h" = "yes" then echo "$as_me:$LINENO: checking for XRenderSetPictureTransform in -lXrender" >&5 @@ -8756,149 +8651,6 @@ #define HAVE_OPENGL 1 _ACEOF - - echo "$as_me:$LINENO: checking for glXGetProcAddressARB in -lGL" >&5 -echo $ECHO_N "checking for glXGetProcAddressARB in -lGL... $ECHO_C" >&6 -if test "${ac_cv_lib_GL_glXGetProcAddressARB+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lGL $X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS $LIBS" -cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char glXGetProcAddressARB (); -int -main () -{ -glXGetProcAddressARB (); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - ac_cv_lib_GL_glXGetProcAddressARB=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_GL_glXGetProcAddressARB=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_GL_glXGetProcAddressARB" >&5 -echo "${ECHO_T}$ac_cv_lib_GL_glXGetProcAddressARB" >&6 -if test $ac_cv_lib_GL_glXGetProcAddressARB = yes; then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GLX_GETPROCADDRESS 1 -_ACEOF - -fi - - - if test "$ac_cv_lib_GL_glXGetProcAddressARB" = "yes" - then - echo "$as_me:$LINENO: checking for OpenGL extension functions prototypes" >&5 -echo $ECHO_N "checking for OpenGL extension functions prototypes... $ECHO_C" >&6 -if test "${wine_cv_extension_prototypes+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 - #ifdef HAVE_GL_GLEXT_H - # include - #endif - -int -main () -{ -PFNGLCOLORTABLEEXTPROC test_proc; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - wine_cv_extension_prototypes="yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -wine_cv_extension_prototypes="no" - -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext - -fi -echo "$as_me:$LINENO: result: $wine_cv_extension_prototypes" >&5 -echo "${ECHO_T}$wine_cv_extension_prototypes" >&6 - if test "$wine_cv_extension_prototypes" = "yes" - then - -cat >>confdefs.h <<\_ACEOF -#define HAVE_GLEXT_PROTOTYPES 1 -_ACEOF - - fi - fi - fi echo "$as_me:$LINENO: checking for gluLookAt in -lGLU" >&5 echo $ECHO_N "checking for gluLookAt in -lGLU... $ECHO_C" >&6 @@ -9780,111 +9532,6 @@ done - saved_libs="$LIBS" - LIBS="$CURSESLIBS $LIBS" - - -for ac_func in getbkgd resizeterm -do -as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_func" >&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+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. */ -/* Define $ac_func to an innocuous variant, in case declares $ac_func. - For example, HP-UX 11i declares gettimeofday. */ -#define $ac_func innocuous_$ac_func - -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. - Prefer to if __STDC__ is defined, since - exists even on freestanding compilers. */ - -#ifdef __STDC__ -# include -#else -# include -#endif - -#undef $ac_func - -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -{ -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -char (*f) () = $ac_func; -#endif -#ifdef __cplusplus -} -#endif - -int -main () -{ -return f != $ac_func; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_var=no" -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - LIBS="$saved_libs" fi @@ -11744,9 +11391,9 @@ if test "$ac_cv_header_sys_asoundlib_h" = "yes" -o "$ac_cv_header_alsa_asoundlib_h" = "yes" then - echo "$as_me:$LINENO: checking for snd_pcm_open in -lasound" >&5 -echo $ECHO_N "checking for snd_pcm_open in -lasound... $ECHO_C" >&6 -if test "${ac_cv_lib_asound_snd_pcm_open+set}" = set; then + echo "$as_me:$LINENO: checking for snd_pcm_hw_params_get_access in -lasound" >&5 +echo $ECHO_N "checking for snd_pcm_hw_params_get_access in -lasound... $ECHO_C" >&6 +if test "${ac_cv_lib_asound_snd_pcm_hw_params_get_access+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_check_lib_save_LIBS=$LIBS @@ -11764,11 +11411,11 @@ #endif /* We use char because int might match the return type of a gcc2 builtin and then its argument prototype would still apply. */ -char snd_pcm_open (); +char snd_pcm_hw_params_get_access (); int main () { -snd_pcm_open (); +snd_pcm_hw_params_get_access (); ; return 0; } @@ -11788,32 +11435,78 @@ ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; } && - { ac_try='test -s conftest$ac_exeext' + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_asound_snd_pcm_hw_params_get_access=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_asound_snd_pcm_hw_params_get_access=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_hw_params_get_access" >&5 +echo "${ECHO_T}$ac_cv_lib_asound_snd_pcm_hw_params_get_access" >&6 +if test $ac_cv_lib_asound_snd_pcm_hw_params_get_access = yes; then + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ +#ifdef HAVE_ALSA_ASOUNDLIB_H +#include +#elif defined(HAVE_SYS_ASOUNDLIB_H) +#include +#endif +int +main () +{ +int ret = snd_pcm_hw_params_get_access(NULL, NULL) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? echo "$as_me:$LINENO: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - ac_cv_lib_asound_snd_pcm_open=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -ac_cv_lib_asound_snd_pcm_open=no -fi -rm -f conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -echo "$as_me:$LINENO: result: $ac_cv_lib_asound_snd_pcm_open" >&5 -echo "${ECHO_T}$ac_cv_lib_asound_snd_pcm_open" >&6 -if test $ac_cv_lib_asound_snd_pcm_open = yes; then cat >>confdefs.h <<\_ACEOF #define HAVE_ALSA 1 _ACEOF - ALSALIBS="-lasound" + ALSALIBS="-lasound" +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext fi fi @@ -12403,8 +12096,6 @@ #define HAVE_CAPI4LINUX 1 _ACEOF - CAPI4LINUXLIBS="-lcapi20" - fi @@ -16129,6 +15820,80 @@ #define SONAME_LIBLCMS "$ac_cv_lib_soname_lcms" _ACEOF fi + +echo "$as_me:$LINENO: checking for -lcapi20 soname" >&5 +echo $ECHO_N "checking for -lcapi20 soname... $ECHO_C" >&6 +if test "${ac_cv_lib_soname_capi20+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_get_soname_save_LIBS=$LIBS +LIBS="-lcapi20 $LIBS" + cat >conftest.$ac_ext <<_ACEOF +/* confdefs.h. */ +_ACEOF +cat confdefs.h >>conftest.$ac_ext +cat >>conftest.$ac_ext <<_ACEOF +/* end confdefs.h. */ + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char capi20_isinstalled (); +int +main () +{ +capi20_isinstalled (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_soname_capi20=`$ac_cv_path_LDD conftest$ac_exeext | grep libcapi20\\.$LIBEXT | sed "s/^.*\(libcapi20\.$LIBEXT[^ ]*\).*$/\1/"` + if test "x$ac_cv_lib_soname_capi20" = "x" + then + ac_cv_lib_soname_capi20="libcapi20.$LIBEXT" + fi +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_lib_soname_capi20="libcapi20.$LIBEXT" +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LIBS=$ac_get_soname_save_LIBS +fi +echo "$as_me:$LINENO: result: $ac_cv_lib_soname_capi20" >&5 +echo "${ECHO_T}$ac_cv_lib_soname_capi20" >&6 +if test "x$ac_cv_lib_soname_capi20" != xNONE +then +cat >>confdefs.h <<_ACEOF +#define SONAME_LIBCAPI20 "$ac_cv_lib_soname_capi20" +_ACEOF +fi fi @@ -16548,9 +16313,6 @@ - - - for ac_func in \ _lwp_create \ _lwp_self \ @@ -16571,9 +16333,7 @@ fstatfs \ fstatvfs \ ftruncate \ - ftruncate64 \ futimes \ - getnetbyaddr \ getnetbyname \ getopt_long \ getpagesize \ @@ -16585,7 +16345,6 @@ gettimeofday \ getuid \ inet_network \ - lseek64 \ lstat \ memmove \ mmap \ @@ -16600,6 +16359,7 @@ sendmsg \ settimeofday \ sigaltstack \ + sigprocmask \ snprintf \ spawnvp \ statfs \ @@ -16610,7 +16370,6 @@ tcgetattr \ timegm \ usleep \ - vfscanf \ vsnprintf \ wait4 \ waitpid \ @@ -16920,73 +16679,6 @@ -for ac_header in netinet/ip.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:$LINENO: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+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 - #if HAVE_SYS_SOCKET_H - # include - #endif - #if HAVE_NETINET_IN_SYSTM_H - # include - #endif - -#include <$ac_header> -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_Header=yes" -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - -eval "$as_ac_Header=no" -fi -rm -f conftest.err conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:$LINENO: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <<_ACEOF -#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1 -_ACEOF - -fi - -done - - - for ac_header in ucontext.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` @@ -17866,6 +17558,71 @@ fi +echo "$as_me:$LINENO: checking for sigset_t" >&5 +echo $ECHO_N "checking for sigset_t... $ECHO_C" >&6 +if test "${ac_cv_type_sigset_t+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 () +{ +if ((sigset_t *) 0) + return 0; +if (sizeof (sigset_t)) + return 0; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>conftest.er1 + ac_status=$? + grep -v '^ *+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_type_sigset_t=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +ac_cv_type_sigset_t=no +fi +rm -f conftest.err conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $ac_cv_type_sigset_t" >&5 +echo "${ECHO_T}$ac_cv_type_sigset_t" >&6 +if test $ac_cv_type_sigset_t = yes; then + +cat >>confdefs.h <<_ACEOF +#define HAVE_SIGSET_T 1 +_ACEOF + + +fi + echo "$as_me:$LINENO: checking whether linux/input.h is for real" >&5 echo $ECHO_N "checking whether linux/input.h is for real... $ECHO_C" >&6 @@ -17935,6 +17692,68 @@ fi +echo "$as_me:$LINENO: checking for sigaddset" >&5 +echo $ECHO_N "checking for sigaddset... $ECHO_C" >&6 +if test "${wine_cv_have_sigaddset+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 () +{ +sigset_t set; sigaddset(&set,SIGTERM); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&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); } && + { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + wine_cv_have_sigaddset=yes +else + echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +wine_cv_have_sigaddset=no +fi +rm -f conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:$LINENO: result: $wine_cv_have_sigaddset" >&5 +echo "${ECHO_T}$wine_cv_have_sigaddset" >&6 +if test "$wine_cv_have_sigaddset" = "yes" +then + +cat >>confdefs.h <<\_ACEOF +#define HAVE_SIGADDSET 1 +_ACEOF + +fi + echo "$as_me:$LINENO: checking whether we can use re-entrant gethostbyname_r Linux style" >&5 echo $ECHO_N "checking whether we can use re-entrant gethostbyname_r Linux style... $ECHO_C" >&6 @@ -20166,7 +19985,7 @@ MAKE_PROG_RULES=programs/Makeprog.rules - ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/advpack/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/itss/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/lzexpand/tests/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/mscms/Makefile dlls/mscms/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/ole32/tests/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/quartz/tests/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/rsaenh/Makefile dlls/rsaenh/tests/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/strmiids/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile fonts/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile" + ac_config_files="$ac_config_files Make.rules dlls/Makedll.rules dlls/Maketest.rules libs/Makelib.rules programs/Makeprog.rules Makefile dlls/Makefile dlls/advapi32/Makefile dlls/advapi32/tests/Makefile dlls/advpack/Makefile dlls/amstream/Makefile dlls/atl/Makefile dlls/avicap32/Makefile dlls/avifil32/Makefile dlls/cabinet/Makefile dlls/capi2032/Makefile dlls/cards/Makefile dlls/cfgmgr32/Makefile dlls/comcat/Makefile dlls/comctl32/Makefile dlls/comctl32/tests/Makefile dlls/commdlg/Makefile dlls/crtdll/Makefile dlls/crypt32/Makefile dlls/ctl3d/Makefile dlls/d3d8/Makefile dlls/d3d9/Makefile dlls/d3dim/Makefile dlls/d3drm/Makefile dlls/d3dx8/Makefile dlls/d3dxof/Makefile dlls/dbghelp/Makefile dlls/dciman32/Makefile dlls/ddraw/Makefile dlls/ddraw/tests/Makefile dlls/devenum/Makefile dlls/dinput/Makefile dlls/dinput8/Makefile dlls/dmband/Makefile dlls/dmcompos/Makefile dlls/dmime/Makefile dlls/dmloader/Makefile dlls/dmscript/Makefile dlls/dmstyle/Makefile dlls/dmsynth/Makefile dlls/dmusic/Makefile dlls/dmusic32/Makefile dlls/dplay/Makefile dlls/dplayx/Makefile dlls/dpnet/Makefile dlls/dpnhpast/Makefile dlls/dsound/Makefile dlls/dsound/tests/Makefile dlls/dswave/Makefile dlls/dxdiagn/Makefile dlls/dxerr8/Makefile dlls/dxerr9/Makefile dlls/dxguid/Makefile dlls/gdi/Makefile dlls/gdi/tests/Makefile dlls/glu32/Makefile dlls/glut32/Makefile dlls/hhctrl.ocx/Makefile dlls/iccvid/Makefile dlls/icmp/Makefile dlls/ifsmgr.vxd/Makefile dlls/imagehlp/Makefile dlls/imm32/Makefile dlls/iphlpapi/Makefile dlls/iphlpapi/tests/Makefile dlls/itss/Makefile dlls/kernel/Makefile dlls/kernel/tests/Makefile dlls/lzexpand/Makefile dlls/lzexpand/tests/Makefile dlls/mapi32/Makefile dlls/mapi32/tests/Makefile dlls/mlang/Makefile dlls/mlang/tests/Makefile dlls/mmdevldr.vxd/Makefile dlls/monodebg.vxd/Makefile dlls/mpr/Makefile dlls/msacm/Makefile dlls/msacm/imaadp32/Makefile dlls/msacm/msadp32/Makefile dlls/msacm/msg711/Makefile dlls/msacm/winemp3/Makefile dlls/msacm/tests/Makefile dlls/mscms/Makefile dlls/mscms/tests/Makefile dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile dlls/msi/tests/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile dlls/msrle32/Makefile dlls/msvcrt/Makefile dlls/msvcrt/tests/Makefile dlls/msvcrt20/Makefile dlls/msvcrt40/Makefile dlls/msvcrtd/Makefile dlls/msvcrtd/tests/Makefile dlls/msvidc32/Makefile dlls/msvideo/Makefile dlls/mswsock/Makefile dlls/netapi32/Makefile dlls/netapi32/tests/Makefile dlls/newdev/Makefile dlls/ntdll/Makefile dlls/ntdll/tests/Makefile dlls/odbc32/Makefile dlls/ole32/Makefile dlls/ole32/tests/Makefile dlls/oleacc/Makefile dlls/oleaut32/Makefile dlls/oleaut32/tests/Makefile dlls/olecli/Makefile dlls/oledlg/Makefile dlls/olepro32/Makefile dlls/olesvr/Makefile dlls/opengl32/Makefile dlls/psapi/Makefile dlls/psapi/tests/Makefile dlls/qcap/Makefile dlls/quartz/Makefile dlls/quartz/tests/Makefile dlls/rasapi32/Makefile dlls/richedit/Makefile dlls/rpcrt4/Makefile dlls/rpcrt4/tests/Makefile dlls/rsabase/Makefile dlls/rsabase/tests/Makefile dlls/rsaenh/Makefile dlls/rsaenh/tests/Makefile dlls/secur32/Makefile dlls/serialui/Makefile dlls/setupapi/Makefile dlls/shdocvw/Makefile dlls/shell32/Makefile dlls/shell32/tests/Makefile dlls/shfolder/Makefile dlls/shlwapi/Makefile dlls/shlwapi/tests/Makefile dlls/snmpapi/Makefile dlls/sti/Makefile dlls/strmiids/Makefile dlls/tapi32/Makefile dlls/ttydrv/Makefile dlls/twain/Makefile dlls/unicows/Makefile dlls/url/Makefile dlls/urlmon/Makefile dlls/urlmon/tests/Makefile dlls/user/Makefile dlls/user/tests/Makefile dlls/uuid/Makefile dlls/uxtheme/Makefile dlls/vdhcp.vxd/Makefile dlls/vdmdbg/Makefile dlls/version/Makefile dlls/version/tests/Makefile dlls/vmm.vxd/Makefile dlls/vnbt.vxd/Makefile dlls/vnetbios.vxd/Makefile dlls/vtdapi.vxd/Makefile dlls/vwin32.vxd/Makefile dlls/win32s/Makefile dlls/winaspi/Makefile dlls/wined3d/Makefile dlls/winedos/Makefile dlls/wineps/Makefile dlls/wininet/Makefile dlls/wininet/tests/Makefile dlls/winmm/Makefile dlls/winmm/joystick/Makefile dlls/winmm/mcianim/Makefile dlls/winmm/mciavi/Makefile dlls/winmm/mcicda/Makefile dlls/winmm/mciseq/Makefile dlls/winmm/mciwave/Makefile dlls/winmm/midimap/Makefile dlls/winmm/tests/Makefile dlls/winmm/wavemap/Makefile dlls/winmm/winealsa/Makefile dlls/winmm/winearts/Makefile dlls/winmm/wineaudioio/Makefile dlls/winmm/winejack/Makefile dlls/winmm/winenas/Makefile dlls/winmm/wineoss/Makefile dlls/winnls/Makefile dlls/winsock/Makefile dlls/winsock/tests/Makefile dlls/winspool/Makefile dlls/winspool/tests/Makefile dlls/wintab32/Makefile dlls/wintrust/Makefile dlls/wow32/Makefile dlls/wsock32/Makefile dlls/x11drv/Makefile documentation/Makefile fonts/Makefile include/Makefile libs/Makefile libs/port/Makefile libs/unicode/Makefile libs/wine/Makefile libs/wpp/Makefile loader/Makefile programs/Makefile programs/avitools/Makefile programs/clock/Makefile programs/cmdlgtst/Makefile programs/control/Makefile programs/expand/Makefile programs/msiexec/Makefile programs/notepad/Makefile programs/progman/Makefile programs/regedit/Makefile programs/regsvr32/Makefile programs/rpcss/Makefile programs/rundll32/Makefile programs/start/Makefile programs/taskmgr/Makefile programs/uninstaller/Makefile programs/view/Makefile programs/wcmd/Makefile programs/wineboot/Makefile programs/winebrowser/Makefile programs/winecfg/Makefile programs/wineconsole/Makefile programs/winedbg/Makefile programs/winefile/Makefile programs/winemenubuilder/Makefile programs/winemine/Makefile programs/winepath/Makefile programs/winetest/Makefile programs/winevdm/Makefile programs/winhelp/Makefile programs/winver/Makefile server/Makefile tools/Makefile tools/widl/Makefile tools/winapi/Makefile tools/winebuild/Makefile tools/winedump/Makefile tools/winegcc/Makefile tools/wmc/Makefile tools/wrc/Makefile" cat >confcache <<\_ACEOF @@ -20531,7 +20350,7 @@ } >&5 cat >&5 <<_CSEOF -This file was extended by Wine $as_me 20041201, which was +This file was extended by Wine $as_me 20050111, which was generated by GNU Autoconf 2.59. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -20594,7 +20413,7 @@ cat >>$CONFIG_STATUS <<_ACEOF ac_cs_version="\\ -Wine config.status 20041201 +Wine config.status 20050111 configured by $0, generated by GNU Autoconf 2.59, with options \\"`echo "$ac_configure_args" | sed 's/[\\""\`\$]/\\\\&/g'`\\" @@ -20790,6 +20609,7 @@ "dlls/msdmo/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msdmo/Makefile" ;; "dlls/mshtml/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/mshtml/Makefile" ;; "dlls/msi/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msi/Makefile" ;; + "dlls/msi/tests/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msi/tests/Makefile" ;; "dlls/msimg32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msimg32/Makefile" ;; "dlls/msisys/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msisys/Makefile" ;; "dlls/msnet32/Makefile" ) CONFIG_FILES="$CONFIG_FILES dlls/msnet32/Makefile" ;; @@ -21133,7 +20953,6 @@ s,@ARTSINCL@,$ARTSINCL,;t t s,@ALSALIBS@,$ALSALIBS,;t t s,@AUDIOIOLIBS@,$AUDIOIOLIBS,;t t -s,@CAPI4LINUXLIBS@,$CAPI4LINUXLIBS,;t t s,@EXTRACFLAGS@,$EXTRACFLAGS,;t t s,@DLLEXT@,$DLLEXT,;t t s,@DLLFLAGS@,$DLLFLAGS,;t t diff -urN wine-20041201/configure.ac wine-20050111/configure.ac --- wine-20041201/configure.ac 2004-11-23 18:33:56.000000000 +0100 +++ wine-20050111/configure.ac 2005-01-10 14:26:33.000000000 +0100 @@ -179,8 +179,6 @@ jpeglib.h \ lcms/lcms.h \ lcms.h \ - libio.h \ - libutil.h \ link.h \ linux/cdrom.h \ linux/compiler.h \ @@ -199,22 +197,15 @@ netinet/in_systm.h \ netinet/tcp.h \ netinet/tcp_fsm.h \ - openssl/des.h \ - openssl/md2.h \ - openssl/rc2.h \ - openssl/rc4.h \ - openssl/rsa.h \ openssl/ssl.h \ process.h \ pthread.h \ - pty.h \ pwd.h \ regex.h \ sched.h \ scsi/sg.h \ scsi/scsi.h \ scsi/scsi_ioctl.h \ - socket.h \ stdint.h \ strings.h \ sys/cdio.h \ @@ -222,9 +213,7 @@ sys/errno.h \ sys/epoll.h \ sys/exec_elf.h \ - sys/file.h \ sys/filio.h \ - sys/inttypes.h \ sys/ioctl.h \ sys/ipc.h \ sys/link.h \ @@ -250,8 +239,6 @@ sys/times.h \ sys/uio.h \ sys/un.h \ - sys/v86.h \ - sys/v86intr.h \ sys/vfs.h \ sys/vm86.h \ sys/wait.h \ @@ -281,7 +268,6 @@ X11/extensions/XShm.h \ X11/extensions/Xrandr.h \ X11/extensions/Xrender.h \ - X11/extensions/Xvlib.h \ X11/extensions/xf86dga.h \ X11/extensions/xf86vmode.h],,, [#include @@ -342,16 +328,6 @@ [AC_DEFINE(HAVE_LIBXRANDR, 1, [Define if you have the Xrandr library])]) fi - dnl *** Check for XVideo extension supporting XvImages - if test "$ac_cv_header_X11_extensions_Xvlib_h" = "yes" - then - AC_CHECK_LIB(Xv, XvShmCreateImage, - [ AC_DEFINE(HAVE_XVIDEO, 1, [Define if the X libraries support XVideo]) - X_PRE_LIBS="$X_PRE_LIBS -lXv" - ],, - $X_LIBS -lXext -lX11 $X_EXTRA_LIBS) - fi - dnl *** Check for Transform functions in Xrender if test "$ac_cv_header_X11_extensions_Xrender_h" = "yes" then @@ -398,32 +374,6 @@ then OPENGLFILES='$(OPENGLFILES)' AC_DEFINE(HAVE_OPENGL, 1, [Define if OpenGL is present on the system]) - - AC_CHECK_LIB(GL,glXGetProcAddressARB, - AC_DEFINE(HAVE_GLX_GETPROCADDRESS, 1, - [Define if the OpenGL library supports the glXGetProcAddressARB call]),, - $X_LIBS -lXext -lX11 -lm $X_EXTRA_LIBS) - - if test "$ac_cv_lib_GL_glXGetProcAddressARB" = "yes" - then - AC_CACHE_CHECK([for OpenGL extension functions prototypes], wine_cv_extension_prototypes, - [AC_TRY_COMPILE([#include - #ifdef HAVE_GL_GLEXT_H - # include - #endif - ], - [PFNGLCOLORTABLEEXTPROC test_proc;], - [wine_cv_extension_prototypes="yes"], - [wine_cv_extension_prototypes="no"] - )] - ) - if test "$wine_cv_extension_prototypes" = "yes" - then - AC_DEFINE(HAVE_GLEXT_PROTOTYPES, 1, - [Define if the OpenGL headers define extension typedefs]) - fi - fi - fi dnl Check for GLU32 library. AC_CHECK_LIB(GLU,gluLookAt, @@ -471,10 +421,6 @@ [AC_CHECK_LIB(curses,waddch, [AC_DEFINE(HAVE_LIBCURSES, 1, [Define if you have the curses library (-lcurses)]) CURSESLIBS="-lcurses"])])])]) - saved_libs="$LIBS" - LIBS="$CURSESLIBS $LIBS" - AC_CHECK_FUNCS(getbkgd resizeterm) - LIBS="$saved_libs" fi AC_SUBST(CURSESLIBS) @@ -730,14 +676,20 @@ CFLAGS="$save_CFLAGS" fi -dnl **** Check for ALSA **** +dnl **** Check for ALSA 1.x **** AC_SUBST(ALSALIBS,"") AC_CHECK_HEADERS(alsa/asoundlib.h sys/asoundlib.h, break) if test "$ac_cv_header_sys_asoundlib_h" = "yes" -o "$ac_cv_header_alsa_asoundlib_h" = "yes" then - AC_CHECK_LIB(asound,snd_pcm_open, - AC_DEFINE(HAVE_ALSA,1,[Define if you have ALSA including devel headers]) - ALSALIBS="-lasound") + AC_CHECK_LIB(asound,snd_pcm_hw_params_get_access, + [AC_TRY_COMPILE([#ifdef HAVE_ALSA_ASOUNDLIB_H +#include +#elif defined(HAVE_SYS_ASOUNDLIB_H) +#include +#endif], + [int ret = snd_pcm_hw_params_get_access(NULL, NULL)], + [AC_DEFINE(HAVE_ALSA,1,[Define if you have ALSA 1.x including devel headers]) + ALSALIBS="-lasound"])]) fi dnl **** Check for libaudioio (which can be used to get solaris audio support) **** @@ -754,7 +706,6 @@ AC_CHECK_HEADERS(linux/capi.h,[ AC_CHECK_LIB(capi20,capi20_register,[ AC_DEFINE(HAVE_CAPI4LINUX,1,[Define if you have capi4linux libs and headers]) - AC_SUBST(CAPI4LINUXLIBS,"-lcapi20") ]) ]) ]) @@ -1160,6 +1111,7 @@ WINE_GET_SONAME(ungif,DGifOpen) WINE_GET_SONAME(gif,DGifOpen) WINE_GET_SONAME(lcms,cmsOpenProfileFromFile) + WINE_GET_SONAME(capi20,capi20_isinstalled) fi @@ -1186,9 +1138,7 @@ fstatfs \ fstatvfs \ ftruncate \ - ftruncate64 \ futimes \ - getnetbyaddr \ getnetbyname \ getopt_long \ getpagesize \ @@ -1200,7 +1150,6 @@ gettimeofday \ getuid \ inet_network \ - lseek64 \ lstat \ memmove \ mmap \ @@ -1215,6 +1164,7 @@ sendmsg \ settimeofday \ sigaltstack \ + sigprocmask \ snprintf \ spawnvp \ statfs \ @@ -1225,7 +1175,6 @@ tcgetattr \ timegm \ usleep \ - vfscanf \ vsnprintf \ wait4 \ waitpid \ @@ -1257,15 +1206,6 @@ # include #endif]) -AC_CHECK_HEADERS(netinet/ip.h,,, - [#include - #if HAVE_SYS_SOCKET_H - # include - #endif - #if HAVE_NETINET_IN_SYSTM_H - # include - #endif]) - AC_CHECK_HEADERS(ucontext.h,,,[#include ]) dnl **** Check for IPX headers (currently Linux only) **** @@ -1311,6 +1251,7 @@ AC_C_CONST AC_C_INLINE AC_CHECK_TYPES([mode_t, off_t, pid_t, size_t, ssize_t, long long, fsblkcnt_t, fsfilcnt_t]) +AC_CHECK_TYPES([sigset_t],,,[#include ]) AC_CACHE_CHECK([whether linux/input.h is for real], wine_cv_linux_input_h, @@ -1332,6 +1273,14 @@ [Define if we have linux/input.h AND it contains the INPUT event API]) fi +AC_CACHE_CHECK([for sigaddset],wine_cv_have_sigaddset, + AC_TRY_LINK([#include ],[sigset_t set; sigaddset(&set,SIGTERM);], + wine_cv_have_sigaddset=yes,wine_cv_have_sigaddset=no)) +if test "$wine_cv_have_sigaddset" = "yes" +then + AC_DEFINE(HAVE_SIGADDSET, 1, [Define if sigaddset is supported]) +fi + AC_CACHE_CHECK([whether we can use re-entrant gethostbyname_r Linux style], wine_cv_linux_gethostbyname_r_6, @@ -1645,6 +1594,7 @@ dlls/msdmo/Makefile dlls/mshtml/Makefile dlls/msi/Makefile +dlls/msi/tests/Makefile dlls/msimg32/Makefile dlls/msisys/Makefile dlls/msnet32/Makefile diff -urN wine-20041201/dlls/Makedll.rules.in wine-20050111/dlls/Makedll.rules.in --- wine-20041201/dlls/Makedll.rules.in 2004-10-20 01:06:12.000000000 +0200 +++ wine-20050111/dlls/Makedll.rules.in 2005-01-07 18:15:47.000000000 +0100 @@ -64,10 +64,10 @@ $(C2MAN) -o $(TOPOBJDIR)/documentation/man$(api_manext) -R$(TOPOBJDIR) -S$(api_manext) $(INCLUDES) $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16) doc-html: $(C_SRCS) - $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPOBJDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16) + $(C2MAN) -o $(TOPOBJDIR)/documentation/html -R$(TOPSRCDIR) $(INCLUDES) -Th $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16) doc-sgml: $(C_SRCS) - $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPOBJDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16) + $(C2MAN) -o $(TOPOBJDIR)/documentation/api-guide -R$(TOPSRCDIR) $(INCLUDES) -Ts $(MAINSPEC:%=-w %) $(SPEC_SRCS16:%=-w %) $(C_SRCS) $(C_SRCS16) .PHONY: man doc-html doc-sgml diff -urN wine-20041201/dlls/advapi32/advapi.c wine-20050111/dlls/advapi32/advapi.c --- wine-20041201/dlls/advapi32/advapi.c 2004-12-01 16:27:59.000000000 +0100 +++ wine-20050111/dlls/advapi32/advapi.c 2005-01-03 18:12:51.000000000 +0100 @@ -121,6 +121,11 @@ return 1; } +/****************************************************************************** + * GetCurrentHwProfileW [ADVAPI32.@] + * + * See GetCurrentHwProfileA. + */ BOOL WINAPI GetCurrentHwProfileW(LPHW_PROFILE_INFOW pInfo) { FIXME("(%p)\n", pInfo); @@ -208,6 +213,40 @@ return TRUE; } +BOOL WINAPI InitiateSystemShutdownA( LPSTR lpMachineName, LPSTR lpMessage, DWORD dwTimeout, + BOOL bForceAppsClosed, BOOL bRebootAfterShutdown ) +{ + return InitiateSystemShutdownExA( lpMachineName, lpMessage, dwTimeout, + bForceAppsClosed, bRebootAfterShutdown, + SHTDN_REASON_MAJOR_LEGACY_API ); +} + +BOOL WINAPI InitiateSystemShutdownW( LPWSTR lpMachineName, LPWSTR lpMessage, DWORD dwTimeout, + BOOL bForceAppsClosed, BOOL bRebootAfterShutdown ) +{ + return InitiateSystemShutdownExW( lpMachineName, lpMessage, dwTimeout, + bForceAppsClosed, bRebootAfterShutdown, + SHTDN_REASON_MAJOR_LEGACY_API ); +} + +BOOL WINAPI LogonUserA( LPCSTR lpszUsername, LPCSTR lpszDomain, LPCSTR lpszPassword, + DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ) +{ + FIXME("%s %s %p 0x%08lx 0x%08lx %p - stub\n", debugstr_a(lpszUsername), + debugstr_a(lpszDomain), lpszPassword, dwLogonType, dwLogonProvider, phToken); + + return TRUE; +} + +BOOL WINAPI LogonUserW( LPCWSTR lpszUsername, LPCWSTR lpszDomain, LPCWSTR lpszPassword, + DWORD dwLogonType, DWORD dwLogonProvider, PHANDLE phToken ) +{ + FIXME("%s %s %p 0x%08lx 0x%08lx %p - stub\n", debugstr_w(lpszUsername), + debugstr_w(lpszDomain), lpszPassword, dwLogonType, dwLogonProvider, phToken); + + return TRUE; +} + DWORD WINAPI CommandLineFromMsiDescriptor(WCHAR *Descriptor, WCHAR *CommandLine, DWORD *CommandLineLength) { diff -urN wine-20041201/dlls/advapi32/advapi32.spec wine-20050111/dlls/advapi32/advapi32.spec --- wine-20041201/dlls/advapi32/advapi32.spec 2004-12-01 16:27:59.000000000 +0100 +++ wine-20050111/dlls/advapi32/advapi32.spec 2005-01-03 21:10:45.000000000 +0100 @@ -13,24 +13,26 @@ @ stdcall AddAccessDeniedAceEx(ptr long long long ptr) @ stdcall AddAce(ptr long long ptr long) @ stdcall AddAuditAccessAce(ptr long long ptr long long) -@ stub AdjustTokenGroups +@ stdcall AdjustTokenGroups(long long ptr long ptr ptr) @ stdcall AdjustTokenPrivileges(long long ptr long ptr ptr) @ stdcall AllocateAndInitializeSid(ptr long long long long long long long long long ptr) @ stdcall AllocateLocallyUniqueId(ptr) -@ stub AreAllAccessesGranted +@ stdcall AreAllAccessesGranted(long long) @ stdcall AreAnyAccessesGranted(long long) @ stdcall BackupEventLogA (long str) @ stdcall BackupEventLogW (long wstr) -@ stub BuildExplicitAccessWithNameA -@ stub BuildExplicitAccessWithNameW +@ stdcall BuildExplicitAccessWithNameA(ptr str long long long) +@ stdcall BuildExplicitAccessWithNameW(ptr wstr long long long) @ stdcall BuildTrusteeWithNameA(ptr str) @ stdcall BuildTrusteeWithNameW(ptr wstr) -@ stub BuildTrusteeWithObjectsAndNameA # (ptr ptr long str str str) -@ stub BuildTrusteeWithObjectsAndNameW # (ptr ptr long wstr wstr wstr) -@ stub BuildTrusteeWithObjectsAndSidA # (ptr ptr ptr ptr ptr) -@ stub BuildTrusteeWithObjectsAndSidW # (ptr ptr ptr ptr ptr) +@ stdcall BuildTrusteeWithObjectsAndNameA(ptr ptr long str str str) +@ stdcall BuildTrusteeWithObjectsAndNameW(ptr ptr long wstr wstr wstr) +@ stdcall BuildTrusteeWithObjectsAndSidA(ptr ptr ptr ptr ptr) +@ stdcall BuildTrusteeWithObjectsAndSidW(ptr ptr ptr ptr ptr) @ stdcall BuildTrusteeWithSidA(ptr ptr) @ stdcall BuildTrusteeWithSidW(ptr ptr) +@ stdcall ChangeServiceConfig2A(long long ptr) +@ stdcall ChangeServiceConfig2W(long long ptr) @ stdcall ChangeServiceConfigA(long long long long wstr str ptr str str str str) @ stdcall ChangeServiceConfigW(long long long long wstr wstr ptr wstr wstr wstr wstr) @ stdcall ClearEventLogA (long str) @@ -43,12 +45,12 @@ @ stdcall ConvertSidToStringSidW(ptr ptr) @ stdcall ConvertStringSidToSidA(ptr ptr) @ stdcall ConvertStringSidToSidW(ptr ptr) -@ stub ConvertStringSecurityDescriptorToSecurityDescriptorA #(str long ptr ptr) ConvertStringSecurityDescriptorToSecurityDescriptorA +@ stdcall ConvertStringSecurityDescriptorToSecurityDescriptorA(str long ptr ptr) @ stdcall ConvertStringSecurityDescriptorToSecurityDescriptorW(wstr long ptr ptr) @ stdcall CopySid(long ptr ptr) -@ stub CreatePrivateObjectSecurity -@ stub CreateProcessAsUserA -@ stub CreateProcessAsUserW +@ stdcall CreatePrivateObjectSecurity(ptr ptr ptr long long ptr) +@ stdcall CreateProcessAsUserA(long str str ptr ptr long long ptr str ptr ptr) +@ stdcall CreateProcessAsUserW(long str str ptr ptr long long ptr str ptr ptr) @ stdcall CreateServiceA(long ptr ptr long long long long ptr ptr ptr ptr ptr ptr) @ stdcall CreateServiceW (long ptr ptr long long long long ptr ptr ptr ptr ptr ptr) @ stub CredProfileLoaded @@ -81,7 +83,7 @@ @ stdcall CryptImportKey(long ptr long long long ptr) @ stdcall CryptReleaseContext(long long) @ stdcall CryptSignHashA(long long ptr long ptr ptr) -@ stdcall CryptSignHashW(long long ptr long ptr ptr) CryptSignHashA +@ stdcall CryptSignHashW(long long ptr long ptr ptr) @ stdcall CryptSetHashParam(long long ptr long) @ stdcall CryptSetKeyParam(long long ptr long) @ stdcall CryptSetProviderA(str long) @@ -90,15 +92,19 @@ @ stdcall CryptSetProviderExW(wstr long ptr long) @ stdcall CryptSetProvParam(long long ptr long) @ stdcall CryptVerifySignatureA(long ptr long long ptr long) -@ stdcall CryptVerifySignatureW(long ptr long long ptr long) CryptVerifySignatureA +@ stdcall CryptVerifySignatureW(long ptr long long ptr long) +@ stdcall DecryptFileA(str long) +@ stdcall DecryptFileW(wstr long) @ stdcall DeleteAce(ptr long) @ stdcall DeleteService(long) @ stdcall DeregisterEventSource(long) -@ stub DestroyPrivateObjectSecurity -@ stub DuplicateToken #(long long ptr) DuplicateToken -@ stub DuplicateTokenEx #(long long ptr long long ptr) DuplicateTokenEx -@ stub EnumDependentServicesA -@ stub EnumDependentServicesW +@ stdcall DestroyPrivateObjectSecurity(ptr) +@ stdcall DuplicateToken(long long ptr) +@ stdcall DuplicateTokenEx(long long ptr long long ptr) +@ stdcall EncryptFileA(str) +@ stdcall EncryptFileW(wstr) +@ stdcall EnumDependentServicesA(long long ptr long ptr ptr) +@ stdcall EnumDependentServicesW(long long ptr long ptr ptr) @ stdcall EnumServicesStatusA (long long long ptr long ptr ptr ptr) @ stdcall EnumServicesStatusW (long long long ptr long ptr ptr ptr) @ stdcall EqualPrefixSid(ptr ptr) @@ -109,19 +115,19 @@ @ stdcall GetAclInformation(ptr ptr long long) @ stdcall GetCurrentHwProfileA(ptr) @ stdcall GetCurrentHwProfileW(ptr) -@ stub GetEffectiveRightsFromAclA +@ stdcall GetEffectiveRightsFromAclA(ptr ptr ptr) @ stdcall GetExplicitEntriesFromAclA(ptr ptr ptr) @ stdcall GetExplicitEntriesFromAclW(ptr ptr ptr) @ stdcall GetFileSecurityA(str long ptr long ptr) @ stdcall GetFileSecurityW(wstr long ptr long ptr) -@ stub GetKernelObjectSecurity +@ stdcall GetKernelObjectSecurity(long long ptr long ptr) @ stdcall GetLengthSid(ptr) @ stub GetMangledSiteSid @ stdcall GetNamedSecurityInfoA (str long long ptr ptr ptr ptr ptr) @ stdcall GetNamedSecurityInfoW (wstr long long ptr ptr ptr ptr ptr) @ stdcall GetNumberOfEventLogRecords (long ptr) @ stdcall GetOldestEventLogRecord (long ptr) -@ stub GetPrivateObjectSecurity +@ stdcall GetPrivateObjectSecurity(ptr long ptr long ptr) @ stdcall GetSecurityDescriptorControl (ptr ptr ptr) @ stdcall GetSecurityDescriptorDacl (ptr ptr ptr ptr) @ stdcall GetSecurityDescriptorGroup(ptr ptr ptr) @@ -130,10 +136,10 @@ @ stdcall GetSecurityDescriptorSacl (ptr ptr ptr ptr) @ stdcall GetSecurityInfo (long long long ptr ptr ptr ptr ptr) @ stdcall GetSecurityInfoExW (long long long wstr wstr ptr ptr wstr wstr) -@ stub GetServiceDisplayNameA -@ stub GetServiceDisplayNameW -@ stub GetServiceKeyNameA -@ stub GetServiceKeyNameW +@ stdcall GetServiceDisplayNameA(ptr str ptr ptr) +@ stdcall GetServiceDisplayNameW(ptr wstr ptr ptr) +@ stdcall GetServiceKeyNameA(long str ptr ptr) +@ stdcall GetServiceKeyNameW(long wstr ptr ptr) @ stdcall GetSidIdentifierAuthority(ptr) @ stdcall GetSidLengthRequired(long) @ stdcall GetSidSubAuthority(ptr long) @@ -143,38 +149,38 @@ @ stdcall GetUserNameA(ptr ptr) @ stdcall GetUserNameW(ptr ptr) @ stdcall ImpersonateLoggedOnUser(long) -@ stub ImpersonateNamedPipeClient +@ stdcall ImpersonateNamedPipeClient(long) @ stdcall ImpersonateSelf(long) @ stdcall InitializeAcl(ptr long long) @ stdcall InitializeSecurityDescriptor(ptr long) @ stdcall InitializeSid(ptr ptr long) -@ stub InitiateSystemShutdownA -@ stub InitiateSystemShutdownW +@ stdcall InitiateSystemShutdownA(str str long long long) +@ stdcall InitiateSystemShutdownW(str str long long long) @ stdcall InitiateSystemShutdownExA(str str long long long long) @ stdcall InitiateSystemShutdownExW(wstr wstr long long long long) @ stub InstallApplication @ stub IsProcessRestricted @ stdcall IsTextUnicode(ptr long ptr) ntdll.RtlIsTextUnicode -@ stub IsTokenRestricted +@ stdcall IsTokenRestricted(long) @ stdcall IsValidAcl(ptr) @ stdcall IsValidSecurityDescriptor(ptr) @ stdcall IsValidSid(ptr) @ stdcall LockServiceDatabase(ptr) -@ stub LogonUserA -@ stub LogonUserW +@ stdcall LogonUserA(str str str long long ptr) +@ stdcall LogonUserW(wstr wstr wstr long long ptr) @ stdcall LookupAccountNameA(str str ptr ptr ptr ptr ptr) -@ stub LookupAccountNameW +@ stdcall LookupAccountNameW(wstr wstr ptr ptr ptr ptr ptr) @ stdcall LookupAccountSidA(ptr ptr ptr ptr ptr ptr ptr) @ stdcall LookupAccountSidW(ptr ptr ptr ptr ptr ptr ptr) -@ stub LookupPrivilegeDisplayNameA -@ stub LookupPrivilegeDisplayNameW +@ stdcall LookupPrivilegeDisplayNameA(str str str ptr ptr) +@ stdcall LookupPrivilegeDisplayNameW(wstr wstr wstr ptr ptr) @ stdcall LookupPrivilegeNameA(str ptr ptr long) @ stdcall LookupPrivilegeNameW(wstr ptr ptr long) @ stdcall LookupPrivilegeValueA(ptr ptr ptr) @ stdcall LookupPrivilegeValueW(ptr ptr ptr) @ stdcall MakeAbsoluteSD(ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr ptr) @ stdcall MakeSelfRelativeSD(ptr ptr ptr) -@ stub MapGenericMask +@ stdcall MapGenericMask(ptr ptr) @ stdcall MD4Final(ptr) @ stdcall MD4Init(ptr) @ stdcall MD4Update(ptr ptr long) @@ -183,12 +189,12 @@ @ stdcall MD5Update(ptr ptr long) @ stdcall NotifyBootConfigStatus(long) @ stdcall NotifyChangeEventLog (long long) -@ stub ObjectCloseAuditAlarmA -@ stub ObjectCloseAuditAlarmW -@ stub ObjectOpenAuditAlarmA -@ stub ObjectOpenAuditAlarmW -@ stub ObjectPrivilegeAuditAlarmA -@ stub ObjectPrivilegeAuditAlarmW +@ stdcall ObjectCloseAuditAlarmA(str ptr long) +@ stdcall ObjectCloseAuditAlarmW(wstr ptr long) +@ stdcall ObjectOpenAuditAlarmA(str ptr str str ptr long long long ptr long long ptr) +@ stdcall ObjectOpenAuditAlarmW(wstr ptr wstr wstr ptr long long long ptr long long ptr) +@ stdcall ObjectPrivilegeAuditAlarmA(str ptr long long ptr long) +@ stdcall ObjectPrivilegeAuditAlarmW(wstr ptr long long ptr long) @ stdcall OpenBackupEventLogA (str str) @ stdcall OpenBackupEventLogW (wstr wstr) @ stdcall OpenEventLogA (str str) @@ -200,12 +206,12 @@ @ stdcall OpenServiceW(long wstr long) @ stdcall OpenThreadToken(long long long ptr) @ stdcall PrivilegeCheck(ptr ptr ptr) -@ stub PrivilegedServiceAuditAlarmA -@ stub PrivilegedServiceAuditAlarmW +@ stdcall PrivilegedServiceAuditAlarmA(str str long ptr long) +@ stdcall PrivilegedServiceAuditAlarmW(wstr wstr long ptr long) @ stdcall QueryServiceConfigA(long ptr long ptr) @ stdcall QueryServiceConfigW(long ptr long ptr) -@ stub QueryServiceLockStatusA -@ stub QueryServiceLockStatusW +@ stdcall QueryServiceLockStatusA(long ptr long ptr) +@ stdcall QueryServiceLockStatusW(long ptr long ptr) @ stdcall QueryServiceObjectSecurity(long long ptr long ptr) @ stdcall QueryServiceStatus(long ptr) @ stdcall QueryServiceStatusEx (long long ptr long ptr) @@ -268,7 +274,7 @@ @ stdcall ReportEventA (long long long long ptr long long str ptr) @ stdcall ReportEventW (long long long long ptr long long wstr ptr) @ stdcall RevertToSelf() -@ stub SetAclInformation +@ stdcall SetAclInformation(ptr ptr long long) @ stdcall SetEntriesInAclA(long ptr ptr ptr) @ stdcall SetEntriesInAclW(long ptr ptr ptr) @ stdcall SetFileSecurityA(str long ptr ) @@ -276,13 +282,14 @@ @ stdcall SetKernelObjectSecurity(long long ptr) @ stdcall SetNamedSecurityInfoA(str long ptr ptr ptr ptr ptr) @ stdcall SetNamedSecurityInfoW(wstr long ptr ptr ptr ptr ptr) -@ stub SetPrivateObjectSecurity -@ stub SetSecurityDescriptorControl #(ptr long long) +@ stdcall SetPrivateObjectSecurity(long ptr ptr ptr long) +@ stdcall SetSecurityDescriptorControl(ptr long long) @ stdcall SetSecurityDescriptorDacl(ptr long ptr long) @ stdcall SetSecurityDescriptorGroup (ptr ptr long) @ stdcall SetSecurityDescriptorOwner (ptr ptr long) @ stdcall SetSecurityDescriptorSacl(ptr long ptr long) -@ stub SetServiceBits +@ stub SetSecurityInfo #(ptr long ptr ptr ptr ptr ptr ptr) +@ stdcall SetServiceBits(long long long long) @ stdcall SetServiceObjectSecurity(long long ptr) @ stdcall SetServiceStatus(long long) @ stdcall SetThreadToken (ptr ptr) @@ -297,8 +304,8 @@ @ stdcall LsaFreeMemory(ptr) @ stdcall LsaQueryInformationPolicy(ptr long ptr) @ stdcall LsaClose(ptr) -@ stub LsaSetInformationPolicy -@ stub LsaLookupNames +@ stdcall LsaSetInformationPolicy(long long ptr) +@ stdcall LsaLookupNames(long long ptr ptr ptr) @ stub SystemFunction001 @ stub SystemFunction002 @ stub SystemFunction003 @@ -360,12 +367,14 @@ @ stub LsaEnumerateAccounts @ stub LsaGetSystemAccessAccount @ stub LsaSetInformationTrustedDomain -@ stub LsaEnumerateTrustedDomains +@ stdcall LsaEnumerateTrustedDomains(long ptr ptr long ptr) @ stdcall LsaNtStatusToWinError(long) @ stub LsaOpenAccount @ stub LsaEnumeratePrivileges @ stub LsaLookupPrivilegeDisplayName @ stub LsaICLookupNames +@ stdcall LsaRetrievePrivateData(ptr ptr ptr) +@ stdcall LsaStorePrivateData(ptr ptr ptr) @ stub ElfRegisterEventSourceW @ stub ElfReportEventW @ stub ElfDeregisterEventSource diff -urN wine-20041201/dlls/advapi32/crypt.c wine-20050111/dlls/advapi32/crypt.c --- wine-20041201/dlls/advapi32/crypt.c 2004-11-30 18:33:27.000000000 +0100 +++ wine-20050111/dlls/advapi32/crypt.c 2004-12-21 15:34:18.000000000 +0100 @@ -29,15 +29,9 @@ #include #include -#include "wine/unicode.h" #include "crypt.h" #include "winnls.h" -#include "wincrypt.h" -#include "windef.h" -#include "winerror.h" #include "winreg.h" -#include "winbase.h" -#include "winuser.h" #include "wine/debug.h" #include "winternl.h" #include "ntstatus.h" @@ -104,9 +98,10 @@ return TRUE; } count = WideCharToMultiByte(CP_ACP, 0, wstr, -1, NULL, 0, NULL, NULL); - count = count < strsize ? count : strsize; if (strsize == -1) *str = CRYPT_Alloc(count * sizeof(CHAR)); + else + count = min( count, strsize ); if (*str) { WideCharToMultiByte(CP_ACP, 0, wstr, -1, *str, count, NULL, NULL); @@ -131,9 +126,10 @@ return TRUE; } wcount = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0); - wcount = wcount < wstrsize/sizeof(WCHAR) ? wcount : wstrsize/sizeof(WCHAR); if (wstrsize == -1) *wstr = CRYPT_Alloc(wcount * sizeof(WCHAR)); + else + wcount = min( wcount, wstrsize/sizeof(WCHAR) ); if (*wstr) { MultiByteToWideChar(CP_ACP, 0, str, -1, *wstr, wcount); @@ -1556,14 +1552,6 @@ } /****************************************************************************** - * CryptSignHashA - * - * Note: Since the sDesciption (string) is supposed to be NULL and - * is only retained for compatibility no string conversions are required - * and only one implementation is required for both ANSI and Unicode. - * We still need to export both: - * - * CryptSignHashA (ADVAPI32.@) * CryptSignHashW (ADVAPI32.@) * * Signs data. @@ -1571,7 +1559,7 @@ * PARAMS * hHash [I] Handle of the hash object to be signed. * dwKeySpec [I] Private key to use. - * sDescription [I] Must be NULL. + * sDescription [I] Should be NULL. * dwFlags [I] CRYPT_NOHASHOID/X931_FORMAT. * pbSignature [O] Buffer of the signature data. * pdwSigLen [I/O] Size of the pbSignature buffer. @@ -1579,16 +1567,20 @@ * RETURNS * Success: TRUE * Failure: FALSE + * + * NOTES + * Because of security flaws sDescription should not be used and should thus be + * NULL. It is supported only for compatibility with Microsoft's Cryptographic + * Providers. */ -BOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescription, +BOOL WINAPI CryptSignHashW (HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR sDescription, DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen) { PCRYPTHASH hash = (PCRYPTHASH)hHash; PCRYPTPROV prov; - TRACE("(0x%lx, %ld, %08ld, %p, %p)\n", hHash, dwKeySpec, dwFlags, pbSignature, pdwSigLen); - if (sDescription) - WARN("The sDescription parameter is not supported (and no longer used). Ignoring.\n"); + TRACE("(0x%lx, %ld, %s, %08ld, %p, %p)\n", + hHash, dwKeySpec, debugstr_w(sDescription), dwFlags, pbSignature, pdwSigLen); if (!hash) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); @@ -1596,11 +1588,32 @@ CRYPT_ReturnLastError(ERROR_INVALID_PARAMETER); prov = hash->pProvider; - return prov->pFuncs->pCPSignHash(prov->hPrivate, hash->hPrivate, dwKeySpec, NULL, + return prov->pFuncs->pCPSignHash(prov->hPrivate, hash->hPrivate, dwKeySpec, sDescription, dwFlags, pbSignature, pdwSigLen); } /****************************************************************************** + * CryptSignHashA (ADVAPI32.@) + * + * ASCII version of CryptSignHashW + */ +BOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR sDescription, + DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen) +{ + LPWSTR wsDescription; + BOOL result; + + TRACE("(0x%lx, %ld, %s, %08ld, %p, %p)\n", + hHash, dwKeySpec, debugstr_a(sDescription), dwFlags, pbSignature, pdwSigLen); + + CRYPT_ANSIToUnicode(sDescription, &wsDescription, -1); + result = CryptSignHashW(hHash, dwKeySpec, wsDescription, dwFlags, pbSignature, pdwSigLen); + if (wsDescription) CRYPT_Free(wsDescription); + + return result; +} + +/****************************************************************************** * CryptSetHashParam (ADVAPI32.@) * * Customizes the operations of a hash object. @@ -1829,14 +1842,6 @@ } /****************************************************************************** - * CryptVerifySignatureA - * - * Note: Since the sDesciption (string) is supposed to be NULL and - * is only retained for compatibility no string conversions are required - * and only one implementation is required for both ANSI and Unicode. - * We still need to export both: - * - * CryptVerifySignatureA (ADVAPI32.@) * CryptVerifySignatureW (ADVAPI32.@) * * Verifies the signature of a hash object. @@ -1846,24 +1851,27 @@ * pbSignature [I] Signature data to verify. * dwSigLen [I] Size of pbSignature. * hPubKey [I] Handle to the public key to authenticate signature. - * sDescription [I] Must be set to NULL. + * sDescription [I] Should be NULL. * dwFlags [I] See MSDN doc. * * RETURNS * Success: TRUE * Failure: FALSE + * + * NOTES + * Because of security flaws sDescription should not be used and should thus be + * NULL. It is supported only for compatibility with Microsoft's Cryptographic + * Providers. */ -BOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen, - HCRYPTKEY hPubKey, LPCSTR sDescription, DWORD dwFlags) +BOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen, + HCRYPTKEY hPubKey, LPCWSTR sDescription, DWORD dwFlags) { PCRYPTHASH hash = (PCRYPTHASH)hHash; PCRYPTKEY key = (PCRYPTKEY)hPubKey; PCRYPTPROV prov; - TRACE("(0x%lx, %p, %ld, 0x%lx, %08ld)\n", hHash, pbSignature, - dwSigLen, hPubKey, dwFlags); - if (sDescription) - WARN("The sDescription parameter is not supported (and no longer used). Ignoring.\n"); + TRACE("(0x%lx, %p, %ld, 0x%lx, %s, %08ld)\n", hHash, pbSignature, + dwSigLen, hPubKey, debugstr_w(sDescription), dwFlags); if (!hash || !key) CRYPT_ReturnLastError(ERROR_INVALID_HANDLE); @@ -1872,9 +1880,29 @@ prov = hash->pProvider; return prov->pFuncs->pCPVerifySignature(prov->hPrivate, hash->hPrivate, pbSignature, dwSigLen, - key->hPrivate, NULL, dwFlags); + key->hPrivate, sDescription, dwFlags); } +/****************************************************************************** + * CryptVerifySignatureA (ADVAPI32.@) + * + * ASCII version of CryptVerifySignatureW + */ +BOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, BYTE *pbSignature, DWORD dwSigLen, + HCRYPTKEY hPubKey, LPCSTR sDescription, DWORD dwFlags) +{ + LPWSTR wsDescription; + BOOL result; + + TRACE("(0x%lx, %p, %ld, 0x%lx, %s, %08ld)\n", hHash, pbSignature, + dwSigLen, hPubKey, debugstr_a(sDescription), dwFlags); + + CRYPT_ANSIToUnicode(sDescription, &wsDescription, -1); + result = CryptVerifySignatureW(hHash, pbSignature, dwSigLen, hPubKey, wsDescription, dwFlags); + if (wsDescription) CRYPT_Free(wsDescription); + + return result; +} /* These functions have nearly identical prototypes to CryptProtectMemory and CryptUnprotectMemory, @@ -1884,12 +1912,18 @@ /****************************************************************************** * SystemFunction040 (ADVAPI32.@) * - * PARAMS: - * memory : pointer to memory to encrypt - * length : length of region to encrypt, in bytes. must be multiple of RTL_ENCRYPT_MEMORY_SIZE - * flags : RTL_ENCRYPT_OPTION_SAME_PROCESS | RTL_ENCRYPT_OPTION_CROSS_PROCESS, | RTL_ENCRYPT_OPTION_SAME_LOGON - * control whether other processes are able to decrypt the memory. The same value must be given - * when decrypting the memory. + * PARAMS + * memory [I/O] Pointer to memory to encrypt. + * length [I] Length of region to encrypt in bytes. + * flags [I] Control whether other processes are able to decrypt the memory. + * RTL_ENCRYPT_OPTION_SAME_PROCESS + * RTL_ENCRYPT_OPTION_CROSS_PROCESS + * RTL_ENCRYPT_OPTION_SAME_LOGON + * + * NOTES + * length must be a multiple of RTL_ENCRYPT_MEMORY_SIZE. + * If flags are specified when encrypting, the same flag value must be given + * when decrypting the memory. */ NTSTATUS WINAPI SystemFunction040(PVOID memory, ULONG length, ULONG flags) /* RtlEncryptMemory */ { @@ -1900,12 +1934,18 @@ /****************************************************************************** * SystemFunction041 (ADVAPI32.@) * - * PARAMS: - * memory : pointer to memory to decrypt - * length : length of region to decrypt, in bytes. must be multiple of RTL_ENCRYPT_MEMORY_SIZE - * flags : RTL_ENCRYPT_OPTION_SAME_PROCESS | RTL_ENCRYPT_OPTION_CROSS_PROCESS, | RTL_ENCRYPT_OPTION_SAME_LOGON - * control whether other processes are able to decrypt the memory. The same value must be given - * when encrypting the memory. + * PARAMS + * memory [I/O] Pointer to memory to decrypt. + * length [I] Length of region to decrypt in bytes. + * flags [I] Control whether other processes are able to decrypt the memory. + * RTL_ENCRYPT_OPTION_SAME_PROCESS + * RTL_ENCRYPT_OPTION_CROSS_PROCESS + * RTL_ENCRYPT_OPTION_SAME_LOGON + * + * NOTES + * length must be a multiple of RTL_ENCRYPT_MEMORY_SIZE. + * If flags are specified when encrypting, the same flag value must be given + * when decrypting the memory. */ NTSTATUS WINAPI SystemFunction041(PVOID memory, ULONG length, ULONG flags) /* RtlDecryptMemory */ { diff -urN wine-20041201/dlls/advapi32/crypt_md4.c wine-20050111/dlls/advapi32/crypt_md4.c --- wine-20041201/dlls/advapi32/crypt_md4.c 2004-10-07 21:14:21.000000000 +0200 +++ wine-20050111/dlls/advapi32/crypt_md4.c 2004-12-15 11:56:21.000000000 +0100 @@ -36,7 +36,6 @@ #include #include "windef.h" -#include "winbase.h" typedef struct { diff -urN wine-20041201/dlls/advapi32/crypt_md5.c wine-20050111/dlls/advapi32/crypt_md5.c --- wine-20041201/dlls/advapi32/crypt_md5.c 2004-10-07 21:14:21.000000000 +0200 +++ wine-20050111/dlls/advapi32/crypt_md5.c 2004-12-15 11:56:21.000000000 +0100 @@ -36,7 +36,6 @@ #include #include "windef.h" -#include "winbase.h" typedef struct { diff -urN wine-20041201/dlls/advapi32/crypt_sha.c wine-20050111/dlls/advapi32/crypt_sha.c --- wine-20041201/dlls/advapi32/crypt_sha.c 2004-10-04 22:42:05.000000000 +0200 +++ wine-20050111/dlls/advapi32/crypt_sha.c 2004-12-15 11:56:21.000000000 +0100 @@ -19,7 +19,6 @@ #include #include "windef.h" -#include "winbase.h" /* SHA Context Structure Declaration */ diff -urN wine-20041201/dlls/advapi32/eventlog.c wine-20050111/dlls/advapi32/eventlog.c --- wine-20041201/dlls/advapi32/eventlog.c 2004-07-13 01:32:10.000000000 +0200 +++ wine-20050111/dlls/advapi32/eventlog.c 2005-01-03 15:56:42.000000000 +0100 @@ -387,7 +387,7 @@ wNumStrings, dwDataSize, wideStrArray, lpRawData); for (i = 0; i < wNumStrings; i++) { - if (wideStrArray[i]) HeapFree( GetProcessHeap(), 0, (LPSTR)wideStrArray[i] ); + HeapFree( GetProcessHeap(), 0, (LPSTR)wideStrArray[i] ); } HeapFree(GetProcessHeap(), 0, wideStrArray); return ret; diff -urN wine-20041201/dlls/advapi32/registry.c wine-20050111/dlls/advapi32/registry.c --- wine-20041201/dlls/advapi32/registry.c 2004-11-30 22:39:01.000000000 +0100 +++ wine-20050111/dlls/advapi32/registry.c 2005-01-07 16:40:09.000000000 +0100 @@ -1006,7 +1006,7 @@ { status = NtSetValueKey( hkey, &NtCurrentTeb()->StaticUnicodeString, 0, type, data, count ); } - if (dataW) HeapFree( GetProcessHeap(), 0, dataW ); + HeapFree( GetProcessHeap(), 0, dataW ); return RtlNtStatusToDosError( status ); } @@ -2073,7 +2073,7 @@ hEvent,fAsync); if( !fAsync ) - hEvent = CreateEventA(NULL, 0, 0, NULL); + hEvent = CreateEventW(NULL, 0, 0, NULL); SERVER_START_REQ( set_registry_notification ) { diff -urN wine-20041201/dlls/advapi32/security.c wine-20050111/dlls/advapi32/security.c --- wine-20041201/dlls/advapi32/security.c 2004-11-04 05:52:17.000000000 +0100 +++ wine-20050111/dlls/advapi32/security.c 2005-01-03 18:12:51.000000000 +0100 @@ -31,7 +31,7 @@ #include "ntsecapi.h" #include "accctrl.h" #include "sddl.h" - +#include "winsvc.h" #include "aclapi.h" #include "wine/debug.h" @@ -92,13 +92,13 @@ static const WCHAR SDDL_AUDIT_SUCCESS[] = {'S','A',0}; static const WCHAR SDDL_AUDIT_FAILURE[] = {'F','A',0}; -#define CallWin32ToNt(func) \ - { NTSTATUS ret; \ - ret = (func); \ - if (ret !=STATUS_SUCCESS) \ - { SetLastError (RtlNtStatusToDosError(ret)); return FALSE; } \ - return TRUE; \ - } +/* set last error code from NT status and get the proper boolean return value */ +/* used for functions that are a simple wrapper around the corresponding ntdll API */ +static inline BOOL set_ntstatus( NTSTATUS status ) +{ + if (status) SetLastError( RtlNtStatusToDosError( status )); + return !status; +} static void dumpLsaAttributes( PLSA_OBJECT_ATTRIBUTES oa ) { @@ -176,7 +176,7 @@ OpenProcessToken( HANDLE ProcessHandle, DWORD DesiredAccess, HANDLE *TokenHandle ) { - CallWin32ToNt(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle )); + return set_ntstatus(NtOpenProcessToken( ProcessHandle, DesiredAccess, TokenHandle )); } /****************************************************************************** @@ -201,7 +201,15 @@ OpenThreadToken( HANDLE ThreadHandle, DWORD DesiredAccess, BOOL OpenAsSelf, HANDLE *TokenHandle) { - CallWin32ToNt (NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle)); + return set_ntstatus( NtOpenThreadToken(ThreadHandle, DesiredAccess, OpenAsSelf, TokenHandle)); +} + +BOOL WINAPI +AdjustTokenGroups( HANDLE TokenHandle, BOOL ResetToDefault, PTOKEN_GROUPS NewState, + DWORD BufferLength, PTOKEN_GROUPS PreviousState, PDWORD ReturnLength ) +{ + return set_ntstatus( NtAdjustGroupsToken(TokenHandle, ResetToDefault, NewState, BufferLength, + PreviousState, ReturnLength)); } /****************************************************************************** @@ -230,7 +238,9 @@ LPVOID NewState, DWORD BufferLength, LPVOID PreviousState, LPDWORD ReturnLength ) { - CallWin32ToNt(NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges, NewState, BufferLength, PreviousState, ReturnLength)); + return set_ntstatus( NtAdjustPrivilegesToken(TokenHandle, DisableAllPrivileges, + NewState, BufferLength, PreviousState, + ReturnLength)); } /****************************************************************************** @@ -297,7 +307,8 @@ (tokeninfoclass == TokenSandBoxInert) ? "TokenSandBoxInert" : "Unknown", tokeninfo, tokeninfolength, retlen); - CallWin32ToNt (NtQueryInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength, retlen)); + return set_ntstatus( NtQueryInformationToken( token, tokeninfoclass, tokeninfo, + tokeninfolength, retlen)); } /****************************************************************************** @@ -339,7 +350,7 @@ "Unknown", tokeninfo, tokeninfolength); - CallWin32ToNt (NtSetInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength )); + return set_ntstatus( NtSetInformationToken( token, tokeninfoclass, tokeninfo, tokeninfolength )); } /************************************************************************* @@ -363,8 +374,8 @@ */ BOOL WINAPI SetThreadToken(PHANDLE thread, HANDLE token) { - CallWin32ToNt (NtSetInformationThread( thread ? *thread : GetCurrentThread(), - ThreadImpersonationToken, &token, sizeof token )); + return set_ntstatus( NtSetInformationThread( thread ? *thread : GetCurrentThread(), + ThreadImpersonationToken, &token, sizeof token )); } /* ############################## @@ -397,11 +408,11 @@ DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid ) { - CallWin32ToNt (RtlAllocateAndInitializeSid( - pIdentifierAuthority, nSubAuthorityCount, - nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, - nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, - pSid )); + return set_ntstatus( RtlAllocateAndInitializeSid( + pIdentifierAuthority, nSubAuthorityCount, + nSubAuthority0, nSubAuthority1, nSubAuthority2, nSubAuthority3, + nSubAuthority4, nSubAuthority5, nSubAuthority6, nSubAuthority7, + pSid )); } /****************************************************************************** @@ -431,6 +442,14 @@ return RtlCopySid(nDestinationSidLength, pDestinationSid, pSourceSid); } +BOOL WINAPI +IsTokenRestricted( HANDLE TokenHandle ) +{ + FIXME("%p - stub\n", TokenHandle); + + return FALSE; +} + /****************************************************************************** * IsValidSid [ADVAPI32.@] * @@ -491,6 +510,22 @@ return RtlInitializeSid(pSid, pIdentifierAuthority, nSubAuthorityCount); } +DWORD WINAPI +GetEffectiveRightsFromAclA( PACL pacl, PTRUSTEEA pTrustee, PACCESS_MASK pAccessRights ) +{ + FIXME("%p %p %p - stub\n", pacl, pTrustee, pAccessRights); + + return 1; +} + +DWORD WINAPI +GetEffectiveRightsFromAclW( PACL pacl, PTRUSTEEW pTrustee, PACCESS_MASK pAccessRights ) +{ + FIXME("%p %p %p - stub\n", pacl, pTrustee, pAccessRights); + + return 1; +} + /****************************************************************************** * GetSidIdentifierAuthority [ADVAPI32.@] * @@ -555,7 +590,7 @@ BOOL WINAPI InitializeSecurityDescriptor( PSECURITY_DESCRIPTOR pDescr, DWORD revision ) { - CallWin32ToNt (RtlCreateSecurityDescriptor(pDescr, revision )); + return set_ntstatus( RtlCreateSecurityDescriptor(pDescr, revision )); } @@ -575,19 +610,46 @@ OUT PSID pPrimaryGroup, OUT LPDWORD lpdwPrimaryGroupSize) { - CallWin32ToNt (RtlSelfRelativeToAbsoluteSD(pSelfRelativeSecurityDescriptor, - pAbsoluteSecurityDescriptor, lpdwAbsoluteSecurityDescriptorSize, - pDacl, lpdwDaclSize, pSacl, lpdwSaclSize, pOwner, lpdwOwnerSize, - pPrimaryGroup, lpdwPrimaryGroupSize)); + return set_ntstatus( RtlSelfRelativeToAbsoluteSD(pSelfRelativeSecurityDescriptor, + pAbsoluteSecurityDescriptor, + lpdwAbsoluteSecurityDescriptorSize, + pDacl, lpdwDaclSize, pSacl, lpdwSaclSize, + pOwner, lpdwOwnerSize, + pPrimaryGroup, lpdwPrimaryGroupSize)); +} + +BOOL WINAPI GetKernelObjectSecurity( + HANDLE Handle, + SECURITY_INFORMATION RequestedInformation, + PSECURITY_DESCRIPTOR pSecurityDescriptor, + DWORD nLength, + LPDWORD lpnLengthNeeded ) +{ + FIXME("%p 0x%08lx %p 0x%08lx %p - stub\n", Handle, RequestedInformation, + pSecurityDescriptor, nLength, lpnLengthNeeded); + + return FALSE; } +BOOL WINAPI GetPrivateObjectSecurity( + PSECURITY_DESCRIPTOR ObjectDescriptor, + SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR ResultantDescriptor, + DWORD DescriptorLength, + PDWORD ReturnLength ) +{ + FIXME("%p 0x%08lx %p 0x%08lx %p - stub\n", ObjectDescriptor, SecurityInformation, + ResultantDescriptor, DescriptorLength, ReturnLength); + + return FALSE; +} /****************************************************************************** * GetSecurityDescriptorLength [ADVAPI32.@] */ DWORD WINAPI GetSecurityDescriptorLength( PSECURITY_DESCRIPTOR pDescr) { - return (RtlLengthSecurityDescriptor(pDescr)); + return RtlLengthSecurityDescriptor(pDescr); } /****************************************************************************** @@ -601,7 +663,10 @@ GetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pDescr, PSID *pOwner, LPBOOL lpbOwnerDefaulted ) { - CallWin32ToNt (RtlGetOwnerSecurityDescriptor( pDescr, pOwner, (PBOOLEAN)lpbOwnerDefaulted )); + BOOLEAN defaulted; + BOOL ret = set_ntstatus( RtlGetOwnerSecurityDescriptor( pDescr, pOwner, &defaulted )); + *lpbOwnerDefaulted = defaulted; + return ret; } /****************************************************************************** @@ -612,7 +677,7 @@ BOOL WINAPI SetSecurityDescriptorOwner( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSID pOwner, BOOL bOwnerDefaulted) { - CallWin32ToNt (RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted)); + return set_ntstatus( RtlSetOwnerSecurityDescriptor(pSecurityDescriptor, pOwner, bOwnerDefaulted)); } /****************************************************************************** * GetSecurityDescriptorGroup [ADVAPI32.@] @@ -622,7 +687,10 @@ PSID *Group, LPBOOL GroupDefaulted) { - CallWin32ToNt (RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, (PBOOLEAN)GroupDefaulted)); + BOOLEAN defaulted; + BOOL ret = set_ntstatus( RtlGetGroupSecurityDescriptor(SecurityDescriptor, Group, &defaulted )); + *GroupDefaulted = defaulted; + return ret; } /****************************************************************************** * SetSecurityDescriptorGroup [ADVAPI32.@] @@ -630,7 +698,7 @@ BOOL WINAPI SetSecurityDescriptorGroup ( PSECURITY_DESCRIPTOR SecurityDescriptor, PSID Group, BOOL GroupDefaulted) { - CallWin32ToNt (RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted)); + return set_ntstatus( RtlSetGroupSecurityDescriptor( SecurityDescriptor, Group, GroupDefaulted)); } /****************************************************************************** @@ -642,7 +710,7 @@ BOOL WINAPI IsValidSecurityDescriptor( PSECURITY_DESCRIPTOR SecurityDescriptor ) { - CallWin32ToNt (RtlValidSecurityDescriptor(SecurityDescriptor)); + return set_ntstatus( RtlValidSecurityDescriptor(SecurityDescriptor)); } /****************************************************************************** @@ -654,8 +722,11 @@ OUT PACL *pDacl, OUT LPBOOL lpbDaclDefaulted) { - CallWin32ToNt (RtlGetDaclSecurityDescriptor(pSecurityDescriptor, (PBOOLEAN)lpbDaclPresent, - pDacl, (PBOOLEAN)lpbDaclDefaulted)); + BOOLEAN present, defaulted; + BOOL ret = set_ntstatus( RtlGetDaclSecurityDescriptor(pSecurityDescriptor, &present, pDacl, &defaulted)); + *lpbDaclPresent = present; + *lpbDaclDefaulted = defaulted; + return ret; } /****************************************************************************** @@ -668,7 +739,7 @@ PACL dacl, BOOL dacldefaulted ) { - CallWin32ToNt (RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted )); + return set_ntstatus( RtlSetDaclSecurityDescriptor (lpsd, daclpresent, dacl, dacldefaulted ) ); } /****************************************************************************** * GetSecurityDescriptorSacl [ADVAPI32.@] @@ -679,8 +750,11 @@ OUT PACL *pSacl, OUT LPBOOL lpbSaclDefaulted) { - CallWin32ToNt (RtlGetSaclSecurityDescriptor(lpsd, - (PBOOLEAN)lpbSaclPresent, pSacl, (PBOOLEAN)lpbSaclDefaulted)); + BOOLEAN present, defaulted; + BOOL ret = set_ntstatus( RtlGetSaclSecurityDescriptor(lpsd, &present, pSacl, &defaulted) ); + *lpbSaclPresent = present; + *lpbSaclDefaulted = defaulted; + return ret; } /************************************************************************** @@ -692,7 +766,7 @@ PACL lpsacl, BOOL sacldefaulted) { - CallWin32ToNt (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted)); + return set_ntstatus (RtlSetSaclSecurityDescriptor(lpsd, saclpresent, lpsacl, sacldefaulted)); } /****************************************************************************** * MakeSelfRelativeSD [ADVAPI32.@] @@ -708,7 +782,8 @@ IN PSECURITY_DESCRIPTOR pSelfRelativeSecurityDescriptor, IN OUT LPDWORD lpdwBufferLength) { - CallWin32ToNt (RtlMakeSelfRelativeSD(pAbsoluteSecurityDescriptor,pSelfRelativeSecurityDescriptor, lpdwBufferLength)); + return set_ntstatus( RtlMakeSelfRelativeSD( pAbsoluteSecurityDescriptor, + pSelfRelativeSecurityDescriptor, lpdwBufferLength)); } /****************************************************************************** @@ -718,7 +793,7 @@ BOOL WINAPI GetSecurityDescriptorControl ( PSECURITY_DESCRIPTOR pSecurityDescriptor, PSECURITY_DESCRIPTOR_CONTROL pControl, LPDWORD lpdwRevision) { - CallWin32ToNt (RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision)); + return set_ntstatus( RtlGetControlSecurityDescriptor(pSecurityDescriptor,pControl,lpdwRevision)); } /* ############################## @@ -729,9 +804,16 @@ /************************************************************************* * InitializeAcl [ADVAPI32.@] */ -DWORD WINAPI InitializeAcl(PACL acl, DWORD size, DWORD rev) +BOOL WINAPI InitializeAcl(PACL acl, DWORD size, DWORD rev) { - CallWin32ToNt (RtlCreateAcl(acl, size, rev)); + return set_ntstatus( RtlCreateAcl(acl, size, rev)); +} + +BOOL WINAPI ImpersonateNamedPipeClient( HANDLE hNamedPipe ) +{ + FIXME("%p - stub\n", hNamedPipe); + + return FALSE; } /****************************************************************************** @@ -743,7 +825,7 @@ IN DWORD AccessMask, IN PSID pSid) { - CallWin32ToNt(RtlAddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid)); + return set_ntstatus(RtlAddAccessAllowedAce(pAcl, dwAceRevision, AccessMask, pSid)); } /****************************************************************************** @@ -756,7 +838,7 @@ IN DWORD AccessMask, IN PSID pSid) { - CallWin32ToNt(RtlAddAccessAllowedAceEx(pAcl, dwAceRevision, AceFlags, AccessMask, pSid)); + return set_ntstatus(RtlAddAccessAllowedAceEx(pAcl, dwAceRevision, AceFlags, AccessMask, pSid)); } /****************************************************************************** @@ -768,7 +850,7 @@ IN DWORD AccessMask, IN PSID pSid) { - CallWin32ToNt(RtlAddAccessDeniedAce(pAcl, dwAceRevision, AccessMask, pSid)); + return set_ntstatus(RtlAddAccessDeniedAce(pAcl, dwAceRevision, AccessMask, pSid)); } /****************************************************************************** @@ -781,7 +863,7 @@ IN DWORD AccessMask, IN PSID pSid) { - CallWin32ToNt(RtlAddAccessDeniedAceEx(pAcl, dwAceRevision, AceFlags, AccessMask, pSid)); + return set_ntstatus(RtlAddAccessDeniedAceEx(pAcl, dwAceRevision, AceFlags, AccessMask, pSid)); } /****************************************************************************** @@ -794,7 +876,7 @@ LPVOID pAceList, DWORD nAceListLength) { - CallWin32ToNt(RtlAddAce(pAcl, dwAceRevision, dwStartingAceIndex, pAceList, nAceListLength)); + return set_ntstatus(RtlAddAce(pAcl, dwAceRevision, dwStartingAceIndex, pAceList, nAceListLength)); } /****************************************************************************** @@ -802,7 +884,7 @@ */ BOOL WINAPI DeleteAce(PACL pAcl, DWORD dwAceIndex) { - CallWin32ToNt(RtlDeleteAce(pAcl, dwAceIndex)); + return set_ntstatus(RtlDeleteAce(pAcl, dwAceIndex)); } /****************************************************************************** @@ -818,7 +900,7 @@ */ BOOL WINAPI GetAce(PACL pAcl,DWORD dwAceIndex,LPVOID *pAce ) { - CallWin32ToNt(RtlGetAce(pAcl, dwAceIndex, pAce)); + return set_ntstatus(RtlGetAce(pAcl, dwAceIndex, pAce)); } /****************************************************************************** @@ -830,8 +912,8 @@ DWORD nAclInformationLength, ACL_INFORMATION_CLASS dwAclInformationClass) { - CallWin32ToNt(RtlQueryInformationAcl(pAcl, pAclInformation, - nAclInformationLength, dwAclInformationClass)); + return set_ntstatus(RtlQueryInformationAcl(pAcl, pAclInformation, + nAclInformationLength, dwAclInformationClass)); } /****************************************************************************** @@ -855,7 +937,7 @@ */ BOOL WINAPI AllocateLocallyUniqueId( PLUID lpLuid ) { - CallWin32ToNt(NtAllocateLocallyUniqueId(lpLuid)); + return set_ntstatus(NtAllocateLocallyUniqueId(lpLuid)); } static const WCHAR SE_CREATE_TOKEN_NAME_W[] = @@ -1019,6 +1101,23 @@ return ret; } +BOOL WINAPI LookupPrivilegeDisplayNameA( LPCSTR lpSystemName, LPCSTR lpName, LPSTR lpDisplayName, + LPDWORD cchDisplayName, LPDWORD lpLanguageId ) +{ + FIXME("%s %s %s %p %p - stub\n", debugstr_a(lpSystemName), debugstr_a(lpName), + debugstr_a(lpDisplayName), cchDisplayName, lpLanguageId); + + return FALSE; +} + +BOOL WINAPI LookupPrivilegeDisplayNameW( LPCWSTR lpSystemName, LPCWSTR lpName, LPWSTR lpDisplayName, + LPDWORD cchDisplayName, LPDWORD lpLanguageId ) +{ + FIXME("%s %s %s %p %p - stub\n", debugstr_w(lpSystemName), debugstr_w(lpName), + debugstr_w(lpDisplayName), cchDisplayName, lpLanguageId); + + return FALSE; +} /****************************************************************************** * LookupPrivilegeNameA [ADVAPI32.@] @@ -1173,8 +1272,7 @@ r = GetFileSecurityW( name, RequestedInformation, pSecurityDescriptor, nLength, lpnLengthNeeded ); - if( name ) - HeapFree( GetProcessHeap(), 0, name ); + HeapFree( GetProcessHeap(), 0, name ); return r; } @@ -1290,8 +1388,7 @@ } r = SetFileSecurityW( name, RequestedInformation, pSecurityDescriptor ); - if( name ) - HeapFree( GetProcessHeap(), 0, name ); + HeapFree( GetProcessHeap(), 0, name ); return r; } @@ -1344,6 +1441,35 @@ return TRUE; } +NTSTATUS WINAPI +LsaEnumerateTrustedDomains( + LSA_HANDLE PolicyHandle, + PLSA_ENUMERATION_HANDLE EnumerationContext, + PVOID* Buffer, + ULONG PreferedMaximumLength, + PULONG CountReturned) +{ + FIXME("(%p,%p,%p,0x%08lx,%p):stub\n", PolicyHandle, EnumerationContext, + Buffer, PreferedMaximumLength, CountReturned); + + if (CountReturned) *CountReturned = 0; + return STATUS_SUCCESS; +} + +NTSTATUS WINAPI +LsaLookupNames( + LSA_HANDLE PolicyHandle, + ULONG Count, + PLSA_UNICODE_STRING Names, + PLSA_REFERENCED_DOMAIN_LIST* ReferencedDomains, + PLSA_TRANSLATED_SID* Sids) +{ + FIXME("(%p,0x%08lx,%p,%p,%p):stub\n", PolicyHandle, Count, Names, + ReferencedDomains, Sids); + + return STATUS_NONE_MAPPED; +} + /****************************************************************************** * LsaOpenPolicy [ADVAPI32.@] * @@ -1461,6 +1587,17 @@ return TRUE; } +NTSTATUS WINAPI +LsaSetInformationPolicy( + LSA_HANDLE PolicyHandle, + POLICY_INFORMATION_CLASS InformationClass, + PVOID Buffer) +{ + FIXME("(%p,0x%08x,%p):stub\n", PolicyHandle, InformationClass, Buffer); + + return STATUS_UNSUCCESSFUL; +} + /****************************************************************************** * LsaLookupSids [ADVAPI32.@] */ @@ -1497,6 +1634,26 @@ } /****************************************************************************** + * LsaStorePrivateData [ADVAPI32.@] + */ +NTSTATUS WINAPI LsaStorePrivateData( LSA_HANDLE PolicyHandle, + PLSA_UNICODE_STRING KeyName, PLSA_UNICODE_STRING PrivateData) +{ + FIXME("%p %p %p\n", PolicyHandle, KeyName, PrivateData); + return STATUS_OBJECT_NAME_NOT_FOUND; +} + +/****************************************************************************** + * LsaRetrievePrivateData [ADVAPI32.@] + */ +NTSTATUS WINAPI LsaRetrievePrivateData( LSA_HANDLE PolicyHandle, + PLSA_UNICODE_STRING KeyName, PLSA_UNICODE_STRING* PrivateData) +{ + FIXME("%p %p %p\n", PolicyHandle, KeyName, PrivateData); + return STATUS_OBJECT_NAME_NOT_FOUND; +} + +/****************************************************************************** * LsaNtStatusToWinError [ADVAPI32.@] * * PARAMS @@ -1554,8 +1711,6 @@ /****************************************************************************** * AccessCheck [ADVAPI32.@] - * - * FIXME check cast LPBOOL to PBOOLEAN */ BOOL WINAPI AccessCheck( @@ -1568,8 +1723,12 @@ LPDWORD GrantedAccess, LPBOOL AccessStatus) { - CallWin32ToNt (NtAccessCheck(SecurityDescriptor, ClientToken, DesiredAccess, - GenericMapping, PrivilegeSet, PrivilegeSetLength, GrantedAccess, (PBOOLEAN)AccessStatus)); + NTSTATUS access_status; + BOOL ret = set_ntstatus( NtAccessCheck(SecurityDescriptor, ClientToken, DesiredAccess, + GenericMapping, PrivilegeSet, PrivilegeSetLength, + GrantedAccess, &access_status) ); + if (ret) *AccessStatus = set_ntstatus( access_status ); + return ret; } @@ -1596,6 +1755,15 @@ return !*AccessStatus; } +VOID WINAPI MapGenericMask( PDWORD AccessMask, PGENERIC_MAPPING GenericMapping ) +{ + FIXME("%p %p - stub\n", AccessMask, GenericMapping); + + *AccessMask |= GenericMapping->GenericRead; + *AccessMask |= GenericMapping->GenericWrite; + *AccessMask |= GenericMapping->GenericExecute; + *AccessMask |= GenericMapping->GenericAll; +} /************************************************************************* * SetKernelObjectSecurity [ADVAPI32.@] @@ -1605,7 +1773,7 @@ IN SECURITY_INFORMATION SecurityInformation, IN PSECURITY_DESCRIPTOR SecurityDescriptor ) { - CallWin32ToNt (NtSetSecurityObject (Handle, SecurityInformation, SecurityDescriptor)); + return set_ntstatus (NtSetSecurityObject (Handle, SecurityInformation, SecurityDescriptor)); } @@ -1683,6 +1851,16 @@ return ret; } +BOOL WINAPI LookupAccountNameW( LPCWSTR lpSystemName, LPCWSTR lpAccountName, PSID Sid, + LPDWORD cbSid, LPWSTR ReferencedDomainName, + LPDWORD cchReferencedDomainName, PSID_NAME_USE peUse ) +{ + FIXME("%s %s %p %p %p %p %p - stub\n", debugstr_w(lpSystemName), debugstr_w(lpAccountName), + Sid, cbSid, ReferencedDomainName, cchReferencedDomainName, peUse); + + return FALSE; +} + /****************************************************************************** * PrivilegeCheck [ADVAPI32.@] */ @@ -1724,6 +1902,81 @@ return TRUE; } +BOOL WINAPI ObjectCloseAuditAlarmA(LPCSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose) +{ + FIXME("stub (%s,%p,%x)\n", debugstr_a(SubsystemName), HandleId, GenerateOnClose); + + return TRUE; +} + +BOOL WINAPI ObjectCloseAuditAlarmW(LPCWSTR SubsystemName, LPVOID HandleId, BOOL GenerateOnClose) +{ + FIXME("stub (%s,%p,%x)\n", debugstr_w(SubsystemName), HandleId, GenerateOnClose); + + return TRUE; +} + +BOOL WINAPI ObjectOpenAuditAlarmA(LPCSTR SubsystemName, LPVOID HandleId, LPSTR ObjectTypeName, + LPSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, + DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, + LPBOOL GenerateOnClose) +{ + FIXME("stub (%s,%p,%s,%s,%p,%p,0x%08lx,0x%08lx,%p,%x,%x,%p)\n", debugstr_a(SubsystemName), + HandleId, debugstr_a(ObjectTypeName), debugstr_a(ObjectName), pSecurityDescriptor, + ClientToken, DesiredAccess, GrantedAccess, Privileges, ObjectCreation, AccessGranted, + GenerateOnClose); + + return TRUE; +} + +BOOL WINAPI ObjectOpenAuditAlarmW(LPCWSTR SubsystemName, LPVOID HandleId, LPWSTR ObjectTypeName, + LPWSTR ObjectName, PSECURITY_DESCRIPTOR pSecurityDescriptor, HANDLE ClientToken, DWORD DesiredAccess, + DWORD GrantedAccess, PPRIVILEGE_SET Privileges, BOOL ObjectCreation, BOOL AccessGranted, + LPBOOL GenerateOnClose) +{ + FIXME("stub (%s,%p,%s,%s,%p,%p,0x%08lx,0x%08lx,%p,%x,%x,%p)\n", debugstr_w(SubsystemName), + HandleId, debugstr_w(ObjectTypeName), debugstr_w(ObjectName), pSecurityDescriptor, + ClientToken, DesiredAccess, GrantedAccess, Privileges, ObjectCreation, AccessGranted, + GenerateOnClose); + + return TRUE; +} + +BOOL WINAPI ObjectPrivilegeAuditAlarmA( LPCSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, + DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted) +{ + FIXME("stub (%s,%p,%p,0x%08lx,%p,%x)\n", debugstr_a(SubsystemName), HandleId, ClientToken, + DesiredAccess, Privileges, AccessGranted); + + return TRUE; +} + +BOOL WINAPI ObjectPrivilegeAuditAlarmW( LPCWSTR SubsystemName, LPVOID HandleId, HANDLE ClientToken, + DWORD DesiredAccess, PPRIVILEGE_SET Privileges, BOOL AccessGranted) +{ + FIXME("stub (%s,%p,%p,0x%08lx,%p,%x)\n", debugstr_w(SubsystemName), HandleId, ClientToken, + DesiredAccess, Privileges, AccessGranted); + + return TRUE; +} + +BOOL WINAPI PrivilegedServiceAuditAlarmA( LPCSTR SubsystemName, LPCSTR ServiceName, HANDLE ClientToken, + PPRIVILEGE_SET Privileges, BOOL AccessGranted) +{ + FIXME("stub (%s,%s,%p,%p,%x)\n", debugstr_a(SubsystemName), debugstr_a(ServiceName), + ClientToken, Privileges, AccessGranted); + + return TRUE; +} + +BOOL WINAPI PrivilegedServiceAuditAlarmW( LPCWSTR SubsystemName, LPCWSTR ServiceName, HANDLE ClientToken, + PPRIVILEGE_SET Privileges, BOOL AccessGranted) +{ + FIXME("stub %s,%s,%p,%p,%x)\n", debugstr_w(SubsystemName), debugstr_w(ServiceName), + ClientToken, Privileges, AccessGranted); + + return TRUE; +} /****************************************************************************** * GetSecurityInfo [ADVAPI32.@] @@ -1754,6 +2007,106 @@ } /****************************************************************************** + * BuildExplicitAccessWithNameA [ADVAPI32.@] + */ +VOID WINAPI BuildExplicitAccessWithNameA( PEXPLICIT_ACCESSA pExplicitAccess, + LPSTR pTrusteeName, DWORD AccessPermissions, + ACCESS_MODE AccessMode, DWORD Inheritance ) +{ + TRACE("%p %s 0x%08lx 0x%08x 0x%08lx\n", pExplicitAccess, debugstr_a(pTrusteeName), + AccessPermissions, AccessMode, Inheritance); + + pExplicitAccess->grfAccessPermissions = AccessPermissions; + pExplicitAccess->grfAccessMode = AccessMode; + pExplicitAccess->grfInheritance = Inheritance; + + pExplicitAccess->Trustee.pMultipleTrustee = NULL; + pExplicitAccess->Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME; + pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; + pExplicitAccess->Trustee.ptstrName = pTrusteeName; +} + +/****************************************************************************** + * BuildExplicitAccessWithNameW [ADVAPI32.@] + */ +VOID WINAPI BuildExplicitAccessWithNameW( PEXPLICIT_ACCESSW pExplicitAccess, + LPWSTR pTrusteeName, DWORD AccessPermissions, + ACCESS_MODE AccessMode, DWORD Inheritance ) +{ + TRACE("%p %s 0x%08lx 0x%08x 0x%08lx\n", pExplicitAccess, debugstr_w(pTrusteeName), + AccessPermissions, AccessMode, Inheritance); + + pExplicitAccess->grfAccessPermissions = AccessPermissions; + pExplicitAccess->grfAccessMode = AccessMode; + pExplicitAccess->grfInheritance = Inheritance; + + pExplicitAccess->Trustee.pMultipleTrustee = NULL; + pExplicitAccess->Trustee.MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pExplicitAccess->Trustee.TrusteeForm = TRUSTEE_IS_NAME; + pExplicitAccess->Trustee.TrusteeType = TRUSTEE_IS_UNKNOWN; + pExplicitAccess->Trustee.ptstrName = pTrusteeName; +} + +/****************************************************************************** + * BuildTrusteeWithObjectsAndNameA [ADVAPI32.@] + */ +VOID WINAPI BuildTrusteeWithObjectsAndNameA( PTRUSTEEA pTrustee, POBJECTS_AND_NAME_A pObjName, + SE_OBJECT_TYPE ObjectType, LPSTR ObjectTypeName, + LPSTR InheritedObjectTypeName, LPSTR Name ) +{ + TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, + ObjectType, ObjectTypeName, InheritedObjectTypeName, debugstr_a(Name)); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = Name; +} + +/****************************************************************************** + * BuildTrusteeWithObjectsAndNameW [ADVAPI32.@] + */ +VOID WINAPI BuildTrusteeWithObjectsAndNameW( PTRUSTEEW pTrustee, POBJECTS_AND_NAME_W pObjName, + SE_OBJECT_TYPE ObjectType, LPWSTR ObjectTypeName, + LPWSTR InheritedObjectTypeName, LPWSTR Name ) +{ + TRACE("%p %p 0x%08x %p %p %s\n", pTrustee, pObjName, + ObjectType, ObjectTypeName, InheritedObjectTypeName, debugstr_w(Name)); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_NAME; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = Name; +} + +VOID WINAPI BuildTrusteeWithObjectsAndSidA( PTRUSTEEA pTrustee, POBJECTS_AND_SID pObjSid, + GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid ) +{ + TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPSTR) pSid; +} + +VOID WINAPI BuildTrusteeWithObjectsAndSidW( PTRUSTEEW pTrustee, POBJECTS_AND_SID pObjSid, + GUID* pObjectGuid, GUID* pInheritedObjectGuid, PSID pSid ) +{ + TRACE("%p %p %p %p %p\n", pTrustee, pObjSid, pObjectGuid, pInheritedObjectGuid, pSid); + + pTrustee->pMultipleTrustee = NULL; + pTrustee->MultipleTrusteeOperation = NO_MULTIPLE_TRUSTEE; + pTrustee->TrusteeForm = TRUSTEE_IS_OBJECTS_AND_SID; + pTrustee->TrusteeType = TRUSTEE_IS_UNKNOWN; + pTrustee->ptstrName = (LPWSTR) pSid; +} + +/****************************************************************************** * BuildTrusteeWithSidA [ADVAPI32.@] */ VOID WINAPI BuildTrusteeWithSidA(PTRUSTEEA pTrustee, PSID pSid) @@ -1809,6 +2162,16 @@ pTrustee->ptstrName = name; } +BOOL WINAPI SetAclInformation( PACL pAcl, LPVOID pAclInformation, + DWORD nAclInformationLength, + ACL_INFORMATION_CLASS dwAclInformationClass ) +{ + FIXME("%p %p 0x%08lx 0x%08x - stub\n", pAcl, pAclInformation, + nAclInformationLength, dwAclInformationClass); + + return TRUE; +} + /****************************************************************************** * SetEntriesInAclA [ADVAPI32.@] */ @@ -1853,12 +2216,38 @@ r = SetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, psidOwner, psidGroup, pDacl, pSacl ); - if( wstr ) - HeapFree( GetProcessHeap(), 0, wstr ); + HeapFree( GetProcessHeap(), 0, wstr ); return r; } +BOOL WINAPI SetPrivateObjectSecurity( SECURITY_INFORMATION SecurityInformation, + PSECURITY_DESCRIPTOR ModificationDescriptor, + PSECURITY_DESCRIPTOR* ObjectsSecurityDescriptor, + PGENERIC_MAPPING GenericMapping, + HANDLE Token ) +{ + FIXME("0x%08lx %p %p %p %p - stub\n", SecurityInformation, ModificationDescriptor, + ObjectsSecurityDescriptor, GenericMapping, Token); + + return TRUE; +} + +BOOL WINAPI SetSecurityDescriptorControl( PSECURITY_DESCRIPTOR pSecurityDescriptor, + SECURITY_DESCRIPTOR_CONTROL ControlBitsOfInterest, + SECURITY_DESCRIPTOR_CONTROL ControlBitsToSet ) +{ + FIXME("%p 0x%08x 0x%08x - stub\n", pSecurityDescriptor, ControlBitsOfInterest, + ControlBitsToSet); + + return TRUE; +} + +BOOL WINAPI AreAllAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ) +{ + return RtlAreAllAccessesGranted( GrantedAccess, DesiredAccess ); +} + /****************************************************************************** * AreAnyAccessesGranted [ADVAPI32.@] * @@ -1876,7 +2265,7 @@ BOOL WINAPI AreAnyAccessesGranted( DWORD GrantedAccess, DWORD DesiredAccess ) { - return (GrantedAccess & DesiredAccess) != 0; + return RtlAreAnyAccessesGranted( GrantedAccess, DesiredAccess ); } /****************************************************************************** @@ -2315,6 +2704,35 @@ } /****************************************************************************** + * ConvertStringSecurityDescriptorToSecurityDescriptorA [ADVAPI32.@] + */ +BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorA( + LPCSTR StringSecurityDescriptor, + DWORD StringSDRevision, + PSECURITY_DESCRIPTOR* SecurityDescriptor, + PULONG SecurityDescriptorSize) +{ + UINT len; + BOOL ret = FALSE; + LPWSTR StringSecurityDescriptorW; + + len = MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, NULL, 0); + StringSecurityDescriptorW = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); + + if (StringSecurityDescriptorW) + { + MultiByteToWideChar(CP_ACP, 0, StringSecurityDescriptor, -1, StringSecurityDescriptorW, len); + + ret = ConvertStringSecurityDescriptorToSecurityDescriptorW(StringSecurityDescriptorW, + StringSDRevision, SecurityDescriptor, + SecurityDescriptorSize); + HeapFree(GetProcessHeap(), 0, StringSecurityDescriptorW); + } + + return ret; +} + +/****************************************************************************** * ConvertStringSecurityDescriptorToSecurityDescriptorW [ADVAPI32.@] */ BOOL WINAPI ConvertStringSecurityDescriptorToSecurityDescriptorW( @@ -2489,6 +2907,67 @@ return TRUE; } +BOOL WINAPI CreatePrivateObjectSecurity( + PSECURITY_DESCRIPTOR ParentDescriptor, + PSECURITY_DESCRIPTOR CreatorDescriptor, + PSECURITY_DESCRIPTOR* NewDescriptor, + BOOL IsDirectoryObject, + HANDLE Token, + PGENERIC_MAPPING GenericMapping ) +{ + FIXME("%p %p %p %d %p %p - stub\n", ParentDescriptor, CreatorDescriptor, + NewDescriptor, IsDirectoryObject, Token, GenericMapping); + + return FALSE; +} + +BOOL WINAPI DestroyPrivateObjectSecurity( PSECURITY_DESCRIPTOR* ObjectDescriptor ) +{ + FIXME("%p - stub\n", ObjectDescriptor); + + return TRUE; +} + +BOOL WINAPI CreateProcessAsUserA( + HANDLE hToken, + LPCSTR lpApplicationName, + LPSTR lpCommandLine, + LPSECURITY_ATTRIBUTES lpProcessAttributes, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + BOOL bInheritHandles, + DWORD dwCreationFlags, + LPVOID lpEnvironment, + LPCSTR lpCurrentDirectory, + LPSTARTUPINFOA lpStartupInfo, + LPPROCESS_INFORMATION lpProcessInformation ) +{ + FIXME("%p %s %s %p %p %d 0x%08lx %p %s %p %p - stub\n", hToken, debugstr_a(lpApplicationName), + debugstr_a(lpCommandLine), lpProcessAttributes, lpThreadAttributes, bInheritHandles, + dwCreationFlags, lpEnvironment, debugstr_a(lpCurrentDirectory), lpStartupInfo, lpProcessInformation); + + return FALSE; +} + +BOOL WINAPI CreateProcessAsUserW( + HANDLE hToken, + LPCWSTR lpApplicationName, + LPWSTR lpCommandLine, + LPSECURITY_ATTRIBUTES lpProcessAttributes, + LPSECURITY_ATTRIBUTES lpThreadAttributes, + BOOL bInheritHandles, + DWORD dwCreationFlags, + LPVOID lpEnvironment, + LPCWSTR lpCurrentDirectory, + LPSTARTUPINFOW lpStartupInfo, + LPPROCESS_INFORMATION lpProcessInformation ) +{ + FIXME("%p %s %s %p %p %d 0x%08lx %p %s %p %p - stub\n", hToken, debugstr_w(lpApplicationName), + debugstr_w(lpCommandLine), lpProcessAttributes, lpThreadAttributes, bInheritHandles, + dwCreationFlags, lpEnvironment, debugstr_w(lpCurrentDirectory), lpStartupInfo, lpProcessInformation); + + return FALSE; +} + /****************************************************************************** * ComputeStringSidSize */ @@ -2510,6 +2989,56 @@ return size; } +BOOL WINAPI DuplicateTokenEx( + HANDLE ExistingTokenHandle, DWORD dwDesiredAccess, + LPSECURITY_ATTRIBUTES lpTokenAttributes, + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, + TOKEN_TYPE TokenType, + PHANDLE DuplicateTokenHandle ) +{ + FIXME("%p 0x%08lx 0x%08x 0x%08x %p - stub\n", ExistingTokenHandle, dwDesiredAccess, + ImpersonationLevel, TokenType, DuplicateTokenHandle); + + return FALSE; +} + +BOOL WINAPI DuplicateToken( + HANDLE ExistingTokenHandle, + SECURITY_IMPERSONATION_LEVEL ImpersonationLevel, + PHANDLE DuplicateTokenHandle ) +{ + return DuplicateTokenEx( ExistingTokenHandle, 0, NULL, ImpersonationLevel, + TokenImpersonation, DuplicateTokenHandle ); +} + +BOOL WINAPI EnumDependentServicesA( + SC_HANDLE hService, + DWORD dwServiceState, + LPENUM_SERVICE_STATUSA lpServices, + DWORD cbBufSize, + LPDWORD pcbBytesNeeded, + LPDWORD lpServicesReturned ) +{ + FIXME("%p 0x%08lx %p 0x%08lx %p %p - stub\n", hService, dwServiceState, + lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned); + + return FALSE; +} + +BOOL WINAPI EnumDependentServicesW( + SC_HANDLE hService, + DWORD dwServiceState, + LPENUM_SERVICE_STATUSW lpServices, + DWORD cbBufSize, + LPDWORD pcbBytesNeeded, + LPDWORD lpServicesReturned ) +{ + FIXME("%p 0x%08lx %p 0x%08lx %p %p - stub\n", hService, dwServiceState, + lpServices, cbBufSize, pcbBytesNeeded, lpServicesReturned); + + return FALSE; +} + /****************************************************************************** * ParseStringSidToSid */ @@ -2637,8 +3166,7 @@ r = GetNamedSecurityInfoW( wstr, ObjectType, SecurityInfo, ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor ); - if( wstr ) - HeapFree( GetProcessHeap(), 0, wstr ); + HeapFree( GetProcessHeap(), 0, wstr ); return r; } @@ -2655,3 +3183,39 @@ ppsidOwner, ppsidGroup, ppDacl, ppSacl, ppSecurityDescriptor); return ERROR_CALL_NOT_IMPLEMENTED; } + +/****************************************************************************** + * DecryptFileW [ADVAPI32.@] + */ +BOOL WINAPI DecryptFileW(LPCWSTR lpFileName, DWORD dwReserved) +{ + FIXME("%s %08lx\n", debugstr_w(lpFileName), dwReserved); + return TRUE; +} + +/****************************************************************************** + * DecryptFileA [ADVAPI32.@] + */ +BOOL WINAPI DecryptFileA(LPCSTR lpFileName, DWORD dwReserved) +{ + FIXME("%s %08lx\n", debugstr_a(lpFileName), dwReserved); + return TRUE; +} + +/****************************************************************************** + * EncryptFileW [ADVAPI32.@] + */ +BOOL WINAPI EncryptFileW(LPCWSTR lpFileName) +{ + FIXME("%s\n", debugstr_w(lpFileName)); + return TRUE; +} + +/****************************************************************************** + * EncryptFileA [ADVAPI32.@] + */ +BOOL WINAPI EncryptFileA(LPCSTR lpFileName) +{ + FIXME("%s\n", debugstr_a(lpFileName)); + return TRUE; +} diff -urN wine-20041201/dlls/advapi32/service.c wine-20050111/dlls/advapi32/service.c --- wine-20041201/dlls/advapi32/service.c 2004-12-01 16:31:34.000000000 +0100 +++ wine-20050111/dlls/advapi32/service.c 2005-01-03 18:12:51.000000000 +0100 @@ -40,13 +40,30 @@ 'L','O','C','K',0}; static const WCHAR szServiceShmemNameFmtW[] = {'A','D','V','A','P','I','_', 'S','E','B','_','%','s',0}; +static const WCHAR szServiceDispEventNameFmtW[] = {'A','D','V','A','P','I','_', + 'D','I','S','P','_','%','s',0}; +static const WCHAR szServiceMutexNameFmtW[] = {'A','D','V','A','P','I','_', + 'M','U','X','_','%','s',0}; +static const WCHAR szServiceAckEventNameFmtW[] = {'A','D','V','A','P','I','_', + 'A','C','K','_','%','s',0}; +static const WCHAR szWaitServiceStartW[] = {'A','D','V','A','P','I','_','W', + 'a','i','t','S','e','r','v','i', + 'c','e','S','t','a','r','t',0}; struct SEB /* service environment block */ { /* resides in service's shared memory object */ + DWORD control_code; /* service control code */ + DWORD dispatcher_error; /* set by dispatcher if it fails to invoke control handler */ + SERVICE_STATUS status; DWORD argc; /* variable part of SEB contains service arguments */ }; +static HANDLE dispatcher_event; /* this is used by service thread to wakeup + * service control dispatcher when thread terminates */ + +static struct service_thread_data *service; /* FIXME: this should be a list */ + /****************************************************************************** * SC_HANDLEs */ @@ -280,7 +297,7 @@ /****************************************************************************** * build_arg_vectors * - * helper function for service control dispatcher + * helper function for start_new_service * * Allocate and initialize array of LPWSTRs to arguments in variable part * of service environment block. @@ -315,6 +332,12 @@ LPSERVICE_MAIN_FUNCTIONW service_main; DWORD argc; LPWSTR *argv; + HANDLE hServiceShmem; + struct SEB *seb; + HANDLE thread_handle; + HANDLE mutex; /* provides serialization of control request */ + HANDLE ack_event; /* control handler completion acknowledgement */ + LPHANDLER_FUNCTION ctrl_handler; }; static DWORD WINAPI service_thread( LPVOID arg ) @@ -322,25 +345,40 @@ struct service_thread_data *data = arg; data->service_main( data->argc, data->argv ); + SetEvent( dispatcher_event ); return 0; } /****************************************************************************** - * service_ctrl_dispatcher + * dispose_service_thread_data * - * helper function for StartServiceCtrlDispatcherA/W + * helper function for service control dispatcher */ -static BOOL service_ctrl_dispatcher( LPSERVICE_TABLE_ENTRYW servent, BOOL ascii ) +static void dispose_service_thread_data( struct service_thread_data* thread_data ) +{ + if( thread_data->mutex ) CloseHandle( thread_data->mutex ); + if( thread_data->ack_event ) CloseHandle( thread_data->ack_event ); + HeapFree( GetProcessHeap(), 0, thread_data->argv ); + if( thread_data->seb ) UnmapViewOfFile( thread_data->seb ); + if( thread_data->hServiceShmem ) CloseHandle( thread_data->hServiceShmem ); + HeapFree( GetProcessHeap(), 0, thread_data ); +} + +/****************************************************************************** + * start_new_service + * + * helper function for service control dispatcher + */ +static struct service_thread_data* +start_new_service( LPSERVICE_MAIN_FUNCTIONW service_main, BOOL ascii ) { - HANDLE hServiceShmem = NULL; - struct SEB *seb = NULL; struct service_thread_data *thread_data; unsigned int i; - HANDLE thread; + WCHAR object_name[ MAX_PATH ]; thread_data = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(struct service_thread_data) ); if( NULL == thread_data ) - return FALSE; + return NULL; if( ! read_scm_lock_data( thread_data->service_name ) ) { @@ -350,21 +388,21 @@ submitted against revision 1.45 and so preserved here. */ FIXME("should fail with ERROR_FAILED_SERVICE_CONTROLLER_CONNECT\n"); - servent->lpServiceProc( 0, NULL ); + service_main( 0, NULL ); HeapFree( GetProcessHeap(), 0, thread_data ); - return TRUE; + return NULL; } - seb = open_seb_shmem( thread_data->service_name, &hServiceShmem ); - if( NULL == seb ) + thread_data->seb = open_seb_shmem( thread_data->service_name, &thread_data->hServiceShmem ); + if( NULL == thread_data->seb ) goto error; - thread_data->argv = build_arg_vectors( seb ); + thread_data->argv = build_arg_vectors( thread_data->seb ); if( NULL == thread_data->argv ) goto error; thread_data->argv[0] = thread_data->service_name; - thread_data->argc = seb->argc + 1; + thread_data->argc = thread_data->seb->argc + 1; if( ascii ) { @@ -388,31 +426,137 @@ } } - /* start the service thread */ - thread_data->service_main = servent->lpServiceProc; - thread = CreateThread( NULL, 0, service_thread, thread_data, 0, NULL ); - if( NULL == thread ) + /* init status according to docs for StartService */ + thread_data->seb->status.dwCurrentState = SERVICE_START_PENDING; + thread_data->seb->status.dwControlsAccepted = 0; + thread_data->seb->status.dwCheckPoint = 0; + thread_data->seb->status.dwWaitHint = 2000; + + /* create service mutex; mutex is initially owned */ + snprintfW( object_name, MAX_PATH, szServiceMutexNameFmtW, thread_data->service_name ); + thread_data->mutex = CreateMutexW( NULL, TRUE, object_name ); + if( NULL == thread_data->mutex ) goto error; - /* FIXME: dispatch control requests */ - WaitForSingleObject( thread, INFINITE ); - CloseHandle( thread ); + if( ERROR_ALREADY_EXISTS == GetLastError() ) + { + SetLastError( ERROR_SERVICE_ALREADY_RUNNING ); + goto error; + } - HeapFree( GetProcessHeap(), 0, thread_data->argv ); - HeapFree( GetProcessHeap(), 0, thread_data ); - UnmapViewOfFile( seb ); - CloseHandle( hServiceShmem ); - return TRUE; + /* create service event */ + snprintfW( object_name, MAX_PATH, szServiceAckEventNameFmtW, thread_data->service_name ); + thread_data->ack_event = CreateEventW( NULL, FALSE, FALSE, object_name ); + if( NULL == thread_data->ack_event ) + goto error; + + if( ERROR_ALREADY_EXISTS == GetLastError() ) + { + SetLastError( ERROR_SERVICE_ALREADY_RUNNING ); + goto error; + } + + /* create service thread in suspended state + * to avoid race while caller handles return value */ + thread_data->service_main = service_main; + thread_data->thread_handle = CreateThread( NULL, 0, service_thread, + thread_data, CREATE_SUSPENDED, NULL ); + if( thread_data->thread_handle ) + return thread_data; error: - if( thread_data->argv ) HeapFree( GetProcessHeap(), 0, thread_data->argv ); - if( seb ) UnmapViewOfFile( seb ); - if( hServiceShmem ) CloseHandle( hServiceShmem ); - HeapFree( GetProcessHeap(), 0, thread_data ); + dispose_service_thread_data( thread_data ); return FALSE; } /****************************************************************************** + * service_ctrl_dispatcher + */ +static BOOL service_ctrl_dispatcher( LPSERVICE_TABLE_ENTRYW servent, BOOL ascii ) +{ + WCHAR object_name[ MAX_PATH ]; + HANDLE wait; + + /* FIXME: if shared service, find entry by service name */ + + /* FIXME: move this into dispatcher loop */ + service = start_new_service( servent->lpServiceProc, ascii ); + if( NULL == service ) + return FALSE; + + ResumeThread( service->thread_handle ); + + /* create dispatcher event object */ + /* FIXME: object_name should be based on executable image path because + * this object is common for all services in the process */ + /* But what if own and shared services have the same executable? */ + snprintfW( object_name, MAX_PATH, szServiceDispEventNameFmtW, service->service_name ); + dispatcher_event = CreateEventW( NULL, FALSE, FALSE, object_name ); + if( NULL == dispatcher_event ) + { + dispose_service_thread_data( service ); + return FALSE; + } + + if( ERROR_ALREADY_EXISTS == GetLastError() ) + { + SetLastError( ERROR_SERVICE_ALREADY_RUNNING ); + CloseHandle( dispatcher_event ); + return FALSE; + } + + /* ready to accept control requests */ + ReleaseMutex( service->mutex ); + + /* signal for StartService */ + wait = OpenSemaphoreW( SEMAPHORE_MODIFY_STATE, FALSE, szWaitServiceStartW ); + if( wait ) + { + ReleaseSemaphore( wait, 1, NULL ); + CloseHandle( wait ); + } + + /* dispatcher loop */ + for(;;) + { + DWORD ret; + + WaitForSingleObject( dispatcher_event, INFINITE ); + + /* at first, look for terminated service thread + * FIXME: threads, if shared service */ + if( !GetExitCodeThread( service->thread_handle, &ret ) ) + ERR("Couldn't get thread exit code\n"); + else if( ret != STILL_ACTIVE ) + { + CloseHandle( service->thread_handle ); + dispose_service_thread_data( service ); + break; + } + + /* look for control requests */ + if( service->seb->control_code ) + { + if( NULL == service->ctrl_handler ) + service->seb->dispatcher_error = ERROR_SERVICE_CANNOT_ACCEPT_CTRL; + else + { + service->ctrl_handler( service->seb->control_code ); + service->seb->dispatcher_error = 0; + } + service->seb->control_code = 0; + SetEvent( service->ack_event ); + } + + /* FIXME: if shared service, check SCM lock object; + * if exists, a new service should be started */ + } + + CloseHandle( dispatcher_event ); + return TRUE; +} + +/****************************************************************************** * StartServiceCtrlDispatcherA [ADVAPI32.@] */ BOOL WINAPI @@ -501,8 +645,14 @@ SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerA( LPCSTR lpServiceName, LPHANDLER_FUNCTION lpfHandler ) -{ FIXME("%s %p\n", lpServiceName, lpfHandler); - return 0xcacacafe; +{ + LPWSTR lpServiceNameW; + SERVICE_STATUS_HANDLE ret; + + lpServiceNameW = SERV_dup(lpServiceName); + ret = RegisterServiceCtrlHandlerW( lpServiceNameW, lpfHandler ); + SERV_free(lpServiceNameW); + return ret; } /****************************************************************************** @@ -515,8 +665,11 @@ SERVICE_STATUS_HANDLE WINAPI RegisterServiceCtrlHandlerW( LPCWSTR lpServiceName, LPHANDLER_FUNCTION lpfHandler ) -{ FIXME("%s %p\n", debugstr_w(lpServiceName), lpfHandler); - return 0xcacacafe; +{ + /* FIXME: find service thread data by service name */ + + service->ctrl_handler = lpfHandler; + return 0xcacacafe; } /****************************************************************************** @@ -528,15 +681,27 @@ */ BOOL WINAPI SetServiceStatus( SERVICE_STATUS_HANDLE hService, LPSERVICE_STATUS lpStatus ) -{ FIXME("0x%lx %p\n",hService, lpStatus); - TRACE("\tType:%lx\n",lpStatus->dwServiceType); - TRACE("\tState:%lx\n",lpStatus->dwCurrentState); - TRACE("\tControlAccepted:%lx\n",lpStatus->dwControlsAccepted); - TRACE("\tExitCode:%lx\n",lpStatus->dwWin32ExitCode); - TRACE("\tServiceExitCode:%lx\n",lpStatus->dwServiceSpecificExitCode); - TRACE("\tCheckPoint:%lx\n",lpStatus->dwCheckPoint); - TRACE("\tWaitHint:%lx\n",lpStatus->dwWaitHint); - return TRUE; +{ + DWORD r; + + TRACE("\tType:%lx\n",lpStatus->dwServiceType); + TRACE("\tState:%lx\n",lpStatus->dwCurrentState); + TRACE("\tControlAccepted:%lx\n",lpStatus->dwControlsAccepted); + TRACE("\tExitCode:%lx\n",lpStatus->dwWin32ExitCode); + TRACE("\tServiceExitCode:%lx\n",lpStatus->dwServiceSpecificExitCode); + TRACE("\tCheckPoint:%lx\n",lpStatus->dwCheckPoint); + TRACE("\tWaitHint:%lx\n",lpStatus->dwWaitHint); + + /* FIXME: find service thread data by status handle */ + + /* acquire mutex; note that mutex may already be owned + * when service handles control request + */ + r = WaitForSingleObject( service->mutex, 0 ); + memcpy( &service->seb->status, lpStatus, sizeof(SERVICE_STATUS) ); + if( WAIT_OBJECT_0 == r || WAIT_ABANDONED == r ) + ReleaseMutex( service->mutex ); + return TRUE; } /****************************************************************************** @@ -556,15 +721,14 @@ SC_HANDLE WINAPI OpenSCManagerA( LPCSTR lpMachineName, LPCSTR lpDatabaseName, DWORD dwDesiredAccess ) { - UNICODE_STRING lpMachineNameW; - UNICODE_STRING lpDatabaseNameW; + LPWSTR lpMachineNameW, lpDatabaseNameW; SC_HANDLE ret; - RtlCreateUnicodeStringFromAsciiz (&lpMachineNameW,lpMachineName); - RtlCreateUnicodeStringFromAsciiz (&lpDatabaseNameW,lpDatabaseName); - ret = OpenSCManagerW(lpMachineNameW.Buffer,lpDatabaseNameW.Buffer, dwDesiredAccess); - RtlFreeUnicodeString(&lpDatabaseNameW); - RtlFreeUnicodeString(&lpMachineNameW); + lpMachineNameW = SERV_dup(lpMachineName); + lpDatabaseNameW = SERV_dup(lpDatabaseName); + ret = OpenSCManagerW(lpMachineNameW, lpDatabaseNameW, dwDesiredAccess); + SERV_free(lpDatabaseNameW); + SERV_free(lpMachineNameW); return ret; } @@ -583,11 +747,23 @@ TRACE("(%s,%s,0x%08lx)\n", debugstr_w(lpMachineName), debugstr_w(lpDatabaseName), dwDesiredAccess); - /* - * FIXME: what is lpDatabaseName? - * It should be set to "SERVICES_ACTIVE_DATABASE" according to - * docs, but what if it isn't? - */ + if( lpDatabaseName && lpDatabaseName[0] ) + { + if( strcmpiW( lpDatabaseName, SERVICES_ACTIVE_DATABASEW ) == 0 ) + { + /* noop, all right */ + } + else if( strcmpiW( lpDatabaseName, SERVICES_FAILED_DATABASEW ) == 0 ) + { + SetLastError( ERROR_DATABASE_DOES_NOT_EXIST ); + return NULL; + } + else + { + SetLastError( ERROR_INVALID_NAME ); + return NULL; + } + } retval = alloc_sc_handle( SC_HTYPE_MANAGER ); if( NULL == retval ) return NULL; @@ -626,14 +802,94 @@ * RETURNS * Success: TRUE. * Failure: FALSE. + * + * BUGS + * Unlike M$' implementation, control requests are not serialized and may be + * processed asynchronously. */ BOOL WINAPI ControlService( SC_HANDLE hService, DWORD dwControl, LPSERVICE_STATUS lpServiceStatus ) { - FIXME("(%p,%ld,%p): stub\n",hService,dwControl,lpServiceStatus); - return TRUE; -} + struct sc_handle *hsvc = hService; + WCHAR object_name[ MAX_PATH ]; + HANDLE mutex = NULL, shmem = NULL; + HANDLE disp_event = NULL, ack_event = NULL; + struct SEB *seb = NULL; + DWORD r; + BOOL ret = FALSE, mutex_owned = FALSE; + + /* open and hold mutex */ + snprintfW( object_name, MAX_PATH, szServiceMutexNameFmtW, hsvc->u.service.name ); + mutex = OpenMutexW( MUTEX_ALL_ACCESS, FALSE, object_name ); + if( NULL == mutex ) + { + SetLastError( ERROR_SERVICE_NOT_ACTIVE ); + return FALSE; + } + + r = WaitForSingleObject( mutex, 30000 ); + if( WAIT_FAILED == r ) + goto done; + + if( WAIT_TIMEOUT == r ) + { + SetLastError( ERROR_SERVICE_REQUEST_TIMEOUT ); + goto done; + } + mutex_owned = TRUE; + + /* open event objects */ + snprintfW( object_name, MAX_PATH, szServiceDispEventNameFmtW, hsvc->u.service.name ); + disp_event = OpenEventW( EVENT_ALL_ACCESS, FALSE, object_name ); + if( NULL == disp_event ) + goto done; + snprintfW( object_name, MAX_PATH, szServiceAckEventNameFmtW, hsvc->u.service.name ); + ack_event = OpenEventW( EVENT_ALL_ACCESS, FALSE, object_name ); + if( NULL == ack_event ) + goto done; + + /* get service environment block */ + seb = open_seb_shmem( hsvc->u.service.name, &shmem ); + if( NULL == seb ) + goto done; + + /* send request */ + /* FIXME: check dwControl against controls accepted */ + seb->control_code = dwControl; + SetEvent( disp_event ); + + /* wait for acknowledgement */ + r = WaitForSingleObject( ack_event, 30000 ); + if( WAIT_FAILED == r ) + goto done; + + if( WAIT_TIMEOUT == r ) + { + SetLastError( ERROR_SERVICE_REQUEST_TIMEOUT ); + goto done; + } + + if( seb->dispatcher_error ) + { + SetLastError( seb->dispatcher_error ); + goto done; + } + + /* get status */ + if( lpServiceStatus ) + memcpy( lpServiceStatus, &seb->status, sizeof(SERVICE_STATUS) ); + ret = TRUE; + +done: + if( seb ) UnmapViewOfFile( seb ); + if( shmem ) CloseHandle( shmem ); + if( ack_event ) CloseHandle( ack_event ); + if( disp_event ) CloseHandle( disp_event ); + if( mutex_owned ) ReleaseMutex( mutex ); + if( mutex ) CloseHandle( mutex ); + return ret; +} /****************************************************************************** * CloseServiceHandle [ADVAPI32.@] @@ -675,15 +931,14 @@ SC_HANDLE WINAPI OpenServiceA( SC_HANDLE hSCManager, LPCSTR lpServiceName, DWORD dwDesiredAccess ) { - UNICODE_STRING lpServiceNameW; + LPWSTR lpServiceNameW; SC_HANDLE ret; - RtlCreateUnicodeStringFromAsciiz (&lpServiceNameW,lpServiceName); - if(lpServiceName) - TRACE("Request for service %s\n",lpServiceName); - else - return FALSE; - ret = OpenServiceW( hSCManager, lpServiceNameW.Buffer, dwDesiredAccess); - RtlFreeUnicodeString(&lpServiceNameW); + + TRACE("%p %s %ld\n",hSCManager, debugstr_a(lpServiceName), dwDesiredAccess); + + lpServiceNameW = SERV_dup(lpServiceName); + ret = OpenServiceW( hSCManager, lpServiceNameW, dwDesiredAccess); + SERV_free(lpServiceNameW); return ret; } @@ -701,8 +956,13 @@ HKEY hKey; long r; - TRACE("(%p,%p,%ld)\n",hSCManager, lpServiceName, - dwDesiredAccess); + TRACE("%p %s %ld\n",hSCManager, debugstr_w(lpServiceName), dwDesiredAccess); + + if (!lpServiceName) + { + SetLastError(ERROR_INVALID_ADDRESS); + return NULL; + } retval = alloc_sc_handle( SC_HTYPE_SERVICE ); if( NULL == retval ) @@ -764,7 +1024,10 @@ init_service_handle( retval, hscm, hKey, lpServiceName ); if (dp != REG_CREATED_NEW_KEY) + { + SetLastError(ERROR_SERVICE_EXISTS); goto error; + } if(lpDisplayName) { @@ -951,29 +1214,23 @@ LPCSTR *lpServiceArgVectors ) { LPWSTR *lpwstr=NULL; - UNICODE_STRING usBuffer; unsigned int i; TRACE("(%p,%ld,%p)\n",hService,dwNumServiceArgs,lpServiceArgVectors); if(dwNumServiceArgs) - lpwstr = (LPWSTR*) HeapAlloc( GetProcessHeap(), 0, + lpwstr = HeapAlloc( GetProcessHeap(), 0, dwNumServiceArgs*sizeof(LPWSTR) ); - else - lpwstr = NULL; for(i=0; iu.service.name ); + mutex = OpenMutexW( MUTEX_ALL_ACCESS, FALSE, object_name ); + if( NULL == mutex ) + goto stopped; + + /* hold mutex */ + r = WaitForSingleObject( mutex, 30000 ); + if( WAIT_FAILED == r ) + goto done; + + if( WAIT_TIMEOUT == r ) + { + SetLastError( ERROR_SERVICE_REQUEST_TIMEOUT ); + goto done; + } + mutex_owned = TRUE; + /* get service environment block */ + seb = open_seb_shmem( hsvc->u.service.name, &shmem ); + if( NULL == seb ) + goto done; + + /* get status */ + memcpy( lpservicestatus, &seb->status, sizeof(SERVICE_STATUS) ); + ret = TRUE; + +done: + if( seb ) UnmapViewOfFile( seb ); + if( shmem ) CloseHandle( shmem ); + if( mutex_owned ) ReleaseMutex( mutex ); + CloseHandle( mutex ); + return ret; + +stopped: + /* service stopped */ /* read the service type from the registry */ size = sizeof(val); r = RegQueryValueExA(hsvc->u.service.hkey, "Type", NULL, &type, (LPBYTE)&val, &size); @@ -1150,26 +1447,7 @@ return FALSE; } lpservicestatus->dwServiceType = val; - /* FIXME: how are these determined or read from the registry? */ - /* SERVICE: unavailable=0, stopped=1, starting=2, running=3? */ - - /* Determine if currently running via named shared memory */ - snprintfW( str, MAX_PATH, szServiceShmemNameFmtW, hsvc->u.service.name ); - hServiceShmem = CreateFileMappingW( INVALID_HANDLE_VALUE, - NULL, PAGE_READWRITE, 0, size, str ); - if( NULL == hServiceShmem ) - { - lpservicestatus->dwCurrentState = 1; - } else { - if( GetLastError() == ERROR_ALREADY_EXISTS ) - { - lpservicestatus->dwCurrentState = 3; - } else { - lpservicestatus->dwCurrentState = 1; - } - CloseHandle( hServiceShmem ); - } - + lpservicestatus->dwCurrentState = 1; /* stopped */ lpservicestatus->dwControlsAccepted = 0; lpservicestatus->dwWin32ExitCode = NO_ERROR; lpservicestatus->dwServiceSpecificExitCode = 0; @@ -1480,6 +1758,64 @@ return TRUE; } +BOOL WINAPI GetServiceKeyNameA( SC_HANDLE hSCManager, LPCSTR lpDisplayName, + LPSTR lpServiceName, LPDWORD lpcchBuffer ) +{ + FIXME("%p %s %p %p\n", hSCManager, debugstr_a(lpDisplayName), lpServiceName, lpcchBuffer); + + return FALSE; +} + +BOOL WINAPI GetServiceKeyNameW( SC_HANDLE hSCManager, LPCWSTR lpDisplayName, + LPWSTR lpServiceName, LPDWORD lpcchBuffer ) +{ + FIXME("%p %s %p %p\n", hSCManager, debugstr_w(lpDisplayName), lpServiceName, lpcchBuffer); + + return FALSE; +} + +BOOL WINAPI QueryServiceLockStatusA( SC_HANDLE hSCManager, + LPQUERY_SERVICE_LOCK_STATUSA lpLockStatus, + DWORD cbBufSize, LPDWORD pcbBytesNeeded) +{ + FIXME("%p %p 0x%08lx %p - stub\n", hSCManager, lpLockStatus, cbBufSize, pcbBytesNeeded); + + return FALSE; +} + +BOOL WINAPI QueryServiceLockStatusW( SC_HANDLE hSCManager, + LPQUERY_SERVICE_LOCK_STATUSW lpLockStatus, + DWORD cbBufSize, LPDWORD pcbBytesNeeded) +{ + FIXME("%p %p 0x%08lx %p - stub\n", hSCManager, lpLockStatus, cbBufSize, pcbBytesNeeded); + + return FALSE; +} + +/****************************************************************************** + * GetServiceDisplayNameA [ADVAPI32.@] + */ +BOOL WINAPI GetServiceDisplayNameA( SC_HANDLE hSCManager, LPCSTR lpServiceName, + LPSTR lpDisplayName, LPDWORD lpcchBuffer) +{ + FIXME("%p %s %p %p\n", hSCManager, + debugstr_a(lpServiceName), lpDisplayName, lpcchBuffer); + return FALSE; +} + + +/****************************************************************************** + * GetServiceDisplayNameW [ADVAPI32.@] + */ +BOOL WINAPI GetServiceDisplayNameW( SC_HANDLE hSCManager, LPCWSTR lpServiceName, + LPWSTR lpDisplayName, LPDWORD lpcchBuffer) +{ + FIXME("%p %s %p %p\n", hSCManager, + debugstr_w(lpServiceName), lpDisplayName, lpcchBuffer); + return FALSE; +} + + /****************************************************************************** * ChangeServiceConfigW [ADVAPI32.@] */ @@ -1638,3 +1974,14 @@ FIXME("%p %ld %p\n", hService, dwSecurityInformation, lpSecurityDescriptor); return TRUE; } + +BOOL WINAPI SetServiceBits( SERVICE_STATUS_HANDLE hServiceStatus, + DWORD dwServiceBits, + BOOL bSetBitsOn, + BOOL bUpdateImmediately) +{ + FIXME("0x%08lx 0x%08lx %x %x - stub\n", hServiceStatus, dwServiceBits, + bSetBitsOn, bUpdateImmediately); + + return TRUE; +} diff -urN wine-20041201/dlls/advapi32/tests/crypt.c wine-20050111/dlls/advapi32/tests/crypt.c --- wine-20041201/dlls/advapi32/tests/crypt.c 2004-11-30 18:33:27.000000000 +0100 +++ wine-20050111/dlls/advapi32/tests/crypt.c 2005-01-04 21:31:53.000000000 +0100 @@ -34,6 +34,26 @@ static const char szBadKeySet[] = "wine_test_bad_keyset"; #define NON_DEF_PROV_TYPE 999 +static HMODULE hadvapi32; +static BOOL (WINAPI *pCryptEnumProviderTypesA)(DWORD, DWORD*, DWORD, DWORD*, LPSTR, DWORD*); +static BOOL (WINAPI *pCryptEnumProvidersA)(DWORD, DWORD*, DWORD, DWORD*, LPSTR, DWORD*); +static BOOL (WINAPI *pCryptGetDefaultProviderA)(DWORD, DWORD*, DWORD, LPSTR, DWORD*); +static BOOL (WINAPI *pCryptSetProviderExA)(LPCSTR, DWORD, DWORD*, DWORD); + +static void init_function_pointers(void) +{ + hadvapi32 = GetModuleHandleA("advapi32.dll"); + + if(hadvapi32) + { + pCryptEnumProviderTypesA = (void*)GetProcAddress(hadvapi32, "CryptEnumProviderTypesA"); + pCryptEnumProvidersA = (void*)GetProcAddress(hadvapi32, "CryptEnumProvidersA"); + pCryptGetDefaultProviderA = (void*)GetProcAddress(hadvapi32, "CryptGetDefaultProviderA"); + pCryptSetProviderExA = (void*)GetProcAddress(hadvapi32, "CryptSetProviderExA"); + } +} + + static void init_environment(void) { HCRYPTPROV hProv; @@ -114,7 +134,7 @@ hProv = 0; SetLastError(0xdeadbeef); result = CryptAcquireContext(&hProv, szKeySet, szRsaBaseProv, PROV_RSA_FULL, 0); - ok(result && GetLastError() == ERROR_SUCCESS, "%d/%ld\n", result, GetLastError()); + ok(result && (GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE), "%d/%ld\n", result, GetLastError()); if (hProv) CryptReleaseContext(hProv, 0); @@ -123,7 +143,7 @@ hProv = 0; SetLastError(0xdeadbeef); result = CryptAcquireContext(&hProv, szKeySet, "", PROV_RSA_FULL, 0); - ok(result && GetLastError() == ERROR_SUCCESS, "%d/%ld\n", result, GetLastError()); + ok(result && (GetLastError() == ERROR_SUCCESS || GetLastError() == ERROR_RING2_STACK_IN_USE), "%d/%ld\n", result, GetLastError()); if (hProv) CryptReleaseContext(hProv, 0); @@ -176,15 +196,21 @@ DWORD notNull = 5; DWORD notZeroFlags = 5; + if(!pCryptEnumProvidersA) + { + trace("skipping CryptEnumProviders tests\n"); + return; + } + if (!FindProvRegVals(dwIndex, &dwType, &pszProvName, &cbName, &provCount)) return; /* check pdwReserved flag for NULL */ - result = CryptEnumProviders(dwIndex, ¬Null, 0, &type, NULL, &providerLen); + result = pCryptEnumProvidersA(dwIndex, ¬Null, 0, &type, NULL, &providerLen); ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "%ld\n", GetLastError()); /* check dwFlags == 0 */ - result = CryptEnumProviders(dwIndex, NULL, notZeroFlags, &type, NULL, &providerLen); + result = pCryptEnumProvidersA(dwIndex, NULL, notZeroFlags, &type, NULL, &providerLen); ok(!result && GetLastError()==NTE_BAD_FLAGS, "%ld\n", GetLastError()); /* alloc provider to half the size required @@ -193,7 +219,7 @@ if (!(provider = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, providerLen)))) return; - result = CryptEnumProviders(dwIndex, NULL, 0, &type, provider, &providerLen); + result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen); ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n", ERROR_MORE_DATA, GetLastError()); @@ -203,7 +229,7 @@ * after loop ends, count should be provCount + 1 so subtract 1 * to get actual number of providers */ count = 0; - while(CryptEnumProviders(count++, NULL, 0, &type, NULL, &providerLen)) + while(pCryptEnumProvidersA(count++, NULL, 0, &type, NULL, &providerLen)) ; count--; ok(count==provCount, "expected %i, got %i\n", (int)provCount, (int)count); @@ -211,17 +237,17 @@ /* loop past the actual number of providers to get the error * ERROR_NO_MORE_ITEMS */ for (count = 0; count < provCount + 1; count++) - result = CryptEnumProviders(count, NULL, 0, &type, NULL, &providerLen); + result = pCryptEnumProvidersA(count, NULL, 0, &type, NULL, &providerLen); ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n", ERROR_NO_MORE_ITEMS, GetLastError()); /* check expected versus actual values returned */ - result = CryptEnumProviders(dwIndex, NULL, 0, &type, NULL, &providerLen); + result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, NULL, &providerLen); ok(result && providerLen==cbName, "expected %i, got %i\n", (int)cbName, (int)providerLen); if (!(provider = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, providerLen)))) return; - result = CryptEnumProviders(dwIndex, NULL, 0, &type, provider, &providerLen); + result = pCryptEnumProvidersA(dwIndex, NULL, 0, &type, provider, &providerLen); ok(result && type==dwType, "expected %ld, got %ld\n", dwType, type); ok(result && !strcmp(pszProvName, provider), "expected %s, got %s\n", pszProvName, provider); @@ -294,6 +320,12 @@ DWORD notNull = 5; DWORD notZeroFlags = 5; + if(!pCryptEnumProviderTypesA) + { + trace("skipping CryptEnumProviderTypes tests\n"); + return; + } + if (!FindProvTypesRegVals(index, &dwProvType, &pszTypeName, &cbTypeName, &dwTypeCount)) { trace("could not find provider types in registry, skipping the test\n"); @@ -301,12 +333,12 @@ } /* check pdwReserved for NULL */ - result = CryptEnumProviderTypes(index, ¬Null, 0, &provType, typeName, &typeNameSize); + result = pCryptEnumProviderTypesA(index, ¬Null, 0, &provType, typeName, &typeNameSize); ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n", ERROR_INVALID_PARAMETER, GetLastError()); /* check dwFlags == zero */ - result = CryptEnumProviderTypes(index, NULL, notZeroFlags, &provType, typeName, &typeNameSize); + result = pCryptEnumProviderTypesA(index, NULL, notZeroFlags, &provType, typeName, &typeNameSize); ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %i, got %ld\n", ERROR_INVALID_PARAMETER, GetLastError()); @@ -319,7 +351,7 @@ /* This test fails under Win2k SP4: result = TRUE, GetLastError() == 0xdeadbeef SetLastError(0xdeadbeef); - result = CryptEnumProviderTypes(index, NULL, 0, &provType, typeName, &typeNameSize); + result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize); ok(!result && GetLastError()==ERROR_MORE_DATA, "expected 0/ERROR_MORE_DATA, got %d/%08lx\n", result, GetLastError()); */ @@ -330,7 +362,7 @@ * after loop ends, count should be dwTypeCount + 1 so subtract 1 * to get actual number of provider types */ typeCount = 0; - while(CryptEnumProviderTypes(typeCount++, NULL, 0, &provType, NULL, &typeNameSize)) + while(pCryptEnumProviderTypesA(typeCount++, NULL, 0, &provType, NULL, &typeNameSize)) ; typeCount--; ok(typeCount==dwTypeCount, "expected %ld, got %ld\n", dwTypeCount, typeCount); @@ -338,19 +370,19 @@ /* loop past the actual number of provider types to get the error * ERROR_NO_MORE_ITEMS */ for (typeCount = 0; typeCount < dwTypeCount + 1; typeCount++) - result = CryptEnumProviderTypes(typeCount, NULL, 0, &provType, NULL, &typeNameSize); + result = pCryptEnumProviderTypesA(typeCount, NULL, 0, &provType, NULL, &typeNameSize); ok(!result && GetLastError()==ERROR_NO_MORE_ITEMS, "expected %i, got %ld\n", ERROR_NO_MORE_ITEMS, GetLastError()); /* check expected versus actual values returned */ - result = CryptEnumProviderTypes(index, NULL, 0, &provType, NULL, &typeNameSize); + result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, NULL, &typeNameSize); ok(result && typeNameSize==cbTypeName, "expected %ld, got %ld\n", cbTypeName, typeNameSize); if (!(typeName = ((LPSTR)LocalAlloc(LMEM_ZEROINIT, typeNameSize)))) return; typeNameSize = 0xdeadbeef; - result = CryptEnumProviderTypes(index, NULL, 0, &provType, typeName, &typeNameSize); + result = pCryptEnumProviderTypesA(index, NULL, 0, &provType, typeName, &typeNameSize); ok(result, "expected TRUE, got %ld\n", result); ok(provType==dwProvType, "expected %ld, got %ld\n", dwProvType, provType); if (pszTypeName) @@ -426,23 +458,29 @@ DWORD result; DWORD notNull = 5; + if(!pCryptGetDefaultProviderA) + { + trace("skipping CryptGetDefaultProvider tests\n"); + return; + } + FindDfltProvRegVals(dwProvType, dwFlags, &pszProvName, &cbProvName); /* check pdwReserved for NULL */ - result = CryptGetDefaultProvider(provType, ¬Null, flags, provName, &provNameSize); + result = pCryptGetDefaultProviderA(provType, ¬Null, flags, provName, &provNameSize); ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n", ERROR_INVALID_PARAMETER, GetLastError()); /* check for invalid flag */ flags = 0xdeadbeef; - result = CryptGetDefaultProvider(provType, NULL, flags, provName, &provNameSize); + result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); ok(!result && GetLastError()==NTE_BAD_FLAGS, "expected %ld, got %ld\n", NTE_BAD_FLAGS, GetLastError()); flags = CRYPT_MACHINE_DEFAULT; /* check for invalid prov type */ provType = 0xdeadbeef; - result = CryptGetDefaultProvider(provType, NULL, flags, provName, &provNameSize); + result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); ok(!result && (GetLastError() == NTE_BAD_PROV_TYPE || GetLastError() == ERROR_INVALID_PARAMETER), "expected NTE_BAD_PROV_TYPE or ERROR_INVALID_PARAMETER, got %ld/%ld\n", @@ -457,21 +495,21 @@ if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize))) return; - result = CryptGetDefaultProvider(provType, NULL, flags, provName, &provNameSize); + result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); ok(!result && GetLastError()==ERROR_MORE_DATA, "expected %i, got %ld\n", ERROR_MORE_DATA, GetLastError()); LocalFree(provName); /* check expected versus actual values returned */ - result = CryptGetDefaultProvider(provType, NULL, flags, NULL, &provNameSize); + result = pCryptGetDefaultProviderA(provType, NULL, flags, NULL, &provNameSize); ok(result && provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize); provNameSize = cbProvName; if (!(provName = LocalAlloc(LMEM_ZEROINIT, provNameSize))) return; - result = CryptGetDefaultProvider(provType, NULL, flags, provName, &provNameSize); + result = pCryptGetDefaultProviderA(provType, NULL, flags, provName, &provNameSize); ok(result && !strcmp(pszProvName, provName), "expected %s, got %s\n", pszProvName, provName); ok(result && provNameSize==cbProvName, "expected %ld, got %ld\n", cbProvName, provNameSize); @@ -487,24 +525,30 @@ LPSTR pszProvName = NULL; DWORD cbProvName; + if(!pCryptGetDefaultProviderA || !pCryptSetProviderExA) + { + trace("skipping CryptSetProviderEx tests\n"); + return; + } + /* check pdwReserved for NULL */ - result = CryptSetProviderEx(MS_DEF_PROV, PROV_RSA_FULL, ¬Null, CRYPT_MACHINE_DEFAULT); + result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, ¬Null, CRYPT_MACHINE_DEFAULT); ok(!result && GetLastError()==ERROR_INVALID_PARAMETER, "expected %i, got %ld\n", ERROR_INVALID_PARAMETER, GetLastError()); /* remove the default provider and then set it to MS_DEF_PROV/PROV_RSA_FULL */ - result = CryptSetProviderEx(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT | CRYPT_DELETE_DEFAULT); + result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT | CRYPT_DELETE_DEFAULT); ok(result, "%ld\n", GetLastError()); - result = CryptSetProviderEx(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT); + result = pCryptSetProviderExA(MS_DEF_PROV, PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT); ok(result, "%ld\n", GetLastError()); /* call CryptGetDefaultProvider to see if they match */ - result = CryptGetDefaultProvider(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, NULL, &cbProvName); + result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, NULL, &cbProvName); if (!(pszProvName = LocalAlloc(LMEM_ZEROINIT, cbProvName))) return; - result = CryptGetDefaultProvider(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, pszProvName, &cbProvName); + result = pCryptGetDefaultProviderA(PROV_RSA_FULL, NULL, CRYPT_MACHINE_DEFAULT, pszProvName, &cbProvName); ok(result && !strcmp(MS_DEF_PROV, pszProvName), "expected %s, got %s\n", MS_DEF_PROV, pszProvName); ok(result && cbProvName==(strlen(MS_DEF_PROV) + 1), "expected %i, got %ld\n", (strlen(MS_DEF_PROV) + 1), cbProvName); @@ -513,6 +557,7 @@ START_TEST(crypt) { + init_function_pointers(); init_environment(); test_acquire_context(); clean_up_environment(); @@ -521,5 +566,4 @@ test_enum_provider_types(); test_get_default_provider(); test_set_provider_ex(); - test_set_provider_ex(); } diff -urN wine-20041201/dlls/advapi32/tests/security.c wine-20050111/dlls/advapi32/tests/security.c --- wine-20041201/dlls/advapi32/tests/security.c 2004-11-04 05:52:17.000000000 +0100 +++ wine-20050111/dlls/advapi32/tests/security.c 2004-12-27 18:46:36.000000000 +0100 @@ -222,13 +222,15 @@ ok(ret, "AllocateLocallyUniqueId failed: %ld\n", GetLastError()); - ok(pAllocateLocallyUniqueId(&luid2), + ret = pAllocateLocallyUniqueId(&luid2); + ok( ret, "AllocateLocallyUniqueId failed: %ld\n", GetLastError()); ok(luid1.LowPart > SE_MAX_WELL_KNOWN_PRIVILEGE || luid1.HighPart != 0, "AllocateLocallyUniqueId returned a well-known LUID\n"); ok(luid1.LowPart != luid2.LowPart || luid1.HighPart != luid2.HighPart, "AllocateLocallyUniqueId returned non-unique LUIDs\n"); - ok(!pAllocateLocallyUniqueId(NULL) && GetLastError() == ERROR_NOACCESS, + ret = pAllocateLocallyUniqueId(NULL); + ok( !ret && GetLastError() == ERROR_NOACCESS, "AllocateLocallyUniqueId(NULL) didn't return ERROR_NOACCESS: %ld\n", GetLastError()); } @@ -253,8 +255,8 @@ /* check with a short buffer */ cchName = 0; luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE; - ok(!pLookupPrivilegeNameA(NULL, &luid, NULL, &cchName) && - GetLastError() == ERROR_INSUFFICIENT_BUFFER, + ret = pLookupPrivilegeNameA(NULL, &luid, NULL, &cchName); + ok( !ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER, "LookupPrivilegeNameA didn't fail with ERROR_INSUFFICIENT_BUFFER: %ld\n", GetLastError()); ok(cchName == strlen("SeCreateTokenPrivilege") + 1, @@ -273,21 +275,22 @@ { luid.LowPart = i; cchName = sizeof(buf); - ok(pLookupPrivilegeNameA(NULL, &luid, buf, &cchName), + ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); + ok( ret, "LookupPrivilegeNameA(0.%ld) failed: %ld\n", i, GetLastError()); } /* check a bogus LUID */ luid.LowPart = 0xdeadbeef; cchName = sizeof(buf); - ok(!pLookupPrivilegeNameA(NULL, &luid, buf, &cchName) && - GetLastError() == ERROR_NO_SUCH_PRIVILEGE, + ret = pLookupPrivilegeNameA(NULL, &luid, buf, &cchName); + ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE, "LookupPrivilegeNameA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n", GetLastError()); /* check on a bogus system */ luid.LowPart = SE_CREATE_TOKEN_PRIVILEGE; cchName = sizeof(buf); - ok(!pLookupPrivilegeNameA("b0gu5.Nam3", &luid, buf, &cchName) && - GetLastError() == RPC_S_SERVER_UNAVAILABLE, + ret = pLookupPrivilegeNameA("b0gu5.Nam3", &luid, buf, &cchName); + ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE, "LookupPrivilegeNameA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n", GetLastError()); } @@ -344,22 +347,23 @@ return; /* check a bogus system name */ - ok(!pLookupPrivilegeValueA("b0gu5.Nam3", "SeCreateTokenPrivilege", &luid) - && GetLastError() == RPC_S_SERVER_UNAVAILABLE, + ret = pLookupPrivilegeValueA("b0gu5.Nam3", "SeCreateTokenPrivilege", &luid); + ok( !ret && GetLastError() == RPC_S_SERVER_UNAVAILABLE, "LookupPrivilegeValueA didn't fail with RPC_S_SERVER_UNAVAILABLE: %ld\n", GetLastError()); /* check a NULL string */ - ok(!pLookupPrivilegeValueA(NULL, 0, &luid) && - GetLastError() == ERROR_NO_SUCH_PRIVILEGE, + ret = pLookupPrivilegeValueA(NULL, 0, &luid); + ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE, "LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n", GetLastError()); /* check a bogus privilege name */ - ok(!pLookupPrivilegeValueA(NULL, "SeBogusPrivilege", &luid) && - GetLastError() == ERROR_NO_SUCH_PRIVILEGE, + ret = pLookupPrivilegeValueA(NULL, "SeBogusPrivilege", &luid); + ok( !ret && GetLastError() == ERROR_NO_SUCH_PRIVILEGE, "LookupPrivilegeValueA didn't fail with ERROR_NO_SUCH_PRIVILEGE: %ld\n", GetLastError()); /* check case insensitive */ - ok(pLookupPrivilegeValueA(NULL, "sEcREATEtOKENpRIVILEGE", &luid), + ret = pLookupPrivilegeValueA(NULL, "sEcREATEtOKENpRIVILEGE", &luid); + ok( ret, "LookupPrivilegeValueA(NULL, sEcREATEtOKENpRIVILEGE, &luid) failed: %ld\n", GetLastError()); for (i = 0; i < sizeof(privs) / sizeof(privs[0]); i++) diff -urN wine-20041201/dlls/advpack/advpack.c wine-20050111/dlls/advpack/advpack.c --- wine-20041201/dlls/advpack/advpack.c 2004-11-01 22:07:53.000000000 +0100 +++ wine-20050111/dlls/advpack/advpack.c 2004-12-15 11:52:57.000000000 +0100 @@ -23,6 +23,7 @@ #include "windef.h" #include "winbase.h" #include "winuser.h" +#include "winreg.h" #include "setupapi.h" #include "advpub.h" #include "wine/debug.h" @@ -30,6 +31,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(advpack); +/*********************************************************************** + * DllMain (ADVPACK.@) + */ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { TRACE("(%p, %ld, %p)\n",hinstDLL, fdwReason, lpvReserved); @@ -41,7 +45,7 @@ } /*********************************************************************** - * LaunchINFSection (SETUPAPI.@) + * LaunchINFSection (ADVPACK.@) */ void WINAPI LaunchINFSection( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show ) { @@ -49,7 +53,7 @@ } /*********************************************************************** - * LaunchINFSectionEx (SETUPAPI.@) + * LaunchINFSectionEx (ADVPACK.@) */ void WINAPI LaunchINFSectionEx( HWND hWnd, HINSTANCE hInst, LPCSTR cmdline, INT show ) { diff -urN wine-20041201/dlls/advpack/advpack.spec wine-20050111/dlls/advpack/advpack.spec --- wine-20041201/dlls/advpack/advpack.spec 2004-11-01 22:07:53.000000000 +0100 +++ wine-20050111/dlls/advpack/advpack.spec 2004-12-15 11:52:57.000000000 +0100 @@ -3,7 +3,7 @@ @ stub CloseINFEngine @ stub DelNode @ stub DelNodeRunDLL32 -@ stub DllMain +@ stdcall DllMain(long long ptr) @ stdcall DoInfInstall(ptr) @ stub ExecuteCab @ stub ExtractFiles diff -urN wine-20041201/dlls/amstream/amstream.c wine-20050111/dlls/amstream/amstream.c --- wine-20041201/dlls/amstream/amstream.c 2004-10-18 23:21:19.000000000 +0200 +++ wine-20050111/dlls/amstream/amstream.c 2005-01-10 13:25:29.000000000 +0100 @@ -36,7 +36,7 @@ typedef struct { IAMMultiMediaStream lpVtbl; - int ref; + ULONG ref; } IAMMultiMediaStreamImpl; static struct IAMMultiMediaStreamVtbl AM_Vtbl; @@ -83,22 +83,21 @@ { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)\n", iface, This); - - This->ref++; - return S_OK; + TRACE("(%p/%p)\n", iface, This); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI IAMMultiMediaStreamImpl_Release(IAMMultiMediaStream* iface) { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; + ULONG ref = InterlockedDecrement(&This->ref); - FIXME("(%p/%p)\n", iface, This); + TRACE("(%p/%p)\n", iface, This); - if (!--This->ref) + if (!ref) HeapFree(GetProcessHeap(), 0, This); - return S_OK; + return ref; } /*** IMultiMediaStream methods ***/ diff -urN wine-20041201/dlls/atl/atl.spec wine-20050111/dlls/atl/atl.spec --- wine-20041201/dlls/atl/atl.spec 2004-09-28 05:14:11.000000000 +0200 +++ wine-20050111/dlls/atl/atl.spec 2004-12-27 18:08:08.000000000 +0100 @@ -10,7 +10,7 @@ 15 stub AtlModuleGetClassObject 16 stdcall AtlModuleInit(ptr long long) 17 stdcall AtlModuleRegisterClassObjects(ptr long long) -18 stub AtlModuleRegisterServer +18 stdcall AtlModuleRegisterServer(ptr long ptr) 19 stub AtlModuleRegisterTypeLib 20 stub AtlModuleRevokeClassObjects 21 stdcall AtlModuleTerm(ptr) diff -urN wine-20041201/dlls/atl/atl_main.c wine-20050111/dlls/atl/atl_main.c --- wine-20041201/dlls/atl/atl_main.c 2004-10-07 05:06:51.000000000 +0200 +++ wine-20050111/dlls/atl/atl_main.c 2004-12-27 18:08:08.000000000 +0100 @@ -179,3 +179,13 @@ return S_OK; } + +/*********************************************************************** + * AtlModuleRegisterServer [ATL.@] + * + */ +HRESULT WINAPI AtlModuleRegisterServer(_ATL_MODULEW* pM, BOOL bRegTypeLib, const CLSID* clsid) +{ + FIXME("%p %d %s\n", pM, bRegTypeLib, debugstr_guid(clsid)); + return S_OK; +} diff -urN wine-20041201/dlls/avifil32/Makefile.in wine-20050111/dlls/avifil32/Makefile.in --- wine-20041201/dlls/avifil32/Makefile.in 2004-08-12 01:59:07.000000000 +0200 +++ wine-20050111/dlls/avifil32/Makefile.in 2005-01-03 21:43:13.000000000 +0100 @@ -3,7 +3,7 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = avifil32.dll -IMPORTS = msacm32 msvfw32 shell32 winmm ole32 user32 advapi32 kernel32 +IMPORTS = msacm32 msvfw32 shell32 winmm ole32 user32 advapi32 kernel32 ntdll EXTRALIBS = -luuid C_SRCS = \ diff -urN wine-20041201/dlls/avifil32/api.c wine-20050111/dlls/avifil32/api.c --- wine-20041201/dlls/avifil32/api.c 2004-11-29 19:00:11.000000000 +0100 +++ wine-20050111/dlls/avifil32/api.c 2004-12-27 17:58:18.000000000 +0100 @@ -251,7 +251,7 @@ } else memcpy(&clsidHandler, lpHandler, sizeof(clsidHandler)); - /* crete instance of handler */ + /* create instance of handler */ hr = SHCoCreateInstance(NULL, &clsidHandler, NULL, &IID_IAVIFile, (LPVOID*)ppfile); if (FAILED(hr) || *ppfile == NULL) @@ -1055,10 +1055,10 @@ /* * 1. iterate over HKEY_CLASSES_ROOT\\AVIFile\\Extensions and collect * extensions and CLSID's - * 2. iterate over collected CLSID's and copy it's description and it's + * 2. iterate over collected CLSID's and copy its description and its * extensions to szFilter if it fits * - * First filter is named "All multimedia files" and it's filter is a + * First filter is named "All multimedia files" and its filter is a * collection of all possible extensions except "*.*". */ if (RegOpenKeyW(HKEY_CLASSES_ROOT, szAVIFileExtensions, &hKey) != S_OK) { @@ -1315,7 +1315,7 @@ if (size > 0) { szFormat[0] = 0; - /* read format to build format descriotion string */ + /* read format to build format description string */ lpFormat = GlobalAllocPtr(GHND, size); if (lpFormat != NULL) { if (SUCCEEDED(AVIStreamReadFormat(SaveOpts.ppavis[SaveOpts.nCurrent],sInfo.dwStart,lpFormat, &size))) { @@ -1478,7 +1478,7 @@ if (nStreams <= 0 || ppavi == NULL || ppOptions == NULL) return AVIERR_BADPARAM; - /* save options for case user press cancel */ + /* save options in case the user presses cancel */ if (ppOptions != NULL && nStreams > 1) { pSavedOptions = GlobalAllocPtr(GHND,nStreams * sizeof(AVICOMPRESSOPTIONS)); if (pSavedOptions == NULL) @@ -1717,7 +1717,7 @@ lFirstVideo = 0; } - /* allocate buffer for formats, data, etc. of an initiale size of 64 kByte */ + /* allocate buffer for formats, data, etc. of an initial size of 64 kBytes*/ lpBuffer = GlobalAllocPtr(GPTR, cbBuffer = 0x00010000); if (lpBuffer == NULL) { hres = AVIERR_MEMORY; @@ -1729,7 +1729,7 @@ dwFileInitialFrames = 0; if (lFirstVideo >= 0) { /* check for correct version of the format - * -- need atleast BITMAPINFOHEADER or newer + * -- need at least BITMAPINFOHEADER or newer */ lSampleInc = 1; lBufferSize = cbBuffer; @@ -1846,7 +1846,7 @@ while (lFirstVideo > lStart[curStream]) { DWORD flags = 0; - /* copy format for case it can change */ + /* copy format in case it can change */ lBufferSize = cbBuffer; hres = AVIStreamReadFormat(pInStreams[curStream], lStart[curStream], lpBuffer, &lBufferSize); @@ -1910,7 +1910,7 @@ while (sInfo.dwStart < sInfo.dwLength) { LONG lSamples = cbBuffer / sInfo.dwSampleSize; - /* copy format for case it can change */ + /* copy format in case it can change */ lBufferSize = cbBuffer; hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart, lpBuffer, &lBufferSize); @@ -1923,7 +1923,7 @@ if (lSamples != (LONG)(sInfo.dwLength - sInfo.dwStart)) lSamples = sInfo.dwLength - sInfo.dwStart; - /* now try to read until we got it, or error occures */ + /* now try to read until we get it, or an error occurs */ do { lReadBytes = cbBuffer; lReadSamples = 0; @@ -1960,7 +1960,7 @@ for (; sInfo.dwStart < sInfo.dwLength; sInfo.dwStart++) { DWORD flags = 0; - /* copy format for case it can change */ + /* copy format in case it can change */ lBufferSize = cbBuffer; hres = AVIStreamReadFormat(pInStreams[curStream], sInfo.dwStart, lpBuffer, &lBufferSize); @@ -2290,6 +2290,20 @@ } /*********************************************************************** + * AVIMakeStreamFromClipboard (AVIFIL32.@) + */ +HRESULT WINAPI AVIMakeStreamFromClipboard(UINT cfFormat, HANDLE hGlobal, + PAVISTREAM * ppstream) +{ + FIXME("(0x%08x,%p,%p), stub!\n", cfFormat, hGlobal, ppstream); + + if (ppstream == NULL) + return AVIERR_BADHANDLE; + + return AVIERR_UNSUPPORTED; +} + +/*********************************************************************** * AVIPutFileOnClipboard (AVIFIL32.@) */ HRESULT WINAPI AVIPutFileOnClipboard(PAVIFILE pfile) @@ -2301,3 +2315,21 @@ return AVIERR_UNSUPPORTED; } + +HRESULT WINAPI AVISaveA(LPCSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK lpfnCallback, + int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions, ...) +{ + FIXME("(%s,%p,%p,0x%08x,%p,%p), stub!\n", debugstr_a(szFile), pclsidHandler, lpfnCallback, + nStreams, pavi, lpOptions); + + return AVIERR_UNSUPPORTED; +} + +HRESULT WINAPI AVISaveW(LPCWSTR szFile, CLSID * pclsidHandler, AVISAVECALLBACK lpfnCallback, + int nStreams, PAVISTREAM pavi, LPAVICOMPRESSOPTIONS lpOptions, ...) +{ + FIXME("(%s,%p,%p,0x%08x,%p,%p), stub!\n", debugstr_w(szFile), pclsidHandler, lpfnCallback, + nStreams, pavi, lpOptions); + + return AVIERR_UNSUPPORTED; +} diff -urN wine-20041201/dlls/avifil32/avifil32.spec wine-20050111/dlls/avifil32/avifil32.spec --- wine-20041201/dlls/avifil32/avifil32.spec 2004-11-19 18:58:18.000000000 +0100 +++ wine-20050111/dlls/avifil32/avifil32.spec 2005-01-03 21:43:13.000000000 +0100 @@ -1,9 +1,9 @@ -@ stub AVIBuildFilter +@ stdcall AVIBuildFilter(str long long) AVIBuildFilterA @ stdcall AVIBuildFilterA(str long long) @ stdcall AVIBuildFilterW(wstr long long) @ stdcall AVIClearClipboard() @ stdcall AVIFileAddRef(ptr) -@ stub AVIFileCreateStream +@ stdcall AVIFileCreateStream(ptr ptr ptr) AVIFileCreateStreamA @ stdcall AVIFileCreateStreamA(ptr ptr ptr) @ stdcall AVIFileCreateStreamW(ptr ptr ptr) @ stdcall AVIFileEndRecord(ptr) @@ -13,7 +13,7 @@ @ stdcall AVIFileInfoA(ptr ptr long) @ stdcall AVIFileInfoW(ptr ptr long) @ stdcall AVIFileInit() -@ stub AVIFileOpen +@ stdcall AVIFileOpen(ptr str long ptr) AVIFileOpenA @ stdcall AVIFileOpenA(ptr str long ptr) @ stdcall AVIFileOpenW(ptr wstr long ptr) @ stdcall AVIFileReadData(ptr long ptr ptr) @@ -22,16 +22,16 @@ @ stdcall AVIGetFromClipboard(ptr) @ stdcall AVIMakeCompressedStream(ptr ptr ptr ptr) @ stdcall AVIMakeFileFromStreams(ptr long ptr) -@ stub AVIMakeStreamFromClipboard +@ stdcall AVIMakeStreamFromClipboard(long long ptr) @ stdcall AVIPutFileOnClipboard(ptr) -@ stub AVISave -@ stub AVISaveA +@ varargs AVISave(str ptr ptr long ptr ptr) AVISaveA +@ varargs AVISaveA(str ptr ptr long ptr ptr) @ stdcall AVISaveOptions(long long long ptr ptr) @ stdcall AVISaveOptionsFree(long ptr) -@ stub AVISaveV +@ stdcall AVISaveV(str ptr ptr long ptr ptr) AVISaveVA @ stdcall AVISaveVA(str ptr ptr long ptr ptr) @ stdcall AVISaveVW(wstr ptr ptr long ptr ptr) -@ stub AVISaveW +@ varargs AVISaveW(wstr ptr ptr long ptr ptr) @ stdcall AVIStreamAddRef(ptr) @ stdcall AVIStreamBeginStreaming(ptr long long long) @ stdcall AVIStreamCreate(ptr long long ptr) @@ -57,7 +57,7 @@ @ stdcall AVIStreamTimeToSample(ptr long) @ stdcall AVIStreamWrite(ptr long long ptr long long ptr ptr) @ stdcall AVIStreamWriteData(ptr long ptr long) -@ stub CLSID_AVISimpleUnMarshal +@ extern CLSID_AVISimpleUnMarshal @ stdcall CreateEditableStream(ptr ptr) @ stdcall -private DllCanUnloadNow() AVIFILE_DllCanUnloadNow @ stdcall -private DllGetClassObject(ptr ptr ptr) AVIFILE_DllGetClassObject @@ -67,10 +67,10 @@ @ stdcall EditStreamCopy(ptr ptr ptr ptr) @ stdcall EditStreamCut(ptr ptr ptr ptr) @ stdcall EditStreamPaste(ptr ptr ptr ptr long long) -@ stub EditStreamSetInfo +@ stdcall EditStreamSetInfo(ptr ptr long) EditStreamSetInfoA @ stdcall EditStreamSetInfoA(ptr ptr long) @ stdcall EditStreamSetInfoW(ptr ptr long) -@ stub EditStreamSetName +@ stdcall EditStreamSetName(ptr str) EditStreamSetNameA @ stdcall EditStreamSetNameA(ptr str) @ stdcall EditStreamSetNameW(ptr wstr) @ extern IID_IAVIEditStream diff -urN wine-20041201/dlls/avifil32/avifile.c wine-20050111/dlls/avifil32/avifile.c --- wine-20041201/dlls/avifil32/avifile.c 2004-11-30 18:33:27.000000000 +0100 +++ wine-20050111/dlls/avifil32/avifile.c 2004-12-09 15:08:00.000000000 +0100 @@ -1999,7 +1999,7 @@ if (nStream > This->fInfo.dwStreams) return AVIERR_BADFORMAT; - if (*bAbsolute == TRUE && lp->dwChunkOffset < This->dwMoviChunkPos) + if (*bAbsolute && lp->dwChunkOffset < This->dwMoviChunkPos) *bAbsolute = FALSE; if (*bAbsolute) diff -urN wine-20041201/dlls/avifil32/wavfile.c wine-20050111/dlls/avifil32/wavfile.c --- wine-20041201/dlls/avifil32/wavfile.c 2004-10-05 20:10:21.000000000 +0200 +++ wine-20050111/dlls/avifil32/wavfile.c 2004-12-20 20:27:07.000000000 +0100 @@ -475,7 +475,7 @@ if (lParam < 0) return AVIERR_BADPARAM; - /* Have we our audio stream? */ + /* Do we have our audio stream? */ if (lParam != 0 || This->fInfo.dwStreams == 0 || (fccType != 0 && fccType != streamtypeAUDIO)) return AVIERR_NODATA; @@ -886,7 +886,7 @@ /* request only the sizes? */ if (buffer == NULL || buffersize <= 0) { - /* then I need atleast one parameter for it */ + /* then I need at least one parameter for it */ if (bytesread == NULL && samplesread == NULL) return AVIERR_BADPARAM; @@ -902,7 +902,7 @@ if (samples == 0) return AVIERR_OK; - /* Can I atleast read one sample? */ + /* Can I read at least one sample? */ if ((DWORD)buffersize < This->sInfo.dwSampleSize) return AVIERR_BUFFERTOOSMALL; @@ -944,7 +944,7 @@ if (buffer == NULL && (buffersize > 0 || samples > 0)) return AVIERR_BADPARAM; - /* Have we write permission? */ + /* Do we have write permission? */ if ((This->uMode & MMIO_RWMODE) == 0) return AVIERR_READONLY; @@ -956,7 +956,7 @@ if (buffersize & ~(This->sInfo.dwSampleSize - 1)) return AVIERR_BADSIZE; - /* have we anything to write? */ + /* do we have anything to write? */ if (buffer != NULL && buffersize > 0) { This->fDirty = 1; @@ -1296,7 +1296,7 @@ dwFactLength /= wfx.nBlockAlign; acmStreamClose(has, 0); - /* crete the fact chunk */ + /* create the fact chunk */ ck.ckid = ckidWAVEFACT; ck.cksize = sizeof(dwFactLength); @@ -1314,7 +1314,7 @@ ERR(": fact chunk is needed for non-pcm files -- currently no codec found, so skipped!\n"); } - /* if here was extra stuff, we need to fill it with JUNK */ + /* if there was extra stuff, we need to fill it with JUNK */ if (mmioSeek(This->hmmio, 0, SEEK_CUR) + 2 * sizeof(DWORD) < This->ckData.dwDataOffset) { ck.ckid = ckidAVIPADDING; ck.cksize = 0; @@ -1328,7 +1328,7 @@ return AVIERR_FILEWRITE; } - /* crete the data chunk */ + /* create the data chunk */ ck.ckid = ckidWAVEDATA; ck.cksize = This->ckData.cksize; if (mmioCreateChunk(This->hmmio, &ck, 0) != S_OK) diff -urN wine-20041201/dlls/cabinet/cabinet_main.c wine-20050111/dlls/cabinet/cabinet_main.c --- wine-20041201/dlls/cabinet/cabinet_main.c 2004-09-03 01:00:54.000000000 +0200 +++ wine-20050111/dlls/cabinet/cabinet_main.c 2004-12-14 12:38:50.000000000 +0100 @@ -121,8 +121,10 @@ TRACE("extracting to dir: %s\n", debugstr_a(dir)); /* FIXME: what to do on failure? */ - if (!process_cabinet(what, dir, FALSE, FALSE, dest)) + if (!process_cabinet(what, dir, FALSE, FALSE, dest)) { + LocalFree(dir); return E_OUTOFMEMORY; + } LocalFree(dir); diff -urN wine-20041201/dlls/cabinet/fdi.c wine-20050111/dlls/cabinet/fdi.c --- wine-20041201/dlls/cabinet/fdi.c 2004-09-03 01:00:54.000000000 +0200 +++ wine-20050111/dlls/cabinet/fdi.c 2004-12-06 17:09:37.000000000 +0100 @@ -2696,13 +2696,19 @@ } /* free decompression temps */ - if (LZX(window)) { - PFDI_FREE(hfdi, LZX(window)); - LZX(window) = NULL; - } - if (QTM(window)) { - PFDI_FREE(hfdi, QTM(window)); - QTM(window) = NULL; + switch (fol->comp_type & cffoldCOMPTYPE_MASK) { + case cffoldCOMPTYPE_LZX: + if (LZX(window)) { + PFDI_FREE(hfdi, LZX(window)); + LZX(window) = NULL; + } + break; + case cffoldCOMPTYPE_QUANTUM: + if (QTM(window)) { + PFDI_FREE(hfdi, QTM(window)); + QTM(window) = NULL; + } + break; } while (decomp_state) { @@ -2738,13 +2744,19 @@ bail_and_fail: /* here we free ram before error returns */ /* free decompression temps */ - if (LZX(window)) { - PFDI_FREE(hfdi, LZX(window)); - LZX(window) = NULL; - } - if (QTM(window)) { - PFDI_FREE(hfdi, QTM(window)); - QTM(window) = NULL; + switch (fol->comp_type & cffoldCOMPTYPE_MASK) { + case cffoldCOMPTYPE_LZX: + if (LZX(window)) { + PFDI_FREE(hfdi, LZX(window)); + LZX(window) = NULL; + } + break; + case cffoldCOMPTYPE_QUANTUM: + if (QTM(window)) { + PFDI_FREE(hfdi, QTM(window)); + QTM(window) = NULL; + } + break; } while (decomp_state) { diff -urN wine-20041201/dlls/capi2032/Makefile.in wine-20050111/dlls/capi2032/Makefile.in --- wine-20041201/dlls/capi2032/Makefile.in 2003-11-06 01:26:43.000000000 +0100 +++ wine-20050111/dlls/capi2032/Makefile.in 2005-01-07 16:33:02.000000000 +0100 @@ -4,7 +4,6 @@ VPATH = @srcdir@ MODULE = capi2032.dll IMPORTS = kernel32 -EXTRALIBS = @CAPI4LINUXLIBS@ C_SRCS = cap20wxx.c diff -urN wine-20041201/dlls/capi2032/cap20wxx.c wine-20050111/dlls/capi2032/cap20wxx.c --- wine-20041201/dlls/capi2032/cap20wxx.c 2004-08-18 00:08:43.000000000 +0200 +++ wine-20050111/dlls/capi2032/cap20wxx.c 2005-01-07 16:33:02.000000000 +0100 @@ -22,6 +22,7 @@ #define __NO_CAPIUTILS__ #include "config.h" +#include "wine/port.h" #include #include @@ -36,18 +37,67 @@ #ifdef HAVE_CAPI20_H # include #endif +#include "wine/library.h" #include "wine/debug.h" #include "cap20wxx.h" WINE_DEFAULT_DEBUG_CHANNEL(capi); +#ifdef HAVE_CAPI4LINUX + +#ifndef SONAME_LIBCAPI20 +#define SONAME_LIBCAPI20 "libcapi20.so" +#endif + +static unsigned (*pcapi20_register)(unsigned, unsigned, unsigned, unsigned *) = NULL; +static unsigned (*pcapi20_release)(unsigned) = NULL; +static unsigned (*pcapi20_put_message)(unsigned, unsigned char *) = NULL; +static unsigned (*pcapi20_get_message)(unsigned, unsigned char **) = NULL; +static unsigned (*pcapi20_waitformessage)(unsigned, struct timeval *) = NULL; +static unsigned (*pcapi20_isinstalled)() = NULL; +static unsigned (*pcapi20_get_profile)(unsigned, unsigned char *) = NULL; +static unsigned char *(*pcapi20_get_manufacturer)(unsigned, unsigned char *) = NULL; +static unsigned char *(*pcapi20_get_serial_number)(unsigned, unsigned char *) = NULL; +static unsigned char *(*pcapi20_get_version)(unsigned, unsigned char *) = NULL; + +static void load_functions() { + void *capi_handle = NULL; + + if (pcapi20_register) /* loaded already */ + return; + capi_handle = wine_dlopen(SONAME_LIBCAPI20, RTLD_NOW, NULL, 0); + if(!capi_handle) { + FIXME("Wine cannot find the library %s, capi2032.dll not working.\n", SONAME_LIBCAPI20); + return; + } +#define LOAD_FUNCPTR(f) if((p##f = wine_dlsym(capi_handle, #f, NULL, 0)) == NULL){WARN("Can't find symbol %s\n", #f); return;} +LOAD_FUNCPTR(capi20_register); +LOAD_FUNCPTR(capi20_release); +LOAD_FUNCPTR(capi20_put_message); +LOAD_FUNCPTR(capi20_get_message); +LOAD_FUNCPTR(capi20_waitformessage); +LOAD_FUNCPTR(capi20_isinstalled); +LOAD_FUNCPTR(capi20_get_profile); +LOAD_FUNCPTR(capi20_get_manufacturer); +LOAD_FUNCPTR(capi20_get_serial_number); +LOAD_FUNCPTR(capi20_get_version); +#undef LOAD_FUNCPTR +} + +#endif + /*===========================================================================*\ \*===========================================================================*/ DWORD WINAPI wrapCAPI_REGISTER (DWORD MessageBufferSize, DWORD maxLogicalConnection, DWORD maxBDataBlocks, DWORD maxBDataLen, DWORD *pApplID) { #ifdef HAVE_CAPI4LINUX unsigned aid = 0; - DWORD fret = capi20_register (maxLogicalConnection, maxBDataBlocks, maxBDataLen, &aid); + DWORD fret; + + load_functions(); + if (!pcapi20_register) + return 0x1009; + fret = pcapi20_register (maxLogicalConnection, maxBDataBlocks, maxBDataLen, &aid); *pApplID = aid; TRACE ( "(%lx) -> %lx\n", *pApplID, fret); return fret; @@ -61,7 +111,12 @@ \*---------------------------------------------------------------------------*/ DWORD WINAPI wrapCAPI_RELEASE (DWORD ApplID) { #ifdef HAVE_CAPI4LINUX - DWORD fret = capi20_release (ApplID); + DWORD fret; + + load_functions(); + if (!pcapi20_release) + return 0x1109; + fret = pcapi20_release (ApplID); TRACE ("(%lx) -> %lx\n", ApplID, fret); return fret; #else @@ -73,7 +128,12 @@ \*---------------------------------------------------------------------------*/ DWORD WINAPI wrapCAPI_PUT_MESSAGE (DWORD ApplID, PVOID pCAPIMessage) { #ifdef HAVE_CAPI4LINUX - DWORD fret = capi20_put_message (ApplID, pCAPIMessage); + DWORD fret; + + load_functions(); + if (!pcapi20_put_message) + return 0x1109; + fret = pcapi20_put_message (ApplID, pCAPIMessage); TRACE ("(%lx) -> %lx\n", ApplID, fret); return fret; #else @@ -85,7 +145,12 @@ \*---------------------------------------------------------------------------*/ DWORD WINAPI wrapCAPI_GET_MESSAGE (DWORD ApplID, PVOID *ppCAPIMessage) { #ifdef HAVE_CAPI4LINUX - DWORD fret = capi20_get_message (ApplID, (unsigned char **)ppCAPIMessage); + DWORD fret; + + load_functions(); + if (!pcapi20_get_message) + return 0x1109; + fret = pcapi20_get_message (ApplID, (unsigned char **)ppCAPIMessage); TRACE ("(%lx) -> %lx\n", ApplID, fret); return fret; #else @@ -98,7 +163,12 @@ DWORD WINAPI wrapCAPI_WAIT_FOR_SIGNAL (DWORD ApplID) { #ifdef HAVE_CAPI4LINUX TRACE ("(%lx)\n", ApplID); - return capi20_waitformessage (ApplID, NULL); + + load_functions(); + if (!pcapi20_waitformessage) + return 0x1109; + + return pcapi20_waitformessage (ApplID, NULL); #else return 0x1109; #endif @@ -108,7 +178,13 @@ \*---------------------------------------------------------------------------*/ DWORD WINAPI wrapCAPI_GET_MANUFACTURER (char *SzBuffer) { #ifdef HAVE_CAPI4LINUX - DWORD fret = (capi20_get_manufacturer (0, SzBuffer) != 0) ? 0 : 0x1108; + DWORD fret; + + load_functions(); + if (!pcapi20_get_manufacturer) + return 0x1109; + + fret = (pcapi20_get_manufacturer (0, SzBuffer) != 0) ? 0 : 0x1108; if (!strncmp (SzBuffer, "AVM", 3)) { strcpy (SzBuffer, "AVM-GmbH"); } @@ -124,7 +200,12 @@ DWORD WINAPI wrapCAPI_GET_VERSION (DWORD *pCAPIMajor, DWORD *pCAPIMinor, DWORD *pManufacturerMajor, DWORD *pManufacturerMinor) { #ifdef HAVE_CAPI4LINUX unsigned char version[4 * sizeof (unsigned)]; - DWORD fret = (capi20_get_version (0, version) != 0) ? 0 : 0x1108; + DWORD fret; + + load_functions(); + if (!pcapi20_get_version) + return 0x1109; + fret = (pcapi20_get_version (0, version) != 0) ? 0 : 0x1108; *pCAPIMajor = *(unsigned *)(version + 0 * sizeof (unsigned)); *pCAPIMinor = *(unsigned *)(version + 1 * sizeof (unsigned)); *pManufacturerMajor = *(unsigned *)(version + 2 * sizeof (unsigned)); @@ -141,7 +222,12 @@ \*---------------------------------------------------------------------------*/ DWORD WINAPI wrapCAPI_GET_SERIAL_NUMBER (char *SzBuffer) { #ifdef HAVE_CAPI4LINUX - DWORD fret = (capi20_get_serial_number (0, SzBuffer) != 0) ? 0 : 0x1108; + DWORD fret; + + load_functions(); + if (!pcapi20_get_serial_number) + return 0x1109; + fret = (pcapi20_get_serial_number (0, SzBuffer) != 0) ? 0 : 0x1108; TRACE ("(%s) -> %lx\n", SzBuffer, fret); return fret; #else @@ -153,7 +239,13 @@ \*---------------------------------------------------------------------------*/ DWORD WINAPI wrapCAPI_GET_PROFILE (PVOID SzBuffer, DWORD CtlrNr) { #ifdef HAVE_CAPI4LINUX - DWORD fret = capi20_get_profile (CtlrNr, SzBuffer); + DWORD fret; + + load_functions(); + if (!pcapi20_get_profile) + return 0x1109; + + fret = pcapi20_get_profile (CtlrNr, SzBuffer); TRACE ("(%lx,%x) -> %lx\n", CtlrNr, *(unsigned short *)SzBuffer, fret); return fret; #else @@ -165,7 +257,12 @@ \*---------------------------------------------------------------------------*/ DWORD WINAPI wrapCAPI_INSTALLED (void) { #ifdef HAVE_CAPI4LINUX - DWORD fret = capi20_isinstalled(); + DWORD fret; + + load_functions(); + if (!pcapi20_isinstalled) + return 0x1109; + fret = pcapi20_isinstalled(); TRACE ("() -> %lx\n", fret); return fret; #else diff -urN wine-20041201/dlls/comcat/factory.c wine-20050111/dlls/comcat/factory.c --- wine-20041201/dlls/comcat/factory.c 2004-09-06 22:34:30.000000000 +0200 +++ wine-20050111/dlls/comcat/factory.c 2005-01-10 13:25:29.000000000 +0100 @@ -56,14 +56,17 @@ static ULONG WINAPI COMCAT_IClassFactory_AddRef(LPCLASSFACTORY iface) { ClassFactoryImpl *This = (ClassFactoryImpl *)iface; + ULONG ref; + TRACE("\n"); if (This == NULL) return E_POINTER; - if (InterlockedIncrement(&This->ref) == 1) { + ref = InterlockedIncrement(&This->ref); + if (ref == 1) { InterlockedIncrement(&dll_ref); } - return This->ref; + return ref; } /********************************************************************** @@ -72,14 +75,17 @@ static ULONG WINAPI COMCAT_IClassFactory_Release(LPCLASSFACTORY iface) { ClassFactoryImpl *This = (ClassFactoryImpl *)iface; + ULONG ref; + TRACE("\n"); if (This == NULL) return E_POINTER; - if (InterlockedDecrement(&This->ref) == 0) { + ref = InterlockedDecrement(&This->ref); + if (ref == 0) { InterlockedDecrement(&dll_ref); } - return This->ref; + return ref; } /********************************************************************** diff -urN wine-20041201/dlls/comcat/information.c wine-20050111/dlls/comcat/information.c --- wine-20041201/dlls/comcat/information.c 2004-09-06 22:34:30.000000000 +0200 +++ wine-20050111/dlls/comcat/information.c 2005-01-10 13:25:29.000000000 +0100 @@ -307,11 +307,12 @@ static ULONG WINAPI COMCAT_IEnumCATEGORYINFO_AddRef(LPENUMCATEGORYINFO iface) { IEnumCATEGORYINFOImpl *This = (IEnumCATEGORYINFOImpl *)iface; + TRACE("\n"); if (This == NULL) return E_POINTER; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_QueryInterface( @@ -338,16 +339,19 @@ static ULONG WINAPI COMCAT_IEnumCATEGORYINFO_Release(LPENUMCATEGORYINFO iface) { IEnumCATEGORYINFOImpl *This = (IEnumCATEGORYINFOImpl *)iface; + ULONG ref; + TRACE("\n"); if (This == NULL) return E_POINTER; - if (--(This->ref) == 0) { + ref = InterlockedDecrement(&This->ref); + if (ref == 0) { if (This->key) RegCloseKey(This->key); HeapFree(GetProcessHeap(), 0, This); return 0; } - return This->ref; + return ref; } static HRESULT WINAPI COMCAT_IEnumCATEGORYINFO_Next( @@ -613,7 +617,7 @@ if (This == NULL) return E_POINTER; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_QueryInterface( @@ -640,17 +644,20 @@ static ULONG WINAPI COMCAT_CLSID_IEnumGUID_Release(LPENUMGUID iface) { CLSID_IEnumGUIDImpl *This = (CLSID_IEnumGUIDImpl *)iface; + ULONG ref; + TRACE("\n"); if (This == NULL) return E_POINTER; - if (--(This->ref) == 0) { + ref = InterlockedDecrement(&This->ref); + if (ref == 0) { if (This->key) RegCloseKey(This->key); HeapFree(GetProcessHeap(), 0, (LPVOID)This->categories); HeapFree(GetProcessHeap(), 0, This); return 0; } - return This->ref; + return ref; } static HRESULT WINAPI COMCAT_CLSID_IEnumGUID_Next( @@ -805,7 +812,7 @@ if (This == NULL) return E_POINTER; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static HRESULT WINAPI COMCAT_CATID_IEnumGUID_QueryInterface( @@ -832,16 +839,19 @@ static ULONG WINAPI COMCAT_CATID_IEnumGUID_Release(LPENUMGUID iface) { CATID_IEnumGUIDImpl *This = (CATID_IEnumGUIDImpl *)iface; + ULONG ref; + TRACE("\n"); if (This == NULL) return E_POINTER; - if (--(This->ref) == 0) { + ref = InterlockedDecrement(&This->ref); + if (ref == 0) { if (This->key) RegCloseKey(This->key); HeapFree(GetProcessHeap(), 0, This); return 0; } - return This->ref; + return ref; } static HRESULT WINAPI COMCAT_CATID_IEnumGUID_Next( diff -urN wine-20041201/dlls/comcat/manager.c wine-20050111/dlls/comcat/manager.c --- wine-20041201/dlls/comcat/manager.c 2004-08-23 21:40:04.000000000 +0200 +++ wine-20050111/dlls/comcat/manager.c 2005-01-10 13:25:29.000000000 +0100 @@ -66,14 +66,17 @@ static ULONG WINAPI COMCAT_IUnknown_AddRef(LPUNKNOWN iface) { ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface); + ULONG ref; + TRACE("\n"); if (This == NULL) return E_POINTER; - if (InterlockedIncrement(&This->ref) == 1) { + ref = InterlockedIncrement(&This->ref); + if (ref == 1) { InterlockedIncrement(&dll_ref); } - return This->ref; + return ref; } /********************************************************************** @@ -82,14 +85,17 @@ static ULONG WINAPI COMCAT_IUnknown_Release(LPUNKNOWN iface) { ICOM_THIS_MULTI(ComCatMgrImpl, unkVtbl, iface); + ULONG ref; + TRACE("\n"); if (This == NULL) return E_POINTER; - if (InterlockedDecrement(&This->ref) == 0) { + ref = InterlockedDecrement(&This->ref); + if (ref == 0) { InterlockedDecrement(&dll_ref); } - return This->ref; + return ref; } /********************************************************************** diff -urN wine-20041201/dlls/comctl32/animate.c wine-20050111/dlls/comctl32/animate.c --- wine-20041201/dlls/comctl32/animate.c 2004-12-01 16:27:18.000000000 +0100 +++ wine-20050111/dlls/comctl32/animate.c 2004-12-23 19:24:50.000000000 +0100 @@ -187,32 +187,20 @@ FreeResource(infoPtr->hRes); infoPtr->hRes = 0; } - if (infoPtr->lpIndex) { - HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex); - infoPtr->lpIndex = NULL; - } + HeapFree(GetProcessHeap(), 0, infoPtr->lpIndex); + infoPtr->lpIndex = NULL; if (infoPtr->hic) { fnIC.fnICClose(infoPtr->hic); infoPtr->hic = 0; } - if (infoPtr->inbih) { - HeapFree(GetProcessHeap(), 0, infoPtr->inbih); - infoPtr->inbih = NULL; - } - if (infoPtr->outbih) { - HeapFree(GetProcessHeap(), 0, infoPtr->outbih); - infoPtr->outbih = NULL; - } - if( infoPtr->indata ) - { + HeapFree(GetProcessHeap(), 0, infoPtr->inbih); + infoPtr->inbih = NULL; + HeapFree(GetProcessHeap(), 0, infoPtr->outbih); + infoPtr->outbih = NULL; HeapFree(GetProcessHeap(), 0, infoPtr->indata); - infoPtr->indata = NULL; - } - if( infoPtr->outdata ) - { + infoPtr->indata = NULL; HeapFree(GetProcessHeap(), 0, infoPtr->outdata); - infoPtr->outdata = NULL; - } + infoPtr->outdata = NULL; if( infoPtr->hbmPrevFrame ) { DeleteObject(infoPtr->hbmPrevFrame); diff -urN wine-20041201/dlls/comctl32/comboex.c wine-20050111/dlls/comctl32/comboex.c --- wine-20041201/dlls/comctl32/comboex.c 2004-11-24 19:28:31.000000000 +0100 +++ wine-20050111/dlls/comctl32/comboex.c 2005-01-09 17:42:54.000000000 +0100 @@ -1840,7 +1840,6 @@ return CallWindowProcW (infoPtr->prevEditWndProc, hwnd, uMsg, wParam, lParam); } - return 0; } @@ -2243,7 +2242,6 @@ ERR("unknown msg %04x wp=%08x lp=%08lx\n",uMsg,wParam,lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/comctl32/comctl32undoc.c wine-20050111/dlls/comctl32/comctl32undoc.c --- wine-20041201/dlls/comctl32/comctl32undoc.c 2004-10-07 05:06:51.000000000 +0200 +++ wine-20050111/dlls/comctl32/comctl32undoc.c 2004-12-20 20:27:07.000000000 +0100 @@ -106,9 +106,8 @@ * NOTES * No more information available yet! */ - -HRESULT WINAPI -DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lParam) +HRESULT WINAPI DPA_LoadStream (HDPA *phDpa, DPALOADPROC loadProc, + IStream *pStream, LPARAM lParam) { HRESULT errCode; LARGE_INTEGER position; @@ -205,9 +204,8 @@ * NOTES * No more information available yet! */ - -HRESULT WINAPI -DPA_SaveStream (const HDPA hDpa, DPALOADPROC loadProc, IStream *pStream, LPARAM lParam) +HRESULT WINAPI DPA_SaveStream (const HDPA hDpa, DPALOADPROC loadProc, + IStream *pStream, LPARAM lParam) { FIXME ("hDpa=%p loadProc=%p pStream=%p lParam=%lx\n", @@ -220,6 +218,8 @@ /************************************************************************** * DPA_Merge [COMCTL32.11] * + * Merge two dynamic pointers arrays. + * * PARAMS * hdpa1 [I] handle to a dynamic pointer array * hdpa2 [I] handle to a dynamic pointer array @@ -235,10 +235,9 @@ * NOTES * No more information available yet! */ - -BOOL WINAPI -DPA_Merge (const HDPA hdpa1, const HDPA hdpa2, DWORD dwFlags, - PFNDPACOMPARE pfnCompare, PFNDPAMERGE pfnMerge, LPARAM lParam) +BOOL WINAPI DPA_Merge (const HDPA hdpa1, const HDPA hdpa2, DWORD dwFlags, + PFNDPACOMPARE pfnCompare, PFNDPAMERGE pfnMerge, + LPARAM lParam) { INT nCount; LPVOID *pWork1, *pWork2; @@ -373,7 +372,6 @@ * Success: pointer to allocated memory block * Failure: NULL */ - LPVOID WINAPI Alloc (DWORD dwSize) { return LocalAlloc( LMEM_ZEROINIT, dwSize ); @@ -398,7 +396,6 @@ * If lpSrc is a NULL-pointer, then ReAlloc allocates a memory * block like Alloc. */ - LPVOID WINAPI ReAlloc (LPVOID lpSrc, DWORD dwSize) { if (lpSrc) @@ -420,7 +417,6 @@ * Success: TRUE * Failure: FALSE */ - BOOL WINAPI Free (LPVOID lpMem) { return !LocalFree( lpMem ); @@ -440,7 +436,6 @@ * Success: size of the specified memory block * Failure: 0 */ - DWORD WINAPI GetSize (LPVOID lpMem) { return LocalSize( lpMem ); @@ -448,33 +443,90 @@ /************************************************************************** - * The MRU-API is a set of functions to manipulate MRU(Most Recently Used) - * lists. + * MRU-Functions {COMCTL32} * - * Stored in the reg. as a set of values under a single key. Each item in the - * list has a value name that is a single char. 'a' - 'z', '{', '|' or '}'. - * The order of the list is stored with value name 'MRUList' which is a string - * containing the value names (i.e. 'a', 'b', etc.) in the relevant order. + * NOTES + * The MRU-Api is a set of functions to manipulate lists of M.R.U. (Most Recently + * Used) items. It is an undocumented Api that is used (at least) by the shell + * and explorer to implement their recent documents feature. + * + * Since these functions are undocumented, they are unsupported by MS and + * may change at any time. + * + * Internally, the list is implemented as a last in, last out list of items + * persisted into the system registry under a caller chosen key. Each list + * item is given a one character identifier in the Ascii range from 'a' to + * '}'. A list of the identifiers in order from newest to oldest is stored + * under the same key in a value named "MRUList". + * + * Items are re-ordered by changing the order of the values in the MRUList + * value. When a new item is added, it becomes the new value of the oldest + * identifier, and that identifier is moved to the front of the MRUList value. + * + * Wine stores MRU-lists in the same registry format as Windows, so when + * switching between the builtin and native comctl32.dll no problems or + * incompatibilities should occur. + * + * The following undocumented structure is used to create an MRU-list: + *|typedef INT (CALLBACK *MRUStringCmpFn)(LPCTSTR lhs, LPCTSTR rhs); + *|typedef INT (CALLBACK *MRUBinaryCmpFn)(LPCVOID lhs, LPCVOID rhs, DWORD length); + *| + *|typedef struct tagCREATEMRULIST + *|{ + *| DWORD cbSize; + *| DWORD nMaxItems; + *| DWORD dwFlags; + *| HKEY hKey; + *| LPCTSTR lpszSubKey; + *| PROC lpfnCompare; + *|} CREATEMRULIST, *LPCREATEMRULIST; + * + * MEMBERS + * cbSize [I] The size of the CREATEMRULIST structure. This must be set + * to sizeof(CREATEMRULIST) by the caller. + * nMaxItems [I] The maximum number of items allowed in the list. Because + * of the limited number of identifiers, this should be set to + * a value from 1 to 30 by the caller. + * dwFlags [I] If bit 0 is set, the list will be used to store binary + * data, otherwise it is assumed to store strings. If bit 1 + * is set, every change made to the list will be reflected in + * the registry immediately, otherwise changes will only be + * written when the list is closed. + * hKey [I] The registry key that the list should be written under. + * This must be supplied by the caller. + * lpszSubKey [I] A caller supplied name of a subkey under hKey to write + * the list to. This may not be blank. + * lpfnCompare [I] A caller supplied comparison function, which may be either + * an MRUStringCmpFn if dwFlags does not have bit 0 set, or a + * MRUBinaryCmpFn otherwise. + * + * FUNCTIONS + * - Create an MRU-list with CreateMRUList() or CreateMRUListLazy(). + * - Add items to an MRU-list with AddMRUString() or AddMRUData(). + * - Remove items from an MRU-list with DelMRUString(). + * - Find data in an MRU-list with FindMRUString() or FindMRUData(). + * - Iterate through an MRU-list with EnumMRUList(). + * - Free an MRU-list with FreeMRUList(). */ typedef struct tagCREATEMRULISTA { - DWORD cbSize; /* size of struct */ - DWORD nMaxItems; /* max no. of items in list */ - DWORD dwFlags; /* see below */ - HKEY hKey; /* root reg. key under which list is saved */ - LPCSTR lpszSubKey; /* reg. subkey */ - PROC lpfnCompare; /* item compare proc */ + DWORD cbSize; + DWORD nMaxItems; + DWORD dwFlags; + HKEY hKey; + LPCSTR lpszSubKey; + PROC lpfnCompare; } CREATEMRULISTA, *LPCREATEMRULISTA; typedef struct tagCREATEMRULISTW { - DWORD cbSize; /* size of struct */ - DWORD nMaxItems; /* max no. of items in list */ - DWORD dwFlags; /* see below */ - HKEY hKey; /* root reg. key under which list is saved */ - LPCWSTR lpszSubKey; /* reg. subkey */ - PROC lpfnCompare; /* item compare proc */ + DWORD cbSize; + DWORD nMaxItems; + DWORD dwFlags; + HKEY hKey; + LPCWSTR lpszSubKey; + PROC lpfnCompare; } CREATEMRULISTW, *LPCREATEMRULISTW; /* dwFlags */ @@ -517,9 +569,9 @@ /************************************************************************** * MRU_SaveChanged (internal) * - * Localize MRU saving code + * Local MRU saving code */ -VOID MRU_SaveChanged( LPWINEMRULIST mp ) +static void MRU_SaveChanged ( LPWINEMRULIST mp ) { UINT i, err; HKEY newkey; @@ -587,16 +639,17 @@ * hMRUList [I] Handle to list. * * RETURNS - * Success: TRUE - * Failure: FALSE + * Nothing. */ -BOOL WINAPI -FreeMRUList (HANDLE hMRUList) +void WINAPI FreeMRUList (HANDLE hMRUList) { LPWINEMRULIST mp = (LPWINEMRULIST)hMRUList; UINT i; - TRACE("\n"); + TRACE("(%p)\n", hMRUList); + if (!hMRUList) + return; + if (mp->wineFlags & WMRUF_CHANGED) { /* need to open key and then save the info */ MRU_SaveChanged( mp ); @@ -609,7 +662,7 @@ Free(mp->realMRU); Free(mp->array); Free((LPWSTR)mp->extview.lpszSubKey); - return Free(mp); + Free(mp); } @@ -629,8 +682,8 @@ * RETURNS * Position in list 0 -> MRU. -1 if item not found. */ -INT WINAPI -FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum) +INT WINAPI FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData, + LPINT lpRegNum) { LPWINEMRULIST mp = (LPWINEMRULIST)hList; INT ret; @@ -707,14 +760,22 @@ * No. corresponding to registry name where value is stored 'a' -> 0 etc. * -1 on error. */ -INT WINAPI -AddMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData) +INT WINAPI AddMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData) { LPWINEMRULIST mp = (LPWINEMRULIST)hList; LPWINEMRUITEM witem; - INT i, replace, ret; + INT i, replace; - if ((replace = FindMRUData (hList, lpData, cbData, NULL)) < 0) { + if ((replace = FindMRUData (hList, lpData, cbData, NULL)) >= 0) { + /* Item exists, just move it to the front */ + LPSTR pos = strchr(mp->realMRU, replace + 'a'); + while (pos > mp->realMRU) + { + pos[0] = pos[-1]; + pos--; + } + } + else { /* either add a new entry or replace oldest */ if (mp->cursize < mp->extview.nMaxItems) { /* Add in a new item */ @@ -726,57 +787,73 @@ replace = mp->realMRU[mp->cursize - 1] - 'a'; Free(mp->array[replace]); } - } - else { - /* free up the old data */ - Free(mp->array[replace]); - } - /* Allocate space for new item and move in the data */ - mp->array[replace] = witem = Alloc(cbData + sizeof(WINEMRUITEM)); - witem->itemFlag |= WMRUIF_CHANGED; - witem->size = cbData; - memcpy( &witem->datastart, lpData, cbData); + /* Allocate space for new item and move in the data */ + mp->array[replace] = witem = Alloc(cbData + sizeof(WINEMRUITEM)); + witem->itemFlag |= WMRUIF_CHANGED; + witem->size = cbData; + memcpy( &witem->datastart, lpData, cbData); + + /* now rotate MRU list */ + for(i=mp->cursize-1; i>=1; i--) + mp->realMRU[i] = mp->realMRU[i-1]; + } - /* now rotate MRU list */ + /* The new item gets the front spot */ mp->wineFlags |= WMRUF_CHANGED; - for(i=mp->cursize-1; i>=1; i--) { - mp->realMRU[i] = mp->realMRU[i-1]; - } mp->realMRU[0] = replace + 'a'; + TRACE("(%p, %p, %ld) adding data, /%c/ now most current\n", - hList, lpData, cbData, replace+'a'); - ret = replace; + hList, lpData, cbData, replace+'a'); if (!(mp->extview.dwFlags & MRUF_DELAYED_SAVE)) { /* save changed stuff right now */ MRU_SaveChanged( mp ); } - return ret; + return replace; } /************************************************************************** * AddMRUStringW [COMCTL32.401] * - * Add item to MRU string list. If item already exists in list them it is - * simply moved up to the top of the list and not added again. If list is - * full then the least recently used item is removed to make room. + * Add an item to an MRU string list. * * PARAMS - * hList [I] Handle to list. - * lpszString [I] ptr to string to add. + * hList [I] Handle to list. + * lpszString [I] The string to add. * * RETURNS - * No. corresponding to registry name where value is stored 'a' -> 0 etc. - * -1 on error. + * Success: The number corresponding to the registry name where the string + * has been stored (0 maps to 'a', 1 to 'b' and so on). + * Failure: -1, if hList is NULL or memory allocation fails. If lpszString + * is invalid, the function returns 0, and GetLastError() returns + * ERROR_INVALID_PARAMETER. The last error value is set only in + * this case. + * + * NOTES + * -If lpszString exists in the list already, it is moved to the top of the + * MRU list (it is not duplicated). + * -If the list is full the least recently used list entry is replaced with + * lpszString. + * -If this function returns 0 you should check the last error value to + * ensure the call really succeeded. */ -INT WINAPI -AddMRUStringW(HANDLE hList, LPCWSTR lpszString) +INT WINAPI AddMRUStringW(HANDLE hList, LPCWSTR lpszString) { - FIXME("(%p, %s) empty stub!\n", hList, debugstr_w(lpszString)); + TRACE("(%p,%s)\n", hList, debugstr_w(lpszString)); + + if (!hList) + return -1; - return 0; + if (!lpszString || IsBadStringPtrW(lpszString, -1)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + return AddMRUData(hList, lpszString, + (strlenW(lpszString) + 1) * sizeof(WCHAR)); } /************************************************************************** @@ -784,12 +861,32 @@ * * See AddMRUStringW. */ -INT WINAPI -AddMRUStringA(HANDLE hList, LPCSTR lpszString) +INT WINAPI AddMRUStringA(HANDLE hList, LPCSTR lpszString) { - FIXME("(%p, %s) empty stub!\n", hList, debugstr_a(lpszString)); + DWORD len; + LPWSTR stringW; + INT ret; - return 0; + TRACE("(%p,%s)\n", hList, debugstr_a(lpszString)); + + if (!hList) + return -1; + + if (IsBadStringPtrA(lpszString, -1)) + { + SetLastError(ERROR_INVALID_PARAMETER); + return 0; + } + + len = MultiByteToWideChar(CP_ACP, 0, lpszString, -1, NULL, 0) * sizeof(WCHAR); + stringW = Alloc(len); + if (!stringW) + return -1; + + MultiByteToWideChar(CP_ACP, 0, lpszString, -1, stringW, len); + ret = AddMRUData(hList, stringW, len); + Free(stringW); + return ret; } /************************************************************************** @@ -804,8 +901,7 @@ * RETURNS * TRUE if successful, FALSE if nItemPos is out of range. */ -BOOL WINAPI -DelMRUString(HANDLE hList, INT nItemPos) +BOOL WINAPI DelMRUString(HANDLE hList, INT nItemPos) { FIXME("(%p, %d): stub\n", hList, nItemPos); return TRUE; @@ -816,11 +912,10 @@ * * See FindMRUStringA. */ -INT WINAPI -FindMRUStringW (HANDLE hList, LPCWSTR lpszString, LPINT lpRegNum) +INT WINAPI FindMRUStringW (HANDLE hList, LPCWSTR lpszString, LPINT lpRegNum) { - FIXME("stub\n"); - return -1; + return FindMRUData(hList, lpszString, + (lstrlenW(lpszString) + 1) * sizeof(WCHAR), lpRegNum); } /************************************************************************** @@ -838,8 +933,7 @@ * RETURNS * Position in list 0 -> MRU. -1 if item not found. */ -INT WINAPI -FindMRUStringA (HANDLE hList, LPCSTR lpszString, LPINT lpRegNum) +INT WINAPI FindMRUStringA (HANDLE hList, LPCSTR lpszString, LPINT lpRegNum) { DWORD len = MultiByteToWideChar(CP_ACP, 0, lpszString, -1, NULL, 0); LPWSTR stringW = Alloc(len * sizeof(WCHAR)); @@ -854,7 +948,7 @@ /************************************************************************* * CreateMRUListLazy_common (internal) */ -HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp) +static HANDLE CreateMRUListLazy_common(LPWINEMRULIST mp) { UINT i, err; HKEY newkey; @@ -901,7 +995,7 @@ *mp->realMRU = 0; } - TRACE("MRU list = %s\n", mp->realMRU); + TRACE("MRU list = %s, datasize = %ld\n", mp->realMRU, datasize); mp->cursize = datasize - 1; /* datasize now has number of items in the MRUList */ @@ -939,16 +1033,16 @@ * * See CreateMRUListLazyA. */ -HANDLE WINAPI -CreateMRUListLazyW (LPCREATEMRULISTW lpcml, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4) +HANDLE WINAPI CreateMRUListLazyW (LPCREATEMRULISTW lpcml, DWORD dwParam2, + DWORD dwParam3, DWORD dwParam4) { LPWINEMRULIST mp; - if (lpcml == NULL) - return 0; + /* Native does not check for a NULL lpcml */ - if (lpcml->cbSize < sizeof(CREATEMRULISTW)) - return 0; + if (lpcml->cbSize != sizeof(CREATEMRULISTW) || !lpcml->hKey || + IsBadStringPtrW(lpcml->lpszSubKey, -1)) + return NULL; mp = Alloc(sizeof(WINEMRULIST)); memcpy(&mp->extview, lpcml, sizeof(CREATEMRULISTW)); @@ -973,16 +1067,16 @@ * RETURNS * Handle to MRU list. */ -HANDLE WINAPI -CreateMRUListLazyA (LPCREATEMRULISTA lpcml, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4) +HANDLE WINAPI CreateMRUListLazyA (LPCREATEMRULISTA lpcml, DWORD dwParam2, + DWORD dwParam3, DWORD dwParam4) { LPWINEMRULIST mp; DWORD len; - if (lpcml == NULL) - return 0; + /* Native does not check for a NULL lpcml */ - if (lpcml->cbSize < sizeof(CREATEMRULISTA)) + if (lpcml->cbSize != sizeof(CREATEMRULISTA) || !lpcml->hKey || + IsBadStringPtrA(lpcml->lpszSubKey, -1)) return 0; mp = Alloc(sizeof(WINEMRULIST)); @@ -1000,8 +1094,7 @@ * * See CreateMRUListA. */ -HANDLE WINAPI -CreateMRUListW (LPCREATEMRULISTW lpcml) +HANDLE WINAPI CreateMRUListW (LPCREATEMRULISTW lpcml) { return CreateMRUListLazyW(lpcml, 0, 0, 0); } @@ -1017,8 +1110,7 @@ * RETURNS * Handle to MRU list. */ -HANDLE WINAPI -CreateMRUListA (LPCREATEMRULISTA lpcml) +HANDLE WINAPI CreateMRUListA (LPCREATEMRULISTA lpcml) { return CreateMRUListLazyA (lpcml, 0, 0, 0); } @@ -1042,8 +1134,8 @@ * If lpBuffer == NULL or nItemPos is -ve return value is no. of items in * the list. */ -INT WINAPI EnumMRUListW(HANDLE hList, INT nItemPos, LPVOID lpBuffer, -DWORD nBufferSize) +INT WINAPI EnumMRUListW (HANDLE hList, INT nItemPos, LPVOID lpBuffer, + DWORD nBufferSize) { LPWINEMRULIST mp = (LPWINEMRULIST) hList; LPWINEMRUITEM witem; @@ -1067,8 +1159,8 @@ * * See EnumMRUListW. */ -INT WINAPI EnumMRUListA(HANDLE hList, INT nItemPos, LPVOID lpBuffer, -DWORD nBufferSize) +INT WINAPI EnumMRUListA (HANDLE hList, INT nItemPos, LPVOID lpBuffer, + DWORD nBufferSize) { LPWINEMRULIST mp = (LPWINEMRULIST) hList; LPWINEMRUITEM witem; @@ -1110,9 +1202,7 @@ * RETURNS * The number of characters copied. */ - -INT WINAPI -Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen) +INT WINAPI Str_GetPtrA (LPCSTR lpSrc, LPSTR lpDest, INT nMaxLen) { INT len; @@ -1157,9 +1247,7 @@ * Set lpSrc to NULL to free the memory allocated by a previous call * to this function. */ - -BOOL WINAPI -Str_SetPtrA (LPSTR *lppDest, LPCSTR lpSrc) +BOOL WINAPI Str_SetPtrA (LPSTR *lppDest, LPCSTR lpSrc) { TRACE("(%p %p)\n", lppDest, lpSrc); @@ -1186,9 +1274,7 @@ * * See Str_GetPtrA. */ - -INT WINAPI -Str_GetPtrW (LPCWSTR lpSrc, LPWSTR lpDest, INT nMaxLen) +INT WINAPI Str_GetPtrW (LPCWSTR lpSrc, LPWSTR lpDest, INT nMaxLen) { INT len; @@ -1221,9 +1307,7 @@ * * See Str_SetPtrA. */ - -BOOL WINAPI -Str_SetPtrW (LPWSTR *lppDest, LPCWSTR lpSrc) +BOOL WINAPI Str_SetPtrW (LPWSTR *lppDest, LPCWSTR lpSrc) { TRACE("(%p %p)\n", lppDest, lpSrc); @@ -1260,8 +1344,7 @@ * Length, in bytes, of the converted string. */ -INT -Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen) +INT Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen) { INT len; @@ -1306,9 +1389,7 @@ * TRUE: conversion successful * FALSE: error */ - -BOOL -Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc) +BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc) { TRACE("(%p %s)\n", lppDest, lpSrc); @@ -1350,9 +1431,7 @@ * fixed-size memory blocks. These arrays can store any kind of data * (e.g. strings and icons). */ - -HDSA WINAPI -DSA_Create (INT nSize, INT nGrow) +HDSA WINAPI DSA_Create (INT nSize, INT nGrow) { HDSA hdsa; @@ -1384,9 +1463,7 @@ * Success: TRUE * Failure: FALSE */ - -BOOL WINAPI -DSA_Destroy (const HDSA hdsa) +BOOL WINAPI DSA_Destroy (const HDSA hdsa) { TRACE("(%p)\n", hdsa); @@ -1414,9 +1491,7 @@ * Success: TRUE * Failure: FALSE */ - -BOOL WINAPI -DSA_GetItem (const HDSA hdsa, INT nIndex, LPVOID pDest) +BOOL WINAPI DSA_GetItem (const HDSA hdsa, INT nIndex, LPVOID pDest) { LPVOID pSrc; @@ -1447,9 +1522,7 @@ * Success: pointer to an item * Failure: NULL */ - -LPVOID WINAPI -DSA_GetItemPtr (const HDSA hdsa, INT nIndex) +LPVOID WINAPI DSA_GetItemPtr (const HDSA hdsa, INT nIndex) { LPVOID pSrc; @@ -1482,9 +1555,7 @@ * Success: TRUE * Failure: FALSE */ - -BOOL WINAPI -DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) +BOOL WINAPI DSA_SetItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) { INT nSize, nNewItems; LPVOID pDest, lpTemp; @@ -1540,9 +1611,7 @@ * Success: position of the new item * Failure: -1 */ - -INT WINAPI -DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) +INT WINAPI DSA_InsertItem (const HDSA hdsa, INT nIndex, LPVOID pSrc) { INT nNewItems, nSize; LPVOID lpTemp, lpDest; @@ -1603,9 +1672,7 @@ * Success: number of the deleted element * Failure: -1 */ - -INT WINAPI -DSA_DeleteItem (const HDSA hdsa, INT nIndex) +INT WINAPI DSA_DeleteItem (const HDSA hdsa, INT nIndex) { LPVOID lpDest,lpSrc; INT nSize; @@ -1657,9 +1724,7 @@ * Success: TRUE * Failure: FALSE */ - -BOOL WINAPI -DSA_DeleteAllItems (const HDSA hdsa) +BOOL WINAPI DSA_DeleteAllItems (const HDSA hdsa) { TRACE("(%p)\n", hdsa); @@ -1688,9 +1753,7 @@ * Success: TRUE * Failure: FALSE */ - -BOOL WINAPI -DPA_Destroy (const HDPA hdpa) +BOOL WINAPI DPA_Destroy (const HDPA hdpa) { TRACE("(%p)\n", hdpa); @@ -1717,9 +1780,7 @@ * Success: TRUE * Failure: FALSE */ - -BOOL WINAPI -DPA_Grow (const HDPA hdpa, INT nGrow) +BOOL WINAPI DPA_Grow (const HDPA hdpa, INT nGrow) { TRACE("(%p %d)\n", hdpa, nGrow); @@ -1751,9 +1812,7 @@ * - If 'hdpa' is a NULL-Pointer, the original implementation crashes, * this implementation just returns NULL. */ - -HDPA WINAPI -DPA_Clone (const HDPA hdpa, const HDPA hdpaNew) +HDPA WINAPI DPA_Clone (const HDPA hdpa, const HDPA hdpaNew) { INT nNewItems, nSize; HDPA hdpaTemp; @@ -1811,9 +1870,7 @@ * Success: pointer * Failure: NULL */ - -LPVOID WINAPI -DPA_GetPtr (const HDPA hdpa, INT nIndex) +LPVOID WINAPI DPA_GetPtr (const HDPA hdpa, INT nIndex) { TRACE("(%p %d)\n", hdpa, nIndex); @@ -1847,9 +1904,7 @@ * Success: index of the specified pointer * Failure: -1 */ - -INT WINAPI -DPA_GetPtrIndex (const HDPA hdpa, LPVOID p) +INT WINAPI DPA_GetPtrIndex (const HDPA hdpa, LPVOID p) { INT i; @@ -1879,9 +1934,7 @@ * Success: index of the inserted pointer * Failure: -1 */ - -INT WINAPI -DPA_InsertPtr (const HDPA hdpa, INT i, LPVOID p) +INT WINAPI DPA_InsertPtr (const HDPA hdpa, INT i, LPVOID p) { TRACE("(%p %d %p)\n", hdpa, i, p); @@ -1914,9 +1967,7 @@ * Success: TRUE * Failure: FALSE */ - -BOOL WINAPI -DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p) +BOOL WINAPI DPA_SetPtr (const HDPA hdpa, INT i, LPVOID p) { LPVOID *lpTemp; @@ -1967,9 +2018,7 @@ * Success: deleted pointer * Failure: NULL */ - -LPVOID WINAPI -DPA_DeletePtr (const HDPA hdpa, INT i) +LPVOID WINAPI DPA_DeletePtr (const HDPA hdpa, INT i) { LPVOID *lpDest, *lpSrc, lpTemp = NULL; INT nSize; @@ -2022,9 +2071,7 @@ * Success: TRUE * Failure: FALSE */ - -BOOL WINAPI -DPA_DeleteAllPtrs (const HDPA hdpa) +BOOL WINAPI DPA_DeleteAllPtrs (const HDPA hdpa) { TRACE("(%p)\n", hdpa); @@ -2058,10 +2105,8 @@ * RETURNS * NONE */ - -static VOID -DPA_QuickSort (LPVOID *lpPtrs, INT l, INT r, - PFNDPACOMPARE pfnCompare, LPARAM lParam) +static VOID DPA_QuickSort (LPVOID *lpPtrs, INT l, INT r, + PFNDPACOMPARE pfnCompare, LPARAM lParam) { INT m; LPVOID t; @@ -2109,9 +2154,7 @@ * Success: TRUE * Failure: FALSE */ - -BOOL WINAPI -DPA_Sort (const HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam) +BOOL WINAPI DPA_Sort (const HDPA hdpa, PFNDPACOMPARE pfnCompare, LPARAM lParam) { if (!hdpa || !pfnCompare) return FALSE; @@ -2148,10 +2191,8 @@ * Function is NOT tested! * If something goes wrong, blame HIM not ME! (Eric Kohl) */ - -INT WINAPI -DPA_Search (const HDPA hdpa, LPVOID pFind, INT nStart, - PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions) +INT WINAPI DPA_Search (const HDPA hdpa, LPVOID pFind, INT nStart, + PFNDPACOMPARE pfnCompare, LPARAM lParam, UINT uOptions) { if (!hdpa || !pfnCompare || !pFind) return -1; @@ -2232,9 +2273,7 @@ * The DPA_ functions can be used to create and manipulate arrays of * pointers. */ - -HDPA WINAPI -DPA_CreateEx (INT nGrow, HANDLE hHeap) +HDPA WINAPI DPA_CreateEx (INT nGrow, HANDLE hHeap) { HDPA hdpa; @@ -2275,9 +2314,7 @@ * The DPA_ functions can be used to create and manipulate arrays of * pointers. */ - -HDPA WINAPI -DPA_Create (INT nGrow) +HDPA WINAPI DPA_Create (INT nGrow) { return DPA_CreateEx( nGrow, 0 ); } @@ -2302,8 +2339,7 @@ * DoNotify [Internal] */ -static LRESULT -DoNotify (LPNOTIFYDATA lpNotify, UINT uCode, LPNMHDR lpHdr) +static LRESULT DoNotify (LPNOTIFYDATA lpNotify, UINT uCode, LPNMHDR lpHdr) { NMHDR nmhdr; LPNMHDR lpNmh = NULL; @@ -2355,7 +2391,6 @@ * message is taken from the NMHDR structure. * If hwndFrom is not -1 then lpHdr can be NULL. */ - LRESULT WINAPI SendNotify (HWND hwndTo, HWND hwndFrom, UINT uCode, LPNMHDR lpHdr) { NOTIFYDATA notify; @@ -2393,7 +2428,6 @@ * message is taken from the NMHDR structure. * If hwndFrom is not -1 then lpHdr can be NULL. */ - LRESULT WINAPI SendNotifyEx (HWND hwndTo, HWND hwndFrom, UINT uCode, LPNMHDR lpHdr, DWORD dwParam5) { @@ -2436,9 +2470,8 @@ * RETURNS * none */ - -VOID WINAPI -DPA_EnumCallback (HDPA hdpa, PFNDPAENUMCALLBACK enumProc, LPVOID lParam) +VOID WINAPI DPA_EnumCallback (HDPA hdpa, PFNDPAENUMCALLBACK enumProc, + LPVOID lParam) { INT i; @@ -2471,9 +2504,8 @@ * RETURNS * none */ - -void WINAPI -DPA_DestroyCallback (HDPA hdpa, PFNDPAENUMCALLBACK enumProc, LPVOID lParam) +void WINAPI DPA_DestroyCallback (HDPA hdpa, PFNDPAENUMCALLBACK enumProc, + LPVOID lParam) { TRACE("(%p %p %p)\n", hdpa, enumProc, lParam); @@ -2495,9 +2527,8 @@ * RETURNS * none */ - -VOID WINAPI -DSA_EnumCallback (HDSA hdsa, PFNDSAENUMCALLBACK enumProc, LPVOID lParam) +VOID WINAPI DSA_EnumCallback (HDSA hdsa, PFNDSAENUMCALLBACK enumProc, + LPVOID lParam) { INT i; @@ -2531,9 +2562,8 @@ * RETURNS * none */ - -void WINAPI -DSA_DestroyCallback (HDSA hdsa, PFNDSAENUMCALLBACK enumProc, LPVOID lParam) +void WINAPI DSA_DestroyCallback (HDSA hdsa, PFNDSAENUMCALLBACK enumProc, + LPVOID lParam) { TRACE("(%p %p %p)\n", hdsa, enumProc, lParam); diff -urN wine-20041201/dlls/comctl32/commctrl.c wine-20050111/dlls/comctl32/commctrl.c --- wine-20041201/dlls/comctl32/commctrl.c 2004-10-20 00:59:59.000000000 +0200 +++ wine-20050111/dlls/comctl32/commctrl.c 2005-01-04 21:39:55.000000000 +0100 @@ -336,7 +336,7 @@ * Handle to the window that contains the menu and controls. * * uFlags - * Identifier of the menu item to receive or loose a check mark. + * Identifier of the menu item to receive or lose a check mark. * * lpInfo * The array of integers contains pairs of values. BOTH values of @@ -482,7 +482,7 @@ r.left += 3; if (style & SBT_RTLREADING) FIXME("Unsupported RTL style!\n"); - DrawTextW (hdc, text, -1, &r, align|DT_VCENTER|DT_SINGLELINE); + DrawTextW (hdc, text, -1, &r, align|DT_VCENTER|DT_SINGLELINE|DT_NOPREFIX); SetBkMode(hdc, oldbkmode); } } diff -urN wine-20041201/dlls/comctl32/datetime.c wine-20050111/dlls/comctl32/datetime.c --- wine-20041201/dlls/comctl32/datetime.c 2004-11-24 19:28:31.000000000 +0100 +++ wine-20050111/dlls/comctl32/datetime.c 2005-01-09 17:42:54.000000000 +0100 @@ -487,22 +487,17 @@ int i,prevright; RECT *field; RECT *rcDraw = &infoPtr->rcDraw; - RECT *rcClient = &infoPtr->rcClient; RECT *calbutton = &infoPtr->calbutton; RECT *checkbox = &infoPtr->checkbox; - HBRUSH hbr; SIZE size; - COLORREF oldBk, oldTextColor; + COLORREF oldTextColor; /* draw control edge */ TRACE("\n"); - hbr = CreateSolidBrush(RGB(255, 255, 255)); - FillRect(hdc, rcClient, hbr); - DrawEdge(hdc, rcClient, EDGE_SUNKEN, BF_RECT); - DeleteObject(hbr); if (infoPtr->dateValid) { HFONT oldFont = SelectObject (hdc, infoPtr->hFont); + INT oldBkMode = SetBkMode (hdc, TRANSPARENT); WCHAR txt[80]; DATETIME_ReturnTxt (infoPtr, 0, txt, sizeof(txt)/sizeof(txt[0])); @@ -521,18 +516,23 @@ field->bottom = rcDraw->bottom; prevright = field->right; - if ((infoPtr->haveFocus) && (i == infoPtr->select)) { - hbr = CreateSolidBrush (GetSysColor (COLOR_ACTIVECAPTION)); + if (infoPtr->dwStyle & WS_DISABLED) + oldTextColor = SetTextColor (hdc, comctl32_color.clrGrayText); + else if ((infoPtr->haveFocus) && (i == infoPtr->select)) { + /* fill if focussed */ + HBRUSH hbr = CreateSolidBrush (comctl32_color.clrActiveCaption); FillRect(hdc, field, hbr); - oldBk = SetBkColor (hdc, GetSysColor(COLOR_ACTIVECAPTION)); - oldTextColor = SetTextColor (hdc, GetSysColor(COLOR_WINDOW)); DeleteObject (hbr); - DrawTextW (hdc, txt, strlenW(txt), field, DT_RIGHT | DT_VCENTER | DT_SINGLELINE); - SetBkColor (hdc, oldBk); - SetTextColor (hdc, oldTextColor); - } else - DrawTextW ( hdc, txt, strlenW(txt), field, DT_RIGHT | DT_VCENTER | DT_SINGLELINE ); + oldTextColor = SetTextColor (hdc, comctl32_color.clrWindow); + } + else + oldTextColor = SetTextColor (hdc, comctl32_color.clrWindowText); + + /* draw the date text using the colour set above */ + DrawTextW (hdc, txt, strlenW(txt), field, DT_RIGHT | DT_VCENTER | DT_SINGLELINE); + SetTextColor (hdc, oldTextColor); } + SetBkMode (hdc, oldBkMode); SelectObject (hdc, oldFont); } @@ -576,25 +576,29 @@ /* FIXME: might be conditions where we don't want to update infoPtr->select */ infoPtr->select = new; - if (infoPtr->select != old) - infoPtr->haveFocus = DTHT_GOTFOCUS; + SetFocus(infoPtr->hwndSelf); if (infoPtr->select == DTHT_MCPOPUP) { + RECT rcMonthCal; + SendMessageW(infoPtr->hMonthCal, MCM_GETMINREQRECT, 0, (LPARAM)&rcMonthCal); + /* FIXME: button actually is only depressed during dropdown of the */ /* calendar control and when the mouse is over the button window */ infoPtr->bCalDepressed = TRUE; /* recalculate the position of the monthcal popup */ if(infoPtr->dwStyle & DTS_RIGHTALIGN) - infoPtr->monthcal_pos.x = infoPtr->rcClient.right - - ((infoPtr->calbutton.right - infoPtr->calbutton.left) + 200); + infoPtr->monthcal_pos.x = infoPtr->calbutton.left - + (rcMonthCal.right - rcMonthCal.left); else - infoPtr->monthcal_pos.x = 8; + /* FIXME: this should be after the area reserved for the checkbox */ + infoPtr->monthcal_pos.x = infoPtr->rcDraw.left; infoPtr->monthcal_pos.y = infoPtr->rcClient.bottom; ClientToScreen (infoPtr->hwndSelf, &(infoPtr->monthcal_pos)); - /* FIXME My Windoze has cx=about 200, but it probably depends on font size etc */ - SetWindowPos(infoPtr->hMonthCal, 0, infoPtr->monthcal_pos.x, infoPtr->monthcal_pos.y, 200, 150, 0); + SetWindowPos(infoPtr->hMonthCal, 0, infoPtr->monthcal_pos.x, + infoPtr->monthcal_pos.y, rcMonthCal.right - rcMonthCal.left, + rcMonthCal.bottom - rcMonthCal.top, 0); if(IsWindowVisible(infoPtr->hMonthCal)) { ShowWindow(infoPtr->hMonthCal, SW_HIDE); @@ -611,7 +615,7 @@ DATETIME_SendSimpleNotify (infoPtr, DTN_DROPDOWN); } - InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); + InvalidateRect(infoPtr->hwndSelf, NULL, TRUE); return 0; } @@ -620,7 +624,7 @@ static LRESULT DATETIME_LButtonUp (DATETIME_INFO *infoPtr, WORD wKey) { - if(infoPtr->bCalDepressed == TRUE) { + if(infoPtr->bCalDepressed) { infoPtr->bCalDepressed = FALSE; InvalidateRect(infoPtr->hwndSelf, &(infoPtr->calbutton), TRUE); } @@ -668,6 +672,45 @@ static LRESULT +DATETIME_Enable (DATETIME_INFO *infoPtr, BOOL bEnable) +{ + TRACE("%p %s\n", infoPtr, bEnable ? "TRUE" : "FALSE"); + if (bEnable) + infoPtr->dwStyle &= ~WS_DISABLED; + else + infoPtr->dwStyle |= WS_DISABLED; + return 0; +} + + +static LRESULT +DATETIME_EraseBackground (DATETIME_INFO *infoPtr, HDC hdc) +{ + HBRUSH hBrush, hSolidBrush = NULL; + RECT rc; + + if (infoPtr->dwStyle & WS_DISABLED) + hBrush = hSolidBrush = CreateSolidBrush(comctl32_color.clrBtnFace); + else + { + hBrush = (HBRUSH)SendMessageW(infoPtr->hwndNotify, WM_CTLCOLOREDIT, + (WPARAM)hdc, (LPARAM)infoPtr->hwndSelf); + if (!hBrush) + hBrush = hSolidBrush = CreateSolidBrush(comctl32_color.clrWindow); + } + + GetClientRect (infoPtr->hwndSelf, &rc); + + FillRect (hdc, &rc, hBrush); + + if (hSolidBrush) + DeleteObject(hSolidBrush); + + return -1; +} + + +static LRESULT DATETIME_Notify (DATETIME_INFO *infoPtr, int idCtrl, LPNMHDR lpnmh) { TRACE ("Got notification %x from %p\n", lpnmh->code, lpnmh->hwndFrom); @@ -749,6 +792,8 @@ static LRESULT DATETIME_KillFocus (DATETIME_INFO *infoPtr, HWND lostFocus) { + TRACE("lost focus to %p\n", lostFocus); + if (infoPtr->haveFocus) { DATETIME_SendSimpleNotify (infoPtr, NM_KILLFOCUS); infoPtr->haveFocus = 0; @@ -761,8 +806,22 @@ static LRESULT +DATETIME_NCCreate (HWND hwnd, LPCREATESTRUCTW lpcs) +{ + DWORD dwExStyle = GetWindowLongW(hwnd, GWL_EXSTYLE); + /* force control to have client edge */ + dwExStyle |= WS_EX_CLIENTEDGE; + SetWindowLongW(hwnd, GWL_EXSTYLE, dwExStyle); + + return DefWindowProcW(hwnd, WM_NCCREATE, 0, (LPARAM)lpcs); +} + + +static LRESULT DATETIME_SetFocus (DATETIME_INFO *infoPtr, HWND lostFocus) { + TRACE("got focus from %p\n", lostFocus); + if (infoPtr->haveFocus == 0) { DATETIME_SendSimpleNotify (infoPtr, NM_SETFOCUS); infoPtr->haveFocus = DTHT_GOTFOCUS; @@ -814,10 +873,7 @@ TRACE("Height=%ld, Width=%ld\n", infoPtr->rcClient.bottom, infoPtr->rcClient.right); - /* use DrawEdge to adjust the size of rcEdge to get rcDraw */ - memcpy((&infoPtr->rcDraw), (&infoPtr->rcClient), sizeof(infoPtr->rcDraw)); - - DrawEdge(NULL, &(infoPtr->rcDraw), EDGE_SUNKEN, BF_RECT | BF_ADJUST); + infoPtr->rcDraw = infoPtr->rcClient; /* set the size of the button that drops the calendar down */ /* FIXME: account for style that allows button on left side */ @@ -833,17 +889,6 @@ infoPtr->checkbox.left = infoPtr->rcDraw.left; infoPtr->checkbox.right = infoPtr->rcDraw.left + 10; - /* update the position of the monthcal control */ - if(infoPtr->dwStyle & DTS_RIGHTALIGN) - infoPtr->monthcal_pos.x = infoPtr->rcClient.right - ((infoPtr->calbutton.right - - infoPtr->calbutton.left) + 145); - else - infoPtr->monthcal_pos.x = 8; - - infoPtr->monthcal_pos.y = infoPtr->rcClient.bottom; - ClientToScreen (infoPtr->hwndSelf, &(infoPtr->monthcal_pos)); - SetWindowPos(infoPtr->hMonthCal, 0, infoPtr->monthcal_pos.x, infoPtr->monthcal_pos.y, 145, 150, 0); - InvalidateRect(infoPtr->hwndSelf, NULL, FALSE); return 0; @@ -903,6 +948,7 @@ infoPtr->fieldRect = (RECT *) Alloc (infoPtr->nrFieldsAllocated * sizeof(RECT)); infoPtr->buflen = (int *) Alloc (infoPtr->nrFieldsAllocated * sizeof(int)); infoPtr->hwndNotify = lpcs->hwndParent; + infoPtr->select = -1; /* initially, nothing is selected */ DATETIME_StyleChanged(infoPtr, GWL_STYLE, &ss); DATETIME_SetFormatW (infoPtr, 0); @@ -946,7 +992,7 @@ TRACE ("%x, %x, %lx\n", uMsg, wParam, lParam); - if (!infoPtr && (uMsg != WM_CREATE)) + if (!infoPtr && (uMsg != WM_CREATE) && (uMsg != WM_NCCREATE)) return DefWindowProcW( hwnd, uMsg, wParam, lParam ); switch (uMsg) { @@ -988,6 +1034,12 @@ case WM_NOTIFY: return DATETIME_Notify (infoPtr, (int)wParam, (LPNMHDR)lParam); + case WM_ENABLE: + return DATETIME_Enable (infoPtr, (BOOL)wParam); + + case WM_ERASEBKGND: + return DATETIME_EraseBackground (infoPtr, (HDC)wParam); + case WM_GETDLGCODE: return DLGC_WANTARROWS | DLGC_WANTCHARS; @@ -1000,6 +1052,9 @@ case WM_KILLFOCUS: return DATETIME_KillFocus (infoPtr, (HWND)wParam); + case WM_NCCREATE: + return DATETIME_NCCreate (hwnd, (LPCREATESTRUCTW)lParam); + case WM_SETFOCUS: return DATETIME_SetFocus (infoPtr, (HWND)wParam); @@ -1030,7 +1085,6 @@ uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/comctl32/flatsb.c wine-20050111/dlls/comctl32/flatsb.c --- wine-20041201/dlls/comctl32/flatsb.c 2004-11-06 04:49:03.000000000 +0100 +++ wine-20050111/dlls/comctl32/flatsb.c 2005-01-09 17:42:54.000000000 +0100 @@ -34,9 +34,7 @@ #include "windef.h" #include "winbase.h" #include "winerror.h" -#include "wingdi.h" #include "winuser.h" -#include "winnls.h" #include "commctrl.h" #include "wine/debug.h" @@ -263,7 +261,6 @@ uMsg, wParam, lParam); return DefWindowProcA (hwnd, uMsg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/comctl32/header.c wine-20050111/dlls/comctl32/header.c --- wine-20041201/dlls/comctl32/header.c 2004-11-06 04:49:03.000000000 +0100 +++ wine-20050111/dlls/comctl32/header.c 2005-01-10 15:25:30.000000000 +0100 @@ -688,29 +688,36 @@ if (!phdi) return FALSE; - if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) - return FALSE; TRACE("[nItem=%d]\n", nItem); if (phdi->mask == 0) return TRUE; - lpItem = &infoPtr->items[nItem]; + if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) { + lpItem = NULL; + } + else { + lpItem = &infoPtr->items[nItem]; + } + if (phdi->mask & HDI_BITMAP) - phdi->hbm = lpItem->hbm; + phdi->hbm = (lpItem != NULL) ? lpItem->hbm : 0; if (phdi->mask & HDI_FORMAT) - phdi->fmt = lpItem->fmt; + phdi->fmt = (lpItem != NULL) ? lpItem->fmt : 0; if (phdi->mask & HDI_WIDTH) - phdi->cxy = lpItem->cxy; + phdi->cxy = (lpItem != NULL) ? lpItem->cxy : 0; if (phdi->mask & HDI_LPARAM) - phdi->lParam = lpItem->lParam; + phdi->lParam = (lpItem != NULL) ? lpItem->lParam : 0; if (phdi->mask & HDI_TEXT) { - if (lpItem->pszText != LPSTR_TEXTCALLBACKW) { + if (lpItem == NULL) { + *phdi->pszText = 0; + } + else if (lpItem->pszText != LPSTR_TEXTCALLBACKW) { if (lpItem->pszText) WideCharToMultiByte (CP_ACP, 0, lpItem->pszText, -1, phdi->pszText, phdi->cchTextMax, NULL, NULL); @@ -722,10 +729,10 @@ } if (phdi->mask & HDI_IMAGE) - phdi->iImage = lpItem->iImage; + phdi->iImage = (lpItem != NULL) ? lpItem->iImage : 0; if (phdi->mask & HDI_ORDER) - phdi->iOrder = lpItem->iOrder; + phdi->iOrder = (lpItem != NULL) ? lpItem->iOrder : 0; return TRUE; } @@ -741,29 +748,36 @@ if (!phdi) return FALSE; - if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) - return FALSE; TRACE("[nItem=%d]\n", nItem); if (phdi->mask == 0) return TRUE; - lpItem = &infoPtr->items[nItem]; + if ((nItem < 0) || (nItem >= (INT)infoPtr->uNumItem)) { + lpItem = NULL; + } + else { + lpItem = &infoPtr->items[nItem]; + } + if (phdi->mask & HDI_BITMAP) - phdi->hbm = lpItem->hbm; + phdi->hbm = (lpItem != NULL) ? lpItem->hbm : 0; if (phdi->mask & HDI_FORMAT) - phdi->fmt = lpItem->fmt; + phdi->fmt = (lpItem != NULL) ? lpItem->fmt : 0; if (phdi->mask & HDI_WIDTH) - phdi->cxy = lpItem->cxy; + phdi->cxy = (lpItem != NULL) ? lpItem->cxy : 0; if (phdi->mask & HDI_LPARAM) - phdi->lParam = lpItem->lParam; + phdi->lParam = (lpItem != NULL) ? lpItem->lParam : 0; if (phdi->mask & HDI_TEXT) { - if (lpItem->pszText != LPSTR_TEXTCALLBACKW) { + if (lpItem == NULL) { + *phdi->pszText = 0; + } + else if (lpItem->pszText != LPSTR_TEXTCALLBACKW) { if (lpItem->pszText) lstrcpynW (phdi->pszText, lpItem->pszText, phdi->cchTextMax); else @@ -774,10 +788,10 @@ } if (phdi->mask & HDI_IMAGE) - phdi->iImage = lpItem->iImage; + phdi->iImage = (lpItem != NULL) ? lpItem->iImage : 0; if (phdi->mask & HDI_ORDER) - phdi->iOrder = lpItem->iOrder; + phdi->iOrder = (lpItem != NULL) ? lpItem->iOrder : 0; return TRUE; } @@ -1831,7 +1845,6 @@ msg, wParam, lParam ); return DefWindowProcA (hwnd, msg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/comctl32/imagelist.c wine-20050111/dlls/comctl32/imagelist.c --- wine-20041201/dlls/comctl32/imagelist.c 2004-11-30 18:33:27.000000000 +0100 +++ wine-20050111/dlls/comctl32/imagelist.c 2005-01-10 15:29:20.000000000 +0100 @@ -612,6 +612,8 @@ } SelectObject(himl->hdcMask, himl->hbmMask); } + else + himl->hbmMask = 0; /* create blending brushes */ hbmTemp = CreateBitmap (8, 8, 1, 1, &aBitBlend25); @@ -1056,10 +1058,10 @@ INT cx, cy, lx, ly, nOvlIdx; DWORD fState, dwRop; UINT fStyle; - COLORREF clrBk, oldImageBk, oldImageFg; + COLORREF oldImageBk, oldImageFg; HDC hImageDC, hImageListDC, hMaskListDC; HBITMAP hImageBmp, hOldImageBmp, hBlendMaskBmp; - BOOL bIsTransparent, bBlend, bResult = FALSE; + BOOL bIsTransparent, bBlend, bResult = FALSE, bMask; HIMAGELIST himl; if (!pimldp || !(himl = pimldp->himl)) return FALSE; @@ -1073,9 +1075,14 @@ fStyle = pimldp->fStyle & ~ILD_OVERLAYMASK; cx = (pimldp->cx == 0) ? himl->cx : pimldp->cx; cy = (pimldp->cy == 0) ? himl->cy : pimldp->cy; - clrBk = (pimldp->rgbBk == CLR_DEFAULT) ? himl->clrBk : pimldp->rgbBk; - bIsTransparent = (fStyle & ILD_TRANSPARENT) || clrBk == CLR_NONE; - bBlend = fStyle & (ILD_BLEND25 | ILD_BLEND50); + + bIsTransparent = (fStyle & ILD_TRANSPARENT); + if( pimldp->rgbBk == CLR_NONE ) + bIsTransparent = TRUE; + if( ( pimldp->rgbBk == CLR_DEFAULT ) && ( himl->clrBk == CLR_NONE ) ) + bIsTransparent = TRUE; + bMask = (himl->flags & ILC_MASK) && (fStyle & ILD_MASK) ; + bBlend = (fStyle & (ILD_BLEND25 | ILD_BLEND50) ) && !bMask; TRACE("himl(0x%lx) hbmMask(%p) iImage(%d) x(%d) y(%d) cx(%d) cy(%d)\n", (DWORD)himl, himl->hbmMask, pimldp->i, pimldp->x, pimldp->y, cx, cy); @@ -1107,24 +1114,43 @@ /* * Draw the initial image */ - if (fStyle & ILD_MASK) { + if( bMask ) { if (himl->hbmMask) { - BitBlt(hImageDC, 0, 0, cx, cy, hMaskListDC, lx, ly, SRCCOPY); + HBRUSH hOldBrush; + hOldBrush = SelectObject (hImageDC, CreateSolidBrush (GetTextColor(pimldp->hdcDst))); + PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY ); + BitBlt(hImageDC, 0, 0, cx, cy, hMaskListDC, lx, ly, SRCPAINT); + DeleteObject (SelectObject (hImageDC, hOldBrush)); + if( bIsTransparent ) + { + BitBlt ( pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, SRCAND); + bResult = TRUE; + goto end; + } } else { HBRUSH hOldBrush = SelectObject (hImageDC, GetStockObject(BLACK_BRUSH)); PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY); SelectObject(hImageDC, hOldBrush); } - } else if (himl->hbmMask && !bIsTransparent) { + } else { /* blend the image with the needed solid background */ - HBRUSH hOldBrush = SelectObject (hImageDC, CreateSolidBrush (clrBk)); + COLORREF colour = RGB(0,0,0); + HBRUSH hOldBrush; + + if( !bIsTransparent ) + { + colour = pimldp->rgbBk; + if( colour == CLR_DEFAULT ) + colour = himl->clrBk; + if( colour == CLR_NONE ) + colour = GetBkColor(pimldp->hdcDst); + } + + hOldBrush = SelectObject (hImageDC, CreateSolidBrush (colour)); PatBlt( hImageDC, 0, 0, cx, cy, PATCOPY ); BitBlt( hImageDC, 0, 0, cx, cy, hMaskListDC, lx, ly, SRCAND ); BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCPAINT ); DeleteObject (SelectObject (hImageDC, hOldBrush)); - } else { - /* start off with the image, if we have a mask, we'll use it later */ - BitBlt( hImageDC, 0, 0, cx, cy, hImageListDC, lx, ly, SRCCOPY); } /* Time for blending, if required */ @@ -1179,7 +1205,7 @@ /* now copy the image to the screen */ dwRop = SRCCOPY; - if (himl->hbmMask && bIsTransparent && !(fStyle & ILD_MASK)) { + if (himl->hbmMask && bIsTransparent ) { COLORREF oldDstFg = SetTextColor(pimldp->hdcDst, RGB( 0, 0, 0 ) ); COLORREF oldDstBk = SetBkColor(pimldp->hdcDst, RGB( 0xff, 0xff, 0xff )); BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hMaskListDC, lx, ly, SRCAND); @@ -1191,7 +1217,7 @@ BitBlt (pimldp->hdcDst, pimldp->x, pimldp->y, cx, cy, hImageDC, 0, 0, dwRop); bResult = TRUE; - +end: /* cleanup the mess */ SetBkColor(hImageDC, oldImageBk); SetTextColor(hImageDC, oldImageFg); @@ -1388,14 +1414,18 @@ /* draw mask*/ ii.hbmMask = CreateCompatibleBitmap (hdcDst, himl->cx, himl->cy); hOldDstBitmap = SelectObject (hdcDst, ii.hbmMask); - PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, WHITENESS); - ImageList_Draw(himl, i, hdcDst, 0, 0, fStyle | ILD_MASK); + if (himl->hbmMask) { + BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, + himl->hdcMask, i * himl->cx, 0, SRCCOPY); + } + else + PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS); /* draw image*/ ii.hbmColor = CreateCompatibleBitmap (himl->hdcImage, himl->cx, himl->cy); SelectObject (hdcDst, ii.hbmColor); - PatBlt (hdcDst, 0, 0, himl->cx, himl->cy, BLACKNESS); - ImageList_Draw(himl, i, hdcDst, 0, 0, fStyle | ILD_TRANSPARENT); + BitBlt (hdcDst, 0, 0, himl->cx, himl->cy, + himl->hdcImage, i * himl->cx, 0, SRCCOPY); /* * CreateIconIndirect requires us to deselect the bitmaps from diff -urN wine-20041201/dlls/comctl32/listview.c wine-20050111/dlls/comctl32/listview.c --- wine-20041201/dlls/comctl32/listview.c 2004-11-24 19:28:31.000000000 +0100 +++ wine-20050111/dlls/comctl32/listview.c 2005-01-09 17:42:54.000000000 +0100 @@ -8346,6 +8346,36 @@ return 0; } + +/*** + * DESCRIPTION: + * Paints/Repaints the listview control. + * + * PARAMETER(S): + * [I] infoPtr : valid pointer to the listview structure + * [I] hdc : device context handle + * [I] options : drawing options + * + * RETURN: + * Zero + */ +static LRESULT LISTVIEW_PrintClient(LISTVIEW_INFO *infoPtr, HDC hdc, DWORD options) +{ + FIXME("Partial Stub: (hdc=%p options=0x%08lx)\n", hdc, options); + + if ((options & PRF_CHECKVISIBLE) && !IsWindowVisible(infoPtr->hwndSelf)) + return 0; + + if (options & PRF_ERASEBKGND) + LISTVIEW_EraseBkgnd(infoPtr, hdc); + + if (options & PRF_CLIENT) + LISTVIEW_Paint(infoPtr, hdc); + + return 0; +} + + /*** * DESCRIPTION: * Processes double click messages (right mouse button). @@ -9193,6 +9223,9 @@ case WM_NOTIFYFORMAT: return LISTVIEW_NotifyFormat(infoPtr, (HWND)wParam, (INT)lParam); + case WM_PRINTCLIENT: + return LISTVIEW_PrintClient(infoPtr, (HDC)wParam, (DWORD)lParam); + case WM_PAINT: return LISTVIEW_Paint(infoPtr, (HDC)wParam); @@ -9260,7 +9293,6 @@ return DefWindowProcW(hwnd, uMsg, wParam, lParam); } - return 0; } /*** diff -urN wine-20041201/dlls/comctl32/monthcal.c wine-20050111/dlls/comctl32/monthcal.c --- wine-20041201/dlls/comctl32/monthcal.c 2004-11-30 18:35:16.000000000 +0100 +++ wine-20050111/dlls/comctl32/monthcal.c 2005-01-11 11:43:03.000000000 +0100 @@ -337,7 +337,6 @@ RECT r; static int haveBoldFont, haveSelectedDay = FALSE; HBRUSH hbr; - HPEN hNewPen, hOldPen = 0; COLORREF oldCol = 0; COLORREF oldBk = 0; @@ -394,12 +393,8 @@ DrawTextA(hdc, buf, -1, &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE ); /* draw a rectangle around the currently selected days text */ - if((day==infoPtr->curSelDay) && (month==infoPtr->currentMonth)) { - hNewPen = CreatePen(PS_ALTERNATE, 0, GetSysColor(COLOR_WINDOWTEXT) ); - hbr = GetSysColorBrush(COLOR_WINDOWTEXT); - FrameRect(hdc, &r, hbr); - SelectObject(hdc, hOldPen); - } + if((day==infoPtr->curSelDay) && (month==infoPtr->currentMonth)) + DrawFocusRect(hdc, &r); } @@ -2016,7 +2011,6 @@ ERR( "unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcA(hwnd, uMsg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/comctl32/nativefont.c wine-20050111/dlls/comctl32/nativefont.c --- wine-20041201/dlls/comctl32/nativefont.c 2004-11-06 04:49:03.000000000 +0100 +++ wine-20050111/dlls/comctl32/nativefont.c 2005-01-09 17:42:54.000000000 +0100 @@ -106,7 +106,6 @@ uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/comctl32/pager.c wine-20050111/dlls/comctl32/pager.c --- wine-20041201/dlls/comctl32/pager.c 2004-09-20 21:10:43.000000000 +0200 +++ wine-20050111/dlls/comctl32/pager.c 2005-01-09 17:42:54.000000000 +0100 @@ -1368,8 +1368,6 @@ default: return DefWindowProcW (hwnd, uMsg, wParam, lParam); } - - return 0; } diff -urN wine-20041201/dlls/comctl32/propsheet.c wine-20050111/dlls/comctl32/propsheet.c --- wine-20041201/dlls/comctl32/propsheet.c 2004-10-04 22:39:55.000000000 +0200 +++ wine-20050111/dlls/comctl32/propsheet.c 2005-01-09 17:42:54.000000000 +0100 @@ -3690,6 +3690,4 @@ default: return FALSE; } - - return FALSE; } diff -urN wine-20041201/dlls/comctl32/rebar.c wine-20050111/dlls/comctl32/rebar.c --- wine-20041201/dlls/comctl32/rebar.c 2004-11-24 19:28:31.000000000 +0100 +++ wine-20050111/dlls/comctl32/rebar.c 2005-01-09 17:42:54.000000000 +0100 @@ -3786,10 +3786,10 @@ infoPtr->bands = NULL; } - DeleteObject (infoPtr->hcurArrow); - DeleteObject (infoPtr->hcurHorz); - DeleteObject (infoPtr->hcurVert); - DeleteObject (infoPtr->hcurDrag); + DestroyCursor (infoPtr->hcurArrow); + DestroyCursor (infoPtr->hcurHorz); + DestroyCursor (infoPtr->hcurVert); + DestroyCursor (infoPtr->hcurDrag); if(infoPtr->hDefaultFont) DeleteObject (infoPtr->hDefaultFont); SetWindowLongPtrW (infoPtr->hwndSelf, 0, 0); @@ -4696,7 +4696,6 @@ uMsg, wParam, lParam); return DefWindowProcA (hwnd, uMsg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/comctl32/smoothscroll.c wine-20050111/dlls/comctl32/smoothscroll.c --- wine-20041201/dlls/comctl32/smoothscroll.c 2004-02-27 05:40:08.000000000 +0100 +++ wine-20050111/dlls/comctl32/smoothscroll.c 2005-01-09 17:42:54.000000000 +0100 @@ -27,10 +27,7 @@ #include "winbase.h" #include "winreg.h" #include "winerror.h" -#include "wingdi.h" #include "winuser.h" -#include "winnls.h" -#include "commctrl.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(commctrl); @@ -75,7 +72,6 @@ LPRECT lpupdaterect = smooth->lpupdaterect; HRGN hrgnupdate = smooth->hrgnupdate; RECT tmprect; - BOOL ret = TRUE; DWORD flags = smooth->flags; if (smooth->dwSize!=sizeof(SMOOTHSCROLLSTRUCT)) @@ -132,5 +128,4 @@ smooth->lpcliprect,hrgnupdate,lpupdaterect, flags & 0xffff ); - return ret; } diff -urN wine-20041201/dlls/comctl32/status.c wine-20050111/dlls/comctl32/status.c --- wine-20041201/dlls/comctl32/status.c 2004-10-27 23:16:17.000000000 +0200 +++ wine-20050111/dlls/comctl32/status.c 2005-01-09 17:42:54.000000000 +0100 @@ -455,7 +455,7 @@ else part = &infoPtr->parts[nPart]; - if (part->text) + if ((~part->style & SBT_OWNERDRAW) && part->text) result = strlenW(part->text); else result = 0; @@ -1250,7 +1250,6 @@ msg, wParam, lParam); return DefWindowProcW (hwnd, msg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/comctl32/syslink.c wine-20050111/dlls/comctl32/syslink.c --- wine-20041201/dlls/comctl32/syslink.c 2004-11-24 19:28:31.000000000 +0100 +++ wine-20050111/dlls/comctl32/syslink.c 2004-12-23 19:24:50.000000000 +0100 @@ -33,7 +33,6 @@ #include "winuser.h" #include "winnls.h" #include "commctrl.h" -#include "comctl32.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -116,14 +115,8 @@ { if(DocItem->Type == slLink) { - if(DocItem->u.Link.szID != NULL) - { - SYSLINK_Free(DocItem->u.Link.szID); - } - if(DocItem->u.Link.szUrl != NULL) - { - SYSLINK_Free(DocItem->u.Link.szUrl); - } + SYSLINK_Free(DocItem->u.Link.szID); + SYSLINK_Free(DocItem->u.Link.szUrl); } if(DocItem->Type == slLink && DocItem->u.Link.hRgn != NULL) @@ -1637,6 +1630,8 @@ case WM_DESTROY: TRACE("SysLink Ctrl destruction, hwnd=%p\n", hwnd); SYSLINK_ClearDoc(infoPtr); + if(infoPtr->Font != 0) DeleteObject(infoPtr->Font); + if(infoPtr->LinkFont != 0) DeleteObject(infoPtr->LinkFont); SYSLINK_Free (infoPtr); SetWindowLongPtrW(hwnd, 0, 0); return 0; diff -urN wine-20041201/dlls/comctl32/tab.c wine-20050111/dlls/comctl32/tab.c --- wine-20041201/dlls/comctl32/tab.c 2004-10-26 02:22:31.000000000 +0200 +++ wine-20050111/dlls/comctl32/tab.c 2005-01-09 17:42:54.000000000 +0100 @@ -201,6 +201,8 @@ } } +/* RETURNS + * the index of the selected tab, or -1 if no tab is selected. */ static LRESULT TAB_GetCurSel (HWND hwnd) { @@ -209,11 +211,21 @@ return infoPtr->iSelected; } +/* RETURNS + * the index of the tab item that has the focus + * NOTE + * we have not to return negative value + * TODO + * test for windows */ static LRESULT TAB_GetCurFocus (HWND hwnd) { TAB_INFO *infoPtr = TAB_GetInfoPtr(hwnd); - + if (infoPtr->uFocus<0) + { + FIXME("we have not to return negative value"); + return 0; + } return infoPtr->uFocus; } @@ -255,10 +267,10 @@ FIXME("Should set input focus\n"); } else { int oldFocus = infoPtr->uFocus; - if (infoPtr->iSelected != iItem || infoPtr->uFocus == -1 ) { + if (infoPtr->iSelected != iItem || oldFocus == -1 ) { infoPtr->uFocus = iItem; if (oldFocus != -1) { - if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)!=TRUE) { + if (!TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)) { infoPtr->iSelected = iItem; TAB_SendSimpleNotify(hwnd, TCN_SELCHANGE); } @@ -611,7 +623,7 @@ if ((newItem != -1) && (infoPtr->iSelected != newItem)) { - if (TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING) != TRUE) + if (!TAB_SendSimpleNotify(hwnd, TCN_SELCHANGING)) { infoPtr->iSelected = newItem; infoPtr->uFocus = newItem; @@ -3258,8 +3270,6 @@ uMsg, wParam, lParam); return DefWindowProcW(hwnd, uMsg, wParam, lParam); } - - return 0; } diff -urN wine-20041201/dlls/comctl32/tests/.cvsignore wine-20050111/dlls/comctl32/tests/.cvsignore --- wine-20041201/dlls/comctl32/tests/.cvsignore 2004-08-23 00:29:37.000000000 +0200 +++ wine-20050111/dlls/comctl32/tests/.cvsignore 2004-12-10 16:31:38.000000000 +0100 @@ -1,6 +1,7 @@ Makefile dpa.ok imagelist.ok +mru.ok subclass.ok tab.ok testlist.c diff -urN wine-20041201/dlls/comctl32/tests/Makefile.in wine-20050111/dlls/comctl32/tests/Makefile.in --- wine-20041201/dlls/comctl32/tests/Makefile.in 2004-08-23 00:29:37.000000000 +0200 +++ wine-20050111/dlls/comctl32/tests/Makefile.in 2004-12-10 16:31:38.000000000 +0100 @@ -3,11 +3,12 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ TESTDLL = comctl32.dll -IMPORTS = comctl32 user32 gdi32 +IMPORTS = comctl32 shlwapi user32 gdi32 advapi32 CTESTS = \ dpa.c \ imagelist.c \ + mru.c \ subclass.c \ tab.c diff -urN wine-20041201/dlls/comctl32/tests/dpa.c wine-20050111/dlls/comctl32/tests/dpa.c --- wine-20041201/dlls/comctl32/tests/dpa.c 2004-02-06 06:16:32.000000000 +0100 +++ wine-20050111/dlls/comctl32/tests/dpa.c 2004-12-15 11:55:36.000000000 +0100 @@ -22,9 +22,7 @@ #include "windef.h" #include "winbase.h" -#include "wingdi.h" #include "winuser.h" -#include "winnls.h" #include "commctrl.h" #include "wine/test.h" diff -urN wine-20041201/dlls/comctl32/tests/imagelist.c wine-20050111/dlls/comctl32/tests/imagelist.c --- wine-20041201/dlls/comctl32/tests/imagelist.c 2004-10-23 00:27:51.000000000 +0200 +++ wine-20050111/dlls/comctl32/tests/imagelist.c 2004-12-13 22:19:02.000000000 +0100 @@ -81,7 +81,7 @@ ROW48(0,0,0,0,0,0,0,0,0,0,0,0) }; -static HIMAGELIST createImageList(cx, cy) +static HIMAGELIST createImageList(int cx, int cy) { /* Create an ImageList and put an image into it */ HIMAGELIST himl = ImageList_Create(cx, cy, ILC_COLOR, 1, 1); diff -urN wine-20041201/dlls/comctl32/tests/mru.c wine-20050111/dlls/comctl32/tests/mru.c --- wine-20041201/dlls/comctl32/tests/mru.c 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050111/dlls/comctl32/tests/mru.c 2004-12-10 16:31:38.000000000 +0100 @@ -0,0 +1,295 @@ +/* + * comctl32 MRU unit tests + * + * Copyright (C) 2004 Jon Griffiths + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +#include + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winnls.h" +#include "winreg.h" +#include "commctrl.h" +#include "shlwapi.h" + +#include "wine/test.h" + +/* Keys for testing MRU functions */ +#define REG_TEST_BASEKEYA "Software\\Wine" +#define REG_TEST_BASESUBKEYA "Test" +#define REG_TEST_KEYA REG_TEST_BASEKEYA "\\" REG_TEST_BASESUBKEYA +#define REG_TEST_SUBKEYA "MRUTest" +#define REG_TEST_FULLKEY REG_TEST_KEYA "\\" REG_TEST_SUBKEYA + +/* Undocumented MRU structures & functions */ +typedef struct tagCREATEMRULISTA +{ + DWORD cbSize; + DWORD nMaxItems; + DWORD dwFlags; + HKEY hKey; + LPCSTR lpszSubKey; + PROC lpfnCompare; +} CREATEMRULISTA, *LPCREATEMRULISTA; + +#define MRUF_STRING_LIST 0 +#define MRUF_BINARY_LIST 1 +#define MRUF_DELAYED_SAVE 2 + +#define LIST_SIZE 3 /* Max entries for each mru */ + +static CREATEMRULISTA mruA = +{ + sizeof(CREATEMRULISTA), + LIST_SIZE, + 0, + NULL, + REG_TEST_SUBKEYA, + NULL +}; + +static HMODULE hComctl32; +static HANDLE (WINAPI *pCreateMRUListA)(LPCREATEMRULISTA); +static void (WINAPI *pFreeMRUList)(HANDLE); +static INT (WINAPI *pAddMRUStringA)(HANDLE,LPCSTR); +/* +static INT (WINAPI *pFindMRUStringA)(HANDLE,LPCSTR,LPINT); +static INT (WINAPI *pEnumMRUList)(HANDLE,INT,LPVOID,DWORD); +*/ + +static BOOL create_reg_entries(void) +{ + HKEY hKey = NULL; + + ok(!RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_FULLKEY, &hKey), + "Couldn't create test key \"%s\"\n", REG_TEST_KEYA); + if (!hKey) return FALSE; + RegCloseKey(hKey); + return TRUE; +} + +static void delete_reg_entries(void) +{ + HKEY hKey; + + if (RegOpenKeyExA(HKEY_CURRENT_USER, REG_TEST_BASEKEYA, 0, KEY_ALL_ACCESS, + &hKey)) + return; + SHDeleteKeyA(hKey, REG_TEST_BASESUBKEYA); + RegCloseKey(hKey); +} + +static void check_reg_entries(const char *mrulist, const char**items) +{ + char buff[128]; + HKEY hKey = NULL; + DWORD type, size, ret; + size_t i; + + ok(!RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_FULLKEY, &hKey), + "Couldn't open test key \"%s\"\n", REG_TEST_FULLKEY); + if (!hKey) return; + + type = REG_SZ; + size = sizeof(buff); + buff[0] = '\0'; + ret = RegQueryValueExA(hKey, "MRUList", NULL, &type, (LPBYTE)buff, &size); + + ok(!ret && buff[0], "Checking MRU: got %ld from RegQueryValueExW\n", ret); + if(ret || !buff[0]) return; + + ok(strcmp(buff, mrulist) == 0, "Checking MRU: Expected list %s, got %s\n", + mrulist, buff); + if(strcmp(buff, mrulist)) return; + + for (i = 0; i < strlen(mrulist); i++) + { + char name[2]; + name[0] = mrulist[i]; + name[1] = '\0'; + type = REG_SZ; + size = sizeof(buff); + buff[0] = '\0'; + ret = RegQueryValueExA(hKey, name, NULL, &type, (LPBYTE)buff, &size); + ok(!ret && buff[0], + "Checking MRU item %d ('%c'): got %ld from RegQueryValueExW\n", + i, mrulist[i], ret); + if(ret || !buff[0]) return; + ok(!strcmp(buff, items[mrulist[i]-'a']), + "Checking MRU item %d ('%c'): expected \"%s\", got \"%s\"\n", + i, mrulist[i], buff, items[mrulist[i] - 'a']); + } +} + +static INT CALLBACK cmp_mru_strA(LPCVOID data1, LPCVOID data2) +{ + return lstrcmpiA(data1, data2); +} + +static HANDLE create_mruA(HKEY hKey, DWORD flags, PROC cmp) +{ + mruA.dwFlags = flags; + mruA.lpfnCompare = cmp; + mruA.hKey = hKey; + + SetLastError(0); + return pCreateMRUListA(&mruA); +} + +static void test_MRUListA(void) +{ + const char *checks[LIST_SIZE+1]; + HANDLE hMRU; + HKEY hKey; + INT iRet; + + pCreateMRUListA = (void*)GetProcAddress(hComctl32,(LPCSTR)151); + pFreeMRUList = (void*)GetProcAddress(hComctl32,(LPCSTR)152); + pAddMRUStringA = (void*)GetProcAddress(hComctl32,(LPCSTR)153); + if (!pCreateMRUListA || !pFreeMRUList || !pAddMRUStringA) + return; + +#if 0 /* Create (NULL) - crashes native */ + hMRU = pCreateMRUListA(NULL); +#endif + + /* Create (size too small) */ + mruA.cbSize = sizeof(mruA) - 2; + hMRU = create_mruA(NULL, MRUF_STRING_LIST, cmp_mru_strA); + ok (!hMRU && !GetLastError(), + "CreateMRUListA(too small) expected NULL,0 got %p,%ld\n", + hMRU, GetLastError()); + mruA.cbSize = sizeof(mruA); + + /* Create (size too big) */ + mruA.cbSize = sizeof(mruA) + 2; + hMRU = create_mruA(NULL, MRUF_STRING_LIST, cmp_mru_strA); + ok (!hMRU && !GetLastError(), + "CreateMRUListA(too big) expected NULL,0 got %p,%ld\n", + hMRU, GetLastError()); + mruA.cbSize = sizeof(mruA); + + /* Create (NULL hKey) */ + hMRU = create_mruA(NULL, MRUF_STRING_LIST, cmp_mru_strA); + ok (!hMRU && !GetLastError(), + "CreateMRUListA(NULL key) expected NULL,0 got %p,%ld\n", + hMRU, GetLastError()); + + /* Create (NULL name) */ + mruA.lpszSubKey = NULL; + hMRU = create_mruA(NULL, MRUF_STRING_LIST, cmp_mru_strA); + ok (!hMRU && !GetLastError(), + "CreateMRUListA(NULL name) expected NULL,0 got %p,%ld\n", + hMRU, GetLastError()); + mruA.lpszSubKey = REG_TEST_SUBKEYA; + + /* Create a string MRU */ + ok(!RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEYA, &hKey), + "Couldn't create test key \"%s\"\n", REG_TEST_KEYA); + if (!hKey) + return; + hMRU = create_mruA(hKey, MRUF_STRING_LIST, cmp_mru_strA); + ok(hMRU && !GetLastError(), + "CreateMRUListA(string) expected non-NULL,0 got %p,%ld\n", + hMRU, GetLastError()); + + if (hMRU) + { + checks[0] = "Test 1"; + checks[1] = "Test 2"; + checks[2] = "Test 3"; + checks[3] = "Test 4"; + + /* Add (NULL list) */ + SetLastError(0); + iRet = pAddMRUStringA(NULL, checks[0]); + ok(iRet == -1 && !GetLastError(), + "AddMRUStringA(NULL list) expected -1,0 got %d,%ld\n", + iRet, GetLastError()); + + /* Add (NULL string) */ + SetLastError(0); + iRet = pAddMRUStringA(hMRU, NULL); + ok(iRet == 0 && GetLastError() == ERROR_INVALID_PARAMETER, + "AddMRUStringA(NULL str) expected 0,ERROR_INVALID_PARAMETER got %d,%ld\n", + iRet, GetLastError()); + + /* Add 3 strings. Check the registry is correct after each add */ + SetLastError(0); + iRet = pAddMRUStringA(hMRU, checks[0]); + ok(iRet == 0 && !GetLastError(), + "AddMRUStringA(1) expected 0,0 got %d,%ld\n", + iRet, GetLastError()); + check_reg_entries("a", checks); + + SetLastError(0); + iRet = pAddMRUStringA(hMRU, checks[1]); + ok(iRet == 1 && !GetLastError(), + "AddMRUStringA(2) expected 1,0 got %d,%ld\n", + iRet, GetLastError()); + check_reg_entries("ba", checks); + + SetLastError(0); + iRet = pAddMRUStringA(hMRU, checks[2]); + ok(iRet == 2 && !GetLastError(), + "AddMRUStringA(2) expected 2,0 got %d,%ld\n", + iRet, GetLastError()); + check_reg_entries("cba", checks); + + /* Add a duplicate of the 2nd string - it should move to the front, + * but keep the same index in the registry. + */ + SetLastError(0); + iRet = pAddMRUStringA(hMRU, checks[1]); + ok(iRet == 1 && !GetLastError(), + "AddMRUStringA(re-add 1) expected 1,0 got %d,%ld\n", + iRet, GetLastError()); + check_reg_entries("bca", checks); + + /* Add a new string - replaces the oldest string + moves to the front */ + SetLastError(0); + iRet = pAddMRUStringA(hMRU, checks[3]); + ok(iRet == 0 && !GetLastError(), + "AddMRUStringA(add new) expected 0,0 got %d,%ld\n", + iRet, GetLastError()); + checks[0] = checks[3]; + check_reg_entries("abc", checks); + + /* Finished with this MRU */ + pFreeMRUList(hMRU); + } + + /* Free (NULL list) - Doesn't crash */ + pFreeMRUList(NULL); +} + +START_TEST(mru) +{ + hComctl32 = GetModuleHandleA("comctl32.dll"); + if (!hComctl32) + return; + + delete_reg_entries(); + if (!create_reg_entries()) + return; + + test_MRUListA(); + + delete_reg_entries(); +} diff -urN wine-20041201/dlls/comctl32/toolbar.c wine-20050111/dlls/comctl32/toolbar.c --- wine-20041201/dlls/comctl32/toolbar.c 2004-11-30 18:28:10.000000000 +0100 +++ wine-20050111/dlls/comctl32/toolbar.c 2005-01-09 17:42:54.000000000 +0100 @@ -5522,8 +5522,7 @@ DestroyWindow (infoPtr->hwndToolTip); /* delete temporary buffer for tooltip text */ - if (infoPtr->pszTooltipText) - HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText); + HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText); /* delete button data */ if (infoPtr->buttons) @@ -6275,11 +6274,8 @@ TRACE("button index = %d\n", index); - if (infoPtr->pszTooltipText) - { - HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText); - infoPtr->pszTooltipText = NULL; - } + HeapFree(GetProcessHeap(), 0, infoPtr->pszTooltipText); + infoPtr->pszTooltipText = NULL; if (index < 0) return 0; @@ -7101,7 +7097,6 @@ uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/comctl32/tooltips.c wine-20050111/dlls/comctl32/tooltips.c --- wine-20041201/dlls/comctl32/tooltips.c 2004-10-25 23:44:50.000000000 +0200 +++ wine-20050111/dlls/comctl32/tooltips.c 2005-01-09 17:42:54.000000000 +0100 @@ -1400,8 +1400,6 @@ } else return (infoPtr->nCurrentTool != -1); - - return FALSE; } @@ -1438,8 +1436,6 @@ } else return (infoPtr->nCurrentTool != -1); - - return FALSE; } @@ -2802,7 +2798,6 @@ uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } - return 0; } @@ -2836,7 +2831,7 @@ TOOLTIPS_Unregister (void) { int i; - for (i = 0; i < TTI_ERROR+1; i++) - DeleteObject(hTooltipIcons[i]); + for (i = TTI_INFO; i <= TTI_ERROR; i++) + DestroyIcon(hTooltipIcons[i]); UnregisterClassW (TOOLTIPS_CLASSW, NULL); } diff -urN wine-20041201/dlls/comctl32/trackbar.c wine-20050111/dlls/comctl32/trackbar.c --- wine-20041201/dlls/comctl32/trackbar.c 2004-11-24 19:28:31.000000000 +0100 +++ wine-20050111/dlls/comctl32/trackbar.c 2005-01-09 17:42:54.000000000 +0100 @@ -1810,7 +1810,6 @@ ERR("unknown msg %04x wp=%08x lp=%08lx\n", uMsg, wParam, lParam); return DefWindowProcW (hwnd, uMsg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/comctl32/treeview.c wine-20050111/dlls/comctl32/treeview.c --- wine-20041201/dlls/comctl32/treeview.c 2004-11-21 16:41:08.000000000 +0100 +++ wine-20050111/dlls/comctl32/treeview.c 2005-01-11 11:39:33.000000000 +0100 @@ -31,7 +31,6 @@ * TVN_SETDISPINFO, TVN_SINGLEEXPAND * * missing styles: TVS_FULLROWSELECT, TVS_INFOTIP, TVS_RTLREADING, - * TVS_TRACKSELECT * * missing item styles: TVIS_CUT, TVIS_EXPANDPARTIAL * @@ -132,6 +131,8 @@ HFONT hFont; HFONT hDefaultFont; HFONT hBoldFont; + HFONT hUnderlineFont; + HCURSOR hcurHand; HWND hwndToolTip; HWND hwndEdit; @@ -263,10 +264,24 @@ return CreateFontIndirectW(&font); } +static HFONT +TREEVIEW_CreateUnderlineFont(HFONT hOrigFont) +{ + LOGFONTW font; + + GetObjectW(hOrigFont, sizeof(font), &font); + font.lfUnderline = TRUE; + return CreateFontIndirectW(&font); +} + static inline HFONT TREEVIEW_FontForItem(TREEVIEW_INFO *infoPtr, TREEVIEW_ITEM *item) { - return (item->state & TVIS_BOLD) ? infoPtr->hBoldFont : infoPtr->hFont; + if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (item == infoPtr->hotItem)) + return infoPtr->hUnderlineFont; + if (item->state & TVIS_BOLD) + return infoPtr->hBoldFont; + return infoPtr->hFont; } /* for trace/debugging purposes only */ @@ -1814,6 +1829,7 @@ DeleteObject(infoPtr->hBoldFont); infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont); + infoPtr->hUnderlineFont = TREEVIEW_CreateUnderlineFont(infoPtr->hFont); if (!infoPtr->bHeightSet) infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr); @@ -2486,7 +2502,9 @@ } else { - if (infoPtr->clrText == -1) + if ((infoPtr->dwStyle & TVS_TRACKSELECT) && (wineItem == infoPtr->hotItem)) + oldTextColor = SetTextColor(hdc, comctl32_color.clrHighlight); + else if (infoPtr->clrText == -1) oldTextColor = SetTextColor(hdc, GetSysColor(COLOR_WINDOWTEXT)); else @@ -3177,7 +3195,7 @@ TREEVIEW_UpdateScrollBars(infoPtr); /* Scroll up so that as many children as possible are visible. - * This looses when expanding causes an HScroll bar to appear, but we + * This fails when expanding causes an HScroll bar to appear, but we * don't know that yet, so the last item is obscured. */ if (wineItem->firstChild != NULL) { @@ -4112,9 +4130,6 @@ case TVGN_CARET: prevSelect = infoPtr->selectedItem; - if (prevSelect == newSelect) - return FALSE; - if (TREEVIEW_SendTreeviewNotify(infoPtr, TVN_SELCHANGINGW, cause, @@ -4701,7 +4716,6 @@ infoPtr->hwnd = hwnd; infoPtr->dwStyle = GetWindowLongW(hwnd, GWL_STYLE); - infoPtr->uInternalStatus = 0; infoPtr->Timer = 0; infoPtr->uNumItems = 0; infoPtr->cdmode = 0; @@ -4713,6 +4727,7 @@ /* No scroll bars yet. */ infoPtr->clientWidth = rcClient.right; infoPtr->clientHeight = rcClient.bottom; + infoPtr->uInternalStatus = 0; infoPtr->treeWidth = 0; infoPtr->treeHeight = 0; @@ -4754,6 +4769,8 @@ SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0); infoPtr->hFont = infoPtr->hDefaultFont = CreateFontIndirectW(&lf); infoPtr->hBoldFont = TREEVIEW_CreateBoldFont(infoPtr->hFont); + infoPtr->hUnderlineFont = TREEVIEW_CreateUnderlineFont(infoPtr->hFont); + infoPtr->hcurHand = LoadCursorW(NULL, (LPWSTR)IDC_HAND); infoPtr->uItemHeight = TREEVIEW_NaturalHeight(infoPtr); @@ -4821,6 +4838,11 @@ infoPtr->stateImageWidth = 16; infoPtr->stateImageHeight = 16; } + + /* Make sure actual scrollbar state is consistent with uInternalStatus */ + ShowScrollBar(hwnd, SB_VERT, FALSE); + ShowScrollBar(hwnd, SB_HORZ, FALSE); + return 0; } @@ -4844,6 +4866,7 @@ DeleteObject(infoPtr->hDefaultFont); DeleteObject(infoPtr->hBoldFont); + DeleteObject(infoPtr->hUnderlineFont); Free(infoPtr); return 0; @@ -5012,6 +5035,63 @@ } static LRESULT +TREEVIEW_MouseLeave (TREEVIEW_INFO * infoPtr) +{ + if (infoPtr->hotItem) + { + /* remove hot effect from item */ + InvalidateRect(infoPtr->hwnd, &infoPtr->hotItem->rect, TRUE); + infoPtr->hotItem = NULL; + } + return 0; +} + +static LRESULT +TREEVIEW_MouseMove (TREEVIEW_INFO * infoPtr, WPARAM wParam, LPARAM lParam) +{ + POINT pt; + TRACKMOUSEEVENT trackinfo; + TREEVIEW_ITEM * item; + + /* fill in the TRACKMOUSEEVENT struct */ + trackinfo.cbSize = sizeof(TRACKMOUSEEVENT); + trackinfo.dwFlags = TME_QUERY; + trackinfo.hwndTrack = infoPtr->hwnd; + trackinfo.dwHoverTime = HOVER_DEFAULT; + + /* call _TrackMouseEvent to see if we are currently tracking for this hwnd */ + _TrackMouseEvent(&trackinfo); + + /* Make sure tracking is enabled so we receive a WM_MOUSELEAVE message */ + if(!(trackinfo.dwFlags & TME_LEAVE)) + { + trackinfo.dwFlags = TME_LEAVE; /* notify upon leaving */ + + /* call TRACKMOUSEEVENT so we receive a WM_MOUSELEAVE message */ + /* and can properly deactivate the hot item */ + _TrackMouseEvent(&trackinfo); + } + + pt.x = (INT)LOWORD(lParam); + pt.y = (INT)HIWORD(lParam); + + item = TREEVIEW_HitTestPoint(infoPtr, pt); + + if (item != infoPtr->hotItem) + { + /* redraw old hot item */ + if (infoPtr->hotItem) + InvalidateRect(infoPtr->hwnd, &infoPtr->hotItem->rect, TRUE); + infoPtr->hotItem = item; + /* redraw new hot item */ + if (infoPtr->hotItem) + InvalidateRect(infoPtr->hwnd, &infoPtr->hotItem->rect, TRUE); + } + + return 0; +} + +static LRESULT TREEVIEW_Notify(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { LPNMHDR lpnmh = (LPNMHDR)lParam; @@ -5108,6 +5188,28 @@ } static LRESULT +TREEVIEW_SetCursor(TREEVIEW_INFO *infoPtr, WPARAM wParam, LPARAM lParam) +{ + POINT pt; + TREEVIEW_ITEM * item; + + GetCursorPos(&pt); + ScreenToClient(infoPtr->hwnd, &pt); + + item = TREEVIEW_HitTestPoint(infoPtr, pt); + + /* FIXME: send NM_SETCURSOR */ + + if (item && (infoPtr->dwStyle & TVS_TRACKSELECT)) + { + SetCursor(infoPtr->hcurHand); + return 0; + } + else + return DefWindowProcW(infoPtr->hwnd, WM_SETCURSOR, wParam, lParam); +} + +static LRESULT TREEVIEW_SetFocus(TREEVIEW_INFO *infoPtr) { TRACE("\n"); @@ -5329,7 +5431,11 @@ /* WM_MBUTTONDOWN */ - /* WM_MOUSEMOVE */ + case WM_MOUSELEAVE: + return TREEVIEW_MouseLeave(infoPtr); + + case WM_MOUSEMOVE: + return TREEVIEW_MouseMove(infoPtr, wParam, lParam); case WM_NOTIFY: return TREEVIEW_Notify(infoPtr, wParam, lParam); @@ -5345,6 +5451,9 @@ case WM_RBUTTONDOWN: return TREEVIEW_RButtonDown(infoPtr, lParam); + case WM_SETCURSOR: + return TREEVIEW_SetCursor(infoPtr, wParam, lParam); + case WM_SETFOCUS: return TREEVIEW_SetFocus(infoPtr); @@ -5388,7 +5497,6 @@ def: return DefWindowProcA(hwnd, uMsg, wParam, lParam); } - return 0; } diff -urN wine-20041201/dlls/commdlg/cdlg.h wine-20050111/dlls/commdlg/cdlg.h --- wine-20041201/dlls/commdlg/cdlg.h 2003-12-30 23:08:17.000000000 +0100 +++ wine-20050111/dlls/commdlg/cdlg.h 2005-01-09 17:31:36.000000000 +0100 @@ -93,7 +93,7 @@ #define PD32_DEFAULT_PRINTER 1582 #define PD32_NR_OF_DOCUMENTS_IN_QUEUE 1583 -#define PD32_PRINT_ALL_X_PAGES 1584 + #define PD32_MARGINS_IN_INCHES 1585 #define PD32_MARGINS_IN_MILIMETERS 1586 #define PD32_MILIMETERS 1587 @@ -145,6 +145,13 @@ #define IDS_COLOR_AQUA 1054 #define IDS_COLOR_WHITE 1055 +#define IDS_FONT_SIZE 1200 +#define IDS_SAVE_BUTTON 1201 +#define IDS_SAVE_IN 1202 +#define IDS_SAVE 1203 +#define IDS_SAVE_AS 1204 +#define IDS_OPEN_FILE 1205 + #include "windef.h" #include "winbase.h" #include "wingdi.h" @@ -199,26 +206,25 @@ { HWND hWnd1; HWND hWnd2; - LPCHOOSEFONTA lpcf32a; + LPCHOOSEFONTW lpcf32w; int added; } CFn_ENUMSTRUCT, *LPCFn_ENUMSTRUCT; -INT AddFontFamily(const ENUMLOGFONTEXA *lpElfex, const NEWTEXTMETRICEXA *lpNTM, - UINT nFontType, LPCHOOSEFONTA lpcf, HWND hwnd, +INT AddFontFamily(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, + UINT nFontType, LPCHOOSEFONTW lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e); -INT AddFontStyle(const ENUMLOGFONTEXA *lpElfex, const NEWTEXTMETRICEXA *metrics, - UINT nFontType, LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, +INT AddFontStyle(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *metrics, + UINT nFontType, LPCHOOSEFONTW lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg, BOOL iswin16); void _dump_cf_flags(DWORD cflags); LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf); + LPCHOOSEFONTW lpcf); LRESULT CFn_WMMeasureItem(HWND hDlg, WPARAM wParam, LPARAM lParam); LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam); LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf); + LPCHOOSEFONTW lpcf); LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf); -LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam); + LPCHOOSEFONTW lpcf); #endif /* _WINE_DLL_CDLG_H */ diff -urN wine-20041201/dlls/commdlg/cdlg_Cn.rc wine-20050111/dlls/commdlg/cdlg_Cn.rc --- wine-20041201/dlls/commdlg/cdlg_Cn.rc 2004-08-24 20:33:04.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Cn.rc 2005-01-04 21:35:24.000000000 +0100 @@ -300,9 +300,9 @@ CAPTION "ŇłĂćÉčÖĂ" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "Ö˝ŐĹ", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "´óĐĄ(&S):", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -408,7 +408,6 @@ PD32_DEFAULT_PRINTER "Default Printer; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "There are %d documents in the queue" - PD32_PRINT_ALL_X_PAGES "&All %d pages" PD32_MARGINS_IN_INCHES "Margins [inches]" PD32_MARGINS_IN_MILIMETERS "Margins [mm]" PD32_MILIMETERS "mm" diff -urN wine-20041201/dlls/commdlg/cdlg_De.rc wine-20050111/dlls/commdlg/cdlg_De.rc --- wine-20041201/dlls/commdlg/cdlg_De.rc 2004-08-24 20:33:04.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_De.rc 2005-01-04 21:35:24.000000000 +0100 @@ -120,9 +120,9 @@ CAPTION "Seite einrichten" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "Papier", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "&Größe:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -402,7 +402,6 @@ PD32_DEFAULT_PRINTER "Standard Drucker; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "Es sind %d Dokumente in der Queue" - PD32_PRINT_ALL_X_PAGES "&Alle %d Seiten" PD32_MARGINS_IN_INCHES "Ränder [inches/zoll]" PD32_MARGINS_IN_MILIMETERS "Ränder [mm]" PD32_MILIMETERS "mm" diff -urN wine-20041201/dlls/commdlg/cdlg_En.rc wine-20050111/dlls/commdlg/cdlg_En.rc --- wine-20041201/dlls/commdlg/cdlg_En.rc 2004-08-24 20:33:04.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_En.rc 2005-01-09 17:31:36.000000000 +0100 @@ -300,9 +300,9 @@ CAPTION "Setup Page" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "Paper", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "&Size:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -408,7 +408,6 @@ PD32_DEFAULT_PRINTER "Default Printer; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "There are %d documents in the queue" - PD32_PRINT_ALL_X_PAGES "&All %d pages" PD32_MARGINS_IN_INCHES "Margins [inches]" PD32_MARGINS_IN_MILIMETERS "Margins [mm]" PD32_MILIMETERS "mm" @@ -461,6 +460,15 @@ IDS_COLOR_WHITE "White" } +STRINGTABLE DISCARDABLE +{ + IDS_FONT_SIZE "Select a font size between %d and %d points." + IDS_SAVE_BUTTON "&Save" + IDS_SAVE_IN "Save &in:" + IDS_SAVE "Save" + IDS_SAVE_AS "Save as" + IDS_OPEN_FILE "Open File" +} /****************************************************************/ /* English neutral resources diff -urN wine-20041201/dlls/commdlg/cdlg_Es.rc wine-20050111/dlls/commdlg/cdlg_Es.rc --- wine-20041201/dlls/commdlg/cdlg_Es.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Es.rc 2005-01-09 17:33:26.000000000 +0100 @@ -1,6 +1,6 @@ /* * Copyright 1995 Jon Tombs - * Copyright 2004 José Manuel Ferrer Ortiz + * Copyright 2004, 2005 José Manuel Ferrer Ortiz * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -139,7 +139,7 @@ CHECKBOX "&Subrayado", chx2, 10,94,50,10, BS_AUTOCHECKBOX LTEXT "&Color:", stc4 ,6,110,30,9 COMBOBOX cmb4,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | - CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP + CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP GROUPBOX "Ejemplo",grp2,98,72,120,36,WS_GROUP CTEXT "AaBbYyZzŃń",stc5,103,80,109,24,SS_NOPREFIX | NOT WS_VISIBLE LTEXT "Codificación:",stc7 ,98,114,80,9 @@ -155,7 +155,7 @@ { LTEXT "Colores &básicos:", 1088, 4, 4, 140, 10 LTEXT "Colores person&alizados:", 1089, 4, 106, 140, 10 - LTEXT "Color|Sól&ido", 1090, 150, 151, 48, 10 + LTEXT "Color | Sól&ido", 1090, 150, 151, 48, 10 LTEXT "&Rojo:", 726 /*1094*/,249,126,24,10 EDITTEXT 706, 275,124,21,12, WS_BORDER | WS_GROUP | WS_TABSTOP LTEXT "&Verde:",727/*1095*/,249,140,24,10 @@ -178,7 +178,7 @@ PUSHBUTTON "A&yuda", pshHelp,100,166, 44, 14 PUSHBUTTON "Ańadir a &colores personalizados", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP PUSHBUTTON "&Definir colores personalizados >>", 719/*1025*/, 4, 150, 142, 14, WS_GROUP | WS_TABSTOP - PUSHBUTTON "&i",713,300,200,4,14 /* just a dummy: 'i' is like &i in "sol&id" */ + PUSHBUTTON "&i",713,300,200,4,14 /* just a dummy: 'i' is like &i in "sol&id" */ } @@ -267,7 +267,7 @@ BEGIN DEFPUSHBUTTON "Aceptar",IDOK,180,156,48,14,WS_GROUP PUSHBUTTON "Cancelar",IDCANCEL,232,156,48,14 -/* PUSHBUTTON "Network...", psh5, 284,156,48,14 */ +/* PUSHBUTTON "Red...", psh5, 284,156,48,14 */ GROUPBOX "Impresora", grp4, 8, 4, 272,84, WS_GROUP PUSHBUTTON "&Propiedades", psh2, 212, 17, 60,14, WS_GROUP @@ -299,9 +299,9 @@ CAPTION "Página de configuración" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "Papel", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "&Tamańo:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -409,7 +409,6 @@ PD32_DEFAULT_PRINTER "Impresora por defecto; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "Hay %d documentos en la cola" - PD32_PRINT_ALL_X_PAGES "&Todas las %d páginas" PD32_MARGINS_IN_INCHES "Márgenes [pulgadas]" PD32_MARGINS_IN_MILIMETERS "Márgenes [mm]" PD32_MILIMETERS "mm" @@ -418,7 +417,7 @@ PD32_PRINTER_STATUS_PAUSED "Pausada; " PD32_PRINTER_STATUS_ERROR "Error; " PD32_PRINTER_STATUS_PENDING_DELETION "Borrado pendiente; " - PD32_PRINTER_STATUS_PAPER_JAM "Paper jam; " + PD32_PRINTER_STATUS_PAPER_JAM "Papel atascado; " PD32_PRINTER_STATUS_PAPER_OUT "Sin papel; " PD32_PRINTER_STATUS_MANUAL_FEED "Ponga papel a mano; " PD32_PRINTER_STATUS_PAPER_PROBLEM "Problema con el papel; " @@ -451,7 +450,7 @@ IDS_COLOR_OLIVE "Oliva" IDS_COLOR_NAVY "Azul marino" IDS_COLOR_PURPLE "Morado" - IDS_COLOR_TEAL "Teal" + IDS_COLOR_TEAL "Turquesa" IDS_COLOR_GRAY "Gris" IDS_COLOR_SILVER "Plateado" IDS_COLOR_RED "Rojo" @@ -462,3 +461,8 @@ IDS_COLOR_AQUA "Agua" IDS_COLOR_WHITE "Blanco" } + +STRINGTABLE DISCARDABLE +{ + IDS_FONT_SIZE "Elija un tamańo de fuente entre %d and %d puntos." +} diff -urN wine-20041201/dlls/commdlg/cdlg_Fr.rc wine-20050111/dlls/commdlg/cdlg_Fr.rc --- wine-20041201/dlls/commdlg/cdlg_Fr.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Fr.rc 2005-01-04 21:35:24.000000000 +0100 @@ -303,9 +303,9 @@ CAPTION "Mise en page" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "Papier", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "&Taille:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -411,7 +411,6 @@ PD32_DEFAULT_PRINTER "Imprimante par défaut; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "Il y a %d documents dans la file d'attente" - PD32_PRINT_ALL_X_PAGES "&Toutes les %d pages" PD32_MARGINS_IN_INCHES "Marges [pouces]" PD32_MARGINS_IN_MILIMETERS "Marges [mm]" PD32_MILIMETERS "mm" diff -urN wine-20041201/dlls/commdlg/cdlg_It.rc wine-20050111/dlls/commdlg/cdlg_It.rc --- wine-20041201/dlls/commdlg/cdlg_It.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_It.rc 2005-01-04 21:35:24.000000000 +0100 @@ -300,9 +300,9 @@ CAPTION "Setup di Pagina" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "Carta", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "&Dimensione:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -407,7 +407,6 @@ PD32_DEFAULT_PRINTER "Stampante predefinita; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "Ci sono %d documenti nella coda di stampa" - PD32_PRINT_ALL_X_PAGES "&Tutte le %d pagine" PD32_MARGINS_IN_INCHES "Margini [pollici]" PD32_MARGINS_IN_MILIMETERS "Margini [mm]" PD32_MILIMETERS "mm" diff -urN wine-20041201/dlls/commdlg/cdlg_Nl.rc wine-20050111/dlls/commdlg/cdlg_Nl.rc --- wine-20041201/dlls/commdlg/cdlg_Nl.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Nl.rc 2004-12-22 15:59:50.000000000 +0100 @@ -251,7 +251,7 @@ EDITTEXT edt3, 240,106, 32,12, WS_GROUP | ES_NUMBER GROUPBOX "Afdrukbereik", grp1, 8,92, 144,64, WS_GROUP - CONTROL "&Alle xx", rad1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,16,106,64,12 + CONTROL "&Alle", rad1,"Button",BS_AUTORADIOBUTTON | WS_GROUP | WS_TABSTOP,16,106,64,12 CONTROL "&Pagina's", rad3,"Button",BS_AUTORADIOBUTTON,16,122,36,12 CONTROL "Sele&ctie", rad2,"Button",BS_AUTORADIOBUTTON,16,138,64,12 EDITTEXT edt1, 74,122, 26,12, WS_GROUP | ES_NUMBER @@ -289,7 +289,6 @@ PD32_DEFAULT_PRINTER "Default Printer, " PD32_NR_OF_DOCUMENTS_IN_QUEUE "Er staan %d documenten in de \ wachtrij" - PD32_PRINT_ALL_X_PAGES "&Alle %d pagina's" PD32_MARGINS_IN_INCHES "Marges [inch]" PD32_MARGINS_IN_MILIMETERS "Marges [mm]" PD32_MILIMETERS "mm" diff -urN wine-20041201/dlls/commdlg/cdlg_Pl.rc wine-20050111/dlls/commdlg/cdlg_Pl.rc --- wine-20041201/dlls/commdlg/cdlg_Pl.rc 2004-10-05 20:09:34.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Pl.rc 2005-01-09 17:31:36.000000000 +0100 @@ -302,9 +302,9 @@ CAPTION "Ustawienia Strony" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "Papier", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "&Rozmiar:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -405,7 +405,6 @@ PD32_DEFAULT_PRINTER "Domyœlna Drukarka; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "W kolejce znajdujš się %d dokumenty" - PD32_PRINT_ALL_X_PAGES "&Wszystkie %d strony" PD32_MARGINS_IN_INCHES "Marginesy [cale]" PD32_MARGINS_IN_MILIMETERS "Marginesy [mm]" PD32_MILIMETERS "mm" @@ -437,6 +436,16 @@ PD32_PRINTER_STATUS_POWER_SAVE "Tryb oszczędzania energii; " } +STRINGTABLE DISCARDABLE +{ + IDS_FONT_SIZE "Wybierz czcionkę o rozmiarze pomiędzy %d a %d punktami." + IDS_SAVE_BUTTON "&Zapisz" + IDS_SAVE_IN "Zapisz &w:" + IDS_SAVE "Zapisz" + IDS_SAVE_AS "Zapisz jako" + IDS_OPEN_FILE "Otwórz Plik" +} + STRINGTABLE DISCARDABLE /* Color names */ { IDS_COLOR_BLACK "Czarny" diff -urN wine-20041201/dlls/commdlg/cdlg_Pt.rc wine-20050111/dlls/commdlg/cdlg_Pt.rc --- wine-20041201/dlls/commdlg/cdlg_Pt.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Pt.rc 2005-01-04 21:35:24.000000000 +0100 @@ -301,9 +301,9 @@ CAPTION "Configuraçőes de Página" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "Papel", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "&Tamanho:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -407,7 +407,6 @@ PD32_DEFAULT_PRINTER "Impressora Padrăo; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "Existem %d documentos na fila" - PD32_PRINT_ALL_X_PAGES "&Todas %d páginas" PD32_MARGINS_IN_INCHES "Margens [polegadas]" PD32_MARGINS_IN_MILIMETERS "Margens [mm]" PD32_MILIMETERS "mm" diff -urN wine-20041201/dlls/commdlg/cdlg_Ru.rc wine-20050111/dlls/commdlg/cdlg_Ru.rc --- wine-20041201/dlls/commdlg/cdlg_Ru.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Ru.rc 2004-12-22 15:59:50.000000000 +0100 @@ -376,7 +376,6 @@ PD32_DEFAULT_PRINTER "Ďđčíňĺđ ďî óěîë÷ŕíčţ; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "%d äîęóěĺíňîâ â î÷ĺđĺäč" - PD32_PRINT_ALL_X_PAGES "&Âńĺ %d ńňđŕíčö" PD32_MARGINS_IN_INCHES "Ăđŕíčöű [äţéěű)" PD32_MARGINS_IN_MILIMETERS "Ăđŕíčöű [ěě]" PD32_MILIMETERS "ěě" diff -urN wine-20041201/dlls/commdlg/cdlg_Si.rc wine-20050111/dlls/commdlg/cdlg_Si.rc --- wine-20041201/dlls/commdlg/cdlg_Si.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Si.rc 2005-01-04 21:35:24.000000000 +0100 @@ -300,9 +300,9 @@ CAPTION "Priprava strani" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "Papir", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "Veli&kost:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -405,7 +405,6 @@ PD32_DEFAULT_PRINTER "Privzeti tiskalnik; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "%d čakajočih dok." - PD32_PRINT_ALL_X_PAGES "&Vse strani -- %d" PD32_MARGINS_IN_INCHES "Robovi [palci]" PD32_MARGINS_IN_MILIMETERS "Robovi [mm]" PD32_MILIMETERS "mm" diff -urN wine-20041201/dlls/commdlg/cdlg_Sk.rc wine-20050111/dlls/commdlg/cdlg_Sk.rc --- wine-20041201/dlls/commdlg/cdlg_Sk.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Sk.rc 2004-12-22 15:59:50.000000000 +0100 @@ -378,7 +378,6 @@ PD32_DEFAULT_PRINTER "Implicitná tlačiareň; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "There are %d documents in queue" - PD32_PRINT_ALL_X_PAGES "&Všetky %d strany" PD32_MARGINS_IN_INCHES "Okraje [palce]" PD32_MARGINS_IN_MILIMETERS "Okraje [mm]" PD32_MILIMETERS "mm" diff -urN wine-20041201/dlls/commdlg/cdlg_Sv.rc wine-20050111/dlls/commdlg/cdlg_Sv.rc --- wine-20041201/dlls/commdlg/cdlg_Sv.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Sv.rc 2005-01-04 21:35:24.000000000 +0100 @@ -293,9 +293,9 @@ CAPTION "Utskriftsformat" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "Papper", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "&Storlek:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160,CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -398,7 +398,6 @@ PD32_DEFAULT_PRINTER "Standardskrivare; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "Det är %d dokument i kön" - PD32_PRINT_ALL_X_PAGES "&Alla %d sidor" PD32_MARGINS_IN_INCHES "Marginaler [inches]" PD32_MARGINS_IN_MILIMETERS "Marginaler [millimeter]" PD32_MILIMETERS "millimeter" diff -urN wine-20041201/dlls/commdlg/cdlg_Th.rc wine-20050111/dlls/commdlg/cdlg_Th.rc --- wine-20041201/dlls/commdlg/cdlg_Th.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Th.rc 2005-01-04 21:35:24.000000000 +0100 @@ -297,9 +297,9 @@ CAPTION "ťĂŃşáľč§" FONT 8, "MS Shell Dlg" BEGIN - CONTROL "", rct1, 130, 0x00020006, 80, 8, 80, 80, SS_WHITERECT - CONTROL "", rct2, 130, 0x00020005, 160, 12, 4, 80, SS_GRAYRECT - CONTROL "", rct3, 130, 0x00020005, 84, 88, 80, 4, SS_GRAYRECT + CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80 + CONTROL "", rct2, "Static", SS_GRAYRECT, 160, 12, 4, 80 + CONTROL "", rct3, "Static", SS_GRAYRECT, 84, 88, 80, 4 GROUPBOX "ĄĂĐ´ŇÉ", grp2, 8, 96, 224, 56, BS_GROUPBOX LTEXT "˘šŇ´:", stc2, 16, 112, 36, 8 COMBOBOX cmb2, 64, 110, 160, 160, CBS_SIMPLE|CBS_DROPDOWN|CBS_SORT|WS_GROUP|WS_TABSTOP|WS_VSCROLL @@ -402,7 +402,6 @@ PD32_DEFAULT_PRINTER "ŕ¤Ă×čͧžÔÁžěťĄľÔ; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "ÁŐ %d áżéÁĂÍÍÂŮč" - PD32_PRINT_ALL_X_PAGES "ˇŘĄ %d ËšéŇ" PD32_MARGINS_IN_INCHES "˘ÍşĄĂĐ´ŇÉ [šÔéÇ]" PD32_MARGINS_IN_MILIMETERS "˘ÍşĄĂĐ´ŇÉ [ÁÁ.]" PD32_MILIMETERS "ÁÁ." diff -urN wine-20041201/dlls/commdlg/cdlg_Uk.rc wine-20050111/dlls/commdlg/cdlg_Uk.rc --- wine-20041201/dlls/commdlg/cdlg_Uk.rc 2004-08-24 20:33:03.000000000 +0200 +++ wine-20050111/dlls/commdlg/cdlg_Uk.rc 2004-12-22 15:59:50.000000000 +0100 @@ -376,7 +376,6 @@ PD32_DEFAULT_PRINTER "Ďđčíňĺđ çŕ îáóěîâëĺíí˙ě; " PD32_NR_OF_DOCUMENTS_IN_QUEUE "%d äîęóěĺíňłâ ó ÷ĺđçł" - PD32_PRINT_ALL_X_PAGES "&Âńł %d ńňîđłíîę" PD32_MARGINS_IN_INCHES "Ěĺćł [äţéěč]" PD32_MARGINS_IN_MILIMETERS "Ěĺćł [ěě]" PD32_MILIMETERS "ěě" diff -urN wine-20041201/dlls/commdlg/colordlg.c wine-20050111/dlls/commdlg/colordlg.c --- wine-20041201/dlls/commdlg/colordlg.c 2003-12-12 07:09:13.000000000 +0100 +++ wine-20050111/dlls/commdlg/colordlg.c 2005-01-10 14:22:35.000000000 +0100 @@ -1057,11 +1057,10 @@ */ LRESULT CC_WMPaint( HWND hDlg, WPARAM wParam, LPARAM lParam ) { - HDC hdc; PAINTSTRUCT ps; LCCPRIV lpp = (LCCPRIV)GetWindowLongA(hDlg, DWL_USER); - hdc = BeginPaint(hDlg, &ps); + BeginPaint(hDlg, &ps); /* we have to paint dialog children except text and buttons */ CC_PaintPredefColorArray(hDlg, 6, 8); CC_PaintUserColorArray(hDlg, 2, 8, lpp->lpcc->lpCustColors); @@ -1072,7 +1071,7 @@ CC_PaintColorGraph(hDlg); EndPaint(hDlg, &ps); - return TRUE; + return TRUE; } /*********************************************************************** @@ -1289,7 +1288,8 @@ { HRSRC hResInfo; HGLOBAL hDlgTmpl; - if (!(hResInfo = FindResourceA(COMDLG32_hInstance, "CHOOSE_COLOR", (LPSTR)RT_DIALOG))) + static const WCHAR wszCHOOSE_COLOR[] = {'C','H','O','O','S','E','_','C','O','L','O','R',0}; + if (!(hResInfo = FindResourceW(COMDLG32_hInstance, wszCHOOSE_COLOR, (LPWSTR)RT_DIALOG))) { COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); return FALSE; diff -urN wine-20041201/dlls/commdlg/filedlg.c wine-20050111/dlls/commdlg/filedlg.c --- wine-20041201/dlls/commdlg/filedlg.c 2004-11-29 17:59:14.000000000 +0100 +++ wine-20050111/dlls/commdlg/filedlg.c 2005-01-10 14:22:35.000000000 +0100 @@ -314,7 +314,7 @@ ZeroMemory(&fodInfos, sizeof(FileOpenDlgInfos)); /* Pass in the original ofn */ - fodInfos.ofnInfos = ofn; + fodInfos.ofnInfos = (LPOPENFILENAMEW)ofn; /* save current directory */ if (ofn->Flags & OFN_NOCHANGEDIR) @@ -445,13 +445,13 @@ { BOOL ret; FileOpenDlgInfos fodInfos; - LPSTR lpstrSavDir = NULL; + LPWSTR lpstrSavDir = NULL; /* Initialize FileOpenDlgInfos structure */ ZeroMemory(&fodInfos, sizeof(FileOpenDlgInfos)); /* Pass in the original ofn */ - fodInfos.ofnInfos = (LPOPENFILENAMEA) ofn; + fodInfos.ofnInfos = ofn; fodInfos.title = ofn->lpstrTitle; fodInfos.defext = ofn->lpstrDefExt; @@ -479,8 +479,8 @@ /* save current directory */ if (ofn->Flags & OFN_NOCHANGEDIR) { - lpstrSavDir = MemAlloc(MAX_PATH); - GetCurrentDirectoryA(MAX_PATH, lpstrSavDir); + lpstrSavDir = MemAlloc(MAX_PATH*sizeof(WCHAR)); + GetCurrentDirectoryW(MAX_PATH, lpstrSavDir); } fodInfos.unicode = TRUE; @@ -500,7 +500,7 @@ if (lpstrSavDir) { - SetCurrentDirectoryA(lpstrSavDir); + SetCurrentDirectoryW(lpstrSavDir); MemFree(lpstrSavDir); } @@ -729,12 +729,12 @@ hinst = fodInfos->ofnInfos->hInstance; if(fodInfos->unicode) { - LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos; + LPOPENFILENAMEW ofn = fodInfos->ofnInfos; hRes = FindResourceW( hinst, ofn->lpTemplateName, (LPWSTR)RT_DIALOG); } else { - LPOPENFILENAMEA ofn = fodInfos->ofnInfos; + LPOPENFILENAMEA ofn = (LPOPENFILENAMEA)fodInfos->ofnInfos; hRes = FindResourceA( hinst, ofn->lpTemplateName, (LPSTR)RT_DIALOG); } if (!hRes) @@ -807,7 +807,7 @@ ofnNotify.hdr.hwndFrom=hwndParentDlg; ofnNotify.hdr.idFrom=0; ofnNotify.hdr.code = uCode; - ofnNotify.lpOFN = (LPOPENFILENAMEW) fodInfos->ofnInfos; + ofnNotify.lpOFN = fodInfos->ofnInfos; ofnNotify.pszFile = NULL; ret = SendMessageW(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); } @@ -817,7 +817,7 @@ ofnNotify.hdr.hwndFrom=hwndParentDlg; ofnNotify.hdr.idFrom=0; ofnNotify.hdr.code = uCode; - ofnNotify.lpOFN = fodInfos->ofnInfos; + ofnNotify.lpOFN = (LPOPENFILENAMEA)fodInfos->ofnInfos; ofnNotify.pszFile = NULL; ret = SendMessageA(fodInfos->DlgInfos.hwndCustomDlg,WM_NOTIFY,0,(LPARAM)&ofnNotify); } @@ -1164,7 +1164,9 @@ } else if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) { - SetWindowTextA(hwnd,"Save"); + WCHAR buf[16]; + LoadStringW(COMDLG32_hInstance, IDS_SAVE, buf, sizeof(buf)/sizeof(WCHAR)); + SetWindowTextW(hwnd, buf); } /* Initialise the file name edit control */ @@ -1388,11 +1390,14 @@ (rectDlg.bottom-rectDlg.top) - (rectHelp.bottom - rectCancel.bottom), SWP_NOACTIVATE|SWP_NOMOVE|SWP_NOZORDER); } - /* change Open to Save FIXME: use resources */ + /* change Open to Save */ if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG) { - SetDlgItemTextA(hwnd,IDOK,"&Save"); - SetDlgItemTextA(hwnd,IDC_LOOKINSTATIC,"Save &in"); + WCHAR buf[16]; + LoadStringW(COMDLG32_hInstance, IDS_SAVE_BUTTON, buf, sizeof(buf)/sizeof(WCHAR)); + SetDlgItemTextW(hwnd, IDOK, buf); + LoadStringW(COMDLG32_hInstance, IDS_SAVE_IN, buf, sizeof(buf)/sizeof(WCHAR)); + SetDlgItemTextW(hwnd, IDC_LOOKINSTATIC, buf); } return 0; } @@ -1582,12 +1587,12 @@ if(fodInfos->unicode) { - LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos; + LPOPENFILENAMEW ofn = fodInfos->ofnInfos; ofn->lpstrFile[0] = '\0'; } else { - LPOPENFILENAMEA ofn = fodInfos->ofnInfos; + LPOPENFILENAMEA ofn = (LPOPENFILENAMEA) fodInfos->ofnInfos; ofn->lpstrFile[0] = '\0'; } @@ -1640,13 +1645,13 @@ } if(fodInfos->unicode) { - LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos; + LPOPENFILENAMEW ofn = fodInfos->ofnInfos; strcpyW( ofn->lpstrFile, lpstrPathSpec); memcpy( ofn->lpstrFile + nSizePath, lpstrFileList, sizeUsed*sizeof(WCHAR) ); } else { - LPOPENFILENAMEA ofn = fodInfos->ofnInfos; + LPOPENFILENAMEA ofn = (LPOPENFILENAMEA)fodInfos->ofnInfos; if (ofn->lpstrFile != NULL) { @@ -1684,14 +1689,14 @@ #define ONOPEN_SEARCH 3 static void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText) { - char strMsgTitle[MAX_PATH]; - char strMsgText [MAX_PATH]; + WCHAR strMsgTitle[MAX_PATH]; + WCHAR strMsgText [MAX_PATH]; if (idCaption) - LoadStringA(COMDLG32_hInstance, idCaption, strMsgTitle, sizeof(strMsgTitle)); + LoadStringW(COMDLG32_hInstance, idCaption, strMsgTitle, sizeof(strMsgTitle)/sizeof(WCHAR)); else strMsgTitle[0] = '\0'; - LoadStringA(COMDLG32_hInstance, idText, strMsgText, sizeof(strMsgText)); - MessageBoxA(hwnd,strMsgText, strMsgTitle, MB_OK | MB_ICONHAND); + LoadStringW(COMDLG32_hInstance, idText, strMsgText, sizeof(strMsgText)/sizeof(WCHAR)); + MessageBoxW(hwnd,strMsgText, strMsgTitle, MB_OK | MB_ICONHAND); } BOOL FILEDLG95_OnOpen(HWND hwnd) @@ -2027,7 +2032,7 @@ { if(fodInfos->unicode) { - LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos; + LPOPENFILENAMEW ofn = fodInfos->ofnInfos; strncpyW(ofn->lpstrFile, lpstrPathAndFile, ofn->nMaxFile); if (ofn->Flags & OFN_ALLOWMULTISELECT) @@ -2035,7 +2040,7 @@ } else { - LPOPENFILENAMEA ofn = fodInfos->ofnInfos; + LPOPENFILENAMEA ofn = (LPOPENFILENAMEA)fodInfos->ofnInfos; WideCharToMultiByte(CP_ACP, 0, lpstrPathAndFile, -1, ofn->lpstrFile, ofn->nMaxFile, NULL, NULL); @@ -2058,12 +2063,12 @@ LPWSTR lpstrFileTitle = PathFindFileNameW(lpstrPathAndFile); if(fodInfos->unicode) { - LPOPENFILENAMEW ofn = (LPOPENFILENAMEW) fodInfos->ofnInfos; + LPOPENFILENAMEW ofn = fodInfos->ofnInfos; strncpyW(ofn->lpstrFileTitle, lpstrFileTitle, ofn->nMaxFileTitle); } else { - LPOPENFILENAMEA ofn = fodInfos->ofnInfos; + LPOPENFILENAMEA ofn = (LPOPENFILENAMEA)fodInfos->ofnInfos; WideCharToMultiByte(CP_ACP, 0, lpstrFileTitle, -1, ofn->lpstrFileTitle, ofn->nMaxFileTitle, NULL, NULL); } @@ -2072,7 +2077,7 @@ /* copy currently selected filter to lpstrCustomFilter */ if (fodInfos->ofnInfos->lpstrCustomFilter) { - LPOPENFILENAMEA ofn = fodInfos->ofnInfos; + LPOPENFILENAMEA ofn = (LPOPENFILENAMEA)fodInfos->ofnInfos; int len = WideCharToMultiByte(CP_ACP, 0, fodInfos->ShellInfos.lpstrCurrentFilter, -1, NULL, 0, NULL, NULL); if (len + strlen(ofn->lpstrCustomFilter) + 1 <= ofn->nMaxCustFilter) @@ -3208,7 +3213,6 @@ if(!lpsf) { - HRESULT hRes; SHGetDesktopFolder(&lpsf); hRes = GetName(lpsf,pidl,dwFlags,lpstrFileName); IShellFolder_Release(lpsf); @@ -3358,10 +3362,7 @@ static void MemFree(void *mem) { - if(mem) - { - HeapFree(GetProcessHeap(),0,mem); - } + HeapFree(GetProcessHeap(),0,mem); } /* diff -urN wine-20041201/dlls/commdlg/filedlg31.c wine-20050111/dlls/commdlg/filedlg31.c --- wine-20041201/dlls/commdlg/filedlg31.c 2004-09-03 01:00:53.000000000 +0200 +++ wine-20050111/dlls/commdlg/filedlg31.c 2005-01-09 17:31:36.000000000 +0100 @@ -586,11 +586,8 @@ static LRESULT FD31_FileTypeChange( PFD31_DATA lfs ) { LONG lRet; - WCHAR diskname[BUFFILE]; LPWSTR pstr; - diskname[0] = 0; - lRet = SendDlgItemMessageW(lfs->hwnd, cmb1, CB_GETCURSEL, 0, 0); if (lRet == LB_ERR) return TRUE; @@ -705,7 +702,6 @@ */ void FD31_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open) { - LPCSTR str; UNICODE_STRING usBuffer; ofnW->lStructSize = sizeof(OPENFILENAMEW); @@ -727,13 +723,18 @@ RtlCreateUnicodeStringFromAsciiz (&usBuffer,ofnA->lpstrInitialDir); ofnW->lpstrInitialDir = usBuffer.Buffer; } - if (ofnA->lpstrTitle) - str = ofnA->lpstrTitle; - else - /* Allocates default title (FIXME : get it from resource) */ - str = open ? "Open File" : "Save as"; - RtlCreateUnicodeStringFromAsciiz (&usBuffer,str); - ofnW->lpstrTitle = usBuffer.Buffer; + if (ofnA->lpstrTitle) { + RtlCreateUnicodeStringFromAsciiz (&usBuffer, ofnA->lpstrTitle); + ofnW->lpstrTitle = usBuffer.Buffer; + } else { + WCHAR buf[16]; + int len; + LoadStringW(COMDLG32_hInstance, open ? IDS_OPEN_FILE : IDS_SAVE_AS, + buf, sizeof(buf)/sizeof(WCHAR)); + len = lstrlenW(buf)+1; + ofnW->lpstrTitle = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + memcpy((void*)ofnW->lpstrTitle, buf, len*sizeof(WCHAR)); + } ofnW->Flags = ofnA->Flags; ofnW->nFileOffset = ofnA->nFileOffset; ofnW->nFileExtension = ofnA->nFileExtension; @@ -757,12 +758,12 @@ */ void FD31_FreeOfnW(LPOPENFILENAMEW ofnW) { - if (ofnW->lpstrFilter) HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrFilter); - if (ofnW->lpstrCustomFilter) HeapFree(GetProcessHeap(), 0, ofnW->lpstrCustomFilter); - if (ofnW->lpstrFile) HeapFree(GetProcessHeap(), 0, ofnW->lpstrFile); - if (ofnW->lpstrFileTitle) HeapFree(GetProcessHeap(), 0, ofnW->lpstrFileTitle); - if (ofnW->lpstrInitialDir) HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrInitialDir); - if (ofnW->lpstrTitle) HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrTitle); + HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrFilter); + HeapFree(GetProcessHeap(), 0, ofnW->lpstrCustomFilter); + HeapFree(GetProcessHeap(), 0, ofnW->lpstrFile); + HeapFree(GetProcessHeap(), 0, ofnW->lpstrFileTitle); + HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrInitialDir); + HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpstrTitle); if ((ofnW->lpTemplateName) && (HIWORD(ofnW->lpTemplateName))) HeapFree(GetProcessHeap(), 0, (LPWSTR) ofnW->lpTemplateName); } diff -urN wine-20041201/dlls/commdlg/filedlgbrowser.c wine-20050111/dlls/commdlg/filedlgbrowser.c --- wine-20041201/dlls/commdlg/filedlgbrowser.c 2004-10-07 05:06:51.000000000 +0200 +++ wine-20050111/dlls/commdlg/filedlgbrowser.c 2005-01-10 13:25:29.000000000 +0100 @@ -216,10 +216,11 @@ ULONG WINAPI IShellBrowserImpl_AddRef(IShellBrowser * iface) { IShellBrowserImpl *This = (IShellBrowserImpl *)iface; + ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(%p,%lu)\n", This, This->ref); + TRACE("(%p,%lu)\n", This, ref - 1); - return ++(This->ref); + return ref; } /************************************************************************** @@ -228,16 +229,17 @@ ULONG WINAPI IShellBrowserImpl_Release(IShellBrowser * iface) { IShellBrowserImpl *This = (IShellBrowserImpl *)iface; + ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p,%lu)\n", This, This->ref); + TRACE("(%p,%lu)\n", This, ref + 1); - if (!--(This->ref)) + if (!ref) { COMDLG32_SHFree(This); TRACE("-- destroyed\n"); return 0; } - return This->ref; + return ref; } /* diff -urN wine-20041201/dlls/commdlg/filedlgbrowser.h wine-20050111/dlls/commdlg/filedlgbrowser.h --- wine-20041201/dlls/commdlg/filedlgbrowser.h 2004-11-29 17:59:14.000000000 +0100 +++ wine-20050111/dlls/commdlg/filedlgbrowser.h 2005-01-10 14:22:35.000000000 +0100 @@ -56,7 +56,7 @@ typedef struct { - LPOPENFILENAMEA ofnInfos; + LPOPENFILENAMEW ofnInfos; BOOL unicode; LPWSTR initdir; LPWSTR filename; diff -urN wine-20041201/dlls/commdlg/fontdlg.c wine-20050111/dlls/commdlg/fontdlg.c --- wine-20041201/dlls/commdlg/fontdlg.c 2004-10-07 19:35:08.000000000 +0200 +++ wine-20050111/dlls/commdlg/fontdlg.c 2005-01-06 20:43:43.000000000 +0100 @@ -36,7 +36,10 @@ WINE_DEFAULT_DEBUG_CHANNEL(commdlg); -#define WINE_FONTDATA "__WINE_FONTDLGDATA" +static const WCHAR strWineFontData[] = {'_','_','W','I','N','E','_','F','O','N','T','D','L','G','D','A','T','A',0}; +static const WCHAR strWineFontData_a[] = + {'_','_','W','I','N','E','_','F','O','N','T','D','L','G','D','A','T','A','_','A',0}; +static const WCHAR chooseFontW[] = {'C','H','O','O','S','E','_','F','O','N','T',0}; #include "cdlg.h" @@ -44,11 +47,8 @@ static HIMAGELIST himlTT = 0; #define TTBITMAP_XSIZE 20 /* x-size of the bitmaps */ - -INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, - LPARAM lParam); -INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, - LPARAM lParam); +INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); /* There is a table here of all charsets, and the sample text for each. * There is a second table that translates a charset into an index into @@ -168,8 +168,7 @@ HINSTANCE hDlginst; HGLOBAL hDlgTmpl; - static const WCHAR chooseFontW[] = {'C','H','O','O','S','E','_', - 'F','O','N','T',0}; + TRACE("(%p)\n", lpChFont); if ( (lpChFont->Flags&CF_ENABLETEMPLATEHANDLE)!=0 ) { @@ -221,6 +220,8 @@ HINSTANCE hDlginst; HGLOBAL hDlgTmpl; + TRACE("(%p)\n", lpChFont); + if ( (lpChFont->Flags&CF_ENABLETEMPLATEHANDLE)!=0 ) { template=(LPCVOID)lpChFont->hInstance; @@ -238,7 +239,7 @@ } else { hDlginst=COMDLG32_hInstance; - if (!(hResInfo = FindResourceA(hDlginst, "CHOOSE_FONT", (LPSTR)RT_DIALOG))) + if (!(hResInfo = FindResourceW(hDlginst, chooseFontW, (LPWSTR)RT_DIALOG))) { COMDLG32_SetCommDlgExtendedError(CDERR_FINDRESFAILURE); return FALSE; @@ -253,7 +254,6 @@ } if (TRACE_ON(commdlg)) _dump_cf_flags(lpChFont->Flags); - if (lpChFont->Flags & (CF_SELECTSCRIPT | CF_NOVERTFONTS )) FIXME(": unimplemented flag (ignored)\n"); @@ -261,7 +261,6 @@ lpChFont->hwndOwner, FormatCharDlgProcA, (LPARAM)lpChFont ); } - #define TEXT_EXTRAS 4 #define TEXT_COLORS 16 @@ -276,7 +275,7 @@ /*********************************************************************** * CFn_HookCallChk32 [internal] */ -static BOOL CFn_HookCallChk32(LPCHOOSEFONTA lpcf) +static BOOL CFn_HookCallChk32(LPCHOOSEFONTW lpcf) { if (lpcf) if(lpcf->Flags & CF_ENABLEHOOK) @@ -288,14 +287,14 @@ /************************************************************************* * AddFontFamily [internal] */ -INT AddFontFamily(const ENUMLOGFONTEXA *lpElfex, const NEWTEXTMETRICEXA *lpNTM, - UINT nFontType, LPCHOOSEFONTA lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e) +INT AddFontFamily(const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, + UINT nFontType, LPCHOOSEFONTW lpcf, HWND hwnd, LPCFn_ENUMSTRUCT e) { int i; WORD w; - const LOGFONTA *lplf = &(lpElfex->elfLogFont); + const LOGFONTW *lplf = &(lpElfex->elfLogFont); - TRACE("font=%s (nFontType=%d)\n", lplf->lfFaceName,nFontType); + TRACE("font=%s (nFontType=%d)\n", debugstr_w(lplf->lfFaceName), nFontType); if (lpcf->Flags & CF_FIXEDPITCHONLY) if (!(lplf->lfPitchAndFamily & FIXED_PITCH)) @@ -309,14 +308,14 @@ if (e) e->added++; - i=SendMessageA(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)lplf->lfFaceName); + i=SendMessageW(hwnd, CB_FINDSTRINGEXACT, 0, (LPARAM)lplf->lfFaceName); if (i == CB_ERR) { - i = SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName); + i = SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)lplf->lfFaceName); if( i != CB_ERR) { /* store some important font information */ w = (lplf->lfPitchAndFamily) << 8 | (HIWORD(lpNTM->ntmTm.ntmFlags) & 0xff); - SendMessageA(hwnd, CB_SETITEMDATA, i, MAKELONG(nFontType,w)); + SendMessageW(hwnd, CB_SETITEMDATA, i, MAKELONG(nFontType,w)); } } return 1; @@ -325,13 +324,13 @@ /************************************************************************* * FontFamilyEnumProc32 [internal] */ -static INT WINAPI FontFamilyEnumProc(const ENUMLOGFONTEXA *lpElfex, - const TEXTMETRICA *metrics, DWORD dwFontType, LPARAM lParam) +static INT WINAPI FontFamilyEnumProc(const ENUMLOGFONTEXW *lpElfex, + const TEXTMETRICW *metrics, DWORD dwFontType, LPARAM lParam) { LPCFn_ENUMSTRUCT e; e=(LPCFn_ENUMSTRUCT)lParam; - return AddFontFamily( lpElfex, (NEWTEXTMETRICEXA *) metrics, - dwFontType, e->lpcf32a, e->hWnd1, e); + return AddFontFamily( lpElfex, (NEWTEXTMETRICEXW *) metrics, + dwFontType, e->lpcf32w, e->hWnd1, e); } /************************************************************************* @@ -339,42 +338,48 @@ * * Fill font style information into combobox (without using font.c directly) */ -static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTA *lplf) +static int SetFontStylesToCombo2(HWND hwnd, HDC hdc, const LOGFONTW *lplf) { #define FSTYLES 4 struct FONTSTYLE { int italic; int weight; - const char *stname; + const WCHAR *stname; }; + static const WCHAR strRegular[] = {'R','e','g','u','l','a','r',0}; + static const WCHAR strItalic[] = {'I','t','a','l','i','c',0}; + static const WCHAR strBold[] = {'B','o','l','d',0}; + static const WCHAR strBoldItalic[] = {'B','o','l','d',' ','I','t','a','l','i','c',0}; static const struct FONTSTYLE fontstyles[FSTYLES]={ - { 0,FW_NORMAL,"Regular"}, { 1,FW_NORMAL,"Italic"}, - { 0,FW_BOLD,"Bold"}, { 1,FW_BOLD,"Bold Italic"} + { 0, FW_NORMAL, strRegular }, + { 1, FW_NORMAL, strItalic }, + { 0, FW_BOLD, strBold }, + { 1, FW_BOLD, strBoldItalic } }; HFONT hf; - TEXTMETRICA tm; + TEXTMETRICW tm; int i,j; - LOGFONTA lf; + LOGFONTW lf; - memcpy(&lf, lplf, sizeof(LOGFONTA)); + memcpy(&lf, lplf, sizeof(LOGFONTW)); for (i=0;iFlags & CF_LIMITSIZE)) || ((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax))) { - sprintf(buffer, "%2d", h); - j=SendMessageA(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer); + wsprintfW(buffer, strFormat, h); + j=SendMessageW(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer); if (j==CB_ERR) { - j=SendMessageA(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer); - if (j!=CB_ERR) j = SendMessageA(hwnd, CB_SETITEMDATA, j, h); + j=SendMessageW(hwnd, CB_ADDSTRING, 0, (LPARAM)buffer); + if (j!=CB_ERR) j = SendMessageW(hwnd, CB_SETITEMDATA, j, h); if (j==CB_ERR) return 1; } } @@ -408,9 +414,9 @@ /************************************************************************* * SetFontSizesToCombo3 [internal] */ -static int SetFontSizesToCombo3(HWND hwnd, LPCHOOSEFONTA lpcf) +static int SetFontSizesToCombo3(HWND hwnd, LPCHOOSEFONTW lpcf) { - static const char sizes[]={8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72}; + static const BYTE sizes[]={8,9,10,11,12,14,16,18,20,22,24,26,28,36,48,72}; int i; for (i = 0; i < sizeof(sizes)/sizeof(sizes[0]); i++) @@ -421,7 +427,7 @@ /************************************************************************* * CFn_GetDC [internal] */ -inline HDC CFn_GetDC(LPCHOOSEFONTA lpcf) +inline HDC CFn_GetDC(LPCHOOSEFONTW lpcf) { HDC ret = ((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC) ? lpcf->hDC : @@ -433,7 +439,7 @@ /************************************************************************* * CFn_ReleaseDC [internal] */ -inline void CFn_ReleaseDC(LPCHOOSEFONTA lpcf, HDC hdc) +inline void CFn_ReleaseDC(LPCHOOSEFONTW lpcf, HDC hdc) { if(!((lpcf->Flags & CF_PRINTERFONTS) && lpcf->hDC)) ReleaseDC(0, hdc); @@ -442,19 +448,19 @@ /*********************************************************************** * AddFontStyle [internal] */ -INT AddFontStyle( const ENUMLOGFONTEXA *lpElfex, const NEWTEXTMETRICEXA *lpNTM, - UINT nFontType, LPCHOOSEFONTA lpcf, HWND hcmb2, HWND hcmb3, +INT AddFontStyle( const ENUMLOGFONTEXW *lpElfex, const NEWTEXTMETRICEXW *lpNTM, + UINT nFontType, LPCHOOSEFONTW lpcf, HWND hcmb2, HWND hcmb3, HWND hDlg, BOOL iswin16) { int i; - const LOGFONTA *lplf = &(lpElfex->elfLogFont); + const LOGFONTW *lplf = &(lpElfex->elfLogFont); HWND hcmb5; HDC hdc; TRACE("(nFontType=%d)\n",nFontType); TRACE(" %s h=%ld w=%ld e=%ld o=%ld wg=%ld i=%d u=%d s=%d" " ch=%d op=%d cp=%d q=%d pf=%xh\n", - lplf->lfFaceName,lplf->lfHeight,lplf->lfWidth, + debugstr_w(lplf->lfFaceName),lplf->lfHeight,lplf->lfWidth, lplf->lfEscapement,lplf->lfOrientation, lplf->lfWeight,lplf->lfItalic,lplf->lfUnderline, lplf->lfStrikeOut,lplf->lfCharSet, lplf->lfOutPrecision, @@ -467,10 +473,10 @@ 72, GetDeviceCaps(hdc, LOGPIXELSY)); CFn_ReleaseDC(lpcf, hdc); i = AddFontSizeToCombo3(hcmb3, points, lpcf); - if( i) return 0; + if(i) return 0; } else if (SetFontSizesToCombo3(hcmb3, lpcf)) return 0; - if (!SendMessageA(hcmb2, CB_GETCOUNT, 0, 0)) + if (!SendMessageW(hcmb2, CB_GETCOUNT, 0, 0)) { if(!(hdc = CFn_GetDC(lpcf))) return 0; i=SetFontStylesToCombo2(hcmb2,hdc,lplf); @@ -479,13 +485,13 @@ return 0; } if( iswin16 || !( hcmb5 = GetDlgItem(hDlg, cmb5))) return 1; - i = SendMessageA( hcmb5, CB_FINDSTRINGEXACT, 0, + i = SendMessageW( hcmb5, CB_FINDSTRINGEXACT, 0, (LPARAM)lpElfex->elfScript); if( i == CB_ERR) { - i = SendMessageA( hcmb5, CB_ADDSTRING, 0, + i = SendMessageW( hcmb5, CB_ADDSTRING, 0, (LPARAM)lpElfex->elfScript); if( i != CB_ERR) - SendMessageA( hcmb5, CB_SETITEMDATA, i, lplf->lfCharSet); + SendMessageW( hcmb5, CB_SETITEMDATA, i, lplf->lfCharSet); } return 1 ; } @@ -495,14 +501,14 @@ int i,n; int ret = 0; /* look for fitting font size in combobox3 */ - n=SendDlgItemMessageA(hDlg, cmb3, CB_GETCOUNT, 0, 0); + n=SendDlgItemMessageW(hDlg, cmb3, CB_GETCOUNT, 0, 0); for (i=0;ihWnd1; HWND hcmb3=s->hWnd2; HWND hDlg=GetParent(hcmb3); - return AddFontStyle( lpElfex, (const NEWTEXTMETRICEXA *) metrics, - dwFontType, s->lpcf32a, hcmb2, hcmb3, hDlg, FALSE); + return AddFontStyle( lpElfex, (const NEWTEXTMETRICEXW *) metrics, + dwFontType, s->lpcf32w, hcmb2, hcmb3, hDlg, FALSE); } /*********************************************************************** * CFn_WMInitDialog [internal] */ LRESULT CFn_WMInitDialog(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf) + LPCHOOSEFONTW lpcf) { HDC hdc; int i,j,init=0; long pstyle; CFn_ENUMSTRUCT s; - LPLOGFONTA lpxx; - HCURSOR hcursor=SetCursor(LoadCursorA(0,(LPSTR)IDC_WAIT)); + LPLOGFONTW lpxx; + HCURSOR hcursor=SetCursor(LoadCursorW(0,(LPWSTR)IDC_WAIT)); + static const WCHAR strColorName[] = {'[','c','o','l','o','r',' ','n','a','m','e',']',0}; - SetPropA(hDlg, WINE_FONTDATA, (HANDLE)lParam); + SetPropW(hDlg, strWineFontData, (HANDLE)lParam); lpxx=lpcf->lpLogFont; TRACE("WM_INITDIALOG lParam=%08lX\n", lParam); - if (lpcf->lStructSize != sizeof(CHOOSEFONTA)) + if (lpcf->lStructSize != sizeof(CHOOSEFONTW)) { ERR("structure size failure !!!\n"); EndDialog (hDlg, 0); return FALSE; } if (!himlTT) - himlTT = ImageList_LoadImageA( COMDLG32_hInstance, MAKEINTRESOURCEA(38), + himlTT = ImageList_LoadImageW( COMDLG32_hInstance, MAKEINTRESOURCEW(38), TTBITMAP_XSIZE, 0, CLR_DEFAULT, IMAGE_BITMAP, 0); if (!(lpcf->Flags & CF_SHOWHELP) || !IsWindow(lpcf->hwndOwner)) @@ -605,18 +612,18 @@ { for (i=0;irgbColors) - SendDlgItemMessageA(hDlg,cmb4, CB_SETCURSEL,j,0); + SendDlgItemMessageW(hDlg,cmb4, CB_SETCURSEL,j,0); } } else @@ -633,14 +640,14 @@ return FALSE; } s.hWnd1=GetDlgItem(hDlg,cmb1); - s.lpcf32a=lpcf; + s.lpcf32w=lpcf; do { - LOGFONTA elf; + LOGFONTW elf; s.added = 0; elf.lfCharSet = DEFAULT_CHARSET; /* enum all charsets */ elf.lfPitchAndFamily = 0; elf.lfFaceName[0] = '\0'; /* enum all fonts */ - if (!EnumFontFamiliesExA(hdc, &elf, (FONTENUMPROCA)FontFamilyEnumProc, (LPARAM)&s, 0)) + if (!EnumFontFamiliesExW(hdc, &elf, (FONTENUMPROCW)FontFamilyEnumProc, (LPARAM)&s, 0)) { TRACE("EnumFontFamiliesEx returns 0\n"); break; @@ -663,7 +670,7 @@ if (lpcf->Flags & CF_INITTOLOGFONTSTRUCT) { /* look for fitting font name in combobox1 */ - j=SendDlgItemMessageA(hDlg,cmb1,CB_FINDSTRING,-1,(LONG)lpxx->lfFaceName); + j=SendDlgItemMessageW(hDlg,cmb1,CB_FINDSTRING,-1,(LONG)lpxx->lfFaceName); if (j!=CB_ERR) { INT height = lpxx->lfHeight < 0 ? -lpxx->lfHeight : @@ -673,8 +680,8 @@ points = MulDiv( height, 72, GetDeviceCaps(hdc, LOGPIXELSY)); pstyle = MAKELONG(lpxx->lfWeight > FW_MEDIUM ? FW_BOLD: FW_NORMAL,lpxx->lfItalic !=0); - SendDlgItemMessageA(hDlg, cmb1, CB_SETCURSEL, j, 0); - SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), + SendDlgItemMessageW(hDlg, cmb1, CB_SETCURSEL, j, 0); + SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), (LPARAM)GetDlgItem(hDlg,cmb1)); init=1; /* look for fitting font style in combobox2 */ @@ -686,17 +693,17 @@ } if (!init) { - SendDlgItemMessageA(hDlg,cmb1,CB_SETCURSEL,0,0); - SendMessageA(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), + SendDlgItemMessageW(hDlg,cmb1,CB_SETCURSEL,0,0); + SendMessageW(hDlg, WM_COMMAND, MAKEWPARAM(cmb1, CBN_SELCHANGE), (LPARAM)GetDlgItem(hDlg,cmb1)); } if (lpcf->Flags & CF_USESTYLE && lpcf->lpszStyle) { - j=SendDlgItemMessageA(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle); + j=SendDlgItemMessageW(hDlg,cmb2,CB_FINDSTRING,-1,(LONG)lpcf->lpszStyle); if (j!=CB_ERR) { - j=SendDlgItemMessageA(hDlg,cmb2,CB_SETCURSEL,j,0); - SendMessageA(hDlg,WM_COMMAND,cmb2, + j=SendDlgItemMessageW(hDlg,cmb2,CB_SETCURSEL,j,0); + SendMessageW(hDlg,WM_COMMAND,cmb2, MAKELONG(HWND_16(GetDlgItem(hDlg,cmb2)),CBN_SELCHANGE)); } } @@ -716,18 +723,18 @@ TEXTMETRICW tm; LPMEASUREITEMSTRUCT lpmi=(LPMEASUREITEMSTRUCT)lParam; if (!himlTT) - himlTT = ImageList_LoadImageA( COMDLG32_hInstance, MAKEINTRESOURCEA(38), + himlTT = ImageList_LoadImageW( COMDLG32_hInstance, MAKEINTRESOURCEW(38), TTBITMAP_XSIZE, 0, CLR_DEFAULT, IMAGE_BITMAP, 0); ImageList_GetIconSize( himlTT, 0, &lpmi->itemHeight); lpmi->itemHeight += 2; /* use MAX of bitmap height and tm.tmHeight .*/ - hdc=GetDC( hDlg); + hdc=GetDC(hDlg); if(!hdc) return 0; hfontprev = SelectObject( hdc, GetStockObject( SYSTEM_FONT)); - GetTextMetricsW( hdc, &tm); + GetTextMetricsW(hdc, &tm); if( tm.tmHeight > lpmi->itemHeight) lpmi->itemHeight = tm.tmHeight; - SelectObject( hdc, hfontprev); - ReleaseDC( hDlg, hdc); + SelectObject(hdc, hfontprev); + ReleaseDC(hDlg, hdc); return 0; } @@ -738,7 +745,7 @@ LRESULT CFn_WMDrawItem(HWND hDlg, WPARAM wParam, LPARAM lParam) { HBRUSH hBrush; - char buffer[40]; + WCHAR buffer[40]; COLORREF cr, oldText=0, oldBk=0; RECT rect; int nFontType; @@ -771,11 +778,11 @@ { case cmb1: /* TRACE(commdlg,"WM_Drawitem cmb1\n"); */ - SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, + SendMessageW(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, (LPARAM)buffer); - TextOutA(lpdi->hDC, lpdi->rcItem.left + TTBITMAP_XSIZE + 10, - lpdi->rcItem.top, buffer, strlen(buffer)); - nFontType = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); + TextOutW(lpdi->hDC, lpdi->rcItem.left + TTBITMAP_XSIZE + 10, + lpdi->rcItem.top, buffer, lstrlenW(buffer)); + nFontType = SendMessageW(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); idx = -1; if (nFontType & TRUETYPE_FONTTYPE) { idx = 0; /* picture: TT */ @@ -795,19 +802,19 @@ case cmb3: /* TRACE(commdlg,"WM_DRAWITEN cmb2,cmb3\n"); */ case cmb5: - SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, + SendMessageW(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, (LPARAM)buffer); - TextOutA(lpdi->hDC, lpdi->rcItem.left, - lpdi->rcItem.top, buffer, strlen(buffer)); + TextOutW(lpdi->hDC, lpdi->rcItem.left, + lpdi->rcItem.top, buffer, lstrlenW(buffer)); break; case cmb4: /* TRACE(commdlg,"WM_DRAWITEM cmb4 (=COLOR)\n"); */ - SendMessageA(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, - (LPARAM)buffer); - TextOutA(lpdi->hDC, lpdi->rcItem.left + 25+5, - lpdi->rcItem.top, buffer, strlen(buffer)); - cr = SendMessageA(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); + SendMessageW(lpdi->hwndItem, CB_GETLBTEXT, lpdi->itemID, + (LPARAM)buffer); + TextOutW(lpdi->hDC, lpdi->rcItem.left + 25+5, + lpdi->rcItem.top, buffer, lstrlenW(buffer)); + cr = SendMessageW(lpdi->hwndItem, CB_GETITEMDATA, lpdi->itemID,0L); hBrush = CreateSolidBrush(cr); if (hBrush) { @@ -840,12 +847,12 @@ * CFn_WMCommand [internal] */ LRESULT CFn_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf) + LPCHOOSEFONTW lpcf) { int i; long l; HDC hdc; - LPLOGFONTA lpxx=lpcf->lpLogFont; + LPLOGFONTW lpxx=lpcf->lpLogFont; TRACE("WM_COMMAND wParam=%08lX lParam=%08lX\n", (LONG)wParam, lParam); switch (LOWORD(wParam)) @@ -862,33 +869,33 @@ EndDialog (hDlg, 0); return TRUE; } - idx = SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0); - pointsize = (int)SendDlgItemMessageA( hDlg, cmb3, CB_GETITEMDATA, + idx = SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0); + pointsize = (int)SendDlgItemMessageW( hDlg, cmb3, CB_GETITEMDATA, idx, 0); - idx = SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0); - pstyle = SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, idx, 0); - idx = SendDlgItemMessageA(hDlg, cmb5, CB_GETCURSEL, 0, 0); - charset = SendDlgItemMessageA(hDlg, cmb5, CB_GETITEMDATA, idx, 0); - - SendDlgItemMessageA(hDlg, cmb2, CB_RESETCONTENT, 0, 0); - SendDlgItemMessageA(hDlg, cmb3, CB_RESETCONTENT, 0, 0); - SendDlgItemMessageA(hDlg, cmb5, CB_RESETCONTENT, 0, 0); - i=SendDlgItemMessageA(hDlg, cmb1, CB_GETCURSEL, 0, 0); + idx = SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0); + pstyle = SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, idx, 0); + idx = SendDlgItemMessageW(hDlg, cmb5, CB_GETCURSEL, 0, 0); + charset = SendDlgItemMessageW(hDlg, cmb5, CB_GETITEMDATA, idx, 0); + + SendDlgItemMessageW(hDlg, cmb2, CB_RESETCONTENT, 0, 0); + SendDlgItemMessageW(hDlg, cmb3, CB_RESETCONTENT, 0, 0); + SendDlgItemMessageW(hDlg, cmb5, CB_RESETCONTENT, 0, 0); + i=SendDlgItemMessageW(hDlg, cmb1, CB_GETCURSEL, 0, 0); if (i!=CB_ERR) { - HCURSOR hcursor=SetCursor(LoadCursorA(0,(LPSTR)IDC_WAIT)); + HCURSOR hcursor=SetCursor(LoadCursorW(0,(LPWSTR)IDC_WAIT)); CFn_ENUMSTRUCT s; - LOGFONTA enumlf; - SendDlgItemMessageA(hDlg, cmb1, CB_GETLBTEXT, i, + LOGFONTW enumlf; + SendDlgItemMessageW(hDlg, cmb1, CB_GETLBTEXT, i, (LPARAM)enumlf.lfFaceName); - TRACE("WM_COMMAND/cmb1 =>%s\n",enumlf.lfFaceName); + TRACE("WM_COMMAND/cmb1 =>%s\n", debugstr_w(enumlf.lfFaceName)); s.hWnd1=GetDlgItem(hDlg, cmb2); s.hWnd2=GetDlgItem(hDlg, cmb3); - s.lpcf32a=lpcf; + s.lpcf32w=lpcf; enumlf.lfCharSet = DEFAULT_CHARSET; /* enum all charsets */ enumlf.lfPitchAndFamily = 0; - EnumFontFamiliesExA(hdc, &enumlf, - (FONTENUMPROCA)FontStyleEnumProc, (LPARAM)&s, 0); + EnumFontFamiliesExW(hdc, &enumlf, + (FONTENUMPROCW)FontStyleEnumProc, (LPARAM)&s, 0); CFn_FitFontStyle(hDlg, pstyle); if( pointsize != CB_ERR) CFn_FitFontSize(hDlg, pointsize); if( charset != CB_ERR) CFn_FitCharSet( hDlg, charset ); @@ -903,37 +910,37 @@ case cmb5: if (HIWORD(wParam)==CBN_SELCHANGE || HIWORD(wParam)== BN_CLICKED ) { - char str[256]; + WCHAR str[256]; WINDOWINFO wininfo; TRACE("WM_COMMAND/cmb2,3 =%08lX\n", lParam); - i=SendDlgItemMessageA(hDlg,cmb1,CB_GETCURSEL,0,0); + i=SendDlgItemMessageW(hDlg,cmb1,CB_GETCURSEL,0,0); if (i==CB_ERR) - i=GetDlgItemTextA( hDlg, cmb1, str, 256 ); + i=GetDlgItemTextW( hDlg, cmb1, str, 256 ); else { - SendDlgItemMessageA(hDlg,cmb1,CB_GETLBTEXT,i, + SendDlgItemMessageW(hDlg,cmb1,CB_GETLBTEXT,i, (LPARAM)str); - l=SendDlgItemMessageA(hDlg,cmb1,CB_GETITEMDATA,i,0); + l=SendDlgItemMessageW(hDlg,cmb1,CB_GETITEMDATA,i,0); lpcf->nFontType = LOWORD(l); /* FIXME: lpcf->nFontType |= .... SIMULATED_FONTTYPE and so */ /* same value reported to the EnumFonts call back with the extra FONTTYPE_... bits added */ lpxx->lfPitchAndFamily = HIWORD(l) >> 8; } - strcpy(lpxx->lfFaceName,str); - i=SendDlgItemMessageA(hDlg, cmb2, CB_GETCURSEL, 0, 0); + lstrcpyW(lpxx->lfFaceName,str); + i=SendDlgItemMessageW(hDlg, cmb2, CB_GETCURSEL, 0, 0); if (i!=CB_ERR) { - l=SendDlgItemMessageA(hDlg, cmb2, CB_GETITEMDATA, i, 0); + l=SendDlgItemMessageW(hDlg, cmb2, CB_GETITEMDATA, i, 0); if (0!=(lpxx->lfItalic=HIWORD(l))) lpcf->nFontType |= ITALIC_FONTTYPE; if ((lpxx->lfWeight=LOWORD(l)) > FW_MEDIUM) lpcf->nFontType |= BOLD_FONTTYPE; } - i=SendDlgItemMessageA(hDlg, cmb3, CB_GETCURSEL, 0, 0); + i=SendDlgItemMessageW(hDlg, cmb3, CB_GETCURSEL, 0, 0); if( i != CB_ERR) - lpcf->iPointSize = 10 * LOWORD(SendDlgItemMessageA(hDlg, cmb3, + lpcf->iPointSize = 10 * LOWORD(SendDlgItemMessageW(hDlg, cmb3, CB_GETITEMDATA , i, 0)); else lpcf->iPointSize = 100; @@ -945,9 +952,9 @@ CFn_ReleaseDC(lpcf, hdc); } else lpxx->lfHeight = -lpcf->iPointSize / 10; - i=SendDlgItemMessageA(hDlg, cmb5, CB_GETCURSEL, 0, 0); + i=SendDlgItemMessageW(hDlg, cmb5, CB_GETCURSEL, 0, 0); if (i!=CB_ERR) - lpxx->lfCharSet=SendDlgItemMessageA(hDlg, cmb5, CB_GETITEMDATA, i, 0); + lpxx->lfCharSet=SendDlgItemMessageW(hDlg, cmb5, CB_GETITEMDATA, i, 0); else lpxx->lfCharSet = DEFAULT_CHARSET; lpxx->lfStrikeOut=IsDlgButtonChecked(hDlg,chx1); @@ -968,7 +975,7 @@ break; case cmb4: - i=SendDlgItemMessageA(hDlg, cmb4, CB_GETCURSEL, 0, 0); + i=SendDlgItemMessageW(hDlg, cmb4, CB_GETCURSEL, 0, 0); if (i!=CB_ERR) { WINDOWINFO wininfo; @@ -985,9 +992,9 @@ break; case psh15: - i=RegisterWindowMessageA( HELPMSGSTRINGA ); + i=RegisterWindowMessageW( HELPMSGSTRINGW ); if (lpcf->hwndOwner) - SendMessageA(lpcf->hwndOwner, i, 0, (LPARAM)GetPropA(hDlg, WINE_FONTDATA)); + SendMessageW(lpcf->hwndOwner, i, 0, (LPARAM)GetPropW(hDlg, strWineFontData)); /* if (CFn_HookCallChk(lpcf)) CallWindowProc16(lpcf->lpfnHook,hDlg,WM_COMMAND,psh15,(LPARAM)lpcf);*/ break; @@ -1000,10 +1007,11 @@ EndDialog(hDlg, TRUE); else { - char buffer[80]; - sprintf(buffer,"Select a font size between %d and %d points.", - lpcf->nSizeMin,lpcf->nSizeMax); - MessageBoxA(hDlg, buffer, NULL, MB_OK); + WCHAR buffer[80]; + WCHAR format[80]; + LoadStringW(COMDLG32_hInstance, IDS_FONT_SIZE, format, sizeof(format)/sizeof(WCHAR)); + wsprintfW(buffer, format, lpcf->nSizeMin,lpcf->nSizeMax); + MessageBoxW(hDlg, buffer, NULL, MB_OK); } return(TRUE); case IDCANCEL: @@ -1013,18 +1021,44 @@ return(FALSE); } -LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam) +LRESULT CFn_WMDestroy(HWND hwnd, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpcfw) { + LPCHOOSEFONTA lpcfa; + LPCSTR lpTemplateName; + LPSTR lpszStyle; + LPLOGFONTA lpLogFonta; + int len; + + lpcfa = GetPropW(hwnd, strWineFontData_a); + lpLogFonta = lpcfa->lpLogFont; + lpTemplateName = lpcfa->lpTemplateName; + lpszStyle = lpcfa->lpszStyle; + memcpy(lpcfa, lpcfw, sizeof(CHOOSEFONTA)); + lpcfa->lpLogFont = lpLogFonta; + lpcfa->lpTemplateName = lpTemplateName; + lpcfa->lpszStyle = lpszStyle; + memcpy(lpcfa->lpLogFont, lpcfw->lpLogFont, sizeof(LOGFONTA)); + WideCharToMultiByte(CP_ACP, 0, lpcfw->lpLogFont->lfFaceName, + LF_FACESIZE, lpcfa->lpLogFont->lfFaceName, LF_FACESIZE, 0, 0); + + if(lpcfw->lpszStyle) { + len = WideCharToMultiByte(CP_ACP, 0, lpcfw->lpszStyle, -1, NULL, -1, 0, 0); + WideCharToMultiByte(CP_ACP, 0, lpcfw->lpszStyle, -1, lpcfa->lpszStyle, len, 0, 0); + HeapFree(GetProcessHeap(), 0, lpcfw->lpszStyle); + } + + HeapFree(GetProcessHeap(), 0, (LPBYTE)lpcfw->lpTemplateName); + HeapFree(GetProcessHeap(), 0, lpcfw->lpLogFont); + HeapFree(GetProcessHeap(), 0, lpcfw); + return TRUE; } -LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, - LPCHOOSEFONTA lpcf ) +LRESULT CFn_WMPaint(HWND hDlg, WPARAM wParam, LPARAM lParam, LPCHOOSEFONTW lpcf) { WINDOWINFO info; info.cbSize=sizeof(info); - if( GetWindowInfo( GetDlgItem( hDlg, stc5), &info ) ) { PAINTSTRUCT ps; @@ -1032,7 +1066,7 @@ HPEN hOrigPen; HFONT hOrigFont; COLORREF rgbPrev; - LOGFONTA lf = *(lpcf->lpLogFont); + LOGFONTW lf = *(lpcf->lpLogFont); MapWindowPoints( 0, hDlg, (LPPOINT) &info.rcWindow, 2); hdc = BeginPaint( hDlg, &ps ); @@ -1058,7 +1092,7 @@ info.rcWindow.bottom--; info.rcWindow.top++; info.rcWindow.left++; - hOrigFont = SelectObject( hdc, CreateFontIndirectA( &lf ) ); + hOrigFont = SelectObject( hdc, CreateFontIndirectW( &lf ) ); rgbPrev=SetTextColor( hdc, lpcf->rgbColors ); DrawTextW( hdc, @@ -1077,29 +1111,50 @@ INT_PTR CALLBACK FormatCharDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - LPCHOOSEFONTA lpcf; + LPCHOOSEFONTW lpcfw; + LPCHOOSEFONTA lpcfa; INT_PTR res = FALSE; + int len; - if (uMsg!=WM_INITDIALOG) - { - lpcf=(LPCHOOSEFONTA)GetPropA(hDlg, WINE_FONTDATA); - if (!lpcf && uMsg != WM_MEASUREITEM) + if (uMsg!=WM_INITDIALOG) { + lpcfw = (LPCHOOSEFONTW)GetPropW(hDlg, strWineFontData); + if (!lpcfw) return FALSE; - if (CFn_HookCallChk32(lpcf)) - res=CallWindowProcA((WNDPROC)lpcf->lpfnHook, hDlg, uMsg, wParam, lParam); + if (CFn_HookCallChk32(lpcfw)) + res=CallWindowProcA((WNDPROC)lpcfw->lpfnHook, hDlg, uMsg, wParam, lParam); if (res) return res; - } - else - { - lpcf=(LPCHOOSEFONTA)lParam; - if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf)) + } else { + lpcfa=(LPCHOOSEFONTA)lParam; + SetPropW(hDlg, strWineFontData_a, (HANDLE)lParam); + + lpcfw = HeapAlloc(GetProcessHeap(), 0, sizeof(CHOOSEFONTW)); + memcpy(lpcfw, lpcfa, sizeof(CHOOSEFONTA)); + lpcfw->lpLogFont = HeapAlloc(GetProcessHeap(), 0, sizeof(LOGFONTW)); + memcpy(lpcfw->lpLogFont, lpcfa->lpLogFont, sizeof(LOGFONTA)); + MultiByteToWideChar(CP_ACP, 0, lpcfa->lpLogFont->lfFaceName, + LF_FACESIZE, lpcfw->lpLogFont->lfFaceName, LF_FACESIZE); + + if(lpcfa->lpszStyle) { + len = MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, NULL, 0); + lpcfw->lpszStyle = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, lpcfa->lpszStyle, -1, lpcfw->lpszStyle, len); + } + + if(lpcfa->lpTemplateName) { + len = MultiByteToWideChar(CP_ACP, 0, lpcfa->lpTemplateName, -1, NULL, 0); + lpcfw->lpTemplateName = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, lpcfa->lpTemplateName, + -1, (LPWSTR)lpcfw->lpTemplateName, len); + } + + if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcfw)) { TRACE("CFn_WMInitDialog returned FALSE\n"); return FALSE; } - if (CFn_HookCallChk32(lpcf)) - return CallWindowProcA((WNDPROC)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); + if (CFn_HookCallChk32(lpcfw)) + return CallWindowProcA((WNDPROC)lpcfa->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); } switch (uMsg) { @@ -1108,16 +1163,15 @@ case WM_DRAWITEM: return CFn_WMDrawItem(hDlg, wParam, lParam); case WM_COMMAND: - return CFn_WMCommand(hDlg, wParam, lParam, lpcf); + return CFn_WMCommand(hDlg, wParam, lParam, lpcfw); case WM_DESTROY: - return CFn_WMDestroy(hDlg, wParam, lParam); + return CFn_WMDestroy(hDlg, wParam, lParam, lpcfw); case WM_CHOOSEFONT_GETLOGFONT: - TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", - lParam); + TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam); FIXME("current logfont back to caller\n"); break; case WM_PAINT: - return CFn_WMPaint(hDlg, wParam, lParam, lpcf); + return CFn_WMPaint(hDlg, wParam, lParam, lpcfw); } return res; } @@ -1128,29 +1182,29 @@ INT_PTR CALLBACK FormatCharDlgProcW(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - LPCHOOSEFONTW lpcf32w; + LPCHOOSEFONTW lpcf; INT_PTR res = FALSE; if (uMsg!=WM_INITDIALOG) { - lpcf32w=(LPCHOOSEFONTW)GetPropA(hDlg, WINE_FONTDATA); - if (!lpcf32w) + lpcf=(LPCHOOSEFONTW)GetPropW(hDlg, strWineFontData); + if (!lpcf) return FALSE; - if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w)) - res=CallWindowProcW((WNDPROC)lpcf32w->lpfnHook, hDlg, uMsg, wParam, lParam); + if (CFn_HookCallChk32(lpcf)) + res=CallWindowProcW((WNDPROC)lpcf->lpfnHook, hDlg, uMsg, wParam, lParam); if (res) return res; } else { - lpcf32w=(LPCHOOSEFONTW)lParam; - if (!CFn_WMInitDialog(hDlg, wParam, lParam, (LPCHOOSEFONTA)lpcf32w)) + lpcf=(LPCHOOSEFONTW)lParam; + if (!CFn_WMInitDialog(hDlg, wParam, lParam, lpcf)) { TRACE("CFn_WMInitDialog returned FALSE\n"); return FALSE; } - if (CFn_HookCallChk32((LPCHOOSEFONTA)lpcf32w)) - return CallWindowProcW((WNDPROC)lpcf32w->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); + if (CFn_HookCallChk32(lpcf)) + return CallWindowProcW((WNDPROC)lpcf->lpfnHook,hDlg,WM_INITDIALOG,wParam,lParam); } switch (uMsg) { @@ -1159,14 +1213,15 @@ case WM_DRAWITEM: return CFn_WMDrawItem(hDlg, wParam, lParam); case WM_COMMAND: - return CFn_WMCommand(hDlg, wParam, lParam, (LPCHOOSEFONTW)lpcf32w); + return CFn_WMCommand(hDlg, wParam, lParam, lpcf); case WM_DESTROY: - return CFn_WMDestroy(hDlg, wParam, lParam); + return TRUE; case WM_CHOOSEFONT_GETLOGFONT: - TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", - lParam); + TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam); FIXME("current logfont back to caller\n"); break; + case WM_PAINT: + return CFn_WMPaint(hDlg, wParam, lParam, lpcf); } return res; } diff -urN wine-20041201/dlls/commdlg/fontdlg16.c wine-20050111/dlls/commdlg/fontdlg16.c --- wine-20041201/dlls/commdlg/fontdlg16.c 2004-09-22 21:36:47.000000000 +0200 +++ wine-20050111/dlls/commdlg/fontdlg16.c 2004-12-23 19:24:50.000000000 +0100 @@ -41,7 +41,7 @@ #include "cdlg.h" #include "cdlg16.h" -static void FONT_LogFont16To32A( const LPLOGFONT16 font16, LPLOGFONTA font32 ) +static void FONT_LogFont16To32W( const LPLOGFONT16 font16, LPLOGFONTW font32 ) { font32->lfHeight = font16->lfHeight; font32->lfWidth = font16->lfWidth; @@ -56,35 +56,50 @@ font32->lfClipPrecision = font16->lfClipPrecision; font32->lfQuality = font16->lfQuality; font32->lfPitchAndFamily = font16->lfPitchAndFamily; - lstrcpynA( font32->lfFaceName, font16->lfFaceName, LF_FACESIZE ); + MultiByteToWideChar(CP_ACP, 0, font16->lfFaceName, + LF_FACESIZE, font32->lfFaceName, LF_FACESIZE); }; -static void FONT_Metrics16To32A( const TEXTMETRIC16 *pm16, - NEWTEXTMETRICEXA *pnm32a) +static void FONT_Metrics16To32W( const TEXTMETRIC16 *pm16, + NEWTEXTMETRICEXW *pnm32w) { - ZeroMemory( pnm32a, sizeof(NEWTEXTMETRICEXA)); + ZeroMemory( pnm32w, sizeof(NEWTEXTMETRICEXW)); /* NOTE: only the fields used by AddFontStyle() are filled in */ - pnm32a->ntmTm.tmHeight = pm16->tmHeight; - pnm32a->ntmTm.tmExternalLeading = pm16->tmExternalLeading; + pnm32w->ntmTm.tmHeight = pm16->tmHeight; + pnm32w->ntmTm.tmExternalLeading = pm16->tmExternalLeading; }; -static void CFn_CHOOSEFONT16to32A(LPCHOOSEFONT16 chf16, LPCHOOSEFONTA chf32a) +static void CFn_CHOOSEFONT16to32W(LPCHOOSEFONT16 chf16, LPCHOOSEFONTW chf32w) { - chf32a->lStructSize=sizeof(CHOOSEFONTA); - chf32a->hwndOwner=HWND_32(chf16->hwndOwner); - chf32a->hDC=HDC_32(chf16->hDC); - chf32a->iPointSize=chf16->iPointSize; - chf32a->Flags=chf16->Flags; - chf32a->rgbColors=chf16->rgbColors; - chf32a->lCustData=chf16->lCustData; - chf32a->lpfnHook=NULL; - chf32a->lpTemplateName=MapSL(chf16->lpTemplateName); - chf32a->hInstance=HINSTANCE_32(chf16->hInstance); - chf32a->lpszStyle=MapSL(chf16->lpszStyle); - chf32a->nFontType=chf16->nFontType; - chf32a->nSizeMax=chf16->nSizeMax; - chf32a->nSizeMin=chf16->nSizeMin; - FONT_LogFont16To32A(MapSL(chf16->lpLogFont), chf32a->lpLogFont); + int len; + if(chf16->lpTemplateName) + { + len = MultiByteToWideChar(CP_ACP, 0, (LPBYTE)chf16->lpTemplateName, -1, NULL, 0); + chf32w->lpTemplateName = HeapAlloc(GetProcessHeap(), 0,len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, (LPSTR)MapSL(chf16->lpTemplateName), + -1, (LPWSTR)chf32w->lpTemplateName, len); + } + if(chf16->lpszStyle) + { + len = MultiByteToWideChar(CP_ACP, 0, (LPBYTE)chf16->lpszStyle, -1, NULL, 0); + chf32w->lpszStyle = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP, 0, (LPSTR)MapSL(chf16->lpTemplateName), + -1, chf32w->lpszStyle, len); + } + chf32w->lStructSize=sizeof(CHOOSEFONTW); + chf32w->hwndOwner=HWND_32(chf16->hwndOwner); + chf32w->hDC=HDC_32(chf16->hDC); + chf32w->iPointSize=chf16->iPointSize; + chf32w->Flags=chf16->Flags; + chf32w->rgbColors=chf16->rgbColors; + chf32w->lCustData=chf16->lCustData; + chf32w->lpfnHook=NULL; + chf32w->hInstance=HINSTANCE_32(chf16->hInstance); + chf32w->lpszStyle=MapSL(chf16->lpszStyle); + chf32w->nFontType=chf16->nFontType; + chf32w->nSizeMax=chf16->nSizeMax; + chf32w->nSizeMin=chf16->nSizeMin; + FONT_LogFont16To32W(MapSL(chf16->lpLogFont), chf32w->lpLogFont); }; /*********************************************************************** @@ -110,12 +125,12 @@ LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); LOGFONT16 *lplf = MapSL( logfont ); TEXTMETRIC16 *lpmtrx16 = MapSL(metrics); - ENUMLOGFONTEXA elf32a; - NEWTEXTMETRICEXA nmtrx32a; - FONT_LogFont16To32A(lplf, &(elf32a.elfLogFont)); - FONT_Metrics16To32A(lpmtrx16, &nmtrx32a); - return AddFontFamily(&elf32a, &nmtrx32a, nFontType, - (LPCHOOSEFONTA)lpcf->lpTemplateName, hwnd,NULL); + ENUMLOGFONTEXW elf32w; + NEWTEXTMETRICEXW nmtrx32w; + FONT_LogFont16To32W(lplf, &(elf32w.elfLogFont)); + FONT_Metrics16To32W(lpmtrx16, &nmtrx32w); + return AddFontFamily(&elf32w, &nmtrx32w, nFontType, + (LPCHOOSEFONTW)lpcf->lpTemplateName, hwnd,NULL); } /*********************************************************************** @@ -130,12 +145,12 @@ LPCHOOSEFONT16 lpcf=(LPCHOOSEFONT16)GetWindowLongA(hDlg, DWL_USER); LOGFONT16 *lplf = MapSL(logfont); TEXTMETRIC16 *lpmtrx16 = MapSL(metrics); - ENUMLOGFONTEXA elf32a; - NEWTEXTMETRICEXA nmtrx32a; - FONT_LogFont16To32A(lplf, &(elf32a.elfLogFont)); - FONT_Metrics16To32A(lpmtrx16, &nmtrx32a); - return AddFontStyle(&elf32a, &nmtrx32a, nFontType, - (LPCHOOSEFONTA)lpcf->lpTemplateName, hcmb2, hcmb3, hDlg, TRUE); + ENUMLOGFONTEXW elf32w; + NEWTEXTMETRICEXW nmtrx32w; + FONT_LogFont16To32W(lplf, &(elf32w.elfLogFont)); + FONT_Metrics16To32W(lpmtrx16, &nmtrx32w); + return AddFontStyle(&elf32w, &nmtrx32w, nFontType, + (LPCHOOSEFONTW)lpcf->lpTemplateName, hcmb2, hcmb3, hDlg, TRUE); } /*********************************************************************** @@ -149,13 +164,13 @@ BOOL16 bRet = FALSE; LPCVOID template; FARPROC16 ptr; - CHOOSEFONTA cf32a; - LOGFONTA lf32a; + CHOOSEFONTW cf32w; + LOGFONTW lf32w; LOGFONT16 *font16; SEGPTR lpTemplateName; - cf32a.lpLogFont=&lf32a; - CFn_CHOOSEFONT16to32A(lpChFont, &cf32a); + cf32w.lpLogFont=&lf32w; + CFn_CHOOSEFONT16to32W(lpChFont, &cf32w); TRACE("ChooseFont\n"); if (!lpChFont) return FALSE; @@ -228,7 +243,7 @@ /* lpTemplateName is not used in the dialog */ lpTemplateName=lpChFont->lpTemplateName; - lpChFont->lpTemplateName=(SEGPTR)&cf32a; + lpChFont->lpTemplateName=(SEGPTR)&cf32w; ptr = GetProcAddress16(GetModuleHandle16("COMMDLG"), (LPCSTR) 16); hInst = GetWindowLongPtrA(HWND_32(lpChFont->hwndOwner), GWLP_HINSTANCE); @@ -242,27 +257,32 @@ } lpChFont->lpTemplateName=lpTemplateName; - lpChFont->iPointSize = cf32a.iPointSize; - lpChFont->Flags = cf32a.Flags; - lpChFont->rgbColors = cf32a.rgbColors; - lpChFont->lCustData = cf32a.lCustData; - lpChFont->nFontType = cf32a.nFontType; + lpChFont->iPointSize = cf32w.iPointSize; + lpChFont->Flags = cf32w.Flags; + lpChFont->rgbColors = cf32w.rgbColors; + lpChFont->lCustData = cf32w.lCustData; + lpChFont->nFontType = cf32w.nFontType; font16 = MapSL(lpChFont->lpLogFont); - font16->lfHeight = cf32a.lpLogFont->lfHeight; - font16->lfWidth = cf32a.lpLogFont->lfWidth; - font16->lfEscapement = cf32a.lpLogFont->lfEscapement; - font16->lfOrientation = cf32a.lpLogFont->lfOrientation; - font16->lfWeight = cf32a.lpLogFont->lfWeight; - font16->lfItalic = cf32a.lpLogFont->lfItalic; - font16->lfUnderline = cf32a.lpLogFont->lfUnderline; - font16->lfStrikeOut = cf32a.lpLogFont->lfStrikeOut; - font16->lfCharSet = cf32a.lpLogFont->lfCharSet; - font16->lfOutPrecision = cf32a.lpLogFont->lfOutPrecision; - font16->lfClipPrecision = cf32a.lpLogFont->lfClipPrecision; - font16->lfQuality = cf32a.lpLogFont->lfQuality; - font16->lfPitchAndFamily = cf32a.lpLogFont->lfPitchAndFamily; - lstrcpynA( font16->lfFaceName, cf32a.lpLogFont->lfFaceName, LF_FACESIZE ); + font16->lfHeight = cf32w.lpLogFont->lfHeight; + font16->lfWidth = cf32w.lpLogFont->lfWidth; + font16->lfEscapement = cf32w.lpLogFont->lfEscapement; + font16->lfOrientation = cf32w.lpLogFont->lfOrientation; + font16->lfWeight = cf32w.lpLogFont->lfWeight; + font16->lfItalic = cf32w.lpLogFont->lfItalic; + font16->lfUnderline = cf32w.lpLogFont->lfUnderline; + font16->lfStrikeOut = cf32w.lpLogFont->lfStrikeOut; + font16->lfCharSet = cf32w.lpLogFont->lfCharSet; + font16->lfOutPrecision = cf32w.lpLogFont->lfOutPrecision; + font16->lfClipPrecision = cf32w.lpLogFont->lfClipPrecision; + font16->lfQuality = cf32w.lpLogFont->lfQuality; + font16->lfPitchAndFamily = cf32w.lpLogFont->lfPitchAndFamily; + WideCharToMultiByte(CP_ACP, 0, cf32w.lpLogFont->lfFaceName, + LF_FACESIZE, font16->lfFaceName, LF_FACESIZE, 0, 0); + + HeapFree(GetProcessHeap(), 0, (LPBYTE)cf32w.lpTemplateName); + HeapFree(GetProcessHeap(), 0, cf32w.lpszStyle); + return bRet; } @@ -291,7 +311,7 @@ else { lpcf=(LPCHOOSEFONT16)lParam; - if (!CFn_WMInitDialog(hDlg, wParam, lParam, (LPCHOOSEFONTA)lpcf->lpTemplateName)) + if (!CFn_WMInitDialog(hDlg, wParam, lParam, (LPCHOOSEFONTW)lpcf->lpTemplateName)) { TRACE("CFn_WMInitDialog returned FALSE\n"); return FALSE; @@ -337,17 +357,16 @@ break; case WM_COMMAND: res=CFn_WMCommand(hDlg, MAKEWPARAM( wParam, HIWORD(lParam) ), LOWORD(lParam), - (LPCHOOSEFONTA)lpcf->lpTemplateName); + (LPCHOOSEFONTW)lpcf->lpTemplateName); break; case WM_DESTROY: - res=CFn_WMDestroy(hDlg, wParam, lParam); - break; + return TRUE; case WM_CHOOSEFONT_GETLOGFONT: TRACE("WM_CHOOSEFONT_GETLOGFONT lParam=%08lX\n", lParam); FIXME("current logfont back to caller\n"); break; case WM_PAINT: - res= CFn_WMPaint(hDlg, wParam, lParam, (LPCHOOSEFONTA)lpcf->lpTemplateName); + res= CFn_WMPaint(hDlg, wParam, lParam, (LPCHOOSEFONTW)lpcf->lpTemplateName); break; } return res; diff -urN wine-20041201/dlls/commdlg/printdlg.c wine-20050111/dlls/commdlg/printdlg.c --- wine-20041201/dlls/commdlg/printdlg.c 2004-11-29 19:00:11.000000000 +0100 +++ wine-20050111/dlls/commdlg/printdlg.c 2004-12-23 19:24:50.000000000 +0100 @@ -479,8 +479,8 @@ out: GlobalUnlock(pdlga->hDevNames); GlobalUnlock(pdlga->hDevMode); - if (Names) HeapFree(GetProcessHeap(),0,Names); - if (points) HeapFree(GetProcessHeap(),0,points); + HeapFree(GetProcessHeap(),0,Names); + HeapFree(GetProcessHeap(),0,points); return retval; } @@ -537,8 +537,8 @@ out: GlobalUnlock(pdlga->hDevNames); GlobalUnlock(pdlga->hDevMode); - if (Names) HeapFree(GetProcessHeap(),0,Names); - if (points) HeapFree(GetProcessHeap(),0,points); + HeapFree(GetProcessHeap(),0,Names); + HeapFree(GetProcessHeap(),0,points); return retval; } @@ -860,10 +860,8 @@ DWORD needed; HANDLE hprn; - if(PrintStructures->lpPrinterInfo) - HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo); - if(PrintStructures->lpDriverInfo) - HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo); + HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo); + HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo); if(!OpenPrinterA(name, &hprn, NULL)) { ERR("Can't open printer %s\n", name); return FALSE; @@ -883,10 +881,8 @@ PRINTDLG_UpdatePrinterInfoTextsA(hDlg, PrintStructures->lpPrinterInfo); - if(PrintStructures->lpDevMode) { - HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode); - PrintStructures->lpDevMode = NULL; - } + HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode); + PrintStructures->lpDevMode = NULL; dmSize = DocumentPropertiesA(0, 0, name, NULL, NULL, 0); if(dmSize == -1) { @@ -928,15 +924,6 @@ if (lppd->Flags & PD_PAGENUMS) CheckRadioButton(hDlg, rad1, rad3, rad3); } - /* "All xxx pages"... */ - { - char resourcestr[64]; - char result[64]; - LoadStringA(COMDLG32_hInstance, PD32_PRINT_ALL_X_PAGES, - resourcestr, 49); - sprintf(result,resourcestr,lppd->nMaxPage - lppd->nMinPage + 1); - SendDlgItemMessageA(hDlg, rad1, WM_SETTEXT, 0, (LPARAM) result); - } /* Collate pages * @@ -1022,10 +1009,8 @@ DWORD needed; HANDLE hprn; - if(PrintStructures->lpPrinterInfo) - HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo); - if(PrintStructures->lpDriverInfo) - HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo); + HeapFree(GetProcessHeap(),0, PrintStructures->lpPrinterInfo); + HeapFree(GetProcessHeap(),0, PrintStructures->lpDriverInfo); if(!OpenPrinterW(name, &hprn, NULL)) { ERR("Can't open printer %s\n", debugstr_w(name)); return FALSE; @@ -1045,10 +1030,8 @@ PRINTDLG_UpdatePrinterInfoTextsW(hDlg, PrintStructures->lpPrinterInfo); - if(PrintStructures->lpDevMode) { - HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode); - PrintStructures->lpDevMode = NULL; - } + HeapFree(GetProcessHeap(), 0, PrintStructures->lpDevMode); + PrintStructures->lpDevMode = NULL; dmSize = DocumentPropertiesW(0, 0, name, NULL, NULL, 0); if(dmSize == -1) { @@ -1090,15 +1073,6 @@ if (lppd->Flags & PD_PAGENUMS) CheckRadioButton(hDlg, rad1, rad3, rad3); } - /* "All xxx pages"... */ - { - WCHAR resourcestr[64]; - WCHAR result[64]; - LoadStringW(COMDLG32_hInstance, PD32_PRINT_ALL_X_PAGES, - resourcestr, 49); - wsprintfW(result,resourcestr,lppd->nMaxPage - lppd->nMinPage + 1); - SendDlgItemMessageW(hDlg, rad1, WM_SETTEXT, 0, (LPARAM) result); - } /* Collate pages * @@ -1412,7 +1386,7 @@ switch (LOWORD(wParam)) { case IDOK: TRACE(" OK button was hit\n"); - if (PRINTDLG_UpdatePrintDlgA(hDlg, PrintStructures)!=TRUE) { + if (!PRINTDLG_UpdatePrintDlgA(hDlg, PrintStructures)) { FIXME("Update printdlg was not successful!\n"); return(FALSE); } @@ -1589,7 +1563,7 @@ switch (LOWORD(wParam)) { case IDOK: TRACE(" OK button was hit\n"); - if (PRINTDLG_UpdatePrintDlgW(hDlg, PrintStructures)!=TRUE) { + if (!PRINTDLG_UpdatePrintDlgW(hDlg, PrintStructures)) { FIXME("Update printdlg was not successful!\n"); return(FALSE); } diff -urN wine-20041201/dlls/d3d8/cubetexture.c wine-20050111/dlls/d3d8/cubetexture.c --- wine-20041201/dlls/d3d8/cubetexture.c 2004-09-08 03:50:38.000000000 +0200 +++ wine-20050111/dlls/d3d8/cubetexture.c 2005-01-09 17:42:53.000000000 +0100 @@ -224,11 +224,9 @@ if (Level < This->levels) { TRACE("(%p) level (%d)\n", This, Level); return IDirect3DSurface8Impl_GetDesc((LPDIRECT3DSURFACE8) This->surfaces[0][Level], pDesc); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; } - return D3D_OK; + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); + return D3DERR_INVALIDCALL; } HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8** ppCubeMapSurface) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; diff -urN wine-20041201/dlls/d3d8/d3d8_private.h wine-20050111/dlls/d3d8/d3d8_private.h --- wine-20041201/dlls/d3d8/d3d8_private.h 2004-10-08 22:52:33.000000000 +0200 +++ wine-20050111/dlls/d3d8/d3d8_private.h 2005-01-09 18:37:02.000000000 +0100 @@ -643,6 +643,8 @@ BOOL Dirty; BOOL inTexture; BOOL inPBuffer; + + IWineD3DSurface *wineD3DSurface; }; /* IUnknown: */ diff -urN wine-20041201/dlls/d3d8/device.c wine-20050111/dlls/d3d8/device.c --- wine-20041201/dlls/d3d8/device.c 2004-11-30 22:39:00.000000000 +0100 +++ wine-20050111/dlls/d3d8/device.c 2004-12-23 19:33:45.000000000 +0100 @@ -1966,7 +1966,7 @@ /* If we are disabling it, check it was enabled, and still only do something if it has assigned a glIndex (which it should have!) */ - if ((lightInfo->lightEnabled == TRUE) && (lightInfo->glIndex != -1)) { + if (lightInfo->lightEnabled && (lightInfo->glIndex != -1)) { TRACE("Disabling light set up at gl idx %ld\n", lightInfo->glIndex); ENTER_GL(); glDisable(GL_LIGHT0 + lightInfo->glIndex); @@ -1979,7 +1979,7 @@ } else { /* We are enabling it. If it is enabled, its really simple */ - if (lightInfo->lightEnabled == TRUE) { + if (lightInfo->lightEnabled) { /* nop */ TRACE("Nothing to do as light was enabled\n"); @@ -3216,7 +3216,7 @@ textureType = IDirect3DBaseTexture8Impl_GetType(pTexture); if (textureType == D3DRTYPE_TEXTURE) { - if (oldTxt == pTexture && TRUE == IDirect3DBaseTexture8Impl_IsDirty(pTexture)) { + if (oldTxt == pTexture && IDirect3DBaseTexture8Impl_IsDirty(pTexture)) { TRACE("Skipping setting texture as old == new\n"); reapplyStates = FALSE; } else { @@ -3228,7 +3228,7 @@ IDirect3DTexture8Impl_PreLoad((LPDIRECT3DTEXTURE8) pTexture); } } else if (textureType == D3DRTYPE_VOLUMETEXTURE) { - if (oldTxt == pTexture && TRUE == IDirect3DBaseTexture8Impl_IsDirty(pTexture)) { + if (oldTxt == pTexture && IDirect3DBaseTexture8Impl_IsDirty(pTexture)) { TRACE("Skipping setting texture as old == new\n"); reapplyStates = FALSE; } else { @@ -3240,7 +3240,7 @@ IDirect3DVolumeTexture8Impl_PreLoad((LPDIRECT3DVOLUMETEXTURE8) pTexture); } } else if (textureType == D3DRTYPE_CUBETEXTURE) { - if (oldTxt == pTexture && TRUE == IDirect3DBaseTexture8Impl_IsDirty(pTexture)) { + if (oldTxt == pTexture && IDirect3DBaseTexture8Impl_IsDirty(pTexture)) { TRACE("Skipping setting texture as old == new\n"); reapplyStates = FALSE; } else { @@ -4055,7 +4055,7 @@ } TRACE_(d3d_shader)("(%p) : freing VertexShader %p\n", This, object); /* TODO: check validity of object */ - if (NULL != object->function) HeapFree(GetProcessHeap(), 0, (void *)object->function); + HeapFree(GetProcessHeap(), 0, (void *)object->function); if (object->prgId != 0) { GL_EXTCALL(glDeleteProgramsARB( 1, &object->prgId )); } @@ -4240,7 +4240,7 @@ } TRACE_(d3d_shader)("(%p) : freeing PixelShader %p\n", This, object); /* TODO: check validity of object before free */ - if (NULL != object->function) HeapFree(GetProcessHeap(), 0, (void *)object->function); + HeapFree(GetProcessHeap(), 0, (void *)object->function); if (object->prgId != 0) { GL_EXTCALL(glDeleteProgramsARB( 1, &object->prgId )); } diff -urN wine-20041201/dlls/d3d8/directx.c wine-20050111/dlls/d3d8/directx.c --- wine-20041201/dlls/d3d8/directx.c 2004-11-23 14:52:46.000000000 +0100 +++ wine-20050111/dlls/d3d8/directx.c 2005-01-09 18:37:02.000000000 +0100 @@ -538,6 +538,24 @@ } +/* Internal function called back during the CreateDevice to create a render target */ +HRESULT WINAPI D3D8CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Height, + D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, + DWORD MultisampleQuality, BOOL Lockable, + IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) { + HRESULT res = D3D_OK; + IDirect3DSurface8Impl *d3dSurface = NULL; + + /* Note - Throw away MultisampleQuality and SharedHandle - only relevant for d3d9 */ + res = IDirect3DDevice8_CreateRenderTarget((IDirect3DDevice8 *)device, Width, Height, + Format, MultiSample, Lockable, + (IDirect3DSurface8 **)&d3dSurface); + if (res == D3D_OK) { + *ppSurface = d3dSurface->wineD3DSurface; + } + return res; +} + HRESULT WINAPI IDirect3D8Impl_CreateDevice (LPDIRECT3D8 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, @@ -583,7 +601,7 @@ localParameters.Flags = &pPresentationParameters->Flags; localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz; localParameters.PresentationInterval = &pPresentationParameters->FullScreen_PresentationInterval; /* Renamed in dx9 */ - IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object); + IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D8CB_CreateRenderTarget); /** use StateBlock Factory here, for creating the startup stateBlock */ object->StateBlock = NULL; diff -urN wine-20041201/dlls/d3d8/drawprim.c wine-20050111/dlls/d3d8/drawprim.c --- wine-20041201/dlls/d3d8/drawprim.c 2004-11-30 22:39:00.000000000 +0100 +++ wine-20050111/dlls/d3d8/drawprim.c 2004-12-09 15:08:00.000000000 +0100 @@ -167,7 +167,7 @@ BOOL requires_material_reset = FALSE; IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; - if (This->tracking_color == NEEDS_TRACKING && isDiffuseSupplied == TRUE) { + if (This->tracking_color == NEEDS_TRACKING && isDiffuseSupplied) { /* If we have not set up the material color tracking, do it now as required */ glDisable(GL_COLOR_MATERIAL); /* Note: Man pages state must enable AFTER calling glColorMaterial! Required?*/ checkGLcall("glDisable GL_COLOR_MATERIAL"); @@ -187,7 +187,7 @@ This->tracking_color = NEEDS_TRACKING; requires_material_reset = TRUE; /* Restore material settings as will be used */ - } else if (This->tracking_color == IS_TRACKING && isDiffuseSupplied == TRUE) { + } else if (This->tracking_color == IS_TRACKING && isDiffuseSupplied) { /* No need to reset material colors since no change to gl_color_material */ requires_material_reset = FALSE; @@ -199,7 +199,7 @@ } /* Reset the material colors which may have been tracking the color*/ - if (requires_material_reset == TRUE) { + if (requires_material_reset) { glMaterialfv(GL_FRONT_AND_BACK, GL_AMBIENT, (float*) &This->StateBlock->material.Ambient); checkGLcall("glMaterialfv"); glMaterialfv(GL_FRONT_AND_BACK, GL_DIFFUSE, (float*) &This->StateBlock->material.Diffuse); @@ -393,7 +393,7 @@ if (LoopThroughTo == 1) { /* VertexShader is FVF */ thisFVF = This->UpdateStateBlock->VertexShader; /* Handle memory passed directly as well as vertex buffers */ - if (This->StateBlock->streamIsUP == TRUE) { + if (This->StateBlock->streamIsUP) { data = (BYTE *)This->StateBlock->stream_source[nStream]; } else { data = ((IDirect3DVertexBuffer8Impl *)This->StateBlock->stream_source[nStream])->allocatedMemory; @@ -526,13 +526,13 @@ IDirect3DDevice8Impl *This = (IDirect3DDevice8Impl *)iface; /* Diffuse -------------------------------- */ - if (isDiffuse == TRUE) { + if (isDiffuse) { glColor4fv(dRGBA); VTRACE(("glColor4f: r,g,b,a=%f,%f,%f,%f\n", dRGBA[0], dRGBA[1], dRGBA[2], dRGBA[3])); } /* Specular Colour ------------------------------------------*/ - if (isSpecular == TRUE) { + if (isSpecular) { if (GL_SUPPORT(EXT_SECONDARY_COLOR)) { GL_EXTCALL(glSecondaryColor3fvEXT(sRGB)); VTRACE(("glSecondaryColor4f: r,g,b=%f,%f,%f\n", sRGB[0], sRGB[1], sRGB[2])); @@ -542,13 +542,13 @@ } /* Normal -------------------------------- */ - if (isNormal == TRUE) { + if (isNormal) { VTRACE(("glNormal:nx,ny,nz=%f,%f,%f\n", nx,ny,nz)); glNormal3f(nx, ny, nz); } /* Point Size ----------------------------------------------*/ - if (isPtSize == TRUE) { + if (isPtSize) { /* no such functionality in the fixed function GL pipeline */ FIXME("Cannot change ptSize here in openGl\n"); @@ -644,7 +644,7 @@ } /* End of textures */ /* Position -------------------------------- */ - if (isXYZ == TRUE) { + if (isXYZ) { if (1.0f == rhw || rhw < 0.00001f) { VTRACE(("Vertex: glVertex:x,y,z=%f,%f,%f\n", x,y,z)); glVertex3f(x, y, z); @@ -1475,7 +1475,7 @@ if (rc) return; /* If we will be using a vertex shader, do some initialization for it */ - if (useVertexShaderFunction == TRUE) { + if (useVertexShaderFunction) { vertex_shader = VERTEX_SHADER(This->UpdateStateBlock->VertexShader); memset(&vertex_shader->input, 0, sizeof(VSHADERINPUTDATA8)); @@ -1485,7 +1485,7 @@ vertex_shader->usage != D3DUSAGE_SOFTWAREPROCESSING); /** init Constants */ - if (TRUE == This->UpdateStateBlock->Changed.vertexShaderConstant) { + if (This->UpdateStateBlock->Changed.vertexShaderConstant) { TRACE_(d3d_shader)("vertex shader initializing constants\n"); IDirect3DVertexShaderImpl_SetConstantF(vertex_shader, 0, (CONST FLOAT*) &This->UpdateStateBlock->vertexShaderConstant[0], 96); } @@ -1505,7 +1505,7 @@ checkGLcall("glEnable(GL_FRAGMENT_PROGRAM_ARB);"); /* init Constants */ - if (TRUE == This->UpdateStateBlock->Changed.pixelShaderConstant) { + if (This->UpdateStateBlock->Changed.pixelShaderConstant) { TRACE_(d3d_shader)("pixel shader initializing constants %p\n",pixel_shader); IDirect3DPixelShaderImpl_SetConstantF(pixel_shader, 0, (CONST FLOAT*) &This->UpdateStateBlock->pixelShaderConstant[0], 8); } @@ -1571,7 +1571,7 @@ } /* Now draw the graphics to the screen */ - if (useVertexShaderFunction == TRUE) { + if (useVertexShaderFunction) { /* Ideally, we should have software FV and hardware VS, possibly depending on the device type? */ @@ -1632,7 +1632,7 @@ /* Diagnostics */ #if defined(SHOW_FRAME_MAKEUP) { - if (isDumpingFrames == TRUE) { + if (isDumpingFrames) { D3DLOCKED_RECT r; char buffer[80]; IDirect3DSurface8Impl_LockRect((LPDIRECT3DSURFACE8) This->renderTarget, &r, NULL, D3DLOCK_READONLY); diff -urN wine-20041201/dlls/d3d8/shader.c wine-20050111/dlls/d3d8/shader.c --- wine-20041201/dlls/d3d8/shader.c 2004-11-30 22:39:00.000000000 +0100 +++ wine-20050111/dlls/d3d8/shader.c 2004-12-06 17:11:38.000000000 +0100 @@ -274,10 +274,10 @@ } typedef FLOAT D3DMATRIX44[4][4]; -typedef FLOAT D3DMATRIX43[4][3]; -typedef FLOAT D3DMATRIX34[4][4]; -typedef FLOAT D3DMATRIX33[4][3]; -typedef FLOAT D3DMATRIX32[4][2]; +typedef FLOAT D3DMATRIX43[3][4]; +typedef FLOAT D3DMATRIX34[4][3]; +typedef FLOAT D3DMATRIX33[3][3]; +typedef FLOAT D3DMATRIX32[2][3]; void vshader_m4x4(D3DSHADERVECTOR* d, D3DSHADERVECTOR* s0, /*D3DSHADERVECTOR* mat1*/ D3DMATRIX44 mat) { /* @@ -991,8 +991,8 @@ const DWORD* pToken = vshader->function; const SHADER_OPCODE* curOpcode = NULL; /** functions parameters */ - D3DSHADERVECTOR* p[4]; - D3DSHADERVECTOR* p_send[4]; + D3DSHADERVECTOR* p[5]; + D3DSHADERVECTOR* p_send[5]; DWORD i; /** init temporary register */ diff -urN wine-20041201/dlls/d3d8/stateblock.c wine-20050111/dlls/d3d8/stateblock.c --- wine-20041201/dlls/d3d8/stateblock.c 2004-09-08 03:23:57.000000000 +0200 +++ wine-20050111/dlls/d3d8/stateblock.c 2004-12-23 19:33:45.000000000 +0100 @@ -389,7 +389,7 @@ HeapFree(GetProcessHeap(), 0, (void *)(tmp->prev)); tmp = tmp->next; } - if (tmp) HeapFree(GetProcessHeap(), 0, (void *)tmp); + HeapFree(GetProcessHeap(), 0, (void *)tmp); HeapFree(GetProcessHeap(), 0, (void *)pSB); return D3D_OK; } diff -urN wine-20041201/dlls/d3d8/surface.c wine-20050111/dlls/d3d8/surface.c --- wine-20041201/dlls/d3d8/surface.c 2004-10-07 05:06:51.000000000 +0200 +++ wine-20050111/dlls/d3d8/surface.c 2005-01-09 18:37:02.000000000 +0100 @@ -479,7 +479,7 @@ }; -HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, GLenum gl_target, GLenum gl_level) { +HRESULT WINAPI IDirect3DSurface8Impl_LoadTexture(LPDIRECT3DSURFACE8 iface, UINT gl_target, UINT gl_level) { IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; if (This->inTexture) diff -urN wine-20041201/dlls/d3d8/texture.c wine-20050111/dlls/d3d8/texture.c --- wine-20041201/dlls/d3d8/texture.c 2004-09-08 03:50:38.000000000 +0200 +++ wine-20050111/dlls/d3d8/texture.c 2005-01-09 17:42:53.000000000 +0100 @@ -182,11 +182,9 @@ if (Level < This->levels) { TRACE("(%p) Level (%d)\n", This, Level); return IDirect3DSurface8Impl_GetDesc((LPDIRECT3DSURFACE8) This->surfaces[Level], pDesc); - } else { - FIXME("Levels seems too high?!!\n"); - return D3DERR_INVALIDCALL; } - return D3D_OK; + FIXME("Levels seems too high?!!\n"); + return D3DERR_INVALIDCALL; } HRESULT WINAPI IDirect3DTexture8Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE8 iface, UINT Level, IDirect3DSurface8** ppSurfaceLevel) { IDirect3DTexture8Impl *This = (IDirect3DTexture8Impl *)iface; diff -urN wine-20041201/dlls/d3d8/utils.c wine-20050111/dlls/d3d8/utils.c --- wine-20041201/dlls/d3d8/utils.c 2004-09-08 03:50:38.000000000 +0200 +++ wine-20050111/dlls/d3d8/utils.c 2005-01-09 17:42:53.000000000 +0100 @@ -286,7 +286,6 @@ case 12: /* Note D3DTSS are not consecutive, so skip these */ return "unused"; - break; default: FIXME("Unrecognized %lu texture state!\n", state); return "unrecognized"; @@ -1336,7 +1335,6 @@ */ LEAVE_GL(); return; - break; } } @@ -1822,7 +1820,7 @@ } } - if (combineOK == TRUE) { + if (combineOK) { glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, useext(GL_COMBINE)); checkGLcall("GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, useext(GL_COMBINE)"); diff -urN wine-20041201/dlls/d3d8/vertexbuffer.c wine-20050111/dlls/d3d8/vertexbuffer.c --- wine-20041201/dlls/d3d8/vertexbuffer.c 2004-09-08 03:50:38.000000000 +0200 +++ wine-20050111/dlls/d3d8/vertexbuffer.c 2004-12-23 19:33:45.000000000 +0100 @@ -60,7 +60,7 @@ ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); if (ref == 0) { - if (NULL != This->allocatedMemory) HeapFree(GetProcessHeap(), 0, This->allocatedMemory); + HeapFree(GetProcessHeap(), 0, This->allocatedMemory); HeapFree(GetProcessHeap(), 0, This); } return ref; diff -urN wine-20041201/dlls/d3d8/vshaderdeclaration.c wine-20050111/dlls/d3d8/vshaderdeclaration.c --- wine-20041201/dlls/d3d8/vshaderdeclaration.c 2004-11-30 22:39:00.000000000 +0100 +++ wine-20050111/dlls/d3d8/vshaderdeclaration.c 2004-12-09 15:08:00.000000000 +0100 @@ -418,7 +418,7 @@ ERR("using unitialised stream[%lu]\n", stream); return D3DERR_INVALIDCALL; } else { - if (This->StateBlock->streamIsUP == TRUE) { + if (This->StateBlock->streamIsUP) { curPos = ((char *) pVB) + (SkipnStrides * skip); /* Not really a VB */ } else { curPos = ((IDirect3DVertexBuffer8Impl*) pVB)->allocatedMemory + (SkipnStrides * skip); @@ -602,7 +602,7 @@ ERR("using unitialised stream[%lu]\n", stream); return D3DERR_INVALIDCALL; } else { - if (This->StateBlock->streamIsUP == TRUE) { + if (This->StateBlock->streamIsUP) { curPos = ((char *) pVB) + (SkipnStrides * skip); /* Not really a VB */ } else { curPos = ((IDirect3DVertexBuffer8Impl*) pVB)->allocatedMemory + (SkipnStrides * skip); diff -urN wine-20041201/dlls/d3d9/basetexture.c wine-20050111/dlls/d3d9/basetexture.c --- wine-20041201/dlls/d3d9/basetexture.c 2004-10-14 02:32:04.000000000 +0200 +++ wine-20050111/dlls/d3d9/basetexture.c 2004-12-07 15:29:12.000000000 +0100 @@ -1,7 +1,7 @@ /* * IDirect3DBaseTexture9 implementation * - * Copyright 2002-2003 Jason Edmeades + * Copyright 2002-2004 Jason Edmeades * Raphael Junqueira * * This library is free software; you can redistribute it and/or @@ -43,15 +43,17 @@ ULONG WINAPI IDirect3DBaseTexture9Impl_AddRef(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); + return InterlockedIncrement(&This->ref); } ULONG WINAPI IDirect3DBaseTexture9Impl_Release(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); - if (ref == 0) + if (ref == 0) { + IWineD3DBaseTexture_Release(This->wineD3DBaseTexture); HeapFree(GetProcessHeap(), 0, This); + } return ref; } @@ -63,41 +65,38 @@ HRESULT WINAPI IDirect3DBaseTexture9Impl_SetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DBaseTexture_SetPrivateData(This->wineD3DBaseTexture, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DBaseTexture9Impl_GetPrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DBaseTexture_GetPrivateData(This->wineD3DBaseTexture, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DBaseTexture9Impl_FreePrivateData(LPDIRECT3DBASETEXTURE9 iface, REFGUID refguid) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DBaseTexture_FreePrivateData(This->wineD3DBaseTexture, refguid); } DWORD WINAPI IDirect3DBaseTexture9Impl_SetPriority(LPDIRECT3DBASETEXTURE9 iface, DWORD PriorityNew) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew); + return IWineD3DBaseTexture_SetPriority(This->wineD3DBaseTexture, PriorityNew); } DWORD WINAPI IDirect3DBaseTexture9Impl_GetPriority(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This); + return IWineD3DBaseTexture_GetPriority(This->wineD3DBaseTexture); } void WINAPI IDirect3DBaseTexture9Impl_PreLoad(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - FIXME("(%p) : stub\n", This); + IWineD3DBaseTexture_PreLoad(This->wineD3DBaseTexture); return ; } D3DRESOURCETYPE WINAPI IDirect3DBaseTexture9Impl_GetType(LPDIRECT3DBASETEXTURE9 iface) { IDirect3DBaseTexture9Impl *This = (IDirect3DBaseTexture9Impl *)iface; - return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This); + return IWineD3DBaseTexture_GetType(This->wineD3DBaseTexture); } /* IDirect3DBaseTexture9 Interface follow: */ diff -urN wine-20041201/dlls/d3d9/cubetexture.c wine-20050111/dlls/d3d9/cubetexture.c --- wine-20041201/dlls/d3d9/cubetexture.c 2004-10-14 02:32:04.000000000 +0200 +++ wine-20050111/dlls/d3d9/cubetexture.c 2005-01-09 17:42:53.000000000 +0100 @@ -150,10 +150,10 @@ if (Level < This->levels) { TRACE("(%p) level (%d)\n", This, Level); return IDirect3DSurface9Impl_GetDesc((LPDIRECT3DSURFACE9) This->surfaces[0][Level], pDesc); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; } + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); + return D3DERR_INVALIDCALL; + return D3D_OK; } diff -urN wine-20041201/dlls/d3d9/d3d9_private.h wine-20050111/dlls/d3d9/d3d9_private.h --- wine-20041201/dlls/d3d9/d3d9_private.h 2004-11-24 19:13:41.000000000 +0100 +++ wine-20050111/dlls/d3d9/d3d9_private.h 2005-01-09 18:37:02.000000000 +0100 @@ -540,7 +540,6 @@ /* IDirect3DResource9 fields */ IWineD3DResource *wineD3DResource; - IDirect3DDevice9 *device; }; /* IUnknown: */ @@ -578,21 +577,8 @@ DWORD ref; /* IDirect3DResource9 fields */ - IDirect3DDevice9Impl *Device; - D3DRESOURCETYPE ResourceType; + IWineD3DSurface *wineD3DSurface; - /* IDirect3DSurface9 fields */ - IUnknown *Container; - D3DSURFACE_DESC myDesc; - BYTE *allocatedMemory; - UINT textureName; - UINT bytesPerPixel; - - BOOL lockable; - BOOL locked; - RECT lockedRect; - RECT dirtyRect; - BOOL Dirty; }; /* IUnknown: */ @@ -724,13 +710,7 @@ DWORD ref; /* IDirect3DResource9 fields */ - IDirect3DDevice9Impl *Device; - D3DRESOURCETYPE ResourceType; - - /* IDirect3DBaseTexture9 fields */ - BOOL Dirty; - D3DFORMAT format; - UINT levels; + IWineD3DBaseTexture *wineD3DBaseTexture; }; /* IUnknown: */ @@ -776,7 +756,6 @@ DWORD ref; /* IDirect3DResource9 fields */ - IDirect3DDevice9Impl *Device; D3DRESOURCETYPE ResourceType; /* IDirect3DBaseTexture9 fields */ @@ -840,7 +819,6 @@ DWORD ref; /* IDirect3DResource9 fields */ - IDirect3DDevice9Impl *Device; D3DRESOURCETYPE ResourceType; /* IDirect3DBaseTexture9 fields */ @@ -905,7 +883,6 @@ DWORD ref; /* IDirect3DResource9 fields */ - IDirect3DDevice9Impl *Device; D3DRESOURCETYPE ResourceType; /* IDirect3DBaseTexture9 fields */ diff -urN wine-20041201/dlls/d3d9/device.c wine-20050111/dlls/d3d9/device.c --- wine-20041201/dlls/d3d9/device.c 2004-11-29 18:53:42.000000000 +0100 +++ wine-20050111/dlls/d3d9/device.c 2005-01-09 18:37:02.000000000 +0100 @@ -114,10 +114,11 @@ } HRESULT WINAPI IDirect3DDevice9Impl_SetCursorProperties(LPDIRECT3DDEVICE9 iface, UINT XHotSpot, UINT YHotSpot, IDirect3DSurface9* pCursorBitmap) { - IDirect3DSurface9Impl* pSur = (IDirect3DSurface9Impl*) pCursorBitmap; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; TRACE("(%p) : Spot Pos(%u,%u)\n", This, XHotSpot, YHotSpot); +/* TODO: + IDirect3DSurface9Impl* pSur = (IDirect3DSurface9Impl*) pCursorBitmap; if (D3DFMT_A8R8G8B8 != pSur->myDesc.Format) { ERR("(%p) : surface(%p) have a invalid format\n", This, pCursorBitmap); return D3DERR_INVALIDCALL; @@ -126,6 +127,7 @@ ERR("(%p) : surface(%p) have a invalid size\n", This, pCursorBitmap); return D3DERR_INVALIDCALL; } +*/ This->xHotSpot = XHotSpot; This->yHotSpot = YHotSpot; @@ -155,8 +157,7 @@ HRESULT WINAPI IDirect3DDevice9Impl_Present(LPDIRECT3DDEVICE9 iface, CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - TRACE("(%p) : stub!\n", This); - return D3D_OK; + return IWineD3DDevice_Present(This->WineD3DDevice, pSourceRect, pDestRect, hDestWindowOverride, pDirtyRegion); } HRESULT WINAPI IDirect3DDevice9Impl_GetBackBuffer(LPDIRECT3DDEVICE9 iface, UINT iSwapChain, UINT BackBuffer, D3DBACKBUFFER_TYPE Type, IDirect3DSurface9** ppBackBuffer) { @@ -206,9 +207,21 @@ return; } -HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, DWORD MultisampleQuality, BOOL Lockable, IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) { +HRESULT WINAPI IDirect3DDevice9Impl_CreateRenderTarget(LPDIRECT3DDEVICE9 iface, UINT Width, UINT Height, + D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, + DWORD MultisampleQuality, BOOL Lockable, + IDirect3DSurface9** ppSurface, HANDLE* pSharedHandle) { + IDirect3DSurface9Impl *object; IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); + + /* Allocate the storage for the device */ + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirect3DSurface9Impl)); + object->lpVtbl = &Direct3DSurface9_Vtbl; + object->ref = 1; + IWineD3DDevice_CreateRenderTarget(This->WineD3DDevice, Width, Height, Format, MultiSample, MultisampleQuality, + Lockable, &object->wineD3DSurface, pSharedHandle, (IUnknown *)This); + *ppSurface = (LPDIRECT3DSURFACE9) object; + return D3D_OK; } @@ -297,14 +310,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_EndScene(LPDIRECT3DDEVICE9 iface) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DDevice_EndScene(This->WineD3DDevice); } HRESULT WINAPI IDirect3DDevice9Impl_Clear(LPDIRECT3DDEVICE9 iface, DWORD Count, CONST D3DRECT* pRects, DWORD Flags, D3DCOLOR Color, float Z, DWORD Stencil) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DDevice_Clear(This->WineD3DDevice, Count, pRects, Flags, Color, Z, Stencil); } HRESULT WINAPI IDirect3DDevice9Impl_SetTransform(LPDIRECT3DDEVICE9 iface, D3DTRANSFORMSTATETYPE State, CONST D3DMATRIX* lpMatrix) { @@ -324,15 +335,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetViewport(LPDIRECT3DDEVICE9 iface, CONST D3DVIEWPORT9* pViewport) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DDevice_SetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport); } HRESULT WINAPI IDirect3DDevice9Impl_GetViewport(LPDIRECT3DDEVICE9 iface, D3DVIEWPORT9* pViewport) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - TRACE("(%p)\n", This); - memcpy(pViewport, &This->StateBlock->viewport, sizeof(D3DVIEWPORT9)); - return D3D_OK; + return IWineD3DDevice_GetViewport(This->WineD3DDevice, (WINED3DVIEWPORT *)pViewport); } HRESULT WINAPI IDirect3DDevice9Impl_SetMaterial(LPDIRECT3DDEVICE9 iface, CONST D3DMATERIAL9* pMaterial) { @@ -377,15 +385,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetRenderState(LPDIRECT3DDEVICE9 iface, D3DRENDERSTATETYPE State, DWORD Value) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DDevice_SetRenderState(This->WineD3DDevice, State, Value); } HRESULT WINAPI IDirect3DDevice9Impl_GetRenderState(LPDIRECT3DDEVICE9 iface, D3DRENDERSTATETYPE State, DWORD* pValue) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - TRACE("(%p) for State %d = %ld\n", This, State, This->UpdateStateBlock->renderstate[State]); - *pValue = This->StateBlock->renderstate[State]; - return D3D_OK; + return IWineD3DDevice_GetRenderState(This->WineD3DDevice, State, pValue); } HRESULT WINAPI IDirect3DDevice9Impl_SetClipStatus(LPDIRECT3DDEVICE9 iface, CONST D3DCLIPSTATUS9* pClipStatus) { @@ -414,15 +419,12 @@ HRESULT WINAPI IDirect3DDevice9Impl_GetTextureStageState(LPDIRECT3DDEVICE9 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD* pValue) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - TRACE("(%p) : requesting Stage %ld, Type %d getting %ld\n", This, Stage, Type, This->UpdateStateBlock->texture_state[Stage][Type]); - *pValue = This->UpdateStateBlock->texture_state[Stage][Type]; - return D3D_OK; + return IWineD3DDevice_GetTextureStageState(This->WineD3DDevice, Stage, Type, pValue); } HRESULT WINAPI IDirect3DDevice9Impl_SetTextureStageState(LPDIRECT3DDEVICE9 iface, DWORD Stage, D3DTEXTURESTAGESTATETYPE Type, DWORD Value) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DDevice_SetTextureStageState(This->WineD3DDevice, Stage, Type, Value); } HRESULT WINAPI IDirect3DDevice9Impl_GetSamplerState(LPDIRECT3DDEVICE9 iface, DWORD Sampler, D3DSAMPLERSTATETYPE Type, DWORD* pValue) { @@ -506,31 +508,28 @@ return 0.0f; } -HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { +HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT StartVertex, UINT PrimitiveCount) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DDevice_DrawPrimitive(This->WineD3DDevice, PrimitiveType, StartVertex, PrimitiveCount); } HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitive(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, INT BaseVertexIndex, UINT MinVertexIndex, UINT NumVertices, UINT startIndex, UINT primCount) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DDevice_DrawIndexedPrimitive(This->WineD3DDevice, PrimitiveType, BaseVertexIndex, MinVertexIndex, NumVertices, startIndex, primCount); } HRESULT WINAPI IDirect3DDevice9Impl_DrawPrimitiveUP(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT PrimitiveCount, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DDevice_DrawPrimitiveUP(This->WineD3DDevice, PrimitiveType, PrimitiveCount, pVertexStreamZeroData, VertexStreamZeroStride); } HRESULT WINAPI IDirect3DDevice9Impl_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE9 iface, D3DPRIMITIVETYPE PrimitiveType, UINT MinVertexIndex, UINT NumVertexIndices, UINT PrimitiveCount, CONST void* pIndexData, D3DFORMAT IndexDataFormat, CONST void* pVertexStreamZeroData, UINT VertexStreamZeroStride) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DDevice_DrawIndexedPrimitiveUP(This->WineD3DDevice, PrimitiveType, MinVertexIndex, NumVertexIndices, PrimitiveCount, + pIndexData, IndexDataFormat, pVertexStreamZeroData, VertexStreamZeroStride); } HRESULT WINAPI IDirect3DDevice9Impl_ProcessVertices(LPDIRECT3DDEVICE9 iface, UINT SrcStartIndex, UINT DestIndex, UINT VertexCount, IDirect3DVertexBuffer9* pDestBuffer, IDirect3DVertexDeclaration9* pVertexDecl, DWORD Flags) { @@ -562,7 +561,10 @@ HRESULT rc = D3D_OK; rc = IWineD3DDevice_GetStreamSource(This->WineD3DDevice, StreamNumber, (IWineD3DVertexBuffer **)&retStream, OffsetInBytes, pStride); - if (rc == D3D_OK && NULL != *pStream) IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream); + if (rc == D3D_OK && NULL != *pStream) { + IWineD3DVertexBuffer_GetParent(retStream, (IUnknown **)pStream); + IWineD3DVertexBuffer_Release(retStream); + } return rc; } @@ -580,35 +582,23 @@ HRESULT WINAPI IDirect3DDevice9Impl_SetIndices(LPDIRECT3DDEVICE9 iface, IDirect3DIndexBuffer9* pIndexData) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - IDirect3DIndexBuffer9 *oldIdxs; - - TRACE("(%p) : Setting to %p\n", This, pIndexData); - oldIdxs = This->StateBlock->pIndexData; - - This->UpdateStateBlock->Changed.Indices = TRUE; - This->UpdateStateBlock->Set.Indices = TRUE; - This->UpdateStateBlock->pIndexData = pIndexData; - - /* Handle recording of state blocks */ - if (This->isRecordingState) { - TRACE("Recording... not performing anything\n"); - return D3D_OK; - } - - if (oldIdxs) IDirect3DIndexBuffer9Impl_Release(oldIdxs); - if (pIndexData) IDirect3DIndexBuffer9Impl_AddRef(This->StateBlock->pIndexData); - return D3D_OK; + return IWineD3DDevice_SetIndices(This->WineD3DDevice, + pIndexData==NULL ? NULL:((IDirect3DIndexBuffer9Impl *)pIndexData)->wineD3DIndexBuffer, + 0); } HRESULT WINAPI IDirect3DDevice9Impl_GetIndices(LPDIRECT3DDEVICE9 iface, IDirect3DIndexBuffer9** ppIndexData) { IDirect3DDevice9Impl *This = (IDirect3DDevice9Impl *)iface; - FIXME("(%p) : stub\n", This); - - *ppIndexData = This->StateBlock->pIndexData; - /* up ref count on ppindexdata */ - if (*ppIndexData) IDirect3DIndexBuffer9Impl_AddRef(*ppIndexData); + IWineD3DIndexBuffer *retIndexData = NULL; + HRESULT rc = D3D_OK; + UINT tmp; - return D3D_OK; + rc = IWineD3DDevice_GetIndices(This->WineD3DDevice, &retIndexData, &tmp); + if (rc == D3D_OK && NULL != *ppIndexData) { + IWineD3DVertexBuffer_GetParent(retIndexData, (IUnknown **)ppIndexData); + IWineD3DVertexBuffer_Release(retIndexData); + } + return rc; } HRESULT WINAPI IDirect3DDevice9Impl_DrawRectPatch(LPDIRECT3DDEVICE9 iface, UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) { diff -urN wine-20041201/dlls/d3d9/directx.c wine-20050111/dlls/d3d9/directx.c --- wine-20041201/dlls/d3d9/directx.c 2004-11-23 14:52:46.000000000 +0100 +++ wine-20050111/dlls/d3d9/directx.c 2005-01-09 18:37:02.000000000 +0100 @@ -152,6 +152,23 @@ return IWineD3D_GetAdapterMonitor(This->WineD3D, Adapter); } +/* Internal function called back during the CreateDevice to create a render target */ +HRESULT WINAPI D3D9CB_CreateRenderTarget(IUnknown *device, UINT Width, UINT Height, + D3DFORMAT Format, D3DMULTISAMPLE_TYPE MultiSample, + DWORD MultisampleQuality, BOOL Lockable, + IWineD3DSurface** ppSurface, HANDLE* pSharedHandle) { + HRESULT res = D3D_OK; + IDirect3DSurface9Impl *d3dSurface = NULL; + + res = IDirect3DDevice9_CreateRenderTarget((IDirect3DDevice9 *)device, Width, Height, + Format, MultiSample, MultisampleQuality, Lockable, + (IDirect3DSurface9 **)&d3dSurface, pSharedHandle); + if (res == D3D_OK) { + *ppSurface = d3dSurface->wineD3DSurface; + } + return res; +} + HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, IDirect3DDevice9** ppReturnedDeviceInterface) { @@ -191,7 +208,7 @@ localParameters.Flags = &pPresentationParameters->Flags; localParameters.FullScreen_RefreshRateInHz = &pPresentationParameters->FullScreen_RefreshRateInHz; localParameters.PresentationInterval = &pPresentationParameters->PresentationInterval; - IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object); + IWineD3D_CreateDevice(This->WineD3D, Adapter, DeviceType, hFocusWindow, BehaviourFlags, &localParameters, &object->WineD3DDevice, (IUnknown *)object, D3D9CB_CreateRenderTarget); FIXME("(%p) : incomplete stub\n", This); return D3D_OK; diff -urN wine-20041201/dlls/d3d9/resource.c wine-20050111/dlls/d3d9/resource.c --- wine-20041201/dlls/d3d9/resource.c 2004-10-14 02:32:04.000000000 +0200 +++ wine-20050111/dlls/d3d9/resource.c 2004-12-07 15:29:12.000000000 +0100 @@ -59,9 +59,9 @@ /* IDirect3DResource9 Interface follow: */ HRESULT WINAPI IDirect3DResource9Impl_GetDevice(LPDIRECT3DRESOURCE9 iface, IDirect3DDevice9** ppDevice) { IDirect3DResource9Impl *This = (IDirect3DResource9Impl *)iface; - TRACE("(%p) : returning %p\n", This, This->device); - *ppDevice = (LPDIRECT3DDEVICE9) This->device; - IDirect3DDevice9Impl_AddRef(*ppDevice); + IWineD3DDevice *myDevice = NULL; + IWineD3DResource_GetDevice(This->wineD3DResource, &myDevice); + IWineD3DDevice_GetParent(myDevice, (IUnknown **)ppDevice); return D3D_OK; } diff -urN wine-20041201/dlls/d3d9/surface.c wine-20050111/dlls/d3d9/surface.c --- wine-20041201/dlls/d3d9/surface.c 2004-10-14 02:32:04.000000000 +0200 +++ wine-20050111/dlls/d3d9/surface.c 2005-01-09 18:37:02.000000000 +0100 @@ -1,7 +1,7 @@ /* * IDirect3DSurface9 implementation * - * Copyright 2002-2003 Jason Edmeades + * Copyright 2002-2005 Jason Edmeades * Raphael Junqueira * * This library is free software; you can redistribute it and/or @@ -29,7 +29,7 @@ IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; if (IsEqualGUID(riid, &IID_IUnknown) - || IsEqualGUID(riid, &IID_IDirect3DResource9) + || IsEqualGUID(riid, &IID_IDirect3DResource9) || IsEqualGUID(riid, &IID_IDirect3DSurface9)) { IDirect3DSurface9Impl_AddRef(iface); *ppobj = This; @@ -43,16 +43,16 @@ ULONG WINAPI IDirect3DSurface9Impl_AddRef(LPDIRECT3DSURFACE9 iface) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); + return InterlockedIncrement(&This->ref); } ULONG WINAPI IDirect3DSurface9Impl_Release(LPDIRECT3DSURFACE9 iface) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This->allocatedMemory); - HeapFree(GetProcessHeap(), 0, This); + IWineD3DBaseTexture_Release(This->wineD3DSurface); + HeapFree(GetProcessHeap(), 0, This); } return ref; } @@ -65,89 +65,103 @@ HRESULT WINAPI IDirect3DSurface9Impl_SetPrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DSurface_SetPrivateData(This->wineD3DSurface, refguid, pData, SizeOfData, Flags); } HRESULT WINAPI IDirect3DSurface9Impl_GetPrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid, void* pData, DWORD* pSizeOfData) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DSurface_GetPrivateData(This->wineD3DSurface, refguid, pData, pSizeOfData); } HRESULT WINAPI IDirect3DSurface9Impl_FreePrivateData(LPDIRECT3DSURFACE9 iface, REFGUID refguid) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DSurface_FreePrivateData(This->wineD3DSurface, refguid); } -DWORD WINAPI IDirect3DSurface9Impl_SetPriority(LPDIRECT3DSURFACE9 iface, DWORD PriorityNew) { +DWORD WINAPI IDirect3DSurface9Impl_SetPriority(LPDIRECT3DSURFACE9 iface, DWORD PriorityNew) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - return IDirect3DResource9Impl_SetPriority((LPDIRECT3DRESOURCE9) This, PriorityNew); + return IWineD3DSurface_SetPriority(This->wineD3DSurface, PriorityNew); } -DWORD WINAPI IDirect3DSurface9Impl_GetPriority(LPDIRECT3DSURFACE9 iface) { +DWORD WINAPI IDirect3DSurface9Impl_GetPriority(LPDIRECT3DSURFACE9 iface) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - return IDirect3DResource9Impl_GetPriority((LPDIRECT3DRESOURCE9) This); + return IWineD3DSurface_GetPriority(This->wineD3DSurface); } -void WINAPI IDirect3DSurface9Impl_PreLoad(LPDIRECT3DSURFACE9 iface) { +void WINAPI IDirect3DSurface9Impl_PreLoad(LPDIRECT3DSURFACE9 iface) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - FIXME("(%p) : stub\n", This); + IWineD3DSurface_PreLoad(This->wineD3DSurface); return ; } D3DRESOURCETYPE WINAPI IDirect3DSurface9Impl_GetType(LPDIRECT3DSURFACE9 iface) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - return IDirect3DResource9Impl_GetType((LPDIRECT3DRESOURCE9) This); + return IWineD3DSurface_GetType(This->wineD3DSurface); } /* IDirect3DSurface9 Interface follow: */ HRESULT WINAPI IDirect3DSurface9Impl_GetContainer(LPDIRECT3DSURFACE9 iface, REFIID riid, void** ppContainer) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; HRESULT res; - res = IUnknown_QueryInterface(This->Container, riid, ppContainer); - if (E_NOINTERFACE == res) { - /** - * If the surface is created using CreateImageSurface, CreateRenderTarget, - * or CreateDepthStencilSurface, the surface is considered stand alone. In this case, - * GetContainer will return the Direct3D device used to create the surface. - */ - res = IUnknown_QueryInterface(This->Container, &IID_IDirect3DDevice9, ppContainer); + + /* The container returned from IWineD3DSurface_GetContainer is either a IWineD3DDevice or + opne of the subclasses of resource */ + IUnknown *IWineContainer = NULL; + res = IWineD3DSurface_GetContainer(This->wineD3DSurface, riid, (void **)&IWineContainer); + + if (res == D3D_OK) { + IWineD3DDevice *myDevice = NULL; + IWineD3DResource_GetDevice((IWineD3DSurface *)This->wineD3DSurface, &myDevice); + + if (IWineContainer == (IUnknown *)myDevice) { + IWineD3DDevice_GetParent((IWineD3DDevice *)IWineContainer, (IUnknown **)ppContainer); + IWineD3DDevice_Release((IWineD3DDevice *)IWineContainer); + } else { + IWineD3DResource_GetParent((IWineD3DResource *)IWineContainer, (IUnknown **)ppContainer); + IWineD3DResource_Release((IWineD3DResource *)IWineContainer); + } + + IWineD3DDevice_Release(myDevice); } - TRACE("(%p) : returning %p\n", This, *ppContainer); + return res; } HRESULT WINAPI IDirect3DSurface9Impl_GetDesc(LPDIRECT3DSURFACE9 iface, D3DSURFACE_DESC* pDesc) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - TRACE("(%p) : copying into %p\n", This, pDesc); - memcpy(pDesc, &This->myDesc, sizeof(D3DSURFACE_DESC)); - return D3D_OK; + WINED3DSURFACE_DESC wined3ddesc; + + /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ + wined3ddesc.Format = &pDesc->Format; + wined3ddesc.Type = &pDesc->Type; + wined3ddesc.Usage = &pDesc->Usage; + wined3ddesc.Pool = &pDesc->Pool; + wined3ddesc.MultiSampleType = &pDesc->MultiSampleType; + wined3ddesc.MultiSampleQuality = &pDesc->MultiSampleQuality; + wined3ddesc.Width = &pDesc->Width; + wined3ddesc.Height = &pDesc->Height; + + return IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc); } HRESULT WINAPI IDirect3DSurface9Impl_LockRect(LPDIRECT3DSURFACE9 iface, D3DLOCKED_RECT* pLockedRect, CONST RECT* pRect, DWORD Flags) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DSurface_LockRect(This->wineD3DSurface, pLockedRect, pRect, Flags); } HRESULT WINAPI IDirect3DSurface9Impl_UnlockRect(LPDIRECT3DSURFACE9 iface) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DSurface_UnlockRect(This->wineD3DSurface); } HRESULT WINAPI IDirect3DSurface9Impl_GetDC(LPDIRECT3DSURFACE9 iface, HDC* phdc) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DSurface_GetDC(This->wineD3DSurface, phdc); } HRESULT WINAPI IDirect3DSurface9Impl_ReleaseDC(LPDIRECT3DSURFACE9 iface, HDC hdc) { IDirect3DSurface9Impl *This = (IDirect3DSurface9Impl *)iface; - FIXME("(%p) : stub\n", This); - return D3D_OK; + return IWineD3DSurface_ReleaseDC(This->wineD3DSurface, hdc); } diff -urN wine-20041201/dlls/d3d9/texture.c wine-20050111/dlls/d3d9/texture.c --- wine-20041201/dlls/d3d9/texture.c 2004-10-14 02:32:04.000000000 +0200 +++ wine-20050111/dlls/d3d9/texture.c 2005-01-09 17:42:53.000000000 +0100 @@ -149,11 +149,9 @@ if (Level < This->levels) { TRACE("(%p) Level (%d)\n", This, Level); return IDirect3DSurface9Impl_GetDesc((LPDIRECT3DSURFACE9) This->surfaces[Level], pDesc); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; } - return D3D_OK; + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); + return D3DERR_INVALIDCALL; } HRESULT WINAPI IDirect3DTexture9Impl_GetSurfaceLevel(LPDIRECT3DTEXTURE9 iface, UINT Level, IDirect3DSurface9** ppSurfaceLevel) { diff -urN wine-20041201/dlls/d3d9/vertexshader.c wine-20050111/dlls/d3d9/vertexshader.c --- wine-20041201/dlls/d3d9/vertexshader.c 2004-10-14 02:32:04.000000000 +0200 +++ wine-20050111/dlls/d3d9/vertexshader.c 2004-12-06 21:43:56.000000000 +0100 @@ -134,7 +134,7 @@ f += 4; } } else { - FLOAT* f = (FLOAT*) pConstantData; + const FLOAT* f = (const FLOAT*) pConstantData; TRACE("(%p) : SetVertexShaderConstant, C[%u]={%f, %f, %f, %f}\n", This, Register, f[0], f[1], f[2], f[3]); } This->UpdateStateBlock->Changed.vertexShaderConstant = TRUE; diff -urN wine-20041201/dlls/d3d9/volumetexture.c wine-20050111/dlls/d3d9/volumetexture.c --- wine-20041201/dlls/d3d9/volumetexture.c 2004-10-14 02:32:04.000000000 +0200 +++ wine-20050111/dlls/d3d9/volumetexture.c 2005-01-09 17:42:53.000000000 +0100 @@ -148,11 +148,9 @@ if (Level < This->levels) { TRACE("(%p) Level (%d)\n", This, Level); return IDirect3DVolume9Impl_GetDesc((LPDIRECT3DVOLUME9) This->volumes[Level], pDesc); - } else { - FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); - return D3DERR_INVALIDCALL; } - return D3D_OK; + FIXME("(%p) level(%d) overflow Levels(%d)\n", This, Level, This->levels); + return D3DERR_INVALIDCALL; } HRESULT WINAPI IDirect3DVolumeTexture9Impl_GetVolumeLevel(LPDIRECT3DVOLUMETEXTURE9 iface, UINT Level, IDirect3DVolume9** ppVolumeLevel) { diff -urN wine-20041201/dlls/d3dx8/d3dxbuffer.c wine-20050111/dlls/d3dx8/d3dxbuffer.c --- wine-20041201/dlls/d3dx8/d3dxbuffer.c 2004-09-08 03:50:37.000000000 +0200 +++ wine-20050111/dlls/d3dx8/d3dxbuffer.c 2004-12-23 19:33:45.000000000 +0100 @@ -60,7 +60,7 @@ ULONG ref = --This->ref; TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); if (ref == 0) { - if (NULL != This->buffer) HeapFree(GetProcessHeap(), 0, This->buffer); + HeapFree(GetProcessHeap(), 0, This->buffer); HeapFree(GetProcessHeap(), 0, This); } return ref; diff -urN wine-20041201/dlls/dbghelp/coff.c wine-20050111/dlls/dbghelp/coff.c --- wine-20041201/dlls/dbghelp/coff.c 2004-11-21 16:51:47.000000000 +0100 +++ wine-20050111/dlls/dbghelp/coff.c 2005-01-03 15:56:42.000000000 +0100 @@ -440,10 +440,7 @@ for (j = 0; j < coff_files.nfiles; j++) { - if (coff_files.files[j].entries != NULL) - { - HeapFree(GetProcessHeap(), 0, coff_files.files[j].entries); - } + HeapFree(GetProcessHeap(), 0, coff_files.files[j].entries); } HeapFree(GetProcessHeap(), 0, coff_files.files); msc_dbg->module->module.SymType = SymCoff; diff -urN wine-20041201/dlls/dbghelp/msc.c wine-20050111/dlls/dbghelp/msc.c --- wine-20041201/dlls/dbghelp/msc.c 2004-11-21 16:51:47.000000000 +0100 +++ wine-20050111/dlls/dbghelp/msc.c 2004-12-23 19:33:44.000000000 +0100 @@ -378,8 +378,7 @@ cv_zmodules[i].allowed = FALSE; cv_zmodules[i].defined_types = NULL; cv_zmodules[i].num_defined_types = 0; - if (cv_zmodules[i].bitfields) - HeapFree(GetProcessHeap(), 0, cv_zmodules[i].bitfields); + HeapFree(GetProcessHeap(), 0, cv_zmodules[i].bitfields); cv_zmodules[i].bitfields = NULL; cv_zmodules[i].num_bitfields = cv_zmodules[i].used_bitfields = 0; } @@ -1542,7 +1541,7 @@ if (curr_func) symt_normalize_function(msc_dbg->module, curr_func); - if (linetab) HeapFree(GetProcessHeap(), 0, linetab); + HeapFree(GetProcessHeap(), 0, linetab); return TRUE; } diff -urN wine-20041201/dlls/dbghelp/mscvpdb.h wine-20050111/dlls/dbghelp/mscvpdb.h --- wine-20041201/dlls/dbghelp/mscvpdb.h 2004-11-21 16:51:47.000000000 +0100 +++ wine-20050111/dlls/dbghelp/mscvpdb.h 2004-12-20 20:27:07.000000000 +0100 @@ -93,7 +93,7 @@ * ----------------------- * Here also we find three flavors (that we've suffixed with _V1, _V2 * and _V3) even if their evolution is closer to the evolution of - * types, there are not completly linked together. + * types, they are not completely linked together. */ #include "pshpack1.h" diff -urN wine-20041201/dlls/dbghelp/pe_module.c wine-20050111/dlls/dbghelp/pe_module.c --- wine-20041201/dlls/dbghelp/pe_module.c 2004-11-08 21:26:22.000000000 +0100 +++ wine-20050111/dlls/dbghelp/pe_module.c 2004-12-06 12:41:32.000000000 +0100 @@ -308,7 +308,7 @@ * in which case we'll rely on the export's on the ELF side */ } -// FIXME shouldn't we check that? if (!module_get_debug(pcs, module))l +/* FIXME shouldn't we check that? if (!module_get_debug(pcs, module))l */ if (pe_load_export_debug_info(pcs, module, mapping, nth) && !ret) ret = TRUE; UnmapViewOfFile(mapping); diff -urN wine-20041201/dlls/dbghelp/stabs.c wine-20050111/dlls/dbghelp/stabs.c --- wine-20041201/dlls/dbghelp/stabs.c 2004-11-08 21:26:22.000000000 +0100 +++ wine-20050111/dlls/dbghelp/stabs.c 2004-12-23 19:33:44.000000000 +0100 @@ -1474,7 +1474,7 @@ done: HeapFree(GetProcessHeap(), 0, stabbuff); stabs_free_includes(); - if (pending_vars) HeapFree(GetProcessHeap(), 0, pending_vars); + HeapFree(GetProcessHeap(), 0, pending_vars); return ret; } diff -urN wine-20041201/dlls/dbghelp/type.c wine-20050111/dlls/dbghelp/type.c --- wine-20041201/dlls/dbghelp/type.c 2004-11-22 19:30:10.000000000 +0100 +++ wine-20050111/dlls/dbghelp/type.c 2005-01-09 17:42:53.000000000 +0100 @@ -590,7 +590,6 @@ break; case SymTagTypedef: return symt_get_info(((const struct symt_typedef*)type)->type, TI_GET_LENGTH, pInfo); - break; case SymTagThunk: X(DWORD) = ((const struct symt_thunk*)type)->size; break; diff -urN wine-20041201/dlls/dciman32/dciman32.spec wine-20050111/dlls/dciman32/dciman32.spec --- wine-20041201/dlls/dciman32/dciman32.spec 2003-03-20 04:53:15.000000000 +0100 +++ wine-20050111/dlls/dciman32/dciman32.spec 2005-01-03 21:47:48.000000000 +0100 @@ -11,7 +11,7 @@ @ stub DCISetClipList @ stub DCISetDestination @ stub DCISetSrcDestClip -@ stub DllEntryPoint +@ stdcall DllEntryPoint(long long ptr) DllMain @ stub GetDCRegionData @ stub GetWindowRegionData @ stub WinWatchClose @@ -19,4 +19,3 @@ @ stub WinWatchGetClipList @ stub WinWatchNotify @ stub WinWatchOpen -@ stub dcithk_ThunkData32 diff -urN wine-20041201/dlls/dciman32/dciman_main.c wine-20050111/dlls/dciman32/dciman_main.c --- wine-20041201/dlls/dciman32/dciman_main.c 2003-09-06 01:08:41.000000000 +0200 +++ wine-20050111/dlls/dciman32/dciman_main.c 2004-12-15 11:52:57.000000000 +0100 @@ -28,6 +28,18 @@ #include "wine/debug.h" /*********************************************************************** + * DllEntryPoint (DCIMAN32.@) + * + * DCIMAN32 initialisation routine. + */ +BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) +{ + if (reason == DLL_PROCESS_ATTACH) DisableThreadLibraryCalls( inst ); + return TRUE; +} + + +/*********************************************************************** * DCIOpenProvider (DCIMAN32.@) */ HDC WINAPI diff -urN wine-20041201/dlls/ddraw/d3ddevice/main.c wine-20050111/dlls/ddraw/d3ddevice/main.c --- wine-20041201/dlls/ddraw/d3ddevice/main.c 2004-09-08 03:50:37.000000000 +0200 +++ wine-20050111/dlls/ddraw/d3ddevice/main.c 2005-01-09 18:35:44.000000000 +0100 @@ -260,16 +260,22 @@ Main_IDirect3DDeviceImpl_7_3T_2T_1T_AddRef(LPDIRECT3DDEVICE7 iface) { ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); - TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1); + + return ref; } ULONG WINAPI Main_IDirect3DDeviceImpl_7_3T_2T_1T_Release(LPDIRECT3DDEVICE7 iface) { ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); - TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref); - if (!--(This->ref)) { + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1); + + if (!ref) { int i; /* Release texture associated with the device */ for (i = 0; i < MAX_TEXTURES; i++) { @@ -280,7 +286,7 @@ HeapFree(GetProcessHeap(), 0, This); return 0; } - return This->ref; + return ref; } HRESULT WINAPI diff -urN wine-20041201/dlls/ddraw/d3ddevice/mesa.c wine-20050111/dlls/ddraw/d3ddevice/mesa.c --- wine-20041201/dlls/ddraw/d3ddevice/mesa.c 2004-11-30 22:39:00.000000000 +0100 +++ wine-20050111/dlls/ddraw/d3ddevice/mesa.c 2005-01-10 14:29:25.000000000 +0100 @@ -381,9 +381,11 @@ { ICOM_THIS_FROM(IDirect3DDeviceImpl, IDirect3DDevice7, iface); IDirect3DDeviceGLImpl *glThis = (IDirect3DDeviceGLImpl *) This; + ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref); - if (!--(This->ref)) { + TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1); + + if (!ref) { int i; IDirectDrawSurfaceImpl *surface = This->surface, *surf; @@ -442,7 +444,7 @@ HeapFree(GetProcessHeap(), 0, This); return 0; } - return This->ref; + return ref; } HRESULT WINAPI @@ -926,7 +928,7 @@ This->world_mat, This->view_mat, This->proj_mat); glThis->transform_state = GL_TRANSFORM_NORMAL; - } else if ((vertex_transformed == TRUE) && + } else if (vertex_transformed && (glThis->transform_state != GL_TRANSFORM_ORTHO)) { /* Set our orthographic projection */ if (glThis->transform_state != GL_TRANSFORM_ORTHO) { @@ -937,8 +939,8 @@ /* TODO: optimize this to not always reset all the fog stuff on all DrawPrimitive call if no fogging state change occurred */ - if (This->state_block.render_state[D3DRENDERSTATE_FOGENABLE - 1] == TRUE) { - if (vertex_transformed == TRUE) { + if (This->state_block.render_state[D3DRENDERSTATE_FOGENABLE - 1]) { + if (vertex_transformed) { if (glThis->fogging != 0) { glDisable(GL_FOG); glThis->fogging = 0; @@ -985,7 +987,7 @@ } /* Handle the 'no-normal' case */ - if ((vertex_lit == FALSE) && (This->state_block.render_state[D3DRENDERSTATE_LIGHTING - 1] == TRUE)) { + if ((vertex_lit == FALSE) && This->state_block.render_state[D3DRENDERSTATE_LIGHTING - 1]) { if (glThis->lighting == 0) { glEnable(GL_LIGHTING); glThis->lighting = 1; @@ -999,8 +1001,8 @@ /* Handle the code for pre-vertex material properties */ if (vertex_transformed == FALSE) { - if ((This->state_block.render_state[D3DRENDERSTATE_LIGHTING - 1] == TRUE) && - (This->state_block.render_state[D3DRENDERSTATE_COLORVERTEX - 1] == TRUE)) { + if (This->state_block.render_state[D3DRENDERSTATE_LIGHTING - 1] && + This->state_block.render_state[D3DRENDERSTATE_COLORVERTEX - 1]) { if ((This->state_block.render_state[D3DRENDERSTATE_DIFFUSEMATERIALSOURCE - 1] != D3DMCS_MATERIAL) || (This->state_block.render_state[D3DRENDERSTATE_AMBIENTMATERIALSOURCE - 1] != D3DMCS_MATERIAL) || (This->state_block.render_state[D3DRENDERSTATE_EMISSIVEMATERIALSOURCE - 1] != D3DMCS_MATERIAL) || @@ -1125,7 +1127,7 @@ unsigned int row; GLenum type; - if (first == TRUE) { + if (first) { MESSAGE("Warning : application does direct locking of ZBuffer - expect slowdowns on many GL implementations :-)\n"); first = FALSE; } @@ -1188,8 +1190,8 @@ } inline static void handle_diffuse_base(STATEBLOCK *sb, DWORD *color) { - if ((sb->render_state[D3DRENDERSTATE_ALPHATESTENABLE - 1] == TRUE) || - (sb->render_state[D3DRENDERSTATE_ALPHABLENDENABLE - 1] == TRUE)) { + if (sb->render_state[D3DRENDERSTATE_ALPHATESTENABLE - 1] || + sb->render_state[D3DRENDERSTATE_ALPHABLENDENABLE - 1]) { glColor4ub((*color >> 16) & 0xFF, (*color >> 8) & 0xFF, (*color >> 0) & 0xFF, @@ -1210,8 +1212,8 @@ inline static void handle_diffuse(STATEBLOCK *sb, DWORD *color, BOOLEAN lighted) { if ((lighted == FALSE) && - (sb->render_state[D3DRENDERSTATE_LIGHTING - 1] == TRUE) && - (sb->render_state[D3DRENDERSTATE_COLORVERTEX - 1] == TRUE)) { + sb->render_state[D3DRENDERSTATE_LIGHTING - 1] && + sb->render_state[D3DRENDERSTATE_COLORVERTEX - 1]) { if (sb->render_state[D3DRENDERSTATE_DIFFUSEMATERIALSOURCE - 1] == D3DMCS_COLOR1) { glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); handle_diffuse_base(sb, color); @@ -1221,7 +1223,7 @@ handle_diffuse_base(sb, color); } if ((sb->render_state[D3DRENDERSTATE_SPECULARMATERIALSOURCE - 1] == D3DMCS_COLOR1) && - (sb->render_state[D3DRENDERSTATE_SPECULARENABLE - 1] == TRUE)) { + sb->render_state[D3DRENDERSTATE_SPECULARENABLE - 1]) { glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); handle_diffuse_base(sb, color); } @@ -1236,8 +1238,8 @@ inline static void handle_specular(STATEBLOCK *sb, DWORD *color, BOOLEAN lighted) { if ((lighted == FALSE) && - (sb->render_state[D3DRENDERSTATE_LIGHTING - 1] == TRUE) && - (sb->render_state[D3DRENDERSTATE_COLORVERTEX - 1] == TRUE)) { + sb->render_state[D3DRENDERSTATE_LIGHTING - 1] && + sb->render_state[D3DRENDERSTATE_COLORVERTEX - 1]) { if (sb->render_state[D3DRENDERSTATE_DIFFUSEMATERIALSOURCE - 1] == D3DMCS_COLOR2) { glColorMaterial(GL_FRONT_AND_BACK, GL_DIFFUSE); handle_specular_base(sb, color); @@ -1247,7 +1249,7 @@ handle_specular_base(sb, color); } if ((sb->render_state[D3DRENDERSTATE_SPECULARMATERIALSOURCE - 1] == D3DMCS_COLOR2) && - (sb->render_state[D3DRENDERSTATE_SPECULARENABLE - 1] == TRUE)) { + sb->render_state[D3DRENDERSTATE_SPECULARENABLE - 1]) { glColorMaterial(GL_FRONT_AND_BACK, GL_SPECULAR); handle_specular_base(sb, color); } @@ -1260,9 +1262,9 @@ } inline static void handle_diffuse_and_specular(STATEBLOCK *sb, BYTE *fog_table, DWORD *color_d, DWORD *color_s, BOOLEAN lighted) { - if (lighted == TRUE) { + if (lighted) { DWORD color = *color_d; - if (sb->render_state[D3DRENDERSTATE_FOGENABLE - 1] == TRUE) { + if (sb->render_state[D3DRENDERSTATE_FOGENABLE - 1]) { /* Special case where the specular value is used to do fogging */ BYTE fog_intensity = *color_s >> 24; /* The alpha value of the specular component is the fog 'intensity' for this vertex */ color &= 0xFF000000; /* Only keep the alpha component */ @@ -1270,12 +1272,12 @@ color |= fog_table[((*color_d >> 8) & 0xFF) << 8 | fog_intensity] << 8; color |= fog_table[((*color_d >> 16) & 0xFF) << 8 | fog_intensity] << 16; } - if (sb->render_state[D3DRENDERSTATE_SPECULARENABLE - 1] == TRUE) { + if (sb->render_state[D3DRENDERSTATE_SPECULARENABLE - 1]) { /* Standard specular value in transformed mode. TODO */ } handle_diffuse_base(sb, &color); } else { - if (sb->render_state[D3DRENDERSTATE_LIGHTING - 1] == TRUE) { + if (sb->render_state[D3DRENDERSTATE_LIGHTING - 1]) { handle_diffuse(sb, color_d, FALSE); handle_specular(sb, color_s, FALSE); } else { @@ -1698,7 +1700,7 @@ TRACE(" - flags : "); dump_DPFLAGS(dwFlags); } - if (vb_impl->processed == TRUE) { + if (vb_impl->processed) { IDirect3DVertexBufferGLImpl *vb_glimp = (IDirect3DVertexBufferGLImpl *) vb_impl; IDirect3DDeviceGLImpl *glThis = (IDirect3DDeviceGLImpl *) This; @@ -1736,7 +1738,7 @@ TRACE(" - flags : "); dump_DPFLAGS(dwFlags); } - if (vb_impl->processed == TRUE) { + if (vb_impl->processed) { IDirect3DVertexBufferGLImpl *vb_glimp = (IDirect3DVertexBufferGLImpl *) vb_impl; IDirect3DDeviceGLImpl *glThis = (IDirect3DDeviceGLImpl *) This; @@ -1939,7 +1941,7 @@ case D3DTADDRESS_CLAMP: TRACE(" Stage type is : %s => D3DTADDRESS_CLAMP\n", type); break; case D3DTADDRESS_BORDER: TRACE(" Stage type is : %s => D3DTADDRESS_BORDER\n", type); break; case D3DTADDRESS_MIRROR: - if (GL_extensions.mirrored_repeat == TRUE) { + if (GL_extensions.mirrored_repeat) { TRACE(" Stage type is : %s => D3DTADDRESS_MIRROR\n", type); } else { FIXME(" Stage type is : %s => D3DTADDRESS_MIRROR - not supported by GL !\n", type); @@ -2209,7 +2211,7 @@ This->matrices_updated(This, TEXMAT0_CHANGED << dwStage); } - if (handled == TRUE) { + if (handled) { TRACE(" Stage type : D3DTSS_TEXTURETRANSFORMFLAGS => %s%s\n", value, projected); } else { FIXME(" Unhandled stage type : D3DTSS_TEXTURETRANSFORMFLAGS => %s%s\n", value, projected); @@ -2319,7 +2321,7 @@ glThis->alpha_test = TRUE; } if ((glThis->current_alpha_test_func != GL_NOTEQUAL) || (glThis->current_alpha_test_ref != 0.0)) { - if (This->state_block.render_state[D3DRENDERSTATE_ALPHATESTENABLE - 1] == TRUE) { + if (This->state_block.render_state[D3DRENDERSTATE_ALPHATESTENABLE - 1]) { static BOOL warn = FALSE; if (warn == FALSE) { warn = TRUE; @@ -3151,7 +3153,7 @@ x_stretch = (double) (rect.u3.x2 - rect.u1.x1) / (double) width; y_stretch = (double) (rect.u4.y2 - rect.u2.y1) / (double) height; - TRACE(" using memory to buffer Blt overide.\n"); + TRACE(" using memory to buffer Blt override.\n"); ENTER_GL(); @@ -3159,7 +3161,7 @@ if (upload_surface_to_tex_memory_init(src_impl, 0, &gl_d3d_dev->current_internal_format, initial, ((dwFlags & DDBLT_KEYSRC) != 0), UNLOCK_TEX_SIZE, UNLOCK_TEX_SIZE) != DD_OK) { - ERR(" unsupported pixel format at memory to buffer Blt overide.\n"); + ERR(" unsupported pixel format at memory to buffer Blt override.\n"); LEAVE_GL(); return DDERR_INVALIDPARAMS; } @@ -3170,7 +3172,7 @@ else glDrawBuffer(GL_BACK); - /* Now the serious stuff happens. This is basically the same code that for the memory + /* Now the serious stuff happens. This is basically the same code as for the memory flush to frame buffer ... with stretching and different rectangles added :-) */ for (y = 0; y < height; y += UNLOCK_TEX_SIZE) { RECT flush_rect; @@ -3272,7 +3274,7 @@ if (setup_rect_and_surface_for_blt(This, &buffer_type, (D3DRECT *) &rdst) != DD_OK) return DDERR_INVALIDPARAMS; - TRACE(" using BltFast memory to frame buffer overide.\n"); + TRACE(" using BltFast memory to frame buffer override.\n"); ENTER_GL(); @@ -3281,7 +3283,7 @@ if (upload_surface_to_tex_memory_init(src_impl, 0, &gl_d3d_dev->current_internal_format, initial, (trans & DDBLTFAST_SRCCOLORKEY) != 0, UNLOCK_TEX_SIZE, UNLOCK_TEX_SIZE) != DD_OK) { - ERR(" unsupported pixel format at memory to buffer Blt overide.\n"); + ERR(" unsupported pixel format at memory to buffer Blt override.\n"); LEAVE_GL(); return DDERR_INVALIDPARAMS; } @@ -3591,7 +3593,7 @@ /* Try to acquire the device critical section */ EnterCriticalSection(&(d3d_dev->crit)); - if (gl_d3d_dev->lock_rect_valid[buffer_type] == TRUE) { + if (gl_d3d_dev->lock_rect_valid[buffer_type]) { ERR("Two consecutive locks on %s buffer... Expect problems !\n", (buffer_type == WINE_GL_BUFFER_BACK ? "back" : "front")); } @@ -3866,7 +3868,7 @@ /* Initialize texture stages states */ for (stage = 0; stage < MAX_TEXTURES; stage++) { for (state = 0; state < HIGHEST_TEXTURE_STAGE_STATE; state += 1) { - if (This->state_block.set_flags.texture_stage_state[stage][state] == TRUE) { + if (This->state_block.set_flags.texture_stage_state[stage][state]) { IDirect3DDevice7_SetTextureStageState(ICOM_INTERFACE(This, IDirect3DDevice7), stage, state + 1, This->state_block.texture_stage_state[stage][state]); } @@ -3976,9 +3978,9 @@ surf2->aux_blt = d3ddevice_blt; surf2->aux_bltfast = d3ddevice_bltfast; - TRACE(" overiding direct surface access.\n"); + TRACE(" overriding direct surface access.\n"); } else { - TRACE(" no overide.\n"); + TRACE(" no override.\n"); } surf2->d3ddevice = object; } @@ -4085,7 +4087,7 @@ pc->dwRasterCaps = D3DPRASTERCAPS_DITHER | D3DPRASTERCAPS_FOGRANGE | D3DPRASTERCAPS_FOGTABLE | D3DPRASTERCAPS_FOGVERTEX | D3DPRASTERCAPS_STIPPLE | D3DPRASTERCAPS_ZBIAS | D3DPRASTERCAPS_ZTEST | D3DPRASTERCAPS_SUBPIXEL | D3DPRASTERCAPS_ZFOG; - if (GL_extensions.mipmap_lodbias == TRUE) { + if (GL_extensions.mipmap_lodbias) { pc->dwRasterCaps |= D3DPRASTERCAPS_MIPMAPLODBIAS; } pc->dwZCmpCaps = D3DPCMPCAPS_ALWAYS | D3DPCMPCAPS_EQUAL | D3DPCMPCAPS_GREATER | D3DPCMPCAPS_GREATEREQUAL | @@ -4109,7 +4111,7 @@ pc->dwTextureBlendCaps = D3DPTBLENDCAPS_ADD | D3DPTBLENDCAPS_COPY | D3DPTBLENDCAPS_DECAL | D3DPTBLENDCAPS_DECALALPHA | D3DPTBLENDCAPS_DECALMASK | D3DPTBLENDCAPS_MODULATE | D3DPTBLENDCAPS_MODULATEALPHA | D3DPTBLENDCAPS_MODULATEMASK; pc->dwTextureAddressCaps = D3DPTADDRESSCAPS_BORDER | D3DPTADDRESSCAPS_CLAMP | D3DPTADDRESSCAPS_WRAP | D3DPTADDRESSCAPS_INDEPENDENTUV; - if (GL_extensions.mirrored_repeat == TRUE) { + if (GL_extensions.mirrored_repeat) { pc->dwTextureAddressCaps |= D3DPTADDRESSCAPS_MIRROR; } pc->dwStippleWidth = 32; @@ -4170,7 +4172,7 @@ opengl_device_caps.dwReserved3 = 0; opengl_device_caps.dwReserved4 = 0; - /* And now some GL overides :-) */ + /* And now some GL overrides :-) */ glGetIntegerv(GL_MAX_TEXTURE_SIZE, (GLint *) &opengl_device_caps.dwMaxTextureWidth); opengl_device_caps.dwMaxTextureHeight = opengl_device_caps.dwMaxTextureWidth; opengl_device_caps.dwMaxTextureAspectRatio = opengl_device_caps.dwMaxTextureWidth; @@ -4212,6 +4214,12 @@ int major, minor, patch, num_parsed; TRACE("Initializing GL...\n"); + + if (!drawable) + { + WARN("x11drv not loaded - D3D support disabled!\n"); + return FALSE; + } /* Get a default rendering context to have the 'caps' function query some info from GL */ device_context = GetDC(0); diff -urN wine-20041201/dlls/ddraw/d3dexecutebuffer.c wine-20050111/dlls/ddraw/d3dexecutebuffer.c --- wine-20041201/dlls/ddraw/d3dexecutebuffer.c 2004-09-08 03:37:25.000000000 +0200 +++ wine-20050111/dlls/ddraw/d3dexecutebuffer.c 2005-01-09 18:35:44.000000000 +0100 @@ -110,8 +110,7 @@ if (count*3>This->nb_indices) { This->nb_indices = count * 3; - if (This->indices) - HeapFree(GetProcessHeap(),0,This->indices); + HeapFree(GetProcessHeap(),0,This->indices); This->indices = HeapAlloc(GetProcessHeap(),0,sizeof(WORD)*This->nb_indices); } @@ -520,27 +519,31 @@ Main_IDirect3DExecuteBufferImpl_1_AddRef(LPDIRECT3DEXECUTEBUFFER iface) { ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface); - FIXME("(%p/%p)->()incrementing from %lu.\n", This, iface, This->ref ); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + FIXME("(%p/%p)->()incrementing from %lu.\n", This, iface, ref - 1); + + return ref; } ULONG WINAPI Main_IDirect3DExecuteBufferImpl_1_Release(LPDIRECT3DEXECUTEBUFFER iface) { ICOM_THIS_FROM(IDirect3DExecuteBufferImpl, IDirect3DExecuteBuffer, iface); - TRACE("(%p/%p)->()decrementing from %lu.\n", This, iface, This->ref); - if (!--(This->ref)) { + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p/%p)->()decrementing from %lu.\n", This, iface, ref + 1); + + if (!ref) { if ((This->desc.lpData != NULL) && This->need_free) HeapFree(GetProcessHeap(),0,This->desc.lpData); - if (This->vertex_data != NULL) - HeapFree(GetProcessHeap(),0,This->vertex_data); - if (This->indices != NULL) - HeapFree(GetProcessHeap(),0,This->indices); + HeapFree(GetProcessHeap(),0,This->vertex_data); + HeapFree(GetProcessHeap(),0,This->indices); HeapFree(GetProcessHeap(),0,This); return 0; } - return This->ref; + return ref; } HRESULT WINAPI @@ -594,8 +597,7 @@ nbvert = This->data.dwVertexCount; /* Prepares the transformed vertex buffer */ - if (This->vertex_data != NULL) - HeapFree(GetProcessHeap(), 0, This->vertex_data); + HeapFree(GetProcessHeap(), 0, This->vertex_data); This->vertex_data = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, nbvert * sizeof(D3DTLVERTEX)); if (TRACE_ON(ddraw)) { diff -urN wine-20041201/dlls/ddraw/d3dlight.c wine-20050111/dlls/ddraw/d3dlight.c --- wine-20041201/dlls/ddraw/d3dlight.c 2004-11-30 22:39:00.000000000 +0100 +++ wine-20050111/dlls/ddraw/d3dlight.c 2005-01-09 18:35:44.000000000 +0100 @@ -53,20 +53,26 @@ Main_IDirect3DLightImpl_1_AddRef(LPDIRECT3DLIGHT iface) { ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface); - TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1); + + return ref; } ULONG WINAPI Main_IDirect3DLightImpl_1_Release(LPDIRECT3DLIGHT iface) { ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface); - TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref); - if (!--(This->ref)) { + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1); + + if (!ref) { HeapFree(GetProcessHeap(), 0, This); return 0; } - return This->ref; + return ref; } HRESULT WINAPI @@ -191,14 +197,16 @@ { ICOM_THIS_FROM(IDirect3DLightImpl, IDirect3DLight, iface); IDirect3DLightGLImpl *glThis = (IDirect3DLightGLImpl *) This; + ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref); - if (!--(This->ref)) { + TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1); + + if (!ref) { ((IDirect3DGLImpl *) This->d3d->d3d_private)->light_released(This->d3d, glThis->light_num); HeapFree(GetProcessHeap(), 0, This); return 0; } - return This->ref; + return ref; } #if !defined(__STRICT_ANSI__) && defined(__GNUC__) diff -urN wine-20041201/dlls/ddraw/d3dmaterial.c wine-20050111/dlls/ddraw/d3dmaterial.c --- wine-20041201/dlls/ddraw/d3dmaterial.c 2004-08-23 21:40:01.000000000 +0200 +++ wine-20050111/dlls/ddraw/d3dmaterial.c 2005-01-09 18:35:44.000000000 +0100 @@ -85,20 +85,26 @@ Main_IDirect3DMaterialImpl_3_2T_1T_AddRef(LPDIRECT3DMATERIAL3 iface) { ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface); - TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1); + + return ref; } ULONG WINAPI Main_IDirect3DMaterialImpl_3_2T_1T_Release(LPDIRECT3DMATERIAL3 iface) { ICOM_THIS_FROM(IDirect3DMaterialImpl, IDirect3DMaterial3, iface); - TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref); - if (!--(This->ref)) { + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1); + + if (!ref) { HeapFree(GetProcessHeap(), 0, This); return 0; } - return This->ref; + return ref; } HRESULT WINAPI diff -urN wine-20041201/dlls/ddraw/d3dtexture.c wine-20050111/dlls/ddraw/d3dtexture.c --- wine-20041201/dlls/ddraw/d3dtexture.c 2004-08-23 21:40:01.000000000 +0200 +++ wine-20050111/dlls/ddraw/d3dtexture.c 2005-01-10 14:29:26.000000000 +0100 @@ -147,7 +147,7 @@ case D3DTADDRESS_CLAMP: gl_state = GL_CLAMP; break; case D3DTADDRESS_BORDER: gl_state = GL_CLAMP_TO_EDGE; break; case D3DTADDRESS_MIRROR: - if (GL_extensions.mirrored_repeat == TRUE) { + if (GL_extensions.mirrored_repeat) { gl_state = GL_MIRRORED_REPEAT_WINE; } else { gl_state = GL_REPEAT; @@ -266,7 +266,7 @@ changed = TRUE; } - if (changed == TRUE) { + if (changed) { if (gl_surf_ptr->tex_parameters == NULL) { gl_surf_ptr->tex_parameters = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(DWORD) * (D3DTSS_MAXMIPLEVEL + 1 - D3DTSS_ADDRESSU)); @@ -577,8 +577,7 @@ glDeleteTextures(1, &(glThis->tex_name)); LEAVE_GL(); - if (glThis->surface_ptr != NULL) - HeapFree(GetProcessHeap(), 0, glThis->surface_ptr); + HeapFree(GetProcessHeap(), 0, glThis->surface_ptr); /* And if this texture was the current one, remove it at the device level */ if (This->d3ddevice != NULL) @@ -890,7 +889,7 @@ surf->aux_setcolorkey_cb = gltex_setcolorkey_cb; surf->set_palette = gltex_set_palette; - /* We are the only one to use the aux_blt and aux_bltfast overides, so no need + /* We are the only one to use the aux_blt and aux_bltfast overrides, so no need to save those... */ surf->aux_blt = gltex_blt; surf->aux_bltfast = gltex_bltfast; diff -urN wine-20041201/dlls/ddraw/d3dvertexbuffer.c wine-20050111/dlls/ddraw/d3dvertexbuffer.c --- wine-20041201/dlls/ddraw/d3dvertexbuffer.c 2004-09-08 03:37:25.000000000 +0200 +++ wine-20050111/dlls/ddraw/d3dvertexbuffer.c 2005-01-09 18:35:44.000000000 +0100 @@ -73,21 +73,27 @@ Main_IDirect3DVertexBufferImpl_7_1T_AddRef(LPDIRECT3DVERTEXBUFFER7 iface) { ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface); - TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1); + + return ref; } ULONG WINAPI Main_IDirect3DVertexBufferImpl_7_1T_Release(LPDIRECT3DVERTEXBUFFER7 iface) { ICOM_THIS_FROM(IDirect3DVertexBufferImpl, IDirect3DVertexBuffer7, iface); - TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref); - if (--(This->ref) == 0) { + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1); + + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This->vertices); HeapFree(GetProcessHeap(), 0, This); return 0; } - return This->ref; + return ref; } HRESULT WINAPI @@ -104,7 +110,7 @@ DDRAW_dump_lockflag(dwFlags); } - if (This->processed == TRUE) { + if (This->processed) { WARN(" application does a Lock on a vertex buffer resulting from a ProcessVertices call. Expect problems !\n"); } diff -urN wine-20041201/dlls/ddraw/d3dviewport.c wine-20050111/dlls/ddraw/d3dviewport.c --- wine-20041201/dlls/ddraw/d3dviewport.c 2004-08-23 21:40:00.000000000 +0200 +++ wine-20050111/dlls/ddraw/d3dviewport.c 2005-01-10 14:29:26.000000000 +0100 @@ -126,20 +126,26 @@ Main_IDirect3DViewportImpl_3_2_1_AddRef(LPDIRECT3DVIEWPORT3 iface) { ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface); - TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p/%p)->() incrementing from %lu.\n", This, iface, ref - 1); + + return ref; } ULONG WINAPI Main_IDirect3DViewportImpl_3_2_1_Release(LPDIRECT3DVIEWPORT3 iface) { ICOM_THIS_FROM(IDirect3DViewportImpl, IDirect3DViewport3, iface); - TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, This->ref); - if (!--(This->ref)) { + ULONG ref = InterlockedDecrement(&This->ref); + + TRACE("(%p/%p)->() decrementing from %lu.\n", This, iface, ref + 1); + + if (!ref) { HeapFree(GetProcessHeap(), 0, This); return 0; } - return This->ref; + return ref; } @@ -192,7 +198,7 @@ memset(&(This->viewports.vp1), 0, sizeof(This->viewports.vp1)); memcpy(&(This->viewports.vp1), lpData, lpData->dwSize); - /* Tests on two games shows that these values are never used properly so overide + /* Tests on two games show that these values are never used properly so override them with proper ones :-) */ This->viewports.vp1.dvMinZ = 0.0; diff -urN wine-20041201/dlls/ddraw/dclipper/main.c wine-20050111/dlls/ddraw/dclipper/main.c --- wine-20041201/dlls/ddraw/dclipper/main.c 2004-09-08 03:50:37.000000000 +0200 +++ wine-20050111/dlls/ddraw/dclipper/main.c 2005-01-09 18:35:44.000000000 +0100 @@ -114,14 +114,16 @@ ULONG WINAPI Main_DirectDrawClipper_Release(LPDIRECTDRAWCLIPPER iface) { IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; - TRACE("(%p)->() decrementing from %lu.\n", This, This->ref ); + ULONG ref = InterlockedDecrement(&This->ref); - if (--This->ref == 0) + TRACE("(%p)->() decrementing from %lu.\n", This, ref + 1); + + if (ref == 0) { Main_DirectDrawClipper_Destroy(This); return 0; } - else return This->ref; + else return ref; } /*********************************************************************** @@ -211,7 +213,7 @@ || IsEqualGUID(&IID_IDirectDrawClipper, riid)) { *ppvObj = ICOM_INTERFACE(This, IDirectDrawClipper); - ++This->ref; + InterlockedIncrement(&This->ref); return S_OK; } else @@ -223,8 +225,11 @@ ULONG WINAPI Main_DirectDrawClipper_AddRef( LPDIRECTDRAWCLIPPER iface ) { IDirectDrawClipperImpl *This = (IDirectDrawClipperImpl *)iface; - TRACE("(%p)->() incrementing from %lu.\n", This, This->ref ); - return ++This->ref; + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p)->() incrementing from %lu.\n", This, ref - 1); + + return ref; } HRESULT WINAPI Main_DirectDrawClipper_GetHWnd( diff -urN wine-20041201/dlls/ddraw/ddraw/hal.c wine-20050111/dlls/ddraw/ddraw/hal.c --- wine-20041201/dlls/ddraw/ddraw/hal.c 2004-09-08 03:50:37.000000000 +0200 +++ wine-20050111/dlls/ddraw/ddraw/hal.c 2004-12-06 17:21:27.000000000 +0100 @@ -213,6 +213,9 @@ static void cleanup(void) { DDHAL_DESTROYDRIVERDATA data; + + if (!dd_cbs.HALDD.DestroyDriver) return; + data.lpDD = NULL; data.ddRVal = 0; data.DestroyDriver = dd_cbs.HALDD.DestroyDriver; diff -urN wine-20041201/dlls/ddraw/ddraw/main.c wine-20050111/dlls/ddraw/ddraw/main.c --- wine-20041201/dlls/ddraw/ddraw/main.c 2004-11-19 19:05:15.000000000 +0100 +++ wine-20050111/dlls/ddraw/ddraw/main.c 2005-01-09 18:35:44.000000000 +0100 @@ -149,17 +149,18 @@ ULONG WINAPI Main_DirectDraw_AddRef(LPDIRECTDRAW7 iface) { IDirectDrawImpl *This = (IDirectDrawImpl *)iface; - TRACE("(%p)->() incrementing from %lu.\n", This, This->ref ); + ULONG ref = InterlockedIncrement(&This->ref); - return ++This->ref; + TRACE("(%p)->() incrementing from %lu.\n", This, ref -1); + + return ref; } ULONG WINAPI Main_DirectDraw_Release(LPDIRECTDRAW7 iface) { - ULONG ref; IDirectDrawImpl *This = (IDirectDrawImpl *)iface; - TRACE("(%p)->() decrementing from %lu.\n", This, This->ref ); + ULONG ref = InterlockedDecrement(&This->ref); - ref = --This->ref; + TRACE("(%p)->() decrementing from %lu.\n", This, ref +1); if (ref == 0) { @@ -408,21 +409,22 @@ } #endif - if (!(ddsd.dwFlags & DDSD_PITCH)) + if ((ddsd.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) && !(ddsd.dwFlags & DDSD_LINEARSIZE)) { - if (ddsd.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) { - int size = 0; - int width = ddsd.dwWidth; - int height = ddsd.dwHeight; - switch(ddsd.u4.ddpfPixelFormat.dwFourCC) { - case MAKE_FOURCC('D','X','T','1'): size = ((width+3)&~3) * ((height+3)&~3) / 16 * 8; break; - case MAKE_FOURCC('D','X','T','3'): size = ((width+3)&~3) * ((height+3)&~3) / 16 * 16; break; - case MAKE_FOURCC('D','X','T','5'): size = ((width+3)&~3) * ((height+3)&~3) / 16 * 16; break; - default: FIXME("FOURCC not supported\n"); break; - } - ddsd.u1.dwLinearSize = size; - } else - ddsd.u1.lPitch = DDRAW_width_bpp_to_pitch(ddsd.dwWidth, GET_BPP(ddsd)*8); + int size = 0; + int width = ddsd.dwWidth; + int height = ddsd.dwHeight; + switch(ddsd.u4.ddpfPixelFormat.dwFourCC) { + case MAKE_FOURCC('D','X','T','1'): size = ((width+3)&~3) * ((height+3)&~3) / 16 * 8; break; + case MAKE_FOURCC('D','X','T','3'): size = ((width+3)&~3) * ((height+3)&~3) / 16 * 16; break; + case MAKE_FOURCC('D','X','T','5'): size = ((width+3)&~3) * ((height+3)&~3) / 16 * 16; break; + default: FIXME("FOURCC not supported\n"); break; + } + ddsd.u1.dwLinearSize = size; + ddsd.dwFlags |= DDSD_LINEARSIZE; + } else if (!(ddsd.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) && !(ddsd.dwFlags & DDSD_PITCH)) { + ddsd.u1.lPitch = DDRAW_width_bpp_to_pitch(ddsd.dwWidth, GET_BPP(ddsd)*8); + ddsd.dwFlags |= DDSD_PITCH; } /* Check also for the MIPMAP / MIPMAPCOUNT flags. @@ -433,7 +435,7 @@ ddsd.u2.dwMipMapCount = 1; } - ddsd.dwFlags |= DDSD_PITCH | DDSD_PIXELFORMAT; + ddsd.dwFlags |= DDSD_PIXELFORMAT; hr = This->create_texture(This, &ddsd, ppSurf, pUnkOuter, mipmap_level); if (FAILED(hr)) return hr; @@ -1010,9 +1012,20 @@ Main_DirectDraw_GetScanLine(LPDIRECTDRAW7 iface, LPDWORD lpdwScanLine) { IDirectDrawImpl *This = (IDirectDrawImpl *)iface; - FIXME("(%p)->(%p)\n", This, lpdwScanLine); + static BOOL hide; + + /* Since this method is called often, show the fixme only once */ + if (!hide) { + FIXME("(%p)->(%p) semi-stub\n", This, lpdwScanLine); + hide = TRUE; + } - *lpdwScanLine = 1; + /* Fake the line sweeping of the monitor */ + /* FIXME: We should synchronize with a source to keep the refresh rate */ + *lpdwScanLine = This->cur_scanline++; + /* Assume 20 scan lines in the vertical blank */ + if (This->cur_scanline >= This->height + 20) + This->cur_scanline = 0; return DD_OK; } diff -urN wine-20041201/dlls/ddraw/ddraw.spec wine-20050111/dlls/ddraw/ddraw.spec --- wine-20041201/dlls/ddraw/ddraw.spec 2003-07-30 05:48:56.000000000 +0200 +++ wine-20050111/dlls/ddraw/ddraw.spec 2005-01-03 21:47:48.000000000 +0100 @@ -26,5 +26,3 @@ @ stub VidMemFree @ stub VidMemInit @ stub VidMemLargestFree -@ stub thk1632_ThunkData32 -@ stub thk3216_ThunkData32 diff -urN wine-20041201/dlls/ddraw/ddraw_private.h wine-20050111/dlls/ddraw/ddraw_private.h --- wine-20041201/dlls/ddraw/ddraw_private.h 2004-08-02 20:24:40.000000000 +0200 +++ wine-20050111/dlls/ddraw/ddraw_private.h 2004-12-27 18:12:55.000000000 +0100 @@ -111,6 +111,7 @@ DWORD width, height; LONG pitch; DDPIXELFORMAT pixelformat; + DWORD cur_scanline; /* Should each of these go into some structure? */ DWORD orig_width, orig_height; diff -urN wine-20041201/dlls/ddraw/direct3d/mesa.c wine-20050111/dlls/ddraw/direct3d/mesa.c --- wine-20041201/dlls/ddraw/direct3d/mesa.c 2004-08-23 21:39:59.000000000 +0200 +++ wine-20050111/dlls/ddraw/direct3d/mesa.c 2004-12-20 18:08:41.000000000 +0100 @@ -153,6 +153,7 @@ (IsEqualGUID(&IID_D3DDEVICE_OpenGL, iid)) || (IsEqualGUID(&IID_IDirect3DHALDevice, iid)) || (IsEqualGUID(&IID_IDirect3DTnLHalDevice, iid)) || + (IsEqualGUID(&IID_IDirect3DRGBDevice, iid)) || (IsEqualGUID(&IID_IDirect3DRefDevice, iid))) { switch (version) { case 1: diff -urN wine-20041201/dlls/ddraw/dpalette/main.c wine-20050111/dlls/ddraw/dpalette/main.c --- wine-20041201/dlls/ddraw/dpalette/main.c 2004-09-08 03:50:37.000000000 +0200 +++ wine-20050111/dlls/ddraw/dpalette/main.c 2005-01-09 18:35:44.000000000 +0100 @@ -208,21 +208,26 @@ Main_DirectDrawPalette_Release(LPDIRECTDRAWPALETTE iface) { IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface; - TRACE("(%p)->() decrementing from %lu.\n", This, This->ref ); + ULONG ref = InterlockedDecrement(&This->ref); - if (!--This->ref) + TRACE("(%p)->() decrementing from %lu.\n", This, ref + 1); + + if (!ref) { Main_DirectDrawPalette_Destroy(This); return 0; } - return This->ref; + return ref; } ULONG WINAPI Main_DirectDrawPalette_AddRef(LPDIRECTDRAWPALETTE iface) { IDirectDrawPaletteImpl *This = (IDirectDrawPaletteImpl *)iface; - TRACE("(%p)->() incrementing from %lu.\n", This, This->ref ); - return ++This->ref; + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p)->() incrementing from %lu.\n", This, ref - 1); + + return ref; } HRESULT WINAPI diff -urN wine-20041201/dlls/ddraw/dsurface/dib.c wine-20050111/dlls/ddraw/dsurface/dib.c --- wine-20041201/dlls/ddraw/dsurface/dib.c 2004-09-08 03:50:37.000000000 +0200 +++ wine-20050111/dlls/ddraw/dsurface/dib.c 2005-01-03 15:41:08.000000000 +0100 @@ -253,17 +253,20 @@ } /* XXX else: how should lPitch be verified? */ - This->surface_desc.dwFlags |= DDSD_PITCH|DDSD_LPSURFACE; + This->surface_desc.dwFlags |= DDSD_LPSURFACE; - if (This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) + if (This->surface_desc.u4.ddpfPixelFormat.dwFlags & DDPF_FOURCC) { This->surface_desc.lpSurface = VirtualAlloc(NULL, This->surface_desc.u1.dwLinearSize, MEM_COMMIT, PAGE_READWRITE); - else + This->surface_desc.dwFlags |= DDSD_LINEARSIZE; + } else { This->surface_desc.lpSurface = VirtualAlloc(NULL, This->surface_desc.u1.lPitch * This->surface_desc.dwHeight + 4, /* The + 4 here is for dumb games reading after the end of the surface when reading the last byte / half using word access */ MEM_COMMIT, PAGE_READWRITE); + This->surface_desc.dwFlags |= DDSD_PITCH; + } if (This->surface_desc.lpSurface == NULL) { @@ -999,6 +1002,16 @@ rsrc->bottom = sdesc.dwHeight; } + /* Check source rect for validity. Copied from normal Blt. Fixes Baldur's Gate.*/ + if ((rsrc->bottom > sdesc.dwHeight) || (rsrc->bottom < 0) || + (rsrc->top > sdesc.dwHeight) || (rsrc->top < 0) || + (rsrc->left > sdesc.dwWidth) || (rsrc->left < 0) || + (rsrc->right > sdesc.dwWidth) || (rsrc->right < 0) || + (rsrc->right < rsrc->left) || (rsrc->bottom < rsrc->top)) { + WARN("Application gave us bad source rectangle for BltFast.\n"); + return DDERR_INVALIDRECT; + } + h=rsrc->bottom-rsrc->top; if (h>ddesc.dwHeight-dsty) h=ddesc.dwHeight-dsty; if (h>sdesc.dwHeight-rsrc->top) h=sdesc.dwHeight-rsrc->top; diff -urN wine-20041201/dlls/ddraw/dsurface/fakezbuffer.c wine-20050111/dlls/ddraw/dsurface/fakezbuffer.c --- wine-20041201/dlls/ddraw/dsurface/fakezbuffer.c 2004-09-08 03:50:37.000000000 +0200 +++ wine-20050111/dlls/ddraw/dsurface/fakezbuffer.c 2004-12-09 15:08:00.000000000 +0100 @@ -61,7 +61,7 @@ static BOOLEAN zbuffer_get_dirty_status(IDirectDrawSurfaceImpl* This, LPCRECT pRect) { - if (((FakeZBuffer_DirectDrawSurfaceImpl *) This->private)->in_memory == TRUE) { + if (((FakeZBuffer_DirectDrawSurfaceImpl *) This->private)->in_memory) { ((FakeZBuffer_DirectDrawSurfaceImpl *) This->private)->in_memory = FALSE; return TRUE; } diff -urN wine-20041201/dlls/ddraw/dsurface/main.c wine-20050111/dlls/ddraw/dsurface/main.c --- wine-20041201/dlls/ddraw/dsurface/main.c 2004-10-07 05:06:51.000000000 +0200 +++ wine-20050111/dlls/ddraw/dsurface/main.c 2005-01-09 18:35:44.000000000 +0100 @@ -125,10 +125,11 @@ ULONG WINAPI Main_DirectDrawSurface_Release(LPDIRECTDRAWSURFACE7 iface) { IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface; + ULONG ref = InterlockedDecrement(&This->ref); - TRACE("(%p)->(): decreasing from %ld\n", This, This->ref); + TRACE("(%p)->(): decreasing from %ld\n", This, ref + 1); - if (--This->ref == 0) + if (ref == 0) { if (This->aux_release) This->aux_release(This->aux_ctx, This->aux_data); @@ -139,16 +140,17 @@ return 0; } - return This->ref; + return ref; } ULONG WINAPI Main_DirectDrawSurface_AddRef(LPDIRECTDRAWSURFACE7 iface) { IDirectDrawSurfaceImpl *This = (IDirectDrawSurfaceImpl *)iface; + ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(%p)->(): increasing from %ld\n", This, This->ref); + TRACE("(%p)->(): increasing from %ld\n", This, ref - 1); - return ++This->ref; + return ref; } HRESULT WINAPI @@ -164,7 +166,7 @@ || IsEqualGUID(&IID_IDirectDrawSurface7, riid) || IsEqualGUID(&IID_IDirectDrawSurface4, riid)) { - This->ref++; + InterlockedIncrement(&This->ref); *ppObj = ICOM_INTERFACE(This, IDirectDrawSurface7); return S_OK; } @@ -172,13 +174,13 @@ || IsEqualGUID(&IID_IDirectDrawSurface2, riid) || IsEqualGUID(&IID_IDirectDrawSurface3, riid)) { - This->ref++; + InterlockedIncrement(&This->ref); *ppObj = ICOM_INTERFACE(This, IDirectDrawSurface3); return S_OK; } else if (IsEqualGUID(&IID_IDirectDrawGammaControl, riid)) { - This->ref++; + InterlockedIncrement(&This->ref); *ppObj = ICOM_INTERFACE(This, IDirectDrawGammaControl); return S_OK; } @@ -199,7 +201,7 @@ *ppObj = ICOM_INTERFACE(d3ddevimpl, IDirect3DDevice); TRACE(" returning Direct3DDevice interface at %p.\n", *ppObj); - This->ref++; /* No idea if this is correct.. Need to check using real Windows */ + InterlockedIncrement(&This->ref); /* No idea if this is correct.. Need to check using real Windows */ return ret_value; } else if (IsEqualGUID( &IID_IDirect3DTexture, riid ) || @@ -230,7 +232,7 @@ *ppObj = ICOM_INTERFACE(This, IDirect3DTexture2); TRACE(" returning Direct3DTexture2 interface at %p.\n", *ppObj); } - This->ref++; + InterlockedIncrement(&This->ref); return ret_value; } #endif diff -urN wine-20041201/dlls/ddraw/dsurface/user.c wine-20050111/dlls/ddraw/dsurface/user.c --- wine-20041201/dlls/ddraw/dsurface/user.c 2004-08-23 21:39:58.000000000 +0200 +++ wine-20050111/dlls/ddraw/dsurface/user.c 2005-01-07 16:40:09.000000000 +0100 @@ -96,8 +96,8 @@ #endif #ifndef SYNC_UPDATE InitializeCriticalSection(&priv->user.crit); - priv->user.refresh_event = CreateEventA(NULL, TRUE, FALSE, NULL); - priv->user.update_event = CreateEventA(NULL, FALSE, FALSE, NULL); + priv->user.refresh_event = CreateEventW(NULL, TRUE, FALSE, NULL); + priv->user.update_event = CreateEventW(NULL, FALSE, FALSE, NULL); priv->user.update_thread = CreateThread(NULL, 0, User_update_thread, This, 0, NULL); #ifdef OWN_WINDOW if (This->ddraw_owner->cooperative_level & DDSCL_FULLSCREEN) { diff -urN wine-20041201/dlls/ddraw/main.c wine-20050111/dlls/ddraw/main.c --- wine-20041201/dlls/ddraw/main.c 2004-10-07 05:06:51.000000000 +0200 +++ wine-20050111/dlls/ddraw/main.c 2005-01-09 18:35:44.000000000 +0100 @@ -496,10 +496,11 @@ static ULONG WINAPI DDCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + ULONG ref = InterlockedIncrement(&This->ref); - TRACE("(%p)->() incrementing from %ld.\n", This, This->ref); + TRACE("(%p)->() incrementing from %ld.\n", This, ref - 1); - return InterlockedIncrement(&This->ref); + return ref; } static ULONG WINAPI DDCF_Release(LPCLASSFACTORY iface) diff -urN wine-20041201/dlls/ddraw/mesa.c wine-20050111/dlls/ddraw/mesa.c --- wine-20041201/dlls/ddraw/mesa.c 2004-11-19 19:05:15.000000000 +0100 +++ wine-20050111/dlls/ddraw/mesa.c 2005-01-09 17:42:53.000000000 +0100 @@ -162,7 +162,7 @@ glThis->depth_test = TRUE; } } else if (dwRenderState == D3DZB_FALSE) { - if (glThis->depth_test == TRUE) { + if (glThis->depth_test) { glDisable(GL_DEPTH_TEST); glThis->depth_test = FALSE; } @@ -668,7 +668,6 @@ default: FIXME("FourCC Not supported\n"); return DD_OK; - break; } if (GL_extensions.s3tc_compressed_texture) { @@ -883,7 +882,7 @@ if ((src_pf->u2.dwRBitMask == 0x00FF0000) && (src_pf->u3.dwGBitMask == 0x0000FF00) && (src_pf->u4.dwBBitMask == 0x000000FF)) { - if (need_alpha_ck == TRUE) { + if (need_alpha_ck) { convert_type = CONVERT_RGB32_888; current_format = GL_RGBA; internal_format = GL_RGBA; @@ -905,7 +904,7 @@ error = TRUE; } - if (error == TRUE) { + if (error) { ERR("Unsupported pixel format for textures : \n"); if (ERR_ON(ddraw)) { DDRAW_dump_pixelformat(src_pf); @@ -921,7 +920,7 @@ } } - if ((sub_texture == TRUE) && (convert_type == NO_CONVERSION)) { + if (sub_texture && (convert_type == NO_CONVERSION)) { current_storage_width = surf_ptr->surface_desc.u1.lPitch / bpp; } else { if (surf_ptr->surface_desc.u1.lPitch == (surf_ptr->surface_desc.dwWidth * bpp)) { @@ -971,7 +970,6 @@ default: FIXME("Not supported\n"); return DD_OK; - break; } if (GL_extensions.s3tc_compressed_texture) { diff -urN wine-20041201/dlls/devenum/createdevenum.c wine-20050111/dlls/devenum/createdevenum.c --- wine-20041201/dlls/devenum/createdevenum.c 2004-09-06 22:34:30.000000000 +0200 +++ wine-20050111/dlls/devenum/createdevenum.c 2004-12-13 22:19:02.000000000 +0100 @@ -33,8 +33,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(devenum); -extern IEnumMonikerVtbl IEnumMoniker_Vtbl; - extern HINSTANCE DEVENUM_hInstance; const WCHAR wszInstanceKeyName[] ={'I','n','s','t','a','n','c','e',0}; @@ -46,7 +44,7 @@ 'd','e','v','e','n','u','m','\\',0}; static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface); -static HRESULT DEVENUM_CreateSpecialCategories(); +static HRESULT DEVENUM_CreateSpecialCategories(void); /********************************************************************** * DEVENUM_ICreateDevEnum_QueryInterface (also IUnknown) @@ -56,10 +54,9 @@ REFIID riid, LPVOID *ppvObj) { - CreateDevEnumImpl *This = (CreateDevEnumImpl *)iface; TRACE("\n\tIID:\t%s\n",debugstr_guid(riid)); - if (This == NULL || ppvObj == NULL) return E_POINTER; + if (ppvObj == NULL) return E_POINTER; if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_ICreateDevEnum)) @@ -78,15 +75,11 @@ */ static ULONG WINAPI DEVENUM_ICreateDevEnum_AddRef(ICreateDevEnum * iface) { - CreateDevEnumImpl *This = (CreateDevEnumImpl *)iface; TRACE("\n"); - if (This == NULL) return E_POINTER; + DEVENUM_LockModule(); - if (InterlockedIncrement(&This->ref) == 1) { - InterlockedIncrement(&dll_ref); - } - return This->ref; + return 2; /* non-heap based object */ } /********************************************************************** @@ -94,15 +87,11 @@ */ static ULONG WINAPI DEVENUM_ICreateDevEnum_Release(ICreateDevEnum * iface) { - CreateDevEnumImpl *This = (CreateDevEnumImpl *)iface; TRACE("\n"); - if (This == NULL) return E_POINTER; + DEVENUM_UnlockModule(); - if (InterlockedDecrement(&This->ref) == 0) { - InterlockedDecrement(&dll_ref); - } - return This->ref; + return 1; /* non-heap based object */ } /********************************************************************** @@ -115,7 +104,6 @@ DWORD dwFlags) { WCHAR wszRegKey[MAX_PATH]; - EnumMonikerImpl * pEnumMoniker; HKEY hkey; HKEY hbasekey; CreateDevEnumImpl *This = (CreateDevEnumImpl *)iface; @@ -173,18 +161,7 @@ } } - pEnumMoniker = (EnumMonikerImpl *)CoTaskMemAlloc(sizeof(EnumMonikerImpl)); - if (!pEnumMoniker) - return E_OUTOFMEMORY; - - pEnumMoniker->lpVtbl = &IEnumMoniker_Vtbl; - pEnumMoniker->ref = 1; - pEnumMoniker->index = 0; - pEnumMoniker->hkey = hkey; - - *ppEnumMoniker = (IEnumMoniker *)pEnumMoniker; - - return S_OK; + return DEVENUM_IEnumMoniker_Construct(hkey, ppEnumMoniker); } /********************************************************************** @@ -201,7 +178,7 @@ /********************************************************************** * static CreateDevEnum instance */ -CreateDevEnumImpl DEVENUM_CreateDevEnum = { &ICreateDevEnum_Vtbl, 0 }; +CreateDevEnumImpl DEVENUM_CreateDevEnum = { &ICreateDevEnum_Vtbl }; /********************************************************************** * DEVENUM_CreateAMCategoryKey (INTERNAL) diff -urN wine-20041201/dlls/devenum/devenum_main.c wine-20050111/dlls/devenum/devenum_main.c --- wine-20041201/dlls/devenum/devenum_main.c 2004-11-30 22:39:00.000000000 +0100 +++ wine-20050111/dlls/devenum/devenum_main.c 2004-12-07 15:37:11.000000000 +0100 @@ -25,7 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(devenum); -DWORD dll_ref = 0; +LONG dll_refs; HINSTANCE DEVENUM_hInstance; typedef struct @@ -43,7 +43,6 @@ */ const WCHAR clsid_keyname[6] = { 'C', 'L', 'S', 'I', 'D', 0 }; - /*********************************************************************** * DllEntryPoint */ @@ -77,7 +76,8 @@ * Oh well - works just fine as it is */ if (IsEqualGUID(rclsid, &CLSID_SystemDeviceEnum) || IsEqualGUID(rclsid, &CLSID_CDeviceMoniker)) - return IClassFactory_QueryInterface((LPCLASSFACTORY)(char*)&DEVENUM_ClassFactory, iid, ppv); + return IClassFactory_QueryInterface((IClassFactory*)&DEVENUM_ClassFactory, iid, ppv); + FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid)); return CLASS_E_CLASSNOTAVAILABLE; } @@ -87,7 +87,7 @@ */ HRESULT WINAPI DEVENUM_DllCanUnloadNow(void) { - return dll_ref != 0 ? S_FALSE : S_OK; + return dll_refs != 0 ? S_FALSE : S_OK; } /*********************************************************************** diff -urN wine-20041201/dlls/devenum/devenum_private.h wine-20050111/dlls/devenum/devenum_private.h --- wine-20041201/dlls/devenum/devenum_private.h 2004-10-07 05:06:51.000000000 +0200 +++ wine-20050111/dlls/devenum/devenum_private.h 2004-12-13 22:19:02.000000000 +0100 @@ -42,26 +42,31 @@ /********************************************************************** * Dll lifetime tracking declaration for devenum.dll */ -extern DWORD dll_ref; +extern LONG dll_refs; +static inline void DEVENUM_LockModule(void) { InterlockedIncrement(&dll_refs); } +static inline void DEVENUM_UnlockModule(void) { InterlockedDecrement(&dll_refs); } + /********************************************************************** * ClassFactory declaration for devenum.dll */ typedef struct { - /* IUnknown fields */ IClassFactoryVtbl *lpVtbl; - DWORD ref; } ClassFactoryImpl; typedef struct { ICreateDevEnumVtbl *lpVtbl; - DWORD ref; } CreateDevEnumImpl; typedef struct { + IParseDisplayNameVtbl *lpVtbl; +} ParseDisplayNameImpl; + +typedef struct +{ IEnumMonikerVtbl *lpVtbl; DWORD ref; DWORD index; @@ -72,24 +77,12 @@ { IMonikerVtbl *lpVtbl; - DWORD ref; + ULONG ref; HKEY hkey; } MediaCatMoniker; -typedef struct -{ - IPropertyBagVtbl *lpVtbl; - DWORD ref; - HKEY hkey; -} RegPropBagImpl; - -typedef struct -{ - IParseDisplayNameVtbl *lpVtbl; - DWORD ref; -} ParseDisplayNameImpl; - -MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(); +MediaCatMoniker * DEVENUM_IMediaCatMoniker_Construct(void); +HRESULT DEVENUM_IEnumMoniker_Construct(HKEY hkey, IEnumMoniker ** ppEnumMoniker); HRESULT WINAPI DEVENUM_ICreateDevEnum_CreateClassEnumerator( ICreateDevEnum * iface, REFCLSID clsidDeviceClass, diff -urN wine-20041201/dlls/devenum/factory.c wine-20050111/dlls/devenum/factory.c --- wine-20041201/dlls/devenum/factory.c 2004-09-06 22:34:30.000000000 +0200 +++ wine-20050111/dlls/devenum/factory.c 2004-12-07 15:37:11.000000000 +0100 @@ -33,10 +33,9 @@ REFIID riid, LPVOID *ppvObj) { - ClassFactoryImpl *This = (ClassFactoryImpl *)iface; TRACE("\n\tIID:\t%s\n",debugstr_guid(riid)); - if (This == NULL || ppvObj == NULL) return E_POINTER; + if (ppvObj == NULL) return E_POINTER; if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IClassFactory)) @@ -59,17 +58,11 @@ */ static ULONG WINAPI DEVENUM_IClassFactory_AddRef(LPCLASSFACTORY iface) { - ClassFactoryImpl *This = (ClassFactoryImpl *)iface; TRACE("\n"); - if (This == NULL) return E_POINTER; + DEVENUM_LockModule(); - This->ref++; - - if (InterlockedIncrement(&This->ref) == 1) { - InterlockedIncrement(&dll_ref); - } - return This->ref; + return 2; /* non-heap based object */ } /********************************************************************** @@ -77,15 +70,11 @@ */ static ULONG WINAPI DEVENUM_IClassFactory_Release(LPCLASSFACTORY iface) { - ClassFactoryImpl *This = (ClassFactoryImpl *)iface; TRACE("\n"); - if (This == NULL) return E_POINTER; + DEVENUM_UnlockModule(); - if (InterlockedDecrement(&This->ref) == 0) { - InterlockedDecrement(&dll_ref); - } - return This->ref; + return 1; /* non-heap based object */ } /********************************************************************** @@ -97,10 +86,9 @@ REFIID riid, LPVOID *ppvObj) { - ClassFactoryImpl *This = (ClassFactoryImpl *)iface; TRACE("\n\tIID:\t%s\n",debugstr_guid(riid)); - if (This == NULL || ppvObj == NULL) return E_POINTER; + if (ppvObj == NULL) return E_POINTER; /* Don't support aggregation (Windows doesn't) */ if (pUnkOuter != NULL) return CLASS_E_NOAGGREGATION; @@ -128,11 +116,10 @@ { TRACE("\n"); - if (fLock != FALSE) { - IClassFactory_AddRef(iface); - } else { - IClassFactory_Release(iface); - } + if (fLock) + DEVENUM_LockModule(); + else + DEVENUM_UnlockModule(); return S_OK; } @@ -151,4 +138,4 @@ /********************************************************************** * static ClassFactory instance */ -ClassFactoryImpl DEVENUM_ClassFactory = { &IClassFactory_Vtbl, 0 }; +ClassFactoryImpl DEVENUM_ClassFactory = { &IClassFactory_Vtbl }; diff -urN wine-20041201/dlls/devenum/mediacatenum.c wine-20050111/dlls/devenum/mediacatenum.c --- wine-20041201/dlls/devenum/mediacatenum.c 2004-09-06 22:34:30.000000000 +0200 +++ wine-20050111/dlls/devenum/mediacatenum.c 2005-01-10 13:25:29.000000000 +0100 @@ -34,10 +34,17 @@ WINE_DEFAULT_DEBUG_CHANNEL(devenum); static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface); -static HRESULT WINAPI DEVENUM_IMediaCatMoniker_Hash(LPMONIKER iface, DWORD* pdwHash); static ULONG WINAPI DEVENUM_IMediaCatMoniker_AddRef(LPMONIKER iface); static ULONG WINAPI DEVENUM_IPropertyBag_AddRef(LPPROPERTYBAG iface); +typedef struct +{ + IPropertyBagVtbl *lpVtbl; + DWORD ref; + HKEY hkey; +} RegPropBagImpl; + + static HRESULT WINAPI DEVENUM_IPropertyBag_QueryInterface( LPPROPERTYBAG iface, REFIID riid, @@ -77,15 +84,17 @@ static ULONG WINAPI DEVENUM_IPropertyBag_Release(LPPROPERTYBAG iface) { RegPropBagImpl *This = (RegPropBagImpl *)iface; + ULONG ref; TRACE("\n"); - if (InterlockedDecrement(&This->ref) == 0) { + ref = InterlockedDecrement(&This->ref); + if (ref == 0) { RegCloseKey(This->hkey); CoTaskMemFree(This); - return 0; + DEVENUM_UnlockModule(); } - return This->ref; + return ref; } static HRESULT WINAPI DEVENUM_IPropertyBag_Read( @@ -190,8 +199,7 @@ FIXME("Variant type %x not supported for regtype %lx\n", V_VT(pVar), type); } - if (pData) - HeapFree(GetProcessHeap(), 0, pData); + HeapFree(GetProcessHeap(), 0, pData); TRACE("<- %lx\n", res); return res; @@ -262,6 +270,18 @@ DEVENUM_IPropertyBag_Write }; +static HRESULT DEVENUM_IPropertyBag_Construct(HANDLE hkey, IPropertyBag **ppBag) +{ + RegPropBagImpl * rpb = CoTaskMemAlloc(sizeof(RegPropBagImpl)); + if (!rpb) + return E_OUTOFMEMORY; + rpb->lpVtbl = &IPropertyBag_Vtbl; + rpb->ref = 1; + rpb->hkey = hkey; + *ppBag = (IPropertyBag*)rpb; + DEVENUM_LockModule(); + return S_OK; +} static HRESULT WINAPI DEVENUM_IMediaCatMoniker_QueryInterface( @@ -298,9 +318,7 @@ MediaCatMoniker *This = (MediaCatMoniker *)iface; TRACE("\n"); - if (This == NULL) return E_POINTER; - - return ++This->ref; + return InterlockedIncrement(&This->ref); } /********************************************************************** @@ -312,12 +330,11 @@ ULONG ref; TRACE("\n"); - if (This == NULL) return E_POINTER; - - ref = --This->ref; + ref = InterlockedDecrement(&This->ref); if (ref == 0) { RegCloseKey(This->hkey); CoTaskMemFree(This); + DEVENUM_UnlockModule(); } return ref; } @@ -444,14 +461,9 @@ if (IsEqualGUID(riid, &IID_IPropertyBag)) { - RegPropBagImpl * rpb = CoTaskMemAlloc(sizeof(RegPropBagImpl)); - if (!rpb) - return E_OUTOFMEMORY; - rpb->lpVtbl = &IPropertyBag_Vtbl; - DuplicateHandle(GetCurrentProcess(), This->hkey, GetCurrentProcess(), (LPHANDLE)&(rpb->hkey), 0, 0, DUPLICATE_SAME_ACCESS); - rpb->ref = 1; - *ppvObj = (LPVOID)rpb; - return S_OK; + HANDLE hkey; + DuplicateHandle(GetCurrentProcess(), This->hkey, GetCurrentProcess(), &hkey, 0, 0, DUPLICATE_SAME_ACCESS); + return DEVENUM_IPropertyBag_Construct(hkey, (IPropertyBag**)ppvObj); } return MK_E_NOSTORAGE; @@ -670,6 +682,8 @@ DEVENUM_IMediaCatMoniker_AddRef((LPMONIKER)pMoniker); + DEVENUM_LockModule(); + return pMoniker; } @@ -704,12 +718,11 @@ static ULONG WINAPI DEVENUM_IEnumMoniker_AddRef(LPENUMMONIKER iface) { EnumMonikerImpl *This = (EnumMonikerImpl *)iface; + ULONG ref = InterlockedIncrement(&This->ref); - TRACE("\n"); - - if (This == NULL) return E_POINTER; + TRACE("(%p)->() AddRef from %ld\n", iface, ref - 1); - return InterlockedIncrement(&This->ref); + return ref; } /********************************************************************** @@ -718,16 +731,18 @@ static ULONG WINAPI DEVENUM_IEnumMoniker_Release(LPENUMMONIKER iface) { EnumMonikerImpl *This = (EnumMonikerImpl *)iface; + ULONG ref = InterlockedDecrement(&This->ref); - TRACE("\n"); + TRACE("(%p)->() Release from %ld\n", iface, ref + 1); - if (!InterlockedDecrement(&This->ref)) + if (!ref) { RegCloseKey(This->hkey); CoTaskMemFree(This); + DEVENUM_UnlockModule(); return 0; } - return This->ref; + return ref; } static HRESULT WINAPI DEVENUM_IEnumMoniker_Next(LPENUMMONIKER iface, ULONG celt, IMoniker ** rgelt, ULONG * pceltFetched) @@ -738,7 +753,7 @@ MediaCatMoniker * pMoniker; EnumMonikerImpl *This = (EnumMonikerImpl *)iface; - TRACE("(%ld, %p, %p)\n", celt, rgelt, pceltFetched); + TRACE("(%p)->(%ld, %p, %p)\n", iface, celt, rgelt, pceltFetched); while (fetched < celt) { @@ -777,7 +792,7 @@ { EnumMonikerImpl *This = (EnumMonikerImpl *)iface; - TRACE("(%ld)\n", celt); + TRACE("(%p)->(%ld)\n", iface, celt); This->index += celt; @@ -788,7 +803,7 @@ { EnumMonikerImpl *This = (EnumMonikerImpl *)iface; - TRACE("()\n"); + TRACE("(%p)->()\n", iface); This->index = 0; @@ -797,7 +812,7 @@ static HRESULT WINAPI DEVENUM_IEnumMoniker_Clone(LPENUMMONIKER iface, IEnumMoniker ** ppenum) { - FIXME("(%p): stub\n", ppenum); + FIXME("(%p)->(%p): stub\n", iface, ppenum); return E_NOTIMPL; } @@ -805,7 +820,7 @@ /********************************************************************** * IEnumMoniker_Vtbl */ -IEnumMonikerVtbl IEnumMoniker_Vtbl = +static IEnumMonikerVtbl IEnumMoniker_Vtbl = { DEVENUM_IEnumMoniker_QueryInterface, DEVENUM_IEnumMoniker_AddRef, @@ -815,3 +830,21 @@ DEVENUM_IEnumMoniker_Reset, DEVENUM_IEnumMoniker_Clone }; + +HRESULT DEVENUM_IEnumMoniker_Construct(HKEY hkey, IEnumMoniker ** ppEnumMoniker) +{ + EnumMonikerImpl * pEnumMoniker = CoTaskMemAlloc(sizeof(EnumMonikerImpl)); + if (!pEnumMoniker) + return E_OUTOFMEMORY; + + pEnumMoniker->lpVtbl = &IEnumMoniker_Vtbl; + pEnumMoniker->ref = 1; + pEnumMoniker->index = 0; + pEnumMoniker->hkey = hkey; + + *ppEnumMoniker = (IEnumMoniker *)pEnumMoniker; + + DEVENUM_LockModule(); + + return S_OK; +} diff -urN wine-20041201/dlls/devenum/parsedisplayname.c wine-20050111/dlls/devenum/parsedisplayname.c --- wine-20041201/dlls/devenum/parsedisplayname.c 2004-09-06 22:34:30.000000000 +0200 +++ wine-20050111/dlls/devenum/parsedisplayname.c 2004-12-07 15:37:11.000000000 +0100 @@ -32,10 +32,9 @@ REFIID riid, LPVOID *ppvObj) { - ParseDisplayNameImpl *This = (ParseDisplayNameImpl *)iface; TRACE("\n\tIID:\t%s\n",debugstr_guid(riid)); - if (This == NULL || ppvObj == NULL) return E_POINTER; + if (ppvObj == NULL) return E_POINTER; if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IParseDisplayName)) @@ -54,16 +53,11 @@ */ static ULONG WINAPI DEVENUM_IParseDisplayName_AddRef(LPPARSEDISPLAYNAME iface) { - ParseDisplayNameImpl *This = (ParseDisplayNameImpl *)iface; TRACE("\n"); - if (This == NULL) return E_POINTER; + DEVENUM_LockModule(); - if (InterlockedIncrement(&This->ref) == 1) { - InterlockedIncrement(&dll_ref); - } - - return ++This->ref; + return 2; /* non-heap based object */ } /********************************************************************** @@ -71,17 +65,11 @@ */ static ULONG WINAPI DEVENUM_IParseDisplayName_Release(LPPARSEDISPLAYNAME iface) { - ParseDisplayNameImpl *This = (ParseDisplayNameImpl *)iface; - ULONG ref; TRACE("\n"); - if (This == NULL) return E_POINTER; + DEVENUM_UnlockModule(); - ref = --This->ref; - if (InterlockedDecrement(&This->ref) == 0) { - InterlockedDecrement(&dll_ref); - } - return ref; + return 1; /* non-heap based object */ } /********************************************************************** @@ -176,4 +164,4 @@ }; /* The one instance of this class */ -ParseDisplayNameImpl DEVENUM_ParseDisplayName = { &IParseDisplayName_Vtbl, 0 }; +ParseDisplayNameImpl DEVENUM_ParseDisplayName = { &IParseDisplayName_Vtbl }; diff -urN wine-20041201/dlls/dinput/dinput_main.c wine-20050111/dlls/dinput/dinput_main.c --- wine-20041201/dlls/dinput/dinput_main.c 2004-10-07 05:06:51.000000000 +0200 +++ wine-20050111/dlls/dinput/dinput_main.c 2004-12-07 15:19:29.000000000 +0100 @@ -704,13 +704,13 @@ HRESULT WINAPI DINPUT_DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { - TRACE("(%p,%p,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + TRACE("(%s,%s,%p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); if ( IsEqualCLSID( &IID_IClassFactory, riid ) ) { *ppv = (LPVOID)&DINPUT_CF; IClassFactory_AddRef((IClassFactory*)*ppv); return S_OK; } - FIXME("(%p,%p,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); + FIXME("(%s,%s,%p): no interface found.\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } diff -urN wine-20041201/dlls/dinput/joystick_linux.c wine-20050111/dlls/dinput/joystick_linux.c --- wine-20041201/dlls/dinput/joystick_linux.c 2004-09-17 20:10:41.000000000 +0200 +++ wine-20050111/dlls/dinput/joystick_linux.c 2004-12-23 19:33:44.000000000 +0100 @@ -157,7 +157,9 @@ return FALSE; } - if ((dwDevType==0) || (GET_DIDEVICE_TYPE(dwDevType)==DIDEVTYPE_JOYSTICK)) { + if ((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) || + (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 8))) { /* check whether we have a joystick */ sprintf(dev, "%s%d", JOYDEV, id); if ((fd = open(dev,O_RDONLY)) < 0) { @@ -205,7 +207,9 @@ return FALSE; } - if ((dwDevType==0) || (GET_DIDEVICE_TYPE(dwDevType)==DIDEVTYPE_JOYSTICK)) { + if ((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) || + (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 8))) { /* check whether we have a joystick */ sprintf(dev, "%s%d", JOYDEV, id); if ((fd = open(dev,O_RDONLY)) < 0) { @@ -552,7 +556,10 @@ newDevice->devcaps.dwSize = sizeof(newDevice->devcaps); newDevice->devcaps.dwFlags = DIDC_ATTACHED; - newDevice->devcaps.dwDevType = DIDEVTYPE_JOYSTICK; + if (newDevice->dinput->version >= 8) + newDevice->devcaps.dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + newDevice->devcaps.dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); newDevice->devcaps.dwFFSamplePeriod = 0; newDevice->devcaps.dwFFMinTimeResolution = 0; newDevice->devcaps.dwFirmwareRevision = 0; @@ -573,18 +580,12 @@ FAILED: hr = DIERR_OUTOFMEMORY; FAILED1: - if (newDevice->axis_map) - HeapFree(GetProcessHeap(),0,newDevice->axis_map); - if (newDevice->name) - HeapFree(GetProcessHeap(),0,newDevice->name); - if (newDevice->props) - HeapFree(GetProcessHeap(),0,newDevice->props); - if (newDevice->user_df->rgodf) - HeapFree(GetProcessHeap(),0,newDevice->user_df->rgodf); - if (newDevice->user_df) - HeapFree(GetProcessHeap(),0,newDevice->user_df); - if (newDevice) - HeapFree(GetProcessHeap(),0,newDevice); + HeapFree(GetProcessHeap(),0,newDevice->axis_map); + HeapFree(GetProcessHeap(),0,newDevice->name); + HeapFree(GetProcessHeap(),0,newDevice->props); + HeapFree(GetProcessHeap(),0,newDevice->user_df->rgodf); + HeapFree(GetProcessHeap(),0,newDevice->user_df); + HeapFree(GetProcessHeap(),0,newDevice); *pdev = 0; return hr; @@ -669,16 +670,13 @@ return ref; /* Free the device name */ - if (This->name) - HeapFree(GetProcessHeap(),0,This->name); + HeapFree(GetProcessHeap(),0,This->name); /* Free the axis map */ - if (This->axis_map) - HeapFree(GetProcessHeap(),0,This->axis_map); + HeapFree(GetProcessHeap(),0,This->axis_map); /* Free the data queue */ - if (This->data_queue != NULL) - HeapFree(GetProcessHeap(),0,This->data_queue); + HeapFree(GetProcessHeap(),0,This->data_queue); /* Free the DataFormat */ HeapFree(GetProcessHeap(), 0, This->user_df->rgodf); @@ -762,12 +760,9 @@ FAILED: WARN("out of memory\n"); - if (new_props) - HeapFree(GetProcessHeap(),0,new_props); - if (new_rgodf) - HeapFree(GetProcessHeap(),0,new_rgodf); - if (new_df) - HeapFree(GetProcessHeap(),0,new_df); + HeapFree(GetProcessHeap(),0,new_props); + HeapFree(GetProcessHeap(),0,new_rgodf); + HeapFree(GetProcessHeap(),0,new_df); return DIERR_OUTOFMEMORY; } @@ -1578,10 +1573,7 @@ pdidi->guidInstance = GUID_Joystick; pdidi->guidProduct = DInput_Wine_Joystick_GUID; /* we only support traditional joysticks for now */ - if (This->dinput->version >= 8) - pdidi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); - else - pdidi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + pdidi->dwDevType = This->devcaps.dwDevType; strcpy(pdidi->tszInstanceName, "Joystick"); strcpy(pdidi->tszProductName, This->name); if (pdidi->dwSize > sizeof(DIDEVICEINSTANCE_DX3A)) { @@ -1616,10 +1608,7 @@ pdidi->guidInstance = GUID_Joystick; pdidi->guidProduct = DInput_Wine_Joystick_GUID; /* we only support traditional joysticks for now */ - if (This->dinput->version >= 8) - pdidi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); - else - pdidi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); + pdidi->dwDevType = This->devcaps.dwDevType; MultiByteToWideChar(CP_ACP, 0, "Joystick", -1, pdidi->tszInstanceName, MAX_PATH); MultiByteToWideChar(CP_ACP, 0, This->name, -1, pdidi->tszProductName, MAX_PATH); if (pdidi->dwSize > sizeof(DIDEVICEINSTANCE_DX3W)) { diff -urN wine-20041201/dlls/dinput/joystick_linuxinput.c wine-20050111/dlls/dinput/joystick_linuxinput.c --- wine-20041201/dlls/dinput/joystick_linuxinput.c 2004-09-17 20:10:41.000000000 +0200 +++ wine-20050111/dlls/dinput/joystick_linuxinput.c 2004-12-23 19:33:44.000000000 +0100 @@ -175,8 +175,10 @@ if (id != 0) return FALSE; - if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK)) - return FALSE; + if (!((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) || + (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 8)))) + return FALSE; if (dwFlags & DIEDFL_FORCEFEEDBACK) return FALSE; @@ -211,8 +213,10 @@ if (id != 0) return FALSE; - if ((dwDevType != 0) && (GET_DIDEVICE_TYPE(dwDevType) != DIDEVTYPE_JOYSTICK)) - return FALSE; + if (!((dwDevType == 0) || + ((dwDevType == DIDEVTYPE_JOYSTICK) && (version < 8)) || + (((dwDevType == DI8DEVCLASS_GAMECTRL) || (dwDevType == DI8DEVTYPE_JOYSTICK)) && (version >= 8)))) + return FALSE; if (dwFlags & DIEDFL_FORCEFEEDBACK) return FALSE; @@ -229,7 +233,10 @@ lpddi->guidProduct = DInput_Wine_Joystick_GUID; lpddi->guidFFDriver = GUID_NULL; - lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL<<8); + if (version >= 8) + lpddi->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + lpddi->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); MultiByteToWideChar(CP_ACP, 0, "Joystick", -1, lpddi->tszInstanceName, MAX_PATH); /* ioctl JSIOCGNAME(len) */ @@ -339,8 +346,7 @@ return ref; /* Free the data queue */ - if (This->data_queue != NULL) - HeapFree(GetProcessHeap(),0,This->data_queue); + HeapFree(GetProcessHeap(),0,This->data_queue); /* Free the DataFormat */ HeapFree(GetProcessHeap(), 0, This->df); @@ -756,7 +762,10 @@ wasacquired = 0; } lpDIDevCaps->dwFlags = DIDC_ATTACHED; - lpDIDevCaps->dwDevType = DIDEVTYPE_JOYSTICK; + if (This->dinput->version >= 8) + lpDIDevCaps->dwDevType = DI8DEVTYPE_JOYSTICK | (DI8DEVTYPEJOYSTICK_STANDARD << 8); + else + lpDIDevCaps->dwDevType = DIDEVTYPE_JOYSTICK | (DIDEVTYPEJOYSTICK_TRADITIONAL << 8); axes=0; for (i=0;iabsbits,i)) axes++; diff -urN wine-20041201/dlls/dinput/keyboard.c wine-20050111/dlls/dinput/keyboard.c --- wine-20041201/dlls/dinput/keyboard.c 2004-10-28 23:01:44.000000000 +0200 +++ wine-20050111/dlls/dinput/keyboard.c 2004-12-23 19:33:44.000000000 +0100 @@ -206,7 +206,7 @@ if ((dwDevType == 0) || ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 8)) || - ((dwDevType == DI8DEVTYPE_KEYBOARD) && (version >= 8))) { + (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 8))) { TRACE("Enumerating the Keyboard device\n"); fill_keyboard_dideviceinstanceA(lpddi, version); @@ -224,7 +224,7 @@ if ((dwDevType == 0) || ((dwDevType == DIDEVTYPE_KEYBOARD) && (version < 8)) || - ((dwDevType == DI8DEVTYPE_KEYBOARD) && (version >= 8))) { + (((dwDevType == DI8DEVCLASS_KEYBOARD) || (dwDevType == DI8DEVTYPE_KEYBOARD)) && (version >= 8))) { TRACE("Enumerating the Keyboard device\n"); fill_keyboard_dideviceinstanceW(lpddi, version); @@ -317,8 +317,7 @@ LeaveCriticalSection(&keyboard_crit); /* Free the data queue */ - if (This->buffer != NULL) - HeapFree(GetProcessHeap(),0,This->buffer); + HeapFree(GetProcessHeap(),0,This->buffer); DeleteCriticalSection(&(This->crit)); @@ -569,36 +568,34 @@ LPDIRECTINPUTDEVICE8A iface, LPDIDEVCAPS lpDIDevCaps) { - SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + SysKeyboardImpl *This = (SysKeyboardImpl *)iface; + DIDEVCAPS devcaps; - TRACE("(this=%p,%p)\n",This,lpDIDevCaps); + TRACE("(this=%p,%p)\n",This,lpDIDevCaps); - if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS)) { - lpDIDevCaps->dwFlags = DIDC_ATTACHED; + if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) { + WARN("invalid parameter\n"); + return DIERR_INVALIDPARAM; + } + + devcaps.dwSize = lpDIDevCaps->dwSize; + devcaps.dwFlags = DIDC_ATTACHED; if (This->dinput->version >= 8) - lpDIDevCaps->dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8); + devcaps.dwDevType = DI8DEVTYPE_KEYBOARD | (DI8DEVTYPEKEYBOARD_UNKNOWN << 8); else - lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); - lpDIDevCaps->dwAxes = 0; - lpDIDevCaps->dwButtons = 256; - lpDIDevCaps->dwPOVs = 0; - lpDIDevCaps->dwFFSamplePeriod = 0; - lpDIDevCaps->dwFFMinTimeResolution = 0; - lpDIDevCaps->dwFirmwareRevision = 100; - lpDIDevCaps->dwHardwareRevision = 100; - lpDIDevCaps->dwFFDriverVersion = 0; - } else if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS_DX3)) { - lpDIDevCaps->dwFlags = DIDC_ATTACHED; - lpDIDevCaps->dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); - lpDIDevCaps->dwAxes = 0; - lpDIDevCaps->dwButtons = 256; - lpDIDevCaps->dwPOVs = 0; - } else { - WARN("invalid parameter\n"); - return DIERR_INVALIDPARAM; - } + devcaps.dwDevType = DIDEVTYPE_KEYBOARD | (DIDEVTYPEKEYBOARD_UNKNOWN << 8); + devcaps.dwAxes = 0; + devcaps.dwButtons = 256; + devcaps.dwPOVs = 0; + devcaps.dwFFSamplePeriod = 0; + devcaps.dwFFMinTimeResolution = 0; + devcaps.dwFirmwareRevision = 100; + devcaps.dwHardwareRevision = 100; + devcaps.dwFFDriverVersion = 0; - return DI_OK; + memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize); + + return DI_OK; } /****************************************************************************** diff -urN wine-20041201/dlls/dinput/mouse.c wine-20050111/dlls/dinput/mouse.c --- wine-20041201/dlls/dinput/mouse.c 2004-09-21 22:04:37.000000000 +0200 +++ wine-20050111/dlls/dinput/mouse.c 2005-01-04 21:39:55.000000000 +0100 @@ -210,7 +210,7 @@ if ((dwDevType == 0) || ((dwDevType == DIDEVTYPE_MOUSE) && (version < 8)) || - ((dwDevType == DI8DEVTYPE_MOUSE) && (version >= 8))) { + (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 8))) { TRACE("Enumerating the mouse device\n"); fill_mouse_dideviceinstanceA(lpddi, version); @@ -228,7 +228,7 @@ if ((dwDevType == 0) || ((dwDevType == DIDEVTYPE_MOUSE) && (version < 8)) || - ((dwDevType == DI8DEVTYPE_MOUSE) && (version >= 8))) { + (((dwDevType == DI8DEVCLASS_POINTER) || (dwDevType == DI8DEVTYPE_MOUSE)) && (version >= 8))) { TRACE("Enumerating the mouse device\n"); fill_mouse_dideviceinstanceW(lpddi, version); @@ -333,8 +333,7 @@ return ref; /* Free the data queue */ - if (This->data_queue != NULL) - HeapFree(GetProcessHeap(),0,This->data_queue); + HeapFree(GetProcessHeap(),0,This->data_queue); if (This->hook) { UnhookWindowsHookEx( This->hook ); @@ -433,7 +432,7 @@ /* Only allow mouse events every 10 ms. * This is to allow the cursor to start acceleration before * the warps happen. But if it involves a mouse button event we - * allow it since we don't want to loose the clicks. + * allow it since we don't want to lose the clicks. */ if (((GetCurrentTime() - last_event) < 10) && wparam == WM_MOUSEMOVE) @@ -502,9 +501,9 @@ switch(wparam) { case WM_LBUTTONDOWN: - GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0xFF, + GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0x80, hook->time, This->dinput->evsequence++); - This->m_state.rgbButtons[0] = 0xFF; + This->m_state.rgbButtons[0] = 0x80; break; case WM_LBUTTONUP: GEN_EVENT(This->offset_array[WINE_MOUSE_L_POSITION], 0x00, @@ -512,9 +511,9 @@ This->m_state.rgbButtons[0] = 0x00; break; case WM_RBUTTONDOWN: - GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0xFF, + GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0x80, hook->time, This->dinput->evsequence++); - This->m_state.rgbButtons[1] = 0xFF; + This->m_state.rgbButtons[1] = 0x80; break; case WM_RBUTTONUP: GEN_EVENT(This->offset_array[WINE_MOUSE_R_POSITION], 0x00, @@ -522,9 +521,9 @@ This->m_state.rgbButtons[1] = 0x00; break; case WM_MBUTTONDOWN: - GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0xFF, + GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0x80, hook->time, This->dinput->evsequence++); - This->m_state.rgbButtons[2] = 0xFF; + This->m_state.rgbButtons[2] = 0x80; break; case WM_MBUTTONUP: GEN_EVENT(This->offset_array[WINE_MOUSE_M_POSITION], 0x00, @@ -923,33 +922,31 @@ LPDIDEVCAPS lpDIDevCaps) { SysMouseImpl *This = (SysMouseImpl *)iface; - + DIDEVCAPS devcaps; + TRACE("(this=%p,%p)\n",This,lpDIDevCaps); - - if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS)) { - lpDIDevCaps->dwFlags = DIDC_ATTACHED; - if (This->dinput->version >= 8) - lpDIDevCaps->dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8); - else - lpDIDevCaps->dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8); - lpDIDevCaps->dwAxes = 3; - lpDIDevCaps->dwButtons = 3; - lpDIDevCaps->dwPOVs = 0; - lpDIDevCaps->dwFFSamplePeriod = 0; - lpDIDevCaps->dwFFMinTimeResolution = 0; - lpDIDevCaps->dwFirmwareRevision = 100; - lpDIDevCaps->dwHardwareRevision = 100; - lpDIDevCaps->dwFFDriverVersion = 0; - } else if (lpDIDevCaps->dwSize == sizeof(DIDEVCAPS_DX3)) { - lpDIDevCaps->dwFlags = DIDC_ATTACHED; - lpDIDevCaps->dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8); - lpDIDevCaps->dwAxes = 3; - lpDIDevCaps->dwButtons = 3; - lpDIDevCaps->dwPOVs = 0; - } else { + + if ((lpDIDevCaps->dwSize != sizeof(DIDEVCAPS)) && (lpDIDevCaps->dwSize != sizeof(DIDEVCAPS_DX3))) { WARN("invalid parameter\n"); return DIERR_INVALIDPARAM; } + + devcaps.dwSize = lpDIDevCaps->dwSize; + devcaps.dwFlags = DIDC_ATTACHED; + if (This->dinput->version >= 8) + devcaps.dwDevType = DI8DEVTYPE_MOUSE | (DI8DEVTYPEMOUSE_TRADITIONAL << 8); + else + devcaps.dwDevType = DIDEVTYPE_MOUSE | (DIDEVTYPEMOUSE_TRADITIONAL << 8); + devcaps.dwAxes = 3; + devcaps.dwButtons = 3; + devcaps.dwPOVs = 0; + devcaps.dwFFSamplePeriod = 0; + devcaps.dwFFMinTimeResolution = 0; + devcaps.dwFirmwareRevision = 100; + devcaps.dwHardwareRevision = 100; + devcaps.dwFFDriverVersion = 0; + + memcpy(lpDIDevCaps, &devcaps, lpDIDevCaps->dwSize); return DI_OK; } diff -urN wine-20041201/dlls/dmband/band.c wine-20050111/dlls/dmband/band.c --- wine-20041201/dlls/dmband/band.c 2004-08-23 21:39:57.000000000 +0200 +++ wine-20050111/dlls/dmband/band.c 2005-01-09 17:42:53.000000000 +0100 @@ -301,7 +301,6 @@ } TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); } while (StreamCount < StreamSize); - break; } else { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; @@ -682,7 +681,7 @@ obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBandImpl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->UnknownVtbl = &DirectMusicBand_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmband/bandtrack.c wine-20050111/dlls/dmband/bandtrack.c --- wine-20041201/dlls/dmband/bandtrack.c 2004-08-23 21:39:57.000000000 +0200 +++ wine-20050111/dlls/dmband/bandtrack.c 2004-12-22 16:13:21.000000000 +0100 @@ -582,7 +582,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBandTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicBandTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmband/dmutils.c wine-20050111/dlls/dmband/dmutils.c --- wine-20041201/dlls/dmband/dmutils.c 2004-08-22 23:38:47.000000000 +0200 +++ wine-20050111/dlls/dmband/dmutils.c 2005-01-03 15:46:40.000000000 +0100 @@ -237,13 +237,13 @@ const char *resolve_STREAM_SEEK (DWORD flag) { switch (flag) { case STREAM_SEEK_SET: - return wine_dbg_sprintf ("STREAM_SEEK_SET"); + return "STREAM_SEEK_SET"; case STREAM_SEEK_CUR: - return wine_dbg_sprintf ("STREAM_SEEK_CUR"); + return "STREAM_SEEK_CUR"; case STREAM_SEEK_END: - return wine_dbg_sprintf ("STREAM_SEEK_END"); + return "STREAM_SEEK_END"; default: - return wine_dbg_sprintf ("()"); + return "()"; } } @@ -697,10 +697,9 @@ if (pDesc->dwValidData & DMUS_OBJ_MEMORY) ptr += sprintf(ptr, " - llMemLength = %lli\n - pbMemData = %p\n", pDesc->llMemLength, pDesc->pbMemData); if (pDesc->dwValidData & DMUS_OBJ_STREAM) ptr += sprintf(ptr, " - pStream = %p\n", pDesc->pStream); - ptr = &buffer[0]; - return ptr; + return wine_dbg_sprintf("%s", buffer); } else { - return wine_dbg_sprintf("(NULL)"); + return "(NULL)"; } } @@ -730,10 +729,9 @@ ptr += sprintf(ptr, "DMUS_IO_CONTAINER_HEADER (%p):\n", pHeader); ptr += sprintf(ptr, " - dwFlags = %s\n", debugstr_DMUS_CONTAINER_FLAGS(pHeader->dwFlags)); - ptr = &buffer[0]; - return ptr; + return wine_dbg_sprintf("%s", buffer); } else { - return wine_dbg_sprintf("(NULL)"); + return "(NULL)"; } } @@ -747,9 +745,8 @@ ptr += sprintf(ptr, " - ckid = %s\n", debugstr_fourcc (pHeader->ckid)); ptr += sprintf(ptr, " - fccType = %s\n", debugstr_fourcc (pHeader->fccType)); - ptr = &buffer[0]; - return ptr; + return wine_dbg_sprintf("%s", buffer); } else { - return wine_dbg_sprintf("(NULL)"); + return "(NULL)"; } } diff -urN wine-20041201/dlls/dmcompos/chordmap.c wine-20050111/dlls/dmcompos/chordmap.c --- wine-20041201/dlls/dmcompos/chordmap.c 2004-08-23 21:39:57.000000000 +0200 +++ wine-20050111/dlls/dmcompos/chordmap.c 2005-01-09 17:42:53.000000000 +0100 @@ -55,6 +55,9 @@ ULONG WINAPI IDirectMusicChordMapImpl_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicChordMapImpl, UnknownVtbl, iface); TRACE("(%p): AddRef from %ld\n", This, This->ref); + + DMCOMPOS_LockModule(); + return ++(This->ref); } @@ -62,9 +65,13 @@ ICOM_THIS_MULTI(IDirectMusicChordMapImpl, UnknownVtbl, iface); ULONG ref = --This->ref; TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } + + DMCOMPOS_UnlockModule(); + return ref; } @@ -285,7 +292,6 @@ } TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); } while (StreamCount < StreamSize); - break; } else { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; @@ -515,7 +521,7 @@ obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapImpl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->UnknownVtbl = &DirectMusicChordMap_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmcompos/chordmaptrack.c wine-20050111/dlls/dmcompos/chordmaptrack.c --- wine-20041201/dlls/dmcompos/chordmaptrack.c 2004-08-23 21:39:57.000000000 +0200 +++ wine-20050111/dlls/dmcompos/chordmaptrack.c 2004-12-22 16:13:20.000000000 +0100 @@ -52,6 +52,9 @@ ULONG WINAPI IDirectMusicChordMapTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicChordMapTrack, UnknownVtbl, iface); TRACE("(%p): AddRef from %ld\n", This, This->ref); + + DMCOMPOS_LockModule(); + return ++(This->ref); } @@ -59,9 +62,13 @@ ICOM_THIS_MULTI(IDirectMusicChordMapTrack, UnknownVtbl, iface); ULONG ref = --This->ref; TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } + + DMCOMPOS_UnlockModule(); + return ref; } @@ -258,7 +265,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordMapTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicChordMapTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmcompos/composer.c wine-20050111/dlls/dmcompos/composer.c --- wine-20041201/dlls/dmcompos/composer.c 2004-09-06 23:34:26.000000000 +0200 +++ wine-20050111/dlls/dmcompos/composer.c 2004-12-09 14:46:47.000000000 +0100 @@ -39,6 +39,9 @@ ULONG WINAPI IDirectMusicComposerImpl_AddRef (LPDIRECTMUSICCOMPOSER iface) { IDirectMusicComposerImpl *This = (IDirectMusicComposerImpl *)iface; TRACE("(%p): AddRef from %ld\n", This, This->ref); + + DMCOMPOS_LockModule(); + return ++(This->ref); } @@ -46,9 +49,13 @@ IDirectMusicComposerImpl *This = (IDirectMusicComposerImpl *)iface; ULONG ref = --This->ref; TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } + + DMCOMPOS_UnlockModule(); + return ref; } diff -urN wine-20041201/dlls/dmcompos/dmcompos_main.c wine-20050111/dlls/dmcompos/dmcompos_main.c --- wine-20041201/dlls/dmcompos/dmcompos_main.c 2004-09-06 23:34:26.000000000 +0200 +++ wine-20050111/dlls/dmcompos/dmcompos_main.c 2004-12-09 14:46:47.000000000 +0100 @@ -21,41 +21,49 @@ WINE_DEFAULT_DEBUG_CHANNEL(dmcompos); +LONG DMCOMPOS_refCount = 0; + typedef struct { - /* IUnknown fields */ IClassFactoryVtbl *lpVtbl; - DWORD ref; } IClassFactoryImpl; /****************************************************************** * DirectMusicChordMap ClassFactory */ static HRESULT WINAPI ChordMapCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj); + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); + + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI ChordMapCF_AddRef(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + DMCOMPOS_LockModule(); + + return 2; /* non-heap based object */ } static ULONG WINAPI ChordMapCF_Release(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - /* static class, won't be freed */ - return --(This->ref); + DMCOMPOS_UnlockModule(); + + return 1; /* non-heap based object */ } static HRESULT WINAPI ChordMapCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj); + TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj); + return DMUSIC_CreateDirectMusicChordMapImpl (riid, ppobj, pOuter); } static HRESULT WINAPI ChordMapCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p, %d): stub\n", This, dolock); + TRACE("(%d)\n", dolock); + + if (dolock) + DMCOMPOS_LockModule(); + else + DMCOMPOS_UnlockModule(); + return S_OK; } @@ -67,37 +75,45 @@ ChordMapCF_LockServer }; -static IClassFactoryImpl ChordMap_CF = {&ChordMapCF_Vtbl, 1 }; +static IClassFactoryImpl ChordMap_CF = {&ChordMapCF_Vtbl}; /****************************************************************** * DirectMusicComposer ClassFactory */ static HRESULT WINAPI ComposerCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p, %s, %p): stub\n",This,debugstr_dmguid(riid),ppobj); + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); + + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI ComposerCF_AddRef(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + DMCOMPOS_LockModule(); + + return 2; /* non-heap based object */ } static ULONG WINAPI ComposerCF_Release(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - /* static class, won't be freed */ - return --(This->ref); + DMCOMPOS_UnlockModule(); + + return 1; /* non-heap based object */ } static HRESULT WINAPI ComposerCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj); + TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj); + return DMUSIC_CreateDirectMusicComposerImpl (riid, ppobj, pOuter); } static HRESULT WINAPI ComposerCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p, %d): stub\n", This, dolock); + TRACE("(%d)\n", dolock); + + if (dolock) + DMCOMPOS_LockModule(); + else + DMCOMPOS_UnlockModule(); + return S_OK; } @@ -109,37 +125,45 @@ ComposerCF_LockServer }; -static IClassFactoryImpl Composer_CF = {&ComposerCF_Vtbl, 1 }; +static IClassFactoryImpl Composer_CF = {&ComposerCF_Vtbl}; /****************************************************************** * DirectMusicChordMapTrack ClassFactory */ static HRESULT WINAPI ChordMapTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p, %s, %p): stub\n",This,debugstr_dmguid(riid),ppobj); + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); + + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI ChordMapTrackCF_AddRef(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + DMCOMPOS_LockModule(); + + return 2; /* non-heap based object */ } static ULONG WINAPI ChordMapTrackCF_Release(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - /* static class, won't be freed */ - return --(This->ref); + DMCOMPOS_UnlockModule(); + + return 1; /* non-heap based object */ } static HRESULT WINAPI ChordMapTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj); + TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj); + return DMUSIC_CreateDirectMusicChordMapTrack (riid, ppobj, pOuter); } static HRESULT WINAPI ChordMapTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p, %d): stub\n", This, dolock); + TRACE("(%d)\n", dolock); + + if (dolock) + DMCOMPOS_LockModule(); + else + DMCOMPOS_UnlockModule(); + return S_OK; } @@ -151,39 +175,47 @@ ChordMapTrackCF_LockServer }; -static IClassFactoryImpl ChordMapTrack_CF = {&ChordMapTrackCF_Vtbl, 1 }; +static IClassFactoryImpl ChordMapTrack_CF = {&ChordMapTrackCF_Vtbl}; /****************************************************************** * DirectMusicTemplate ClassFactory */ static HRESULT WINAPI TemplateCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p, %s, %p): stub\n", This, debugstr_dmguid(riid), ppobj); + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); + + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI TemplateCF_AddRef(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + DMCOMPOS_LockModule(); + + return 2; /* non-heap based object */ } static ULONG WINAPI TemplateCF_Release(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - /* static class, won't be freed */ - return --(This->ref); + DMCOMPOS_UnlockModule(); + + return 1; /* non-heap based object */ } static HRESULT WINAPI TemplateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj); + TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj); /* nothing yet */ - WARN("(%p, %s,%p): not found\n", This, debugstr_dmguid(riid), ppobj); + WARN("(%s,%p): not found\n", debugstr_dmguid(riid), ppobj); + return E_NOINTERFACE; } static HRESULT WINAPI TemplateCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p, %d): stub\n", This, dolock); + TRACE("(%d)\n", dolock); + + if (dolock) + DMCOMPOS_LockModule(); + else + DMCOMPOS_UnlockModule(); + return S_OK; } @@ -195,37 +227,45 @@ TemplateCF_LockServer }; -static IClassFactoryImpl Template_CF = {&TemplateCF_Vtbl, 1 }; +static IClassFactoryImpl Template_CF = {&TemplateCF_Vtbl}; /****************************************************************** * DirectMusicSignPostTrack ClassFactory */ static HRESULT WINAPI SignPostTrackCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p, %s, %p): stub\n",This,debugstr_dmguid(riid),ppobj); + FIXME("- no interface\n\tIID:\t%s\n", debugstr_guid(riid)); + + if (ppobj == NULL) return E_POINTER; + return E_NOINTERFACE; } static ULONG WINAPI SignPostTrackCF_AddRef(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + DMCOMPOS_LockModule(); + + return 2; /* non-heap based object */ } static ULONG WINAPI SignPostTrackCF_Release(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - /* static class, won't be freed */ - return --(This->ref); + DMCOMPOS_UnlockModule(); + + return 1; /* non-heap based object */ } static HRESULT WINAPI SignPostTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - TRACE ("(%p, %p, %s, %p)\n", This, pOuter, debugstr_dmguid(riid), ppobj); + TRACE ("(%p, %s, %p)\n", pOuter, debugstr_dmguid(riid), ppobj); + return DMUSIC_CreateDirectMusicSignPostTrack (riid, ppobj, pOuter); } static HRESULT WINAPI SignPostTrackCF_LockServer(LPCLASSFACTORY iface,BOOL dolock) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - FIXME("(%p, %d): stub\n", This, dolock); + TRACE("(%d)\n", dolock); + + if (dolock) + DMCOMPOS_LockModule(); + else + DMCOMPOS_UnlockModule(); + return S_OK; } @@ -237,7 +277,7 @@ SignPostTrackCF_LockServer }; -static IClassFactoryImpl SignPostTrack_CF = {&SignPostTrackCF_Vtbl, 1 }; +static IClassFactoryImpl SignPostTrack_CF = {&SignPostTrackCF_Vtbl}; /****************************************************************** * DllMain @@ -263,8 +303,7 @@ * */ HRESULT WINAPI DMCOMPOS_DllCanUnloadNow(void) { - FIXME("(void): stub\n"); - return S_FALSE; + return DMCOMPOS_refCount != 0 ? S_FALSE : S_OK; } diff -urN wine-20041201/dlls/dmcompos/dmcompos_private.h wine-20050111/dlls/dmcompos/dmcompos_private.h --- wine-20041201/dlls/dmcompos/dmcompos_private.h 2004-08-22 23:38:47.000000000 +0200 +++ wine-20050111/dlls/dmcompos/dmcompos_private.h 2004-12-09 14:46:47.000000000 +0100 @@ -237,6 +237,12 @@ extern HRESULT WINAPI IDirectMusicSignPostTrack_IPersistStream_Save (LPPERSISTSTREAM iface, IStream* pStm, BOOL fClearDirty); extern HRESULT WINAPI IDirectMusicSignPostTrack_IPersistStream_GetSizeMax (LPPERSISTSTREAM iface, ULARGE_INTEGER* pcbSize); +/********************************************************************** + * Dll lifetime tracking declaration for dmcompos.dll + */ +extern LONG DMCOMPOS_refCount; +static inline void DMCOMPOS_LockModule() { InterlockedIncrement( &DMCOMPOS_refCount ); } +static inline void DMCOMPOS_UnlockModule() { InterlockedDecrement( &DMCOMPOS_refCount ); } /***************************************************************************** * Misc. diff -urN wine-20041201/dlls/dmcompos/signposttrack.c wine-20050111/dlls/dmcompos/signposttrack.c --- wine-20041201/dlls/dmcompos/signposttrack.c 2004-09-06 23:34:26.000000000 +0200 +++ wine-20050111/dlls/dmcompos/signposttrack.c 2004-12-22 16:13:20.000000000 +0100 @@ -52,6 +52,9 @@ ULONG WINAPI IDirectMusicSignPostTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSignPostTrack, UnknownVtbl, iface); TRACE("(%p): AddRef from %ld\n", This, This->ref); + + DMCOMPOS_LockModule(); + return ++(This->ref); } @@ -59,9 +62,13 @@ ICOM_THIS_MULTI(IDirectMusicSignPostTrack, UnknownVtbl, iface); ULONG ref = --This->ref; TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } + + DMCOMPOS_UnlockModule(); + return ref; } @@ -256,7 +263,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSignPostTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicSignPostTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/audiopath.c wine-20050111/dlls/dmime/audiopath.c --- wine-20041201/dlls/dmime/audiopath.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/audiopath.c 2005-01-11 17:02:21.000000000 +0100 @@ -54,14 +54,17 @@ ULONG WINAPI IDirectMusicAudioPathImpl_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicAudioPathImpl_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicAudioPathImpl, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { if (This->pDSBuffer) { IDirectSoundBuffer8_Release(This->pDSBuffer); @@ -402,7 +405,6 @@ } TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); } while (StreamCount < StreamSize); - break; } else { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; @@ -631,7 +633,7 @@ obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAudioPathImpl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->UnknownVtbl = &DirectMusicAudioPath_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/dmime_main.c wine-20050111/dlls/dmime/dmime_main.c --- wine-20041201/dlls/dmime/dmime_main.c 2004-09-06 23:34:26.000000000 +0200 +++ wine-20050111/dlls/dmime/dmime_main.c 2005-01-11 17:02:21.000000000 +0100 @@ -40,13 +40,13 @@ static ULONG WINAPI PerformanceCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI PerformanceCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI PerformanceCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -82,13 +82,13 @@ static ULONG WINAPI SegmentCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI SegmentCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI SegmentCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -124,13 +124,13 @@ static ULONG WINAPI SegmentStateCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI SegmentStateCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI SegmentStateCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -166,13 +166,13 @@ static ULONG WINAPI GraphCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI GraphCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI GraphCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -208,13 +208,13 @@ static ULONG WINAPI TempoTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI TempoTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI TempoTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -250,13 +250,13 @@ static ULONG WINAPI SeqTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI SeqTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI SeqTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -292,13 +292,13 @@ static ULONG WINAPI SysExTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI SysExTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI SysExTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -334,13 +334,13 @@ static ULONG WINAPI TimeSigTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI TimeSigTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI TimeSigTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -376,13 +376,13 @@ static ULONG WINAPI ParamControlTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI ParamControlTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI ParamControlTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -418,13 +418,13 @@ static ULONG WINAPI MarkerTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI MarkerTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI MarkerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -460,13 +460,13 @@ static ULONG WINAPI LyricsTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI LyricsTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI LyricsTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -503,13 +503,13 @@ static ULONG WINAPI SegTriggerTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI SegTriggerTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI SegTriggerTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -545,13 +545,13 @@ static ULONG WINAPI AudioPathCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI AudioPathCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI AudioPathCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { @@ -587,13 +587,13 @@ static ULONG WINAPI WaveTrackCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI WaveTrackCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class, won't be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI WaveTrackCF_CreateInstance(LPCLASSFACTORY iface, LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj) { diff -urN wine-20041201/dlls/dmime/graph.c wine-20050111/dlls/dmime/graph.c --- wine-20041201/dlls/dmime/graph.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/graph.c 2005-01-11 17:02:21.000000000 +0100 @@ -54,14 +54,17 @@ ULONG WINAPI IDirectMusicGraphImpl_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicGraphImpl_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicGraphImpl, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -368,7 +371,6 @@ } TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); } while (StreamCount < StreamSize); - break; } else { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; @@ -596,7 +598,7 @@ obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicGraphImpl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->UnknownVtbl = &DirectMusicGraph_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/lyricstrack.c wine-20050111/dlls/dmime/lyricstrack.c --- wine-20041201/dlls/dmime/lyricstrack.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/lyricstrack.c 2005-01-11 17:02:21.000000000 +0100 @@ -51,14 +51,17 @@ ULONG WINAPI IDirectMusicLyricsTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicLyricsTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicLyricsTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicLyricsTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -259,7 +262,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicLyricsTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicLyricsTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/markertrack.c wine-20050111/dlls/dmime/markertrack.c --- wine-20041201/dlls/dmime/markertrack.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/markertrack.c 2005-01-11 17:02:21.000000000 +0100 @@ -51,14 +51,17 @@ ULONG WINAPI IDirectMusicMarkerTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicMarkerTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicMarkerTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicMarkerTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -259,7 +262,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMarkerTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicMarkerTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/paramcontroltrack.c wine-20050111/dlls/dmime/paramcontroltrack.c --- wine-20041201/dlls/dmime/paramcontroltrack.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/paramcontroltrack.c 2005-01-11 17:02:21.000000000 +0100 @@ -51,14 +51,17 @@ ULONG WINAPI IDirectMusicParamControlTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicParamControlTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicParamControlTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicParamControlTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -259,7 +262,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicParamControlTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicParamControlTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/patterntrack.c wine-20050111/dlls/dmime/patterntrack.c --- wine-20041201/dlls/dmime/patterntrack.c 2004-09-06 23:34:26.000000000 +0200 +++ wine-20050111/dlls/dmime/patterntrack.c 2005-01-11 17:02:21.000000000 +0100 @@ -39,14 +39,17 @@ ULONG WINAPI IDirectMusicPatternTrackImpl_AddRef (LPDIRECTMUSICPATTERNTRACK iface) { IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface; - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicPatternTrackImpl_Release (LPDIRECTMUSICPATTERNTRACK iface) { IDirectMusicPatternTrackImpl *This = (IDirectMusicPatternTrackImpl *)iface; - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -87,7 +90,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicPatternTrackImpl)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->lpVtbl = &DirectMusicPatternTrack_Vtbl; diff -urN wine-20041201/dlls/dmime/performance.c wine-20050111/dlls/dmime/performance.c --- wine-20041201/dlls/dmime/performance.c 2004-09-06 23:34:26.000000000 +0200 +++ wine-20050111/dlls/dmime/performance.c 2005-01-11 17:02:21.000000000 +0100 @@ -93,18 +93,14 @@ for (it = This->imm_head; NULL != it; ) { it_next = it->next; cur = ProceedMsg(This, it); - if (NULL != cur) { - HeapFree(GetProcessHeap(), 0, cur); - } + HeapFree(GetProcessHeap(), 0, cur); it = it_next; } for (it = This->head; NULL != it && it->rtItemTime < rtCurTime + dwDec; ) { it_next = it->next; cur = ProceedMsg(This, it); - if (NULL != cur) { - HeapFree(GetProcessHeap(), 0, cur); - } + HeapFree(GetProcessHeap(), 0, cur); it = it_next; } if (NULL != it) { @@ -114,7 +110,7 @@ outrefresh: LeaveCriticalSection(&This->safe); - while (TRUE == PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) { + while (PeekMessageA(&msg, NULL, 0, 0, PM_REMOVE)) { /** if hwnd we suppose that is a windows event ... */ if (NULL != msg.hwnd) { TranslateMessage(&msg); @@ -124,7 +120,6 @@ case WM_QUIT: case PROCESSMSG_EXIT: goto outofthread; - break; case PROCESSMSG_START: break; case PROCESSMSG_ADD: @@ -150,10 +145,20 @@ static BOOL PostMessageToProcessMsgThread(IDirectMusicPerformance8Impl* This, UINT iMsg) { if (FALSE == This->procThreadTicStarted && PROCESSMSG_EXIT != iMsg) { + BOOL res; This->procThread = CreateThread(NULL, 0, ProcessMsgThread, This, 0, &This->procThreadId); if (NULL == This->procThread) return FALSE; SetThreadPriority(This->procThread, THREAD_PRIORITY_TIME_CRITICAL); This->procThreadTicStarted = TRUE; + while(1) { + res = PostThreadMessageA(This->procThreadId, iMsg, 0, 0); + /* Let the thread creates its message queue (with MsgWaitForMultipleObjects call) by yielding and retrying */ + if (!res && (GetLastError() == ERROR_INVALID_THREAD_ID)) + Sleep(0); + else + break; + } + return res; } return PostThreadMessageA(This->procThreadId, iMsg, 0, 0); } @@ -177,14 +182,17 @@ ULONG WINAPI IDirectMusicPerformance8Impl_AddRef (LPDIRECTMUSICPERFORMANCE8 iface) { IDirectMusicPerformance8Impl *This = (IDirectMusicPerformance8Impl *)iface; - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicPerformance8Impl_Release (LPDIRECTMUSICPERFORMANCE8 iface) { IDirectMusicPerformance8Impl *This = (IDirectMusicPerformance8Impl *)iface; - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { DeleteCriticalSection(&This->safe); HeapFree(GetProcessHeap(), 0, This); @@ -308,7 +316,7 @@ if (NULL == pItem) { return E_POINTER; } - if (TRUE == pItem->bInUse) { + if (pItem->bInUse) { return DMUS_E_ALREADY_SENT; } @@ -369,7 +377,7 @@ REFERENCE_TIME rtCur = 0; /*TRACE("(%p, %p, %p)\n", This, prtNow, pmtNow); */ - if (TRUE == This->procThreadTicStarted) { + if (This->procThreadTicStarted) { rtCur = ((REFERENCE_TIME) GetTickCount() * 10000) - This->procThreadStartTime; } else { /*return DMUS_E_NO_MASTER_CLOCK;*/ @@ -417,7 +425,7 @@ if (NULL == pItem) { return E_POINTER; } - if (TRUE == pItem->bInUse) { + if (pItem->bInUse) { /** prevent for freeing PMsg in queue (ie to be processed) */ return DMUS_E_CANNOT_FREE; } @@ -841,7 +849,6 @@ HeapFree(GetProcessHeap(), 0, default_path); *ppNewPath = NULL; return E_INVALIDARG; - break; } /* FIXME: Should we create one secondary buffer for each PChannel? */ diff -urN wine-20041201/dlls/dmime/segment.c wine-20050111/dlls/dmime/segment.c --- wine-20041201/dlls/dmime/segment.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/segment.c 2005-01-11 17:02:21.000000000 +0100 @@ -57,14 +57,17 @@ ULONG WINAPI IDirectMusicSegment8Impl_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSegment8Impl, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicSegment8Impl_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSegment8Impl, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -1283,7 +1286,7 @@ obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegment8Impl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->UnknownVtbl = &DirectMusicSegment8_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/segmentstate.c wine-20050111/dlls/dmime/segmentstate.c --- wine-20041201/dlls/dmime/segmentstate.c 2004-09-06 23:34:26.000000000 +0200 +++ wine-20050111/dlls/dmime/segmentstate.c 2005-01-11 17:02:21.000000000 +0100 @@ -39,14 +39,17 @@ ULONG WINAPI IDirectMusicSegmentState8Impl_AddRef (LPDIRECTMUSICSEGMENTSTATE8 iface) { IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicSegmentState8Impl_Release (LPDIRECTMUSICSEGMENTSTATE8 iface) { IDirectMusicSegmentState8Impl *This = (IDirectMusicSegmentState8Impl *)iface; - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -116,7 +119,7 @@ obj = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegmentState8Impl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->lpVtbl = &DirectMusicSegmentState8_Vtbl; diff -urN wine-20041201/dlls/dmime/segtriggertrack.c wine-20050111/dlls/dmime/segtriggertrack.c --- wine-20041201/dlls/dmime/segtriggertrack.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/segtriggertrack.c 2005-01-11 17:02:21.000000000 +0100 @@ -52,14 +52,17 @@ ULONG WINAPI IDirectMusicSegTriggerTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicSegTriggerTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSegTriggerTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -506,7 +509,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSegTriggerTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicSegTriggerTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/seqtrack.c wine-20050111/dlls/dmime/seqtrack.c --- wine-20041201/dlls/dmime/seqtrack.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/seqtrack.c 2005-01-11 17:02:21.000000000 +0100 @@ -51,14 +51,17 @@ ULONG WINAPI IDirectMusicSeqTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSeqTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicSeqTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSeqTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -259,7 +262,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSeqTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicSeqTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/sysextrack.c wine-20050111/dlls/dmime/sysextrack.c --- wine-20041201/dlls/dmime/sysextrack.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/sysextrack.c 2005-01-11 17:02:21.000000000 +0100 @@ -51,14 +51,17 @@ ULONG WINAPI IDirectMusicSysExTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSysExTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicSysExTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicSysExTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -259,7 +262,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicSysExTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicSysExTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/tempotrack.c wine-20050111/dlls/dmime/tempotrack.c --- wine-20041201/dlls/dmime/tempotrack.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/tempotrack.c 2005-01-11 17:02:21.000000000 +0100 @@ -52,14 +52,17 @@ ULONG WINAPI IDirectMusicTempoTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicTempoTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicTempoTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -393,7 +396,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicTempoTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicTempoTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/timesigtrack.c wine-20050111/dlls/dmime/timesigtrack.c --- wine-20041201/dlls/dmime/timesigtrack.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/timesigtrack.c 2005-01-11 17:02:21.000000000 +0100 @@ -51,14 +51,17 @@ ULONG WINAPI IDirectMusicTimeSigTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicTimeSigTrack, UnknownVtbl, iface); - TRACE("(%p): AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p): AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicTimeSigTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicTimeSigTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p): ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -264,7 +267,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicTimeSigTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicTimeSigTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmime/tool.c wine-20050111/dlls/dmime/tool.c --- wine-20041201/dlls/dmime/tool.c 2004-09-06 23:34:26.000000000 +0200 +++ wine-20050111/dlls/dmime/tool.c 2005-01-11 17:02:21.000000000 +0100 @@ -38,14 +38,17 @@ ULONG WINAPI IDirectMusicTool8Impl_AddRef (LPDIRECTMUSICTOOL8 iface) { IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface; - TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) : AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicTool8Impl_Release (LPDIRECTMUSICTOOL8 iface) { IDirectMusicTool8Impl *This = (IDirectMusicTool8Impl *)iface; - ULONG ref = --This->ref; - TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p) : ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -115,7 +118,7 @@ obj = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicTool8Impl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->lpVtbl = &DirectMusicTool8_Vtbl; diff -urN wine-20041201/dlls/dmime/wavetrack.c wine-20050111/dlls/dmime/wavetrack.c --- wine-20041201/dlls/dmime/wavetrack.c 2004-08-23 21:39:56.000000000 +0200 +++ wine-20050111/dlls/dmime/wavetrack.c 2005-01-11 17:02:21.000000000 +0100 @@ -51,14 +51,17 @@ ULONG WINAPI IDirectMusicWaveTrack_IUnknown_AddRef (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicWaveTrack, UnknownVtbl, iface); - TRACE("(%p) : AddRef from %ld\n", This, This->ref); - return ++(This->ref); + ULONG ref = InterlockedIncrement(&This->ref); + + TRACE("(%p) : AddRef from %ld\n", This, ref - 1); + + return ref; } ULONG WINAPI IDirectMusicWaveTrack_IUnknown_Release (LPUNKNOWN iface) { ICOM_THIS_MULTI(IDirectMusicWaveTrack, UnknownVtbl, iface); - ULONG ref = --This->ref; - TRACE("(%p) : ReleaseRef to %ld\n", This, This->ref); + ULONG ref = InterlockedDecrement(&This->ref); + TRACE("(%p) : ReleaseRef to %ld\n", This, ref); if (ref == 0) { HeapFree(GetProcessHeap(), 0, This); } @@ -265,7 +268,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicWaveTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicWaveTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmloader/classfactory.c wine-20050111/dlls/dmloader/classfactory.c --- wine-20041201/dlls/dmloader/classfactory.c 2004-09-06 22:34:30.000000000 +0200 +++ wine-20050111/dlls/dmloader/classfactory.c 2004-12-09 15:07:59.000000000 +0100 @@ -75,7 +75,7 @@ HRESULT WINAPI IDirectMusicLoaderCF_LockServer (LPCLASSFACTORY iface, BOOL dolock) { IDirectMusicLoaderCF *This = (IDirectMusicLoaderCF *)iface; TRACE("(%p, %d)\n", This, dolock); - if (dolock == TRUE) + if (dolock) InterlockedIncrement (&dwDirectMusicLoader); else InterlockedDecrement (&dwDirectMusicLoader); @@ -162,7 +162,7 @@ HRESULT WINAPI IDirectMusicContainerCF_LockServer (LPCLASSFACTORY iface, BOOL dolock) { IDirectMusicContainerCF *This = (IDirectMusicContainerCF *)iface; TRACE("(%p, %d)\n", This, dolock); - if (dolock == TRUE) + if (dolock) InterlockedIncrement (&dwDirectMusicContainer); else InterlockedDecrement (&dwDirectMusicContainer); diff -urN wine-20041201/dlls/dmloader/container.c wine-20050111/dlls/dmloader/container.c --- wine-20041201/dlls/dmloader/container.c 2004-08-23 21:39:55.000000000 +0200 +++ wine-20050111/dlls/dmloader/container.c 2005-01-09 17:42:53.000000000 +0100 @@ -375,7 +375,6 @@ } TRACE_(dmfile)(": StreamCount[0] = 0x%08lX < StreamSize[0] = 0x%08lX\n", StreamCount, StreamSize); } while (StreamCount < StreamSize); - break; } else { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; @@ -886,7 +885,7 @@ obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicContainerImpl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->ContainerVtbl = &DirectMusicContainer_Container_Vtbl; diff -urN wine-20041201/dlls/dmloader/loader.c wine-20050111/dlls/dmloader/loader.c --- wine-20041201/dlls/dmloader/loader.c 2004-09-08 03:37:25.000000000 +0200 +++ wine-20050111/dlls/dmloader/loader.c 2004-12-09 15:07:59.000000000 +0100 @@ -93,7 +93,7 @@ IsEqualGUID (&pDesc->guidObject, &pExistingEntry->Desc.guidObject)) { TRACE(": found it by object GUID\n"); /* I suppose such stuff can happen only when GUID for object is given (GUID_DefaultGMCollection) */ - if (pExistingEntry->bInvalidDefaultDLS == TRUE) { + if (pExistingEntry->bInvalidDefaultDLS) { TRACE(": found faulty default DLS collection... enabling M$ compliant behaviour\n"); return DMUS_E_LOADER_NOFILENAME; } diff -urN wine-20041201/dlls/dmloader/loaderstream.c wine-20050111/dlls/dmloader/loaderstream.c --- wine-20041201/dlls/dmloader/loaderstream.c 2004-08-23 21:39:55.000000000 +0200 +++ wine-20050111/dlls/dmloader/loaderstream.c 2004-12-22 16:13:20.000000000 +0100 @@ -286,7 +286,7 @@ TRACE("(%p)\n", ppobj); obj = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicLoaderFileStream)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->StreamVtbl = &DirectMusicLoaderFileStream_Stream_Vtbl; @@ -552,7 +552,7 @@ TRACE("(%p)\n", ppobj); obj = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicLoaderResourceStream)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->StreamVtbl = &DirectMusicLoaderResourceStream_Stream_Vtbl; @@ -810,7 +810,7 @@ TRACE("(%p)\n", ppobj); obj = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(IDirectMusicLoaderGenericStream)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->StreamVtbl = &DirectMusicLoaderGenericStream_Stream_Vtbl; diff -urN wine-20041201/dlls/dmscript/script.c wine-20050111/dlls/dmscript/script.c --- wine-20041201/dlls/dmscript/script.c 2004-08-23 21:39:54.000000000 +0200 +++ wine-20050111/dlls/dmscript/script.c 2005-01-09 17:42:53.000000000 +0100 @@ -72,10 +72,10 @@ ULONG ref = --This->ref; TRACE("(%p): ReleaseRef to %ld\n", This, This->ref); if (ref == 0) { - if (NULL != This->pHeader) HeapFree(GetProcessHeap(), 0, This->pHeader); - if (NULL != This->pVersion) HeapFree(GetProcessHeap(), 0, This->pVersion); - if (NULL != This->pwzLanguage) HeapFree(GetProcessHeap(), 0, This->pwzLanguage); - if (NULL != This->pwzSource) HeapFree(GetProcessHeap(), 0, This->pwzSource); + HeapFree(GetProcessHeap(), 0, This->pHeader); + HeapFree(GetProcessHeap(), 0, This->pVersion); + HeapFree(GetProcessHeap(), 0, This->pwzLanguage); + HeapFree(GetProcessHeap(), 0, This->pwzSource); HeapFree(GetProcessHeap(), 0, This); } return ref; @@ -365,7 +365,6 @@ } TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); } while (StreamCount < StreamSize); - break; } else { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; diff -urN wine-20041201/dlls/dmscript/scripttrack.c wine-20050111/dlls/dmscript/scripttrack.c --- wine-20041201/dlls/dmscript/scripttrack.c 2004-08-23 21:39:54.000000000 +0200 +++ wine-20050111/dlls/dmscript/scripttrack.c 2004-12-22 16:13:20.000000000 +0100 @@ -259,7 +259,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicScriptTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicScriptTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmstyle/auditiontrack.c wine-20050111/dlls/dmstyle/auditiontrack.c --- wine-20041201/dlls/dmstyle/auditiontrack.c 2004-08-23 21:39:54.000000000 +0200 +++ wine-20050111/dlls/dmstyle/auditiontrack.c 2004-12-22 16:13:20.000000000 +0100 @@ -259,7 +259,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicAuditionTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicAuditionTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmstyle/chordtrack.c wine-20050111/dlls/dmstyle/chordtrack.c --- wine-20041201/dlls/dmstyle/chordtrack.c 2004-08-23 21:39:54.000000000 +0200 +++ wine-20050111/dlls/dmstyle/chordtrack.c 2004-12-22 16:13:20.000000000 +0100 @@ -387,7 +387,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicChordTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicChordTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmstyle/commandtrack.c wine-20050111/dlls/dmstyle/commandtrack.c --- wine-20041201/dlls/dmstyle/commandtrack.c 2004-08-23 21:39:54.000000000 +0200 +++ wine-20050111/dlls/dmstyle/commandtrack.c 2004-12-22 16:13:20.000000000 +0100 @@ -321,7 +321,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCommandTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicCommandTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmstyle/dmstyle_private.h wine-20050111/dlls/dmstyle/dmstyle_private.h --- wine-20041201/dlls/dmstyle/dmstyle_private.h 2004-08-22 23:38:47.000000000 +0200 +++ wine-20050111/dlls/dmstyle/dmstyle_private.h 2005-01-05 14:22:57.000000000 +0100 @@ -104,14 +104,30 @@ IDirectMusicBand* pBand; } DMUS_PRIVATE_STYLE_BAND, *LPDMUS_PRIVATE_STYLE_BAND; -typedef struct _DMUS_PRIVATE_STYLE_MOTIF { +typedef struct _DMUS_PRIVATE_STYLE_PARTREF_ITEM { struct list entry; /* for listing elements */ DMUS_OBJECTDESC desc; + DMUS_IO_PARTREF part_ref; +} DMUS_PRIVATE_STYLE_PARTREF_ITEM, *LPDMUS_PRIVATE_STYLE_PARTREF_ITEM; + +typedef struct _DMUS_PRIVATE_STYLE_MOTIF { + struct list entry; /* for listing elements */ + DWORD dwRythm; DMUS_IO_PATTERN pattern; + DMUS_OBJECTDESC desc; + /** optional for motifs */ DMUS_IO_MOTIFSETTINGS settings; IDirectMusicBand* pBand; + + struct list Items; } DMUS_PRIVATE_STYLE_MOTIF, *LPDMUS_PRIVATE_STYLE_MOTIF; +typedef struct _DMUS_PRIVATE_STYLE_ITEM { + struct list entry; /* for listing elements */ + DWORD dwTimeStamp; + IDirectMusicStyle8* pObject; +} DMUS_PRIVATE_STYLE_ITEM, *LPDMUS_PRIVATE_STYLE_ITEM; + extern HRESULT WINAPI DMUSIC_CreateDirectMusicAuditionTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter); extern HRESULT WINAPI DMUSIC_CreateDirectMusicChordTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter); extern HRESULT WINAPI DMUSIC_CreateDirectMusicCommandTrack (LPCGUID lpcGUID, LPVOID* ppobj, LPUNKNOWN pUnkOuter); @@ -486,6 +502,8 @@ /* IDirectMusicStyleTrack fields */ LPDMUS_OBJECTDESC pDesc; + + struct list Items; }; /* IUnknown: */ diff -urN wine-20041201/dlls/dmstyle/motiftrack.c wine-20050111/dlls/dmstyle/motiftrack.c --- wine-20041201/dlls/dmstyle/motiftrack.c 2004-08-23 21:39:54.000000000 +0200 +++ wine-20050111/dlls/dmstyle/motiftrack.c 2004-12-22 16:13:20.000000000 +0100 @@ -265,7 +265,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMotifTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicMotifTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmstyle/mutetrack.c wine-20050111/dlls/dmstyle/mutetrack.c --- wine-20041201/dlls/dmstyle/mutetrack.c 2004-08-23 21:39:54.000000000 +0200 +++ wine-20050111/dlls/dmstyle/mutetrack.c 2004-12-22 16:13:20.000000000 +0100 @@ -262,7 +262,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicMuteTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicMuteTrack_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmstyle/style.c wine-20050111/dlls/dmstyle/style.c --- wine-20041201/dlls/dmstyle/style.c 2004-08-23 21:39:54.000000000 +0200 +++ wine-20050111/dlls/dmstyle/style.c 2005-01-09 17:42:53.000000000 +0100 @@ -39,6 +39,10 @@ *ppobj = (LPVOID)&This->StyleVtbl; IDirectMusicStyle8Impl_IDirectMusicStyle8_AddRef ((LPDIRECTMUSICSTYLE8)&This->StyleVtbl); return S_OK; + } else if (IsEqualIID (riid, &IID_IDirectMusicStyle8)) { + *ppobj = (LPVOID)&This->StyleVtbl; + IDirectMusicStyle8Impl_IDirectMusicStyle8_AddRef ((LPDIRECTMUSICSTYLE8)&This->StyleVtbl); + return S_OK; } else if (IsEqualIID (riid, &IID_IDirectMusicObject)) { *ppobj = (LPVOID)&This->ObjectVtbl; IDirectMusicStyle8Impl_IDirectMusicObject_AddRef ((LPDIRECTMUSICOBJECT)&This->ObjectVtbl); @@ -365,7 +369,6 @@ } TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); } while (StreamCount < StreamSize); - break; } else { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; @@ -463,7 +466,8 @@ DWORD ListSize[3], ListCount[3]; LARGE_INTEGER liMove; /* used when skipping chunks */ - DMUS_OBJECTDESC desc; + LPDMUS_PRIVATE_STYLE_PARTREF_ITEM pNewItem = NULL; + if (pChunk->fccID != DMUS_FOURCC_PARTREF_LIST) { ERR_(dmfile)(": %s chunk should be a PARTREF list\n", debugstr_fourcc (pChunk->fccID)); @@ -479,9 +483,16 @@ TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); switch (Chunk.fccID) { case DMUS_FOURCC_PARTREF_CHUNK: { - TRACE_(dmfile)(": PartRef chunk (skipping for now)\n"); - liMove.QuadPart = Chunk.dwSize; - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + TRACE_(dmfile)(": PartRef chunk\n"); + pNewItem = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_STYLE_PARTREF_ITEM)); + if (NULL == pNewItem) { + ERR(": no more memory\n"); + return E_OUTOFMEMORY; + } + hr = IStream_Read (pStm, &pNewItem->part_ref, sizeof(DMUS_IO_PARTREF), NULL); + /*TRACE_(dmfile)(" - sizeof %lu\n", sizeof(DMUS_IO_PARTREF));*/ + list_add_tail (&pNewMotif->Items, &pNewItem->entry); + DM_STRUCT_INIT(&pNewItem->desc); break; } case FOURCC_LIST: { @@ -497,7 +508,7 @@ ListCount[1] += sizeof(FOURCC) + sizeof(DWORD) + Chunk.dwSize; TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); - hr = IDirectMusicUtils_IPersistStream_ParseUNFOGeneric(&Chunk, pStm, &desc); + hr = IDirectMusicUtils_IPersistStream_ParseUNFOGeneric(&Chunk, pStm, &pNewItem->desc); if (FAILED(hr)) return hr; if (hr == S_FALSE) { @@ -545,6 +556,8 @@ LARGE_INTEGER liMove; /* used when skipping chunks */ DMUS_OBJECTDESC desc; + DWORD dwSize = 0; + DWORD cnt = 0; if (pChunk->fccID != DMUS_FOURCC_PART_LIST) { ERR_(dmfile)(": %s chunk should be a PART list\n", debugstr_fourcc (pChunk->fccID)); @@ -560,20 +573,40 @@ TRACE_(dmfile)(": %s chunk (size = %ld)", debugstr_fourcc (Chunk.fccID), Chunk.dwSize); switch (Chunk.fccID) { case DMUS_FOURCC_PART_CHUNK: { - TRACE_(dmfile)(": Part chunk (skipping for now)\n"); + TRACE_(dmfile)(": Part chunk (skipping for now) (sizeof %u)\n", sizeof(DMUS_IO_STYLEPART)); liMove.QuadPart = Chunk.dwSize; IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); break; } case DMUS_FOURCC_NOTE_CHUNK: { - TRACE_(dmfile)(": Note chunk (skipping for now)\n"); - liMove.QuadPart = Chunk.dwSize; + TRACE_(dmfile)(": Note chunk (skipping for now) (sizeof %u)\n", sizeof(DMUS_IO_STYLENOTE)); + IStream_Read (pStm, &dwSize, sizeof(DWORD), NULL); + cnt = (Chunk.dwSize - sizeof(DWORD)); + TRACE_(dmfile)(" - dwSize: %lu\n", dwSize); + TRACE_(dmfile)(" - cnt: %lu (%lu / %lu)\n", cnt / dwSize, (Chunk.dwSize - sizeof(DWORD)), dwSize); + if (cnt % dwSize != 0) { + ERR("Invalid Array Size"); + return E_FAIL; + } + cnt /= dwSize; + /** skip for now */ + liMove.QuadPart = cnt * dwSize; IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); break; } case DMUS_FOURCC_CURVE_CHUNK: { - TRACE_(dmfile)(": Curve chunk (skipping for now)\n"); - liMove.QuadPart = Chunk.dwSize; + TRACE_(dmfile)(": Curve chunk (skipping for now) (sizeof %u)\n", sizeof(DMUS_IO_STYLECURVE)); + IStream_Read (pStm, &dwSize, sizeof(DWORD), NULL); + cnt = (Chunk.dwSize - sizeof(DWORD)); + TRACE_(dmfile)(" - dwSize: %lu\n", dwSize); + TRACE_(dmfile)(" - cnt: %lu (%lu / %lu)\n", cnt / dwSize, (Chunk.dwSize - sizeof(DWORD)), dwSize); + if (cnt % dwSize != 0) { + ERR("Invalid Array Size"); + return E_FAIL; + } + cnt /= dwSize; + /** skip for now */ + liMove.QuadPart = cnt * dwSize; IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); break; } @@ -655,12 +688,10 @@ DWORD ListSize[3], ListCount[3]; LARGE_INTEGER liMove; /* used when skipping chunks */ - DWORD dwRythm; DMUS_OBJECTDESC desc; IDirectMusicBand* pBand = NULL; LPDMUS_PRIVATE_STYLE_MOTIF pNewMotif = NULL; - dwRythm = 0; DM_STRUCT_INIT(&desc); if (pChunk->fccID != DMUS_FOURCC_PATTERN_LIST) { @@ -690,14 +721,14 @@ /** TODO trace pattern */ /** reset all datas, as a new pattern begin */ - dwRythm = 0; DM_STRUCT_INIT(&pNewMotif->desc); + list_init (&pNewMotif->Items); break; } case DMUS_FOURCC_RHYTHM_CHUNK: { TRACE_(dmfile)(": Rythm chunk\n"); - IStream_Read (pStm, &dwRythm, sizeof(DWORD), NULL); - TRACE_(dmfile)(" - dwRythm: %lu\n", dwRythm); + IStream_Read (pStm, &pNewMotif->dwRythm, sizeof(DWORD), NULL); + TRACE_(dmfile)(" - dwRythm: %lu\n", pNewMotif->dwRythm); /** TODO understand why some Chunks have size > 4 */ liMove.QuadPart = Chunk.dwSize - sizeof(DWORD); IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); @@ -1041,7 +1072,7 @@ obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyle8Impl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->UnknownVtbl = &DirectMusicStyle8_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmstyle/styletrack.c wine-20050111/dlls/dmstyle/styletrack.c --- wine-20041201/dlls/dmstyle/styletrack.c 2004-08-23 21:39:54.000000000 +0200 +++ wine-20050111/dlls/dmstyle/styletrack.c 2005-01-05 14:22:57.000000000 +0100 @@ -242,15 +242,17 @@ } static HRESULT IDirectMusicStyleTrack_IPersistStream_ParseStyleRef (LPPERSISTSTREAM iface, DMUS_PRIVATE_CHUNK* pChunk, IStream* pStm) { - /*ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface);*/ + ICOM_THIS_MULTI(IDirectMusicStyleTrack, PersistStreamVtbl, iface); DMUS_PRIVATE_CHUNK Chunk; DWORD ListSize[3], ListCount[3]; LARGE_INTEGER liMove; /* used when skipping chunks */ + HRESULT hr; - DWORD dwTimeStamp; + IDirectMusicObject* pObject = NULL; + LPDMUS_PRIVATE_STYLE_ITEM pNewItem = NULL; if (pChunk->fccID != DMUS_FOURCC_STYLE_REF_LIST) { - ERR_(dmfile)(": %s chunk should be a SEGMENT list\n", debugstr_fourcc (pChunk->fccID)); + ERR_(dmfile)(": %s chunk should be a STYLE list\n", debugstr_fourcc (pChunk->fccID)); return E_FAIL; } @@ -264,8 +266,14 @@ switch (Chunk.fccID) { case DMUS_FOURCC_TIME_STAMP_CHUNK: { TRACE_(dmfile)(": Time Stamp chunck \n"); - IStream_Read (pStm, &dwTimeStamp, sizeof(DWORD), NULL); - TRACE_(dmfile)(" - dwTimeStamp: %lu\n", dwTimeStamp); + pNewItem = HeapAlloc (GetProcessHeap (), HEAP_ZERO_MEMORY, sizeof(DMUS_PRIVATE_STYLE_ITEM)); + if (NULL == pNewItem) { + ERR(": no more memory\n"); + return E_OUTOFMEMORY; + } + IStream_Read (pStm, &pNewItem->dwTimeStamp, sizeof(DWORD), NULL); + TRACE_(dmfile)(" - dwTimeStamp: %lu\n", pNewItem->dwTimeStamp); + list_add_tail (&This->Items, &pNewItem->entry); break; } case FOURCC_LIST: { @@ -279,8 +287,18 @@ */ case DMUS_FOURCC_REF_LIST: { FIXME_(dmfile)(": DMRF (DM References) list, not yet handled\n"); - liMove.QuadPart = Chunk.dwSize - sizeof(FOURCC); - IStream_Seek (pStm, liMove, STREAM_SEEK_CUR, NULL); + hr = IDirectMusicUtils_IPersistStream_ParseReference (iface, &Chunk, pStm, &pObject); + if (FAILED(hr)) { + ERR(": could not load Reference\n"); + return hr; + } + hr = IDirectMusicObject_QueryInterface(pObject, &IID_IDirectMusicStyle8, (LPVOID*)&pNewItem->pObject); + if (FAILED(hr)) { + ERR(": Reference not a IDirectMusicStyle, exiting\n"); + exit(-1); + return hr; + } + IDirectMusicObject_Release(pObject); break; } default: { @@ -432,7 +450,7 @@ track = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicStyleTrack)); if (NULL == track) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } track->UnknownVtbl = &DirectMusicStyleTrack_Unknown_Vtbl; @@ -443,6 +461,7 @@ track->pDesc->dwValidData |= DMUS_OBJ_CLASS; memcpy (&track->pDesc->guidClass, &CLSID_DirectMusicStyleTrack, sizeof (CLSID)); track->ref = 0; /* will be inited by QueryInterface */ + list_init (&track->Items); return IDirectMusicStyleTrack_IUnknown_QueryInterface ((LPUNKNOWN)&track->UnknownVtbl, lpcGUID, ppobj); } diff -urN wine-20041201/dlls/dmusic/buffer.c wine-20050111/dlls/dmusic/buffer.c --- wine-20041201/dlls/dmusic/buffer.c 2004-09-06 23:34:25.000000000 +0200 +++ wine-20050111/dlls/dmusic/buffer.c 2004-12-22 16:13:20.000000000 +0100 @@ -155,7 +155,7 @@ dmbuff = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicBufferImpl)); if (NULL == dmbuff) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } dmbuff->lpVtbl = &DirectMusicBuffer_Vtbl; diff -urN wine-20041201/dlls/dmusic/collection.c wine-20050111/dlls/dmusic/collection.c --- wine-20041201/dlls/dmusic/collection.c 2004-09-08 03:37:25.000000000 +0200 +++ wine-20050111/dlls/dmusic/collection.c 2005-01-09 17:42:53.000000000 +0100 @@ -349,7 +349,6 @@ } TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); } while (StreamCount < StreamSize); - break; } else { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; @@ -742,7 +741,7 @@ obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicCollectionImpl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->UnknownVtbl = &DirectMusicCollection_Unknown_Vtbl; diff -urN wine-20041201/dlls/dmusic/download.c wine-20050111/dlls/dmusic/download.c --- wine-20041201/dlls/dmusic/download.c 2004-09-06 23:34:25.000000000 +0200 +++ wine-20050111/dlls/dmusic/download.c 2004-12-22 16:13:20.000000000 +0100 @@ -72,7 +72,7 @@ dmdl = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadImpl)); if (NULL == dmdl) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } dmdl->lpVtbl = &DirectMusicDownload_Vtbl; diff -urN wine-20041201/dlls/dmusic/downloadedinstrument.c wine-20050111/dlls/dmusic/downloadedinstrument.c --- wine-20041201/dlls/dmusic/downloadedinstrument.c 2004-09-06 23:34:25.000000000 +0200 +++ wine-20050111/dlls/dmusic/downloadedinstrument.c 2004-12-22 16:13:20.000000000 +0100 @@ -67,7 +67,7 @@ dmdlinst = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicDownloadedInstrumentImpl)); if (NULL == dmdlinst) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } dmdlinst->lpVtbl = &DirectMusicDownloadedInstrument_Vtbl; diff -urN wine-20041201/dlls/dmusic/instrument.c wine-20050111/dlls/dmusic/instrument.c --- wine-20041201/dlls/dmusic/instrument.c 2004-08-23 21:39:53.000000000 +0200 +++ wine-20050111/dlls/dmusic/instrument.c 2004-12-22 16:13:20.000000000 +0100 @@ -118,7 +118,7 @@ dminst = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicInstrumentImpl)); if (NULL == dminst) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } dminst->UnknownVtbl = &DirectMusicInstrument_Unknown_Vtbl; diff -urN wine-20041201/dlls/dplayx/dpclassfactory.c wine-20050111/dlls/dplayx/dpclassfactory.c --- wine-20041201/dlls/dplayx/dpclassfactory.c 2004-10-07 05:06:51.000000000 +0200 +++ wine-20050111/dlls/dplayx/dpclassfactory.c 2005-01-11 16:46:44.000000000 +0100 @@ -55,13 +55,13 @@ static ULONG WINAPI DP_and_DPL_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI DP_and_DPL_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; /* static class (reference starts @ 1), won't ever be freed */ - return --(This->ref); + return InterlockedDecrement(&This->ref); } static HRESULT WINAPI DP_and_DPL_CreateInstance( diff -urN wine-20041201/dlls/dplayx/dplay.c wine-20050111/dlls/dplayx/dplay.c --- wine-20041201/dlls/dplayx/dplay.c 2004-09-06 23:34:25.000000000 +0200 +++ wine-20050111/dlls/dplayx/dplay.c 2005-01-07 16:40:09.000000000 +0100 @@ -1307,15 +1307,8 @@ } /* Delete any existing pointers */ - if( lpDst->u1.lpszShortNameA ) - { - HeapFree( GetProcessHeap(), 0, lpDst->u1.lpszShortNameA ); - } - - if( lpDst->u2.lpszLongNameA ) - { - HeapFree( GetProcessHeap(), 0, lpDst->u1.lpszShortNameA ); - } + HeapFree( GetProcessHeap(), 0, lpDst->u1.lpszShortNameA ); + HeapFree( GetProcessHeap(), 0, lpDst->u2.lpszLongNameA ); /* Copy as required */ CopyMemory( lpDst, lpSrc, lpSrc->dwSize ); @@ -2316,7 +2309,7 @@ lpData->dwTimeout = dwTimeout; This->dp2->hKillEnumSessionThreadEvent = - CreateEventA( NULL, TRUE, FALSE, NULL ); + CreateEventW( NULL, TRUE, FALSE, NULL ); if( !DuplicateHandle( GetCurrentProcess(), This->dp2->hKillEnumSessionThreadEvent, @@ -4589,7 +4582,7 @@ { DWORD dwWaitReturn; - This->dp2->hReplyEvent = CreateEventA( NULL, FALSE, FALSE, NULL ); + This->dp2->hReplyEvent = CreateEventW( NULL, FALSE, FALSE, NULL ); dwWaitReturn = WaitForSingleObject( hReplyEvent, dwTimeout ); if( dwWaitReturn != WAIT_OBJECT_0 ) diff -urN wine-20041201/dlls/dplayx/dplaysp.c wine-20050111/dlls/dplayx/dplaysp.c --- wine-20041201/dlls/dplayx/dplaysp.c 2004-09-06 23:34:25.000000000 +0200 +++ wine-20050111/dlls/dplayx/dplaysp.c 2004-12-23 19:41:06.000000000 +0100 @@ -411,21 +411,13 @@ /* What to do in the case where there is nothing set yet? */ if( dwFlags == DPSET_LOCAL ) { - if( lpPlayerData->lpPlayerLocalData ) - { - HeapFree( GetProcessHeap(), 0, lpPlayerData->lpPlayerLocalData ); - } - + HeapFree( GetProcessHeap(), 0, lpPlayerData->lpPlayerLocalData ); *lplpData = lpPlayerData->lpPlayerLocalData; *lpdwDataSize = lpPlayerData->dwPlayerLocalDataSize; } else if( dwFlags == DPSET_REMOTE ) { - if( lpPlayerData->lpPlayerRemoteData ) - { - HeapFree( GetProcessHeap(), 0, lpPlayerData->lpPlayerRemoteData ); - } - + HeapFree( GetProcessHeap(), 0, lpPlayerData->lpPlayerRemoteData ); *lplpData = lpPlayerData->lpPlayerRemoteData; *lpdwDataSize = lpPlayerData->dwPlayerRemoteDataSize; } @@ -908,21 +900,13 @@ /* If we have data already allocated, free it and replace it */ if( dwFlags == DPSET_REMOTE ) { - if( This->sp->lpSpRemoteData ) - { - HeapFree( GetProcessHeap(), 0, This->sp->lpSpRemoteData ); - } - + HeapFree( GetProcessHeap(), 0, This->sp->lpSpRemoteData ); This->sp->dwSpRemoteDataSize = dwDataSize; This->sp->lpSpRemoteData = lpSpData; } else if ( dwFlags == DPSET_LOCAL ) { - if( This->sp->lpSpLocalData ) - { - HeapFree( GetProcessHeap(), 0, This->sp->lpSpLocalData ); - } - + HeapFree( GetProcessHeap(), 0, This->sp->lpSpLocalData ); This->sp->lpSpLocalData = lpSpData; This->sp->dwSpLocalDataSize = dwDataSize; } diff -urN wine-20041201/dlls/dplayx/dplayx_messages.c wine-20050111/dlls/dplayx/dplayx_messages.c --- wine-20041201/dlls/dplayx/dplayx_messages.c 2003-09-29 22:20:53.000000000 +0200 +++ wine-20050111/dlls/dplayx/dplayx_messages.c 2005-01-07 16:40:09.000000000 +0100 @@ -166,7 +166,7 @@ HANDLE DP_MSG_BuildAndLinkReplyStruct( IDirectPlay2Impl* This, LPDP_MSG_REPLY_STRUCT_LIST lpReplyStructList, WORD wReplyCommandId ) { - lpReplyStructList->replyExpected.hReceipt = CreateEventA( NULL, FALSE, FALSE, NULL ); + lpReplyStructList->replyExpected.hReceipt = CreateEventW( NULL, FALSE, FALSE, NULL ); lpReplyStructList->replyExpected.wExpectedReply = wReplyCommandId; lpReplyStructList->replyExpected.lpReplyMsg = NULL; lpReplyStructList->replyExpected.dwMsgBodySize = 0; @@ -341,7 +341,6 @@ lpMsgBody->unknown4[9] = 0x0; lpMsgBody->unknown4[10] = 0x0; lpMsgBody->unknown4[11] = 0x0; - lpMsgBody->unknown4[12] = 0x0; lpMsgBody->unknown5[0] = 0x0; lpMsgBody->unknown5[1] = 0x0; diff -urN wine-20041201/dlls/dplayx/dplobby.c wine-20050111/dlls/dplayx/dplobby.c --- wine-20041201/dlls/dplayx/dplobby.c 2004-11-30 22:39:00.000000000 +0100 +++ wine-20050111/dlls/dplayx/dplobby.c 2005-01-07 16:40:09.000000000 +0100 @@ -1164,13 +1164,13 @@ s_attrib.bInheritHandle = TRUE; /* FIXME: Is there a handle leak here? */ - hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL ); + hTemp = CreateEventW( &s_attrib, TRUE, FALSE, NULL ); *lphStart = ConvertToGlobalHandle( hTemp ); - hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL ); + hTemp = CreateEventW( &s_attrib, TRUE, FALSE, NULL ); *lphDeath = ConvertToGlobalHandle( hTemp ); - hTemp = CreateEventA( &s_attrib, TRUE, FALSE, NULL ); + hTemp = CreateEventW( &s_attrib, TRUE, FALSE, NULL ); *lphRead = ConvertToGlobalHandle( hTemp ); if( ( !DuplicateHandle( GetCurrentProcess(), *lphStart, diff -urN wine-20041201/dlls/dsound/buffer.c wine-20050111/dlls/dsound/buffer.c --- wine-20041201/dlls/dsound/buffer.c 2004-09-17 20:10:59.000000000 +0200 +++ wine-20050111/dlls/dsound/buffer.c 2004-12-23 19:41:06.000000000 +0100 @@ -132,10 +132,8 @@ memcpy(This->dsb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY)); This->dsb->nrofnotifies = howmuch; } else { - if (This->dsb->notifies) { - HeapFree(GetProcessHeap(), 0, This->dsb->notifies); - This->dsb->notifies = NULL; - } + HeapFree(GetProcessHeap(), 0, This->dsb->notifies); + This->dsb->notifies = NULL; This->dsb->nrofnotifies = 0; } @@ -406,12 +404,8 @@ } } - if (This->notifies != NULL) - HeapFree(GetProcessHeap(), 0, This->notifies); - - if (This->pwfx) - HeapFree(GetProcessHeap(), 0, This->pwfx); - + HeapFree(GetProcessHeap(), 0, This->notifies); + HeapFree(GetProcessHeap(), 0, This->pwfx); HeapFree(GetProcessHeap(),0,This); TRACE("(%p) released\n",This); @@ -986,17 +980,12 @@ } if ( IsEqualGUID( &IID_IKsPropertySet, riid ) ) { - /* only supported on hardware 3D secondary buffers */ - if (!(This->dsbd.dwFlags & DSBCAPS_PRIMARYBUFFER) && - (This->dsbd.dwFlags & DSBCAPS_CTRL3D) && - (This->hwbuf != NULL) ) { - if (!This->iks) - IKsBufferPropertySetImpl_Create(This, &(This->iks)); - if (This->iks) { - IKsPropertySet_AddRef((LPKSPROPERTYSET)*ppobj); - *ppobj = This->iks; - return S_OK; - } + if (!This->iks) + IKsBufferPropertySetImpl_Create(This, &(This->iks)); + if (This->iks) { + IKsPropertySet_AddRef((LPKSPROPERTYSET)This->iks); + *ppobj = This->iks; + return S_OK; } WARN("IID_IKsPropertySet\n"); return E_NOINTERFACE; @@ -1212,10 +1201,8 @@ if (!(dsbd->dwFlags & DSBCAPS_PRIMARYBUFFER)) { err = DSOUND_AddBuffer(ds, dsb); if (err != DS_OK) { - if (dsb->buffer->memory) - HeapFree(GetProcessHeap(),0,dsb->buffer->memory); - if (dsb->buffer) - HeapFree(GetProcessHeap(),0,dsb->buffer); + HeapFree(GetProcessHeap(),0,dsb->buffer->memory); + HeapFree(GetProcessHeap(),0,dsb->buffer); dsb->lock.DebugInfo->Spare[1] = 0; DeleteCriticalSection(&(dsb->lock)); HeapFree(GetProcessHeap(),0,dsb->pwfx); diff -urN wine-20041201/dlls/dsound/capture.c wine-20050111/dlls/dsound/capture.c --- wine-20041201/dlls/dsound/capture.c 2004-11-19 18:56:56.000000000 +0100 +++ wine-20050111/dlls/dsound/capture.c 2005-01-09 17:42:53.000000000 +0100 @@ -397,9 +397,7 @@ IDsCaptureDriver_Release(This->driver); } - if (This->pwfx) - HeapFree(GetProcessHeap(), 0, This->pwfx); - + HeapFree(GetProcessHeap(), 0, This->pwfx); This->lock.DebugInfo->Spare[1] = 0; DeleteCriticalSection( &(This->lock) ); HeapFree( GetProcessHeap(), 0, This ); @@ -730,8 +728,7 @@ /* let driver allocate memory */ ipDSC->buflen = lpcDSCBufferDesc->dwBufferBytes; /* FIXME: */ - if (ipDSC->buffer) - HeapFree( GetProcessHeap(), 0, ipDSC->buffer); + HeapFree( GetProcessHeap(), 0, ipDSC->buffer); ipDSC->buffer = NULL; } @@ -868,10 +865,8 @@ memcpy(This->dscb->notifies, notify, howmuch * sizeof(DSBPOSITIONNOTIFY)); This->dscb->nrofnotifies = howmuch; } else { - if (This->dscb->notifies) { - HeapFree(GetProcessHeap(), 0, This->dscb->notifies); - This->dscb->notifies = NULL; - } + HeapFree(GetProcessHeap(), 0, This->dscb->notifies); + This->dscb->notifies = NULL; This->dscb->nrofnotifies = 0; } @@ -985,16 +980,13 @@ if (This->dsound->state == STATE_CAPTURING) This->dsound->state = STATE_STOPPING; - if (This->pdscbd) - HeapFree(GetProcessHeap(),0, This->pdscbd); + HeapFree(GetProcessHeap(),0, This->pdscbd); if (This->dsound->hwi) { waveInReset(This->dsound->hwi); waveInClose(This->dsound->hwi); - if (This->dsound->pwave) { - HeapFree(GetProcessHeap(),0, This->dsound->pwave); - This->dsound->pwave = 0; - } + HeapFree(GetProcessHeap(),0, This->dsound->pwave); + This->dsound->pwave = 0; This->dsound->hwi = 0; } @@ -1010,9 +1002,7 @@ if (This->notify) IDirectSoundNotify_Release((LPDIRECTSOUNDNOTIFY)This->notify); - if (This->notifies != NULL) - HeapFree(GetProcessHeap(), 0, This->notifies); - + HeapFree(GetProcessHeap(), 0, This->notifies); HeapFree( GetProcessHeap(), 0, This ); TRACE("(%p) released\n",This); } @@ -1726,8 +1716,6 @@ WARN("IDirectSoundFullDuplexImpl_Initialize failed\n"); return hres; } - - return DSERR_GENERIC; } static HRESULT WINAPI diff -urN wine-20041201/dlls/dsound/dsound.c wine-20050111/dlls/dsound/dsound.c --- wine-20041201/dlls/dsound/dsound.c 2004-09-16 21:08:04.000000000 +0200 +++ wine-20050111/dlls/dsound/dsound.c 2004-12-07 15:23:46.000000000 +0100 @@ -787,7 +787,7 @@ /* Allocate memory */ pDS = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(IDirectSoundImpl)); - if (ppDS == NULL) { + if (pDS == NULL) { WARN("out of memory\n"); *ppDS = NULL; return DSERR_OUTOFMEMORY; diff -urN wine-20041201/dlls/dsound/primary.c wine-20050111/dlls/dsound/primary.c --- wine-20041201/dlls/dsound/primary.c 2004-09-17 20:10:59.000000000 +0200 +++ wine-20050111/dlls/dsound/primary.c 2004-12-23 19:41:06.000000000 +0100 @@ -234,10 +234,8 @@ HeapFree(GetProcessHeap(),0,This->pwave[c]); } } - if (This->pwfx) { - HeapFree(GetProcessHeap(),0,This->pwfx); - This->pwfx=NULL; - } + HeapFree(GetProcessHeap(),0,This->pwfx); + This->pwfx=NULL; return DS_OK; } diff -urN wine-20041201/dlls/dsound/propset.c wine-20050111/dlls/dsound/propset.c --- wine-20041201/dlls/dsound/propset.c 2004-09-17 20:10:59.000000000 +0200 +++ wine-20050111/dlls/dsound/propset.c 2005-01-09 17:42:53.000000000 +0100 @@ -109,22 +109,24 @@ TRACE("(iface=%p,guidPropSet=%s,dwPropID=%ld,pInstanceData=%p,cbInstanceData=%ld,pPropData=%p,cbPropData=%ld,pcbReturned=%p)\n", This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData,pcbReturned); - IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps); + if (This->dsb->hwbuf) { + IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps); - if (ps) { - DSPROPERTY prop; - HRESULT hres; + if (ps) { + DSPROPERTY prop; + HRESULT hres; - prop.s.Set = *guidPropSet; - prop.s.Id = dwPropID; - prop.s.Flags = 0; /* unused */ - prop.s.InstanceId = (ULONG)This->dsb->dsound; + prop.s.Set = *guidPropSet; + prop.s.Id = dwPropID; + prop.s.Flags = 0; /* unused */ + prop.s.InstanceId = (ULONG)This->dsb->dsound; - hres = IDsDriverPropertySet_Get(ps, &prop, pInstanceData, cbInstanceData, pPropData, cbPropData, pcbReturned); + hres = IDsDriverPropertySet_Get(ps, &prop, pInstanceData, cbInstanceData, pPropData, cbPropData, pcbReturned); - IDsDriverPropertySet_Release(ps); + IDsDriverPropertySet_Release(ps); - return hres; + return hres; + } } return E_PROP_ID_UNSUPPORTED; @@ -143,21 +145,23 @@ PIDSDRIVERPROPERTYSET ps; TRACE("(%p,%s,%ld,%p,%ld,%p,%ld)\n",This,debugstr_guid(guidPropSet),dwPropID,pInstanceData,cbInstanceData,pPropData,cbPropData); - IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps); + if (This->dsb->hwbuf) { + IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps); - if (ps) { - DSPROPERTY prop; - HRESULT hres; + if (ps) { + DSPROPERTY prop; + HRESULT hres; + + prop.s.Set = *guidPropSet; + prop.s.Id = dwPropID; + prop.s.Flags = 0; /* unused */ + prop.s.InstanceId = (ULONG)This->dsb->dsound; + hres = IDsDriverPropertySet_Set(ps,&prop,pInstanceData,cbInstanceData,pPropData,cbPropData); - prop.s.Set = *guidPropSet; - prop.s.Id = dwPropID; - prop.s.Flags = 0; /* unused */ - prop.s.InstanceId = (ULONG)This->dsb->dsound; - hres = IDsDriverPropertySet_Set(ps,&prop,pInstanceData,cbInstanceData,pPropData,cbPropData); + IDsDriverPropertySet_Release(ps); - IDsDriverPropertySet_Release(ps); - - return hres; + return hres; + } } return E_PROP_ID_UNSUPPORTED; @@ -173,16 +177,18 @@ PIDSDRIVERPROPERTYSET ps; TRACE("(%p,%s,%ld,%p)\n",This,debugstr_guid(guidPropSet),dwPropID,pTypeSupport); - IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps); + if (This->dsb->hwbuf) { + IDsDriver_QueryInterface(This->dsb->hwbuf, &IID_IDsDriverPropertySet, (void **)&ps); - if (ps) { - HRESULT hres; + if (ps) { + HRESULT hres; - hres = IDsDriverPropertySet_QuerySupport(ps,guidPropSet, dwPropID,pTypeSupport); + hres = IDsDriverPropertySet_QuerySupport(ps,guidPropSet, dwPropID,pTypeSupport); - IDsDriverPropertySet_Release(ps); + IDsDriverPropertySet_Release(ps); - return hres; + return hres; + } } return E_PROP_ID_UNSUPPORTED; @@ -205,6 +211,12 @@ TRACE("(%p,%p)\n",dsb,piks); iks = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(*iks)); + if (iks == 0) { + WARN("out of memory\n"); + *piks = NULL; + return DSERR_OUTOFMEMORY; + } + iks->ref = 0; iks->dsb = dsb; dsb->iks = iks; @@ -603,7 +615,6 @@ WARN("waveInMessage failed\n"); return E_PROP_ID_UNSUPPORTED; } - break; } } } else { @@ -759,7 +770,6 @@ WARN("waveInMessage failed\n"); return E_PROP_ID_UNSUPPORTED; } - break; } } } else { @@ -848,15 +858,29 @@ for (wod = 0; wod < devs; ++wod) { err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { + DWORD size; memset(&data, 0, sizeof(data)); data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; data.WaveDeviceId = wod; data.DeviceId = renderer_guids[wod]; data.Description = desc.szDesc; data.Module = desc.szDrvName; - data.Interface = "Interface"; - TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); - (ppd->Callback)(&data, ppd->Context); + err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0)); + if (err == DS_OK) { + WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size); + err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size)); + if (err == DS_OK) { + CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR)); + WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL ); + data.Interface = szInterface; + + TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); + (ppd->Callback)(&data, ppd->Context); + + HeapFree(GetProcessHeap(),0,szInterface); + } + HeapFree(GetProcessHeap(),0,nameW); + } } } @@ -864,15 +888,29 @@ for (wid = 0; wid < devs; ++wid) { err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { + DWORD size; memset(&data, 0, sizeof(data)); data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; data.WaveDeviceId = wid; data.DeviceId = capture_guids[wid]; data.Description = desc.szDesc; data.Module = desc.szDrvName; - data.Interface = "Interface"; - TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); - (ppd->Callback)(&data, ppd->Context); + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE,(DWORD_PTR)&size,0)); + if (err == DS_OK) { + WCHAR * nameW = HeapAlloc(GetProcessHeap(),0,size); + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACE,(DWORD_PTR)nameW,size)); + if (err == DS_OK) { + CHAR * szInterface = HeapAlloc(GetProcessHeap(),0,size/sizeof(WCHAR)); + WideCharToMultiByte( CP_ACP, 0, nameW, size/sizeof(WCHAR), szInterface, size/sizeof(WCHAR), NULL, NULL ); + data.Interface = szInterface; + + TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); + (ppd->Callback)(&data, ppd->Context); + + HeapFree(GetProcessHeap(),0,szInterface); + } + HeapFree(GetProcessHeap(),0,nameW); + } } } @@ -913,25 +951,33 @@ for (wod = 0; wod < devs; ++wod) { err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { - /* FIXME: this is a memory leak */ WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); - WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); - - memset(&data, 0, sizeof(data)); - data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; - data.WaveDeviceId = wod; - data.DeviceId = renderer_guids[wod]; - - MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); - MultiByteToWideChar( CP_ACP, 0, desc.szDrvName, -1, wModule, 0x100 ); - MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); - - data.Description = wDescription; - data.Module = wModule; - data.Interface = wInterface; - TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); - (ppd->Callback)(&data, ppd->Context); + DWORD size; + err = mmErr(waveOutMessage((HWAVEOUT)wod,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0)); + if (err == DS_OK) { + WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size); + err = mmErr(waveOutMessage((HWAVEOUT)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size)); + if (err == DS_OK) { + memset(&data, 0, sizeof(data)); + data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_RENDER; + data.WaveDeviceId = wod; + data.DeviceId = renderer_guids[wod]; + + MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); + MultiByteToWideChar( CP_ACP, 0, desc.szDrvName, -1, wModule, 0x100 ); + + data.Description = wDescription; + data.Module = wModule; + data.Interface = wInterface; + + TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); + (ppd->Callback)(&data, ppd->Context); + } + HeapFree(GetProcessHeap(),0,wInterface); + } + HeapFree(GetProcessHeap(),0,wDescription); + HeapFree(GetProcessHeap(),0,wModule); } } @@ -939,25 +985,32 @@ for (wid = 0; wid < devs; ++wid) { err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDSOUNDDESC,(DWORD)&desc,0)); if (err == DS_OK) { - /* FIXME: this is a memory leak */ WCHAR * wDescription = HeapAlloc(GetProcessHeap(),0,0x200); WCHAR * wModule = HeapAlloc(GetProcessHeap(),0,0x200); - WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,0x200); - - memset(&data, 0, sizeof(data)); - data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; - data.WaveDeviceId = wid; - data.DeviceId = capture_guids[wid]; - - MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); - MultiByteToWideChar( CP_ACP, 0, desc.szDrvName, -1, wModule, 0x100 ); - MultiByteToWideChar( CP_ACP, 0, "Interface", -1, wInterface, 0x100 ); - - data.Description = wDescription; - data.Module = wModule; - data.Interface = wInterface; - TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); - (ppd->Callback)(&data, ppd->Context); + DWORD size; + err = mmErr(waveInMessage((HWAVEIN)wid,DRV_QUERYDEVICEINTERFACESIZE, (DWORD_PTR)&size, 0)); + if (err == DS_OK) { + WCHAR * wInterface = HeapAlloc(GetProcessHeap(),0,size); + err = mmErr(waveInMessage((HWAVEIN)wod, DRV_QUERYDEVICEINTERFACE, (DWORD_PTR)wInterface, size)); + if (err == DS_OK) { + memset(&data, 0, sizeof(data)); + data.DataFlow = DIRECTSOUNDDEVICE_DATAFLOW_CAPTURE; + data.WaveDeviceId = wid; + data.DeviceId = capture_guids[wid]; + + MultiByteToWideChar( CP_ACP, 0, desc.szDesc, -1, wDescription, 0x100 ); + MultiByteToWideChar( CP_ACP, 0, desc.szDrvName, -1, wModule, 0x100 ); + + data.Description = wDescription; + data.Module = wModule; + data.Interface = wInterface; + TRACE("calling Callback(%p,%p)\n", &data, ppd->Context); + (ppd->Callback)(&data, ppd->Context); + } + HeapFree(GetProcessHeap(),0,wInterface); + } + HeapFree(GetProcessHeap(),0,wDescription); + HeapFree(GetProcessHeap(),0,wModule); } } diff -urN wine-20041201/dlls/dsound/sound3d.c wine-20050111/dlls/dsound/sound3d.c --- wine-20041201/dlls/dsound/sound3d.c 2004-09-17 20:10:59.000000000 +0200 +++ wine-20050111/dlls/dsound/sound3d.c 2004-12-09 15:07:59.000000000 +0100 @@ -355,7 +355,7 @@ crash without the following line) */ if (ds3dl->dsound->buffers[i]->ds3db == NULL) continue; - if (ds3dl->dsound->buffers[i]->ds3db_need_recalc == TRUE) + if (ds3dl->dsound->buffers[i]->ds3db_need_recalc) { DSOUND_Mix3DBuffer(ds3dl->dsound->buffers[i]); } diff -urN wine-20041201/dlls/dsound/tests/capture.c wine-20050111/dlls/dsound/tests/capture.c --- wine-20041201/dlls/dsound/tests/capture.c 2004-10-25 23:45:51.000000000 +0200 +++ wine-20050111/dlls/dsound/tests/capture.c 2005-01-10 13:25:57.000000000 +0100 @@ -23,13 +23,9 @@ #define NONAMELESSUNION #include -#include -#include #include #include "wine/test.h" -#include "windef.h" -#include "wingdi.h" #include "dsound.h" #include "mmreg.h" #include "dxerr8.h" @@ -274,10 +270,9 @@ /* wait for the notifications */ for (i = 0; i < (NOTIFICATIONS * 2); i++) { - rc=MsgWaitForMultipleObjects(NOTIFICATIONS,state.event,FALSE, - 3000,QS_ALLEVENTS); + rc=WaitForMultipleObjects(NOTIFICATIONS,state.event,FALSE,3000); ok(rc==(WAIT_OBJECT_0+(i%NOTIFICATIONS)), - "MsgWaitForMultipleObjects failed: 0x%lx\n",rc); + "WaitForMultipleObjects failed: 0x%lx\n",rc); if (rc!=(WAIT_OBJECT_0+(i%NOTIFICATIONS))) { ok((rc==WAIT_TIMEOUT)||(rc==WAIT_FAILED), "Wrong notification: should be %d, got %ld\n", @@ -513,6 +508,8 @@ { HMODULE hDsound; + CoInitialize(NULL); + hDsound = LoadLibraryA("dsound.dll"); if (!hDsound) { trace("dsound.dll not found\n"); @@ -527,4 +524,6 @@ } capture_tests(); + + CoUninitialize(); } diff -urN wine-20041201/dlls/dsound/tests/ds3d.c wine-20050111/dlls/dsound/tests/ds3d.c --- wine-20041201/dlls/dsound/tests/ds3d.c 2004-10-21 21:51:10.000000000 +0200 +++ wine-20050111/dlls/dsound/tests/ds3d.c 2005-01-10 13:25:56.000000000 +0100 @@ -28,11 +28,8 @@ #include #include -#include #include "wine/test.h" -#include "windef.h" -#include "wingdi.h" #include "dsound.h" #include "dxerr8.h" @@ -1198,5 +1195,9 @@ START_TEST(ds3d) { + CoInitialize(NULL); + ds3d_tests(); + + CoUninitialize(); } diff -urN wine-20041201/dlls/dsound/tests/ds3d8.c wine-20050111/dlls/dsound/tests/ds3d8.c --- wine-20041201/dlls/dsound/tests/ds3d8.c 2004-10-21 21:51:10.000000000 +0200 +++ wine-20050111/dlls/dsound/tests/ds3d8.c 2005-01-10 13:25:56.000000000 +0100 @@ -28,11 +28,8 @@ #include #include -#include #include "wine/test.h" -#include "windef.h" -#include "wingdi.h" #include "dsound.h" #include "dxerr8.h" @@ -1130,4 +1127,6 @@ } ds3d8_tests(); + + CoUninitialize(); } diff -urN wine-20041201/dlls/dsound/tests/dsound.c wine-20050111/dlls/dsound/tests/dsound.c --- wine-20041201/dlls/dsound/tests/dsound.c 2004-10-25 23:45:51.000000000 +0200 +++ wine-20050111/dlls/dsound/tests/dsound.c 2005-01-10 13:25:56.000000000 +0100 @@ -29,12 +29,7 @@ #define NONAMELESSUNION #include -#include -#include - #include "wine/test.h" -#include "windef.h" -#include "wingdi.h" #include "dsound.h" #include "dxerr8.h" #include "dsconf.h" @@ -756,4 +751,6 @@ IDirectSound_tests(); dsound_tests(); + + CoUninitialize(); } diff -urN wine-20041201/dlls/dsound/tests/dsound8.c wine-20050111/dlls/dsound/tests/dsound8.c --- wine-20041201/dlls/dsound/tests/dsound8.c 2004-10-26 23:17:37.000000000 +0200 +++ wine-20050111/dlls/dsound/tests/dsound8.c 2005-01-10 13:25:56.000000000 +0100 @@ -29,12 +29,7 @@ #define NONAMELESSUNION #include -#include -#include - #include "wine/test.h" -#include "windef.h" -#include "wingdi.h" #include "dsound.h" #include "dxerr8.h" #include "dsconf.h" @@ -791,4 +786,6 @@ IDirectSound8_tests(); dsound8_tests(); + + CoUninitialize(); } diff -urN wine-20041201/dlls/dsound/tests/dsound_test.h wine-20050111/dlls/dsound/tests/dsound_test.h --- wine-20041201/dlls/dsound/tests/dsound_test.h 2004-10-22 21:51:54.000000000 +0200 +++ wine-20050111/dlls/dsound/tests/dsound_test.h 2004-12-13 22:19:02.000000000 +0100 @@ -52,7 +52,7 @@ extern char* wave_generate_la(WAVEFORMATEX*,double,DWORD*); -extern HWND get_hwnd(); +extern HWND get_hwnd(void); extern void init_format(WAVEFORMATEX*,int,int,int,int); extern void test_buffer(LPDIRECTSOUND,LPDIRECTSOUNDBUFFER, BOOL,BOOL,LONG,BOOL,LONG,BOOL,double,BOOL, diff -urN wine-20041201/dlls/dsound/tests/propset.c wine-20050111/dlls/dsound/tests/propset.c --- wine-20041201/dlls/dsound/tests/propset.c 2004-10-21 21:51:10.000000000 +0200 +++ wine-20050111/dlls/dsound/tests/propset.c 2005-01-10 13:25:56.000000000 +0100 @@ -23,12 +23,7 @@ #define NONAMELESSUNION #include -#include -#include - #include "wine/test.h" -#include "windef.h" -#include "wingdi.h" #include "dsound.h" #include "initguid.h" #include "dsconf.h" @@ -408,6 +403,10 @@ START_TEST(propset) { + CoInitialize(NULL); + propset_private_tests(); propset_buffer_tests(); + + CoUninitialize(); } diff -urN wine-20041201/dlls/dswave/dswave.c wine-20050111/dlls/dswave/dswave.c --- wine-20041201/dlls/dswave/dswave.c 2004-08-23 21:39:51.000000000 +0200 +++ wine-20050111/dlls/dswave/dswave.c 2005-01-09 17:42:53.000000000 +0100 @@ -484,7 +484,6 @@ } TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); } while (StreamCount < StreamSize); - break; } else { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; @@ -667,7 +666,6 @@ } TRACE_(dmfile)(": StreamCount[0] = %ld < StreamSize[0] = %ld\n", StreamCount, StreamSize); } while (StreamCount < StreamSize); - break; } else { TRACE_(dmfile)(": unexpected chunk; loading failed)\n"); liMove.QuadPart = StreamSize; @@ -715,7 +713,7 @@ obj = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectMusicWaveImpl)); if (NULL == obj) { - *ppobj = (LPVOID) NULL; + *ppobj = NULL; return E_OUTOFMEMORY; } obj->UnknownVtbl = &DirectMusicWave_Unknown_Vtbl; diff -urN wine-20041201/dlls/gdi/bitmap.c wine-20050111/dlls/gdi/bitmap.c --- wine-20041201/dlls/gdi/bitmap.c 2004-11-22 19:18:21.000000000 +0100 +++ wine-20050111/dlls/gdi/bitmap.c 2004-12-23 19:41:06.000000000 +0100 @@ -23,7 +23,7 @@ #include #include "wine/winbase16.h" -#include "wine/winuser16.h" +#include "wine/wingdi16.h" #include "gdi.h" #include "gdi_private.h" #include "wine/debug.h" @@ -532,8 +532,7 @@ if (bmp->funcs && bmp->funcs->pDeleteBitmap) bmp->funcs->pDeleteBitmap( handle ); - if( bmp->bitmap.bmBits ) - HeapFree( GetProcessHeap(), 0, bmp->bitmap.bmBits ); + HeapFree( GetProcessHeap(), 0, bmp->bitmap.bmBits ); if (bmp->dib) { diff -urN wine-20041201/dlls/gdi/dc.c wine-20050111/dlls/gdi/dc.c --- wine-20041201/dlls/gdi/dc.c 2004-11-23 13:19:24.000000000 +0100 +++ wine-20050111/dlls/gdi/dc.c 2005-01-10 13:30:18.000000000 +0100 @@ -77,6 +77,7 @@ dc->vportExtY = 1; dc->miterLimit = 10.0f; /* 10.0 is the default, from MSDN */ dc->flags = 0; + dc->layout = 0; dc->hClipRgn = 0; dc->hVisRgn = 0; dc->hPen = GetStockObject( BLACK_PEN ); @@ -290,6 +291,7 @@ TRACE("(%p): returning %p\n", hdc, handle ); newdc->flags = dc->flags | DC_SAVED; + newdc->layout = dc->layout; newdc->hPen = dc->hPen; newdc->hBrush = dc->hBrush; newdc->hFont = dc->hFont; @@ -383,6 +385,7 @@ TRACE("%p %p\n", hdc, hdcs ); dc->flags = dcs->flags & ~(DC_SAVED | DC_DIRTY); + dc->layout = dcs->layout; dc->hDevice = dcs->hDevice; dc->ROPmode = dcs->ROPmode; dc->polyFillMode = dcs->polyFillMode; @@ -651,7 +654,7 @@ RtlFreeUnicodeString(&driverW); RtlFreeUnicodeString(&deviceW); RtlFreeUnicodeString(&outputW); - if (initDataW) HeapFree(GetProcessHeap(), 0, initDataW); + HeapFree(GetProcessHeap(), 0, initDataW); return ret; } @@ -825,7 +828,7 @@ ret = ResetDCW(hdc, devmodeW); - if (devmodeW) HeapFree(GetProcessHeap(), 0, devmodeW); + HeapFree(GetProcessHeap(), 0, devmodeW); return ret; } @@ -1872,28 +1875,45 @@ * GetLayout (GDI32.@) * * Gets left->right or right->left text layout flags of a dc. - * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same * */ DWORD WINAPI GetLayout(HDC hdc) { - FIXME("(%p): stub\n", hdc); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; + DWORD layout = GDI_ERROR; + + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + layout = dc->layout; + GDI_ReleaseObj( hdc ); + } + + TRACE("hdc : %p, layout : %08lx\n", hdc, layout); + + return layout; } /*********************************************************************** * SetLayout (GDI32.@) * * Sets left->right or right->left text layout flags of a dc. - * win98 just returns 0 and sets ERROR_CALL_NOT_IMPLEMENTED so we do the same * */ DWORD WINAPI SetLayout(HDC hdc, DWORD layout) { - FIXME("(%p,%08lx): stub\n", hdc, layout); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; + DWORD oldlayout = GDI_ERROR; + + DC * dc = DC_GetDCPtr( hdc ); + if (dc) + { + oldlayout = dc->layout; + dc->layout = layout; + GDI_ReleaseObj( hdc ); + } + + TRACE("hdc : %p, old layout : %08lx, new layout : %08lx\n", hdc, oldlayout, layout); + + return oldlayout; } /*********************************************************************** diff -urN wine-20041201/dlls/gdi/driver.c wine-20050111/dlls/gdi/driver.c --- wine-20041201/dlls/gdi/driver.c 2004-11-30 22:38:59.000000000 +0100 +++ wine-20050111/dlls/gdi/driver.c 2004-12-23 19:41:06.000000000 +0100 @@ -629,7 +629,7 @@ } doc.lpszDocName = name; ret = StartDocA( hdc, &doc ); - if (name) HeapFree( GetProcessHeap(), 0, name ); + HeapFree( GetProcessHeap(), 0, name ); if (ret > 0) ret = StartPage( hdc ); return ret; } diff -urN wine-20041201/dlls/gdi/enhmetafile.c wine-20050111/dlls/gdi/enhmetafile.c --- wine-20041201/dlls/gdi/enhmetafile.c 2004-11-22 19:22:20.000000000 +0100 +++ wine-20050111/dlls/gdi/enhmetafile.c 2005-01-03 15:50:12.000000000 +0100 @@ -229,7 +229,7 @@ } else /* assume BITMAPINFOHEADER */ { - RGBQUAD *rgb = info->bmiColors; + const RGBQUAD *rgb = info->bmiColors; /* Check if the first color is black */ if ((rgb->rgbRed == 0) && (rgb->rgbGreen == 0) && @@ -1162,28 +1162,28 @@ case EMR_POLYBEZIER: { PEMRPOLYBEZIER lpPolyBez = (PEMRPOLYBEZIER)mr; - PolyBezier(hdc, (const LPPOINT)lpPolyBez->aptl, (UINT)lpPolyBez->cptl); + PolyBezier(hdc, (const POINT*)lpPolyBez->aptl, (UINT)lpPolyBez->cptl); break; } case EMR_POLYGON: { PEMRPOLYGON lpPoly = (PEMRPOLYGON)mr; - Polygon( hdc, (const LPPOINT)lpPoly->aptl, (UINT)lpPoly->cptl ); + Polygon( hdc, (const POINT*)lpPoly->aptl, (UINT)lpPoly->cptl ); break; } case EMR_POLYLINE: { PEMRPOLYLINE lpPolyLine = (PEMRPOLYLINE)mr; - Polyline(hdc, (const LPPOINT)lpPolyLine->aptl, (UINT)lpPolyLine->cptl); + Polyline(hdc, (const POINT*)lpPolyLine->aptl, (UINT)lpPolyLine->cptl); break; } case EMR_POLYBEZIERTO: { PEMRPOLYBEZIERTO lpPolyBezierTo = (PEMRPOLYBEZIERTO)mr; - PolyBezierTo( hdc, (const LPPOINT)lpPolyBezierTo->aptl, + PolyBezierTo( hdc, (const POINT*)lpPolyBezierTo->aptl, (UINT)lpPolyBezierTo->cptl ); break; } @@ -1191,7 +1191,7 @@ case EMR_POLYLINETO: { PEMRPOLYLINETO lpPolyLineTo = (PEMRPOLYLINETO)mr; - PolylineTo( hdc, (const LPPOINT)lpPolyLineTo->aptl, + PolylineTo( hdc, (const POINT*)lpPolyLineTo->aptl, (UINT)lpPolyLineTo->cptl ); break; } @@ -1478,7 +1478,7 @@ { PEMRPOLYDRAW lpPolyDraw = (PEMRPOLYDRAW)mr; PolyDraw( hdc, - (const LPPOINT)lpPolyDraw->aptl, + (const POINT*)lpPolyDraw->aptl, lpPolyDraw->abTypes, (INT)lpPolyDraw->cptl ); @@ -2357,9 +2357,10 @@ hmfDst = EMF_Create_HENHMETAFILE( emrDst, FALSE ); } else { HANDLE hFile; + DWORD w; hFile = CreateFileA( file, GENERIC_WRITE | GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, 0); - WriteFile( hFile, emrSrc, emrSrc->nBytes, 0, 0); + WriteFile( hFile, emrSrc, emrSrc->nBytes, &w, NULL); CloseHandle( hFile ); /* Reopen file for reading only, so that apps can share read access to the file while hmf is still valid */ @@ -2396,9 +2397,10 @@ hmfDst = EMF_Create_HENHMETAFILE( emrDst, FALSE ); } else { HANDLE hFile; + DWORD w; hFile = CreateFileW( file, GENERIC_WRITE | GENERIC_READ, 0, NULL, CREATE_ALWAYS, 0, 0); - WriteFile( hFile, emrSrc, emrSrc->nBytes, 0, 0); + WriteFile( hFile, emrSrc, emrSrc->nBytes, &w, NULL); CloseHandle( hFile ); /* Reopen file for reading only, so that apps can share read access to the file while hmf is still valid */ @@ -2556,7 +2558,7 @@ TRACE("mm = %ld %ldx%ld\n", lpmfp->mm, lpmfp->xExt, lpmfp->yExt); if((lpmfp->mm == MM_ISOTROPIC || lpmfp->mm == MM_ANISOTROPIC) && - mfp.xExt > 0 && mfp.yExt > 0) { + (lpmfp->xExt > 0) && (lpmfp->yExt > 0)) { rc.left = rc.top = 0; rc.right = lpmfp->xExt; rc.bottom = lpmfp->yExt; diff -urN wine-20041201/dlls/gdi/enhmfdrv/graphics.c wine-20050111/dlls/gdi/enhmfdrv/graphics.c --- wine-20041201/dlls/gdi/enhmfdrv/graphics.c 2004-11-30 22:38:59.000000000 +0100 +++ wine-20050111/dlls/gdi/enhmfdrv/graphics.c 2004-12-21 15:49:19.000000000 +0100 @@ -459,6 +459,8 @@ EMFDRV_Polygon( PHYSDEV dev, const POINT* pt, INT count ) { if(count < 2) return FALSE; + if( EMFDRV_Polylinegon16( dev, pt, count, EMR_POLYGON16 ) ) + return TRUE; return EMFDRV_Polylinegon( dev, pt, count, EMR_POLYGON ); } diff -urN wine-20041201/dlls/gdi/enhmfdrv/objects.c wine-20050111/dlls/gdi/enhmfdrv/objects.c --- wine-20041201/dlls/gdi/enhmfdrv/objects.c 2004-11-22 19:22:20.000000000 +0100 +++ wine-20050111/dlls/gdi/enhmfdrv/objects.c 2004-12-20 20:27:07.000000000 +0100 @@ -235,14 +235,14 @@ bm.bmHeight * BITMAP_GetWidthBytes(bm.bmWidth, bm.bmBitsPixel), (LPBYTE)info + sizeof(BITMAPINFOHEADER)); - /* Change the padding to DIB compatable if needed */ + /* Change the padding to be DIB compatible if needed */ if (bm.bmWidth & 31) EMFDRV_PadTo32((LPBYTE)info + sizeof(BITMAPINFOHEADER), bm.bmWidth, bm.bmHeight); emr->emr.iType = EMR_CREATEMONOBRUSH; emr->emr.nSize = size; emr->ihBrush = index = EMFDRV_AddHandle( dev, hBrush ); - /* Presumably to reduce the size of the written EMF, MS support an + /* Presumably to reduce the size of the written EMF, MS supports an * undocumented iUsage value of 2, indicating a mono bitmap without the * 8 byte 2 entry black/white palette. Stupidly, they could have saved * over 20 bytes more by also ignoring the BITMAPINFO fields that are diff -urN wine-20041201/dlls/gdi/font.c wine-20050111/dlls/gdi/font.c --- wine-20041201/dlls/gdi/font.c 2004-09-08 03:37:24.000000000 +0200 +++ wine-20050111/dlls/gdi/font.c 2005-01-05 14:24:52.000000000 +0100 @@ -126,7 +126,7 @@ */ #define FS(x) {{0,0,0,0},{0x1<<(x),0}} #define MAXTCIINDEX 32 -static CHARSETINFO FONT_tci[MAXTCIINDEX] = { +static const CHARSETINFO FONT_tci[MAXTCIINDEX] = { /* ANSI */ { ANSI_CHARSET, 1252, FS(0)}, { EASTEUROPE_CHARSET, 1250, FS(1)}, @@ -1649,6 +1649,8 @@ /*********************************************************************** * ExtTextOutA (GDI32.@) + * + * See ExtTextOutW. */ BOOL WINAPI ExtTextOutA( HDC hdc, INT x, INT y, UINT flags, const RECT *lprect, LPCSTR str, UINT count, const INT *lpDx ) @@ -1677,13 +1679,40 @@ ret = ExtTextOutW( hdc, x, y, flags, lprect, p, wlen, lpDxW ); HeapFree( GetProcessHeap(), 0, p ); - if (lpDxW) HeapFree( GetProcessHeap(), 0, lpDxW ); + HeapFree( GetProcessHeap(), 0, lpDxW ); return ret; } /*********************************************************************** * ExtTextOutW (GDI32.@) + * + * Draws text using the currently selected font, background color, and text color. + * + * + * PARAMS + * x,y [I] coordinates of string + * flags [I] + * ETO_GRAYED - undocumented on MSDN + * ETO_OPAQUE - use background color for fill the rectangle + * ETO_CLIPPED - clipping text to the rectangle + * ETO_GLYPH_INDEX - Buffer is of glyph locations in fonts rather + * than encoded characters. Implies ETO_IGNORELANGUAGE + * ETO_RTLREADING - Paragraph is basically a right-to-left paragraph. + * Affects BiDi ordering + * ETO_IGNORELANGUAGE - Undocumented in MSDN - instructs ExtTextOut not to do BiDi reordering + * ETO_PDY - unimplemented + * ETO_NUMERICSLATIN - unimplemented always assumed - + * do not translate numbers into locale representations + * ETO_NUMERICSLOCAL - unimplemented - Numerals in Arabic/Farsi context should assume local form + * lprect [I] dimensions for clipping or/and opaquing + * str [I] text string + * count [I] number of symbols in string + * lpDx [I] optional parameter with distance between drawing characters + * + * RETURNS + * Success: TRUE + * Failure: FALSE */ BOOL WINAPI ExtTextOutW( HDC hdc, INT x, INT y, UINT flags, const RECT *lprect, LPCWSTR str, UINT count, const INT *lpDx ) @@ -1692,6 +1721,9 @@ DC * dc = DC_GetDCUpdate( hdc ); if (dc) { + if (flags&(ETO_NUMERICSLOCAL|ETO_NUMERICSLATIN|ETO_PDY)) + FIXME("flags ETO_NUMERICSLOCAL|ETO_NUMERICSLATIN|ETO_PDY unimplemented\n"); + if(PATH_IsPathOpen(dc->path)) FIXME("called on an open path\n"); else if(dc->funcs->pExtTextOut) @@ -1922,8 +1954,7 @@ c = uChar; ret = GetGlyphOutlineW(hdc, c, fuFormat, lpgm, cbBuffer, lpBuffer, lpmat2); - if(p) - HeapFree(GetProcessHeap(), 0, p); + HeapFree(GetProcessHeap(), 0, p); return ret; } diff -urN wine-20041201/dlls/gdi/freetype.c wine-20050111/dlls/gdi/freetype.c --- wine-20041201/dlls/gdi/freetype.c 2004-10-18 21:38:30.000000000 +0200 +++ wine-20050111/dlls/gdi/freetype.c 2005-01-05 18:12:07.000000000 +0100 @@ -352,7 +352,7 @@ * Key Meaning * FIXEDFON.FON FixedSys * FONTS.FON System - * OEMFONT.FON Termial + * OEMFONT.FON Terminal * LogPixels Current dpi set by the display control panel applet * (HKLM\\Software\\Microsft\\Windows NT\\CurrentVersion\\FontDPI * also has a LogPixels value that appears to mirror this) @@ -1210,8 +1210,8 @@ vlen = valuelen; } } - if (data) HeapFree(GetProcessHeap(), 0, data); - if (valueW) HeapFree(GetProcessHeap(), 0, valueW); + HeapFree(GetProcessHeap(), 0, data); + HeapFree(GetProcessHeap(), 0, valueW); RegCloseKey(hkey); } @@ -1387,8 +1387,8 @@ static void free_font(GdiFont font) { if (font->ft_face) pFT_Done_Face(font->ft_face); - if (font->potm) HeapFree(GetProcessHeap(), 0, font->potm); - if (font->name) HeapFree(GetProcessHeap(), 0, font->name); + HeapFree(GetProcessHeap(), 0, font->potm); + HeapFree(GetProcessHeap(), 0, font->name); HeapFree(GetProcessHeap(), 0, font->gm); HeapFree(GetProcessHeap(), 0, font); } @@ -1464,7 +1464,7 @@ } } - if(offset < 0) { + if(offset == -1) { FIXME("No suitable ratio found\n"); return ppem; } @@ -2032,16 +2032,16 @@ if(!(ptm->tmPitchAndFamily & TMPF_VECTOR)) *ptype |= RASTER_FONTTYPE; - if(potm) { - pntm->ntmTm.ntmFlags = ptm->tmItalic ? NTM_ITALIC : 0; - if(ptm->tmWeight > 550) pntm->ntmTm.ntmFlags |= NTM_BOLD; - if(pntm->ntmTm.ntmFlags == 0) pntm->ntmTm.ntmFlags = NTM_REGULAR; + pntm->ntmTm.ntmFlags = ptm->tmItalic ? NTM_ITALIC : 0; + if(ptm->tmWeight > 550) pntm->ntmTm.ntmFlags |= NTM_BOLD; + if(pntm->ntmTm.ntmFlags == 0) pntm->ntmTm.ntmFlags = NTM_REGULAR; + + pntm->ntmTm.ntmCellHeight = pntm->ntmTm.tmHeight; + pntm->ntmTm.ntmAvgWidth = pntm->ntmTm.tmAveCharWidth; + memset(&pntm->ntmFontSig, 0, sizeof(FONTSIGNATURE)); + if(potm) { pntm->ntmTm.ntmSizeEM = potm->otmEMSquare; - pntm->ntmTm.ntmCellHeight = 0; - pntm->ntmTm.ntmAvgWidth = 0; - - memset(&pntm->ntmFontSig, 0, sizeof(FONTSIGNATURE)); strncpyW(pelf->elfLogFont.lfFaceName, (WCHAR*)((char*)potm + (ptrdiff_t)potm->otmpFamilyName), @@ -2053,7 +2053,10 @@ (WCHAR*)((char*)potm + (ptrdiff_t)potm->otmpStyleName), LF_FACESIZE); + HeapFree(GetProcessHeap(), 0, potm); } else { + pntm->ntmTm.ntmSizeEM = pntm->ntmTm.tmHeight - pntm->ntmTm.tmInternalLeading; + strncpyW(pelf->elfLogFont.lfFaceName, face->family->FamilyName, LF_FACESIZE); strncpyW(pelf->elfFullName, face->family->FamilyName, LF_FACESIZE); pelf->elfStyle[0] = '\0'; @@ -2061,9 +2064,7 @@ pelf->elfScript[0] = '\0'; /* This will get set in WineEngEnumFonts */ - HeapFree(GetProcessHeap(), 0, potm); free_font(font); - return; } /************************************************************* diff -urN wine-20041201/dlls/gdi/gdi16.c wine-20050111/dlls/gdi/gdi16.c --- wine-20041201/dlls/gdi/gdi16.c 2004-08-31 02:02:03.000000000 +0200 +++ wine-20050111/dlls/gdi/gdi16.c 2004-12-23 19:41:06.000000000 +0100 @@ -1870,7 +1870,7 @@ rect32.bottom = lprect->bottom; } ret = ExtTextOutA(HDC_32(hdc),x,y,flags,lprect?&rect32:NULL,str,count,lpdx32); - if (lpdx32) HeapFree( GetProcessHeap(), 0, lpdx32 ); + HeapFree( GetProcessHeap(), 0, lpdx32 ); return ret; } diff -urN wine-20041201/dlls/gdi/gdi32.spec wine-20050111/dlls/gdi/gdi32.spec --- wine-20041201/dlls/gdi/gdi32.spec 2004-04-14 21:35:25.000000000 +0200 +++ wine-20050111/dlls/gdi/gdi32.spec 2005-01-03 15:33:07.000000000 +0100 @@ -226,14 +226,14 @@ @ stdcall GetGlyphOutlineW(long long long ptr long ptr ptr) @ stub GetGlyphOutlineWow @ stdcall GetGraphicsMode(long) -@ stdcall GetICMProfileA(long ptr ptr) -@ stub GetICMProfileW +@ stdcall GetICMProfileA(long ptr str) +@ stdcall GetICMProfileW(long ptr wstr) @ stub GetKerningPairs @ stdcall GetKerningPairsA(long long ptr) @ stdcall GetKerningPairsW(long long ptr) @ stdcall GetLayout(long) -@ stub GetLogColorSpaceA -@ stub GetLogColorSpaceW +@ stdcall GetLogColorSpaceA(long ptr long) +@ stdcall GetLogColorSpaceW(long ptr long) @ stdcall GetMapMode(long) @ stdcall GetMetaFileA(str) @ stdcall GetMetaFileBitsEx(long long ptr) @@ -363,8 +363,8 @@ @ stub SetFontEnumeration @ stdcall SetGraphicsMode(long long) @ stdcall SetICMMode(long long) -@ stdcall SetICMProfileA (long ptr) -@ stub SetICMProfileW +@ stdcall SetICMProfileA(long str) +@ stdcall SetICMProfileW(long wstr) @ stdcall SetLayout(long long) @ stub SetMagicColors @ stdcall SetMapMode(long long) @@ -408,9 +408,9 @@ @ stub UnloadNetworkFonts @ stdcall UnrealizeObject(long) @ stdcall UpdateColors(long) -@ stub UpdateICMRegKey -@ stub UpdateICMRegKeyA -@ stub UpdateICMRegKeyW +@ stdcall UpdateICMRegKey(long str str long) UpdateICMRegKeyA +@ stdcall UpdateICMRegKeyA(long str str long) +@ stdcall UpdateICMRegKeyW(long wstr wstr long) @ stdcall WidenPath(long) @ stub gdiPlaySpoolStream @ extern pfnRealizePalette @@ -425,14 +425,10 @@ @ stdcall DeleteMetaFile16(long) @ stdcall DrvGetPrinterData16(str str ptr ptr long ptr) @ stdcall DrvSetPrinterData16(str str long ptr long) -@ stdcall ExcludeVisRect16(long long long long long) @ stdcall GetDCState16(long) -@ stdcall IntersectVisRect16(long long long long long) -@ stdcall IsDCCurrentPalette16(long) @ stdcall OpenJob16(str str long) @ stdcall SelectVisRgn16(long long) @ stdcall SetDCHook(long ptr long) -@ stdcall SetDCOrg16(long long long) @ stdcall SetDCState16(long long) @ stdcall SetHookFlags16(long long) @ stdcall WriteSpool16(long ptr long) diff -urN wine-20041201/dlls/gdi/gdi_private.h wine-20050111/dlls/gdi/gdi_private.h --- wine-20041201/dlls/gdi/gdi_private.h 2004-11-23 13:19:24.000000000 +0100 +++ wine-20050111/dlls/gdi/gdi_private.h 2005-01-10 13:30:18.000000000 +0100 @@ -162,7 +162,7 @@ INT (*pSetWindowExt)(PHYSDEV,INT,INT); INT (*pSetWindowOrg)(PHYSDEV,INT,INT); BOOL (*pSetWorldTransform)(PHYSDEV,const XFORM*); - INT (*pStartDoc)(PHYSDEV,const DOCINFOA*); + INT (*pStartDoc)(PHYSDEV,const DOCINFOW*); INT (*pStartPage)(PHYSDEV); BOOL (*pStretchBlt)(PHYSDEV,INT,INT,INT,INT,PHYSDEV,INT,INT,INT,INT,DWORD); INT (*pStretchDIBits)(PHYSDEV,INT,INT,INT,INT,INT,INT,INT,INT,const void *, @@ -218,6 +218,7 @@ FLOAT miterLimit; int flags; + DWORD layout; HRGN hClipRgn; /* Clip region (may be 0) */ HRGN hVisRgn; /* Visible region (must never be 0) */ HPEN hPen; diff -urN wine-20041201/dlls/gdi/gdiobj.c wine-20050111/dlls/gdi/gdiobj.c --- wine-20041201/dlls/gdi/gdiobj.c 2004-11-23 13:19:24.000000000 +0100 +++ wine-20050111/dlls/gdi/gdiobj.c 2005-01-05 18:12:07.000000000 +0100 @@ -122,9 +122,9 @@ */ /* - * language-dependenet stock fonts for all known charsets - * please see TranslateCharsetInfo (objects/font.c) and - * CharsetBindingInfo (graphics/x11drv/xfont.c), + * language-dependent stock fonts for all known charsets + * please see TranslateCharsetInfo (dlls/gdi/font.c) and + * CharsetBindingInfo (dlls/x11drv/xfont.c), * and modify entries for your language if needed. */ struct DefaultFontInfo diff -urN wine-20041201/dlls/gdi/icm.c wine-20050111/dlls/gdi/icm.c --- wine-20041201/dlls/gdi/icm.c 2004-01-13 06:20:17.000000000 +0100 +++ wine-20050111/dlls/gdi/icm.c 2004-12-16 15:35:55.000000000 +0100 @@ -24,7 +24,6 @@ #include #include "windef.h" #include "winbase.h" -#include "winreg.h" #include "wingdi.h" #include "wine/debug.h" diff -urN wine-20041201/dlls/gdi/metafile.c wine-20050111/dlls/gdi/metafile.c --- wine-20041201/dlls/gdi/metafile.c 2004-07-21 06:07:28.000000000 +0200 +++ wine-20050111/dlls/gdi/metafile.c 2004-12-23 19:41:06.000000000 +0100 @@ -411,12 +411,13 @@ MF_ReleaseMetaHeader16( hSrcMetaFile ); if(lpFilename) { /* disk based metafile */ + DWORD w; if((hFile = CreateFileA(lpFilename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) { HeapFree( GetProcessHeap(), 0, mh2 ); return 0; } - WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL); + WriteFile(hFile, mh2, mh2->mtSize * 2, &w, NULL); CloseHandle(hFile); mh2 = MF_CreateMetaHeaderDisk(mh2, lpFilename, FALSE); } @@ -460,12 +461,13 @@ } if(lpFilename) { /* disk based metafile */ + DWORD w; if((hFile = CreateFileW(lpFilename, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0)) == INVALID_HANDLE_VALUE) { HeapFree( GetProcessHeap(), 0, mh2 ); return 0; } - WriteFile(hFile, mh2, mh2->mtSize * 2, NULL, NULL); + WriteFile(hFile, mh2, mh2->mtSize * 2, &w, NULL); CloseHandle(hFile); mh2 = MF_CreateMetaHeaderDisk(mh2, lpFilename, TRUE); } @@ -792,7 +794,7 @@ /* free handle table */ HeapFree( GetProcessHeap(), 0, ht); /* free a copy of metafile */ - if (mhTemp) HeapFree( GetProcessHeap(), 0, mhTemp ); + HeapFree( GetProcessHeap(), 0, mhTemp ); return result; } diff -urN wine-20041201/dlls/gdi/mfdrv/init.c wine-20050111/dlls/gdi/mfdrv/init.c --- wine-20041201/dlls/gdi/mfdrv/init.c 2004-08-02 20:54:54.000000000 +0200 +++ wine-20050111/dlls/gdi/mfdrv/init.c 2004-12-23 19:41:05.000000000 +0100 @@ -210,7 +210,7 @@ DC *dc = physDev->dc; DWORD index; - if (physDev->mh) HeapFree( GetProcessHeap(), 0, physDev->mh ); + HeapFree( GetProcessHeap(), 0, physDev->mh ); for(index = 0; index < physDev->handles_size; index++) if(physDev->handles[index]) GDI_hdc_not_using_object(physDev->handles[index], physDev->hdc); diff -urN wine-20041201/dlls/gdi/mfdrv/text.c wine-20050111/dlls/gdi/mfdrv/text.c --- wine-20041201/dlls/gdi/mfdrv/text.c 2004-09-08 03:37:24.000000000 +0200 +++ wine-20050111/dlls/gdi/mfdrv/text.c 2004-12-23 19:41:05.000000000 +0100 @@ -150,6 +150,6 @@ ret = MFDRV_MetaExtTextOut(dev,x,y,flags,lprect?&rect16:NULL,ascii,len,lpdx16); HeapFree( GetProcessHeap(), 0, ascii ); - if (lpdx16) HeapFree( GetProcessHeap(), 0, lpdx16 ); + HeapFree( GetProcessHeap(), 0, lpdx16 ); return ret; } diff -urN wine-20041201/dlls/gdi/palette.c wine-20050111/dlls/gdi/palette.c --- wine-20041201/dlls/gdi/palette.c 2004-10-18 23:18:58.000000000 +0200 +++ wine-20050111/dlls/gdi/palette.c 2005-01-03 15:33:07.000000000 +0100 @@ -696,11 +696,9 @@ { PALETTEOBJ *palette = obj; - if (palette->mapping) - { - HeapFree( GetProcessHeap(), 0, palette->mapping ); - palette->mapping = NULL; - } + HeapFree( GetProcessHeap(), 0, palette->mapping ); + palette->mapping = NULL; + if (hLastRealizedPalette == handle) { TRACE("unrealizing palette %p\n", handle); @@ -929,38 +927,84 @@ * How does Windows assign these? Some registry key? */ -#define WINEICM "winefake.icm" /* easy-to-identify fake filename */ /*********************************************************************/ BOOL WINAPI GetICMProfileA(HDC hDC, LPDWORD lpcbName, LPSTR lpszFilename) { DWORD callerLen; + static const char icm[] = "winefake.icm"; FIXME("(%p, %p, %p): partial stub\n", hDC, lpcbName, lpszFilename); callerLen = *lpcbName; /* all 3 behaviors require the required buffer size to be set */ - *lpcbName = strlen(WINEICM); + *lpcbName = sizeof(icm); /* behavior 1: if lpszFilename is NULL, return size of string and no error */ - if ((DWORD)lpszFilename == (DWORD)0x00000000) - return TRUE; + if (!lpszFilename) return TRUE; /* behavior 2: if buffer size too small, return size of string and error */ - if (callerLen < strlen(WINEICM)) + if (callerLen < sizeof(icm)) { SetLastError(ERROR_INSUFFICIENT_BUFFER); return FALSE; } /* behavior 3: if buffer size OK and pointer not NULL, copy and return size */ - strcpy(lpszFilename, WINEICM); + memcpy(lpszFilename, icm, sizeof(icm)); + return TRUE; +} + +BOOL WINAPI GetICMProfileW(HDC hDC, LPDWORD lpcbName, LPWSTR lpszFilename) +{ + DWORD callerLen; + static const WCHAR icm[] = { 'w','i','n','e','f','a','k','e','.','i','c','m', 0 }; + + FIXME("(%p, %p, %p): partial stub\n", hDC, lpcbName, lpszFilename); + + callerLen = *lpcbName; + + /* all 3 behaviors require the required buffer size to be set */ + *lpcbName = sizeof(icm) / sizeof(WCHAR); + + /* behavior 1: if lpszFilename is NULL, return size of string and no error */ + if (!lpszFilename) return TRUE; + + /* behavior 2: if buffer size too small, return size of string and error */ + if (callerLen < sizeof(icm)/sizeof(WCHAR)) + { + SetLastError(ERROR_INSUFFICIENT_BUFFER); + return FALSE; + } + + /* behavior 3: if buffer size OK and pointer not NULL, copy and return size */ + memcpy(lpszFilename, icm, sizeof(icm)); return TRUE; } /********************************************************************** + * GetLogColorSpaceA [GDI32.@] + * + */ +BOOL WINAPI GetLogColorSpaceA(HCOLORSPACE hColorSpace, LPLOGCOLORSPACEA lpBuffer, DWORD nSize) +{ + FIXME("%p %p 0x%08lx: stub!\n", hColorSpace, lpBuffer, nSize); + return FALSE; +} + +/********************************************************************** + * GetLogColorSpaceW [GDI32.@] + * + */ +BOOL WINAPI GetLogColorSpaceW(HCOLORSPACE hColorSpace, LPLOGCOLORSPACEW lpBuffer, DWORD nSize) +{ + FIXME("%p %p 0x%08lx: stub!\n", hColorSpace, lpBuffer, nSize); + return FALSE; +} + +/********************************************************************** * SetICMProfileA [GDI32.@] * */ @@ -969,3 +1013,35 @@ FIXME("hDC %p filename '%s': stub!\n", hDC, debugstr_a(lpszFilename)); return TRUE; /* success */ } + +/********************************************************************** + * SetICMProfileA [GDI32.@] + * + */ +BOOL WINAPI SetICMProfileW(HDC hDC, LPWSTR lpszFilename) +{ + FIXME("hDC %p filename '%s': stub!\n", hDC, debugstr_w(lpszFilename)); + return TRUE; /* success */ +} + +/********************************************************************** + * UpdateICMRegKeyA [GDI32.@] + * + */ +BOOL WINAPI UpdateICMRegKeyA(DWORD dwReserved, LPSTR lpszCMID, LPSTR lpszFileName, UINT nCommand) +{ + FIXME("(0x%08lx, %s, %s, 0x%08x): stub!\n", dwReserved, debugstr_a(lpszCMID), + debugstr_a(lpszFileName), nCommand); + return TRUE; /* success */ +} + +/********************************************************************** + * UpdateICMRegKeyW [GDI32.@] + * + */ +BOOL WINAPI UpdateICMRegKeyW(DWORD dwReserved, LPWSTR lpszCMID, LPWSTR lpszFileName, UINT nCommand) +{ + FIXME("(0x%08lx, %s, %s, 0x%08x): stub!\n", dwReserved, debugstr_w(lpszCMID), + debugstr_w(lpszFileName), nCommand); + return TRUE; /* success */ +} diff -urN wine-20041201/dlls/gdi/path.c wine-20050111/dlls/gdi/path.c --- wine-20041201/dlls/gdi/path.c 2004-09-08 03:37:24.000000000 +0200 +++ wine-20050111/dlls/gdi/path.c 2004-12-23 19:41:06.000000000 +0100 @@ -500,8 +500,8 @@ { assert(pPath!=NULL); - if (pPath->pPoints) HeapFree( GetProcessHeap(), 0, pPath->pPoints ); - if (pPath->pFlags) HeapFree( GetProcessHeap(), 0, pPath->pFlags ); + HeapFree( GetProcessHeap(), 0, pPath->pPoints ); + HeapFree( GetProcessHeap(), 0, pPath->pFlags ); } /* PATH_AssignGdiPath diff -urN wine-20041201/dlls/gdi/printdrv.c wine-20050111/dlls/gdi/printdrv.c --- wine-20041201/dlls/gdi/printdrv.c 2004-10-14 05:08:57.000000000 +0200 +++ wine-20050111/dlls/gdi/printdrv.c 2005-01-04 21:39:19.000000000 +0100 @@ -50,7 +50,6 @@ #include "wine/debug.h" #include "gdi.h" #include "gdi_private.h" -#include "heap.h" WINE_DEFAULT_DEBUG_CHANNEL(print); @@ -70,13 +69,14 @@ * * Note: we now do it the other way, with the STARTDOC Escape calling StartDoc. */ -INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc) +INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc) { INT ret = 0; DC *dc = DC_GetDCPtr( hdc ); - TRACE("DocName = '%s' Output = '%s' Datatype = '%s'\n", - doc->lpszDocName, doc->lpszOutput, doc->lpszDatatype); + TRACE("DocName = %s Output = %s Datatype = %s\n", + debugstr_w(doc->lpszDocName), debugstr_w(doc->lpszOutput), + debugstr_w(doc->lpszDatatype)); if(!dc) return SP_ERROR; @@ -86,31 +86,45 @@ } /************************************************************************* - * StartDocW [GDI32.@] + * StartDocA [GDI32.@] * */ -INT WINAPI StartDocW(HDC hdc, const DOCINFOW* doc) +INT WINAPI StartDocA(HDC hdc, const DOCINFOA* doc) { - DOCINFOA docA; - INT ret; + LPWSTR szDocName = NULL, szOutput = NULL, szDatatype = NULL; + DOCINFOW docW; + INT ret, len; + + docW.cbSize = doc->cbSize; + if (doc->lpszDocName) + { + len = MultiByteToWideChar(CP_ACP,0,doc->lpszDocName,-1,NULL,0); + szDocName = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP,0,doc->lpszDocName,-1,szDocName,len); + } + if (doc->lpszOutput) + { + len = MultiByteToWideChar(CP_ACP,0,doc->lpszOutput,-1,NULL,0); + szOutput = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP,0,doc->lpszOutput,-1,szOutput,len); + } + if (doc->lpszDatatype) + { + len = MultiByteToWideChar(CP_ACP,0,doc->lpszDatatype,-1,NULL,0); + szDatatype = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR)); + MultiByteToWideChar(CP_ACP,0,doc->lpszDatatype,-1,szDatatype,len); + } + + docW.lpszDocName = szDocName; + docW.lpszOutput = szOutput; + docW.lpszDatatype = szDatatype; + docW.fwType = doc->fwType; + + ret = StartDocW(hdc, &docW); - docA.cbSize = doc->cbSize; - docA.lpszDocName = doc->lpszDocName ? - HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszDocName ) : NULL; - docA.lpszOutput = doc->lpszOutput ? - HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszOutput ) : NULL; - docA.lpszDatatype = doc->lpszDatatype ? - HEAP_strdupWtoA( GetProcessHeap(), 0, doc->lpszDatatype ) : NULL; - docA.fwType = doc->fwType; - - ret = StartDocA(hdc, &docA); - - if(docA.lpszDocName) - HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDocName ); - if(docA.lpszOutput) - HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszOutput ); - if(docA.lpszDatatype) - HeapFree( GetProcessHeap(), 0, (LPSTR)docA.lpszDatatype ); + HeapFree( GetProcessHeap(), 0, szDocName ); + HeapFree( GetProcessHeap(), 0, szOutput ); + HeapFree( GetProcessHeap(), 0, szDatatype ); return ret; } diff -urN wine-20041201/dlls/gdi/region.c wine-20050111/dlls/gdi/region.c --- wine-20041201/dlls/gdi/region.c 2004-07-21 06:07:28.000000000 +0200 +++ wine-20050111/dlls/gdi/region.c 2004-12-14 12:38:50.000000000 +0100 @@ -2803,6 +2803,7 @@ tmpPtBlock = HeapAlloc( GetProcessHeap(), 0, sizeof(POINTBLOCK)); if(!tmpPtBlock) { WARN("Can't alloc tPB\n"); + HeapFree( GetProcessHeap(), 0, pETEs ); return 0; } curPtBlock->next = tmpPtBlock; @@ -2855,6 +2856,7 @@ if(!tmpPtBlock) { WARN("Can't alloc tPB\n"); REGION_DeleteObject( hrgn, obj ); + HeapFree( GetProcessHeap(), 0, pETEs ); return 0; } curPtBlock->next = tmpPtBlock; diff -urN wine-20041201/dlls/gdi/tests/brush.c wine-20050111/dlls/gdi/tests/brush.c --- wine-20041201/dlls/gdi/tests/brush.c 2004-11-24 19:09:20.000000000 +0100 +++ wine-20050111/dlls/gdi/tests/brush.c 2004-12-27 18:46:36.000000000 +0100 @@ -45,6 +45,7 @@ HBRUSH stockBrush; LOGBRUSH br; size_t i; + INT ret; for(i=0; i +#include #include "wine/test.h" #include "winbase.h" @@ -37,6 +38,7 @@ const INT *dx; INT *orig_dx = (INT *)param; LOGFONTA device_lf; + INT ret; trace("hdc %p, emr->iType %ld, emr->nSize %ld, param %p\n", hdc, emr->iType, emr->nSize, (void *)param); @@ -54,8 +56,8 @@ const EMREXTTEXTOUTA *emr_ExtTextOutA = (const EMREXTTEXTOUTA *)emr; dx = (const INT *)((const char *)emr + emr_ExtTextOutA->emrtext.offDx); - ok(GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf) == sizeof(device_lf), - "GetObjectA error %ld\n", GetLastError()); + ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf); + ok( ret == sizeof(device_lf), "GetObjectA error %ld\n", GetLastError()); /* compare up to lfOutPrecision, other values are not interesting, * and in fact sometimes arbitrary adapted by Win9x. @@ -78,8 +80,8 @@ const EMREXTTEXTOUTW *emr_ExtTextOutW = (const EMREXTTEXTOUTW *)emr; dx = (const INT *)((const char *)emr + emr_ExtTextOutW->emrtext.offDx); - ok(GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf) == sizeof(device_lf), - "GetObjectA error %ld\n", GetLastError()); + ret = GetObjectA(GetCurrentObject(hdc, OBJ_FONT), sizeof(device_lf), &device_lf); + ok( ret == sizeof(device_lf), "GetObjectA error %ld\n", GetLastError()); /* compare up to lfOutPrecision, other values are not interesting, * and in fact sometimes arbitrary adapted by Win9x. @@ -113,6 +115,7 @@ static const char text[] = "Simple text to test ExtTextOut on metafiles"; INT i, len, dx[256]; static const RECT rc = { 0, 0, 100, 100 }; + BOOL ret; assert(sizeof(dx)/sizeof(dx[0]) >= lstrlenA(text)); @@ -144,8 +147,8 @@ len = lstrlenA(text); for (i = 0; i < len; i++) { - ok(GetCharWidthA(hdcDisplay, text[i], text[i], &dx[i]), - "GetCharWidthA error %ld\n", GetLastError()); + ret = GetCharWidthA(hdcDisplay, text[i], text[i], &dx[i]); + ok( ret, "GetCharWidthA error %ld\n", GetLastError()); } hFont = SelectObject(hdcDisplay, hFont); @@ -160,36 +163,287 @@ hFont = SelectObject(hdcMetafile, hFont); /* 1. pass NULL lpDx */ - ok(ExtTextOutA(hdcMetafile, 0, 0, 0, &rc, text, lstrlenA(text), NULL), - "ExtTextOutA error %ld\n", GetLastError()); + ret = ExtTextOutA(hdcMetafile, 0, 0, 0, &rc, text, lstrlenA(text), NULL); + ok( ret, "ExtTextOutA error %ld\n", GetLastError()); /* 2. pass custom lpDx */ - ok(ExtTextOutA(hdcMetafile, 0, 20, 0, &rc, text, lstrlenA(text), dx), - "ExtTextOutA error %ld\n", GetLastError()); + ret = ExtTextOutA(hdcMetafile, 0, 20, 0, &rc, text, lstrlenA(text), dx); + ok( ret, "ExtTextOutA error %ld\n", GetLastError()); hFont = SelectObject(hdcMetafile, hFont); - ok(DeleteObject(hFont), "DeleteObject error %ld\n", GetLastError()); + ret = DeleteObject(hFont); + ok( ret, "DeleteObject error %ld\n", GetLastError()); hMetafile = CloseEnhMetaFile(hdcMetafile); ok(hMetafile != 0, "CloseEnhMetaFile error %ld\n", GetLastError()); ok(!GetObjectType(hdcMetafile), "CloseEnhMetaFile has to destroy metafile hdc\n"); - ok(PlayEnhMetaFile(hdcDisplay, hMetafile, &rc), "PlayEnhMetaFile error %ld\n", GetLastError()); + ret = PlayEnhMetaFile(hdcDisplay, hMetafile, &rc); + ok( ret, "PlayEnhMetaFile error %ld\n", GetLastError()); - ok(EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, &rc), - "EnumEnhMetaFile error %ld\n", GetLastError()); + ret = EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, &rc); + ok( ret, "EnumEnhMetaFile error %ld\n", GetLastError()); ok(emr_processed, "EnumEnhMetaFile couldn't find EMR_EXTTEXTOUTA or EMR_EXTTEXTOUTW record\n"); ok(!EnumEnhMetaFile(hdcDisplay, hMetafile, emf_enum_proc, dx, NULL), "A valid hdc has to require a valid rc\n"); - ok(DeleteEnhMetaFile(hMetafile), "DeleteEnhMetaFile error %ld\n", GetLastError()); - ok(ReleaseDC(hwnd, hdcDisplay), "ReleaseDC error %ld\n", GetLastError()); + ret = DeleteEnhMetaFile(hMetafile); + ok( ret, "DeleteEnhMetaFile error %ld\n", GetLastError()); + ret = ReleaseDC(hwnd, hdcDisplay); + ok( ret, "ReleaseDC error %ld\n", GetLastError()); +} + +/* Win-format metafile (mfdrv) tests */ +/* These tests compare the generated metafiles byte-by-byte */ +/* with the nominal results. */ + +/* Maximum size of sample metafiles in bytes. */ +#define MF_BUFSIZE 256 + +/* 8x8 bitmap data for a pattern brush */ +static const unsigned char SAMPLE_PATTERN_BRUSH[] = { + 0x01, 0x00, 0x02, 0x00, + 0x03, 0x00, 0x04, 0x00, + 0x05, 0x00, 0x06, 0x00, + 0x07, 0x00, 0x08, 0x00 +}; + +/* Sample metafiles to be compared to the outputs of the + * test functions. + */ + +static const unsigned char MF_BLANK_BITS[] = { + 0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x0c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, +}; + +static const unsigned char MF_GRAPHICS_BITS[] = { + 0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x22, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x05, 0x00, 0x00, 0x00, 0x14, 0x02, + 0x01, 0x00, 0x01, 0x00, 0x05, 0x00, 0x00, 0x00, + 0x13, 0x02, 0x02, 0x00, 0x02, 0x00, 0x05, 0x00, + 0x00, 0x00, 0x14, 0x02, 0x01, 0x00, 0x01, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x18, 0x04, 0x02, 0x00, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, + 0x00, 0x00, 0x00, 0x00 +}; + +static const unsigned char MF_PATTERN_BRUSH_BITS[] = { + 0x01, 0x00, 0x09, 0x00, 0x00, 0x03, 0x3d, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x2d, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x2d, 0x00, 0x00, 0x00, 0x42, 0x01, + 0x03, 0x00, 0x00, 0x00, 0x28, 0x00, 0x00, 0x00, + 0x08, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0xff, 0xff, 0xff, 0x00, 0x08, 0x00, 0x00, 0x00, + 0x07, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, + 0x05, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x03, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, + 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, + 0x2d, 0x01, 0x00, 0x00, 0x03, 0x00, 0x00, 0x00, + 0x00, 0x00 +}; + +/* For debugging or dumping the raw metafiles produced by + * new test functions. + */ + +static void dump_mf_bits (const HMETAFILE mf, const char *desc) +{ + char buf[MF_BUFSIZE]; + UINT mfsize; + int i; + + mfsize = GetMetaFileBitsEx (mf, MF_BUFSIZE, buf); + ok (mfsize > 0, "%s: GetMetaFileBitsEx failed.\n", desc); + + printf ("MetaFile %s has bits:\n{\n ", desc); + for (i=0; i 0, "%s: GetMetaFileBitsEx failed.\n", desc); + if (mfsize < MF_BUFSIZE) + ok (mfsize == bsize, "%s: mfsize=%d, bsize=%d.\n", + desc, mfsize, bsize); + else + ok (bsize >= MF_BUFSIZE, "%s: mfsize > bufsize (%d bytes), bsize=%d.\n", + desc, mfsize, bsize); + if (mfsize != bsize) + return -1; + + diff = 0; + for (i=0; ilbStyle = BS_PATTERN; + orig_lb->lbColor = RGB(0, 0, 0); + orig_lb->lbHatch = (INT) CreateBitmap (8, 8, 1, 1, SAMPLE_PATTERN_BRUSH); + ok((HBITMAP *)orig_lb->lbHatch != NULL, "CreateBitmap error %ld.\n", GetLastError()); + + hBrush = CreateBrushIndirect (orig_lb); + ok(hBrush != 0, "CreateBrushIndirect error %ld\n", GetLastError()); + + hdcMetafile = CreateMetaFileA(NULL); + ok(hdcMetafile != 0, "CreateMetaFileA error %ld\n", GetLastError()); + trace("hdcMetafile %p\n", hdcMetafile); + + hBrush = SelectObject(hdcMetafile, hBrush); + ok(hBrush != 0, "SelectObject error %ld.\n", GetLastError()); + + hMetafile = CloseMetaFile(hdcMetafile); + ok(hMetafile != 0, "CloseMetaFile error %ld\n", GetLastError()); + ok(!GetObjectType(hdcMetafile), "CloseMetaFile has to destroy metafile hdc\n"); + + if (compare_mf_bits (hMetafile, MF_PATTERN_BRUSH_BITS, sizeof(MF_PATTERN_BRUSH_BITS), + "mf_Pattern_Brush") != 0) + dump_mf_bits (hMetafile, "mf_Pattern_Brush"); + + ret = DeleteMetaFile(hMetafile); + ok( ret, "DeleteMetaFile error %ld\n", GetLastError()); + ret = DeleteObject(hBrush); + ok( ret, "DeleteObject(HBRUSH) error %ld\n", GetLastError()); + ret = DeleteObject((HBITMAP *)orig_lb->lbHatch); + ok( ret, "DeleteObject(HBITMAP) error %ld\n", + GetLastError()); + HeapFree (GetProcessHeap(), 0, orig_lb); } START_TEST(metafile) { + /* For enhanced metafiles (enhmfdrv) */ test_ExtTextOut(); + + /* For win-format metafiles (mfdrv) */ + test_mf_Blank(); + test_mf_Graphics(); + + /* Crashes under wine: */ + /* test_mf_PatternBrush(); */ + } diff -urN wine-20041201/dlls/gdi/wing.c wine-20050111/dlls/gdi/wing.c --- wine-20041201/dlls/gdi/wing.c 2004-09-14 01:22:30.000000000 +0200 +++ wine-20050111/dlls/gdi/wing.c 2004-12-16 15:35:55.000000000 +0100 @@ -23,7 +23,7 @@ #include "windef.h" #include "wownt32.h" #include "gdi.h" -#include "wine/winuser16.h" +#include "wine/wingdi16.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(wing); diff -urN wine-20041201/dlls/glu32/glu.c wine-20050111/dlls/glu32/glu.c --- wine-20041201/dlls/glu32/glu.c 2003-11-11 01:30:10.000000000 +0100 +++ wine-20050111/dlls/glu32/glu.c 2004-12-13 22:19:02.000000000 +0100 @@ -146,8 +146,8 @@ /*********************************************************************** * gluNewQuadric (GLU32.@) */ -extern int gluNewQuadric(); -int WINAPI wine_gluNewQuadric() { +extern int gluNewQuadric(void); +int WINAPI wine_gluNewQuadric(void) { return gluNewQuadric(); } @@ -234,8 +234,8 @@ /*********************************************************************** * gluNewNurbsRenderer (GLU32.@) */ -extern int gluNewNurbsRenderer(); -int WINAPI wine_gluNewNurbsRenderer() { +extern int gluNewNurbsRenderer(void); +int WINAPI wine_gluNewNurbsRenderer(void) { return gluNewNurbsRenderer(); } diff -urN wine-20041201/dlls/imm32/imm.c wine-20050111/dlls/imm32/imm.c --- wine-20041201/dlls/imm32/imm.c 2004-11-30 22:38:59.000000000 +0100 +++ wine-20050111/dlls/imm32/imm.c 2004-12-23 19:41:05.000000000 +0100 @@ -1282,11 +1282,8 @@ rc = ImmSetCompositionStringW(hIMC, dwIndex, CompBuffer, comp_len, ReadBuffer, read_len); - if (CompBuffer) - HeapFree(GetProcessHeap(), 0, CompBuffer); - - if (ReadBuffer) - HeapFree(GetProcessHeap(), 0, ReadBuffer); + HeapFree(GetProcessHeap(), 0, CompBuffer); + HeapFree(GetProcessHeap(), 0, ReadBuffer); return rc; } diff -urN wine-20041201/dlls/iphlpapi/ifenum.c wine-20050111/dlls/iphlpapi/ifenum.c --- wine-20041201/dlls/iphlpapi/ifenum.c 2004-09-08 03:37:24.000000000 +0200 +++ wine-20050111/dlls/iphlpapi/ifenum.c 2004-12-23 19:41:05.000000000 +0100 @@ -33,7 +33,6 @@ * than my current mess would probably be better. * FIXME: * - I don't support IPv6 addresses here, since SIOCGIFCONF can't return them - * - the memory interface uses malloc/free; it should be using HeapAlloc instead * * There are three implemened methods for determining the MAC address of an * interface: @@ -153,10 +152,8 @@ void interfaceMapFree(void) { DeleteCriticalSection(&mapCS); - if (gNonLoopbackInterfaceMap) - free(gNonLoopbackInterfaceMap); - if (gLoopbackInterfaceMap) - free(gLoopbackInterfaceMap); + HeapFree(GetProcessHeap(), 0, gNonLoopbackInterfaceMap); + HeapFree(GetProcessHeap(), 0, gLoopbackInterfaceMap); } /* Sizes the passed-in map to have enough space for numInterfaces interfaces. @@ -168,14 +165,16 @@ { if (!map) { numInterfaces = max(numInterfaces, INITIAL_INTERFACES_ASSUMED); - map = (InterfaceNameMap *)calloc(1, sizeof(InterfaceNameMap) + + map = (InterfaceNameMap *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(InterfaceNameMap) + (numInterfaces - 1) * sizeof(InterfaceNameMapEntry)); if (map) map->numAllocated = numInterfaces; } else { if (map->numAllocated < numInterfaces) { - map = (InterfaceNameMap *)realloc(map, sizeof(InterfaceNameMap) + + map = (InterfaceNameMap *)HeapReAlloc(GetProcessHeap(), 0, map, + sizeof(InterfaceNameMap) + (numInterfaces - 1) * sizeof(InterfaceNameMapEntry)); if (map) memset(&map->table[map->numAllocated], 0, @@ -320,10 +319,9 @@ guessedNumInterfaces = INITIAL_INTERFACES_ASSUMED; else guessedNumInterfaces *= 2; - if (ifc.ifc_buf) - free(ifc.ifc_buf); + HeapFree(GetProcessHeap(), 0, ifc.ifc_buf); ifc.ifc_len = sizeof(struct ifreq) * guessedNumInterfaces; - ifc.ifc_buf = (char *)malloc(ifc.ifc_len); + ifc.ifc_buf = (char *)HeapAlloc(GetProcessHeap(), 0, ifc.ifc_len); ret = ioctl(fd, SIOCGIFCONF, &ifc); } while (ret == 0 && ifc.ifc_len == (sizeof(struct ifreq) * guessedNumInterfaces)); @@ -335,8 +333,7 @@ LeaveCriticalSection(&mapCS); } - if (ifc.ifc_buf) - free(ifc.ifc_buf); + HeapFree(GetProcessHeap(), 0, ifc.ifc_buf); close(fd); } } @@ -432,7 +429,7 @@ EnterCriticalSection(&mapCS); numInterfaces = getNumInterfaces(); - ret = (InterfaceIndexTable *)calloc(1, + ret = (InterfaceIndexTable *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(InterfaceIndexTable) + (numInterfaces - 1) * sizeof(DWORD)); if (ret) { ret->numAllocated = numInterfaces; @@ -450,7 +447,7 @@ EnterCriticalSection(&mapCS); numInterfaces = getNumNonLoopbackInterfaces(); - ret = (InterfaceIndexTable *)calloc(1, + ret = (InterfaceIndexTable *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(InterfaceIndexTable) + (numInterfaces - 1) * sizeof(DWORD)); if (ret) { ret->numAllocated = numInterfaces; @@ -719,12 +716,12 @@ if (sysctl(mib, 6, NULL, &mibLen, NULL, 0) < 0) return ERROR_NO_MORE_FILES; - buf = (u_char *)malloc(mibLen); + buf = (u_char *)HeapAlloc(GetProcessHeap(), 0, mibLen); if (!buf) return ERROR_NOT_ENOUGH_MEMORY; if (sysctl(mib, 6, buf, &mibLen, NULL, 0) < 0) { - free(buf); + HeapFree(GetProcessHeap(), 0, buf); return ERROR_NO_MORE_FILES; } @@ -786,7 +783,7 @@ ret = NO_ERROR; } } - free(buf); + HeapFree(GetProcessHeap(), 0, buf); return ret; } #endif diff -urN wine-20041201/dlls/iphlpapi/ifenum.h wine-20050111/dlls/iphlpapi/ifenum.h --- wine-20041201/dlls/iphlpapi/ifenum.h 2004-02-09 21:54:28.000000000 +0100 +++ wine-20050111/dlls/iphlpapi/ifenum.h 2004-12-13 14:21:39.000000000 +0100 @@ -62,7 +62,7 @@ } InterfaceIndexTable; /* Returns a table with all known interface indexes, or NULL if one could not - * be allocated. free() the returned table. + * be allocated. HeapFree() the returned table. */ InterfaceIndexTable *getInterfaceIndexTable(void); diff -urN wine-20041201/dlls/iphlpapi/iphlpapi_main.c wine-20050111/dlls/iphlpapi/iphlpapi_main.c --- wine-20041201/dlls/iphlpapi/iphlpapi_main.c 2004-01-15 01:25:41.000000000 +0100 +++ wine-20050111/dlls/iphlpapi/iphlpapi_main.c 2004-12-13 14:21:39.000000000 +0100 @@ -68,6 +68,8 @@ /****************************************************************** * AddIPAddress (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -78,8 +80,7 @@ * NTEInstance [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI AddIPAddress(IPAddr Address, IPMask IpMask, DWORD IfIndex, PULONG NTEContext, PULONG NTEInstance) @@ -93,6 +94,8 @@ /****************************************************************** * AllocateAndGetIfTableFromStack (IPHLPAPI.@) * + * NOTES + * Like GetIfTable, but allocates the returned table from heap. * * PARAMS * @@ -132,6 +135,8 @@ /****************************************************************** * AllocateAndGetIpAddrTableFromStack (IPHLPAPI.@) * + * NOTES + * Like GetIpAddrTable, but allocates the returned table from heap. * * PARAMS * @@ -141,8 +146,8 @@ * flags [In] -- flags to HeapAlloc * * RETURNS - * - * DWORD + * ERROR_INVALID_PARAMETER if ppIpAddrTable is NULL, whatever GetIpAddrTable + * returns otherwise. * */ DWORD WINAPI AllocateAndGetIpAddrTableFromStack(PMIB_IPADDRTABLE *ppIpAddrTable, @@ -171,6 +176,10 @@ /****************************************************************** * AllocateAndGetIpForwardTableFromStack (IPHLPAPI.@) * + * NOTES + * Like GetIpForwardTable, but allocates the returned table from heap. + * + * PARAMS * * ppIpForwardTable [Out] -- pointer into which the MIB_IPFORWARDTABLE is * allocated and returned. @@ -208,6 +217,8 @@ /****************************************************************** * AllocateAndGetIpNetTableFromStack (IPHLPAPI.@) * + * NOTES + * Like GetIpNetTable, but allocates the returned table from heap. * * PARAMS * @@ -217,8 +228,8 @@ * flags [In] -- flags to HeapAlloc * * RETURNS - * - * DWORD + * ERROR_INVALID_PARAMETER if ppIpNetTable is NULL, whatever GetIpNetTable + * returns otherwise. * */ DWORD WINAPI AllocateAndGetIpNetTableFromStack(PMIB_IPNETTABLE *ppIpNetTable, @@ -247,6 +258,8 @@ /****************************************************************** * AllocateAndGetTcpTableFromStack (IPHLPAPI.@) * + * NOTES + * Like GetTcpTable, but allocates the returned table from heap. * * PARAMS * @@ -256,8 +269,8 @@ * flags [In] -- flags to HeapAlloc * * RETURNS - * - * DWORD + * ERROR_INVALID_PARAMETER if ppTcpTable is NULL, whatever GetTcpTable + * returns otherwise. * */ DWORD WINAPI AllocateAndGetTcpTableFromStack(PMIB_TCPTABLE *ppTcpTable, @@ -286,6 +299,8 @@ /****************************************************************** * AllocateAndGetUdpTableFromStack (IPHLPAPI.@) * + * NOTES + * Like GetUdpTable, but allocates the returned table from heap. * * PARAMS * @@ -295,8 +310,8 @@ * flags [In] -- flags to HeapAlloc * * RETURNS - * - * DWORD + * ERROR_INVALID_PARAMETER if ppUdpTable is NULL, whatever GetUdpTable + * returns otherwise. * */ DWORD WINAPI AllocateAndGetUdpTableFromStack(PMIB_UDPTABLE *ppUdpTable, @@ -325,21 +340,21 @@ /****************************************************************** * CreateIpForwardEntry (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * pRoute [In/Out] * * RETURNS - * - * DWORD + * 0 * */ DWORD WINAPI CreateIpForwardEntry(PMIB_IPFORWARDROW pRoute) { - TRACE("pRoute %p\n", pRoute); + FIXME("(pRoute %p): stub\n", pRoute); /* could use SIOCADDRT, not sure I want to */ - FIXME(":stub\n"); return (DWORD) 0; } @@ -347,21 +362,21 @@ /****************************************************************** * CreateIpNetEntry (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * pArpEntry [In/Out] * * RETURNS - * - * DWORD + * 0 * */ DWORD WINAPI CreateIpNetEntry(PMIB_IPNETROW pArpEntry) { - TRACE("pArpEntry %p\n", pArpEntry); + FIXME("(pArpEntry %p)\n", pArpEntry); /* could use SIOCSARP on systems that support it, not sure I want to */ - FIXME(":stub\n"); return (DWORD) 0; } @@ -369,6 +384,8 @@ /****************************************************************** * CreateProxyArpEntry (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -377,15 +394,13 @@ * dwIfIndex [In] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI CreateProxyArpEntry(DWORD dwAddress, DWORD dwMask, DWORD dwIfIndex) { - TRACE("dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx\n", dwAddress, - dwMask, dwIfIndex); - FIXME(":stub\n"); + FIXME("(dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx): stub\n", + dwAddress, dwMask, dwIfIndex); /* marking Win2K+ functions not supported */ return ERROR_NOT_SUPPORTED; } @@ -394,20 +409,20 @@ /****************************************************************** * DeleteIPAddress (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * NTEContext [In] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI DeleteIPAddress(ULONG NTEContext) { - TRACE("NTEContext %ld\n", NTEContext); - FIXME(":stub\n"); + FIXME("(NTEContext %ld): stub\n", NTEContext); /* marking Win2K+ functions not supported */ return ERROR_NOT_SUPPORTED; } @@ -416,21 +431,21 @@ /****************************************************************** * DeleteIpForwardEntry (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * pRoute [In/Out] * * RETURNS - * - * DWORD + * 0 * */ DWORD WINAPI DeleteIpForwardEntry(PMIB_IPFORWARDROW pRoute) { - TRACE("pRoute %p\n", pRoute); + FIXME("(pRoute %p): stub\n", pRoute); /* could use SIOCDELRT, not sure I want to */ - FIXME(":stub\n"); return (DWORD) 0; } @@ -438,21 +453,21 @@ /****************************************************************** * DeleteIpNetEntry (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * pArpEntry [In/Out] * * RETURNS - * - * DWORD + * 0 * */ DWORD WINAPI DeleteIpNetEntry(PMIB_IPNETROW pArpEntry) { - TRACE("pArpEntry %p\n", pArpEntry); + FIXME("(pArpEntry %p): stub\n", pArpEntry); /* could use SIOCDARP on systems that support it, not sure I want to */ - FIXME(":stub\n"); return (DWORD) 0; } @@ -460,6 +475,8 @@ /****************************************************************** * DeleteProxyArpEntry (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -468,15 +485,13 @@ * dwIfIndex [In] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI DeleteProxyArpEntry(DWORD dwAddress, DWORD dwMask, DWORD dwIfIndex) { - TRACE("dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx\n", dwAddress, - dwMask, dwIfIndex); - FIXME(":stub\n"); + FIXME("(dwAddress 0x%08lx, dwMask 0x%08lx, dwIfIndex 0x%08lx): stub\n", + dwAddress, dwMask, dwIfIndex); /* marking Win2K+ functions not supported */ return ERROR_NOT_SUPPORTED; } @@ -485,6 +500,8 @@ /****************************************************************** * EnableRouter (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -492,14 +509,12 @@ * pOverlapped [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI EnableRouter(HANDLE * pHandle, OVERLAPPED * pOverlapped) { - TRACE("pHandle %p, pOverlapped %p\n", pHandle, pOverlapped); - FIXME(":stub\n"); + FIXME("(pHandle %p, pOverlapped %p): stub\n", pHandle, pOverlapped); /* could echo "1" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to could map EACCESS to ERROR_ACCESS_DENIED, I suppose marking Win2K+ functions not supported */ @@ -510,20 +525,20 @@ /****************************************************************** * FlushIpNetTable (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * dwIfIndex [In] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI FlushIpNetTable(DWORD dwIfIndex) { - TRACE("dwIfIndex 0x%08lx\n", dwIfIndex); - FIXME(":stub\n"); + FIXME("(dwIfIndex 0x%08lx): stub\n", dwIfIndex); /* this flushes the arp cache of the given index marking Win2K+ functions not supported */ return ERROR_NOT_SUPPORTED; @@ -533,6 +548,8 @@ /****************************************************************** * GetAdapterIndex (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -540,14 +557,12 @@ * IfIndex [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI GetAdapterIndex(LPWSTR AdapterName, PULONG IfIndex) { - TRACE("AdapterName %p, IfIndex %p\n", AdapterName, IfIndex); - FIXME(":stub\n"); + FIXME("(AdapterName %p, IfIndex %p): stub\n", AdapterName, IfIndex); /* marking Win2K+ functions not supported */ return ERROR_NOT_SUPPORTED; } @@ -556,7 +571,6 @@ /****************************************************************** * GetAdaptersInfo (IPHLPAPI.@) * - * * PARAMS * * pAdapterInfo [In/Out] @@ -659,7 +673,7 @@ } ret = NO_ERROR; } - free(table); + HeapFree(GetProcessHeap(), 0, table); } else ret = ERROR_OUTOFMEMORY; @@ -676,7 +690,6 @@ /****************************************************************** * GetBestInterface (IPHLPAPI.@) * - * * PARAMS * * dwDestAddr [In] @@ -709,7 +722,6 @@ /****************************************************************** * GetBestRoute (IPHLPAPI.@) * - * * PARAMS * * dwDestAddr [In] @@ -763,14 +775,17 @@ /****************************************************************** * GetFriendlyIfIndex (IPHLPAPI.@) * + * NOTES + * Returns a "friendly" version if IfIndex, which is one that doesn't + * have the top byte set. Doesn't validate whether IfIndex is a valid + * adapter index. * * PARAMS * * IfIndex [In] * * RETURNS - * - * DWORD + * A friendly version of IfIndex. * */ DWORD WINAPI GetFriendlyIfIndex(DWORD IfIndex) @@ -786,7 +801,6 @@ /****************************************************************** * GetIcmpStatistics (IPHLPAPI.@) * - * * PARAMS * * pStats [In/Out] @@ -810,7 +824,6 @@ /****************************************************************** * GetIfEntry (IPHLPAPI.@) * - * * PARAMS * * pIfRow [In/Out] @@ -857,6 +870,12 @@ /****************************************************************** * GetIfTable (IPHLPAPI.@) * + * NOTES + * Returns a table of local interfaces, *pdwSize is the size in bytes of + * pIfTable. If this is less than required, the function will return + * ERROR_INSUFFICIENT_BUFFER, and *pdwSize will be set to the required byte + * size. + * If bOrder is true, the returned table will be sorted by interface index. * * PARAMS * @@ -865,8 +884,7 @@ * bOrder [In] * * RETURNS - * - * DWORD + * NO_ERROR on success, something else on failure. * */ DWORD WINAPI GetIfTable(PMIB_IFTABLE pIfTable, PULONG pdwSize, BOOL bOrder) @@ -909,7 +927,7 @@ IfTableSorter); ret = NO_ERROR; } - free(table); + HeapFree(GetProcessHeap(), 0, table); } else ret = ERROR_OUTOFMEMORY; @@ -923,7 +941,6 @@ /****************************************************************** * GetInterfaceInfo (IPHLPAPI.@) * - * * PARAMS * * pIfTable [In/Out] @@ -980,7 +997,7 @@ } ret = NO_ERROR; } - free(table); + HeapFree(GetProcessHeap(), 0, table); } else ret = ERROR_OUTOFMEMORY; @@ -1006,6 +1023,13 @@ /****************************************************************** * GetIpAddrTable (IPHLPAPI.@) * + * NOTES + * Returns the route table. On input, *pdwSize is the size in bytes of + * pIpForwardTable. If this is less than required, the function will return + * ERROR_INSUFFICIENT_BUFFER, and *pdwSize will be set to the required byte + * size. + * If bOrder is true, the returned table will be sorted by the next hop and + * an assortment of arbitrary parameters. * * PARAMS * @@ -1014,8 +1038,7 @@ * bOrder [In] * * RETURNS - * - * DWORD + * NO_ERROR on success, something else on failure. * */ DWORD WINAPI GetIpAddrTable(PMIB_IPADDRTABLE pIpAddrTable, PULONG pdwSize, BOOL bOrder) @@ -1073,7 +1096,7 @@ sizeof(MIB_IPADDRROW), IpAddrTableSorter); ret = NO_ERROR; } - free(table); + HeapFree(GetProcessHeap(), 0, table); } else ret = ERROR_OUTOFMEMORY; @@ -1110,6 +1133,13 @@ /****************************************************************** * GetIpForwardTable (IPHLPAPI.@) * + * NOTES + * Returns the route table. On input, *pdwSize is the size in bytes of + * pIpForwardTable. If this is less than required, the function will return + * ERROR_INSUFFICIENT_BUFFER, and *pdwSize will be set to the required byte + * size. + * If bOrder is true, the returned table will be sorted by the next hop and + * an assortment of arbitrary parameters. * * PARAMS * @@ -1118,8 +1148,7 @@ * bOrder [In] * * RETURNS - * - * DWORD + * NO_ERROR on success, something else on failure. * */ DWORD WINAPI GetIpForwardTable(PMIB_IPFORWARDTABLE pIpForwardTable, PULONG pdwSize, BOOL bOrder) @@ -1184,7 +1213,7 @@ sizeof(MIB_IPFORWARDROW), IpForwardTableSorter); ret = NO_ERROR; } - free(table); + HeapFree(GetProcessHeap(), 0, table); } else ret = ERROR_OUTOFMEMORY; @@ -1210,6 +1239,11 @@ /****************************************************************** * GetIpNetTable (IPHLPAPI.@) * + * Returns the ARP cache. On input, *pdwSize is the size in bytes of + * pIpNetTable. If this is less than required, the function will return + * ERROR_INSUFFICIENT_BUFFER, and *pdwSize will be set to the required byte + * size. + * If bOrder is true, the returned table will be sorted by IP address. * * PARAMS * @@ -1218,8 +1252,7 @@ * bOrder [In] * * RETURNS - * - * DWORD + * NO_ERROR on success, something else on failure. * */ DWORD WINAPI GetIpNetTable(PMIB_IPNETTABLE pIpNetTable, PULONG pdwSize, BOOL bOrder) @@ -1256,7 +1289,7 @@ sizeof(MIB_IPNETROW), IpNetTableSorter); ret = NO_ERROR; } - free(table); + HeapFree(GetProcessHeap(), 0, table); } else ret = ERROR_OUTOFMEMORY; @@ -1270,7 +1303,6 @@ /****************************************************************** * GetIpStatistics (IPHLPAPI.@) * - * * PARAMS * * pStats [In/Out] @@ -1294,7 +1326,6 @@ /****************************************************************** * GetNetworkParams (IPHLPAPI.@) * - * * PARAMS * * pFixedInfo [In/Out] @@ -1370,14 +1401,15 @@ /****************************************************************** * GetNumberOfInterfaces (IPHLPAPI.@) * + * NOTES + * Returns the number of interfaces in *pdwNumIf. * * PARAMS * * pdwNumIf [In/Out] * * RETURNS - * - * DWORD + * NO_ERROR on success, ERROR_INVALID_PARAMETER if pdwNumIf is NULL. * */ DWORD WINAPI GetNumberOfInterfaces(PDWORD pdwNumIf) @@ -1399,6 +1431,8 @@ /****************************************************************** * GetPerAdapterInfo (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -1407,15 +1441,12 @@ * pOutBufLen [In/Out] * * RETURNS - * - * DWORD - * + * ERROR_NOT_SUPPORTED */ DWORD WINAPI GetPerAdapterInfo(ULONG IfIndex, PIP_PER_ADAPTER_INFO pPerAdapterInfo, PULONG pOutBufLen) { - TRACE("IfIndex %ld, pPerAdapterInfo %p, pOutBufLen %p\n", IfIndex, + TRACE("(IfIndex %ld, pPerAdapterInfo %p, pOutBufLen %p)\n", IfIndex, pPerAdapterInfo, pOutBufLen); - FIXME(":stub\n"); /* marking Win2K+ functions not supported */ return ERROR_NOT_SUPPORTED; } @@ -1424,6 +1455,8 @@ /****************************************************************** * GetRTTAndHopCount (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -1433,23 +1466,20 @@ * RTT [In/Out] * * RETURNS - * - * BOOL + * FALSE * */ BOOL WINAPI GetRTTAndHopCount(IPAddr DestIpAddress, PULONG HopCount, ULONG MaxHops, PULONG RTT) { - TRACE("DestIpAddress 0x%08lx, HopCount %p, MaxHops %ld, RTT %p\n", + FIXME("(DestIpAddress 0x%08lx, HopCount %p, MaxHops %ld, RTT %p): stub\n", DestIpAddress, HopCount, MaxHops, RTT); - FIXME(":stub\n"); - return (BOOL) 0; + return FALSE; } /****************************************************************** * GetTcpStatistics (IPHLPAPI.@) * - * * PARAMS * * pStats [In/Out] @@ -1496,6 +1526,13 @@ /****************************************************************** * GetTcpTable (IPHLPAPI.@) * + * Returns a table of active TCP connections. On input, *pdwSize + * is the size in bytes of pTcpTable. If this is less than required, + * the function will return ERROR_INSUFFICIENT_BUFFER, and *pdwSize + * will be set to the required byte size. + * If bOrder is true, the returned table will be sorted, first by + * local address and port number, then by remote address and port + * number. * * PARAMS * @@ -1504,8 +1541,7 @@ * bOrder [In] * * RETURNS - * - * DWORD + * NO_ERROR on success, something else on failure. * */ DWORD WINAPI GetTcpTable(PMIB_TCPTABLE pTcpTable, PDWORD pdwSize, BOOL bOrder) @@ -1541,7 +1577,7 @@ sizeof(MIB_TCPROW), TcpTableSorter); ret = NO_ERROR; } - free(table); + HeapFree(GetProcessHeap(), 0, table); } else ret = ERROR_OUTOFMEMORY; @@ -1555,7 +1591,6 @@ /****************************************************************** * GetUdpStatistics (IPHLPAPI.@) * - * * PARAMS * * pStats [In/Out] @@ -1596,6 +1631,12 @@ /****************************************************************** * GetUdpTable (IPHLPAPI.@) * + * Returns a table of active UDP connections. On input, *pdwSize + * is the size in bytes of pUdpTable. If this is less than required, + * the function will return ERROR_INSUFFICIENT_BUFFER, and *pdwSize + * will be set to the required byte size. + * If bOrder is true, the returned table will be sorted, first by + * local address, then by local port number. * * PARAMS * @@ -1604,8 +1645,7 @@ * bOrder [In] * * RETURNS - * - * DWORD + * NO_ERROR on success, something else on failure. * */ DWORD WINAPI GetUdpTable(PMIB_UDPTABLE pUdpTable, PDWORD pdwSize, BOOL bOrder) @@ -1641,7 +1681,7 @@ sizeof(MIB_UDPROW), UdpTableSorter); ret = NO_ERROR; } - free(table); + HeapFree(GetProcessHeap(), 0, table); } else ret = ERROR_OUTOFMEMORY; @@ -1655,6 +1695,9 @@ /****************************************************************** * GetUniDirectionalAdapterInfo (IPHLPAPI.@) * + * This is a Win98-only function to get information on "unidirectional" + * adapters. Since this is pretty nonsensical in other contexts, it + * never returns anything. * * PARAMS * @@ -1662,8 +1705,7 @@ * dwOutBufLen [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI GetUniDirectionalAdapterInfo(PIP_UNIDIRECTIONAL_ADAPTER_ADDRESS pIPIfInfo, PULONG dwOutBufLen) @@ -1677,14 +1719,16 @@ /****************************************************************** * IpReleaseAddress (IPHLPAPI.@) * + * NOTES + * Since GetAdaptersInfo never returns adapters that have DHCP enabled, + * this function does nothing. * * PARAMS * * AdapterInfo [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI IpReleaseAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo) @@ -1699,14 +1743,16 @@ /****************************************************************** * IpRenewAddress (IPHLPAPI.@) * + * NOTES + * Since GetAdaptersInfo never returns adapters that have DHCP enabled, + * this function does nothing. * * PARAMS * * AdapterInfo [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI IpRenewAddress(PIP_ADAPTER_INDEX_MAP AdapterInfo) @@ -1721,6 +1767,8 @@ /****************************************************************** * NotifyAddrChange (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -1728,14 +1776,12 @@ * overlapped [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI NotifyAddrChange(PHANDLE Handle, LPOVERLAPPED overlapped) { - TRACE("Handle %p, overlapped %p\n", Handle, overlapped); - FIXME(":stub\n"); + FIXME("(Handle %p, overlapped %p): stub\n", Handle, overlapped); /* marking Win2K+ functions not supported */ return ERROR_NOT_SUPPORTED; } @@ -1744,6 +1790,8 @@ /****************************************************************** * NotifyRouteChange (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -1751,14 +1799,12 @@ * overlapped [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI NotifyRouteChange(PHANDLE Handle, LPOVERLAPPED overlapped) { - TRACE("Handle %p, overlapped %p\n", Handle, overlapped); - FIXME(":stub\n"); + FIXME("(Handle %p, overlapped %p): stub\n", Handle, overlapped); /* marking Win2K+ functions not supported */ return ERROR_NOT_SUPPORTED; } @@ -1767,6 +1813,8 @@ /****************************************************************** * SendARP (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -1776,15 +1824,13 @@ * PhyAddrLen [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI SendARP(IPAddr DestIP, IPAddr SrcIP, PULONG pMacAddr, PULONG PhyAddrLen) { - TRACE("DestIP 0x%08lx, SrcIP 0x%08lx, pMacAddr %p, PhyAddrLen %p\n", DestIP, - SrcIP, pMacAddr, PhyAddrLen); - FIXME(":stub\n"); + FIXME("(DestIP 0x%08lx, SrcIP 0x%08lx, pMacAddr %p, PhyAddrLen %p): stub\n", + DestIP, SrcIP, pMacAddr, PhyAddrLen); /* marking Win2K+ functions not supported */ return ERROR_NOT_SUPPORTED; } @@ -1793,24 +1839,24 @@ /****************************************************************** * SetIfEntry (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * pIfRow [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI SetIfEntry(PMIB_IFROW pIfRow) { - TRACE("pIfRow %p\n", pIfRow); + FIXME("(pIfRow %p): stub\n", pIfRow); /* this is supposed to set an administratively interface up or down. Could do SIOCSIFFLAGS and set/clear IFF_UP, but, not sure I want to, and this sort of down is indistinguishable from other sorts of down (e.g. no link). */ - FIXME(":stub\n"); return ERROR_NOT_SUPPORTED; } @@ -1818,23 +1864,23 @@ /****************************************************************** * SetIpForwardEntry (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * pRoute [In/Out] * * RETURNS - * - * DWORD + * 0 * */ DWORD WINAPI SetIpForwardEntry(PMIB_IPFORWARDROW pRoute) { - TRACE("pRoute %p\n", pRoute); + FIXME("(pRoute %p): stub\n", pRoute); /* this is to add a route entry, how's it distinguishable from CreateIpForwardEntry? could use SIOCADDRT, not sure I want to */ - FIXME(":stub\n"); return (DWORD) 0; } @@ -1842,21 +1888,21 @@ /****************************************************************** * SetIpNetEntry (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * pArpEntry [In/Out] * * RETURNS - * - * DWORD + * 0 * */ DWORD WINAPI SetIpNetEntry(PMIB_IPNETROW pArpEntry) { - TRACE("pArpEntry %p\n", pArpEntry); + FIXME("(pArpEntry %p): stub\n", pArpEntry); /* same as CreateIpNetEntry here, could use SIOCSARP, not sure I want to */ - FIXME(":stub\n"); return (DWORD) 0; } @@ -1864,20 +1910,20 @@ /****************************************************************** * SetIpStatistics (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * pIpStats [In/Out] * * RETURNS - * - * DWORD + * 0 * */ DWORD WINAPI SetIpStatistics(PMIB_IPSTATS pIpStats) { - TRACE("pIpStats %p\n", pIpStats); - FIXME(":stub\n"); + FIXME("(pIpStats %p): stub\n", pIpStats); return (DWORD) 0; } @@ -1885,22 +1931,22 @@ /****************************************************************** * SetIpTTL (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * nTTL [In] * * RETURNS - * - * DWORD + * 0 * */ DWORD WINAPI SetIpTTL(UINT nTTL) { - TRACE("nTTL %d\n", nTTL); + FIXME("(nTTL %d): stub\n", nTTL); /* could echo nTTL > /proc/net/sys/net/ipv4/ip_default_ttl, not sure I want to. Could map EACCESS to ERROR_ACCESS_DENIED, I suppose */ - FIXME(":stub\n"); return (DWORD) 0; } @@ -1908,20 +1954,20 @@ /****************************************************************** * SetTcpEntry (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * * pTcpRow [In/Out] * * RETURNS - * - * DWORD + * 0 * */ DWORD WINAPI SetTcpEntry(PMIB_TCPROW pTcpRow) { - TRACE("pTcpRow %p\n", pTcpRow); - FIXME(":stub\n"); + FIXME("(pTcpRow %p): stub\n", pTcpRow); return (DWORD) 0; } @@ -1929,6 +1975,8 @@ /****************************************************************** * UnenableRouter (IPHLPAPI.@) * + * NOTES + * Stub * * PARAMS * @@ -1936,14 +1984,13 @@ * lpdwEnableCount [In/Out] * * RETURNS - * - * DWORD + * ERROR_NOT_SUPPORTED * */ DWORD WINAPI UnenableRouter(OVERLAPPED * pOverlapped, LPDWORD lpdwEnableCount) { - TRACE("pOverlapped %p, lpdwEnableCount %p\n", pOverlapped, lpdwEnableCount); - FIXME(":stub\n"); + FIXME("(pOverlapped %p, lpdwEnableCount %p): stub\n", pOverlapped, + lpdwEnableCount); /* could echo "0" > /proc/net/sys/net/ipv4/ip_forward, not sure I want to could map EACCESS to ERROR_ACCESS_DENIED, I suppose marking Win2K+ functions not supported */ diff -urN wine-20041201/dlls/iphlpapi/ipstats.c wine-20050111/dlls/iphlpapi/ipstats.c --- wine-20041201/dlls/iphlpapi/ipstats.c 2004-05-04 06:13:06.000000000 +0200 +++ wine-20050111/dlls/iphlpapi/ipstats.c 2004-12-13 14:21:39.000000000 +0100 @@ -565,8 +565,8 @@ DWORD numRoutes = getNumRoutes(); RouteTable *ret; - ret = (RouteTable *)calloc(1, sizeof(RouteTable) + - (numRoutes - 1) * sizeof(RouteEntry)); + ret = (RouteTable *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(RouteTable) + (numRoutes - 1) * sizeof(RouteEntry)); if (ret) { FILE *fp; @@ -638,8 +638,8 @@ DWORD numEntries = getNumArpEntries(); PMIB_IPNETTABLE ret; - ret = (PMIB_IPNETTABLE)calloc(1, sizeof(MIB_IPNETTABLE) + - (numEntries - 1) * sizeof(MIB_IPNETROW)); + ret = (PMIB_IPNETTABLE)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(MIB_IPNETTABLE) + (numEntries - 1) * sizeof(MIB_IPNETROW)); if (ret) { FILE *fp; @@ -716,8 +716,8 @@ DWORD numEntries = getNumUdpEntries(); PMIB_UDPTABLE ret; - ret = (PMIB_UDPTABLE)calloc(1, sizeof(MIB_UDPTABLE) + - (numEntries - 1) * sizeof(MIB_UDPROW)); + ret = (PMIB_UDPTABLE)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(MIB_UDPTABLE) + (numEntries - 1) * sizeof(MIB_UDPROW)); if (ret) { FILE *fp; @@ -768,8 +768,8 @@ DWORD numEntries = getNumTcpEntries(); PMIB_TCPTABLE ret; - ret = (PMIB_TCPTABLE)calloc(1, sizeof(MIB_TCPTABLE) + - (numEntries - 1) * sizeof(MIB_TCPROW)); + ret = (PMIB_TCPTABLE)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(MIB_TCPTABLE) + (numEntries - 1) * sizeof(MIB_TCPROW)); if (ret) { FILE *fp; diff -urN wine-20041201/dlls/iphlpapi/ipstats.h wine-20050111/dlls/iphlpapi/ipstats.h --- wine-20041201/dlls/iphlpapi/ipstats.h 2003-09-06 01:08:37.000000000 +0200 +++ wine-20050111/dlls/iphlpapi/ipstats.h 2004-12-13 14:21:39.000000000 +0100 @@ -74,7 +74,7 @@ } RouteTable; /* Allocates and returns to you the route table, or NULL if it can't allocate - * enough memory. free() the returned table. + * enough memory. HeapFree() the returned table. */ RouteTable *getRouteTable(void); @@ -82,7 +82,7 @@ DWORD getNumArpEntries(void); /* Allocates and returns to you the arp table, or NULL if it can't allocate - * enough memory. free() the returned table. + * enough memory. HeapFree() the returned table. */ PMIB_IPNETTABLE getArpTable(void); @@ -90,7 +90,7 @@ DWORD getNumUdpEntries(void); /* Allocates and returns to you the UDP state table, or NULL if it can't - * allocate enough memory. free() the returned table. + * allocate enough memory. HeapFree() the returned table. */ PMIB_UDPTABLE getUdpTable(void); @@ -98,7 +98,7 @@ DWORD getNumTcpEntries(void); /* Allocates and returns to you the TCP state table, or NULL if it can't - * allocate enough memory. free() the returned table. + * allocate enough memory. HeapFree() the returned table. */ PMIB_TCPTABLE getTcpTable(void); diff -urN wine-20041201/dlls/itss/chm_lib.c wine-20050111/dlls/itss/chm_lib.c --- wine-20041201/dlls/itss/chm_lib.c 2004-10-20 01:53:26.000000000 +0200 +++ wine-20050111/dlls/itss/chm_lib.c 2004-12-09 15:07:59.000000000 +0100 @@ -588,7 +588,7 @@ buf, (DWORD)len, &actualLen, - NULL) == TRUE) + NULL)) readLen = actualLen; else readLen = 0; diff -urN wine-20041201/dlls/itss/itss.c wine-20050111/dlls/itss/itss.c --- wine-20041201/dlls/itss/itss.c 2004-11-19 19:03:56.000000000 +0100 +++ wine-20050111/dlls/itss/itss.c 2005-01-03 15:39:51.000000000 +0100 @@ -53,6 +53,8 @@ static HRESULT ITSS_create(IUnknown *pUnkOuter, LPVOID *ppObj); +ULONG dll_count = 0; + BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) { switch(fdwReason) { @@ -117,8 +119,10 @@ ULONG ref = InterlockedDecrement(&This->ref); - if (ref == 0) - HeapFree(GetProcessHeap(), 0, This); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_count); + } return ref; } @@ -193,6 +197,7 @@ factory->pfnCreateInstance = object_creation[i].pfnCreateInstance; *ppv = &(factory->ITF_IClassFactory); + InterlockedIncrement(&dll_count); TRACE("(%p) <- %p\n", ppv, &(factory->ITF_IClassFactory) ); @@ -239,8 +244,10 @@ ITStorageImpl *This = (ITStorageImpl *)iface; ULONG ref = InterlockedDecrement(&This->ref); - if (ref == 0) - HeapFree(GetProcessHeap(), 0, This); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_count); + } return ref; } @@ -393,6 +400,7 @@ TRACE("-> %p\n", its); *ppObj = (LPVOID) its; + InterlockedIncrement(&dll_count); return S_OK; } @@ -405,9 +413,8 @@ return S_OK; } -BOOL WINAPI ITSS_DllCanUnloadNow(void) +HRESULT WINAPI ITSS_DllCanUnloadNow(void) { - FIXME("\n"); - - return FALSE; + TRACE("dll_count = %lu\n", dll_count); + return dll_count ? S_FALSE : S_OK; } diff -urN wine-20041201/dlls/itss/moniker.c wine-20050111/dlls/itss/moniker.c --- wine-20041201/dlls/itss/moniker.c 2004-10-07 05:06:50.000000000 +0200 +++ wine-20050111/dlls/itss/moniker.c 2005-01-03 15:39:51.000000000 +0100 @@ -44,6 +44,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(itss); +extern ULONG dll_count; + /*****************************************************************************/ typedef struct { @@ -78,17 +80,19 @@ { ITS_IMonikerImpl *This = (ITS_IMonikerImpl *)iface; TRACE("%p\n", This); - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI ITS_IMonikerImpl_Release( IMoniker* iface) { ITS_IMonikerImpl *This = (ITS_IMonikerImpl *)iface; - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); - if (ref == 0) - HeapFree(GetProcessHeap(), 0, This); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_count); + } return ref; } @@ -365,6 +369,7 @@ TRACE("-> %p %s %s\n", itsmon, debugstr_w(itsmon->szFile), debugstr_w(itsmon->szHtml) ); *ppObj = (IMoniker*) itsmon; + InterlockedIncrement(&dll_count); return S_OK; } @@ -400,17 +405,19 @@ { ITS_IParseDisplayNameImpl *This = (ITS_IParseDisplayNameImpl *)iface; TRACE("%p\n", This); - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI ITS_IParseDisplayNameImpl_Release( IParseDisplayName* iface) { ITS_IParseDisplayNameImpl *This = (ITS_IParseDisplayNameImpl *)iface; - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); - if (ref == 0) - HeapFree(GetProcessHeap(), 0, This); + if (ref == 0) { + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_count); + } return ref; } @@ -470,6 +477,7 @@ TRACE("-> %p\n", its); *ppObj = (LPVOID) its; + InterlockedIncrement(&dll_count); return S_OK; } diff -urN wine-20041201/dlls/itss/storage.c wine-20050111/dlls/itss/storage.c --- wine-20041201/dlls/itss/storage.c 2004-10-07 05:06:50.000000000 +0200 +++ wine-20050111/dlls/itss/storage.c 2005-01-03 15:39:51.000000000 +0100 @@ -45,6 +45,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(itss); +extern ULONG dll_count; + /************************************************************************/ typedef struct _ITSS_IStorageImpl @@ -107,7 +109,7 @@ IEnumSTATSTG* iface) { IEnumSTATSTG_Impl *This = (IEnumSTATSTG_Impl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI ITSS_IEnumSTATSTG_Release( @@ -115,7 +117,7 @@ { IEnumSTATSTG_Impl *This = (IEnumSTATSTG_Impl *)iface; - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); if (ref == 0) { @@ -125,7 +127,8 @@ HeapFree( GetProcessHeap(), 0, This->first ); This->first = t; } - HeapFree(GetProcessHeap(), 0, This); + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_count); } return ref; @@ -251,6 +254,7 @@ stgenum->first = NULL; stgenum->last = NULL; stgenum->current = NULL; + InterlockedIncrement(&dll_count); TRACE(" -> %p\n", stgenum ); @@ -282,7 +286,7 @@ IStorage* iface) { ITSS_IStorageImpl *This = (ITSS_IStorageImpl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } ULONG WINAPI ITSS_IStorageImpl_Release( @@ -290,11 +294,12 @@ { ITSS_IStorageImpl *This = (ITSS_IStorageImpl *)iface; - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); if (ref == 0) { - HeapFree(GetProcessHeap(), 0, This); + HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_count); } return ref; @@ -336,7 +341,7 @@ if( pwcsName[0] == '/' ) { WCHAR *p = &path[strlenW( path ) - 1]; - while( ( path <= p ) && ( *p = '/' ) ) + while( ( path <= p ) && ( *p == '/' ) ) *p-- = 0; } strcatW( path, pwcsName ); @@ -569,6 +574,7 @@ strcpyW( stg->dir, dir ); *ppstgOpen = (IStorage*) stg; + InterlockedIncrement(&dll_count); return S_OK; } @@ -619,7 +625,7 @@ IStream* iface) { IStream_Impl *This = (IStream_Impl *)iface; - return ++(This->ref); + return InterlockedIncrement(&This->ref); } static ULONG WINAPI ITSS_IStream_Release( @@ -627,12 +633,13 @@ { IStream_Impl *This = (IStream_Impl *)iface; - ULONG ref = --This->ref; + ULONG ref = InterlockedDecrement(&This->ref); if (ref == 0) { IStorage_Release( (IStorage*) This->stg ); HeapFree(GetProcessHeap(), 0, This); + InterlockedDecrement(&dll_count); } return ref; @@ -818,6 +825,7 @@ memcpy( &stm->ui, ui, sizeof stm->ui ); stm->stg = stg; IStorage_AddRef( (IStorage*) stg ); + InterlockedIncrement(&dll_count); TRACE(" -> %p\n", stm ); diff -urN wine-20041201/dlls/kernel/comm.c wine-20050111/dlls/kernel/comm.c --- wine-20041201/dlls/kernel/comm.c 2004-10-26 02:25:58.000000000 +0200 +++ wine-20050111/dlls/kernel/comm.c 2005-01-07 16:40:09.000000000 +0100 @@ -1735,9 +1735,10 @@ HANDLE hComm, /* [in] The communication device in need of a command character. */ CHAR chTransmit) /* [in] The character to transmit. */ { + DWORD w; WARN("(%p,'%c') not perfect!\n",hComm,chTransmit); - return WriteFile( hComm, &chTransmit, 1, NULL, NULL ); + return WriteFile( hComm, &chTransmit, 1, &w, NULL ); } @@ -2024,7 +2025,7 @@ return COMM_WaitCommEvent(hFile, lpdwEvents, lpOverlapped); /* if there is no overlapped structure, create our own */ - ov.hEvent = CreateEventA(NULL,FALSE,FALSE,NULL); + ov.hEvent = CreateEventW(NULL,FALSE,FALSE,NULL); COMM_WaitCommEvent(hFile, lpdwEvents, &ov); @@ -2295,8 +2296,7 @@ MultiByteToWideChar( CP_ACP, 0, lpszDevice, -1, lpDeviceW, len ); } r = SetDefaultCommConfigW(lpDeviceW,lpCommConfig,dwSize); - if (lpDeviceW) - HeapFree( GetProcessHeap(), 0, lpDeviceW ); + HeapFree( GetProcessHeap(), 0, lpDeviceW ); return r; } diff -urN wine-20041201/dlls/kernel/computername.c wine-20050111/dlls/kernel/computername.c --- wine-20041201/dlls/kernel/computername.c 2004-08-11 01:43:21.000000000 +0200 +++ wine-20050111/dlls/kernel/computername.c 2004-12-06 12:38:25.000000000 +0100 @@ -253,7 +253,7 @@ st = NtQueryValueKey( hsubkey, &nameW, KeyValuePartialInformation, buf, len, &len ); - if ( st == STATUS_OBJECT_NAME_NOT_FOUND || ( st == STATUS_SUCCESS && get_use_dns_option())) + if ( st != STATUS_SUCCESS || get_use_dns_option() ) { char hbuf[256]; int hlen = sizeof (hbuf); diff -urN wine-20041201/dlls/kernel/console.c wine-20050111/dlls/kernel/console.c --- wine-20041201/dlls/kernel/console.c 2004-09-13 20:04:50.000000000 +0200 +++ wine-20050111/dlls/kernel/console.c 2004-12-23 19:48:47.000000000 +0100 @@ -390,7 +390,7 @@ } new_coord.X = new_coord.Y = 0; ret = WriteConsoleOutputW( hConsoleOutput, ciw, new_size, new_coord, region ); - if (ciw) HeapFree( GetProcessHeap(), 0, ciw ); + HeapFree( GetProcessHeap(), 0, ciw ); return ret; } @@ -1142,22 +1142,29 @@ if (!start_console_renderer(&siConsole)) goto the_end; - /* all std I/O handles are inheritable by default */ - sa.nLength = sizeof(sa); - sa.lpSecurityDescriptor = NULL; - sa.bInheritHandle = TRUE; - - handle_in = CreateFileA( "CONIN$", GENERIC_READ|GENERIC_WRITE|SYNCHRONIZE, - 0, &sa, OPEN_EXISTING, 0, 0 ); - if (handle_in == INVALID_HANDLE_VALUE) goto the_end; - - handle_out = CreateFileA( "CONOUT$", GENERIC_READ|GENERIC_WRITE, - 0, &sa, OPEN_EXISTING, 0, 0 ); - if (handle_out == INVALID_HANDLE_VALUE) goto the_end; - - if (!DuplicateHandle(GetCurrentProcess(), handle_out, GetCurrentProcess(), &handle_err, - 0, TRUE, DUPLICATE_SAME_ACCESS)) - goto the_end; + if( !(siCurrent.dwFlags & STARTF_USESTDHANDLES) ) { + /* all std I/O handles are inheritable by default */ + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = NULL; + sa.bInheritHandle = TRUE; + + handle_in = CreateFileA( "CONIN$", GENERIC_READ|GENERIC_WRITE|SYNCHRONIZE, + 0, &sa, OPEN_EXISTING, 0, 0 ); + if (handle_in == INVALID_HANDLE_VALUE) goto the_end; + + handle_out = CreateFileA( "CONOUT$", GENERIC_READ|GENERIC_WRITE, + 0, &sa, OPEN_EXISTING, 0, 0 ); + if (handle_out == INVALID_HANDLE_VALUE) goto the_end; + + if (!DuplicateHandle(GetCurrentProcess(), handle_out, GetCurrentProcess(), + &handle_err, 0, TRUE, DUPLICATE_SAME_ACCESS)) + goto the_end; + } else { + /* STARTF_USESTDHANDLES flag: use handles from StartupInfo */ + handle_in = siCurrent.hStdInput; + handle_out = siCurrent.hStdOutput; + handle_err = siCurrent.hStdError; + } /* NT resets the STD_*_HANDLEs on console alloc */ SetStdHandle(STD_INPUT_HANDLE, handle_in); @@ -1217,7 +1224,7 @@ { if (!S_EditString || S_EditString[S_EditStrPos] == 0) { - if (S_EditString) HeapFree(GetProcessHeap(), 0, S_EditString); + HeapFree(GetProcessHeap(), 0, S_EditString); if (!(S_EditString = CONSOLE_Readline(hConsoleInput))) return FALSE; S_EditStrPos = 0; diff -urN wine-20041201/dlls/kernel/cpu.c wine-20050111/dlls/kernel/cpu.c --- wine-20041201/dlls/kernel/cpu.c 2004-10-18 21:38:41.000000000 +0200 +++ wine-20050111/dlls/kernel/cpu.c 2004-12-27 18:16:39.000000000 +0100 @@ -226,7 +226,7 @@ return TRUE; } #endif - frequency->u.LowPart = 1000000; + frequency->u.LowPart = 10000000; frequency->u.HighPart = 0; return TRUE; } diff -urN wine-20041201/dlls/kernel/editline.c wine-20050111/dlls/kernel/editline.c --- wine-20041201/dlls/kernel/editline.c 2004-08-11 01:43:21.000000000 +0200 +++ wine-20050111/dlls/kernel/editline.c 2004-12-23 19:48:47.000000000 +0100 @@ -229,11 +229,8 @@ static void WCEL_FreeYank(WCEL_Context* ctx) { - if (ctx->yanked) - { - HeapFree(GetProcessHeap(), 0, ctx->yanked); - ctx->yanked = NULL; - } + HeapFree(GetProcessHeap(), 0, ctx->yanked); + ctx->yanked = NULL; } static void WCEL_SaveYank(WCEL_Context* ctx, int beg, int end) @@ -310,7 +307,7 @@ /* save current line edition for recall when needed (FIXME seems broken to me) */ if (ctx->histPos == ctx->histSize - 1) { - if (ctx->histCurr) HeapFree(GetProcessHeap(), 0, ctx->histCurr); + HeapFree(GetProcessHeap(), 0, ctx->histCurr); ctx->histCurr = HeapAlloc(GetProcessHeap(), 0, (ctx->len + 1) * sizeof(WCHAR)); memcpy(ctx->histCurr, ctx->line, (ctx->len + 1) * sizeof(WCHAR)); } @@ -865,6 +862,6 @@ CONSOLE_AppendHistory(ctx.line); CloseHandle(ctx.hConOut); - if (ctx.histCurr) HeapFree(GetProcessHeap(), 0, ctx.histCurr); + HeapFree(GetProcessHeap(), 0, ctx.histCurr); return ctx.line; } diff -urN wine-20041201/dlls/kernel/environ.c wine-20050111/dlls/kernel/environ.c --- wine-20041201/dlls/kernel/environ.c 2004-10-25 23:47:23.000000000 +0200 +++ wine-20050111/dlls/kernel/environ.c 2004-12-23 19:48:47.000000000 +0100 @@ -325,7 +325,7 @@ else ret = ExpandEnvironmentStringsW( us_src.Buffer, NULL, 0); RtlFreeUnicodeString( &us_src ); - if (dstW) HeapFree(GetProcessHeap(), 0, dstW); + HeapFree(GetProcessHeap(), 0, dstW); return ret; } diff -urN wine-20041201/dlls/kernel/except.c wine-20050111/dlls/kernel/except.c --- wine-20041201/dlls/kernel/except.c 2004-06-01 21:45:15.000000000 +0200 +++ wine-20050111/dlls/kernel/except.c 2004-12-14 21:03:23.000000000 +0100 @@ -135,8 +135,12 @@ rec->ExceptionInformation[0]); break; case EXCEPTION_WINE_STUB: - len = snprintf( buffer, size, "Unimplemented function %s.%s called", - (char *)rec->ExceptionInformation[0], (char *)rec->ExceptionInformation[1] ); + if (HIWORD(rec->ExceptionInformation[1])) + len = snprintf( buffer, size, "Unimplemented function %s.%s called", + (char *)rec->ExceptionInformation[0], (char *)rec->ExceptionInformation[1] ); + else + len = snprintf( buffer, size, "Unimplemented function %s.%ld called", + (char *)rec->ExceptionInformation[0], rec->ExceptionInformation[1] ); break; case EXCEPTION_WINE_ASSERTION: len = snprintf( buffer, size, "Assertion failed" ); diff -urN wine-20041201/dlls/kernel/file.c wine-20050111/dlls/kernel/file.c --- wine-20041201/dlls/kernel/file.c 2004-11-28 15:58:11.000000000 +0100 +++ wine-20050111/dlls/kernel/file.c 2005-01-11 16:09:01.000000000 +0100 @@ -681,9 +681,7 @@ if (is_console_handle( hFile )) { /* this will fail (as expected) for an output handle */ - /* FIXME: wait until FlushFileBuffers is moved to dll/kernel */ - /* return FlushConsoleInputBuffer( hFile ); */ - return TRUE; + return FlushConsoleInputBuffer( hFile ); } nts = NtFlushBuffersFile( hFile, &ioblk ); if (nts != STATUS_SUCCESS) @@ -1183,9 +1181,6 @@ static const WCHAR coninW[] = {'C','O','N','I','N','$',0}; static const WCHAR conoutW[] = {'C','O','N','O','U','T','$',0}; - static const char * const creation_name[5] = - { "CREATE_NEW", "CREATE_ALWAYS", "OPEN_EXISTING", "OPEN_ALWAYS", "TRUNCATE_EXISTING" }; - static const UINT nt_disposition[5] = { FILE_CREATE, /* CREATE_NEW */ @@ -1204,20 +1199,14 @@ return INVALID_HANDLE_VALUE; } - if (creation < CREATE_NEW || creation > TRUNCATE_EXISTING) - { - SetLastError( ERROR_INVALID_PARAMETER ); - return INVALID_HANDLE_VALUE; - } - - TRACE("%s %s%s%s%s%s%s%s attributes 0x%lx\n", debugstr_w(filename), + TRACE("%s %s%s%s%s%s%s creation %ld attributes 0x%lx\n", debugstr_w(filename), (access & GENERIC_READ)?"GENERIC_READ ":"", (access & GENERIC_WRITE)?"GENERIC_WRITE ":"", (!access)?"QUERY_ACCESS ":"", (sharing & FILE_SHARE_READ)?"FILE_SHARE_READ ":"", (sharing & FILE_SHARE_WRITE)?"FILE_SHARE_WRITE ":"", (sharing & FILE_SHARE_DELETE)?"FILE_SHARE_DELETE ":"", - creation_name[creation - CREATE_NEW], attributes); + creation, attributes); /* Open a console for CONIN$ or CONOUT$ */ @@ -1258,7 +1247,7 @@ static const WCHAR conW[] = {'C','O','N'}; if (LOWORD(dosdev) == sizeof(conW) && - !memicmpW( filename + HIWORD(dosdev)/sizeof(WCHAR), conW, sizeof(conW))) + !memicmpW( filename + HIWORD(dosdev)/sizeof(WCHAR), conW, sizeof(conW)/sizeof(WCHAR))) { switch (access & (GENERIC_READ|GENERIC_WRITE)) { @@ -1275,6 +1264,12 @@ } } + if (creation < CREATE_NEW || creation > TRUNCATE_EXISTING) + { + SetLastError( ERROR_INVALID_PARAMETER ); + return INVALID_HANDLE_VALUE; + } + if (!RtlDosPathNameToNtPathName_U( filename, &nameW, NULL, NULL )) { SetLastError( ERROR_PATH_NOT_FOUND ); @@ -1523,7 +1518,7 @@ return (HANDLE)info; error: - if (info) HeapFree( GetProcessHeap(), 0, info ); + HeapFree( GetProcessHeap(), 0, info ); RtlFreeUnicodeString( &nt_name ); return INVALID_HANDLE_VALUE; } diff -urN wine-20041201/dlls/kernel/file16.c wine-20050111/dlls/kernel/file16.c --- wine-20041201/dlls/kernel/file16.c 2004-05-01 07:25:08.000000000 +0200 +++ wine-20050111/dlls/kernel/file16.c 2004-12-23 19:48:47.000000000 +0100 @@ -402,7 +402,7 @@ ret = GetTempFileNameA( temppath, prefix16, unique, buffer ); - if (prefix16) HeapFree(GetProcessHeap(), 0, prefix16); + HeapFree(GetProcessHeap(), 0, prefix16); return ret; } diff -urN wine-20041201/dlls/kernel/format_msg.c wine-20050111/dlls/kernel/format_msg.c --- wine-20041201/dlls/kernel/format_msg.c 2004-07-21 00:12:21.000000000 +0200 +++ wine-20050111/dlls/kernel/format_msg.c 2004-12-23 19:48:47.000000000 +0100 @@ -330,7 +330,7 @@ lstrcpynA(lpBuffer,target,nSize); } HeapFree(GetProcessHeap(),0,target); - if (from) HeapFree(GetProcessHeap(),0,from); + HeapFree(GetProcessHeap(),0,from); TRACE("-- returning %d\n", (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? strlen(*(LPSTR*)lpBuffer):strlen(lpBuffer)); return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? strlen(*(LPSTR*)lpBuffer): @@ -543,7 +543,7 @@ else lstrcpynW(lpBuffer, target, nSize); HeapFree(GetProcessHeap(),0,target); - if (from) HeapFree(GetProcessHeap(),0,from); + HeapFree(GetProcessHeap(),0,from); TRACE("ret=%s\n", wine_dbgstr_w((dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? *(LPWSTR*)lpBuffer : lpBuffer)); return (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) ? diff -urN wine-20041201/dlls/kernel/global16.c wine-20050111/dlls/kernel/global16.c --- wine-20041201/dlls/kernel/global16.c 2004-08-11 01:43:21.000000000 +0200 +++ wine-20050111/dlls/kernel/global16.c 2004-12-23 19:48:47.000000000 +0100 @@ -442,7 +442,7 @@ TRACE("%04x\n", handle ); if (!GLOBAL_FreeBlock( handle )) return handle; /* failed */ - if (ptr) HeapFree( GetProcessHeap(), 0, ptr ); + HeapFree( GetProcessHeap(), 0, ptr ); return 0; } diff -urN wine-20041201/dlls/kernel/heap.c wine-20050111/dlls/kernel/heap.c --- wine-20041201/dlls/kernel/heap.c 2004-10-23 00:27:51.000000000 +0200 +++ wine-20050111/dlls/kernel/heap.c 2004-12-27 18:06:18.000000000 +0100 @@ -1179,7 +1179,7 @@ VOID WINAPI GlobalMemoryStatus( LPMEMORYSTATUS lpBuffer ) { MEMORYSTATUSEX memstatus; - OSVERSIONINFOA osver; + OSVERSIONINFOW osver; /* Because GlobalMemoryStatus is identical to GlobalMemoryStatusEX save for one extra field in the struct, and the lack of a bug, we simply @@ -1193,7 +1193,9 @@ * NT reports values modulo 4 Gb. * Values between 2 Gb and 4 Gb are rounded down to 2 Gb. */ - GetVersionExA(&osver); + + osver.dwOSVersionInfoSize = sizeof(osver); + GetVersionExW(&osver); if ( osver.dwMajorVersion >= 5 ) { diff -urN wine-20041201/dlls/kernel/kernel32.spec wine-20050111/dlls/kernel/kernel32.spec --- wine-20041201/dlls/kernel/kernel32.spec 2004-10-20 01:50:36.000000000 +0200 +++ wine-20050111/dlls/kernel/kernel32.spec 2005-01-03 15:32:16.000000000 +0100 @@ -246,13 +246,13 @@ @ stdcall EndUpdateResourceW(long long) @ stdcall EnterCriticalSection(ptr) ntdll.RtlEnterCriticalSection @ stdcall EnumCalendarInfoA(ptr long long long) -@ stub EnumCalendarInfoW -@ stub EnumCalendarInfoExA -@ stub EnumCalendarInfoExW +@ stdcall EnumCalendarInfoW(ptr long long long) +@ stdcall EnumCalendarInfoExA(ptr long long long) +@ stdcall EnumCalendarInfoExW(ptr long long long) @ stdcall EnumDateFormatsA(ptr long long) @ stdcall EnumDateFormatsW(ptr long long) -@ stub EnumDateFormatsExA -@ stub EnumDateFormatsExW +@ stdcall EnumDateFormatsExA(ptr long long) +@ stdcall EnumDateFormatsExW(ptr long long) @ stdcall EnumLanguageGroupLocalesA(ptr long long ptr) @ stdcall EnumLanguageGroupLocalesW(ptr long long ptr) @ stdcall EnumResourceLanguagesA(long str str ptr long) diff -urN wine-20041201/dlls/kernel/lcformat.c wine-20050111/dlls/kernel/lcformat.c --- wine-20041201/dlls/kernel/lcformat.c 2004-02-07 02:28:45.000000000 +0100 +++ wine-20050111/dlls/kernel/lcformat.c 2005-01-07 18:08:55.000000000 +0100 @@ -409,7 +409,7 @@ if (!lpTime) { - GetSystemTime(&st); /* Default to current time */ + GetLocalTime(&st); /* Default to current time */ lpTime = &st; } else @@ -1581,6 +1581,26 @@ */ /************************************************************************** + * EnumDateFormatsExA (KERNEL32.@) + */ +BOOL WINAPI EnumDateFormatsExA( DATEFMT_ENUMPROCEXA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags ) +{ + FIXME("(%p, %ld, %ld): stub\n", lpDateFmtEnumProc, Locale, dwFlags); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/************************************************************************** + * EnumDateFormatsExW (KERNEL32.@) + */ +BOOL WINAPI EnumDateFormatsExW( DATEFMT_ENUMPROCEXW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags ) +{ + FIXME("(%p, %ld, %ld): stub\n", lpDateFmtEnumProc, Locale, dwFlags); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return FALSE; +} + +/************************************************************************** * EnumDateFormatsA (KERNEL32.@) */ BOOL WINAPI EnumDateFormatsA( DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags) @@ -1935,11 +1955,186 @@ } /****************************************************************************** + * NLS_EnumCalendarInfoAW + * Enumerates calendar information for a specified locale. + * + * PARAMS + * calinfoproc [I] Pointer to the callback + * locale [I] The locale for which to retrieve calendar information. + * This parameter can be a locale identifier created by the + * MAKELCID macro, or one of the following values: + * LOCALE_SYSTEM_DEFAULT + * Use the default system locale. + * LOCALE_USER_DEFAULT + * Use the default user locale. + * calendar [I] The calendar for which information is requested, or + * ENUM_ALL_CALENDARS. + * caltype [I] The type of calendar information to be returned. Note + * that only one CALTYPE value can be specified per call + * of this function, except where noted. + * unicode [I] Specifies if the callback expects a unicode string. + * ex [I] Specifies if the callback needs the calendar identifier. + * + * RETURNS + * Success: TRUE. + * Failure: FALSE. Use GetLastError() to determine the cause. + * + * NOTES + * When the ANSI version of this function is used with a Unicode-only LCID, + * the call can succeed because the system uses the system code page. + * However, characters that are undefined in the system code page appear + * in the string as a question mark (?). + * + * TODO + * The above note should be respected by GetCalendarInfoA. + */ +BOOL WINAPI NLS_EnumCalendarInfoAW(void *calinfoproc, LCID locale, + CALID calendar, CALTYPE caltype, BOOL unicode, BOOL ex ) +{ + WCHAR *buf, *opt = NULL, *iter = NULL; + BOOL ret = FALSE; + int bufSz = 200; /* the size of the buffer */ + + if (calinfoproc == NULL) + { + SetLastError(ERROR_INVALID_PARAMETER); + return FALSE; + } + + buf = HeapAlloc(GetProcessHeap(), 0, bufSz); + if (buf == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + return FALSE; + } + + if (calendar == ENUM_ALL_CALENDARS) + { + int optSz = GetLocaleInfoW(locale, LOCALE_IOPTIONALCALENDAR, NULL, 0); + if (optSz > 1) + { + opt = HeapAlloc(GetProcessHeap(), 0, optSz * sizeof(WCHAR)); + if (opt == NULL) + { + SetLastError(ERROR_NOT_ENOUGH_MEMORY); + goto NLS_EnumCalendarInfoAW_Cleanup; + } + if (GetLocaleInfoW(locale, LOCALE_IOPTIONALCALENDAR, opt, optSz)) + iter = opt; + } + calendar = NLS_GetLocaleNumber(locale, LOCALE_ICALENDARTYPE); + } + + while (TRUE) /* loop through calendars */ + { + do /* loop until there's no error */ + { + if (unicode) + ret = GetCalendarInfoW(locale, calendar, caltype, buf, bufSz / sizeof(WCHAR), NULL); + else ret = GetCalendarInfoA(locale, calendar, caltype, (CHAR*)buf, bufSz / sizeof(CHAR), NULL); + + if (!ret) + { + if (GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { /* so resize it */ + int newSz; + if (unicode) + newSz = GetCalendarInfoW(locale, calendar, caltype, NULL, 0, NULL) * sizeof(WCHAR); + else newSz = GetCalendarInfoA(locale, calendar, caltype, NULL, 0, NULL) * sizeof(CHAR); + if (bufSz >= newSz) + { + ERR("Buffer resizing disorder: was %d, requested %d.\n", bufSz, newSz); + goto NLS_EnumCalendarInfoAW_Cleanup; + } + bufSz = newSz; + WARN("Buffer too small; resizing to %d bytes.\n", bufSz); + buf = HeapReAlloc(GetProcessHeap(), 0, buf, bufSz); + if (buf == NULL) + goto NLS_EnumCalendarInfoAW_Cleanup; + } else goto NLS_EnumCalendarInfoAW_Cleanup; + } + } while (!ret); + + /* Here we are. We pass the buffer to the correct version of + * the callback. Because it's not the same number of params, + * we must check for Ex, but we don't care about Unicode + * because the buffer is already in the correct format. + */ + if (ex) { + ret = ((CALINFO_ENUMPROCEXW)calinfoproc)(buf, calendar); + } else + ret = ((CALINFO_ENUMPROCW)calinfoproc)(buf); + + if (!ret) { /* the callback told to stop */ + ret = TRUE; + break; + } + + if ((iter == NULL) || (*iter == 0)) /* no more calendars */ + break; + + calendar = 0; + while ((*iter >= '0') && (*iter <= '9')) + calendar = calendar * 10 + *iter++ - '0'; + + if (*iter++ != 0) + { + SetLastError(ERROR_BADDB); + ret = FALSE; + break; + } + } + +NLS_EnumCalendarInfoAW_Cleanup: + HeapFree(GetProcessHeap(), 0, opt); + HeapFree(GetProcessHeap(), 0, buf); + return ret; +} + +/****************************************************************************** * EnumCalendarInfoA [KERNEL32.@] + * + * See EnumCalendarInfoAW. */ BOOL WINAPI EnumCalendarInfoA( CALINFO_ENUMPROCA calinfoproc,LCID locale, CALID calendar,CALTYPE caltype ) { - FIXME("(%p,0x%04lx,0x%08lx,0x%08lx),stub!\n",calinfoproc,locale,calendar,caltype); - return FALSE; + TRACE("(%p,0x%08lx,0x%08lx,0x%08lx)\n", calinfoproc, locale, calendar, caltype); + return NLS_EnumCalendarInfoAW(calinfoproc, locale, calendar, caltype, FALSE, FALSE); +} + +/****************************************************************************** + * EnumCalendarInfoW [KERNEL32.@] + * + * See EnumCalendarInfoAW. + */ +BOOL WINAPI EnumCalendarInfoW( CALINFO_ENUMPROCW calinfoproc,LCID locale, + CALID calendar,CALTYPE caltype ) +{ + TRACE("(%p,0x%08lx,0x%08lx,0x%08lx)\n", calinfoproc, locale, calendar, caltype); + return NLS_EnumCalendarInfoAW(calinfoproc, locale, calendar, caltype, TRUE, FALSE); +} + +/****************************************************************************** + * EnumCalendarInfoExA [KERNEL32.@] + * + * See EnumCalendarInfoAW. + */ +BOOL WINAPI EnumCalendarInfoExA( CALINFO_ENUMPROCEXA calinfoproc,LCID locale, + CALID calendar,CALTYPE caltype ) +{ + TRACE("(%p,0x%08lx,0x%08lx,0x%08lx)\n", calinfoproc, locale, calendar, caltype); + return NLS_EnumCalendarInfoAW(calinfoproc, locale, calendar, caltype, FALSE, TRUE); +} + +/****************************************************************************** + * EnumCalendarInfoExW [KERNEL32.@] + * + * See EnumCalendarInfoAW. + */ +BOOL WINAPI EnumCalendarInfoExW( CALINFO_ENUMPROCEXW calinfoproc,LCID locale, + CALID calendar,CALTYPE caltype ) +{ + TRACE("(%p,0x%08lx,0x%08lx,0x%08lx)\n", calinfoproc, locale, calendar, caltype); + return NLS_EnumCalendarInfoAW(calinfoproc, locale, calendar, caltype, TRUE, TRUE); } diff -urN wine-20041201/dlls/kernel/local16.c wine-20050111/dlls/kernel/local16.c --- wine-20041201/dlls/kernel/local16.c 2004-01-09 23:18:50.000000000 +0100 +++ wine-20050111/dlls/kernel/local16.c 2004-12-23 19:48:47.000000000 +0100 @@ -1927,7 +1927,7 @@ selectorOdd = SELECTOR_AllocBlock( base + 0x8000, totSize - 0x8000, WINE_LDT_FLAGS_DATA ); if ( !selectorTable || !selectorEven || !selectorOdd ) { - if ( selectorTable ) HeapFree( header->heap, 0, selectorTable ); + HeapFree( header->heap, 0, selectorTable ); if ( selectorEven ) SELECTOR_FreeBlock( selectorEven ); if ( selectorOdd ) SELECTOR_FreeBlock( selectorOdd ); HeapDestroy( header->heap ); diff -urN wine-20041201/dlls/kernel/locale.c wine-20050111/dlls/kernel/locale.c --- wine-20041201/dlls/kernel/locale.c 2004-11-21 16:47:24.000000000 +0100 +++ wine-20050111/dlls/kernel/locale.c 2004-12-23 19:48:47.000000000 +0100 @@ -2267,12 +2267,10 @@ } } - if (dstW) - HeapFree(GetProcessHeap(), 0, dstW); + HeapFree(GetProcessHeap(), 0, dstW); FoldStringA_exit: - if (srcW) - HeapFree(GetProcessHeap(), 0, srcW); + HeapFree(GetProcessHeap(), 0, srcW); return ret; } diff -urN wine-20041201/dlls/kernel/module.c wine-20050111/dlls/kernel/module.c --- wine-20041201/dlls/kernel/module.c 2004-09-10 23:16:02.000000000 +0200 +++ wine-20050111/dlls/kernel/module.c 2004-12-17 20:01:22.000000000 +0100 @@ -441,7 +441,7 @@ * This function always returns the long path of hModule (as opposed to * GetModuleFileName16() which returns short paths when the modules version * field is < 4.0). - * The function doesn't write a terminating '\0' is the buffer is too + * The function doesn't write a terminating '\0' if the buffer is too * small. */ DWORD WINAPI GetModuleFileNameA( diff -urN wine-20041201/dlls/kernel/ne_module.c wine-20050111/dlls/kernel/ne_module.c --- wine-20041201/dlls/kernel/ne_module.c 2004-10-22 21:55:14.000000000 +0200 +++ wine-20050111/dlls/kernel/ne_module.c 2004-12-23 19:48:47.000000000 +0100 @@ -32,19 +32,14 @@ #endif #include -#include "ntstatus.h" #include "windef.h" -#include "winbase.h" #include "wine/winbase16.h" -#include "winerror.h" #include "wownt32.h" #include "module.h" #include "toolhelp.h" #include "builtin16.h" #include "stackframe.h" #include "excpt.h" -#include "kernel_private.h" -#include "wine/unicode.h" #include "wine/exception.h" #include "wine/debug.h" @@ -731,7 +726,7 @@ buffer )) { HeapFree( GetProcessHeap(), 0, buffer ); - if (fastload) HeapFree( GetProcessHeap(), 0, fastload ); + HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); return (HMODULE16)11; /* invalid exe */ } @@ -745,7 +740,7 @@ } else { - if (fastload) HeapFree( GetProcessHeap(), 0, fastload ); + HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); return (HMODULE16)11; /* invalid exe */ } @@ -771,7 +766,7 @@ ne_header.ne_modtab - ne_header.ne_restab, pData )) { - if (fastload) HeapFree( GetProcessHeap(), 0, fastload ); + HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); return (HMODULE16)11; /* invalid exe */ } @@ -786,7 +781,7 @@ ne_header.ne_cmod * sizeof(WORD), pData )) { - if (fastload) HeapFree( GetProcessHeap(), 0, fastload ); + HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); return (HMODULE16)11; /* invalid exe */ } @@ -801,7 +796,7 @@ ne_header.ne_enttab - ne_header.ne_imptab, pData )) { - if (fastload) HeapFree( GetProcessHeap(), 0, fastload ); + HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); return (HMODULE16)11; /* invalid exe */ } @@ -819,7 +814,7 @@ ne_header.ne_cbenttab, pTempEntryTable )) { HeapFree( GetProcessHeap(), 0, pTempEntryTable ); - if (fastload) HeapFree( GetProcessHeap(), 0, fastload ); + HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); return (HMODULE16)11; /* invalid exe */ } @@ -883,7 +878,7 @@ } else { - if (fastload) HeapFree( GetProcessHeap(), 0, fastload ); + HeapFree( GetProcessHeap(), 0, fastload ); GlobalFree16( hModule ); return (HMODULE16)11; /* invalid exe */ } @@ -907,7 +902,7 @@ /* Free the fast-load area */ #undef READ - if (fastload) HeapFree( GetProcessHeap(), 0, fastload ); + HeapFree( GetProcessHeap(), 0, fastload ); /* Get the non-resident names table */ diff -urN wine-20041201/dlls/kernel/path.c wine-20050111/dlls/kernel/path.c --- wine-20041201/dlls/kernel/path.c 2004-11-22 19:25:05.000000000 +0100 +++ wine-20050111/dlls/kernel/path.c 2004-12-23 19:48:47.000000000 +0100 @@ -226,7 +226,7 @@ RtlFreeUnicodeString( &source_name ); RtlFreeUnicodeString( &dest_name ); if (Reboot) NtClose(Reboot); - if (Buffer) HeapFree( GetProcessHeap(), 0, Buffer ); + HeapFree( GetProcessHeap(), 0, Buffer ); return(rc); } @@ -550,7 +550,7 @@ /*********************************************************************** * GetTempPathA (KERNEL32.@) */ -UINT WINAPI GetTempPathA( UINT count, LPSTR path ) +DWORD WINAPI GetTempPathA( DWORD count, LPSTR path ) { WCHAR pathW[MAX_PATH]; UINT ret; @@ -572,14 +572,14 @@ /*********************************************************************** * GetTempPathW (KERNEL32.@) */ -UINT WINAPI GetTempPathW( UINT count, LPWSTR path ) +DWORD WINAPI GetTempPathW( DWORD count, LPWSTR path ) { static const WCHAR tmp[] = { 'T', 'M', 'P', 0 }; static const WCHAR temp[] = { 'T', 'E', 'M', 'P', 0 }; WCHAR tmp_path[MAX_PATH]; UINT ret; - TRACE("%u,%p\n", count, path); + TRACE("%lu,%p\n", count, path); if (!(ret = GetEnvironmentVariableW( tmp, tmp_path, MAX_PATH ))) if (!(ret = GetEnvironmentVariableW( temp, tmp_path, MAX_PATH ))) @@ -638,7 +638,7 @@ ret = GetTempFileNameW(pathW, prefixW, unique, bufferW); if (ret) FILE_name_WtoA( bufferW, -1, buffer, MAX_PATH ); - if (prefixW) HeapFree( GetProcessHeap(), 0, prefixW ); + HeapFree( GetProcessHeap(), 0, prefixW ); return ret; } @@ -830,7 +830,7 @@ ret = SearchPathW(pathW, nameW, extW, MAX_PATH, bufferW, NULL); HeapFree( GetProcessHeap(), 0, pathW ); - if (extW) HeapFree( GetProcessHeap(), 0, extW ); + HeapFree( GetProcessHeap(), 0, extW ); if (!ret) return 0; if (ret > MAX_PATH) @@ -1218,7 +1218,7 @@ if (template && !(templateW = FILE_name_AtoW( template, TRUE ))) return FALSE; ret = CreateDirectoryExW( templateW, pathW, sa ); - if (templateW) HeapFree( GetProcessHeap(), 0, templateW ); + HeapFree( GetProcessHeap(), 0, templateW ); return ret; } diff -urN wine-20041201/dlls/kernel/powermgnt.c wine-20050111/dlls/kernel/powermgnt.c --- wine-20041201/dlls/kernel/powermgnt.c 2003-09-06 01:08:37.000000000 +0200 +++ wine-20050111/dlls/kernel/powermgnt.c 2004-12-15 11:54:44.000000000 +0100 @@ -19,7 +19,6 @@ #include -#include "ntstatus.h" #include "windef.h" #include "winbase.h" #include "wine/debug.h" diff -urN wine-20041201/dlls/kernel/process.c wine-20050111/dlls/kernel/process.c --- wine-20041201/dlls/kernel/process.c 2004-10-30 04:11:33.000000000 +0200 +++ wine-20050111/dlls/kernel/process.c 2004-12-23 19:48:47.000000000 +0100 @@ -835,7 +835,7 @@ RtlInitUnicodeString( &dir_str, DIR_Windows ); RtlSetCurrentDirectory_U( &dir_str ); } - if (cwd) HeapFree( GetProcessHeap(), 0, cwd ); + HeapFree( GetProcessHeap(), 0, cwd ); done: if (!cur_dir->Handle) chdir("/"); /* change to root directory so as not to lock cdroms */ @@ -1849,9 +1849,9 @@ ret = CreateProcessW( app_nameW, cmd_lineW, process_attr, thread_attr, inherit, flags, env, cur_dirW, &infoW, info ); done: - if (app_nameW) HeapFree( GetProcessHeap(), 0, app_nameW ); - if (cmd_lineW) HeapFree( GetProcessHeap(), 0, cmd_lineW ); - if (cur_dirW) HeapFree( GetProcessHeap(), 0, cur_dirW ); + HeapFree( GetProcessHeap(), 0, app_nameW ); + HeapFree( GetProcessHeap(), 0, cmd_lineW ); + HeapFree( GetProcessHeap(), 0, cur_dirW ); RtlFreeUnicodeString( &desktopW ); RtlFreeUnicodeString( &titleW ); return ret; @@ -1988,7 +1988,7 @@ done: if (tidy_cmdline != cmd_line) HeapFree( GetProcessHeap(), 0, tidy_cmdline ); if (envW != env) HeapFree( GetProcessHeap(), 0, envW ); - if (unixdir) HeapFree( GetProcessHeap(), 0, unixdir ); + HeapFree( GetProcessHeap(), 0, unixdir ); return retv; } @@ -2233,7 +2233,7 @@ * * RETURNS * Success: Value stored in calling thread's TLS slot for index - * Failure: 0 and GetLastError returns NO_ERROR + * Failure: 0 and GetLastError() returns NO_ERROR */ LPVOID WINAPI TlsGetValue( DWORD index) /* [in] TLS index to retrieve value for */ @@ -2690,7 +2690,9 @@ * minset [I] Specifies minimum working set size * maxset [I] Specifies maximum working set size * - * RETURNS STD + * RETURNS + * Success: TRUE + * Failure: FALSE */ BOOL WINAPI SetProcessWorkingSetSize(HANDLE hProcess, SIZE_T minset, SIZE_T maxset) @@ -2838,7 +2840,7 @@ */ DWORD WINAPI RegisterServiceProcess(DWORD dwProcessId, DWORD dwType) { - /* I don't think that Wine needs to do anything in that function */ + /* I don't think that Wine needs to do anything in this function */ return 1; /* success */ } @@ -2847,8 +2849,18 @@ * GetSystemMSecCount (SYSTEM.6) * GetTickCount (KERNEL32.@) * - * Returns the number of milliseconds, modulo 2^32, since the start - * of the wineserver. + * Get the number of milliseconds the system has been running. + * + * PARANS + * None. + * + * RETURNS + * The current tick count. + * + * NOTES + * -The value returned will wrap arounf every 2^32 milliseconds. + * -Under Windows, tick 0 is the moment at which the system is rebooted. + * Under Wine, tick 0 begins at the moment the wineserver process is started, */ DWORD WINAPI GetTickCount(void) { @@ -2860,6 +2872,14 @@ /*********************************************************************** * GetCurrentProcess (KERNEL32.@) + * + * Get a handle to the current process. + * + * PARAMS + * None. + * + * RETURNS + * A handle representing the current process. */ #undef GetCurrentProcess HANDLE WINAPI GetCurrentProcess(void) diff -urN wine-20041201/dlls/kernel/profile.c wine-20050111/dlls/kernel/profile.c --- wine-20041201/dlls/kernel/profile.c 2004-07-16 04:45:00.000000000 +0200 +++ wine-20050111/dlls/kernel/profile.c 2005-01-11 11:43:24.000000000 +0100 @@ -263,7 +263,7 @@ for (key = section->key; key; key = next_key) { next_key = key->next; - if (key->value) HeapFree( GetProcessHeap(), 0, key->value ); + HeapFree( GetProcessHeap(), 0, key->value ); HeapFree( GetProcessHeap(), 0, key ); } next_section = section->next; @@ -550,7 +550,7 @@ { PROFILEKEY *to_del = *key; *key = to_del->next; - if (to_del->value) HeapFree( GetProcessHeap(), 0, to_del->value); + HeapFree( GetProcessHeap(), 0, to_del->value); HeapFree( GetProcessHeap(), 0, to_del ); return TRUE; } @@ -580,7 +580,7 @@ { PROFILEKEY *to_del = *key; *key = to_del->next; - if (to_del->value) HeapFree( GetProcessHeap(), 0, to_del->value); + HeapFree( GetProcessHeap(), 0, to_del->value); HeapFree( GetProcessHeap(), 0, to_del ); CurProfile->changed =TRUE; } @@ -707,7 +707,7 @@ { PROFILE_FlushFile(); PROFILE_Free( CurProfile->section ); - if (CurProfile->filename) HeapFree( GetProcessHeap(), 0, CurProfile->filename ); + HeapFree( GetProcessHeap(), 0, CurProfile->filename ); CurProfile->changed = FALSE; CurProfile->section = NULL; CurProfile->filename = NULL; @@ -774,26 +774,35 @@ for(i=0;ifilename && !strcmpW( buffer, MRUProfile[i]->filename ))) - { - TRACE("MRU Filename: %s, new filename: %s\n", debugstr_w(MRUProfile[i]->filename), debugstr_w(buffer)); - if(i) - { - PROFILE_FlushFile(); - tempProfile=MRUProfile[i]; - for(j=i;j>0;j--) - MRUProfile[j]=MRUProfile[j-1]; - CurProfile=tempProfile; - } - GetFileTime(hFile, NULL, NULL, &LastWriteTime); - if(memcmp(&CurProfile->LastWriteTime, &LastWriteTime, sizeof(FILETIME))) - TRACE("(%s): already opened (mru=%d)\n", - debugstr_w(buffer), i ); - else - TRACE("(%s): already opened, needs refreshing (mru=%d)\n", - debugstr_w(buffer), i ); - CloseHandle(hFile); - return TRUE; + if ((MRUProfile[i]->filename && !strcmpiW( buffer, MRUProfile[i]->filename ))) + { + TRACE("MRU Filename: %s, new filename: %s\n", debugstr_w(MRUProfile[i]->filename), debugstr_w(buffer)); + if(i) + { + PROFILE_FlushFile(); + tempProfile=MRUProfile[i]; + for(j=i;j>0;j--) + MRUProfile[j]=MRUProfile[j-1]; + CurProfile=tempProfile; + } + + if (hFile != INVALID_HANDLE_VALUE) + { + if (TRACE_ON(profile)) + { + GetFileTime(hFile, NULL, NULL, &LastWriteTime); + if (memcmp(&CurProfile->LastWriteTime, &LastWriteTime, sizeof(FILETIME))) + TRACE("(%s): already opened (mru=%d)\n", + debugstr_w(buffer), i); + else + TRACE("(%s): already opened, needs refreshing (mru=%d)\n", + debugstr_w(buffer), i); + } + CloseHandle(hFile); + } + else TRACE("(%s): already opened, not yet created (mru=%d)\n", + debugstr_w(buffer), i); + return TRUE; } } @@ -1170,7 +1179,7 @@ RtlFreeUnicodeString(&entryW); RtlFreeUnicodeString(&def_valW); RtlFreeUnicodeString(&filenameW); - if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW); + HeapFree(GetProcessHeap(), 0, bufferW); return ret; } @@ -1214,7 +1223,7 @@ RtlFreeUnicodeString(&entryW); RtlFreeUnicodeString(&def_valW); RtlFreeUnicodeString(&filenameW); - if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW); + HeapFree(GetProcessHeap(), 0, bufferW); return ret; } @@ -1381,7 +1390,7 @@ RtlFreeUnicodeString(§ionW); RtlFreeUnicodeString(&filenameW); - if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW); + HeapFree(GetProcessHeap(), 0, bufferW); return ret; } @@ -1632,7 +1641,7 @@ } RtlFreeUnicodeString(&filenameW); - if (bufferW) HeapFree(GetProcessHeap(), 0, bufferW); + HeapFree(GetProcessHeap(), 0, bufferW); return ret; } diff -urN wine-20041201/dlls/kernel/resource.c wine-20050111/dlls/kernel/resource.c --- wine-20041201/dlls/kernel/resource.c 2004-09-29 23:10:44.000000000 +0200 +++ wine-20050111/dlls/kernel/resource.c 2005-01-03 15:56:42.000000000 +0100 @@ -288,7 +288,7 @@ if (newlen + 1 > len) { len = newlen + 1; - if (type) HeapFree( GetProcessHeap(), 0, type ); + HeapFree( GetProcessHeap(), 0, type ); if (!(type = HeapAlloc( GetProcessHeap(), 0, len ))) return FALSE; } WideCharToMultiByte( CP_ACP, 0, str->NameString, str->Length, type, len, NULL, NULL); @@ -301,7 +301,7 @@ } if (!ret) break; } - if (type) HeapFree( GetProcessHeap(), 0, type ); + HeapFree( GetProcessHeap(), 0, type ); return ret; } @@ -337,7 +337,7 @@ if (str->Length + 1 > len) { len = str->Length + 1; - if (type) HeapFree( GetProcessHeap(), 0, type ); + HeapFree( GetProcessHeap(), 0, type ); if (!(type = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) return FALSE; } memcpy(type, str->NameString, str->Length * sizeof (WCHAR)); @@ -350,7 +350,7 @@ } if (!ret) break; } - if (type) HeapFree( GetProcessHeap(), 0, type ); + HeapFree( GetProcessHeap(), 0, type ); return ret; } @@ -393,7 +393,7 @@ if (newlen + 1 > len) { len = newlen + 1; - if (name) HeapFree( GetProcessHeap(), 0, name ); + HeapFree( GetProcessHeap(), 0, name ); if (!(name = HeapAlloc(GetProcessHeap(), 0, len + 1 ))) { ret = FALSE; @@ -411,7 +411,7 @@ if (!ret) break; } done: - if (name) HeapFree( GetProcessHeap(), 0, name ); + HeapFree( GetProcessHeap(), 0, name ); if (HIWORD(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); return ret; @@ -454,7 +454,7 @@ if (str->Length + 1 > len) { len = str->Length + 1; - if (name) HeapFree( GetProcessHeap(), 0, name ); + HeapFree( GetProcessHeap(), 0, name ); if (!(name = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ))) { ret = FALSE; @@ -472,7 +472,7 @@ if (!ret) break; } done: - if (name) HeapFree( GetProcessHeap(), 0, name ); + HeapFree( GetProcessHeap(), 0, name ); if (HIWORD(typeW.Buffer)) HeapFree( GetProcessHeap(), 0, typeW.Buffer ); if (status != STATUS_SUCCESS) SetLastError( RtlNtStatusToDosError(status) ); return ret; @@ -747,7 +747,7 @@ done: if(!ret && current_updates) { - if(current_updates->pFileName) HeapFree(GetProcessHeap(), 0, current_updates->pFileName); + HeapFree(GetProcessHeap(), 0, current_updates->pFileName); GlobalUnlock(hUpdate); GlobalFree(hUpdate); hUpdate = NULL; @@ -811,10 +811,10 @@ list_remove(¤t_resource->entry); if(HIWORD(current_resource->lpType)) HeapFree(GetProcessHeap(), 0, current_resource->lpType); if(HIWORD(current_resource->lpName)) HeapFree(GetProcessHeap(), 0, current_resource->lpName); - if(current_resource->lpData) HeapFree(GetProcessHeap(), 0, current_resource->lpData); + HeapFree(GetProcessHeap(), 0, current_resource->lpData); HeapFree(GetProcessHeap(), 0, current_resource); } - if(current_updates->pFileName) HeapFree(GetProcessHeap(), 0, current_updates->pFileName); + HeapFree(GetProcessHeap(), 0, current_updates->pFileName); GlobalUnlock(hUpdate); GlobalFree(hUpdate); } @@ -890,7 +890,7 @@ { if(HIWORD(current_resource->lpType)) HeapFree(GetProcessHeap(), 0, current_resource->lpType); if(HIWORD(current_resource->lpName)) HeapFree(GetProcessHeap(), 0, current_resource->lpName); - if(current_resource->lpData) HeapFree(GetProcessHeap(), 0, current_resource->lpData); + HeapFree(GetProcessHeap(), 0, current_resource->lpData); HeapFree(GetProcessHeap(), 0, current_resource); } if(found) GlobalUnlock(hUpdate); diff -urN wine-20041201/dlls/kernel/sync.c wine-20050111/dlls/kernel/sync.c --- wine-20041201/dlls/kernel/sync.c 2004-10-20 01:55:15.000000000 +0200 +++ wine-20050111/dlls/kernel/sync.c 2005-01-07 16:40:09.000000000 +0100 @@ -403,12 +403,10 @@ BOOL initial_state, LPCWSTR name ) { HANDLE ret; - DWORD len = name ? strlenW(name) : 0; - if (len >= MAX_PATH) - { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); - return 0; - } + UNICODE_STRING nameW; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + /* one buggy program needs this * ("Van Dale Groot woordenboek der Nederlandse taal") */ @@ -418,17 +416,21 @@ SetLastError( ERROR_INVALID_PARAMETER); return 0; } - SERVER_START_REQ( create_event ) + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = NULL; + attr.Attributes = (sa && sa->bInheritHandle) ? OBJ_INHERIT : 0; + attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; + attr.SecurityQualityOfService = NULL; + if (name) { - req->manual_reset = manual_reset; - req->initial_state = initial_state; - req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle); - wine_server_add_data( req, name, len * sizeof(WCHAR) ); - SetLastError(0); - wine_server_call_err( req ); - ret = reply->handle; + RtlInitUnicodeString( &nameW, name ); + attr.ObjectName = &nameW; } - SERVER_END_REQ; + + status = NtCreateEvent( &ret, EVENT_ALL_ACCESS, &attr, manual_reset, initial_state ); + SetLastError( RtlNtStatusToDosError(status) ); return ret; } @@ -438,7 +440,7 @@ */ HANDLE WINAPI WIN16_CreateEvent( BOOL manual_reset, BOOL initial_state ) { - return CreateEventA( NULL, manual_reset, initial_state, NULL ); + return CreateEventW( NULL, manual_reset, initial_state, NULL ); } @@ -466,23 +468,30 @@ HANDLE WINAPI OpenEventW( DWORD access, BOOL inherit, LPCWSTR name ) { HANDLE ret; - DWORD len = name ? strlenW(name) : 0; - if (len >= MAX_PATH) + UNICODE_STRING nameW; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + + if (!is_version_nt()) access = EVENT_ALL_ACCESS; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = NULL; + attr.Attributes = inherit ? OBJ_INHERIT : 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + if (name) { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); - return 0; + RtlInitUnicodeString( &nameW, name ); + attr.ObjectName = &nameW; } - if (!is_version_nt()) access = EVENT_ALL_ACCESS; - SERVER_START_REQ( open_event ) + status = NtOpenEvent( &ret, access, &attr ); + if (status != STATUS_SUCCESS) { - req->access = access; - req->inherit = inherit; - wine_server_add_data( req, name, len * sizeof(WCHAR) ); - wine_server_call_err( req ); - ret = reply->handle; + SetLastError( RtlNtStatusToDosError(status) ); + return 0; } - SERVER_END_REQ; return ret; } @@ -539,7 +548,7 @@ */ HANDLE WINAPI VWin32_EventCreate(VOID) { - HANDLE hEvent = CreateEventA( NULL, FALSE, 0, NULL ); + HANDLE hEvent = CreateEventW( NULL, FALSE, 0, NULL ); return ConvertToGlobalHandle( hEvent ); } @@ -598,22 +607,24 @@ HANDLE WINAPI CreateMutexW( SECURITY_ATTRIBUTES *sa, BOOL owner, LPCWSTR name ) { HANDLE ret; - DWORD len = name ? strlenW(name) : 0; - if (len >= MAX_PATH) - { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); - return 0; - } - SERVER_START_REQ( create_mutex ) + UNICODE_STRING nameW; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = NULL; + attr.Attributes = (sa && sa->bInheritHandle) ? OBJ_INHERIT : 0; + attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; + attr.SecurityQualityOfService = NULL; + if (name) { - req->owned = owner; - req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle); - wine_server_add_data( req, name, len * sizeof(WCHAR) ); - SetLastError(0); - wine_server_call_err( req ); - ret = reply->handle; + RtlInitUnicodeString( &nameW, name ); + attr.ObjectName = &nameW; } - SERVER_END_REQ; + + status = NtCreateMutant( &ret, MUTEX_ALL_ACCESS, &attr, owner ); + SetLastError( RtlNtStatusToDosError(status) ); return ret; } @@ -642,23 +653,30 @@ HANDLE WINAPI OpenMutexW( DWORD access, BOOL inherit, LPCWSTR name ) { HANDLE ret; - DWORD len = name ? strlenW(name) : 0; - if (len >= MAX_PATH) + UNICODE_STRING nameW; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + + if (!is_version_nt()) access = MUTEX_ALL_ACCESS; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = NULL; + attr.Attributes = inherit ? OBJ_INHERIT : 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + if (name) { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); - return 0; + RtlInitUnicodeString( &nameW, name ); + attr.ObjectName = &nameW; } - if (!is_version_nt()) access = MUTEX_ALL_ACCESS; - SERVER_START_REQ( open_mutex ) + status = NtOpenMutant( &ret, access, &attr ); + if (status != STATUS_SUCCESS) { - req->access = access; - req->inherit = inherit; - wine_server_add_data( req, name, len * sizeof(WCHAR) ); - wine_server_call_err( req ); - ret = reply->handle; + SetLastError( RtlNtStatusToDosError(status) ); + return 0; } - SERVER_END_REQ; return ret; } @@ -668,14 +686,15 @@ */ BOOL WINAPI ReleaseMutex( HANDLE handle ) { - BOOL ret; - SERVER_START_REQ( release_mutex ) + NTSTATUS status; + + status = NtReleaseMutant(handle, NULL); + if (status != STATUS_SUCCESS) { - req->handle = handle; - ret = !wine_server_call_err( req ); + SetLastError( RtlNtStatusToDosError(status) ); + return FALSE; } - SERVER_END_REQ; - return ret; + return TRUE; } @@ -706,35 +725,27 @@ * CreateSemaphoreW (KERNEL32.@) */ HANDLE WINAPI CreateSemaphoreW( SECURITY_ATTRIBUTES *sa, LONG initial, - LONG max, LPCWSTR name ) + LONG max, LPCWSTR name ) { HANDLE ret; - DWORD len = name ? strlenW(name) : 0; - - /* Check parameters */ + UNICODE_STRING nameW; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; - if ((max <= 0) || (initial < 0) || (initial > max)) + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = NULL; + attr.Attributes = (sa && sa->bInheritHandle) ? OBJ_INHERIT : 0; + attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; + attr.SecurityQualityOfService = NULL; + if (name) { - SetLastError( ERROR_INVALID_PARAMETER ); - return 0; - } - if (len >= MAX_PATH) - { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); - return 0; + RtlInitUnicodeString( &nameW, name ); + attr.ObjectName = &nameW; } - SERVER_START_REQ( create_semaphore ) - { - req->initial = (unsigned int)initial; - req->max = (unsigned int)max; - req->inherit = (sa && (sa->nLength>=sizeof(*sa)) && sa->bInheritHandle); - wine_server_add_data( req, name, len * sizeof(WCHAR) ); - SetLastError(0); - wine_server_call_err( req ); - ret = reply->handle; - } - SERVER_END_REQ; + status = NtCreateSemaphore( &ret, SEMAPHORE_ALL_ACCESS, &attr, initial, max ); + SetLastError( RtlNtStatusToDosError(status) ); return ret; } @@ -763,23 +774,30 @@ HANDLE WINAPI OpenSemaphoreW( DWORD access, BOOL inherit, LPCWSTR name ) { HANDLE ret; - DWORD len = name ? strlenW(name) : 0; - if (len >= MAX_PATH) + UNICODE_STRING nameW; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + + if (!is_version_nt()) access = SEMAPHORE_ALL_ACCESS; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = NULL; + attr.Attributes = inherit ? OBJ_INHERIT : 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + if (name) { - SetLastError( ERROR_FILENAME_EXCED_RANGE ); - return 0; + RtlInitUnicodeString( &nameW, name ); + attr.ObjectName = &nameW; } - if (!is_version_nt()) access = SEMAPHORE_ALL_ACCESS; - SERVER_START_REQ( open_semaphore ) + status = NtOpenSemaphore( &ret, access, &attr ); + if (status != STATUS_SUCCESS) { - req->access = access; - req->inherit = inherit; - wine_server_add_data( req, name, len * sizeof(WCHAR) ); - wine_server_call_err( req ); - ret = reply->handle; + SetLastError( RtlNtStatusToDosError(status) ); + return 0; } - SERVER_END_REQ; return ret; } @@ -823,25 +841,26 @@ */ HANDLE WINAPI CreateWaitableTimerW( SECURITY_ATTRIBUTES *sa, BOOL manual, LPCWSTR name ) { - HANDLE handle; - NTSTATUS status; - UNICODE_STRING us; - DWORD attr = 0; - OBJECT_ATTRIBUTES oa; - - if (name) RtlInitUnicodeString(&us, name); - if (sa && (sa->nLength >= sizeof(*sa)) && sa->bInheritHandle) - attr |= OBJ_INHERIT; - InitializeObjectAttributes(&oa, name ? &us : NULL, attr, - NULL /* FIXME */, NULL /* FIXME */); - status = NtCreateTimer(&handle, TIMER_ALL_ACCESS, &oa, - manual ? NotificationTimer : SynchronizationTimer); + HANDLE handle; + NTSTATUS status; + UNICODE_STRING nameW; + OBJECT_ATTRIBUTES attr; - if (status != STATUS_SUCCESS) + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = NULL; + attr.Attributes = (sa && sa->bInheritHandle) ? OBJ_INHERIT : 0; + attr.SecurityDescriptor = sa ? sa->lpSecurityDescriptor : NULL; + attr.SecurityQualityOfService = NULL; + if (name) { - SetLastError( RtlNtStatusToDosError(status) ); - return 0; + RtlInitUnicodeString( &nameW, name ); + attr.ObjectName = &nameW; } + + status = NtCreateTimer(&handle, TIMER_ALL_ACCESS, &attr, + manual ? NotificationTimer : SynchronizationTimer); + SetLastError( RtlNtStatusToDosError(status) ); return handle; } @@ -869,17 +888,26 @@ */ HANDLE WINAPI OpenWaitableTimerW( DWORD access, BOOL inherit, LPCWSTR name ) { - NTSTATUS status; - ULONG attr = 0; - UNICODE_STRING us; - HANDLE handle; - OBJECT_ATTRIBUTES oa; - - if (inherit) attr |= OBJ_INHERIT; - - if (name) RtlInitUnicodeString(&us, name); - InitializeObjectAttributes(&oa, name ? &us : NULL, attr, NULL /* FIXME */, NULL /* FIXME */); - status = NtOpenTimer(&handle, access, &oa); + HANDLE handle; + UNICODE_STRING nameW; + OBJECT_ATTRIBUTES attr; + NTSTATUS status; + + if (!is_version_nt()) access = TIMER_ALL_ACCESS; + + attr.Length = sizeof(attr); + attr.RootDirectory = 0; + attr.ObjectName = NULL; + attr.Attributes = inherit ? OBJ_INHERIT : 0; + attr.SecurityDescriptor = NULL; + attr.SecurityQualityOfService = NULL; + if (name) + { + RtlInitUnicodeString( &nameW, name ); + attr.ObjectName = &nameW; + } + + status = NtOpenTimer(&handle, access, &attr); if (status != STATUS_SUCCESS) { SetLastError( RtlNtStatusToDosError(status) ); @@ -1273,7 +1301,7 @@ } memset(&ov,0,sizeof(ov)); - ov.hEvent = CreateEventA(NULL,0,0,NULL); + ov.hEvent = CreateEventW(NULL,0,0,NULL); if (!ov.hEvent) return FALSE; @@ -1449,7 +1477,7 @@ LPSECURITY_ATTRIBUTES sa, DWORD size ) { static unsigned index = 0; - char name[64]; + WCHAR name[64]; HANDLE hr, hw; unsigned in_index = index; @@ -1457,15 +1485,19 @@ /* generate a unique pipe name (system wide) */ do { - sprintf(name, "\\\\.\\pipe\\Win32.Pipes.%08lu.%08u", GetCurrentProcessId(), ++index); - hr = CreateNamedPipeA(name, PIPE_ACCESS_INBOUND, + static const WCHAR nameFmt[] = { '\\','\\','.','\\','p','i','p','e', + '\\','W','i','n','3','2','.','P','i','p','e','s','.','%','0','8','l', + 'u','.','%','0','8','u','\0' }; + snprintfW(name, sizeof(name) / sizeof(name[0]), nameFmt, + GetCurrentProcessId(), ++index); + hr = CreateNamedPipeW(name, PIPE_ACCESS_INBOUND, PIPE_TYPE_BYTE | PIPE_WAIT, 1, size, size, NMPWAIT_USE_DEFAULT_WAIT, sa); } while (hr == INVALID_HANDLE_VALUE && index != in_index); /* from completion sakeness, I think system resources might be exhausted before this happens !! */ if (hr == INVALID_HANDLE_VALUE) return FALSE; - hw = CreateFileA(name, GENERIC_WRITE, 0, sa, OPEN_EXISTING, 0, 0); + hw = CreateFileW(name, GENERIC_WRITE, 0, sa, OPEN_EXISTING, 0, 0); if (hw == INVALID_HANDLE_VALUE) { CloseHandle(hr); @@ -1500,8 +1532,7 @@ handle = CreateMailslotW( name, nMaxMessageSize, lReadTimeout, sa ); - if( name ) - HeapFree( GetProcessHeap(), 0, name ); + HeapFree( GetProcessHeap(), 0, name ); return handle; } @@ -1639,8 +1670,7 @@ r = CreateJobObjectW( attr, str ); - if( str ) - HeapFree( GetProcessHeap(), 0, str ); + HeapFree( GetProcessHeap(), 0, str ); return r; } diff -urN wine-20041201/dlls/kernel/tests/alloc.c wine-20050111/dlls/kernel/tests/alloc.c --- wine-20041201/dlls/kernel/tests/alloc.c 2004-06-04 19:58:49.000000000 +0200 +++ wine-20050111/dlls/kernel/tests/alloc.c 2004-12-23 19:48:47.000000000 +0100 @@ -77,9 +77,7 @@ */ mem1=HeapAlloc(heap,0,5*memchunk+1); ok(mem1==NULL,"HeapCreate allocated more Ram than it should have\n"); - if(mem1) { - HeapFree(heap,0,mem1); - } + HeapFree(heap,0,mem1); } /* Check that a normal alloc works */ diff -urN wine-20041201/dlls/kernel/tests/change.c wine-20050111/dlls/kernel/tests/change.c --- wine-20041201/dlls/kernel/tests/change.c 2004-11-03 23:18:44.000000000 +0100 +++ wine-20050111/dlls/kernel/tests/change.c 2004-12-27 18:26:38.000000000 +0100 @@ -44,7 +44,8 @@ ret = FindNextChangeNotification(change); } - ok(FindCloseChangeNotification(change), "FindCloseChangeNotification error: %ld\n", + ret = FindCloseChangeNotification(change); + ok( ret, "FindCloseChangeNotification error: %ld\n", GetLastError()); ExitThread((DWORD)ret); @@ -123,7 +124,8 @@ file = CreateFileA(filename1, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError()); - ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError()); + ret = CloseHandle(file); + ok( ret, "CloseHandle error: %ld\n", GetLastError()); /* Try to register notification for a file. win98 and win2k behave differently here */ change = FindFirstChangeNotificationA(filename1, FALSE, FILE_NOTIFY_CHANGE_FILE_NAME); @@ -189,7 +191,8 @@ file = CreateFileA(filename2, GENERIC_WRITE|GENERIC_READ, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0); ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError()); - ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError()); + ret = CloseHandle(file); + ok( ret, "CloseHandle error: %ld\n", GetLastError()); ok(FinishNotificationThread(thread), "Missed notification\n"); attributes = GetFileAttributesA(filename2); @@ -209,7 +212,8 @@ ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError()); ret = WriteFile(file, buffer, sizeof(buffer), &count, NULL); ok(ret && count == sizeof(buffer), "WriteFile error: %ld\n", GetLastError()); - ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError()); + ret = CloseHandle(file); + ok( ret, "CloseHandle error: %ld\n", GetLastError()); ok(FinishNotificationThread(thread), "Missed notification\n"); /* Change file size by truncating a file */ @@ -219,7 +223,8 @@ ok(file != INVALID_HANDLE_VALUE, "CreateFileA error: %ld\n", GetLastError()); ret = WriteFile(file, buffer, sizeof(buffer) / 2, &count, NULL); ok(ret && count == sizeof(buffer) / 2, "WriteFileA error: %ld\n", GetLastError()); - ok(CloseHandle(file), "CloseHandle error: %ld\n", GetLastError()); + ret = CloseHandle(file); + ok( ret, "CloseHandle error: %ld\n", GetLastError()); ok(FinishNotificationThread(thread), "Missed notification\n"); /* clean up */ diff -urN wine-20041201/dlls/kernel/tests/directory.c wine-20050111/dlls/kernel/tests/directory.c --- wine-20041201/dlls/kernel/tests/directory.c 2004-11-29 18:52:06.000000000 +0100 +++ wine-20050111/dlls/kernel/tests/directory.c 2004-12-20 20:27:07.000000000 +0100 @@ -213,7 +213,7 @@ lstrcatA(tmpdir, "Please Remove Me/Please Remove Me"); ret = CreateDirectoryA(tmpdir, NULL); ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, - "CreateDirectoryA with multiple non existing directories in path should fail\n"); + "CreateDirectoryA with multiple non-existent directories in path should fail\n"); ret = RemoveDirectoryA(tmpdir); } @@ -285,7 +285,7 @@ lstrcatW(tmpdir, tmp_dir_name); ret = CreateDirectoryW(tmpdir, NULL); ok(ret == FALSE && GetLastError() == ERROR_PATH_NOT_FOUND, - "CreateDirectoryW with multiple non existing directories in path should fail\n"); + "CreateDirectoryW with multiple non-existent directories in path should fail\n"); ret = RemoveDirectoryW(tmpdir); } diff -urN wine-20041201/dlls/kernel/tests/file.c wine-20050111/dlls/kernel/tests/file.c --- wine-20041201/dlls/kernel/tests/file.c 2004-11-28 15:58:11.000000000 +0100 +++ wine-20050111/dlls/kernel/tests/file.c 2004-12-27 18:26:38.000000000 +0100 @@ -58,6 +58,7 @@ long bytes_read; long bytes_wanted; long i; + BOOL ret; SetFileAttributesA(filename,FILE_ATTRIBUTE_NORMAL); /* be sure to remove stale files */ DeleteFileA( filename ); @@ -92,7 +93,8 @@ ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" ); - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); + ret = DeleteFileA( filename ); + ok( ret != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); } @@ -107,6 +109,7 @@ char *contents; HLOCAL memory_object; char checksum[1]; + BOOL ret; filehandle = _lcreat( filename, 0 ); if (filehandle == HFILE_ERROR) @@ -175,13 +178,15 @@ ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" ); - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); + ret = DeleteFileA( filename ); + ok( ret != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); } static void test__lclose( void ) { HFILE filehandle; + BOOL ret; filehandle = _lcreat( filename, 0 ); if (filehandle == HFILE_ERROR) @@ -194,7 +199,8 @@ ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); + ret = DeleteFileA( filename ); + ok( ret != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); } @@ -206,6 +212,7 @@ char slashname[] = "testfi/"; int err; HANDLE find; + BOOL ret; filehandle = _lcreat( filename, 0 ); if (filehandle == HFILE_ERROR) @@ -224,7 +231,8 @@ ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should be able to find file\n" ); - ok( DeleteFileA(filename) != 0, "DeleteFile failed (%ld)\n", GetLastError()); + ret = DeleteFileA(filename); + ok( ret != 0, "DeleteFile failed (%ld)\n", GetLastError()); filehandle = _lcreat( filename, 1 ); /* readonly */ ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)\n", filename, GetLastError( ) ); @@ -254,7 +262,8 @@ ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file\n" ); - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); + ret = DeleteFileA( filename ); + ok( ret, "DeleteFile failed (%ld)\n", GetLastError( ) ); filehandle = _lcreat( filename, 4 ); /* SYSTEM file */ ok( HFILE_ERROR != filehandle, "couldn't create file \"%s\" (err=%ld)\n", filename, GetLastError( ) ); @@ -269,7 +278,8 @@ ok( INVALID_HANDLE_VALUE != FindFirstFileA( filename, &search_results ), "should STILL be able to find file\n" ); - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); + ret = DeleteFileA( filename ); + ok( ret, "DeleteFile failed (%ld)\n", GetLastError( ) ); filehandle=_lcreat (slashname, 0); /* illegal name */ if (HFILE_ERROR==filehandle) { @@ -281,7 +291,8 @@ find=FindFirstFileA (slashname, &search_results); if (INVALID_HANDLE_VALUE!=find) { - ok (0!=FindClose (find), "FindClose complains (%ld)\n", GetLastError ()); + ret = FindClose (find); + ok (0 != ret, "FindClose complains (%ld)\n", GetLastError ()); slashname[strlen(slashname)-1]=0; ok (!strcmp (slashname, search_results.cFileName), "found unexpected name \"%s\"\n", search_results.cFileName); @@ -289,8 +300,8 @@ "attributes of file \"%s\" are 0x%04lx\n", search_results.cFileName, search_results.dwFileAttributes); } - ok (0!=DeleteFileA (slashname), "Can't delete \"%s\" (%ld)\n", slashname, - GetLastError ()); + ret = DeleteFileA( slashname ); + ok( ret, "DeleteFile failed (%ld)\n", GetLastError( ) ); } filehandle=_lcreat (filename, 8); /* illegal attribute */ @@ -302,15 +313,16 @@ if (INVALID_HANDLE_VALUE==find) ok (0, "file \"%s\" not found\n", filename); else { - ok (0!=FindClose (find), "FindClose complains (%ld)\n", GetLastError ()); + ret = FindClose(find); + ok ( 0 != ret, "FindClose complains (%ld)\n", GetLastError ()); ok (!strcmp (filename, search_results.cFileName), "found unexpected name \"%s\"\n", search_results.cFileName); ok (FILE_ATTRIBUTE_ARCHIVE==search_results.dwFileAttributes, "attributes of file \"%s\" are 0x%04lx\n", search_results.cFileName, search_results.dwFileAttributes); } - ok (0!=DeleteFileA (filename), "Can't delete \"%s\" (%ld)\n", slashname, - GetLastError ()); + ret = DeleteFileA( filename ); + ok( ret, "DeleteFile failed (%ld)\n", GetLastError( ) ); } } @@ -321,6 +333,7 @@ HFILE filehandle; char buffer[1]; long bytes_read; + BOOL ret; filehandle = _lcreat( filename, 0 ); if (filehandle == HFILE_ERROR) @@ -347,7 +360,8 @@ ok( HFILE_ERROR != _llseek( filehandle, 1000000, FILE_END ), "should be able to seek past file; poor, poor Windows programmers\n" ); ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); + ret = DeleteFileA( filename ); + ok( ret, "DeleteFile failed (%ld)\n", GetLastError( ) ); } @@ -356,6 +370,7 @@ HFILE filehandle; UINT bytes_read; char buffer[10000]; + BOOL ret; filehandle = _lcreat( filename, 0 ); if (filehandle == HFILE_ERROR) @@ -384,7 +399,8 @@ ok( HFILE_ERROR != _hwrite( filehandle, sillytext, strlen( sillytext ) ), "_hwrite should write just fine\n" ); ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); + ret = DeleteFileA( filename ); + ok( ret, "DeleteFile failed (%ld)\n", GetLastError( ) ); /* TODO - add tests for the SHARE modes - use two processes to pull this one off */ } @@ -396,6 +412,7 @@ long bytes_read; UINT bytes_wanted; UINT i; + BOOL ret; filehandle = _lcreat( filename, 0 ); if (filehandle == HFILE_ERROR) @@ -428,7 +445,8 @@ ok( HFILE_ERROR != _lclose(filehandle), "_lclose complains\n" ); - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); + ret = DeleteFileA( filename ); + ok( ret, "DeleteFile failed (%ld)\n", GetLastError( ) ); } @@ -443,6 +461,7 @@ char *contents; HLOCAL memory_object; char checksum[1]; + BOOL ret; filehandle = _lcreat( filename, 0 ); if (filehandle == HFILE_ERROR) @@ -511,7 +530,8 @@ ok( HFILE_ERROR != _lclose( filehandle ), "_lclose complains\n" ); - ok( DeleteFileA( filename ) != 0, "DeleteFile failed (%ld)\n", GetLastError( ) ); + ret = DeleteFileA( filename ); + ok( ret, "DeleteFile failed (%ld)\n", GetLastError( ) ); } static void test_CopyFileA(void) @@ -522,6 +542,7 @@ HANDLE hfile; char buf[10]; DWORD ret; + BOOL retok; ret = GetTempPathA(MAX_PATH, temp_path); ok(ret != 0, "GetTempPathA error %ld\n", GetLastError()); @@ -533,7 +554,8 @@ /* make the source have not zero size */ hfile = CreateFileA(source, GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, 0 ); ok(hfile != INVALID_HANDLE_VALUE, "failed to open source file\n"); - ok(WriteFile(hfile, prefix, sizeof(prefix), &ret, NULL ) && ret == sizeof(prefix), + retok = WriteFile(hfile, prefix, sizeof(prefix), &ret, NULL ); + ok( retok && ret == sizeof(prefix), "WriteFile error %ld\n", GetLastError()); ok(GetFileSize(hfile, NULL) == sizeof(prefix), "source file has wrong size\n"); CloseHandle(hfile); @@ -563,7 +585,8 @@ /* make sure that destination still has correct size */ ret = GetFileSize(hfile, NULL); ok(ret == sizeof(prefix), "destination file has wrong size %ld\n", ret); - ok(ReadFile(hfile, buf, sizeof(buf), &ret, NULL) && ret == sizeof(prefix), + retok = ReadFile(hfile, buf, sizeof(buf), &ret, NULL); + ok( retok && ret == sizeof(prefix), "ReadFile: error %ld\n", GetLastError()); ok(!memcmp(prefix, buf, sizeof(prefix)), "buffer contents mismatch\n"); CloseHandle(hfile); @@ -861,9 +884,12 @@ BYTE buf[256], pattern[] = "TeSt"; UINT i; char temp_path[MAX_PATH], temp_fname[MAX_PATH]; + BOOL ret; - ok(GetTempPathA(MAX_PATH, temp_path) != 0, "GetTempPathA error %ld\n", GetLastError()); - ok(GetTempFileNameA(temp_path, "pfx", 0, temp_fname) != 0, "GetTempFileNameA error %ld\n", GetLastError()); + ret =GetTempPathA(MAX_PATH, temp_path); + ok( ret, "GetTempPathA error %ld\n", GetLastError()); + ret =GetTempFileNameA(temp_path, "pfx", 0, temp_fname); + ok( ret, "GetTempFileNameA error %ld\n", GetLastError()); /*** Write File *****************************************************/ @@ -871,7 +897,8 @@ ok(hFile != INVALID_HANDLE_VALUE, "CreateFileA error %ld\n", GetLastError()); for(i = 0; i < sizeof(buf); i++) buf[i] = i; - ok(WriteFile(hFile, buf, sizeof(buf), &done, NULL), "WriteFile error %ld\n", GetLastError()); + ret = WriteFile(hFile, buf, sizeof(buf), &done, NULL); + ok( ret, "WriteFile error %ld\n", GetLastError()); ok(done == sizeof(buf), "expected number of bytes written %lu\n", done); memset(&ov, 0, sizeof(ov)); @@ -888,7 +915,8 @@ ov.Offset = sizeof(buf) * 2; ov.OffsetHigh = 0; - ok(WriteFile(hFile, pattern, sizeof(pattern), &done, &ov), "WriteFile error %ld\n", GetLastError()); + ret = WriteFile(hFile, pattern, sizeof(pattern), &done, &ov); + ok( ret, "WriteFile error %ld\n", GetLastError()); ok(done == sizeof(pattern), "expected number of bytes written %lu\n", done); /*trace("Current offset = %04lx\n", SetFilePointer(hFile, 0, NULL, FILE_CURRENT));*/ ok(SetFilePointer(hFile, 0, NULL, FILE_CURRENT) == (sizeof(buf) * 2 + sizeof(pattern)), @@ -919,7 +947,8 @@ CloseHandle(hFile); - ok(DeleteFileA(temp_fname), "DeleteFileA error %ld\n", GetLastError()); + ret = DeleteFileA(temp_fname); + ok( ret, "DeleteFileA error %ld\n", GetLastError()); } static void test_LockFile(void) @@ -1316,8 +1345,10 @@ "ret = %ld, error %ld\n", ret, GetLastError()); ok(!bytes, "bytes = %ld\n", bytes); - ok(CloseHandle(hFile), "CloseHandle: error %ld\n", GetLastError()); - ok(DeleteFileA(filename), "DeleteFileA: error %ld\n", GetLastError()); + ret = CloseHandle(hFile); + ok( ret, "CloseHandle: error %ld\n", GetLastError()); + ret = DeleteFileA(filename); + ok( ret, "DeleteFileA: error %ld\n", GetLastError()); } START_TEST(file) diff -urN wine-20041201/dlls/kernel/tests/locale.c wine-20050111/dlls/kernel/tests/locale.c --- wine-20041201/dlls/kernel/tests/locale.c 2004-11-21 16:47:24.000000000 +0100 +++ wine-20050111/dlls/kernel/tests/locale.c 2004-12-09 15:07:59.000000000 +0100 @@ -131,7 +131,7 @@ #define EXPECT_LENW EXPECT_LEN((int)strlenW(Expected)+1) #define EXPECT_EQW ok(strncmpW(buffer, Expected, strlenW(Expected)) == 0, "Bad conversion\n") #define EXPECT_FALSE ok(FALSE == ret, "Expected return value FALSE, got TRUE\n") -#define EXPECT_TRUE ok(TRUE == ret, "Expected return value TRUE, got FALSE\n") +#define EXPECT_TRUE ok(FALSE != ret, "Expected return value TRUE, got FALSE\n") #define NUO LOCALE_NOUSEROVERRIDE diff -urN wine-20041201/dlls/kernel/tests/pipe.c wine-20050111/dlls/kernel/tests/pipe.c --- wine-20041201/dlls/kernel/tests/pipe.c 2004-05-24 21:06:52.000000000 +0200 +++ wine-20050111/dlls/kernel/tests/pipe.c 2004-12-13 22:19:02.000000000 +0100 @@ -54,7 +54,7 @@ static HANDLE alarm_event; -static void test_CreateNamedPipe(pipemode) +static void test_CreateNamedPipe(int pipemode) { HANDLE hnp; HANDLE hFile; diff -urN wine-20041201/dlls/kernel/tests/process.c wine-20050111/dlls/kernel/tests/process.c --- wine-20041201/dlls/kernel/tests/process.c 2004-11-22 19:28:56.000000000 +0100 +++ wine-20050111/dlls/kernel/tests/process.c 2004-12-27 18:26:38.000000000 +0100 @@ -202,6 +202,7 @@ char bufA[MAX_PATH]; WCHAR bufW[MAX_PATH]; HANDLE hFile = CreateFileA(file, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0); + BOOL ret; if (hFile == INVALID_HANDLE_VALUE) return; @@ -329,11 +330,14 @@ /* now that we have written all relevant information, let's change it */ ok(SetConsoleCP(1252), "Setting CP\n"); ok(SetConsoleOutputCP(1252), "Setting SB CP\n"); - ok(SetConsoleMode(hConIn, modeIn ^ 1), "Setting mode (%ld)\n", GetLastError()); - ok(SetConsoleMode(hConOut, modeOut ^ 1), "Setting mode (%ld)\n", GetLastError()); + ret = SetConsoleMode(hConIn, modeIn ^ 1); + ok( ret, "Setting mode (%ld)\n", GetLastError()); + ret = SetConsoleMode(hConOut, modeOut ^ 1); + ok( ret, "Setting mode (%ld)\n", GetLastError()); sbi.dwCursorPosition.X ^= 1; sbi.dwCursorPosition.Y ^= 1; - ok(SetConsoleCursorPosition(hConOut, sbi.dwCursorPosition), "Setting cursor position (%ld)\n", GetLastError()); + ret = SetConsoleCursorPosition(hConOut, sbi.dwCursorPosition); + ok( ret, "Setting cursor position (%ld)\n", GetLastError()); } if (option && strcmp(option, "stdhandle") == 0) { diff -urN wine-20041201/dlls/kernel/tests/thread.c wine-20050111/dlls/kernel/tests/thread.c --- wine-20041201/dlls/kernel/tests/thread.c 2004-11-03 23:18:44.000000000 +0100 +++ wine-20050111/dlls/kernel/tests/thread.c 2004-12-27 18:26:38.000000000 +0100 @@ -155,7 +155,7 @@ #endif /* Check basic funcationality of CreateThread and Tls* functions */ -VOID test_CreateThread_basic() +VOID test_CreateThread_basic(void) { HANDLE thread[NUM_THREADS],event[NUM_THREADS]; DWORD threadid[NUM_THREADS],curthreadId; @@ -217,7 +217,7 @@ } /* Check that using the CREATE_SUSPENDED flag works */ -VOID test_CreateThread_suspended() +VOID test_CreateThread_suspended(void) { HANDLE thread; DWORD threadId; @@ -246,7 +246,7 @@ } /* Check that SuspendThread and ResumeThread work */ -VOID test_SuspendThread() +VOID test_SuspendThread(void) { HANDLE thread,access_thread; DWORD threadId,exitCode,error; @@ -303,12 +303,10 @@ /* Check that TerminateThread works properly */ -VOID test_TerminateThread() +VOID test_TerminateThread(void) { HANDLE thread,access_thread,event; DWORD threadId,exitCode; - int i,error; - i=0; error=0; event=CreateEventA(NULL,TRUE,FALSE,NULL); thread = CreateThread(NULL,0,threadFunc4, (LPVOID)event, 0,&threadId); @@ -344,7 +342,7 @@ /* Check if CreateThread obeys the specified stack size. This code does not work properly, and is currently disabled */ -VOID test_CreateThread_stack() +VOID test_CreateThread_stack(void) { #if CHECK_STACK /* The only way I know of to test the stack size is to use alloca @@ -371,7 +369,7 @@ } /* Check whether setting/retrieving thread priorities works */ -VOID test_thread_priority() +VOID test_thread_priority(void) { HANDLE curthread,access_thread; DWORD curthreadId,exitCode; @@ -440,14 +438,14 @@ if (rc!=0 || GetLastError()!=ERROR_CALL_NOT_IMPLEMENTED) { ok(rc!=0,"error=%ld\n",GetLastError()); - ok(pSetThreadPriorityBoost(curthread,1)!=0, - "error=%ld\n",GetLastError()); + rc = pSetThreadPriorityBoost(curthread,1); + ok( rc != 0, "error=%ld\n",GetLastError()); rc=pGetThreadPriorityBoost(curthread,&disabled); ok(rc!=0 && disabled==1, "rc=%d error=%ld disabled=%d\n",rc,GetLastError(),disabled); - ok(pSetThreadPriorityBoost(curthread,0)!=0, - "error=%ld\n",GetLastError()); + rc = pSetThreadPriorityBoost(curthread,0); + ok( rc != 0, "error=%ld\n",GetLastError()); rc=pGetThreadPriorityBoost(curthread,&disabled); ok(rc!=0 && disabled==0, "rc=%d error=%ld disabled=%d\n",rc,GetLastError(),disabled); @@ -457,7 +455,7 @@ } /* check the GetThreadTimes function */ -VOID test_GetThreadTimes() +VOID test_GetThreadTimes(void) { HANDLE thread,access_thread=NULL; FILETIME creationTime,exitTime,kernelTime,userTime; @@ -508,7 +506,7 @@ /* Check the processor affinity functions */ /* NOTE: These functions should also be checked that they obey access control */ -VOID test_thread_processor() +VOID test_thread_processor(void) { HANDLE curthread,curproc; DWORD processMask,systemMask; diff -urN wine-20041201/dlls/kernel/tests/time.c wine-20050111/dlls/kernel/tests/time.c --- wine-20041201/dlls/kernel/tests/time.c 2004-11-06 04:53:53.000000000 +0100 +++ wine-20050111/dlls/kernel/tests/time.c 2004-12-27 18:26:38.000000000 +0100 @@ -189,10 +189,12 @@ FILETIME ft; SYSTEMTIME st; ULONGLONG time = (ULONGLONG)TICKSPERSEC + TICKS_1601_TO_1970; + BOOL ret; ft.dwHighDateTime = 0; ft.dwLowDateTime = 0; - ok(FileTimeToSystemTime(&ft, &st), + ret = FileTimeToSystemTime(&ft, &st); + ok( ret, "FileTimeToSystemTime() failed with Error 0x%08lx\n",GetLastError()); ok(((st.wYear == 1601) && (st.wMonth == 1) && (st.wDay == 1) && (st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 0) && @@ -201,7 +203,8 @@ ft.dwHighDateTime = (UINT)(time >> 32); ft.dwLowDateTime = (UINT)time; - ok(FileTimeToSystemTime(&ft, &st), + ret = FileTimeToSystemTime(&ft, &st); + ok( ret, "FileTimeToSystemTime() failed with Error 0x%08lx\n",GetLastError()); ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) && (st.wHour == 0) && (st.wMinute == 0) && (st.wSecond == 1) && @@ -222,10 +225,13 @@ ( res == TIME_ZONE_ID_STANDARD ? tzinfo.StandardBias : ( res == TIME_ZONE_ID_DAYLIGHT ? tzinfo.DaylightBias : 0 ))) * SECSPERMIN *TICKSPERSEC; + BOOL ret; + ok( res != TIME_ZONE_ID_INVALID , "GetTimeZoneInformation failed\n"); ft.dwHighDateTime = (UINT)(time >> 32); ft.dwLowDateTime = (UINT)time; - ok(FileTimeToLocalFileTime(&ft, &lft) !=0 , + ret = FileTimeToLocalFileTime(&ft, &lft); + ok( ret, "FileTimeToLocalFileTime() failed with Error 0x%08lx\n",GetLastError()); FileTimeToSystemTime(&lft, &st); ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) && @@ -238,7 +244,8 @@ ok(SetEnvironmentVariableA("TZ","GMT") != 0, "SetEnvironmentVariableA failed\n"); ok(res != TIME_ZONE_ID_INVALID, "GetTimeZoneInformation failed\n"); - ok(FileTimeToLocalFileTime(&ft, &lft) !=0 , + ret = FileTimeToLocalFileTime(&ft, &lft); + ok( ret, "FileTimeToLocalFileTime() failed with Error 0x%08lx\n",GetLastError()); FileTimeToSystemTime(&lft, &st); ok(((st.wYear == 1970) && (st.wMonth == 1) && (st.wDay == 1) && diff -urN wine-20041201/dlls/kernel/time.c wine-20050111/dlls/kernel/time.c --- wine-20041201/dlls/kernel/time.c 2004-11-06 04:53:53.000000000 +0100 +++ wine-20050111/dlls/kernel/time.c 2004-12-23 19:48:47.000000000 +0100 @@ -39,10 +39,7 @@ #include "windef.h" #include "winbase.h" #include "winreg.h" -#include "ntstatus.h" #include "winternl.h" -#include "winerror.h" -#include "winnls.h" #include "kernel_private.h" #include "wine/unicode.h" #include "wine/debug.h" @@ -81,7 +78,7 @@ * -1 if date < compareDate * 0 if date == compareDate * 1 if date > compareDate - * -2 if an error occures + * -2 if an error occurs */ static int TIME_DayLightCompareDate( const SYSTEMTIME *date, /* [in] The local time to compare. */ @@ -578,8 +575,7 @@ ret = GetCalendarInfoW(lcid, Calendar, CalType, lpCalDataW, cchData, lpValue); if(ret && lpCalDataW && lpCalData) WideCharToMultiByte(CP_ACP, 0, lpCalDataW, cchData, lpCalData, cchData, NULL, NULL); - if(lpCalDataW) - HeapFree(GetProcessHeap(), 0, lpCalDataW); + HeapFree(GetProcessHeap(), 0, lpCalDataW); return ret; } diff -urN wine-20041201/dlls/kernel/utthunk.c wine-20050111/dlls/kernel/utthunk.c --- wine-20041201/dlls/kernel/utthunk.c 2003-09-06 01:08:36.000000000 +0200 +++ wine-20050111/dlls/kernel/utthunk.c 2004-12-15 11:54:44.000000000 +0100 @@ -26,7 +26,6 @@ #include "winreg.h" #include "winternl.h" #include "wownt32.h" -#include "module.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(thunk); diff -urN wine-20041201/dlls/kernel/volume.c wine-20050111/dlls/kernel/volume.c --- wine-20041201/dlls/kernel/volume.c 2004-10-28 23:00:36.000000000 +0200 +++ wine-20050111/dlls/kernel/volume.c 2004-12-23 19:48:47.000000000 +0100 @@ -896,8 +896,8 @@ if (fsname) FILE_name_WtoA( fsnameW, -1, fsname, fsname_len ); } - if (labelW) HeapFree( GetProcessHeap(), 0, labelW ); - if (fsnameW) HeapFree( GetProcessHeap(), 0, fsnameW ); + HeapFree( GetProcessHeap(), 0, labelW ); + HeapFree( GetProcessHeap(), 0, fsnameW ); return ret; } @@ -1011,7 +1011,7 @@ if (root && !(rootW = FILE_name_AtoW( root, FALSE ))) return FALSE; if (volname && !(volnameW = FILE_name_AtoW( volname, TRUE ))) return FALSE; ret = SetVolumeLabelW( rootW, volnameW ); - if (volnameW) HeapFree( GetProcessHeap(), 0, volnameW ); + HeapFree( GetProcessHeap(), 0, volnameW ); return ret; } @@ -1092,7 +1092,7 @@ } HeapFree( GetProcessHeap(), 0, path ); } - if (target) HeapFree( GetProcessHeap(), 0, target ); + HeapFree( GetProcessHeap(), 0, target ); return ret; } @@ -1108,7 +1108,7 @@ if (!(devW = FILE_name_AtoW( devname, FALSE ))) return FALSE; if (targetpath && !(targetW = FILE_name_AtoW( targetpath, TRUE ))) return FALSE; ret = DefineDosDeviceW(flags, devW, targetW); - if (targetW) HeapFree( GetProcessHeap(), 0, targetW ); + HeapFree( GetProcessHeap(), 0, targetW ); return ret; } diff -urN wine-20041201/dlls/lzexpand/lzexpand_main.c wine-20050111/dlls/lzexpand/lzexpand_main.c --- wine-20041201/dlls/lzexpand/lzexpand_main.c 2003-09-27 04:22:03.000000000 +0200 +++ wine-20050111/dlls/lzexpand/lzexpand_main.c 2004-12-23 19:48:47.000000000 +0100 @@ -578,7 +578,7 @@ if (!(lzs = GET_LZ_STATE(fd))) _lclose(fd); else { - if (lzs->get) HeapFree( GetProcessHeap(), 0, lzs->get ); + HeapFree( GetProcessHeap(), 0, lzs->get ); CloseHandle((HANDLE)lzs->realfd); lzstates[fd - 0x400] = NULL; HeapFree( GetProcessHeap(), 0, lzs ); diff -urN wine-20041201/dlls/lzexpand/tests/lzexpand_main.c wine-20050111/dlls/lzexpand/tests/lzexpand_main.c --- wine-20041201/dlls/lzexpand/tests/lzexpand_main.c 2004-11-21 17:05:14.000000000 +0100 +++ wine-20050111/dlls/lzexpand/tests/lzexpand_main.c 2004-12-27 18:46:36.000000000 +0100 @@ -140,12 +140,13 @@ DWORD ret; int cfile; OFSTRUCT test; + BOOL retok; /* Create the compressed file. */ file = CreateFile(filename_, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0); ok(file != INVALID_HANDLE_VALUE, "Could not create test file\n"); - ok2(WriteFile(file, compressed_file, compressed_file_size, &ret, 0), - "WriteFile: error %ld\n", GetLastError()); + retok = WriteFile(file, compressed_file, compressed_file_size, &ret, 0); + ok2( retok, "WriteFile: error %ld\n", GetLastError()); ok(ret == compressed_file_size, "Wrote wrong number of bytes with WriteFile?\n"); CloseHandle(file); @@ -177,13 +178,14 @@ DWORD ret; int source, dest; OFSTRUCT stest, dtest; + BOOL retok; /* Create the compressed file. */ file = CreateFile(filename_, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0); ok2(file != INVALID_HANDLE_VALUE, "CreateFile: error %ld\n", GetLastError()); - ok2(WriteFile(file, compressed_file, compressed_file_size, &ret, 0), - "WriteFile error %ld\n", GetLastError()); + retok = WriteFile(file, compressed_file, compressed_file_size, &ret, 0); + ok2( retok, "WriteFile error %ld\n", GetLastError()); ok(ret == compressed_file_size, "Wrote wrong number of bytes\n"); CloseHandle(file); @@ -203,8 +205,8 @@ ok2(file != INVALID_HANDLE_VALUE, "CreateFile: error %ld\n", GetLastError()); - ok2(ReadFile(file, buf, uncompressed_data_size*2, &ret, 0) && - ret == uncompressed_data_size, "ReadFile: error %ld\n", GetLastError()); + retok = ReadFile(file, buf, uncompressed_data_size*2, &ret, 0); + ok2( retok && ret == uncompressed_data_size, "ReadFile: error %ld\n", GetLastError()); /* Compare what we read with what we think we should read. */ ok(!memcmp(buf, uncompressed_data, uncompressed_data_size), "buffer contents mismatch\n"); diff -urN wine-20041201/dlls/mapi32/mapi32.spec wine-20050111/dlls/mapi32/mapi32.spec --- wine-20041201/dlls/mapi32/mapi32.spec 2004-11-30 18:38:52.000000000 +0100 +++ wine-20050111/dlls/mapi32/mapi32.spec 2005-01-03 18:05:02.000000000 +0100 @@ -42,7 +42,7 @@ 54 stub DeregisterIdleRoutine@4 55 stub ChangeIdleRoutine@28 59 stdcall MAPIGetDefaultMalloc@0() MAPIGetDefaultMalloc - 60 stub CreateIProp@24 + 60 stdcall CreateIProp@24(ptr ptr ptr ptr ptr ptr) CreateIProp 61 stub CreateTable@36 62 stdcall MNLS_lstrlenW@4(wstr) MNLS_lstrlenW 63 stdcall MNLS_lstrcmpW@8(wstr wstr) MNLS_lstrcmpW @@ -127,7 +127,7 @@ 187 stub __ValidateParameters@8 188 stub __CPPValidateParameters@8 189 stub FBadSortOrderSet@4 -190 stub FBadEntryList@4 +190 stdcall FBadEntryList@4(ptr) FBadEntryList 191 stub FBadRestriction@4 192 stub ScUNCFromLocalPath@12 193 stub ScLocalPathFromUNC@12 diff -urN wine-20041201/dlls/mapi32/prop.c wine-20050111/dlls/mapi32/prop.c --- wine-20041201/dlls/mapi32/prop.c 2004-09-13 20:09:30.000000000 +0200 +++ wine-20050111/dlls/mapi32/prop.c 2005-01-10 14:29:25.000000000 +0100 @@ -28,6 +28,7 @@ #include "winternl.h" #include "objbase.h" #include "shlwapi.h" +#include "wine/list.h" #include "wine/debug.h" #include "wine/unicode.h" #include "mapival.h" @@ -63,21 +64,21 @@ * Any elements within the property returned should not be individually * freed, as they will be freed when lpOrig is. */ -SCODE WINAPI PropCopyMore(LPSPropValue lpDest, LPSPropValue lpSrc, +SCODE WINAPI PropCopyMore(LPSPropValue lpDest, LPSPropValue lpSrc, ALLOCATEMORE *lpMore, LPVOID lpOrig) { ULONG ulLen, i; SCODE scode = S_OK; - + TRACE("(%p,%p,%p,%p)\n", lpDest, lpSrc, lpMore, lpOrig); - + if (!lpDest || IsBadWritePtr(lpDest, sizeof(SPropValue)) || FBadProp(lpSrc) || !lpMore) return MAPI_E_INVALID_PARAMETER; /* Shallow copy first, this is sufficient for properties without pointers */ *lpDest = *lpSrc; - + switch (PROP_TYPE(lpSrc->ulPropTag)) { case PT_CLSID: @@ -124,59 +125,59 @@ if (FAILED(scode)) break; - /* Note that we could allocate the memory for each value in a + /* Note that we could allocate the memory for each value in a * multi-value property seperately, however if an allocation failed * we would be left with a bunch of allocated memory, which (while - * not really leaked) is unusable until lpOrig is freed. So for - * strings and binary arrays we make a single allocation for all + * not really leaked) is unusable until lpOrig is freed. So for + * strings and binary arrays we make a single allocation for all * of the data. This is consistent since individual elements can't * be freed anyway. */ - + switch (PROP_TYPE(lpSrc->ulPropTag)) { case PT_MV_STRING8: { - char *lpNextStr = (char*)(lpDest->Value.MVszA.lppszA + + char *lpNextStr = (char*)(lpDest->Value.MVszA.lppszA + lpDest->Value.MVszA.cValues); - + for (i = 0; i < lpSrc->Value.MVszA.cValues; i++) { ULONG ulStrLen = lstrlenA(lpSrc->Value.MVszA.lppszA[i]) + 1u; - + lpDest->Value.MVszA.lppszA[i] = lpNextStr; memcpy(lpNextStr, lpSrc->Value.MVszA.lppszA[i], ulStrLen); lpNextStr += ulStrLen; - } + } break; } case PT_MV_UNICODE: { - WCHAR *lpNextStr = (WCHAR*)(lpDest->Value.MVszW.lppszW + + WCHAR *lpNextStr = (WCHAR*)(lpDest->Value.MVszW.lppszW + lpDest->Value.MVszW.cValues); for (i = 0; i < lpSrc->Value.MVszW.cValues; i++) { ULONG ulStrLen = strlenW(lpSrc->Value.MVszW.lppszW[i]) + 1u; - + lpDest->Value.MVszW.lppszW[i] = lpNextStr; memcpy(lpNextStr, lpSrc->Value.MVszW.lppszW[i], ulStrLen * sizeof(WCHAR)); lpNextStr += ulStrLen; - } + } break; } case PT_MV_BINARY: { - LPBYTE lpNext = (LPBYTE)(lpDest->Value.MVbin.lpbin + + LPBYTE lpNext = (LPBYTE)(lpDest->Value.MVbin.lpbin + lpDest->Value.MVbin.cValues); - + for (i = 0; i < lpSrc->Value.MVszW.cValues; i++) { lpDest->Value.MVbin.lpbin[i].cb = lpSrc->Value.MVbin.lpbin[i].cb; lpDest->Value.MVbin.lpbin[i].lpb = lpNext; memcpy(lpNext, lpSrc->Value.MVbin.lpbin[i].lpb, lpDest->Value.MVbin.lpbin[i].cb); lpNext += lpDest->Value.MVbin.lpbin[i].cb; - } + } break; } default: @@ -189,7 +190,7 @@ } return scode; } - + /************************************************************************* * UlPropSize@4 (MAPI32.77) * @@ -267,7 +268,6 @@ break; case PT_BINARY: ulRet = lpProp->Value.bin.cb; break; - break; case PT_OBJECT: default: ulRet = 0u; break; @@ -723,7 +723,7 @@ for (i = 0; i < ulCount; i++) { ULONG ulPropSize = 0; - + if (FBadProp(&lpProps[i]) || lpProps[i].ulPropTag == PROP_ID_NULL || lpProps[i].ulPropTag == PROP_ID_INVALID) return MAPI_E_INVALID_PARAMETER; @@ -734,20 +734,20 @@ if (!ulPropSize) return MAPI_E_INVALID_PARAMETER; } - + switch (PROP_TYPE(lpProps[i].ulPropTag)) { case PT_STRING8: case PT_UNICODE: case PT_CLSID: case PT_BINARY: - case PT_MV_I2: - case PT_MV_I4: - case PT_MV_I8: - case PT_MV_R4: - case PT_MV_R8: - case PT_MV_CURRENCY: - case PT_MV_SYSTIME: + case PT_MV_I2: + case PT_MV_I4: + case PT_MV_I8: + case PT_MV_R4: + case PT_MV_R8: + case PT_MV_CURRENCY: + case PT_MV_SYSTIME: case PT_MV_APPTIME: ulPropSize += sizeof(SPropValue); break; @@ -919,17 +919,17 @@ * MSDN states that this function can be used for serialisation by passing * NULL as either lpOld or lpNew, thus converting any pointers in lpProps * between offsets and pointers. This does not work in native (it crashes), - * and cannot be made to work in Wine because the original interface design + * and cannot be made to work in Wine because the original interface design * is deficient. The only use left for this function is to remap pointers * in a contigous property array that has been copied with memcpy() to another * memory location. */ -SCODE WINAPI ScRelocProps(int cValues, LPSPropValue lpProps, LPVOID lpOld, +SCODE WINAPI ScRelocProps(int cValues, LPSPropValue lpProps, LPVOID lpOld, LPVOID lpNew, ULONG *lpCount) { static const BOOL bBadPtr = TRUE; /* Windows bug - Assumes source is bad */ LPSPropValue lpDest = (LPSPropValue)lpProps; - ULONG ulCount = cValues * sizeof(SPropValue); + ULONG ulCount = cValues * sizeof(SPropValue); ULONG ulLen, i, iter; TRACE("(%d,%p,%p,%p,%p)\n", cValues, lpProps, lpOld, lpNew, lpCount); @@ -1279,8 +1279,6 @@ */ ULONG WINAPI FBadProp(LPSPropValue lpProp) { - ULONG i; - if (!lpProp || IsBadReadPtr(lpProp, sizeof(SPropValue)) || FBadPropTag(lpProp->ulPropTag)) return TRUE; @@ -1332,16 +1330,7 @@ return FBadRglpszW(lpProp->Value.MVszW.lppszW, lpProp->Value.MVszW.cValues); case PT_MV_BINARY: - if (PROP_BadArray(lpProp, sizeof(SBinary))) - return TRUE; - - for (i = 0; i < lpProp->Value.MVszW.cValues; i++) - { - if (IsBadReadPtr(lpProp->Value.MVbin.lpbin[i].lpb, - lpProp->Value.MVbin.lpbin[i].cb)) - return TRUE; - } - break; + return FBadEntryList((LPENTRYLIST)&lpProp->Value.MVbin); } return FALSE; } @@ -1380,3 +1369,1179 @@ TRACE("Returning %s\n", ulRet ? "TRUE" : "FALSE"); return ulRet; } + + +/************************************************************************** + * IMAPIProp {MAPI32} + * + * The default Mapi interface for manipulating object properties. + * + * DESCRIPTION + * This object provides an interface to an objects properties. It is exposed + * by several types of Mapi objects in order to simplify the querying and + * modification of properties. + * + * METHODS + */ + +/* A single property in a property data collection */ +typedef struct +{ + struct list entry; + ULONG ulAccess; /* The property value access level */ + LPSPropValue value; /* The property value */ +} IPropDataItem, *LPIPropDataItem; + + /* The main property data collection structure */ +typedef struct +{ + IPropDataVtbl *lpVtbl; + LONG lRef; /* Reference count */ + ALLOCATEBUFFER *lpAlloc; /* Memory allocation routine */ + ALLOCATEMORE *lpMore; /* Linked memory allocation routine */ + FREEBUFFER *lpFree; /* Memory free routine */ + ULONG ulObjAccess; /* Object access level */ + ULONG ulNumValues; /* Number of items in values list */ + struct list values; /* List of property values */ + CRITICAL_SECTION cs; /* Lock for thread safety */ +} IPropDataImpl; + +/* Internal - Get a property value, assumes lock is held */ +static IPropDataItem *IMAPIPROP_GetValue(IPropDataImpl *This, ULONG ulPropTag) +{ + struct list *cursor; + + LIST_FOR_EACH(cursor, &This->values) + { + LPIPropDataItem current = LIST_ENTRY(cursor, IPropDataItem, entry); + /* Note that propery types don't have to match, just Id's */ + if (PROP_ID(current->value->ulPropTag) == PROP_ID(ulPropTag)) + return current; + } + return NULL; +} + +/* Internal - Add a new property value, assumes lock is held */ +static IPropDataItem *IMAPIPROP_AddValue(IPropDataImpl *This, + LPSPropValue lpProp) +{ + LPVOID lpMem; + LPIPropDataItem lpNew; + HRESULT hRet; + + hRet = This->lpAlloc(sizeof(IPropDataItem), &lpMem); + + if (SUCCEEDED(hRet)) + { + lpNew = lpMem; + lpNew->ulAccess = IPROP_READWRITE; + + /* Allocate the value seperately so we can update it easily */ + lpMem = NULL; + hRet = This->lpAlloc(sizeof(SPropValue), &lpMem); + if (SUCCEEDED(hRet)) + { + lpNew->value = lpMem; + + hRet = PropCopyMore(lpNew->value, lpProp, This->lpMore, lpMem); + if (SUCCEEDED(hRet)) + { + list_add_tail(&This->values, &lpNew->entry); + This->ulNumValues++; + return lpNew; + } + This->lpFree(lpNew->value); + } + This->lpFree(lpNew); + } + return NULL; +} + +/* Internal - Lock an IPropData object */ +static inline void IMAPIPROP_Lock(IPropDataImpl *This) +{ + RtlEnterCriticalSection(&This->cs); +} + +/* Internal - Unlock an IPropData object */ +static inline void IMAPIPROP_Unlock(IPropDataImpl *This) +{ + RtlLeaveCriticalSection(&This->cs); +} + +/* This one seems to be missing from mapidefs.h */ +#define CbNewSPropProblemArray(c) \ + (offsetof(SPropProblemArray,aProblem)+(c)*sizeof(SPropProblem)) + +/************************************************************************** + * IMAPIProp_QueryInterface {MAPI32} + * + * Inherited method from the IUnknown Interface. + * See IUnknown_QueryInterface. + * + * NOTES + * This object exposes the following interfaces: + * - IUnknown() : The default interface for all COM-Objects. + * - IMAPIProp() : The default Mapi interface for manipulating object properties. + */ +static inline HRESULT WINAPI +IMAPIProp_fnQueryInterface(LPMAPIPROP iface, REFIID riid, LPVOID *ppvObj) +{ + IPropDataImpl *This = (IPropDataImpl*)iface; + + TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObj); + + if (!ppvObj || !riid) + return MAPI_E_INVALID_PARAMETER; + + *ppvObj = NULL; + + if(IsEqualIID(riid, &IID_IUnknown) || + IsEqualIID(riid, &IID_IMAPIProp) || + IsEqualIID(riid, &IID_IMAPIPropData)) + { + *ppvObj = This; + IPropData_AddRef(iface); + TRACE("returning %p\n", *ppvObj); + return S_OK; + } + + TRACE("returning E_NOINTERFACE\n"); + return MAPI_E_INTERFACE_NOT_SUPPORTED; +} + +/************************************************************************** + * IMAPIProp_AddRef {MAPI32} + * + * Inherited method from the IUnknown Interface. + * See IUnknown_AddRef. + */ +static inline ULONG WINAPI IMAPIProp_fnAddRef(LPMAPIPROP iface) +{ + IPropDataImpl *This = (IPropDataImpl*)iface; + + TRACE("(%p)->(count=%ld)\n", This, This->lRef); + + return InterlockedIncrement(&This->lRef); +} + +/************************************************************************** + * IMAPIProp_Release {MAPI32} + * + * Inherited method from the IUnknown Interface. + * See IUnknown_Release. + */ +static inline ULONG WINAPI IMAPIProp_fnRelease(LPMAPIPROP iface) +{ + IPropDataImpl *This = (IPropDataImpl*)iface; + + TRACE("(%p)->()\n", This); + + if (!InterlockedDecrement(&This->lRef)) + { + TRACE("Destroying IPropData (%p)\n",This); + + /* Note: No need to lock, since no other thread is referencing iface */ + while (!list_empty(&This->values)) + { + struct list *head = list_head(&This->values); + LPIPropDataItem current = LIST_ENTRY(head, IPropDataItem, entry); + list_remove(head); + This->lpFree(current->value); + This->lpFree(current); + } + RtlDeleteCriticalSection(&This->cs); + This->lpFree(This); + return 0U; + } + return (ULONG)This->lRef; +} + +/************************************************************************** + * IMAPIProp_GetLastError {MAPI32} + * + * Get information about the last error that ocurred in an IMAPIProp object. + * + * PARAMS + * iface [I] IMAPIProp object that experienced the error + * hRes [I] Result of the call that returned an error + * ulFlags [I] 0=return Ascii strings, MAPI_UNICODE=return Unicode strings + * lppError [O] Destination for detailed error information + * + * RETURNS + * Success: S_OK. *lppError contains details about the last error. + * Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid, + * MAPI_E_NOT_ENOUGH_MEMORY, if memory allocation fails. + * + * NOTES + * - If this function succeeds, the returned information in *lppError must be + * freed using MAPIFreeBuffer() once the caller is finished with it. + * - It is possible for this function to suceed and set *lppError to NULL, + * if there is no further information to report about hRes. + */ +static inline HRESULT WINAPI +IMAPIProp_fnGetLastError(LPMAPIPROP iface, HRESULT hRes, + ULONG ulFlags, LPMAPIERROR *lppError) +{ + TRACE("(%p,0x%08lX,0x%08lX,%p)\n", iface, hRes, ulFlags, lppError); + + if (!lppError || SUCCEEDED(hRes) || (ulFlags & ~MAPI_UNICODE)) + return MAPI_E_INVALID_PARAMETER; + + *lppError = NULL; + return S_OK; +} + +/************************************************************************** + * IMAPIProp_SaveChanges {MAPI32} + * + * Update any changes made to a tansactional IMAPIProp object. + * + * PARAMS + * iface [I] IMAPIProp object to update + * ulFlags [I] Flags controlling the update. + * + * RETURNS + * Success: S_OK. Any outstanding changes are committed to the object. + * Failure: An HRESULT error code describing the error. + */ +static inline HRESULT WINAPI +IMAPIProp_fnSaveChanges(LPMAPIPROP iface, ULONG ulFlags) +{ + TRACE("(%p,0x%08lX)\n", iface, ulFlags); + + /* Since this object is not transacted we do not need to implement this */ + /* FIXME: Should we set the access levels to clean? */ + return S_OK; +} + +/************************************************************************** + * IMAPIProp_GetProps {MAPI32} + * + * Get property values from an IMAPIProp object. + * + * PARAMS + * iface [I] IMAPIProp object to get the property values from + * lpTags [I] Property tage of property values to be retrieved + * ulFlags [I] Return 0=Ascii MAPI_UNICODE=Unicode strings for + * unspecified types + * lpCount [O] Destination for number of properties returned + * lppProps [O] Destination for returned property values + * + * RETURNS + * Success: S_OK. *lppProps and *lpCount are updated. + * Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid. + * MAPI_E_NOT_ENOUGH_MEMORY, if memory allocation fails, or + * MAPI_W_ERRORS_RETURNED if not all properties were retrieved + * successfully. + * NOTES + * - If MAPI_W_ERRORS_RETURNED is returned, any properties that could not be + * retrieved from iface are present in lppProps with their type + * changed to PT_ERROR and Id unchanged. + */ +static inline HRESULT WINAPI +IMAPIProp_fnGetProps(LPMAPIPROP iface, LPSPropTagArray lpTags, + ULONG ulFlags, ULONG *lpCount, LPSPropValue *lppProps) +{ + ULONG i; + HRESULT hRet = S_OK; + IPropDataImpl *This = (IPropDataImpl*)iface; + + TRACE("(%p,%p,0x%08lx,%p,%p) stub\n", iface, lpTags, ulFlags, + lpCount, lppProps); + + if (!iface || ulFlags & ~MAPI_UNICODE || !lpTags || *lpCount || !lppProps) + return MAPI_E_INVALID_PARAMETER; + + FIXME("semi-stub, flags not supported\n"); + + *lpCount = lpTags->cValues; + *lppProps = NULL; + + if (*lpCount) + { + hRet = MAPIAllocateBuffer(*lpCount * sizeof(SPropValue), (LPVOID*)lppProps); + if (FAILED(hRet)) + return hRet; + + IMAPIPROP_Lock(This); + + for (i = 0; i < lpTags->cValues; i++) + { + HRESULT hRetTmp = E_INVALIDARG; + LPIPropDataItem item; + + item = IMAPIPROP_GetValue(This, lpTags->aulPropTag[i]); + + if (item) + hRetTmp = PropCopyMore(&(*lppProps)[i], item->value, + This->lpMore, *lppProps); + if (FAILED(hRetTmp)) + { + hRet = MAPI_W_ERRORS_RETURNED; + (*lppProps)[i].ulPropTag = + CHANGE_PROP_TYPE(lpTags->aulPropTag[i], PT_ERROR); + } + } + + IMAPIPROP_Unlock(This); + } + return hRet; +} + +/************************************************************************** + * MAPIProp_GetPropList {MAPI32} + * + * Get the list of property tags for all values in an IMAPIProp object. + * + * PARAMS + * iface [I] IMAPIProp object to get the property tag list from + * ulFlags [I] Return 0=Ascii MAPI_UNICODE=Unicode strings for + * unspecified types + * lppTags [O] Destination for the retrieved peoperty tag list + * + * RETURNS + * Success: S_OK. *lppTags contains the tags for all available properties. + * Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid. + * MAPI_E_BAD_CHARWIDTH, if Ascii or Unicode strings are requested + * and that type of string is not supported. + */ +static inline HRESULT WINAPI +IMAPIProp_fnGetPropList(LPMAPIPROP iface, ULONG ulFlags, + LPSPropTagArray *lppTags) +{ + IPropDataImpl *This = (IPropDataImpl*)iface; + ULONG i; + HRESULT hRet; + + TRACE("(%p,0x%08lx,%p) stub\n", iface, ulFlags, lppTags); + + if (!iface || ulFlags & ~MAPI_UNICODE || !lppTags) + return MAPI_E_INVALID_PARAMETER; + + FIXME("semi-stub, flags not supported\n"); + + *lppTags = NULL; + + IMAPIPROP_Lock(This); + + hRet = MAPIAllocateBuffer(CbNewSPropTagArray(This->ulNumValues), + (LPVOID*)lppTags); + if (SUCCEEDED(hRet)) + { + struct list *cursor; + + i = 0; + LIST_FOR_EACH(cursor, &This->values) + { + LPIPropDataItem current = LIST_ENTRY(cursor, IPropDataItem, entry); + (*lppTags)->aulPropTag[i] = current->value->ulPropTag; + i++; + } + (*lppTags)->cValues = This->ulNumValues; + } + + IMAPIPROP_Unlock(This); + return hRet; +} + +/************************************************************************** + * IMAPIProp_OpenProperty {MAPI32} + * + * Not documented at this time. + * + * RETURNS + * An HRESULT success/failure code. + */ +static inline HRESULT WINAPI +IMAPIProp_fnOpenProperty(LPMAPIPROP iface, ULONG ulPropTag, LPCIID iid, + ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lpUnk) +{ + FIXME("(%p,%lu,%s,%lu,0x%08lx,%p) stub\n", iface, ulPropTag, + debugstr_guid(iid), ulOpts, ulFlags, lpUnk); + return MAPI_E_NO_SUPPORT; +} + + +/************************************************************************** + * IMAPIProp_SetProps {MAPI32} + * + * Add or edit the property values in an IMAPIProp object. + * + * PARAMS + * iface [I] IMAPIProp object to get the property tag list from + * ulValues [I] Number of properties in lpProps + * lpProps [I] Property values to set + * lppProbs [O] Optional destination for any problems that occurred + * + * RETURNS + * Success: S_OK. The properties in lpProps are added to iface if they don't + * exist, or changed to the values in lpProps if they do + * Failure: An HRESULT error code describing the error + */ +static inline HRESULT WINAPI +IMAPIProp_fnSetProps(LPMAPIPROP iface, ULONG ulValues, + LPSPropValue lpProps, LPSPropProblemArray *lppProbs) +{ + IPropDataImpl *This = (IPropDataImpl*)iface; + HRESULT hRet = S_OK; + ULONG i; + + TRACE("(%p,%lu,%p,%p)\n", iface, ulValues, lpProps, lppProbs); + + if (!iface || !lpProps) + return MAPI_E_INVALID_PARAMETER; + + for (i = 0; i < ulValues; i++) + { + if (FBadProp(&lpProps[i]) || + PROP_TYPE(lpProps[i].ulPropTag) == PT_OBJECT || + PROP_TYPE(lpProps[i].ulPropTag) == PT_NULL) + return MAPI_E_INVALID_PARAMETER; + } + + IMAPIPROP_Lock(This); + + /* FIXME: Under what circumstances is lpProbs created? */ + for (i = 0; i < ulValues; i++) + { + LPIPropDataItem item = IMAPIPROP_GetValue(This, lpProps[i].ulPropTag); + + if (item) + { + HRESULT hRetTmp; + LPVOID lpMem = NULL; + + /* Found, so update the existing value */ + if (item->value->ulPropTag != lpProps[i].ulPropTag) + FIXME("semi-stub, overwriting type (not coercing)\n"); + + hRetTmp = This->lpAlloc(sizeof(SPropValue), &lpMem); + if (SUCCEEDED(hRetTmp)) + { + hRetTmp = PropCopyMore(lpMem, &lpProps[i], This->lpMore, lpMem); + if (SUCCEEDED(hRetTmp)) + { + This->lpFree(item->value); + item->value = lpMem; + continue; + } + This->lpFree(lpMem); + } + hRet = hRetTmp; + } + else + { + /* Add new value */ + if (!(item = IMAPIPROP_AddValue(This, &lpProps[i]))) + hRet = MAPI_E_NOT_ENOUGH_MEMORY; + } + } + + IMAPIPROP_Unlock(This); + return hRet; +} + +/************************************************************************** + * IMAPIProp_DeleteProps {MAPI32} + * + * Delete one or more property values from a IMAPIProp objects. + * + * PARAMS + * iface [I] IMAPIProp object to remove property values from. + * lpTags [I] Collection of property Id's to remove from iface. + * lppProbs [O] Destination for problems encountered, if any. + * + * RETURNS + * Success: S_OK. Any properties in iface matching property Id's in lpTags have + * been deleted. If lppProbs is non-NULL it contains details of any + * errors that occurred. + * Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid. + * E_ACCESSDENIED, if this object was created using CreateIProp() and + * a subsequent call to IPropData_SetObjAcess() was made specifying + * IPROP_READONLY as the access type. + * + * NOTES + * - lppProbs will not be populated for cases where a property Id is present + * in lpTags but not in iface. + * - lppProbs should be deleted with MAPIFreeBuffer() if returned. + */ +static inline HRESULT WINAPI +IMAPIProp_fnDeleteProps(LPMAPIPROP iface, LPSPropTagArray lpTags, + LPSPropProblemArray *lppProbs) +{ + IPropDataImpl *This = (IPropDataImpl*)iface; + ULONG i, numProbs = 0; + HRESULT hRet = S_OK; + + TRACE("(%p,%p,%p)\n", iface, lpTags, lppProbs); + + if (!iface || !lpTags) + return MAPI_E_INVALID_PARAMETER; + + if (lppProbs) + *lppProbs = NULL; + + for (i = 0; i < lpTags->cValues; i++) + { + if (FBadPropTag(lpTags->aulPropTag[i]) || + PROP_TYPE(lpTags->aulPropTag[i]) == PT_OBJECT || + PROP_TYPE(lpTags->aulPropTag[i]) == PT_NULL) + return MAPI_E_INVALID_PARAMETER; + } + + IMAPIPROP_Lock(This); + + if (This->ulObjAccess != IPROP_READWRITE) + { + IMAPIPROP_Unlock(This); + return E_ACCESSDENIED; + } + + for (i = 0; i < lpTags->cValues; i++) + { + LPIPropDataItem item = IMAPIPROP_GetValue(This, lpTags->aulPropTag[i]); + + if (item) + { + if (item->ulAccess & IPROP_READWRITE) + { + /* Everything hunky-dory, remove the item */ + list_remove(&item->entry); + This->lpFree(item->value); /* Also frees value pointers */ + This->lpFree(item); + This->ulNumValues--; + } + else if (lppProbs) + { + /* Can't write the value. Create/populate problems array */ + if (!*lppProbs) + { + /* Create problems array */ + ULONG ulSize = CbNewSPropProblemArray(lpTags->cValues - i); + HRESULT hRetTmp = MAPIAllocateBuffer(ulSize, (LPVOID*)lppProbs); + if (FAILED(hRetTmp)) + hRet = hRetTmp; + } + if (*lppProbs) + { + LPSPropProblem lpProb = &(*lppProbs)->aProblem[numProbs]; + lpProb->ulIndex = i; + lpProb->ulPropTag = lpTags->aulPropTag[i]; + lpProb->scode = E_ACCESSDENIED; + numProbs++; + } + } + } + } + if (lppProbs && *lppProbs) + (*lppProbs)->cProblem = numProbs; + + IMAPIPROP_Unlock(This); + return hRet; +} + + +/************************************************************************** + * IMAPIProp_CopyTo {MAPI32} + * + * Not documented at this time. + * + * RETURNS + * An HRESULT success/failure code. + */ +static inline HRESULT WINAPI +IMAPIProp_fnCopyTo(LPMAPIPROP iface, ULONG niids, LPCIID lpiidExcl, + LPSPropTagArray lpPropsExcl, ULONG ulParam, + LPMAPIPROGRESS lpIProgress, LPCIID lpIfaceIid, LPVOID lpDstObj, + ULONG ulFlags, LPSPropProblemArray *lppProbs) +{ + FIXME("(%p,%lu,%p,%p,%lx,%p,%s,%p,0x%08lX,%p) stub\n", iface, niids, + lpiidExcl, lpPropsExcl, ulParam, lpIProgress, + debugstr_guid(lpIfaceIid), lpDstObj, ulFlags, lppProbs); + return MAPI_E_NO_SUPPORT; +} + +/************************************************************************** + * IMAPIProp_CopyProps {MAPI32} + * + * Not documented at this time. + * + * RETURNS + * An HRESULT success/failure code. + */ +static inline HRESULT WINAPI +IMAPIProp_fnCopyProps(LPMAPIPROP iface, LPSPropTagArray lpInclProps, + ULONG ulParam, LPMAPIPROGRESS lpIProgress, LPCIID lpIface, + LPVOID lpDstObj, ULONG ulFlags, + LPSPropProblemArray *lppProbs) +{ + FIXME("(%p,%p,%lx,%p,%s,%p,0x%08lX,%p) stub\n", iface, lpInclProps, + ulParam, lpIProgress, debugstr_guid(lpIface), lpDstObj, ulFlags, + lppProbs); + return MAPI_E_NO_SUPPORT; +} + +/************************************************************************** + * IMAPIProp_GetNamesFromIDs {MAPI32} + * + * Get the names of properties from their identifiers. + * + * PARAMS + * iface [I] IMAPIProp object to operate on + * lppPropTags [I/O] Property identifiers to get the names for, or NULL to + * get all names + * iid [I] Property set identifier, or NULL + * ulFlags [I] MAPI_NO_IDS=Don't return numeric named properties, + * or MAPI_NO_STRINGS=Don't return strings + * lpCount [O] Destination for number of properties returned + * lpppNames [O] Destination for returned names + * + * RETURNS + * Success: S_OK. *lppPropTags and lpppNames contain the returned + * name/identifiers. + * Failure: MAPI_E_NO_SUPPORT, if the object does not support named properties, + * MAPI_E_NOT_ENOUGH_MEMORY, if memory allocation fails, or + * MAPI_W_ERRORS_RETURNED if not all properties were retrieved + * successfully. + */ +static inline HRESULT WINAPI +IMAPIProp_fnGetNamesFromIDs(LPMAPIPROP iface, LPSPropTagArray *lppPropTags, + LPGUID iid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) +{ + FIXME("(%p,%p,%s,0x%08lX,%p,%p) stub\n", iface, lppPropTags, + debugstr_guid(iid), ulFlags, lpCount, lpppNames); + return MAPI_E_NO_SUPPORT; +} + +/************************************************************************** + * IMAPIProp_GetIDsFromNames {MAPI32} + * + * Get property identifiers associated with one or more named properties. + * + * PARAMS + * iface [I] IMAPIProp object to operate on + * ulNames [I] Number of names in lppNames + * lppNames [I] Names to query or create, or NULL to query all names + * ulFlags [I] Pass MAPI_CREATE to create new named properties + * lppPropTags [O] Destination for queried or created property identifiers + * + * RETURNS + * Success: S_OK. *lppPropTags contains the property tags created or requested. + * Failure: MAPI_E_NO_SUPPORT, if the object does not support named properties, + * MAPI_E_TOO_BIG, if the object cannot process the number of + * properties involved. + * MAPI_E_NOT_ENOUGH_MEMORY, if memory allocation fails, or + * MAPI_W_ERRORS_RETURNED if not all properties were retrieved + * successfully. + */ +static inline HRESULT WINAPI +IMAPIProp_fnGetIDsFromNames(LPMAPIPROP iface, ULONG ulNames, + LPMAPINAMEID *lppNames, ULONG ulFlags, + LPSPropTagArray *lppPropTags) +{ + FIXME("(%p,%ld,%p,0x%08lX,%p) stub\n", + iface, ulNames, lppNames, ulFlags, lppPropTags); + return MAPI_E_NO_SUPPORT; +} + +/************************************************************************** + * IPropData {MAPI32} + * + * A default Mapi interface to provide manipulation of object properties. + * + * DESCRIPTION + * This object provides a default interface suitable in some cases as an + * implementation of the IMAPIProp interface (which has no default + * implementation). In addition to the IMAPIProp() methods inherited, this + * interface allows read/write control over access to the object and its + * individual properties. + * + * To obtain the default implementation of this interface from Mapi, call + * CreateIProp(). + * + * METHODS + */ + +/************************************************************************** + * IPropData_QueryInterface {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_QueryInterface. + */ +static HRESULT WINAPI +IPropData_fnQueryInterface(LPPROPDATA iface, REFIID riid, LPVOID *ppvObj) +{ + return IMAPIProp_fnQueryInterface((LPMAPIPROP)iface, riid, ppvObj); +} + +/************************************************************************** + * IPropData_AddRef {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_AddRef. + */ +static ULONG WINAPI +IPropData_fnAddRef(LPPROPDATA iface) +{ + return IMAPIProp_fnAddRef((LPMAPIPROP)iface); +} + +/************************************************************************** + * IPropData_Release {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_Release. + */ +static ULONG WINAPI +IPropData_fnRelease(LPPROPDATA iface) +{ + return IMAPIProp_fnRelease((LPMAPIPROP)iface); +} + +/************************************************************************** + * IPropData_GetLastError {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_GetLastError. + */ +static HRESULT WINAPI +IPropData_fnGetLastError(LPPROPDATA iface, HRESULT hRes, ULONG ulFlags, + LPMAPIERROR *lppError) +{ + return IMAPIProp_fnGetLastError((LPMAPIPROP)iface, hRes, ulFlags, lppError); +} + +/************************************************************************** + * IPropData_SaveChanges {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_SaveChanges. + */ +static HRESULT WINAPI +IPropData_fnSaveChanges(LPPROPDATA iface, ULONG ulFlags) +{ + return IMAPIProp_fnSaveChanges((LPMAPIPROP)iface, ulFlags); +} + +/************************************************************************** + * IPropData_GetProps {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_GetProps. + */ +static HRESULT WINAPI +IPropData_fnGetProps(LPPROPDATA iface, LPSPropTagArray lpPropTags, + ULONG ulFlags, ULONG *lpCount, LPSPropValue *lppProps) +{ + return IMAPIProp_fnGetProps((LPMAPIPROP)iface, lpPropTags, ulFlags, + lpCount, lppProps); +} + +/************************************************************************** + * IPropData_GetPropList {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_GetPropList. + */ +static HRESULT WINAPI +IPropData_fnGetPropList(LPPROPDATA iface, ULONG ulFlags, + LPSPropTagArray *lppPropTags) +{ + return IMAPIProp_fnGetPropList((LPMAPIPROP)iface, ulFlags, lppPropTags); +} + +/************************************************************************** + * IPropData_OpenProperty {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_OpenProperty. + */ +static HRESULT WINAPI +IPropData_fnOpenProperty(LPPROPDATA iface, ULONG ulPropTag, LPCIID iid, + ULONG ulOpts, ULONG ulFlags, LPUNKNOWN *lpUnk) +{ + return IMAPIProp_fnOpenProperty((LPMAPIPROP)iface, ulPropTag, iid, + ulOpts, ulFlags, lpUnk); +} + +/************************************************************************** + * IPropData_SetProps {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_SetProps. + */ +static HRESULT WINAPI +IPropData_fnSetProps(LPPROPDATA iface, ULONG cValues, LPSPropValue lpProps, + LPSPropProblemArray *lppProbs) +{ + return IMAPIProp_fnSetProps((LPMAPIPROP)iface, cValues, lpProps, lppProbs); +} + +/************************************************************************** + * IPropData_DeleteProps {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_DeleteProps. + */ +static HRESULT WINAPI +IPropData_fnDeleteProps(LPPROPDATA iface, LPSPropTagArray lpPropTags, + LPSPropProblemArray *lppProbs) +{ + return IMAPIProp_fnDeleteProps((LPMAPIPROP)iface, lpPropTags, lppProbs); +} + +/************************************************************************** + * IPropData_CopyTo {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_CopyTo. + */ +static HRESULT WINAPI +IPropData_fnCopyTo(LPPROPDATA iface, ULONG ciidExclude, LPCIID lpIid, + LPSPropTagArray lpProps, ULONG ulParam, + LPMAPIPROGRESS lpProgress, LPCIID lpIface, LPVOID lpDst, + ULONG ulFlags, LPSPropProblemArray *lppProbs) +{ + return IMAPIProp_fnCopyTo((LPMAPIPROP)iface, ciidExclude, lpIid, lpProps, + ulParam, lpProgress, lpIface, lpDst, + ulFlags, lppProbs); +} + +/************************************************************************** + * IPropData_CopyProps {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_CopyProps. + */ +static HRESULT WINAPI +IPropData_fnCopyProps(LPPROPDATA iface, LPSPropTagArray lpProps, + ULONG ulParam, LPMAPIPROGRESS lpProgress, LPCIID lpIface, + LPVOID lpDst, ULONG ulFlags, LPSPropProblemArray *lppProbs) +{ + return IMAPIProp_fnCopyProps((LPMAPIPROP)iface, lpProps, ulParam, + lpProgress, lpIface, lpDst, ulFlags, lppProbs); +} + +/************************************************************************** + * IPropData_GetNamesFromIDs {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_GetNamesFromIDs. + */ +static HRESULT WINAPI +IPropData_fnGetNamesFromIDs(LPPROPDATA iface, LPSPropTagArray *lppPropTags, + LPGUID iid, ULONG ulFlags, ULONG *lpCount, + LPMAPINAMEID **lpppNames) +{ + return IMAPIProp_fnGetNamesFromIDs((LPMAPIPROP)iface, lppPropTags, iid, + ulFlags, lpCount, lpppNames); +} + +/************************************************************************** + * IPropData_GetIDsFromNames {MAPI32} + * + * Inherited method from the IMAPIProp Interface. + * See IMAPIProp_GetIDsFromNames. + */ +static HRESULT WINAPI +IPropData_fnGetIDsFromNames(LPPROPDATA iface, ULONG ulNames, + LPMAPINAMEID *lppNames, ULONG ulFlags, + LPSPropTagArray *lppPropTags) +{ + return IMAPIProp_fnGetIDsFromNames((LPMAPIPROP)iface, ulNames, lppNames, + ulFlags, lppPropTags); +} + +/************************************************************************** + * IPropData_HrSetObjAccess {MAPI32} + * + * Set the access level of an IPropData object. + * + * PARAMS + * iface [I] IPropData object to set the access on + * ulAccess [I] Either IPROP_READONLY or IPROP_READWRITE for read or + * read/write access respectively. + * + * RETURNS + * Success: S_OK. The objects access level is changed. + * Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid. + */ +static HRESULT WINAPI +IPropData_fnHrSetObjAccess(LPPROPDATA iface, ULONG ulAccess) +{ + IPropDataImpl *This = (IPropDataImpl*)iface; + + TRACE("(%p,%lx)\n", iface, ulAccess); + + if (!iface || ulAccess < IPROP_READONLY || ulAccess > IPROP_READWRITE) + return MAPI_E_INVALID_PARAMETER; + + IMAPIPROP_Lock(This); + + This->ulObjAccess = ulAccess; + + IMAPIPROP_Unlock(This); + return S_OK; +} + +/* Internal - determine if an access value is bad */ +static inline BOOL PROP_IsBadAccess(ULONG ulAccess) +{ + switch (ulAccess) + { + case IPROP_READONLY|IPROP_CLEAN: + case IPROP_READONLY|IPROP_DIRTY: + case IPROP_READWRITE|IPROP_CLEAN: + case IPROP_READWRITE|IPROP_DIRTY: + return FALSE; + } + return TRUE; +} + +/************************************************************************** + * IPropData_HrSetPropAccess {MAPI32} + * + * Set the access levels for a group of property values in an IPropData object. + * + * PARAMS + * iface [I] IPropData object to set access levels in. + * lpTags [I] List of property Id's to set access for. + * lpAccess [O] Access level for each property in lpTags. + * + * RETURNS + * Success: S_OK. The access level of each property value in lpTags that is + * present in iface is changed. + * Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid. + * + * NOTES + * - Each access level in lpAccess must contain at least one of IPROP_READONLY + * or IPROP_READWRITE, but not both, and also IPROP_CLEAN or IPROP_DIRTY, + * but not both. No other bits should be set. + * - If a property Id in lpTags is not present in iface, it is ignored. + */ +static HRESULT WINAPI +IPropData_fnHrSetPropAccess(LPPROPDATA iface, LPSPropTagArray lpTags, + ULONG *lpAccess) +{ + IPropDataImpl *This = (IPropDataImpl*)iface; + + ULONG i; + + TRACE("(%p,%p,%p)\n", iface, lpTags, lpAccess); + + if (!iface || !lpTags || !lpAccess) + return MAPI_E_INVALID_PARAMETER; + + for (i = 0; i < lpTags->cValues; i++) + { + if (FBadPropTag(lpTags->aulPropTag[i]) || PROP_IsBadAccess(lpAccess[i])) + return MAPI_E_INVALID_PARAMETER; + } + + IMAPIPROP_Lock(This); + + for (i = 0; i < lpTags->cValues; i++) + { + LPIPropDataItem item = IMAPIPROP_GetValue(This, lpTags->aulPropTag[i]); + + if (item) + item->ulAccess = lpAccess[i]; + } + + IMAPIPROP_Unlock(This); + return S_OK; +} + +/************************************************************************** + * IPropData_HrGetPropAccess {MAPI32} + * + * Get the access levels for a group of property values in an IPropData object. + * + * PARAMS + * iface [I] IPropData object to get access levels from. + * lppTags [O] Destination for the list of property Id's in iface. + * lppAccess [O] Destination for access level for each property in lppTags. + * + * RETURNS + * Success: S_OK. lppTags and lppAccess contain the property Id's and the + * Access level of each property value in iface. + * Failure: MAPI_E_INVALID_PARAMETER, if any parameter is invalid, or + * MAPI_E_NOT_ENOUGH_MEMORY if memory allocation fails. + * + * NOTES + * - *lppTags and *lppAccess should be freed with MAPIFreeBuffer() by the caller. + */ +static HRESULT WINAPI +IPropData_fnHrGetPropAccess(LPPROPDATA iface, LPSPropTagArray *lppTags, + ULONG **lppAccess) +{ + IPropDataImpl *This = (IPropDataImpl*)iface; + LPVOID lpMem; + HRESULT hRet; + ULONG i; + + TRACE("(%p,%p,%p) stub\n", iface, lppTags, lppAccess); + + if (!iface || !lppTags || !lppAccess) + return MAPI_E_INVALID_PARAMETER; + + *lppTags = NULL; + *lppAccess = NULL; + + IMAPIPROP_Lock(This); + + hRet = This->lpAlloc(CbNewSPropTagArray(This->ulNumValues), &lpMem); + if (SUCCEEDED(hRet)) + { + *lppTags = lpMem; + + hRet = This->lpAlloc(This->ulNumValues * sizeof(ULONG), &lpMem); + if (SUCCEEDED(hRet)) + { + struct list *cursor; + + *lppAccess = lpMem; + (*lppTags)->cValues = This->ulNumValues; + + i = 0; + LIST_FOR_EACH(cursor, &This->values) + { + LPIPropDataItem item = LIST_ENTRY(cursor, IPropDataItem, entry); + (*lppTags)->aulPropTag[i] = item->value->ulPropTag; + (*lppAccess)[i] = item->ulAccess; + i++; + } + IMAPIPROP_Unlock(This); + return S_OK; + } + This->lpFree(*lppTags); + *lppTags = 0; + } + IMAPIPROP_Unlock(This); + return MAPI_E_NOT_ENOUGH_MEMORY; +} + +/************************************************************************** + * IPropData_HrAddObjProps {MAPI32} + * + * Not documented at this time. + * + * RETURNS + * An HRESULT success/failure code. + */ +static HRESULT WINAPI +IPropData_fnHrAddObjProps(LPPROPDATA iface, LPSPropTagArray lpTags, + LPSPropProblemArray *lppProbs) +{ +#if 0 + ULONG i; + HRESULT hRet; + LPSPropValue lpValues; +#endif + + FIXME("(%p,%p,%p) stub\n", iface, lpTags, lppProbs); + + if (!iface || !lpTags) + return MAPI_E_INVALID_PARAMETER; + + /* FIXME: Below is the obvious implementation, adding all the properties + * in lpTags to the object. However, it doesn't appear that this + * is what this function does. + */ + return S_OK; +#if 0 + if (!lpTags->cValues) + return S_OK; + + lpValues = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + lpTags->cValues * sizeof(SPropValue)); + if (!lpValues) + return MAPI_E_NOT_ENOUGH_MEMORY; + + for (i = 0; i < lpTags->cValues; i++) + lpValues[i].ulPropTag = lpTags->aulPropTag[i]; + + hRet = IPropData_SetProps(iface, lpTags->cValues, lpValues, lppProbs); + HeapFree(GetProcessHeap(), 0, lpValues); + return hRet; +#endif +} + +static struct IPropDataVtbl IPropDataImpl_vtbl = +{ + IPropData_fnQueryInterface, + IPropData_fnAddRef, + IPropData_fnRelease, + IPropData_fnGetLastError, + IPropData_fnSaveChanges, + IPropData_fnGetProps, + IPropData_fnGetPropList, + IPropData_fnOpenProperty, + IPropData_fnSetProps, + IPropData_fnDeleteProps, + IPropData_fnCopyTo, + IPropData_fnCopyProps, + IPropData_fnGetNamesFromIDs, + IPropData_fnGetIDsFromNames, + IPropData_fnHrSetObjAccess, + IPropData_fnHrSetPropAccess, + IPropData_fnHrGetPropAccess, + IPropData_fnHrAddObjProps +}; + +/************************************************************************* + * CreateIProp@24 (MAPI32.60) + * + * Create an IPropData object. + * + * PARAMS + * iid [I] GUID of the object to create. Use &IID_IMAPIPropData or NULL + * lpAlloc [I] Memory allocation function. Use MAPIAllocateBuffer() + * lpMore [I] Linked memory allocation function. Use MAPIAllocateMore() + * lpFree [I] Memory free function. Use MAPIFreeBuffer() + * lpReserved [I] Reserved, set to NULL + * lppPropData [O] Destination for created IPropData object + * + * RETURNS + * Success: S_OK. *lppPropData contains the newly created object. + * Failure: MAPI_E_INTERFACE_NOT_SUPPORTED, if iid is non-NULL and not supported, + * MAPI_E_INVALID_PARAMETER, if any parameter is invalid + */ +SCODE WINAPI CreateIProp(LPCIID iid, ALLOCATEBUFFER *lpAlloc, + ALLOCATEMORE *lpMore, FREEBUFFER *lpFree, + LPVOID lpReserved, LPPROPDATA *lppPropData) +{ + IPropDataImpl *lpPropData; + SCODE scode; + + TRACE("(%s,%p,%p,%p,%p,%p)\n", debugstr_guid(iid), lpAlloc, lpMore, lpFree, + lpReserved, lppPropData); + + if (lppPropData) + *lppPropData = NULL; + + if (iid && !IsEqualGUID(iid, &IID_IMAPIPropData)) + return MAPI_E_INTERFACE_NOT_SUPPORTED; + + if (!lpAlloc || !lpMore || !lpFree || lpReserved || !lppPropData) + return MAPI_E_INVALID_PARAMETER; + + scode = lpAlloc(sizeof(IPropDataImpl), (LPVOID*)&lpPropData); + + if (SUCCEEDED(scode)) + { + lpPropData->lpVtbl = &IPropDataImpl_vtbl; + lpPropData->lRef = 1; + lpPropData->lpAlloc = lpAlloc; + lpPropData->lpMore = lpMore; + lpPropData->lpFree = lpFree; + lpPropData->ulObjAccess = IPROP_READWRITE; + lpPropData->ulNumValues = 0; + list_init(&lpPropData->values); + RtlInitializeCriticalSection(&lpPropData->cs); + *lppPropData = (LPPROPDATA)lpPropData; + } + return scode; +} diff -urN wine-20041201/dlls/mapi32/tests/imalloc.c wine-20050111/dlls/mapi32/tests/imalloc.c --- wine-20041201/dlls/mapi32/tests/imalloc.c 2004-11-30 18:38:52.000000000 +0100 +++ wine-20050111/dlls/mapi32/tests/imalloc.c 2004-12-21 15:40:19.000000000 +0100 @@ -49,7 +49,6 @@ return; lpMalloc = pMAPIGetDefaultMalloc(); - ok (lpMalloc != NULL, "iMAPIGetDefaultMalloc returned null\n"); if (!lpMalloc) return; diff -urN wine-20041201/dlls/mapi32/tests/prop.c wine-20050111/dlls/mapi32/tests/prop.c --- wine-20041201/dlls/mapi32/tests/prop.c 2004-08-17 01:18:48.000000000 +0200 +++ wine-20050111/dlls/mapi32/tests/prop.c 2005-01-10 14:29:25.000000000 +0100 @@ -51,6 +51,8 @@ static ULONG (WINAPI *pFBadRow)(LPSRow); static ULONG (WINAPI *pFBadProp)(LPSPropValue); static ULONG (WINAPI *pFBadColumnSet)(LPSPropTagArray); +static SCODE (WINAPI *pCreateIProp)(LPCIID,ALLOCATEBUFFER*,ALLOCATEMORE*, + FREEBUFFER*,LPVOID,LPPROPDATA*); static ULONG ptTypes[] = { PT_I2, PT_I4, PT_R4, PT_R8, PT_CURRENCY, PT_APPTIME, PT_SYSTIME, @@ -71,7 +73,7 @@ SPropValue *lpDest = NULL, *lpSrc = NULL; ULONG i; SCODE scode; - + pPropCopyMore = (void*)GetProcAddress(hMapi32, "PropCopyMore@16"); if (!pPropCopyMore) @@ -80,7 +82,7 @@ scode = MAPIAllocateBuffer(sizeof(LPSPropValue), (LPVOID *)lpDest); if (FAILED(scode)) return; - + scode = MAPIAllocateMore(sizeof(LPSPropValue), lpDest, (LPVOID *)lpSrc); if (FAILED(scode)) return; @@ -88,7 +90,7 @@ for (i = 0; i < sizeof(ptTypes)/sizeof(ptTypes[0]); i++) { lpSrc->ulPropTag = ptTypes[i]; - + switch (ptTypes[i]) { case PT_STRING8: @@ -104,7 +106,7 @@ } memset(lpDest, 0xff, sizeof(SPropValue)); - + scode = pPropCopyMore(lpDest, lpSrc, MAPIAllocateMore, lpDest); ok(!scode && lpDest->ulPropTag == lpSrc->ulPropTag, "PropCopyMore: Expected 0x0,%ld, got 0x%08lx,%ld\n", @@ -122,14 +124,14 @@ "PropCopyMore: Unicode string differs\n"); break; case PT_BINARY: - ok(lpDest->Value.bin.cb == 4 && + ok(lpDest->Value.bin.cb == 4 && !memcmp(lpSrc->Value.bin.lpb, lpDest->Value.bin.lpb, 4), "PropCopyMore: Binary array differs\n"); break; } } } - + /* Since all allocations are linked, freeing lpDest frees everything */ MAPIFreeBuffer(lpDest); } @@ -154,9 +156,9 @@ memset(&pv, 0 ,sizeof(pv)); pv.ulPropTag = pt; - + exp = 1u; /* Default to one item for non-MV properties */ - + switch (PROP_TYPE(pt)) { case PT_MV_I2: pv.Value.MVi.cValues = exp = 2; @@ -178,9 +180,9 @@ case PT_OBJECT: exp = 0; break; case PT_MV_I8: pv.Value.MVli.cValues = exp = 2; case PT_I8: exp *= sizeof(LONG64); break; -#if 0 +#if 0 /* My version of native mapi returns 0 for PT_MV_CLSID even if a valid - * array is given. This _has_ to be a bug, so Wine does + * array is given. This _has_ to be a bug, so Wine does * the right thing(tm) and we don't test it here. */ case PT_MV_CLSID: pv.Value.MVguid.cValues = exp = 2; @@ -624,7 +626,7 @@ if (!pPpropFindProp) return; - + for (i = 0; i < sizeof(ptTypes)/sizeof(ptTypes[0]); i++) { pvProp.ulPropTag = ptTypes[i]; @@ -634,7 +636,7 @@ ptTypes[i]); pRet = pPpropFindProp(&pvProp, 1u, i ? ptTypes[i-1] : ptTypes[i+1]); - ok(pRet == NULL, "PpropFindProp[%ld]: Found non-existing propery\n", + ok(pRet == NULL, "PpropFindProp[%ld]: Found non-existent propery\n", ptTypes[i]); } @@ -672,17 +674,17 @@ switch (PROP_TYPE(pt)) { - case PT_I2: - case PT_I4: - case PT_R4: - case PT_R8: - case PT_CURRENCY: - case PT_APPTIME: - case PT_SYSTIME: - case PT_ERROR: - case PT_BOOLEAN: - case PT_OBJECT: - case PT_I8: + case PT_I2: + case PT_I4: + case PT_R4: + case PT_R8: + case PT_CURRENCY: + case PT_APPTIME: + case PT_SYSTIME: + case PT_ERROR: + case PT_BOOLEAN: + case PT_OBJECT: + case PT_I8: exp = sizeof(pv); break; case PT_CLSID: @@ -738,7 +740,6 @@ pv.Value.MVft.lpft = (FILETIME*)iid; exp = 3 * sizeof(CY) + sizeof(pv); break; - break; case PT_MV_STRING8: pv.Value.MVszA.cValues = 3; pv.Value.MVszA.lppszA = buffa; @@ -779,7 +780,7 @@ } else { success = res == S_OK && ulRet == exp; - ok(success, "pt= %ld: Expected %ld, got %ld, ret=0x%08lX\n", + ok(success, "pt= %ld: Expected %ld, got %ld, ret=0x%08lX\n", pt, exp, ulRet, res); } } @@ -793,7 +794,7 @@ SPropValue pvProp, *lpResProp = (LPSPropValue)buffer; ULONG ulCount; SCODE sc; - + pScCopyProps = (void*)GetProcAddress(hMapi32, "ScCopyProps@16"); pScRelocProps = (void*)GetProcAddress(hMapi32, "ScRelocProps@20"); @@ -801,37 +802,37 @@ return; pvProp.ulPropTag = PROP_TAG(PT_MV_STRING8, 1u); - + lppszA[0] = (char *)szTestA; pvProp.Value.MVszA.cValues = 1; pvProp.Value.MVszA.lppszA = lppszA; ulCount = 0; - - sc = pScCopyProps(1, &pvProp, buffer, &ulCount); + + sc = pScCopyProps(1, &pvProp, buffer, &ulCount); ok(sc == S_OK && lpResProp->ulPropTag == pvProp.ulPropTag && - lpResProp->Value.MVszA.cValues == 1 && + lpResProp->Value.MVszA.cValues == 1 && lpResProp->Value.MVszA.lppszA[0] == buffer + sizeof(SPropValue) + sizeof(char*) && !strcmp(lpResProp->Value.MVszA.lppszA[0], szTestA) && ulCount == sizeof(SPropValue) + sizeof(char*) + 5, "CopyProps(str): Expected 0 {1,%lx,%p,%s} %d got 0x%08lx {%ld,%lx,%p,%s} %ld\n", pvProp.ulPropTag, buffer + sizeof(SPropValue) + sizeof(char*), - szTestA, sizeof(SPropValue) + sizeof(char*) + 5, sc, + szTestA, sizeof(SPropValue) + sizeof(char*) + 5, sc, lpResProp->Value.MVszA.cValues, lpResProp->ulPropTag, lpResProp->Value.MVszA.lppszA[0], sc==S_OK?lpResProp->Value.MVszA.lppszA[0]:NULL, ulCount); memcpy(buffer2, buffer, sizeof(buffer)); - + /* Clear the data in the source buffer. Since pointers in the copied buffer * refer to the source buffer, this proves that native always assumes that * the copied buffers pointers are bad (needing to be relocated first). */ memset(buffer, 0, sizeof(buffer)); ulCount = 0; - + sc = pScRelocProps(1, (LPSPropValue)buffer2, buffer, buffer2, &ulCount); lpResProp = (LPSPropValue)buffer2; ok(sc == S_OK && lpResProp->ulPropTag == pvProp.ulPropTag && - lpResProp->Value.MVszA.cValues == 1 && + lpResProp->Value.MVszA.cValues == 1 && lpResProp->Value.MVszA.lppszA[0] == buffer2 + sizeof(SPropValue) + sizeof(char*) && !strcmp(lpResProp->Value.MVszA.lppszA[0], szTestA) && /* Native has a bug whereby it calculates the size correctly when copying @@ -841,11 +842,11 @@ (ulCount == sizeof(SPropValue) + sizeof(char*) + 5 || ulCount == sizeof(SPropValue) + 5), "RelocProps(str): Expected 0 {1,%lx,%p,%s} %d got 0x%08lx {%ld,%lx,%p,%s} %ld\n", pvProp.ulPropTag, buffer2 + sizeof(SPropValue) + sizeof(char*), - szTestA, sizeof(SPropValue) + sizeof(char*) + 5, sc, + szTestA, sizeof(SPropValue) + sizeof(char*) + 5, sc, lpResProp->Value.MVszA.cValues, lpResProp->ulPropTag, lpResProp->Value.MVszA.lppszA[0], sc==S_OK?lpResProp->Value.MVszA.lppszA[0]:NULL, ulCount); - /* Native crashes with lpNew or lpOld set to NULL so skip testing this */ + /* Native crashes with lpNew or lpOld set to NULL so skip testing this */ } static void test_LpValFindProp(void) @@ -857,7 +858,7 @@ if (!pLpValFindProp) return; - + for (i = 0; i < sizeof(ptTypes)/sizeof(ptTypes[0]); i++) { pvProp.ulPropTag = PROP_TAG(ptTypes[i], 1u); @@ -867,13 +868,13 @@ ptTypes[i]); pRet = pLpValFindProp(PROP_TAG(ptTypes[i], 0u), 1u, &pvProp); - ok(pRet == NULL, "LpValFindProp[%ld]: Found non-existing propery id\n", + ok(pRet == NULL, "LpValFindProp[%ld]: Found non-existent propery id\n", ptTypes[i]); - + pRet = pLpValFindProp(PROP_TAG(PT_NULL, 0u), 1u, &pvProp); - ok(pRet == NULL, "LpValFindProp[%ld]: Found non-existing propery id/type\n", + ok(pRet == NULL, "LpValFindProp[%ld]: Found non-existent propery id/type\n", ptTypes[i]); - + pRet = pLpValFindProp(PROP_TAG(PT_NULL, 1u), 1u, &pvProp); ok(pRet == &pvProp, "LpValFindProp[%ld]: Didn't find existing propery id\n", ptTypes[i]); @@ -885,24 +886,24 @@ LPSTR lpStrs[4]; char *szString = "A String"; BOOL bRet; - + pFBadRglpszA = (void*)GetProcAddress(hMapi32, "FBadRglpszA@8"); if (!pFBadRglpszA) return; - + bRet = pFBadRglpszA(NULL, 10); - ok(bRet == TRUE, "FBadRglpszA(Null): expected TRUE, got FALSE\n"); - + ok(bRet == TRUE, "FBadRglpszA(Null): expected TRUE, got FALSE\n"); + lpStrs[0] = lpStrs[1] = lpStrs[2] = lpStrs[3] = NULL; bRet = pFBadRglpszA(lpStrs, 4); - ok(bRet == TRUE, "FBadRglpszA(Nulls): expected TRUE, got FALSE\n"); + ok(bRet == TRUE, "FBadRglpszA(Nulls): expected TRUE, got FALSE\n"); lpStrs[0] = lpStrs[1] = lpStrs[2] = szString; bRet = pFBadRglpszA(lpStrs, 3); - ok(bRet == FALSE, "FBadRglpszA(valid): expected FALSE, got TRUE\n"); - + ok(bRet == FALSE, "FBadRglpszA(valid): expected FALSE, got TRUE\n"); + bRet = pFBadRglpszA(lpStrs, 4); - ok(bRet == TRUE, "FBadRglpszA(1 invalid): expected TRUE, got FALSE\n"); + ok(bRet == TRUE, "FBadRglpszA(1 invalid): expected TRUE, got FALSE\n"); } static void test_FBadRglpszW(void) @@ -910,37 +911,37 @@ LPWSTR lpStrs[4]; WCHAR szString[] = { 'A',' ','S','t','r','i','n','g','\0' }; BOOL bRet; - + pFBadRglpszW = (void*)GetProcAddress(hMapi32, "FBadRglpszW@8"); if (!pFBadRglpszW) return; - + bRet = pFBadRglpszW(NULL, 10); - ok(bRet == TRUE, "FBadRglpszW(Null): expected TRUE, got FALSE\n"); - + ok(bRet == TRUE, "FBadRglpszW(Null): expected TRUE, got FALSE\n"); + lpStrs[0] = lpStrs[1] = lpStrs[2] = lpStrs[3] = NULL; bRet = pFBadRglpszW(lpStrs, 4); - ok(bRet == TRUE, "FBadRglpszW(Nulls): expected TRUE, got FALSE\n"); + ok(bRet == TRUE, "FBadRglpszW(Nulls): expected TRUE, got FALSE\n"); lpStrs[0] = lpStrs[1] = lpStrs[2] = szString; bRet = pFBadRglpszW(lpStrs, 3); - ok(bRet == FALSE, "FBadRglpszW(valid): expected FALSE, got TRUE\n"); - + ok(bRet == FALSE, "FBadRglpszW(valid): expected FALSE, got TRUE\n"); + bRet = pFBadRglpszW(lpStrs, 4); - ok(bRet == TRUE, "FBadRglpszW(1 invalid): expected TRUE, got FALSE\n"); + ok(bRet == TRUE, "FBadRglpszW(1 invalid): expected TRUE, got FALSE\n"); } static void test_FBadRowSet(void) { ULONG ulRet; - + pFBadRowSet = (void*)GetProcAddress(hMapi32, "FBadRowSet@4"); if (!pFBadRowSet) return; - + ulRet = pFBadRowSet(NULL); ok(ulRet != 0, "FBadRow(null): Expected non-zero, got 0\n"); - + /* FIXME */ } @@ -978,11 +979,11 @@ static void test_FBadRow(void) { ULONG ulRet; - + pFBadRow = (void*)GetProcAddress(hMapi32, "FBadRow@4"); if (!pFBadRow) return; - + ulRet = pFBadRow(NULL); ok(ulRet != 0, "FBadRow(null): Expected non-zero, got 0\n"); @@ -995,7 +996,7 @@ GUID iid; ULONG pt, res; SPropValue pv; - + pFBadProp = (void*)GetProcAddress(hMapi32, "FBadProp@4"); if (!pFBadProp) return; @@ -1009,13 +1010,13 @@ /* Note that MV values are valid below because their array count is 0, * so no pointers are validated. - */ + */ switch (PROP_TYPE(pt)) { case (MV_FLAG|PT_UNSPECIFIED): case PT_UNSPECIFIED: - case (MV_FLAG|PT_NULL): - case PT_NULL: + case (MV_FLAG|PT_NULL): + case PT_NULL: case PT_MV_I2: case PT_I2: case PT_MV_I4: @@ -1115,10 +1116,222 @@ } } + +static void test_IProp(void) +{ + IPropData *lpIProp; + LPMAPIERROR lpError; + LPSPropProblemArray lpProbs; + LPSPropValue lpProps; + LPSPropTagArray lpTags; + SPropValue pvs[2]; + SizedSPropTagArray(2,tags); + ULONG access[2], count; + SCODE sc; + + pCreateIProp = (void*)GetProcAddress(hMapi32, "CreateIProp@24"); + if (!pCreateIProp) + return; + + memset(&tags, 0 , sizeof(tags)); + + /* Create the object */ + lpIProp = NULL; + sc = pCreateIProp(&IID_IMAPIPropData, MAPIAllocateBuffer, MAPIAllocateMore, + MAPIFreeBuffer, NULL, &lpIProp); + ok(sc == S_OK && lpIProp, + "CreateIProp: expected S_OK, non-null, got 0x%08lX,%p\n", sc, lpIProp); + + if (sc != S_OK || !lpIProp) + return; + + /* GetLastError - No errors set */ + lpError = NULL; + IPropData_GetLastError(lpIProp, E_INVALIDARG, 0, &lpError); + ok(sc == S_OK && !lpError, + "GetLastError: Expected S_OK, null, got 0x%08lX,%p\n", sc, lpError); + + /* Get prop tags - succeeds returning 0 items */ + lpTags = NULL; + sc = IPropData_GetPropList(lpIProp, 0, &lpTags); + ok(sc == S_OK && lpTags && lpTags->cValues == 0, + "GetPropList(empty): Expected S_OK, non-null, 0, got 0x%08lX,%p,%ld\n", + sc, lpTags, lpTags ? lpTags->cValues : 0); + if (lpTags) + MAPIFreeBuffer(lpTags); + + /* Get props - succeeds returning 0 items */ + lpProps = NULL; + count = 0; + tags.cValues = 1; + tags.aulPropTag[0] = PR_IMPORTANCE; + sc = IPropData_GetProps(lpIProp, (LPSPropTagArray)&tags, 0, &count, &lpProps); + ok(sc == MAPI_W_ERRORS_RETURNED && lpProps && count == 1, + "GetProps(empty): Expected ERRORS_RETURNED, non-null, 1, got 0x%08lX,%p,%ld\n", + sc, lpProps, count); + if (lpProps && count > 0) + { + ok(lpProps[0].ulPropTag == CHANGE_PROP_TYPE(PR_IMPORTANCE,PT_ERROR), + "GetProps(empty): Expected %x, got %lx\n", + CHANGE_PROP_TYPE(PR_IMPORTANCE,PT_ERROR), lpProps[0].ulPropTag); + + MAPIFreeBuffer(lpProps); + } + + /* Add (NULL) - Can't add NULL's */ + lpProbs = NULL; + pvs[0].ulPropTag = PROP_TAG(PT_NULL,0x01); + sc = IPropData_SetProps(lpIProp, 1, pvs, &lpProbs); + ok(sc == MAPI_E_INVALID_PARAMETER && !lpProbs, + "SetProps(): Expected INVALID_PARAMETER, null, got 0x%08lX,%p\n", + sc, lpProbs); + + /* Add (OBJECT) - Can't add OBJECTS's */ + lpProbs = NULL; + pvs[0].ulPropTag = PROP_TAG(PT_OBJECT,0x01); + sc = IPropData_SetProps(lpIProp, 1, pvs, &lpProbs); + ok(sc == MAPI_E_INVALID_PARAMETER && !lpProbs, + "SetProps(OBJECT): Expected INVALID_PARAMETER, null, got 0x%08lX,%p\n", + sc, lpProbs); + + /* Add - Adds value */ + lpProbs = NULL; + pvs[0].ulPropTag = PR_IMPORTANCE; + sc = IPropData_SetProps(lpIProp, 1, pvs, &lpProbs); + ok(sc == S_OK && !lpProbs, + "SetProps(ERROR): Expected S_OK, null, got 0x%08lX,%p\n", sc, lpProbs); + + /* Get prop list - returns 1 item */ + lpTags = NULL; + IPropData_GetPropList(lpIProp, 0, &lpTags); + ok(sc == S_OK && lpTags && lpTags->cValues == 1, + "GetPropList: Expected S_OK, non-null, 1, got 0x%08lX,%p,%ld\n", + sc, lpTags, lpTags ? lpTags->cValues : 0); + if (lpTags && lpTags->cValues > 0) + { + ok(lpTags->aulPropTag[0] == PR_IMPORTANCE, + "GetPropList: Expected %x, got %lx\n", + PR_IMPORTANCE, lpTags->aulPropTag[0]); + MAPIFreeBuffer(lpTags); + } + + /* Set access to read and write */ + sc = IPropData_HrSetObjAccess(lpIProp, IPROP_READWRITE); + ok(sc == S_OK, "SetObjAcess(WRITE): Expected S_OK got 0x%08lX\n", sc); + + tags.cValues = 1; + tags.aulPropTag[0] = PR_IMPORTANCE; + + /* Set item access (bad access) - Fails */ + access[0] = 0; + sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access); + ok(sc == MAPI_E_INVALID_PARAMETER, + "SetPropAcess(0): Expected INVALID_PARAMETER got 0x%08lX\n",sc); + access[0] = IPROP_READWRITE; + sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access); + ok(sc == MAPI_E_INVALID_PARAMETER, + "SetPropAcess(RW): Expected INVALID_PARAMETER got 0x%08lX\n",sc); + access[0] = IPROP_CLEAN; + sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access); + ok(sc == MAPI_E_INVALID_PARAMETER, + "SetPropAcess(C): Expected INVALID_PARAMETER got 0x%08lX\n",sc); + + /* Set item access to read/write/clean */ + tags.cValues = 1; + tags.aulPropTag[0] = PR_IMPORTANCE; + access[0] = IPROP_READWRITE|IPROP_CLEAN; + sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access); + ok(sc == S_OK, "SetPropAcess(RW/C): Expected S_OK got 0x%08lX\n",sc); + + /* Set object access to read only */ + sc = IPropData_HrSetObjAccess(lpIProp, IPROP_READONLY); + ok(sc == S_OK, "SetObjAcess(READ): Expected S_OK got 0x%08lX\n", sc); + + /* Set item access to read/write/dirty - doesn't care about RO object */ + access[0] = IPROP_READONLY|IPROP_DIRTY; + sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access); + ok(sc == S_OK, "SetPropAcess(WRITE): Expected S_OK got 0x%08lX\n", sc); + + /* Delete any item when set to read only - Error */ + lpProbs = NULL; + tags.aulPropTag[0] = PR_RESPONSE_REQUESTED; + sc = IPropData_DeleteProps(lpIProp, (LPSPropTagArray)&tags, &lpProbs); + ok(sc == E_ACCESSDENIED && !lpProbs, + "DeleteProps(non-existent): Expected E_ACCESSDENIED null got 0x%08lX %p\n", + sc, lpProbs); + + /* Set access to read and write */ + sc = IPropData_HrSetObjAccess(lpIProp, IPROP_READWRITE); + ok(sc == S_OK, "SetObjAcess(WRITE): Expected S_OK got 0x%08lX\n", sc); + + /* Delete non-existent item - No error */ + lpProbs = NULL; + tags.aulPropTag[0] = PR_RESPONSE_REQUESTED; + sc = IPropData_DeleteProps(lpIProp, (LPSPropTagArray)&tags, &lpProbs); + ok(sc == S_OK && !lpProbs, + "DeleteProps(non-existent): Expected S_OK null got 0x%08lX %p\n", + sc, lpProbs); + + /* Delete existing item (r/o) - No error, but lpProbs populated */ + lpProbs = NULL; + tags.aulPropTag[0] = PR_IMPORTANCE; + sc = IPropData_DeleteProps(lpIProp, (LPSPropTagArray)&tags, &lpProbs); + ok(sc == S_OK && lpProbs, + "DeleteProps(RO): Expected S_OK non-null got 0x%08lX %p\n", sc, lpProbs); + + if (lpProbs && lpProbs->cProblem > 0) + { + ok(lpProbs->cProblem == 1 && + lpProbs->aProblem[0].ulIndex == 0 && + lpProbs->aProblem[0].ulPropTag == PR_IMPORTANCE && + lpProbs->aProblem[0].scode == E_ACCESSDENIED, + "DeleteProps(RO): Expected (1,0,%x,%lx) got (%ld,%lx,%lx)\n", + PR_IMPORTANCE, E_ACCESSDENIED, + lpProbs->aProblem[0].ulIndex, lpProbs->aProblem[0].ulPropTag, + lpProbs->aProblem[0].scode); + MAPIFreeBuffer(lpProbs); + } + + lpProbs = NULL; + tags.cValues = 1; + tags.aulPropTag[0] = PR_RESPONSE_REQUESTED; + IPropData_HrAddObjProps(lpIProp, (LPSPropTagArray)&tags, &lpProbs); + ok(sc == S_OK && !lpProbs, + "AddObjProps(RO): Expected S_OK null got 0x%08lX %p\n", sc, lpProbs); + + /* Get prop list - returns 1 item */ + lpTags = NULL; + IPropData_GetPropList(lpIProp, 0, &lpTags); + ok(sc == S_OK && lpTags && lpTags->cValues == 1, + "GetPropList: Expected S_OK, non-null, 1, got 0x%08lX,%p,%ld\n", + sc, lpTags, lpTags ? lpTags->cValues : 0); + if (lpTags && lpTags->cValues > 0) + { + ok(lpTags->aulPropTag[0] == PR_IMPORTANCE, + "GetPropList: Expected %x, got %lx\n", + PR_IMPORTANCE, lpTags->aulPropTag[0]); + MAPIFreeBuffer(lpTags); + } + + /* Set item to r/w again */ + access[0] = IPROP_READWRITE|IPROP_DIRTY; + sc = IPropData_HrSetPropAccess(lpIProp, (LPSPropTagArray)&tags, access); + ok(sc == S_OK, "SetPropAcess(WRITE): Expected S_OK got 0x%08lX\n", sc); + + /* Delete existing item (r/w) - No error, no problems */ + lpProbs = NULL; + sc = IPropData_DeleteProps(lpIProp, (LPSPropTagArray)&tags, &lpProbs); + ok(sc == S_OK && !lpProbs, + "DeleteProps(RO): Expected S_OK null got 0x%08lX %p\n", sc, lpProbs); + + /* Free the list */ + IPropData_Release(lpIProp); +} + START_TEST(prop) -{ +{ hMapi32 = LoadLibraryA("mapi32.dll"); - + pScInitMapiUtil = (void*)GetProcAddress(hMapi32, "ScInitMapiUtil@4"); if (!pScInitMapiUtil) return; @@ -1140,4 +1353,6 @@ test_FBadRow(); test_FBadProp(); test_FBadColumnSet(); + + test_IProp(); } diff -urN wine-20041201/dlls/mapi32/util.c wine-20050111/dlls/mapi32/util.c --- wine-20041201/dlls/mapi32/util.c 2004-11-30 18:38:52.000000000 +0100 +++ wine-20050111/dlls/mapi32/util.c 2005-01-03 18:05:02.000000000 +0100 @@ -718,7 +718,7 @@ * Read an integer from a hexadecimal string. * * PARAMS - * lpSzHex [I] String containing the hexidecimal number to read + * lpSzHex [I] String containing the hexadecimal number to read * * RETURNS * Success: The number represented by lpszHex. @@ -747,6 +747,34 @@ return ulRet; } +/************************************************************************ + * FBadEntryList@4 (MAPI32.190) + * + * Determine is an entry list is invalid. + * + * PARAMS + * lpEntryList [I] List to check + * + * RETURNS + * TRUE, if lpEntryList is invalid, + * FALSE, otherwise. + */ +BOOL WINAPI FBadEntryList(LPENTRYLIST lpEntryList) +{ + ULONG i; + + if (IsBadReadPtr(lpEntryList, sizeof(*lpEntryList)) || + IsBadReadPtr(lpEntryList->lpbin, + lpEntryList->cValues * sizeof(*lpEntryList->lpbin))) + return TRUE; + + for (i = 0; i < lpEntryList->cValues; i++) + if(IsBadReadPtr(lpEntryList->lpbin[i].lpb, lpEntryList->lpbin[i].cb)) + return TRUE; + + return FALSE; +} + /************************************************************************* * CbOfEncoded@4 (MAPI32.207) * diff -urN wine-20041201/dlls/mpr/mpr.rc wine-20050111/dlls/mpr/mpr.rc --- wine-20041201/dlls/mpr/mpr.rc 2004-10-27 02:47:53.000000000 +0200 +++ wine-20050111/dlls/mpr/mpr.rc 2005-01-10 15:27:29.000000000 +0100 @@ -19,6 +19,7 @@ */ #include "windef.h" #include "winbase.h" +#include "winuser.h" #include "mprres.h" #include "version.rc" diff -urN wine-20041201/dlls/mpr/mpr_En.rc wine-20050111/dlls/mpr/mpr_En.rc --- wine-20041201/dlls/mpr/mpr_En.rc 2004-04-06 01:14:26.000000000 +0200 +++ wine-20050111/dlls/mpr/mpr_En.rc 2005-01-10 15:27:29.000000000 +0100 @@ -24,3 +24,23 @@ { IDS_ENTIRENETWORK "Entire Network" } + +IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154 +STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "Enter Network Password" +FONT 8, "Helv" +{ + LTEXT "Please enter your username and password:", IDC_EXPLAIN, 40, 6, 150, 15 + LTEXT "Proxy", -1, 40, 26, 50, 10 +/* LTEXT "Realm", -1, 40, 46, 50, 10 */ + LTEXT "User", -1, 40, 66, 50, 10 + LTEXT "Password", -1, 40, 86, 50, 10 + LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0 + LTEXT "" IDC_REALM, 80, 46, 150, 14, 0 + EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP + EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD + CHECKBOX "&Save this password (Insecure)", IDC_SAVEPASSWORD, + 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP + PUSHBUTTON "OK", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON + PUSHBUTTON "Cancel", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP +} diff -urN wine-20041201/dlls/mpr/mprres.h wine-20050111/dlls/mpr/mprres.h --- wine-20041201/dlls/mpr/mprres.h 2004-04-06 01:14:26.000000000 +0200 +++ wine-20050111/dlls/mpr/mprres.h 2005-01-10 15:27:29.000000000 +0100 @@ -20,4 +20,13 @@ #define IDS_ENTIRENETWORK 1 +#define IDD_PROXYDLG 0x400 + +#define IDC_PROXY 0x401 +#define IDC_REALM 0x402 +#define IDC_USERNAME 0x403 +#define IDC_PASSWORD 0x404 +#define IDC_SAVEPASSWORD 0x405 +#define IDC_EXPLAIN 0x406 + #endif /* ndef __WINE_MPRRES_H__ */ diff -urN wine-20041201/dlls/mpr/nps.c wine-20050111/dlls/mpr/nps.c --- wine-20041201/dlls/mpr/nps.c 2003-09-06 01:08:36.000000000 +0200 +++ wine-20050111/dlls/mpr/nps.c 2005-01-10 15:27:29.000000000 +0100 @@ -2,6 +2,7 @@ * MPR Network Provider Services functions * * Copyright 1999 Ulrich Weigand + * Copyright 2004 Mike McCormack for CodeWeavers Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,24 +19,109 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ +#include "config.h" + #include #include "windef.h" #include "winbase.h" +#include "winuser.h" #include "winnetwk.h" #include "netspi.h" #include "wine/debug.h" +#include "winerror.h" WINE_DEFAULT_DEBUG_CHANNEL(mpr); +#include "wine/unicode.h" + +#include "mprres.h" + +/*********************************************************************** + * NPS_ProxyPasswordDialog + */ +static INT_PTR WINAPI NPS_ProxyPasswordDialog( + HWND hdlg, UINT uMsg, WPARAM wParam, LPARAM lParam ) +{ + HWND hitem; + LPAUTHDLGSTRUCTA lpAuthDlgStruct; + + if( uMsg == WM_INITDIALOG ) + { + TRACE("WM_INITDIALOG (%08lx)\n", lParam); + + /* save the parameter list */ + lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) lParam; + SetWindowLongPtrW( hdlg, GWLP_USERDATA, lParam ); + + if( lpAuthDlgStruct->lpExplainText ) + { + hitem = GetDlgItem( hdlg, IDC_EXPLAIN ); + SetWindowTextA( hitem, lpAuthDlgStruct->lpExplainText ); + } + + /* extract the Realm from the proxy response and show it */ + if( lpAuthDlgStruct->lpResource ) + { + hitem = GetDlgItem( hdlg, IDC_REALM ); + SetWindowTextA( hitem, lpAuthDlgStruct->lpResource ); + } + + return TRUE; + } + + lpAuthDlgStruct = (LPAUTHDLGSTRUCTA) GetWindowLongPtrW( hdlg, GWLP_USERDATA ); + + switch( uMsg ) + { + case WM_COMMAND: + if( wParam == IDOK ) + { + WCHAR username[0x20], password[0x20]; + + username[0] = 0; + hitem = GetDlgItem( hdlg, IDC_USERNAME ); + if( hitem ) + GetWindowTextA( hitem, lpAuthDlgStruct->lpUsername, lpAuthDlgStruct->cbUsername ); + + password[0] = 0; + hitem = GetDlgItem( hdlg, IDC_PASSWORD ); + if( hitem ) + GetWindowTextA( hitem, lpAuthDlgStruct->lpPassword, lpAuthDlgStruct->cbPassword ); + + EndDialog( hdlg, WN_SUCCESS ); + return TRUE; + } + if( wParam == IDCANCEL ) + { + EndDialog( hdlg, WN_CANCEL ); + return TRUE; + } + break; + } + return FALSE; +} /***************************************************************** * NPSAuthenticationDialogA [MPR.@] */ DWORD WINAPI NPSAuthenticationDialogA( LPAUTHDLGSTRUCTA lpAuthDlgStruct ) { - FIXME( "(%p): stub\n", lpAuthDlgStruct ); - return WN_NOT_SUPPORTED; + HMODULE hwininet = GetModuleHandleA( "mpr.dll" ); + + TRACE("%p\n", lpAuthDlgStruct); + + if( !lpAuthDlgStruct ) + return WN_BAD_POINTER; + if( lpAuthDlgStruct->cbStructure < sizeof *lpAuthDlgStruct ) + return WN_BAD_POINTER; + + TRACE("%s %s %s\n",lpAuthDlgStruct->lpResource, + lpAuthDlgStruct->lpOUTitle, lpAuthDlgStruct->lpExplainText); + + return DialogBoxParamW( hwininet, MAKEINTRESOURCEW( IDD_PROXYDLG ), + lpAuthDlgStruct->hwndOwner, NPS_ProxyPasswordDialog, + (LPARAM) lpAuthDlgStruct ); } /***************************************************************** diff -urN wine-20041201/dlls/mpr/wnet.c wine-20050111/dlls/mpr/wnet.c --- wine-20041201/dlls/mpr/wnet.c 2004-06-30 20:17:07.000000000 +0200 +++ wine-20050111/dlls/mpr/wnet.c 2004-12-23 21:20:49.000000000 +0100 @@ -197,8 +197,7 @@ { WARN("Provider %s didn't export NPGetCaps\n", debugstr_w(provider)); - if (name) - HeapFree(GetProcessHeap(), 0, name); + HeapFree(GetProcessHeap(), 0, name); FreeLibrary(hLib); } } @@ -311,8 +310,7 @@ HeapFree(GetProcessHeap(), 0, providerTable->table[i].name); FreeModule(providerTable->table[i].hLib); } - if (providerTable->entireNetwork) - HeapFree(GetProcessHeap(), 0, providerTable->entireNetwork); + HeapFree(GetProcessHeap(), 0, providerTable->entireNetwork); HeapFree(GetProcessHeap(), 0, providerTable); providerTable = NULL; } @@ -371,8 +369,7 @@ { if (lpNet) { - if (lpNet->lpRemoteName) - HeapFree(GetProcessHeap(), 0, lpNet->lpRemoteName); + HeapFree(GetProcessHeap(), 0, lpNet->lpRemoteName); HeapFree(GetProcessHeap(), 0, lpNet); } } diff -urN wine-20041201/dlls/msacm/imaadp32/imaadp32.c wine-20050111/dlls/msacm/imaadp32/imaadp32.c --- wine-20041201/dlls/msacm/imaadp32/imaadp32.c 2004-04-20 02:34:52.000000000 +0200 +++ wine-20050111/dlls/msacm/imaadp32/imaadp32.c 2005-01-09 17:52:51.000000000 +0100 @@ -934,5 +934,4 @@ default: return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); } - return 0; } diff -urN wine-20041201/dlls/msacm/internal.c wine-20050111/dlls/msacm/internal.c --- wine-20041201/dlls/msacm/internal.c 2004-09-08 03:37:24.000000000 +0200 +++ wine-20050111/dlls/msacm/internal.c 2004-12-23 21:20:49.000000000 +0100 @@ -341,10 +341,8 @@ while (p->pACMDriverList) acmDriverClose((HACMDRIVER) p->pACMDriverList, 0); - if (p->pszDriverAlias) - HeapFree(MSACM_hHeap, 0, p->pszDriverAlias); - if (p->pszFileName) - HeapFree(MSACM_hHeap, 0, p->pszFileName); + HeapFree(MSACM_hHeap, 0, p->pszDriverAlias); + HeapFree(MSACM_hHeap, 0, p->pszFileName); HeapFree(MSACM_hHeap, 0, p->aFormatTag); if (p == MSACM_pFirstACMDriverID) diff -urN wine-20041201/dlls/msacm/msadp32/msadp32.c wine-20050111/dlls/msacm/msadp32/msadp32.c --- wine-20041201/dlls/msacm/msadp32/msadp32.c 2004-04-20 02:34:52.000000000 +0200 +++ wine-20050111/dlls/msacm/msadp32/msadp32.c 2005-01-09 17:52:51.000000000 +0100 @@ -777,5 +777,4 @@ default: return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); } - return 0; } diff -urN wine-20041201/dlls/msacm/msg711/msg711.c wine-20050111/dlls/msacm/msg711/msg711.c --- wine-20041201/dlls/msacm/msg711/msg711.c 2004-04-20 02:34:52.000000000 +0200 +++ wine-20050111/dlls/msacm/msg711/msg711.c 2005-01-09 17:52:51.000000000 +0100 @@ -928,7 +928,7 @@ aad->convert = cvtXXulaw16K; } else if (adsi->pwfxSrc->wFormatTag == WAVE_FORMAT_PCM && - adsi->pwfxDst->wFormatTag == WAVE_FORMAT_ALAW) + adsi->pwfxDst->wFormatTag == WAVE_FORMAT_MULAW) { if (adsi->pwfxSrc->nSamplesPerSec != adsi->pwfxDst->nSamplesPerSec || adsi->pwfxSrc->nChannels != adsi->pwfxDst->nChannels || @@ -1161,5 +1161,4 @@ default: return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); } - return 0; } diff -urN wine-20041201/dlls/msacm/pcmconverter.c wine-20050111/dlls/msacm/pcmconverter.c --- wine-20041201/dlls/msacm/pcmconverter.c 2004-09-08 03:37:24.000000000 +0200 +++ wine-20050111/dlls/msacm/pcmconverter.c 2005-01-09 17:52:51.000000000 +0100 @@ -4,6 +4,7 @@ * MSACM32 library * * Copyright 2000 Eric Pouech + * Copyright 2004 Robert Reif * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -20,10 +21,6 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * FIXME / TODO list - * + most of the computation should be done in fixed point arithmetic - * instead of floating point (16 bits for integral part, and 16 bits - * for fractional part for example) - * + implement PCM_FormatSuggest function * + get rid of hack for PCM_DriverProc (msacm32.dll shouldn't export * a DriverProc, but this would require implementing a generic * embedded driver handling scheme in msacm32.dll which isn't done yet @@ -75,7 +72,7 @@ } #define NUM_PCM_FORMATS (sizeof(PCM_Formats) / sizeof(PCM_Formats[0])) -#define NUM_OF(a,b) (((a)+(b)-1)/(b)) +#define NUM_OF(a,b) ((a)/(b)) /* flags for fdwDriver */ #define PCM_RESAMPLE 1 @@ -85,19 +82,9 @@ /* conversion routine, depending if rate conversion is required */ union { void (*cvtKeepRate)(const unsigned char*, int, unsigned char*); - void (*cvtChangeRate)(struct tagAcmPcmData*, const unsigned char*, - LPDWORD, unsigned char*, LPDWORD); + void (*cvtChangeRate)(DWORD, const unsigned char*, LPDWORD, + DWORD, unsigned char*, LPDWORD); } cvt; - /* the following fields are used only with rate conversion) */ - DWORD srcPos; /* position in source stream */ - double dstPos; /* position in destination stream */ - double dstIncr; /* value to increment dst stream when src stream - is incremented by 1 */ - /* last source stream value read */ - union { - unsigned char b; /* 8 bit value */ - short s; /* 16 bit value */ - } last[2]; /* two channels max (stereo) */ } AcmPcmData; /* table to list all supported formats... those are the basic ones. this @@ -142,11 +129,7 @@ * shall work in all cases) * * mono => stereo: copy the same sample on Left & Right channels - * stereo =) mono: use the average value of samples from Left & Right channels - * resampling; we lookup for each destination sample the two source adjacent - * samples were src <= dst < src+1 (dst is increased by a fractional - * value which is equivalent to the increment by one on src); then we - * use a linear interpolation between src and src+1 + * stereo => mono: use the sum of Left & Right channels */ /*********************************************************************** @@ -156,7 +139,7 @@ */ static inline short C816(unsigned char b) { - return (short)((b+(b << 8))-32768); + return (b - 128) << 8; } /*********************************************************************** @@ -194,22 +177,40 @@ * M16 * * Convert the (l,r) 16 bit stereo sample into a 16 bit mono - * (takes the mid-point of the two values) + * (takes the sum of the two values) */ static inline short M16(short l, short r) { - return (l + r) / 2; + int sum = l + r; + + /* clip sum to saturation */ + if (sum > 32767) + sum = 32767; + else if (sum < -32768) + sum = -32768; + + return sum; } /*********************************************************************** * M8 * * Convert the (l,r) 8 bit stereo sample into a 8 bit mono - * (takes the mid-point of the two values) + * (takes the sum of the two values) */ static inline unsigned char M8(unsigned char a, unsigned char b) { - return (unsigned char)((a + b) / 2); + int l = a - 128; + int r = b - 128; + int sum = (l + r) + 128; + + /* clip sum to saturation */ + if (sum > 0xff) + sum = 0xff; + else if (sum < 0) + sum = 0; + + return sum; } /* the conversion routines without rate conversion are labelled cvtK @@ -275,7 +276,7 @@ TRACE("(%p, %d, %p)\n", src, ns, dst); while (ns--) { - v = C168(R16(src)); src += 2; + v = C168(R16(src)); src += 2; *dst++ = v; *dst++ = v; } @@ -380,40 +381,6 @@ cvtSS1616K, cvtSM1616K, cvtMS1616K, cvtMM1616K, }; -/*********************************************************************** - * I - * - * Interpolate the value at r (r in ]0, 1]) between the two points v1 and v2 - * Linear interpolation is used - */ -static inline double I(double v1, double v2, double r) -{ - if (0.0 >= r || r > 1.0) FIXME("r!! %f\n", r); - return (1.0 - r) * v1 + r * v2; -} - -static void cvtSS88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->last[1].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - *dst++ = I(apd->last[0].b, src[0], r); - *dst++ = I(apd->last[1].b, src[1], r); - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - /* the conversion routines with rate conversion are labelled cvtC * where : * is the (M)ono/(S)tereo configuration of input channel @@ -422,393 +389,320 @@ * is the number of bits of output channel (8 or 16) * */ -static void cvtSM88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtSS88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->last[1].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - *dst++ = I(M8(apd->last[0].b, apd->last[1].b), M8(src[0], src[1]), r); - else - *dst++ = M8(apd->last[0].b, apd->last[1].b); - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtMS88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - dst[0] = dst[1] = I(apd->last[0].b, src[0], r); - else - dst[0] = dst[1] = apd->last[0].b; - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtMM88C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - *dst++ = I(apd->last[0].b, src[0], r); - else - *dst++ = apd->last[0].b; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtSS816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->last[1].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(C816(apd->last[0].b), C816(src[0]), r)); - else - W16(dst, C816(apd->last[0].b)); - dst += 2; - if (*nsrc) /* don't go off end of data */ - W16(dst, I(C816(apd->last[1].b), C816(src[1]), r)); - else - W16(dst, C816(apd->last[1].b)); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtSM816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->last[1].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(M16(C816(apd->last[0].b), C816(apd->last[1].b)), - M16(C816(src[0]), C816(src[1])), r)); - else - W16(dst, M16(C816(apd->last[0].b), C816(apd->last[1].b))); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; + while ((*ndst)--) { + *dst++ = *src; + *dst++ = *src; + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } } } -static void cvtMS816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtSM88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - short v; - TRACE("(%p, %p, %p->(%ld), %p, %p->(%ld))\n", apd, src, nsrc, *nsrc, dst, ndst, *ndst); + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - v = I(C816(apd->last[0].b), C816(src[0]), r); - else - v = C816(apd->last[0].b); - W16(dst, v); dst += 2; - W16(dst, v); dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; + while ((*ndst)--) { + *dst++ = M8(src[0], src[1]); + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } } } -static void cvtMM816C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtMS88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].b = *src++; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(C816(apd->last[0].b), C816(src[0]), r)); - else - W16(dst, C816(apd->last[0].b)); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtSS168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->last[1].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) { /* don't go off end of data */ - *dst++ = C168(I(apd->last[0].s, R16(src) , r)); - *dst++ = C168(I(apd->last[1].s, R16(src+2), r)); - } else { - *dst++ = C168(apd->last[0].s); - *dst++ = C168(apd->last[1].s); - } - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtSM168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->last[1].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - *dst++ = C168(I(M16(apd->last[0].s, apd->last[1].s), - M16(R16(src), R16(src + 2)), r)); - else - *dst++ = C168(M16(apd->last[0].s, apd->last[1].s)); - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - - -static void cvtMS168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - dst[0] = dst[1] = C168(I(apd->last[0].s, R16(src), r)); - else - dst[0] = dst[1] = C168(apd->last[0].s); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - - -static void cvtMM168C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - *dst++ = C168(I(apd->last[0].s, R16(src), r)); - else - *dst++ = C168(apd->last[0].s); - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtSS1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->last[1].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(apd->last[0].s, R16(src), r)); - else - W16(dst, apd->last[0].s); - dst += 2; - if (*nsrc) /* don't go off end of data */ - W16(dst, I(apd->last[1].s, R16(src+2), r)); - else - W16(dst, apd->last[1].s); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; - } -} - -static void cvtSM1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) -{ - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->last[1].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(M16(apd->last[0].s, apd->last[1].s), - M16(R16(src), R16(src+2)), r)); - else - W16(dst, M16(apd->last[0].s, apd->last[1].s)); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + *dst++ = *src; + *dst++ = *src; + error = error + srcRate; + while (error > dstRate) { + src++; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } } } -static void cvtMS1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtMM88C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - short v; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - v = I(apd->last[0].s, R16(src), r); - else - v = apd->last[0].s; - W16(dst, v); dst += 2; - W16(dst, v); dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; + while ((*ndst)--) { + *dst++ = *src; + error = error + srcRate; + while (error > dstRate) { + src++; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } + } +} + +static void cvtSS816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + W16(dst, C816(src[0])); dst += 2; + W16(dst, C816(src[1])); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } + } +} + +static void cvtSM816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + W16(dst, M16(C816(src[0]), C816(src[1]))); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } } } -static void cvtMM1616C(AcmPcmData* apd, const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) +static void cvtMS816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) { - double r; - TRACE("(%p, %p, %p, %p, %p)\n", apd, src, nsrc, dst, ndst); - - while (*nsrc != 0 && *ndst != 0) { - while ((r = (double)apd->srcPos - apd->dstPos) <= 0) { - if (*nsrc == 0) return; - apd->last[0].s = R16(src); src += 2; - apd->srcPos++; - (*nsrc)--; - } - /* now do the interpolation */ - if (*nsrc) /* don't go off end of data */ - W16(dst, I(apd->last[0].s, R16(src), r)); - else - W16(dst, apd->last[0].s); - dst += 2; - apd->dstPos += apd->dstIncr; - (*ndst)--; + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + W16(dst, C816(*src)); dst += 2; + W16(dst, C816(*src)); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src++; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } } } -static void (*PCM_ConvertChangeRate[16])(AcmPcmData* apd, - const unsigned char* src, LPDWORD nsrc, - unsigned char* dst, LPDWORD ndst) = { +static void cvtMM816C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + W16(dst, C816(*src)); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src++; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } + } +} + +static void cvtSS168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + *dst++ = C168(R16(src)); + *dst++ = C168(R16(src + 2)); + error = error + srcRate; + while (error > dstRate) { + src += 4; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } + } +} + +static void cvtSM168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + *dst++ = C168(M16(R16(src), R16(src + 2))); + error = error + srcRate; + while (error > dstRate) { + src += 4; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } + } +} + +static void cvtMS168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + *dst++ = C168(R16(src)); + *dst++ = C168(R16(src)); + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc==0) + return; + error = error - dstRate; + } + } +} + +static void cvtMM168C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + *dst++ = C168(R16(src)); + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } + } +} + +static void cvtSS1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + W16(dst, R16(src)); dst += 2; + W16(dst, R16(src)); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 4; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } + } +} + +static void cvtSM1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + W16(dst, M16(R16(src), R16(src + 2))); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 4; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } + } +} + +static void cvtMS1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while((*ndst)--) { + W16(dst, R16(src)); dst += 2; + W16(dst, R16(src)); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } + } +} + +static void cvtMM1616C(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) +{ + DWORD error = dstRate / 2; + TRACE("(%ld, %p, %p, %ld, %p, %p)\n", srcRate, src, nsrc, dstRate, dst, ndst); + + while ((*ndst)--) { + W16(dst, R16(src)); dst += 2; + error = error + srcRate; + while (error > dstRate) { + src += 2; + (*nsrc)--; + if (*nsrc == 0) + return; + error = error - dstRate; + } + } +} + +static void (*PCM_ConvertChangeRate[16])(DWORD srcRate, const unsigned char* src, LPDWORD nsrc, + DWORD dstRate, unsigned char* dst, LPDWORD ndst) = { cvtSS88C, cvtSM88C, cvtMS88C, cvtMM88C, cvtSS816C, cvtSM816C, cvtMS816C, cvtMM816C, cvtSS168C, cvtSM168C, cvtMS168C, cvtMM168C, @@ -900,8 +794,8 @@ switch (dwQuery) { case ACM_FORMATDETAILSF_FORMAT: if (PCM_GetFormatIndex(afd->pwfx) == 0xFFFFFFFF) { - return ACMERR_NOTPOSSIBLE; WARN("not possible\n"); + return ACMERR_NOTPOSSIBLE; } break; case ACM_FORMATDETAILSF_INDEX: @@ -945,7 +839,7 @@ PCM_GetFormatIndex(adfs->pwfxSrc) == 0xFFFFFFFF) { WARN("not possible\n"); return ACMERR_NOTPOSSIBLE; - } + } /* is no suggestion for destination, then copy source value */ if (!(adfs->fdwSuggest & ACM_FORMATSUGGESTF_NCHANNELS)) { @@ -978,26 +872,6 @@ } /*********************************************************************** - * PCM_Reset - * - */ -static void PCM_Reset(AcmPcmData* apd, int srcNumBits) -{ - TRACE("(%p, %d)\n", apd, srcNumBits); - - apd->srcPos = 0; - apd->dstPos = 0; - /* initialize with neutral value */ - if (srcNumBits == 16) { - apd->last[0].s = 0; - apd->last[1].s = 0; - } else { - apd->last[0].b = (BYTE)0x80; - apd->last[1].b = (BYTE)0x80; - } -} - -/*********************************************************************** * PCM_StreamOpen * */ @@ -1010,12 +884,6 @@ assert(!(adsi->fdwOpen & ACM_STREAMOPENF_ASYNC)); - if (PCM_GetFormatIndex(adsi->pwfxSrc) == 0xFFFFFFFF || - PCM_GetFormatIndex(adsi->pwfxDst) == 0xFFFFFFFF) { - WARN("not possible\n"); - return ACMERR_NOTPOSSIBLE; - } - apd = HeapAlloc(GetProcessHeap(), 0, sizeof(AcmPcmData)); if (apd == 0) { WARN("no memory\n"); @@ -1034,9 +902,6 @@ apd->cvt.cvtKeepRate = PCM_ConvertKeepRate[idx]; } else { adsi->fdwDriver |= PCM_RESAMPLE; - apd->dstIncr = (double)(adsi->pwfxSrc->nSamplesPerSec) / - (double)(adsi->pwfxDst->nSamplesPerSec); - PCM_Reset(apd, adsi->pwfxSrc->wBitsPerSample); apd->cvt.cvtChangeRate = PCM_ConvertChangeRate[idx]; } @@ -1131,15 +996,14 @@ */ if ((adsh->fdwConvert & ACM_STREAMCONVERTF_START) && (adsi->fdwDriver & PCM_RESAMPLE)) { - PCM_Reset(apd, adsi->pwfxSrc->wBitsPerSample); } /* do the job */ if (adsi->fdwDriver & PCM_RESAMPLE) { DWORD nsrc2 = nsrc; DWORD ndst2 = ndst; - - apd->cvt.cvtChangeRate(apd, adsh->pbSrc, &nsrc2, adsh->pbDst, &ndst2); + apd->cvt.cvtChangeRate((DWORD)adsi->pwfxSrc->nSamplesPerSec, adsh->pbSrc, &nsrc2, + (DWORD)adsi->pwfxDst->nSamplesPerSec, adsh->pbDst, &ndst2); nsrc -= nsrc2; ndst -= ndst2; } else { @@ -1220,5 +1084,4 @@ default: return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); } - return 0; } diff -urN wine-20041201/dlls/msacm/wineacm.h wine-20050111/dlls/msacm/wineacm.h --- wine-20041201/dlls/msacm/wineacm.h 2004-04-20 02:34:53.000000000 +0200 +++ wine-20050111/dlls/msacm/wineacm.h 2004-12-13 22:19:02.000000000 +0100 @@ -184,8 +184,7 @@ * Functions - Win16 */ -DWORD WINAPI acmGetVersion16( -); +DWORD WINAPI acmGetVersion16(void); MMRESULT16 WINAPI acmMetrics16( HACMOBJ16 hao, UINT16 uMetric, LPVOID pMetric ); diff -urN wine-20041201/dlls/msacm/winemp3/mpegl3.c wine-20050111/dlls/msacm/winemp3/mpegl3.c --- wine-20041201/dlls/msacm/winemp3/mpegl3.c 2004-04-20 02:34:52.000000000 +0200 +++ wine-20050111/dlls/msacm/winemp3/mpegl3.c 2005-01-09 17:52:51.000000000 +0100 @@ -606,5 +606,4 @@ default: return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2); } - return 0; } diff -urN wine-20041201/dlls/mscms/Makefile.in wine-20050111/dlls/mscms/Makefile.in --- wine-20041201/dlls/mscms/Makefile.in 2004-11-19 19:06:41.000000000 +0100 +++ wine-20050111/dlls/mscms/Makefile.in 2004-12-20 18:04:11.000000000 +0100 @@ -3,12 +3,14 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = mscms.dll -IMPORTS = kernel32 +IMPORTS = kernel32 ntdll C_SRCS = \ handle.c \ + icc.c \ mscms_main.c \ - profile.c + profile.c \ + stub.c RC_SRCS = version.rc diff -urN wine-20041201/dlls/mscms/icc.c wine-20050111/dlls/mscms/icc.c --- wine-20041201/dlls/mscms/icc.c 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050111/dlls/mscms/icc.c 2004-12-13 14:23:18.000000000 +0100 @@ -0,0 +1,104 @@ +/* + * MSCMS - Color Management System for Wine + * + * Copyright 2004 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/debug.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "winternl.h" +#include "icm.h" + +#define LCMS_API_FUNCTION(f) extern typeof(f) * p##f; +#include "lcms_api.h" +#undef LCMS_API_FUNCTION + +WINE_DEFAULT_DEBUG_CHANNEL(mscms); + +#ifdef HAVE_LCMS_H + +static inline void MSCMS_adjust_endianess32( ULONG *ptr ) +{ +#ifndef WORDS_BIGENDIAN + *ptr = RtlUlongByteSwap(*ptr); +#endif +} + +void MSCMS_get_profile_header( icProfile *iccprofile, PROFILEHEADER *header ) +{ + unsigned int i; + + memcpy( header, iccprofile, sizeof(PROFILEHEADER) ); + + /* ICC format is big-endian, swap bytes if necessary */ + for (i = 0; i < sizeof(PROFILEHEADER) / sizeof(ULONG); i++) + MSCMS_adjust_endianess32( (ULONG *)header + i ); +} + +void MSCMS_set_profile_header( icProfile *iccprofile, PROFILEHEADER *header ) +{ + unsigned int i; + icHeader *iccheader = (icHeader *)iccprofile; + + memcpy( iccheader, header, sizeof(icHeader) ); + + /* ICC format is big-endian, swap bytes if necessary */ + for (i = 0; i < sizeof(icHeader) / sizeof(ULONG); i++) + MSCMS_adjust_endianess32( (ULONG *)iccheader + i ); +} + +DWORD MSCMS_get_tag_count( icProfile *iccprofile ) +{ + ULONG count = iccprofile->count; + + MSCMS_adjust_endianess32( &count ); + return count; +} + +void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag ) +{ + icTag *tmp = (icTag *)((char *)&iccprofile->data + index * sizeof(icTag)); + + tag->sig = tmp->sig; + tag->offset = tmp->offset; + tag->size = tmp->size; + + MSCMS_adjust_endianess32( (ULONG *)&tag->sig ); + MSCMS_adjust_endianess32( (ULONG *)&tag->offset ); + MSCMS_adjust_endianess32( (ULONG *)&tag->size ); +} + +void MSCMS_get_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer ) +{ + memcpy( buffer, (char *)iccprofile + tag->offset + offset, tag->size - offset ); +} + +void MSCMS_set_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer ) +{ + memcpy( (char *)iccprofile + tag->offset + offset, buffer, tag->size - offset ); +} + +#endif /* HAVE_LCMS_H */ diff -urN wine-20041201/dlls/mscms/mscms.spec wine-20050111/dlls/mscms/mscms.spec --- wine-20041201/dlls/mscms/mscms.spec 2004-11-30 22:06:14.000000000 +0100 +++ wine-20050111/dlls/mscms/mscms.spec 2004-12-20 18:04:11.000000000 +0100 @@ -1,23 +1,23 @@ -@ stub AssociateColorProfileWithDeviceA -@ stub AssociateColorProfileWithDeviceW -@ stub CheckBitmapBits -@ stub CheckColors +@ stdcall AssociateColorProfileWithDeviceA(ptr ptr ptr) +@ stdcall AssociateColorProfileWithDeviceW(ptr ptr ptr) +@ stdcall CheckBitmapBits(ptr ptr long long long ptr ptr ptr) +@ stdcall CheckColors(ptr ptr long long ptr) @ stdcall CloseColorProfile(ptr) -@ stub ConvertColorNameToIndex -@ stub ConvertIndexToColorName -@ stub CreateColorTransformA -@ stub CreateColorTransformW -@ stub CreateDeviceLinkProfile -@ stub CreateMultiProfileTransform -@ stub CreateProfileFromLogColorSpaceA -@ stub CreateProfileFromLogColorSpaceW -@ stub DeleteColorTransform -@ stub DisassociateColorProfileFromDeviceA -@ stub DisassociateColorProfileFromDeviceW -@ stub EnumColorProfilesA -@ stub EnumColorProfilesW +@ stdcall ConvertColorNameToIndex(ptr ptr ptr long) +@ stdcall ConvertIndexToColorName(ptr ptr ptr long) +@ stdcall CreateColorTransformA(ptr ptr ptr long) +@ stdcall CreateColorTransformW(ptr ptr ptr long) +@ stdcall CreateDeviceLinkProfile(ptr long ptr long long ptr long) +@ stdcall CreateMultiProfileTransform(ptr long ptr long long long) +@ stdcall CreateProfileFromLogColorSpaceA(ptr ptr) +@ stdcall CreateProfileFromLogColorSpaceW(ptr ptr) +@ stdcall DeleteColorTransform(ptr) +@ stdcall DisassociateColorProfileFromDeviceA(ptr ptr ptr) +@ stdcall DisassociateColorProfileFromDeviceW(ptr ptr ptr) +@ stdcall EnumColorProfilesA(ptr ptr ptr ptr ptr) +@ stdcall EnumColorProfilesW(ptr ptr ptr ptr ptr) @ stub GenerateCopyFilePaths -@ stub GetCMMInfo +@ stdcall GetCMMInfo(ptr long) @ stdcall GetColorDirectoryA(ptr ptr long) @ stdcall GetColorDirectoryW(ptr ptr long) @ stdcall GetColorProfileElement(ptr long long ptr ptr ptr) @@ -25,10 +25,10 @@ @ stdcall GetColorProfileFromHandle(ptr ptr ptr) @ stdcall GetColorProfileHeader(ptr ptr) @ stdcall GetCountColorProfileElements(ptr long) -@ stub GetNamedProfileInfo -@ stub GetPS2ColorRenderingDictionary -@ stub GetPS2ColorRenderingIntent -@ stub GetPS2ColorSpaceArray +@ stdcall GetNamedProfileInfo(ptr ptr) +@ stdcall GetPS2ColorRenderingDictionary(ptr long ptr ptr ptr) +@ stdcall GetPS2ColorRenderingIntent(ptr long ptr ptr) +@ stdcall GetPS2ColorSpaceArray(ptr long long ptr ptr ptr) @ stdcall GetStandardColorSpaceProfileA(ptr long ptr ptr) @ stdcall GetStandardColorSpaceProfileW(ptr long ptr ptr) @ stdcall InstallColorProfileA(ptr ptr) @@ -43,19 +43,19 @@ @ stdcall IsColorProfileValid(ptr long) @ stdcall OpenColorProfileA(ptr long long long) @ stdcall OpenColorProfileW(ptr long long long) -@ stub RegisterCMMA -@ stub RegisterCMMW -@ stub SelectCMM -@ stub SetColorProfileElement -@ stub SetColorProfileElementReference -@ stub SetColorProfileElementSize +@ stdcall RegisterCMMA(ptr long ptr) +@ stdcall RegisterCMMW(ptr long ptr) +@ stdcall SelectCMM(long) +@ stdcall SetColorProfileElement(ptr long long ptr ptr) +@ stdcall SetColorProfileElementReference(ptr long long) +@ stdcall SetColorProfileElementSize(ptr long long) @ stdcall SetColorProfileHeader(ptr ptr) -@ stub SetStandardColorSpaceProfileA -@ stub SetStandardColorSpaceProfileW +@ stdcall SetStandardColorSpaceProfileA(ptr long ptr) +@ stdcall SetStandardColorSpaceProfileW(ptr long ptr) @ stub SpoolerCopyFileEvent -@ stub TranslateBitmapBits -@ stub TranslateColors +@ stdcall TranslateBitmapBits(ptr ptr long long long long ptr long long ptr long) +@ stdcall TranslateColors(ptr ptr long long ptr long) @ stdcall UninstallColorProfileA(ptr ptr long) @ stdcall UninstallColorProfileW(ptr ptr long) -@ stub UnregisterCMMA -@ stub UnregisterCMMW +@ stdcall UnregisterCMMA(ptr long) +@ stdcall UnregisterCMMW(ptr long) diff -urN wine-20041201/dlls/mscms/mscms_priv.h wine-20050111/dlls/mscms/mscms_priv.h --- wine-20041201/dlls/mscms/mscms_priv.h 2004-11-30 22:06:14.000000000 +0100 +++ wine-20050111/dlls/mscms/mscms_priv.h 2004-12-13 14:23:18.000000000 +0100 @@ -78,4 +78,11 @@ extern HPROFILE MSCMS_create_hprofile_handle( HANDLE file, icProfile *iccprofile, cmsHPROFILE cmsprofile ); extern void MSCMS_destroy_hprofile_handle( HPROFILE profile ); +extern DWORD MSCMS_get_tag_count( icProfile *iccprofile ); +extern void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag ); +extern void MSCMS_get_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer ); +extern void MSCMS_set_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer ); +extern void MSCMS_get_profile_header( icProfile *iccprofile, PROFILEHEADER *header ); +extern void MSCMS_set_profile_header( icProfile *iccprofile, PROFILEHEADER *header ); + #endif /* HAVE_LCMS_H */ diff -urN wine-20041201/dlls/mscms/profile.c wine-20050111/dlls/mscms/profile.c --- wine-20041201/dlls/mscms/profile.c 2004-11-30 22:06:14.000000000 +0100 +++ wine-20050111/dlls/mscms/profile.c 2004-12-20 18:04:11.000000000 +0100 @@ -44,143 +44,11 @@ lstrcpyW( name, &path[i] ); } -#ifdef HAVE_LCMS_H -static BOOL MSCMS_cpu_is_little_endian() -{ - long l = 1; - void *p = &l; - char b = *(char *)p; - - return b ? TRUE : FALSE; -} - -static void MSCMS_endian_swap16( BYTE *byte ) -{ - BYTE tmp; - - tmp = byte[0]; - byte[0] = byte[1]; - byte[1] = tmp; -} - -static void MSCMS_endian_swap32( BYTE *byte ) -{ - BYTE tmp1, tmp2; - - tmp1 = *byte++; - tmp2 = *byte++; - - *(byte - 1) = *byte; - *byte++ = tmp2; - *(byte - 3) = *byte; - *byte = tmp1; -} - -static void MSCMS_adjust_endianess32( BYTE *byte ) -{ - if (MSCMS_cpu_is_little_endian()) - MSCMS_endian_swap32( byte ); -} - -static void MSCMS_get_profile_header( icProfile *iccprofile, PROFILEHEADER *header ) -{ - memcpy( header, iccprofile, sizeof(PROFILEHEADER) ); - - /* ICC format is big-endian, swap bytes if necessary */ - - if (MSCMS_cpu_is_little_endian()) - { - MSCMS_endian_swap32( (BYTE *)&header->phSize ); - MSCMS_endian_swap32( (BYTE *)&header->phCMMType ); - MSCMS_endian_swap32( (BYTE *)&header->phVersion ); - MSCMS_endian_swap32( (BYTE *)&header->phClass ); - MSCMS_endian_swap32( (BYTE *)&header->phDataColorSpace ); - MSCMS_endian_swap32( (BYTE *)&header->phConnectionSpace ); - - MSCMS_endian_swap32( (BYTE *)&header->phDateTime[0] ); - MSCMS_endian_swap32( (BYTE *)&header->phDateTime[1] ); - MSCMS_endian_swap32( (BYTE *)&header->phDateTime[2] ); - - MSCMS_endian_swap32( (BYTE *)&header->phSignature ); - MSCMS_endian_swap32( (BYTE *)&header->phPlatform ); - MSCMS_endian_swap32( (BYTE *)&header->phProfileFlags ); - MSCMS_endian_swap32( (BYTE *)&header->phManufacturer ); - MSCMS_endian_swap32( (BYTE *)&header->phModel ); - - MSCMS_endian_swap32( (BYTE *)&header->phAttributes[0] ); - MSCMS_endian_swap32( (BYTE *)&header->phAttributes[1] ); - - MSCMS_endian_swap32( (BYTE *)&header->phRenderingIntent ); - MSCMS_endian_swap32( (BYTE *)&header->phIlluminant ); - MSCMS_endian_swap32( (BYTE *)&header->phCreator ); - } -} - -static void MSCMS_set_profile_header( icProfile *iccprofile, PROFILEHEADER *header ) -{ - icHeader *iccheader = (icHeader *)iccprofile; - - memcpy( iccprofile, header, sizeof(PROFILEHEADER) ); - - /* ICC format is big-endian, swap bytes if necessary */ - - if (MSCMS_cpu_is_little_endian()) - { - MSCMS_endian_swap32( (BYTE *)&iccheader->size ); - MSCMS_endian_swap32( (BYTE *)&iccheader->cmmId ); - MSCMS_endian_swap32( (BYTE *)&iccheader->version ); - MSCMS_endian_swap32( (BYTE *)&iccheader->deviceClass ); - MSCMS_endian_swap32( (BYTE *)&iccheader->colorSpace ); - MSCMS_endian_swap32( (BYTE *)&iccheader->pcs ); - - MSCMS_endian_swap16( (BYTE *)&iccheader->date.year ); - MSCMS_endian_swap16( (BYTE *)&iccheader->date.month ); - MSCMS_endian_swap16( (BYTE *)&iccheader->date.day ); - MSCMS_endian_swap16( (BYTE *)&iccheader->date.hours ); - MSCMS_endian_swap16( (BYTE *)&iccheader->date.minutes ); - MSCMS_endian_swap16( (BYTE *)&iccheader->date.seconds ); - - MSCMS_endian_swap32( (BYTE *)&iccheader->magic ); - MSCMS_endian_swap32( (BYTE *)&iccheader->platform ); - MSCMS_endian_swap32( (BYTE *)&iccheader->flags ); - MSCMS_endian_swap32( (BYTE *)&iccheader->manufacturer ); - MSCMS_endian_swap32( (BYTE *)&iccheader->model ); - - MSCMS_endian_swap32( (BYTE *)&iccheader->attributes[0] ); - MSCMS_endian_swap32( (BYTE *)&iccheader->attributes[1] ); - - MSCMS_endian_swap32( (BYTE *)&iccheader->renderingIntent ); - MSCMS_endian_swap32( (BYTE *)&iccheader->illuminant ); - MSCMS_endian_swap32( (BYTE *)&iccheader->creator ); - } -} - -static DWORD MSCMS_get_tag_count( icProfile *iccprofile ) -{ - DWORD count = iccprofile->count; - - MSCMS_adjust_endianess32( (BYTE *)&count ); - return count; -} - -static void MSCMS_get_tag_by_index( icProfile *iccprofile, DWORD index, icTag *tag ) -{ - icTag *tmp = (icTag *)&iccprofile->data + (index * sizeof(icTag)); - - tag->sig = tmp->sig; - tag->offset = tmp->offset; - tag->size = tmp->size; - - MSCMS_adjust_endianess32( (BYTE *)&tag->sig ); - MSCMS_adjust_endianess32( (BYTE *)&tag->offset ); - MSCMS_adjust_endianess32( (BYTE *)&tag->size ); -} - -static void MSCMS_get_tag_data( icProfile *iccprofile, icTag *tag, DWORD offset, void *buffer ) -{ - memcpy( buffer, (char *)iccprofile + tag->offset + offset, tag->size - offset ); -} -#endif /* HAVE_LCMS_H */ +static const WCHAR rgbprofile[] = +{ 'c',':','\\','w','i','n','d','o','w','s','\\', 's','y','s','t','e','m','3','2', + '\\','s','p','o','o','l','\\','d','r','i','v','e','r','s', + '\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ', + 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 }; WINE_DEFAULT_DEBUG_CHANNEL(mscms); @@ -194,11 +62,20 @@ INT len; LPWSTR bufferW; BOOL ret = FALSE; - DWORD sizeW = *size * sizeof(WCHAR); + DWORD sizeW; + + TRACE( "( %p, %p )\n", buffer, size ); + + if (machine || !size) return FALSE; - TRACE( "( %p, %ld )\n", buffer, *size ); + if (!buffer) + { + ret = GetColorDirectoryW( NULL, NULL, &sizeW ); + *size = sizeW / sizeof(WCHAR); + return FALSE; + } - if (machine || !buffer) return FALSE; + sizeW = *size * sizeof(WCHAR); bufferW = HeapAlloc( GetProcessHeap(), 0, sizeW ); @@ -226,7 +103,7 @@ * PARAMS * machine [I] Name of the machine for which to get the color directory. * Must be NULL, which indicates the local machine. - * buffer [I] Buffer to recieve the path name in. + * buffer [I] Buffer to receive the path name. * size [I/O] Size of the buffer in bytes. On return the variable holds * the number of bytes actually needed. */ @@ -239,15 +116,16 @@ DWORD len; - TRACE( "( %p, %ld )\n", buffer, *size ); + TRACE( "( %p, %p )\n", buffer, size ); - if (machine || !buffer) return FALSE; + if (machine || !size) return FALSE; len = lstrlenW( colordir ) * sizeof(WCHAR); - if (len <= *size) + if (len <= *size && buffer) { lstrcpyW( buffer, colordir ); + *size = len; return TRUE; } @@ -255,6 +133,25 @@ return FALSE; } +/****************************************************************************** + * GetColorProfileElement [MSCMS.@] + * + * Retrieve data for a specified tag type. + * + * PARAMS + * profile [I] Handle to a color profile. + * type [I] ICC tag type. + * offset [I] Offset in bytes to start copying from. + * size [I/O] Size of the buffer in bytes. On return the variable holds + * the number of bytes actually needed. + * buffer [O] Buffer to receive the tag data. + * ref [O] Pointer to a BOOL that specifies whether more than one tag + * references the data. + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ BOOL WINAPI GetColorProfileElement( HPROFILE profile, TAGTYPE type, DWORD offset, PDWORD size, PVOID buffer, PBOOL ref ) { @@ -266,7 +163,7 @@ TRACE( "( %p, 0x%08lx, %ld, %p, %p, %p )\n", profile, type, offset, size, buffer, ref ); - if (!iccprofile || !ref) return FALSE; + if (!iccprofile || !size || !ref) return FALSE; count = MSCMS_get_tag_count( iccprofile ); for (i = 0; i < count; i++) @@ -295,12 +192,12 @@ /****************************************************************************** * GetColorProfileElementTag [MSCMS.@] * - * Get a tag name from a color profile by index. + * Get the tag type from a color profile by index. * * PARAMS * profile [I] Handle to a color profile. * index [I] Index into the tag table of the color profile. - * tag [O] Pointer to a TAGTYPE variable. + * type [O] Pointer to a variable that holds the ICC tag type on return. * * RETURNS * Success: TRUE @@ -320,10 +217,10 @@ TRACE( "( %p, %ld, %p )\n", profile, index, type ); - if (!iccprofile) return FALSE; + if (!iccprofile || !type) return FALSE; count = MSCMS_get_tag_count( iccprofile ); - if (index > count) return FALSE; + if (index > count || index < 1) return FALSE; MSCMS_get_tag_by_index( iccprofile, index - 1, &tag ); *type = tag.sig; @@ -334,6 +231,24 @@ return ret; } +/****************************************************************************** + * GetColorProfileFromHandle [MSCMS.@] + * + * Retrieve an ICC color profile by handle. + * + * PARAMS + * profile [I] Handle to a color profile. + * buffer [O] Buffer to receive the ICC profile. + * size [I/O] Size of the buffer in bytes. On return the variable holds the + * number of bytes actually needed. + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + * NOTES + * The profile returned will be in big-endian format. + */ BOOL WINAPI GetColorProfileFromHandle( HPROFILE profile, PBYTE buffer, PDWORD size ) { BOOL ret = FALSE; @@ -343,8 +258,8 @@ TRACE( "( %p, %p, %p )\n", profile, buffer, size ); - if (!iccprofile) return FALSE; - MSCMS_get_profile_header( profile, &header ); + if (!iccprofile || !size) return FALSE; + MSCMS_get_profile_header( iccprofile, &header ); if (!buffer || header.phSize > *size) { @@ -352,14 +267,32 @@ return FALSE; } - /* FIXME: no endian conversion */ + /* No endian conversion needed */ memcpy( buffer, iccprofile, header.phSize ); + + *size = header.phSize; ret = TRUE; #endif /* HAVE_LCMS_H */ return ret; } +/****************************************************************************** + * GetColorProfileHeader [MSCMS.@] + * + * Retrieve a color profile header by handle. + * + * PARAMS + * profile [I] Handle to a color profile. + * header [O] Buffer to receive the ICC profile header. + * + * RETURNS + * Success: TRUE + * Failure: FALSE + * + * NOTES + * The profile header returned will be adjusted for endianess. + */ BOOL WINAPI GetColorProfileHeader( HPROFILE profile, PPROFILEHEADER header ) { BOOL ret = FALSE; @@ -399,7 +332,7 @@ TRACE( "( %p, %p )\n", profile, count ); - if (!count) return FALSE; + if (!iccprofile || !count) return FALSE; *count = MSCMS_get_tag_count( iccprofile ); ret = TRUE; @@ -412,11 +345,20 @@ INT len; LPWSTR profileW; BOOL ret = FALSE; - DWORD sizeW = *size * sizeof(WCHAR); + DWORD sizeW; - TRACE( "( 0x%08lx, %p, %ld )\n", id, profile, *size ); + TRACE( "( 0x%08lx, %p, %p )\n", id, profile, size ); - if (machine || !profile) return FALSE; + if (machine || !size) return FALSE; + + sizeW = *size * sizeof(WCHAR); + + if (!profile) + { + ret = GetStandardColorSpaceProfileW( NULL, id, NULL, &sizeW ); + *size = sizeW / sizeof(WCHAR); + return FALSE; + } profileW = HeapAlloc( GetProcessHeap(), 0, sizeW ); @@ -438,9 +380,31 @@ BOOL WINAPI GetStandardColorSpaceProfileW( PCWSTR machine, DWORD id, PWSTR profile, PDWORD size ) { - FIXME( "( %lx, %p, %ld ) stub\n", id, profile, *size ); + DWORD len; - return FALSE; + TRACE( "( 0x%08lx, %p, %p )\n", id, profile, size ); + + if (machine || !size) return FALSE; + + switch (id) + { + case 0x52474220: /* 'RGB ' */ + len = sizeof( rgbprofile ); + + if (*size < len || !profile) + { + *size = len; + return TRUE; + } + + lstrcpyW( profile, rgbprofile ); + break; + + default: + return FALSE; + } + + return TRUE; } /****************************************************************************** @@ -511,28 +475,28 @@ /****************************************************************************** * IsColorProfileTagPresent [MSCMS.@] * - * Determine if a given ICC tag is present in a color profile. + * Determine if a given ICC tag type is present in a color profile. * * PARAMS * profile [I] Color profile handle. - * tag [I] ICC tag. - * present [O] Pointer to a BOOL variable. Set to TRUE if tag is present, + * tag [I] ICC tag type. + * present [O] Pointer to a BOOL variable. Set to TRUE if tag type is present, * FALSE otherwise. * * RETURNS * Success: TRUE * Failure: FALSE */ -BOOL WINAPI IsColorProfileTagPresent( HPROFILE profile, TAGTYPE tag, PBOOL present ) +BOOL WINAPI IsColorProfileTagPresent( HPROFILE profile, TAGTYPE type, PBOOL present ) { BOOL ret = FALSE; +#ifdef HAVE_LCMS_H + cmsHPROFILE cmsprofile = MSCMS_hprofile2cmsprofile( profile ); - TRACE( "( %p, 0x%08lx, %p )\n", profile, tag, present ); - - if (!present) return FALSE; + TRACE( "( %p, 0x%08lx, %p )\n", profile, type, present ); -#ifdef HAVE_LCMS_H - ret = cmsIsTag( MSCMS_hprofile2cmsprofile( profile ), tag ); + if (!cmsprofile || !present) return FALSE; + ret = cmsIsTag( cmsprofile, type ); #endif /* HAVE_LCMS_H */ return *present = ret; @@ -567,6 +531,54 @@ return ret; } +/****************************************************************************** + * SetColorProfileElement [MSCMS.@] + * + * Set data for a specified tag type. + * + * PARAMS + * profile [I] Handle to a color profile. + * type [I] ICC tag type. + * offset [I] Offset in bytes to start copying to. + * size [I/O] Size of the buffer in bytes. On return the variable holds the + * number of bytes actually needed. + * buffer [O] Buffer holding the tag data. + * + * RETURNS + * Success: TRUE + * Failure: FALSE + */ +BOOL WINAPI SetColorProfileElement( HPROFILE profile, TAGTYPE type, DWORD offset, PDWORD size, + PVOID buffer ) +{ + BOOL ret = FALSE; +#ifdef HAVE_LCMS_H + icProfile *iccprofile = MSCMS_hprofile2iccprofile( profile ); + DWORD i, count; + icTag tag; + + TRACE( "( %p, 0x%08lx, %ld, %p, %p )\n", profile, type, offset, size, buffer ); + + if (!iccprofile || !size || !buffer) return FALSE; + count = MSCMS_get_tag_count( iccprofile ); + + for (i = 0; i < count; i++) + { + MSCMS_get_tag_by_index( iccprofile, i, &tag ); + + if (tag.sig == type) + { + if (offset > tag.size) return FALSE; + + MSCMS_set_tag_data( iccprofile, &tag, offset, buffer ); + return TRUE; + } + } + +#endif /* HAVE_LCMS_H */ + return ret; +} + BOOL WINAPI SetColorProfileHeader( HPROFILE profile, PPROFILEHEADER header ) { BOOL ret = FALSE; @@ -584,6 +596,20 @@ return ret; } +BOOL WINAPI SetStandardColorSpaceProfileA( PCSTR machine, DWORD id, PSTR profile ) +{ + FIXME( "( 0x%08lx, %p ) stub\n", id, profile ); + + return TRUE; +} + +BOOL WINAPI SetStandardColorSpaceProfileW( PCWSTR machine, DWORD id, PWSTR profile ) +{ + FIXME( "( 0x%08lx, %p ) stub\n", id, profile ); + + return TRUE; +} + /****************************************************************************** * UninstallColorProfileA [MSCMS.@] * diff -urN wine-20041201/dlls/mscms/stub.c wine-20050111/dlls/mscms/stub.c --- wine-20041201/dlls/mscms/stub.c 1970-01-01 01:00:00.000000000 +0100 +++ wine-20050111/dlls/mscms/stub.c 2004-12-20 18:04:11.000000000 +0100 @@ -0,0 +1,270 @@ +/* + * MSCMS - Color Management System for Wine + * + * Copyright 2004 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" +#include "wine/debug.h" + +#include + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "icm.h" + +WINE_DEFAULT_DEBUG_CHANNEL(mscms); + +BOOL WINAPI AssociateColorProfileWithDeviceA( PCSTR machine, PCSTR profile, PCSTR device ) +{ + FIXME( "( %p, %p, %p ) stub\n", machine, profile, device ); + + return TRUE; +} + +BOOL WINAPI AssociateColorProfileWithDeviceW( PCWSTR machine, PCWSTR profile, PCWSTR device ) +{ + FIXME( "( %p, %p, %p ) stub\n", machine, profile, device ); + + return TRUE; +} + +BOOL WINAPI CheckBitmapBits( HTRANSFORM transform, PVOID srcbits, BMFORMAT format, DWORD width, + DWORD height, DWORD stride, PBYTE result, PBMCALLBACKFN callback, + LPARAM data ) +{ + FIXME( "( %p, %p, 0x%08x, 0x%08lx, 0x%08lx, 0x%08lx, %p, %p, 0x%08lx ) stub\n", + transform, srcbits, format, width, height, stride, result, callback, data ); + + return FALSE; +} + +BOOL WINAPI CheckColors( HTRANSFORM transform, PCOLOR colors, DWORD number, COLORTYPE type, + PBYTE result ) +{ + FIXME( "( %p, %p, 0x%08lx, 0x%08x, %p ) stub\n", transform, colors, number, type, result ); + + return FALSE; +} + +BOOL WINAPI ConvertColorNameToIndex( HPROFILE profile, PCOLOR_NAME name, PDWORD index, DWORD count ) +{ + FIXME( "( %p, %p, %p, 0x%08lx ) stub\n", profile, name, index, count ); + + return FALSE; +} + +BOOL WINAPI ConvertIndexToColorName( HPROFILE profile, PDWORD index, PCOLOR_NAME name, DWORD count ) +{ + FIXME( "( %p, %p, %p, 0x%08lx ) stub\n", profile, index, name, count ); + + return FALSE; +} + +HTRANSFORM WINAPI CreateColorTransformA( LPLOGCOLORSPACEA space, HPROFILE dest, HPROFILE target, + DWORD flags ) +{ + FIXME( "( %p, %p, %p, 0x%08lx ) stub\n", space, dest, target, flags ); + + return NULL; +} + +HTRANSFORM WINAPI CreateColorTransformW( LPLOGCOLORSPACEW space, HPROFILE dest, HPROFILE target, + DWORD flags ) +{ + FIXME( "( %p, %p, %p, 0x%08lx ) stub\n", space, dest, target, flags ); + + return NULL; +} + +BOOL WINAPI CreateDeviceLinkProfile( PHPROFILE profiles, DWORD nprofiles, PDWORD intents, + DWORD nintents, DWORD flags, PBYTE *data, DWORD index ) +{ + FIXME( "( %p, 0x%08lx, %p, 0x%08lx, 0x%08lx, %p, 0x%08lx ) stub\n", + profiles, nprofiles, intents, nintents, flags, data, index ); + + return FALSE; +} + +HTRANSFORM WINAPI CreateMultiProfileTransform( PHPROFILE profiles, DWORD nprofiles, PDWORD intents, + DWORD nintents, DWORD flags, DWORD index ) +{ + FIXME( "( %p, 0x%08lx, %p, 0x%08lx, 0x%08lx, 0x%08lx ) stub\n", + profiles, nprofiles, intents, nintents, flags, index ); + + return NULL; +} + +BOOL WINAPI CreateProfileFromLogColorSpaceA( LPLOGCOLORSPACEA space, PBYTE *buffer ) +{ + FIXME( "( %p, %p ) stub\n", space, buffer ); + + return FALSE; +} + +BOOL WINAPI CreateProfileFromLogColorSpaceW( LPLOGCOLORSPACEW space, PBYTE *buffer ) +{ + FIXME( "( %p, %p ) stub\n", space, buffer ); + + return FALSE; +} + +BOOL WINAPI DeleteColorTransform( HTRANSFORM transform ) +{ + FIXME( "( %p ) stub\n", transform ); + + return TRUE; +} + +BOOL WINAPI DisassociateColorProfileFromDeviceA( PCSTR machine, PCSTR profile, PCSTR device ) +{ + FIXME( "( %p, %p, %p ) stub\n", machine, profile, device ); + + return TRUE; +} + +BOOL WINAPI DisassociateColorProfileFromDeviceW( PCWSTR machine, PCWSTR profile, PCWSTR device ) +{ + FIXME( "( %p, %p, %p ) stub\n", machine, profile, device ); + + return TRUE; +} + +BOOL WINAPI EnumColorProfilesA( PCSTR machine, PENUMTYPEA record, PBYTE buffer, PDWORD size, + PDWORD number ) +{ + FIXME( "( %p, %p, %p, %p, %p ) stub\n", machine, record, buffer, size, number ); + + return FALSE; +} + +BOOL WINAPI EnumColorProfilesW( PCWSTR machine, PENUMTYPEW record, PBYTE buffer, PDWORD size, + PDWORD number ) +{ + FIXME( "( %p, %p, %p, %p, %p ) stub\n", machine, record, buffer, size, number ); + + return FALSE; +} + +DWORD WINAPI GetCMMInfo( HTRANSFORM transform, DWORD info ) +{ + FIXME( "( %p, 0x%08lx ) stub\n", transform, info ); + + return 0; +} + +BOOL WINAPI GetNamedProfileInfo( HPROFILE profile, PNAMED_PROFILE_INFO info ) +{ + FIXME( "( %p, %p ) stub\n", profile, info ); + + return FALSE; +} + +BOOL WINAPI GetPS2ColorRenderingDictionary( HPROFILE profile, DWORD intent, PBYTE buffer, + PDWORD size, PBOOL binary ) +{ + FIXME( "( %p, 0x%08lx, %p, %p, %p ) stub\n", profile, intent, buffer, size, binary ); + + return FALSE; +} + +BOOL WINAPI GetPS2ColorRenderingIntent( HPROFILE profile, DWORD intent, PBYTE buffer, PDWORD size ) +{ + FIXME( "( %p, 0x%08lx, %p, %p ) stub\n", profile, intent, buffer, size ); + + return FALSE; +} + +BOOL WINAPI GetPS2ColorSpaceArray( HPROFILE profile, DWORD intent, DWORD type, PBYTE buffer, + PDWORD size, PBOOL binary ) +{ + FIXME( "( %p, 0x%08lx, 0x%08lx, %p, %p, %p ) stub\n", profile, intent, type, buffer, size, binary ); + + return FALSE; +} + +BOOL WINAPI RegisterCMMA( PCSTR machine, DWORD id, PCSTR dll ) +{ + FIXME( "( %p, 0x%08lx, %p ) stub\n", machine, id, dll ); + + return TRUE; +} + +BOOL WINAPI RegisterCMMW( PCWSTR machine, DWORD id, PCWSTR dll ) +{ + FIXME( "( %p, 0x%08lx, %p ) stub\n", machine, id, dll ); + + return TRUE; +} + +BOOL WINAPI SelectCMM( DWORD id ) +{ + FIXME( "( 0x%08lx ) stub\n", id ); + + return TRUE; +} + +BOOL WINAPI SetColorProfileElementReference( HPROFILE profile, TAGTYPE type, TAGTYPE ref ) +{ + FIXME( "( %p, 0x%08lx, 0x%08lx ) stub\n", profile, type, ref ); + + return TRUE; +} + +BOOL WINAPI SetColorProfileElementSize( HPROFILE profile, TAGTYPE type, DWORD size ) +{ + FIXME( "( %p, 0x%08lx, 0x%08lx ) stub\n", profile, type, size ); + + return FALSE; +} + +BOOL WINAPI TranslateBitmapBits( HTRANSFORM transform, PVOID srcbits, BMFORMAT input, + DWORD width, DWORD height, DWORD inputstride, PVOID destbits, + BMFORMAT output, DWORD outputstride, PBMCALLBACKFN callback, + ULONG data ) +{ + FIXME( "( %p, %p, 0x%08x, 0x%08lx, 0x%08lx, 0x%08lx, %p, 0x%08x, 0x%08lx, %p, 0x%08lx ) stub\n", + transform, srcbits, input, width, height, inputstride, destbits, output, outputstride, + callback, data ); + + return FALSE; +} + +BOOL WINAPI TranslateColors( HTRANSFORM transform, PCOLOR inputcolors, DWORD number, + COLORTYPE input, PCOLOR outputcolors, COLORTYPE output ) +{ + FIXME( "( %p, %p, 0x%08lx, 0x%08x, %p, 0x%08x ) stub\n", transform, inputcolors, + number, input, outputcolors, output ); + + return FALSE; +} + +BOOL WINAPI UnregisterCMMA( PCSTR machine, DWORD id ) +{ + FIXME( "( %p, 0x%08lx ) stub\n", machine, id ); + + return TRUE; +} + +BOOL WINAPI UnregisterCMMW( PCWSTR machine, DWORD id ) +{ + FIXME( "( %p, 0x%08lx ) stub\n", machine, id ); + + return TRUE; +} diff -urN wine-20041201/dlls/mscms/tests/profile.c wine-20050111/dlls/mscms/tests/profile.c --- wine-20041201/dlls/mscms/tests/profile.c 2004-11-30 22:06:14.000000000 +0100 +++ wine-20050111/dlls/mscms/tests/profile.c 2004-12-27 18:46:36.000000000 +0100 @@ -32,6 +32,15 @@ static const char machine[] = "dummy"; static const WCHAR machineW[] = { 'd','u','m','m','y',0 }; +/* To do any real functionality testing with this suite you need a copy of + * the freely distributable standard RGB color space profile. It comes + * standard with Windows, but on Wine you probably need to install it yourself + * in one of the locations mentioned below. Here's a link to the profile in + * a self extracting zip file: + * + * http://download.microsoft.com/download/whistler/hwdev1/1.0/wxp/en-us/ColorProfile.exe + */ + /* Two common places to find the standard color space profile */ static const char profile1[] = "c:\\windows\\system\\color\\srgb color space profile.icm"; @@ -48,6 +57,15 @@ '\\','c','o','l','o','r','\\','s','r','g','b',' ','c','o','l','o','r',' ', 's','p','a','c','e',' ','p','r','o','f','i','l','e','.','i','c','m',0 }; +static const unsigned char rgbheader[] = +{ 0x48, 0x0c, 0x00, 0x00, 0x6f, 0x6e, 0x69, 0x4c, 0x00, 0x00, 0x10, 0x02, + 0x72, 0x74, 0x6e, 0x6d, 0x20, 0x42, 0x47, 0x52, 0x20, 0x5a, 0x59, 0x58, + 0x02, 0x00, 0xce, 0x07, 0x06, 0x00, 0x09, 0x00, 0x00, 0x00, 0x31, 0x00, + 0x70, 0x73, 0x63, 0x61, 0x54, 0x46, 0x53, 0x4d, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x43, 0x45, 0x49, 0x42, 0x47, 0x52, 0x73, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xf6, 0x00, 0x00, + 0x00, 0x00, 0x01, 0x00, 0x2d, 0xd3, 0x00, 0x00, 0x20, 0x20, 0x50, 0x48 }; + static LPSTR standardprofile; static LPWSTR standardprofileW; @@ -80,32 +98,30 @@ /* Parameter checks */ + ret = GetColorDirectoryA( NULL, NULL, NULL ); + ok( !ret, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() ); + size = 0; ret = GetColorDirectoryA( NULL, NULL, &size ); - ok( !ret, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() ); + ok( !ret && size > 0, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() ); size = 0; ret = GetColorDirectoryA( NULL, buffer, &size ); - ok( !ret, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() ); + ok( !ret && size > 0, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() ); size = 1; ret = GetColorDirectoryA( NULL, buffer, &size ); - ok( !ret, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() ); - - size = sizeof(buffer); - - ret = GetColorDirectoryA( machine, buffer, &size ); - ok( !ret, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() ); + ok( !ret && size > 0, "GetColorDirectoryA() succeeded (%ld)\n", GetLastError() ); /* Functional checks */ size = sizeof(buffer); ret = GetColorDirectoryA( NULL, buffer, &size ); - ok( ret, "GetColorDirectoryA() failed (%ld)\n", GetLastError() ); + ok( ret && size > 0, "GetColorDirectoryA() failed (%ld)\n", GetLastError() ); } static void test_GetColorDirectoryW() @@ -116,32 +132,35 @@ /* Parameter checks */ + /* This one crashes win2k + + ret = GetColorDirectoryW( NULL, NULL, NULL ); + ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() ); + + */ + size = 0; ret = GetColorDirectoryW( NULL, NULL, &size ); - ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() ); + ok( !ret && size > 0, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() ); size = 0; ret = GetColorDirectoryW( NULL, buffer, &size ); - ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() ); + ok( !ret && size > 0, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() ); size = 1; ret = GetColorDirectoryW( NULL, buffer, &size ); - ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() ); - - size = sizeof(buffer); - - ret = GetColorDirectoryW( machineW, buffer, &size ); - ok( !ret, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() ); + ok( !ret && size > 0, "GetColorDirectoryW() succeeded (%ld)\n", GetLastError() ); /* Functional checks */ size = sizeof(buffer); ret = GetColorDirectoryW( NULL, buffer, &size ); - ok( ret, "GetColorDirectoryW() failed (%ld)\n", GetLastError() ); + ok( ret && size > 0, "GetColorDirectoryW() failed (%ld)\n", GetLastError() ); + ret = GetColorDirectoryW( NULL, buffer, &size ); } static void test_GetColorProfileElement() @@ -154,7 +173,7 @@ DWORD size; TAGTYPE tag = 0x63707274; /* 'cprt' */ static char buffer[51]; - static char expect[] = + static const char expect[] = { 0x74, 0x65, 0x78, 0x74, 0x00, 0x00, 0x00, 0x00, 0x43, 0x6f, 0x70, 0x79, 0x72, 0x69, 0x67, 0x68, 0x74, 0x20, 0x28, 0x63, 0x29, 0x20, 0x31, 0x39, 0x39, 0x38, 0x20, 0x48, 0x65, 0x77, 0x6c, 0x65, 0x74, @@ -168,15 +187,25 @@ handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING ); ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); + /* Parameter checks */ + + ret = GetColorProfileElement( handle, tag, 0, NULL, NULL, &ref ); + ok( !ret, "GetColorProfileElement() succeeded (%ld)\n", GetLastError() ); + + ret = GetColorProfileElement( handle, tag, 0, &size, NULL, NULL ); + ok( !ret, "GetColorProfileElement() succeeded (%ld)\n", GetLastError() ); + size = 0; ret = GetColorProfileElement( handle, tag, 0, &size, NULL, &ref ); - ok( !ret, "GetColorProfileElement() succeeded (%ld)\n", GetLastError() ); + ok( !ret && size > 0, "GetColorProfileElement() succeeded (%ld)\n", GetLastError() ); size = sizeof(buffer); + /* Functional checks */ + ret = GetColorProfileElement( handle, tag, 0, &size, buffer, &ref ); - ok( ret, "GetColorProfileElement() failed (%ld)\n", GetLastError() ); + ok( ret && size > 0, "GetColorProfileElement() failed (%ld)\n", GetLastError() ); ok( !memcmp( buffer, expect, sizeof(expect) ), "Unexpected tag data\n" ); @@ -201,9 +230,83 @@ handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING ); ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); + /* Parameter checks */ + + ret = GetColorProfileElementTag( NULL, index, &tag ); + ok( !ret, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() ); + + ret = GetColorProfileElementTag( handle, 0, &tag ); + ok( !ret, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() ); + + ret = GetColorProfileElementTag( handle, index, NULL ); + ok( !ret, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() ); + + ret = GetColorProfileElementTag( handle, 18, NULL ); + ok( !ret, "GetColorProfileElementTag() succeeded (%ld)\n", GetLastError() ); + + /* Functional checks */ + ret = GetColorProfileElementTag( handle, index, &tag ); - ok( ret && tag == expect, "GetColorProfileElementTag() failed (%ld) 0x%08lx\n", - GetLastError(), tag ); + ok( ret && tag == expect, "GetColorProfileElementTag() failed (%ld)\n", + GetLastError() ); + + CloseColorProfile( handle ); + } +} + +static void test_GetColorProfileFromHandle() +{ + if (testprofile) + { + PROFILE profile; + HPROFILE handle; + DWORD size; + BOOL ret; + static const unsigned char expect[] = + { 0x00, 0x00, 0x0c, 0x48, 0x4c, 0x69, 0x6e, 0x6f, 0x02, 0x10, 0x00, + 0x00, 0x6d, 0x6e, 0x74, 0x72, 0x52, 0x47, 0x42, 0x20, 0x58, 0x59, + 0x5a, 0x20, 0x07, 0xce, 0x00, 0x02, 0x00, 0x09, 0x00, 0x06, 0x00, + 0x31, 0x00, 0x00, 0x61, 0x63, 0x73, 0x70, 0x4d, 0x53, 0x46, 0x54, + 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x43, 0x20, 0x73, 0x52, 0x47, + 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0xf6, 0xd6, 0x00, 0x01, 0x00, 0x00, 0x00, + 0x00, 0xd3, 0x2d, 0x48, 0x50, 0x20, 0x20 }; + + unsigned char *buffer; + + profile.dwType = PROFILE_FILENAME; + profile.pProfileData = testprofile; + profile.cbDataSize = strlen(testprofile); + + handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING ); + ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); + + /* Parameter checks */ + + size = 0; + + ret = GetColorProfileFromHandle( handle, NULL, &size ); + ok( !ret && size > 0, "GetColorProfileFromHandle() failed (%ld)\n", GetLastError() ); + + buffer = HeapAlloc( GetProcessHeap(), 0, size ); + + if (buffer) + { + ret = GetColorProfileFromHandle( NULL, buffer, &size ); + ok( !ret, "GetColorProfileFromHandle() succeeded (%ld)\n", GetLastError() ); + + ret = GetColorProfileFromHandle( handle, buffer, NULL ); + ok( !ret, "GetColorProfileFromHandle() succeeded (%ld)\n", GetLastError() ); + + /* Functional checks */ + + ret = GetColorProfileFromHandle( handle, buffer, &size ); + ok( ret && size > 0, "GetColorProfileFromHandle() failed (%ld)\n", GetLastError() ); + + ok( !memcmp( buffer, expect, sizeof(expect) ), "Unexpected header data\n" ); + + HeapFree( GetProcessHeap(), 0, buffer ); + } CloseColorProfile( handle ); } @@ -216,12 +319,7 @@ PROFILE profile; HPROFILE handle; BOOL ret; - static PROFILEHEADER header; - static PROFILEHEADER expect = - { 0x00000c48, 0x4c696e6f, 0x02100000, 0x6d6e7472, 0x52474220, 0x58595a20, - { 0x07ce0002, 0x00090006, 0x61637370 }, 0x61637370, 0x4d534654, 0x00000000, - 0x49454320, 0x73524742, { 0x00000000, 0x00000000 }, 0x00000000, { 0x0000f6d6, - 0x00000100, 0x2dd30000 }, 0x48502020 }; + PROFILEHEADER header; profile.dwType = PROFILE_FILENAME; profile.pProfileData = testprofile; @@ -230,11 +328,23 @@ handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING ); ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); + /* Parameter checks */ + + ret = GetColorProfileHeader( NULL, NULL ); + ok( !ret, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() ); + + ret = GetColorProfileHeader( NULL, &header ); + ok( !ret, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() ); + + ret = GetColorProfileHeader( handle, NULL ); + ok( !ret, "GetColorProfileHeader() succeeded (%ld)\n", GetLastError() ); + + /* Functional checks */ + ret = GetColorProfileHeader( handle, &header ); ok( ret, "GetColorProfileHeader() failed (%ld)\n", GetLastError() ); - ok( memcmp( &header, &expect, FIELD_OFFSET(PROFILEHEADER, phReserved) ), - "Unexpected header data\n" ); + ok( !memcmp( &header, rgbheader, sizeof(rgbheader) ), "Unexpected header data\n" ); CloseColorProfile( handle ); } @@ -256,13 +366,124 @@ handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING ); ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); + /* Parameter checks */ + + ret = GetCountColorProfileElements( NULL, &count ); + ok( !ret, "GetCountColorProfileElements() succeeded (%ld)\n", + GetLastError() ); + + ret = GetCountColorProfileElements( handle, NULL ); + ok( !ret, "GetCountColorProfileElements() succeeded (%ld)\n", + GetLastError() ); + + /* Functional checks */ + ret = GetCountColorProfileElements( handle, &count ); - ok( ret && count == expect, "GetCountColorProfileElements() failed (%ld)\n", GetLastError() ); + ok( ret && count == expect, + "GetCountColorProfileElements() failed (%ld)\n", GetLastError() ); CloseColorProfile( handle ); } } +static void test_GetStandardColorSpaceProfileA() +{ + BOOL ret; + DWORD size; + CHAR oldprofile[MAX_PATH]; + CHAR newprofile[MAX_PATH]; + + /* Parameter checks */ + + ret = GetStandardColorSpaceProfileA( NULL, 0, newprofile, NULL ); + ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() ); + + ret = GetStandardColorSpaceProfileA( machine, 0, newprofile, &size ); + ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() ); + + size = 0; + + ret = GetStandardColorSpaceProfileA( NULL, 0, NULL, &size ); + ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() ); + + size = sizeof(newprofile); + + ret = GetStandardColorSpaceProfileA( NULL, 0, newprofile, &size ); + ok( !ret, "GetStandardColorSpaceProfileA() succeeded (%ld)\n", GetLastError() ); + + /* Functional checks */ + + if (standardprofile) + { + size = sizeof(oldprofile); + + ret = GetStandardColorSpaceProfileA( NULL, SPACE_RGB, oldprofile, &size ); + ok( ret, "GetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() ); + + ret = SetStandardColorSpaceProfileA( NULL, SPACE_RGB, standardprofile ); + ok( ret, "SetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() ); + + size = sizeof(newprofile); + + ret = GetStandardColorSpaceProfileA( NULL, SPACE_RGB, newprofile, &size ); + ok( ret, "GetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() ); + + ok( !lstrcmpiA( (LPSTR)&newprofile, standardprofile ), "Unexpected profile\n" ); + + ret = SetStandardColorSpaceProfileA( NULL, SPACE_RGB, oldprofile ); + ok( ret, "SetStandardColorSpaceProfileA() failed (%ld)\n", GetLastError() ); + } +} + +static void test_GetStandardColorSpaceProfileW() +{ + BOOL ret; + DWORD size; + WCHAR oldprofile[MAX_PATH]; + WCHAR newprofile[MAX_PATH]; + + /* Parameter checks */ + + ret = GetStandardColorSpaceProfileW( NULL, 0, newprofile, NULL ); + ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() ); + + ret = GetStandardColorSpaceProfileW( machineW, 0, newprofile, &size ); + ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() ); + + size = 0; + + ret = GetStandardColorSpaceProfileW( NULL, 0, NULL, &size ); + ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() ); + + size = sizeof(newprofile); + + ret = GetStandardColorSpaceProfileW( NULL, 0, newprofile, &size ); + ok( !ret, "GetStandardColorSpaceProfileW() succeeded (%ld)\n", GetLastError() ); + + /* Functional checks */ + + if (standardprofileW) + { + size = sizeof(oldprofile); + + ret = GetStandardColorSpaceProfileW( NULL, SPACE_RGB, oldprofile, &size ); + ok( ret, "GetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() ); + + ret = SetStandardColorSpaceProfileW( NULL, SPACE_RGB, standardprofileW ); + ok( ret, "SetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() ); + + size = sizeof(newprofile); + + ret = GetStandardColorSpaceProfileW( NULL, SPACE_RGB, newprofile, &size ); + ok( ret, "GetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() ); + + ok( !lstrcmpiW( (LPWSTR)&newprofile, standardprofileW ), "Unexpected profile\n" ); + + ret = SetStandardColorSpaceProfileW( NULL, SPACE_RGB, oldprofile ); + ok( ret, "SetStandardColorSpaceProfileW() failed (%ld)\n", GetLastError() ); + } +} + static void test_InstallColorProfileA() { BOOL ret; @@ -381,6 +602,8 @@ handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING ); ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); + /* Parameter checks */ + tag = 0; ret = IsColorProfileTagPresent( handle, tag, &present ); @@ -388,6 +611,14 @@ tag = 0x63707274; /* 'cprt' */ + ret = IsColorProfileTagPresent( NULL, tag, &present ); + ok( !ret, "IsColorProfileTagPresent() succeeded (%ld)\n", GetLastError() ); + + ret = IsColorProfileTagPresent( handle, tag, NULL ); + ok( !ret, "IsColorProfileTagPresent() succeeded (%ld)\n", GetLastError() ); + + /* Functional checks */ + ret = IsColorProfileTagPresent( handle, tag, &present ); ok( ret && present, "IsColorProfileTagPresent() failed (%ld)\n", GetLastError() ); @@ -399,6 +630,7 @@ { PROFILE profile; HPROFILE handle; + BOOL ret; profile.dwType = PROFILE_FILENAME; profile.pProfileData = NULL; @@ -418,7 +650,7 @@ handle = OpenColorProfileA( &profile, PROFILE_READWRITE, 0, 0 ); ok( handle == NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); - ok ( !CloseColorProfile( NULL ), "CloseColorProfile() succeeded" ); + ok ( !CloseColorProfile( NULL ), "CloseColorProfile() succeeded\n" ); if (standardprofile) { @@ -439,7 +671,8 @@ handle = OpenColorProfileA( &profile, PROFILE_READ, 0, OPEN_EXISTING ); ok( handle != NULL, "OpenColorProfileA() failed (%ld)\n", GetLastError() ); - ok( CloseColorProfile( handle ), "CloseCol