Changeset 291 for trunk/src


Ignore:
Timestamp:
Jul 12, 1999, 2:21:37 AM (26 years ago)
Author:
davidr
Message:

Updated clsid handling to correctly draw textual clsid's
Fixed GUID instansiation.
Moved initialisation to OLE32.CPP
Added many new APIs incl. CoCreateInstance & CoGetClassObject.
Many partially implemented stubs completed and moved to OLE32.CPP
Running Object Table implemented (Moniker.cpp)
IMalloc & Task Memory implemented.

Location:
trunk/src/ole32
Files:
2 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/ole32/clsid.cpp

    r197 r291  
    1 /*
    2  *
     1/* 
     2 * 
    33 * Project Odin Software License can be found in LICENSE.TXT
    4  *
     4 * 
    55 */
    6 /*
    7  * Win32 OLE stubs for OS/2
    8  *
    9  * 1998/06/12
    10  *
    11  * Copyright 1998 Sander van Leeuwen
     6/*
     7 * ClassID Manipulation.
     8 *
     9 * 1/7/99
     10 *
     11 * Copyright 1999 David J. Raison
     12 *
     13 * Some portions from Wine Implementation
     14 *   Copyright 1995  Martin von Loewis
     15 *   Copyright 1998  Justin Bradford
     16 *   Copyright 1999  Francis Beaudet
     17 *   Copyright 1999  Sylvain St-Germain
    1218 */
    1319
     
    1521
    1622#include "oString.h"
    17 
    18 // ----------------------------------------------------------------------
    19 // CLSIDFromStringA() [Internal]
    20 // ----------------------------------------------------------------------
    21 static HRESULT CLSIDFromStringA(
    22     const char *        lpsz,           // [in] - ASCII string to convert
    23     LPCLSID             pclisid)        // [out] - CLSID
    24 {
    25     dprintf(("OLE32.CLSIDFromStringA [Internal]\n"));
    26 
    27     BYTE *s = (BYTE *) lpsz;
    28     BYTE *p;
    29     int   i;
    30     BYTE table[256];
    31 
    32     /* quick lookup table */
    33     memset(table, 0, 256);
    34 
    35     for (i = 0; i < 10; i++)
    36     {
    37         table['0' + i] = i;
    38     }
    39     for (i = 0; i < 6; i++)
    40     {
    41         table['A' + i] = i+10;
    42         table['a' + i] = i+10;
    43     }
    44 
    45     /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
    46 
    47     if (strlen(lpsz) != 38)
    48         return OLE_ERROR_OBJECT;
    49 
    50     p = (BYTE *) pclisid;
    51 
    52     s++;  /* skip leading brace  */
    53     for (i = 0; i < 4; i++)
    54     {
    55         p[3 - i] = table[*s]<<4 | table[*(s+1)];
    56         s += 2;
    57     }
    58     p += 4;
    59     s++;  /* skip - */
    60 
    61     for (i = 0; i < 2; i++)
    62     {
    63         p[1-i] = table[*s]<<4 | table[*(s+1)];
    64         s += 2;
    65     }
    66     p += 2;
    67     s++;  /* skip - */
    68 
    69     for (i = 0; i < 2; i++)
    70     {
    71         p[1-i] = table[*s]<<4 | table[*(s+1)];
    72         s += 2;
    73     }
    74     p += 2;
    75     s++;  /* skip - */
    76 
    77     /* these are just sequential bytes */
    78     for (i = 0; i < 2; i++)
    79     {
    80         *p++ = table[*s]<<4 | table[*(s+1)];
    81         s += 2;
    82     }
    83     s++;  /* skip - */
    84 
    85     for (i = 0; i < 6; i++)
    86     {
    87         *p++ = table[*s]<<4 | table[*(s+1)];
    88         s += 2;
    89     }
    90 
    91     return S_OK;
    92 }
    9323
    9424// ----------------------------------------------------------------------
     
    9929    LPCLSID             pclsid)         // [out] - CLSID
    10030{
    101     dprintf(("OLE32.CLSIDFromProgID\n"));
     31    dprintf(("OLE32: CLSIDFromProgID"));
    10232
    10333    LONG                lDataLen = 80;
    104     oStringA            szKey(lpszProgID);
    105     oStringA            szCLSID(lDataLen);
     34    oStringW            szKey(lpszProgID);
     35    oStringW            szCLSID(lDataLen);
    10636    HKEY                hKey;
    10737    HRESULT             rc;
    10838
    10939    // Create the registry lookup string...
    110     szKey += "\\CLSID";
     40    szKey += L"\\CLSID";
    11141
    11242    // Try to open the key in the registry...
    113     rc = RegOpenKeyA(HKEY_CLASSES_ROOT, szKey, &hKey);
     43    rc = RegOpenKeyW(HKEY_CLASSES_ROOT, szKey, &hKey);
    11444    if (rc != 0)
    11545        return OLE_ERROR_GENERIC;
    11646
    11747    // Now get the data from the _default_ entry on this key...
    118     rc = RegQueryValueA(hKey, NULL, szCLSID, &lDataLen);
     48    rc = RegQueryValueW(hKey, NULL, szCLSID, &lDataLen);
    11949    RegCloseKey(hKey);
    12050    if (rc != 0)
     
    12252
    12353    // Now convert from a string to a UUID
    124     return CLSIDFromStringA(szCLSID, pclsid);
     54    return CLSIDFromString(szCLSID, pclsid);
     55}
     56
     57// ----------------------------------------------------------------------
     58// IIDFromString
     59// ----------------------------------------------------------------------
     60HRESULT WIN32API IIDFromString(LPSTR lpsz, LPIID lpiid)
     61{
     62    dprintf(("OLE32: IIDFromString"));
     63    return CLSIDFromString((LPCOLESTR)lpsz, (LPCLSID)lpiid);
    12564}
    12665
     
    13271    LPCLSID             pclsid)         // [out] - Binary CLSID
    13372{
    134     dprintf(("OLE32.CLSIDFromString\n"));
     73    dprintf(("OLE32: CLSIDFromString"));
     74
     75    oStringA            tClsId(lpsz);
    13576
    13677    HRESULT             ret = OLE_ERROR_GENERIC;
    137     oStringA            szCLSID(lpsz);
    13878
    13979    // Convert to binary CLSID
    140     return CLSIDFromStringA(szCLSID, pclsid);
    141 }
    142 
     80    char *s = (char *) tClsId;
     81    char *p;
     82    int   i;
     83    char table[256];
     84
     85    /* quick lookup table */
     86    memset(table, 0, 256);
     87
     88    for (i = 0; i < 10; i++)
     89    {
     90        table['0' + i] = i;
     91    }
     92    for (i = 0; i < 6; i++)
     93    {
     94        table['A' + i] = i+10;
     95        table['a' + i] = i+10;
     96    }
     97
     98    /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
     99
     100    if (lstrlenW(lpsz) != 38)
     101        return OLE_ERROR_OBJECT;
     102
     103    p = (char *) pclsid;
     104
     105    s++;  /* skip leading brace  */
     106    for (i = 0; i < 4; i++)
     107    {
     108        p[3 - i] = table[*s]<<4 | table[*(s+1)];
     109        s += 2;
     110    }
     111    p += 4;
     112    s++;  /* skip - */
     113
     114    for (i = 0; i < 2; i++)
     115    {
     116        p[1-i] = table[*s]<<4 | table[*(s+1)];
     117        s += 2;
     118    }
     119    p += 2;
     120    s++;  /* skip - */
     121
     122    for (i = 0; i < 2; i++)
     123    {
     124        p[1-i] = table[*s]<<4 | table[*(s+1)];
     125        s += 2;
     126    }
     127    p += 2;
     128    s++;  /* skip - */
     129
     130    /* these are just sequential bytes */
     131    for (i = 0; i < 2; i++)
     132    {
     133        *p++ = table[*s]<<4 | table[*(s+1)];
     134        s += 2;
     135    }
     136    s++;  /* skip - */
     137
     138    for (i = 0; i < 6; i++)
     139    {
     140        *p++ = table[*s]<<4 | table[*(s+1)];
     141        s += 2;
     142    }
     143
     144    return S_OK;
     145}
     146
     147// ----------------------------------------------------------------------
     148// CoCreateGuid()
     149// ----------------------------------------------------------------------
     150HRESULT WIN32API CoCreateGuid(GUID *pguid)
     151{
     152   dprintf(("OLE32: CoCreateGuid"));
     153   memset(pguid, 0, sizeof(GUID));      //TODO: should be random GUID
     154   return S_OK;
     155}
     156
     157// ----------------------------------------------------------------------
     158// StringFromCLSID
     159// Memory allocated here on behalf of application should be freed using CoTaskMemFree()
     160// ----------------------------------------------------------------------
     161HRESULT WIN32API StringFromCLSID(REFCLSID rclsid, LPOLESTR *ppsz)
     162{
     163    char        tmp[50];
     164    LPWSTR      szclsid;
     165    size_t      strLen;
     166
     167    dprintf(("OLE32: StringFromCLSID"));
     168
     169    // Setup new string...
     170    strLen  = sprintf(tmp, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
     171            rclsid->Data1,
     172            rclsid->Data2,
     173            rclsid->Data3,
     174            rclsid->Data4[0],
     175            rclsid->Data4[1],
     176            rclsid->Data4[2],
     177            rclsid->Data4[3],
     178            rclsid->Data4[4],
     179            rclsid->Data4[5],
     180            rclsid->Data4[6],
     181            rclsid->Data4[7]);
     182
     183    // Grab buffer for string...
     184    szclsid = (LPWSTR)CoTaskMemAlloc((strLen + 1) * sizeof(WCHAR));
     185
     186    AsciiToUnicode(tmp, szclsid);
     187
     188    *ppsz = (LPOLESTR)szclsid;
     189
     190    return S_OK;
     191}
     192
     193// ----------------------------------------------------------------------
     194// StringFromIID
     195// Memory allocated here on behalf of application should be freed using CoTaskMemFree()
     196// ----------------------------------------------------------------------
     197HRESULT WIN32API StringFromIID(REFIID riid, LPOLESTR *ppsz)
     198{
     199    char        tmp[50];
     200    LPWSTR      sziid;
     201    size_t      strLen;
     202
     203    dprintf(("OLE32: StringFromIID"));
     204
     205    // Setup new string...
     206    strLen  = sprintf(tmp, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
     207            riid->Data1,
     208            riid->Data2,
     209            riid->Data3,
     210            riid->Data4[0],
     211            riid->Data4[1],
     212            riid->Data4[2],
     213            riid->Data4[3],
     214            riid->Data4[4],
     215            riid->Data4[5],
     216            riid->Data4[6],
     217            riid->Data4[7]);
     218
     219    // Grab buffer for string...
     220    sziid = (LPWSTR)CoTaskMemAlloc((strLen + 1) * sizeof(WCHAR));
     221
     222    AsciiToUnicode(tmp, sziid);
     223
     224    *ppsz = (LPOLESTR)sziid;
     225
     226    return S_OK;
     227}
     228
     229// ----------------------------------------------------------------------
     230// StringFromGUID2
     231// ----------------------------------------------------------------------
     232int WIN32API StringFromGUID2(REFGUID rguid, LPOLESTR lpsz, int cbMax)
     233{
     234    char        tmp[64];
     235    size_t      strLen;
     236
     237    dprintf(("OLE32: StringFromGUID2"));
     238
     239    // Setup new string...
     240    strLen  = sprintf(tmp, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
     241            rguid->Data1,
     242            rguid->Data2,
     243            rguid->Data3,
     244            rguid->Data4[0],
     245            rguid->Data4[1],
     246            rguid->Data4[2],
     247            rguid->Data4[3],
     248            rguid->Data4[4],
     249            rguid->Data4[5],
     250            rguid->Data4[6],
     251            rguid->Data4[7]);
     252
     253    if(cbMax < (strLen * 2 + 1))
     254        return 0;
     255
     256    AsciiToUnicode(tmp, lpsz);
     257
     258    return(strLen * 2 + 1);  // including 0 terminator
     259}
     260
  • trunk/src/ole32/guid.cpp

    r199 r291  
    1 /*
    2  *
     1/* 
     2 * 
    33 * Project Odin Software License can be found in LICENSE.TXT
    4  *
     4 * 
    55 */
    6 /*
    7  * Win32 OLE stubs for OS/2
    8  *
    9  * 1998/06/12
    10  *
    11  * Copyright 1998 Sander van Leeuwen
     6/*
     7 * Concrete defintions of all IID's
     8 *
     9 * 1/7/99
     10 *
     11 * Copyright 1999 David J. Raison
     12 *
    1213 */
    1314
    14 // This causes all the DEFINE_GUID's to instantiate their GUID's
    15 #define INITGUID
     15// This causes all the DEFINE_GUID macros to instantiate their GUID's
     16#define INITGUID 1
    1617
    1718#include "ole32.h"
     19
  • trunk/src/ole32/initialise.cpp

    r199 r291  
    1 /*
    2  *
     1/* 
     2 * 
    33 * Project Odin Software License can be found in LICENSE.TXT
    4  *
     4 * 
    55 */
    6 /*
    7  * Win32 OLE stubs for OS/2
    8  *
    9  * 1998/06/12
    10  *
    11  * Copyright 1998 Sander van Leeuwen
     6/*
     7 * COM/OLE Startup shutdown.
     8 *
     9 * 1/7/99
     10 *
     11 * Copyright 1999 David J. Raison
     12 *
     13 * Some portions from Wine Implementation
     14 *   Copyright 1995  Martin von Loewis
     15 *   Copyright 1998  Justin Bradford
     16 *   Copyright 1999  Francis Beaudet
     17 *   Copyright 1999  Sylvain St-Germain
    1218 */
    1319
     
    1521
    1622// ----------------------------------------------------------------------
    17 // Local Variables
     23// Local data
    1824// ----------------------------------------------------------------------
    19 static int      s_COMLockCount = 0;
    2025
    21 // ----------------------------------------------------------------------
    22 // CoInitialize()
    23 // ----------------------------------------------------------------------
    24 HRESULT WIN32API CoInitialize(LPVOID lpReserved)
    25 {
    26     dprintf(("OLE32.CoInitialize\n"));
    2726
    28     return CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);
    29 }
    3027
    31 // ----------------------------------------------------------------------
    32 // CoInitializeEx()
    33 // ----------------------------------------------------------------------
    34 HRESULT WIN32API CoInitializeEx(
    35         LPVOID  lpReserved,     // [in] pointer to win32 malloc interface
    36         DWORD   dwCoInit)       // [in] A value from COINIT specifies the thread
    37 {
    38     HRESULT hr = S_FALSE;
    3928
    40     dprintf(("OLE32.CoInitializeEx(%p, %lx)\n", lpReserved, dwCoInit));
    41 
    42     if (lpReserved != NULL)
    43     {
    44         dprintf(("Warning: Bad parameter %p, must be an old Windows Application", lpReserved));
    45     }
    46 
    47     /*
    48      * Check for unsupported features.
    49      */
    50     if (dwCoInit != COINIT_APARTMENTTHREADED)
    51     {
    52         dprintf(("Warning: Unsupported flag %lx", dwCoInit));
    53         /* Hope for the best and continue anyway */
    54     }
    55 
    56     /*
    57      * Check the lock count.
    58      * If this is the first time going through the initialize
    59      * process, we have to initialize the libraries.
    60      */
    61     if (s_COMLockCount == 0)
    62     {
    63         /*
    64          * Initialize the various COM libraries and data structures.
    65          */
    66         dprintf(("OLE32.CoInitializeEx - Initializing COM libraries"));
    67 
    68 //      RunningObjectTableImpl_Initialize();
    69 
    70         hr = S_OK;
    71     }
    72 
    73     /*
    74      * Crank-up that lock count.
    75      */
    76     s_COMLockCount++;
    77 
    78     return hr;
    79 }
    80 
  • trunk/src/ole32/oString.cpp

    r201 r291  
    11
    2 #include <string.h>
    3 
    4 // Prevent CALLCONV becoming _System
    5 #include <winbase.h>
    6 #include <uconv.h>
    7 #undef CALLCONV
    8 
    9 #include <os2win.h>
     2#include "ole32.h"
    103
    114#include "oString.h"
    125
     6// ======================================================================
     7// oStringBase - Base stuff for oString classes
     8// ======================================================================
     9
    1310// Block size.
    14 long oStringA::blockSize = 32;
     11long oStringBase::blockSize = 32;
     12
     13// Initialise to nothing...
     14oStringBase::oStringBase(long bytePerChar)
     15{
     16    m_bytePerChar = bytePerChar;
     17    m_Heap = GetProcessHeap();
     18}
     19
     20// Destructor
     21oStringBase::~oStringBase()
     22{
     23    freeBuf();
     24}
    1525
    1626// calculate the buffersize needed for this string (quantised to blockSize)
    17 long oStringA::calcBufLen(long strLen)
     27long oStringBase::calcBufLen(long strLen)
    1828{
    1929    long        tmp;
    2030
    21     tmp = (strLen / blockSize) + 1;
     31    tmp = ((strLen * m_bytePerChar) / blockSize) + 1;
    2232
    2333    return tmp * blockSize;
     
    2535
    2636// Get a buffer of required length...
    27 void oStringA::getBuf(long strLen)
     37void oStringBase::getBuf(long strLen)
    2838{
    2939    // Sanity check...
    3040    if (strLen < 1)
    3141    {
    32         dprintf(("Warning: oStringA::getBuf - strlen < 1!"));
     42        dprintf(("oStringBase: Warning! ::getBuf - strlen < 1!"));
    3343        strLen = 1;
    3444    }
     
    4252
    4353// Free buffer...
    44 void oStringA::freeBuf()
     54void oStringBase::freeBuf()
    4555{
    4656    HeapFree(m_Heap, 0, m_strBuf);
     
    4858
    4959// Re-allocate buffer if more space is required...
    50 void oStringA::adjBuf(long strLen)
    51 {
    52     if (strLen > m_bufLen)
     60void oStringBase::adjBuf(long strLen)
     61{
     62    if ((strLen * m_bytePerChar) > m_bufLen)
    5363    {
    54         LPSTR   strBuf;
    5564        long    bufLen = calcBufLen(strLen);
    5665
    5766        // Allocate new buffer...
    58         strBuf = (LPSTR)HeapAlloc(m_Heap, 0, bufLen);
    59 
    60         // Copy old buffer to new...
    61         strcpy(strBuf, m_strBuf);       // Incl. terminator...
    62         freeBuf();
     67        m_strBuf = (LPSTR)HeapReAlloc(m_Heap, 0, m_strBuf, bufLen);
    6368
    6469        // Save new buffer...
    65         m_strBuf = strBuf;
    6670        m_bufLen = bufLen;
    6771    }
    6872}
    6973
     74// ======================================================================
     75// oStringA - String manipulation based on ASCII
     76// ======================================================================
     77
    7078// Initialise to nothing...
    71 oStringA::oStringA( void)
    72 {
    73     m_Heap = GetProcessHeap();
    74     getBuf(1);  // Incl. terminator...
     79oStringA::oStringA( void) : oStringBase(sizeof(char))
     80{
     81    getBuf( 1); // Incl. terminator...
    7582}
    7683
    7784// Initialise to a specified length...
    78 oStringA::oStringA(int defLen)
    79 {
    80     m_Heap = GetProcessHeap();
    81     getBuf(defLen + 1);
     85oStringA::oStringA(int defLen)   : oStringBase(sizeof(char))
     86{
     87    getBuf( defLen + 1);
    8288}
    8389
    8490// Initialise from Unicode string...
    85 oStringA::oStringA(LPCWSTR pUnicode)
     91oStringA::oStringA(LPCWSTR pUnicode)  : oStringBase(sizeof(char))
    8692{
    8793    long        strLen = lstrlenW(pUnicode) + 1;
    8894
    89     m_Heap = GetProcessHeap();
    90     getBuf(strLen);
     95    getBuf( strLen);
    9196    UnicodeToAscii((LPWSTR)pUnicode, m_strBuf);
    9297    m_strLen = strLen;
     
    9499
    95100// Initialise from ASCII string...
    96 oStringA::oStringA(LPCSTR pAscii)
     101oStringA::oStringA(LPCSTR pAscii)  : oStringBase(sizeof(char))
    97102{
    98103    long        strLen = strlen(pAscii) + 1;
    99104
    100     m_Heap = GetProcessHeap();
    101     getBuf(strLen);
     105    getBuf( strLen);
    102106    strcpy(m_strBuf, pAscii);
    103107    m_strLen = strLen;
     
    105109
    106110// Initialise from another oString
    107 oStringA::oStringA(const oStringA &ref)
    108 {
    109     m_Heap = GetProcessHeap();
    110     getBuf(ref.m_strLen);
     111oStringA::oStringA(const oStringA &ref)  : oStringBase(sizeof(char))
     112{
     113    getBuf( ref.m_strLen);
    111114    strcpy(m_strBuf, ref.m_strBuf);
    112115    m_strLen = ref.m_strLen;
    113116}
    114117
    115 //Destroy resources...
    116 oStringA::~oStringA()
    117 {
    118     freeBuf();
     118// Initialise from CLSID
     119oStringA::oStringA( REFCLSID pClsId)  : oStringBase(sizeof(char))
     120{
     121    getBuf( 50);        // Incl. terminator...
     122
     123    // Assign string...
     124    operator=(pClsId);
    119125}
    120126
     
    122128oStringA::operator LPSTR()
    123129{
    124     return m_strBuf;
     130    return (LPSTR)m_strBuf;
    125131}
    126132
     
    133139
    134140    // Setup new string...
    135     getBuf(string.m_strLen);
     141    getBuf( string.m_strLen);
    136142    strcpy(m_strBuf, string.m_strBuf);
    137143    m_strLen = string.m_strLen;
     
    147153
    148154    // Setup new string...
    149     getBuf(strLen);
     155    getBuf( strLen);
    150156    strcpy(m_strBuf, pAscii);
    151157    m_strLen = strLen;
     
    161167
    162168    // Setup new string...
    163     getBuf(strLen);
     169    getBuf( strLen);
    164170    UnicodeToAscii((LPWSTR)pUnicode, m_strBuf);
    165171    m_strLen = strLen;
     
    167173}
    168174
     175oStringA oStringA::operator =  (REFCLSID rClsId)
     176{
     177    // Lose old string...
     178    freeBuf();
     179
     180    // Setup new string...
     181    getBuf( 50);
     182    m_strLen  = sprintf(m_strBuf, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
     183            rClsId->Data1,
     184            rClsId->Data2,
     185            rClsId->Data3,
     186            rClsId->Data4[0],
     187            rClsId->Data4[1],
     188            rClsId->Data4[2],
     189            rClsId->Data4[3],
     190            rClsId->Data4[4],
     191            rClsId->Data4[5],
     192            rClsId->Data4[6],
     193            rClsId->Data4[7]);
     194    return *this;
     195}
    169196
    170197// Add String to String
     
    215242    long        strLen = m_strLen + string.m_strLen - 1;
    216243
    217     adjBuf(strLen);
     244    adjBuf( strLen);
    218245    strcpy(m_strBuf + m_strLen - 1, string.m_strBuf);
    219246    m_strLen = strLen;
     
    227254    long        strLen = m_strLen + strlen(pAscii);
    228255
    229     adjBuf(strLen);
     256    adjBuf( strLen);
    230257    strcpy(m_strBuf + m_strLen - 1, pAscii);
    231258    m_strLen = strLen;
     
    239266    long        strLen = m_strLen + lstrlenW(pUnicode);
    240267
    241     adjBuf(strLen);
     268    adjBuf( strLen);
    242269    UnicodeToAscii((LPWSTR)pUnicode, m_strBuf + m_strLen - 1);
    243270    m_strLen = strLen;
     
    246273}
    247274
    248 
     275// ======================================================================
     276// oStringW - String manipulation based on Unicode
     277// ======================================================================
     278
     279// Initialise to nothing...
     280oStringW::oStringW( void) : oStringBase(sizeof(WCHAR))
     281{
     282    getBuf( 1); // Incl. terminator...
     283}
     284
     285// Initialise to a specified length...
     286oStringW::oStringW(int defLen) : oStringBase(sizeof(WCHAR))
     287{
     288    getBuf( defLen + 1);
     289}
     290
     291// Initialise from Unicode string...
     292oStringW::oStringW(LPCWSTR pUnicode) : oStringBase(sizeof(WCHAR))
     293{
     294    long        strLen = lstrlenW((const WCHAR *)pUnicode) + 1;
     295
     296    getBuf(strLen);
     297    lstrcpyW((LPWSTR)m_strBuf, pUnicode);
     298    m_strLen = strLen;
     299}
     300
     301// Initialise from Unicode string...
     302oStringW::oStringW(const wchar_t * pUnicode) : oStringBase(sizeof(WCHAR))
     303{
     304    long        strLen = lstrlenW((LPWSTR)pUnicode) + 1;
     305
     306    getBuf(strLen);
     307    lstrcpyW((LPWSTR)m_strBuf, (LPCWSTR)pUnicode);
     308    m_strLen = strLen;
     309}
     310
     311// Initialise from ASCII string...
     312oStringW::oStringW(LPCSTR pAscii) : oStringBase(sizeof(WCHAR))
     313{
     314    long        strLen = strlen(pAscii) + 1;
     315
     316    getBuf( strLen);
     317    AsciiToUnicode((char *)pAscii, (LPWSTR)m_strBuf);
     318    m_strLen = strLen;
     319}
     320
     321// Initialise from another oString
     322oStringW::oStringW(const oStringW &ref) : oStringBase(sizeof(WCHAR))
     323{
     324    getBuf( ref.m_strLen);
     325    lstrcpyW((LPWSTR)m_strBuf, (LPWSTR)ref.m_strBuf);
     326    m_strLen = ref.m_strLen;
     327}
     328
     329// Initialise from CLSID
     330oStringW::oStringW( REFCLSID pClsId) : oStringBase(sizeof(WCHAR))
     331{
     332    getBuf( 50);        // Incl. terminator...
     333
     334    // Assign string...
     335    operator=(pClsId);
     336}
     337
     338// Return pointer to string...
     339oStringW::operator LPWSTR()
     340{
     341    return (LPWSTR)m_strBuf;
     342}
     343
     344// Assign
     345oStringW oStringW::operator =  (const oStringW & string)
     346{
     347    // Lose old string...
     348    freeBuf();
     349
     350    // Setup new string...
     351    getBuf( string.m_strLen);
     352    lstrcpyW((LPWSTR)m_strBuf, (LPWSTR)string.m_strBuf);
     353    m_strLen = string.m_strLen;
     354    return *this;
     355}
     356
     357oStringW oStringW::operator =  (LPCSTR pAscii)
     358{
     359    long        strLen = strlen(pAscii) + 1;
     360
     361    // Lose old string...
     362    freeBuf();
     363
     364    // Setup new string...
     365    getBuf( strLen);
     366    AsciiToUnicode((char *)pAscii, (LPWSTR)m_strBuf);
     367    m_strLen = strLen;
     368    return *this;
     369}
     370
     371oStringW oStringW::operator =  (LPCWSTR pUnicode)
     372{
     373    long        strLen = lstrlenW(pUnicode) + 1;
     374
     375    // Lose old string...
     376    freeBuf();
     377
     378    // Setup new string...
     379    getBuf( strLen);
     380    lstrcpyW((LPWSTR)m_strBuf, pUnicode);
     381    m_strLen = strLen;
     382    return *this;
     383}
     384
     385oStringW oStringW::operator =  (const wchar_t * pUnicode)
     386{
     387    long        strLen = lstrlenW((LPWSTR)pUnicode) + 1;
     388
     389    // Lose old string...
     390    freeBuf();
     391
     392    // Setup new string...
     393    getBuf( strLen);
     394    lstrcpyW((LPWSTR)m_strBuf, (LPWSTR)pUnicode);
     395    m_strLen = strLen;
     396    return *this;
     397}
     398
     399oStringW oStringW::operator =  (REFCLSID rClsId)
     400{
     401    char        tmp[50];
     402
     403    // Lose old string...
     404    freeBuf();
     405
     406    // Setup new string...
     407    getBuf( 50);
     408    m_strLen  = sprintf(tmp, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
     409            rClsId->Data1,
     410            rClsId->Data2,
     411            rClsId->Data3,
     412            rClsId->Data4[0],
     413            rClsId->Data4[1],
     414            rClsId->Data4[2],
     415            rClsId->Data4[3],
     416            rClsId->Data4[4],
     417            rClsId->Data4[5],
     418            rClsId->Data4[6],
     419            rClsId->Data4[7]);
     420    AsciiToUnicode(tmp, (LPWSTR)m_strBuf);
     421    return *this;
     422}
     423
     424// Add String to String
     425oStringW oStringW::operator +  (const oStringW & string)
     426{
     427    // two terminators to account for...
     428    oStringW    product(m_strLen + string.m_strLen - 1);
     429
     430    lstrcpyW((LPWSTR)product.m_strBuf, (LPWSTR)m_strBuf);
     431    lstrcpyW((LPWSTR)product.m_strBuf + m_strLen - 1, (LPWSTR)string.m_strBuf);
     432    product.m_strLen = m_strLen + string.m_strLen - 1;
     433
     434    return product;
     435}
     436
     437// Add String to ASCII string
     438oStringW oStringW::operator +  (LPCSTR pAscii)
     439{
     440    long        strLen = m_strLen + strlen(pAscii);
     441
     442    oStringW    product(strLen);
     443
     444    lstrcpyW((LPWSTR)product.m_strBuf, (LPWSTR)m_strBuf);
     445    AsciiToUnicode((char *)pAscii, (LPWSTR)product.m_strBuf + m_strLen - 1);
     446    product.m_strLen = strLen;
     447
     448    return product;
     449}
     450
     451// Add String to UNICODE string
     452oStringW oStringW::operator +  (LPCWSTR pUnicode)
     453{
     454    long        strLen = m_strLen + lstrlenW(pUnicode);
     455
     456    oStringW    product(strLen);
     457
     458    lstrcpyW((LPWSTR)product.m_strBuf, (LPWSTR)m_strBuf);
     459    lstrcpyW((LPWSTR)product.m_strBuf + m_strLen - 1, (LPWSTR)pUnicode);
     460    product.m_strLen = strLen;
     461
     462    return product;
     463}
     464
     465// Add String to UNICODE string
     466oStringW oStringW::operator +  (const wchar_t * pUnicode)
     467{
     468    long        strLen = m_strLen + lstrlenW((LPWSTR)pUnicode);
     469
     470    oStringW    product(strLen);
     471
     472    lstrcpyW((LPWSTR)product.m_strBuf, (LPWSTR)m_strBuf);
     473    lstrcpyW((LPWSTR)product.m_strBuf + m_strLen - 1, (LPWSTR)pUnicode);
     474    product.m_strLen = strLen;
     475
     476    return product;
     477}
     478
     479// Concatenate string object
     480oStringW oStringW::operator += (const oStringW & string)
     481{
     482    // two terminators to account for...
     483    long        strLen = m_strLen + string.m_strLen - 1;
     484
     485    adjBuf( strLen);
     486    lstrcpyW((LPWSTR)m_strBuf + m_strLen - 1, (LPWSTR)string.m_strBuf);
     487    m_strLen = strLen;
     488
     489    return *this;
     490}
     491
     492// Concatenate Ascii string
     493oStringW oStringW::operator +=  (LPCSTR pAscii)
     494{
     495    long        strLen = m_strLen + strlen(pAscii);
     496
     497    adjBuf( strLen);
     498    AsciiToUnicode((char *)pAscii, (LPWSTR)m_strBuf + m_strLen - 1);
     499    m_strLen = strLen;
     500
     501    return *this;
     502}
     503
     504// Concatenate Unicode string
     505oStringW oStringW::operator +=  (LPCWSTR pUnicode)
     506{
     507    long        strLen = m_strLen + lstrlenW(pUnicode);
     508
     509    adjBuf( strLen);
     510    lstrcpyW((LPWSTR)m_strBuf + m_strLen - 1, (LPWSTR)pUnicode);
     511    m_strLen = strLen;
     512
     513    return *this;
     514}
     515
     516// Concatenate Unicode string
     517oStringW oStringW::operator +=  (const wchar_t * pUnicode)
     518{
     519    long        strLen = m_strLen + lstrlenW((LPWSTR)pUnicode);
     520
     521    adjBuf( strLen);
     522    lstrcpyW((LPWSTR)m_strBuf + m_strLen - 1, (LPWSTR)pUnicode);
     523    m_strLen = strLen;
     524
     525    return *this;
     526}
     527
     528
  • trunk/src/ole32/ole32.cpp

    r200 r291  
     1/*
     2 *
     3 * Project Odin Software License can be found in LICENSE.TXT
     4 *
     5 */
     6/*
     7 * COM/OLE misc. functions.
     8 *
     9 * 1/7/99
     10 *
     11 * Copyright 1999 David J. Raison
     12 *
     13 * Some portions from Wine Implementation
     14 *   Copyright 1995  Martin von Loewis
     15 *   Copyright 1998  Justin Bradford
     16 *   Copyright 1999  Francis Beaudet
     17 *   Copyright 1999  Sylvain St-Germain
     18 */
     19
     20#include "ole32.h"
     21
     22#include "oString.h"
     23#include "moniker.h"    // RunningObjectTableImpl_***
     24
     25// ======================================================================
     26// Local Data
     27// ======================================================================
     28typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv);
     29
    130/*
     31 * This linked list contains the list of registered class objects. These
     32 * are mostly used to register the factories for out-of-proc servers of OLE
     33 * objects.
     34 */
     35typedef struct tagRegisteredClass
     36{
     37  CLSID     classIdentifier;
     38  LPUNKNOWN classObject;
     39  DWORD     runContext;
     40  DWORD     connectFlags;
     41  DWORD     dwCookie;
     42  struct tagRegisteredClass* nextClass;
     43} RegisteredClass;
     44
     45static RegisteredClass* firstRegisteredClass = NULL;
     46
     47/*
     48 * COM External Lock structures and methods declaration
    249 *
    3  * Project Odin Software License can be found in LICENSE.TXT
     50 * This api provides a linked list to managed external references to
     51 * COM objects.
    452 *
    553 */
     54
     55#define EL_END_OF_LIST 0
     56#define EL_NOT_FOUND   0
     57
    658/*
    7  * Win32 OLE stubs for OS/2
     59 * Declaration of the static structure that manage the
     60 * external lock to COM  objects.
     61 */
     62typedef struct COM_ExternalLock     COM_ExternalLock;
     63typedef struct COM_ExternalLockList COM_ExternalLockList;
     64
     65struct COM_ExternalLock
     66{
     67    IUnknown         *pUnk;     /* IUnknown referenced */
     68    ULONG            uRefCount; /* external lock counter to IUnknown object*/
     69    COM_ExternalLock *next;     /* Pointer to next element in list */
     70};
     71
     72struct COM_ExternalLockList
     73{
     74    COM_ExternalLock *head;     /* head of list */
     75};
     76
     77/*
     78 * Declaration and initialization of the static structure that manages
     79 * the external lock to COM objects.
     80 */
     81static COM_ExternalLockList elList = { EL_END_OF_LIST };
     82
     83/*
     84 * This open DLL table belongs in a per process table, but my guess is that
     85 * it shouldn't live in the kernel, so I'll put them out here in DLL
     86 * space assuming that there is one OLE32 per process.
     87 */
     88typedef struct tagOpenDll
     89{
     90    char *      DllName;                /* really only needed for debugging */
     91    HINSTANCE   hLibrary;
     92    struct tagOpenDll * next;
     93} OpenDll;
     94
     95static OpenDll * openDllList = NULL;    /* linked list of open dlls */
     96
     97/*
     98 * Com Library reference count...
    899 *
    9  * 1998/06/12
    10  *
    11  * Copyright 1998 Sander van Leeuwen
     100 * Used to control loading / unloading of Library resources,
     101 * Runnng object table, DLL's etc...
    12102 */
    13 
    14 #include "ole32.h"
     103static LONG     COM_ref = 0;
     104
     105// ======================================================================
     106// Prototypes.
     107// ======================================================================
     108static HRESULT COM_GetRegisteredClassObject(
     109        REFCLSID        rclsid,
     110        DWORD           dwClsContext,
     111        LPUNKNOWN *     ppUnk);
     112
     113static void COM_RevokeAllClasses();
     114
     115static void COM_ExternalLockFreeList();
     116
     117static void COM_ExternalLockAddRef(
     118        IUnknown * pUnk);
     119
     120static void COM_ExternalLockRelease(
     121        IUnknown *      pUnk,
     122        BOOL            bRelAll);
     123
     124static BOOL COM_ExternalLockInsert(
     125        IUnknown * pUnk);
     126
     127static void COM_ExternalLockDelete(
     128        COM_ExternalLock * element);
     129
     130static COM_ExternalLock * COM_ExternalLockFind(
     131        IUnknown *      pUnk);
     132
     133static COM_ExternalLock * COM_ExternalLockLocate(
     134        COM_ExternalLock * element,
     135        IUnknown *      pUnk);
     136
     137// ======================================================================
     138// Public API's
     139// ======================================================================
    15140
    16141// ----------------------------------------------------------------------
     
    20145{
    21146    dprintf(("OLE32.CoBuildVersion\n"));
    22     return (rmm<<16)+rup;
    23 }
    24 
     147    return (rmm << 16) + rup;
     148}
     149
     150// ----------------------------------------------------------------------
     151// CoDosDateTimeToFileTime
     152// ----------------------------------------------------------------------
     153BOOL WIN32API CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime,
     154                                         FILETIME *lpFileTime)
     155{
     156    dprintf(("OLE32: CoDosDateTimeToFileTime"));
     157
     158    return DosDateTimeToFileTime(nDosDate, nDosTime, lpFileTime);
     159}
     160
     161// ----------------------------------------------------------------------
     162// CoDosDateTimeToFileTime
     163// ----------------------------------------------------------------------
     164HRESULT WIN32API CoFileTimeNow(FILETIME *lpFileTime)
     165{
     166    SYSTEMTIME systime;
     167
     168    dprintf(("OLE32: CoFileTimeNow"));
     169
     170    GetSystemTime(&systime);
     171    return SystemTimeToFileTime(&systime, lpFileTime);
     172}
     173
     174// ----------------------------------------------------------------------
     175// CoDosDateTimeToFileTime
     176// ----------------------------------------------------------------------
     177BOOL WIN32API CoFileTimeToDosDateTime(FILETIME *lpFileTime, LPWORD lpDosDate,
     178                                         LPWORD lpDosTime)
     179{
     180    dprintf(("OLE32: CoFileTimeToDosDateTime"));
     181
     182    return FileTimeToDosDateTime(lpFileTime, lpDosDate, lpDosTime);
     183}
     184
     185// ----------------------------------------------------------------------
     186// CoInitialize()
     187// ----------------------------------------------------------------------
     188HRESULT WIN32API CoInitialize(LPVOID lpReserved)
     189{
     190    dprintf(("OLE32: CoInitialize\n"));
     191
     192    return CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);
     193}
     194
     195// ----------------------------------------------------------------------
     196// CoInitializeEx()
     197// ----------------------------------------------------------------------
     198HRESULT WIN32API CoInitializeEx(
     199        LPVOID  lpReserved,     // [in] pointer to win32 malloc interface
     200        DWORD   dwCoInit)       // [in] A value from COINIT specifies the thread
     201{
     202    HRESULT             hr;
     203
     204    dprintf(("OLE32: CoInitializeEx(%p, %lx)\n", lpReserved, dwCoInit));
     205
     206    if (lpReserved != NULL)
     207    {
     208        dprintf(("Warning: Bad parameter %p, must be an old Windows Application", lpReserved));
     209    }
     210
     211    /*
     212     * Check for unsupported features.
     213     */
     214    if (dwCoInit != COINIT_APARTMENTTHREADED)
     215    {
     216        dprintf(("Warning: Unsupported flag %lx", dwCoInit));
     217        /* Hope for the best and continue anyway */
     218    }
     219
     220    /*
     221     * Initialise the Running Object Table
     222     */
     223    hr = S_FALSE;
     224    if (++COM_ref == 1)
     225    {
     226        hr = RunningObjectTableImpl_Initialize();
     227        if (hr != S_OK)
     228            --COM_ref;
     229    }
     230
     231    return hr;
     232}
     233
     234// ----------------------------------------------------------------------
     235// CoUninitialize()
     236// ----------------------------------------------------------------------
     237void WIN32API CoUninitialize(void)
     238{
     239    dprintf(("OLE32: CoUninitialize"));
     240
     241    if (--COM_ref == 0)
     242    {
     243        dprintf(("OLE32: Releasing COM libraries"));
     244
     245        RunningObjectTableImpl_UnInitialize();
     246
     247        COM_RevokeAllClasses();
     248
     249        CoFreeAllLibraries();
     250       
     251        COM_ExternalLockFreeList();
     252    }
     253}
     254
     255// ----------------------------------------------------------------------
     256// CoCreateInstance
     257// ----------------------------------------------------------------------
     258HRESULT WIN32API CoCreateInstance
     259   (REFCLSID            rclsid,
     260    LPUNKNOWN           pUnkOuter,
     261    DWORD               dwClsContext,
     262    REFIID              iid,
     263    LPVOID *            ppv)
     264{
     265    HRESULT hres;
     266    LPCLASSFACTORY lpclf = 0;
     267
     268    oStringA            tCLSID(rclsid);
     269    oStringA            tIId(iid);
     270
     271    dprintf(("OLE32: CoCreateInstance"));
     272    dprintf(("       CLSID:%s", (char *)tCLSID));
     273    dprintf(("       IID  :%s", (char *)tIId));
     274
     275    // Sanity check
     276    if (ppv == 0)
     277        return E_POINTER;
     278
     279    *ppv = 0;
     280
     281    // Get a class factory to construct the object we want.
     282    hres = CoGetClassObject(rclsid, dwClsContext, NULL, &IID_IClassFactory, (LPVOID *)&lpclf);
     283
     284    if (FAILED(hres))
     285        return hres;
     286
     287    // Create the object and don't forget to release the factory
     288    hres = IClassFactory_CreateInstance(lpclf, pUnkOuter, iid, ppv);
     289    IClassFactory_Release(lpclf);
     290
     291    return hres;
     292}
     293
     294// ----------------------------------------------------------------------
     295// CoCreateInstanceEx
     296// ----------------------------------------------------------------------
     297HRESULT WIN32API CoCreateInstanceEx
     298   (REFCLSID            rclsid,
     299    LPUNKNOWN           pUnkOuter,
     300    DWORD               dwClsContext,
     301    COSERVERINFO *      pServerInfo,
     302    ULONG               cmq,
     303    MULTI_QI *          pResults)
     304{
     305    IUnknown *          pUnk = NULL;
     306    HRESULT             hr;
     307    ULONG               index;
     308    int                 successCount = 0;
     309
     310    oStringA            tCLSID(rclsid);
     311
     312    dprintf(("OLE32: CoCreateInstanceEx"));
     313    dprintf(("       CLSID:%s", (char *)tCLSID));
     314
     315    // Sanity check
     316    if ( (cmq == 0) || (pResults == NULL))
     317        return E_INVALIDARG;
     318
     319    if (pServerInfo != NULL)
     320        dprintf(("OLE32: CoCreateInstanceEx - pServerInfo not supported!"));
     321
     322    // Initialize all the "out" parameters.
     323    for (index = 0; index < cmq; index++)
     324    {
     325        pResults[index].pItf = NULL;
     326        pResults[index].hr   = E_NOINTERFACE;
     327    }
     328
     329    /*
     330    * Get the object and get it's IUnknown pointer.
     331    */
     332    hr = CoCreateInstance(rclsid, pUnkOuter, dwClsContext, &IID_IUnknown, (VOID**)&pUnk);
     333
     334    if (hr)
     335        return hr;
     336
     337    /*
     338    * Then, query for all the interfaces requested.
     339    */
     340    for (index = 0; index < cmq; index++)
     341    {
     342        pResults[index].hr = IUnknown_QueryInterface(pUnk, pResults[index].pIID, (VOID**)&(pResults[index].pItf));
     343
     344        if (pResults[index].hr == S_OK)
     345            successCount++;
     346    }
     347
     348    /*
     349    * Release our temporary unknown pointer.
     350    */
     351    IUnknown_Release(pUnk);
     352
     353    if (successCount == 0)
     354        return E_NOINTERFACE;
     355
     356    if (successCount != cmq)
     357        return CO_S_NOTALLINTERFACES;
     358
     359    return S_OK;
     360}
     361
     362// ----------------------------------------------------------------------
     363// CoGetClassObject
     364// ----------------------------------------------------------------------
     365HRESULT WIN32API CoGetClassObject
     366   (REFCLSID            rclsid,
     367    DWORD               dwClsContext,
     368    LPVOID              pvReserved,
     369    REFIID              iid,
     370    LPVOID *            ppv)
     371{
     372    LPUNKNOWN           regClassObject;
     373    HRESULT             hres = E_UNEXPECTED;
     374
     375    char                dllName[MAX_PATH+1];
     376    LONG                dllNameLen = sizeof(dllName);
     377    HINSTANCE           hLibrary;
     378
     379    DllGetClassObjectFunc DllGetClassObject;
     380    oStringA            tCLSID(rclsid);
     381
     382#ifdef DEBUG
     383    oStringA            tIId(iid);
     384    dprintf(("OLE32: CoGetClassObject"));
     385    dprintf(("       CLSID:%s", (char *)tCLSID));
     386    dprintf(("       IID  :%s", (char *)tIId));
     387#endif
     388
     389    // First, try and see if we can't match the class ID with one of the
     390    // registered classes.
     391    if (S_OK == COM_GetRegisteredClassObject(rclsid, dwClsContext, &regClassObject))
     392    {
     393        // Get the required interface from the retrieved pointer.
     394        hres = IUnknown_QueryInterface(regClassObject, iid, ppv);
     395
     396        // Since QI got another reference on the pointer, we want to release the
     397        // one we already have. If QI was unsuccessful, this will release the object. This
     398        // is good since we are not returning it in the "out" parameter.
     399        IUnknown_Release(regClassObject);
     400
     401        return hres;
     402    }
     403
     404    // out of process and remote servers not supported yet...
     405    if (dwClsContext & CLSCTX_LOCAL_SERVER)
     406    {
     407        dprintf(("OLE32: CoGetClassObject - CLSCTX_LOCAL_SERVER not supported!\n"));
     408        return E_ACCESSDENIED;
     409    }
     410
     411    if (dwClsContext & CLSCTX_REMOTE_SERVER)
     412    {
     413        dprintf(("OLE32: CoGetClassObject - CLSCTX_REMOTE_SERVER not supported!\n"));
     414        return E_ACCESSDENIED;
     415    }
     416
     417    // Get down to the biz..
     418    if (dwClsContext & (CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER))
     419    {
     420        HKEY    CLSIDkey;
     421        HKEY    key;
     422
     423        /* lookup CLSID in registry key HKCR/CLSID */
     424        hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &CLSIDkey);
     425        if (hres != ERROR_SUCCESS)
     426            return REGDB_E_READREGDB;
     427
     428        hres = RegOpenKeyExA(CLSIDkey, tCLSID, 0, KEY_QUERY_VALUE, &key);
     429        if (hres != ERROR_SUCCESS)
     430        {
     431            RegCloseKey(CLSIDkey);
     432            return REGDB_E_CLASSNOTREG;
     433        }
     434
     435        hres = RegQueryValueA(key, "InprocServer32", dllName, &dllNameLen);
     436        RegCloseKey(key);
     437        RegCloseKey(CLSIDkey);
     438        if (hres != ERROR_SUCCESS)
     439        {
     440            dprintf(("OLE32: CoGetClassObject - InprocServer32 not found in registry"));
     441            return REGDB_E_READREGDB;
     442        }
     443
     444        dprintf(("OLE32: CoGetClassObject - Registry reports InprocServer32 dll as %s\n", dllName));
     445
     446        /* open dll, call DllGetClassFactory */
     447        hLibrary = CoLoadLibrary(dllName, TRUE);
     448        if (hLibrary == 0)
     449        {
     450            dprintf(("OLE32: CoGetClassObject - couldn't load %s\n", dllName));
     451            return E_ACCESSDENIED; /* or should this be CO_E_DLLNOTFOUND? */
     452        }
     453
     454        DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject");
     455        if (!DllGetClassObject)
     456        {
     457            dprintf(("OLE32: CoGetClassObject - couldn't function DllGetClassObject in %s\n", dllName));
     458            /* not sure if this should be called here CoFreeLibrary(hLibrary);*/
     459            return E_ACCESSDENIED;
     460        }
     461
     462        // Ask the DLL for it's class object. (there was a note here about class
     463        // factories but this is good.
     464        return DllGetClassObject(rclsid, iid, ppv);
     465    }
     466    return hres;
     467}
     468
     469// ======================================================================
     470// Private functions.
     471// ======================================================================
     472
     473// ----------------------------------------------------------------------
     474// COM_GetRegisteredClassObject
     475// ----------------------------------------------------------------------
     476// This internal method is used to scan the registered class list to
     477// find a class object.
     478//
     479// Params:
     480//   rclsid        Class ID of the class to find.
     481//   dwClsContext  Class context to match.
     482//   ppv           [out] returns a pointer to the class object. Complying
     483//                 to normal COM usage, this method will increase the
     484//                 reference count on this object.
     485static HRESULT COM_GetRegisteredClassObject
     486   (REFCLSID            rclsid,
     487    DWORD               dwClsContext,
     488    LPUNKNOWN *         ppUnk)
     489{
     490    RegisteredClass* curClass;
     491
     492    oStringA            tCLSID(rclsid);
     493
     494    dprintf(("OLE32: COM_GetRegisteredClassObject"));
     495    dprintf(("       CLSID:%s", (char *)tCLSID));
     496
     497    // Sanity check
     498    if (ppUnk == 0)
     499        return E_POINTER;
     500
     501    // Iterate through the whole list and try to match the class ID.
     502    curClass = firstRegisteredClass;
     503
     504    while (curClass != 0)
     505    {
     506        // Check if we have a match on the class ID.
     507        if (IsEqualGUID(curClass->classIdentifier, rclsid))
     508        {
     509            // Since we don't do out-of process or DCOM just right away,
     510            // let's ignore the class context.
     511
     512            // We have a match, return the pointer to the class object.
     513            *ppUnk = curClass->classObject;
     514
     515            IUnknown_AddRef(curClass->classObject);
     516
     517            return S_OK;
     518        }
     519
     520    // Step to the next class in the list.
     521    curClass = curClass->nextClass;
     522    }
     523
     524    // If we get to here, we haven't found our class.
     525    return S_FALSE;
     526}
     527
     528// ----------------------------------------------------------------------
     529// COM_RevokeAllClasses
     530// ----------------------------------------------------------------------
     531// This method is called when the COM libraries are uninitialized to
     532// release all the references to the class objects registered with
     533// the library
     534static void COM_RevokeAllClasses()
     535{
     536    dprintf(("OLE32: COM_RevokeAllClasses"));
     537
     538    while (firstRegisteredClass != 0)
     539    {
     540        CoRevokeClassObject(firstRegisteredClass->dwCookie);
     541    }
     542}
     543
     544// ----------------------------------------------------------------------
     545// COM_ExternalLockAddRef
     546// ----------------------------------------------------------------------
     547// Method that increments the count for a IUnknown* in the linked
     548// list.  The item is inserted if not already in the list.
     549static void COM_ExternalLockAddRef(IUnknown * pUnk)
     550{
     551    dprintf(("OLE32: COM_ExternalLockAddRef"));
     552
     553    COM_ExternalLock *externalLock = COM_ExternalLockFind(pUnk);
     554
     555    /*
     556     * Add an external lock to the object. If it was already externally
     557     * locked, just increase the reference count. If it was not.
     558     * add the item to the list.
     559     */
     560    if ( externalLock == EL_NOT_FOUND )
     561        COM_ExternalLockInsert(pUnk);
     562    else
     563        externalLock->uRefCount++;
     564
     565    /*
     566     * Add an internal lock to the object
     567     */
     568    IUnknown_AddRef(pUnk);
     569}
     570
     571// ----------------------------------------------------------------------
     572// COM_ExternalLockRelease
     573// ----------------------------------------------------------------------
     574// Method that decrements the count for a IUnknown* in the linked
     575// list.  The item is removed from the list if its count end up at zero or if
     576// bRelAll is TRUE.
     577static void COM_ExternalLockRelease(IUnknown * pUnk, BOOL bRelAll)
     578{
     579    dprintf(("OLE32: COM_ExternalLockRelease"));
     580
     581    COM_ExternalLock * externalLock = COM_ExternalLockFind(pUnk);
     582
     583    if ( externalLock != EL_NOT_FOUND )
     584    {
     585        do
     586        {
     587            externalLock->uRefCount--;  /* release external locks      */
     588            IUnknown_Release(pUnk);     /* release local locks as well */
     589
     590            if ( bRelAll == FALSE )
     591                break;  /* perform single release */
     592
     593        } while ( externalLock->uRefCount > 0 ); 
     594
     595        if ( externalLock->uRefCount == 0 )  /* get rid of the list entry */
     596            COM_ExternalLockDelete(externalLock);
     597    }
     598}
     599
     600// ----------------------------------------------------------------------
     601// COM_ExternalLockFreeList
     602// ----------------------------------------------------------------------
     603// Method that frees the content of the list.
     604static void COM_ExternalLockFreeList()
     605{
     606    dprintf(("OLE32: COM_ExternalLockFreeList"));
     607
     608    COM_ExternalLock *head;
     609
     610    head = elList.head;                 /* grab it by the head             */
     611    while (head != EL_END_OF_LIST)
     612    {
     613        COM_ExternalLockDelete(head);     /* get rid of the head stuff       */
     614
     615        head = elList.head;               /* get the new head...             */
     616    }
     617}
     618
     619// ----------------------------------------------------------------------
     620// COM_ExternalLockDump
     621// ----------------------------------------------------------------------
     622// Method that dump the content of the list.
     623void COM_ExternalLockDump()
     624{
     625    dprintf(("OLE32: COM_ExternalLockDump"));
     626
     627    COM_ExternalLock *current = elList.head;
     628
     629    printf("External lock list:");
     630
     631    while ( current != EL_END_OF_LIST )
     632    {
     633        dprintf(("    %p with %lu references count.\n", current->pUnk, current->uRefCount));
     634
     635        /* Skip to the next item */
     636        current = current->next;
     637    }
     638}
     639
     640// ----------------------------------------------------------------------
     641// COM_ExternalLockFind
     642// ----------------------------------------------------------------------
     643// Find a IUnknown* in the linked list
     644static COM_ExternalLock * COM_ExternalLockFind(IUnknown *pUnk)
     645{
     646    dprintf(("OLE32: COM_ExternalLockFind"));
     647
     648    return COM_ExternalLockLocate(elList.head, pUnk);
     649}
     650
     651// ----------------------------------------------------------------------
     652// COM_ExternalLockLocate
     653// ----------------------------------------------------------------------
     654// Recursivity agent for IUnknownExternalLockList_Find
     655static COM_ExternalLock * COM_ExternalLockLocate( COM_ExternalLock * element, IUnknown * pUnk)
     656{
     657  if ( element == EL_END_OF_LIST ) 
     658    return EL_NOT_FOUND;
     659
     660  else if ( element->pUnk == pUnk )    /* We found it */
     661    return element;
     662
     663  else                                 /* Not the right guy, keep on looking */
     664    return COM_ExternalLockLocate( element->next, pUnk);
     665}
     666
     667// ----------------------------------------------------------------------
     668// COM_ExternalLockInsert
     669// ----------------------------------------------------------------------
     670// Insert a new IUnknown* to the linked list
     671static BOOL COM_ExternalLockInsert(IUnknown * pUnk)
     672{
     673    dprintf(("OLE32: COM_ExternalLockInsert"));
     674
     675    COM_ExternalLock *  newLock      = NULL;
     676    COM_ExternalLock *  previousHead = NULL;
     677
     678    // Allocate space for the new storage object
     679    newLock = (COM_ExternalLock *)HeapAlloc(GetProcessHeap(), 0, sizeof(COM_ExternalLock));
     680
     681    if (newLock != NULL)
     682    {
     683        if ( elList.head == EL_END_OF_LIST )
     684            elList.head = newLock;    /* The list is empty */
     685        else
     686        {
     687            // insert does it at the head
     688            previousHead  = elList.head;
     689            elList.head = newLock;
     690        }
     691
     692        /*
     693         * Set new list item data member
     694         */
     695        newLock->pUnk      = pUnk;
     696        newLock->uRefCount = 1;
     697        newLock->next      = previousHead;
     698
     699        return TRUE;
     700    }
     701
     702    return FALSE;
     703}
     704
     705// ----------------------------------------------------------------------
     706// ExternalLockDelete
     707// ----------------------------------------------------------------------
     708// Method that removes an item from the linked list.
     709static void COM_ExternalLockDelete(COM_ExternalLock * itemList)
     710{
     711    dprintf(("OLE32: ExternalLockDelete"));
     712
     713    COM_ExternalLock *current = elList.head;
     714
     715    if ( current == itemList )
     716    {
     717        // this section handles the deletion of the first node
     718        elList.head = itemList->next;
     719        HeapFree( GetProcessHeap(), 0, itemList); 
     720    }
     721    else
     722    {
     723        do
     724        {
     725            if ( current->next == itemList )   /* We found the item to free  */
     726            {
     727                current->next = itemList->next;  /* readjust the list pointers */
     728
     729                HeapFree( GetProcessHeap(), 0, itemList); 
     730                break;
     731            }
     732
     733            /* Skip to the next item */
     734            current = current->next;
     735
     736        } while ( current != EL_END_OF_LIST );
     737    }
     738}
  • trunk/src/ole32/stubs.cpp

    r206 r291  
    1 /*
    2  *
     1/* 
     2 * 
    33 * Project Odin Software License can be found in LICENSE.TXT
    4  *
     4 * 
    55 */
    6 /*
    7  * Win32 OLE stubs for OS/2
    8  *
    9  * 1998/06/12
    10  *
     6/*
     7 * Win32 COM/OLE stubs for OS/2
     8 *
     9 * 1/7/99
     10 *
     11 * Copyright 1999 David J. Raison
    1112 * Copyright 1998 Sander van Leeuwen
     13 *
    1214 */
    1315
    1416#include "ole32.h"
    15 
    16 
    17 // ----------------------------------------------------------------------
    18 // CoCreateGuid()
    19 // ----------------------------------------------------------------------
    20 HRESULT WIN32API CoCreateGuid(GUID *pguid)
    21 {
    22    dprintf(("OLE32.CoCreateGuid\n"));
    23    memset(pguid, 0, sizeof(GUID));      //TODO: should be random GUID
    24    return S_OK;
    25 }
    2617
    2718//*****************************************************************************
     
    3021                                                  LPUNKNOWN *ppunkMarshaler)
    3122{
    32    dprintf(("CoCreateFreeThreadedMarshaler- stub\n"));
    33    return E_OUTOFMEMORY;
    34 }
    35 //*****************************************************************************
    36 //*****************************************************************************
    37 HRESULT WIN32API CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter,
    38                                      DWORD dwClsContext, REFIID riid,
    39                                      LPVOID *ppv)
    40 {
    41    dprintf(("CoCreateInstance - stub\n"));
    42    return REGDB_E_CLASSNOTREG;
     23    dprintf(("OLE32: CoCreateFreeThreadedMarshaler- stub"));
     24    return E_OUTOFMEMORY;
    4325}
    4426//*******************************************************************************
     
    4628HRESULT WIN32API CoDisconnectObject(IUnknown *pUnk, DWORD dwReserved)
    4729{
    48    dprintf(("CoDisconnectObject - stub\n"));
    49    return S_OK;
    50 }
    51 //*******************************************************************************
    52 //*******************************************************************************
    53 BOOL WIN32API CoDosDateTimeToFileTime(WORD nDosDate, WORD nDosTime,
    54                                          FILETIME *lpFileTime)
    55 {
    56    dprintf(("CoDosDateTimeToFileTime, redundant\n"));
    57    return DosDateTimeToFileTime(nDosDate, nDosTime, lpFileTime);
    58 }
    59 //*******************************************************************************
    60 //*******************************************************************************
    61 HRESULT WIN32API CoFileTimeNow(FILETIME *lpFileTime)
    62 {
    63  SYSTEMTIME systime;
    64 
    65    dprintf(("CoFileTimeNow\n"));
    66    GetSystemTime(&systime);
    67    return SystemTimeToFileTime(&systime, lpFileTime);
    68 }
    69 //*******************************************************************************
    70 //*******************************************************************************
    71 BOOL WIN32API CoFileTimeToDosDateTime(FILETIME *lpFileTime, LPWORD lpDosDate,
    72                                          LPWORD lpDosTime)
    73 {
    74    dprintf(("CoFileTimeToDosDateTime\n"));
    75    return FileTimeToDosDateTime(lpFileTime, lpDosDate, lpDosTime);
     30    dprintf(("OLE32: CoDisconnectObject - stub"));
     31    return S_OK;
    7632}
    7733//*******************************************************************************
     
    8036void WIN32API CoFreeAllLibraries()
    8137{
    82    dprintf(("CoFreeAllLibraries - stub\n"));
    83    return ;
     38    dprintf(("OLE32: CoFreeAllLibraries - stub"));
     39    return ;
    8440}
    8541//*******************************************************************************
     
    8743void WIN32API CoFreeLibrary(HINSTANCE hInst)
    8844{
    89    dprintf(("CoFreeLibrary\n"));
     45    dprintf(("OLE32: CoFreeLibrary"));
    9046   FreeLibrary(hInst);
    9147}
     
    9450void WIN32API CoFreeUnusedLibraries()
    9551{
    96    dprintf(("CoFreeUnusedLibraries - stub\n"));
    97    return ;
     52    dprintf(("OLE32: CoFreeUnusedLibraries - stub"));
     53    return ;
    9854}
    9955//*******************************************************************************
     
    10157HRESULT WIN32API CoGetCallerTID()
    10258{
    103    dprintf(("CoGetCallerTID, UNKNOWN API - stub\n"));
    104    return 0;
    105 }
    106 //*******************************************************************************
    107 //*******************************************************************************
    108 //HRESULT WIN32API CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, REFIID riid, LPVOID *ppv)
    109 HRESULT WIN32API CoGetClassObject(REFCLSID rclsid, DWORD dwClsContext, LPVOID pServerInfo, REFIID riid, LPVOID *ppv)
    110 {
    111    dprintf(("CoGetClassObject - stub\n"));
    112    return REGDB_E_CLASSNOTREG;
     59    dprintf(("OLE32: CoGetCallerTID, UNKNOWN API - stub"));
     60    return 0;
    11361}
    11462//*******************************************************************************
     
    11664HRESULT WIN32API CoGetCurrentLogicalThreadId()
    11765{
    118    dprintf(("CoGetCurrentLogicalThreadId, UNKNOWN API - stub\n"));
    119    return 0;
     66    dprintf(("OLE32: CoGetCurrentLogicalThreadId, UNKNOWN API - stub"));
     67    return 0;
    12068}
    12169//*******************************************************************************
     
    12371DWORD WIN32API CoGetCurrentProcess()
    12472{
    125    dprintf(("CoGetCurrentProcess - stub\n"));
    126    return 666;
     73    dprintf(("OLE32: CoGetCurrentProcess - stub"));
     74    return 666;
    12775}
    12876//*******************************************************************************
     
    13179                                                   LPVOID *ppv)
    13280{
    133    dprintf(("CoGetInterfaceAndReleaseStream - stub\n"));
    134    return E_INVALIDARG;
    135 }
    136 //*******************************************************************************
    137 //*******************************************************************************
    138 HRESULT WIN32API CoGetMalloc(DWORD dwMemContext, LPMALLOC *ppMalloc)
    139 {
    140    dprintf(("CoGetMalloc - stub\n"));
    141    return E_OUTOFMEMORY;
     81    dprintf(("OLE32: CoGetInterfaceAndReleaseStream - stub"));
     82    return E_INVALIDARG;
    14283}
    14384//*******************************************************************************
     
    14788                                        DWORD mshlflags)
    14889{
    149    dprintf(("CoGetMarshalSizeMax - stub\n"));
    150    return CO_E_NOTINITIALIZED;
     90    dprintf(("OLE32: CoGetMarshalSizeMax - stub"));
     91    return CO_E_NOTINITIALIZED;
    15192}
    15293//*******************************************************************************
     
    15495HRESULT WIN32API CoGetPSClsid(REFIID riid, CLSID *pclsid)
    15596{
    156    dprintf(("CoGetPSClsid - stub\n"));
    157    return E_OUTOFMEMORY;
     97    dprintf(("OLE32: CoGetPSClsid - stub"));
     98    return E_OUTOFMEMORY;
    15899}
    159100//*******************************************************************************
     
    163104                                         LPMARSHAL *ppMarshal)
    164105{
    165    dprintf(("CoGetStandardMarshal - stub\n"));
    166    return E_OUTOFMEMORY;
     106    dprintf(("OLE32: CoGetStandardMarshal - stub"));
     107    return E_OUTOFMEMORY;
    167108}
    168109//*******************************************************************************
     
    170111HRESULT WIN32API CoGetState()
    171112{
    172    dprintf(("CoGetState, UNKNOWN API - stub\n"));
    173    return 0;
     113    dprintf(("OLE32: CoGetState, UNKNOWN API - stub"));
     114    return 0;
    174115}
    175116//*******************************************************************************
     
    177118HRESULT WIN32API CoGetTreatAsClass(REFCLSID clsidOld, LPCLSID pclsidNew)
    178119{
    179    dprintf(("CoGetTreatAsClass - stub\n"));
    180    return S_FALSE;
     120    dprintf(("OLE32: CoGetTreatAsClass - stub"));
     121    return S_FALSE;
    181122}
    182123//*******************************************************************************
     
    184125HRESULT WIN32API CoInitializeWOW()
    185126{
    186    dprintf(("CoInitializeWOW, UNKNOWN API - stub\n"));
    187    return 0;
     127    dprintf(("OLE32: CoInitializeWOW, UNKNOWN API - stub"));
     128    return 0;
    188129}
    189130//*******************************************************************************
     
    191132BOOL WIN32API CoIsHandlerConnected(LPUNKNOWN pUnk)
    192133{
    193    dprintf(("CoIsHandlerConnected - stub\n"));
    194    return FALSE;
     134    dprintf(("OLE32: CoIsHandlerConnected - stub"));
     135    return FALSE;
    195136}
    196137//*******************************************************************************
     
    198139BOOL WIN32API CoIsOle1Class(REFCLSID rclsid)
    199140{
    200    dprintf(("CoIsOle1Class - stub\n"));
    201    return S_FALSE;
     141    dprintf(("OLE32: CoIsOle1Class - stub"));
     142    return S_FALSE;
    202143}
    203144//*******************************************************************************
     
    205146HINSTANCE WIN32API CoLoadLibrary(LPSTR lpszLibName, BOOL bAutoFree)
    206147{
    207    dprintf(("CoLoadLibrary\n"));
    208    return LoadLibraryA(lpszLibName);
     148    dprintf(("OLE32: CoLoadLibrary"));
     149    return LoadLibraryA(lpszLibName);
    209150}
    210151//*******************************************************************************
     
    212153HRESULT WIN32API CoLockObjectExternal(IUnknown *pUnk, BOOL fLock, BOOL fLastUnlockReleases)
    213154{
    214    dprintf(("CoLockObjectExternal - stub\n"));
    215    return E_OUTOFMEMORY;
     155    dprintf(("OLE32: CoLockObjectExternal - stub"));
     156    return E_OUTOFMEMORY;
    216157}
    217158//*******************************************************************************
     
    219160HRESULT WIN32API CoMarshalHresult(IStream *pStm, HRESULT hresult)
    220161{
    221    dprintf(("CoMarshalHresult - stub\n"));
    222    return E_OUTOFMEMORY;
     162    dprintf(("OLE32: CoMarshalHresult - stub"));
     163    return E_OUTOFMEMORY;
    223164}
    224165//*******************************************************************************
     
    228169                                                          LPSTREAM *ppStm)
    229170{
    230    dprintf(("CoMarshalInterThreadInterfaceInStream - stub\n"));
    231    return E_OUTOFMEMORY;
     171    dprintf(("OLE32: CoMarshalInterThreadInterfaceInStream - stub"));
     172    return E_OUTOFMEMORY;
    232173}
    233174//*******************************************************************************
     
    237178                                       DWORD mshlflags)
    238179{
    239    dprintf(("CoMarshalInterface - stub\n"));
    240    return E_OUTOFMEMORY;
     180    dprintf(("OLE32: CoMarshalInterface - stub"));
     181    return E_OUTOFMEMORY;
    241182}
    242183//*******************************************************************************
     
    244185HRESULT WIN32API CoQueryReleaseObject()
    245186{
    246    dprintf(("CoQueryReleaseObject, UNKNOWN API - stub\n"));
    247    return 0;
     187    dprintf(("OLE32: CoQueryReleaseObject, UNKNOWN API - stub"));
     188    return 0;
    248189}
    249190//*******************************************************************************
     
    253194                                          LPDWORD lpdwRegister)
    254195{
    255    dprintf(("CoRegisterClassObject - stub\n"));
    256    return E_OUTOFMEMORY;
     196    dprintf(("OLE32: CoRegisterClassObject - stub"));
     197    return E_OUTOFMEMORY;
    257198}
    258199//*******************************************************************************
     
    260201HRESULT WIN32API CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)
    261202{
    262    dprintf(("CoRegisterMallocSpy - stub\n"));
    263    return CO_E_OBJISREG;
     203    dprintf(("OLE32: CoRegisterMallocSpy - stub"));
     204    return CO_E_OBJISREG;
    264205}
    265206//*******************************************************************************
     
    268209                                            LPMESSAGEFILTER *lplpMessageFilter)
    269210{
    270    dprintf(("CoRegisterMessageFilter - stub\n"));
    271    return S_FALSE;
     211    dprintf(("OLE32: CoRegisterMessageFilter - stub"));
     212    return S_FALSE;
    272213}
    273214//*******************************************************************************
     
    275216HRESULT WIN32API CoReleaseMarshalData(IStream *pStm)
    276217{
    277    dprintf(("CoReleaseMarshalData - stub\n"));
    278    return E_OUTOFMEMORY;
     218    dprintf(("OLE32: CoReleaseMarshalData - stub"));
     219    return E_OUTOFMEMORY;
    279220}
    280221//*******************************************************************************
     
    282223HRESULT WIN32API CoRevokeClassObject(DWORD dwRegister)
    283224{
    284    dprintf(("CoRevokeClassObject - stub\n"));
    285    return E_OUTOFMEMORY;
     225    dprintf(("OLE32: CoRevokeClassObject - stub"));
     226    return E_OUTOFMEMORY;
    286227}
    287228//*******************************************************************************
     
    289230HRESULT WIN32API CoRevokeMallocSpy()
    290231{
    291    dprintf(("CoRevokeMallocSpy - stub\n"));
    292    return E_ACCESSDENIED;
     232    dprintf(("OLE32: CoRevokeMallocSpy - stub"));
     233    return E_ACCESSDENIED;
    293234}
    294235//*******************************************************************************
     
    296237HRESULT WIN32API CoSetState()
    297238{
    298    dprintf(("CoSetState, UNKNOWN API - stub\n"));
    299    return 0;
    300 }
    301 //*******************************************************************************
    302 //*******************************************************************************
    303 LPVOID WIN32API CoTaskMemAlloc(ULONG cb)
    304 {
    305    dprintf(("CoTaskMemAlloc\n"));
    306    return malloc(cb);
    307 }
    308 //*******************************************************************************
    309 //*******************************************************************************
    310 void WIN32API CoTaskMemFree(void *pv)
    311 {
    312    dprintf(("CoTaskMemFree\n"));
    313    free(pv);
    314    return;
    315 }
    316 //*******************************************************************************
    317 //*******************************************************************************
    318 LPVOID WIN32API CoTaskMemRealloc(LPVOID pv, ULONG cb)
    319 {
    320    dprintf(("CoTaskMemRealloc - stub\n"));
    321    return NULL;
    322 }
     239    dprintf(("OLE32: CoSetState, UNKNOWN API - stub"));
     240    return 0;
     241}
     242
    323243//*******************************************************************************
    324244//*******************************************************************************
    325245HRESULT WIN32API CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)
    326246{
    327    dprintf(("CoTreatAsClass - stub\n"));
    328    return E_INVALIDARG;
    329 }
    330 //*******************************************************************************
    331 //*******************************************************************************
    332 void WIN32API CoUninitialize()
    333 {
    334    dprintf(("CoUninitialize - stub\n"));
    335    return ;
     247    dprintf(("OLE32: CoTreatAsClass - stub"));
     248    return E_INVALIDARG;
    336249}
    337250//*******************************************************************************
     
    339252void WIN32API CoUnloadingWOW()
    340253{
    341    dprintf(("CoUnloadingWOW, UNKNOWN API - stub\n"));
    342    return ;
     254    dprintf(("OLE32: CoUnloadingWOW, UNKNOWN API - stub"));
     255    return ;
    343256}
    344257//*******************************************************************************
     
    346259HRESULT WIN32API CoUnmarshalHresult(LPSTREAM pStm, HRESULT *phresult)
    347260{
    348    dprintf(("CoUnmarshalHresult - stub\n"));
    349    return S_OK;
     261    dprintf(("OLE32: CoUnmarshalHresult - stub"));
     262    return S_OK;
    350263}
    351264//*******************************************************************************
     
    353266HRESULT WIN32API CoUnmarshalInterface(IStream *pSTm, REFIID riid, void **ppv)
    354267{
    355    dprintf(("CoUnmarshalInterface - stub\n"));
    356    return S_OK;
     268    dprintf(("OLE32: CoUnmarshalInterface - stub"));
     269    return S_OK;
    357270}
    358271
     
    361274void WIN32API OleUninitialize(void)
    362275{
    363   dprintf(("OleUninitialize - stub\n"));
     276  dprintf(("OLE32: OleUninitialize - stub"));
    364277  return;
    365278}
     
    369282                                LPVOID *ppvResult)
    370283{
    371    dprintf(("BindMoniker- stub\n"));
    372    return MK_E_NOOBJECT;
     284    dprintf(("OLE32: BindMoniker- stub"));
     285    return MK_E_NOOBJECT;
    373286}
    374287//*******************************************************************************
     
    376289HRESULT WIN32API CreateAntiMoniker(LPMONIKER *ppmk)
    377290{
    378    dprintf(("CreateAntiMoniker - stub\n"));
    379    return E_OUTOFMEMORY;
     291    dprintf(("OLE32: CreateAntiMoniker - stub"));
     292    return E_OUTOFMEMORY;
    380293}
    381294//*******************************************************************************
     
    383296HRESULT WIN32API CreateBindCtx(DWORD reserved, LPBC *ppbc)
    384297{
    385    dprintf(("CreateBindCtx - stub\n"));
    386    return E_OUTOFMEMORY;
     298    dprintf(("OLE32: CreateBindCtx - stub"));
     299    return E_OUTOFMEMORY;
    387300}
    388301//*******************************************************************************
     
    390303HRESULT WIN32API CreateDataAdviseHolder(IDataAdviseHolder **ppDAHolder)
    391304{
    392    dprintf(("CreateDataAdviseHolder - stub\n"));
    393    return E_OUTOFMEMORY;
     305    dprintf(("OLE32: CreateDataAdviseHolder - stub"));
     306    return E_OUTOFMEMORY;
    394307}
    395308//*******************************************************************************
     
    398311                                    REFIID riid, LPVOID *ppvObj)
    399312{
    400    dprintf(("CreateDataCache - stub\n"));
    401    return E_OUTOFMEMORY;
     313    dprintf(("OLE32: CreateDataCache - stub"));
     314    return E_OUTOFMEMORY;
    402315}
    403316//*******************************************************************************
     
    405318HRESULT WIN32API CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER *ppmk)
    406319{
    407    dprintf(("CreateFileMoniker - stub\n"));
    408    return E_OUTOFMEMORY;
     320    dprintf(("OLE32: CreateFileMoniker - stub"));
     321    return E_OUTOFMEMORY;
    409322}
    410323//*******************************************************************************
     
    413326                                           LPMONIKER *ppmkComposite)
    414327{
    415    dprintf(("CreateGenericComposite - stub\n"));
    416    return E_OUTOFMEMORY;
     328    dprintf(("OLE32: CreateGenericComposite - stub"));
     329    return E_OUTOFMEMORY;
    417330}
    418331//*******************************************************************************
     
    421334                                              ILockBytes **ppkLkbyt)
    422335{
    423    dprintf(("CreateILockBytesOnHGlobal - stub\n"));
    424    return E_OUTOFMEMORY;
     336    dprintf(("OLE32: CreateILockBytesOnHGlobal - stub"));
     337    return E_OUTOFMEMORY;
    425338}
    426339//*******************************************************************************
     
    428341HRESULT WIN32API CreateItemMoniker(LPCOLESTR lpszDelim, LPCOLESTR lpszItem, LPMONIKER *ppmk)
    429342{
    430    dprintf(("CreateItemMoniker - stub\n"));
    431    return E_OUTOFMEMORY;
     343    dprintf(("OLE32: CreateItemMoniker - stub"));
     344    return E_OUTOFMEMORY;
    432345}
    433346//*******************************************************************************
     
    435348HRESULT WIN32API CreateOleAdviseHolder(IOleAdviseHolder ppOAHolder)
    436349{
    437    dprintf(("CreateOleAdviseHolder - stub\n"));
    438    return E_OUTOFMEMORY;
     350    dprintf(("OLE32: CreateOleAdviseHolder - stub"));
     351    return E_OUTOFMEMORY;
    439352}
    440353//*******************************************************************************
     
    442355HRESULT WIN32API CreatePointerMoniker(LPUNKNOWN punk, LPMONIKER *ppmk)
    443356{
    444    dprintf(("CreatePointerMoniker - stub\n"));
    445    return E_OUTOFMEMORY;
     357    dprintf(("OLE32: CreatePointerMoniker - stub"));
     358    return E_OUTOFMEMORY;
    446359}
    447360//*******************************************************************************
     
    450363                                          LPSTREAM *ppstm)
    451364{
    452    dprintf(("CreateStreamOnHGlobal - stub\n"));
    453    return E_OUTOFMEMORY;
     365    dprintf(("OLE32: CreateStreamOnHGlobal - stub"));
     366    return E_OUTOFMEMORY;
    454367}
    455368//*******************************************************************************
     
    457370HRESULT WIN32API DllDebugObjectRPCHook()
    458371{
    459    dprintf(("DllDebugObjectRPCHook, UNKNOWN API - stub\n"));
    460    return 0;
     372    dprintf(("OLE32: DllDebugObjectRPCHook, UNKNOWN API - stub"));
     373    return 0;
    461374}
    462375//*******************************************************************************
     
    464377HRESULT WIN32API DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
    465378{
    466    dprintf(("DllGetClassObject - stub\n"));
    467    return E_OUTOFMEMORY;
     379    dprintf(("OLE32: DllGetClassObject - stub"));
     380    return E_OUTOFMEMORY;
    468381}
    469382//*******************************************************************************
     
    471384HRESULT WIN32API DllGetClassObjectWOW()
    472385{
    473    dprintf(("DllGetClassObjectWOW, UNKNOWN API - stub\n"));
    474    return 0;
     386    dprintf(("OLE32: DllGetClassObjectWOW, UNKNOWN API - stub"));
     387    return 0;
    475388}
    476389//*******************************************************************************
     
    479392                               DWORD dwOKEffect, DWORD *pdwEffect)
    480393{
    481    dprintf(("DoDragDrop - stub\n"));
    482    return E_OUTOFMEMORY;
     394    dprintf(("OLE32: DoDragDrop - stub"));
     395    return E_OUTOFMEMORY;
    483396}
    484397//*******************************************************************************
     
    486399HRESULT WIN32API EnableHookObject()
    487400{
    488    dprintf(("EnableHookObject, UNKNOWN API - stub\n"));
    489    return 0;
     401    dprintf(("OLE32: EnableHookObject, UNKNOWN API - stub"));
     402    return 0;
    490403}
    491404//*******************************************************************************
     
    493406HRESULT WIN32API GetClassFile(LPCWSTR szFileName, CLSID *pclsid)
    494407{
    495    dprintf(("GetClassFile - stub\n"));
    496    return MK_E_CANTOPENFILE;
     408    dprintf(("OLE32: GetClassFile - stub"));
     409    return MK_E_CANTOPENFILE;
    497410}
    498411//*******************************************************************************
     
    500413HRESULT WIN32API GetConvertStg(IStorage *pStg)
    501414{
    502    dprintf(("GetConvertStg - stub\n"));
    503    return STG_E_ACCESSDENIED;
     415    dprintf(("OLE32: GetConvertStg - stub"));
     416    return STG_E_ACCESSDENIED;
    504417}
    505418//*******************************************************************************
     
    507420HRESULT WIN32API GetDocumentBitStg()
    508421{
    509    dprintf(("GetDocumentBitStg, UNKNOWN API - stub\n"));
    510    return 0;
     422    dprintf(("OLE32: GetDocumentBitStg, UNKNOWN API - stub"));
     423    return 0;
    511424}
    512425//*******************************************************************************
     
    514427HRESULT WIN32API GetHGlobalFromILockBytes(ILockBytes *pLkbyt, HGLOBAL *phglobal)
    515428{
    516    dprintf(("GetHGlobalFromILockBytes - stub\n"));
    517    return E_INVALIDARG;
     429    dprintf(("OLE32: GetHGlobalFromILockBytes - stub"));
     430    return E_INVALIDARG;
    518431}
    519432//*******************************************************************************
     
    521434HRESULT WIN32API GetHGlobalFromStream(IStream *pstm, HGLOBAL *phglobal)
    522435{
    523    dprintf(("GetHGlobalFromStream - stub\n"));
    524    return E_INVALIDARG;
     436    dprintf(("OLE32: GetHGlobalFromStream - stub"));
     437    return E_INVALIDARG;
    525438}
    526439//*******************************************************************************
     
    528441HRESULT WIN32API GetHookInterface()
    529442{
    530    dprintf(("GetHookInterface, UNKNOWN API - stub\n"));
    531    return 0;
    532 }
    533 //*******************************************************************************
    534 //*******************************************************************************
    535 //HRESULT WIN32API GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot)
    536 HRESULT WIN32API GetRunningObjectTable(DWORD reserved, LPVOID *pprot)
    537 {
    538    dprintf(("GetRunningObjectTable - stub\n"));
    539    return E_UNEXPECTED;
    540 }
    541 //*******************************************************************************
    542 //*******************************************************************************
    543 HRESULT WIN32API IIDFromString(LPSTR lpsz, LPIID lpiid)
    544 {
    545    dprintf(("IIDFromString - stub\n"));
    546    return E_INVALIDARG;
     443    dprintf(("OLE32: GetHookInterface, UNKNOWN API - stub"));
     444    return 0;
    547445}
    548446//*******************************************************************************
     
    551449                               WORD *lpwCmd)
    552450{
    553    dprintf(("IsAccelerator - stub\n"));
    554    return FALSE;
     451    dprintf(("OLE32: IsAccelerator - stub"));
     452    return FALSE;
    555453}
    556454//*******************************************************************************
     
    558456BOOL WIN32API CONCRETE_IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
    559457{
    560    dprintf(("IsEqualGUID - stub\n"));
    561    return FALSE;
     458    dprintf(("OLE32: IsEqualGUID - stub"));
     459    return FALSE;
    562460}
    563461//*******************************************************************************
     
    565463HRESULT WIN32API IsValidIid(DWORD Iid)
    566464{
    567    dprintf(("IsValidIid, obsolete - stub\n"));
    568    return E_INVALIDARG;
    569 }
    570 //*******************************************************************************
    571 //*******************************************************************************
    572 HRESULT WIN32API IsValidInterface(DWORD interface_)
    573 {
    574    dprintf(("IsValidInterface, obsolete - stub\n"));
    575    return E_INVALIDARG;
     465    dprintf(("OLE32: IsValidIid, obsolete - stub"));
     466    return E_INVALIDARG;
    576467}
    577468//*******************************************************************************
     
    579470HRESULT WIN32API IsValidPtrIn(DWORD ptrIn)
    580471{
    581    dprintf(("IsValidPtrIn, obsolete - stub\n"));
    582    return E_INVALIDARG;
     472    dprintf(("OLE32: IsValidPtrIn, obsolete - stub"));
     473    return E_INVALIDARG;
    583474}
    584475//*******************************************************************************
     
    586477HRESULT WIN32API IsValidPtrOut(DWORD ptrOut)
    587478{
    588    dprintf(("IsValidPtrOut, obsolete - stub\n"));
    589    return E_INVALIDARG;
     479    dprintf(("OLE32: IsValidPtrOut, obsolete - stub"));
     480    return E_INVALIDARG;
    590481}
    591482//*******************************************************************************
     
    594485                                        LPMONIKER *ppmk)
    595486{
    596    dprintf(("MkParseDisplayName - stub\n"));
    597    return E_OUTOFMEMORY;
     487    dprintf(("OLE32: MkParseDisplayName - stub"));
     488    return E_OUTOFMEMORY;
    598489}
    599490//*******************************************************************************
     
    602493                                            LPMONIKER *ppmkCommon)
    603494{
    604    dprintf(("MonikerCommonPrefixWith - stub\n"));
    605    return E_OUTOFMEMORY;
     495    dprintf(("OLE32: MonikerCommonPrefixWith - stub"));
     496    return E_OUTOFMEMORY;
    606497}
    607498//*******************************************************************************
     
    610501                                          LPMONIKER *ppmkRelPath, BOOL dwReserved )
    611502{
    612    dprintf(("MonikerRelativePathTo - stub\n"));
    613    return E_OUTOFMEMORY;
     503    dprintf(("OLE32: MonikerRelativePathTo - stub"));
     504    return E_OUTOFMEMORY;
    614505}
    615506//*******************************************************************************
     
    617508DWORD WIN32API OleBuildVersion()
    618509{
    619    dprintf(("OleBuildVersion, obsolete - stub\n"));
    620    return 666;
     510    dprintf(("OLE32: OleBuildVersion, obsolete - stub"));
     511    return 666;
    621512}
    622513//*******************************************************************************
     
    624515HRESULT WIN32API OleConvertIStorageToOLESTREAM(IStorage *pStg, LPOLESTREAM lpolestream)
    625516{
    626    dprintf(("OleConvertIStorageToOLESTREAM - stub\n"));
    627    return E_INVALIDARG;
     517    dprintf(("OLE32: OleConvertIStorageToOLESTREAM - stub"));
     518    return E_INVALIDARG;
    628519}
    629520//*******************************************************************************
     
    637528                                                 LPOLESTREAM    lpolestream)
    638529{
    639    dprintf(("OleConvertIStorageToOLESTREAMEx - stub\n"));
    640    return(E_INVALIDARG);
     530    dprintf(("OLE32: OleConvertIStorageToOLESTREAMEx - stub"));
     531    return(E_INVALIDARG);
    641532}
    642533//*******************************************************************************
     
    646537                                                  const DVTARGETDEVICE *ptd)
    647538{
    648    dprintf(("OleConvertOLESTREAMToIStorage - stub\n"));
    649    return(E_INVALIDARG);
     539    dprintf(("OLE32: OleConvertOLESTREAMToIStorage - stub"));
     540    return(E_INVALIDARG);
    650541}
    651542//*******************************************************************************
     
    659550                                                 LPSTGMEDIUM    pmedium)
    660551{
    661    dprintf(("OleConvertOLESTREAMToIStorageEx - stub\n"));
    662    return(E_OUTOFMEMORY);
     552    dprintf(("OLE32: OleConvertOLESTREAMToIStorageEx - stub"));
     553    return(E_OUTOFMEMORY);
    663554}
    664555//*******************************************************************************
     
    668559                              IStorage *pStg, void **ppvObject)
    669560{
    670    dprintf(("OleCreate - stub\n"));
    671    return(E_OUTOFMEMORY);
     561    dprintf(("OLE32: OleCreate - stub"));
     562    return(E_OUTOFMEMORY);
    672563}
    673564//*******************************************************************************
     
    676567                                            REFIID riid, LPVOID *ppvObj)
    677568{
    678    dprintf(("OleCreateDefaultHandler - stub\n"));
    679    return(E_OUTOFMEMORY);
     569    dprintf(("OLE32: OleCreateDefaultHandler - stub"));
     570    return(E_OUTOFMEMORY);
    680571}
    681572//*******************************************************************************
     
    685576                                             REFIID riid, LPVOID *ppvObj)
    686577{
    687    dprintf(("OleCreateEmbeddingHelper - stub\n"));
    688    return(E_OUTOFMEMORY);
     578    dprintf(("OLE32: OleCreateEmbeddingHelper - stub"));
     579    return(E_OUTOFMEMORY);
    689580}
    690581//*******************************************************************************
     
    695586                                      LPVOID *ppvObj)
    696587{
    697    dprintf(("OleCreateFromData - stub\n"));
    698    return(DV_E_FORMATETC);
     588    dprintf(("OLE32: OleCreateFromData - stub"));
     589    return(DV_E_FORMATETC);
    699590}
    700591//*******************************************************************************
     
    706597                                      LPVOID *ppvObj)
    707598{
    708    dprintf(("OleCreateFromFile - stub\n"));
    709    return(E_OUTOFMEMORY);
     599    dprintf(("OLE32: OleCreateFromFile - stub"));
     600    return(E_OUTOFMEMORY);
    710601}
    711602//*******************************************************************************
     
    716607                                  LPVOID *ppvObj)
    717608{
    718    dprintf(("OleCreateLink - stub\n"));
    719    return(E_OUTOFMEMORY);
     609    dprintf(("OLE32: OleCreateLink - stub"));
     610    return(E_OUTOFMEMORY);
    720611}
    721612//*******************************************************************************
     
    726617                                          LPVOID *ppvObj)
    727618{
    728    dprintf(("OleCreateLinkFromData - stub\n"));
    729    return(E_OUTOFMEMORY);
     619    dprintf(("OLE32: OleCreateLinkFromData - stub"));
     620    return(E_OUTOFMEMORY);
    730621}
    731622//*******************************************************************************
     
    735626                                        IStorage *pStg, void **ppvObj)
    736627{
    737    dprintf(("OleCreateLinkToFile - stub\n"));
    738    return(STG_E_FILENOTFOUND);
     628    dprintf(("OLE32: OleCreateLinkToFile - stub"));
     629    return(STG_E_FILENOTFOUND);
    739630}
    740631//*******************************************************************************
     
    742633HOLEMENU WIN32API OleCreateMenuDescriptor(HMENU hmenuCombined, LPOLEMENUGROUPWIDTHS lpMenuWidths)
    743634{
    744    dprintf(("OleCreateMenuDescriptor - stub\n"));
    745    return(NULL);
     635    dprintf(("OLE32: OleCreateMenuDescriptor - stub"));
     636    return(NULL);
    746637}
    747638//*******************************************************************************
     
    752643                                            LPVOID *ppvObj)
    753644{
    754    dprintf(("OleCreateStaticFromData - stub\n"));
    755    return(E_OUTOFMEMORY);
     645    dprintf(("OLE32: OleCreateStaticFromData - stub"));
     646    return(E_OUTOFMEMORY);
    756647}
    757648//*******************************************************************************
     
    759650HRESULT WIN32API OleDestroyMenuDescriptor(HOLEMENU holemenu)
    760651{
    761    dprintf(("OleDestroyMenuDescriptor - stub\n"));
    762    return E_OUTOFMEMORY;
     652    dprintf(("OLE32: OleDestroyMenuDescriptor - stub"));
     653    return E_OUTOFMEMORY;
    763654}
    764655//*******************************************************************************
     
    766657HRESULT WIN32API OleDoAutoConvert(IStorage *pStg, LPCLSID pClsidNew)
    767658{
    768    dprintf(("OleDoAutoConvert - stub\n"));
    769    return(E_OUTOFMEMORY);
     659    dprintf(("OLE32: OleDoAutoConvert - stub"));
     660    return(E_OUTOFMEMORY);
    770661}
    771662//*******************************************************************************
     
    774665                            LPCRECT lprcBounds)
    775666{
    776    dprintf(("OleDraw - stub\n"));
    777    return(E_INVALIDARG);
     667    dprintf(("OLE32: OleDraw - stub"));
     668    return(E_INVALIDARG);
    778669}
    779670//*******************************************************************************
     
    781672HANDLE WIN32API OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat, UINT uiFlags)
    782673{
    783    dprintf(("OleDuplicateData - stub\n"));
    784    return(NULL);
     674    dprintf(("OLE32: OleDuplicateData - stub"));
     675    return(NULL);
    785676}
    786677//*******************************************************************************
     
    788679HRESULT WIN32API OleFlushClipboard()
    789680{
    790    dprintf(("OleFlushClipboard - stub\n"));
    791    return(S_OK);
     681    dprintf(("OLE32: OleFlushClipboard - stub"));
     682    return(S_OK);
    792683}
    793684//*******************************************************************************
     
    795686HRESULT WIN32API OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)
    796687{
    797    dprintf(("OleGetAutoConvert - stub\n"));
    798    return(E_OUTOFMEMORY);
     688    dprintf(("OLE32: OleGetAutoConvert - stub"));
     689    return(E_OUTOFMEMORY);
    799690}
    800691//*******************************************************************************
     
    802693HRESULT WIN32API OleGetClipboard(IDataObject **ppDataObj)
    803694{
    804    dprintf(("OleGetClipboard - stub\n"));
    805    return(E_OUTOFMEMORY);
     695    dprintf(("OLE32: OleGetClipboard - stub"));
     696    return(E_OUTOFMEMORY);
    806697}
    807698//*******************************************************************************
     
    809700HGLOBAL WIN32API OleGetIconOfClass(REFCLSID rclsid, LPOLESTR lpszLabel, BOOL fUseTypeAsLabel)
    810701{
    811    dprintf(("OleGetIconOfClass - stub\n"));
    812    return(NULL);
     702    dprintf(("OLE32: OleGetIconOfClass - stub"));
     703    return(NULL);
    813704}
    814705//*******************************************************************************
     
    816707HGLOBAL WIN32API OleGetIconOfFile(LPOLESTR lpszPath, BOOL fUseTypeAsLabel)
    817708{
    818    dprintf(("OleGetIconOfFile - stub\n"));
    819    return(NULL);
     709    dprintf(("OLE32: OleGetIconOfFile - stub"));
     710    return(NULL);
    820711}
    821712//*******************************************************************************
     
    823714HRESULT WIN32API OleInitialize(LPVOID pvReserved)
    824715{
    825    dprintf(("OleInitialize - stub\n"));
     716    dprintf(("OLE32: OleInitialize - stub"));
    826717//   return(E_OUTOFMEMORY);
    827    return(0);
     718    return(0);
    828719}
    829720//*******************************************************************************
     
    831722HRESULT WIN32API OleInitializeWOW()
    832723{
    833    dprintf(("OleInitializeWOW, UNKNOWN API - stub\n"));
    834    return(E_OUTOFMEMORY);
     724    dprintf(("OLE32: OleInitializeWOW, UNKNOWN API - stub"));
     725    return(E_OUTOFMEMORY);
    835726}
    836727//*******************************************************************************
     
    838729HRESULT WIN32API OleIsCurrentClipboard(IDataObject *pDataObject)
    839730{
    840    dprintf(("OleIsCurrentClipboard - stub\n"));
    841    return(S_FALSE);
     731    dprintf(("OLE32: OleIsCurrentClipboard - stub"));
     732    return(S_FALSE);
    842733}
    843734//*******************************************************************************
     
    845736BOOL WIN32API OleIsRunning(LPOLEOBJECT pObject)
    846737{
    847    dprintf(("OleIsRunning - stub\n"));
    848    return(FALSE);
     738    dprintf(("OLE32: OleIsRunning - stub"));
     739    return(FALSE);
    849740}
    850741//*******************************************************************************
     
    853744                            LPVOID *ppvObj)
    854745{
    855    dprintf(("OleLoad - stub\n"));
    856    return(E_OUTOFMEMORY);
     746    dprintf(("OLE32: OleLoad - stub"));
     747    return(E_OUTOFMEMORY);
    857748}
    858749//*******************************************************************************
     
    860751HRESULT WIN32API OleLoadFromStream(IStream *pStm, REFIID riid, void *ppvObj)
    861752{
    862    dprintf(("OleLoadFromStream - stub\n"));
    863    return(E_OUTOFMEMORY);
     753    dprintf(("OLE32: OleLoadFromStream - stub"));
     754    return(E_OUTOFMEMORY);
    864755}
    865756//*******************************************************************************
     
    867758HRESULT WIN32API OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses)
    868759{
    869    dprintf(("OleLockRunning - stub\n"));
    870    return(E_OUTOFMEMORY);
     760    dprintf(("OLE32: OleLockRunning - stub"));
     761    return(E_OUTOFMEMORY);
    871762}
    872763//*******************************************************************************
     
    876767                                                    UINT iIconIndex)
    877768{
    878    dprintf(("OleMetafilePictFromIconAndLabel - stub\n"));
    879    return(NULL);
     769    dprintf(("OLE32: OleMetafilePictFromIconAndLabel - stub"));
     770    return(NULL);
    880771}
    881772//*******************************************************************************
     
    883774HRESULT WIN32API OleNoteObjectVisible(LPUNKNOWN pUnknown, BOOL fVisible)
    884775{
    885    dprintf(("OleNoteObjectVisible - stub\n"));
    886    return(E_OUTOFMEMORY);
     776    dprintf(("OLE32: OleNoteObjectVisible - stub"));
     777    return(E_OUTOFMEMORY);
    887778}
    888779//*******************************************************************************
     
    890781HRESULT WIN32API OleQueryCreateFromData(IDataObject *pSrcDataObject)
    891782{
    892    dprintf(("OleQueryCreateFromData - stub\n"));
    893    return(S_FALSE);
     783    dprintf(("OLE32: OleQueryCreateFromData - stub"));
     784    return(S_FALSE);
    894785}
    895786//*******************************************************************************
     
    897788HRESULT WIN32API OleQueryLinkFromData(IDataObject *pSrcDataObject)
    898789{
    899    dprintf(("OleQueryLinkFromData - stub\n"));
    900    return(S_FALSE);
     790    dprintf(("OLE32: OleQueryLinkFromData - stub"));
     791    return(S_FALSE);
    901792}
    902793//*******************************************************************************
     
    905796                                        LPENUMFORMATETC *ppenumFormatetc)
    906797{
    907    dprintf(("OleRegEnumFormatEtc - stub\n"));
    908    return(E_OUTOFMEMORY);
     798    dprintf(("OLE32: OleRegEnumFormatEtc - stub"));
     799    return(E_OUTOFMEMORY);
    909800}
    910801//*******************************************************************************
     
    912803HRESULT WIN32API OleRegEnumVerbs(REFCLSID clsid, LPENUMOLEVERB *ppenumOleVerb)
    913804{
    914    dprintf(("OleRegEnumVerbs - stub\n"));
    915    return(E_OUTOFMEMORY);
     805    dprintf(("OLE32: OleRegEnumVerbs - stub"));
     806    return(E_OUTOFMEMORY);
    916807}
    917808//*******************************************************************************
     
    919810HRESULT WIN32API OleRegGetMiscStatus(REFCLSID clsid, DWORD dwAspect, DWORD *pdwStatus)
    920811{
    921    dprintf(("OleRegGetMiscStatus - stub\n"));
    922    return(E_OUTOFMEMORY);
     812    dprintf(("OLE32: OleRegGetMiscStatus - stub"));
     813    return(E_OUTOFMEMORY);
    923814}
    924815//*******************************************************************************
     
    927818                                      LPOLESTR *pszUserType)
    928819{
    929    dprintf(("OleRegGetUserType - stub\n"));
    930    return(E_OUTOFMEMORY);
     820    dprintf(("OLE32: OleRegGetUserType - stub"));
     821    return(E_OUTOFMEMORY);
    931822}
    932823//*******************************************************************************
     
    934825HRESULT WIN32API OleRun(LPUNKNOWN pUnknown)
    935826{
    936    dprintf(("OleRun - stub\n"));
    937    return(E_UNEXPECTED);
     827    dprintf(("OLE32: OleRun - stub"));
     828    return(E_UNEXPECTED);
    938829}
    939830//*******************************************************************************
     
    941832HRESULT WIN32API OleSave(IPersistStorage *pPS, IStorage *pStg, BOOL fSameAsLoad)
    942833{
    943    dprintf(("OleSave - stub\n"));
    944    return(STG_E_MEDIUMFULL);
     834    dprintf(("OLE32: OleSave - stub"));
     835    return(STG_E_MEDIUMFULL);
    945836}
    946837//*******************************************************************************
     
    948839HRESULT WIN32API OleSaveToStream(IPersistStorage *pPS, IStream *pStm)
    949840{
    950    dprintf(("OleSaveToStream - stub\n"));
    951    return(STG_E_MEDIUMFULL);
     841    dprintf(("OLE32: OleSaveToStream - stub"));
     842    return(STG_E_MEDIUMFULL);
    952843}
    953844//*******************************************************************************
     
    955846HRESULT WIN32API OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew)
    956847{
    957    dprintf(("OleSetAutoConvert - stub\n"));
    958    return(E_OUTOFMEMORY);
     848    dprintf(("OLE32: OleSetAutoConvert - stub"));
     849    return(E_OUTOFMEMORY);
    959850}
    960851//*******************************************************************************
     
    962853HRESULT WIN32API OleSetClipboard(IDataObject *pDataObj)
    963854{
    964    dprintf(("OleSetClipboard - stub\n"));
    965    return(E_OUTOFMEMORY);
     855    dprintf(("OLE32: OleSetClipboard - stub"));
     856    return(E_OUTOFMEMORY);
    966857}
    967858//*******************************************************************************
     
    969860HRESULT WIN32API OleSetContainedObject(LPUNKNOWN pUnknown, BOOL fContained)
    970861{
    971    dprintf(("OleSetContainedObject - stub\n"));
    972    return(E_OUTOFMEMORY);
     862    dprintf(("OLE32: OleSetContainedObject - stub"));
     863    return(E_OUTOFMEMORY);
    973864}
    974865//*******************************************************************************
     
    979870                                         LPOLEINPLACEACTIVEOBJECT lpActiveObj)
    980871{
    981    dprintf(("OleSetMenuDescriptor - stub\n"));
    982    return(E_FAIL);
     872    dprintf(("OLE32: OleSetMenuDescriptor - stub"));
     873    return(E_FAIL);
    983874}
    984875//*******************************************************************************
     
    988879                                            LPMSG lpmsg)
    989880{
    990    dprintf(("OleTranslateAccelerator - stub\n"));
    991    return(S_FALSE);
     881    dprintf(("OLE32: OleTranslateAccelerator - stub"));
     882    return(S_FALSE);
    992883}
    993884//*******************************************************************************
     
    995886HRESULT WIN32API OpenOrCreateStream()
    996887{
    997    dprintf(("OpenOrCreateStream, UNKNOWN API - stub\n"));
    998    return(E_OUTOFMEMORY);
     888    dprintf(("OLE32: OpenOrCreateStream, UNKNOWN API - stub"));
     889    return(E_OUTOFMEMORY);
    999890}
    1000891//*******************************************************************************
     
    1002893HRESULT WIN32API ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID)
    1003894{
    1004    dprintf(("ProgIDFromCLSID - stub\n"));
    1005    return(REGDB_E_CLASSNOTREG);
     895    dprintf(("OLE32: ProgIDFromCLSID - stub"));
     896    return(REGDB_E_CLASSNOTREG);
    1006897}
    1007898//*******************************************************************************
     
    1009900HRESULT WIN32API ReadClassStg(IStorage *pStg, CLSID *pclsid)
    1010901{
    1011    dprintf(("ReadClassStg - stub\n"));
    1012    return(E_OUTOFMEMORY);
     902    dprintf(("OLE32: ReadClassStg - stub"));
     903    return(E_OUTOFMEMORY);
    1013904}
    1014905//*******************************************************************************
     
    1016907HRESULT WIN32API ReadClassStm(IStream *pStm, CLSID *pclsid)
    1017908{
    1018    dprintf(("ReadClassStm - stub\n"));
    1019    return(STG_E_READFAULT);
     909    dprintf(("OLE32: ReadClassStm - stub"));
     910    return(STG_E_READFAULT);
    1020911}
    1021912//*******************************************************************************
     
    1024915                                       LPWSTR *lplpszUserType)
    1025916{
    1026    dprintf(("ReadFmtUserTypeStg - stub\n"));
    1027    return(E_OUTOFMEMORY);
     917    dprintf(("OLE32: ReadFmtUserTypeStg - stub"));
     918    return(E_OUTOFMEMORY);
    1028919}
    1029920//*******************************************************************************
     
    1031922HRESULT WIN32API ReadOleStg()
    1032923{
    1033    dprintf(("ReadOleStg, UNKNOWN API - stub\n"));
    1034    return(E_OUTOFMEMORY);
     924    dprintf(("OLE32: ReadOleStg, UNKNOWN API - stub"));
     925    return(E_OUTOFMEMORY);
    1035926}
    1036927//*******************************************************************************
     
    1038929HRESULT WIN32API ReadStringStream()
    1039930{
    1040    dprintf(("ReadStringStream, UNKNOWN API - stub\n"));
    1041    return(E_OUTOFMEMORY);
     931    dprintf(("OLE32: ReadStringStream, UNKNOWN API - stub"));
     932    return(E_OUTOFMEMORY);
    1042933}
    1043934//*******************************************************************************
     
    1045936HRESULT WIN32API RegisterDragDrop(HWND hwnd, IDropTarget *pDropTarget)
    1046937{
    1047    dprintf(("RegisterDragDrop - stub\n"));
    1048    return(E_OUTOFMEMORY);
     938    dprintf(("OLE32: RegisterDragDrop - stub"));
     939    return(E_OUTOFMEMORY);
    1049940}
    1050941//*******************************************************************************
     
    1052943void WIN32API ReleaseStgMedium(STGMEDIUM *pmedium)
    1053944{
    1054    dprintf(("ReleaseStgMedium - stub\n"));
    1055    return;
     945    dprintf(("OLE32: ReleaseStgMedium - stub"));
     946    return;
    1056947}
    1057948//*******************************************************************************
     
    1059950HRESULT WIN32API RevokeDragDrop(HWND hwnd)
    1060951{
    1061    dprintf(("RevokeDragDrop - stub\n"));
    1062    return(E_OUTOFMEMORY);
     952    dprintf(("OLE32: RevokeDragDrop - stub"));
     953    return(E_OUTOFMEMORY);
    1063954}
    1064955//*******************************************************************************
     
    1066957HRESULT WIN32API SetConvertStg(IStorage *pStg, BOOL fConvert)
    1067958{
    1068    dprintf(("SetConvertStg - stub\n"));
    1069    return(E_OUTOFMEMORY);
     959    dprintf(("OLE32: SetConvertStg - stub"));
     960    return(E_OUTOFMEMORY);
    1070961}
    1071962//*******************************************************************************
     
    1074965                                     DWORD reserved, IStorage **ppstgOpen)
    1075966{
    1076    dprintf(("StgCreateDocfile - stub\n"));
    1077    return(STG_E_INSUFFICIENTMEMORY);
     967    dprintf(("OLE32: StgCreateDocfile - stub"));
     968    return(STG_E_INSUFFICIENTMEMORY);
    1078969}
    1079970//*******************************************************************************
     
    1081972HRESULT WIN32API SetDocumentBitStg()
    1082973{
    1083    dprintf(("SetDocumentBitStg, UNKNOWN API - stub\n"));
    1084    return(E_OUTOFMEMORY);
     974    dprintf(("OLE32: SetDocumentBitStg, UNKNOWN API - stub"));
     975    return(E_OUTOFMEMORY);
    1085976}
    1086977//*******************************************************************************
     
    1089980                                                 DWORD reserved, IStorage **ppstgOpen)
    1090981{
    1091    dprintf(("StgCreateDocfileOnILockBytes - stub\n"));
    1092    return(STG_E_INSUFFICIENTMEMORY);
     982    dprintf(("OLE32: StgCreateDocfileOnILockBytes - stub"));
     983    return(STG_E_INSUFFICIENTMEMORY);
    1093984}
    1094985//*******************************************************************************
     
    1096987HRESULT WIN32API StgIsStorageFile(const WCHAR *pwcsName)
    1097988{
    1098    dprintf(("StgIsStorageFile - stub\n"));
    1099    return(S_FALSE);
     989    dprintf(("OLE32: StgIsStorageFile - stub"));
     990    return(S_FALSE);
    1100991}
    1101992//*******************************************************************************
     
    1103994HRESULT WIN32API StgIsStorageILockBytes(ILockBytes *plkbyt)
    1104995{
    1105    dprintf(("StgIsStorageILockBytes - stub\n"));
    1106    return(S_FALSE);
     996    dprintf(("OLE32: StgIsStorageILockBytes - stub"));
     997    return(S_FALSE);
    1107998}
    1108999//*******************************************************************************
     
    11121003                                   IStorage **ppstgOpen)
    11131004{
    1114    dprintf(("StgOpenStorage - stub\n"));
    1115    return(STG_E_INSUFFICIENTMEMORY);
     1005    dprintf(("OLE32: StgOpenStorage - stub"));
     1006    return(STG_E_INSUFFICIENTMEMORY);
    11161007}
    11171008//*******************************************************************************
     
    11231014                                               IStorage **ppstgOpen)
    11241015{
    1125    dprintf(("StgOpenStorageOnILockBytes - stub\n"));
    1126    return(STG_E_INSUFFICIENTMEMORY);
     1016    dprintf(("OLE32: StgOpenStorageOnILockBytes - stub"));
     1017    return(STG_E_INSUFFICIENTMEMORY);
    11271018}
    11281019//*******************************************************************************
     
    11311022                                FILETIME const *patime, FILETIME const *pmtime)
    11321023{
    1133    dprintf(("StgSetTimes - stub\n"));
    1134    return(STG_E_FILENOTFOUND);
    1135 }
    1136 //*******************************************************************************
    1137 //Freed in CoTaskMemFree
    1138 //*******************************************************************************
    1139 HRESULT WIN32API StringFromCLSID(REFCLSID rclsid, LPOLESTR *ppsz)
    1140 {
    1141  char   szclass[64];
    1142  WCHAR *szclsid = (WCHAR *)malloc(64*sizeof(WCHAR));
    1143 
    1144    dprintf(("StringFromCLSID\n"));
    1145 
    1146    sprintf(szclass, "[%8X-%4X-%4X-%4X-%4X%8X]", rclsid.Data1, rclsid.Data2, rclsid.Data3,
    1147            *(WORD *)rclsid.Data4, *(WORD *)&rclsid.Data4[2], *(DWORD *)&rclsid.Data4[4]);
    1148    AsciiToUnicode(szclass, szclsid);
    1149    *ppsz = (LPOLESTR)szclsid;
    1150    return(S_OK);
    1151 }
    1152 //*******************************************************************************
    1153 //*******************************************************************************
    1154 int WIN32API StringFromGUID2(REFGUID rguid, LPOLESTR lpsz, int cbMax)
    1155 {
    1156  char szclsid[64];
    1157 
    1158    dprintf(("StringFromGUID2\n"));
    1159    if(cbMax < 55)
    1160         return(0);
    1161 
    1162    sprintf(szclsid, "[%8X-%4X-%4X-%4X-%4X%8X]", rguid.Data1, rguid.Data2, rguid.Data3,
    1163            *(WORD *)rguid.Data4, *(WORD *)&rguid.Data4[2], *(DWORD *)&rguid.Data4[4]);
    1164    AsciiToUnicode(szclsid, lpsz);
    1165    return(55);  //including 0 terminator
    1166 }
    1167 //*******************************************************************************
    1168 //Freed in CoTaskMemFree
    1169 //*******************************************************************************
    1170 HRESULT WIN32API StringFromIID(REFIID riid, LPOLESTR *lplpsz)
    1171 {
    1172  char   szclass[64];
    1173  WCHAR *szclsid = (WCHAR *)malloc(64*sizeof(WCHAR));
    1174 
    1175    dprintf(("StringFromIID\n"));
    1176 
    1177    sprintf(szclass, "[%8X-%4X-%4X-%4X-%4X%8X]", riid.Data1, riid.Data2, riid.Data3,
    1178            *(WORD *)riid.Data4, *(WORD *)&riid.Data4[2], *(DWORD *)&riid.Data4[4]);
    1179 
    1180    AsciiToUnicode(szclass, szclsid);
    1181    *lplpsz = (LPOLESTR)szclsid;
    1182    return(S_OK);
     1024    dprintf(("OLE32: StgSetTimes - stub"));
     1025    return(STG_E_FILENOTFOUND);
    11831026}
    11841027//*******************************************************************************
     
    11861029HRESULT WIN32API UtConvertDvtd16toDvtd32()
    11871030{
    1188    dprintf(("UtConvertDvtd16toDvtd32, UNKNOWN API - stub\n"));
    1189    return(E_OUTOFMEMORY);
     1031    dprintf(("OLE32: UtConvertDvtd16toDvtd32, UNKNOWN API - stub"));
     1032    return(E_OUTOFMEMORY);
    11901033}
    11911034//*******************************************************************************
     
    11931036HRESULT WIN32API UtConvertDvtd32toDvtd16()
    11941037{
    1195    dprintf(("UtConvertDvtd32toDvtd16, UNKNOWN API - stub\n"));
    1196    return(E_OUTOFMEMORY);
     1038    dprintf(("OLE32: UtConvertDvtd32toDvtd16, UNKNOWN API - stub"));
     1039    return(E_OUTOFMEMORY);
    11971040}
    11981041//*******************************************************************************
     
    12001043HRESULT WIN32API UtGetDvtd16Info()
    12011044{
    1202    dprintf(("UtGetDvtd16Info, UNKNOWN API - stub\n"));
    1203    return(E_OUTOFMEMORY);
     1045    dprintf(("OLE32: UtGetDvtd16Info, UNKNOWN API - stub"));
     1046    return(E_OUTOFMEMORY);
    12041047}
    12051048//*******************************************************************************
     
    12071050HRESULT WIN32API UtGetDvtd32Info()
    12081051{
    1209    dprintf(("UtGetDvtd32Info, UNKNOWN API - stub\n"));
    1210    return(E_OUTOFMEMORY);
     1052    dprintf(("OLE32: UtGetDvtd32Info, UNKNOWN API - stub"));
     1053    return(E_OUTOFMEMORY);
    12111054}
    12121055//*******************************************************************************
     
    12141057HRESULT WIN32API WriteClassStg(IStorage *pStg, REFCLSID rclsid)
    12151058{
    1216    dprintf(("WriteClassStg - stub\n"));
    1217    return(STG_E_MEDIUMFULL);
     1059    dprintf(("OLE32: WriteClassStg - stub"));
     1060    return(STG_E_MEDIUMFULL);
    12181061}
    12191062//*******************************************************************************
     
    12211064HRESULT WIN32API WriteClassStm(IStream *pStm, REFCLSID rclsid)
    12221065{
    1223    dprintf(("WriteClassStm - stub\n"));
    1224    return(STG_E_MEDIUMFULL);
     1066    dprintf(("OLE32: WriteClassStm - stub"));
     1067    return(STG_E_MEDIUMFULL);
    12251068}
    12261069//*******************************************************************************
     
    12281071HRESULT WIN32API WriteFmtUserTypeStg(IStorage *pStg, CLIPFORMAT cf, LPWSTR *lpszUserType)
    12291072{
    1230    dprintf(("WriteFmtUserTypeStg - stub\n"));
    1231    return(STG_E_MEDIUMFULL);
     1073    dprintf(("OLE32: WriteFmtUserTypeStg - stub"));
     1074    return(STG_E_MEDIUMFULL);
    12321075}
    12331076//*******************************************************************************
     
    12351078HRESULT WIN32API WriteOleStg()
    12361079{
    1237    dprintf(("WriteOleStg, UNKNOWN API - stub\n"));
    1238    return(E_OUTOFMEMORY);
     1080    dprintf(("OLE32: WriteOleStg, UNKNOWN API - stub"));
     1081    return(E_OUTOFMEMORY);
    12391082}
    12401083//*******************************************************************************
     
    12421085HRESULT WIN32API WriteStringStream()
    12431086{
    1244    dprintf(("WriteStringStream, UNKNOWN API - stub\n"));
    1245    return(E_OUTOFMEMORY);
     1087    dprintf(("OLE32: WriteStringStream, UNKNOWN API - stub"));
     1088    return(E_OUTOFMEMORY);
    12461089}
    12471090//*******************************************************************************
     
    12501093HRESULT WIN32API CoImpersonateClient()          // DCOM - obj_clientserver.h
    12511094{
     1095    dprintf(("OLE32: CoImpersonateClient - Stub"));
    12521096    return(S_OK);
    12531097}
     
    12661110    void                        *pReserved3 )
    12671111{
     1112    dprintf(("OLE32: CoInitializeSecurity - Stub"));
    12681113    return(S_OK);
    12691114}
     
    12731118HRESULT WIN32API CoRegisterSurrogate(LPSURROGATE pSurrogate)    // NT4 SP2, Win95b+
    12741119{
     1120    dprintf(("OLE32: CoRegisterSurrogate - Stub"));
    12751121    return(S_OK);
    12761122}
Note: See TracChangeset for help on using the changeset viewer.