sync ole32 winetest to wine 1.1.13

svn path=/trunk/; revision=38907
This commit is contained in:
Christoph von Wittich 2009-01-18 19:23:06 +00:00
parent 4e7ee302a9
commit 130bfcf51a
6 changed files with 126 additions and 10 deletions

View file

@ -29,6 +29,9 @@
#include "shlguid.h"
#include "urlmon.h" /* for CLSID_FileProtocol */
#include "initguid.h"
#include "ctxtcall.h"
#include "wine/test.h"
/* functions that are not present on all versions of Windows */
@ -887,7 +890,7 @@ static void test_registered_object_thread_affinity(void)
ok(hr == S_OK, "CoGetClassObject on local server object registered in same "
"thread should return S_OK instead of 0x%08x\n", hr);
thread = CreateThread(NULL, 0, revoke_class_object_thread, (LPVOID)cookie, 0, &tid);
thread = CreateThread(NULL, 0, revoke_class_object_thread, (LPVOID)(DWORD_PTR)cookie, 0, &tid);
ok(thread != NULL, "CreateThread failed with error %d\n", GetLastError());
WaitForSingleObject(thread, INFINITE);
GetExitCodeThread(thread, &exitcode);
@ -931,7 +934,7 @@ static void test_CoFreeUnusedLibraries(void)
ok(!is_module_loaded("urlmon.dll"), "urlmon.dll shouldn't be loaded\n");
hr = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER, &IID_IUnknown, (void **)&pUnk);
hr = CoCreateInstance(&CLSID_FileProtocol, NULL, CLSCTX_INPROC_SERVER, &IID_IInternetProtocol, (void **)&pUnk);
if (hr == REGDB_E_CLASSNOTREG)
{
trace("IE not installed so can't run CoFreeUnusedLibraries test\n");
@ -967,6 +970,7 @@ static void test_CoGetObjectContext(void)
HRESULT hr;
ULONG refs;
IComThreadingInfo *pComThreadingInfo;
IContextCallback *pContextCallback;
APTTYPE apttype;
THDTYPE thdtype;
@ -996,6 +1000,15 @@ static void test_CoGetObjectContext(void)
refs = IComThreadingInfo_Release(pComThreadingInfo);
ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %d refs\n", refs);
hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
if (hr == S_OK)
{
refs = IContextCallback_Release(pContextCallback);
ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs);
}
CoUninitialize();
pCoInitializeEx(NULL, COINIT_MULTITHREADED);
@ -1014,14 +1027,41 @@ static void test_CoGetObjectContext(void)
refs = IComThreadingInfo_Release(pComThreadingInfo);
ok(refs == 0, "pComThreadingInfo should have 0 refs instead of %d refs\n", refs);
hr = pCoGetObjectContext(&IID_IContextCallback, (void **)&pContextCallback);
ok_ole_success(hr, "CoGetObjectContext(ContextCallback)");
if (hr == S_OK)
{
refs = IContextCallback_Release(pContextCallback);
ok(refs == 0, "pContextCallback should have 0 refs instead of %d refs\n", refs);
}
CoUninitialize();
}
static void test_CoInitializeEx(void)
{
HRESULT hr;
hr = pCoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
ok(hr == S_OK, "CoInitializeEx failed with error 0x%08x\n", hr);
/* Calling OleInitialize for the first time should yield S_OK even with
* apartment already initialized by previous CoInitialize(Ex) calls. */
hr = OleInitialize(NULL);
todo_wine ok(hr == S_OK, "OleInitialize failed with error 0x%08x\n", hr);
/* Subsequent calls to OleInitialize should return S_FALSE */
hr = OleInitialize(NULL);
ok(hr == S_FALSE, "Expected S_FALSE, hr = 0x%08x\n", hr);
/* Cleanup */
CoUninitialize();
OleUninitialize();
}
START_TEST(compobj)
{
skip("ROS-HACK: Skipping compobj tests\n");
return;
HMODULE hOle32 = GetModuleHandle("ole32");
pCoGetObjectContext = (void*)GetProcAddress(hOle32, "CoGetObjectContext");
if (!(pCoInitializeEx = (void*)GetProcAddress(hOle32, "CoInitializeEx")))
@ -1048,4 +1088,5 @@ START_TEST(compobj)
test_registered_object_thread_affinity();
test_CoFreeUnusedLibraries();
test_CoGetObjectContext();
test_CoInitializeEx();
}

