Module: wine Branch: master Commit: d2a38cef9981eef210b31abfea341804c60494d9 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d2a38cef9981eef210b31abfea...
Author: Rob Shearman rob@codeweavers.com Date: Wed Feb 7 22:09:43 2007 +0000
oleaut32: Always register the typelib for the tmarshal tests.
---
dlls/oleaut32/tests/tmarshal.c | 39 +++++++++++++-------------------------- 1 files changed, 13 insertions(+), 26 deletions(-)
diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c index 99bbf00..9308408 100644 --- a/dlls/oleaut32/tests/tmarshal.c +++ b/dlls/oleaut32/tests/tmarshal.c @@ -520,16 +520,20 @@ typedef struct KindaEnum LONG refs; } KindaEnum;
-static HRESULT register_current_module_typelib(ITypeLib **typelib) +static HRESULT register_current_module_typelib(void) { WCHAR path[MAX_PATH]; HRESULT hr; + ITypeLib *typelib;
GetModuleFileNameW(NULL, path, MAX_PATH);
- hr = LoadTypeLib(path, typelib); + hr = LoadTypeLib(path, &typelib); if (SUCCEEDED(hr)) - hr = RegisterTypeLib(*typelib, path, NULL); + { + hr = RegisterTypeLib(typelib, path, NULL); + ITypeLib_Release(typelib); + } return hr; }
@@ -544,11 +548,6 @@ static IWidget *Widget_Create(void)
hr = LoadRegTypeLib(&LIBID_TestTypelib, 1, 0, LOCALE_NEUTRAL, &pTypeLib); ok_ole_success(hr, LoadRegTypeLib); - if (hr == TYPE_E_LIBNOTREGISTERED) - { - hr = register_current_module_typelib(&pTypeLib); - ok_ole_success(hr, register_current_module_typelib); - } if (SUCCEEDED(hr)) { ITypeInfo *pTypeInfo; @@ -658,19 +657,6 @@ static const IKindaEnumWidgetVtbl KindaE static IKindaEnumWidget *KindaEnumWidget_Create(void) { KindaEnum *This; - HRESULT hr; - ITypeLib *pTypeLib; - - hr = LoadRegTypeLib(&LIBID_TestTypelib, 1, 0, LOCALE_NEUTRAL, &pTypeLib); - if (hr == TYPE_E_LIBNOTREGISTERED) - { - hr = register_current_module_typelib(&pTypeLib); - ok_ole_success(hr, register_current_module_typelib); - } - else - ok_ole_success(hr, LoadRegTypeLib); - if (SUCCEEDED(hr)) - ITypeLib_Release(pTypeLib);
This = (KindaEnum *)HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); if (!This) return NULL; @@ -720,11 +706,7 @@ static ITypeInfo *NonOleAutomation_GetTy { ITypeLib *pTypeLib; HRESULT hr = LoadRegTypeLib(&LIBID_TestTypelib, 1, 0, LOCALE_NEUTRAL, &pTypeLib); - if (hr == TYPE_E_LIBNOTREGISTERED) - { - hr = register_current_module_typelib(&pTypeLib); - ok_ole_success(hr, register_current_module_typelib); - } + ok_ole_success(hr, LoadRegTypeLib); if (SUCCEEDED(hr)) { ITypeInfo *pTypeInfo; @@ -1106,8 +1088,13 @@ static void test_DispCallFunc(void)
START_TEST(tmarshal) { + HRESULT hr; + CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
+ hr = register_current_module_typelib(); + ok_ole_success(hr, register_current_module_typelib); + test_typelibmarshal(); test_DispCallFunc();