diff --git a/rostests/winetests/ole32/clipboard.c b/rostests/winetests/ole32/clipboard.c index ee912ce773e..8445f8b1c0f 100644 --- a/rostests/winetests/ole32/clipboard.c +++ b/rostests/winetests/ole32/clipboard.c @@ -200,7 +200,7 @@ static HRESULT WINAPI DataObjectImpl_GetData(IDataObject* iface, FORMATETC *pfor DataObjectImpl_GetData_calls++; if(pformatetc->lindex != -1) - return DV_E_LINDEX; + return DV_E_FORMATETC; if(!(pformatetc->tymed & TYMED_HGLOBAL)) return DV_E_TYMED; @@ -359,7 +359,10 @@ static void test_get_clipboard(void) InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL); fmtetc.lindex = 256; hr = IDataObject_QueryGetData(data_obj, &fmtetc); - ok(hr == DV_E_FORMATETC, "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr); + ok(hr == DV_E_FORMATETC || broken(hr == S_OK), + "IDataObject_QueryGetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr); + if (hr == S_OK) + ReleaseStgMedium(&stgmedium); InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL); fmtetc.cfFormat = CF_RIFF; @@ -397,8 +400,13 @@ static void test_get_clipboard(void) InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL); fmtetc.lindex = 256; hr = IDataObject_GetData(data_obj, &fmtetc, &stgmedium); - todo_wine - ok(hr == DV_E_FORMATETC, "IDataObject_GetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr); + ok(hr == DV_E_FORMATETC || broken(hr == S_OK), "IDataObject_GetData should have failed with DV_E_FORMATETC instead of 0x%08x\n", hr); + if (hr == S_OK) + { + /* undo the unexpected success */ + DataObjectImpl_GetData_calls--; + ReleaseStgMedium(&stgmedium); + } InitFormatEtc(fmtetc, CF_TEXT, TYMED_HGLOBAL); fmtetc.cfFormat = CF_RIFF; @@ -430,12 +438,10 @@ static void test_set_clipboard(void) return; hr = OleSetClipboard(data1); - todo_wine ok(hr == CO_E_NOTINITIALIZED, "OleSetClipboard should have failed with CO_E_NOTINITIALIZED instead of 0x%08x\n", hr); CoInitialize(NULL); hr = OleSetClipboard(data1); - todo_wine ok(hr == CO_E_NOTINITIALIZED || hr == CLIPBRD_E_CANT_SET, /* win9x */ "OleSetClipboard should have failed with " diff --git a/rostests/winetests/ole32/compobj.c b/rostests/winetests/ole32/compobj.c index 6f507926277..b52c1427794 100644 --- a/rostests/winetests/ole32/compobj.c +++ b/rostests/winetests/ole32/compobj.c @@ -40,18 +40,13 @@ HRESULT (WINAPI * pCoGetObjectContext)(REFIID riid, LPVOID *ppv); #define ok_no_locks() ok(cLocks == 0, "Number of locks should be 0, but actually is %d\n", cLocks) static const CLSID CLSID_non_existent = { 0x12345678, 0x1234, 0x1234, { 0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0 } }; -static const CLSID CLSID_CDeviceMoniker = { 0x4315d437, 0x5b8c, 0x11d0, { 0xbd, 0x3b, 0x00, 0xa0, 0xc9, 0x11, 0xce, 0x86 } }; -static WCHAR devicedotone[] = {'d','e','v','i','c','e','.','1',0}; +static const CLSID CLSID_StdFont = { 0x0be35203, 0x8f91, 0x11ce, { 0x9d, 0xe3, 0x00, 0xaa, 0x00, 0x4b, 0xb8, 0x51 } }; +static WCHAR stdfont[] = {'S','t','d','F','o','n','t',0}; static const WCHAR wszNonExistent[] = {'N','o','n','E','x','i','s','t','e','n','t',0}; -static WCHAR wszCLSID_CDeviceMoniker[] = +static WCHAR wszCLSID_StdFont[] = { - '{', - '4','3','1','5','d','4','3','7','-', - '5','b','8','c','-', - '1','1','d','0','-', - 'b','d','3','b','-', - '0','0','a','0','c','9','1','1','c','e','8','6', - '}',0 + '{','0','b','e','3','5','2','0','3','-','8','f','9','1','-','1','1','c','e','-', + '9','d','e','3','-','0','0','a','a','0','0','4','b','b','8','5','1','}',0 }; static const IID IID_IWineTest = @@ -143,11 +138,11 @@ static IClassFactory Test_ClassFactory = { &TestClassFactory_Vtbl }; static void test_ProgIDFromCLSID(void) { LPWSTR progid; - HRESULT hr = ProgIDFromCLSID(&CLSID_CDeviceMoniker, &progid); + HRESULT hr = ProgIDFromCLSID(&CLSID_StdFont, &progid); ok(hr == S_OK, "ProgIDFromCLSID failed with error 0x%08x\n", hr); if (hr == S_OK) { - ok(!lstrcmpiW(progid, devicedotone), "Didn't get expected prog ID\n"); + ok(!lstrcmpiW(progid, stdfont), "Didn't get expected prog ID\n"); CoTaskMemFree(progid); } @@ -156,20 +151,20 @@ static void test_ProgIDFromCLSID(void) ok(hr == REGDB_E_CLASSNOTREG, "ProgIDFromCLSID returned %08x\n", hr); ok(progid == NULL, "ProgIDFromCLSID returns with progid %p\n", progid); - hr = ProgIDFromCLSID(&CLSID_CDeviceMoniker, NULL); + hr = ProgIDFromCLSID(&CLSID_StdFont, NULL); ok(hr == E_INVALIDARG, "ProgIDFromCLSID should return E_INVALIDARG instead of 0x%08x\n", hr); } static void test_CLSIDFromProgID(void) { CLSID clsid; - HRESULT hr = CLSIDFromProgID(devicedotone, &clsid); + HRESULT hr = CLSIDFromProgID(stdfont, &clsid); ok(hr == S_OK, "CLSIDFromProgID failed with error 0x%08x\n", hr); - ok(IsEqualCLSID(&clsid, &CLSID_CDeviceMoniker), "clsid wasn't equal to CLSID_CDeviceMoniker\n"); + ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n"); - hr = CLSIDFromString(devicedotone, &clsid); + hr = CLSIDFromString(stdfont, &clsid); ok_ole_success(hr, "CLSIDFromString"); - ok(IsEqualCLSID(&clsid, &CLSID_CDeviceMoniker), "clsid wasn't equal to CLSID_CDeviceMoniker\n"); + ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n"); /* test some failure cases */ @@ -188,9 +183,9 @@ static void test_CLSIDFromProgID(void) static void test_CLSIDFromString(void) { CLSID clsid; - HRESULT hr = CLSIDFromString(wszCLSID_CDeviceMoniker, &clsid); + HRESULT hr = CLSIDFromString(wszCLSID_StdFont, &clsid); ok_ole_success(hr, "CLSIDFromString"); - ok(IsEqualCLSID(&clsid, &CLSID_CDeviceMoniker), "clsid wasn't equal to CLSID_CDeviceMoniker\n"); + ok(IsEqualCLSID(&clsid, &CLSID_StdFont), "clsid wasn't equal to CLSID_StdFont\n"); hr = CLSIDFromString(NULL, &clsid); ok_ole_success(hr, "CLSIDFromString"); @@ -202,19 +197,19 @@ static void test_StringFromGUID2(void) WCHAR str[50]; int len; /* Test corner cases for buffer size */ - len = StringFromGUID2(&CLSID_CDeviceMoniker,str,50); + len = StringFromGUID2(&CLSID_StdFont,str,50); ok(len == 39, "len: %d (expected 39)\n", len); - ok(!lstrcmpiW(str, wszCLSID_CDeviceMoniker),"string wan't equal for CLSID_CDeviceMoniker\n"); + ok(!lstrcmpiW(str, wszCLSID_StdFont),"string wasn't equal for CLSID_StdFont\n"); memset(str,0,sizeof str); - len = StringFromGUID2(&CLSID_CDeviceMoniker,str,39); + len = StringFromGUID2(&CLSID_StdFont,str,39); ok(len == 39, "len: %d (expected 39)\n", len); - ok(!lstrcmpiW(str, wszCLSID_CDeviceMoniker),"string wan't equal for CLSID_CDeviceMoniker\n"); + ok(!lstrcmpiW(str, wszCLSID_StdFont),"string wasn't equal for CLSID_StdFont\n"); - len = StringFromGUID2(&CLSID_CDeviceMoniker,str,38); + len = StringFromGUID2(&CLSID_StdFont,str,38); ok(len == 0, "len: %d (expected 0)\n", len); - len = StringFromGUID2(&CLSID_CDeviceMoniker,str,30); + len = StringFromGUID2(&CLSID_StdFont,str,30); ok(len == 0, "len: %d (expected 0)\n", len); } diff --git a/rostests/winetests/ole32/defaulthandler.c b/rostests/winetests/ole32/defaulthandler.c new file mode 100644 index 00000000000..a6469b709e5 --- /dev/null +++ b/rostests/winetests/ole32/defaulthandler.c @@ -0,0 +1,110 @@ +/* + * Default Handler Tests + * + * Copyright 2008 Huw Davies + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS +#define CONST_VTABLE + +#include + +#include "windef.h" +#include "winbase.h" +#include "objbase.h" + +#include "wine/test.h" + + +static HRESULT create_storage(IStorage **stg) +{ + HRESULT hr; + ILockBytes *lock_bytes; + + hr = CreateILockBytesOnHGlobal(NULL, TRUE, &lock_bytes); + if(SUCCEEDED(hr)) + { + hr = StgCreateDocfileOnILockBytes(lock_bytes, + STGM_CREATE | STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, stg); + ILockBytes_Release(lock_bytes); + } + return hr; +} + +typedef struct +{ + DWORD version; + DWORD flags; + DWORD link_update_opt; + DWORD res; + DWORD moniker_size; +} ole_stream_header_t; + +static void test_olestream(void) +{ + HRESULT hr; + const CLSID non_existent_class = {0xa5f1772f, 0x3772, 0x490f, {0x9e, 0xc6, 0x77, 0x13, 0xe8, 0xb3, 0x4b, 0x5d}}; + IOleObject *ole_obj; + IPersistStorage *persist; + IStorage *stg; + IStream *stm; + static const WCHAR olestream[] = {1,'O','l','e',0}; + ULONG read; + ole_stream_header_t header; + + hr = create_storage(&stg); + ok(hr == S_OK, "got %08x\n", hr); + + hr = IStorage_OpenStream(stg, olestream, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, 0, &stm); + ok(hr == STG_E_FILENOTFOUND, "got %08x\n", hr); + + hr = OleCreateDefaultHandler(&non_existent_class, 0, &IID_IOleObject, (void**)&ole_obj); + ok(hr == S_OK, "got %08x\n", hr); + + hr = IOleObject_QueryInterface(ole_obj, &IID_IPersistStorage, (void**)&persist); + ok(hr == S_OK, "got %08x\n", hr); + + hr = IPersistStorage_InitNew(persist, stg); + ok(hr == S_OK, "got %08x\n", hr); + + hr = IStorage_OpenStream(stg, olestream, NULL, STGM_SHARE_EXCLUSIVE | STGM_READ, 0, &stm); + ok(hr == S_OK, "got %08x\n", hr); + hr = IStream_Read(stm, &header, sizeof(header), &read); + ok(hr == S_OK, "got %08x\n", hr); + ok(read == sizeof(header), "read %d\n", read); + ok(header.version == 0x02000001, "got version %08x\n", header.version); + ok(header.flags == 0x0, "got flags %08x\n", header.flags); + ok(header.link_update_opt == 0x0, "got link update option %08x\n", header.link_update_opt); + ok(header.res == 0x0, "got reserved %08x\n", header.res); + ok(header.moniker_size == 0x0, "got moniker size %08x\n", header.moniker_size); + + IStream_Release(stm); + + IPersistStorage_Release(persist); + IOleObject_Release(ole_obj); + + IStorage_Release(stg); +} + +START_TEST(defaulthandler) +{ + OleInitialize(NULL); + + test_olestream(); + + OleUninitialize(); +} diff --git a/rostests/winetests/ole32/dragdrop.c b/rostests/winetests/ole32/dragdrop.c index 15610661c29..b7599814ba8 100644 --- a/rostests/winetests/ole32/dragdrop.c +++ b/rostests/winetests/ole32/dragdrop.c @@ -108,16 +108,42 @@ static const IDropTargetVtbl DropTarget_VTbl = static IDropTarget DropTarget = { &DropTarget_VTbl }; +static ATOM register_dummy_class(void) +{ + WNDCLASS wc = + { + 0, + DefWindowProc, + 0, + 0, + GetModuleHandle(NULL), + NULL, + LoadCursor(NULL, IDC_ARROW), + (HBRUSH)(COLOR_BTNFACE+1), + NULL, + TEXT("WineOleTestClass"), + }; + + return RegisterClass(&wc); +} + START_TEST(dragdrop) { HRESULT hr; + HWND hwnd; - hr = RegisterDragDrop(GetDesktopWindow(), &DropTarget); - ok(hr == E_OUTOFMEMORY, "RegisterDragDrop without OLE initialized should have returned E_OUTOFMEMORY instead of 0x%08x\n", hr); + hwnd = CreateWindow(MAKEINTATOM(register_dummy_class()), "Test", 0, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, NULL, + NULL, NULL, NULL); + + hr = RegisterDragDrop(hwnd, &DropTarget); + ok(hr == E_OUTOFMEMORY || + broken(hr == CO_E_NOTINITIALIZED), /* NT4 */ + "RegisterDragDrop without OLE initialized should have returned E_OUTOFMEMORY instead of 0x%08x\n", hr); OleInitialize(NULL); - hr = RegisterDragDrop(GetDesktopWindow(), NULL); + hr = RegisterDragDrop(hwnd, NULL); ok(hr == E_INVALIDARG, "RegisterDragDrop with NULL IDropTarget * should return E_INVALIDARG instead of 0x%08x\n", hr); hr = RegisterDragDrop(NULL, &DropTarget); @@ -127,21 +153,25 @@ START_TEST(dragdrop) ok(hr == DRAGDROP_E_INVALIDHWND, "RegisterDragDrop with garbage hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr); ok(droptarget_addref_called == 0, "DropTarget_AddRef shouldn't have been called\n"); - hr = RegisterDragDrop(GetDesktopWindow(), &DropTarget); + hr = RegisterDragDrop(hwnd, &DropTarget); ok_ole_success(hr, "RegisterDragDrop"); ok(droptarget_addref_called == 1, "DropTarget_AddRef should have been called once, not %d times\n", droptarget_addref_called); - hr = RegisterDragDrop(GetDesktopWindow(), &DropTarget); + hr = RegisterDragDrop(hwnd, &DropTarget); ok(hr == DRAGDROP_E_ALREADYREGISTERED, "RegisterDragDrop with already registered hwnd should return DRAGDROP_E_ALREADYREGISTERED instead of 0x%08x\n", hr); ok(droptarget_release_called == 0, "DropTarget_Release shouldn't have been called\n"); OleUninitialize(); ok(droptarget_release_called == 0, "DropTarget_Release shouldn't have been called\n"); - hr = RevokeDragDrop(GetDesktopWindow()); + hr = RevokeDragDrop(hwnd); ok_ole_success(hr, "RevokeDragDrop"); - ok(droptarget_release_called == 1, "DropTarget_Release should have been called once, not %d times\n", droptarget_release_called); + ok(droptarget_release_called == 1 || + broken(droptarget_release_called == 0), /* NT4 */ + "DropTarget_Release should have been called once, not %d times\n", droptarget_release_called); hr = RevokeDragDrop(NULL); ok(hr == DRAGDROP_E_INVALIDHWND, "RevokeDragDrop with NULL hwnd should return DRAGDROP_E_INVALIDHWND instead of 0x%08x\n", hr); + + DestroyWindow(hwnd); } diff --git a/rostests/winetests/ole32/hglobalstream.c b/rostests/winetests/ole32/hglobalstream.c index eb98a18c44a..cae13ed2ea9 100644 --- a/rostests/winetests/ole32/hglobalstream.c +++ b/rostests/winetests/ole32/hglobalstream.c @@ -92,7 +92,8 @@ static void test_streamonhglobal(IStream *pStream) ull.u.HighPart = -1; ull.u.LowPart = -1; hr = IStream_SetSize(pStream, ull); - ok(hr == E_OUTOFMEMORY, "IStream_SetSize with large size should have returned E_OUTOFMEMORY instead of 0x%08x\n", hr); + ok(hr == E_OUTOFMEMORY || broken(hr == S_OK), /* win9x */ + "IStream_SetSize with large size should have returned E_OUTOFMEMORY instead of 0x%08x\n", hr); } static HRESULT WINAPI TestStream_QueryInterface(IStream *iface, REFIID riid, void **ppv) @@ -261,18 +262,19 @@ static void test_copyto(void) static void test_freed_hglobal(void) { + static const char teststring[] = "this is a test string"; HRESULT hr; IStream *pStream; HGLOBAL hglobal; char *p; - char buffer[10]; + char buffer[sizeof(teststring) + 8]; ULARGE_INTEGER ull; ULONG read, written; - hglobal = GlobalAlloc(GMEM_DDESHARE|GMEM_NODISCARD|GMEM_MOVEABLE, strlen("Rob") + 1); + hglobal = GlobalAlloc(GMEM_DDESHARE|GMEM_NODISCARD|GMEM_MOVEABLE, strlen(teststring) + 1); ok(hglobal != NULL, "GlobalAlloc failed with error %d\n", GetLastError()); p = GlobalLock(hglobal); - strcpy(p, "Rob"); + strcpy(p, teststring); GlobalUnlock(hglobal); hr = CreateStreamOnHGlobal(hglobal, FALSE, &pStream); @@ -280,8 +282,10 @@ static void test_freed_hglobal(void) hr = IStream_Read(pStream, buffer, sizeof(buffer), &read); ok_ole_success(hr, "IStream_Read"); - ok(!strcmp(buffer, "Rob"), "buffer data %s differs\n", buffer); - ok(read == strlen("Rob") + 1, "read should be 4 instead of %d\n", read); + ok(!strcmp(buffer, teststring), "buffer data %s differs\n", buffer); + ok(read == sizeof(teststring) || + broken(read == ((sizeof(teststring) + 3) & ~3)), /* win9x rounds the size */ + "read should be sizeof(teststring) instead of %d\n", read); GlobalFree(hglobal); diff --git a/rostests/winetests/ole32/marshal.c b/rostests/winetests/ole32/marshal.c index 0443b63291a..9dc76323ad0 100644 --- a/rostests/winetests/ole32/marshal.c +++ b/rostests/winetests/ole32/marshal.c @@ -2052,7 +2052,7 @@ static void test_freethreadedmarshaldata(IStream *pStream, MSHCTX mshctx, void * size = GlobalSize(hglobal); - marshal_data = (char *)GlobalLock(hglobal); + marshal_data = GlobalLock(hglobal); if (mshctx == MSHCTX_INPROC) { diff --git a/rostests/winetests/ole32/moniker.c b/rostests/winetests/ole32/moniker.c index 468eb62de74..1b7bcc3badb 100644 --- a/rostests/winetests/ole32/moniker.c +++ b/rostests/winetests/ole32/moniker.c @@ -364,7 +364,7 @@ Moniker_GetDisplayName(IMoniker* iface, IBindCtx* pbc, { static const WCHAR wszDisplayName[] = {'*','*','G','e','m','m','a',0}; CHECK_EXPECTED_METHOD("Moniker_GetDisplayName"); - *ppszDisplayName = (LPOLESTR)CoTaskMemAlloc(sizeof(wszDisplayName)); + *ppszDisplayName = CoTaskMemAlloc(sizeof(wszDisplayName)); memcpy(*ppszDisplayName, wszDisplayName, sizeof(wszDisplayName)); return S_OK; } diff --git a/rostests/winetests/ole32/ole2.c b/rostests/winetests/ole32/ole2.c index cc3476d60f7..99b8acb0503 100644 --- a/rostests/winetests/ole32/ole2.c +++ b/rostests/winetests/ole32/ole2.c @@ -1481,7 +1481,7 @@ static void test_default_handler(void) IOleObject_Release(pObject); } -void test_runnable(void) +static void test_runnable(void) { static const char *methods_query_runnable[] = { diff --git a/rostests/winetests/ole32/ole32.rbuild b/rostests/winetests/ole32/ole32.rbuild index 904cb0fdb95..2ed9a5f1b50 100644 --- a/rostests/winetests/ole32/ole32.rbuild +++ b/rostests/winetests/ole32/ole32.rbuild @@ -6,6 +6,7 @@ . clipboard.c compobj.c + defaulthandler.c dragdrop.c errorinfo.c hglobalstream.c diff --git a/rostests/winetests/ole32/stg_prop.c b/rostests/winetests/ole32/stg_prop.c index a7024b38296..c4e2d0c59d6 100644 --- a/rostests/winetests/ole32/stg_prop.c +++ b/rostests/winetests/ole32/stg_prop.c @@ -408,8 +408,7 @@ static void testCodepage(void) /* check code page before it's been explicitly set */ hr = IPropertyStorage_ReadMultiple(propertyStorage, 1, &spec, &var); ok(hr == S_OK, "ReadMultiple failed: 0x%08x\n", hr); - ok(var.vt == VT_I2 && U(var).iVal == 1252, - "Didn't get expected type or value for property\n"); + ok(var.vt == VT_I2, "Didn't get expected type for property (%u)\n", var.vt); /* Set code page to Unicode */ U(var).iVal = 1200; hr = IPropertyStorage_WriteMultiple(propertyStorage, 1, &spec, &var, 0); diff --git a/rostests/winetests/ole32/storage32.c b/rostests/winetests/ole32/storage32.c index d825ab66bfa..f65af733d28 100644 --- a/rostests/winetests/ole32/storage32.c +++ b/rostests/winetests/ole32/storage32.c @@ -262,7 +262,8 @@ static void test_storage_stream(void) r = IStorage_CreateStream(stg, NULL, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); ok(r==STG_E_INVALIDNAME, "IStorage->CreateStream wrong error\n"); r = IStorage_CreateStream(stg, longname, STGM_SHARE_EXCLUSIVE | STGM_READWRITE, 0, 0, &stm ); - ok(r==STG_E_INVALIDNAME, "IStorage->CreateStream wrong error, got %d GetLastError()=%d\n", r, GetLastError()); + ok(r==STG_E_INVALIDNAME || broken(r==S_OK) /* nt4 */, + "IStorage->CreateStream wrong error, got %d GetLastError()=%d\n", r, GetLastError()); r = IStorage_CreateStream(stg, stmname, STGM_READWRITE, 0, 0, &stm ); ok(r==STG_E_INVALIDFLAG, "IStorage->CreateStream wrong error\n"); r = IStorage_CreateStream(stg, stmname, STGM_READ, 0, 0, &stm ); @@ -1003,65 +1004,66 @@ struct access_res { BOOL gothandle; DWORD lasterr; + BOOL ignore; }; static const struct access_res create[16] = { - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { TRUE, ERROR_SUCCESS }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { TRUE, ERROR_SUCCESS }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { TRUE, ERROR_SUCCESS } + { TRUE, ERROR_SUCCESS, TRUE }, + { TRUE, ERROR_SUCCESS, TRUE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { TRUE, ERROR_SUCCESS, TRUE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { TRUE, ERROR_SUCCESS, TRUE } }; static const struct access_res create_commit[16] = { - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { TRUE, ERROR_SUCCESS }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { TRUE, ERROR_SUCCESS }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { FALSE, ERROR_SHARING_VIOLATION }, - { TRUE, ERROR_SUCCESS } + { TRUE, ERROR_SUCCESS, TRUE }, + { TRUE, ERROR_SUCCESS, TRUE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { TRUE, ERROR_SUCCESS, TRUE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { FALSE, ERROR_SHARING_VIOLATION, FALSE }, + { TRUE, ERROR_SUCCESS, TRUE } }; static const struct access_res create_close[16] = { - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, - { TRUE, ERROR_SUCCESS }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, + { TRUE, ERROR_SUCCESS, FALSE }, { TRUE, ERROR_SUCCESS } }; @@ -1081,6 +1083,9 @@ static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD for (j = 0; j < 4; j++) { + if (ares[idx].ignore) + continue; + if (j == 0) share = 0; if (j == 1) share = FILE_SHARE_READ; if (j == 2) share = FILE_SHARE_WRITE; @@ -1096,7 +1101,8 @@ static void _test_file_access(LPCSTR file, const struct access_res *ares, DWORD line, idx, ares[idx].gothandle, (hfile != INVALID_HANDLE_VALUE)); - ok(lasterr == ares[idx].lasterr, + ok(lasterr == ares[idx].lasterr || + broken(lasterr == 0xdeadbeef) /* win9x */, "(%d, lasterr, %d): Expected %d, got %d\n", line, idx, ares[idx].lasterr, lasterr); diff --git a/rostests/winetests/ole32/testlist.c b/rostests/winetests/ole32/testlist.c index 0d19af299c6..65c40d2c5ad 100644 --- a/rostests/winetests/ole32/testlist.c +++ b/rostests/winetests/ole32/testlist.c @@ -8,6 +8,7 @@ extern void func_clipboard(void); extern void func_compobj(void); +extern void func_defaulthandler(void); extern void func_dragdrop(void); extern void func_errorinfo(void); extern void func_hglobalstream(void); @@ -23,6 +24,7 @@ const struct test winetest_testlist[] = { { "clipboard", func_clipboard }, { "compobj", func_compobj }, + { "defaulthandler", func_defaulthandler }, { "dragdrop", func_dragdrop }, { "errorinfo", func_errorinfo }, { "hglobalstream", func_hglobalstream }, diff --git a/rostests/winetests/ole32/usrmarshal.c b/rostests/winetests/ole32/usrmarshal.c index 60e85cf5544..087d5cb6388 100644 --- a/rostests/winetests/ole32/usrmarshal.c +++ b/rostests/winetests/ole32/usrmarshal.c @@ -158,9 +158,9 @@ static void test_marshal_HGLOBAL(void) static HENHMETAFILE create_emf(void) { - RECT rect = {0, 0, 100, 100}; + const RECT rect = {0, 0, 100, 100}; HDC hdc = CreateEnhMetaFile(NULL, NULL, &rect, "HENHMETAFILE Marshaling Test\0Test\0\0"); - ExtTextOut(hdc, 0, 0, ETO_OPAQUE, NULL, "Test String", strlen("Test String"), NULL); + ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, "Test String", strlen("Test String"), NULL); return CloseEnhMetaFile(hdc); }