View file

@ -2056,15 +2056,18 @@ static void test_freethreadedmarshaldata(IStream *pStream, MSHCTX mshctx, void *
if (mshctx == MSHCTX_INPROC)
{
DWORD expected_size = sizeof(DWORD) + sizeof(void *) + sizeof(DWORD) + sizeof(GUID);
DWORD expected_size = 3*sizeof(DWORD) + sizeof(GUID);
ok(size == expected_size, "size should have been %d instead of %d\n", expected_size, size);
ok(*(DWORD *)marshal_data == mshlflags, "expected 0x%x, but got 0x%x for mshctx\n", mshlflags, *(DWORD *)marshal_data);
marshal_data += sizeof(DWORD);
ok(*(void **)marshal_data == ptr, "expected %p, but got %p for mshctx\n", ptr, *(void **)marshal_data);
marshal_data += sizeof(void *);
ok(*(DWORD *)marshal_data == 0, "expected 0x0, but got 0x%x\n", *(DWORD *)marshal_data);
marshal_data += sizeof(DWORD);
if (sizeof(void*) == 4)
{
ok(*(DWORD *)marshal_data == 0, "expected 0x0, but got 0x%x\n", *(DWORD *)marshal_data);
marshal_data += sizeof(DWORD);
}
trace("got guid data: {%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\n",
((GUID *)marshal_data)->Data1, ((GUID *)marshal_data)->Data2, ((GUID *)marshal_data)->Data3,
((GUID *)marshal_data)->Data4[0], ((GUID *)marshal_data)->Data4[1], ((GUID *)marshal_data)->Data4[2], ((GUID *)marshal_data)->Data4[3],

View file

@ -1332,6 +1332,9 @@ static void test_class_moniker(void)
ok_ole_success(hr, CreateBindCtx);
/* IsRunning test */
hr = IMoniker_IsRunning(moniker, NULL, NULL, NULL);
ok(hr == E_NOTIMPL, "IMoniker_IsRunning should return E_NOTIMPL, not 0x%08x\n", hr);
hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
ok(hr == E_NOTIMPL, "IMoniker_IsRunning should return E_NOTIMPL, not 0x%08x\n", hr);
@ -1461,6 +1464,10 @@ static void test_item_moniker(void)
ok_ole_success(hr, CreateBindCtx);
/* IsRunning test */
hr = IMoniker_IsRunning(moniker, NULL, NULL, NULL);
todo_wine
ok(hr == E_INVALIDARG, "IMoniker_IsRunning should return E_INVALIDARG, not 0x%08x\n", hr);
hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
ok(hr == S_FALSE, "IMoniker_IsRunning should return S_FALSE, not 0x%08x\n", hr);
@ -1593,6 +1600,10 @@ static void test_generic_composite_moniker(void)
ok_ole_success(hr, CreateBindCtx);
/* IsRunning test */
hr = IMoniker_IsRunning(moniker, NULL, NULL, NULL);
todo_wine
ok(hr == E_INVALIDARG, "IMoniker_IsRunning should return E_INVALIDARG, not 0x%08x\n", hr);
hr = IMoniker_IsRunning(moniker, bindctx, NULL, NULL);
todo_wine
ok(hr == S_FALSE, "IMoniker_IsRunning should return S_FALSE, not 0x%08x\n", hr);
@ -1750,7 +1761,7 @@ static void test_bind_context(void)
hr = IBindCtx_GetBindOptions(pBindCtx, (BIND_OPTS *)&bind_opts);
ok_ole_success(hr, "IBindCtx_GetBindOptions");
ok(bind_opts.cbStruct == sizeof(bind_opts) ||
bind_opts.cbStruct == 36, /* Vista */
bind_opts.cbStruct == sizeof(bind_opts) + sizeof(void*), /* Vista */
"bind_opts.cbStruct was %d\n", bind_opts.cbStruct);
bind_opts.cbStruct = sizeof(BIND_OPTS);

View file

@ -1384,7 +1384,6 @@ static void test_default_handler(void)
hr);
hr = IOleObject_GetMiscStatus(pObject, DVASPECT_CONTENT, &dwStatus);
todo_wine
ok(hr == REGDB_E_CLASSNOTREG, "IOleObject_GetMiscStatus should have returned REGDB_E_CLASSNOTREG instead of 0x%08x\n", hr);
hr = IOleObject_GetUserClassID(pObject, &clsid);

View file

@ -803,6 +803,56 @@ static void test_storage_refcount(void)
DeleteFileW(filename);
}
static void test_writeclassstg(void)
{
static const WCHAR szPrefix[] = { 's','t','g',0 };
static const WCHAR szDot[] = { '.',0 };
WCHAR filename[MAX_PATH];
IStorage *stg = NULL;
HRESULT r;
CLSID temp_cls;
if(!GetTempFileNameW(szDot, szPrefix, 0, filename))
return;
DeleteFileW(filename);
/* create the file */
r = StgCreateDocfile( filename, STGM_CREATE | STGM_SHARE_EXCLUSIVE |
STGM_READWRITE, 0, &stg);
ok(r==S_OK, "StgCreateDocfile failed\n");
r = ReadClassStg( NULL, NULL );
ok(r == E_INVALIDARG, "ReadClassStg should return E_INVALIDARG instead of 0x%08X\n", r);
r = ReadClassStg( stg, NULL );
ok(r == E_INVALIDARG, "ReadClassStg should return E_INVALIDARG instead of 0x%08X\n", r);
temp_cls.Data1 = 0xdeadbeef;
r = ReadClassStg( stg, &temp_cls );
ok(r == S_OK, "ReadClassStg failed with 0x%08X\n", r);
ok(IsEqualCLSID(&temp_cls, &CLSID_NULL), "ReadClassStg returned wrong clsid\n");
r = WriteClassStg( NULL, NULL );
ok(r == E_INVALIDARG, "WriteClassStg should return E_INVALIDARG instead of 0x%08X\n", r);
r = WriteClassStg( stg, NULL );
ok(r == STG_E_INVALIDPOINTER, "WriteClassStg should return STG_E_INVALIDPOINTER instead of 0x%08X\n", r);
r = WriteClassStg( stg, &test_stg_cls );
ok( r == S_OK, "WriteClassStg failed with 0x%08X\n", r);
r = ReadClassStg( stg, &temp_cls );
ok( r == S_OK, "ReadClassStg failed with 0x%08X\n", r);
ok(IsEqualCLSID(&temp_cls, &test_stg_cls), "ReadClassStg returned wrong clsid\n");
r = IStorage_Release( stg );
ok (r == 0, "storage not released\n");
DeleteFileW(filename);
}
static void test_streamenum(void)
{
static const WCHAR szPrefix[] = { 's','t','g',0 };
@ -1229,4 +1279,5 @@ START_TEST(storage32)
test_transact();
test_ReadClassStm();
test_access();
test_writeclassstg();
}

View file

@ -34,6 +34,17 @@ unsigned char * __RPC_USER HMETAFILE_UserMarshal(ULONG *, unsigned char *, HMETA
unsigned char * __RPC_USER HMETAFILE_UserUnmarshal(ULONG *, unsigned char *, HMETAFILE *);
void __RPC_USER HMETAFILE_UserFree(ULONG *, HMETAFILE *);
ULONG __RPC_USER HENHMETAFILE_UserSize(ULONG *, ULONG, HENHMETAFILE *);
unsigned char * __RPC_USER HENHMETAFILE_UserMarshal (ULONG *, unsigned char *, HENHMETAFILE *);
unsigned char * __RPC_USER HENHMETAFILE_UserUnmarshal(ULONG *, unsigned char *, HENHMETAFILE *);
void __RPC_USER HENHMETAFILE_UserFree(ULONG *, HENHMETAFILE *);
ULONG __RPC_USER HMETAFILEPICT_UserSize(ULONG *, ULONG, HMETAFILEPICT *);
unsigned char * __RPC_USER HMETAFILEPICT_UserMarshal (ULONG *, unsigned char *, HMETAFILEPICT *);
unsigned char * __RPC_USER HMETAFILEPICT_UserUnmarshal(ULONG *, unsigned char *, HMETAFILEPICT *);
void __RPC_USER HMETAFILEPICT_UserFree(ULONG *, HMETAFILEPICT *);
static const char cf_marshaled[] =
{
0x9, 0x0, 0x0, 0x0,