Module: wine Branch: master Commit: 1053b4d4faed52756429c9813c9f3d4e087ed632 URL: http://source.winehq.org/git/wine.git/?a=commit;h=1053b4d4faed52756429c9813c...
Author: Nikolay Sivov nsivov@codeweavers.com Date: Sun Jan 10 21:45:49 2016 +0300
ole2: Implement ReadClassStm().
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/ole2.dll16/ole2.c | 63 +++++++++++++++++++++++++++++++++++++---- dlls/ole2.dll16/ole2.dll16.spec | 2 +- 2 files changed, 59 insertions(+), 6 deletions(-)
diff --git a/dlls/ole2.dll16/ole2.c b/dlls/ole2.dll16/ole2.c index 422469d..bd9cf45 100644 --- a/dlls/ole2.dll16/ole2.c +++ b/dlls/ole2.dll16/ole2.c @@ -274,6 +274,9 @@ HRESULT WINAPI OleFlushClipboard16(void) return OleFlushClipboard(); }
+#define GET_SEGPTR_METHOD_ADDR(ifacename,segptr,methodname) \ + ((SEGPTR)((const ifacename##Vtbl*)MapSL((SEGPTR)((ifacename*)MapSL(segptr))->lpVtbl))->methodname) + /*********************************************************************** * ReadClassStg (OLE2.18) * @@ -308,17 +311,15 @@ HRESULT WINAPI ReadClassStg16(SEGPTR pstg, CLSID *pclsid) /* * read a STATSTG structure (contains the clsid) from the storage */ - args[0] = (DWORD)pstg; /* iface */ + args[0] = pstg; /* iface */ args[1] = WOWGlobalAllocLock16( 0, sizeof(STATSTG16), &hstatstg ); args[2] = STATFLAG_DEFAULT;
if (!WOWCallback16Ex( - (DWORD)((const IStorage16Vtbl*)MapSL( - (SEGPTR)((LPSTORAGE16)MapSL(pstg))->lpVtbl) - )->Stat, + GET_SEGPTR_METHOD_ADDR(IStorage16, pstg, Stat), WCB16_PASCAL, 3*sizeof(DWORD), - (LPVOID)args, + args, (LPDWORD)&hres )) { WOWGlobalUnlockFree16(args[1]); @@ -336,6 +337,58 @@ HRESULT WINAPI ReadClassStg16(SEGPTR pstg, CLSID *pclsid) }
/*********************************************************************** + * ReadClassStm (OLE2.20) + */ +HRESULT WINAPI ReadClassStm16(SEGPTR stream, CLSID *clsid) +{ + HANDLE16 hclsid, hread; + HRESULT hres; + DWORD args[4]; + + TRACE("(0x%x, %p)\n", stream, clsid); + + if (!clsid) + return E_INVALIDARG16; + + memset(clsid, 0, sizeof(*clsid)); + + if (!stream) + return E_INVALIDARG16; + + args[0] = stream; /* iface */ + args[1] = WOWGlobalAllocLock16( 0, sizeof(CLSID), &hclsid ); + args[2] = sizeof(CLSID); + args[3] = WOWGlobalAllocLock16( 0, sizeof(ULONG), &hread ); + + if (WOWCallback16Ex( + GET_SEGPTR_METHOD_ADDR(IStream16, stream, Read), + WCB16_PASCAL, + 4*sizeof(DWORD), + args, + (DWORD*)&hres)) + { + ULONG readlen; + + memcpy(&readlen, MapSL(args[3]), sizeof(readlen)); + if (readlen == sizeof(CLSID)) + memcpy(clsid, MapSL(args[1]), sizeof(CLSID)); + else + hres = STG_E_READFAULT; + + TRACE("clsid is %s\n", debugstr_guid(clsid)); + } + else + { + ERR("CallTo16 IStream16::Read() failed, hres %x\n", hres); + hres = E_FAIL; + } + WOWGlobalUnlockFree16(args[1]); + WOWGlobalUnlockFree16(args[3]); + + return hres; +} + +/*********************************************************************** * GetConvertStg (OLE2.82) */ HRESULT WINAPI GetConvertStg16(LPSTORAGE stg) diff --git a/dlls/ole2.dll16/ole2.dll16.spec b/dlls/ole2.dll16/ole2.dll16.spec index cb6b1ec..ed5e917 100644 --- a/dlls/ole2.dll16/ole2.dll16.spec +++ b/dlls/ole2.dll16/ole2.dll16.spec @@ -17,7 +17,7 @@ 17 stub OLELOCKRUNNING 18 pascal ReadClassStg(segptr ptr) ReadClassStg16 19 pascal WriteClassStg(segptr ptr) WriteClassStg16 -20 stub READCLASSSTM +20 pascal ReadClassStm(segptr ptr) ReadClassStm16 21 stub WRITECLASSSTM 22 stub BINDMONIKER 23 stub MKPARSEDISPLAYNAME