- Timestamp:
- Sep 2, 1999, 2:43:42 AM (26 years ago)
- Location:
- trunk/src/ole32
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/makefile
r604 r784 27 27 initialise.obj \ 28 28 taskmem.obj \ 29 library.obj \ 30 iunknown.obj \ 29 31 stubs.obj 30 32 … … 56 58 moniker.obj: moniker.cpp 57 59 taskmem.obj: taskmem.cpp 60 library.obj: library.cpp 61 iunknown.obj: iunknown.cpp 58 62 59 63 -
trunk/src/ole32/oString.cpp
r291 r784 1 /* 2 * 3 * Project Odin Software License can be found in LICENSE.TXT 4 * 5 */ 6 /* 7 * ClassID Manipulation. 8 * 9 * 12/7/99 10 * 11 * Copyright 1999 David J. Raison 12 * 13 */ 1 14 2 15 #include "ole32.h" -
trunk/src/ole32/ole32.cpp
r633 r784 82 82 83 83 /* 84 * This open DLL table belongs in a per process table, but my guess is that85 * it shouldn't live in the kernel, so I'll put them out here in DLL86 * space assuming that there is one OLE32 per process.87 */88 typedef struct tagOpenDll89 {90 char * DllName; /* really only needed for debugging */91 HINSTANCE hLibrary;92 struct tagOpenDll * next;93 } OpenDll;94 95 static OpenDll * openDllList = NULL; /* linked list of open dlls */96 97 /*98 84 * Com Library reference count... 99 85 * … … 465 451 } 466 452 return hres; 453 } 454 455 // ---------------------------------------------------------------------- 456 // CoLockObjectExternal 457 // ---------------------------------------------------------------------- 458 HRESULT WIN32API CoLockObjectExternal(IUnknown *pUnk, BOOL fLock, BOOL fLastUnlockReleases) 459 { 460 dprintf(("OLE32: CoLockObjectExternal")); 461 462 if (fLock) 463 { 464 /* 465 * Increment the external lock coutner, COM_ExternalLockAddRef also 466 * increment the object's internal lock counter. 467 */ 468 COM_ExternalLockAddRef( pUnk); 469 } 470 else 471 { 472 /* 473 * Decrement the external lock coutner, COM_ExternalLockRelease also 474 * decrement the object's internal lock counter. 475 */ 476 COM_ExternalLockRelease( pUnk, fLastUnlockReleases); 477 } 478 479 return S_OK; 480 } 481 482 // ---------------------------------------------------------------------- 483 // CoRegisterClassObject 484 // ---------------------------------------------------------------------- 485 HRESULT WINAPI CoRegisterClassObject( 486 REFCLSID rclsid, 487 LPUNKNOWN pUnk, 488 DWORD dwClsContext, // Context in which to run the executable 489 DWORD flags, // how connections are made 490 LPDWORD lpdwRegister) 491 { 492 RegisteredClass * newClass; 493 LPUNKNOWN foundObject; 494 HRESULT hr; 495 oStringA tClsid(rclsid); 496 497 dprintf(("OLE32: CoRegisterClassObject(%s)", (char *)tClsid)); 498 499 // Perform a sanity check on the parameters 500 if ((lpdwRegister == 0) || (pUnk == 0)) 501 return E_INVALIDARG; 502 503 // Initialize the cookie (out parameter) 504 *lpdwRegister = 0; 505 506 // First, check if the class is already registered. 507 // If it is, this should cause an error. 508 hr = COM_GetRegisteredClassObject(rclsid, dwClsContext, &foundObject); 509 if (hr == S_OK) 510 { 511 // The COM_GetRegisteredClassObject increased the reference count on the 512 // object so it has to be released. 513 IUnknown_Release(foundObject); 514 515 return CO_E_OBJISREG; 516 } 517 518 // If it is not registered, we must create a new entry for this class and 519 // append it to the registered class list. 520 // We use the address of the chain node as the cookie since we are sure it's 521 // unique. 522 newClass = (RegisteredClass *)HeapAlloc(GetProcessHeap(), 0, sizeof(RegisteredClass)); 523 524 // Initialize the node. 525 newClass->classIdentifier = *rclsid; 526 newClass->runContext = dwClsContext; 527 newClass->connectFlags = flags; 528 newClass->dwCookie = (DWORD)newClass; 529 newClass->nextClass = firstRegisteredClass; 530 531 // Since we're making a copy of the object pointer, we have to increase it's 532 // reference count. 533 newClass->classObject = pUnk; 534 IUnknown_AddRef(newClass->classObject); 535 536 firstRegisteredClass = newClass; 537 538 // Assign the out parameter (cookie) 539 *lpdwRegister = newClass->dwCookie; 540 541 return S_OK; 542 } 543 544 // ---------------------------------------------------------------------- 545 // CoRegisterClassObject 546 // ---------------------------------------------------------------------- 547 // This method will remove a class object from the class registry 548 HRESULT WINAPI CoRevokeClassObject(DWORD dwRegister) 549 { 550 RegisteredClass * * prevClassLink; 551 RegisteredClass * curClass; 552 553 dprintf(("OLE32: CoRegisterClassObject")); 554 555 // Iterate through the whole list and try to match the cookie. 556 curClass = firstRegisteredClass; 557 prevClassLink = &firstRegisteredClass; 558 559 while (curClass != 0) 560 { 561 // Check if we have a match on the cookie. 562 if (curClass->dwCookie == dwRegister) 563 { 564 // Remove the class from the chain. 565 *prevClassLink = curClass->nextClass; 566 567 // Release the reference to the class object. 568 IUnknown_Release(curClass->classObject); 569 570 // Free the memory used by the chain node. 571 HeapFree(GetProcessHeap(), 0, curClass); 572 573 return S_OK; 574 } 575 576 // Step to the next class in the list. 577 prevClassLink = &(curClass->nextClass); 578 curClass = curClass->nextClass; 579 } 580 581 return E_INVALIDARG; 467 582 } 468 583 -
trunk/src/ole32/stubs.cpp
r633 r784 30 30 } 31 31 //******************************************************************************* 32 //Frees all libs loaded with CoLoadLibrary33 //*******************************************************************************34 void WIN32API CoFreeAllLibraries()35 {36 dprintf(("OLE32: CoFreeAllLibraries - stub"));37 return ;38 }39 //*******************************************************************************40 //*******************************************************************************41 void WIN32API CoFreeLibrary(HINSTANCE hInst)42 {43 dprintf(("OLE32: CoFreeLibrary"));44 FreeLibrary(hInst);45 }46 //*******************************************************************************47 //*******************************************************************************48 void WIN32API CoFreeUnusedLibraries()49 {50 dprintf(("OLE32: CoFreeUnusedLibraries - stub"));51 return ;52 }53 //*******************************************************************************54 32 //******************************************************************************* 55 33 HRESULT WIN32API CoGetCallerTID() … … 142 120 //******************************************************************************* 143 121 //******************************************************************************* 144 HINSTANCE WIN32API CoLoadLibrary(LPSTR lpszLibName, BOOL bAutoFree)145 {146 dprintf(("OLE32: CoLoadLibrary"));147 return LoadLibraryA(lpszLibName);148 }149 //*******************************************************************************150 //*******************************************************************************151 HRESULT WIN32API CoLockObjectExternal(IUnknown *pUnk, BOOL fLock, BOOL fLastUnlockReleases)152 {153 dprintf(("OLE32: CoLockObjectExternal - stub"));154 return E_OUTOFMEMORY;155 }156 //*******************************************************************************157 //*******************************************************************************158 122 HRESULT WIN32API CoMarshalHresult(IStream *pStm, HRESULT hresult) 159 123 { … … 188 152 //******************************************************************************* 189 153 //******************************************************************************* 190 HRESULT WIN32API CoRegisterClassObject(REFCLSID rclsid, IUnknown *pUnk,191 DWORD dwClsContext, DWORD flags,192 LPDWORD lpdwRegister)193 {194 dprintf(("OLE32: CoRegisterClassObject - stub"));195 return E_OUTOFMEMORY;196 }197 //*******************************************************************************198 //*******************************************************************************199 154 HRESULT WIN32API CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy) 200 155 { … … 215 170 { 216 171 dprintf(("OLE32: CoReleaseMarshalData - stub")); 217 return E_OUTOFMEMORY;218 }219 //*******************************************************************************220 //*******************************************************************************221 HRESULT WIN32API CoRevokeClassObject(DWORD dwRegister)222 {223 dprintf(("OLE32: CoRevokeClassObject - stub"));224 172 return E_OUTOFMEMORY; 225 173 }
Note:
See TracChangeset
for help on using the changeset viewer.