From 64b327866d1e51dbbbf3037a11cb017ad5a4fd9c Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Tue, 12 Jun 2007 13:42:22 +0200 Subject: [PATCH] push f6c05471e518356cc315a2213a1fa6428675e384 --- .gitignore | 6 +- Makefile.in | 2 + configure | 3 + configure.ac | 1 + dlls/Makefile.in | 1 + dlls/credui/credui.rc | 1 + dlls/credui/credui_Ko.rc | 37 ++++ dlls/d3d8/cubetexture.c | 104 +++++++-- dlls/d3d8/indexbuffer.c | 75 ++++++- dlls/d3d8/surface.c | 51 ++++- dlls/dsound/propset.c | 1 + dlls/gdiplus/Makefile.in | 6 +- dlls/gdiplus/gdiplus.c | 14 ++ dlls/gdiplus/gdiplus.spec | 10 +- .../credui.rc => gdiplus/gdiplus_private.h} | 33 ++- dlls/gdiplus/graphics.c | 67 ++++++ dlls/gdiplus/pen.c | 72 +++++++ dlls/gdiplus/tests/Makefile.in | 13 ++ dlls/gdiplus/tests/pen.c | 92 ++++++++ dlls/hlink/hlink_main.c | 2 - dlls/mshtml/editor.c | 13 +- dlls/mshtml/htmldoc.c | 12 +- dlls/mshtml/mshtml_private.h | 3 + dlls/mshtml/navigate.c | 32 ++- dlls/mshtml/nsio.c | 67 +++--- dlls/mshtml/olecmd.c | 16 ++ dlls/mshtml/persist.c | 67 ++++-- dlls/mshtml/tests/htmldoc.c | 89 +++++++- dlls/msi/format.c | 2 +- dlls/ntdll/misc.c | 2 +- dlls/ntdll/string.c | 12 +- dlls/ntdll/wcstring.c | 10 +- dlls/rpcrt4/tests/server.c | 24 +++ dlls/rpcrt4/tests/server.idl | 9 + dlls/shell32/shell32_En.rc | 2 - dlls/shell32/shell32_Ko.rc | 20 ++ dlls/shell32/xdg.c | 2 +- dlls/uuid/uuid.c | 1 + dlls/wined3d/device.c | 2 +- dlls/winmm/playsound.c | 19 +- dlls/winmm/time.c | 203 +++++++---------- dlls/winmm/winemm.h | 1 - programs/winecfg/appdefaults.c | 2 +- programs/winetest/Makefile.in | 3 + programs/winetest/winetest.rc | 1 + programs/wordpad/De.rc | 6 + programs/wordpad/En.rc | 6 + programs/wordpad/Fr.rc | 6 + programs/wordpad/Hu.rc | 6 + programs/wordpad/Ko.rc | 6 + programs/wordpad/Makefile.in | 2 +- programs/wordpad/Nl.rc | 6 + programs/wordpad/No.rc | 6 + programs/wordpad/Pl.rc | 6 + programs/wordpad/Ru.rc | 6 + programs/wordpad/Tr.rc | 6 + programs/wordpad/resource.h | 14 +- programs/wordpad/rsrc.rc | 4 +- programs/wordpad/wordpad.c | 207 +++++++++++++++--- tools/widl/parser.y | 1 - tools/widl/typegen.c | 240 +++++++++------------ tools/widl/widltypes.h | 1 - tools/winapi/win32.api | 9 +- tools/winapi/winapi.pm | 2 +- 64 files changed, 1296 insertions(+), 449 deletions(-) create mode 100644 dlls/credui/credui_Ko.rc copy dlls/{credui/credui.rc => gdiplus/gdiplus_private.h} (67%) create mode 100644 dlls/gdiplus/graphics.c create mode 100644 dlls/gdiplus/pen.c create mode 100644 dlls/gdiplus/tests/Makefile.in create mode 100644 dlls/gdiplus/tests/pen.c diff --git a/.gitignore b/.gitignore index 88c847579d6..15c7492fa7a 100644 --- a/.gitignore +++ b/.gitignore @@ -240,6 +240,9 @@ dlls/gdi32/tests/testlist.c dlls/gdi32/version.res dlls/gdi32/version16.res dlls/gdiplus/libgdiplus.def +dlls/gdiplus/tests/*.ok +dlls/gdiplus/tests/gdiplus_crosstest.exe +dlls/gdiplus/tests/testlist.c dlls/glu32/libglu32.def dlls/gphoto2.ds/rsrc.res dlls/hhctrl.ocx/hhctrl.res @@ -845,6 +848,7 @@ programs/winetest/dnsapi_test.exe programs/winetest/dplayx_test.exe programs/winetest/dsound_test.exe programs/winetest/gdi32_test.exe +programs/winetest/gdiplus_test.exe programs/winetest/hlink_test.exe programs/winetest/infosoft_test.exe programs/winetest/iphlpapi_test.exe @@ -899,8 +903,8 @@ programs/winhelp/macro.lex.yy.c programs/winhelp/rsrc.res programs/winhelp/winhelp programs/winver/winver +programs/wordpad/formatbar.bmp programs/wordpad/rsrc.res -programs/wordpad/toolbar.bmp programs/wordpad/wordpad programs/wordpad/wordpad.ico programs/xcopy/rsrc.res diff --git a/Makefile.in b/Makefile.in index 36d950dddd7..fbf92683dfc 100644 --- a/Makefile.in +++ b/Makefile.in @@ -234,6 +234,7 @@ ALL_MAKEFILES = \ dlls/gdi32/Makefile \ dlls/gdi32/tests/Makefile \ dlls/gdiplus/Makefile \ + dlls/gdiplus/tests/Makefile \ dlls/glu32/Makefile \ dlls/gphoto2.ds/Makefile \ dlls/hal/Makefile \ @@ -586,6 +587,7 @@ dlls/dxguid/Makefile: dlls/dxguid/Makefile.in dlls/Makeimplib.rules dlls/gdi32/Makefile: dlls/gdi32/Makefile.in dlls/Makedll.rules dlls/gdi32/tests/Makefile: dlls/gdi32/tests/Makefile.in dlls/Maketest.rules dlls/gdiplus/Makefile: dlls/gdiplus/Makefile.in dlls/Makedll.rules +dlls/gdiplus/tests/Makefile: dlls/gdiplus/tests/Makefile.in dlls/Maketest.rules dlls/glu32/Makefile: dlls/glu32/Makefile.in dlls/Makedll.rules dlls/gphoto2.ds/Makefile: dlls/gphoto2.ds/Makefile.in dlls/Makedll.rules dlls/hal/Makefile: dlls/hal/Makefile.in dlls/Makedll.rules diff --git a/configure b/configure index 446033de068..341f70a89df 100755 --- a/configure +++ b/configure @@ -20553,6 +20553,8 @@ ac_config_files="$ac_config_files dlls/gdi32/tests/Makefile" ac_config_files="$ac_config_files dlls/gdiplus/Makefile" +ac_config_files="$ac_config_files dlls/gdiplus/tests/Makefile" + ac_config_files="$ac_config_files dlls/glu32/Makefile" ac_config_files="$ac_config_files dlls/gphoto2.ds/Makefile" @@ -21717,6 +21719,7 @@ do "dlls/gdi32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gdi32/Makefile" ;; "dlls/gdi32/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gdi32/tests/Makefile" ;; "dlls/gdiplus/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gdiplus/Makefile" ;; + "dlls/gdiplus/tests/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gdiplus/tests/Makefile" ;; "dlls/glu32/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/glu32/Makefile" ;; "dlls/gphoto2.ds/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/gphoto2.ds/Makefile" ;; "dlls/hal/Makefile") CONFIG_FILES="$CONFIG_FILES dlls/hal/Makefile" ;; diff --git a/configure.ac b/configure.ac index 6059840ad2d..7a1f0dbcafe 100644 --- a/configure.ac +++ b/configure.ac @@ -1528,6 +1528,7 @@ AC_CONFIG_FILES([dlls/dxguid/Makefile]) AC_CONFIG_FILES([dlls/gdi32/Makefile]) AC_CONFIG_FILES([dlls/gdi32/tests/Makefile]) AC_CONFIG_FILES([dlls/gdiplus/Makefile]) +AC_CONFIG_FILES([dlls/gdiplus/tests/Makefile]) AC_CONFIG_FILES([dlls/glu32/Makefile]) AC_CONFIG_FILES([dlls/gphoto2.ds/Makefile]) AC_CONFIG_FILES([dlls/hal/Makefile]) diff --git a/dlls/Makefile.in b/dlls/Makefile.in index 8fb87a7492e..6110b1a055a 100644 --- a/dlls/Makefile.in +++ b/dlls/Makefile.in @@ -246,6 +246,7 @@ TESTSUBDIRS = \ dplayx/tests \ dsound/tests \ gdi32/tests \ + gdiplus/tests \ hlink/tests \ infosoft/tests \ iphlpapi/tests \ diff --git a/dlls/credui/credui.rc b/dlls/credui/credui.rc index 3b48b396648..de238af4c8e 100644 --- a/dlls/credui/credui.rc +++ b/dlls/credui/credui.rc @@ -26,5 +26,6 @@ #include "credui_De.rc" #include "credui_En.rc" +#include "credui_Ko.rc" #include "credui_No.rc" #include "credui_Pl.rc" diff --git a/dlls/credui/credui_Ko.rc b/dlls/credui/credui_Ko.rc new file mode 100644 index 00000000000..ee35b4f7cec --- /dev/null +++ b/dlls/credui/credui_Ko.rc @@ -0,0 +1,37 @@ +/* + * Korean language resource file for Credentials UI + * + * Copyright 2007 Robert Shearman (for CodeWeavers) + * Copyright 2007 YunSong Hwang-ȲÀ±¼º(hys545@dreamwiz.com) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +LANGUAGE LANG_KOREAN, SUBLANG_DEFAULT + +IDD_CREDDIALOG DIALOG DISCARDABLE 0, 0, 220, 82 +STYLE DS_MODALFRAME | DS_NOIDLEMSG | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU +CAPTION "»ç¿ëÀÚ À̸§°ú ¾ÏÈ£ ÀÔ·Â" +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "»ç¿ëÀÚ À̸§(&U):",IDC_STATIC,7,10,72,12,SS_CENTERIMAGE + EDITTEXT IDC_USERNAME,80,10,130,12,ES_AUTOHSCROLL + LTEXT "¾ÏÈ£(&P):",IDC_STATIC,7,27,72,12,SS_CENTERIMAGE + EDITTEXT IDC_PASSWORD,80,27,130,12,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "µµ¸ÞÀÎ À̸§(&D):",IDC_STATIC,7,44,72,12,SS_CENTERIMAGE + EDITTEXT IDC_DOMAIN,80,44,130,12,ES_AUTOHSCROLL + DEFPUSHBUTTON "È®ÀÎ",IDOK,7,61,50,14 + PUSHBUTTON "Ãë¼Ò",IDCANCEL,67,61,50,14 +END diff --git a/dlls/d3d8/cubetexture.c b/dlls/d3d8/cubetexture.c index 71daf34f7d3..ae343bbb712 100644 --- a/dlls/d3d8/cubetexture.c +++ b/dlls/d3d8/cubetexture.c @@ -57,7 +57,9 @@ static ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 ifa if (ref == 0) { TRACE("Releasing child %p\n", This->wineD3DCubeTexture); + EnterCriticalSection(&d3d8_cs); IWineD3DCubeTexture_Destroy(This->wineD3DCubeTexture, D3D8CB_DestroySurface); + LeaveCriticalSection(&d3d8_cs); IUnknown_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } @@ -67,74 +69,128 @@ static ULONG WINAPI IDirect3DCubeTexture8Impl_Release(LPDIRECT3DCUBETEXTURE8 ifa /* IDirect3DCubeTexture8 IDirect3DResource8 Interface follow: */ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetDevice(LPDIRECT3DCUBETEXTURE8 iface, IDirect3DDevice8 **ppDevice) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n" , This); - return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice); + + EnterCriticalSection(&d3d8_cs); + hr = IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DCubeTexture8Impl_SetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DCubeTexture_SetPrivateData(This->wineD3DCubeTexture,refguid,pData,SizeOfData,Flags); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetPrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DCubeTexture_GetPrivateData(This->wineD3DCubeTexture,refguid,pData,pSizeOfData); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DCubeTexture8Impl_FreePrivateData(LPDIRECT3DCUBETEXTURE8 iface, REFGUID refguid) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DCubeTexture_FreePrivateData(This->wineD3DCubeTexture,refguid); + LeaveCriticalSection(&d3d8_cs); + return hr; } static DWORD WINAPI IDirect3DCubeTexture8Impl_SetPriority(LPDIRECT3DCUBETEXTURE8 iface, DWORD PriorityNew) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + DWORD ret; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew); + + EnterCriticalSection(&d3d8_cs); + ret = IWineD3DCubeTexture_SetPriority(This->wineD3DCubeTexture, PriorityNew); + LeaveCriticalSection(&d3d8_cs); + return ret; } static DWORD WINAPI IDirect3DCubeTexture8Impl_GetPriority(LPDIRECT3DCUBETEXTURE8 iface) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + DWORD ret; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture); + + EnterCriticalSection(&d3d8_cs); + ret = IWineD3DCubeTexture_GetPriority(This->wineD3DCubeTexture); + LeaveCriticalSection(&d3d8_cs); + return ret; } static void WINAPI IDirect3DCubeTexture8Impl_PreLoad(LPDIRECT3DCUBETEXTURE8 iface) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; TRACE("(%p) Relay\n", This); + + EnterCriticalSection(&d3d8_cs); IWineD3DCubeTexture_PreLoad(This->wineD3DCubeTexture); + LeaveCriticalSection(&d3d8_cs); } static D3DRESOURCETYPE WINAPI IDirect3DCubeTexture8Impl_GetType(LPDIRECT3DCUBETEXTURE8 iface) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + D3DRESOURCETYPE type; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture); + + EnterCriticalSection(&d3d8_cs); + type = IWineD3DCubeTexture_GetType(This->wineD3DCubeTexture); + LeaveCriticalSection(&d3d8_cs); + return type; } /* IDirect3DCubeTexture8 IDirect3DBaseTexture8 Interface follow: */ static DWORD WINAPI IDirect3DCubeTexture8Impl_SetLOD(LPDIRECT3DCUBETEXTURE8 iface, DWORD LODNew) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + DWORD lod; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew); + + EnterCriticalSection(&d3d8_cs); + lod = IWineD3DCubeTexture_SetLOD(This->wineD3DCubeTexture, LODNew); + LeaveCriticalSection(&d3d8_cs); + return lod; } static DWORD WINAPI IDirect3DCubeTexture8Impl_GetLOD(LPDIRECT3DCUBETEXTURE8 iface) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + DWORD lod; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_GetLOD((LPDIRECT3DBASETEXTURE8) This); + + EnterCriticalSection(&d3d8_cs); + lod = IWineD3DCubeTexture_GetLOD((LPDIRECT3DBASETEXTURE8) This); + LeaveCriticalSection(&d3d8_cs); + return lod; } static DWORD WINAPI IDirect3DCubeTexture8Impl_GetLevelCount(LPDIRECT3DCUBETEXTURE8 iface) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + DWORD cnt; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture); + + EnterCriticalSection(&d3d8_cs); + cnt = IWineD3DCubeTexture_GetLevelCount(This->wineD3DCubeTexture); + LeaveCriticalSection(&d3d8_cs); + return cnt; } /* IDirect3DCubeTexture8 Interface follow: */ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTURE8 iface, UINT Level, D3DSURFACE_DESC *pDesc) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + HRESULT hr; WINED3DSURFACE_DESC wined3ddesc; TRACE("(%p) Relay\n", This); @@ -150,7 +206,10 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetLevelDesc(LPDIRECT3DCUBETEXTU wined3ddesc.Width = &pDesc->Width; wined3ddesc.Height = &pDesc->Height; - return IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc); + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DCubeTexture_GetLevelDesc(This->wineD3DCubeTexture, Level, &wined3ddesc); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, IDirect3DSurface8 **ppCubeMapSurface) { @@ -160,30 +219,47 @@ static HRESULT WINAPI IDirect3DCubeTexture8Impl_GetCubeMapSurface(LPDIRECT3DCUBE TRACE("(%p) Relay\n", This); + EnterCriticalSection(&d3d8_cs); hrc = IWineD3DCubeTexture_GetCubeMapSurface(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, &mySurface); if (hrc == D3D_OK && NULL != ppCubeMapSurface) { IWineD3DCubeTexture_GetParent(mySurface, (IUnknown **)ppCubeMapSurface); IWineD3DCubeTexture_Release(mySurface); } + LeaveCriticalSection(&d3d8_cs); return hrc; } static HRESULT WINAPI IDirect3DCubeTexture8Impl_LockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level, D3DLOCKED_RECT* pLockedRect, CONST RECT *pRect, DWORD Flags) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_LockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DCubeTexture_LockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DCubeTexture8Impl_UnlockRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, UINT Level) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_UnlockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DCubeTexture_UnlockRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, Level); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DCubeTexture8Impl_AddDirtyRect(LPDIRECT3DCUBETEXTURE8 iface, D3DCUBEMAP_FACES FaceType, CONST RECT *pDirtyRect) { IDirect3DCubeTexture8Impl *This = (IDirect3DCubeTexture8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DCubeTexture_AddDirtyRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, pDirtyRect); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DCubeTexture_AddDirtyRect(This->wineD3DCubeTexture, (WINED3DCUBEMAP_FACES) FaceType, pDirtyRect); + LeaveCriticalSection(&d3d8_cs); + return hr; } diff --git a/dlls/d3d8/indexbuffer.c b/dlls/d3d8/indexbuffer.c index ad92cf40f0a..c4bd83338b2 100644 --- a/dlls/d3d8/indexbuffer.c +++ b/dlls/d3d8/indexbuffer.c @@ -56,7 +56,9 @@ static ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 ifa TRACE("(%p) : ReleaseRef to %d\n", This, ref); if (ref == 0) { + EnterCriticalSection(&d3d8_cs); IWineD3DIndexBuffer_Release(This->wineD3DIndexBuffer); + LeaveCriticalSection(&d3d8_cs); IUnknown_Release(This->parentDevice); HeapFree(GetProcessHeap(), 0, This); } @@ -66,69 +68,122 @@ static ULONG WINAPI IDirect3DIndexBuffer8Impl_Release(LPDIRECT3DINDEXBUFFER8 ifa /* IDirect3DIndexBuffer8 IDirect3DResource8 Interface follow: */ static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDevice(LPDIRECT3DINDEXBUFFER8 iface, IDirect3DDevice8 **ppDevice) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice); + + EnterCriticalSection(&d3d8_cs); + hr = IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DIndexBuffer8Impl_SetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, CONST void* pData, DWORD SizeOfData, DWORD Flags) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DIndexBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DIndexBuffer_SetPrivateData(This->wineD3DIndexBuffer, refguid, pData, SizeOfData, Flags); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetPrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DIndexBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DIndexBuffer_GetPrivateData(This->wineD3DIndexBuffer, refguid, pData, pSizeOfData); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DIndexBuffer8Impl_FreePrivateData(LPDIRECT3DINDEXBUFFER8 iface, REFGUID refguid) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DIndexBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DIndexBuffer_FreePrivateData(This->wineD3DIndexBuffer, refguid); + LeaveCriticalSection(&d3d8_cs); + return hr; } static DWORD WINAPI IDirect3DIndexBuffer8Impl_SetPriority(LPDIRECT3DINDEXBUFFER8 iface, DWORD PriorityNew) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; + DWORD ret; TRACE("(%p) Relay\n", This); - return IWineD3DIndexBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew); + + EnterCriticalSection(&d3d8_cs); + ret = IWineD3DIndexBuffer_SetPriority(This->wineD3DIndexBuffer, PriorityNew); + LeaveCriticalSection(&d3d8_cs); + return ret; } static DWORD WINAPI IDirect3DIndexBuffer8Impl_GetPriority(LPDIRECT3DINDEXBUFFER8 iface) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; + DWORD ret; TRACE("(%p) Relay\n", This); - return IWineD3DIndexBuffer_GetPriority(This->wineD3DIndexBuffer); + + EnterCriticalSection(&d3d8_cs); + ret = IWineD3DIndexBuffer_GetPriority(This->wineD3DIndexBuffer); + LeaveCriticalSection(&d3d8_cs); + return ret; } static void WINAPI IDirect3DIndexBuffer8Impl_PreLoad(LPDIRECT3DINDEXBUFFER8 iface) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; TRACE("(%p) Relay\n", This); + + EnterCriticalSection(&d3d8_cs); IWineD3DIndexBuffer_PreLoad(This->wineD3DIndexBuffer); + LeaveCriticalSection(&d3d8_cs); } static D3DRESOURCETYPE WINAPI IDirect3DIndexBuffer8Impl_GetType(LPDIRECT3DINDEXBUFFER8 iface) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; + D3DRESOURCETYPE type; TRACE("(%p) Relay\n", This); - return IWineD3DIndexBuffer_GetType(This->wineD3DIndexBuffer); + + EnterCriticalSection(&d3d8_cs); + type = IWineD3DIndexBuffer_GetType(This->wineD3DIndexBuffer); + LeaveCriticalSection(&d3d8_cs); + return type; } /* IDirect3DIndexBuffer8 Interface follow: */ static HRESULT WINAPI IDirect3DIndexBuffer8Impl_Lock(LPDIRECT3DINDEXBUFFER8 iface, UINT OffsetToLock, UINT SizeToLock, BYTE **ppbData, DWORD Flags) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DIndexBuffer_Lock(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, ppbData, Flags); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DIndexBuffer_Lock(This->wineD3DIndexBuffer, OffsetToLock, SizeToLock, ppbData, Flags); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DIndexBuffer8Impl_Unlock(LPDIRECT3DINDEXBUFFER8 iface) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DIndexBuffer_Unlock(This->wineD3DIndexBuffer); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DIndexBuffer_Unlock(This->wineD3DIndexBuffer); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DIndexBuffer8Impl_GetDesc(LPDIRECT3DINDEXBUFFER8 iface, D3DINDEXBUFFER_DESC *pDesc) { IDirect3DIndexBuffer8Impl *This = (IDirect3DIndexBuffer8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, (WINED3DINDEXBUFFER_DESC *) pDesc); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DIndexBuffer_GetDesc(This->wineD3DIndexBuffer, (WINED3DINDEXBUFFER_DESC *) pDesc); + LeaveCriticalSection(&d3d8_cs); + return hr; } diff --git a/dlls/d3d8/surface.c b/dlls/d3d8/surface.c index 4d2f9b41dcf..6ecd7af8c8f 100644 --- a/dlls/d3d8/surface.c +++ b/dlls/d3d8/surface.c @@ -76,7 +76,9 @@ static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) { if (This->parentDevice) IUnknown_Release(This->parentDevice); /* Implicit surfaces are destroyed with the device, not if refcount reaches 0. */ if (!This->isImplicit) { + EnterCriticalSection(&d3d8_cs); IWineD3DSurface_Release(This->wineD3DSurface); + LeaveCriticalSection(&d3d8_cs); HeapFree(GetProcessHeap(), 0, This); } } @@ -88,25 +90,46 @@ static ULONG WINAPI IDirect3DSurface8Impl_Release(LPDIRECT3DSURFACE8 iface) { /* IDirect3DSurface8 IDirect3DResource8 Interface follow: */ static HRESULT WINAPI IDirect3DSurface8Impl_GetDevice(LPDIRECT3DSURFACE8 iface, IDirect3DDevice8 **ppDevice) { IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; - return IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice); + HRESULT hr; + TRACE("(%p)->(%p)\n", This, ppDevice); + + EnterCriticalSection(&d3d8_cs); + hr = IDirect3DResource8Impl_GetDevice((LPDIRECT3DRESOURCE8) This, ppDevice); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DSurface8Impl_SetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid, CONST void *pData, DWORD SizeOfData, DWORD Flags) { IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DSurface_SetPrivateData(This->wineD3DSurface, refguid, pData, SizeOfData, Flags); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DSurface_SetPrivateData(This->wineD3DSurface, refguid, pData, SizeOfData, Flags); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DSurface8Impl_GetPrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid, void *pData, DWORD *pSizeOfData) { IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DSurface_GetPrivateData(This->wineD3DSurface, refguid, pData, pSizeOfData); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DSurface_GetPrivateData(This->wineD3DSurface, refguid, pData, pSizeOfData); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DSurface8Impl_FreePrivateData(LPDIRECT3DSURFACE8 iface, REFGUID refguid) { IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DSurface_FreePrivateData(This->wineD3DSurface, refguid); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DSurface_FreePrivateData(This->wineD3DSurface, refguid); + LeaveCriticalSection(&d3d8_cs); + return hr; } /* IDirect3DSurface8 Interface follow: */ @@ -127,6 +150,7 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetContainer(LPDIRECT3DSURFACE8 ifac static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3DSURFACE_DESC *pDesc) { IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; WINED3DSURFACE_DESC wined3ddesc; + HRESULT hr; TRACE("(%p) Relay\n", This); /* As d3d8 and d3d9 structures differ, pass in ptrs to where data needs to go */ @@ -140,14 +164,19 @@ static HRESULT WINAPI IDirect3DSurface8Impl_GetDesc(LPDIRECT3DSURFACE8 iface, D3 wined3ddesc.Width = &pDesc->Width; wined3ddesc.Height = &pDesc->Height; - return IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc); + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DSurface_GetDesc(This->wineD3DSurface, &wined3ddesc); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D3DLOCKED_RECT *pLockedRect, CONST RECT *pRect, DWORD Flags) { IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); TRACE("(%p) calling IWineD3DSurface_LockRect %p %p %p %d\n", This, This->wineD3DSurface, pLockedRect, pRect, Flags); + EnterCriticalSection(&d3d8_cs); if (pRect) { D3DSURFACE_DESC desc; IDirect3DSurface8_GetDesc(iface, &desc); @@ -159,17 +188,25 @@ static HRESULT WINAPI IDirect3DSurface8Impl_LockRect(LPDIRECT3DSURFACE8 iface, D || (pRect->right > desc.Width) || (pRect->bottom > desc.Height)) { WARN("Trying to lock an invalid rectangle, returning D3DERR_INVALIDCALL\n"); + LeaveCriticalSection(&d3d8_cs); return D3DERR_INVALIDCALL; } } - return IWineD3DSurface_LockRect(This->wineD3DSurface, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); + hr = IWineD3DSurface_LockRect(This->wineD3DSurface, (WINED3DLOCKED_RECT *) pLockedRect, pRect, Flags); + LeaveCriticalSection(&d3d8_cs); + return hr; } static HRESULT WINAPI IDirect3DSurface8Impl_UnlockRect(LPDIRECT3DSURFACE8 iface) { IDirect3DSurface8Impl *This = (IDirect3DSurface8Impl *)iface; + HRESULT hr; TRACE("(%p) Relay\n", This); - return IWineD3DSurface_UnlockRect(This->wineD3DSurface); + + EnterCriticalSection(&d3d8_cs); + hr = IWineD3DSurface_UnlockRect(This->wineD3DSurface); + LeaveCriticalSection(&d3d8_cs); + return hr; } const IDirect3DSurface8Vtbl Direct3DSurface8_Vtbl = diff --git a/dlls/dsound/propset.c b/dlls/dsound/propset.c index 7bb7f4f5c2b..4017f07be6c 100644 --- a/dlls/dsound/propset.c +++ b/dlls/dsound/propset.c @@ -200,6 +200,7 @@ HRESULT IKsBufferPropertySetImpl_Create( PIDSDRIVERPROPERTYSET ps = NULL; IKsBufferPropertySetImpl *iks; TRACE("(%p,%p)\n",dsb,piks); + *piks = NULL; if (!dsb->hwbuf) return DSERR_INVALIDPARAM; diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in index f1d5040d57d..d1089af6790 100644 --- a/dlls/gdiplus/Makefile.in +++ b/dlls/gdiplus/Makefile.in @@ -4,10 +4,12 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = gdiplus.dll IMPORTLIB = libgdiplus.$(IMPLIBEXT) -IMPORTS = gdi32 advapi32 kernel32 ntdll +IMPORTS = user32 gdi32 advapi32 kernel32 ntdll C_SRCS = \ - gdiplus.c + gdiplus.c \ + graphics.c \ + pen.c @MAKE_DLL_RULES@ diff --git a/dlls/gdiplus/gdiplus.c b/dlls/gdiplus/gdiplus.c index 2cb04a65d40..6b2683acf22 100644 --- a/dlls/gdiplus/gdiplus.c +++ b/dlls/gdiplus/gdiplus.c @@ -79,3 +79,17 @@ void WINGDIPAPI GdipFree(void* ptr) { HeapFree(GetProcessHeap(), 0, ptr); } + +COLORREF ARGB2COLORREF(ARGB color) +{ + /* + Packing of these color structures: + COLORREF: 00bbggrr + ARGB: aarrggbb + FIXME:doesn't handle alpha channel + */ + return (COLORREF) + ((color & 0x0000ff) << 16) + + (color & 0x00ff00) + + ((color & 0xff0000) >> 16); +} diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 99b56b86525..c80fbbb3fa8 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -81,8 +81,8 @@ @ stub GdipCreateFontFromLogfontA @ stub GdipCreateFontFromLogfontW @ stub GdipCreateFromHDC2 -@ stub GdipCreateFromHDC -@ stub GdipCreateFromHWND +@ stdcall GdipCreateFromHDC(long ptr) +@ stdcall GdipCreateFromHWND(long ptr) @ stub GdipCreateFromHWNDICM @ stub GdipCreateHBITMAPFromBitmap @ stub GdipCreateHICONFromBitmap @@ -111,7 +111,7 @@ @ stub GdipCreatePathGradientFromPath @ stub GdipCreatePathGradientI @ stub GdipCreatePathIter -@ stub GdipCreatePen1 +@ stdcall GdipCreatePen1(long long long ptr) @ stub GdipCreatePen2 @ stub GdipCreateRegion @ stub GdipCreateRegionHrgn @@ -132,11 +132,11 @@ @ stub GdipDeleteCustomLineCap @ stub GdipDeleteFont @ stub GdipDeleteFontFamily -@ stub GdipDeleteGraphics +@ stdcall GdipDeleteGraphics(ptr) @ stub GdipDeleteMatrix @ stub GdipDeletePath @ stub GdipDeletePathIter -@ stub GdipDeletePen +@ stdcall GdipDeletePen(ptr) @ stub GdipDeletePrivateFontCollection @ stub GdipDeleteRegion @ stub GdipDeleteStringFormat diff --git a/dlls/credui/credui.rc b/dlls/gdiplus/gdiplus_private.h similarity index 67% copy from dlls/credui/credui.rc copy to dlls/gdiplus/gdiplus_private.h index 3b48b396648..f6e238ae036 100644 --- a/dlls/credui/credui.rc +++ b/dlls/gdiplus/gdiplus_private.h @@ -1,7 +1,5 @@ /* - * Top level resource file for Credentials UI - * - * Copyright 2007 Robert Shearman (for CodeWeavers) + * Copyright (C) 2007 Google (Evan Stade) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -18,13 +16,28 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#ifndef __WINE_GP_PRIVATE_H_ +#define __WINE_GP_PRIVATE_H_ + #include "windef.h" #include "winbase.h" -#include "winuser.h" -#include "winnls.h" -#include "credui_resources.h" +#include "gdiplus.h" + +#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_ENDCAP_FLAT) + +COLORREF ARGB2COLORREF(ARGB color); + +struct GpPen{ + UINT style; + COLORREF color; + GpUnit unit; + REAL width; + HPEN gdipen; +}; + +struct GpGraphics{ + HDC hdc; + HWND hwnd; +}; -#include "credui_De.rc" -#include "credui_En.rc" -#include "credui_No.rc" -#include "credui_Pl.rc" +#endif diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c new file mode 100644 index 00000000000..37af0127560 --- /dev/null +++ b/dlls/gdiplus/graphics.c @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "wingdi.h" +#include "gdiplus.h" +#include "gdiplus_private.h" +#include "wine/debug.h" + +GpStatus WINGDIPAPI GdipCreateFromHDC(HDC hdc, GpGraphics **graphics) +{ + if(hdc == NULL) + return OutOfMemory; + + if(graphics == NULL) + return InvalidParameter; + + *graphics = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + sizeof(GpGraphics)); + (*graphics)->hdc = hdc; + (*graphics)->hwnd = NULL; + + return Ok; +} + +GpStatus WINGDIPAPI GdipCreateFromHWND(HWND hwnd, GpGraphics **graphics) +{ + GpStatus ret; + + if((ret = GdipCreateFromHDC(GetDC(hwnd), graphics)) != Ok) + return ret; + + (*graphics)->hwnd = hwnd; + + return Ok; +} + +GpStatus WINGDIPAPI GdipDeleteGraphics(GpGraphics *graphics) +{ + if(!graphics) return InvalidParameter; + if(graphics->hwnd) + ReleaseDC(graphics->hwnd, graphics->hdc); + + HeapFree(GetProcessHeap(), 0, graphics); + + return Ok; +} diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c new file mode 100644 index 00000000000..2128d3b89e8 --- /dev/null +++ b/dlls/gdiplus/pen.c @@ -0,0 +1,72 @@ +/* + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#include "windef.h" +#include "winbase.h" +#include "wingdi.h" +#include "gdiplus.h" +#include "gdiplus_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(gdiplus); + +GpStatus WINGDIPAPI GdipCreatePen1(ARGB color, FLOAT width, GpUnit unit, + GpPen **pen) +{ + LOGBRUSH lb; + GpPen *gp_pen; + + gp_pen = GdipAlloc(sizeof(GpPen)); + if(!pen) return OutOfMemory; + + gp_pen->style = GP_DEFAULT_PENSTYLE; + gp_pen->color = ARGB2COLORREF(color); + gp_pen->width = width; + gp_pen->unit = unit; + + /* FIXME: Currently only solid lines supported. */ + lb.lbStyle = BS_SOLID; + lb.lbColor = gp_pen->color; + lb.lbHatch = 0; + + if((gp_pen->unit == UnitWorld) || (gp_pen->unit == UnitPixel)) { + gp_pen->gdipen = ExtCreatePen(gp_pen->style, (INT) gp_pen->width, &lb, + 0, NULL); + } else { + FIXME("UnitWorld, UnitPixel only supported units"); + return NotImplemented; + } + + if(!gp_pen) + return GenericError; + + *pen = gp_pen; + + return Ok; +} + +GpStatus WINGDIPAPI GdipDeletePen(GpPen *pen) +{ + if(!pen) return InvalidParameter; + DeleteObject(pen->gdipen); + GdipFree(pen); + + return Ok; +} diff --git a/dlls/gdiplus/tests/Makefile.in b/dlls/gdiplus/tests/Makefile.in new file mode 100644 index 00000000000..8cb68102546 --- /dev/null +++ b/dlls/gdiplus/tests/Makefile.in @@ -0,0 +1,13 @@ +TOPSRCDIR = @top_srcdir@ +TOPOBJDIR = ../../.. +SRCDIR = @srcdir@ +VPATH = @srcdir@ +TESTDLL = gdiplus.dll +IMPORTS = gdiplus kernel32 + +CTESTS = \ + pen.c + +@MAKE_TEST_RULES@ + +@DEPENDENCIES@ # everything below this line is overwritten by make depend diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c new file mode 100644 index 00000000000..3615d9a3753 --- /dev/null +++ b/dlls/gdiplus/tests/pen.c @@ -0,0 +1,92 @@ +/* + * Unit test suite for pens (and init) + * + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include + +#include "windef.h" +#include "gdiplus.h" +#include "wine/test.h" + +#define expect(expected, got) ok(got == expected, "Expected %.8x, got %.8x\n", expected, got) + +static void test_startup(void) +{ + GpPen *pen; + Status status; + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + expect(Ok, status); + GdiplusShutdown(gdiplusToken); + + gdiplusStartupInput.GdiplusVersion = 2; + + status = GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + expect(UnsupportedGdiplusVersion, status); + GdiplusShutdown(gdiplusToken); + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + + todo_wine + expect(GdiplusNotInitialized, status); + + GdipDeletePen(pen); +} + +static void test_constructor_destructor(void) +{ + GpStatus status; + GpPen *pen = NULL; + + status = GdipCreatePen1((ARGB)0xffff00ff, 10.0f, UnitPixel, &pen); + expect(Ok, status); + ok(pen != NULL, "Expected pen to be initialized"); + + status = GdipDeletePen(NULL); + expect(InvalidParameter, status); + + status = GdipDeletePen(pen); + expect(Ok, status); +} + +START_TEST(pen) +{ + struct GdiplusStartupInput gdiplusStartupInput; + ULONG_PTR gdiplusToken; + + test_startup(); + + gdiplusStartupInput.GdiplusVersion = 1; + gdiplusStartupInput.DebugEventCallback = NULL; + gdiplusStartupInput.SuppressBackgroundThread = 0; + gdiplusStartupInput.SuppressExternalCodecs = 0; + + GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); + + test_constructor_destructor(); + + GdiplusShutdown(gdiplusToken); +} diff --git a/dlls/hlink/hlink_main.c b/dlls/hlink/hlink_main.c index 3a4632fe757..91ecb77dee9 100644 --- a/dlls/hlink/hlink_main.c +++ b/dlls/hlink/hlink_main.c @@ -33,8 +33,6 @@ #include "wine/debug.h" #include "wine/unicode.h" #include "hlink.h" - -#include "initguid.h" #include "hlguids.h" WINE_DEFAULT_DEBUG_CHANNEL(hlink); diff --git a/dlls/mshtml/editor.c b/dlls/mshtml/editor.c index d257c5f3a1f..b727e5502ee 100644 --- a/dlls/mshtml/editor.c +++ b/dlls/mshtml/editor.c @@ -364,6 +364,15 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size) if(!nsselection) return; + nsISelection_GetRangeCount(nsselection, &range_cnt); + if(range_cnt != 1) { + FIXME("range_cnt %d not supprted\n", range_cnt); + if(!range_cnt) { + nsISelection_Release(nsselection); + return; + } + } + nsres = nsIWebNavigation_GetDocument(This->nscontainer->navigation, &nsdoc); if(NS_FAILED(nsres)) return; @@ -372,10 +381,6 @@ static void set_font_size(HTMLDocument *This, LPCWSTR size) nsAString_Init(&size_str, wszSize); nsAString_Init(&val_str, size); - nsISelection_GetRangeCount(nsselection, &range_cnt); - if(range_cnt != 1) - FIXME("range_cnt %d not supprted\n", range_cnt); - nsIDOMDocument_CreateElement(nsdoc, &font_str, &elem); nsIDOMElement_SetAttribute(elem, &size_str, &val_str); diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index a009cc8a5db..a606dace389 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -159,6 +159,7 @@ static ULONG WINAPI HTMLDocument_Release(IHTMLDocument2 *iface) IOleDocumentView_SetInPlaceSite(DOCVIEW(This), NULL); set_document_bscallback(This, NULL); + set_current_mon(This, NULL); if(This->tooltips_hwnd) DestroyWindow(This->tooltips_hwnd); @@ -507,8 +508,15 @@ static HRESULT WINAPI HTMLDocument_put_URL(IHTMLDocument2 *iface, BSTR v) static HRESULT WINAPI HTMLDocument_get_URL(IHTMLDocument2 *iface, BSTR *p) { - FIXME("(%p)->(%p)\n", iface, p); - return E_NOTIMPL; + HTMLDocument *This = HTMLDOC_THIS(iface); + + static const WCHAR about_blank_url[] = + {'a','b','o','u','t',':','b','l','a','n','k',0}; + + TRACE("(%p)->(%p)\n", iface, p); + + *p = SysAllocString(This->url ? This->url : about_blank_url); + return S_OK; } static HRESULT WINAPI HTMLDocument_put_domain(IHTMLDocument2 *iface, BSTR v) diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index 74ee748bccb..562373677e6 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -101,6 +101,8 @@ struct HTMLDocument { IOleInPlaceFrame *frame; BSCallback *bscallback; + IMoniker *mon; + BSTR url; HWND hwnd; HWND tooltips_hwnd; @@ -353,6 +355,7 @@ BSCallback *create_bscallback(IMoniker*); HRESULT start_binding(BSCallback*); HRESULT load_stream(BSCallback*,IStream*); void set_document_bscallback(HTMLDocument*,BSCallback*); +void set_current_mon(HTMLDocument*,IMoniker*); IHlink *Hlink_Create(void); IHTMLSelectionObject *HTMLSelectionObject_Create(nsISelection*); diff --git a/dlls/mshtml/navigate.c b/dlls/mshtml/navigate.c index 2303baf17ce..459cc63e30d 100644 --- a/dlls/mshtml/navigate.c +++ b/dlls/mshtml/navigate.c @@ -744,6 +744,7 @@ void hlink_frame_navigate(HTMLDocument *doc, IHlinkFrame *hlink_frame, IBindCtx *bindctx; IMoniker *mon; IHlink *hlink; + HRESULT hr; callback = create_bscallback(NULL); @@ -754,24 +755,35 @@ void hlink_frame_navigate(HTMLDocument *doc, IHlinkFrame *hlink_frame, debugstr_an(callback->post_data, callback->post_data_len)); } - CreateAsyncBindCtx(0, STATUSCLB(callback), NULL, &bindctx); + hr = CreateAsyncBindCtx(0, STATUSCLB(callback), NULL, &bindctx); + if (FAILED(hr)) { + IBindStatusCallback_Release(STATUSCLB(callback)); + return; + } hlink = Hlink_Create(); + if (!hlink) { + IBindCtx_Release(bindctx); + IBindStatusCallback_Release(STATUSCLB(callback)); + return; + } - CreateURLMoniker(NULL, uri, &mon); - IHlink_SetMonikerReference(hlink, 0, mon, NULL); + hr = CreateURLMoniker(NULL, uri, &mon); + if (SUCCEEDED(hr)) { + IHlink_SetMonikerReference(hlink, 0, mon, NULL); - if(hlnf & HLNF_OPENINNEWWINDOW) { - static const WCHAR wszBlank[] = {'_','b','l','a','n','k',0}; - IHlink_SetTargetFrameName(hlink, wszBlank); /* FIXME */ - } + if(hlnf & HLNF_OPENINNEWWINDOW) { + static const WCHAR wszBlank[] = {'_','b','l','a','n','k',0}; + IHlink_SetTargetFrameName(hlink, wszBlank); /* FIXME */ + } + + IHlinkFrame_Navigate(hlink_frame, hlnf, bindctx, STATUSCLB(callback), hlink); - IHlinkFrame_Navigate(hlink_frame, hlnf, bindctx, STATUSCLB(callback), hlink); + IMoniker_Release(mon); + } IBindCtx_Release(bindctx); IBindStatusCallback_Release(STATUSCLB(callback)); - IMoniker_Release(mon); - } HRESULT start_binding(BSCallback *bscallback) diff --git a/dlls/mshtml/nsio.c b/dlls/mshtml/nsio.c index 399eb6e0cfc..1b50d2e867a 100644 --- a/dlls/mshtml/nsio.c +++ b/dlls/mshtml/nsio.c @@ -605,15 +605,45 @@ static BOOL do_load_from_moniker_hack(nsChannel *This) return FALSE; } +static HRESULT create_mon_for_nschannel(nsChannel *channel, IMoniker **mon) +{ + nsIWineURI *wine_uri; + LPCWSTR wine_url; + nsresult nsres; + HRESULT hres; + + if(!channel->original_uri) { + ERR("original_uri == NULL\n"); + return E_FAIL; + } + + nsres = nsIURI_QueryInterface(channel->original_uri, &IID_nsIWineURI, (void**)&wine_uri); + if(NS_FAILED(nsres)) { + ERR("Could not get nsIWineURI: %08x\n", nsres); + return E_FAIL; + } + + nsIWineURI_GetWineURL(wine_uri, &wine_url); + nsIWineURI_Release(wine_uri); + if(!wine_url) { + TRACE("wine_url == NULL\n"); + return E_FAIL; + } + + hres = CreateURLMoniker(NULL, wine_url, mon); + if(FAILED(hres)) + WARN("CreateURLMonikrer failed: %08x\n", hres); + + return hres; +} + static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListener *aListener, nsISupports *aContext) { nsChannel *This = NSCHANNEL_THIS(iface); BSCallback *bscallback; - nsIWineURI *wine_uri; - IMoniker *mon; + IMoniker *mon = NULL; PRBool is_doc_uri; - LPCWSTR wine_url; nsresult nsres; task_t *task; HRESULT hres; @@ -660,6 +690,11 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen return This->channel ? nsIChannel_AsyncOpen(This->channel, aListener, aContext) : NS_ERROR_UNEXPECTED; + + hres = create_mon_for_nschannel(This, &mon); + if(FAILED(hres)) + return NS_ERROR_UNEXPECTED; + set_current_mon(container->doc, mon); } } @@ -685,6 +720,9 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen nsres = nsIChannel_AsyncOpen(This->channel, aListener, aContext); + if(mon) + IMoniker_Release(mon); + if(NS_FAILED(nsres) && (This->load_flags & LOAD_INITIAL_DOCUMENT_URI)) return WINE_NS_LOAD_FROM_MONIKER; return nsres; @@ -692,28 +730,9 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen TRACE("channel == NULL\n"); - if(!This->original_uri) { - ERR("original_uri == NULL\n"); - return NS_ERROR_UNEXPECTED; - } - - nsres = nsIURI_QueryInterface(This->original_uri, &IID_nsIWineURI, (void**)&wine_uri); - if(NS_FAILED(nsres)) { - ERR("Could not get nsIWineURI: %08x\n", nsres); - return NS_ERROR_UNEXPECTED; - } - - nsIWineURI_GetWineURL(wine_uri, &wine_url); - if(!wine_url) { - TRACE("wine_url == NULL\n"); + hres = create_mon_for_nschannel(This, &mon); + if(FAILED(hres)) return NS_ERROR_UNEXPECTED; - } - - hres = CreateURLMoniker(NULL, wine_url, &mon); - if(FAILED(hres)) { - WARN("CreateURLMonikrer failed: %08x\n", hres); - return NS_ERROR_UNEXPECTED; - } bscallback = create_bscallback(mon); IMoniker_Release(mon); diff --git a/dlls/mshtml/olecmd.c b/dlls/mshtml/olecmd.c index 288a12b21d1..c481e6afe34 100644 --- a/dlls/mshtml/olecmd.c +++ b/dlls/mshtml/olecmd.c @@ -546,6 +546,22 @@ static HRESULT exec_editmode(HTMLDocument *This, DWORD cmdexecopt, VARIANT *in, if(This->frame) IOleInPlaceFrame_SetStatusText(This->frame, NULL); + if(This->client) { + IOleCommandTarget *cmdtrg; + + hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, + (void**)&cmdtrg); + if(SUCCEEDED(hres)) { + VARIANT var; + + V_VT(&var) = VT_I4; + V_I4(&var) = 0; + IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL); + + IOleCommandTarget_Release(cmdtrg); + } + } + if(This->hostui) { DOCHOSTUIINFO hostinfo; diff --git a/dlls/mshtml/persist.c b/dlls/mshtml/persist.c index 13c07d44030..58ca42229f0 100644 --- a/dlls/mshtml/persist.c +++ b/dlls/mshtml/persist.c @@ -113,6 +113,31 @@ static nsIInputStream *get_post_data_stream(IBindCtx *bctx) return ret; } +void set_current_mon(HTMLDocument *This, IMoniker *mon) +{ + HRESULT hres; + + if(This->mon) { + IMoniker_Release(This->mon); + This->mon = NULL; + } + + if(This->url) { + SysFreeString(This->url); + This->url = NULL; + } + + if(!mon) + return; + + IMoniker_AddRef(mon); + This->mon = mon; + + hres = IMoniker_GetDisplayName(mon, NULL, NULL, &This->url); + if(FAILED(hres)) + WARN("GetDisplayName failed: %08x\n", hres); +} + static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BOOL *bind_complete) { BSCallback *bscallback; @@ -165,24 +190,11 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO TRACE("got url: %s\n", debugstr_w(url)); - if(This->client) { - IOleCommandTarget *cmdtrg = NULL; - - hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, - (void**)&cmdtrg); - if(SUCCEEDED(hres)) { - VARIANT var; - - V_VT(&var) = VT_I4; - V_I4(&var) = 0; - IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL); - - IOleCommandTarget_Release(cmdtrg); - } - } + set_current_mon(This, mon); if(This->client) { VARIANT silent, offline; + IOleCommandTarget *cmdtrg = NULL; hres = get_client_disp_property(This->client, DISPID_AMBIENT_SILENT, &silent); if(SUCCEEDED(hres)) { @@ -200,6 +212,18 @@ static HRESULT set_moniker(HTMLDocument *This, IMoniker *mon, IBindCtx *pibc, BO else if(V_BOOL(&silent)) FIXME("offline == true\n"); } + + hres = IOleClientSite_QueryInterface(This->client, &IID_IOleCommandTarget, + (void**)&cmdtrg); + if(SUCCEEDED(hres)) { + VARIANT var; + + V_VT(&var) = VT_I4; + V_I4(&var) = 0; + IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL); + + IOleCommandTarget_Release(cmdtrg); + } } bscallback = create_bscallback(mon); @@ -376,8 +400,15 @@ static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoni static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName) { HTMLDocument *This = PERSISTMON_THIS(iface); - FIXME("(%p)->(%p)\n", This, ppimkName); - return E_NOTIMPL; + + TRACE("(%p)->(%p)\n", This, ppimkName); + + if(!This->mon) + return E_UNEXPECTED; + + IMoniker_AddRef(This->mon); + *ppimkName = This->mon; + return S_OK; } static const IPersistMonikerVtbl PersistMonikerVtbl = { @@ -658,4 +689,6 @@ void HTMLDocument_Persist_Init(HTMLDocument *This) This->lpPersistStreamInitVtbl = &PersistStreamInitVtbl; This->bscallback = NULL; + This->mon = NULL; + This->url = NULL; } diff --git a/dlls/mshtml/tests/htmldoc.c b/dlls/mshtml/tests/htmldoc.c index 61966106b0d..619d36eb7c7 100644 --- a/dlls/mshtml/tests/htmldoc.c +++ b/dlls/mshtml/tests/htmldoc.c @@ -146,12 +146,15 @@ static const char html_page[] = static const char css_data[] = "body {color: red}"; static const WCHAR doc_url[] = {'w','i','n','e','t','e','s','t',':','d','o','c',0}; +static const WCHAR about_blank_url[] = {'a','b','o','u','t',':','b','l','a','n','k',0}; static HRESULT QueryInterface(REFIID riid, void **ppv); static void test_readyState(IUnknown*); static void test_MSHTML_QueryStatus(IUnknown*,DWORD); static BOOL nogecko = FALSE; +static void test_GetCurMoniker(IUnknown*,IMoniker*,LPCWSTR); + static const WCHAR wszTimesNewRoman[] = {'T','i','m','e','s',' ','N','e','w',' ','R','o','m','a','n',0}; static const WCHAR wszArial[] = @@ -1852,6 +1855,12 @@ static HRESULT WINAPI OleCommandTarget_Exec(IOleCommandTarget *iface, const GUID switch(nCmdID) { case 37: CHECK_EXPECT2(Exec_ShellDocView_37); + + if(load_from_stream) + test_GetCurMoniker(doc_unk, NULL, about_blank_url); + else if(!editmode) + test_GetCurMoniker(doc_unk, &Moniker, NULL); + ok(pvaOut == NULL, "pvaOut=%p, expected NULL\n", pvaOut); ok(pvaIn != NULL, "pvaIn == NULL\n"); if(pvaIn) { @@ -2178,6 +2187,70 @@ static void test_ConnectionPointContainer(IUnknown *unk) IConnectionPointContainer_Release(container); } +static void test_GetCurMoniker(IUnknown *unk, IMoniker *exmon, LPCWSTR exurl) +{ + IHTMLDocument2 *doc; + IPersistMoniker *permon; + IMoniker *mon = (void*)0xdeadbeef; + BSTR doc_url = (void*)0xdeadbeef; + HRESULT hres; + + hres = IUnknown_QueryInterface(unk, &IID_IPersistMoniker, (void**)&permon); + ok(hres == S_OK, "QueryInterface(IID_IPersistMoniker) failed: %08x\n", hres); + if(FAILED(hres)) + return; + + hres = IUnknown_QueryInterface(unk, &IID_IHTMLDocument2, (void**)&doc); + ok(hres == S_OK, "QueryInterface(IID_IHTMLDocument2) failed: %08x\n", hres); + + hres = IHTMLDocument2_get_URL(doc, &doc_url); + ok(hres == S_OK, "get_URL failed: %08x\n", hres); + + hres = IPersistMoniker_GetCurMoniker(permon, &mon); + IPersistMoniker_Release(permon); + + if(exmon) { + BSTR url; + BOOL exb = expect_GetDisplayName; + BOOL clb = called_GetDisplayName; + + ok(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres); + ok(mon == exmon, "mon(%p) != exmon(%p)\n", mon, exmon); + + SET_EXPECT(GetDisplayName); + hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url); + ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres); + CHECK_CALLED(GetDisplayName); + expect_GetDisplayName = exb; + called_GetDisplayName = clb; + + SysFreeString(url); + ok(!lstrcmpW(url, doc_url), "url != doc_url\n"); + }else if(exurl) { + BSTR url; + + ok(hres == S_OK, "GetCurrentMoniker failed: %08x\n", hres); + + hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url); + ok(hres == S_OK, "GetDisplayName failed: %08x\n", hres); + + ok(!lstrcmpW(url, exurl), "unexpected url\n"); + ok(!lstrcmpW(url, doc_url), "url != doc_url\n"); + + SysFreeString(url); + }else { + ok(hres == E_UNEXPECTED, + "GetCurrentMoniker failed: %08x, expected E_UNEXPECTED\n", hres); + ok(mon == (IMoniker*)0xdeadbeef, "mon=%p\n", mon); + ok(!lstrcmpW(doc_url, about_blank_url), "doc_url is not about:blank\n"); + } + + SysFreeString(doc_url); + IHTMLDocument_Release(doc); + if(mon && mon != (void*)0xdeadbeef) + IMoniker_Release(mon); +} + static void test_Load(IPersistMoniker *persist) { IBindCtx *bind; @@ -2258,6 +2331,8 @@ static void test_Load(IPersistMoniker *persist) set_clientsite = container_locked = TRUE; + test_GetCurMoniker((IUnknown*)persist, &Moniker, NULL); + IBindCtx_Release(bind); test_readyState((IUnknown*)persist); @@ -2585,6 +2660,8 @@ static void test_exec_editmode(IUnknown *unk) if(FAILED(hres)) return; + editmode = TRUE; + SET_EXPECT(SetStatusText); SET_EXPECT(Exec_ShellDocView_37); SET_EXPECT(GetHostInfo); @@ -2609,8 +2686,6 @@ static void test_exec_editmode(IUnknown *unk) IOleCommandTarget_Release(cmdtrg); - editmode = TRUE; - hres = IOleCommandTarget_Exec(cmdtrg, &CGID_MSHTML, IDM_EDITMODE, OLECMDEXECOPT_DODEFAULT, NULL, NULL); ok(hres == S_OK, "Exec failed: %08x\n", hres); @@ -3145,6 +3220,7 @@ static void test_StreamLoad(IUnknown *unk) CHECK_CALLED(Read); test_timer(EXPECT_SETTITLE); + test_GetCurMoniker(unk, NULL, about_blank_url); IPersistStreamInit_Release(init); } @@ -3190,6 +3266,7 @@ static void test_HTMLDocument(enum load_state_t ls) test_IsDirty(unk, S_FALSE); test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED); test_ConnectionPointContainer(unk); + test_GetCurMoniker(unk, NULL, NULL); test_Persist(unk); if(load_state == LD_NO) test_OnAmbientPropertyChange2(unk); @@ -3200,8 +3277,10 @@ static void test_HTMLDocument(enum load_state_t ls) return; } - if(load_state == LD_LOADING) + if(load_state == LD_LOADING) { test_download(FALSE, TRUE); + test_GetCurMoniker(unk, &Moniker, NULL); + } test_MSHTML_QueryStatus(unk, OLECMDF_SUPPORTED); test_OleCommandTarget_fail(unk); @@ -3241,6 +3320,7 @@ static void test_HTMLDocument(enum load_state_t ls) test_CloseView(); test_Close(unk, TRUE); test_OnAmbientPropertyChange2(unk); + test_GetCurMoniker(unk, load_state == LD_NO ? NULL : &Moniker, NULL); if(view) IOleDocumentView_Release(view); @@ -3270,6 +3350,7 @@ static void test_HTMLDocument_hlink(void) doc_unk = unk; test_ConnectionPointContainer(unk); + test_GetCurMoniker(unk, NULL, NULL); test_Persist(unk); test_Navigate(unk); @@ -3282,6 +3363,7 @@ static void test_HTMLDocument_hlink(void) test_InPlaceDeactivate(unk, TRUE); test_Close(unk, FALSE); test_IsDirty(unk, S_FALSE); + test_GetCurMoniker(unk, &Moniker, NULL); if(view) IOleDocumentView_Release(view); @@ -3320,6 +3402,7 @@ static void test_HTMLDocument_StreamLoad(void) IOleObject_Release(oleobj); + test_GetCurMoniker(unk, NULL, NULL); test_StreamLoad(unk); test_download(TRUE, FALSE); diff --git a/dlls/msi/format.c b/dlls/msi/format.c index 1bcfa6eb536..4b5edc4ba20 100644 --- a/dlls/msi/format.c +++ b/dlls/msi/format.c @@ -45,7 +45,7 @@ static DWORD deformat_string_internal(MSIPACKAGE *package, LPCWSTR ptr, BOOL* in_group); -static LPWSTR build_default_format(MSIRECORD* record) +static LPWSTR build_default_format(const MSIRECORD* record) { int i; int count; diff --git a/dlls/ntdll/misc.c b/dlls/ntdll/misc.c index 2f63ebb44be..d5e8c1d99fb 100644 --- a/dlls/ntdll/misc.c +++ b/dlls/ntdll/misc.c @@ -149,7 +149,7 @@ int CDECL NTDLL_abs( int i ) /********************************************************************* * labs (NTDLL.@) */ -long CDECL NTDLL_labs( long i ) +LONG CDECL NTDLL_labs( LONG i ) { return labs( i ); } diff --git a/dlls/ntdll/string.c b/dlls/ntdll/string.c index ae56aae468b..ebfa6fb19fa 100644 --- a/dlls/ntdll/string.c +++ b/dlls/ntdll/string.c @@ -449,7 +449,7 @@ int __cdecl NTDLL_isxdigit( int c ) /********************************************************************* * strtol (NTDLL.@) */ -long __cdecl NTDLL_strtol( const char *nptr, char **endptr, int base ) +LONG __cdecl NTDLL_strtol( const char *nptr, char **endptr, int base ) { return strtol( nptr, endptr, base ); } @@ -458,7 +458,7 @@ long __cdecl NTDLL_strtol( const char *nptr, char **endptr, int base ) /********************************************************************* * strtoul (NTDLL.@) */ -unsigned long __cdecl NTDLL_strtoul( const char *nptr, char **endptr, int base ) +ULONG __cdecl NTDLL_strtoul( const char *nptr, char **endptr, int base ) { return strtoul( nptr, endptr, base ); } @@ -476,7 +476,7 @@ int __cdecl NTDLL_atoi( const char *nptr ) /********************************************************************* * atol (NTDLL.@) */ -long __cdecl NTDLL_atol( const char *nptr ) +LONG __cdecl NTDLL_atol( const char *nptr ) { return atol( nptr ); } @@ -497,7 +497,7 @@ long __cdecl NTDLL_atol( const char *nptr ) * - If str is NULL it crashes, as the native function does. */ char * __cdecl _ultoa( - unsigned long value, /* [I] Value to be converted */ + ULONG value, /* [I] Value to be converted */ char *str, /* [O] Destination for the converted value */ int radix) /* [I] Number base for conversion */ { @@ -539,11 +539,11 @@ char * __cdecl _ultoa( * - If str is NULL it crashes, as the native function does. */ char * __cdecl _ltoa( - long value, /* [I] Value to be converted */ + LONG value, /* [I] Value to be converted */ char *str, /* [O] Destination for the converted value */ int radix) /* [I] Number base for conversion */ { - unsigned long val; + ULONG val; int negative; char buffer[33]; char *pos; diff --git a/dlls/ntdll/wcstring.c b/dlls/ntdll/wcstring.c index 23fc5e86c5a..9d1dc4dcd3a 100644 --- a/dlls/ntdll/wcstring.c +++ b/dlls/ntdll/wcstring.c @@ -278,7 +278,7 @@ INT __cdecl NTDLL_mbstowcs( LPWSTR dst, LPCSTR src, INT n ) /********************************************************************* * wcstol (NTDLL.@) */ -long __cdecl NTDLL_wcstol(LPCWSTR s,LPWSTR *end,INT base) +LONG __cdecl NTDLL_wcstol(LPCWSTR s, LPWSTR *end, INT base) { return strtolW( s, end, base ); } @@ -287,7 +287,7 @@ long __cdecl NTDLL_wcstol(LPCWSTR s,LPWSTR *end,INT base) /********************************************************************* * wcstoul (NTDLL.@) */ -unsigned long __cdecl NTDLL_wcstoul(LPCWSTR s,LPWSTR *end,INT base) +ULONG __cdecl NTDLL_wcstoul(LPCWSTR s, LPWSTR *end, INT base) { return strtoulW( s, end, base ); } @@ -392,7 +392,7 @@ INT __cdecl NTDLL_iswxdigit( WCHAR wc ) * If str is NULL it just returns NULL. */ LPWSTR __cdecl _ultow( - unsigned long value, /* [I] Value to be converted */ + ULONG value, /* [I] Value to be converted */ LPWSTR str, /* [O] Destination for the converted value */ INT radix) /* [I] Number base for conversion */ { @@ -436,11 +436,11 @@ LPWSTR __cdecl _ultow( * If str is NULL it just returns NULL. */ LPWSTR __cdecl _ltow( - long value, /* [I] Value to be converted */ + LONG value, /* [I] Value to be converted */ LPWSTR str, /* [O] Destination for the converted value */ INT radix) /* [I] Number base for conversion */ { - unsigned long val; + ULONG val; int negative; WCHAR buffer[33]; PWCHAR pos; diff --git a/dlls/rpcrt4/tests/server.c b/dlls/rpcrt4/tests/server.c index 76d6f013c2c..b65dc91c753 100644 --- a/dlls/rpcrt4/tests/server.c +++ b/dlls/rpcrt4/tests/server.c @@ -210,6 +210,21 @@ s_sum_cs(cs_t *cs) return s_sum_conf_array(cs->ca, cs->n); } +int +s_sum_cps(cps_t *cps) +{ + int sum = 0; + int i; + + for (i = 0; i < *cps->pn; ++i) + sum += cps->ca1[i]; + + for (i = 0; i < 2 * cps->n; ++i) + sum += cps->ca2[i]; + + return sum; +} + void s_stop(void) { @@ -393,7 +408,9 @@ array_tests(void) }; static int c[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9}; static vector_t vs[2] = {{1, -2, 3}, {4, -5, -6}}; + cps_t cps; cs_t *cs; + int n; ok(sum_fixed_int_3d(m) == 4116, "RPC sum_fixed_int_3d\n"); @@ -417,6 +434,13 @@ array_tests(void) cs->ca[4] = -4; ok(sum_cs(cs) == 1, "RPC sum_cs\n"); HeapFree(GetProcessHeap(), 0, cs); + + n = 5; + cps.pn = &n; + cps.ca1 = &c[2]; + cps.n = 3; + cps.ca2 = &c[3]; + ok(sum_cps(&cps) == 53, "RPC sum_cps\n"); } static void diff --git a/dlls/rpcrt4/tests/server.idl b/dlls/rpcrt4/tests/server.idl index 213a8831d66..a7b3df7c4f9 100644 --- a/dlls/rpcrt4/tests/server.idl +++ b/dlls/rpcrt4/tests/server.idl @@ -119,7 +119,16 @@ interface IServer [size_is(n)] int ca[]; } cs_t; + typedef struct + { + int *pn; + [size_is(*pn)] int *ca1; + [size_is(n * 2)] int *ca2; + int n; + } cps_t; + int sum_cs(cs_t *cs); + int sum_cps(cps_t *cps); void stop(void); } diff --git a/dlls/shell32/shell32_En.rc b/dlls/shell32/shell32_En.rc index ca902c8de7a..594191784a6 100644 --- a/dlls/shell32/shell32_En.rc +++ b/dlls/shell32/shell32_En.rc @@ -16,8 +16,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "shresdef.h" - LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT MENU_001 MENU DISCARDABLE diff --git a/dlls/shell32/shell32_Ko.rc b/dlls/shell32/shell32_Ko.rc index 89ae3670d54..eb07c53e66f 100644 --- a/dlls/shell32/shell32_Ko.rc +++ b/dlls/shell32/shell32_Ko.rc @@ -105,6 +105,26 @@ WS_BORDER | WS_TABSTOP, 4, 40, 180, 120 } + +SHNEWBRSFORFOLDER_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 15, 40, 218, 196 +STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU | DS_MODALFRAME | DS_SETFONT | DS_3DLOOK +CAPTION "Æú´õ Ž»ö" +FONT 8, "MS Shell Dlg" +{ +LTEXT "", IDD_TITLE, 10, 8, 198, 24 +LTEXT "", IDD_STATUS, 10, 25, 198, 12 +LTEXT "Æú´õ:", IDD_FOLDER, 10, 156, 40, 12 +CONTROL "", IDD_TREEVIEW, "SysTreeView32", +TVS_HASBUTTONS | TVS_HASLINES | TVS_LINESATROOT | +WS_BORDER | WS_TABSTOP, +12, 38, 194, 105 +EDITTEXT IDD_FOLDERTEXT, 46, 150, 160, 14, WS_BORDER | WS_GROUP | WS_TABSTOP +PUSHBUTTON "»õ Æú´õ ¸¸µé±â(&M)", IDD_MAKENEWFOLDER, 12, 174, 70, 14, WS_GROUP | WS_TABSTOP +DEFPUSHBUTTON "È®ÀÎ", IDOK, 102, 174, 50, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP +PUSHBUTTON "Ãë¼Ò", IDCANCEL, 156, 174, 50, 14, WS_GROUP | WS_TABSTOP +} + + SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 15, 40, 210, 152 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU CAPTION "%s Á¤º¸" diff --git a/dlls/shell32/xdg.c b/dlls/shell32/xdg.c index 6521232ae4f..108d92abc19 100644 --- a/dlls/shell32/xdg.c +++ b/dlls/shell32/xdg.c @@ -113,7 +113,7 @@ static char *load_path(int path_id) ret = SHAlloc(strlen(paths[path_id].default_value)+1); if (ret != NULL) - lstrcpyA(ret, env); + lstrcpyA(ret, paths[path_id].default_value); return ret; } diff --git a/dlls/uuid/uuid.c b/dlls/uuid/uuid.c index 5ee4074edd8..4e9be905de0 100644 --- a/dlls/uuid/uuid.c +++ b/dlls/uuid/uuid.c @@ -67,6 +67,7 @@ DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0); #include "indexsrv.h" #include "htiframe.h" #include "urlhist.h" +#include "hlguids.h" /* FIXME: cguids declares GUIDs but does not define their values */ diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9d289f96d51..008e0bd865e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -704,7 +704,7 @@ static HRESULT WINAPI IWineD3DDeviceImpl_CreateSurface(IWineD3DDevice *iface, U object->pow2Height = pow2Height; /* Flags */ - object->Flags = SFLAG_DYNLOCK; + object->Flags = 0; object->Flags |= (pow2Width != Width || pow2Height != Height) ? SFLAG_NONPOW2 : 0; object->Flags |= Discard ? SFLAG_DISCARD : 0; object->Flags |= (WINED3DFMT_D16_LOCKABLE == Format) ? SFLAG_LOCKABLE : 0; diff --git a/dlls/winmm/playsound.c b/dlls/winmm/playsound.c index a048b51a241..96d3249a9aa 100644 --- a/dlls/winmm/playsound.c +++ b/dlls/winmm/playsound.c @@ -45,6 +45,7 @@ typedef struct tagWINE_PLAYSOUND HMODULE hMod; DWORD fdwSound; HANDLE hThread; + HWAVEOUT hWave; struct tagWINE_PLAYSOUND* lpNext; } WINE_PLAYSOUND; @@ -268,7 +269,6 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg) MMCKINFO ckMainRIFF; MMCKINFO mmckInfo; LPWAVEFORMATEX lpWaveFormat = NULL; - HWAVEOUT hWave = 0; LPWAVEHDR waveHdr = NULL; INT count, bufsize, left, index; struct playsound_data s; @@ -367,7 +367,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg) s.hEvent = CreateEventW(NULL, FALSE, FALSE, NULL); - if (waveOutOpen(&hWave, WAVE_MAPPER, lpWaveFormat, (DWORD)PlaySound_Callback, + if (waveOutOpen(&wps->hWave, WAVE_MAPPER, lpWaveFormat, (DWORD)PlaySound_Callback, (DWORD)&s, CALLBACK_FUNCTION) != MMSYSERR_NOERROR) goto errCleanUp; @@ -381,8 +381,8 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg) waveHdr[0].dwLoops = waveHdr[1].dwLoops = 0L; waveHdr[0].dwFlags = waveHdr[1].dwFlags = 0L; waveHdr[0].dwBufferLength = waveHdr[1].dwBufferLength = bufsize; - if (waveOutPrepareHeader(hWave, &waveHdr[0], sizeof(WAVEHDR)) || - waveOutPrepareHeader(hWave, &waveHdr[1], sizeof(WAVEHDR))) { + if (waveOutPrepareHeader(wps->hWave, &waveHdr[0], sizeof(WAVEHDR)) || + waveOutPrepareHeader(wps->hWave, &waveHdr[1], sizeof(WAVEHDR))) { goto errCleanUp; } @@ -405,7 +405,7 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg) left -= count; waveHdr[index].dwBufferLength = count; waveHdr[index].dwFlags &= ~WHDR_DONE; - if (waveOutWrite(hWave, &waveHdr[index], sizeof(WAVEHDR)) == MMSYSERR_NOERROR) { + if (waveOutWrite(wps->hWave, &waveHdr[index], sizeof(WAVEHDR)) == MMSYSERR_NOERROR) { index ^= 1; PlaySound_WaitDone(&s); } @@ -415,17 +415,17 @@ static DWORD WINAPI proc_PlaySound(LPVOID arg) } while (wps->bLoop); PlaySound_WaitDone(&s); /* for last buffer */ - waveOutReset(hWave); + waveOutReset(wps->hWave); - waveOutUnprepareHeader(hWave, &waveHdr[0], sizeof(WAVEHDR)); - waveOutUnprepareHeader(hWave, &waveHdr[1], sizeof(WAVEHDR)); + waveOutUnprepareHeader(wps->hWave, &waveHdr[0], sizeof(WAVEHDR)); + waveOutUnprepareHeader(wps->hWave, &waveHdr[1], sizeof(WAVEHDR)); errCleanUp: TRACE("Done playing=%s => %s!\n", debugstr_w(wps->pszSound), bRet ? "ok" : "ko"); CloseHandle(s.hEvent); HeapFree(GetProcessHeap(), 0, waveHdr); HeapFree(GetProcessHeap(), 0, lpWaveFormat); - if (hWave) while (waveOutClose(hWave) == WAVERR_STILLPLAYING) Sleep(100); + if (wps->hWave) while (waveOutClose(wps->hWave) == WAVERR_STILLPLAYING) Sleep(100); if (hmmio) mmioClose(hmmio, 0); PlaySound_Free(wps); @@ -464,6 +464,7 @@ static BOOL MULTIMEDIA_PlaySound(const void* pszSound, HMODULE hmod, DWORD fdwSo * NULL... as of today, we stop all playing instances */ SetEvent(psStopEvent); + waveOutReset(PlaySoundList->hWave); LeaveCriticalSection(&WINMM_cs); WaitForSingleObject(psLastEvent, INFINITE); EnterCriticalSection(&WINMM_cs); diff --git a/dlls/winmm/time.c b/dlls/winmm/time.c index 211ca502e88..827f87a9acd 100644 --- a/dlls/winmm/time.c +++ b/dlls/winmm/time.c @@ -45,11 +45,13 @@ #include "winemm.h" +#include "wine/list.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(mmtime); typedef struct tagWINE_TIMERENTRY { + struct list entry; UINT wDelay; UINT wResol; LPTIMECALLBACK lpFunc; /* can be lots of things */ @@ -57,16 +59,34 @@ typedef struct tagWINE_TIMERENTRY { UINT16 wFlags; UINT16 wTimerID; DWORD dwTriggerTime; - struct tagWINE_TIMERENTRY* lpNext; } WINE_TIMERENTRY, *LPWINE_TIMERENTRY; +static struct list timer_list = LIST_INIT(timer_list); + +static CRITICAL_SECTION TIME_cbcrst; +static CRITICAL_SECTION_DEBUG critsect_debug = +{ + 0, 0, &TIME_cbcrst, + { &critsect_debug.ProcessLocksList, &critsect_debug.ProcessLocksList }, + 0, 0, { (DWORD_PTR)(__FILE__ ": TIME_cbcrst") } +}; +static CRITICAL_SECTION TIME_cbcrst = { &critsect_debug, -1, 0, 0, 0, 0 }; static HANDLE TIME_hMMTimer; -static LPWINE_TIMERENTRY TIME_TimersList; -static CRITICAL_SECTION TIME_cbcrst; static BOOL TIME_TimeToDie = TRUE; static int TIME_fdWake[2] = { -1, -1 }; +/* link timer at the appropriate spot in the list */ +static inline void link_timer( WINE_TIMERENTRY *timer ) +{ + WINE_TIMERENTRY *next; + + LIST_FOR_EACH_ENTRY( next, &timer_list, WINE_TIMERENTRY, entry ) + if ((int)(next->dwTriggerTime - timer->dwTriggerTime) >= 0) break; + + list_add_before( &next->entry, &timer->entry ); +} + /* * Some observations on the behavior of winmm on Windows. * First, the call to timeBeginPeriod(xx) can never be used @@ -97,50 +117,13 @@ static int TIME_fdWake[2] = { -1, -1 }; #define MMSYSTIME_MAXINTERVAL (65535) -static void TIME_TriggerCallBack(LPWINE_TIMERENTRY lpTimer) -{ - TRACE("%04x:CallBack => lpFunc=%p wTimerID=%04X dwUser=%08X dwTriggerTime %d(delta %d)\n", - GetCurrentThreadId(), lpTimer->lpFunc, lpTimer->wTimerID, lpTimer->dwUser, - lpTimer->dwTriggerTime, GetTickCount() - lpTimer->dwTriggerTime); - - /* - TimeProc callback that is called here is something strange, under Windows 3.1x it is called - * during interrupt time, is allowed to execute very limited number of API calls (like - * PostMessage), and must reside in DLL (therefore uses stack of active application). So I - * guess current implementation via SetTimer has to be improved upon. - */ - switch (lpTimer->wFlags & 0x30) { - case TIME_CALLBACK_FUNCTION: - if (lpTimer->wFlags & WINE_TIMER_IS32) - (lpTimer->lpFunc)(lpTimer->wTimerID, 0, lpTimer->dwUser, 0, 0); - else if (pFnCallMMDrvFunc16) - pFnCallMMDrvFunc16((DWORD)lpTimer->lpFunc, lpTimer->wTimerID, 0, - lpTimer->dwUser, 0, 0); - break; - case TIME_CALLBACK_EVENT_SET: - SetEvent((HANDLE)lpTimer->lpFunc); - break; - case TIME_CALLBACK_EVENT_PULSE: - PulseEvent((HANDLE)lpTimer->lpFunc); - break; - default: - FIXME("Unknown callback type 0x%04x for mmtime callback (%p), ignored.\n", - lpTimer->wFlags, lpTimer->lpFunc); - break; - } -} - /************************************************************************** * TIME_MMSysTimeCallback */ static int TIME_MMSysTimeCallback(void) { -static int nSizeLpTimers; -static LPWINE_TIMERENTRY lpTimers; - - LPWINE_TIMERENTRY timer, *ptimer, *next_ptimer; - int idx; - DWORD cur_time; - int delta_time, ret_time = -1; + WINE_TIMERENTRY *timer, *to_free; + int delta_time; /* since timeSetEvent() and timeKillEvent() can be called * from 16 bit code, there are cases where win16 lock is @@ -152,84 +135,61 @@ static LPWINE_TIMERENTRY lpTimers; * To cope with that, we just copy the WINE_TIMERENTRY struct * that need to trigger the callback, and call it without the * mm timer crit sect locked. - * the hKillTimeEvent is used to mark the section where we - * handle the callbacks so we can do synchronous kills. - * EPP 99/07/13, updated 04/01/10 */ - idx = 0; - cur_time = GetTickCount(); EnterCriticalSection(&WINMM_cs); - for (ptimer = &TIME_TimersList; *ptimer != NULL; ) { - timer = *ptimer; - next_ptimer = &timer->lpNext; - delta_time = timer->dwTriggerTime - cur_time; - if (delta_time <= 0) + for (;;) + { + struct list *ptr = list_head( &timer_list ); + if (!ptr) { - if (timer->lpFunc) { - if (idx == nSizeLpTimers) { - if (lpTimers) - lpTimers = (LPWINE_TIMERENTRY) - HeapReAlloc(GetProcessHeap(), 0, lpTimers, - ++nSizeLpTimers * sizeof(WINE_TIMERENTRY)); - else - lpTimers = (LPWINE_TIMERENTRY) - HeapAlloc(GetProcessHeap(), 0, - ++nSizeLpTimers * sizeof(WINE_TIMERENTRY)); - } - lpTimers[idx++] = *timer; + delta_time = -1; + break; + } - } + timer = LIST_ENTRY( ptr, WINE_TIMERENTRY, entry ); + delta_time = timer->dwTriggerTime - GetTickCount(); + if (delta_time > 0) break; - /* Update the time after we make the copy to preserve - the original trigger time */ + list_remove( &timer->entry ); + if (timer->wFlags & TIME_PERIODIC) + { timer->dwTriggerTime += timer->wDelay; - - /* TIME_ONESHOT is defined as 0 */ - if (!(timer->wFlags & TIME_PERIODIC)) - { - /* unlink timer from timers list */ - *ptimer = *next_ptimer; - HeapFree(GetProcessHeap(), 0, timer); - - /* We don't need to trigger oneshots again */ - delta_time = -1; - } - else - { - /* Compute when this event needs this function - to be called again */ - delta_time = timer->dwTriggerTime - cur_time; - if (delta_time < 0) delta_time = 0; - } + link_timer( timer ); /* restart it */ + to_free = NULL; } + else to_free = timer; - /* Determine when we need to return to this function */ - if (delta_time != -1) + switch(timer->wFlags & (TIME_CALLBACK_EVENT_SET|TIME_CALLBACK_EVENT_PULSE)) { - if (ret_time == -1 || ret_time > delta_time) ret_time = delta_time; - } + case TIME_CALLBACK_EVENT_SET: + SetEvent((HANDLE)timer->lpFunc); + break; + case TIME_CALLBACK_EVENT_PULSE: + PulseEvent((HANDLE)timer->lpFunc); + break; + case TIME_CALLBACK_FUNCTION: + { + DWORD user = timer->dwUser; + UINT16 id = timer->wTimerID; + UINT16 flags = timer->wFlags; + LPTIMECALLBACK func = timer->lpFunc; - ptimer = next_ptimer; - } - LeaveCriticalSection(&WINMM_cs); + if (flags & TIME_KILL_SYNCHRONOUS) EnterCriticalSection(&TIME_cbcrst); + LeaveCriticalSection(&WINMM_cs); - EnterCriticalSection(&TIME_cbcrst); - while (idx > 0) TIME_TriggerCallBack(&lpTimers[--idx]); - LeaveCriticalSection(&TIME_cbcrst); + if (flags & WINE_TIMER_IS32) func(id, 0, user, 0, 0); + else if (pFnCallMMDrvFunc16) pFnCallMMDrvFunc16((DWORD)func, id, 0, user, 0, 0); - /* Finally, adjust the recommended wait time downward - by the amount of time the processing routines - actually took */ - if (ret_time != -1) - { - ret_time -= GetTickCount() - cur_time; - if (ret_time < 0) ret_time = 0; + EnterCriticalSection(&WINMM_cs); + if (flags & TIME_KILL_SYNCHRONOUS) LeaveCriticalSection(&TIME_cbcrst); + } + break; + } + HeapFree( GetProcessHeap(), 0, to_free ); } - - /* We return the amount of time our caller should sleep - before needing to check in on us again */ - return ret_time; + LeaveCriticalSection(&WINMM_cs); + return delta_time; } /************************************************************************** @@ -277,10 +237,9 @@ static DWORD CALLBACK TIME_MMSysTimeThread(LPVOID arg) /************************************************************************** * TIME_MMTimeStart */ -void TIME_MMTimeStart(void) +static void TIME_MMTimeStart(void) { if (!TIME_hMMTimer) { - TIME_TimersList = NULL; if (pipe(TIME_fdWake) < 0) { TIME_fdWake[0] = TIME_fdWake[1] = -1; @@ -292,8 +251,6 @@ void TIME_MMTimeStart(void) TIME_TimeToDie = FALSE; TIME_hMMTimer = CreateThread(NULL, 0, TIME_MMSysTimeThread, NULL, 0, NULL); SetThreadPriority(TIME_hMMTimer, THREAD_PRIORITY_TIME_CRITICAL); - InitializeCriticalSection(&TIME_cbcrst); - TIME_cbcrst.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": WINMM.TIME_cbcrst"); } } @@ -314,9 +271,7 @@ void TIME_MMTimeStop(void) TIME_fdWake[0] = TIME_fdWake[1] = -1; CloseHandle(TIME_hMMTimer); TIME_hMMTimer = 0; - TIME_cbcrst.DebugInfo->Spare[0] = 0; DeleteCriticalSection(&TIME_cbcrst); - TIME_TimersList = NULL; } } @@ -355,8 +310,6 @@ WORD TIME_SetEventInternal(UINT wDelay, UINT wResol, if (lpNewTimer == NULL) return 0; - TIME_MMTimeStart(); - lpNewTimer->wDelay = wDelay; lpNewTimer->dwTriggerTime = GetTickCount() + wDelay; @@ -369,14 +322,14 @@ WORD TIME_SetEventInternal(UINT wDelay, UINT wResol, EnterCriticalSection(&WINMM_cs); - for (lpTimer = TIME_TimersList; lpTimer != NULL; lpTimer = lpTimer->lpNext) { - wNewID = max(wNewID, lpTimer->wTimerID); - } + LIST_FOR_EACH_ENTRY( lpTimer, &timer_list, WINE_TIMERENTRY, entry ) + wNewID = max(wNewID, lpTimer->wTimerID); - lpNewTimer->lpNext = TIME_TimersList; - TIME_TimersList = lpNewTimer; + link_timer( lpNewTimer ); lpNewTimer->wTimerID = wNewID + 1; + TIME_MMTimeStart(); + LeaveCriticalSection(&WINMM_cs); /* Wake the service thread in case there is work to be done */ @@ -405,16 +358,16 @@ MMRESULT WINAPI timeSetEvent(UINT wDelay, UINT wResol, LPTIMECALLBACK lpFunc, */ MMRESULT WINAPI timeKillEvent(UINT wID) { - LPWINE_TIMERENTRY lpSelf = NULL, *lpTimer; + WINE_TIMERENTRY *lpSelf = NULL, *lpTimer; TRACE("(%u)\n", wID); EnterCriticalSection(&WINMM_cs); /* remove WINE_TIMERENTRY from list */ - for (lpTimer = &TIME_TimersList; *lpTimer; lpTimer = &(*lpTimer)->lpNext) { - if (wID == (*lpTimer)->wTimerID) { - lpSelf = *lpTimer; - /* unlink timer of id 'wID' */ - *lpTimer = (*lpTimer)->lpNext; + LIST_FOR_EACH_ENTRY( lpTimer, &timer_list, WINE_TIMERENTRY, entry ) + { + if (wID == lpTimer->wTimerID) { + lpSelf = lpTimer; + list_remove( &lpTimer->entry ); break; } } diff --git a/dlls/winmm/winemm.h b/dlls/winmm/winemm.h index ed9e9f347a7..72de79a4573 100644 --- a/dlls/winmm/winemm.h +++ b/dlls/winmm/winemm.h @@ -241,7 +241,6 @@ LPWINE_MMIO MMIO_Get(HMMIO h); WORD TIME_SetEventInternal(UINT wDelay, UINT wResol, LPTIMECALLBACK lpFunc, DWORD dwUser, UINT wFlags); -void TIME_MMTimeStart(void); void TIME_MMTimeStop(void); /* Global variables */ diff --git a/programs/winecfg/appdefaults.c b/programs/winecfg/appdefaults.c index ed61f9d18ac..1df045e0a72 100644 --- a/programs/winecfg/appdefaults.c +++ b/programs/winecfg/appdefaults.c @@ -107,7 +107,7 @@ static void update_comboboxes(HWND dialog) winver = get_reg_key(config_key, keypath(""), "Version", ""); ver = get_registry_version(); - if (*winver == '\0') + if (!winver || !winver[0]) { HeapFree(GetProcessHeap(), 0, winver); diff --git a/programs/winetest/Makefile.in b/programs/winetest/Makefile.in index c5afe482064..bf2fd4ab295 100644 --- a/programs/winetest/Makefile.in +++ b/programs/winetest/Makefile.in @@ -40,6 +40,7 @@ TESTBINS = \ dplayx_test.exe \ dsound_test.exe \ gdi32_test.exe \ + gdiplus_test.exe \ hlink_test.exe \ infosoft_test.exe \ iphlpapi_test.exe \ @@ -121,6 +122,8 @@ dsound_test.exe: $(DLLDIR)/dsound/tests/dsound_test.exe$(DLLEXT) cp $(DLLDIR)/dsound/tests/dsound_test.exe$(DLLEXT) $@ && $(STRIP) $@ gdi32_test.exe: $(DLLDIR)/gdi32/tests/gdi32_test.exe$(DLLEXT) cp $(DLLDIR)/gdi32/tests/gdi32_test.exe$(DLLEXT) $@ && $(STRIP) $@ +gdiplus_test.exe: $(DLLDIR)/gdiplus/tests/gdiplus_test.exe$(DLLEXT) + cp $(DLLDIR)/gdiplus/tests/gdiplus_test.exe$(DLLEXT) $@ && $(STRIP) $@ hlink_test.exe: $(DLLDIR)/hlink/tests/hlink_test.exe$(DLLEXT) cp $(DLLDIR)/hlink/tests/hlink_test.exe$(DLLEXT) $@ && $(STRIP) $@ infosoft_test.exe: $(DLLDIR)/infosoft/tests/infosoft_test.exe$(DLLEXT) diff --git a/programs/winetest/winetest.rc b/programs/winetest/winetest.rc index 103a03740e0..e8a077297d8 100644 --- a/programs/winetest/winetest.rc +++ b/programs/winetest/winetest.rc @@ -163,6 +163,7 @@ dnsapi_test.exe TESTRES "dnsapi_test.exe" dplayx_test.exe TESTRES "dplayx_test.exe" dsound_test.exe TESTRES "dsound_test.exe" gdi32_test.exe TESTRES "gdi32_test.exe" +gdiplus_test.exe TESTRES "gdiplus_test.exe" hlink_test.exe TESTRES "hlink_test.exe" infosoft_test.exe TESTRES "infosoft_test.exe" iphlpapi_test.exe TESTRES "iphlpapi_test.exe" diff --git a/programs/wordpad/De.rc b/programs/wordpad/De.rc index 64893cbb45f..272dd5001b2 100644 --- a/programs/wordpad/De.rc +++ b/programs/wordpad/De.rc @@ -52,6 +52,12 @@ BEGIN MENUITEM "&Get text", ID_EDIT_GETTEXT END END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR + MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR + END POPUP "F&ormat" BEGIN POPUP "&Hintergrund" diff --git a/programs/wordpad/En.rc b/programs/wordpad/En.rc index 2f08653b83e..f8878bdf585 100644 --- a/programs/wordpad/En.rc +++ b/programs/wordpad/En.rc @@ -52,6 +52,12 @@ BEGIN MENUITEM "&Get text", ID_EDIT_GETTEXT END END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR + MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR + END POPUP "F&ormat" BEGIN POPUP "&Background" diff --git a/programs/wordpad/Fr.rc b/programs/wordpad/Fr.rc index c52dac2b657..096248359fd 100644 --- a/programs/wordpad/Fr.rc +++ b/programs/wordpad/Fr.rc @@ -52,6 +52,12 @@ BEGIN MENUITEM "&Recevoir texte", ID_EDIT_GETTEXT END END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR + MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR + END POPUP "Forma&t" BEGIN POPUP "&Fond" diff --git a/programs/wordpad/Hu.rc b/programs/wordpad/Hu.rc index 93c02200180..abd9f6d54a4 100644 --- a/programs/wordpad/Hu.rc +++ b/programs/wordpad/Hu.rc @@ -52,6 +52,12 @@ BEGIN MENUITEM "Sz&övegszerzés", ID_EDIT_GETTEXT END END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR + MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR + END POPUP "F&ormátum" BEGIN POPUP "&Háttér" diff --git a/programs/wordpad/Ko.rc b/programs/wordpad/Ko.rc index d963f625e8a..9f89ed0c55e 100644 --- a/programs/wordpad/Ko.rc +++ b/programs/wordpad/Ko.rc @@ -53,6 +53,12 @@ BEGIN MENUITEM "ÅؽºÆ® ¾ò±â(&G)", ID_EDIT_GETTEXT END END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR + MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR + END POPUP "Çü½Ä(&O)" BEGIN POPUP "¹è°æ(&B)" diff --git a/programs/wordpad/Makefile.in b/programs/wordpad/Makefile.in index 166f14d2aad..2192db8b92a 100644 --- a/programs/wordpad/Makefile.in +++ b/programs/wordpad/Makefile.in @@ -15,7 +15,7 @@ C_SRCS = \ RC_SRCS = rsrc.rc RC_BINSRC = rsrc.rc RC_BINARIES = \ - toolbar.bmp \ + formatbar.bmp \ wordpad.ico @MAKE_PROG_RULES@ diff --git a/programs/wordpad/Nl.rc b/programs/wordpad/Nl.rc index 67f378b70cb..0cdfef51e80 100644 --- a/programs/wordpad/Nl.rc +++ b/programs/wordpad/Nl.rc @@ -52,6 +52,12 @@ BEGIN MENUITEM "&Haal tekst", ID_EDIT_GETTEXT END END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR + MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR + END POPUP "&Opmaak" BEGIN POPUP "&Achtergrond" diff --git a/programs/wordpad/No.rc b/programs/wordpad/No.rc index 87be440e01d..20621bf8a0a 100644 --- a/programs/wordpad/No.rc +++ b/programs/wordpad/No.rc @@ -52,6 +52,12 @@ BEGIN MENUITEM "&Hent tekst", ID_EDIT_GETTEXT END END + POPUP "&Vis" + BEGIN + MENUITEM "Verk&tøylinje", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatlinje", ID_TOGGLE_FORMATBAR + MENUITEM "&Statuslinje", ID_TOGGLE_STATUSBAR + END POPUP "F&ormat" BEGIN POPUP "&Bakgrunn" diff --git a/programs/wordpad/Pl.rc b/programs/wordpad/Pl.rc index c55626421cd..67ea7c02591 100644 --- a/programs/wordpad/Pl.rc +++ b/programs/wordpad/Pl.rc @@ -53,6 +53,12 @@ BEGIN MENUITEM "&Pobie¿ tekst", ID_EDIT_GETTEXT END END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR + MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR + END POPUP "F&ormat" BEGIN POPUP "&T³o" diff --git a/programs/wordpad/Ru.rc b/programs/wordpad/Ru.rc index ef18f08b4fc..a0ad92261ea 100644 --- a/programs/wordpad/Ru.rc +++ b/programs/wordpad/Ru.rc @@ -50,6 +50,12 @@ BEGIN MENUITEM "Ï&îëó÷èòü òåêñò", ID_EDIT_GETTEXT END END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR + MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR + END POPUP "Ôîð&ìàò" BEGIN POPUP "&Ôîí" diff --git a/programs/wordpad/Tr.rc b/programs/wordpad/Tr.rc index 7a124aba54d..cf4d9f69031 100644 --- a/programs/wordpad/Tr.rc +++ b/programs/wordpad/Tr.rc @@ -54,6 +54,12 @@ BEGIN MENUITEM "&Metni al", ID_EDIT_GETTEXT END END + POPUP "&View" + BEGIN + MENUITEM "&Toolbar", ID_TOGGLE_TOOLBAR + MENUITEM "&Formatbar", ID_TOGGLE_FORMATBAR + MENUITEM "&Statusbar", ID_TOGGLE_STATUSBAR + END POPUP "&Biçim" BEGIN POPUP "&Arkaplan" diff --git a/programs/wordpad/resource.h b/programs/wordpad/resource.h index bc7647d0e3e..ecc035a1881 100644 --- a/programs/wordpad/resource.h +++ b/programs/wordpad/resource.h @@ -53,13 +53,21 @@ #define ID_FORMAT_ITALIC 1401 #define ID_FORMAT_UNDERLINE 1402 +#define ID_TOGGLE_TOOLBAR 1500 +#define ID_TOGGLE_FORMATBAR 1501 +#define ID_TOGGLE_STATUSBAR 1502 + +#define BANDID_TOOLBAR 0 +#define BANDID_FORMATBAR 1 + #define IDC_STATUSBAR 2000 #define IDC_EDITOR 2001 #define IDC_TOOLBAR 2002 -#define IDC_REBAR 2003 -#define IDC_COMBO 2004 +#define IDC_FORMATBAR 2003 +#define IDC_REBAR 2004 +#define IDC_COMBO 2005 -#define IDB_TOOLBAR 100 +#define IDB_FORMATBAR 100 #define IDI_WORDPAD 101 diff --git a/programs/wordpad/rsrc.rc b/programs/wordpad/rsrc.rc index 94d46d953b9..3410d511d3a 100644 --- a/programs/wordpad/rsrc.rc +++ b/programs/wordpad/rsrc.rc @@ -39,8 +39,8 @@ BEGIN "S", ID_FILE_SAVE, VIRTKEY, CONTROL END -/* BINRES toolbar.bmp */ -IDB_TOOLBAR BITMAP "toolbar.bmp" +/* BINRES formatbar.bmp */ +IDB_FORMATBAR BITMAP "formatbar.bmp" /* { '42 4d 3e 03 00 00 00 00 00 00 3e 00 00 00 28 00' '00 00 60 00 00 00 10 00 00 00 01 00 04 00 00 00' diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index 6efc15dc514..616ef23018d 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -48,6 +48,8 @@ static HWND hEditorWnd; static WCHAR wszFilter[MAX_STRING_LEN]; +static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam ); + /* Load string resources */ static void DoLoadStrings(void) { @@ -324,9 +326,52 @@ static void DoDefaultFont(void) SendMessage(hEditorWnd, EM_SETCHARFORMAT, SCF_DEFAULT, (LPARAM)&fmt); } +static void update_window(void) +{ + RECT rect; + + GetWindowRect(hMainWnd, &rect); + + (void) OnSize(hMainWnd, SIZE_RESTORED, MAKELONG(rect.bottom, rect.right)); +} + +static void toggle_toolbar(int bandId) +{ + HWND hwndReBar = GetDlgItem(hMainWnd, IDC_REBAR); + REBARBANDINFOW rbbinfo; + BOOL hide = TRUE; + + if(!hwndReBar) + return; + + rbbinfo.cbSize = sizeof(rbbinfo); + rbbinfo.fMask = RBBIM_STYLE | RBBIM_SIZE; + + SendMessageW(hwndReBar, RB_GETBANDINFO, bandId, (LPARAM)&rbbinfo); + + if(rbbinfo.fStyle & RBBS_HIDDEN) + hide = FALSE; + + SendMessageW(hwndReBar, RB_SHOWBAND, bandId, hide ? 0 : 1); + + if(bandId == BANDID_TOOLBAR) + { + rbbinfo.fMask ^= RBBIM_SIZE; + + SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_FORMATBAR, (LPARAM)&rbbinfo); + + if(hide) + rbbinfo.fStyle ^= RBBS_BREAK; + else + rbbinfo.fStyle |= RBBS_BREAK; + + SendMessageW(hwndReBar, RB_SETBANDINFO, BANDID_FORMATBAR, (LPARAM)&rbbinfo); + } +} + static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam) { - HWND hToolBarWnd, hReBarWnd; + HWND hToolBarWnd, hFormatBarWnd, hReBarWnd; HINSTANCE hInstance = (HINSTANCE)GetWindowLongPtr(hWnd, GWLP_HINSTANCE); HANDLE hDLL; TBADDBITMAP ab; @@ -348,13 +393,14 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam) hToolBarWnd = CreateToolbarEx(hReBarWnd, CCS_NOPARENTALIGN|CCS_NOMOVEY|WS_VISIBLE|WS_CHILD|TBSTYLE_TOOLTIPS|TBSTYLE_BUTTON, IDC_TOOLBAR, - 6, hInstance, IDB_TOOLBAR, + 0, hInstance, 0, NULL, 0, 24, 24, 16, 16, sizeof(TBBUTTON)); ab.hInst = HINST_COMMCTRL; ab.nID = IDB_STD_SMALL_COLOR; - nStdBitmaps = SendMessage(hToolBarWnd, TB_ADDBITMAP, 6, (LPARAM)&ab); + nStdBitmaps = SendMessageW(hToolBarWnd, TB_ADDBITMAP, 0, (LPARAM)&ab); + AddButton(hToolBarWnd, nStdBitmaps+STD_FILENEW, ID_FILE_NEW); AddButton(hToolBarWnd, nStdBitmaps+STD_FILEOPEN, ID_FILE_OPEN); AddButton(hToolBarWnd, nStdBitmaps+STD_FILESAVE, ID_FILE_SAVE); @@ -369,27 +415,41 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam) AddButton(hToolBarWnd, nStdBitmaps+STD_PASTE, ID_EDIT_PASTE); AddButton(hToolBarWnd, nStdBitmaps+STD_UNDO, ID_EDIT_UNDO); AddButton(hToolBarWnd, nStdBitmaps+STD_REDOW, ID_EDIT_REDO); - AddSeparator(hToolBarWnd); - AddButton(hToolBarWnd, 0, ID_FORMAT_BOLD); - AddButton(hToolBarWnd, 1, ID_FORMAT_ITALIC); - AddButton(hToolBarWnd, 2, ID_FORMAT_UNDERLINE); - AddSeparator(hToolBarWnd); - AddButton(hToolBarWnd, 3, ID_ALIGN_LEFT); - AddButton(hToolBarWnd, 4, ID_ALIGN_CENTER); - AddButton(hToolBarWnd, 5, ID_ALIGN_RIGHT); SendMessage(hToolBarWnd, TB_ADDSTRING, 0, (LPARAM)"Exit\0"); SendMessage(hToolBarWnd, TB_AUTOSIZE, 0, 0); rbb.cbSize = sizeof(rbb); rbb.fMask = RBBIM_SIZE | RBBIM_CHILDSIZE | RBBIM_CHILD | RBBIM_STYLE; - rbb.fStyle = RBBS_CHILDEDGE; - rbb.cx = 500; + rbb.fStyle = RBBS_CHILDEDGE | RBBS_BREAK | RBBS_NOGRIPPER; + rbb.cx = 0; rbb.hwndChild = hToolBarWnd; rbb.cxMinChild = 0; rbb.cyChild = rbb.cyMinChild = HIWORD(SendMessage(hToolBarWnd, TB_GETBUTTONSIZE, 0, 0)); - SendMessage(hReBarWnd, RB_INSERTBAND, -1, (LPARAM)&rbb); + SendMessageW(hReBarWnd, RB_INSERTBAND, BANDID_TOOLBAR, (LPARAM)&rbb); + + hFormatBarWnd = CreateToolbarEx(hReBarWnd, + CCS_NOPARENTALIGN | CCS_NOMOVEY | WS_VISIBLE | TBSTYLE_TOOLTIPS | TBSTYLE_BUTTON, + IDC_FORMATBAR, 6, hInstance, IDB_FORMATBAR, NULL, 0, 24, 24, 16, 16, sizeof(TBBUTTON)); + + ab.hInst = HINST_COMMCTRL; + ab.nID = IDB_STD_SMALL_COLOR; + nStdBitmaps = SendMessageW(hFormatBarWnd, TB_ADDBITMAP, 6, (LPARAM)&ab); + + AddButton(hFormatBarWnd, 0, ID_FORMAT_BOLD); + AddButton(hFormatBarWnd, 1, ID_FORMAT_ITALIC); + AddButton(hFormatBarWnd, 2, ID_FORMAT_UNDERLINE); + AddSeparator(hFormatBarWnd); + AddButton(hFormatBarWnd, 3, ID_ALIGN_LEFT); + AddButton(hFormatBarWnd, 4, ID_ALIGN_CENTER); + AddButton(hFormatBarWnd, 5, ID_ALIGN_RIGHT); + + SendMessageW(hFormatBarWnd, TB_AUTOSIZE, 0, 0); + + rbb.hwndChild = hFormatBarWnd; + + SendMessageW(hReBarWnd, RB_INSERTBAND, BANDID_FORMATBAR, (LPARAM)&rbb); hDLL = LoadLibrary("RICHED20.DLL"); assert(hDLL); @@ -397,6 +457,7 @@ static LRESULT OnCreate( HWND hWnd, WPARAM wParam, LPARAM lParam) hEditorWnd = CreateWindowExW(WS_EX_CLIENTEDGE, wszRichEditClass, NULL, WS_CHILD|WS_VISIBLE|ES_MULTILINE|ES_AUTOVSCROLL|ES_WANTRETURN|WS_VSCROLL, 0, 0, 1000, 100, hWnd, (HMENU)IDC_EDITOR, hInstance, NULL); + if (!hEditorWnd) { fprintf(stderr, "Error code %u\n", GetLastError()); @@ -419,6 +480,7 @@ static LRESULT OnUser( HWND hWnd, WPARAM wParam, LPARAM lParam) HWND hwndEditor = GetDlgItem(hWnd, IDC_EDITOR); HWND hwndReBar = GetDlgItem(hWnd, IDC_REBAR); HWND hwndToolBar = GetDlgItem(hwndReBar, IDC_TOOLBAR); + HWND hwndFormatBar = GetDlgItem(hwndReBar, IDC_FORMATBAR); int from, to; CHARFORMAT2W fmt; PARAFORMAT2 pf; @@ -438,17 +500,21 @@ static LRESULT OnUser( HWND hWnd, WPARAM wParam, LPARAM lParam) SendMessage(hwndEditor, EM_CANREDO, 0, 0)); SendMessage(hwndToolBar, TB_ENABLEBUTTON, ID_EDIT_CUT, from == to ? 0 : 1); SendMessage(hwndToolBar, TB_ENABLEBUTTON, ID_EDIT_COPY, from == to ? 0 : 1); - SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_FORMAT_BOLD, (fmt.dwMask & CFM_BOLD) && (fmt.dwEffects & CFE_BOLD)); - SendMessage(hwndToolBar, TB_INDETERMINATE, ID_FORMAT_BOLD, !(fmt.dwMask & CFM_BOLD)); - SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_FORMAT_ITALIC, (fmt.dwMask & CFM_ITALIC) && (fmt.dwEffects & CFE_ITALIC)); - SendMessage(hwndToolBar, TB_INDETERMINATE, ID_FORMAT_ITALIC, !(fmt.dwMask & CFM_ITALIC)); - SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_FORMAT_UNDERLINE, (fmt.dwMask & CFM_UNDERLINE) && (fmt.dwEffects & CFE_UNDERLINE)); - SendMessage(hwndToolBar, TB_INDETERMINATE, ID_FORMAT_UNDERLINE, !(fmt.dwMask & CFM_UNDERLINE)); - SendMessage(hwndEditor, EM_GETPARAFORMAT, 0, (LPARAM)&pf); - SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_ALIGN_LEFT, (pf.wAlignment == PFA_LEFT)); - SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_ALIGN_CENTER, (pf.wAlignment == PFA_CENTER)); - SendMessage(hwndToolBar, TB_CHECKBUTTON, ID_ALIGN_RIGHT, (pf.wAlignment == PFA_RIGHT)); + SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_FORMAT_BOLD, (fmt.dwMask & CFM_BOLD) && + (fmt.dwEffects & CFE_BOLD)); + SendMessageW(hwndFormatBar, TB_INDETERMINATE, ID_FORMAT_BOLD, !(fmt.dwMask & CFM_BOLD)); + SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_FORMAT_ITALIC, (fmt.dwMask & CFM_ITALIC) && + (fmt.dwEffects & CFE_ITALIC)); + SendMessageW(hwndFormatBar, TB_INDETERMINATE, ID_FORMAT_ITALIC, !(fmt.dwMask & CFM_ITALIC)); + SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_FORMAT_UNDERLINE, (fmt.dwMask & CFM_UNDERLINE) && + (fmt.dwEffects & CFE_UNDERLINE)); + SendMessageW(hwndFormatBar, TB_INDETERMINATE, ID_FORMAT_UNDERLINE, !(fmt.dwMask & CFM_UNDERLINE)); + + SendMessageW(hwndEditor, EM_GETPARAFORMAT, 0, (LPARAM)&pf); + SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_ALIGN_LEFT, (pf.wAlignment == PFA_LEFT)); + SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_ALIGN_CENTER, (pf.wAlignment == PFA_CENTER)); + SendMessageW(hwndFormatBar, TB_CHECKBUTTON, ID_ALIGN_RIGHT, (pf.wAlignment == PFA_RIGHT)); return 0; } @@ -479,6 +545,7 @@ static LRESULT OnNotify( HWND hWnd, WPARAM wParam, LPARAM lParam) static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam) { HWND hwndEditor = GetDlgItem(hWnd, IDC_EDITOR); + HWND hwndStatus = GetDlgItem(hWnd, IDC_STATUSBAR); if ((HWND)lParam == hwndEditor) return 0; @@ -674,6 +741,21 @@ static LRESULT OnCommand( HWND hWnd, WPARAM wParam, LPARAM lParam) SendMessage(hwndEditor, EM_SETBKGNDCOLOR, 0, RGB(255,255,192)); break; + case ID_TOGGLE_TOOLBAR: + toggle_toolbar(BANDID_TOOLBAR); + update_window(); + break; + + case ID_TOGGLE_FORMATBAR: + toggle_toolbar(BANDID_FORMATBAR); + update_window(); + break; + + case ID_TOGGLE_STATUSBAR: + ShowWindow(hwndStatus, IsWindowVisible(hwndStatus) ? SW_HIDE : SW_SHOW); + update_window(); + break; + default: SendMessage(hwndEditor, WM_COMMAND, wParam, lParam); break; @@ -685,8 +767,11 @@ static LRESULT OnInitPopupMenu( HWND hWnd, WPARAM wParam, LPARAM lParam ) { HMENU hMenu = (HMENU)wParam; HWND hwndEditor = GetDlgItem(hWnd, IDC_EDITOR); + HWND hwndReBar = GetDlgItem(hWnd, IDC_REBAR); + HWND hwndStatus = GetDlgItem(hWnd, IDC_STATUSBAR); PARAFORMAT pf; int nAlignment = -1; + REBARBANDINFOW rbbinfo; pf.cbSize = sizeof(PARAFORMAT); SendMessage(hwndEditor, EM_GETPARAFORMAT, 0, (LPARAM)&pf); @@ -696,28 +781,58 @@ static LRESULT OnInitPopupMenu( HWND hWnd, WPARAM wParam, LPARAM lParam ) MF_BYCOMMAND|(SendMessage(hwndEditor, EM_GETMODIFY, 0, 0) ? MF_CHECKED : MF_UNCHECKED)); if (pf.dwMask & PFM_ALIGNMENT) nAlignment = pf.wAlignment; - CheckMenuItem(hMenu, ID_ALIGN_LEFT, MF_BYCOMMAND|(nAlignment == PFA_LEFT) ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(hMenu, ID_ALIGN_CENTER, MF_BYCOMMAND|(nAlignment == PFA_CENTER) ? MF_CHECKED : MF_UNCHECKED); - CheckMenuItem(hMenu, ID_ALIGN_RIGHT, MF_BYCOMMAND|(nAlignment == PFA_RIGHT) ? MF_CHECKED : MF_UNCHECKED); - EnableMenuItem(hMenu, ID_EDIT_UNDO, MF_BYCOMMAND|(SendMessage(hwndEditor, EM_CANUNDO, 0, 0)) ? MF_ENABLED : MF_GRAYED); - EnableMenuItem(hMenu, ID_EDIT_REDO, MF_BYCOMMAND|(SendMessage(hwndEditor, EM_CANREDO, 0, 0)) ? MF_ENABLED : MF_GRAYED); + CheckMenuItem(hMenu, ID_ALIGN_LEFT, MF_BYCOMMAND|(nAlignment == PFA_LEFT) ? + MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_ALIGN_CENTER, MF_BYCOMMAND|(nAlignment == PFA_CENTER) ? + MF_CHECKED : MF_UNCHECKED); + CheckMenuItem(hMenu, ID_ALIGN_RIGHT, MF_BYCOMMAND|(nAlignment == PFA_RIGHT) ? + MF_CHECKED : MF_UNCHECKED); + EnableMenuItem(hMenu, ID_EDIT_UNDO, MF_BYCOMMAND|(SendMessageW(hwndEditor, EM_CANUNDO, 0, 0)) ? + MF_ENABLED : MF_GRAYED); + EnableMenuItem(hMenu, ID_EDIT_REDO, MF_BYCOMMAND|(SendMessageW(hwndEditor, EM_CANREDO, 0, 0)) ? + MF_ENABLED : MF_GRAYED); + + rbbinfo.cbSize = sizeof(rbbinfo); + rbbinfo.fMask = RBBIM_STYLE; + SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_TOOLBAR, (LPARAM)&rbbinfo); + + CheckMenuItem(hMenu, ID_TOGGLE_TOOLBAR, MF_BYCOMMAND|(rbbinfo.fStyle & RBBS_HIDDEN) ? + MF_UNCHECKED : MF_CHECKED); + + SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_FORMATBAR, (LPARAM)&rbbinfo); + + CheckMenuItem(hMenu, ID_TOGGLE_FORMATBAR, MF_BYCOMMAND|(rbbinfo.fStyle & RBBS_HIDDEN) ? + MF_UNCHECKED : MF_CHECKED); + + CheckMenuItem(hMenu, ID_TOGGLE_STATUSBAR, MF_BYCOMMAND|IsWindowVisible(hwndStatus) ? + MF_CHECKED : MF_UNCHECKED); return 0; } static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam ) { - int nStatusSize = 0, nTBSize = 0; + int nStatusSize = 0; RECT rc; HWND hwndEditor = GetDlgItem(hWnd, IDC_EDITOR); HWND hwndStatusBar = GetDlgItem(hWnd, IDC_STATUSBAR); HWND hwndReBar = GetDlgItem(hWnd, IDC_REBAR); HWND hwndToolBar = GetDlgItem(hwndReBar, IDC_TOOLBAR); + HWND hwndFormatBar = GetDlgItem(hwndReBar, IDC_FORMATBAR); + int rebarHeight = 0; + REBARBANDINFOW rbbinfo; + int rebarRows = 2; if (hwndStatusBar) { SendMessage(hwndStatusBar, WM_SIZE, 0, 0); - GetClientRect(hwndStatusBar, &rc); - nStatusSize = rc.bottom - rc.top; + if (IsWindowVisible(hwndStatusBar)) + { + GetClientRect(hwndStatusBar, &rc); + nStatusSize = rc.bottom - rc.top; + } else + { + nStatusSize = 0; + } } if (hwndToolBar) { @@ -726,14 +841,38 @@ static LRESULT OnSize( HWND hWnd, WPARAM wParam, LPARAM lParam ) rc.bottom = HIWORD(lParam); SendMessage(hwndToolBar, TB_AUTOSIZE, 0, 0); SendMessage(hwndReBar, RB_SIZETORECT, 0, (LPARAM)&rc); - nTBSize = SendMessage(hwndReBar, RB_GETBARHEIGHT, 0, 0); GetClientRect(hwndReBar, &rc); MoveWindow(hwndReBar, 0, 0, LOWORD(lParam), rc.right, FALSE); } + if (hwndFormatBar) + { + rc.left = rc.top = 0; + rc.right = LOWORD(lParam); + rc.bottom = HIWORD(lParam); + SendMessageW(hwndFormatBar, TB_AUTOSIZE, 0, 0); + SendMessageW(hwndReBar, RB_SIZETORECT, 0, (LPARAM)&rc); + GetClientRect(hwndReBar, &rc); + MoveWindow(hwndReBar, 0, 0, LOWORD(lParam), rc.right, FALSE); + } + if (hwndReBar) + { + rbbinfo.cbSize = sizeof(rbbinfo); + rbbinfo.fMask = RBBIM_STYLE; + + SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_TOOLBAR, (LPARAM)&rbbinfo); + if(rbbinfo.fStyle & RBBS_HIDDEN) + rebarRows--; + + SendMessageW(hwndReBar, RB_GETBANDINFO, BANDID_FORMATBAR, (LPARAM)&rbbinfo); + if(rbbinfo.fStyle & RBBS_HIDDEN) + rebarRows--; + + rebarHeight = rebarRows ? SendMessageW(hwndReBar, RB_GETBARHEIGHT, 0, 0) : 0; + } if (hwndEditor) { GetClientRect(hWnd, &rc); - MoveWindow(hwndEditor, 0, nTBSize, rc.right, rc.bottom-nStatusSize-nTBSize, TRUE); + MoveWindow(hwndEditor, 0, rebarHeight, rc.right, rc.bottom-nStatusSize-rebarHeight, TRUE); } return DefWindowProcW(hWnd, WM_SIZE, wParam, lParam); diff --git a/tools/widl/parser.y b/tools/widl/parser.y index b5c18658042..b5826730ec8 100644 --- a/tools/widl/parser.y +++ b/tools/widl/parser.y @@ -1387,7 +1387,6 @@ static var_t *make_var(char *name) v->args = NULL; v->attrs = NULL; v->eval = NULL; - v->corrdesc = 0; return v; } diff --git a/tools/widl/typegen.c b/tools/widl/typegen.c index 8f4c9264ec5..e3d529259ff 100644 --- a/tools/widl/typegen.c +++ b/tools/widl/typegen.c @@ -62,7 +62,7 @@ struct expr_eval_routine static size_t fields_memsize(const var_list_t *fields, unsigned int *align); static size_t write_struct_tfs(FILE *file, type_t *type, const char *name, unsigned int *tfsoff); static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *type, - const char *name, int level, unsigned int *tfsoff); + const char *name, int write_ptr, unsigned int *tfsoff); const char *string_of_type(unsigned char type) { @@ -160,32 +160,6 @@ static int is_embedded_complex(const type_t *type) return is_struct(tc) || is_union(tc) || is_array(type); } -static long field_offset(const type_t *strct, const char *name, var_t **pfield) -{ - long offset = 0; - var_list_t *fields = strct->fields; - var_t *f; - - if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry) - { - unsigned int align = 0; - - if (f->name != NULL && strcmp(name, f->name) == 0) - { - if (pfield) *pfield = f; - return offset; - } - else - { - /* FIXME: handle possible padding */ - offset += type_memsize(f->type, &align); - } - } - - if (pfield) *pfield = NULL; - return -1; -} - static int compare_expr(const expr_t *a, const expr_t *b) { int ret; @@ -442,7 +416,8 @@ static int write_base_type(FILE *file, const type_t *type, unsigned int *typestr } /* write conformance / variance descriptor */ -static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_t *structure, const expr_t *expr) +static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_t *structure, + unsigned int baseoff, const expr_t *expr) { unsigned char operator_type = 0; const char *operator_string = "no operators"; @@ -526,18 +501,19 @@ static size_t write_conf_or_var_desc(FILE *file, const func_t *func, const type_ if (structure->fields) LIST_FOR_EACH_ENTRY( var, structure->fields, const var_t, entry ) { unsigned int align = 0; - offset -= type_memsize(var->type, &align); /* FIXME: take alignment into account */ if (!strcmp(var->name, subexpr->u.sval)) { correlation_variable = var->type; break; } + offset += type_memsize(var->type, &align); } if (!correlation_variable) error("write_conf_or_var_desc: couldn't find variable %s in structure\n", subexpr->u.sval); + offset -= baseoff; correlation_type = RPC_FC_NORMAL_CONFORMANCE; } else @@ -819,7 +795,7 @@ static int processed(const type_t *type) } static void write_member_type(FILE *file, type_t *type, const var_t *field, - unsigned int *tfsoff) + unsigned int *corroff, unsigned int *tfsoff) { if (is_ptr(type)) { @@ -828,10 +804,19 @@ static void write_member_type(FILE *file, type_t *type, const var_t *field, } else if (is_embedded_complex(type)) { - size_t absoff = (field && field->corrdesc - ? field->corrdesc - : type->typestring_offset); - short reloff = absoff - (*tfsoff + 2); + size_t absoff; + short reloff; + + if (is_union(type->type) && is_attr(field->attrs, ATTR_SWITCHIS)) + { + absoff = *corroff; + *corroff += 8; + } + else + { + absoff = type->typestring_offset; + } + reloff = absoff - (*tfsoff + 2); print_file(file, 2, "0x4c,\t/* FC_EMBEDDED_COMPLEX */\n"); /* FIXME: actually compute necessary padding */ @@ -855,6 +840,35 @@ static void write_end(FILE *file, unsigned int *tfsoff) *tfsoff += 1; } +static void write_descriptors(FILE *file, type_t *type, unsigned int *tfsoff) +{ + unsigned int offset = 0; + var_list_t *fs = type->fields; + var_t *f; + + if (fs) LIST_FOR_EACH_ENTRY(f, fs, var_t, entry) + { + unsigned int align = 0; + type_t *ft = f->type; + if (is_union(ft->type) && is_attr(f->attrs, ATTR_SWITCHIS)) + { + unsigned int absoff = ft->typestring_offset; + short reloff = absoff - (*tfsoff + 6); + print_file(file, 0, "/* %d */\n", *tfsoff); + print_file(file, 2, "0x%x,\t/* %s */\n", ft->type, string_of_type(ft->type)); + print_file(file, 2, "0x%x,\t/* FIXME: always FC_LONG */\n", RPC_FC_LONG); + write_conf_or_var_desc(file, current_func, current_structure, offset, + get_attrp(f->attrs, ATTR_SWITCHIS)); + print_file(file, 2, "NdrFcShort(%hd),\t/* Offset= %hd (%u) */\n", + reloff, reloff, absoff); + *tfsoff += 8; + } + + /* FIXME: take alignment into account */ + offset += type_memsize(ft, &align); + } +} + static size_t write_pointer_description(FILE *file, type_t *type, size_t mem_offset, int level, unsigned int *typestring_offset) { @@ -959,6 +973,8 @@ static size_t write_string_tfs(FILE *file, const attr_list_t *attrs, } else if (type->size_is) { + unsigned int align = 0; + if (rtype == RPC_FC_CHAR) WRITE_FCTYPE(file, FC_C_CSTRING, *typestring_offset); else @@ -966,7 +982,12 @@ static size_t write_string_tfs(FILE *file, const attr_list_t *attrs, print_file(file, 2, "0x%x, /* FC_STRING_SIZED */\n", RPC_FC_STRING_SIZED); *typestring_offset += 2; - *typestring_offset += write_conf_or_var_desc(file, current_func, NULL, type->size_is); + *typestring_offset += write_conf_or_var_desc( + file, current_func, current_structure, + (type->declarray && current_structure + ? type_memsize(current_structure, &align) + : 0), + type->size_is); return start_offset; } @@ -997,7 +1018,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type pointer_type = RPC_FC_RP; has_pointer = FALSE; - if (write_embedded_types(file, attrs, type, name, 0, typestring_offset)) + if (write_embedded_types(file, attrs, type->ref, name, FALSE, typestring_offset)) has_pointer = TRUE; size = type_memsize(type, &align); @@ -1011,9 +1032,14 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type print_file(file, 2, "0x%x,\t/* %d */\n", align - 1, align - 1); *typestring_offset += 2; + align = 0; if (type->type != RPC_FC_BOGUS_ARRAY) { unsigned char tc = type->type; + unsigned int baseoff + = type->declarray && current_structure + ? type_memsize(current_structure, &align) + : 0; if (tc == RPC_FC_LGFARRAY || tc == RPC_FC_LGVARRAY) { @@ -1028,8 +1054,8 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type if (is_conformant_array(type)) *typestring_offset - += write_conf_or_var_desc(file, current_func, - current_structure, size_is); + += write_conf_or_var_desc(file, current_func, current_structure, + baseoff, size_is); if (type->type == RPC_FC_SMVARRAY || type->type == RPC_FC_LGVARRAY) { @@ -1053,8 +1079,8 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type if (length_is) *typestring_offset - += write_conf_or_var_desc(file, current_func, - current_structure, length_is); + += write_conf_or_var_desc(file, current_func, current_structure, + baseoff, length_is); if (has_pointer) { @@ -1066,7 +1092,7 @@ static size_t write_array_tfs(FILE *file, const attr_list_t *attrs, type_t *type *typestring_offset += 1; } - write_member_type(file, type->ref, NULL, typestring_offset); + write_member_type(file, type->ref, NULL, NULL, typestring_offset); write_end(file, typestring_offset); } else @@ -1089,7 +1115,8 @@ static const var_t *find_array_or_string_in_struct(const type_t *type) return NULL; } -static void write_struct_members(FILE *file, const type_t *type, unsigned int *typestring_offset) +static void write_struct_members(FILE *file, const type_t *type, + unsigned int *corroff, unsigned int *typestring_offset) { const var_t *field; @@ -1097,7 +1124,7 @@ static void write_struct_members(FILE *file, const type_t *type, unsigned int *t { type_t *ft = field->type; if (!ft->declarray || !is_conformant_array(ft)) - write_member_type(file, ft, field, typestring_offset); + write_member_type(file, ft, field, corroff, typestring_offset); } write_end(file, typestring_offset); @@ -1106,32 +1133,37 @@ static void write_struct_members(FILE *file, const type_t *type, unsigned int *t static size_t write_struct_tfs(FILE *file, type_t *type, const char *name, unsigned int *tfsoff) { + const type_t *save_current_structure = current_structure; unsigned int total_size; const var_t *array; size_t start_offset; size_t array_offset; - int has_pointers; + int has_pointers = 0; unsigned int align = 0; + unsigned int corroff; + var_t *f; guard_rec(type); + current_structure = type; total_size = type_memsize(type, &align); if (total_size > USHRT_MAX) error("structure size for %s exceeds %d bytes by %d bytes\n", name, USHRT_MAX, total_size - USHRT_MAX); - has_pointers = write_embedded_types(file, NULL, type, name, 0, tfsoff); + if (type->fields) LIST_FOR_EACH_ENTRY(f, type->fields, var_t, entry) + has_pointers |= write_embedded_types(file, f->attrs, f->type, f->name, + FALSE, tfsoff); array = find_array_or_string_in_struct(type); if (array && !processed(array->type)) - { - current_structure = type; array_offset = is_attr(array->attrs, ATTR_STRING) ? write_string_tfs(file, array->attrs, array->type, array->name, tfsoff) : write_array_tfs(file, array->attrs, array->type, array->name, tfsoff); - current_structure = NULL; - } + + corroff = *tfsoff; + write_descriptors(file, type, tfsoff); start_offset = *tfsoff; update_tfsoff(type, start_offset, file); @@ -1171,10 +1203,9 @@ static size_t write_struct_tfs(FILE *file, type_t *type, *tfsoff += 1; } - current_structure = type; - write_struct_members(file, type, tfsoff); - current_structure = NULL; + write_struct_members(file, type, &corroff, tfsoff); + current_structure = save_current_structure; return start_offset; } @@ -1230,8 +1261,7 @@ static void write_branch_type(FILE *file, const type_t *t, unsigned int *tfsoff) *tfsoff += 2; } -static size_t write_union_tfs(FILE *file, type_t *type, const char *name, - unsigned int *tfsoff) +static size_t write_union_tfs(FILE *file, type_t *type, unsigned int *tfsoff) { unsigned int align = 0; unsigned int start_offset; @@ -1244,14 +1274,13 @@ static size_t write_union_tfs(FILE *file, type_t *type, const char *name, guard_rec(type); - /* use a level of 1 so pointers always get written */ - write_embedded_types(file, NULL, type, name, 1, tfsoff); - if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry) { expr_list_t *cases = get_attrp(f->attrs, ATTR_CASE); if (cases) nbranch += list_count(cases); + if (f->type) + write_embedded_types(file, f->attrs, f->type, f->name, TRUE, tfsoff); } start_offset = *tfsoff; @@ -1321,7 +1350,7 @@ static size_t write_ip_tfs(FILE *file, const func_t *func, const type_t *type, c expr.is_const = FALSE; print_file(file, 2, "0x2f, /* FC_IP */\n"); print_file(file, 2, "0x5c, /* FC_PAD */\n"); - *typeformat_offset += write_conf_or_var_desc(file, func, NULL, &expr) + 2; + *typeformat_offset += write_conf_or_var_desc(file, func, NULL, 0, &expr) + 2; } else { @@ -1404,7 +1433,7 @@ static size_t write_typeformatstring_var(FILE *file, int indent, const func_t *f return write_struct_tfs(file, type, var->name, typeformat_offset); case RPC_FC_ENCAPSULATED_UNION: case RPC_FC_NON_ENCAPSULATED_UNION: - return write_union_tfs(file, type, var->name, typeformat_offset); + return write_union_tfs(file, type, typeformat_offset); case RPC_FC_IGNORE: case RPC_FC_BIND_PRIMITIVE: /* nothing to do */ @@ -1475,92 +1504,19 @@ static void set_tfswrite(type_t *type, int val) } static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *type, - const char *name, int level, unsigned int *tfsoff) + const char *name, int write_ptr, unsigned int *tfsoff) { - var_list_t *fields = type->fields; int retmask = 0; - size_t offset = 0; - var_t *f; - - if (fields) LIST_FOR_EACH_ENTRY(f, fields, var_t, entry) - { - unsigned int align = 0; - type_t *ft = f->type; - - if (!ft) continue; - else if (ft->type == RPC_FC_NON_ENCAPSULATED_UNION) - { - expr_t *swexp = get_attrp(f->attrs, ATTR_SWITCHIS); - const char *swname; - var_t *swvar; - size_t corroff; - unsigned char corrdesc, op = 0; - short creloff, ureloff; - - if (swexp == NULL) - error("union %s needs a switch_is attribute\n", f->name); - if (swexp->type != EXPR_IDENTIFIER) - error("%s: only identifiers are supported for switch_is at this time\n", - f->name); - - if (!processed(ft)) - write_union_tfs(file, ft, f->name, tfsoff); - - swname = swexp->u.sval; - corroff = field_offset(type, swname, &swvar); - corrdesc = swvar->type->type; - creloff = corroff - offset; - - f->corrdesc = *tfsoff; - ureloff = ft->typestring_offset - (f->corrdesc + 6); - print_file(file, 0, "/* %d */\n", f->corrdesc); - print_file(file, 2, "0x%x,\t/* %s */\n", ft->type, string_of_type(ft->type)); - print_file(file, 2, "0x8,\t/* FIXME: support other switch types */\n"); - print_file(file, 2, "0x%x,\t/* Corr desc: %s */\n", - corrdesc, string_of_type(corrdesc & 0xf)); - print_file(file, 2, "0x%x,\n", op); - print_file(file, 2, "NdrFcShort(0x%hx),\t/* %hd */\n", creloff, creloff); - print_file(file, 2, "NdrFcShort(0x%hx),\t/* Offset= %hd (%lu) */\n", - ureloff, ureloff, ft->typestring_offset); - *tfsoff += 8; - } - else - retmask |= write_embedded_types(file, attrs, ft, f->name, - level + 1, tfsoff); - /* FIXME: this doesn't take alignment/padding into account */ - offset += type_memsize(ft, &align); - } - /* don't generate a pointer for first-level arrays since we want to - descend into them to write their pointers, not stop here */ - else if (level == 0 && is_array(type)) - { - return write_embedded_types(file, NULL, type->ref, name, level + 1, tfsoff); - } - else if (is_ptr(type)) + if (is_ptr(type)) { type_t *ref = type->ref; if (!processed(ref) && !is_base_type(ref->type)) - { - if (is_ptr(ref)) - { - retmask |= write_embedded_types(file, attrs, ref, name, - level + 1, tfsoff); - } - else if (is_struct(ref->type)) - { - write_struct_tfs(file, ref, name, tfsoff); - } - else - { - error("write_embedded_types: type format string unknown for %s (0x%x)\n", - name, ref->type); - } - } + retmask |= write_embedded_types(file, NULL, ref, name, TRUE, tfsoff); - /* top-level pointers are handled inline */ - if (1 < level) + /* top-level pointers are handled inline for structures */ + if (write_ptr) write_pointer_tfs(file, type, tfsoff); retmask |= 1; @@ -1571,6 +1527,16 @@ static int write_embedded_types(FILE *file, const attr_list_t *attrs, type_t *ty { write_array_tfs(file, attrs, type, name, tfsoff); } + else if (is_struct(type->type)) + { + if (!processed(type)) + write_struct_tfs(file, type, name, tfsoff); + } + else if (is_union(type->type)) + { + if (!processed(type)) + write_union_tfs(file, type, tfsoff); + } else if (!is_base_type(type->type)) error("write_embedded_types: unknown embedded type for %s (0x%x)\n", name, type->type); diff --git a/tools/widl/widltypes.h b/tools/widl/widltypes.h index 0c8acadde5c..0fe453b311a 100644 --- a/tools/widl/widltypes.h +++ b/tools/widl/widltypes.h @@ -227,7 +227,6 @@ struct _var_t { var_list_t *args; /* for function pointers */ attr_list_t *attrs; expr_t *eval; - size_t corrdesc; /* offset to correlation descriptor (e.g., for unions) */ /* parser-internal */ struct list entry; diff --git a/tools/winapi/win32.api b/tools/winapi/win32.api index f9762d3d8f1..1039cbd2d79 100644 --- a/tools/winapi/win32.api +++ b/tools/winapi/win32.api @@ -46,6 +46,7 @@ NTSTATUS POLICY_INFORMATION_CLASS POLICY_NOTIFICATION_INFORMATION_CLASS REGSAM +SC_ENUM_TYPE SC_HANDLE SC_STATUS_TYPE SE_OBJECT_TYPE @@ -96,8 +97,6 @@ LPQUERY_SERVICE_LOCK_STATUSA LPQUERY_SERVICE_LOCK_STATUSW LPSECURITY_ATTRIBUTES LPSERVICE_STATUS -LPSERVICE_TABLE_ENTRYA -LPSERVICE_TABLE_ENTRYW LPSTARTUPINFOA LPSTARTUPINFOW LPSTR * @@ -152,13 +151,15 @@ PTRUSTEEA PTRUSTEEW PUCHAR PULONG -PUNICODE_STRING PVALENTA PVALENTW PVOID PVOID * SC_LOCK SECURITY_ATTRIBUTES * +SERVICE_TABLE_ENTRYA * +SERVICE_TABLE_ENTRYW * +UNICODE_STRING * WMIDPREQUEST struct ustring * unsigned char * @@ -2818,11 +2819,9 @@ ULONG WCHAR WORD int -long obj_handle_t size_t unsigned int -unsigned long %long --pointer diff --git a/tools/winapi/winapi.pm b/tools/winapi/winapi.pm index 5bf4ce6b45e..8c552e5b41e 100644 --- a/tools/winapi/winapi.pm +++ b/tools/winapi/winapi.pm @@ -192,7 +192,7 @@ sub parse_api_file($$) { } } elsif(defined($kind)) { my $type = $_; - if ($type =~ /^long\b/) + if ($type =~ /\blong\b/) { $output->write("$file:$linenum: type ($type) is not Win64 compatible\n"); } -- 2.11.4.GIT