Commit 2cbda2ef authored by Huw D M Davies's avatar Huw D M Davies Committed by Alexandre Julliard

Stub implementation of LHashValOfNameSysA.

Don't crash if we encounter a BSTR with length <= 0. Fix typos in ITypeLib::GetDocumentation.
parent 4fb5ab47
...@@ -139,7 +139,7 @@ import ole32.dll ...@@ -139,7 +139,7 @@ import ole32.dll
163 stdcall RegisterTypeLib(ptr str str) RegisterTypeLib 163 stdcall RegisterTypeLib(ptr str str) RegisterTypeLib
164 stdcall QueryPathOfRegTypeLib(ptr long long long ptr) QueryPathOfRegTypeLib 164 stdcall QueryPathOfRegTypeLib(ptr long long long ptr) QueryPathOfRegTypeLib
165 stub LHashValOfNameSys 165 stub LHashValOfNameSys
166 stub LHashValOfNameSysA 166 stdcall LHashValOfNameSysA(long long str) LHashValOfNameSysA
170 stdcall OaBuildVersion() OaBuildVersion 170 stdcall OaBuildVersion() OaBuildVersion
171 stub ClearCustData 171 stub ClearCustData
180 stub CreateTypeLib2 180 stub CreateTypeLib2
...@@ -293,3 +293,4 @@ import ole32.dll ...@@ -293,3 +293,4 @@ import ole32.dll
422 stub OleLoadPictureFile 422 stub OleLoadPictureFile
423 stub OleSavePictureFile 423 stub OleSavePictureFile
424 stub OleLoadPicturePath 424 stub OleLoadPicturePath
425 stub OleLoadPictureEx
...@@ -184,7 +184,7 @@ HRESULT WINAPI LoadTypeLibEx( ...@@ -184,7 +184,7 @@ HRESULT WINAPI LoadTypeLibEx(
{ {
LPSTR p; LPSTR p;
HRESULT res; HRESULT res;
TRACE("('%s',%d,%p)\n",debugstr_w(szFile), regkind, pptLib); TRACE("(%s,%d,%p)\n",debugstr_w(szFile), regkind, pptLib);
p=HEAP_strdupWtoA(GetProcessHeap(),0,szFile); p=HEAP_strdupWtoA(GetProcessHeap(),0,szFile);
...@@ -192,9 +192,8 @@ HRESULT WINAPI LoadTypeLibEx( ...@@ -192,9 +192,8 @@ HRESULT WINAPI LoadTypeLibEx(
FIXME ("registration of typelibs not supported yet!\n"); FIXME ("registration of typelibs not supported yet!\n");
res= TLB_ReadTypeLib(p, pptLib); res= TLB_ReadTypeLib(p, pptLib);
/* XXX need to free p ?? */ HeapFree(GetProcessHeap(),0,p);
TRACE(" returns %08lx\n",res);
TRACE(" returns %ld\n",res);
return res; return res;
} }
...@@ -296,6 +295,15 @@ DWORD WINAPI OaBuildVersion16(void) ...@@ -296,6 +295,15 @@ 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 */ /* for better debugging info leave the static out for the time being */
#define static #define static
...@@ -636,6 +644,7 @@ static void TLB_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx ) ...@@ -636,6 +644,7 @@ static void TLB_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx )
} }
TLB_Read(&(pVar->vt), sizeof(VARTYPE), pcx, TLB_Read(&(pVar->vt), sizeof(VARTYPE), pcx,
pcx->pTblDir->pCustData.offset + offset ); pcx->pTblDir->pCustData.offset + offset );
TRACE("Vartype = %x\n", pVar->vt);
switch(pVar->vt){ switch(pVar->vt){
case VT_EMPTY: /* FIXME: is this right? */ case VT_EMPTY: /* FIXME: is this right? */
case VT_NULL: /* FIXME: is this right? */ case VT_NULL: /* FIXME: is this right? */
...@@ -665,15 +674,19 @@ static void TLB_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx ) ...@@ -665,15 +674,19 @@ static void TLB_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx )
case VT_BSTR :{ case VT_BSTR :{
char * ptr; char * ptr;
TLB_Read(&size, sizeof(INT), pcx, DO_NOT_SEEK ); TLB_Read(&size, sizeof(INT), pcx, DO_NOT_SEEK );
ptr=TLB_Alloc(size);/* allocate temp buffer */ if(size <= 0) {
TLB_Read(ptr, size, pcx, DO_NOT_SEEK ); /* read string (ANSI) */ FIXME("BSTR length = %d?\n", size);
V_UNION(pVar, bstrVal)=SysAllocStringLen(NULL,size); } else {
/* FIXME: do we need a AtoW conversion here? */ ptr=TLB_Alloc(size);/* allocate temp buffer */
V_UNION(pVar, bstrVal[size])=L'\0'; TLB_Read(ptr, size, pcx, DO_NOT_SEEK); /* read string (ANSI) */
while(size--) V_UNION(pVar, bstrVal[size])=ptr[size]; V_UNION(pVar, bstrVal)=SysAllocStringLen(NULL,size);
TLB_Free(ptr); /* FIXME: do we need a AtoW conversion here? */
} V_UNION(pVar, bstrVal[size])=L'\0';
size=-4; break; while(size--) V_UNION(pVar, bstrVal[size])=ptr[size];
TLB_Free(ptr);
}
}
size=-4; break;
/* FIXME: this will not work AT ALL when the variant contains a pointer */ /* FIXME: this will not work AT ALL when the variant contains a pointer */
case VT_DISPATCH : case VT_DISPATCH :
case VT_VARIANT : case VT_VARIANT :
...@@ -700,7 +713,7 @@ static void TLB_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx ) ...@@ -700,7 +713,7 @@ static void TLB_ReadValue( VARIANT * pVar, int offset, TLBContext *pcx )
if(size>0) /* (big|small) endian correct? */ if(size>0) /* (big|small) endian correct? */
TLB_Read(&(V_UNION(pVar, iVal)), size, pcx, DO_NOT_SEEK ); TLB_Read(&(V_UNION(pVar, iVal)), size, pcx, DO_NOT_SEEK );
return ; return;
} }
/* /*
* create a linked list with custom data * create a linked list with custom data
...@@ -1078,7 +1091,7 @@ int TLB_ReadTypeLib(LPSTR pszFileName, ITypeLib **ppTypeLib) ...@@ -1078,7 +1091,7 @@ int TLB_ReadTypeLib(LPSTR pszFileName, ITypeLib **ppTypeLib)
hinstDLL = LoadLibraryExA(pszFileName, 0, DONT_RESOLVE_DLL_REFERENCES|LOAD_LIBRARY_AS_DATAFILE|LOAD_WITH_ALTERED_SEARCH_PATH); hinstDLL = LoadLibraryExA(pszFileName, 0, DONT_RESOLVE_DLL_REFERENCES|LOAD_LIBRARY_AS_DATAFILE|LOAD_WITH_ALTERED_SEARCH_PATH);
if (!hinstDLL) if (!hinstDLL)
{ {
ERR("error: couldn't load the DLL"); ERR("error: couldn't load the DLL %s\n", pszFileName);
goto err1; goto err1;
} }
...@@ -1469,7 +1482,7 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr( ...@@ -1469,7 +1482,7 @@ static HRESULT WINAPI ITypeLib2_fnGetLibAttr(
ITypeLib2 *iface, ITypeLib2 *iface,
LPTLIBATTR *ppTLibAttr) LPTLIBATTR *ppTLibAttr)
{ {
ICOM_THIS( ITypeLibImpl, iface); ICOM_THIS( ITypeLibImpl, iface);
TRACE("(%p)\n",This); TRACE("(%p)\n",This);
/* FIXME: must do a copy here */ /* FIXME: must do a copy here */
*ppTLibAttr=&This->LibAttr; *ppTLibAttr=&This->LibAttr;
...@@ -1516,11 +1529,11 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation( ...@@ -1516,11 +1529,11 @@ static HRESULT WINAPI ITypeLib2_fnGetDocumentation(
if(pBstrName) if(pBstrName)
*pBstrName=TLB_DupAtoBstr(This->Name); *pBstrName=TLB_DupAtoBstr(This->Name);
if(pBstrDocString) if(pBstrDocString)
*pBstrName=TLB_DupAtoBstr(This->DocString); *pBstrDocString=TLB_DupAtoBstr(This->DocString);
if(pdwHelpContext) if(pdwHelpContext)
*pdwHelpContext=This->dwHelpContext; *pdwHelpContext=This->dwHelpContext;
if(pBstrHelpFile) if(pBstrHelpFile)
*pBstrName=TLB_DupAtoBstr(This->HelpFile); *pBstrHelpFile=TLB_DupAtoBstr(This->HelpFile);
}else {/* for a typeinfo */ }else {/* for a typeinfo */
result=ITypeLib2_fnGetTypeInfo(iface, index, &pTInfo); result=ITypeLib2_fnGetTypeInfo(iface, index, &pTInfo);
if(SUCCEEDED(result)){ if(SUCCEEDED(result)){
...@@ -1553,7 +1566,8 @@ static HRESULT WINAPI ITypeLib2_fnIsName( ...@@ -1553,7 +1566,8 @@ static HRESULT WINAPI ITypeLib2_fnIsName(
int i; int i;
PCHAR astr= HEAP_strdupWtoA( GetProcessHeap(), 0, szNameBuf ); PCHAR astr= HEAP_strdupWtoA( GetProcessHeap(), 0, szNameBuf );
TRACE("\n"); TRACE("(%p)->(%s,%08lx,%p)\n", This, debugstr_w(szNameBuf), lHashVal,
pfName);
*pfName=TRUE; *pfName=TRUE;
if(!strcmp(astr,This->Name)) goto ITypeLib2_fnIsName_exit; if(!strcmp(astr,This->Name)) goto ITypeLib2_fnIsName_exit;
...@@ -1633,7 +1647,7 @@ static VOID WINAPI ITypeLib2_fnReleaseTLibAttr( ...@@ -1633,7 +1647,7 @@ static VOID WINAPI ITypeLib2_fnReleaseTLibAttr(
ITypeLib2 *iface, ITypeLib2 *iface,
TLIBATTR *pTLibAttr) TLIBATTR *pTLibAttr)
{ {
ICOM_THIS( ITypeLibImpl, iface); ICOM_THIS( ITypeLibImpl, iface);
TRACE("freeing (%p)\n",This); TRACE("freeing (%p)\n",This);
/* nothing to do */ /* nothing to do */
} }
...@@ -1752,7 +1766,7 @@ static HRESULT WINAPI ITypeLib2_fnGetAllCustData( ...@@ -1752,7 +1766,7 @@ static HRESULT WINAPI ITypeLib2_fnGetAllCustData(
ITypeLib2 * iface, ITypeLib2 * iface,
CUSTDATA *pCustData) CUSTDATA *pCustData)
{ {
ICOM_THIS( ITypeLibImpl, iface); ICOM_THIS( ITypeLibImpl, iface);
TLBCustData *pCData; TLBCustData *pCData;
int i; int i;
TRACE("(%p) returning %d items\n", This, This->ctCustData); TRACE("(%p) returning %d items\n", This, This->ctCustData);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment