Added CreateTypeLib,LHashValOfNameSys stubs.

Check for correct struct magic before reading out of it.
This commit is contained in:
Marcus Meissner 2000-07-29 21:54:58 +00:00 committed by Alexandre Julliard
parent f06555a34e
commit e5c1b9dded
3 changed files with 62 additions and 24 deletions

View File

@ -133,12 +133,12 @@ import ole32.dll
148 stdcall SafeArrayPtrOfIndex(ptr ptr ptr) SafeArrayPtrOfIndex
149 stdcall SysStringByteLen(ptr) SysStringByteLen
150 stdcall SysAllocStringByteLen(ptr long) SysAllocStringByteLen
160 stub CreateTypeLib
160 stdcall CreateTypeLib(long wstr ptr) CreateTypeLib
161 stdcall LoadTypeLib (wstr ptr) LoadTypeLib
162 stdcall LoadRegTypeLib (ptr long long long ptr) LoadRegTypeLib
163 stdcall RegisterTypeLib(ptr str str) RegisterTypeLib
164 stdcall QueryPathOfRegTypeLib(ptr long long long ptr) QueryPathOfRegTypeLib
165 stub LHashValOfNameSys
165 stdcall LHashValOfNameSys(long long wstr) LHashValOfNameSys
166 stdcall LHashValOfNameSysA(long long str) LHashValOfNameSysA
170 stdcall OaBuildVersion() OaBuildVersion
171 stub ClearCustData

View File

@ -9,6 +9,7 @@
#include "windef.h"
#include "debugtools.h"
#include "olectl.h"
#include "heap.h"
DEFAULT_DEBUG_CHANNEL(ole);
@ -33,14 +34,39 @@ HRESULT WINAPI OleCreatePropertyFrameIndirect( LPOCPFIPARAMS lpParams)
/***********************************************************************
* OleCreatePropertyFrame
*/
HRESULT WINAPI OleCreatePropertyFrame( HWND hwndOwner, UINT x, UINT y,
LPCOLESTR lpszCaption,ULONG cObjects, LPUNKNOWN* ppUnk,
ULONG cPages, LPCLSID pPageClsID, LCID lcid,
DWORD dwReserved, LPVOID pvReserved )
HRESULT WINAPI OleCreatePropertyFrame(
HWND hwndOwner, UINT x, UINT y, LPCOLESTR lpszCaption,ULONG cObjects,
LPUNKNOWN* ppUnk, ULONG cPages, LPCLSID pPageClsID, LCID lcid,
DWORD dwReserved, LPVOID pvReserved )
{
FIXME("(%x,%d,%d,%p,%ld,%p,%ld,%p,%x,%ld,%p), not implemented (olepro32.dll)\n",
hwndOwner,x,y,lpszCaption,cObjects,ppUnk,cPages,pPageClsID,
(int)lcid,dwReserved,pvReserved);
FIXME("(%x,%d,%d,%s,%ld,%p,%ld,%p,%x,%ld,%p), not implemented (olepro32.dll)\n",
hwndOwner,x,y,debugstr_w(lpszCaption),cObjects,ppUnk,cPages,
pPageClsID, (int)lcid,dwReserved,pvReserved);
return S_OK;
}
/***********************************************************************
* LHashValOfNameSysA
*/
ULONG WINAPI LHashValOfNameSysA( SYSKIND skind, LCID lcid, LPCSTR str)
{
/* returns a 16 bit hashvalue (depending on skind and lcid) in the
* lowword and a unique id made from skind and lcid in bits 23-16
*/
FIXME("(%d,%x,%s), stub, returning 0x424242!\n",skind,(int)lcid,debugstr_a(str));
return 0x00424242;
}
/***********************************************************************
* LHashValOfNameSys
*/
ULONG WINAPI LHashValOfNameSys( SYSKIND skind, LCID lcid, LPCOLESTR str)
{
LPSTR strA;
ULONG res;
if (!str) return 0;
strA = HEAP_strdupWtoA(GetProcessHeap(),0,str);
res = LHashValOfNameSysA(skind,lcid,strA);
HeapFree(GetProcessHeap(),0,strA);
return res;
}

View File

@ -127,6 +127,19 @@ QueryPathOfRegTypeLib(
return S_OK;
}
/******************************************************************************
* CreateTypeLib [OLEAUT32] creates a typelib
*
* RETURNS
* Success: S_OK
* Failure: Status
*/
HRESULT WINAPI CreateTypeLib(
SYSKIND syskind, LPCOLESTR szFile, /*ICreateTypeLib*/IUnknown ** ppctlib
) {
FIXME("(%d,%s,%p), stub!\n",syskind,debugstr_w(szFile),ppctlib);
return E_FAIL;
}
/******************************************************************************
* LoadTypeLib [TYPELIB.3] Loads and registers a type library
* NOTES
@ -296,15 +309,6 @@ DWORD WINAPI OaBuildVersion16(void)
}
}
/********************************************************************
* LHashValOfNameSysA [OLEAUT32]
*/
HRESULT WINAPI LHashValOfNameSysA(SYSKIND sys, LCID lcid, LPSTR name)
{
FIXME("%s\n", name);
return 0;
}
/* for better debugging info leave the static out for the time being */
#define static
@ -1129,7 +1133,12 @@ int TLB_ReadTypeLib(LPSTR pszFileName, ITypeLib2 **ppTypeLib)
LPVOID pBase = LockResource(hGlobal);
if (pBase)
{
*ppTypeLib = ITypeLib2_Constructor(pBase);
/* try to load as incore resource */
dwSignature = *((DWORD*) pBase);
if ( dwSignature == MSFT_SIGNATURE)
*ppTypeLib = ITypeLib2_Constructor(pBase);
else
FIXME("Header type magic 0x%08lx not supported.\n",dwSignature);
}
FreeResource( hGlobal );
}
@ -1177,15 +1186,19 @@ static ITypeLib2* ITypeLib2_Constructor(LPVOID pLib)
/* read header */
TLB_Read((void*)&tlbHeader, sizeof(tlbHeader), &cx, 0);
TRACE("read header (0x%08x 0x%08x)\n",tlbHeader.magic1,tlbHeader.magic2 );
TRACE("header:\n");
TRACE("\tmagic1=0x%08x ,magic2=0x%08x\n",tlbHeader.magic1,tlbHeader.magic2 );
if (memcmp(&tlbHeader.magic1,TLBMAGIC2,4)) {
FIXME("Header type magic 0x%08x not supported.\n",tlbHeader.magic1);
return NULL;
}
/* there is a small number of information here until the next important
* part:
* the segment directory . Try to calculate the amount of data */
lPSegDir = sizeof(tlbHeader) + (tlbHeader.nrtypeinfos)*4 + (tlbHeader.varflags & HELPDLLFLAG? 4 :0);
lPSegDir = sizeof(tlbHeader) + (tlbHeader.nrtypeinfos)*4 + ((tlbHeader.varflags & HELPDLLFLAG)? 4 :0);
/* now read the segment directory */
TRACE("read segment directory\n");
TRACE("read segment directory (at %ld)\n",lPSegDir);
TLB_Read((void*)&tlbSegDir, sizeof(tlbSegDir), &cx, lPSegDir);
cx.pTblDir = &tlbSegDir;
@ -2932,4 +2945,3 @@ static ICOM_VTABLE(ITypeInfo2) tinfvt =
ITypeInfo2_fnGetAllVarCustData,
ITypeInfo2_fnGetAllImplTypeCustData,
};