- Timestamp:
- Apr 26, 2001, 9:33:15 PM (24 years ago)
- Location:
- trunk/src/ole32
- Files:
-
- 23 added
- 21 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/clsid.cpp
r3449 r5602 1 /* $Id: clsid.cpp,v 1.1 3 2000-04-25 22:57:00 davidrExp $ */1 /* $Id: clsid.cpp,v 1.14 2001-04-26 19:32:42 sandervl Exp $ */ 2 2 /* 3 3 * … … 27 27 28 28 // ---------------------------------------------------------------------- 29 // CoCreateGuid [OLE32.6]30 //31 // Creates a 128bit GUID.32 // ----------------------------------------------------------------------33 HRESULT WINAPI CoCreateGuid(34 GUID * pguid) /* [out] points to the GUID to initialize */35 {36 HRESULT hr;37 38 dprintf(("OLE32: CoCreateGuid"));39 hr = UuidCreate(pguid);40 41 return hr;42 }43 44 // ----------------------------------------------------------------------45 // CLSIDFromProgID16()46 // ----------------------------------------------------------------------47 HRESULT WIN32API CLSIDFromProgID16(48 LPCOLESTR16 lpszProgID, // [in] - UNICODE program id as found in registry49 LPCLSID pclsid) // [out] - CLSID50 {51 // dprintf(("OLE32: CLSIDFromProgID16"));52 53 LONG lDataLen = 80;54 oStringA szKey(lpszProgID);55 oStringA szCLSID(lDataLen, 1);56 HKEY hKey;57 HRESULT rc;58 59 // Create the registry lookup string...60 szKey += "\\CLSID";61 62 // Try to open the key in the registry...63 rc = RegOpenKeyA(HKEY_CLASSES_ROOT, szKey, &hKey);64 if (rc != 0)65 return OLE_ERROR_GENERIC;66 67 // Now get the data from the _default_ entry on this key...68 rc = RegQueryValueA(hKey, NULL, szCLSID, &lDataLen);69 RegCloseKey(hKey);70 if (rc != 0)71 return OLE_ERROR_GENERIC;72 73 // Now convert from a string to a UUID74 return CLSIDFromString16(szCLSID, pclsid);75 }76 77 // ----------------------------------------------------------------------78 // CLSIDFromProgID()79 // ----------------------------------------------------------------------80 HRESULT WIN32API CLSIDFromProgID(81 LPCOLESTR lpszProgID, // [in] - UNICODE program id as found in registry82 LPCLSID pclsid) // [out] - CLSID83 {84 // dprintf(("OLE32: CLSIDFromProgID"));85 86 LONG lDataLen = 80;87 oStringW szKey(lpszProgID);88 oStringW szCLSID(lDataLen, 1);89 HKEY hKey;90 HRESULT rc;91 92 // Create the registry lookup string...93 szKey += L"\\CLSID";94 95 // Try to open the key in the registry...96 rc = RegOpenKeyW(HKEY_CLASSES_ROOT, szKey, &hKey);97 if (rc != 0)98 return OLE_ERROR_GENERIC;99 100 // Now get the data from the _default_ entry on this key...101 rc = RegQueryValueW(hKey, NULL, szCLSID, &lDataLen);102 RegCloseKey(hKey);103 if (rc != 0)104 return OLE_ERROR_GENERIC;105 106 // Now convert from a string to a UUID107 return CLSIDFromString(szCLSID, pclsid);108 }109 110 // ----------------------------------------------------------------------111 29 // IIDFromString 112 30 // ---------------------------------------------------------------------- … … 118 36 119 37 120 // ----------------------------------------------------------------------121 // CLSIDFromStringA()122 // @@@PH: this is not a WINE API, but a replacement for CLSIDFromString16123 // which used to accept ASCII strings instead of OLE strings124 // ----------------------------------------------------------------------125 38 126 HRESULT WIN32API CLSIDFromStringA(127 LPCSTR lpsz, // [in] - ASCII string CLSID128 LPCLSID pclsid) // [out] - Binary CLSID129 {130 return CLSIDFromString16(lpsz, pclsid);131 }132 133 134 // ----------------------------------------------------------------------135 // CLSIDFromString16()136 // ----------------------------------------------------------------------137 HRESULT WIN32API CLSIDFromString16(138 LPCOLESTR16 lpsz, // [in] - Unicode string CLSID139 LPCLSID pclsid) // [out] - Binary CLSID140 {141 // dprintf(("OLE32: CLSIDFromString16"));142 143 // Convert to binary CLSID144 char *s = (char *) lpsz;145 char *p;146 int i;147 char table[256];148 149 /* quick lookup table */150 memset(table, 0, 256);151 152 for (i = 0; i < 10; i++)153 {154 table['0' + i] = i;155 }156 for (i = 0; i < 6; i++)157 {158 table['A' + i] = i+10;159 table['a' + i] = i+10;160 }161 162 /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */163 164 if (lstrlenA(lpsz) != 38)165 return OLE_ERROR_OBJECT;166 167 p = (char *) pclsid;168 169 s++; /* skip leading brace */170 for (i = 0; i < 4; i++)171 {172 p[3 - i] = table[*s]<<4 | table[*(s+1)];173 s += 2;174 }175 p += 4;176 s++; /* skip - */177 178 for (i = 0; i < 2; i++)179 {180 p[1-i] = table[*s]<<4 | table[*(s+1)];181 s += 2;182 }183 p += 2;184 s++; /* skip - */185 186 for (i = 0; i < 2; i++)187 {188 p[1-i] = table[*s]<<4 | table[*(s+1)];189 s += 2;190 }191 p += 2;192 s++; /* skip - */193 194 /* these are just sequential bytes */195 for (i = 0; i < 2; i++)196 {197 *p++ = table[*s]<<4 | table[*(s+1)];198 s += 2;199 }200 s++; /* skip - */201 202 for (i = 0; i < 6; i++)203 {204 *p++ = table[*s]<<4 | table[*(s+1)];205 s += 2;206 }207 208 return S_OK;209 }210 211 // ----------------------------------------------------------------------212 // CLSIDFromString()213 // ----------------------------------------------------------------------214 HRESULT WIN32API CLSIDFromString(215 LPCOLESTR lpsz, // [in] - Unicode string CLSID216 LPCLSID pclsid) // [out] - Binary CLSID217 {218 // dprintf(("OLE32: CLSIDFromString"));219 220 oStringA tClsId(lpsz);221 222 return CLSIDFromString16(tClsId, pclsid);223 }224 225 // ----------------------------------------------------------------------226 // WINE_StringFromCLSID227 // ----------------------------------------------------------------------228 HRESULT WIN32API WINE_StringFromCLSID(const CLSID *rclsid, LPSTR idstr)229 {230 // dprintf(("OLE32: WINE_StringFromCLSID"));231 232 if (rclsid == NULL)233 {234 dprintf((" clsid: (NULL)"));235 *idstr = 0;236 return E_FAIL;237 }238 239 // Setup new string...240 sprintf(idstr, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",241 rclsid->Data1,242 rclsid->Data2,243 rclsid->Data3,244 rclsid->Data4[0],245 rclsid->Data4[1],246 rclsid->Data4[2],247 rclsid->Data4[3],248 rclsid->Data4[4],249 rclsid->Data4[5],250 rclsid->Data4[6],251 rclsid->Data4[7]);252 253 // dprintf((" clsid: %s", idstr));254 255 return OLE_OK;256 }257 258 // ----------------------------------------------------------------------259 // StringFromCLSID260 // Memory allocated here on behalf of application should be freed using CoTaskMemFree()261 // ----------------------------------------------------------------------262 HRESULT WIN32API StringFromCLSID(REFCLSID rclsid, LPOLESTR *ppsz)263 {264 char tmp[50];265 LPWSTR szclsid;266 size_t strLen;267 268 // dprintf(("OLE32: StringFromCLSID"));269 270 // Setup new string...271 WINE_StringFromCLSID(rclsid, tmp);272 273 strLen = strlen(tmp);274 275 // Grab buffer for string...276 szclsid = (LPWSTR)CoTaskMemAlloc((strLen + 1) * sizeof(WCHAR));277 278 AsciiToUnicode(tmp, szclsid);279 280 *ppsz = (LPOLESTR)szclsid;281 282 return S_OK;283 }284 39 285 40 // ---------------------------------------------------------------------- … … 311 66 312 67 // ---------------------------------------------------------------------- 313 // StringFromGUID2314 // ----------------------------------------------------------------------315 int WIN32API StringFromGUID2(REFGUID rguid, LPOLESTR lpsz, int cbMax)316 {317 // NB cbMax is a CHARACTER count not a BYTE count... :-)318 char tmp[50];319 size_t strLen;320 321 // Setup new string...322 WINE_StringFromCLSID(rguid, tmp);323 324 strLen = (strlen(tmp) + 1);325 if (strLen > cbMax)326 strLen = cbMax;327 328 AsciiToUnicodeN(tmp, lpsz, strLen);329 330 return strLen; // Num CHARACTERS including 0 terminator331 }332 333 // ----------------------------------------------------------------------334 68 // CONCRETE_IsEqualGUID 335 69 // ---------------------------------------------------------------------- … … 339 73 } 340 74 341 // ----------------------------------------------------------------------342 // ReadClassStm343 // ----------------------------------------------------------------------344 HRESULT WIN32API ReadClassStm(IStream *pStm, CLSID *rclsid)345 {346 ULONG nbByte;347 HRESULT res;348 349 dprintf(("OLE32: ReadClassStm"));350 351 if (rclsid == NULL)352 return E_INVALIDARG;353 354 res = IStream_Read(pStm,(void*)rclsid,sizeof(CLSID),&nbByte);355 356 if (FAILED(res))357 return res;358 359 if (nbByte != sizeof(CLSID))360 return S_FALSE;361 362 return S_OK;363 }364 365 // ----------------------------------------------------------------------366 // WriteClassStm367 // ----------------------------------------------------------------------368 HRESULT WIN32API WriteClassStm(IStream *pStm, REFCLSID rclsid)369 {370 dprintf(("OLE32: WriteClassStm"));371 372 if (rclsid == NULL)373 return E_INVALIDARG;374 375 return IStream_Write(pStm, rclsid, sizeof(CLSID), NULL);376 }377 378 // ----------------------------------------------------------------------379 // ProgIDFromCLSID380 // ----------------------------------------------------------------------381 HRESULT WIN32API ProgIDFromCLSID(REFCLSID clsid, LPOLESTR *lplpszProgID)382 {383 oStringA tClsId(clsid);384 oStringA szKey("CLSID\\");385 LONG lDataLen = 255;386 oStringA szProgID(lDataLen, 1);387 HKEY hKey;388 HRESULT rc;389 LPOLESTR tmp;390 LPMALLOC pMllc;391 392 // dprintf(("OLE32: ProgIDFromCLSID"));393 // dprintf((" clsid = %s", (char *)tClsId));394 395 szKey += tClsId + "\\ProgID";396 397 // Open key...398 if (RegOpenKeyA(HKEY_CLASSES_ROOT, szKey, &hKey))399 return REGDB_E_CLASSNOTREG;400 401 // Get default string from the key...402 rc = RegQueryValueA(hKey, NULL, szProgID, &lDataLen);403 RegCloseKey(hKey);404 if (rc != 0)405 return REGDB_E_CLASSNOTREG;406 407 if (CoGetMalloc(0, &pMllc)) // Singleton instance, no need to release408 return E_OUTOFMEMORY;409 410 tmp = (LPOLESTR)IMalloc_Alloc(pMllc, (strlen(szProgID) + 1) * 2);411 if (tmp == NULL)412 return E_OUTOFMEMORY;413 414 AsciiToUnicode(szProgID, tmp);415 *lplpszProgID = tmp;416 417 return S_OK;418 } -
trunk/src/ole32/errorinfo.c
r4659 r5602 9 9 */ 10 10 11 #include <string.h> 11 12 #include "debugtools.h" 12 13 #include "windef.h" … … 169 170 { 170 171 _ICOM_THIS_From_IErrorInfo(ErrorInfoImpl, iface); 171 ////TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvoid);172 TRACE("(%p)->(\n\tIID:\t%s,%p)\n",This,debugstr_guid(riid),ppvoid); 172 173 173 174 *ppvoid = NULL; … … 330 331 { 331 332 _ICOM_THIS_From_ICreateErrorInfo(ErrorInfoImpl, iface); 332 ////TRACE("(%p)->(%s)\n", This, debugstr_guid(rguid));333 TRACE("(%p)->(%s)\n", This, debugstr_guid(rguid)); 333 334 memcpy(&This->m_Guid, rguid, sizeof(GUID)); 334 335 return S_OK; … … 432 433 { 433 434 _ICOM_THIS_From_ISupportErrorInfo(ErrorInfoImpl, iface); 434 ////TRACE("(%p)->(%s)\n", This, debugstr_guid(riid));435 TRACE("(%p)->(%s)\n", This, debugstr_guid(riid)); 435 436 return (IsEqualIID(riid, &This->m_Guid)) ? S_OK : S_FALSE; 436 437 } -
trunk/src/ole32/ole32.cpp
r3177 r5602 1 /* $Id: ole32.cpp,v 1.1 4 2000-03-21 00:37:46 davidrExp $ */1 /* $Id: ole32.cpp,v 1.15 2001-04-26 19:32:49 sandervl Exp $ */ 2 2 /* 3 3 * … … 21 21 #include "ole32.h" 22 22 23 #include "oString.h"24 #include "moniker.h" // RunningObjectTableImpl_***25 #include "filemoniker.h" // FileMonikerImpl_***26 27 // ======================================================================28 // Local Data29 // ======================================================================30 typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv);31 32 /*33 * This linked list contains the list of registered class objects. These34 * are mostly used to register the factories for out-of-proc servers of OLE35 * objects.36 */37 typedef struct tagRegisteredClass38 {39 CLSID classIdentifier;40 LPUNKNOWN classObject;41 DWORD runContext;42 DWORD connectFlags;43 DWORD dwCookie;44 struct tagRegisteredClass* nextClass;45 } RegisteredClass;46 47 static RegisteredClass* firstRegisteredClass = NULL;48 49 /*50 * COM External Lock structures and methods declaration51 *52 * This api provides a linked list to managed external references to53 * COM objects.54 *55 */56 57 #define EL_END_OF_LIST 058 #define EL_NOT_FOUND 059 60 /*61 * Declaration of the static structure that manage the62 * external lock to COM objects.63 */64 typedef struct COM_ExternalLock COM_ExternalLock;65 typedef struct COM_ExternalLockList COM_ExternalLockList;66 67 struct COM_ExternalLock68 {69 IUnknown *pUnk; /* IUnknown referenced */70 ULONG uRefCount; /* external lock counter to IUnknown object*/71 COM_ExternalLock *next; /* Pointer to next element in list */72 };73 74 struct COM_ExternalLockList75 {76 COM_ExternalLock *head; /* head of list */77 };78 79 /*80 * Declaration and initialization of the static structure that manages81 * the external lock to COM objects.82 */83 static COM_ExternalLockList elList = { EL_END_OF_LIST };84 85 /*86 * Com Library reference count...87 *88 * Used to control loading / unloading of Library resources,89 * Runnng object table, DLL's etc...90 */91 static LONG COM_ref = 0;92 93 // ======================================================================94 // Prototypes.95 // ======================================================================96 static HRESULT COM_GetRegisteredClassObject(97 REFCLSID rclsid,98 DWORD dwClsContext,99 LPUNKNOWN * ppUnk);100 101 static void COM_RevokeAllClasses();102 103 static void COM_ExternalLockFreeList();104 105 static void COM_ExternalLockAddRef(106 IUnknown * pUnk);107 108 static void COM_ExternalLockRelease(109 IUnknown * pUnk,110 BOOL bRelAll);111 112 static BOOL COM_ExternalLockInsert(113 IUnknown * pUnk);114 115 static void COM_ExternalLockDelete(116 COM_ExternalLock * element);117 118 static COM_ExternalLock * COM_ExternalLockFind(119 IUnknown * pUnk);120 121 static COM_ExternalLock * COM_ExternalLockLocate(122 COM_ExternalLock * element,123 IUnknown * pUnk);124 125 // ======================================================================126 // Public API's127 // ======================================================================128 129 // ----------------------------------------------------------------------130 // CoBuildVersion()131 // ----------------------------------------------------------------------132 DWORD WIN32API CoBuildVersion()133 {134 dprintf(("OLE32.CoBuildVersion"));135 return (rmm << 16) + rup;136 }137 138 23 // ---------------------------------------------------------------------- 139 24 // CoDosDateTimeToFileTime … … 150 35 // CoDosDateTimeToFileTime 151 36 // ---------------------------------------------------------------------- 152 HRESULT WIN32API CoFileTimeNow(FILETIME *lpFileTime)153 {154 SYSTEMTIME systime;155 156 dprintf(("OLE32: CoFileTimeNow"));157 158 GetSystemTime(&systime);159 return SystemTimeToFileTime(&systime, lpFileTime);160 }161 162 // ----------------------------------------------------------------------163 // CoDosDateTimeToFileTime164 // ----------------------------------------------------------------------165 37 BOOL WIN32API CoFileTimeToDosDateTime(FILETIME *lpFileTime, LPWORD lpDosDate, 166 38 LPWORD lpDosTime) … … 170 42 return FileTimeToDosDateTime(lpFileTime, lpDosDate, lpDosTime); 171 43 } 172 173 // ----------------------------------------------------------------------174 // CoInitialize()175 // ----------------------------------------------------------------------176 HRESULT WIN32API CoInitialize(LPVOID lpReserved)177 {178 dprintf(("OLE32: CoInitialize\n"));179 180 return CoInitializeEx(lpReserved, COINIT_APARTMENTTHREADED);181 }182 183 // ----------------------------------------------------------------------184 // CoInitializeEx()185 // ----------------------------------------------------------------------186 HRESULT WIN32API CoInitializeEx(187 LPVOID lpReserved, // [in] pointer to win32 malloc interface188 DWORD dwCoInit) // [in] A value from COINIT specifies the thread189 {190 HRESULT hr;191 192 dprintf(("OLE32: CoInitializeEx(%p, %lx)\n", lpReserved, dwCoInit));193 194 if (lpReserved != NULL)195 {196 dprintf(("Warning: Bad parameter %p, must be an old Windows Application", lpReserved));197 }198 199 /*200 * Check for unsupported features.201 */202 if (dwCoInit != COINIT_APARTMENTTHREADED)203 {204 dprintf(("Warning: Unsupported flag %lx", dwCoInit));205 /* Hope for the best and continue anyway */206 }207 208 /*209 * Initialise the Running Object Table210 */211 hr = S_FALSE;212 if (++COM_ref == 1)213 {214 hr = RunningObjectTableImpl_Initialize();215 if (hr != S_OK)216 --COM_ref;217 }218 219 return hr;220 }221 222 // ----------------------------------------------------------------------223 // CoUninitialize()224 // ----------------------------------------------------------------------225 void WIN32API CoUninitialize(void)226 {227 dprintf(("OLE32: CoUninitialize"));228 229 if (--COM_ref == 0)230 {231 dprintf(("OLE32: Releasing COM libraries"));232 233 RunningObjectTableImpl_UnInitialize();234 235 COM_RevokeAllClasses();236 237 CoFreeAllLibraries();238 239 COM_ExternalLockFreeList();240 }241 }242 243 // ----------------------------------------------------------------------244 // CoCreateInstance245 // ----------------------------------------------------------------------246 HRESULT WIN32API CoCreateInstance247 (REFCLSID rclsid,248 LPUNKNOWN pUnkOuter,249 DWORD dwClsContext,250 REFIID iid,251 LPVOID * ppv)252 {253 HRESULT hres;254 LPCLASSFACTORY lpclf = 0;255 256 oStringA tCLSID(rclsid);257 oStringA tIId(iid);258 259 dprintf(("OLE32: CoCreateInstance"));260 dprintf((" CLSID:%s", (char *)tCLSID));261 dprintf((" IID :%s", (char *)tIId));262 263 // Sanity check264 if (ppv == 0)265 return E_POINTER;266 267 *ppv = 0;268 269 // Get a class factory to construct the object we want.270 hres = CoGetClassObject(rclsid, dwClsContext, NULL, &IID_IClassFactory, (LPVOID *)&lpclf);271 272 if (FAILED(hres))273 return hres;274 275 // Create the object and don't forget to release the factory276 hres = IClassFactory_CreateInstance(lpclf, pUnkOuter, iid, ppv);277 IClassFactory_Release(lpclf);278 279 return hres;280 }281 282 // ----------------------------------------------------------------------283 // CoCreateInstanceEx284 // ----------------------------------------------------------------------285 HRESULT WIN32API CoCreateInstanceEx286 (REFCLSID rclsid,287 LPUNKNOWN pUnkOuter,288 DWORD dwClsContext,289 COSERVERINFO * pServerInfo,290 ULONG cmq,291 MULTI_QI * pResults)292 {293 IUnknown * pUnk = NULL;294 HRESULT hr;295 ULONG index;296 int successCount = 0;297 298 oStringA tCLSID(rclsid);299 300 dprintf(("OLE32: CoCreateInstanceEx"));301 dprintf((" CLSID:%s", (char *)tCLSID));302 303 // Sanity check304 if ( (cmq == 0) || (pResults == NULL))305 return E_INVALIDARG;306 307 if (pServerInfo != NULL)308 dprintf(("OLE32: CoCreateInstanceEx - pServerInfo not supported!"));309 310 // Initialize all the "out" parameters.311 for (index = 0; index < cmq; index++)312 {313 pResults[index].pItf = NULL;314 pResults[index].hr = E_NOINTERFACE;315 }316 317 /*318 * Get the object and get it's IUnknown pointer.319 */320 hr = CoCreateInstance(rclsid, pUnkOuter, dwClsContext, &IID_IUnknown, (VOID**)&pUnk);321 322 if (hr)323 return hr;324 325 /*326 * Then, query for all the interfaces requested.327 */328 for (index = 0; index < cmq; index++)329 {330 pResults[index].hr = IUnknown_QueryInterface(pUnk, pResults[index].pIID, (VOID**)&(pResults[index].pItf));331 332 if (pResults[index].hr == S_OK)333 successCount++;334 }335 336 /*337 * Release our temporary unknown pointer.338 */339 IUnknown_Release(pUnk);340 341 if (successCount == 0)342 return E_NOINTERFACE;343 344 if (successCount != cmq)345 return CO_S_NOTALLINTERFACES;346 347 return S_OK;348 }349 350 // ----------------------------------------------------------------------351 // CoGetClassObject352 // ----------------------------------------------------------------------353 HRESULT WIN32API CoGetClassObject354 (REFCLSID rclsid,355 DWORD dwClsContext,356 LPVOID pvReserved,357 REFIID iid,358 LPVOID * ppv)359 {360 LPUNKNOWN regClassObject;361 HRESULT hres = E_UNEXPECTED;362 363 char dllName[MAX_PATH+1];364 LONG dllNameLen = sizeof(dllName);365 HINSTANCE hLibrary;366 367 DllGetClassObjectFunc DllGetClassObject;368 oStringA tCLSID(rclsid);369 370 #ifdef DEBUG371 oStringA tIId(iid);372 dprintf(("OLE32: CoGetClassObject"));373 dprintf((" CLSID:%s", (char *)tCLSID));374 dprintf((" IID :%s", (char *)tIId));375 #endif376 377 // First, try and see if we can't match the class ID with one of the378 // registered classes.379 if (S_OK == COM_GetRegisteredClassObject(rclsid, dwClsContext, ®ClassObject))380 {381 // Get the required interface from the retrieved pointer.382 hres = IUnknown_QueryInterface(regClassObject, iid, ppv);383 384 // Since QI got another reference on the pointer, we want to release the385 // one we already have. If QI was unsuccessful, this will release the object. This386 // is good since we are not returning it in the "out" parameter.387 IUnknown_Release(regClassObject);388 389 return hres;390 }391 392 // out of process and remote servers not supported yet...393 if (dwClsContext & CLSCTX_LOCAL_SERVER)394 {395 dprintf(("OLE32: CoGetClassObject - CLSCTX_LOCAL_SERVER not supported!\n"));396 // return E_ACCESSDENIED;397 dwClsContext |= CLSCTX_INPROC_SERVER; // Kludge as VB uses CLSCTX_LOCAL_SERVER398 }399 400 if (dwClsContext & CLSCTX_REMOTE_SERVER)401 {402 dprintf(("OLE32: CoGetClassObject - CLSCTX_REMOTE_SERVER not supported!\n"));403 return E_ACCESSDENIED;404 }405 406 // Get down to the biz..407 if (dwClsContext & (CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER))408 {409 HKEY CLSIDkey;410 HKEY key;411 412 /* lookup CLSID in registry key HKCR/CLSID */413 hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, "CLSID", 0, KEY_READ, &CLSIDkey);414 if (hres != ERROR_SUCCESS)415 return REGDB_E_READREGDB;416 417 hres = RegOpenKeyExA(CLSIDkey, tCLSID, 0, KEY_QUERY_VALUE, &key);418 if (hres != ERROR_SUCCESS)419 {420 RegCloseKey(CLSIDkey);421 return REGDB_E_CLASSNOTREG;422 }423 424 hres = RegQueryValueA(key, "InprocServer32", dllName, &dllNameLen);425 RegCloseKey(key);426 RegCloseKey(CLSIDkey);427 if (hres != ERROR_SUCCESS)428 {429 dprintf(("OLE32: CoGetClassObject - InprocServer32 not found in registry"));430 return REGDB_E_READREGDB;431 }432 433 dprintf(("OLE32: CoGetClassObject - Registry reports InprocServer32 dll as %s\n", dllName));434 435 /* open dll, call DllGetClassFactory */436 hLibrary = CoLoadLibrary(dllName, TRUE);437 if (hLibrary == 0)438 {439 dprintf(("OLE32: CoGetClassObject - couldn't load %s\n", dllName));440 return E_ACCESSDENIED; /* or should this be CO_E_DLLNOTFOUND? */441 }442 443 DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject");444 if (!DllGetClassObject)445 {446 dprintf(("OLE32: CoGetClassObject - couldn't function DllGetClassObject in %s\n", dllName));447 /* not sure if this should be called here CoFreeLibrary(hLibrary);*/448 return E_ACCESSDENIED;449 }450 451 // Ask the DLL for it's class object. (there was a note here about class452 // factories but this is good.453 return DllGetClassObject(rclsid, iid, ppv);454 }455 return hres;456 }457 458 // ----------------------------------------------------------------------459 // CoLockObjectExternal460 // ----------------------------------------------------------------------461 HRESULT WIN32API CoLockObjectExternal(IUnknown *pUnk, BOOL fLock, BOOL fLastUnlockReleases)462 {463 dprintf(("OLE32: CoLockObjectExternal"));464 465 if (fLock)466 {467 /*468 * Increment the external lock coutner, COM_ExternalLockAddRef also469 * increment the object's internal lock counter.470 */471 COM_ExternalLockAddRef( pUnk);472 }473 else474 {475 /*476 * Decrement the external lock coutner, COM_ExternalLockRelease also477 * decrement the object's internal lock counter.478 */479 COM_ExternalLockRelease( pUnk, fLastUnlockReleases);480 }481 482 return S_OK;483 }484 485 // ----------------------------------------------------------------------486 // CoRegisterClassObject487 // ----------------------------------------------------------------------488 HRESULT WIN32API CoRegisterClassObject(489 REFCLSID rclsid,490 LPUNKNOWN pUnk,491 DWORD dwClsContext, // Context in which to run the executable492 DWORD flags, // how connections are made493 LPDWORD lpdwRegister)494 {495 RegisteredClass * newClass;496 LPUNKNOWN foundObject;497 HRESULT hr;498 oStringA tClsid(rclsid);499 500 dprintf(("OLE32: CoRegisterClassObject(%s)", (char *)tClsid));501 502 // Perform a sanity check on the parameters503 if ((lpdwRegister == 0) || (pUnk == 0))504 return E_INVALIDARG;505 506 // Initialize the cookie (out parameter)507 *lpdwRegister = 0;508 509 // First, check if the class is already registered.510 // If it is, this should cause an error.511 hr = COM_GetRegisteredClassObject(rclsid, dwClsContext, &foundObject);512 if (hr == S_OK)513 {514 // The COM_GetRegisteredClassObject increased the reference count on the515 // object so it has to be released.516 IUnknown_Release(foundObject);517 518 return CO_E_OBJISREG;519 }520 521 // If it is not registered, we must create a new entry for this class and522 // append it to the registered class list.523 // We use the address of the chain node as the cookie since we are sure it's524 // unique.525 newClass = (RegisteredClass *)HeapAlloc(GetProcessHeap(), 0, sizeof(RegisteredClass));526 527 // Initialize the node.528 newClass->classIdentifier = *rclsid;529 newClass->runContext = dwClsContext;530 newClass->connectFlags = flags;531 newClass->dwCookie = (DWORD)newClass;532 newClass->nextClass = firstRegisteredClass;533 534 // Since we're making a copy of the object pointer, we have to increase it's535 // reference count.536 newClass->classObject = pUnk;537 IUnknown_AddRef(newClass->classObject);538 539 firstRegisteredClass = newClass;540 541 // Assign the out parameter (cookie)542 *lpdwRegister = newClass->dwCookie;543 544 return S_OK;545 }546 547 // ----------------------------------------------------------------------548 // CoRevokeClassObject549 //550 // This method will remove a class object from the class registry551 // ----------------------------------------------------------------------552 HRESULT WIN32API CoRevokeClassObject(DWORD dwRegister)553 {554 RegisteredClass * * prevClassLink;555 RegisteredClass * curClass;556 557 dprintf(("OLE32: CoRevokeClassObject"));558 559 // Iterate through the whole list and try to match the cookie.560 curClass = firstRegisteredClass;561 prevClassLink = &firstRegisteredClass;562 563 while (curClass != 0)564 {565 // Check if we have a match on the cookie.566 if (curClass->dwCookie == dwRegister)567 {568 // Remove the class from the chain.569 *prevClassLink = curClass->nextClass;570 571 // Release the reference to the class object.572 IUnknown_Release(curClass->classObject);573 574 // Free the memory used by the chain node.575 HeapFree(GetProcessHeap(), 0, curClass);576 577 return S_OK;578 }579 580 // Step to the next class in the list.581 prevClassLink = &(curClass->nextClass);582 curClass = curClass->nextClass;583 }584 585 return E_INVALIDARG;586 }587 588 // ----------------------------------------------------------------------589 // GetClassFile590 //591 // This function supplies the CLSID associated with the given filename.592 // ----------------------------------------------------------------------593 HRESULT WIN32API GetClassFile(LPOLESTR filePathName, CLSID *pclsid)594 {595 IStorage * pstg = 0;596 HRESULT res;597 int nbElm = 0;598 int length = 0;599 int i = 0;600 LONG sizeProgId = 20;601 LPOLESTR * pathDec = 0;602 LPOLESTR absFile = 0;603 LPOLESTR progId = 0;604 WCHAR extention[100] = {0};605 606 dprintf(("OLE32: GetClassFile"));607 608 // if the file contain a storage object the return the CLSID609 // writen by IStorage_SetClass method610 611 if((StgIsStorageFile(filePathName)) == S_OK)612 {613 res = StgOpenStorage(filePathName, NULL, STGM_READ | STGM_SHARE_DENY_WRITE, NULL, 0, &pstg);614 615 if (SUCCEEDED(res))616 res = ReadClassStg(pstg, pclsid);617 618 IStorage_Release(pstg);619 620 return res;621 }622 623 /* if the obove strategies fail then search for the extension key in the registry */624 625 /* get the last element (absolute file) in the path name */626 nbElm = FileMonikerImpl_DecomposePath(filePathName, &pathDec);627 absFile = pathDec[nbElm-1];628 629 /* failed if the path represente a directory and not an absolute file name*/630 if (lstrcmpW(absFile, (LPOLESTR)"\\"))631 return MK_E_INVALIDEXTENSION;632 633 /* get the extension of the file */634 length = lstrlenW(absFile);635 for(i = length-1; ( (i >= 0) && (extention[i] = absFile[i]) ); i--);636 637 /* get the progId associated to the extension */638 progId = (WCHAR *)CoTaskMemAlloc(sizeProgId);639 640 res = RegQueryValueW(HKEY_CLASSES_ROOT, extention, progId, &sizeProgId);641 642 if (res == ERROR_MORE_DATA)643 {644 CoTaskMemRealloc(progId,sizeProgId);645 646 res = RegQueryValueW(HKEY_CLASSES_ROOT, extention, progId, &sizeProgId);647 }648 if (res == ERROR_SUCCESS)649 /* return the clsid associated to the progId */650 res = CLSIDFromProgID(progId, pclsid);651 652 for(i = 0; pathDec[i] != NULL; i++)653 CoTaskMemFree(pathDec[i]);654 655 CoTaskMemFree(pathDec);656 657 CoTaskMemFree(progId);658 659 if (res == ERROR_SUCCESS)660 return res;661 662 return MK_E_INVALIDEXTENSION;663 }664 // ======================================================================665 // Private functions.666 // ======================================================================667 668 // ----------------------------------------------------------------------669 // COM_GetRegisteredClassObject670 // ----------------------------------------------------------------------671 // This internal method is used to scan the registered class list to672 // find a class object.673 //674 // Params:675 // rclsid Class ID of the class to find.676 // dwClsContext Class context to match.677 // ppv [out] returns a pointer to the class object. Complying678 // to normal COM usage, this method will increase the679 // reference count on this object.680 static HRESULT COM_GetRegisteredClassObject681 (REFCLSID rclsid,682 DWORD dwClsContext,683 LPUNKNOWN * ppUnk)684 {685 RegisteredClass* curClass;686 687 oStringA tCLSID(rclsid);688 689 dprintf(("OLE32: COM_GetRegisteredClassObject"));690 dprintf((" CLSID:%s", (char *)tCLSID));691 692 // Sanity check693 if (ppUnk == 0)694 return E_POINTER;695 696 // Iterate through the whole list and try to match the class ID.697 curClass = firstRegisteredClass;698 699 while (curClass != 0)700 {701 // Check if we have a match on the class ID.702 if (IsEqualGUID(&curClass->classIdentifier, rclsid))703 {704 // Since we don't do out-of process or DCOM just right away,705 // let's ignore the class context.706 707 // We have a match, return the pointer to the class object.708 *ppUnk = curClass->classObject;709 710 IUnknown_AddRef(curClass->classObject);711 712 return S_OK;713 }714 715 // Step to the next class in the list.716 curClass = curClass->nextClass;717 }718 719 // If we get to here, we haven't found our class.720 return S_FALSE;721 }722 723 // ----------------------------------------------------------------------724 // COM_RevokeAllClasses725 // ----------------------------------------------------------------------726 // This method is called when the COM libraries are uninitialized to727 // release all the references to the class objects registered with728 // the library729 static void COM_RevokeAllClasses()730 {731 dprintf(("OLE32: COM_RevokeAllClasses"));732 733 while (firstRegisteredClass != 0)734 {735 CoRevokeClassObject(firstRegisteredClass->dwCookie);736 }737 }738 739 // ----------------------------------------------------------------------740 // COM_ExternalLockAddRef741 // ----------------------------------------------------------------------742 // Method that increments the count for a IUnknown* in the linked743 // list. The item is inserted if not already in the list.744 static void COM_ExternalLockAddRef(IUnknown * pUnk)745 {746 dprintf(("OLE32: COM_ExternalLockAddRef"));747 748 COM_ExternalLock *externalLock = COM_ExternalLockFind(pUnk);749 750 /*751 * Add an external lock to the object. If it was already externally752 * locked, just increase the reference count. If it was not.753 * add the item to the list.754 */755 if ( externalLock == EL_NOT_FOUND )756 COM_ExternalLockInsert(pUnk);757 else758 externalLock->uRefCount++;759 760 /*761 * Add an internal lock to the object762 */763 IUnknown_AddRef(pUnk);764 }765 766 // ----------------------------------------------------------------------767 // COM_ExternalLockRelease768 // ----------------------------------------------------------------------769 // Method that decrements the count for a IUnknown* in the linked770 // list. The item is removed from the list if its count end up at zero or if771 // bRelAll is TRUE.772 static void COM_ExternalLockRelease(IUnknown * pUnk, BOOL bRelAll)773 {774 dprintf(("OLE32: COM_ExternalLockRelease"));775 776 COM_ExternalLock * externalLock = COM_ExternalLockFind(pUnk);777 778 if ( externalLock != EL_NOT_FOUND )779 {780 do781 {782 externalLock->uRefCount--; /* release external locks */783 IUnknown_Release(pUnk); /* release local locks as well */784 785 if ( bRelAll == FALSE )786 break; /* perform single release */787 788 } while ( externalLock->uRefCount > 0 );789 790 if ( externalLock->uRefCount == 0 ) /* get rid of the list entry */791 COM_ExternalLockDelete(externalLock);792 }793 }794 795 // ----------------------------------------------------------------------796 // COM_ExternalLockFreeList797 // ----------------------------------------------------------------------798 // Method that frees the content of the list.799 static void COM_ExternalLockFreeList()800 {801 dprintf(("OLE32: COM_ExternalLockFreeList"));802 803 COM_ExternalLock *head;804 805 head = elList.head; /* grab it by the head */806 while (head != EL_END_OF_LIST)807 {808 COM_ExternalLockDelete(head); /* get rid of the head stuff */809 810 head = elList.head; /* get the new head... */811 }812 }813 814 // ----------------------------------------------------------------------815 // COM_ExternalLockDump816 // ----------------------------------------------------------------------817 // Method that dump the content of the list.818 void COM_ExternalLockDump()819 {820 dprintf(("OLE32: COM_ExternalLockDump"));821 822 COM_ExternalLock *current = elList.head;823 824 printf("External lock list:");825 826 while ( current != EL_END_OF_LIST )827 {828 dprintf((" %p with %lu references count.\n", current->pUnk, current->uRefCount));829 830 /* Skip to the next item */831 current = current->next;832 }833 }834 835 // ----------------------------------------------------------------------836 // COM_ExternalLockFind837 // ----------------------------------------------------------------------838 // Find a IUnknown* in the linked list839 static COM_ExternalLock * COM_ExternalLockFind(IUnknown *pUnk)840 {841 dprintf(("OLE32: COM_ExternalLockFind"));842 843 return COM_ExternalLockLocate(elList.head, pUnk);844 }845 846 // ----------------------------------------------------------------------847 // COM_ExternalLockLocate848 // ----------------------------------------------------------------------849 // Recursivity agent for IUnknownExternalLockList_Find850 static COM_ExternalLock * COM_ExternalLockLocate( COM_ExternalLock * element, IUnknown * pUnk)851 {852 if ( element == EL_END_OF_LIST )853 return EL_NOT_FOUND;854 855 else if ( element->pUnk == pUnk ) /* We found it */856 return element;857 858 else /* Not the right guy, keep on looking */859 return COM_ExternalLockLocate( element->next, pUnk);860 }861 862 // ----------------------------------------------------------------------863 // COM_ExternalLockInsert864 // ----------------------------------------------------------------------865 // Insert a new IUnknown* to the linked list866 static BOOL COM_ExternalLockInsert(IUnknown * pUnk)867 {868 dprintf(("OLE32: COM_ExternalLockInsert"));869 870 COM_ExternalLock * newLock = NULL;871 COM_ExternalLock * previousHead = NULL;872 873 // Allocate space for the new storage object874 newLock = (COM_ExternalLock *)HeapAlloc(GetProcessHeap(), 0, sizeof(COM_ExternalLock));875 876 if (newLock != NULL)877 {878 if ( elList.head == EL_END_OF_LIST )879 elList.head = newLock; /* The list is empty */880 else881 {882 // insert does it at the head883 previousHead = elList.head;884 elList.head = newLock;885 }886 887 /*888 * Set new list item data member889 */890 newLock->pUnk = pUnk;891 newLock->uRefCount = 1;892 newLock->next = previousHead;893 894 return TRUE;895 }896 897 return FALSE;898 }899 900 // ----------------------------------------------------------------------901 // ExternalLockDelete902 // ----------------------------------------------------------------------903 // Method that removes an item from the linked list.904 static void COM_ExternalLockDelete(COM_ExternalLock * itemList)905 {906 dprintf(("OLE32: ExternalLockDelete"));907 908 COM_ExternalLock *current = elList.head;909 910 if ( current == itemList )911 {912 // this section handles the deletion of the first node913 elList.head = itemList->next;914 HeapFree( GetProcessHeap(), 0, itemList);915 }916 else917 {918 do919 {920 if ( current->next == itemList ) /* We found the item to free */921 {922 current->next = itemList->next; /* readjust the list pointers */923 924 HeapFree( GetProcessHeap(), 0, itemList);925 break;926 }927 928 /* Skip to the next item */929 current = current->next;930 931 } while ( current != EL_END_OF_LIST );932 }933 } -
trunk/src/ole32/ole32.mak
r5579 r5602 1 # $Id: ole32.mak,v 1. 5 2001-04-24 19:44:38sandervl Exp $1 # $Id: ole32.mak,v 1.6 2001-04-26 19:32:49 sandervl Exp $ 2 2 3 3 # … … 25 25 CDEFINES = $(CDEFINES) -DNONAMELESSSTRUCT 26 26 !endif 27 CDEFINES = $(CDEFINES) -DWINE_LARGE_INTEGER 27 28 28 29 # … … 43 44 $(OBJDIR)\initialise.obj \ 44 45 $(OBJDIR)\itemmoniker.obj \ 45 $(OBJDIR)\iunknown.obj \46 46 $(OBJDIR)\imessagefilter.obj \ 47 $(OBJDIR)\library.obj \48 47 $(OBJDIR)\memlockbytes.obj \ 49 48 $(OBJDIR)\moniker.obj \ … … 52 51 $(OBJDIR)\ole2.obj \ 53 52 $(OBJDIR)\oleobj.obj \ 54 $(OBJDIR)\oleClip.obj \ 55 $(OBJDIR)\oleDrag.obj \ 56 $(OBJDIR)\oleMenu.obj \ 53 $(OBJDIR)\compobj.obj \ 54 $(OBJDIR)\clipboard.obj \ 55 $(OBJDIR)\ole2stubs.obj \ 56 $(OBJDIR)\ole32_main.obj \ 57 $(OBJDIR)\initterm.obj \ 57 58 $(OBJDIR)\stg_bigblockfile.obj \ 58 59 $(OBJDIR)\stg_stream.obj \ 59 60 $(OBJDIR)\storage32.obj \ 60 61 $(OBJDIR)\stubs.obj \ 61 $(OBJDIR)\taskmem.obj \ 62 $(OBJDIR)\ole32rsrc.obj \ 63 $(DLLENTRY) 62 $(OBJDIR)\ifs.obj \ 63 $(OBJDIR)\ole32rsrc.obj 64 64 65 65 -
trunk/src/ole32/stg_bigblockfile.c
r5026 r5602 20 20 21 21 #ifdef __WIN32OS2__ 22 #define WINE_LARGE_INTEGER23 22 #define inline 24 23 -
trunk/src/ole32/stg_stream.c
r5026 r5602 10 10 */ 11 11 #ifdef __WIN32OS2__ 12 #define WINE_LARGE_INTEGER13 12 14 13 #include <odin.h> -
trunk/src/ole32/storage32.c
r5026 r5602 12 12 13 13 #ifdef __WIN32OS2__ 14 #define WINE_LARGE_INTEGER15 16 14 #include <odin.h> 17 15 #include "ole32.h" 18 16 #include "heapstring.h" 19 20 17 #endif 21 18 … … 5304 5301 WCHAR prefix[] = { 'S', 'T', 'O', 0 }; 5305 5302 5303 if (!(grfMode & STGM_SHARE_EXCLUSIVE)) 5304 return STG_E_INVALIDFLAG; 5305 if (!(grfMode & (STGM_WRITE|STGM_READWRITE))) 5306 return STG_E_INVALIDFLAG; 5307 5306 5308 memset(tempPath, 0, sizeof(tempPath)); 5307 5309 memset(tempFileName, 0, sizeof(tempFileName)); … … 5314 5316 else 5315 5317 return STG_E_INSUFFICIENTMEMORY; 5318 5319 creationMode = TRUNCATE_EXISTING; 5320 } 5321 else 5322 { 5323 creationMode = GetCreationModeFromSTGM(grfMode); 5316 5324 } 5317 5325 … … 5321 5329 shareMode = GetShareModeFromSTGM(grfMode); 5322 5330 accessMode = GetAccessModeFromSTGM(grfMode); 5323 creationMode = GetCreationModeFromSTGM(grfMode);5324 5331 5325 5332 if (grfMode & STGM_DELETEONRELEASE) … … 5485 5492 { 5486 5493 HeapFree(GetProcessHeap(), 0, newStorage); 5494 /* 5495 * According to the docs if the file is not a storage, return STG_E_FILEALREADYEXISTS 5496 */ 5497 if(hr == STG_E_INVALIDHEADER) 5498 return STG_E_FILEALREADYEXISTS; 5487 5499 return hr; 5488 5500 } … … 5613 5625 return hr; 5614 5626 } 5615 #ifndef __WIN32OS2__ 5627 5616 5628 /****************************************************************************** 5617 5629 * StgSetTimes [ole32.150] … … 5625 5637 return FALSE; 5626 5638 } 5627 #endif5628 5639 5629 5640 /****************************************************************************** … … 6414 6425 6415 6426 /* copy the OleTypeName to the compobj struct */ 6416 /* Note: in the test made, these w here Identical */6427 /* Note: in the test made, these were Identical */ 6417 6428 IStorageCompObj.dwProgIDNameLength = strlen(strOleTypeName)+1; 6418 6429 strcpy(IStorageCompObj.strProgIDName, strOleTypeName); … … 6971 6982 } 6972 6983 6984 /*********************************************************************** 6985 * GetConvertStg (OLE32.68) 6986 */ 6987 HRESULT WINAPI GetConvertStg(LPGUID guid) { 6988 FIXME("(%s), unimplemented stub!\n",debugstr_guid(guid)); 6989 return E_FAIL; 6990 } 6991 6973 6992 #ifdef __WIN32OS2__ 6993 static const BYTE STORAGE_notmagic[8]={0x0e,0x11,0xfc,0x0d,0xd0,0xcf,0x11,0xe0}; 6994 6974 6995 /****************************************************************************** 6975 6996 * StgIsStorageFile16 [STORAGE.5] 6976 6997 */ 6977 6998 HRESULT WINAPI StgIsStorageFile16(LPCOLESTR16 fn) { 6978 static const BYTE STORAGE_notmagic[8]={0x0e,0x11,0xfc,0x0d,0xd0,0xcf,0x11,0xe0}; 6979 HFILE hf; 6980 OFSTRUCT ofs; 6981 BYTE magic[24]; 6982 6983 TRACE_(ole)("(\'%s\')\n",fn); 6984 hf = OpenFile(fn,&ofs,OF_SHARE_DENY_NONE); 6985 if (hf==HFILE_ERROR) 6986 return STG_E_FILENOTFOUND; 6987 if (24!=_lread(hf,magic,24)) { 6988 WARN_(ole)(" too short\n"); 6989 _lclose(hf); 6990 return S_FALSE; 6991 } 6992 if (!memcmp(magic,STORAGE_magic,8)) { 6993 WARN_(ole)(" -> YES\n"); 6994 _lclose(hf); 6995 return S_OK; 6996 } 6997 if (!memcmp(magic,STORAGE_notmagic,8)) { 6998 WARN_(ole)(" -> NO\n"); 6999 _lclose(hf); 7000 return S_FALSE; 7001 } 7002 if (!memcmp(magic,STORAGE_oldmagic,8)) { 7003 WARN_(ole)(" -> old format\n"); 7004 _lclose(hf); 7005 return STG_E_OLDFORMAT; 7006 } 7007 WARN_(ole)(" -> Invalid header.\n"); 7008 _lclose(hf); 7009 return STG_E_INVALIDHEADER; 7010 } 7011 7012 HRESULT WINAPI 7013 StgIsStorageFile(LPCOLESTR fn) 7014 { 7015 LPOLESTR16 xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn); 7016 HRESULT ret = StgIsStorageFile16(xfn); 7017 7018 HeapFree(GetProcessHeap(),0,xfn); 7019 return ret; 6999 HFILE hf; 7000 OFSTRUCT ofs; 7001 BYTE magic[24]; 7002 7003 TRACE("(\'%s\')\n",fn); 7004 hf = OpenFile(fn,&ofs,OF_SHARE_DENY_NONE); 7005 if (hf==HFILE_ERROR) 7006 return STG_E_FILENOTFOUND; 7007 if (24!=_lread(hf,magic,24)) { 7008 WARN(" too short\n"); 7009 _lclose(hf); 7010 return S_FALSE; 7011 } 7012 if (!memcmp(magic,STORAGE_magic,8)) { 7013 WARN(" -> YES\n"); 7014 _lclose(hf); 7015 return S_OK; 7016 } 7017 if (!memcmp(magic,STORAGE_notmagic,8)) { 7018 WARN(" -> NO\n"); 7019 _lclose(hf); 7020 return S_FALSE; 7021 } 7022 if (!memcmp(magic,STORAGE_oldmagic,8)) { 7023 WARN(" -> old format\n"); 7024 _lclose(hf); 7025 return STG_E_OLDFORMAT; 7026 } 7027 WARN(" -> Invalid header.\n"); 7028 _lclose(hf); 7029 return STG_E_INVALIDHEADER; 7030 } 7031 7032 /****************************************************************************** 7033 * StgIsStorageFile [OLE32.146] 7034 */ 7035 HRESULT WINAPI 7036 StgIsStorageFile(LPCOLESTR fn) 7037 { 7038 LPOLESTR16 xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn); 7039 HRESULT ret = StgIsStorageFile16(xfn); 7040 7041 HeapFree(GetProcessHeap(),0,xfn); 7042 return ret; 7020 7043 } 7021 7044 #endif -
trunk/src/ole32/storage32.h
r5026 r5602 20 20 #include "wine/obj_base.h" 21 21 #include "wine/obj_storage.h" 22 23 #ifdef __cplusplus24 extern "C" {25 #endif26 22 27 23 /* … … 866 862 867 863 868 #ifdef __cplusplus869 }870 #endif871 872 864 #endif /* __STORAGE32_H__ */ 873 865 -
trunk/src/ole32/stubs.cpp
r4383 r5602 1 /* $Id: stubs.cpp,v 1.1 5 2000-10-02 17:34:15sandervl Exp $ */1 /* $Id: stubs.cpp,v 1.16 2001-04-26 19:32:52 sandervl Exp $ */ 2 2 /* 3 3 * Win32 COM/OLE stubs for OS/2 … … 38 38 //***************************************************************************** 39 39 //***************************************************************************** 40 HRESULT WIN32API CoCreateFreeThreadedMarshaler(LPUNKNOWN punkOuter,41 LPUNKNOWN *ppunkMarshaler)42 {43 dprintf(("OLE32: CoCreateFreeThreadedMarshaler- stub"));44 return E_OUTOFMEMORY;45 }46 //*******************************************************************************47 //*******************************************************************************48 40 HRESULT WIN32API CoDisconnectObject(IUnknown *pUnk, DWORD dwReserved) 49 41 { … … 84 76 //******************************************************************************* 85 77 //******************************************************************************* 86 HRESULT WIN32API CoGetPSClsid(REFIID riid, CLSID *pclsid)87 {88 dprintf(("OLE32: CoGetPSClsid - stub"));89 return E_OUTOFMEMORY;90 }91 //*******************************************************************************92 //*******************************************************************************93 78 HRESULT WIN32API CoGetStandardMarshal(REFIID riid, IUnknown *pUnk, DWORD dwDestContext, 94 79 LPVOID pvDestContext, DWORD mshlflags, … … 128 113 //******************************************************************************* 129 114 //******************************************************************************* 130 BOOL WIN32API CoIsOle1Class(REFCLSID rclsid)131 {132 dprintf(("OLE32: CoIsOle1Class - stub"));133 return S_FALSE;134 }135 //*******************************************************************************136 //*******************************************************************************137 115 HRESULT WIN32API CoMarshalHresult(IStream *pStm, HRESULT hresult) 138 116 { … … 195 173 } 196 174 197 //*******************************************************************************198 //*******************************************************************************199 HRESULT WIN32API CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)200 {201 dprintf(("OLE32: CoTreatAsClass - stub"));202 return E_INVALIDARG;203 }204 175 //******************************************************************************* 205 176 //******************************************************************************* … … 248 219 //******************************************************************************* 249 220 //******************************************************************************* 250 HRESULT WIN32API GetConvertStg(IStorage *pStg)251 {252 dprintf(("OLE32: GetConvertStg - stub"));253 return STG_E_ACCESSDENIED;254 }255 //*******************************************************************************256 //*******************************************************************************257 221 HRESULT WIN32API GetDocumentBitStg() 258 222 { … … 268 232 } 269 233 //******************************************************************************* 270 //*******************************************************************************271 BOOL WIN32API IsAccelerator(HACCEL hAccel, int cAccelEntries, struct tagMSG* lpMsg, WORD* lpwCmd)272 {273 dprintf(("OLE32: IsAccelerator - stub"));274 return FALSE;275 }276 234 //******************************************************************************* 277 235 //******************************************************************************* … … 294 252 dprintf(("OLE32: IsValidPtrOut, obsolete - stub")); 295 253 return E_INVALIDARG; 296 }297 //*******************************************************************************298 //*******************************************************************************299 HRESULT WIN32API MkParseDisplayName(LPBC pbc, LPSTR szUserName, ULONG *lpchEaten,300 LPMONIKER *ppmk)301 {302 dprintf(("OLE32: MkParseDisplayName - stub"));303 return E_OUTOFMEMORY;304 254 } 305 255 //******************************************************************************* … … 339 289 //******************************************************************************* 340 290 //******************************************************************************* 341 HRESULT WIN32API OleCreate(REFCLSID rclsid, REFIID riid, DWORD renderopt,342 FORMATETC *pFormatEtc, IOleClientSite *pClientSite,343 IStorage *pStg, void **ppvObject)344 {345 dprintf(("OLE32: OleCreate - stub"));346 return(E_OUTOFMEMORY);347 }348 //*******************************************************************************349 //*******************************************************************************350 291 HRESULT WIN32API OleCreateEmbeddingHelper(REFCLSID clsid, LPUNKNOWN pUnkOuter, 351 292 DWORD flags, LPCLASSFACTORY pCF, … … 357 298 //******************************************************************************* 358 299 //******************************************************************************* 359 HRESULT WIN32API OleCreateFromFile(REFCLSID rclsid, LPCOLESTR lpszFileName,360 REFIID riid,361 DWORD renderopt, LPFORMATETC pFormatEtc,362 LPOLECLIENTSITE pClientSite, LPSTORAGE pStg,363 LPVOID *ppvObj)364 {365 dprintf(("OLE32: OleCreateFromFile - stub"));366 return(E_OUTOFMEMORY);367 }368 //*******************************************************************************369 //*******************************************************************************370 HRESULT WIN32API OleCreateLink(LPMONIKER lpmkLinkSrc, REFIID riid,371 DWORD renderopt, LPFORMATETC pFormatEtc,372 LPOLECLIENTSITE lpClientSite, LPSTORAGE pStg,373 LPVOID *ppvObj)374 {375 dprintf(("OLE32: OleCreateLink - stub"));376 return(E_OUTOFMEMORY);377 }378 //*******************************************************************************379 //*******************************************************************************380 HRESULT WIN32API OleCreateLinkFromData(LPDATAOBJECT pSrcDataObj, REFIID riid,381 DWORD renderopt, LPFORMATETC pFormatEtc,382 LPOLECLIENTSITE pClientSite, LPSTORAGE pStg,383 LPVOID *ppvObj)384 {385 dprintf(("OLE32: OleCreateLinkFromData - stub"));386 return(E_OUTOFMEMORY);387 }388 //*******************************************************************************389 //*******************************************************************************390 HRESULT WIN32API OleCreateLinkToFile(LPCOLESTR lpszFileName, REFIID riid, DWORD renderopt,391 LPFORMATETC pFormatEtc, IOleClientSite *pClientSite,392 IStorage *pStg, void **ppvObj)393 {394 dprintf(("OLE32: OleCreateLinkToFile - stub"));395 return(STG_E_FILENOTFOUND);396 }397 //*******************************************************************************398 //*******************************************************************************399 HRESULT WIN32API OleCreateStaticFromData(LPDATAOBJECT pSrcDataObj, REFIID riid,400 DWORD renderopt, LPFORMATETC pFormatEtc,401 LPOLECLIENTSITE pClientSite, LPSTORAGE pStg,402 LPVOID *ppvObj)403 {404 dprintf(("OLE32: OleCreateStaticFromData - stub"));405 return(E_OUTOFMEMORY);406 }407 //*******************************************************************************408 //*******************************************************************************409 300 HRESULT WIN32API OleDoAutoConvert(IStorage *pStg, LPCLSID pClsidNew) 410 301 { … … 422 313 //******************************************************************************* 423 314 //******************************************************************************* 424 HRESULT WIN32API OleDuplicateData(HANDLE hSrc, CLIPFORMAT cfFormat, UINT uiFlags)425 {426 dprintf(("OLE32: OleDuplicateData - stub"));427 return(NULL);428 }429 //*******************************************************************************430 //*******************************************************************************431 HRESULT WIN32API OleGetAutoConvert(REFCLSID clsidOld, LPCLSID pClsidNew)432 {433 dprintf(("OLE32: OleGetAutoConvert - stub"));434 return(E_OUTOFMEMORY);435 }436 //*******************************************************************************437 //*******************************************************************************438 HGLOBAL WIN32API OleGetIconOfClass(REFCLSID rclsid, LPOLESTR lpszLabel, BOOL fUseTypeAsLabel)439 {440 dprintf(("OLE32: OleGetIconOfClass - stub"));441 return(NULL);442 }443 //*******************************************************************************444 //*******************************************************************************445 315 HGLOBAL WIN32API OleGetIconOfFile(LPOLESTR lpszPath, BOOL fUseTypeAsLabel) 446 316 { … … 453 323 { 454 324 dprintf(("OLE32: OleInitializeWOW, UNKNOWN API - stub")); 455 return(E_OUTOFMEMORY);456 }457 //*******************************************************************************458 //*******************************************************************************459 BOOL WIN32API OleIsRunning(LPOLEOBJECT pObject)460 {461 dprintf(("OLE32: OleIsRunning - stub"));462 return(FALSE);463 }464 //*******************************************************************************465 //*******************************************************************************466 HRESULT WIN32API OleLockRunning(LPUNKNOWN pUnknown, BOOL fLock, BOOL fLastUnlockCloses)467 {468 dprintf(("OLE32: OleLockRunning - stub"));469 325 return(E_OUTOFMEMORY); 470 326 } … … 487 343 //******************************************************************************* 488 344 //******************************************************************************* 489 HRESULT WIN32API OleQueryLinkFromData(IDataObject *pSrcDataObject)490 {491 dprintf(("OLE32: OleQueryLinkFromData - stub"));492 return(S_FALSE);493 }494 //*******************************************************************************495 //*******************************************************************************496 HRESULT WIN32API OleRegEnumFormatEtc(REFCLSID clsid, DWORD dwDirection,497 LPENUMFORMATETC *ppenumFormatetc)498 {499 dprintf(("OLE32: OleRegEnumFormatEtc - stub"));500 return(E_OUTOFMEMORY);501 }502 //*******************************************************************************503 //*******************************************************************************504 HRESULT WIN32API OleRegEnumVerbs(REFCLSID clsid, LPENUMOLEVERB *ppenumOleVerb)505 {506 dprintf(("OLE32: OleRegEnumVerbs - stub"));507 return(E_OUTOFMEMORY);508 }509 //*******************************************************************************510 //*******************************************************************************511 HRESULT WIN32API OleRun(LPUNKNOWN pUnknown)512 {513 dprintf(("OLE32: OleRun - stub"));514 return(E_UNEXPECTED);515 }516 //*******************************************************************************517 //*******************************************************************************518 HRESULT WIN32API OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew)519 {520 dprintf(("OLE32: OleSetAutoConvert - stub"));521 return(E_OUTOFMEMORY);522 }523 //*******************************************************************************524 //*******************************************************************************525 HRESULT WIN32API OleTranslateAccelerator526 (LPOLEINPLACEFRAME lpFrame,527 LPOLEINPLACEFRAMEINFO lpFrameInfo,528 struct tagMSG * lpmsg)529 {530 dprintf(("OLE32: OleTranslateAccelerator - stub"));531 return(S_FALSE);532 }533 //*******************************************************************************534 //*******************************************************************************535 345 HRESULT WIN32API OpenOrCreateStream() 536 346 { … … 540 350 //******************************************************************************* 541 351 //******************************************************************************* 542 HRESULT WIN32API ReadFmtUserTypeStg(IStorage *pStg, CLIPFORMAT *pcf,543 LPWSTR *lplpszUserType)544 {545 dprintf(("OLE32: ReadFmtUserTypeStg - stub"));546 return(E_OUTOFMEMORY);547 }548 //*******************************************************************************549 //*******************************************************************************550 352 HRESULT WIN32API ReadOleStg() 551 353 { … … 562 364 //******************************************************************************* 563 365 //******************************************************************************* 564 HRESULT WIN32API SetConvertStg(IStorage *pStg, BOOL fConvert)565 {566 dprintf(("OLE32: SetConvertStg - stub"));567 return(E_OUTOFMEMORY);568 }569 //*******************************************************************************570 //*******************************************************************************571 366 HRESULT WIN32API SetDocumentBitStg() 572 367 { … … 576 371 //******************************************************************************* 577 372 //******************************************************************************* 578 HRESULT WIN32API StgSetTimes(WCHAR const *lpszName, FILETIME const *pctime,579 FILETIME const *patime, FILETIME const *pmtime)580 {581 dprintf(("OLE32: StgSetTimes - stub"));582 return(STG_E_FILENOTFOUND);583 }584 //*******************************************************************************585 //*******************************************************************************586 373 HRESULT WIN32API UtConvertDvtd16toDvtd32() 587 374 { … … 611 398 } 612 399 613 //*******************************************************************************614 //*******************************************************************************615 HRESULT WIN32API WriteFmtUserTypeStg(LPSTORAGE pstg, CLIPFORMAT cf, LPOLESTR lpszUserType)616 {617 dprintf(("OLE32: WriteFmtUserTypeStg - stub"));618 return(STG_E_MEDIUMFULL);619 }620 400 //******************************************************************************* 621 401 //*******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.