Commit 0e189144 authored by Robert Shearman's avatar Robert Shearman Committed by Alexandre Julliard

- Add documentation for most Co* functions.

- Move several functions into different files to group them with similar functions.
parent 2d58a624
......@@ -527,8 +527,15 @@ static IMallocSpyVtbl VT_IMallocSpy =
/******************************************************************************
* CoGetMalloc [OLE32.@]
*
* Retrieves the current IMalloc interface for the process.
*
* PARAMS
* dwMemContext [I]
* lpMalloc [O] Address where memory allocator object will be stored.
*
* RETURNS
* The win32 IMalloc
* Success: S_OK.
* Failure: HRESULT code.
*/
HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC *lpMalloc)
{
......@@ -538,15 +545,31 @@ HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC *lpMalloc)
/***********************************************************************
* CoTaskMemAlloc [OLE32.@]
*
* Allocates memory using the current process memory allocator.
*
* PARAMS
* size [I] Size of the memory block to allocate.
*
* RETURNS
* pointer to newly allocated block
* Success: Pointer to newly allocated memory block.
* Failure: NULL.
*/
LPVOID WINAPI CoTaskMemAlloc(ULONG size)
{
return IMalloc_Alloc((LPMALLOC)&Malloc32,size);
}
/***********************************************************************
* CoTaskMemFree [OLE32.@]
*
* Frees memory allocated from the current process memory allocator.
*
* PARAMS
* ptr [I] Memory block to free.
*
* RETURNS
* Nothing.
*/
VOID WINAPI CoTaskMemFree(LPVOID ptr)
{
......@@ -555,8 +578,16 @@ VOID WINAPI CoTaskMemFree(LPVOID ptr)
/***********************************************************************
* CoTaskMemRealloc [OLE32.@]
*
* Allocates memory using the current process memory allocator.
*
* PARAMS
* pvOld [I] Pointer to old memory block.
* size [I] Size of the new memory block.
*
* RETURNS
* pointer to newly allocated block
* Success: Pointer to newly allocated memory block.
* Failure: NULL.
*/
LPVOID WINAPI CoTaskMemRealloc(LPVOID pvOld, ULONG size)
{
......@@ -566,6 +597,16 @@ LPVOID WINAPI CoTaskMemRealloc(LPVOID pvOld, ULONG size)
/***********************************************************************
* CoRegisterMallocSpy [OLE32.@]
*
* Registers an object that receives notifications on memory allocations and
* frees.
*
* PARAMS
* pMallocSpy [I] New spy object.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*
* NOTES
* if a mallocspy is already registered, we can't do it again since
* only the spy knows, how to free a memory block
......@@ -597,6 +638,16 @@ HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
/***********************************************************************
* CoRevokeMallocSpy [OLE32.@]
*
* Revokes a previousl registered object that receives notifications on memory
* allocations and frees.
*
* PARAMS
* pMallocSpy [I] New spy object.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*
* NOTES
* we can't revoke a malloc spy as long as memory blocks allocated with
* the spy are active since only the spy knows how to free them
......@@ -629,12 +680,16 @@ HRESULT WINAPI CoRevokeMallocSpy(void)
/******************************************************************************
* IsValidInterface [OLE32.@]
*
* Determines whether a pointer is a valid interface.
*
* PARAMS
* punk [I] Interface to be tested.
*
* RETURNS
* True, if the passed pointer is a valid interface
* TRUE, if the passed pointer is a valid interface, or FALSE otherwise.
*/
BOOL WINAPI IsValidInterface(
LPUNKNOWN punk /* [in] interface to be tested */
) {
BOOL WINAPI IsValidInterface(LPUNKNOWN punk)
{
return !(
IsBadReadPtr(punk,4) ||
IsBadReadPtr(punk->lpVtbl,4) ||
......
......@@ -48,6 +48,7 @@
#include "wine/wingdi16.h"
#include "wine/winuser16.h"
#include "ole32_main.h"
#include "compobj_private.h"
#include "wine/debug.h"
......@@ -244,18 +245,6 @@ HRESULT WINAPI OleInitialize(LPVOID reserved)
}
/******************************************************************************
* CoGetCurrentProcess [COMPOBJ.34]
* CoGetCurrentProcess [OLE32.@]
*
* NOTES
* Is DWORD really the correct return type for this function?
*/
DWORD WINAPI CoGetCurrentProcess(void)
{
return GetCurrentProcessId();
}
/******************************************************************************
* OleUninitialize [OLE2.3]
* OleUninitialize [OLE32.@]
*/
......@@ -301,20 +290,6 @@ void WINAPI OleUninitialize(void)
}
/******************************************************************************
* CoRegisterMessageFilter [OLE32.@]
*/
HRESULT WINAPI CoRegisterMessageFilter(
LPMESSAGEFILTER lpMessageFilter, /* [in] Pointer to interface */
LPMESSAGEFILTER *lplpMessageFilter /* [out] Indirect pointer to prior instance if non-NULL */
) {
FIXME("stub\n");
if (lplpMessageFilter) {
*lplpMessageFilter = NULL;
}
return S_OK;
}
/******************************************************************************
* OleInitializeWOW [OLE32.@]
*/
HRESULT WINAPI OleInitializeWOW(DWORD x) {
......@@ -2313,6 +2288,44 @@ HRESULT WINAPI OleCreate(
return hres;
}
/******************************************************************************
* OleSetAutoConvert [OLE32.@]
*/
/* FIXME: convert to Unicode */
HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew)
{
HKEY hkey = 0;
char buf[200], szClsidNew[200];
HRESULT res = S_OK;
TRACE("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew));
sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]);
WINE_StringFromCLSID(clsidNew, szClsidNew);
if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey))
{
res = REGDB_E_CLASSNOTREG;
goto done;
}
if (RegSetValueA(hkey, "AutoConvertTo", REG_SZ, szClsidNew, strlen(szClsidNew)+1))
{
res = REGDB_E_WRITEREGDB;
goto done;
}
done:
if (hkey) RegCloseKey(hkey);
return res;
}
/******************************************************************************
* OleDoAutoConvert [OLE32.@]
*/
HRESULT WINAPI OleDoAutoConvert(IStorage *pStg, LPCLSID pClsidNew)
{
FIXME("(%p,%p) : stub\n",pStg,pClsidNew);
return E_NOTIMPL;
}
/***********************************************************************
* OLE_FreeClipDataArray [internal]
*
......
......@@ -139,15 +139,6 @@ HRESULT WINAPI OleRegEnumFormatEtc (
}
/***********************************************************************
* CoIsOle1Class [OLE32.@]
*/
BOOL WINAPI CoIsOle1Class(REFCLSID clsid)
{
FIXME("%s\n", debugstr_guid(clsid));
return FALSE;
}
/***********************************************************************
* DllGetClassObject [OLE2.4]
*/
HRESULT WINAPI DllGetClassObject16(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
......
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