Index: trunk/src/ole32/clsid.cpp
===================================================================
--- trunk/src/ole32/clsid.cpp	(revision 290)
+++ trunk/src/ole32/clsid.cpp	(revision 291)
@@ -1,13 +1,19 @@
-/*
- *
+/* 
+ * 
  * Project Odin Software License can be found in LICENSE.TXT
- *
+ * 
  */
-/*
- * Win32 OLE stubs for OS/2
- *
- * 1998/06/12
- *
- * Copyright 1998 Sander van Leeuwen
+/* 
+ * ClassID Manipulation.
+ * 
+ * 1/7/99
+ * 
+ * Copyright 1999 David J. Raison
+ * 
+ * Some portions from Wine Implementation
+ *   Copyright 1995  Martin von Loewis
+ *   Copyright 1998  Justin Bradford
+ *   Copyright 1999  Francis Beaudet
+ *   Copyright 1999  Sylvain St-Germain
  */
 
@@ -15,80 +21,4 @@
 
 #include "oString.h"
-
-// ----------------------------------------------------------------------
-// CLSIDFromStringA() [Internal]
-// ----------------------------------------------------------------------
-static HRESULT CLSIDFromStringA(
-    const char *	lpsz,		// [in] - ASCII string to convert
-    LPCLSID		pclisid)	// [out] - CLSID
-{
-    dprintf(("OLE32.CLSIDFromStringA [Internal]\n"));
-
-    BYTE *s = (BYTE *) lpsz;
-    BYTE *p;
-    int   i;
-    BYTE table[256];
-
-    /* quick lookup table */
-    memset(table, 0, 256);
-
-    for (i = 0; i < 10; i++) 
-    {
-	table['0' + i] = i;
-    }
-    for (i = 0; i < 6; i++) 
-    {
-	table['A' + i] = i+10;
-	table['a' + i] = i+10;
-    }
-
-    /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
-
-    if (strlen(lpsz) != 38)
-	return OLE_ERROR_OBJECT;
-
-    p = (BYTE *) pclisid;
-
-    s++;  /* skip leading brace  */
-    for (i = 0; i < 4; i++)
-    {
-	p[3 - i] = table[*s]<<4 | table[*(s+1)];
-	s += 2;
-    }
-    p += 4;
-    s++;  /* skip - */
-
-    for (i = 0; i < 2; i++)
-    {
-	p[1-i] = table[*s]<<4 | table[*(s+1)];
-	s += 2;
-    }
-    p += 2;
-    s++;  /* skip - */
-
-    for (i = 0; i < 2; i++) 
-    {
-	p[1-i] = table[*s]<<4 | table[*(s+1)];
-	s += 2;
-    }
-    p += 2;
-    s++;  /* skip - */
-
-    /* these are just sequential bytes */
-    for (i = 0; i < 2; i++) 
-    {
-	*p++ = table[*s]<<4 | table[*(s+1)];
-	s += 2;
-    }
-    s++;  /* skip - */
-
-    for (i = 0; i < 6; i++) 
-    {
-	*p++ = table[*s]<<4 | table[*(s+1)];
-	s += 2;
-    }
-
-    return S_OK;
-}
 
 // ----------------------------------------------------------------------
@@ -99,22 +29,22 @@
     LPCLSID		pclsid)		// [out] - CLSID
 {
-    dprintf(("OLE32.CLSIDFromProgID\n"));
+    dprintf(("OLE32: CLSIDFromProgID"));
 
     LONG		lDataLen = 80;
-    oStringA		szKey(lpszProgID);
-    oStringA		szCLSID(lDataLen);
+    oStringW		szKey(lpszProgID);
+    oStringW		szCLSID(lDataLen);
     HKEY		hKey;
     HRESULT		rc;
 
     // Create the registry lookup string...
-    szKey += "\\CLSID";
+    szKey += L"\\CLSID";
 
     // Try to open the key in the registry...
-    rc = RegOpenKeyA(HKEY_CLASSES_ROOT, szKey, &hKey);
+    rc = RegOpenKeyW(HKEY_CLASSES_ROOT, szKey, &hKey);
     if (rc != 0)
     	return OLE_ERROR_GENERIC;
 
     // Now get the data from the _default_ entry on this key...
-    rc = RegQueryValueA(hKey, NULL, szCLSID, &lDataLen);
+    rc = RegQueryValueW(hKey, NULL, szCLSID, &lDataLen);
     RegCloseKey(hKey);
     if (rc != 0)
@@ -122,5 +52,14 @@
 
     // Now convert from a string to a UUID
-    return CLSIDFromStringA(szCLSID, pclsid);
+    return CLSIDFromString(szCLSID, pclsid);
+}
+
+// ----------------------------------------------------------------------
+// IIDFromString
+// ----------------------------------------------------------------------
+HRESULT WIN32API IIDFromString(LPSTR lpsz, LPIID lpiid)
+{
+    dprintf(("OLE32: IIDFromString"));
+    return CLSIDFromString((LPCOLESTR)lpsz, (LPCLSID)lpiid);
 }
 
