From eeab855fbf906a68a606417c2a1ca9e9834afd84 Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Thu, 26 Mar 2009 22:45:30 +0100 Subject: [PATCH] push be44e1b1e67dd45fdccac3e29dd1c8b262d48d95 --- configure | 132 +-------- configure.ac | 6 +- dlls/amstream/amstream.c | 12 +- dlls/comctl32/tab.c | 30 +- dlls/comctl32/tests/tab.c | 33 +++ dlls/d3d8/tests/device.c | 12 +- dlls/d3d9/tests/device.c | 104 ++++--- dlls/d3dxof/d3dxof.c | 3 +- dlls/hal/hal.spec | 2 +- dlls/kernel32/tests/profile.c | 15 +- dlls/msctf/threadmgr.c | 9 +- dlls/msi/package.c | 2 +- dlls/msi/tests/msi.c | 4 +- dlls/msvcrt/msvcrt.spec | 2 + dlls/msvcrt/tests/printf.c | 48 ++++ dlls/msvcrt/wcs.c | 32 ++- dlls/ntdll/Makefile.in | 1 - dlls/ntdll/ntdll_misc.h | 1 - dlls/ntdll/pthread.c | 599 ---------------------------------------- dlls/ntdll/thread.c | 1 - dlls/ole32/clipboard.c | 128 ++++++--- dlls/ole32/tests/clipboard.c | 23 +- dlls/rpcrt4/rpc_server.c | 49 +++- dlls/rpcrt4/rpc_transport.c | 66 ++++- dlls/rpcrt4/tests/rpc.c | 2 +- dlls/rpcrt4/tests/rpc_protseq.c | 4 - dlls/wined3d/device.c | 50 ++-- dlls/wined3d/drawprim.c | 107 +------ dlls/wined3d/state.c | 36 +-- dlls/winedos/int21.c | 5 +- dlls/wininet/tests/http.c | 8 +- include/config.h.in | 6 - include/msvcrt/stdio.h | 2 + include/msvcrt/wchar.h | 1 + include/wine/pthread.h | 51 ---- include/wine/wined3d.idl | 9 - loader/pthread.c | 6 + tools/widl/widl.c | 32 ++- 38 files changed, 519 insertions(+), 1114 deletions(-) delete mode 100644 dlls/ntdll/pthread.c diff --git a/configure b/configure index fe6eaca410b..bd994ebfad9 100755 --- a/configure +++ b/configure @@ -14696,134 +14696,6 @@ _ACEOF fi -{ echo "$as_me:$LINENO: checking for pthread_rwlock_t" >&5 -echo $ECHO_N "checking for pthread_rwlock_t... $ECHO_C" >&6; } -if test "${ac_cv_type_pthread_rwlock_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define _GNU_SOURCE -#include - -typedef pthread_rwlock_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_pthread_rwlock_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_pthread_rwlock_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_pthread_rwlock_t" >&5 -echo "${ECHO_T}$ac_cv_type_pthread_rwlock_t" >&6; } -if test $ac_cv_type_pthread_rwlock_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_PTHREAD_RWLOCK_T 1 -_ACEOF - - -fi -{ echo "$as_me:$LINENO: checking for pthread_rwlockattr_t" >&5 -echo $ECHO_N "checking for pthread_rwlockattr_t... $ECHO_C" >&6; } -if test "${ac_cv_type_pthread_rwlockattr_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -/* confdefs.h. */ -_ACEOF -cat confdefs.h >>conftest.$ac_ext -cat >>conftest.$ac_ext <<_ACEOF -/* end confdefs.h. */ -#define _GNU_SOURCE -#include - -typedef pthread_rwlockattr_t ac__type_new_; -int -main () -{ -if ((ac__type_new_ *) 0) - return 0; -if (sizeof (ac__type_new_)) - return 0; - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (ac_try="$ac_compile" -case "(($ac_try" in - *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; - *) ac_try_echo=$ac_try;; -esac -eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5 - (eval "$ac_compile") 2>conftest.er1 - ac_status=$? - grep -v '^ *+' conftest.er1 >conftest.err - rm -f conftest.er1 - cat conftest.err >&5 - echo "$as_me:$LINENO: \$? = $ac_status" >&5 - (exit $ac_status); } && { - test -z "$ac_c_werror_flag" || - test ! -s conftest.err - } && test -s conftest.$ac_objext; then - ac_cv_type_pthread_rwlockattr_t=yes -else - echo "$as_me: failed program was:" >&5 -sed 's/^/| /' conftest.$ac_ext >&5 - - ac_cv_type_pthread_rwlockattr_t=no -fi - -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ echo "$as_me:$LINENO: result: $ac_cv_type_pthread_rwlockattr_t" >&5 -echo "${ECHO_T}$ac_cv_type_pthread_rwlockattr_t" >&6; } -if test $ac_cv_type_pthread_rwlockattr_t = yes; then - -cat >>confdefs.h <<_ACEOF -#define HAVE_PTHREAD_RWLOCKATTR_T 1 -_ACEOF - - -fi - - ac_wine_check_funcs_save_LIBS="$LIBS" LIBS="$LIBS $LIBPTHREAD" @@ -17468,7 +17340,6 @@ CFLAGS="$CFLAGS $BUILTINFLAG" - for ac_func in \ _pclose \ _popen \ @@ -17522,7 +17393,6 @@ for ac_func in \ sigaltstack \ sigprocmask \ snprintf \ - socketpair \ spawnvp \ statfs \ statvfs \ @@ -18139,6 +18009,7 @@ fi + for ac_func in \ getaddrinfo \ getnameinfo \ @@ -18148,6 +18019,7 @@ for ac_func in \ getservbyport \ inet_network \ sendmsg \ + socketpair \ do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` diff --git a/configure.ac b/configure.ac index 2eb2377feed..d2e6a5c53e2 100644 --- a/configure.ac +++ b/configure.ac @@ -1152,10 +1152,6 @@ then AC_DEFINE(HAVE_PPDEV, 1, [Define if we can use ppdev.h for parallel port access]) fi -dnl **** Check for pthread_rwlock_t **** -AC_CHECK_TYPES([pthread_rwlock_t, pthread_rwlockattr_t],,,[#define _GNU_SOURCE -#include ]) - dnl **** Check for pthread functions **** WINE_CHECK_LIB_FUNCS(\ pthread_attr_get_np \ @@ -1506,7 +1502,6 @@ AC_CHECK_FUNCS(\ sigaltstack \ sigprocmask \ snprintf \ - socketpair \ spawnvp \ statfs \ statvfs \ @@ -1560,6 +1555,7 @@ AC_CHECK_FUNCS(\ getservbyport \ inet_network \ sendmsg \ + socketpair \ ) dnl **** Check for OpenLDAP *** diff --git a/dlls/amstream/amstream.c b/dlls/amstream/amstream.c index 9e4d45aef04..6c544f64ccf 100644 --- a/dlls/amstream/amstream.c +++ b/dlls/amstream/amstream.c @@ -238,9 +238,17 @@ static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilterGraph(IAMMultiMediaStream { IAMMultiMediaStreamImpl *This = (IAMMultiMediaStreamImpl *)iface; - FIXME("(%p/%p)->(%p) stub!\n", This, iface, ppGraphBuilder); + TRACE("(%p/%p)->(%p)\n", This, iface, ppGraphBuilder); - return E_NOTIMPL; + if (!ppGraphBuilder) + return E_POINTER; + + if (This->pFilterGraph) + return IFilterGraph_QueryInterface(This->pFilterGraph, &IID_IGraphBuilder, (void**)ppGraphBuilder); + else + *ppGraphBuilder = NULL; + + return S_OK; } static HRESULT WINAPI IAMMultiMediaStreamImpl_GetFilter(IAMMultiMediaStream* iface, IMediaStreamFilter** ppFilter) diff --git a/dlls/comctl32/tab.c b/dlls/comctl32/tab.c index 3a0e477a8f0..62770aa8b85 100644 --- a/dlls/comctl32/tab.c +++ b/dlls/comctl32/tab.c @@ -252,6 +252,9 @@ static inline LRESULT TAB_SetCurSel (TAB_INFO *infoPtr, INT iItem) return -1; else { if (infoPtr->iSelected != iItem) { + infoPtr->items[prevItem].dwState &= ~TCIS_BUTTONPRESSED; + infoPtr->items[iItem].dwState |= TCIS_BUTTONPRESSED; + infoPtr->iSelected=iItem; infoPtr->uFocus=iItem; TAB_EnsureSelectionVisible(infoPtr); @@ -489,12 +492,8 @@ static LRESULT TAB_KeyUp(TAB_INFO* infoPtr, WPARAM keyCode) { if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) { - infoPtr->iSelected = newItem; - infoPtr->uFocus = newItem; + TAB_SetCurSel(infoPtr, newItem); TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE); - - TAB_EnsureSelectionVisible(infoPtr); - TAB_InvalidateTabArea(infoPtr); } } @@ -615,13 +614,8 @@ TAB_LButtonDown (TAB_INFO *infoPtr, WPARAM wParam, LPARAM lParam) { if (!TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGING)) { - infoPtr->iSelected = newItem; - infoPtr->uFocus = newItem; + TAB_SetCurSel(infoPtr, newItem); TAB_SendSimpleNotify(infoPtr, TCN_SELCHANGE); - - TAB_EnsureSelectionVisible(infoPtr); - - TAB_InvalidateTabArea(infoPtr); } } return 0; @@ -1962,8 +1956,13 @@ static void TAB_DrawItem(const TAB_INFO *infoPtr, HDC hdc, INT iItem) } else /* ! selected */ { - if (!(lStyle & TCS_FLATBUTTONS)) - DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RECT); + DWORD state = infoPtr->items[iItem].dwState; + + if (state & TCIS_BUTTONPRESSED) + DrawEdge(hdc, &r, EDGE_SUNKEN, BF_SOFT|BF_RECT); + else + if (!(lStyle & TCS_FLATBUTTONS)) + DrawEdge(hdc, &r, EDGE_RAISED, BF_SOFT|BF_RECT); } } else /* !TCS_BUTTONS */ @@ -2714,7 +2713,8 @@ TAB_SetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode) FIXME("TCIF_RTLREADING\n"); if (tabItem->mask & TCIF_STATE) - wineItem->dwState = tabItem->dwState; + wineItem->dwState = (wineItem->dwState & ~tabItem->dwStateMask) | + ( tabItem->dwState & tabItem->dwStateMask); if (tabItem->mask & TCIF_TEXT) { @@ -2761,7 +2761,7 @@ TAB_GetItemT (TAB_INFO *infoPtr, INT iItem, LPTCITEMW tabItem, BOOL bUnicode) FIXME("TCIF_RTLREADING\n"); if (tabItem->mask & TCIF_STATE) - tabItem->dwState = wineItem->dwState; + tabItem->dwState = wineItem->dwState & tabItem->dwStateMask; if (tabItem->mask & TCIF_TEXT) { diff --git a/dlls/comctl32/tests/tab.c b/dlls/comctl32/tests/tab.c index d24d0972988..7cee79dfa03 100644 --- a/dlls/comctl32/tests/tab.c +++ b/dlls/comctl32/tests/tab.c @@ -727,6 +727,7 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs) { INT selectionIndex; INT focusIndex; + TCITEM tcItem; flush_sequences(sequences, NUM_MSG_SEQUENCES); @@ -756,6 +757,15 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs) ok_sequence(sequences, TAB_SEQ_INDEX, getset_cur_sel_seq, "Getset curSel test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset curSel test parent sequence", FALSE); + + /* selected item should have TCIS_BUTTONPRESSED state + It doesn't depend on button state */ + memset(&tcItem, 0, sizeof(TCITEM)); + tcItem.mask = TCIF_STATE; + tcItem.dwStateMask = TCIS_BUTTONPRESSED; + selectionIndex = SendMessage(hTab, TCM_GETCURSEL, 0, 0); + SendMessage(hTab, TCM_GETITEM, selectionIndex, (LPARAM) &tcItem); + ok (tcItem.dwState & TCIS_BUTTONPRESSED, "Selected item should have TCIS_BUTTONPRESSED\n"); } /* Testing ExtendedStyle */ @@ -831,6 +841,29 @@ static void test_getters_setters(HWND parent_wnd, INT nTabs) ok_sequence(sequences, TAB_SEQ_INDEX, getset_item_seq, "Getset item test sequence", FALSE); ok_sequence(sequences, PARENT_SEQ_INDEX, empty_sequence, "Getset item test parent sequence", FALSE); + + /* TCIS_BUTTONPRESSED doesn't depend on tab style */ + memset(&tcItem, 0, sizeof(tcItem)); + tcItem.mask = TCIF_STATE; + tcItem.dwStateMask = TCIS_BUTTONPRESSED; + tcItem.dwState = TCIS_BUTTONPRESSED; + ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n"); + tcItem.dwState = 0; + ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); + ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n"); + /* next highlight item, test that dwStateMask actually masks */ + tcItem.mask = TCIF_STATE; + tcItem.dwStateMask = TCIS_HIGHLIGHTED; + tcItem.dwState = TCIS_HIGHLIGHTED; + ok ( SendMessage(hTab, TCM_SETITEM, 0, (LPARAM) &tcItem), "Setting new item failed.\n"); + tcItem.dwState = 0; + ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); + ok (tcItem.dwState == TCIS_HIGHLIGHTED, "TCIS_HIGHLIGHTED should be set.\n"); + tcItem.mask = TCIF_STATE; + tcItem.dwStateMask = TCIS_BUTTONPRESSED; + tcItem.dwState = 0; + ok ( SendMessage(hTab, TCM_GETITEM, 0, (LPARAM) &tcItem), "Getting item failed.\n"); + ok (tcItem.dwState == TCIS_BUTTONPRESSED, "TCIS_BUTTONPRESSED should be set.\n"); } /* Testing GetSet ToolTip */ diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 449348f127a..aa2b6273847 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -715,7 +715,7 @@ static void test_states(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 640; - d3dpp.BackBufferHeight = 480; + d3dpp.BackBufferHeight = 480; d3dpp.BackBufferFormat = d3ddm.Format; hr = IDirect3D8_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, @@ -808,7 +808,7 @@ static void test_scene(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; d3dpp.BackBufferFormat = d3ddm.Format; @@ -914,7 +914,7 @@ static void test_shader(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; d3dpp.BackBufferFormat = d3ddm.Format; @@ -1111,7 +1111,7 @@ static void test_limits(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; @@ -1174,7 +1174,7 @@ static void test_lights(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; @@ -1256,7 +1256,7 @@ static void test_render_zero_triangles(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index a0597f5492e..f2547197f74 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -725,9 +725,14 @@ static void test_reset(void) IDirect3DSurface9 *surface; IDirect3DTexture9 *texture; IDirect3DVertexShader9 *shader; - BOOL support_800x600 = FALSE; - UINT i; + UINT i, adapter_mode_count; D3DLOCKED_RECT lockrect; + struct + { + UINT w; + UINT h; + } *modes = NULL; + UINT mode_count = 0; pD3d = pDirect3DCreate9( D3D_SDK_VERSION ); ok(pD3d != NULL, "Failed to create IDirect3D9 object\n"); @@ -736,23 +741,27 @@ static void test_reset(void) if (!pD3d || !hwnd) goto cleanup; IDirect3D9_GetAdapterDisplayMode( pD3d, D3DADAPTER_DEFAULT, &d3ddm ); - ZeroMemory( &d3dpp, sizeof(d3dpp) ); - d3dpp.Windowed = FALSE; - d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; - d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; - d3dpp.BackBufferFormat = d3ddm.Format; - d3dpp.EnableAutoDepthStencil = TRUE; - d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8; - - for(i = 0; i < IDirect3D9_GetAdapterModeCount(pD3d, D3DADAPTER_DEFAULT, d3ddm.Format); i++) { + adapter_mode_count = IDirect3D9_GetAdapterModeCount(pD3d, D3DADAPTER_DEFAULT, d3ddm.Format); + modes = HeapAlloc(GetProcessHeap(), 0, sizeof(*modes) * adapter_mode_count); + for(i = 0; i < adapter_mode_count; ++i) + { + int j; ZeroMemory( &d3ddm2, sizeof(d3ddm2) ); hr = IDirect3D9_EnumAdapterModes(pD3d, D3DADAPTER_DEFAULT, d3ddm.Format, i, &d3ddm2); ok(hr == D3D_OK, "IDirect3D9_EnumAdapterModes returned %#x\n", hr); - if(d3ddm2.Width == 800 && d3ddm2.Height == 600) { - support_800x600 = TRUE; + for (j = 0; j < mode_count; ++j) + { + if (modes[j].w == d3ddm2.Width && modes[j].h == d3ddm2.Height) + break; + } + if (j == mode_count) + { + modes[j].w = d3ddm2.Width; + modes[j].h = d3ddm2.Height; + ++mode_count; } + /* We use them as invalid modes */ if((d3ddm2.Width == 801 && d3ddm2.Height == 600) || (d3ddm2.Width == 32 && d3ddm2.Height == 32)) { @@ -761,11 +770,25 @@ static void test_reset(void) goto cleanup; } } - if(!support_800x600) { - skip("Mode 800x600 not supported, skipping mode tests\n"); + + if (mode_count < 2) + { + skip("Less than 2 modes supported, skipping mode tests\n"); goto cleanup; } + i = 0; + if (modes[i].w == orig_width && modes[i].h == orig_height) ++i; + + ZeroMemory( &d3dpp, sizeof(d3dpp) ); + d3dpp.Windowed = FALSE; + d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; + d3dpp.BackBufferWidth = modes[i].w; + d3dpp.BackBufferHeight = modes[i].h; + d3dpp.BackBufferFormat = d3ddm.Format; + d3dpp.EnableAutoDepthStencil = TRUE; + d3dpp.AutoDepthStencilFormat = D3DFMT_D24S8; + hr = IDirect3D9_CreateDevice( pD3d, D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL /* no NULLREF here */, hwnd, D3DCREATE_SOFTWARE_VERTEXPROCESSING, &d3dpp, &pDevice ); @@ -779,8 +802,8 @@ static void test_reset(void) width = GetSystemMetrics(SM_CXSCREEN); height = GetSystemMetrics(SM_CYSCREEN); - ok(width == 800, "Screen width is %d\n", width); - ok(height == 600, "Screen height is %d\n", height); + ok(width == modes[i].w, "Screen width is %u, expected %u\n", width, modes[i].w); + ok(height == modes[i].h, "Screen height is %u, expected %u\n", height, modes[i].h); hr = IDirect3DDevice9_GetViewport(pDevice, &vp); ok(hr == D3D_OK, "IDirect3DDevice9_GetViewport failed with %08x\n", hr); @@ -788,13 +811,15 @@ static void test_reset(void) { ok(vp.X == 0, "D3DVIEWPORT->X = %d\n", vp.X); ok(vp.Y == 0, "D3DVIEWPORT->Y = %d\n", vp.Y); - ok(vp.Width == 800, "D3DVIEWPORT->Width = %d\n", vp.Width); - ok(vp.Height == 600, "D3DVIEWPORT->Height = %d\n", vp.Height); + ok(vp.Width == modes[i].w, "D3DVIEWPORT->Width = %u, expected %u\n", vp.Width, modes[i].w); + ok(vp.Height == modes[i].h, "D3DVIEWPORT->Height = %u, expected %u\n", vp.Height, modes[i].h); ok(vp.MinZ == 0, "D3DVIEWPORT->MinZ = %f\n", vp.MinZ); ok(vp.MaxZ == 1, "D3DVIEWPORT->MaxZ = %f\n", vp.MaxZ); } + + i = 1; vp.X = 10; - vp.X = 20; + vp.Y = 20; vp.MinZ = 2; vp.MaxZ = 3; hr = IDirect3DDevice9_SetViewport(pDevice, &vp); @@ -803,8 +828,8 @@ static void test_reset(void) ZeroMemory( &d3dpp, sizeof(d3dpp) ); d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.Windowed = FALSE; - d3dpp.BackBufferWidth = 640; - d3dpp.BackBufferHeight = 480; + d3dpp.BackBufferWidth = modes[i].w; + d3dpp.BackBufferHeight = modes[i].h; d3dpp.BackBufferFormat = d3ddm.Format; hr = IDirect3DDevice9_Reset(pDevice, &d3dpp); ok(hr == D3D_OK, "IDirect3DDevice9_Reset failed with %08x\n", hr); @@ -818,16 +843,16 @@ static void test_reset(void) { ok(vp.X == 0, "D3DVIEWPORT->X = %d\n", vp.X); ok(vp.Y == 0, "D3DVIEWPORT->Y = %d\n", vp.Y); - ok(vp.Width == 640, "D3DVIEWPORT->Width = %d\n", vp.Width); - ok(vp.Height == 480, "D3DVIEWPORT->Height = %d\n", vp.Height); + ok(vp.Width == modes[i].w, "D3DVIEWPORT->Width = %u, expected %u\n", vp.Width, modes[i].w); + ok(vp.Height == modes[i].h, "D3DVIEWPORT->Height = %u, expected %u\n", vp.Height, modes[i].h); ok(vp.MinZ == 0, "D3DVIEWPORT->MinZ = %f\n", vp.MinZ); ok(vp.MaxZ == 1, "D3DVIEWPORT->MaxZ = %f\n", vp.MaxZ); } width = GetSystemMetrics(SM_CXSCREEN); height = GetSystemMetrics(SM_CYSCREEN); - ok(width == 640, "Screen width is %d\n", width); - ok(height == 480, "Screen height is %d\n", height); + ok(width == modes[i].w, "Screen width is %u, expected %u\n", width, modes[i].w); + ok(height == modes[i].h, "Screen height is %u, expected %u\n", height, modes[i].h); hr = IDirect3DDevice9_GetSwapChain(pDevice, 0, &pSwapchain); ok(hr == D3D_OK, "IDirect3DDevice9_GetSwapChain returned %08x\n", hr); @@ -838,8 +863,10 @@ static void test_reset(void) ok(hr == D3D_OK, "IDirect3DSwapChain9_GetPresentParameters returned %08x\n", hr); if(SUCCEEDED(hr)) { - ok(d3dpp.BackBufferWidth == 640, "Back buffer width is %d\n", d3dpp.BackBufferWidth); - ok(d3dpp.BackBufferHeight == 480, "Back buffer height is %d\n", d3dpp.BackBufferHeight); + ok(d3dpp.BackBufferWidth == modes[i].w, "Back buffer width is %u, expected %u\n", + d3dpp.BackBufferWidth, modes[i].w); + ok(d3dpp.BackBufferHeight == modes[i].h, "Back buffer height is %u, expected %u\n", + d3dpp.BackBufferHeight, modes[i].h); } IDirect3DSwapChain9_Release(pSwapchain); } @@ -848,7 +875,7 @@ static void test_reset(void) d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.Windowed = TRUE; d3dpp.BackBufferWidth = 400; - d3dpp.BackBufferHeight = 300; + d3dpp.BackBufferHeight = 300; hr = IDirect3DDevice9_Reset(pDevice, &d3dpp); ok(hr == D3D_OK, "IDirect3DDevice9_Reset failed with %08x\n", hr); hr = IDirect3DDevice9_TestCooperativeLevel(pDevice); @@ -891,7 +918,7 @@ static void test_reset(void) d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.Windowed = TRUE; d3dpp.BackBufferWidth = 400; - d3dpp.BackBufferHeight = 300; + d3dpp.BackBufferHeight = 300; /* _Reset fails if there is a resource in the default pool */ hr = IDirect3DDevice9_CreateOffscreenPlainSurface(pDevice, 16, 16, D3DFMT_R5G6B5, D3DPOOL_DEFAULT, &surface, NULL); @@ -1006,7 +1033,7 @@ static void test_reset(void) d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.Windowed = FALSE; d3dpp.BackBufferWidth = 32; - d3dpp.BackBufferHeight = 32; + d3dpp.BackBufferHeight = 32; hr = IDirect3DDevice9_Reset(pDevice, &d3dpp); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_Reset to w=32, h=32, windowed=FALSE failed with %08x\n", hr); hr = IDirect3DDevice9_TestCooperativeLevel(pDevice); @@ -1016,13 +1043,14 @@ static void test_reset(void) d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.Windowed = FALSE; d3dpp.BackBufferWidth = 801; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; hr = IDirect3DDevice9_Reset(pDevice, &d3dpp); ok(hr == D3DERR_INVALIDCALL, "IDirect3DDevice9_Reset to w=801, h=600, windowed=FALSE failed with %08x\n", hr); hr = IDirect3DDevice9_TestCooperativeLevel(pDevice); ok(hr == D3DERR_DEVICENOTRESET, "IDirect3DDevice9_TestCooperativeLevel after a failed reset returned %#x\n", hr); cleanup: + HeapFree(GetProcessHeap(), 0, modes); if(pD3d) IDirect3D9_Release(pD3d); if(pDevice) IDirect3D9_Release(pDevice); } @@ -1141,7 +1169,7 @@ static void test_scene(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; @@ -1294,7 +1322,7 @@ static void test_limits(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; @@ -1362,7 +1390,7 @@ static void test_depthstenciltest(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.EnableAutoDepthStencil = TRUE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; @@ -1431,7 +1459,7 @@ static void test_depthstenciltest(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.EnableAutoDepthStencil = FALSE; d3dpp.AutoDepthStencilFormat = D3DFMT_UNKNOWN; @@ -1465,7 +1493,7 @@ static void test_depthstenciltest(void) d3dpp.Windowed = TRUE; d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD; d3dpp.BackBufferWidth = 800; - d3dpp.BackBufferHeight = 600; + d3dpp.BackBufferHeight = 600; d3dpp.BackBufferFormat = d3ddm.Format; d3dpp.EnableAutoDepthStencil = FALSE; d3dpp.AutoDepthStencilFormat = D3DFMT_D16; diff --git a/dlls/d3dxof/d3dxof.c b/dlls/d3dxof/d3dxof.c index 6f9b266c782..5d42d535706 100644 --- a/dlls/d3dxof/d3dxof.c +++ b/dlls/d3dxof/d3dxof.c @@ -1100,9 +1100,8 @@ static HRESULT WINAPI IDirectXFileEnumObjectImpl_GetNextDataObject(IDirectXFileE error: HeapFree(GetProcessHeap(), 0, This->buf.pxo_tab); + HeapFree(GetProcessHeap(), 0, This->buf.pxo->pdata); HeapFree(GetProcessHeap(), 0, pstrings); - if (This->buf.pxo->pdata) - HeapFree(GetProcessHeap(), 0, This->buf.pxo->pdata); return hr; } diff --git a/dlls/hal/hal.spec b/dlls/hal/hal.spec index 83eedea2b6e..0824e49ec0b 100644 --- a/dlls/hal/hal.spec +++ b/dlls/hal/hal.spec @@ -15,7 +15,7 @@ @ stub KeTryToAcquireQueuedSpinLockRaiseToSynch @ stdcall -norelay KfAcquireSpinLock(ptr) @ stdcall -norelay KfLowerIrql(long) -@ stdcall -norelay KfRaiseIrql() +@ stdcall -norelay KfRaiseIrql(long) @ stdcall -norelay KfReleaseSpinLock(ptr long) @ stub HalAcquireDisplayOwnership @ stub HalAdjustResourceList diff --git a/dlls/kernel32/tests/profile.c b/dlls/kernel32/tests/profile.c index 7b5769939a5..5651deb26b7 100644 --- a/dlls/kernel32/tests/profile.c +++ b/dlls/kernel32/tests/profile.c @@ -860,13 +860,16 @@ static void test_WritePrivateProfileString(void) ok(check_file_data(path, data), "File doesn't match\n"); DeleteFileA(path); - /* empty lpAppName */ + if (0) + { + /* empty lpAppName, crashes on NT4 and higher */ data = "[]\r\n" "key=string\r\n"; ret = WritePrivateProfileStringA("", "key", "string", path); ok(ret == TRUE, "Expected TRUE, got %d\n", ret); ok(check_file_data(path, data), "File doesn't match\n"); DeleteFileA(path); + } /* NULL lpKeyName */ data = ""; @@ -878,7 +881,9 @@ static void test_WritePrivateProfileString(void) } DeleteFileA(path); - /* empty lpKeyName */ + if (0) + { + /* empty lpKeyName, crashes on NT4 and higher */ data = "[App]\r\n" "=string\r\n"; ret = WritePrivateProfileStringA("App", "", "string", path); @@ -888,6 +893,7 @@ static void test_WritePrivateProfileString(void) ok(check_file_data(path, data), "File doesn't match\n"); } DeleteFileA(path); + } /* NULL lpString */ data = ""; @@ -904,10 +910,7 @@ static void test_WritePrivateProfileString(void) "key=\r\n"; ret = WritePrivateProfileStringA("App", "key", "", path); ok(ret == TRUE, "Expected TRUE, got %d\n", ret); - todo_wine - { - ok(check_file_data(path, data), "File doesn't match\n"); - } + ok(check_file_data(path, data), "File doesn't match\n"); DeleteFileA(path); /* empty lpFileName */ diff --git a/dlls/msctf/threadmgr.c b/dlls/msctf/threadmgr.c index b2ec069fa93..5461425a84c 100644 --- a/dlls/msctf/threadmgr.c +++ b/dlls/msctf/threadmgr.c @@ -372,9 +372,14 @@ static WINAPI HRESULT ThreadMgrSource_AdviseSink(ITfSource *iface, static WINAPI HRESULT ThreadMgrSource_UnadviseSink(ITfSource *iface, DWORD pdwCookie) { + ThreadMgrSink *sink = (ThreadMgrSink*)pdwCookie; ThreadMgr *This = impl_from_ITfSourceVtbl(iface); - FIXME("STUB:(%p)\n",This); - return E_NOTIMPL; + TRACE("(%p) %x\n",This,pdwCookie); + + list_remove(&sink->entry); + free_sink(sink); + + return S_OK; } static const ITfSourceVtbl ThreadMgr_SourceVtbl = diff --git a/dlls/msi/package.c b/dlls/msi/package.c index ec8495fb9ed..82de944e7a7 100644 --- a/dlls/msi/package.c +++ b/dlls/msi/package.c @@ -260,7 +260,7 @@ static LPWSTR get_fusion_filename(MSIPACKAGE *package) if (!check) { - if (file) msi_free(file); + msi_free(file); return NULL; } diff --git a/dlls/msi/tests/msi.c b/dlls/msi/tests/msi.c index 1c843ef0c71..928e48a9130 100644 --- a/dlls/msi/tests/msi.c +++ b/dlls/msi/tests/msi.c @@ -7771,7 +7771,7 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid ok(context == MSIINSTALLCONTEXT_USERMANAGED, "Expected MSIINSTALLCONTEXT_USERMANAGED, got %d\n", context); ok(size == lstrlenA(expectedsid) * sizeof(WCHAR), - "Expected %d, got %d\n", lstrlenA(expectedsid) * sizeof(WCHAR), size); + "Expected %d*sizeof(WCHAR), got %d\n", lstrlenA(expectedsid), size); /* pcchTargetUserSid is exactly the length of szTargetUserSid */ lstrcpyA(patchcode, "apple"); @@ -7792,7 +7792,7 @@ static void test_MsiEnumPatchesEx_usermanaged(LPCSTR usersid, LPCSTR expectedsid ok(!strncmp(targetsid, expectedsid, lstrlenA(expectedsid) - 1), "Expected \"%s\", got \"%s\"\n", expectedsid, targetsid); ok(size == lstrlenA(expectedsid) * sizeof(WCHAR), - "Expected %d, got %d\n", lstrlenA(expectedsid) * sizeof(WCHAR), size); + "Expected %d*sizeof(WCHAR), got %d\n", lstrlenA(expectedsid), size); /* pcchTargetUserSid has enough room for NULL terminator */ lstrcpyA(patchcode, "apple"); diff --git a/dlls/msvcrt/msvcrt.spec b/dlls/msvcrt/msvcrt.spec index 1a9bc125f9d..145b2b0fd57 100644 --- a/dlls/msvcrt/msvcrt.spec +++ b/dlls/msvcrt/msvcrt.spec @@ -508,6 +508,8 @@ @ cdecl _unloaddll(long) @ cdecl _unlock(long) @ cdecl _utime(str ptr) +@ cdecl _vscprintf(str ptr) +@ cdecl _vscwprintf(wstr ptr) @ cdecl _vsnprintf(ptr long str ptr) MSVCRT_vsnprintf @ cdecl _vsnwprintf(ptr long wstr ptr) MSVCRT_vsnwprintf @ cdecl _waccess(wstr long) diff --git a/dlls/msvcrt/tests/printf.c b/dlls/msvcrt/tests/printf.c index d25734e195e..5f72b47a80b 100644 --- a/dlls/msvcrt/tests/printf.c +++ b/dlls/msvcrt/tests/printf.c @@ -726,6 +726,48 @@ static void test_vsnwprintf(void) ok( !strcmp(buf, "onetwothree"), "got %s expected 'onetwothree'\n", buf ); } +static int (*p__vscprintf)(const char *format, __ms_va_list valist); +static int (*p__vscwprintf)(const wchar_t *format, __ms_va_list valist); + +static int __cdecl _vscprintf_wrapper(const char *format, ...) +{ + int ret; + __ms_va_list valist; + __ms_va_start(valist, format); + ret = p__vscprintf(format, valist); + __ms_va_end(valist); + return ret; +} + +static void test_vscprintf(void) +{ + int ret; + + ret = _vscprintf_wrapper( "%s %d", "number", 1 ); + ok( ret == 8, "got %d expected 8\n", ret ); +} + +static int __cdecl _vscwprintf_wrapper(const wchar_t *format, ...) +{ + int ret; + __ms_va_list valist; + __ms_va_start(valist, format); + ret = p__vscwprintf(format, valist); + __ms_va_end(valist); + return ret; +} + +static void test_vscwprintf(void) +{ + const wchar_t format[] = {'%','s',' ','%','d',0}; + const wchar_t number[] = {'n','u','m','b','e','r',0}; + + int ret; + + ret = _vscwprintf_wrapper( format, number, 1 ); + ok( ret == 8, "got %d expected 8\n", ret ); +} + START_TEST(printf) { test_sprintf(); @@ -733,4 +775,10 @@ START_TEST(printf) test_snprintf(); test_fcvt(); test_vsnwprintf(); + + p__vscprintf = (void *)GetProcAddress(GetModuleHandle("msvcrt.dll"), "_vscprintf"); + p__vscwprintf = (void *)GetProcAddress(GetModuleHandle("msvcrt.dll"), "_vscwprintf"); + + if (p__vscprintf) test_vscprintf(); + if (p__vscwprintf) test_vscwprintf(); } diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index 37004cf4bdd..09c87dd615a 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -200,11 +200,11 @@ static inline int pf_output_stringW( pf_output *out, LPCWSTR str, int len ) if( space >= len ) { - memcpy( p, str, len*sizeof(WCHAR) ); + if (out->buf.W) memcpy( p, str, len*sizeof(WCHAR) ); out->used += len; return len; } - if( space > 0 ) + if( space > 0 && out->buf.W ) memcpy( p, str, space*sizeof(WCHAR) ); out->used += len; } @@ -215,11 +215,11 @@ static inline int pf_output_stringW( pf_output *out, LPCWSTR str, int len ) if( space >= n ) { - WideCharToMultiByte( CP_ACP, 0, str, len, p, n, NULL, NULL ); + if (out->buf.A) WideCharToMultiByte( CP_ACP, 0, str, len, p, n, NULL, NULL ); out->used += n; return len; } - if( space > 0 ) + if( space > 0 && out->buf.A ) WideCharToMultiByte( CP_ACP, 0, str, len, p, space, NULL, NULL ); out->used += n; } @@ -238,11 +238,11 @@ static inline int pf_output_stringA( pf_output *out, LPCSTR str, int len ) if( space >= len ) { - memcpy( p, str, len ); + if (out->buf.A) memcpy( p, str, len ); out->used += len; return len; } - if( space > 0 ) + if( space > 0 && out->buf.A ) memcpy( p, str, space ); out->used += len; } @@ -253,11 +253,11 @@ static inline int pf_output_stringA( pf_output *out, LPCSTR str, int len ) if( space >= n ) { - MultiByteToWideChar( CP_ACP, 0, str, len, p, n ); + if (out->buf.W) MultiByteToWideChar( CP_ACP, 0, str, len, p, n ); out->used += n; return len; } - if( space > 0 ) + if( space > 0 && out->buf.W ) MultiByteToWideChar( CP_ACP, 0, str, len, p, space ); out->used += n; } @@ -804,6 +804,14 @@ int CDECL MSVCRT_vsprintf( char *str, const char *format, __ms_va_list valist) } /********************************************************************* + * _vscprintf (MSVCRT.@) + */ +int CDECL _vscprintf( const char *format, __ms_va_list valist ) +{ + return MSVCRT_vsnprintf( NULL, INT_MAX, format, valist ); +} + +/********************************************************************* * _snprintf (MSVCRT.@) */ int CDECL MSVCRT__snprintf(char *str, unsigned int len, const char *format, ...) @@ -882,6 +890,14 @@ int CDECL MSVCRT_vswprintf( MSVCRT_wchar_t* str, const MSVCRT_wchar_t* format, _ } /********************************************************************* + * _vscwprintf (MSVCRT.@) + */ +int CDECL _vscwprintf( const MSVCRT_wchar_t *format, __ms_va_list args ) +{ + return MSVCRT_vsnwprintf( NULL, INT_MAX, format, args ); +} + +/********************************************************************* * vswprintf_s (MSVCRT.@) */ int CDECL MSVCRT_vswprintf_s( MSVCRT_wchar_t* str, MSVCRT_size_t num, const MSVCRT_wchar_t* format, __ms_va_list args ) diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in index 98fe9217601..a37204438ea 100644 --- a/dlls/ntdll/Makefile.in +++ b/dlls/ntdll/Makefile.in @@ -31,7 +31,6 @@ C_SRCS = \ path.c \ printf.c \ process.c \ - pthread.c \ reg.c \ relay.c \ resource.c \ diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h index fa99b3164b8..56e2b2fd645 100644 --- a/dlls/ntdll/ntdll_misc.h +++ b/dlls/ntdll/ntdll_misc.h @@ -62,7 +62,6 @@ extern size_t get_signal_stack_total_size(void); extern void version_init( const WCHAR *appname ); extern void debug_init(void); extern HANDLE thread_init(void); -extern void pthread_init(void); extern void actctx_init(void); extern void virtual_init(void); extern void virtual_init_threading(void); diff --git a/dlls/ntdll/pthread.c b/dlls/ntdll/pthread.c deleted file mode 100644 index 60b6033c3f3..00000000000 --- a/dlls/ntdll/pthread.c +++ /dev/null @@ -1,599 +0,0 @@ -/* - * pthread emulation for re-entrant libcs - * - * Copyright 1999 Ove Kåven - * Copyright 2003 Alexandre Julliard - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2.1 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -#include "config.h" -#include "wine/port.h" - -#ifdef HAVE_PTHREAD_H - -#define _GNU_SOURCE /* we may need to override some GNU extensions */ - -#include -#include -#include -#include -#include -#ifdef HAVE_UNISTD_H -# include -#endif -#include -#include -#ifdef HAVE_SYS_SOCKET_H -# include -#endif -#ifdef HAVE_SYS_MMAN_H -#include -#endif - -#include "windef.h" -#include "winbase.h" -#include "winternl.h" -#include "ntdll_misc.h" -#include "wine/pthread.h" - -#define P_OUTPUT(stuff) write(2,stuff,strlen(stuff)) - -/* NOTE: This is a truly extremely incredibly ugly hack! - * But it does seem to work... */ - -/* assume that pthread_mutex_t has room for at least one pointer, - * and hope that the users of pthread_mutex_t considers it opaque - * (never checks what's in it) - * also: assume that static initializer sets pointer to NULL - */ -typedef struct -{ -#ifdef __GLIBC__ - int reserved; -#endif - CRITICAL_SECTION *critsect; -} *wine_mutex; - -/* see wine_mutex above for comments */ -typedef struct { - RTL_RWLOCK *lock; -} *wine_rwlock; - -struct pthread_thread_init -{ - void* (*start_routine)(void*); - void* arg; -}; - -static void wine_pthread_exit(void *retval, char *currentframe) -{ - RtlFreeThreadActivationContextStack(); - RtlExitUserThread( PtrToUlong(retval) ); -} - -static void CALLBACK pthread_thread_start(LPVOID data) -{ - struct pthread_thread_init init = *(struct pthread_thread_init*)data; - RtlFreeHeap(GetProcessHeap(),0,data); - wine_pthread_exit( init.start_routine(init.arg), NULL ); -} - -static int wine_pthread_create(pthread_t* thread, const pthread_attr_t* attr, void* - (*start_routine)(void *), void* arg) -{ - HANDLE handle; - CLIENT_ID client_id; - struct pthread_thread_init* idata; - - if (!(idata = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(*idata)))) return ENOMEM; - - idata->start_routine = start_routine; - idata->arg = arg; - if (!RtlCreateUserThread( NtCurrentProcess(), NULL, FALSE, NULL, 0, 0, - pthread_thread_start, idata, &handle, &client_id )) - { - NtClose( handle ); - *thread = (pthread_t)client_id.UniqueThread; - } - else - { - RtlFreeHeap( GetProcessHeap(), 0, idata ); - return EAGAIN; - } - - return 0; -} - -static int wine_pthread_cancel(pthread_t thread) -{ - CLIENT_ID cid; - NTSTATUS status; - HANDLE handle; - - cid.UniqueProcess = 0; - cid.UniqueThread = (HANDLE)thread; - status = NtOpenThread( &handle, THREAD_TERMINATE, NULL, &cid ); - if (!status) - { - status = NtTerminateThread( handle, 0 ); - NtClose( handle ); - } - if (status) return EINVAL; - return 0; -} - -static int wine_pthread_join(pthread_t thread, void **value_ptr) -{ - THREAD_BASIC_INFORMATION info; - CLIENT_ID cid; - NTSTATUS status; - HANDLE handle; - - cid.UniqueProcess = 0; - cid.UniqueThread = (HANDLE)thread; - status = NtOpenThread( &handle, THREAD_QUERY_INFORMATION|SYNCHRONIZE, NULL, &cid ); - if (!status) - { - NtWaitForMultipleObjects( 1, &handle, FALSE, FALSE, NULL ); - status = NtQueryInformationThread( handle, ThreadBasicInformation, &info, sizeof(info), NULL ); - NtClose( handle ); - if (!status) *value_ptr = UlongToPtr(info.ExitStatus); - } - if (status) return EINVAL; /* FIXME: make this more correctly match windows errors */ - return 0; -} - -/*FIXME: not sure what to do with this one... */ -static int wine_pthread_detach(pthread_t thread) -{ - P_OUTPUT("FIXME:pthread_detach\n"); - return 0; -} - -/***** MUTEXES *****/ - -static int wine_pthread_mutex_init(pthread_mutex_t *mutex, - const pthread_mutexattr_t *mutexattr) -{ - /* glibc has a tendency to initialize mutexes very often, even - in situations where they are not really used later on. - - As for us, initializing a mutex is very expensive, we postpone - the real initialization until the time the mutex is first used. */ - - ((wine_mutex)mutex)->critsect = NULL; - return 0; -} - -static void mutex_real_init( pthread_mutex_t *mutex ) -{ - CRITICAL_SECTION *critsect = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(CRITICAL_SECTION)); - RtlInitializeCriticalSection(critsect); - - if (interlocked_cmpxchg_ptr((void**)&(((wine_mutex)mutex)->critsect),critsect,NULL) != NULL) { - /* too late, some other thread already did it */ - RtlDeleteCriticalSection(critsect); - RtlFreeHeap(GetProcessHeap(), 0, critsect); - } -} - -static int wine_pthread_mutex_lock(pthread_mutex_t *mutex) -{ - if (!((wine_mutex)mutex)->critsect) - mutex_real_init( mutex ); - - RtlEnterCriticalSection(((wine_mutex)mutex)->critsect); - return 0; -} - -static int wine_pthread_mutex_trylock(pthread_mutex_t *mutex) -{ - if (!((wine_mutex)mutex)->critsect) - mutex_real_init( mutex ); - - if (!RtlTryEnterCriticalSection(((wine_mutex)mutex)->critsect)) return EBUSY; - return 0; -} - -static int wine_pthread_mutex_unlock(pthread_mutex_t *mutex) -{ - CRITICAL_SECTION *crit = ((wine_mutex)mutex)->critsect; - - if (!crit) return 0; - if (crit->OwningThread != ULongToHandle(GetCurrentThreadId())) return EPERM; - RtlLeaveCriticalSection( crit ); - return 0; -} - -static int wine_pthread_mutex_destroy(pthread_mutex_t *mutex) -{ - if (!((wine_mutex)mutex)->critsect) return 0; - if (((wine_mutex)mutex)->critsect->RecursionCount) { -#if 0 /* there seems to be a bug in libc6 that makes this a bad idea */ - return EBUSY; -#else - while (((wine_mutex)mutex)->critsect->RecursionCount) - RtlLeaveCriticalSection(((wine_mutex)mutex)->critsect); -#endif - } - RtlDeleteCriticalSection(((wine_mutex)mutex)->critsect); - RtlFreeHeap(GetProcessHeap(), 0, ((wine_mutex)mutex)->critsect); - ((wine_mutex)mutex)->critsect = NULL; - return 0; -} - -/***** READ-WRITE LOCKS *****/ - -static void rwlock_real_init(pthread_rwlock_t *rwlock) -{ - RTL_RWLOCK *lock = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(RTL_RWLOCK)); - RtlInitializeResource(lock); - - if (interlocked_cmpxchg_ptr((void**)&(((wine_rwlock)rwlock)->lock),lock,NULL) != NULL) { - /* too late, some other thread already did it */ - RtlDeleteResource(lock); - RtlFreeHeap(GetProcessHeap(), 0, lock); - } -} - -static int wine_pthread_rwlock_init(pthread_rwlock_t *rwlock, const pthread_rwlockattr_t *rwlock_attr) -{ - ((wine_rwlock)rwlock)->lock = NULL; - return 0; -} - -static int wine_pthread_rwlock_destroy(pthread_rwlock_t *rwlock) -{ - if (!((wine_rwlock)rwlock)->lock) return 0; - RtlDeleteResource(((wine_rwlock)rwlock)->lock); - RtlFreeHeap(GetProcessHeap(), 0, ((wine_rwlock)rwlock)->lock); - return 0; -} - -static int wine_pthread_rwlock_rdlock(pthread_rwlock_t *rwlock) -{ - if (!((wine_rwlock)rwlock)->lock) - rwlock_real_init( rwlock ); - - while(TRUE) - if (RtlAcquireResourceShared(((wine_rwlock)rwlock)->lock, TRUE)) - return 0; -} - -static int wine_pthread_rwlock_tryrdlock(pthread_rwlock_t *rwlock) -{ - if (!((wine_rwlock)rwlock)->lock) - rwlock_real_init( rwlock ); - - if (!RtlAcquireResourceShared(((wine_rwlock)rwlock)->lock, FALSE)) return EBUSY; - return 0; -} - -static int wine_pthread_rwlock_wrlock(pthread_rwlock_t *rwlock) -{ - if (!((wine_rwlock)rwlock)->lock) - rwlock_real_init( rwlock ); - - while(TRUE) - if (RtlAcquireResourceExclusive(((wine_rwlock)rwlock)->lock, TRUE)) - return 0; -} - -static int wine_pthread_rwlock_trywrlock(pthread_rwlock_t *rwlock) -{ - if (!((wine_rwlock)rwlock)->lock) - rwlock_real_init( rwlock ); - - if (!RtlAcquireResourceExclusive(((wine_rwlock)rwlock)->lock, FALSE)) return EBUSY; - return 0; -} - -static int wine_pthread_rwlock_unlock(pthread_rwlock_t *rwlock) -{ - if (!((wine_rwlock)rwlock)->lock) return 0; - RtlReleaseResource( ((wine_rwlock)rwlock)->lock ); - return 0; -} - -/***** CONDITIONS *****/ - -/* The condition code is basically cut-and-pasted from Douglas - * Schmidt's paper: - * "Strategies for Implementing POSIX Condition Variables on Win32", - * at http://www.cs.wustl.edu/~schmidt/win32-cv-1.html and - * http://www.cs.wustl.edu/~schmidt/win32-cv-2.html. - * This paper formed the basis for the condition variable - * implementation used in the ACE library. - */ - -/* Possible problems with ACE: - * - unimplemented pthread_mutexattr_init - */ -typedef struct { - /* Number of waiting threads. */ - int waiters_count; - - /* Serialize access to . */ - CRITICAL_SECTION waiters_count_lock; - - /* - * Semaphore used to queue up threads waiting for the condition to - * become signaled. - */ - HANDLE sema; - - /* - * An auto-reset event used by the broadcast/signal thread to wait - * for all the waiting thread(s) to wake up and be released from the - * semaphore. - */ - HANDLE waiters_done; - - /* - * Keeps track of whether we were broadcasting or signaling. This - * allows us to optimize the code if we're just signaling. - */ - size_t was_broadcast; -} wine_cond_detail; - -/* see wine_mutex above for comments */ -typedef struct { - wine_cond_detail *cond; -} *wine_cond; - -static void wine_cond_real_init(pthread_cond_t *cond) -{ - wine_cond_detail *detail = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(wine_cond_detail)); - detail->waiters_count = 0; - detail->was_broadcast = 0; - NtCreateSemaphore( &detail->sema, SEMAPHORE_ALL_ACCESS, NULL, 0, 0x7fffffff ); - NtCreateEvent( &detail->waiters_done, EVENT_ALL_ACCESS, NULL, FALSE, FALSE ); - RtlInitializeCriticalSection (&detail->waiters_count_lock); - - if (interlocked_cmpxchg_ptr((void**)&(((wine_cond)cond)->cond), detail, NULL) != NULL) - { - /* too late, some other thread already did it */ - P_OUTPUT("FIXME:pthread_cond_init:expect troubles...\n"); - NtClose(detail->sema); - RtlDeleteCriticalSection(&detail->waiters_count_lock); - NtClose(detail->waiters_done); - RtlFreeHeap(GetProcessHeap(), 0, detail); - } -} - -static int wine_pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *cond_attr) -{ - /* The same as for wine_pthread_mutex_init, we postpone initialization - until condition is really used.*/ - ((wine_cond)cond)->cond = NULL; - return 0; -} - -static int wine_pthread_cond_destroy(pthread_cond_t *cond) -{ - wine_cond_detail *detail = ((wine_cond)cond)->cond; - - if (!detail) return 0; - NtClose(detail->sema); - RtlDeleteCriticalSection(&detail->waiters_count_lock); - NtClose(detail->waiters_done); - RtlFreeHeap(GetProcessHeap(), 0, detail); - ((wine_cond)cond)->cond = NULL; - return 0; -} - -static int wine_pthread_cond_signal(pthread_cond_t *cond) -{ - int have_waiters; - wine_cond_detail *detail; - - if ( !((wine_cond)cond)->cond ) wine_cond_real_init(cond); - detail = ((wine_cond)cond)->cond; - - RtlEnterCriticalSection (&detail->waiters_count_lock); - have_waiters = detail->waiters_count > 0; - RtlLeaveCriticalSection (&detail->waiters_count_lock); - - /* If there aren't any waiters, then this is a no-op. */ - if (have_waiters) - NtReleaseSemaphore(detail->sema, 1, NULL); - - return 0; -} - -static int wine_pthread_cond_broadcast(pthread_cond_t *cond) -{ - int have_waiters = 0; - wine_cond_detail *detail; - - if ( !((wine_cond)cond)->cond ) wine_cond_real_init(cond); - detail = ((wine_cond)cond)->cond; - - /* - * This is needed to ensure that and are - * consistent relative to each other. - */ - RtlEnterCriticalSection (&detail->waiters_count_lock); - - if (detail->waiters_count > 0) { - /* - * We are broadcasting, even if there is just one waiter... - * Record that we are broadcasting, which helps optimize - * for the non-broadcast case. - */ - detail->was_broadcast = 1; - have_waiters = 1; - } - - if (have_waiters) { - /* Wake up all the waiters atomically. */ - NtReleaseSemaphore(detail->sema, detail->waiters_count, NULL); - - RtlLeaveCriticalSection (&detail->waiters_count_lock); - - /* Wait for all the awakened threads to acquire the counting semaphore. */ - NtWaitForMultipleObjects( 1, &detail->waiters_done, FALSE, FALSE, NULL ); - - /* - * This assignment is okay, even without the held - * because no other waiter threads can wake up to access it. - */ - detail->was_broadcast = 0; - } - else - RtlLeaveCriticalSection (&detail->waiters_count_lock); - return 0; -} - -static int wine_pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) -{ - wine_cond_detail *detail; - int last_waiter; - - if ( !((wine_cond)cond)->cond ) wine_cond_real_init(cond); - detail = ((wine_cond)cond)->cond; - - /* Avoid race conditions. */ - RtlEnterCriticalSection (&detail->waiters_count_lock); - detail->waiters_count++; - RtlLeaveCriticalSection (&detail->waiters_count_lock); - - RtlLeaveCriticalSection ( ((wine_mutex)mutex)->critsect ); - NtWaitForMultipleObjects( 1, &detail->sema, FALSE, FALSE, NULL ); - - /* Reacquire lock to avoid race conditions. */ - RtlEnterCriticalSection (&detail->waiters_count_lock); - - /* We're no longer waiting... */ - detail->waiters_count--; - - /* Check to see if we're the last waiter after . */ - last_waiter = detail->was_broadcast && detail->waiters_count == 0; - - RtlLeaveCriticalSection (&detail->waiters_count_lock); - - /* - * If we're the last waiter thread during this particular broadcast - * then let all the other threads proceed. - */ - if (last_waiter) NtSetEvent( detail->waiters_done, NULL ); - RtlEnterCriticalSection (((wine_mutex)mutex)->critsect); - return 0; -} - -static int wine_pthread_cond_timedwait(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime) -{ - LARGE_INTEGER time; - int last_waiter; - wine_cond_detail *detail; - - if ( !((wine_cond)cond)->cond ) wine_cond_real_init(cond); - detail = ((wine_cond)cond)->cond; - - /* Avoid race conditions. */ - RtlEnterCriticalSection (&detail->waiters_count_lock); - detail->waiters_count++; - RtlLeaveCriticalSection (&detail->waiters_count_lock); - - RtlLeaveCriticalSection (((wine_mutex)mutex)->critsect); - - time.QuadPart = (ULONGLONG)abstime->tv_sec * 10000000 + abstime->tv_nsec / 100; - time.QuadPart = -time.QuadPart; - NtWaitForMultipleObjects( 1, &detail->sema, FALSE, FALSE, &time ); - - /* Reacquire lock to avoid race conditions. */ - RtlEnterCriticalSection (&detail->waiters_count_lock); - - /* We're no longer waiting... */ - detail->waiters_count--; - - /* Check to see if we're the last waiter after . */ - last_waiter = detail->was_broadcast && detail->waiters_count == 0; - - RtlLeaveCriticalSection (&detail->waiters_count_lock); - - /* - * If we're the last waiter thread during this particular broadcast - * then let all the other threads proceed. - */ - if (last_waiter) NtSetEvent( detail->waiters_done, NULL ); - RtlEnterCriticalSection (((wine_mutex)mutex)->critsect); - return 0; -} - -/***** MISC *****/ - -static pthread_t wine_pthread_self(void) -{ - return (pthread_t)GetCurrentThreadId(); -} - -static int wine_pthread_equal(pthread_t thread1, pthread_t thread2) -{ - return (DWORD)thread1 == (DWORD)thread2; -} - -static void *wine_get_thread_data(void) -{ - return ntdll_get_thread_data()->pthread_data; -} - -static void wine_set_thread_data( void *data ) -{ - ntdll_get_thread_data()->pthread_data = data; -} - -static const struct wine_pthread_callbacks callbacks = -{ - wine_get_thread_data, /* ptr_get_thread_data */ - wine_set_thread_data, /* ptr_set_thread_data */ - wine_pthread_self, /* ptr_pthread_self */ - wine_pthread_equal, /* ptr_pthread_equal */ - wine_pthread_create, /* ptr_pthread_create */ - wine_pthread_cancel, /* ptr_pthread_cancel */ - wine_pthread_join, /* ptr_pthread_join */ - wine_pthread_detach, /* ptr_pthread_detach */ - wine_pthread_exit, /* ptr_pthread_exit */ - wine_pthread_mutex_init, /* ptr_pthread_mutex_init */ - wine_pthread_mutex_lock, /* ptr_pthread_mutex_lock */ - wine_pthread_mutex_trylock, /* ptr_pthread_mutex_trylock */ - wine_pthread_mutex_unlock, /* ptr_pthread_mutex_unlock */ - wine_pthread_mutex_destroy, /* ptr_pthread_mutex_destroy */ - wine_pthread_rwlock_init, /* ptr_pthread_rwlock_init */ - wine_pthread_rwlock_destroy, /* ptr_pthread_rwlock_destroy */ - wine_pthread_rwlock_rdlock, /* ptr_pthread_rwlock_rdlock */ - wine_pthread_rwlock_tryrdlock, /* ptr_pthread_rwlock_tryrdlock */ - wine_pthread_rwlock_wrlock, /* ptr_pthread_rwlock_wrlock */ - wine_pthread_rwlock_trywrlock, /* ptr_pthread_rwlock_trywrlock */ - wine_pthread_rwlock_unlock, /* ptr_pthread_rwlock_unlock */ - wine_pthread_cond_init, /* ptr_pthread_cond_init */ - wine_pthread_cond_destroy, /* ptr_pthread_cond_destroy */ - wine_pthread_cond_signal, /* ptr_pthread_cond_signal */ - wine_pthread_cond_broadcast, /* ptr_pthread_cond_broadcast */ - wine_pthread_cond_wait, /* ptr_pthread_cond_wait */ - wine_pthread_cond_timedwait /* ptr_pthread_cond_timedwait */ -}; - -static struct wine_pthread_functions pthread_functions; - -void pthread_init(void) -{ - wine_pthread_get_functions( &pthread_functions, sizeof(pthread_functions) ); - pthread_functions.init_process( &callbacks, sizeof(callbacks) ); -} - -#endif /* HAVE_PTHREAD_H */ diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c index 3fc21346035..a69746c1c8e 100644 --- a/dlls/ntdll/thread.c +++ b/dlls/ntdll/thread.c @@ -335,7 +335,6 @@ HANDLE thread_init(void) user_shared_data->TickCountLowDeprecated = user_shared_data->u.TickCount.LowPart; user_shared_data->TickCountMultiplier = 1 << 24; - pthread_init(); return exe_file; } diff --git a/dlls/ole32/clipboard.c b/dlls/ole32/clipboard.c index 008e35bde25..5dbcca817fd 100644 --- a/dlls/ole32/clipboard.c +++ b/dlls/ole32/clipboard.c @@ -151,15 +151,26 @@ static ole_clipbrd* theOleClipboard; static const CHAR OLEClipbrd_WNDCLASS[] = "CLIPBRDWNDCLASS"; static UINT dataobject_clipboard_format; +static UINT ole_priv_data_clipboard_format; -/* - * If we need to store state info we can store it here. - * For now we don't need this functionality. - * -typedef struct tagClipboardWindowInfo +/* Structure of 'Ole Private Data' clipboard format */ +typedef struct { -} ClipboardWindowInfo; - */ + FORMATETC fmtetc; + DWORD first_use; /* Has this cf been added to the list already */ + DWORD unk[2]; +} ole_priv_data_entry; + +typedef struct +{ + DWORD unk1; + DWORD size; /* in bytes of the entire structure */ + DWORD unk2; + DWORD count; /* no. of format entries */ + DWORD unk3[2]; + ole_priv_data_entry entries[1]; /* array of size count */ + /* then follows any DVTARGETDEVICE structures referenced in the FORMATETCs */ +} ole_priv_data; /*---------------------------------------------------------------------* * Implementation of the internal IEnumFORMATETC interface returned by @@ -1180,9 +1191,12 @@ static ole_clipbrd* OLEClipbrd_Construct(void) static void register_clipboard_formats(void) { static const WCHAR DataObjectW[] = { 'D','a','t','a','O','b','j','e','c','t',0 }; + static const WCHAR OlePrivateDataW[] = { 'O','l','e',' ','P','r','i','v','a','t','e',' ','D','a','t','a',0 }; if(!dataobject_clipboard_format) dataobject_clipboard_format = RegisterClipboardFormatW(DataObjectW); + if(!ole_priv_data_clipboard_format) + ole_priv_data_clipboard_format = RegisterClipboardFormatW(OlePrivateDataW); } /*********************************************************************** @@ -1271,6 +1285,16 @@ static HWND OLEClipbrd_CreateWindow(void) return hwnd; } +static inline BOOL is_format_in_list(ole_priv_data_entry *entries, DWORD num, UINT cf) +{ + DWORD i; + for(i = 0; i < num; i++) + if(entries[i].fmtetc.cfFormat == cf) + return TRUE; + + return FALSE; +} + /********************************************************************* * set_clipboard_formats * @@ -1285,12 +1309,47 @@ static HRESULT set_clipboard_formats(IDataObject *data) HRESULT hr; FORMATETC fmt; IEnumFORMATETC *enum_fmt; + HGLOBAL priv_data_handle; + DWORD target_offset; + ole_priv_data *priv_data; + DWORD count = 0, needed = sizeof(*priv_data), idx; hr = IDataObject_EnumFormatEtc(data, DATADIR_GET, &enum_fmt); if(FAILED(hr)) return hr; while(IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL) == S_OK) { + count++; + needed += sizeof(priv_data->entries[0]); + if(fmt.ptd) + { + needed += fmt.ptd->tdSize; + CoTaskMemFree(fmt.ptd); + } + } + + /* Windows pads the list with two empty ole_priv_data_entries, one + * after the entries array and one after the target device data. + * Allocating with zero init to zero these pads. */ + + needed += sizeof(priv_data->entries[0]); /* initialisation of needed includes one of these. */ + priv_data_handle = GlobalAlloc(GMEM_DDESHARE | GMEM_MOVEABLE | GMEM_ZEROINIT, needed); + priv_data = GlobalLock(priv_data_handle); + + priv_data->unk1 = 0; + priv_data->size = needed; + priv_data->unk2 = 1; + priv_data->count = count; + priv_data->unk3[0] = 0; + priv_data->unk3[1] = 0; + + IEnumFORMATETC_Reset(enum_fmt); + + idx = 0; + target_offset = FIELD_OFFSET(ole_priv_data, entries[count + 1]); /* count entries + one pad. */ + + while(IEnumFORMATETC_Next(enum_fmt, 1, &fmt, NULL) == S_OK) + { if (fmt.tymed == TYMED_HGLOBAL) { char fmt_name[80]; @@ -1299,9 +1358,28 @@ static HRESULT set_clipboard_formats(IDataObject *data) SetClipboardData(fmt.cfFormat, NULL); } + + priv_data->entries[idx].fmtetc = fmt; + if(fmt.ptd) + { + memcpy((char*)priv_data + target_offset, fmt.ptd, fmt.ptd->tdSize); + priv_data->entries[idx].fmtetc.ptd = (DVTARGETDEVICE*)target_offset; + target_offset += fmt.ptd->tdSize; + CoTaskMemFree(fmt.ptd); + } + + priv_data->entries[idx].first_use = !is_format_in_list(priv_data->entries, idx, fmt.cfFormat); + priv_data->entries[idx].unk[0] = 0; + priv_data->entries[idx].unk[1] = 0; + + idx++; } IEnumFORMATETC_Release(enum_fmt); + + GlobalUnlock(priv_data_handle); + SetClipboardData(ole_priv_data_clipboard_format, priv_data_handle); + return S_OK; } @@ -1474,13 +1552,9 @@ HRESULT WINAPI OleFlushClipboard(void) FORMATETC rgelt; HRESULT hr = S_OK; BOOL bClipboardOpen = FALSE; - IDataObject* pIDataObjectSrc = NULL; TRACE("()\n"); - /* - * Make sure we have a clipboard object - */ OLEClipbrd_Initialize(); /* @@ -1489,30 +1563,14 @@ HRESULT WINAPI OleFlushClipboard(void) if (!theOleClipboard->pIDataObjectSrc) return S_OK; - /* - * Addref and save the source data object we are holding on to temporarily, - * since it will be released when we empty the clipboard. - */ - pIDataObjectSrc = theOleClipboard->pIDataObjectSrc; - IDataObject_AddRef(pIDataObjectSrc); - - /* - * Open the Windows clipboard - */ if ( !(bClipboardOpen = OpenClipboard(theOleClipboard->hWndClipboard)) ) HANDLE_ERROR( CLIPBRD_E_CANT_OPEN ); /* - * Empty the current clipboard - */ - if ( !EmptyClipboard() ) - HANDLE_ERROR( CLIPBRD_E_CANT_EMPTY ); - - /* * Render all HGLOBAL formats supported by the source into * the windows clipboard. */ - if ( FAILED( hr = IDataObject_EnumFormatEtc( pIDataObjectSrc, + if ( FAILED( hr = IDataObject_EnumFormatEtc( theOleClipboard->pIDataObjectSrc, DATADIR_GET, &penumFormatetc) )) { @@ -1528,10 +1586,7 @@ HRESULT WINAPI OleFlushClipboard(void) GetClipboardFormatNameA(rgelt.cfFormat, szFmtName, sizeof(szFmtName)-1) ? szFmtName : ""); - /* - * Render the clipboard data - */ - if ( FAILED(OLEClipbrd_RenderFormat( pIDataObjectSrc, &rgelt )) ) + if ( FAILED(OLEClipbrd_RenderFormat( theOleClipboard->pIDataObjectSrc, &rgelt )) ) continue; } } @@ -1540,16 +1595,11 @@ HRESULT WINAPI OleFlushClipboard(void) hr = set_dataobject_format(NULL); - /* - * Release the source data object we are holding on to - */ - IDataObject_Release(pIDataObjectSrc); + IDataObject_Release(theOleClipboard->pIDataObjectSrc); + theOleClipboard->pIDataObjectSrc = NULL; CLEANUP: - /* - * Close Windows clipboard (It remains associated with our window) - */ if ( bClipboardOpen && !CloseClipboard() ) hr = CLIPBRD_E_CANT_CLOSE; diff --git a/dlls/ole32/tests/clipboard.c b/dlls/ole32/tests/clipboard.c index bc7e727f125..47921af0fad 100644 --- a/dlls/ole32/tests/clipboard.c +++ b/dlls/ole32/tests/clipboard.c @@ -616,7 +616,6 @@ static void test_cf_dataobject(IDataObject *data) } while(cf); CloseClipboard(); ok(found_dataobject, "didn't find cf_dataobject\n"); -todo_wine ok(found_priv_data, "didn't find cf_ole_priv_data\n"); } @@ -625,6 +624,7 @@ static void test_set_clipboard(void) HRESULT hr; ULONG ref; LPDATAOBJECT data1, data2, data_cmpl; + HGLOBAL hblob, h; cf_stream = RegisterClipboardFormatA("stream format"); cf_storage = RegisterClipboardFormatA("storage format"); @@ -681,6 +681,16 @@ static void test_set_clipboard(void) hr = OleIsCurrentClipboard(NULL); ok(hr == S_FALSE, "expect S_FALSE, hr = 0x%08x\n", hr); + /* put a format directly onto the clipboard to show + OleFlushClipboard doesn't empty the clipboard */ + hblob = GlobalAlloc(GMEM_DDESHARE|GMEM_MOVEABLE|GMEM_ZEROINIT, 10); + OpenClipboard(NULL); + h = SetClipboardData(cf_onemore, hblob); + ok(h == hblob, "got %p\n", h); + h = GetClipboardData(cf_onemore); + ok(h == hblob, "got %p\n", h); + CloseClipboard(); + hr = OleFlushClipboard(); ok(hr == S_OK, "failed to flush clipboard, hr = 0x%08x\n", hr); hr = OleIsCurrentClipboard(data1); @@ -690,10 +700,21 @@ static void test_set_clipboard(void) hr = OleIsCurrentClipboard(NULL); ok(hr == S_FALSE, "expect S_FALSE, hr = 0x%08x\n", hr); + /* format should survive the flush */ + OpenClipboard(NULL); + h = GetClipboardData(cf_onemore); + ok(h == hblob, "got %p\n", h); + CloseClipboard(); + test_cf_dataobject(NULL); ok(OleSetClipboard(NULL) == S_OK, "failed to clear clipboard, hr = 0x%08x\n", hr); + OpenClipboard(NULL); + h = GetClipboardData(cf_onemore); + ok(h == NULL, "got %p\n", h); + CloseClipboard(); + hr = OleSetClipboard(data_cmpl); ok(hr == S_OK, "failed to set clipboard to complex data, hr = 0x%08x\n", hr); test_cf_dataobject(data_cmpl); diff --git a/dlls/rpcrt4/rpc_server.c b/dlls/rpcrt4/rpc_server.c index 12a525d68b6..4a87bd07dc9 100644 --- a/dlls/rpcrt4/rpc_server.c +++ b/dlls/rpcrt4/rpc_server.c @@ -566,11 +566,32 @@ static void RPCRT4_stop_listen(BOOL auto_listen) LeaveCriticalSection(&listen_cs); } +static BOOL RPCRT4_protseq_is_endpoint_registered(RpcServerProtseq *protseq, LPCSTR endpoint) +{ + RpcConnection *conn; + EnterCriticalSection(&protseq->cs); + for (conn = protseq->conn; conn; conn = conn->Next) + { + if (!endpoint || !strcmp(endpoint, conn->Endpoint)) + break; + } + LeaveCriticalSection(&protseq->cs); + return (conn != NULL); +} + static RPC_STATUS RPCRT4_use_protseq(RpcServerProtseq* ps, LPSTR endpoint) { RPC_STATUS status; - status = ps->ops->open_endpoint(ps, endpoint); + EnterCriticalSection(&ps->cs); + + if (RPCRT4_protseq_is_endpoint_registered(ps, endpoint)) + status = RPC_S_OK; + else + status = ps->ops->open_endpoint(ps, endpoint); + + LeaveCriticalSection(&ps->cs); + if (status != RPC_S_OK) return status; @@ -751,6 +772,9 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExA( RPC_CSTR Protseq, UINT MaxCalls, RPC debugstr_a(szep), SecurityDescriptor, lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags ); + if (!Endpoint) + return RPC_S_INVALID_ENDPOINT_FORMAT; + status = RPCRT4_get_or_create_serverprotseq(MaxCalls, RPCRT4_strdupA(szps), &ps); if (status != RPC_S_OK) return status; @@ -772,6 +796,9 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( RPC_WSTR Protseq, UINT MaxCalls, RPC debugstr_w( Endpoint ), SecurityDescriptor, lpPolicy->Length, lpPolicy->EndpointFlags, lpPolicy->NICFlags ); + if (!Endpoint) + return RPC_S_INVALID_ENDPOINT_FORMAT; + status = RPCRT4_get_or_create_serverprotseq(MaxCalls, RPCRT4_strdupWtoA(Protseq), &ps); if (status != RPC_S_OK) return status; @@ -787,8 +814,16 @@ RPC_STATUS WINAPI RpcServerUseProtseqEpExW( RPC_WSTR Protseq, UINT MaxCalls, RPC */ RPC_STATUS WINAPI RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor) { + RPC_STATUS status; + RpcServerProtseq* ps; + TRACE("(Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_a((char*)Protseq), MaxCalls, SecurityDescriptor); - return RpcServerUseProtseqEpA(Protseq, MaxCalls, NULL, SecurityDescriptor); + + status = RPCRT4_get_or_create_serverprotseq(MaxCalls, RPCRT4_strdupA((const char *)Protseq), &ps); + if (status != RPC_S_OK) + return status; + + return RPCRT4_use_protseq(ps, NULL); } /*********************************************************************** @@ -796,8 +831,16 @@ RPC_STATUS WINAPI RpcServerUseProtseqA(RPC_CSTR Protseq, unsigned int MaxCalls, */ RPC_STATUS WINAPI RpcServerUseProtseqW(RPC_WSTR Protseq, unsigned int MaxCalls, void *SecurityDescriptor) { + RPC_STATUS status; + RpcServerProtseq* ps; + TRACE("Protseq == %s, MaxCalls == %d, SecurityDescriptor == ^%p)\n", debugstr_w(Protseq), MaxCalls, SecurityDescriptor); - return RpcServerUseProtseqEpW(Protseq, MaxCalls, NULL, SecurityDescriptor); + + status = RPCRT4_get_or_create_serverprotseq(MaxCalls, RPCRT4_strdupWtoA(Protseq), &ps); + if (status != RPC_S_OK) + return status; + + return RPCRT4_use_protseq(ps, NULL); } void RPCRT4_destroy_all_protseqs(void) diff --git a/dlls/rpcrt4/rpc_transport.c b/dlls/rpcrt4/rpc_transport.c index 7de623045fd..39908bcdf75 100644 --- a/dlls/rpcrt4/rpc_transport.c +++ b/dlls/rpcrt4/rpc_transport.c @@ -822,6 +822,12 @@ static RPC_STATUS rpcrt4_ncacn_ip_tcp_open(RpcConnection* Connection) { int val; + if (ai_cur->ai_family != AF_INET && ai_cur->ai_family != AF_INET6) + { + TRACE("skipping non-IP/IPv6 address family\n"); + continue; + } + if (TRACE_ON(rpc)) { char host[256]; @@ -884,7 +890,7 @@ static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *pr hints.ai_canonname = NULL; hints.ai_next = NULL; - ret = getaddrinfo(NULL, endpoint, &hints, &ai); + ret = getaddrinfo(NULL, endpoint ? endpoint : "0", &hints, &ai); if (ret) { ERR("getaddrinfo for port %s failed: %s\n", endpoint, @@ -898,11 +904,19 @@ static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *pr { RpcConnection_tcp *tcpc; RPC_STATUS create_status; + struct sockaddr_storage sa; + socklen_t sa_len; + char service[NI_MAXSERV]; + + if (ai_cur->ai_family != AF_INET && ai_cur->ai_family != AF_INET6) + { + TRACE("skipping non-IP/IPv6 address family\n"); + continue; + } if (TRACE_ON(rpc)) { char host[256]; - char service[256]; getnameinfo(ai_cur->ai_addr, ai_cur->ai_addrlen, host, sizeof(host), service, sizeof(service), NI_NUMERICHOST | NI_NUMERICSERV); @@ -928,9 +942,28 @@ static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *pr status = RPC_S_CANT_CREATE_ENDPOINT; continue; } + + sa_len = sizeof(sa); + if (getsockname(sock, (struct sockaddr *)&sa, &sa_len)) + { + WARN("getsockname() failed: %s\n", strerror(errno)); + status = RPC_S_CANT_CREATE_ENDPOINT; + continue; + } + + ret = getnameinfo((struct sockaddr *)&sa, sa_len, + NULL, 0, service, sizeof(service), + NI_NUMERICSERV); + if (ret) + { + WARN("getnameinfo failed: %s\n", gai_strerror(ret)); + status = RPC_S_CANT_CREATE_ENDPOINT; + continue; + } + create_status = RPCRT4_CreateConnection((RpcConnection **)&tcpc, TRUE, protseq->Protseq, NULL, - endpoint, NULL, NULL, NULL); + service, NULL, NULL, NULL); if (create_status != RPC_S_OK) { closesocket(sock); @@ -962,6 +995,10 @@ static RPC_STATUS rpcrt4_protseq_ncacn_ip_tcp_open_endpoint(RpcServerProtseq *pr tcpc->common.Next = first_connection; first_connection = &tcpc->common; + + /* since IPv4 and IPv6 share the same port space, we only need one + * successful bind to listen for both */ + break; } freeaddrinfo(ai); @@ -1414,8 +1451,6 @@ static int rpcrt4_protseq_sock_wait_for_new_connection(RpcServerProtseq *protseq return 1; } -#endif /* HAVE_SOCKETPAIR */ - static RPC_STATUS rpcrt4_ncacn_ip_tcp_parse_top_of_tower(const unsigned char *tower_data, size_t tower_size, char **networkaddr, @@ -1597,8 +1632,8 @@ static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor) DWORD status_code; DWORD size; DWORD index; - WCHAR status_text[32]; - + WCHAR buf[32]; + WCHAR *status_text = buf; TRACE("\n"); index = 0; @@ -1609,11 +1644,17 @@ static RPC_STATUS rpcrt4_http_check_response(HINTERNET hor) if (status_code < 400) return RPC_S_OK; index = 0; - size = sizeof(status_text); + size = sizeof(buf); ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index); - if (!ret) - return GetLastError(); - ERR("server returned: %d %s\n", status_code, debugstr_w(status_text)); + if (!ret && GetLastError() == ERROR_INSUFFICIENT_BUFFER) + { + status_text = HeapAlloc(GetProcessHeap(), 0, size); + ret = HttpQueryInfoW(hor, HTTP_QUERY_STATUS_TEXT, status_text, &size, &index); + } + + ERR("server returned: %d %s\n", status_code, ret ? debugstr_w(status_text) : ""); + if(status_text != buf) HeapFree(GetProcessHeap(), 0, status_text); + if (status_code == HTTP_STATUS_DENIED) return ERROR_ACCESS_DENIED; return RPC_S_SERVER_UNAVAILABLE; @@ -2358,6 +2399,7 @@ static RPC_STATUS rpcrt4_ncacn_http_parse_top_of_tower(const unsigned char *towe networkaddr, EPM_PROTOCOL_HTTP, endpoint); } +#endif /* HAVE_SOCKETPAIR */ static const struct connection_ops conn_protseq_list[] = { { "ncacn_np", @@ -2403,7 +2445,6 @@ static const struct connection_ops conn_protseq_list[] = { rpcrt4_ncacn_ip_tcp_parse_top_of_tower, NULL, }, -#endif { "ncacn_http", { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP }, rpcrt4_ncacn_http_alloc, @@ -2418,6 +2459,7 @@ static const struct connection_ops conn_protseq_list[] = { rpcrt4_ncacn_http_parse_top_of_tower, rpcrt4_ncacn_http_receive_fragment, }, +#endif }; diff --git a/dlls/rpcrt4/tests/rpc.c b/dlls/rpcrt4/tests/rpc.c index 725dbba6221..128391d33dd 100644 --- a/dlls/rpcrt4/tests/rpc.c +++ b/dlls/rpcrt4/tests/rpc.c @@ -335,7 +335,7 @@ static void test_towers(void) if (ret == RPC_S_INVALID_RPC_PROTSEQ) { /* Windows Vista fails with this error and crashes if we continue */ - skip("TowerConstruct failed, we are most likely on Windows Vista\n"); + win_skip("TowerConstruct failed, we are most likely on Windows Vista\n"); return; } diff --git a/dlls/rpcrt4/tests/rpc_protseq.c b/dlls/rpcrt4/tests/rpc_protseq.c index a4589d6f157..06a82ecaa41 100644 --- a/dlls/rpcrt4/tests/rpc_protseq.c +++ b/dlls/rpcrt4/tests/rpc_protseq.c @@ -46,7 +46,6 @@ static void test_RpcServerUseProtseq(void) /* show that RpcServerUseProtseqEp(..., NULL, ...) isn't the same as * RpcServerUseProtseq(...) */ status = RpcServerUseProtseqEp(ncalrpc, 0, NULL, NULL); - todo_wine ok(status == RPC_S_INVALID_ENDPOINT_FORMAT, "RpcServerUseProtseqEp with NULL endpoint should have failed with " "RPC_S_INVALID_ENDPOINT_FORMAT instead of %d\n", status); @@ -70,7 +69,6 @@ static void test_RpcServerUseProtseq(void) if (status == RPC_S_OK) endpoints_registered++; status = RpcServerUseProtseq(iptcp, 0, NULL); - todo_wine ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %d\n", status); if (status == RPC_S_OK) endpoints_registered++; @@ -102,7 +100,6 @@ static void test_RpcServerUseProtseq(void) ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_np) failed with status %d\n", status); status = RpcServerUseProtseq(iptcp, 0, NULL); - todo_wine ok(status == RPC_S_OK, "RpcServerUseProtseq(ncacn_ip_tcp) failed with status %d\n", status); status = RpcServerUseProtseq(ncalrpc, 0, NULL); @@ -111,7 +108,6 @@ static void test_RpcServerUseProtseq(void) status = RpcServerInqBindings(&bindings); ok(status == RPC_S_OK, "RpcServerInqBindings failed with status %d\n", status); binding_count_after2 = bindings->Count; - todo_wine ok(binding_count_after2 == binding_count_after1, "bindings should have been re-used - after1: %u after2: %u\n", binding_count_after1, binding_count_after2); diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9c7e6ca8744..c0f0d85177b 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4680,38 +4680,24 @@ static HRESULT WINAPI IWineD3DDeviceImpl_ProcessVertices(IWineD3DDevice *iface, * * Also get the start index in, but only loop over all elements if there's something to add at all. */ -#define FIXSRC(type) \ - if(strided.u.s.type.VBO) { \ - struct wined3d_buffer *vb = (struct wined3d_buffer *)This->stateBlock->streamSource[strided.u.s.type.streamNo]; \ - strided.u.s.type.VBO = 0; \ - strided.u.s.type.lpData = (BYTE *) ((unsigned long) strided.u.s.type.lpData + (unsigned long) vb->resource.allocatedMemory); \ - ENTER_GL(); \ - GL_EXTCALL(glDeleteBuffersARB(1, &vb->buffer_object)); \ - vb->buffer_object = 0; \ - LEAVE_GL(); \ - } \ - if(strided.u.s.type.lpData) { \ - strided.u.s.type.lpData += strided.u.s.type.dwStride * SrcStartIndex; \ - } - FIXSRC(position); - FIXSRC(blendWeights); - FIXSRC(blendMatrixIndices); - FIXSRC(normal); - FIXSRC(pSize); - FIXSRC(diffuse); - FIXSRC(specular); - for(i = 0; i < WINED3DDP_MAXTEXCOORD; i++) { - FIXSRC(texCoords[i]); - } - FIXSRC(position2); - FIXSRC(normal2); - FIXSRC(tangent); - FIXSRC(binormal); - FIXSRC(tessFactor); - FIXSRC(fog); - FIXSRC(depth); - FIXSRC(sample); -#undef FIXSRC + for (i = 0; i < (sizeof(strided.u.input) / sizeof(*strided.u.input)); ++i) + { + if (strided.u.input[i].VBO) + { + struct wined3d_buffer *vb = + (struct wined3d_buffer *)This->stateBlock->streamSource[strided.u.input[i].streamNo]; + strided.u.input[i].VBO = 0; + strided.u.input[i].lpData = (BYTE *)((unsigned long)strided.u.input[i].lpData + (unsigned long)vb->resource.allocatedMemory); + ENTER_GL(); + GL_EXTCALL(glDeleteBuffersARB(1, &vb->buffer_object)); + vb->buffer_object = 0; + LEAVE_GL(); + } + if (strided.u.input[i].lpData) + { + strided.u.input[i].lpData += strided.u.input[i].dwStride * SrcStartIndex; + } + } } return process_vertices_strided(This, DestIndex, VertexCount, &strided, diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index 3f61b8a2793..4718969e1ae 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -57,22 +57,6 @@ static BOOL fixed_get_input( *regnum = 6; else if (usage == WINED3DDECLUSAGE_TEXCOORD && usage_idx < WINED3DDP_MAXTEXCOORD) *regnum = 7 + usage_idx; - else if ((usage == WINED3DDECLUSAGE_POSITION || usage == WINED3DDECLUSAGE_POSITIONT) && usage_idx == 1) - *regnum = 7 + WINED3DDP_MAXTEXCOORD; - else if (usage == WINED3DDECLUSAGE_NORMAL && usage_idx == 1) - *regnum = 8 + WINED3DDP_MAXTEXCOORD; - else if (usage == WINED3DDECLUSAGE_TANGENT && usage_idx == 0) - *regnum = 9 + WINED3DDP_MAXTEXCOORD; - else if (usage == WINED3DDECLUSAGE_BINORMAL && usage_idx == 0) - *regnum = 10 + WINED3DDP_MAXTEXCOORD; - else if (usage == WINED3DDECLUSAGE_TESSFACTOR && usage_idx == 0) - *regnum = 11 + WINED3DDP_MAXTEXCOORD; - else if (usage == WINED3DDECLUSAGE_FOG && usage_idx == 0) - *regnum = 12 + WINED3DDP_MAXTEXCOORD; - else if (usage == WINED3DDECLUSAGE_DEPTH && usage_idx == 0) - *regnum = 13 + WINED3DDP_MAXTEXCOORD; - else if (usage == WINED3DDECLUSAGE_SAMPLE && usage_idx == 0) - *regnum = 14 + WINED3DDP_MAXTEXCOORD; if (*regnum == -1) { FIXME("Unsupported input stream [usage=%s, usage_idx=%u]\n", @@ -697,91 +681,18 @@ static inline void drawStridedInstanced(IWineD3DDevice *iface, const WineDirect3 } static inline void remove_vbos(IWineD3DDeviceImpl *This, WineDirect3DVertexStridedData *s) { - unsigned char i; - struct wined3d_buffer *vb; + unsigned int i; - if(s->u.s.position.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.position.streamNo]; - s->u.s.position.VBO = 0; - s->u.s.position.lpData = (BYTE *) ((unsigned long) s->u.s.position.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.blendWeights.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.blendWeights.streamNo]; - s->u.s.blendWeights.VBO = 0; - s->u.s.blendWeights.lpData = (BYTE *) ((unsigned long) s->u.s.blendWeights.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.blendMatrixIndices.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.blendMatrixIndices.streamNo]; - s->u.s.blendMatrixIndices.VBO = 0; - s->u.s.blendMatrixIndices.lpData = (BYTE *) ((unsigned long) s->u.s.blendMatrixIndices.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.normal.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.normal.streamNo]; - s->u.s.normal.VBO = 0; - s->u.s.normal.lpData = (BYTE *) ((unsigned long) s->u.s.normal.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.pSize.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.pSize.streamNo]; - s->u.s.pSize.VBO = 0; - s->u.s.pSize.lpData = (BYTE *) ((unsigned long) s->u.s.pSize.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.diffuse.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.diffuse.streamNo]; - s->u.s.diffuse.VBO = 0; - s->u.s.diffuse.lpData = (BYTE *) ((unsigned long) s->u.s.diffuse.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.specular.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.specular.streamNo]; - s->u.s.specular.VBO = 0; - s->u.s.specular.lpData = (BYTE *) ((unsigned long) s->u.s.specular.lpData + (unsigned long) vb->resource.allocatedMemory); - } - for(i = 0; i < WINED3DDP_MAXTEXCOORD; i++) { - if(s->u.s.texCoords[i].VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.texCoords[i].streamNo]; - s->u.s.texCoords[i].VBO = 0; - s->u.s.texCoords[i].lpData = (BYTE *) ((unsigned long) s->u.s.texCoords[i].lpData + (unsigned long) vb->resource.allocatedMemory); + for (i = 0; i < (sizeof(s->u.input) / sizeof(*s->u.input)); ++i) + { + if (s->u.input[i].VBO) + { + struct wined3d_buffer *vb = + (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.input[i].streamNo]; + s->u.input[i].VBO = 0; + s->u.input[i].lpData = (BYTE *)((unsigned long)s->u.input[i].lpData + (unsigned long)vb->resource.allocatedMemory); } } - if(s->u.s.position2.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.position2.streamNo]; - s->u.s.position2.VBO = 0; - s->u.s.position2.lpData = (BYTE *) ((unsigned long) s->u.s.position2.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.normal2.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.normal2.streamNo]; - s->u.s.normal2.VBO = 0; - s->u.s.normal2.lpData = (BYTE *) ((unsigned long) s->u.s.normal2.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.tangent.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.tangent.streamNo]; - s->u.s.tangent.VBO = 0; - s->u.s.tangent.lpData = (BYTE *) ((unsigned long) s->u.s.tangent.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.binormal.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.binormal.streamNo]; - s->u.s.binormal.VBO = 0; - s->u.s.binormal.lpData = (BYTE *) ((unsigned long) s->u.s.binormal.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.tessFactor.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.tessFactor.streamNo]; - s->u.s.tessFactor.VBO = 0; - s->u.s.tessFactor.lpData = (BYTE *) ((unsigned long) s->u.s.tessFactor.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.fog.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.fog.streamNo]; - s->u.s.fog.VBO = 0; - s->u.s.fog.lpData = (BYTE *) ((unsigned long) s->u.s.fog.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.depth.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.depth.streamNo]; - s->u.s.depth.VBO = 0; - s->u.s.depth.lpData = (BYTE *) ((unsigned long) s->u.s.depth.lpData + (unsigned long) vb->resource.allocatedMemory); - } - if(s->u.s.sample.VBO) { - vb = (struct wined3d_buffer *)This->stateBlock->streamSource[s->u.s.sample.streamNo]; - s->u.s.sample.VBO = 0; - s->u.s.sample.lpData = (BYTE *) ((unsigned long) s->u.s.sample.lpData + (unsigned long) vb->resource.allocatedMemory); - } } /* Routine common to the draw primitive and draw indexed primitive routines */ diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 863f5ccc971..9e84347962b 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -81,8 +81,6 @@ static void state_fillmode(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine } static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { - BOOL transformed; - /* Lighting is not enabled if transformed vertices are drawn * but lighting does not affect the stream sources, so it is not grouped for performance reasons. * This state reads the decoded vertex declaration, so if it is dirty don't do anything. The @@ -93,11 +91,9 @@ static void state_lighting(DWORD state, IWineD3DStateBlockImpl *stateblock, Wine return; } - transformed = ((stateblock->wineD3DDevice->strided_streams.u.s.position.lpData != NULL || - stateblock->wineD3DDevice->strided_streams.u.s.position.VBO != 0) && - stateblock->wineD3DDevice->strided_streams.position_transformed) ? TRUE : FALSE; - - if (stateblock->renderState[WINED3DRS_LIGHTING] && !transformed) { + if (stateblock->renderState[WINED3DRS_LIGHTING] + && !stateblock->wineD3DDevice->strided_streams.position_transformed) + { glEnable(GL_LIGHTING); checkGLcall("glEnable GL_LIGHTING"); } else { @@ -4030,13 +4026,13 @@ static void loadVertexData(IWineD3DStateBlockImpl *stateblock, const WineDirect3 (sd->u.s.blendMatrixIndices.lpData) || (sd->u.s.blendMatrixIndices.VBO) ) { if (GL_SUPPORT(ARB_VERTEX_BLEND)) { - TRACE("Blend %d %p %d\n", WINED3D_ATR_FORMAT(sd->u.s.blendWeights.dwType), + TRACE("Blend %d %p %d\n", WINED3D_ATR_SIZE(sd->u.s.blendWeights.dwType), sd->u.s.blendWeights.lpData + stateblock->loadBaseVertexIndex * sd->u.s.blendWeights.dwStride, sd->u.s.blendWeights.dwStride + offset[sd->u.s.blendWeights.streamNo]); glEnableClientState(GL_WEIGHT_ARRAY_ARB); checkGLcall("glEnableClientState(GL_WEIGHT_ARRAY_ARB)"); - GL_EXTCALL(glVertexBlendARB(WINED3D_ATR_FORMAT(sd->u.s.blendWeights.dwType) + 1)); + GL_EXTCALL(glVertexBlendARB(WINED3D_ATR_SIZE(sd->u.s.blendWeights.dwType) + 1)); VTRACE(("glWeightPointerARB(%d, GL_FLOAT, %d, %p)\n", WINED3D_ATR_FORMAT(sd->u.s.blendWeights.dwType) , @@ -4243,14 +4239,6 @@ static inline void drawPrimitiveTraceDataLocations(const WineDirect3DVertexStrid TRACE_STRIDED((dataLocations), texCoords[5]); TRACE_STRIDED((dataLocations), texCoords[6]); TRACE_STRIDED((dataLocations), texCoords[7]); - TRACE_STRIDED((dataLocations), position2); - TRACE_STRIDED((dataLocations), normal2); - TRACE_STRIDED((dataLocations), tangent); - TRACE_STRIDED((dataLocations), binormal); - TRACE_STRIDED((dataLocations), tessFactor); - TRACE_STRIDED((dataLocations), fog); - TRACE_STRIDED((dataLocations), depth); - TRACE_STRIDED((dataLocations), sample); return; } @@ -4333,20 +4321,6 @@ static void streamsrc(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DCo loadVertexData(stateblock, dataLocations); context->namedArraysLoaded = TRUE; } - -/* Generate some fixme's if unsupported functionality is being used */ -#define BUFFER_OR_DATA(_attribute) dataLocations->u.s._attribute.lpData - /* TODO: Either support missing functionality in fixupVertices or by creating a shader to replace the pipeline. */ - if (!useVertexShaderFunction && (BUFFER_OR_DATA(position2) || BUFFER_OR_DATA(normal2))) { - FIXME("Tweening is only valid with vertex shaders\n"); - } - if (!useVertexShaderFunction && BUFFER_OR_DATA(binormal)) { - FIXME("Binormal bump mapping is only valid with vertex shaders\n"); - } - if (!useVertexShaderFunction && (BUFFER_OR_DATA(tessFactor) || BUFFER_OR_DATA(fog) || BUFFER_OR_DATA(depth) || BUFFER_OR_DATA(sample))) { - FIXME("Extended attributes are only valid with vertex shaders\n"); - } -#undef BUFFER_OR_DATA } static void vertexdeclaration(DWORD state, IWineD3DStateBlockImpl *stateblock, WineD3DContext *context) { diff --git a/dlls/winedos/int21.c b/dlls/winedos/int21.c index 0c7967f1df4..cbce913e98e 100644 --- a/dlls/winedos/int21.c +++ b/dlls/winedos/int21.c @@ -2182,6 +2182,7 @@ static BOOL INT21_FileAttributes( CONTEXT86 *context, else { TRACE( "SET FILE CREATION DATE AND TIME, file %s\n", fileA ); + MultiByteToWideChar(CP_OEMCP, 0, fileA, -1, fileW, MAX_PATH); handle = CreateFileW( fileW, GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, @@ -2207,8 +2208,8 @@ static BOOL INT21_FileAttributes( CONTEXT86 *context, INT_BARF( context, 0x21 ); else { - TRACE( "GET FILE CREATION DATE AND TIME, handle %d\n", - BX_reg(context) ); + TRACE( "GET FILE CREATION DATE AND TIME, file %s\n", fileA ); + MultiByteToWideChar(CP_OEMCP, 0, fileA, -1, fileW, MAX_PATH); handle = CreateFileW( fileW, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, diff --git a/dlls/wininet/tests/http.c b/dlls/wininet/tests/http.c index 27e393b2275..044b96f5d7a 100644 --- a/dlls/wininet/tests/http.c +++ b/dlls/wininet/tests/http.c @@ -568,8 +568,8 @@ static void InternetReadFileExA_test(int flags) SET_EXPECT2(INTERNET_STATUS_REQUEST_SENT, 2); SET_EXPECT2(INTERNET_STATUS_RECEIVING_RESPONSE, 2); SET_EXPECT2(INTERNET_STATUS_RESPONSE_RECEIVED, 2); - SET_EXPECT2(INTERNET_STATUS_CLOSING_CONNECTION, 2); - SET_EXPECT2(INTERNET_STATUS_CONNECTION_CLOSED, 2); + SET_OPTIONAL2(INTERNET_STATUS_CLOSING_CONNECTION, 2); + SET_OPTIONAL2(INTERNET_STATUS_CONNECTION_CLOSED, 2); SET_EXPECT(INTERNET_STATUS_REDIRECT); SET_OPTIONAL(INTERNET_STATUS_CONNECTING_TO_SERVER); SET_OPTIONAL(INTERNET_STATUS_CONNECTED_TO_SERVER); @@ -606,8 +606,8 @@ static void InternetReadFileExA_test(int flags) CHECK_NOTIFIED2(INTERNET_STATUS_REQUEST_SENT, 2); CHECK_NOTIFIED2(INTERNET_STATUS_RECEIVING_RESPONSE, 2); CHECK_NOTIFIED2(INTERNET_STATUS_RESPONSE_RECEIVED, 2); - todo_wine CHECK_NOTIFIED2(INTERNET_STATUS_CLOSING_CONNECTION, 2); - todo_wine CHECK_NOTIFIED2(INTERNET_STATUS_CONNECTION_CLOSED, 2); + CHECK_NOTIFIED2(INTERNET_STATUS_CLOSING_CONNECTION, 2); + CHECK_NOTIFIED2(INTERNET_STATUS_CONNECTION_CLOSED, 2); CHECK_NOTIFIED(INTERNET_STATUS_REDIRECT); if (flags & INTERNET_FLAG_ASYNC) CHECK_NOTIFIED(INTERNET_STATUS_REQUEST_COMPLETE); diff --git a/include/config.h.in b/include/config.h.in index 047e90ca9cf..9e93513565e 100644 --- a/include/config.h.in +++ b/include/config.h.in @@ -594,12 +594,6 @@ /* Define to 1 if you have the header file. */ #undef HAVE_PTHREAD_NP_H -/* Define to 1 if the system has the type `pthread_rwlockattr_t'. */ -#undef HAVE_PTHREAD_RWLOCKATTR_T - -/* Define to 1 if the system has the type `pthread_rwlock_t'. */ -#undef HAVE_PTHREAD_RWLOCK_T - /* Define to 1 if you have the header file. */ #undef HAVE_PWD_H diff --git a/include/msvcrt/stdio.h b/include/msvcrt/stdio.h index b65a2b17c39..f2398b59309 100644 --- a/include/msvcrt/stdio.h +++ b/include/msvcrt/stdio.h @@ -115,6 +115,7 @@ int __cdecl _setmaxstdio(int); int __cdecl _snprintf(char*,size_t,const char*,...); char* __cdecl _tempnam(const char*,const char*); int __cdecl _unlink(const char*); +int __cdecl _vscprintf(const char*,__ms_va_list); int __cdecl _vsnprintf(char*,size_t,const char*,__ms_va_list); void __cdecl clearerr(FILE*); @@ -166,6 +167,7 @@ wint_t __cdecl _fputwchar(wint_t); wchar_t* __cdecl _getws(wchar_t*); int __cdecl _putws(const wchar_t*); int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...); +int __cdecl _vscwprintf(const wchar_t*,__ms_va_list); int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list); FILE* __cdecl _wfdopen(int,const wchar_t*); FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*); diff --git a/include/msvcrt/wchar.h b/include/msvcrt/wchar.h index 77bcc10e1d4..03d6107edeb 100644 --- a/include/msvcrt/wchar.h +++ b/include/msvcrt/wchar.h @@ -275,6 +275,7 @@ wint_t __cdecl _fputwchar(wint_t); wchar_t* __cdecl _getws(wchar_t*); int __cdecl _putws(const wchar_t*); int __cdecl _snwprintf(wchar_t*,size_t,const wchar_t*,...); +int __cdecl _vscwprintf(const wchar_t*,__ms_va_list); int __cdecl _vsnwprintf(wchar_t*,size_t,const wchar_t*,__ms_va_list); FILE* __cdecl _wfdopen(int,const wchar_t*); FILE* __cdecl _wfopen(const wchar_t*,const wchar_t*); diff --git a/include/wine/pthread.h b/include/wine/pthread.h index a8d5ba30de5..561c22c5221 100644 --- a/include/wine/pthread.h +++ b/include/wine/pthread.h @@ -30,57 +30,6 @@ struct sigset_t; typedef struct sigset_t sigset_t; #endif -#ifdef HAVE_PTHREAD_H - -#define _GNU_SOURCE -#include -#ifdef HAVE_PTHREAD_NP_H -#include -#endif - -#ifndef HAVE_PTHREAD_RWLOCK_T -typedef void *pthread_rwlock_t; -#endif -#ifndef HAVE_PTHREAD_RWLOCKATTR_T -typedef void *pthread_rwlockattr_t; -#endif - -struct wine_pthread_callbacks -{ - void * (*ptr_get_thread_data)(void); - void (*ptr_set_thread_data)(void *data); - pthread_t (*ptr_pthread_self)(void); - int (*ptr_pthread_equal)(pthread_t thread1, pthread_t thread2); - int (*ptr_pthread_create)(pthread_t* thread, const pthread_attr_t* attr, - void* (*start_routine)(void *), void* arg); - int (*ptr_pthread_cancel)(pthread_t thread); - int (*ptr_pthread_join)(pthread_t thread, void **value_ptr); - int (*ptr_pthread_detach)(pthread_t thread); - void (*ptr_pthread_exit)(void *retval, char *currentframe); - int (*ptr_pthread_mutex_init)(pthread_mutex_t *mutex, const pthread_mutexattr_t *mutexattr); - int (*ptr_pthread_mutex_lock)(pthread_mutex_t *mutex); - int (*ptr_pthread_mutex_trylock)(pthread_mutex_t *mutex); - int (*ptr_pthread_mutex_unlock)(pthread_mutex_t *mutex); - int (*ptr_pthread_mutex_destroy)(pthread_mutex_t *mutex); - int (*ptr_pthread_rwlock_init)(pthread_rwlock_t *rwlock, - const pthread_rwlockattr_t *rwlock_attr); - int (*ptr_pthread_rwlock_destroy)(pthread_rwlock_t *rwlock); - int (*ptr_pthread_rwlock_rdlock)(pthread_rwlock_t *rwlock); - int (*ptr_pthread_rwlock_tryrdlock)(pthread_rwlock_t *rwlock); - int (*ptr_pthread_rwlock_wrlock)(pthread_rwlock_t *rwlock); - int (*ptr_pthread_rwlock_trywrlock)(pthread_rwlock_t *rwlock); - int (*ptr_pthread_rwlock_unlock)(pthread_rwlock_t *rwlock); - int (*ptr_pthread_cond_init)(pthread_cond_t *cond, const pthread_condattr_t *cond_attr); - int (*ptr_pthread_cond_destroy)(pthread_cond_t *cond); - int (*ptr_pthread_cond_signal)(pthread_cond_t *cond); - int (*ptr_pthread_cond_broadcast)(pthread_cond_t *cond); - int (*ptr_pthread_cond_wait)(pthread_cond_t *cond, pthread_mutex_t *mutex); - int (*ptr_pthread_cond_timedwait)(pthread_cond_t *cond, pthread_mutex_t *mutex, - const struct timespec *abstime); -}; - -#endif /* HAVE_PTHREAD_H */ - /* thread information used to creating and exiting threads */ struct wine_pthread_thread_info { diff --git a/include/wine/wined3d.idl b/include/wine/wined3d.idl index 5d502f1dfc0..4cf9159b714 100644 --- a/include/wine/wined3d.idl +++ b/include/wine/wined3d.idl @@ -1945,15 +1945,6 @@ typedef struct WineDirect3DVertexStridedData WineDirect3DStridedData diffuse; WineDirect3DStridedData specular; WineDirect3DStridedData texCoords[WINED3DDP_MAXTEXCOORD]; - WineDirect3DStridedData position2; /* tween data */ - WineDirect3DStridedData normal2; /* tween data */ - WineDirect3DStridedData tangent; - WineDirect3DStridedData binormal; - WineDirect3DStridedData tessFactor; - WineDirect3DStridedData fog; - WineDirect3DStridedData depth; - WineDirect3DStridedData sample; - /* Add fields here */ } s; WineDirect3DStridedData input[16]; /* Indexed by constants in D3DVSDE_REGISTER */ diff --git a/loader/pthread.c b/loader/pthread.c index 4c0c8924a32..e4e0831f210 100644 --- a/loader/pthread.c +++ b/loader/pthread.c @@ -39,6 +39,12 @@ #include #include #endif +#ifdef HAVE_PTHREAD_H +#include +#endif +#ifdef HAVE_PTHREAD_NP_H +#include +#endif #include "wine/library.h" #include "wine/pthread.h" diff --git a/tools/widl/widl.c b/tools/widl/widl.c index 62b7ff5d20b..cbc35b75175 100644 --- a/tools/widl/widl.c +++ b/tools/widl/widl.c @@ -196,6 +196,36 @@ static char *dup_basename_token(const char *name, const char *ext) return ret; } +static void add_widl_version_define(void) +{ + unsigned int version; + const char *p = PACKAGE_VERSION; + + /* major */ + version = atoi(p) * 0x10000; + p = strchr(p, '.'); + + /* minor */ + if (p) + { + version += atoi(p + 1) * 0x100; + p = strchr(p + 1, '.'); + } + + /* build */ + if (p) + version += atoi(p + 1); + + if (version != 0) + { + char version_str[11]; + snprintf(version_str, sizeof(version_str), "0x%x", version); + wpp_add_define("__WIDL__", version_str); + } + else + wpp_add_define("__WIDL__", NULL); +} + /* clean things up when aborting on a signal */ static void exit_on_signal( int sig ) { @@ -596,7 +626,7 @@ int main(int argc,char *argv[]) if (do_client) client_token = dup_basename_token(client_name,"_c.c"); if (do_server) server_token = dup_basename_token(server_name,"_s.c"); - wpp_add_cmdline_define("__WIDL__"); + add_widl_version_define(); atexit(rm_tempfile); if (!no_preprocess) -- 2.11.4.GIT