From 80380eaa32d4de494e1a3c623568a2c51e59c1f7 Mon Sep 17 00:00:00 2001 From: Mike Hearn Date: Mon, 21 Feb 2005 18:34:41 +0000 Subject: [PATCH] Allow loading of builtin typelibs. --- dlls/oleaut32/typelib.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/dlls/oleaut32/typelib.c b/dlls/oleaut32/typelib.c index b3cdf57b5fb..faa8e012a96 100644 --- a/dlls/oleaut32/typelib.c +++ b/dlls/oleaut32/typelib.c @@ -315,6 +315,9 @@ HRESULT WINAPI LoadTypeLibEx( TRACE("(%s,%d,%p)\n",debugstr_w(szFile), regkind, pptLib); + /* by default try and load using LoadLibrary (for builtin stdole32.tlb) */ + memcpy(szPath, szFile, (strlenW(szFile)+1)*sizeof(WCHAR)); + *pptLib = NULL; if(!SearchPathW(NULL,szFile,NULL,sizeof(szPath)/sizeof(WCHAR),szPath, NULL)) { @@ -331,9 +334,6 @@ HRESULT WINAPI LoadTypeLibEx( return TYPE_E_CANTLOADLIBRARY; if (GetFileAttributesW(szFileCopy) & FILE_ATTRIBUTE_DIRECTORY) return TYPE_E_CANTLOADLIBRARY; - } else { - TRACE("Wanted to load %s as typelib, but file was not found.\n",debugstr_w(szFile)); - return TYPE_E_CANTLOADLIBRARY; } } @@ -2209,8 +2209,13 @@ int TLB_ReadTypeLib(LPCWSTR pszFileName, INT index, ITypeLib2 **ppTypeLib) } CloseHandle(hFile); } + else + { + TRACE("not found, trying to load %s as library\n", debugstr_w(pszFileName)); + } - if( (WORD)dwSignature == IMAGE_DOS_SIGNATURE ) + /* if the file is a DLL or not found, try loading it with LoadLibrary */ + if (((WORD)dwSignature == IMAGE_DOS_SIGNATURE) || (dwSignature == 0)) { /* find the typelibrary resource*/ HINSTANCE hinstDLL = LoadLibraryExW(pszFileName, 0, DONT_RESOLVE_DLL_REFERENCES|