@@ -132,11 +71,190 @@
     LPCLSID		pclsid)		// [out] - Binary CLSID
 {
-    dprintf(("OLE32.CLSIDFromString\n"));
+    dprintf(("OLE32: CLSIDFromString"));
+
+    oStringA		tClsId(lpsz);
 
     HRESULT		ret = OLE_ERROR_GENERIC;
-    oStringA		szCLSID(lpsz);
 
     // Convert to binary CLSID
-    return CLSIDFromStringA(szCLSID, pclsid);
-}
-
+    char *s = (char *) tClsId;
+    char *p;
+    int   i;
+    char table[256];
+
+    /* quick lookup table */
+    memset(table, 0, 256);
+
+    for (i = 0; i < 10; i++) 
+    {
+	table['0' + i] = i;
+    }
+    for (i = 0; i < 6; i++) 
+    {
+	table['A' + i] = i+10;
+	table['a' + i] = i+10;
+    }
+
+    /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
+
+    if (lstrlenW(lpsz) != 38)
+	return OLE_ERROR_OBJECT;
+
+    p = (char *) pclsid;
+
+    s++;  /* skip leading brace  */
+    for (i = 0; i < 4; i++)
+    {
+	p[3 - i] = table[*s]<<4 | table[*(s+1)];
+	s += 2;
+    }
+    p += 4;
+    s++;  /* skip - */
+
+    for (i = 0; i < 2; i++)
+    {
+	p[1-i] = table[*s]<<4 | table[*(s+1)];
+	s += 2;
+    }
+    p += 2;
+    s++;  /* skip - */
+
+    for (i = 0; i < 2; i++) 
+    {
+	p[1-i] = table[*s]<<4 | table[*(s+1)];
+	s += 2;
+    }
+    p += 2;
+    s++;  /* skip - */
+
+    /* these are just sequential bytes */
+    for (i = 0; i < 2; i++) 
+    {
+	*p++ = table[*s]<<4 | table[*(s+1)];
+	s += 2;
+    }
+    s++;  /* skip - */
+
+    for (i = 0; i < 6; i++) 
+    {
+	*p++ = table[*s]<<4 | table[*(s+1)];
+	s += 2;
+    }
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// CoCreateGuid()
+// ----------------------------------------------------------------------
+HRESULT WIN32API CoCreateGuid(GUID *pguid)
+{
+   dprintf(("OLE32: CoCreateGuid"));
+   memset(pguid, 0, sizeof(GUID));      //TODO: should be random GUID
+   return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// StringFromCLSID
+// Memory allocated here on behalf of application should be freed using CoTaskMemFree()
+// ----------------------------------------------------------------------
+HRESULT WIN32API StringFromCLSID(REFCLSID rclsid, LPOLESTR *ppsz)
+{
+    char	tmp[50];
+    LPWSTR	szclsid;
+    size_t	strLen;
+
+    dprintf(("OLE32: StringFromCLSID"));
+
+    // Setup new string...
+    strLen  = sprintf(tmp, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+	    rclsid->Data1,
+	    rclsid->Data2,
+	    rclsid->Data3,
+	    rclsid->Data4[0],
+	    rclsid->Data4[1],
+	    rclsid->Data4[2],
+	    rclsid->Data4[3],
+	    rclsid->Data4[4],
+	    rclsid->Data4[5],
+	    rclsid->Data4[6],
+	    rclsid->Data4[7]);
+
+    // Grab buffer for string...
+    szclsid = (LPWSTR)CoTaskMemAlloc((strLen + 1) * sizeof(WCHAR));
+
+    AsciiToUnicode(tmp, szclsid);
+
+    *ppsz = (LPOLESTR)szclsid;
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// StringFromIID
+// Memory allocated here on behalf of application should be freed using CoTaskMemFree()
+// ----------------------------------------------------------------------
+HRESULT WIN32API StringFromIID(REFIID riid, LPOLESTR *ppsz)
+{
+    char	tmp[50];
+    LPWSTR	sziid;
+    size_t	strLen;
+
+    dprintf(("OLE32: StringFromIID"));
+
+    // Setup new string...
+    strLen  = sprintf(tmp, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+	    riid->Data1,
+	    riid->Data2,
+	    riid->Data3,
+	    riid->Data4[0],
+	    riid->Data4[1],
+	    riid->Data4[2],
+	    riid->Data4[3],
+	    riid->Data4[4],
+	    riid->Data4[5],
+	    riid->Data4[6],
+	    riid->Data4[7]);
+
+    // Grab buffer for string...
+    sziid = (LPWSTR)CoTaskMemAlloc((strLen + 1) * sizeof(WCHAR));
+
+    AsciiToUnicode(tmp, sziid);
+
+    *ppsz = (LPOLESTR)sziid;
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// StringFromGUID2
+// ----------------------------------------------------------------------
+int WIN32API StringFromGUID2(REFGUID rguid, LPOLESTR lpsz, int cbMax)
+{
+    char 	tmp[64];
+    size_t	strLen;
+
+    dprintf(("OLE32: StringFromGUID2"));
+
+    // Setup new string...
+    strLen  = sprintf(tmp, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+	    rguid->Data1,
+	    rguid->Data2,
+	    rguid->Data3,
+	    rguid->Data4[0],
+	    rguid->Data4[1],
+	    rguid->Data4[2],
+	    rguid->Data4[3],
+	    rguid->Data4[4],
+	    rguid->Data4[5],
+	    rguid->Data4[6],
+	    rguid->Data4[7]);
+
+    if(cbMax < (strLen * 2 + 1))
+	return 0;
+
+    AsciiToUnicode(tmp, lpsz);
+
+    return(strLen * 2 + 1);  // including 0 terminator
+}
+
Index: trunk/src/ole32/guid.cpp
===================================================================
--- trunk/src/ole32/guid.cpp	(revision 290)
+++ trunk/src/ole32/guid.cpp	(revision 291)
@@ -1,17 +1,19 @@
-/*
- *
+/* 
+ * 
  * Project Odin Software License can be found in LICENSE.TXT
- *
+ * 
  */
-/*
- * Win32 OLE stubs for OS/2
- *
- * 1998/06/12
- *
- * Copyright 1998 Sander van Leeuwen
+/* 
+ * Concrete defintions of all IID's
+ * 
+ * 1/7/99
+ * 
+ * Copyright 1999 David J. Raison
+ * 
  */
 
-// This causes all the DEFINE_GUID's to instantiate their GUID's
-#define INITGUID
+// This causes all the DEFINE_GUID macros to instantiate their GUID's
+#define INITGUID 1
 
 #include "ole32.h"
+
Index: trunk/src/ole32/initialise.cpp
===================================================================
--- trunk/src/ole32/initialise.cpp	(revision 290)
+++ trunk/src/ole32/initialise.cpp	(revision 291)
@@ -1,13 +1,19 @@
-/*
- *
+/* 
+ * 
  * Project Odin Software License can be found in LICENSE.TXT
- *
+ * 
  */
-/*
- * Win32 OLE stubs for OS/2
- *
- * 1998/06/12
- *
- * Copyright 1998 Sander van Leeuwen
+/* 
+ * COM/OLE Startup shutdown.
+ * 
+ * 1/7/99
+ * 
+ * Copyright 1999 David J. Raison
+ * 
+ * Some portions from Wine Implementation
+ *   Copyright 1995  Martin von Loewis
+ *   Copyright 1998  Justin Bradford
+ *   Copyright 1999  Francis Beaudet
+ *   Copyright 1999  Sylvain St-Germain
  */
 
@@ -15,66 +21,8 @@
 
 // ----------------------------------------------------------------------
-// Local Variables
+// Local data
 // ----------------------------------------------------------------------
-static int	s_COMLockCount = 0;
 
-// ----------------------------------------------------------------------
-// CoInitialize()
-// ----------------------------------------------------------------------
-HRESULT WIN32API CoInitialize(LPVOID lpReserved)
-{
-    dprintf(("OLE32.CoInitialize\n"));
 
-    return CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);
-}
 
-// ----------------------------------------------------------------------
-// CoInitializeEx()
-// ----------------------------------------------------------------------
-HRESULT WIN32API CoInitializeEx(
-	LPVOID 	lpReserved,	// [in] pointer to win32 malloc interface
-	DWORD 	dwCoInit)	// [in] A value from COINIT specifies the thread
-{
-    HRESULT hr = S_FALSE;
 
-    dprintf(("OLE32.CoInitializeEx(%p, %lx)\n", lpReserved, dwCoInit));
-
-    if (lpReserved != NULL)
-    {
-	dprintf(("Warning: Bad parameter %p, must be an old Windows Application", lpReserved));
-    }
-
-    /*
-     * Check for unsupported features.
-     */
-    if (dwCoInit != COINIT_APARTMENTTHREADED)
-    {
-	dprintf(("Warning: Unsupported flag %lx", dwCoInit));
-	/* Hope for the best and continue anyway */
-    }
-
-    /*
-     * Check the lock count.
-     * If this is the first time going through the initialize
-     * process, we have to initialize the libraries.
-     */
-    if (s_COMLockCount == 0)
-    {
-	/*
-	 * Initialize the various COM libraries and data structures.
-	 */
-	dprintf(("OLE32.CoInitializeEx - Initializing COM libraries"));
-
-//	RunningObjectTableImpl_Initialize();
-
-	hr = S_OK;
-    }
-
-    /*
-     * Crank-up that lock count.
-     */
-    s_COMLockCount++;
-
-    return hr;
-}
-
Index: trunk/src/ole32/moniker.cpp
===================================================================
--- trunk/src/ole32/moniker.cpp	(revision 291)
+++ trunk/src/ole32/moniker.cpp	(revision 291)
@@ -0,0 +1,446 @@
+/* 
+ * 
+ * Project Odin Software License can be found in LICENSE.TXT
+ * 
+ */
+/* 
+ * COM Monikers.
+ * 
+ * 1/7/99
+ * 
+ * Copyright 1999 David J. Raison
+ * 
+ * Some portions from Wine Implementation
+ *   Copyright 1998  Marcus Meissner
+ *   Copyright 1999  Noomen Hamza
+ */
+
+#include "ole32.h"
+
+#include "moniker.h"
+
+// ======================================================================
+// DATA
+// ======================================================================
+
+// Singleton instance of ROT
+RunningObjectTableImpl * runningObjectTableInstance = 0;
+
+// VTABLE instance
+static ICOM_VTABLE(IRunningObjectTable) VT_RunningObjectTableImpl =
+{
+    RunningObjectTableImpl_QueryInterface, 
+    RunningObjectTableImpl_AddRef, 
+    RunningObjectTableImpl_Release, 
+    RunningObjectTableImpl_Register, 
+    RunningObjectTableImpl_Revoke, 
+    RunningObjectTableImpl_IsRunning, 
+    RunningObjectTableImpl_GetObject, 
+    RunningObjectTableImpl_NoteChangeTime, 
+    RunningObjectTableImpl_GetTimeOfLastChange, 
+    RunningObjectTableImpl_EnumRunning
+};
+
+// ======================================================================
+// Local Methods
+// ======================================================================
+
+// ----------------------------------------------------------------------
+// Initialize
+// ----------------------------------------------------------------------
+HRESULT RunningObjectTableImpl_Initialize()
+{
+    // create singleton ROT
+    runningObjectTableInstance = (RunningObjectTableImpl *)
+			    HeapAlloc(GetProcessHeap(), 0, sizeof(RunningObjectTableImpl));
+
+    if (runningObjectTableInstance == 0)
+	return E_OUTOFMEMORY;
+
+    /* initialize the virtual table function */
+    runningObjectTableInstance->lpvtbl = &VT_RunningObjectTableImpl;
+    runningObjectTableInstance->ref = 1;
+    runningObjectTableInstance->runObjTabSize = ROT_BLOCK_SIZE;
+    runningObjectTableInstance->runObjTabRegister = 0;
+    runningObjectTableInstance->runObjTabLastIndx = 0;
+    runningObjectTableInstance->runObjTab = (RunObject *)
+			HeapAlloc(GetProcessHeap(), 0, sizeof(RunObject[ROT_BLOCK_SIZE]));
+
+    if (runningObjectTableInstance->runObjTab == NULL)
+	return E_OUTOFMEMORY;
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// UnInitialize
+// ----------------------------------------------------------------------
+HRESULT RunningObjectTableImpl_UnInitialize()
+{
+    RunningObjectTableImpl_Release((IRunningObjectTable * )runningObjectTableInstance);
+    Destroy();
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// Destroy
+// ----------------------------------------------------------------------
+static HRESULT Destroy()
+{
+    HeapFree(GetProcessHeap(), 0, runningObjectTableInstance->runObjTab);
+    HeapFree(GetProcessHeap(), 0, runningObjectTableInstance);
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// GetObjectIndex
+// ----------------------------------------------------------------------
+static HRESULT GetObjectIndex(RunningObjectTableImpl * This, DWORD identReg,
+						 IMoniker * pmk, DWORD * indx)
+{
+    DWORD i;
+
+    if (pmk != NULL)
+        /* search object identified by a moniker*/
+        for(i = 0; (i < This->runObjTabLastIndx) && (!IMoniker_IsEqual(This->runObjTab[i].pmkObj, pmk) == S_OK); i++)
+	    ;
+    else
+        /* search object identified by a register identifier*/
+        for(i = 0; ((i<This->runObjTabLastIndx) && (This->runObjTab[i].identRegObj != identReg)); i++)
+	    ;
+    
+    if (i == This->runObjTabLastIndx)
+	return S_FALSE;
+
+    if (indx != NULL)
+	*indx = i;
+
+    return S_OK;
+}
+
+// ======================================================================
+// COM INTERFACE FUNCTIONS
+// ======================================================================
+
+// ----------------------------------------------------------------------
+// RunningObjectTableImpl_QueryInterface
+// ----------------------------------------------------------------------
+HRESULT WIN32API RunningObjectTableImpl_QueryInterface
+   (IRunningObjectTable * iface,
+   REFIID riid,
+   void**ppvObject)
+{
+    ICOM_THIS(RunningObjectTableImpl, iface);
+
+    dprintf(("OLE32: RunningObjectTableImpl_QueryInterface(%p, %p, %p)", This, riid, ppvObject));
+
+    /* validate arguments*/
+    if (This == 0)
+        return CO_E_NOTINITIALIZED;
+
+    if (ppvObject == 0)
+        return E_INVALIDARG;
+
+    * ppvObject = 0;
+
+    if (IsEqualIID(IID_IUnknown, riid))
+        * ppvObject = (IRunningObjectTable * )This;
+    else
+        if (IsEqualIID(IID_IRunningObjectTable, riid))
+            * ppvObject = (IRunningObjectTable * )This;
+
+    if ((* ppvObject) == 0)
+        return E_NOINTERFACE;
+
+    RunningObjectTableImpl_AddRef(iface);
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// RunningObjectTableImpl_AddRef
+// ----------------------------------------------------------------------
+ULONG   WIN32API RunningObjectTableImpl_AddRef
+   (IRunningObjectTable * iface)
+{
+    ICOM_THIS(RunningObjectTableImpl, iface);
+
+    dprintf(("OLE32: RunningObjectTableImpl_AddRef(%p)", This));
+
+    return ++(This->ref);
+}
+
+// ----------------------------------------------------------------------
+// RunningObjectTableImpl_Release
+// ----------------------------------------------------------------------
+ULONG   WIN32API RunningObjectTableImpl_Release
+   (IRunningObjectTable * iface)
+{
+    ICOM_THIS(RunningObjectTableImpl, iface);
+
+    DWORD	i;
+
+    dprintf(("OLE32: RunningObjectTableImpl_Release(%p)", This));
+
+    This->ref--;
+
+    /* unitialize ROT structure if there's no more reference to it*/
+    if (This->ref == 0){
+
+        /* release all registred objects */
+        for( i = 0; i < This->runObjTabLastIndx; i++)
+        {
+            if (( This->runObjTab[i].regTypeObj & ROTFLAGS_REGISTRATIONKEEPSALIVE) != 0)
+                IUnknown_Release(This->runObjTab[i].pObj);
+ 
+            IMoniker_Release(This->runObjTab[i].pmkObj);
+        }
+
+       /*
+        * RunningObjectTable data structure will be not destroyed here !
+        * The destruction will be done only
+        * when RunningObjectTableImpl_UnInitialize function is called
+        */
+
+        /* there's no more elements in the table */
+        This->runObjTabRegister = 0;
+        This->runObjTabLastIndx = 0;
+
+        return 0;
+    }
+
+    return This->ref;
+}
+
+// ----------------------------------------------------------------------
+// RunningObjectTableImpl_Register
+// ----------------------------------------------------------------------
+HRESULT WIN32API RunningObjectTableImpl_Register
+   (IRunningObjectTable * iface, 
+    DWORD grfFlags,           /* Registration options */
+    IUnknown * punkObject,     /* Pointer to the object being registered */
+    IMoniker * pmkObjectName,  /* Pointer to the moniker of the object being registered */
+    DWORD * pdwRegister)       /* Pointer to the value identifying the  registration */
+{
+    ICOM_THIS(RunningObjectTableImpl, iface);
+
+    dprintf(("OLE32: RunningObjectTableImpl_Register(%p, %ld, %p, %p, %p)", This, grfFlags, punkObject, pmkObjectName, pdwRegister));
+
+    HRESULT res = S_OK;
+
+    /* there's only two types of register : strong and or weak registration (only one must be passed on parameter) */
+    if ( ( (grfFlags & ROTFLAGS_REGISTRATIONKEEPSALIVE) || !(grfFlags & ROTFLAGS_ALLOWANYCLIENT)) &&
+         (!(grfFlags & ROTFLAGS_REGISTRATIONKEEPSALIVE) ||  (grfFlags & ROTFLAGS_ALLOWANYCLIENT)) &&
+         (grfFlags) )
+        return E_INVALIDARG;
+
+    if ((punkObject == NULL) || (pmkObjectName == NULL) || (pdwRegister == NULL))
+        return E_INVALIDARG;
+
+    /* verify if the object to be registred was registred befor */
+    if (GetObjectIndex(This, -1, pmkObjectName, NULL) == S_OK)
+        res = MK_S_MONIKERALREADYREGISTERED;
+
+    /* put the new registred object in the first free element in the table */
+    This->runObjTab[This->runObjTabLastIndx].pObj = punkObject;
+    This->runObjTab[This->runObjTabLastIndx].pmkObj = pmkObjectName;
+    This->runObjTab[This->runObjTabLastIndx].regTypeObj = grfFlags;
+    This->runObjTab[This->runObjTabLastIndx].identRegObj = This->runObjTabRegister;
+    CoFileTimeNow(&(This->runObjTab[This->runObjTabLastIndx].lastModifObj));
+    
+    /* gives a registration identifier to the registred object*/
+    (* pdwRegister)= This->runObjTabRegister;
+
+    if (This->runObjTabRegister == 0xFFFFFFFF)
+    {
+        WriteLog("OLE32: Rot_Impl_Register() - runObjTabRegister: %ld overflow! ", This->runObjTabRegister);
+	return E_FAIL;
+    }
+    This->runObjTabRegister++;
+    This->runObjTabLastIndx++;
+    
+    if (This->runObjTabLastIndx == This->runObjTabSize)
+    { /* table is full ! so it must be resized */
+
+        This->runObjTabSize += ROT_BLOCK_SIZE; /* newsize table */
+        This->runObjTab = (RunObject *)HeapReAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, This->runObjTab, 
+                        This->runObjTabSize * sizeof(RunObject));
+        if (!This->runObjTab)
+            return E_OUTOFMEMORY;
+    }
+    /* add a reference to the object in the strong registration case */
+    if ((grfFlags & ROTFLAGS_REGISTRATIONKEEPSALIVE) != 0 )
+        IUnknown_AddRef(punkObject);
+
+    IMoniker_AddRef(pmkObjectName);
+    
+    return res;
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// RunningObjectTableImpl_Revoke
+// ----------------------------------------------------------------------
+HRESULT WIN32API RunningObjectTableImpl_Revoke
+   (IRunningObjectTable * iface, 
+    DWORD dwRegister)  /* Value identifying registration to be revoked*/
+{
+
+    ICOM_THIS(RunningObjectTableImpl, iface);
+
+    dprintf(("OLE32: RunningObjectTableImpl_Revoke(%p, %ld)", This, dwRegister));
+
+    DWORD index, j;
+
+    /* verify if the object to be revoked was registred befor or not */
+    if (GetObjectIndex(This, dwRegister, NULL, &index) == S_FALSE)
+        return E_INVALIDARG;
+
+    /* release the object if it was registred with a strong registrantion option */
+    if ((This->runObjTab[index].regTypeObj & ROTFLAGS_REGISTRATIONKEEPSALIVE) != 0)
+        IUnknown_Release(This->runObjTab[index].pObj);
+
+    IMoniker_Release(This->runObjTab[index].pmkObj);
+    
+    /* remove the object from the table */
+    for(j = index; j < This->runObjTabLastIndx - 1; j++)
+        This->runObjTab[j]= This->runObjTab[j + 1];
+    
+    This->runObjTabLastIndx--;
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// RunningObjectTableImpl_IsRunning
+// ----------------------------------------------------------------------
+HRESULT WIN32API RunningObjectTableImpl_IsRunning
+   (IRunningObjectTable * iface, 
+    IMoniker * pmkObjectName)  /* Pointer to the moniker of the object whose status is desired */
+{
+    ICOM_THIS(RunningObjectTableImpl, iface);
+
+    dprintf(("OLE32: RunningObjectTableImpl_IsRunning(%p, %p)", This, pmkObjectName));
+
+    return GetObjectIndex(This, -1, pmkObjectName, NULL);
+}
+
+// ----------------------------------------------------------------------
+// RunningObjectTableImpl_GetObject
+// ----------------------------------------------------------------------
+HRESULT WIN32API RunningObjectTableImpl_GetObject
+   (IRunningObjectTable * iface, 
+    IMoniker * pmkObjectName, /* Pointer to the moniker on the object */
+    IUnknown **ppunkObject) /* Address of output variable that receives the IUnknown interface pointer */
+{
+    ICOM_THIS(RunningObjectTableImpl, iface);
+
+    dprintf(("OLE32: RunningObjectTableImpl_GetObject(%p, %p, %p)", This, pmkObjectName, ppunkObject));
+
+    DWORD index;
+
+    if (ppunkObject == NULL)
+        return E_POINTER;
+    
+    *ppunkObject = 0;
+
+    /* verify if the object was registred befor or not */
+    if (GetObjectIndex(This, -1, pmkObjectName, &index) == S_FALSE)
+        return MK_E_UNAVAILABLE;
+
+    /* add a reference to the object then set output object argument */
+    IUnknown_AddRef(This->runObjTab[index].pObj);
+    *ppunkObject = This->runObjTab[index].pObj;
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// RunningObjectTableImpl_NoteChangeTime
+// ----------------------------------------------------------------------
+HRESULT WIN32API RunningObjectTableImpl_NoteChangeTime
+   (IRunningObjectTable * iface, 
+    DWORD dwRegister,  /* Value identifying registration being updated */
+    FILETIME * pfiletime) /* Pointer to structure containing object's last change time */
+{
+    ICOM_THIS(RunningObjectTableImpl, iface);
+
+    dprintf(( "OLE32: RunningObjectTableImpl_NoteChangeTime(%p, %ld, %p)", This, dwRegister, pfiletime));
+
+    DWORD index=-1;
+
+    /* verify if the object to be changed was registred befor or not */
+    if (GetObjectIndex(This, dwRegister, NULL, &index) == S_FALSE)
+        return E_INVALIDARG;
+
+    /* set the new value of the last time change */
+    This->runObjTab[index].lastModifObj = (* pfiletime);
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// RunningObjectTableImpl_GetTimeOfLastChange
+// ----------------------------------------------------------------------
+HRESULT WIN32API RunningObjectTableImpl_GetTimeOfLastChange
+   (IRunningObjectTable * iface, 
+    IMoniker * pmkObjectName,  /* Pointer to moniker on the object whose status is desired */
+    FILETIME * pfiletime)       /* Pointer to structure that receives object's last change time */
+{
+    ICOM_THIS(RunningObjectTableImpl, iface);
+
+    dprintf(( "OLE32: RunningObjectTableImpl_GetTimeOfLastChange(%p, %p, %p)", This, pmkObjectName, pfiletime));
+
+    DWORD index = -1;
+
+    if (pmkObjectName == NULL || pfiletime == NULL)
+        return E_INVALIDARG;
+
+    /* verify if the object was registred befor or not */
+    if (GetObjectIndex(This, -1, pmkObjectName, &index) == S_FALSE)
+        return MK_E_UNAVAILABLE;;
+
+    (* pfiletime)= This->runObjTab[index].lastModifObj;
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// RunningObjectTableImpl_EnumRunning
+// ----------------------------------------------------------------------
+HRESULT WIN32API RunningObjectTableImpl_EnumRunning
+   (IRunningObjectTable * iface, 
+    IEnumMoniker **ppenumMoniker) /* Address of output variable that receives the IEnumMoniker interface pointer */
+{
+    dprintf(( "OLE32: RunningObjectTableImpl_EnumRunning - stub"));
+    return E_NOTIMPL;
+}
+
+// ======================================================================
+// API Methods
+// ======================================================================
+
+// ----------------------------------------------------------------------
+// GetRunningObjectTable
+// ----------------------------------------------------------------------
+HRESULT WIN32API GetRunningObjectTable(DWORD reserved, LPVOID *pprot)
+{
+    IID		riid = IID_IRunningObjectTable;
+    HRESULT	hr;
+
+    dprintf(("OLE32: GetRunningObjectTable"));
+
+    if (reserved != 0)
+	return E_UNEXPECTED;
+
+    if (runningObjectTableInstance == NULL)
+	return CO_E_NOTINITIALIZED;
+
+    hr = RunningObjectTableImpl_QueryInterface(
+		    (IRunningObjectTable*)runningObjectTableInstance, &riid, (void**)pprot);
+
+    return hr;
+}
+
Index: trunk/src/ole32/oString.cpp
===================================================================
--- trunk/src/ole32/oString.cpp	(revision 290)
+++ trunk/src/ole32/oString.cpp	(revision 291)
@@ -1,23 +1,33 @@
 
-#include <string.h>
-
-// Prevent CALLCONV becoming _System
-#include <winbase.h>
-#include <uconv.h>
-#undef CALLCONV
-
-#include <os2win.h>
+#include "ole32.h"
 
 #include "oString.h"
 
+// ======================================================================
+// oStringBase - Base stuff for oString classes
+// ======================================================================
+
 // Block size.
-long oStringA::blockSize = 32;
+long oStringBase::blockSize = 32;
+
+// Initialise to nothing...
+oStringBase::oStringBase(long bytePerChar)
+{
+    m_bytePerChar = bytePerChar;
+    m_Heap = GetProcessHeap();
+}
+
+// Destructor
+oStringBase::~oStringBase()
+{
+    freeBuf();
+}
 
 // calculate the buffersize needed for this string (quantised to blockSize)
-long oStringA::calcBufLen(long strLen)
+long oStringBase::calcBufLen(long strLen)
 {
     long	tmp;
 
-    tmp = (strLen / blockSize) + 1;
+    tmp = ((strLen * m_bytePerChar) / blockSize) + 1;
 
     return tmp * blockSize;
@@ -25,10 +35,10 @@
 
 // Get a buffer of required length...
-void oStringA::getBuf(long strLen)
+void oStringBase::getBuf(long strLen)
 {
     // Sanity check...
     if (strLen < 1)
     {
-    	dprintf(("Warning: oStringA::getBuf - strlen < 1!"));
+    	dprintf(("oStringBase: Warning! ::getBuf - strlen < 1!"));
     	strLen = 1;
     }
@@ -42,5 +52,5 @@
 
 // Free buffer...
-void oStringA::freeBuf()
+void oStringBase::freeBuf()
 {
     HeapFree(m_Heap, 0, m_strBuf);
@@ -48,45 +58,40 @@
 
 // Re-allocate buffer if more space is required...
-void oStringA::adjBuf(long strLen)
-{
-    if (strLen > m_bufLen)
+void oStringBase::adjBuf(long strLen)
+{
+    if ((strLen * m_bytePerChar) > m_bufLen)
     {
-	LPSTR	strBuf;
 	long	bufLen = calcBufLen(strLen);
 
 	// Allocate new buffer...
-	strBuf = (LPSTR)HeapAlloc(m_Heap, 0, bufLen);
-
-	// Copy old buffer to new...
-	strcpy(strBuf, m_strBuf);	// Incl. terminator...
-	freeBuf();
+	m_strBuf = (LPSTR)HeapReAlloc(m_Heap, 0, m_strBuf, bufLen);
 
 	// Save new buffer...
-	m_strBuf = strBuf;
 	m_bufLen = bufLen;
     }
 }
 
+// ======================================================================
+// oStringA - String manipulation based on ASCII
+// ======================================================================
+
 // Initialise to nothing...
-oStringA::oStringA( void)
-{
-    m_Heap = GetProcessHeap();
-    getBuf(1);	// Incl. terminator...
+oStringA::oStringA( void) : oStringBase(sizeof(char))
+{
+    getBuf( 1);	// Incl. terminator...
 }
 
 // Initialise to a specified length...
-oStringA::oStringA(int defLen)
-{
-    m_Heap = GetProcessHeap();
-    getBuf(defLen + 1);
+oStringA::oStringA(int defLen)   : oStringBase(sizeof(char))
+{
+    getBuf( defLen + 1);
 }
 
 // Initialise from Unicode string...
-oStringA::oStringA(LPCWSTR pUnicode)
+oStringA::oStringA(LPCWSTR pUnicode)  : oStringBase(sizeof(char))
 {
     long	strLen = lstrlenW(pUnicode) + 1;
 
-    m_Heap = GetProcessHeap();
-    getBuf(strLen);
+    getBuf( strLen);
     UnicodeToAscii((LPWSTR)pUnicode, m_strBuf);
     m_strLen = strLen;
@@ -94,10 +99,9 @@
 
 // Initialise from ASCII string...
-oStringA::oStringA(LPCSTR pAscii)
+oStringA::oStringA(LPCSTR pAscii)  : oStringBase(sizeof(char))
 {
     long	strLen = strlen(pAscii) + 1;
 
-    m_Heap = GetProcessHeap();
-    getBuf(strLen);
+    getBuf( strLen);
     strcpy(m_strBuf, pAscii);
     m_strLen = strLen;
@@ -105,16 +109,18 @@
 
 // Initialise from another oString
-oStringA::oStringA(const oStringA &ref)
-{
-    m_Heap = GetProcessHeap();
-    getBuf(ref.m_strLen);
+oStringA::oStringA(const oStringA &ref)  : oStringBase(sizeof(char))
+{
+    getBuf( ref.m_strLen);
     strcpy(m_strBuf, ref.m_strBuf);
     m_strLen = ref.m_strLen;
 }
 
-//Destroy resources...
-oStringA::~oStringA()
-{
-    freeBuf();
+// Initialise from CLSID
+oStringA::oStringA( REFCLSID pClsId)  : oStringBase(sizeof(char))
+{
+    getBuf( 50);	// Incl. terminator...
+
+    // Assign string...
+    operator=(pClsId);
 }
 
@@ -122,5 +128,5 @@
 oStringA::operator LPSTR()
 {
-    return m_strBuf;
+    return (LPSTR)m_strBuf;
 }
 
@@ -133,5 +139,5 @@
 
     // Setup new string...
-    getBuf(string.m_strLen);
+    getBuf( string.m_strLen);
     strcpy(m_strBuf, string.m_strBuf);
     m_strLen = string.m_strLen;
@@ -147,5 +153,5 @@
 
     // Setup new string...
-    getBuf(strLen);
+    getBuf( strLen);
     strcpy(m_strBuf, pAscii);
     m_strLen = strLen;
@@ -161,5 +167,5 @@
 
     // Setup new string...
-    getBuf(strLen);
+    getBuf( strLen);
     UnicodeToAscii((LPWSTR)pUnicode, m_strBuf);
     m_strLen = strLen;
@@ -167,4 +173,25 @@
 }
 
+oStringA oStringA::operator =  (REFCLSID rClsId)
+{
+    // Lose old string...
+    freeBuf();
+
+    // Setup new string...
+    getBuf( 50);
+    m_strLen  = sprintf(m_strBuf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+	    rClsId->Data1,
+	    rClsId->Data2,
+	    rClsId->Data3,
+	    rClsId->Data4[0],
+	    rClsId->Data4[1],
+	    rClsId->Data4[2],
+	    rClsId->Data4[3],
+	    rClsId->Data4[4],
+	    rClsId->Data4[5],
+	    rClsId->Data4[6],
+	    rClsId->Data4[7]);
+    return *this;
+}
 
 // Add String to String
@@ -215,5 +242,5 @@
     long	strLen = m_strLen + string.m_strLen - 1;
 
-    adjBuf(strLen);
+    adjBuf( strLen);
     strcpy(m_strBuf + m_strLen - 1, string.m_strBuf);
     m_strLen = strLen;
@@ -227,5 +254,5 @@
     long	strLen = m_strLen + strlen(pAscii);
 
-    adjBuf(strLen);
+    adjBuf( strLen);
     strcpy(m_strBuf + m_strLen - 1, pAscii);
     m_strLen = strLen;
@@ -239,5 +266,5 @@
     long	strLen = m_strLen + lstrlenW(pUnicode);
 
-    adjBuf(strLen);
+    adjBuf( strLen);
     UnicodeToAscii((LPWSTR)pUnicode, m_strBuf + m_strLen - 1);
     m_strLen = strLen;
@@ -246,3 +273,256 @@
 }
 
-
+// ======================================================================
+// oStringW - String manipulation based on Unicode
+// ======================================================================
+
+// Initialise to nothing...
+oStringW::oStringW( void) : oStringBase(sizeof(WCHAR))
+{
+    getBuf( 1);	// Incl. terminator...
+}
+
+// Initialise to a specified length...
+oStringW::oStringW(int defLen) : oStringBase(sizeof(WCHAR))
+{
+    getBuf( defLen + 1);
+}
+
+// Initialise from Unicode string...
+oStringW::oStringW(LPCWSTR pUnicode) : oStringBase(sizeof(WCHAR))
+{
+    long	strLen = lstrlenW((const WCHAR *)pUnicode) + 1;
+
+    getBuf(strLen);
+    lstrcpyW((LPWSTR)m_strBuf, pUnicode);
+    m_strLen = strLen;
+}
+
+// Initialise from Unicode string...
+oStringW::oStringW(const wchar_t * pUnicode) : oStringBase(sizeof(WCHAR))
+{
+    long	strLen = lstrlenW((LPWSTR)pUnicode) + 1;
+
+    getBuf(strLen);
+    lstrcpyW((LPWSTR)m_strBuf, (LPCWSTR)pUnicode);
+    m_strLen = strLen;
+}
+
+// Initialise from ASCII string...
+oStringW::oStringW(LPCSTR pAscii) : oStringBase(sizeof(WCHAR))
+{
+    long	strLen = strlen(pAscii) + 1;
+
+    getBuf( strLen);
+    AsciiToUnicode((char *)pAscii, (LPWSTR)m_strBuf);
+    m_strLen = strLen;
+}
+
+// Initialise from another oString
+oStringW::oStringW(const oStringW &ref) : oStringBase(sizeof(WCHAR))
+{
+    getBuf( ref.m_strLen);
+    lstrcpyW((LPWSTR)m_strBuf, (LPWSTR)ref.m_strBuf);
+    m_strLen = ref.m_strLen;
+}
+
+// Initialise from CLSID
+oStringW::oStringW( REFCLSID pClsId) : oStringBase(sizeof(WCHAR))
+{
+    getBuf( 50);	// Incl. terminator...
+
+    // Assign string...
+    operator=(pClsId);
+}
+
+// Return pointer to string...
+oStringW::operator LPWSTR()
+{
+    return (LPWSTR)m_strBuf;
+}
+
+// Assign
+oStringW oStringW::operator =  (const oStringW & string)
+{
+    // Lose old string...
+    freeBuf();
+
+    // Setup new string...
+    getBuf( string.m_strLen);
+    lstrcpyW((LPWSTR)m_strBuf, (LPWSTR)string.m_strBuf);
+    m_strLen = string.m_strLen;
+    return *this;
+}
+
+oStringW oStringW::operator =  (LPCSTR pAscii)
+{
+    long	strLen = strlen(pAscii) + 1;
+
+    // Lose old string...
+    freeBuf();
+
+    // Setup new string...
+    getBuf( strLen);
+    AsciiToUnicode((char *)pAscii, (LPWSTR)m_strBuf);
+    m_strLen = strLen;
+    return *this;
+}
+
+oStringW oStringW::operator =  (LPCWSTR pUnicode)
+{
+    long	strLen = lstrlenW(pUnicode) + 1;
+
+    // Lose old string...
+    freeBuf();
+
+    // Setup new string...
+    getBuf( strLen);
+    lstrcpyW((LPWSTR)m_strBuf, pUnicode);
+    m_strLen = strLen;
+    return *this;
+}
+
+oStringW oStringW::operator =  (const wchar_t * pUnicode)
+{
+    long	strLen = lstrlenW((LPWSTR)pUnicode) + 1;
+
+    // Lose old string...
+    freeBuf();
+
+    // Setup new string...
+    getBuf( strLen);
+    lstrcpyW((LPWSTR)m_strBuf, (LPWSTR)pUnicode);
+    m_strLen = strLen;
+    return *this;
+}
+
+oStringW oStringW::operator =  (REFCLSID rClsId)
+{
+    char	tmp[50];
+
+    // Lose old string...
+    freeBuf();
+
+    // Setup new string...
+    getBuf( 50);
+    m_strLen  = sprintf(tmp, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+	    rClsId->Data1,
+	    rClsId->Data2,
+	    rClsId->Data3,
+	    rClsId->Data4[0],
+	    rClsId->Data4[1],
+	    rClsId->Data4[2],
+	    rClsId->Data4[3],
+	    rClsId->Data4[4],
+	    rClsId->Data4[5],
+	    rClsId->Data4[6],
+	    rClsId->Data4[7]);
+    AsciiToUnicode(tmp, (LPWSTR)m_strBuf);
+    return *this;
+}
+
+// Add String to String
+oStringW oStringW::operator +  (const oStringW & string)
+{
+    // two terminators to account for...
+    oStringW	product(m_strLen + string.m_strLen - 1);
+
+    lstrcpyW((LPWSTR)product.m_strBuf, (LPWSTR)m_strBuf);
+    lstrcpyW((LPWSTR)product.m_strBuf + m_strLen - 1, (LPWSTR)string.m_strBuf);
+    product.m_strLen = m_strLen + string.m_strLen - 1;
+
+    return product;
+}
+
+// Add String to ASCII string
+oStringW oStringW::operator +  (LPCSTR pAscii)
+{
+    long	strLen = m_strLen + strlen(pAscii);
+
+    oStringW	product(strLen);
+
+    lstrcpyW((LPWSTR)product.m_strBuf, (LPWSTR)m_strBuf);
+    AsciiToUnicode((char *)pAscii, (LPWSTR)product.m_strBuf + m_strLen - 1);
+    product.m_strLen = strLen;
+
+    return product;
+}
+
+// Add String to UNICODE string
+oStringW oStringW::operator +  (LPCWSTR pUnicode)
+{
+    long	strLen = m_strLen + lstrlenW(pUnicode);
+
+    oStringW	product(strLen);
+
+    lstrcpyW((LPWSTR)product.m_strBuf, (LPWSTR)m_strBuf);
+    lstrcpyW((LPWSTR)product.m_strBuf + m_strLen - 1, (LPWSTR)pUnicode);
+    product.m_strLen = strLen;
+
+    return product;
+}
+
+// Add String to UNICODE string
+oStringW oStringW::operator +  (const wchar_t * pUnicode)
+{
+    long	strLen = m_strLen + lstrlenW((LPWSTR)pUnicode);
+
+    oStringW	product(strLen);
+
+    lstrcpyW((LPWSTR)product.m_strBuf, (LPWSTR)m_strBuf);
+    lstrcpyW((LPWSTR)product.m_strBuf + m_strLen - 1, (LPWSTR)pUnicode);
+    product.m_strLen = strLen;
+
+    return product;
+}
+
+// Concatenate string object
+oStringW oStringW::operator += (const oStringW & string)
+{
+    // two terminators to account for...
+    long	strLen = m_strLen + string.m_strLen - 1;
+
+    adjBuf( strLen);
+    lstrcpyW((LPWSTR)m_strBuf + m_strLen - 1, (LPWSTR)string.m_strBuf);
+    m_strLen = strLen;
+
+    return *this;
+}
+
+// Concatenate Ascii string
+oStringW oStringW::operator +=  (LPCSTR pAscii)
+{
+    long	strLen = m_strLen + strlen(pAscii);
+
+    adjBuf( strLen);
+    AsciiToUnicode((char *)pAscii, (LPWSTR)m_strBuf + m_strLen - 1);
+    m_strLen = strLen;
+
+    return *this;
+}
+
+// Concatenate Unicode string
+oStringW oStringW::operator +=  (LPCWSTR pUnicode)
+{
+    long	strLen = m_strLen + lstrlenW(pUnicode);
+
+    adjBuf( strLen);
+    lstrcpyW((LPWSTR)m_strBuf + m_strLen - 1, (LPWSTR)pUnicode);
+    m_strLen = strLen;
+
+    return *this;
+}
+
+// Concatenate Unicode string
+oStringW oStringW::operator +=  (const wchar_t * pUnicode)
+{
+    long	strLen = m_strLen + lstrlenW((LPWSTR)pUnicode);
+
+    adjBuf( strLen);
+    lstrcpyW((LPWSTR)m_strBuf + m_strLen - 1, (LPWSTR)pUnicode);
+    m_strLen = strLen;
+
+    return *this;
+}
+
+
Index: trunk/src/ole32/ole32.cpp
===================================================================
--- trunk/src/ole32/ole32.cpp	(revision 290)
+++ trunk/src/ole32/ole32.cpp	(revision 291)
@@ -1,16 +1,141 @@
+/* 
+ * 
+ * Project Odin Software License can be found in LICENSE.TXT
+ * 
+ */
+/* 
+ * COM/OLE misc. functions.
+ * 
+ * 1/7/99
+ * 
+ * Copyright 1999 David J. Raison
+ * 
+ * Some portions from Wine Implementation
+ *   Copyright 1995  Martin von Loewis
+ *   Copyright 1998  Justin Bradford
+ *   Copyright 1999  Francis Beaudet
+ *   Copyright 1999  Sylvain St-Germain
+ */
+
+#include "ole32.h"
+
+#include "oString.h"
+#include "moniker.h"	// RunningObjectTableImpl_***
+
+// ======================================================================
+// Local Data
+// ======================================================================
+typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv);
+
 /*
+ * This linked list contains the list of registered class objects. These
+ * are mostly used to register the factories for out-of-proc servers of OLE
+ * objects.
+ */
+typedef struct tagRegisteredClass
+{
+  CLSID     classIdentifier;
+  LPUNKNOWN classObject;
+  DWORD     runContext;
+  DWORD     connectFlags;
+  DWORD     dwCookie;
+  struct tagRegisteredClass* nextClass;
+} RegisteredClass;
+
+static RegisteredClass* firstRegisteredClass = NULL;
+
+/*
+ * COM External Lock structures and methods declaration
  *
- * Project Odin Software License can be found in LICENSE.TXT
+ * This api provides a linked list to managed external references to
+ * COM objects.
  *
  */
+
+#define EL_END_OF_LIST 0
+#define EL_NOT_FOUND   0
+
 /*
- * Win32 OLE stubs for OS/2
+ * Declaration of the static structure that manage the
+ * external lock to COM  objects.
+ */
+typedef struct COM_ExternalLock     COM_ExternalLock;
+typedef struct COM_ExternalLockList COM_ExternalLockList;
+
+struct COM_ExternalLock
+{
+    IUnknown         *pUnk;     /* IUnknown referenced */
+    ULONG            uRefCount; /* external lock counter to IUnknown object*/
+    COM_ExternalLock *next;     /* Pointer to next element in list */
+};
+
+struct COM_ExternalLockList
+{
+    COM_ExternalLock *head;     /* head of list */
+};
+
+/*
+ * Declaration and initialization of the static structure that manages
+ * the external lock to COM objects.
+ */
+static COM_ExternalLockList elList = { EL_END_OF_LIST };
+
+/*
+ * This open DLL table belongs in a per process table, but my guess is that
+ * it shouldn't live in the kernel, so I'll put them out here in DLL
+ * space assuming that there is one OLE32 per process.
+ */
+typedef struct tagOpenDll 
+{
+    char *	DllName;                /* really only needed for debugging */
+    HINSTANCE 	hLibrary;
+    struct tagOpenDll * next;
+} OpenDll;
+
+static OpenDll * openDllList = NULL;	/* linked list of open dlls */
+
+/*
+ * Com Library reference count...
  *
- * 1998/06/12
- *
- * Copyright 1998 Sander van Leeuwen
+ * Used to control loading / unloading of Library resources,
+ * Runnng object table, DLL's etc...
  */
-
-#include "ole32.h"
+static LONG	COM_ref = 0;
+
+// ======================================================================
+// Prototypes.
+// ======================================================================
+static HRESULT COM_GetRegisteredClassObject(
+	REFCLSID    	rclsid,
+	DWORD       	dwClsContext,
+	LPUNKNOWN * 	ppUnk);
+
+static void COM_RevokeAllClasses();
+
+static void COM_ExternalLockFreeList();
+
+static void COM_ExternalLockAddRef(
+	IUnknown * pUnk);
+
+static void COM_ExternalLockRelease(
+	IUnknown *	pUnk,
+	BOOL		bRelAll);
+
+static BOOL COM_ExternalLockInsert(
+	IUnknown * pUnk);
+
+static void COM_ExternalLockDelete(
+	COM_ExternalLock * element);
+
+static COM_ExternalLock * COM_ExternalLockFind(
+	IUnknown *	pUnk);
+
+static COM_ExternalLock * COM_ExternalLockLocate(
+	COM_ExternalLock * element,
+	IUnknown *	pUnk);
+
+// ======================================================================
+// Public API's
+// ======================================================================
 
 // ----------------------------------------------------------------------
@@ -20,5 +145,594 @@
 {
     dprintf(("OLE32.CoBuildVersion\n"));
-    return (rmm<<16)+rup;
-}
-
+    return (rmm << 16) + rup;
+}
+
+// ----------------------------------------------------------------------
+// CoDosDateTimeToFileTime
+// ----------------------------------------------------------------------
+BOOL WIN32API CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime,
+                                         FILETIME *lpFileTime)
+{
+    dprintf(("OLE32: CoDosDateTimeToFileTime"));
+
+    return DosDateTimeToFileTime(nDosDate, nDosTime, lpFileTime);
+}
+
+// ----------------------------------------------------------------------
+// CoDosDateTimeToFileTime
+// ----------------------------------------------------------------------
+HRESULT WIN32API CoFileTimeNow(FILETIME *lpFileTime)
+{
+    SYSTEMTIME systime;
+
+    dprintf(("OLE32: CoFileTimeNow"));
+
+    GetSystemTime(&systime);
+    return SystemTimeToFileTime(&systime, lpFileTime);
+}
+
+// ----------------------------------------------------------------------
+// CoDosDateTimeToFileTime
+// ----------------------------------------------------------------------
+BOOL WIN32API CoFileTimeToDosDateTime(FILETIME *lpFileTime, LPWORD lpDosDate,
+                                         LPWORD lpDosTime)
+{
+    dprintf(("OLE32: CoFileTimeToDosDateTime"));
+
+    return FileTimeToDosDateTime(lpFileTime, lpDosDate, lpDosTime);
+}
+
+// ----------------------------------------------------------------------
+// CoInitialize()
+// ----------------------------------------------------------------------
+HRESULT WIN32API CoInitialize(LPVOID lpReserved)
+{
+    dprintf(("OLE32: CoInitialize\n"));
+
+    return CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);
+}
+
+// ----------------------------------------------------------------------
+// CoInitializeEx()
+// ----------------------------------------------------------------------
+HRESULT WIN32API CoInitializeEx(
+	LPVOID 	lpReserved,	// [in] pointer to win32 malloc interface
+	DWORD 	dwCoInit)	// [in] A value from COINIT specifies the thread
+{
+    HRESULT		hr;
+
+    dprintf(("OLE32: CoInitializeEx(%p, %lx)\n", lpReserved, dwCoInit));
+
+    if (lpReserved != NULL)
+    {
+	dprintf(("Warning: Bad parameter %p, must be an old Windows Application", lpReserved));
+    }
+
+    /*
+     * Check for unsupported features.
+     */
+    if (dwCoInit != COINIT_APARTMENTTHREADED)
+    {
+	dprintf(("Warning: Unsupported flag %lx", dwCoInit));
+	/* Hope for the best and continue anyway */
+    }
+
+    /*
+     * Initialise the Running Object Table
+     */
+    hr = S_FALSE;
+    if (++COM_ref == 1)
+    {
+	hr = RunningObjectTableImpl_Initialize();
+	if (hr != S_OK)
+	    --COM_ref;
+    }
+
+    return hr;
+}
+
+// ----------------------------------------------------------------------
+// CoUninitialize()
+// ----------------------------------------------------------------------
+void WIN32API CoUninitialize(void)
+{
+    dprintf(("OLE32: CoUninitialize"));
+
+    if (--COM_ref == 0)
+    {
+	dprintf(("OLE32: Releasing COM libraries"));
+
+	RunningObjectTableImpl_UnInitialize();
+
+	COM_RevokeAllClasses();
+
+	CoFreeAllLibraries();
+	
+	COM_ExternalLockFreeList();
+    }
+}
+
+// ----------------------------------------------------------------------
+// CoCreateInstance
+// ----------------------------------------------------------------------
+HRESULT WIN32API CoCreateInstance
+   (REFCLSID		rclsid,
+    LPUNKNOWN		pUnkOuter,
+    DWORD		dwClsContext,
+    REFIID		iid,
+    LPVOID *		ppv) 
+{
+    HRESULT hres;
+    LPCLASSFACTORY lpclf = 0;
+
+    oStringA		tCLSID(rclsid);
+    oStringA		tIId(iid);
+
+    dprintf(("OLE32: CoCreateInstance"));
+    dprintf(("       CLSID:%s", (char *)tCLSID));
+    dprintf(("       IID  :%s", (char *)tIId));
+
+    // Sanity check
+    if (ppv == 0)
+	return E_POINTER;
+
+    *ppv = 0;
+
+    // Get a class factory to construct the object we want.
+    hres = CoGetClassObject(rclsid, dwClsContext, NULL, &IID_IClassFactory, (LPVOID *)&lpclf);
+
+    if (FAILED(hres))
+	return hres;
+
+    // Create the object and don't forget to release the factory
+    hres = IClassFactory_CreateInstance(lpclf, pUnkOuter, iid, ppv);
+    IClassFactory_Release(lpclf);
+
+    return hres;
+}
+
+// ----------------------------------------------------------------------
+// CoCreateInstanceEx
+// ----------------------------------------------------------------------
+HRESULT WIN32API CoCreateInstanceEx
+   (REFCLSID      	rclsid, 
+    LPUNKNOWN     	pUnkOuter,
+    DWORD         	dwClsContext, 
+    COSERVERINFO * 	pServerInfo,
+    ULONG         	cmq,
+    MULTI_QI *     	pResults)
+{
+    IUnknown * 		pUnk = NULL;
+    HRESULT   		hr;
+    ULONG     		index;
+    int       		successCount = 0;
+
+    oStringA		tCLSID(rclsid);
+
+    dprintf(("OLE32: CoCreateInstanceEx"));
+    dprintf(("       CLSID:%s", (char *)tCLSID));
+
+    // Sanity check
+    if ( (cmq == 0) || (pResults == NULL))
+	return E_INVALIDARG;
+
+    if (pServerInfo != NULL)
+	dprintf(("OLE32: CoCreateInstanceEx - pServerInfo not supported!"));
+
+    // Initialize all the "out" parameters.
+    for (index = 0; index < cmq; index++)
+    {
+	pResults[index].pItf = NULL;
+	pResults[index].hr   = E_NOINTERFACE;
+    }
+
+    /*
+    * Get the object and get it's IUnknown pointer.
+    */
+    hr = CoCreateInstance(rclsid, pUnkOuter, dwClsContext, &IID_IUnknown, (VOID**)&pUnk);
+
+    if (hr)
+	return hr;
+
+    /*
+    * Then, query for all the interfaces requested.
+    */
+    for (index = 0; index < cmq; index++)
+    {
+	pResults[index].hr = IUnknown_QueryInterface(pUnk, pResults[index].pIID, (VOID**)&(pResults[index].pItf));
+
+	if (pResults[index].hr == S_OK)
+	    successCount++;
+    }
+
+    /*
+    * Release our temporary unknown pointer.
+    */
+    IUnknown_Release(pUnk);
+
+    if (successCount == 0)
+	return E_NOINTERFACE;
+
+    if (successCount != cmq)
+	return CO_S_NOTALLINTERFACES;
+
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// CoGetClassObject
+// ----------------------------------------------------------------------
+HRESULT WIN32API CoGetClassObject
+   (REFCLSID		rclsid,
+    DWORD		dwClsContext,
+    LPVOID		pvReserved,
+    REFIID		iid,
+    LPVOID *		ppv)
+{
+    LPUNKNOWN		regClassObject;
+    HRESULT		hres = E_UNEXPECTED;
+
+    char		dllName[MAX_PATH+1];
+    LONG		dllNameLen = sizeof(dllName);
+    HINSTANCE		hLibrary;
+
+    DllGetClassObjectFunc DllGetClassObject;
+    oStringA		tCLSID(rclsid);
+
+#ifdef DEBUG
+    oStringA		tIId(iid);
+    dprintf(("OLE32: CoGetClassObject"));
+    dprintf(("       CLSID:%s", (char *)tCLSID));
+    dprintf(("       IID  :%s", (char *)tIId));
+#endif
+
+    // First, try and see if we can't match the class ID with one of the 
+    // registered classes.
+    if (S_OK == COM_GetRegisteredClassObject(rclsid, dwClsContext, &regClassObject))
+    {
+	// Get the required interface from the retrieved pointer.
+	hres = IUnknown_QueryInterface(regClassObject, iid, ppv);
+
+	// Since QI got another reference on the pointer, we want to release the
+	// one we already have. If QI was unsuccessful, this will release the object. This
+	// is good since we are not returning it in the "out" parameter.
+	IUnknown_Release(regClassObject);
+
+	return hres;
+    }
+
+    // out of process and remote servers not supported yet...
+    if (dwClsContext & CLSCTX_LOCAL_SERVER)
+    {
+	dprintf(("OLE32: CoGetClassObject - CLSCTX_LOCAL_SERVER not supported!\n"));
+	return E_ACCESSDENIED;
+    }
+
+    if (dwClsContext & CLSCTX_REMOTE_SERVER)
+    {
+	dprintf(("OLE32: CoGetClassObject - CLSCTX_REMOTE_SERVER not supported!\n"));
+	return E_ACCESSDENIED;
+    }
+
+    // Get down to the biz..
+    if (dwClsContext & (CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER))
+    {
+        HKEY	CLSIDkey;
+        HKEY	key;
+
+        /* lookup CLSID in registry key HKCR/CLSID */
+        hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &CLSIDkey);
+	if (hres != ERROR_SUCCESS)
+	    return REGDB_E_READREGDB;
+
+        hres = RegOpenKeyExA(CLSIDkey, tCLSID, 0, KEY_QUERY_VALUE, &key);
+	if (hres != ERROR_SUCCESS) 
+	{
+	    RegCloseKey(CLSIDkey);
+	    return REGDB_E_CLASSNOTREG;
+	}
+
+	hres = RegQueryValueA(key, "InprocServer32", dllName, &dllNameLen);
+	RegCloseKey(key);
+	RegCloseKey(CLSIDkey);
+	if (hres != ERROR_SUCCESS)
+	{
+	    dprintf(("OLE32: CoGetClassObject - InprocServer32 not found in registry"));
+	    return REGDB_E_READREGDB;
+	}
+
+	dprintf(("OLE32: CoGetClassObject - Registry reports InprocServer32 dll as %s\n", dllName));
+
+	/* open dll, call DllGetClassFactory */
+	hLibrary = CoLoadLibrary(dllName, TRUE);
+	if (hLibrary == 0)
+	{
+	    dprintf(("OLE32: CoGetClassObject - couldn't load %s\n", dllName));
+	    return E_ACCESSDENIED; /* or should this be CO_E_DLLNOTFOUND? */
+	}
+
+	DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject");
+	if (!DllGetClassObject) 
+	{
+	    dprintf(("OLE32: CoGetClassObject - couldn't function DllGetClassObject in %s\n", dllName));
+	    /* not sure if this should be called here CoFreeLibrary(hLibrary);*/
+	    return E_ACCESSDENIED;
+	}
+
+	// Ask the DLL for it's class object. (there was a note here about class
+	// factories but this is good.
+	return DllGetClassObject(rclsid, iid, ppv);
+    }
+    return hres;
+}
+
+// ======================================================================
+// Private functions.
+// ======================================================================
+
+// ----------------------------------------------------------------------
+// COM_GetRegisteredClassObject
+// ----------------------------------------------------------------------
+// This internal method is used to scan the registered class list to 
+// find a class object.
+//
+// Params: 
+//   rclsid        Class ID of the class to find.
+//   dwClsContext  Class context to match.
+//   ppv           [out] returns a pointer to the class object. Complying
+//                 to normal COM usage, this method will increase the
+//                 reference count on this object.
+static HRESULT COM_GetRegisteredClassObject
+   (REFCLSID		rclsid,
+    DWORD       	dwClsContext,
+    LPUNKNOWN *	  	ppUnk)
+{
+    RegisteredClass* curClass;
+
+    oStringA		tCLSID(rclsid);
+
+    dprintf(("OLE32: COM_GetRegisteredClassObject"));
+    dprintf(("       CLSID:%s", (char *)tCLSID));
+
+    // Sanity check
+    if (ppUnk == 0)
+	return E_POINTER;
+
+    // Iterate through the whole list and try to match the class ID.
+    curClass = firstRegisteredClass;
+
+    while (curClass != 0)
+    {
+	// Check if we have a match on the class ID.
+	if (IsEqualGUID(curClass->classIdentifier, rclsid))
+	{
+	    // Since we don't do out-of process or DCOM just right away,
+	    // let's ignore the class context.
+
+	    // We have a match, return the pointer to the class object.
+	    *ppUnk = curClass->classObject;
+
+	    IUnknown_AddRef(curClass->classObject);
+
+	    return S_OK;
+	}
+
+    // Step to the next class in the list.
+    curClass = curClass->nextClass;
+    }
+
+    // If we get to here, we haven't found our class.
+    return S_FALSE;
+}
+
+// ----------------------------------------------------------------------
+// COM_RevokeAllClasses
+// ----------------------------------------------------------------------
+// This method is called when the COM libraries are uninitialized to 
+// release all the references to the class objects registered with
+// the library
+static void COM_RevokeAllClasses()
+{
+    dprintf(("OLE32: COM_RevokeAllClasses"));
+
+    while (firstRegisteredClass != 0)
+    {
+	CoRevokeClassObject(firstRegisteredClass->dwCookie);
+    }
+}
+
+// ----------------------------------------------------------------------
+// COM_ExternalLockAddRef
+// ----------------------------------------------------------------------
+// Method that increments the count for a IUnknown* in the linked 
+// list.  The item is inserted if not already in the list.
+static void COM_ExternalLockAddRef(IUnknown * pUnk)
+{
+    dprintf(("OLE32: COM_ExternalLockAddRef"));
+
+    COM_ExternalLock *externalLock = COM_ExternalLockFind(pUnk);
+
+    /*
+     * Add an external lock to the object. If it was already externally
+     * locked, just increase the reference count. If it was not.
+     * add the item to the list.
+     */
+    if ( externalLock == EL_NOT_FOUND )
+	COM_ExternalLockInsert(pUnk);
+    else
+	externalLock->uRefCount++;
+
+    /*
+     * Add an internal lock to the object
+     */
+    IUnknown_AddRef(pUnk); 
+}
+
+// ----------------------------------------------------------------------
+// COM_ExternalLockRelease
+// ----------------------------------------------------------------------
+// Method that decrements the count for a IUnknown* in the linked 
+// list.  The item is removed from the list if its count end up at zero or if
+// bRelAll is TRUE.
+static void COM_ExternalLockRelease(IUnknown * pUnk, BOOL bRelAll)
+{
+    dprintf(("OLE32: COM_ExternalLockRelease"));
+
+    COM_ExternalLock * externalLock = COM_ExternalLockFind(pUnk);
+
+    if ( externalLock != EL_NOT_FOUND )
+    {
+	do
+	{
+	    externalLock->uRefCount--;  /* release external locks      */
+	    IUnknown_Release(pUnk);     /* release local locks as well */
+
+	    if ( bRelAll == FALSE ) 
+		break;  /* perform single release */
+
+	} while ( externalLock->uRefCount > 0 );  
+
+	if ( externalLock->uRefCount == 0 )  /* get rid of the list entry */
+	    COM_ExternalLockDelete(externalLock);
+    }
+}
+
+// ----------------------------------------------------------------------
+// COM_ExternalLockFreeList
+// ----------------------------------------------------------------------
+// Method that frees the content of the list.
+static void COM_ExternalLockFreeList()
+{
+    dprintf(("OLE32: COM_ExternalLockFreeList"));
+
+    COM_ExternalLock *head;
+
+    head = elList.head;                 /* grab it by the head             */
+    while (head != EL_END_OF_LIST)
+    {
+	COM_ExternalLockDelete(head);     /* get rid of the head stuff       */
+
+	head = elList.head;               /* get the new head...             */ 
+    }
+}
+
+// ----------------------------------------------------------------------
+// COM_ExternalLockDump
+// ----------------------------------------------------------------------
+// Method that dump the content of the list.
+void COM_ExternalLockDump()
+{
+    dprintf(("OLE32: COM_ExternalLockDump"));
+
+    COM_ExternalLock *current = elList.head;
+
+    printf("External lock list:");
+
+    while ( current != EL_END_OF_LIST )
+    {
+	dprintf(("    %p with %lu references count.\n", current->pUnk, current->uRefCount));
+
+	/* Skip to the next item */ 
+	current = current->next;
+    } 
+}
+
+// ----------------------------------------------------------------------
+// COM_ExternalLockFind
+// ----------------------------------------------------------------------
+// Find a IUnknown* in the linked list
+static COM_ExternalLock * COM_ExternalLockFind(IUnknown *pUnk)
+{
+    dprintf(("OLE32: COM_ExternalLockFind"));
+
+    return COM_ExternalLockLocate(elList.head, pUnk);
+}
+
+// ----------------------------------------------------------------------
+// COM_ExternalLockLocate
+// ----------------------------------------------------------------------
+// Recursivity agent for IUnknownExternalLockList_Find
+static COM_ExternalLock * COM_ExternalLockLocate( COM_ExternalLock * element, IUnknown * pUnk)
+{
+  if ( element == EL_END_OF_LIST )  
+    return EL_NOT_FOUND;
+
+  else if ( element->pUnk == pUnk )    /* We found it */
+    return element;
+
+  else                                 /* Not the right guy, keep on looking */ 
+    return COM_ExternalLockLocate( element->next, pUnk);
+}
+
+// ----------------------------------------------------------------------
+// COM_ExternalLockInsert
+// ----------------------------------------------------------------------
+// Insert a new IUnknown* to the linked list
+static BOOL COM_ExternalLockInsert(IUnknown * pUnk)
+{
+    dprintf(("OLE32: COM_ExternalLockInsert"));
+
+    COM_ExternalLock *	newLock      = NULL;
+    COM_ExternalLock *	previousHead = NULL;
+
+    // Allocate space for the new storage object
+    newLock = (COM_ExternalLock *)HeapAlloc(GetProcessHeap(), 0, sizeof(COM_ExternalLock));
+
+    if (newLock != NULL)
+    {
+	if ( elList.head == EL_END_OF_LIST ) 
+	    elList.head = newLock;    /* The list is empty */
+	else 
+	{
+	    // insert does it at the head
+	    previousHead  = elList.head;
+	    elList.head = newLock;
+	}
+
+	/*
+	 * Set new list item data member 
+	 */
+	newLock->pUnk      = pUnk;
+	newLock->uRefCount = 1;
+	newLock->next      = previousHead;
+
+	return TRUE;
+    }
+
+    return FALSE;
+}
+
+// ----------------------------------------------------------------------
+// ExternalLockDelete
+// ----------------------------------------------------------------------
+// Method that removes an item from the linked list.
+static void COM_ExternalLockDelete(COM_ExternalLock * itemList)
+{
+    dprintf(("OLE32: ExternalLockDelete"));
+
+    COM_ExternalLock *current = elList.head;
+
+    if ( current == itemList )
+    {
+	// this section handles the deletion of the first node 
+	elList.head = itemList->next;
+	HeapFree( GetProcessHeap(), 0, itemList);  
+    }
+    else
+    {
+	do 
+	{
+	    if ( current->next == itemList )   /* We found the item to free  */
+	    {
+		current->next = itemList->next;  /* readjust the list pointers */
+
+		HeapFree( GetProcessHeap(), 0, itemList);  
+		break; 
+	    }
+
+	    /* Skip to the next item */ 
+	    current = current->next;
+
+	} while ( current != EL_END_OF_LIST );
+    }
+}
Index: trunk/src/ole32/stubs.cpp
===================================================================
--- trunk/src/ole32/stubs.cpp	(revision 290)
+++ trunk/src/ole32/stubs.cpp	(revision 291)
@@ -1,27 +1,18 @@
-/*
- *
+/* 
+ * 
  * Project Odin Software License can be found in LICENSE.TXT
- *
+ * 
  */
-/*
- * Win32 OLE stubs for OS/2
- *
- * 1998/06/12
- *
+/* 
+ * Win32 COM/OLE stubs for OS/2
+ * 
+ * 1/7/99
+ * 
+ * Copyright 1999 David J. Raison
  * Copyright 1998 Sander van Leeuwen
+ * 
  */
 
 #include "ole32.h"
-
-
-// ----------------------------------------------------------------------
-// CoCreateGuid()
-// ----------------------------------------------------------------------
-HRESULT WIN32API CoCreateGuid(GUID *pguid)
-{
-   dprintf(("OLE32.CoCreateGuid\n"));
-   memset(pguid, 0, sizeof(GUID));      //TODO: should be random GUID
-   return S_OK;
-}
 
 //*****************************************************************************
@@ -30,15 +21,6 @@
                                                   LPUNKNOWN *ppunkMarshaler)
 {
-   dprintf(("CoCreateFreeThreadedMarshaler- stub\n"));
-   return E_OUTOFMEMORY;
-}
-//*****************************************************************************
-//*****************************************************************************
-HRESULT WIN32API CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
-                                     DWORD dwClsContext, REFIID riid,
-                                     LPVOID *ppv)
-{
-   dprintf(("CoCreateInstance - stub\n"));
-   return REGDB_E_CLASSNOTREG;
+    dprintf(("OLE32: CoCreateFreeThreadedMarshaler- stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -46,32 +28,6 @@
 HRESULT WIN32API CoDisconnectObject(IUnknown *pUnk, DWORD dwReserved)
 {
-   dprintf(("CoDisconnectObject - stub\n"));
-   return S_OK;
-}
-//*******************************************************************************
-//*******************************************************************************
-BOOL WIN32API CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime,
-                                         FILETIME *lpFileTime)
-{
-   dprintf(("CoDosDateTimeToFileTime, redundant\n"));
-   return DosDateTimeToFileTime(nDosDate, nDosTime, lpFileTime);
-}
-//*******************************************************************************
-//*******************************************************************************
-HRESULT WIN32API CoFileTimeNow(FILETIME *lpFileTime)
-{
- SYSTEMTIME systime;
-
-   dprintf(("CoFileTimeNow\n"));
-   GetSystemTime(&systime);
-   return SystemTimeToFileTime(&systime, lpFileTime);
-}
-//*******************************************************************************
-//*******************************************************************************
-BOOL WIN32API CoFileTimeToDosDateTime(FILETIME *lpFileTime, LPWORD lpDosDate,
-                                         LPWORD lpDosTime)
-{
-   dprintf(("CoFileTimeToDosDateTime\n"));
-   return FileTimeToDosDateTime(lpFileTime, lpDosDate, lpDosTime);
+    dprintf(("OLE32: CoDisconnectObject - stub"));
+    return S_OK;
 }
 //*******************************************************************************
@@ -80,6 +36,6 @@
 void WIN32API CoFreeAllLibraries()
 {
-   dprintf(("CoFreeAllLibraries - stub\n"));
-   return ;
+    dprintf(("OLE32: CoFreeAllLibraries - stub"));
+    return ;
 }
 //*******************************************************************************
@@ -87,5 +43,5 @@
 void WIN32API CoFreeLibrary(HINSTANCE hInst)
 {
-   dprintf(("CoFreeLibrary\n"));
+    dprintf(("OLE32: CoFreeLibrary"));
    FreeLibrary(hInst);
 }
@@ -94,6 +50,6 @@
 void WIN32API CoFreeUnusedLibraries()
 {
-   dprintf(("CoFreeUnusedLibraries - stub\n"));
-   return ;
+    dprintf(("OLE32: CoFreeUnusedLibraries - stub"));
+    return ;
 }
 //*******************************************************************************
@@ -101,14 +57,6 @@
 HRESULT WIN32API CoGetCallerTID()
 {
-   dprintf(("CoGetCallerTID, UNKNOWN API - stub\n"));
-   return 0;
-}
-//*******************************************************************************
-//*******************************************************************************
-//HRESULT WIN32API CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID riid, LPVOID *ppv)
-HRESULT WIN32API CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, LPVOID pServerInfo, REFIID riid, LPVOID *ppv)
-{
-   dprintf(("CoGetClassObject - stub\n"));
-   return REGDB_E_CLASSNOTREG;
+    dprintf(("OLE32: CoGetCallerTID, UNKNOWN API - stub"));
+    return 0;
 }
 //*******************************************************************************
@@ -116,6 +64,6 @@
 HRESULT WIN32API CoGetCurrentLogicalThreadId()
 {
-   dprintf(("CoGetCurrentLogicalThreadId, UNKNOWN API - stub\n"));
-   return 0;
+    dprintf(("OLE32: CoGetCurrentLogicalThreadId, UNKNOWN API - stub"));
+    return 0;
 }
 //*******************************************************************************
@@ -123,6 +71,6 @@
 DWORD WIN32API CoGetCurrentProcess()
 {
-   dprintf(("CoGetCurrentProcess - stub\n"));
-   return 666;
+    dprintf(("OLE32: CoGetCurrentProcess - stub"));
+    return 666;
 }
 //*******************************************************************************
@@ -131,13 +79,6 @@
                                                    LPVOID *ppv)
 {
-   dprintf(("CoGetInterfaceAndReleaseStream - stub\n"));
-   return E_INVALIDARG;
-}
-//*******************************************************************************
-//*******************************************************************************
-HRESULT WIN32API CoGetMalloc(DWORD dwMemContext, LPMALLOC *ppMalloc)
-{
-   dprintf(("CoGetMalloc - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CoGetInterfaceAndReleaseStream - stub"));
+    return E_INVALIDARG;
 }
 //*******************************************************************************
@@ -147,6 +88,6 @@
                                         DWORD mshlflags)
 {
-   dprintf(("CoGetMarshalSizeMax - stub\n"));
-   return CO_E_NOTINITIALIZED;
+    dprintf(("OLE32: CoGetMarshalSizeMax - stub"));
+    return CO_E_NOTINITIALIZED;
 }
 //*******************************************************************************
@@ -154,6 +95,6 @@
 HRESULT WIN32API CoGetPSClsid(REFIID riid, CLSID *pclsid)
 {
-   dprintf(("CoGetPSClsid - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CoGetPSClsid - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -163,6 +104,6 @@
                                          LPMARSHAL *ppMarshal)
 {
-   dprintf(("CoGetStandardMarshal - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CoGetStandardMarshal - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -170,6 +111,6 @@
 HRESULT WIN32API CoGetState()
 {
-   dprintf(("CoGetState, UNKNOWN API - stub\n"));
-   return 0;
+    dprintf(("OLE32: CoGetState, UNKNOWN API - stub"));
+    return 0;
 }
 //*******************************************************************************
@@ -177,6 +118,6 @@
 HRESULT WIN32API CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pclsidNew)
 {
-   dprintf(("CoGetTreatAsClass - stub\n"));
-   return S_FALSE;
+    dprintf(("OLE32: CoGetTreatAsClass - stub"));
+    return S_FALSE;
 }
 //*******************************************************************************
@@ -184,6 +125,6 @@
 HRESULT WIN32API CoInitializeWOW()
 {
-   dprintf(("CoInitializeWOW, UNKNOWN API - stub\n"));
-   return 0;
+    dprintf(("OLE32: CoInitializeWOW, UNKNOWN API - stub"));
+    return 0;
 }
 //*******************************************************************************
@@ -191,6 +132,6 @@
 BOOL WIN32API CoIsHandlerConnected(LPUNKNOWN pUnk)
 {
-   dprintf(("CoIsHandlerConnected - stub\n"));
-   return FALSE;
+    dprintf(("OLE32: CoIsHandlerConnected - stub"));
+    return FALSE;
 }
 //*******************************************************************************
@@ -198,6 +139,6 @@
 BOOL WIN32API CoIsOle1Class(REFCLSID rclsid)
 {
-   dprintf(("CoIsOle1Class - stub\n"));
-   return S_FALSE;
+    dprintf(("OLE32: CoIsOle1Class - stub"));
+    return S_FALSE;
 }
 //*******************************************************************************
@@ -205,6 +146,6 @@
 HINSTANCE WIN32API CoLoadLibrary(LPSTR lpszLibName, BOOL bAutoFree)
 {
-   dprintf(("CoLoadLibrary\n"));
-   return LoadLibraryA(lpszLibName);
+    dprintf(("OLE32: CoLoadLibrary"));
+    return LoadLibraryA(lpszLibName);
 }
 //*******************************************************************************
@@ -212,6 +153,6 @@
 HRESULT WIN32API CoLockObjectExternal(IUnknown *pUnk, BOOL fLock, BOOL fLastUnlockReleases)
 {
-   dprintf(("CoLockObjectExternal - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CoLockObjectExternal - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -219,6 +160,6 @@
 HRESULT WIN32API CoMarshalHresult(IStream *pStm, HRESULT hresult)
 {
-   dprintf(("CoMarshalHresult - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CoMarshalHresult - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -228,6 +169,6 @@
                                                           LPSTREAM *ppStm)
 {
-   dprintf(("CoMarshalInterThreadInterfaceInStream - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CoMarshalInterThreadInterfaceInStream - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -237,6 +178,6 @@
                                        DWORD mshlflags)
 {
-   dprintf(("CoMarshalInterface - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CoMarshalInterface - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -244,6 +185,6 @@
 HRESULT WIN32API CoQueryReleaseObject()
 {
-   dprintf(("CoQueryReleaseObject, UNKNOWN API - stub\n"));
-   return 0;
+    dprintf(("OLE32: CoQueryReleaseObject, UNKNOWN API - stub"));
+    return 0;
 }
 //*******************************************************************************
@@ -253,6 +194,6 @@
                                           LPDWORD lpdwRegister)
 {
-   dprintf(("CoRegisterClassObject - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CoRegisterClassObject - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -260,6 +201,6 @@
 HRESULT WIN32API CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
 {
-   dprintf(("CoRegisterMallocSpy - stub\n"));
-   return CO_E_OBJISREG;
+    dprintf(("OLE32: CoRegisterMallocSpy - stub"));
+    return CO_E_OBJISREG;
 }
 //*******************************************************************************
@@ -268,6 +209,6 @@
                                             LPMESSAGEFILTER *lplpMessageFilter)
 {
-   dprintf(("CoRegisterMessageFilter - stub\n"));
-   return S_FALSE;
+    dprintf(("OLE32: CoRegisterMessageFilter - stub"));
+    return S_FALSE;
 }
 //*******************************************************************************
@@ -275,6 +216,6 @@
 HRESULT WIN32API CoReleaseMarshalData(IStream *pStm)
 {
-   dprintf(("CoReleaseMarshalData - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CoReleaseMarshalData - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -282,6 +223,6 @@
 HRESULT WIN32API CoRevokeClassObject(DWORD dwRegister)
 {
-   dprintf(("CoRevokeClassObject - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CoRevokeClassObject - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -289,6 +230,6 @@
 HRESULT WIN32API CoRevokeMallocSpy()
 {
-   dprintf(("CoRevokeMallocSpy - stub\n"));
-   return E_ACCESSDENIED;
+    dprintf(("OLE32: CoRevokeMallocSpy - stub"));
+    return E_ACCESSDENIED;
 }
 //*******************************************************************************
@@ -296,42 +237,14 @@
 HRESULT WIN32API CoSetState()
 {
-   dprintf(("CoSetState, UNKNOWN API - stub\n"));
-   return 0;
-}
-//*******************************************************************************
-//*******************************************************************************
-LPVOID WIN32API CoTaskMemAlloc(ULONG cb)
-{
-   dprintf(("CoTaskMemAlloc\n"));
-   return malloc(cb);
-}
-//*******************************************************************************
-//*******************************************************************************
-void WIN32API CoTaskMemFree(void *pv)
-{
-   dprintf(("CoTaskMemFree\n"));
-   free(pv);
-   return;
-}
-//*******************************************************************************
-//*******************************************************************************
-LPVOID WIN32API CoTaskMemRealloc(LPVOID pv, ULONG cb)
-{
-   dprintf(("CoTaskMemRealloc - stub\n"));
-   return NULL;
-}
+    dprintf(("OLE32: CoSetState, UNKNOWN API - stub"));
+    return 0;
+}
+
 //*******************************************************************************
 //*******************************************************************************
 HRESULT WIN32API CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
 {
-   dprintf(("CoTreatAsClass - stub\n"));
-   return E_INVALIDARG;
-}
-//*******************************************************************************
-//*******************************************************************************
-void WIN32API CoUninitialize()
-{
-   dprintf(("CoUninitialize - stub\n"));
-   return ;
+    dprintf(("OLE32: CoTreatAsClass - stub"));
+    return E_INVALIDARG;
 }
 //*******************************************************************************
@@ -339,6 +252,6 @@
 void WIN32API CoUnloadingWOW()
 {
-   dprintf(("CoUnloadingWOW, UNKNOWN API - stub\n"));
-   return ;
+    dprintf(("OLE32: CoUnloadingWOW, UNKNOWN API - stub"));
+    return ;
 }
 //*******************************************************************************
@@ -346,6 +259,6 @@
 HRESULT WIN32API CoUnmarshalHresult(LPSTREAM pStm, HRESULT *phresult)
 {
-   dprintf(("CoUnmarshalHresult - stub\n"));
-   return S_OK;
+    dprintf(("OLE32: CoUnmarshalHresult - stub"));
+    return S_OK;
 }
 //*******************************************************************************
@@ -353,6 +266,6 @@
 HRESULT WIN32API CoUnmarshalInterface(IStream *pSTm, REFIID riid, void **ppv)
 {
-   dprintf(("CoUnmarshalInterface - stub\n"));
-   return S_OK;
+    dprintf(("OLE32: CoUnmarshalInterface - stub"));
+    return S_OK;
 }
 
@@ -361,5 +274,5 @@
 void WIN32API OleUninitialize(void)
 {
-  dprintf(("OleUninitialize - stub\n"));
+  dprintf(("OLE32: OleUninitialize - stub"));
   return;
 }
@@ -369,6 +282,6 @@
                                 LPVOID *ppvResult)
 {
-   dprintf(("BindMoniker- stub\n"));
-   return MK_E_NOOBJECT;
+    dprintf(("OLE32: BindMoniker- stub"));
+    return MK_E_NOOBJECT;
 }
 //*******************************************************************************
@@ -376,6 +289,6 @@
 HRESULT WIN32API CreateAntiMoniker(LPMONIKER *ppmk)
 {
-   dprintf(("CreateAntiMoniker - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreateAntiMoniker - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -383,6 +296,6 @@
 HRESULT WIN32API CreateBindCtx(DWORD reserved, LPBC *ppbc)
 {
-   dprintf(("CreateBindCtx - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreateBindCtx - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -390,6 +303,6 @@
 HRESULT WIN32API CreateDataAdviseHolder(IDataAdviseHolder **ppDAHolder)
 {
-   dprintf(("CreateDataAdviseHolder - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreateDataAdviseHolder - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -398,6 +311,6 @@
                                     REFIID riid, LPVOID *ppvObj)
 {
-   dprintf(("CreateDataCache - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreateDataCache - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -405,6 +318,6 @@
 HRESULT WIN32API CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER *ppmk)
 {
-   dprintf(("CreateFileMoniker - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreateFileMoniker - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -413,6 +326,6 @@
                                            LPMONIKER *ppmkComposite)
 {
-   dprintf(("CreateGenericComposite - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreateGenericComposite - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -421,6 +334,6 @@
                                               ILockBytes **ppkLkbyt)
 {
-   dprintf(("CreateILockBytesOnHGlobal - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreateILockBytesOnHGlobal - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -428,6 +341,6 @@
 HRESULT WIN32API CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER *ppmk)
 {
-   dprintf(("CreateItemMoniker - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreateItemMoniker - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -435,6 +348,6 @@
 HRESULT WIN32API CreateOleAdviseHolder(IOleAdviseHolder ppOAHolder)
 {
-   dprintf(("CreateOleAdviseHolder - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreateOleAdviseHolder - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -442,6 +355,6 @@
 HRESULT WIN32API CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER *ppmk)
 {
-   dprintf(("CreatePointerMoniker - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreatePointerMoniker - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -450,6 +363,6 @@
                                           LPSTREAM *ppstm)
 {
-   dprintf(("CreateStreamOnHGlobal - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: CreateStreamOnHGlobal - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -457,6 +370,6 @@
 HRESULT WIN32API DllDebugObjectRPCHook()
 {
-   dprintf(("DllDebugObjectRPCHook, UNKNOWN API - stub\n"));
-   return 0;
+    dprintf(("OLE32: DllDebugObjectRPCHook, UNKNOWN API - stub"));
+    return 0;
 }
 //*******************************************************************************
@@ -464,6 +377,6 @@
 HRESULT WIN32API DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
 {
-   dprintf(("DllGetClassObject - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: DllGetClassObject - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -471,6 +384,6 @@
 HRESULT WIN32API DllGetClassObjectWOW()
 {
-   dprintf(("DllGetClassObjectWOW, UNKNOWN API - stub\n"));
-   return 0;
+    dprintf(("OLE32: DllGetClassObjectWOW, UNKNOWN API - stub"));
+    return 0;
 }
 //*******************************************************************************
@@ -479,6 +392,6 @@
                                DWORD dwOKEffect, DWORD *pdwEffect)
 {
-   dprintf(("DoDragDrop - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: DoDragDrop - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -486,6 +399,6 @@
 HRESULT WIN32API EnableHookObject()
 {
-   dprintf(("EnableHookObject, UNKNOWN API - stub\n"));
-   return 0;
+    dprintf(("OLE32: EnableHookObject, UNKNOWN API - stub"));
+    return 0;
 }
 //*******************************************************************************
@@ -493,6 +406,6 @@
 HRESULT WIN32API GetClassFile(LPCWSTR szFileName, CLSID *pclsid)
 {
-   dprintf(("GetClassFile - stub\n"));
-   return MK_E_CANTOPENFILE;
+    dprintf(("OLE32: GetClassFile - stub"));
+    return MK_E_CANTOPENFILE;
 }
 //*******************************************************************************
@@ -500,6 +413,6 @@
 HRESULT WIN32API GetConvertStg(IStorage *pStg)
 {
-   dprintf(("GetConvertStg - stub\n"));
-   return STG_E_ACCESSDENIED;
+    dprintf(("OLE32: GetConvertStg - stub"));
+    return STG_E_ACCESSDENIED;
 }
 //*******************************************************************************
@@ -507,6 +420,6 @@
 HRESULT WIN32API GetDocumentBitStg()
 {
-   dprintf(("GetDocumentBitStg, UNKNOWN API - stub\n"));
-   return 0;
+    dprintf(("OLE32: GetDocumentBitStg, UNKNOWN API - stub"));
+    return 0;
 }
 //*******************************************************************************
@@ -514,6 +427,6 @@
 HRESULT WIN32API GetHGlobalFromILockBytes(ILockBytes *pLkbyt, HGLOBAL *phglobal)
 {
-   dprintf(("GetHGlobalFromILockBytes - stub\n"));
-   return E_INVALIDARG;
+    dprintf(("OLE32: GetHGlobalFromILockBytes - stub"));
+    return E_INVALIDARG;
 }
 //*******************************************************************************
@@ -521,6 +434,6 @@
 HRESULT WIN32API GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
 {
-   dprintf(("GetHGlobalFromStream - stub\n"));
-   return E_INVALIDARG;
+    dprintf(("OLE32: GetHGlobalFromStream - stub"));
+    return E_INVALIDARG;
 }
 //*******************************************************************************
@@ -528,21 +441,6 @@
 HRESULT WIN32API GetHookInterface()
 {
-   dprintf(("GetHookInterface, UNKNOWN API - stub\n"));
-   return 0;
-}
-//*******************************************************************************
-//*******************************************************************************
-//HRESULT WIN32API GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot)
-HRESULT WIN32API GetRunningObjectTable(DWORD reserved, LPVOID *pprot)
-{
-   dprintf(("GetRunningObjectTable - stub\n"));
-   return E_UNEXPECTED;
-}
-//*******************************************************************************
-//*******************************************************************************
-HRESULT WIN32API IIDFromString(LPSTR lpsz, LPIID lpiid)
-{
-   dprintf(("IIDFromString - stub\n"));
-   return E_INVALIDARG;
+    dprintf(("OLE32: GetHookInterface, UNKNOWN API - stub"));
+    return 0;
 }
 //*******************************************************************************
@@ -551,6 +449,6 @@
                                WORD *lpwCmd)
 {
-   dprintf(("IsAccelerator - stub\n"));
-   return FALSE;
+    dprintf(("OLE32: IsAccelerator - stub"));
+    return FALSE;
 }
 //*******************************************************************************
@@ -558,6 +456,6 @@
 BOOL WIN32API CONCRETE_IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
 {
-   dprintf(("IsEqualGUID - stub\n"));
-   return FALSE;
+    dprintf(("OLE32: IsEqualGUID - stub"));
+    return FALSE;
 }
 //*******************************************************************************
@@ -565,13 +463,6 @@
 HRESULT WIN32API IsValidIid(DWORD Iid)
 {
-   dprintf(("IsValidIid, obsolete - stub\n"));
-   return E_INVALIDARG;
-}
-//*******************************************************************************
-//*******************************************************************************
-HRESULT WIN32API IsValidInterface(DWORD interface_)
-{
-   dprintf(("IsValidInterface, obsolete - stub\n"));
-   return E_INVALIDARG;
+    dprintf(("OLE32: IsValidIid, obsolete - stub"));
+    return E_INVALIDARG;
 }
 //*******************************************************************************
@@ -579,6 +470,6 @@
 HRESULT WIN32API IsValidPtrIn(DWORD ptrIn)
 {
-   dprintf(("IsValidPtrIn, obsolete - stub\n"));
-   return E_INVALIDARG;
+    dprintf(("OLE32: IsValidPtrIn, obsolete - stub"));
+    return E_INVALIDARG;
 }
 //*******************************************************************************
@@ -586,6 +477,6 @@
 HRESULT WIN32API IsValidPtrOut(DWORD ptrOut)
 {
-   dprintf(("IsValidPtrOut, obsolete - stub\n"));
-   return E_INVALIDARG;
+    dprintf(("OLE32: IsValidPtrOut, obsolete - stub"));
+    return E_INVALIDARG;
 }
 //*******************************************************************************
@@ -594,6 +485,6 @@
                                         LPMONIKER *ppmk)
 {
-   dprintf(("MkParseDisplayName - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: MkParseDisplayName - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -602,6 +493,6 @@
                                             LPMONIKER *ppmkCommon)
 {
-   dprintf(("MonikerCommonPrefixWith - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: MonikerCommonPrefixWith - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -610,6 +501,6 @@
                                           LPMONIKER *ppmkRelPath, BOOL dwReserved )
 {
-   dprintf(("MonikerRelativePathTo - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: MonikerRelativePathTo - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -617,6 +508,6 @@
 DWORD WIN32API OleBuildVersion()
 {
-   dprintf(("OleBuildVersion, obsolete - stub\n"));
-   return 666;
+    dprintf(("OLE32: OleBuildVersion, obsolete - stub"));
+    return 666;
 }
 //*******************************************************************************
@@ -624,6 +515,6 @@
 HRESULT WIN32API OleConvertIStorageToOLESTREAM(IStorage *pStg, LPOLESTREAM lpolestream)
 {
-   dprintf(("OleConvertIStorageToOLESTREAM - stub\n"));
-   return E_INVALIDARG;
+    dprintf(("OLE32: OleConvertIStorageToOLESTREAM - stub"));
+    return E_INVALIDARG;
 }
 //*******************************************************************************
@@ -637,6 +528,6 @@
 						 LPOLESTREAM	lpolestream)
 {
-   dprintf(("OleConvertIStorageToOLESTREAMEx - stub\n"));
-   return(E_INVALIDARG);
+    dprintf(("OLE32: OleConvertIStorageToOLESTREAMEx - stub"));
+    return(E_INVALIDARG);
 }
 //*******************************************************************************
@@ -646,6 +537,6 @@
                                                   const DVTARGETDEVICE *ptd)
 {
-   dprintf(("OleConvertOLESTREAMToIStorage - stub\n"));
-   return(E_INVALIDARG);
+    dprintf(("OLE32: OleConvertOLESTREAMToIStorage - stub"));
+    return(E_INVALIDARG);
 }
 //*******************************************************************************
@@ -659,6 +550,6 @@
                                                  LPSTGMEDIUM	pmedium)
 {
-   dprintf(("OleConvertOLESTREAMToIStorageEx - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleConvertOLESTREAMToIStorageEx - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -668,6 +559,6 @@
                               IStorage *pStg, void **ppvObject)
 {
-   dprintf(("OleCreate - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleCreate - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -676,6 +567,6 @@
                                             REFIID riid, LPVOID *ppvObj)
 {
-   dprintf(("OleCreateDefaultHandler - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleCreateDefaultHandler - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -685,6 +576,6 @@
                                              REFIID riid, LPVOID *ppvObj)
 {
-   dprintf(("OleCreateEmbeddingHelper - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleCreateEmbeddingHelper - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -695,6 +586,6 @@
                                       LPVOID *ppvObj)
 {
-   dprintf(("OleCreateFromData - stub\n"));
-   return(DV_E_FORMATETC);
+    dprintf(("OLE32: OleCreateFromData - stub"));
+    return(DV_E_FORMATETC);
 }
 //*******************************************************************************
@@ -706,6 +597,6 @@
                                       LPVOID *ppvObj)
 {
-   dprintf(("OleCreateFromFile - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleCreateFromFile - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -716,6 +607,6 @@
                                   LPVOID *ppvObj)
 {
-   dprintf(("OleCreateLink - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleCreateLink - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -726,6 +617,6 @@
                                           LPVOID *ppvObj)
 {
-   dprintf(("OleCreateLinkFromData - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleCreateLinkFromData - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -735,6 +626,6 @@
                                         IStorage *pStg, void **ppvObj)
 {
-   dprintf(("OleCreateLinkToFile - stub\n"));
-   return(STG_E_FILENOTFOUND);
+    dprintf(("OLE32: OleCreateLinkToFile - stub"));
+    return(STG_E_FILENOTFOUND);
 }
 //*******************************************************************************
@@ -742,6 +633,6 @@
 HOLEMENU WIN32API OleCreateMenuDescriptor(HMENU hmenuCombined, LPOLEMENUGROUPWIDTHS lpMenuWidths)
 {
-   dprintf(("OleCreateMenuDescriptor - stub\n"));
-   return(NULL);
+    dprintf(("OLE32: OleCreateMenuDescriptor - stub"));
+    return(NULL);
 }
 //*******************************************************************************
@@ -752,6 +643,6 @@
                                             LPVOID *ppvObj)
 {
-   dprintf(("OleCreateStaticFromData - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleCreateStaticFromData - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -759,6 +650,6 @@
 HRESULT WIN32API OleDestroyMenuDescriptor(HOLEMENU holemenu)
 {
-   dprintf(("OleDestroyMenuDescriptor - stub\n"));
-   return E_OUTOFMEMORY;
+    dprintf(("OLE32: OleDestroyMenuDescriptor - stub"));
+    return E_OUTOFMEMORY;
 }
 //*******************************************************************************
@@ -766,6 +657,6 @@
 HRESULT WIN32API OleDoAutoConvert(IStorage *pStg, LPCLSID pClsidNew)
 {
-   dprintf(("OleDoAutoConvert - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleDoAutoConvert - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -774,6 +665,6 @@
                             LPCRECT lprcBounds)
 {
-   dprintf(("OleDraw - stub\n"));
-   return(E_INVALIDARG);
+    dprintf(("OLE32: OleDraw - stub"));
+    return(E_INVALIDARG);
 }
 //*******************************************************************************
@@ -781,6 +672,6 @@
 HANDLE WIN32API OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat, UINT uiFlags)
 {
-   dprintf(("OleDuplicateData - stub\n"));
-   return(NULL);
+    dprintf(("OLE32: OleDuplicateData - stub"));
+    return(NULL);
 }
 //*******************************************************************************
@@ -788,6 +679,6 @@
 HRESULT WIN32API OleFlushClipboard()
 {
-   dprintf(("OleFlushClipboard - stub\n"));
-   return(S_OK);
+    dprintf(("OLE32: OleFlushClipboard - stub"));
+    return(S_OK);
 }
 //*******************************************************************************
@@ -795,6 +686,6 @@
 HRESULT WIN32API OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)
 {
-   dprintf(("OleGetAutoConvert - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleGetAutoConvert - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -802,6 +693,6 @@
 HRESULT WIN32API OleGetClipboard(IDataObject **ppDataObj)
 {
-   dprintf(("OleGetClipboard - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleGetClipboard - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -809,6 +700,6 @@
 HGLOBAL WIN32API OleGetIconOfClass(REFCLSID rclsid, LPOLESTR lpszLabel, BOOL fUseTypeAsLabel)
 {
-   dprintf(("OleGetIconOfClass - stub\n"));
-   return(NULL);
+    dprintf(("OLE32: OleGetIconOfClass - stub"));
+    return(NULL);
 }
 //*******************************************************************************
@@ -816,6 +707,6 @@
 HGLOBAL WIN32API OleGetIconOfFile(LPOLESTR lpszPath, BOOL fUseTypeAsLabel)
 {
-   dprintf(("OleGetIconOfFile - stub\n"));
-   return(NULL);
+    dprintf(("OLE32: OleGetIconOfFile - stub"));
+    return(NULL);
 }
 //*******************************************************************************
@@ -823,7 +714,7 @@
 HRESULT WIN32API OleInitialize(LPVOID pvReserved)
 {
-   dprintf(("OleInitialize - stub\n"));
+    dprintf(("OLE32: OleInitialize - stub"));
 //   return(E_OUTOFMEMORY);
-   return(0);
+    return(0);
 }
 //*******************************************************************************
@@ -831,6 +722,6 @@
 HRESULT WIN32API OleInitializeWOW()
 {
-   dprintf(("OleInitializeWOW, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleInitializeWOW, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -838,6 +729,6 @@
 HRESULT WIN32API OleIsCurrentClipboard(IDataObject *pDataObject)
 {
-   dprintf(("OleIsCurrentClipboard - stub\n"));
-   return(S_FALSE);
+    dprintf(("OLE32: OleIsCurrentClipboard - stub"));
+    return(S_FALSE);
 }
 //*******************************************************************************
@@ -845,6 +736,6 @@
 BOOL WIN32API OleIsRunning(LPOLEOBJECT pObject)
 {
-   dprintf(("OleIsRunning - stub\n"));
-   return(FALSE);
+    dprintf(("OLE32: OleIsRunning - stub"));
+    return(FALSE);
 }
 //*******************************************************************************
@@ -853,6 +744,6 @@
                             LPVOID *ppvObj)
 {
-   dprintf(("OleLoad - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleLoad - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -860,6 +751,6 @@
 HRESULT WIN32API OleLoadFromStream(IStream *pStm, REFIID riid, void *ppvObj)
 {
-   dprintf(("OleLoadFromStream - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleLoadFromStream - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -867,6 +758,6 @@
 HRESULT WIN32API OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses)
 {
-   dprintf(("OleLockRunning - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleLockRunning - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -876,6 +767,6 @@
                                                     UINT iIconIndex)
 {
-   dprintf(("OleMetafilePictFromIconAndLabel - stub\n"));
-   return(NULL);
+    dprintf(("OLE32: OleMetafilePictFromIconAndLabel - stub"));
+    return(NULL);
 }
 //*******************************************************************************
@@ -883,6 +774,6 @@
 HRESULT WIN32API OleNoteObjectVisible(LPUNKNOWN pUnknown, BOOL fVisible)
 {
-   dprintf(("OleNoteObjectVisible - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleNoteObjectVisible - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -890,6 +781,6 @@
 HRESULT WIN32API OleQueryCreateFromData(IDataObject *pSrcDataObject)
 {
-   dprintf(("OleQueryCreateFromData - stub\n"));
-   return(S_FALSE);
+    dprintf(("OLE32: OleQueryCreateFromData - stub"));
+    return(S_FALSE);
 }
 //*******************************************************************************
@@ -897,6 +788,6 @@
 HRESULT WIN32API OleQueryLinkFromData(IDataObject *pSrcDataObject)
 {
-   dprintf(("OleQueryLinkFromData - stub\n"));
-   return(S_FALSE);
+    dprintf(("OLE32: OleQueryLinkFromData - stub"));
+    return(S_FALSE);
 }
 //*******************************************************************************
@@ -905,6 +796,6 @@
                                         LPENUMFORMATETC *ppenumFormatetc)
 {
-   dprintf(("OleRegEnumFormatEtc - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleRegEnumFormatEtc - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -912,6 +803,6 @@
 HRESULT WIN32API OleRegEnumVerbs(REFCLSID clsid, LPENUMOLEVERB *ppenumOleVerb)
 {
-   dprintf(("OleRegEnumVerbs - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleRegEnumVerbs - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -919,6 +810,6 @@
 HRESULT WIN32API OleRegGetMiscStatus(REFCLSID clsid, DWORD dwAspect, DWORD *pdwStatus)
 {
-   dprintf(("OleRegGetMiscStatus - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleRegGetMiscStatus - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -927,6 +818,6 @@
                                       LPOLESTR *pszUserType)
 {
-   dprintf(("OleRegGetUserType - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleRegGetUserType - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -934,6 +825,6 @@
 HRESULT WIN32API OleRun(LPUNKNOWN pUnknown)
 {
-   dprintf(("OleRun - stub\n"));
-   return(E_UNEXPECTED);
+    dprintf(("OLE32: OleRun - stub"));
+    return(E_UNEXPECTED);
 }
 //*******************************************************************************
@@ -941,6 +832,6 @@
 HRESULT WIN32API OleSave(IPersistStorage *pPS, IStorage *pStg, BOOL fSameAsLoad)
 {
-   dprintf(("OleSave - stub\n"));
-   return(STG_E_MEDIUMFULL);
+    dprintf(("OLE32: OleSave - stub"));
+    return(STG_E_MEDIUMFULL);
 }
 //*******************************************************************************
@@ -948,6 +839,6 @@
 HRESULT WIN32API OleSaveToStream(IPersistStorage *pPS, IStream *pStm)
 {
-   dprintf(("OleSaveToStream - stub\n"));
-   return(STG_E_MEDIUMFULL);
+    dprintf(("OLE32: OleSaveToStream - stub"));
+    return(STG_E_MEDIUMFULL);
 }
 //*******************************************************************************
@@ -955,6 +846,6 @@
 HRESULT WIN32API OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew)
 {
-   dprintf(("OleSetAutoConvert - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleSetAutoConvert - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -962,6 +853,6 @@
 HRESULT WIN32API OleSetClipboard(IDataObject *pDataObj)
 {
-   dprintf(("OleSetClipboard - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleSetClipboard - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -969,6 +860,6 @@
 HRESULT WIN32API OleSetContainedObject(LPUNKNOWN pUnknown, BOOL fContained)
 {
-   dprintf(("OleSetContainedObject - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OleSetContainedObject - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -979,6 +870,6 @@
                                          LPOLEINPLACEACTIVEOBJECT lpActiveObj)
 {
-   dprintf(("OleSetMenuDescriptor - stub\n"));
-   return(E_FAIL);
+    dprintf(("OLE32: OleSetMenuDescriptor - stub"));
+    return(E_FAIL);
 }
 //*******************************************************************************
@@ -988,6 +879,6 @@
                                             LPMSG lpmsg)
 {
-   dprintf(("OleTranslateAccelerator - stub\n"));
-   return(S_FALSE);
+    dprintf(("OLE32: OleTranslateAccelerator - stub"));
+    return(S_FALSE);
 }
 //*******************************************************************************
@@ -995,6 +886,6 @@
 HRESULT WIN32API OpenOrCreateStream()
 {
-   dprintf(("OpenOrCreateStream, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: OpenOrCreateStream, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1002,6 +893,6 @@
 HRESULT WIN32API ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID)
 {
-   dprintf(("ProgIDFromCLSID - stub\n"));
-   return(REGDB_E_CLASSNOTREG);
+    dprintf(("OLE32: ProgIDFromCLSID - stub"));
+    return(REGDB_E_CLASSNOTREG);
 }
 //*******************************************************************************
@@ -1009,6 +900,6 @@
 HRESULT WIN32API ReadClassStg(IStorage *pStg, CLSID *pclsid)
 {
-   dprintf(("ReadClassStg - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: ReadClassStg - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1016,6 +907,6 @@
 HRESULT WIN32API ReadClassStm(IStream *pStm, CLSID *pclsid)
 {
-   dprintf(("ReadClassStm - stub\n"));
-   return(STG_E_READFAULT);
+    dprintf(("OLE32: ReadClassStm - stub"));
+    return(STG_E_READFAULT);
 }
 //*******************************************************************************
@@ -1024,6 +915,6 @@
                                        LPWSTR *lplpszUserType)
 {
-   dprintf(("ReadFmtUserTypeStg - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: ReadFmtUserTypeStg - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1031,6 +922,6 @@
 HRESULT WIN32API ReadOleStg()
 {
-   dprintf(("ReadOleStg, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: ReadOleStg, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1038,6 +929,6 @@
 HRESULT WIN32API ReadStringStream()
 {
-   dprintf(("ReadStringStream, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: ReadStringStream, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1045,6 +936,6 @@
 HRESULT WIN32API RegisterDragDrop(HWND hwnd, IDropTarget *pDropTarget)
 {
-   dprintf(("RegisterDragDrop - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: RegisterDragDrop - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1052,6 +943,6 @@
 void WIN32API ReleaseStgMedium(STGMEDIUM *pmedium)
 {
-   dprintf(("ReleaseStgMedium - stub\n"));
-   return;
+    dprintf(("OLE32: ReleaseStgMedium - stub"));
+    return;
 }
 //*******************************************************************************
@@ -1059,6 +950,6 @@
 HRESULT WIN32API RevokeDragDrop(HWND hwnd)
 {
-   dprintf(("RevokeDragDrop - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: RevokeDragDrop - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1066,6 +957,6 @@
 HRESULT WIN32API SetConvertStg(IStorage *pStg, BOOL fConvert)
 {
-   dprintf(("SetConvertStg - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: SetConvertStg - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1074,6 +965,6 @@
                                      DWORD reserved, IStorage **ppstgOpen)
 {
-   dprintf(("StgCreateDocfile - stub\n"));
-   return(STG_E_INSUFFICIENTMEMORY);
+    dprintf(("OLE32: StgCreateDocfile - stub"));
+    return(STG_E_INSUFFICIENTMEMORY);
 }
 //*******************************************************************************
@@ -1081,6 +972,6 @@
 HRESULT WIN32API SetDocumentBitStg()
 {
-   dprintf(("SetDocumentBitStg, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: SetDocumentBitStg, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1089,6 +980,6 @@
                                                  DWORD reserved, IStorage **ppstgOpen)
 {
-   dprintf(("StgCreateDocfileOnILockBytes - stub\n"));
-   return(STG_E_INSUFFICIENTMEMORY);
+    dprintf(("OLE32: StgCreateDocfileOnILockBytes - stub"));
+    return(STG_E_INSUFFICIENTMEMORY);
 }
 //*******************************************************************************
@@ -1096,6 +987,6 @@
 HRESULT WIN32API StgIsStorageFile(const WCHAR *pwcsName)
 {
-   dprintf(("StgIsStorageFile - stub\n"));
-   return(S_FALSE);
+    dprintf(("OLE32: StgIsStorageFile - stub"));
+    return(S_FALSE);
 }
 //*******************************************************************************
@@ -1103,6 +994,6 @@
 HRESULT WIN32API StgIsStorageILockBytes(ILockBytes *plkbyt)
 {
-   dprintf(("StgIsStorageILockBytes - stub\n"));
-   return(S_FALSE);
+    dprintf(("OLE32: StgIsStorageILockBytes - stub"));
+    return(S_FALSE);
 }
 //*******************************************************************************
@@ -1112,6 +1003,6 @@
                                    IStorage **ppstgOpen)
 {
-   dprintf(("StgOpenStorage - stub\n"));
-   return(STG_E_INSUFFICIENTMEMORY);
+    dprintf(("OLE32: StgOpenStorage - stub"));
+    return(STG_E_INSUFFICIENTMEMORY);
 }
 //*******************************************************************************
@@ -1123,6 +1014,6 @@
                                                IStorage **ppstgOpen)
 {
-   dprintf(("StgOpenStorageOnILockBytes - stub\n"));
-   return(STG_E_INSUFFICIENTMEMORY);
+    dprintf(("OLE32: StgOpenStorageOnILockBytes - stub"));
+    return(STG_E_INSUFFICIENTMEMORY);
 }
 //*******************************************************************************
@@ -1131,54 +1022,6 @@
                                 FILETIME const *patime, FILETIME const *pmtime)
 {
-   dprintf(("StgSetTimes - stub\n"));
-   return(STG_E_FILENOTFOUND);
-}
-//*******************************************************************************
-//Freed in CoTaskMemFree
-//*******************************************************************************
-HRESULT WIN32API StringFromCLSID(REFCLSID rclsid, LPOLESTR *ppsz)
-{
- char   szclass[64];
- WCHAR *szclsid = (WCHAR *)malloc(64*sizeof(WCHAR));
-
-   dprintf(("StringFromCLSID\n"));
-
-   sprintf(szclass, "[%8X-%4X-%4X-%4X-%4X%8X]", rclsid.Data1, rclsid.Data2, rclsid.Data3,
-           *(WORD *)rclsid.Data4, *(WORD *)&rclsid.Data4[2], *(DWORD *)&rclsid.Data4[4]);
-   AsciiToUnicode(szclass, szclsid);
-   *ppsz = (LPOLESTR)szclsid;
-   return(S_OK);
-}
-//*******************************************************************************
-//*******************************************************************************
-int WIN32API StringFromGUID2(REFGUID rguid, LPOLESTR lpsz, int cbMax)
-{
- char szclsid[64];
-
-   dprintf(("StringFromGUID2\n"));
-   if(cbMax < 55)
-        return(0);
-
-   sprintf(szclsid, "[%8X-%4X-%4X-%4X-%4X%8X]", rguid.Data1, rguid.Data2, rguid.Data3,
-           *(WORD *)rguid.Data4, *(WORD *)&rguid.Data4[2], *(DWORD *)&rguid.Data4[4]);
-   AsciiToUnicode(szclsid, lpsz);
-   return(55);  //including 0 terminator
-}
-//*******************************************************************************
-//Freed in CoTaskMemFree
-//*******************************************************************************
-HRESULT WIN32API StringFromIID(REFIID riid, LPOLESTR *lplpsz)
-{
- char   szclass[64];
- WCHAR *szclsid = (WCHAR *)malloc(64*sizeof(WCHAR));
-
-   dprintf(("StringFromIID\n"));
-
-   sprintf(szclass, "[%8X-%4X-%4X-%4X-%4X%8X]", riid.Data1, riid.Data2, riid.Data3,
-           *(WORD *)riid.Data4, *(WORD *)&riid.Data4[2], *(DWORD *)&riid.Data4[4]);
-
-   AsciiToUnicode(szclass, szclsid);
-   *lplpsz = (LPOLESTR)szclsid;
-   return(S_OK);
+    dprintf(("OLE32: StgSetTimes - stub"));
+    return(STG_E_FILENOTFOUND);
 }
 //*******************************************************************************
@@ -1186,6 +1029,6 @@
 HRESULT WIN32API UtConvertDvtd16toDvtd32()
 {
-   dprintf(("UtConvertDvtd16toDvtd32, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: UtConvertDvtd16toDvtd32, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1193,6 +1036,6 @@
 HRESULT WIN32API UtConvertDvtd32toDvtd16()
 {
-   dprintf(("UtConvertDvtd32toDvtd16, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: UtConvertDvtd32toDvtd16, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1200,6 +1043,6 @@
 HRESULT WIN32API UtGetDvtd16Info()
 {
-   dprintf(("UtGetDvtd16Info, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: UtGetDvtd16Info, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1207,6 +1050,6 @@
 HRESULT WIN32API UtGetDvtd32Info()
 {
-   dprintf(("UtGetDvtd32Info, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: UtGetDvtd32Info, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1214,6 +1057,6 @@
 HRESULT WIN32API WriteClassStg(IStorage *pStg, REFCLSID rclsid)
 {
-   dprintf(("WriteClassStg - stub\n"));
-   return(STG_E_MEDIUMFULL);
+    dprintf(("OLE32: WriteClassStg - stub"));
+    return(STG_E_MEDIUMFULL);
 }
 //*******************************************************************************
@@ -1221,6 +1064,6 @@
 HRESULT WIN32API WriteClassStm(IStream *pStm, REFCLSID rclsid)
 {
-   dprintf(("WriteClassStm - stub\n"));
-   return(STG_E_MEDIUMFULL);
+    dprintf(("OLE32: WriteClassStm - stub"));
+    return(STG_E_MEDIUMFULL);
 }
 //*******************************************************************************
@@ -1228,6 +1071,6 @@
 HRESULT WIN32API WriteFmtUserTypeStg(IStorage *pStg, CLIPFORMAT cf, LPWSTR *lpszUserType)
 {
-   dprintf(("WriteFmtUserTypeStg - stub\n"));
-   return(STG_E_MEDIUMFULL);
+    dprintf(("OLE32: WriteFmtUserTypeStg - stub"));
+    return(STG_E_MEDIUMFULL);
 }
 //*******************************************************************************
@@ -1235,6 +1078,6 @@
 HRESULT WIN32API WriteOleStg()
 {
-   dprintf(("WriteOleStg, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: WriteOleStg, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1242,6 +1085,6 @@
 HRESULT WIN32API WriteStringStream()
 {
-   dprintf(("WriteStringStream, UNKNOWN API - stub\n"));
-   return(E_OUTOFMEMORY);
+    dprintf(("OLE32: WriteStringStream, UNKNOWN API - stub"));
+    return(E_OUTOFMEMORY);
 }
 //*******************************************************************************
@@ -1250,4 +1093,5 @@
 HRESULT WIN32API CoImpersonateClient()		// DCOM - obj_clientserver.h
 {
+    dprintf(("OLE32: CoImpersonateClient - Stub"));
     return(S_OK);
 }
@@ -1266,4 +1110,5 @@
     void                        *pReserved3 )
 {
+    dprintf(("OLE32: CoInitializeSecurity - Stub"));
     return(S_OK);
 }
@@ -1273,4 +1118,5 @@
 HRESULT WIN32API CoRegisterSurrogate(LPSURROGATE pSurrogate)	// NT4 SP2, Win95b+
 {
+    dprintf(("OLE32: CoRegisterSurrogate - Stub"));
     return(S_OK);
 }
Index: trunk/src/ole32/taskmem.cpp
===================================================================
--- trunk/src/ole32/taskmem.cpp	(revision 291)
+++ trunk/src/ole32/taskmem.cpp	(revision 291)
@@ -0,0 +1,252 @@
+/* 
+ * 
+ * Project Odin Software License can be found in LICENSE.TXT
+ * 
+ */
+/* 
+ * COM/OLE memory management functions.
+ * 
+ * 7/7/99
+ * 
+ * Copyright 1999 David J. Raison
+ * 
+ * Some portions from Wine Implementation
+ *	Copyright 1997	Marcus Meissner
+ */
+
+#include "ole32.h"
+
+#include "oString.h"
+
+// ======================================================================
+// Prototypes.
+// ======================================================================
+static HRESULT WIN32API IMalloc_fnQueryInterface(LPMALLOC iface, REFIID refiid, LPVOID * obj) ;
+static ULONG WIN32API IMalloc_fnAddRef(LPMALLOC iface) ;
+static ULONG WIN32API IMalloc_fnRelease(LPMALLOC iface) ;
+static LPVOID WIN32API IMalloc_fnAlloc(LPMALLOC iface, DWORD cb);
+static LPVOID WIN32API IMalloc_fnRealloc(LPMALLOC iface, LPVOID pv, DWORD cb);
+static VOID WIN32API IMalloc_fnFree(LPMALLOC iface, LPVOID pv);
+static DWORD WIN32API IMalloc_fnGetSize(const IMalloc* iface, LPVOID pv);
+static INT WIN32API IMalloc_fnDidAlloc(const IMalloc* iface, LPVOID pv);
+static LPVOID WIN32API IMalloc_fnHeapMinimize(LPMALLOC iface);
+static LPMALLOC IMalloc_Constructor();
+
+// ======================================================================
+// Local Data
+// ======================================================================
+typedef struct
+{
+        /* IUnknown fields */
+        ICOM_VTABLE(IMalloc)* lpvtbl;
+        DWORD                   ref;
+} IMallocImpl;
+
+static ICOM_VTABLE(IMalloc) VT_IMalloc = 
+{
+    IMalloc_fnQueryInterface,
+    IMalloc_fnAddRef,
+    IMalloc_fnRelease,
+    IMalloc_fnAlloc,
+    IMalloc_fnRealloc,
+    IMalloc_fnFree,
+    IMalloc_fnGetSize,
+    IMalloc_fnDidAlloc,
+    IMalloc_fnHeapMinimize
+};
+
+LPMALLOC currentMalloc32 = NULL;
+
+// ======================================================================
+// Public API's
+// ======================================================================
+
+// ----------------------------------------------------------------------
+// CoTaskMemAlloc
+// ----------------------------------------------------------------------
+LPVOID WIN32API CoTaskMemAlloc(ULONG cb)
+{
+    dprintf(("OLE32: CoTaskMemAlloc(%lu)", cb));
+
+    return HeapAlloc(GetProcessHeap(), 0, cb);
+}
+
+// ----------------------------------------------------------------------
+// CoTaskMemFree
+// ----------------------------------------------------------------------
+void WIN32API CoTaskMemFree(void *pv)
+{
+    dprintf(("OLE32: CoTaskMemFree"));
+
+    HeapFree(GetProcessHeap(), 0, pv);
+}
+
+// ----------------------------------------------------------------------
+// CoTaskMemRealloc
+// ----------------------------------------------------------------------
+LPVOID WIN32API CoTaskMemRealloc(LPVOID pv, ULONG cb)
+{
+    dprintf(("OLE32: CoTaskMemRealloc(%lu)", cb));
+
+    return HeapReAlloc(GetProcessHeap(), 0, pv, cb);
+}
+
+// ----------------------------------------------------------------------
+// CoGetMalloc
+// ----------------------------------------------------------------------
+HRESULT WIN32API CoGetMalloc(DWORD dwMemContext, LPMALLOC *ppMalloc)
+{
+    dprintf(("OLE32: CoGetMalloc"));
+
+    if(!currentMalloc32)
+	currentMalloc32 = IMalloc_Constructor();
+
+    *ppMalloc = currentMalloc32;
+    return S_OK;
+}
+
+// ----------------------------------------------------------------------
+// IsValidInterface32
+// ----------------------------------------------------------------------
+BOOL WIN32API IsValidInterface( LPUNKNOWN punk)	/* [in] interface to be tested */
+{
+    dprintf(("OLE32: IsValidInterface"));
+
+    return !(IsBadReadPtr(punk, 4)
+	    || IsBadReadPtr(punk->lpvtbl, 4)
+	    || IsBadReadPtr(punk->lpvtbl->fnQueryInterface, 9)
+	    || IsBadCodePtr((FARPROC)punk->lpvtbl->fnQueryInterface) );
+}
+
+// ======================================================================
+// IMalloc implementation 
+// ======================================================================
+
+// ----------------------------------------------------------------------
+// IMalloc_Constructor
+// ----------------------------------------------------------------------
+static LPMALLOC IMalloc_Constructor()
+{
+    IMallocImpl* This;
+
+    This = (IMallocImpl*)HeapAlloc(GetProcessHeap(), 0, sizeof(IMallocImpl));
+    This->lpvtbl = &VT_IMalloc;
+    This->ref = 1;
+    return (LPMALLOC)This;
+}
+
+// ----------------------------------------------------------------------
+// IMalloc_fnQueryInterface
+// ----------------------------------------------------------------------
+static HRESULT WIN32API IMalloc_fnQueryInterface(LPMALLOC iface, REFIID refiid, LPVOID * obj) 
+{
+    ICOM_THIS(IMallocImpl, iface);
+
+    oStringA	tRefiid(refiid);
+    dprintf(("OLE32: IMalloc_fnQueryInterface(%s)", (char *)tRefiid));
+
+    if (!memcmp(&IID_IUnknown, refiid, sizeof(IID_IUnknown))
+    	|| !memcmp(&IID_IMalloc, refiid, sizeof(IID_IMalloc)))
+    {
+	*obj = This;
+	return S_OK;
+    }
+    return OLE_E_ENUM_NOMORE; 
+}
+
+// ----------------------------------------------------------------------
+// IMalloc_fnAddRef
+// ----------------------------------------------------------------------
+static ULONG WIN32API IMalloc_fnAddRef(LPMALLOC iface) 
+{
+    ICOM_THIS(IMallocImpl, iface);
+
+    dprintf(("OLE32: IMalloc_fnAddRef"));
+
+    return 1; /* cannot be freed */
+}
+
+// ----------------------------------------------------------------------
+// IMalloc_fnRelease
+// ----------------------------------------------------------------------
+static ULONG WIN32API IMalloc_fnRelease(LPMALLOC iface) 
+{
+    ICOM_THIS(IMallocImpl, iface);
+
+    dprintf(("OLE32: IMalloc_fnRelease"));
+
+    return 1; /* cannot be freed */
+}
+
+// ----------------------------------------------------------------------
+// IMalloc_fnAlloc
+// ----------------------------------------------------------------------
+static LPVOID WIN32API IMalloc_fnAlloc(LPMALLOC iface, DWORD cb)
+{
+    ICOM_THIS(IMallocImpl, iface);
+
+    dprintf(("OLE32: IMalloc_fnAlloc"));
+
+    return HeapAlloc(GetProcessHeap(), 0, cb);
+}
+
+// ----------------------------------------------------------------------
+// IMalloc_fnRealloc
+// ----------------------------------------------------------------------
+static LPVOID WIN32API IMalloc_fnRealloc(LPMALLOC iface, LPVOID pv, DWORD cb)
+{
+    ICOM_THIS(IMallocImpl, iface);
+
+    dprintf(("OLE32: IMalloc_fnRealloc"));
+
+    return HeapReAlloc(GetProcessHeap(), 0, pv, cb);
+}
+
+// ----------------------------------------------------------------------
+// IMalloc_fnFree
+// ----------------------------------------------------------------------
+static VOID WIN32API IMalloc_fnFree(LPMALLOC iface, LPVOID pv)
+{
+    ICOM_THIS(IMallocImpl, iface);
+
+    dprintf(("OLE32: IMalloc_fnFree"));
+
+    HeapFree(GetProcessHeap(), 0, pv);
+}
+
+// ----------------------------------------------------------------------
+// IMalloc_fnGetSize
+// ----------------------------------------------------------------------
+static DWORD WIN32API IMalloc_fnGetSize(const IMalloc* iface, LPVOID pv)
+{
+    ICOM_THIS(IMallocImpl, iface);
+
+    dprintf(("OLE32: IMalloc_fnGetSize"));
+
+    return HeapSize(GetProcessHeap(), 0, pv);
+}
+
+// ----------------------------------------------------------------------
+// IMalloc_fnDidAlloc
+// ----------------------------------------------------------------------
+static INT WIN32API IMalloc_fnDidAlloc(const IMalloc* iface, LPVOID pv)
+{
+    ICOM_THIS(IMallocImpl, iface);
+
+    dprintf(("OLE32: IMalloc_fnDidAlloc"));
+
+    return -1;
+}
+
+// ----------------------------------------------------------------------
+// IMalloc_fnHeapMinimize
+// ----------------------------------------------------------------------
+static LPVOID WIN32API IMalloc_fnHeapMinimize(LPMALLOC iface)
+{
+    ICOM_THIS(IMallocImpl, iface);
+
+    dprintf(("OLE32: IMalloc_fnHeapMinimize"));
+
+    return NULL;
+}
+
