Module: wine Branch: master Commit: f42d61df0d6432eb83d602b139e61d934b75fa6f URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=f42d61df0d6432eb83d602b1...
Author: Robert Shearman rob@codeweavers.com Date: Wed Aug 16 13:00:02 2006 +0100
ole32: Move some functions out of compobj.c that don't belong there and update the copyright statement.
---
dlls/ole32/compobj.c | 87 +----------------------------------------------- dlls/ole32/ole2.c | 27 +++++++++++++++ dlls/ole32/storage32.c | 57 +++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 86 deletions(-)
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c index 314411d..e049563 100644 --- a/dlls/ole32/compobj.c +++ b/dlls/ole32/compobj.c @@ -7,6 +7,7 @@ * Copyright 1999 Sylvain St-Germain * Copyright 2002 Marcus Meissner * Copyright 2004 Mike Hearn + * Copyright 2005-2006 Robert Shearman (for CodeWeavers) * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -1321,65 +1322,6 @@ HRESULT WINAPI CoRegisterPSClsid(REFIID }
- -/*********************************************************************** - * WriteClassStm (OLE32.@) - * - * Writes a CLSID to a stream. - * - * PARAMS - * pStm [I] Stream to write to. - * rclsid [I] CLSID to write. - * - * RETURNS - * Success: S_OK. - * Failure: HRESULT code. - */ -HRESULT WINAPI WriteClassStm(IStream *pStm,REFCLSID rclsid) -{ - TRACE("(%p,%p)\n",pStm,rclsid); - - if (rclsid==NULL) - return E_INVALIDARG; - - return IStream_Write(pStm,rclsid,sizeof(CLSID),NULL); -} - -/*********************************************************************** - * ReadClassStm (OLE32.@) - * - * Reads a CLSID from a stream. - * - * PARAMS - * pStm [I] Stream to read from. - * rclsid [O] CLSID to read. - * - * RETURNS - * Success: S_OK. - * Failure: HRESULT code. - */ -HRESULT WINAPI ReadClassStm(IStream *pStm,CLSID *pclsid) -{ - ULONG nbByte; - HRESULT res; - - TRACE("(%p,%p)\n",pStm,pclsid); - - if (pclsid==NULL) - return E_INVALIDARG; - - res = IStream_Read(pStm,(void*)pclsid,sizeof(CLSID),&nbByte); - - if (FAILED(res)) - return res; - - if (nbByte != sizeof(CLSID)) - return S_FALSE; - else - return S_OK; -} - - /*** * COM_GetRegisteredClassObject * @@ -2377,33 +2319,6 @@ HRESULT WINAPI CoSetState(IUnknown * pv)
/****************************************************************************** - * OleGetAutoConvert [OLE32.@] - */ -HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew) -{ - static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0}; - HKEY hkey = NULL; - WCHAR buf[CHARS_IN_GUID]; - LONG len; - HRESULT res = S_OK; - - res = COM_OpenKeyForCLSID(clsidOld, wszAutoConvertTo, KEY_READ, &hkey); - if (FAILED(res)) - goto done; - - len = sizeof(buf); - if (RegQueryValueW(hkey, NULL, buf, &len)) - { - res = REGDB_E_KEYMISSING; - goto done; - } - res = CLSIDFromString(buf, pClsidNew); -done: - if (hkey) RegCloseKey(hkey); - return res; -} - -/****************************************************************************** * CoTreatAsClass [OLE32.@] * * Sets the TreatAs value of a class. diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c index e04095a..bf6847c 100644 --- a/dlls/ole32/ole2.c +++ b/dlls/ole32/ole2.c @@ -2334,6 +2334,33 @@ HRESULT WINAPI OleCreate( }
/****************************************************************************** + * OleGetAutoConvert [OLE32.@] + */ +HRESULT WINAPI OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew) +{ + static const WCHAR wszAutoConvertTo[] = {'A','u','t','o','C','o','n','v','e','r','t','T','o',0}; + HKEY hkey = NULL; + WCHAR buf[CHARS_IN_GUID]; + LONG len; + HRESULT res = S_OK; + + res = COM_OpenKeyForCLSID(clsidOld, wszAutoConvertTo, KEY_READ, &hkey); + if (FAILED(res)) + goto done; + + len = sizeof(buf); + if (RegQueryValueW(hkey, NULL, buf, &len)) + { + res = REGDB_E_KEYMISSING; + goto done; + } + res = CLSIDFromString(buf, pClsidNew); +done: + if (hkey) RegCloseKey(hkey); + return res; +} + +/****************************************************************************** * OleSetAutoConvert [OLE32.@] */ HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index d44d381..cae44c4 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -7871,3 +7871,60 @@ StgIsStorageFile(LPCOLESTR fn) WARN(" -> Invalid header.\n"); return S_FALSE; } + +/*********************************************************************** + * WriteClassStm (OLE32.@) + * + * Writes a CLSID to a stream. + * + * PARAMS + * pStm [I] Stream to write to. + * rclsid [I] CLSID to write. + * + * RETURNS + * Success: S_OK. + * Failure: HRESULT code. + */ +HRESULT WINAPI WriteClassStm(IStream *pStm,REFCLSID rclsid) +{ + TRACE("(%p,%p)\n",pStm,rclsid); + + if (rclsid==NULL) + return E_INVALIDARG; + + return IStream_Write(pStm,rclsid,sizeof(CLSID),NULL); +} + +/*********************************************************************** + * ReadClassStm (OLE32.@) + * + * Reads a CLSID from a stream. + * + * PARAMS + * pStm [I] Stream to read from. + * rclsid [O] CLSID to read. + * + * RETURNS + * Success: S_OK. + * Failure: HRESULT code. + */ +HRESULT WINAPI ReadClassStm(IStream *pStm,CLSID *pclsid) +{ + ULONG nbByte; + HRESULT res; + + TRACE("(%p,%p)\n",pStm,pclsid); + + if (pclsid==NULL) + return E_INVALIDARG; + + res = IStream_Read(pStm,(void*)pclsid,sizeof(CLSID),&nbByte); + + if (FAILED(res)) + return res; + + if (nbByte != sizeof(CLSID)) + return S_FALSE; + else + return S_OK; +}