oleaut32: Always register the typelib for the tmarshal tests.

This commit is contained in:
Rob Shearman 2007-02-07 22:09:43 +00:00 committed by Alexandre Julliard
parent 5b19d5899f
commit d2a38cef99
1 changed files with 13 additions and 26 deletions

View File

@ -520,16 +520,20 @@ typedef struct KindaEnum
LONG refs; LONG refs;
} KindaEnum; } KindaEnum;
static HRESULT register_current_module_typelib(ITypeLib **typelib) static HRESULT register_current_module_typelib(void)
{ {
WCHAR path[MAX_PATH]; WCHAR path[MAX_PATH];
HRESULT hr; HRESULT hr;
ITypeLib *typelib;
GetModuleFileNameW(NULL, path, MAX_PATH); GetModuleFileNameW(NULL, path, MAX_PATH);
hr = LoadTypeLib(path, typelib); hr = LoadTypeLib(path, &typelib);
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
hr = RegisterTypeLib(*typelib, path, NULL); {
hr = RegisterTypeLib(typelib, path, NULL);
ITypeLib_Release(typelib);
}
return hr; return hr;
} }
@ -544,11 +548,6 @@ static IWidget *Widget_Create(void)
hr = LoadRegTypeLib(&LIBID_TestTypelib, 1, 0, LOCALE_NEUTRAL, &pTypeLib); hr = LoadRegTypeLib(&LIBID_TestTypelib, 1, 0, LOCALE_NEUTRAL, &pTypeLib);
ok_ole_success(hr, LoadRegTypeLib); 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)) if (SUCCEEDED(hr))
{ {
ITypeInfo *pTypeInfo; ITypeInfo *pTypeInfo;
@ -658,19 +657,6 @@ static const IKindaEnumWidgetVtbl KindaEnumWidget_VTable =
static IKindaEnumWidget *KindaEnumWidget_Create(void) static IKindaEnumWidget *KindaEnumWidget_Create(void)
{ {
KindaEnum *This; 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)); This = (KindaEnum *)HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This) return NULL; if (!This) return NULL;
@ -720,11 +706,7 @@ static ITypeInfo *NonOleAutomation_GetTypeInfo(void)
{ {
ITypeLib *pTypeLib; ITypeLib *pTypeLib;
HRESULT hr = LoadRegTypeLib(&LIBID_TestTypelib, 1, 0, LOCALE_NEUTRAL, &pTypeLib); HRESULT hr = LoadRegTypeLib(&LIBID_TestTypelib, 1, 0, LOCALE_NEUTRAL, &pTypeLib);
if (hr == TYPE_E_LIBNOTREGISTERED) ok_ole_success(hr, LoadRegTypeLib);
{
hr = register_current_module_typelib(&pTypeLib);
ok_ole_success(hr, register_current_module_typelib);
}
if (SUCCEEDED(hr)) if (SUCCEEDED(hr))
{ {
ITypeInfo *pTypeInfo; ITypeInfo *pTypeInfo;
@ -1106,8 +1088,13 @@ static void test_DispCallFunc(void)
START_TEST(tmarshal) START_TEST(tmarshal)
{ {
HRESULT hr;
CoInitializeEx(NULL, COINIT_APARTMENTTHREADED); CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
hr = register_current_module_typelib();
ok_ole_success(hr, register_current_module_typelib);
test_typelibmarshal(); test_typelibmarshal();
test_DispCallFunc(); test_DispCallFunc();