Changeset 9400 for trunk/src/ole32
- Timestamp:
- Nov 12, 2002, 6:07:48 PM (23 years ago)
- Location:
- trunk/src/ole32
- Files:
-
- 2 added
- 1 deleted
- 16 edited
-
compobj.c (modified) (30 diffs)
-
compobj_private.h (modified) (1 diff)
-
datacache.c (modified) (1 diff)
-
filemoniker.c (modified) (2 diffs)
-
ftmarshal.c (added)
-
hglobalstream.c (modified) (5 diffs)
-
ifs.c (modified) (1 diff)
-
itemmoniker.c (modified) (5 diffs)
-
marshal.c (modified) (2 diffs)
-
ole2stubs.c (modified) (1 diff)
-
ole32.c (added)
-
ole32.cpp (deleted)
-
ole32.def (modified) (1 diff)
-
ole32.mak (modified) (3 diffs)
-
ole32dbg.def (modified) (1 diff)
-
stg_stream.c (modified) (2 diffs)
-
storage32.c (modified) (31 diffs)
-
storage32.h (modified) (25 diffs)
-
stubs.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/compobj.c
r8620 r9400 46 46 #include "wine/obj_storage.h" 47 47 #include "wine/obj_channel.h" 48 #include "wine/winbase16.h"49 48 #include "compobj_private.h" 50 #include "ifs.h"51 49 52 50 #include "wine/debug.h" 53 51 54 52 WINE_DEFAULT_DEBUG_CHANNEL(ole); 55 56 /****************************************************************************57 * COM External Lock structures and methods declaration58 *59 * This api provides a linked list to managed external references to60 * COM objects.61 *62 * The public interface consists of three calls:63 * COM_ExternalLockAddRef64 * COM_ExternalLockRelease65 * COM_ExternalLockFreeList66 */67 68 #define EL_END_OF_LIST 069 #define EL_NOT_FOUND 070 71 /*72 * Declaration of the static structure that manage the73 * external lock to COM objects.74 */75 typedef struct COM_ExternalLock COM_ExternalLock;76 typedef struct COM_ExternalLockList COM_ExternalLockList;77 78 struct COM_ExternalLock79 {80 IUnknown *pUnk; /* IUnknown referenced */81 ULONG uRefCount; /* external lock counter to IUnknown object*/82 COM_ExternalLock *next; /* Pointer to next element in list */83 };84 85 struct COM_ExternalLockList86 {87 COM_ExternalLock *head; /* head of list */88 };89 90 /*91 * Declaration and initialization of the static structure that manages92 * the external lock to COM objects.93 */94 static COM_ExternalLockList elList = { EL_END_OF_LIST };95 96 /*97 * Public Interface to the external lock list98 */99 static void COM_ExternalLockFreeList();100 static void COM_ExternalLockAddRef(IUnknown *pUnk);101 static void COM_ExternalLockRelease(IUnknown *pUnk, BOOL bRelAll);102 void COM_ExternalLockDump(); /* testing purposes, not static to avoid warning */103 104 /*105 * Private methods used to managed the linked list106 */107 static BOOL COM_ExternalLockInsert(108 IUnknown *pUnk);109 110 static void COM_ExternalLockDelete(111 COM_ExternalLock *element);112 113 static COM_ExternalLock* COM_ExternalLockFind(114 IUnknown *pUnk);115 116 static COM_ExternalLock* COM_ExternalLockLocate(117 COM_ExternalLock *element,118 IUnknown *pUnk);119 53 120 54 /**************************************************************************** … … 123 57 * TODO: Most of these things will have to be made thread-safe. 124 58 */ 125 HINSTANCE16 COMPOBJ_hInstance = 0;126 59 HINSTANCE COMPOBJ_hInstance32 = 0; 127 static int COMPOBJ_Attach = 0; 128 129 LPMALLOC16 currentMalloc16=NULL; 130 LPMALLOC currentMalloc32=NULL; 131 132 HTASK16 hETask = 0; 133 WORD Table_ETask[62]; 60 61 static HRESULT COM_GetRegisteredClassObject(REFCLSID rclsid, DWORD dwClsContext, LPUNKNOWN* ppUnk); 62 static void COM_RevokeAllClasses(); 63 static void COM_ExternalLockFreeList(); 64 65 /***************************************************************************** 66 * Appartment management stuff 67 * 68 * NOTE: 69 * per Thread values are stored in the TEB on offset 0xF80 70 * 71 * see www.microsoft.com/msj/1099/bugslayer/bugslayer1099.htm 72 * 73 */ 74 75 typedef struct { 76 unsigned char threadingModell; /* we use the COINIT flags */ 77 unsigned long threadID; 78 long AppartmentLockCount; 79 } OleAppartmentData; 80 81 typedef struct { 82 OleAppartmentData *AppartmentData; 83 } OleThreadData; 84 85 /* not jet used 86 static CRITICAL_SECTION csAppartmentData = CRITICAL_SECTION_INIT("csAppartmentData"); 87 */ 88 /* 89 * the first STA created in a process is the main STA 90 */ 91 92 /* not jet used 93 static OleAppartmentData * mainSTA; 94 */ 95 96 /* 97 * a Process can only have one MTA 98 */ 99 100 /* not jet used 101 static OleAppartmentData * processMTA; 102 */ 103 134 104 135 105 /* … … 159 129 } RegisteredClass; 160 130 161 static CRITICAL_SECTION csRegisteredClassList ;131 static CRITICAL_SECTION csRegisteredClassList = CRITICAL_SECTION_INIT("csRegisteredClassList"); 162 132 static RegisteredClass* firstRegisteredClass = NULL; 163 133 164 /* this open DLL table belongs in a per process table, but my guess is that 165 * it shouldn't live in the kernel, so I'll put them out here in DLL 166 * space assuming that there is one OLE32 per process. 167 */ 134 /***************************************************************************** 135 * This section contains OpenDllList definitions 136 * 137 * The OpenDllList contains only handles of dll loaded by CoGetClassObject or 138 * other functions what do LoadLibrary _without_ giving back a HMODULE. 139 * Without this list these handles would be freed never. 140 * 141 * FIXME: a DLL what says OK whenn asked for unloading is unloaded in the 142 * next unload-call but not before 600 sec. 143 */ 144 168 145 typedef struct tagOpenDll { 169 146 HINSTANCE hLibrary; … … 171 148 } OpenDll; 172 149 173 static CRITICAL_SECTION csOpenDllList ;150 static CRITICAL_SECTION csOpenDllList = CRITICAL_SECTION_INIT("csOpenDllList"); 174 151 static OpenDll *openDllList = NULL; /* linked list of open dlls */ 175 152 176 /***************************************************************************** 177 * This section contains prototypes to internal methods for this 178 * module 179 */ 180 static HRESULT COM_GetRegisteredClassObject(REFCLSID rclsid, 181 DWORD dwClsContext, 182 LPUNKNOWN* ppUnk); 183 184 static void COM_RevokeAllClasses(); 153 static void COMPOBJ_DLLList_Add(HANDLE hLibrary); 154 static void COMPOBJ_DllList_FreeUnused(int Timeout); 185 155 186 156 … … 190 160 void COMPOBJ_InitProcess( void ) 191 161 { 192 InitializeCriticalSection( &csRegisteredClassList );193 InitializeCriticalSection( &csOpenDllList );194 162 } 195 163 196 164 void COMPOBJ_UninitProcess( void ) 197 165 { 198 DeleteCriticalSection( &csRegisteredClassList ); 199 DeleteCriticalSection( &csOpenDllList ); 166 } 167 168 /***************************************************************************** 169 * This section contains OpenDllList implemantation 170 */ 171 172 static void COMPOBJ_DLLList_Add(HANDLE hLibrary) 173 { 174 OpenDll *ptr; 175 OpenDll *tmp; 176 177 TRACE("\n"); 178 179 EnterCriticalSection( &csOpenDllList ); 180 181 if (openDllList == NULL) { 182 /* empty list -- add first node */ 183 openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll)); 184 openDllList->hLibrary=hLibrary; 185 openDllList->next = NULL; 186 } else { 187 /* search for this dll */ 188 int found = FALSE; 189 for (ptr = openDllList; ptr->next != NULL; ptr=ptr->next) { 190 if (ptr->hLibrary == hLibrary) { 191 found = TRUE; 192 break; 193 } 194 } 195 if (!found) { 196 /* dll not found, add it */ 197 tmp = openDllList; 198 openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll)); 199 openDllList->hLibrary = hLibrary; 200 openDllList->next = tmp; 201 } 202 } 203 204 LeaveCriticalSection( &csOpenDllList ); 205 } 206 207 static void COMPOBJ_DllList_FreeUnused(int Timeout) 208 { 209 OpenDll *curr, *next, *prev = NULL; 210 typedef HRESULT(*DllCanUnloadNowFunc)(void); 211 DllCanUnloadNowFunc DllCanUnloadNow; 212 213 TRACE("\n"); 214 215 EnterCriticalSection( &csOpenDllList ); 216 217 for (curr = openDllList; curr != NULL; ) { 218 DllCanUnloadNow = (DllCanUnloadNowFunc) GetProcAddress(curr->hLibrary, "DllCanUnloadNow"); 219 220 if ( (DllCanUnloadNow != NULL) && (DllCanUnloadNow() == S_OK) ) { 221 next = curr->next; 222 223 TRACE("freeing 0x%08x\n", curr->hLibrary); 224 FreeLibrary(curr->hLibrary); 225 226 HeapFree(GetProcessHeap(), 0, curr); 227 if (curr == openDllList) { 228 openDllList = next; 229 } else { 230 prev->next = next; 231 } 232 233 curr = next; 234 } else { 235 prev = curr; 236 curr = curr->next; 237 } 238 } 239 240 LeaveCriticalSection( &csOpenDllList ); 200 241 } 201 242 … … 211 252 TRACE("Returning version %d, build %d.\n", rmm, rup); 212 253 return (rmm<<16)+rup; 213 }214 215 /******************************************************************************216 * CoInitialize [COMPOBJ.2]217 * Set the win16 IMalloc used for memory management218 */219 HRESULT WINAPI CoInitialize16(220 LPVOID lpReserved /* [in] pointer to win16 malloc interface */221 ) {222 currentMalloc16 = (LPMALLOC16)lpReserved;223 return S_OK;224 254 } 225 255 … … 306 336 307 337 return hr; 308 }309 310 /***********************************************************************311 * CoUninitialize [COMPOBJ.3]312 * Don't know what it does.313 * 3-Nov-98 -- this was originally misspelled, I changed it to what I314 * believe is the correct spelling315 */316 void WINAPI CoUninitialize16(void)317 {318 TRACE("()\n");319 CoFreeAllLibraries();320 338 } 321 339 … … 368 386 } 369 387 370 #ifndef __WIN32OS2__371 /***********************************************************************372 * CoGetMalloc [COMPOBJ.4]373 * RETURNS374 * The current win16 IMalloc375 */376 HRESULT WINAPI CoGetMalloc16(377 DWORD dwMemContext, /* [in] unknown */378 LPMALLOC16 * lpMalloc /* [out] current win16 malloc interface */379 ) {380 if(!currentMalloc16)381 currentMalloc16 = IMalloc16_Constructor();382 *lpMalloc = currentMalloc16;383 return S_OK;384 }385 #endif386 /******************************************************************************387 * CoGetMalloc [OLE32.20]388 *389 * RETURNS390 * The current win32 IMalloc391 */392 HRESULT WINAPI CoGetMalloc(393 DWORD dwMemContext, /* [in] unknown */394 LPMALLOC *lpMalloc /* [out] current win32 malloc interface */395 ) {396 if(!currentMalloc32)397 currentMalloc32 = IMalloc_Constructor();398 *lpMalloc = currentMalloc32;399 return S_OK;400 }401 #ifndef __WIN32OS2__402 /***********************************************************************403 * CoCreateStandardMalloc [COMPOBJ.71]404 */405 HRESULT WINAPI CoCreateStandardMalloc16(DWORD dwMemContext,406 LPMALLOC16 *lpMalloc)407 {408 /* FIXME: docu says we shouldn't return the same allocator as in409 * CoGetMalloc16 */410 *lpMalloc = IMalloc16_Constructor();411 return S_OK;412 }413 #endif414 388 /****************************************************************************** 415 389 * CoDisconnectObject [COMPOBJ.15] … … 420 394 TRACE("(%p, %lx)\n",lpUnk,reserved); 421 395 return S_OK; 422 }423 424 /***********************************************************************425 * IsEqualGUID [COMPOBJ.18]426 *427 * Compares two Unique Identifiers.428 *429 * RETURNS430 * TRUE if equal431 */432 BOOL16 WINAPI IsEqualGUID16(433 GUID* g1, /* [in] unique id 1 */434 GUID* g2 /* [in] unique id 2 */435 ) {436 return !memcmp( g1, g2, sizeof(GUID) );437 }438 439 /******************************************************************************440 * CLSIDFromString [COMPOBJ.20]441 * Converts a unique identifier from its string representation into442 * the GUID struct.443 *444 * Class id: DWORD-WORD-WORD-BYTES[2]-BYTES[6]445 *446 * RETURNS447 * the converted GUID448 */449 HRESULT WINAPI CLSIDFromString16(450 LPCOLESTR16 idstr, /* [in] string representation of guid */451 CLSID *id /* [out] GUID converted from string */452 ) {453 BYTE *s = (BYTE *) idstr;454 BYTE *p;455 int i;456 BYTE table[256];457 458 if (!s)459 s = "{00000000-0000-0000-0000-000000000000}";460 else { /* validate the CLSID string */461 462 if (strlen(s) != 38)463 return CO_E_CLASSSTRING;464 465 if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') || (s[24]!='-') || (s[37]!='}'))466 return CO_E_CLASSSTRING;467 468 for (i=1; i<37; i++)469 {470 if ((i == 9)||(i == 14)||(i == 19)||(i == 24)) continue;471 if (!(((s[i] >= '0') && (s[i] <= '9')) ||472 ((s[i] >= 'a') && (s[i] <= 'f')) ||473 ((s[i] >= 'A') && (s[i] <= 'F')))474 )475 return CO_E_CLASSSTRING;476 }477 }478 479 TRACE("%s -> %p\n", s, id);480 481 /* quick lookup table */482 memset(table, 0, 256);483 484 for (i = 0; i < 10; i++) {485 table['0' + i] = i;486 }487 for (i = 0; i < 6; i++) {488 table['A' + i] = i+10;489 table['a' + i] = i+10;490 }491 492 /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */493 494 p = (BYTE *) id;495 496 s++; /* skip leading brace */497 for (i = 0; i < 4; i++) {498 p[3 - i] = table[*s]<<4 | table[*(s+1)];499 s += 2;500 }501 p += 4;502 s++; /* skip - */503 504 for (i = 0; i < 2; i++) {505 p[1-i] = table[*s]<<4 | table[*(s+1)];506 s += 2;507 }508 p += 2;509 s++; /* skip - */510 511 for (i = 0; i < 2; i++) {512 p[1-i] = table[*s]<<4 | table[*(s+1)];513 s += 2;514 }515 p += 2;516 s++; /* skip - */517 518 /* these are just sequential bytes */519 for (i = 0; i < 2; i++) {520 *p++ = table[*s]<<4 | table[*(s+1)];521 s += 2;522 }523 s++; /* skip - */524 525 for (i = 0; i < 6; i++) {526 *p++ = table[*s]<<4 | table[*(s+1)];527 s += 2;528 }529 530 return S_OK;531 396 } 532 397 … … 553 418 * the converted GUID 554 419 */ 420 HRESULT WINAPI __CLSIDFromStringA( 421 LPCSTR idstr, /* [in] string representation of guid */ 422 CLSID *id) /* [out] GUID converted from string */ 423 { 424 BYTE *s = (BYTE *) idstr; 425 int i; 426 BYTE table[256]; 427 428 if (!s) 429 s = "{00000000-0000-0000-0000-000000000000}"; 430 else { /* validate the CLSID string */ 431 432 if (strlen(s) != 38) 433 return CO_E_CLASSSTRING; 434 435 if ((s[0]!='{') || (s[9]!='-') || (s[14]!='-') || (s[19]!='-') || (s[24]!='-') || (s[37]!='}')) 436 return CO_E_CLASSSTRING; 437 438 for (i=1; i<37; i++) { 439 if ((i == 9)||(i == 14)||(i == 19)||(i == 24)) continue; 440 if (!(((s[i] >= '0') && (s[i] <= '9')) || 441 ((s[i] >= 'a') && (s[i] <= 'f')) || 442 ((s[i] >= 'A') && (s[i] <= 'F')))) 443 return CO_E_CLASSSTRING; 444 } 445 } 446 447 TRACE("%s -> %p\n", s, id); 448 449 /* quick lookup table */ 450 memset(table, 0, 256); 451 452 for (i = 0; i < 10; i++) { 453 table['0' + i] = i; 454 } 455 for (i = 0; i < 6; i++) { 456 table['A' + i] = i+10; 457 table['a' + i] = i+10; 458 } 459 460 /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */ 461 462 id->Data1 = (table[s[1]] << 28 | table[s[2]] << 24 | table[s[3]] << 20 | table[s[4]] << 16 | 463 table[s[5]] << 12 | table[s[6]] << 8 | table[s[7]] << 4 | table[s[8]]); 464 id->Data2 = table[s[10]] << 12 | table[s[11]] << 8 | table[s[12]] << 4 | table[s[13]]; 465 id->Data3 = table[s[15]] << 12 | table[s[16]] << 8 | table[s[17]] << 4 | table[s[18]]; 466 467 /* these are just sequential bytes */ 468 id->Data4[0] = table[s[20]] << 4 | table[s[21]]; 469 id->Data4[1] = table[s[22]] << 4 | table[s[23]]; 470 id->Data4[2] = table[s[25]] << 4 | table[s[26]]; 471 id->Data4[3] = table[s[27]] << 4 | table[s[28]]; 472 id->Data4[4] = table[s[29]] << 4 | table[s[30]]; 473 id->Data4[5] = table[s[31]] << 4 | table[s[32]]; 474 id->Data4[6] = table[s[33]] << 4 | table[s[34]]; 475 id->Data4[7] = table[s[35]] << 4 | table[s[36]]; 476 477 return S_OK; 478 } 479 480 /*****************************************************************************/ 481 555 482 HRESULT WINAPI CLSIDFromString( 556 483 LPCOLESTR idstr, /* [in] string representation of GUID */ … … 562 489 if (!WideCharToMultiByte( CP_ACP, 0, idstr, -1, xid, sizeof(xid), NULL, NULL )) 563 490 return CO_E_CLASSSTRING; 564 ret = CLSIDFromString16(xid,id); 491 492 493 ret = __CLSIDFromStringA(xid,id); 565 494 if(ret != S_OK) { /* It appears a ProgID is also valid */ 566 495 ret = CLSIDFromProgID(idstr, id); … … 610 539 return S_OK; 611 540 } 612 #ifndef __WIN32OS2__ 613 /****************************************************************************** 614 * StringFromCLSID [COMPOBJ.19] 615 * Converts a GUID into the respective string representation. 616 * The target string is allocated using the OLE IMalloc. 617 * RETURNS 618 * the string representation and HRESULT 619 */ 620 HRESULT WINAPI StringFromCLSID16( 621 REFCLSID id, /* [in] the GUID to be converted */ 622 LPOLESTR16 *idstr /* [out] a pointer to a to-be-allocated segmented pointer pointing to the resulting string */ 623 624 ) { 625 extern BOOL WINAPI K32WOWCallback16Ex( DWORD vpfn16, DWORD dwFlags, 626 DWORD cbArgs, LPVOID pArgs, LPDWORD pdwRetCode ); 627 LPMALLOC16 mllc; 628 HRESULT ret; 629 DWORD args[2]; 630 631 ret = CoGetMalloc16(0,&mllc); 632 if (ret) return ret; 633 634 args[0] = (DWORD)mllc; 635 args[1] = 40; 636 637 /* No need for a Callback entry, we have WOWCallback16Ex which does 638 * everything we need. 639 */ 640 if (!K32WOWCallback16Ex( 641 (DWORD)((ICOM_VTABLE(IMalloc16)*)MapSL( 642 (SEGPTR)ICOM_VTBL(((LPMALLOC16)MapSL((SEGPTR)mllc)))) 643 )->Alloc, 644 WCB16_CDECL, 645 2*sizeof(DWORD), 646 (LPVOID)args, 647 (LPDWORD)idstr 648 )) { 649 WARN("CallTo16 IMalloc16 failed\n"); 650 return E_FAIL; 651 } 652 return WINE_StringFromCLSID(id,MapSL((SEGPTR)*idstr)); 653 } 654 #endif 541 542 655 543 /****************************************************************************** 656 544 * StringFromCLSID [OLE32.151] … … 755 643 756 644 /****************************************************************************** 757 * CLSIDFromProgID [COMPOBJ.61]758 * Converts a program id into the respective GUID. (By using a registry lookup)759 * RETURNS760 * riid associated with the progid761 */762 HRESULT WINAPI CLSIDFromProgID16(763 LPCOLESTR16 progid, /* [in] program id as found in registry */764 LPCLSID riid /* [out] associated CLSID */765 ) {766 char *buf,buf2[80];767 DWORD buf2len;768 HRESULT err;769 HKEY xhkey;770 771 buf = HeapAlloc(GetProcessHeap(),0,strlen(progid)+8);772 sprintf(buf,"%s\\CLSID",progid);773 if ((err=RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&xhkey))) {774 HeapFree(GetProcessHeap(),0,buf);775 return CO_E_CLASSSTRING;776 }777 HeapFree(GetProcessHeap(),0,buf);778 buf2len = sizeof(buf2);779 if ((err=RegQueryValueA(xhkey,NULL,buf2,&buf2len))) {780 RegCloseKey(xhkey);781 return CO_E_CLASSSTRING;782 }783 RegCloseKey(xhkey);784 return CLSIDFromString16(buf2,riid);785 }786 787 /******************************************************************************788 645 * CLSIDFromProgID [OLE32.2] 789 646 * Converts a program id into the respective GUID. (By using a registry lookup) … … 816 673 } 817 674 RegCloseKey(xhkey); 818 return CLSIDFromString16(buf2,riid);675 return __CLSIDFromStringA(buf2,riid); 819 676 } 820 677 … … 877 734 /* We have the CLSid we want back from the registry as a string, so 878 735 lets convert it into a CLSID structure */ 879 if ( (CLSIDFromString16(buf2,pclsid)) != NOERROR) 880 { 736 if ( (__CLSIDFromStringA(buf2,pclsid)) != NOERROR) { 881 737 return E_INVALIDARG; 882 738 } … … 928 784 return S_OK; 929 785 } 930 #ifndef __WIN32OS2__ 931 /* FIXME: this function is not declared in the WINELIB headers. But where should it go ? */ 932 /*********************************************************************** 933 * LookupETask (COMPOBJ.94) 934 */ 935 HRESULT WINAPI LookupETask16(HTASK16 *hTask,LPVOID p) { 936 FIXME("(%p,%p),stub!\n",hTask,p); 937 if ((*hTask = GetCurrentTask()) == hETask) { 938 memcpy(p, Table_ETask, sizeof(Table_ETask)); 939 } 940 return 0; 941 } 942 943 /* FIXME: this function is not declared in the WINELIB headers. But where should it go ? */ 944 /*********************************************************************** 945 * SetETask (COMPOBJ.95) 946 */ 947 HRESULT WINAPI SetETask16(HTASK16 hTask, LPVOID p) { 948 FIXME("(%04x,%p),stub!\n",hTask,p); 949 hETask = hTask; 950 return 0; 951 } 952 953 /* FIXME: this function is not declared in the WINELIB headers. But where should it go ? */ 954 /*********************************************************************** 955 * CALLOBJECTINWOW (COMPOBJ.201) 956 */ 957 HRESULT WINAPI CallObjectInWOW(LPVOID p1,LPVOID p2) { 958 FIXME("(%p,%p),stub!\n",p1,p2); 959 return 0; 960 } 961 962 /****************************************************************************** 963 * CoRegisterClassObject [COMPOBJ.5] 964 * 965 * Don't know where it registers it ... 966 */ 967 HRESULT WINAPI CoRegisterClassObject16( 968 REFCLSID rclsid, 969 LPUNKNOWN pUnk, 970 DWORD dwClsContext, /* [in] CLSCTX flags indicating the context in which to run the executable */ 971 DWORD flags, /* [in] REGCLS flags indicating how connections are made */ 972 LPDWORD lpdwRegister 973 ) { 974 char buf[80]; 975 976 WINE_StringFromCLSID(rclsid,buf); 977 978 FIXME("(%s,%p,0x%08lx,0x%08lx,%p),stub\n", 979 buf,pUnk,dwClsContext,flags,lpdwRegister 980 ); 981 return 0; 982 } 983 984 985 /****************************************************************************** 986 * CoRevokeClassObject [COMPOBJ.6] 987 * 988 */ 989 HRESULT WINAPI CoRevokeClassObject16(DWORD dwRegister) /* [in] token on class obj */ 990 { 991 FIXME("(0x%08lx),stub!\n", dwRegister); 992 return 0; 993 } 994 995 /****************************************************************************** 996 * CoFileTimeToDosDateTime [COMPOBJ.30] 997 */ 998 BOOL16 WINAPI CoFileTimeToDosDateTime16(const FILETIME *ft, LPWORD lpDosDate, LPWORD lpDosTime) 999 { 1000 return FileTimeToDosDateTime(ft, lpDosDate, lpDosTime); 1001 } 1002 1003 /****************************************************************************** 1004 * CoDosDateTimeToFileTime [COMPOBJ.31] 1005 */ 1006 BOOL16 WINAPI CoDosDateTimeToFileTime16(WORD wDosDate, WORD wDosTime, FILETIME *ft) 1007 { 1008 return DosDateTimeToFileTime(wDosDate, wDosTime, ft); 1009 } 1010 #endif 786 787 1011 788 /*** 1012 789 * COM_GetRegisteredClassObject … … 1296 1073 1297 1074 /*********************************************************************** 1075 * compobj_RegReadPath [internal] 1076 * 1077 * Reads a registry value and expands it when nessesary 1078 */ 1079 HRESULT compobj_RegReadPath(char * keyname, char * valuename, char * dst, int dstlen) 1080 { 1081 HRESULT hres; 1082 HKEY key; 1083 DWORD keytype; 1084 char src[MAX_PATH]; 1085 DWORD dwLength = dstlen; 1086 1087 if((hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, keyname, 0, KEY_READ, &key)) == ERROR_SUCCESS) { 1088 if( (hres = RegQueryValueExA(key, NULL, NULL, &keytype, (LPBYTE)src, &dwLength)) == ERROR_SUCCESS ) { 1089 if (keytype == REG_EXPAND_SZ) { 1090 if (dstlen <= ExpandEnvironmentStringsA(src, dst, dstlen)) hres = ERROR_MORE_DATA; 1091 } else { 1092 strncpy(dst, src, dstlen); 1093 } 1094 } 1095 RegCloseKey (key); 1096 } 1097 return hres; 1098 } 1099 1100 /*********************************************************************** 1298 1101 * CoGetClassObject [COMPOBJ.7] 1299 1102 * CoGetClassObject [OLE32.16] … … 1311 1114 HRESULT hres = E_UNEXPECTED; 1312 1115 char xclsid[80]; 1313 WCHAR ProviderName[MAX_PATH+1];1314 DWORD ProviderNameLen = sizeof(ProviderName);1315 1116 HINSTANCE hLibrary; 1316 1117 #ifdef __WIN32OS2__ 1317 typedef HRESULT (* CALLBACK DllGetClassObjectFunc)(REFCLSID clsid, 1318 REFIID iid, LPVOID *ppv); 1118 typedef HRESULT (* CALLBACK DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv); 1319 1119 #else 1320 typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, 1321 REFIID iid, LPVOID *ppv); 1120 typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, REFIID iid, LPVOID *ppv); 1322 1121 #endif 1323 1122 DllGetClassObjectFunc DllGetClassObject; … … 1325 1124 WINE_StringFromCLSID((LPCLSID)rclsid,xclsid); 1326 1125 1327 TRACE("\n\tCLSID:\t%s,\n\tIID:\t%s\n", 1328 debugstr_guid(rclsid), 1329 debugstr_guid(iid) 1330 ); 1126 TRACE("\n\tCLSID:\t%s,\n\tIID:\t%s\n", debugstr_guid(rclsid), debugstr_guid(iid)); 1331 1127 1332 1128 if (pServerInfo) { … … 1356 1152 } 1357 1153 1358 if ((CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER) & dwClsContext) { 1359 HKEY key; 1360 char buf[200]; 1361 1362 memset(ProviderName,0,sizeof(ProviderName)); 1363 sprintf(buf,"CLSID\\%s\\InprocServer32",xclsid); 1364 if (((hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key)) != ERROR_SUCCESS) || 1365 ((hres = RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)ProviderName,&ProviderNameLen)), 1366 RegCloseKey (key), 1367 hres != ERROR_SUCCESS)) 1368 { 1154 /* first try: in-process */ 1155 if ((CLSCTX_INPROC_SERVER | CLSCTX_INPROC_HANDLER) & dwClsContext) { 1156 char keyname[MAX_PATH]; 1157 char dllpath[MAX_PATH+1]; 1158 1159 sprintf(keyname,"CLSID\\%s\\InprocServer32",xclsid); 1160 1161 if ( compobj_RegReadPath(keyname, NULL, dllpath, sizeof(dllpath)) != ERROR_SUCCESS) { 1162 /* failure: CLSID is not found in registry */ 1163 WARN("class %s not registred\n", xclsid); 1369 1164 hres = REGDB_E_CLASSNOTREG; 1370 } 1371 /* Don't ask me. MSDN says that CoGetClassObject does NOT call CoLoadLibrary */ 1372 else if ((hLibrary = CoLoadLibrary(ProviderName, TRUE)) == 0) 1373 { 1374 FIXME("couldn't load InprocServer32 dll %s\n", debugstr_w(ProviderName)); 1375 hres = E_ACCESSDENIED; /* or should this be CO_E_DLLNOTFOUND? */ 1165 } else { 1166 if ((hLibrary = LoadLibraryExA(dllpath, 0, LOAD_WITH_ALTERED_SEARCH_PATH)) == 0) { 1167 /* failure: DLL could not be loaded */ 1168 ERR("couldn't load InprocServer32 dll %s\n", dllpath); 1169 hres = E_ACCESSDENIED; /* FIXME: or should this be CO_E_DLLNOTFOUND? */ 1170 } else if (!(DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject"))) { 1171 /* failure: the dll did not export DllGetClassObject */ 1172 ERR("couldn't find function DllGetClassObject in %s\n", dllpath); 1173 FreeLibrary( hLibrary ); 1174 hres = CO_E_DLLNOTFOUND; 1175 } else { 1176 /* OK: get the ClassObject */ 1177 COMPOBJ_DLLList_Add( hLibrary ); 1178 return DllGetClassObject(rclsid, iid, ppv); 1179 } 1376 1180 } 1377 else if (!(DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject"))) 1378 { 1379 /* not sure if this should be called here CoFreeLibrary(hLibrary);*/ 1380 FIXME("couldn't find function DllGetClassObject in %s\n", debugstr_w(ProviderName)); 1381 hres = E_ACCESSDENIED; 1382 } 1383 else 1384 { 1385 /* Ask the DLL for its class object. (there was a note here about 1386 * class factories but this is good. 1387 */ 1388 return DllGetClassObject(rclsid, iid, ppv); 1389 } 1390 } 1391 1181 } 1392 1182 1393 1183 /* Next try out of process */ … … 1426 1216 IStorage *pstg=0; 1427 1217 HRESULT res; 1428 int nbElm =0,length=0,i=0;1429 LONG sizeProgId =20;1218 int nbElm, length, i; 1219 LONG sizeProgId; 1430 1220 LPOLESTR *pathDec=0,absFile=0,progId=0; 1431 WCHAR extention[100]={0}; 1432 1433 TRACE("()\n"); 1221 LPWSTR extension; 1222 static const WCHAR bkslashW[] = {'\\',0}; 1223 static const WCHAR dotW[] = {'.',0}; 1224 1225 TRACE("%s, %p\n", debugstr_w(filePathName), pclsid); 1434 1226 1435 1227 /* if the file contain a storage object the return the CLSID writen by IStorage_SetClass method*/ … … 1475 1267 1476 1268 /* failed if the path represente a directory and not an absolute file name*/ 1477 if ( lstrcmpW(absFile,(LPOLESTR)"\\"))1269 if (!lstrcmpW(absFile, bkslashW)) 1478 1270 return MK_E_INVALIDEXTENSION; 1479 1271 1480 1272 /* get the extension of the file */ 1273 extension = NULL; 1481 1274 length=lstrlenW(absFile); 1482 for(i=length-1; ( (i>=0) && (extention[i]=absFile[i]) );i--); 1275 for(i = length-1; (i >= 0) && *(extension = &absFile[i]) != '.'; i--) 1276 /* nothing */; 1277 1278 if (!extension || !lstrcmpW(extension, dotW)) 1279 return MK_E_INVALIDEXTENSION; 1280 1281 res=RegQueryValueW(HKEY_CLASSES_ROOT, extension, NULL, &sizeProgId); 1483 1282 1484 1283 /* get the progId associated to the extension */ 1485 progId=CoTaskMemAlloc(sizeProgId); 1486 1487 res=RegQueryValueW(HKEY_CLASSES_ROOT,extention,progId,&sizeProgId); 1488 1489 if (res==ERROR_MORE_DATA){ 1490 1491 progId = CoTaskMemRealloc(progId,sizeProgId); 1492 res=RegQueryValueW(HKEY_CLASSES_ROOT,extention,progId,&sizeProgId); 1493 } 1284 progId = CoTaskMemAlloc(sizeProgId); 1285 res = RegQueryValueW(HKEY_CLASSES_ROOT, extension, progId, &sizeProgId); 1286 1494 1287 if (res==ERROR_SUCCESS) 1495 1288 /* return the clsid associated to the progId */ … … 1507 1300 return MK_E_INVALIDEXTENSION; 1508 1301 } 1509 /******************************************************************************1510 * CoRegisterMessageFilter [COMPOBJ.27]1511 */1512 HRESULT WINAPI CoRegisterMessageFilter16(1513 LPMESSAGEFILTER lpMessageFilter,1514 LPMESSAGEFILTER *lplpMessageFilter1515 ) {1516 FIXME("(%p,%p),stub!\n",lpMessageFilter,lplpMessageFilter);1517 return 0;1518 }1519 1520 1302 /*********************************************************************** 1521 1303 * CoCreateInstance [COMPOBJ.13] … … 1644 1426 1645 1427 /*********************************************************************** 1428 * CoLoadLibrary (OLE32.30) 1429 */ 1430 HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree) 1431 { 1432 TRACE("(%s, %d)\n", debugstr_w(lpszLibName), bAutoFree); 1433 1434 return LoadLibraryExW(lpszLibName, 0, LOAD_WITH_ALTERED_SEARCH_PATH); 1435 } 1436 1437 /*********************************************************************** 1646 1438 * CoFreeLibrary [OLE32.13] 1439 * 1440 * NOTES: don't belive the docu 1647 1441 */ 1648 1442 void WINAPI CoFreeLibrary(HINSTANCE hLibrary) 1649 1443 { 1650 OpenDll *ptr, *prev; 1651 OpenDll *tmp; 1652 1653 EnterCriticalSection( &csOpenDllList ); 1654 1655 /* lookup library in linked list */ 1656 prev = NULL; 1657 for (ptr = openDllList; ptr != NULL; ptr=ptr->next) { 1658 if (ptr->hLibrary == hLibrary) { 1659 break; 1660 } 1661 prev = ptr; 1662 } 1663 1664 if (ptr == NULL) { 1665 /* shouldn't happen if user passed in a valid hLibrary */ 1666 goto end; 1667 } 1668 /* assert: ptr points to the library entry to free */ 1669 1670 /* free library and remove node from list */ 1671 FreeLibrary(hLibrary); 1672 if (ptr == openDllList) { 1673 tmp = openDllList->next; 1674 HeapFree(GetProcessHeap(), 0, openDllList); 1675 openDllList = tmp; 1676 } else { 1677 tmp = ptr->next; 1678 HeapFree(GetProcessHeap(), 0, ptr); 1679 prev->next = tmp; 1680 } 1681 end: 1682 LeaveCriticalSection( &csOpenDllList ); 1444 FreeLibrary(hLibrary); 1683 1445 } 1684 1446 … … 1686 1448 /*********************************************************************** 1687 1449 * CoFreeAllLibraries [OLE32.12] 1450 * 1451 * NOTES: don't belive the docu 1688 1452 */ 1689 1453 void WINAPI CoFreeAllLibraries(void) 1690 1454 { 1691 OpenDll *ptr, *tmp; 1692 1693 EnterCriticalSection( &csOpenDllList ); 1694 1695 for (ptr = openDllList; ptr != NULL; ) { 1696 tmp=ptr->next; 1697 CoFreeLibrary(ptr->hLibrary); 1698 ptr = tmp; 1699 } 1700 1701 LeaveCriticalSection( &csOpenDllList ); 1702 } 1703 1455 /* NOP */ 1456 } 1704 1457 1705 1458 … … 1707 1460 * CoFreeUnusedLibraries [COMPOBJ.17] 1708 1461 * CoFreeUnusedLibraries [OLE32.14] 1462 * 1463 * FIXME: Calls to CoFreeUnusedLibraries from any thread always route 1464 * through the main apartment's thread to call DllCanUnloadNow 1709 1465 */ 1710 1466 void WINAPI CoFreeUnusedLibraries(void) 1711 1467 { 1712 OpenDll *ptr, *tmp; 1713 typedef HRESULT(*DllCanUnloadNowFunc)(void); 1714 DllCanUnloadNowFunc DllCanUnloadNow; 1715 1716 EnterCriticalSection( &csOpenDllList ); 1717 1718 for (ptr = openDllList; ptr != NULL; ) { 1719 DllCanUnloadNow = (DllCanUnloadNowFunc) 1720 GetProcAddress(ptr->hLibrary, "DllCanUnloadNow"); 1721 1722 if ( (DllCanUnloadNow != NULL) && 1723 (DllCanUnloadNow() == S_OK) ) { 1724 tmp=ptr->next; 1725 CoFreeLibrary(ptr->hLibrary); 1726 ptr = tmp; 1727 } else { 1728 ptr=ptr->next; 1729 } 1730 } 1731 1732 LeaveCriticalSection( &csOpenDllList ); 1468 COMPOBJ_DllList_FreeUnused(0); 1733 1469 } 1734 1470 … … 1747 1483 1748 1484 /*********************************************************************** 1749 * CoTaskMemAlloc (OLE32.43)1750 * RETURNS1751 * pointer to newly allocated block1752 */1753 LPVOID WINAPI CoTaskMemAlloc(1754 ULONG size /* [in] size of memoryblock to be allocated */1755 ) {1756 LPMALLOC lpmalloc;1757 HRESULT ret = CoGetMalloc(0,&lpmalloc);1758 1759 if (FAILED(ret))1760 return NULL;1761 1762 return IMalloc_Alloc(lpmalloc,size);1763 }1764 /***********************************************************************1765 * CoTaskMemFree (OLE32.44)1766 */1767 VOID WINAPI CoTaskMemFree(1768 LPVOID ptr /* [in] pointer to be freed */1769 ) {1770 LPMALLOC lpmalloc;1771 HRESULT ret = CoGetMalloc(0,&lpmalloc);1772 1773 if (FAILED(ret))1774 return;1775 1776 IMalloc_Free(lpmalloc, ptr);1777 }1778 1779 /***********************************************************************1780 * CoTaskMemRealloc (OLE32.45)1781 * RETURNS1782 * pointer to newly allocated block1783 */1784 LPVOID WINAPI CoTaskMemRealloc(1785 LPVOID pvOld,1786 ULONG size) /* [in] size of memoryblock to be allocated */1787 {1788 LPMALLOC lpmalloc;1789 HRESULT ret = CoGetMalloc(0,&lpmalloc);1790 1791 if (FAILED(ret))1792 return NULL;1793 1794 return IMalloc_Realloc(lpmalloc, pvOld, size);1795 }1796 1797 /***********************************************************************1798 1485 * CoLoadLibrary (OLE32.30) 1799 1486 */ 1800 HINSTANCE WINAPI CoLoadLibrary(LPOLESTR lpszLibName, BOOL bAutoFree) 1801 { 1802 HINSTANCE hLibrary; 1803 OpenDll *ptr; 1804 OpenDll *tmp; 1805 1806 TRACE("(%s, %d)\n", debugstr_w(lpszLibName), bAutoFree); 1807 1808 hLibrary = LoadLibraryExW(lpszLibName, 0, LOAD_WITH_ALTERED_SEARCH_PATH); 1809 1810 if (!bAutoFree) 1811 return hLibrary; 1812 1813 EnterCriticalSection( &csOpenDllList ); 1814 1815 if (openDllList == NULL) { 1816 /* empty list -- add first node */ 1817 openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll)); 1818 openDllList->hLibrary=hLibrary; 1819 openDllList->next = NULL; 1487 static void COM_RevokeAllClasses() 1488 { 1489 EnterCriticalSection( &csRegisteredClassList ); 1490 1491 while (firstRegisteredClass!=0) 1492 { 1493 CoRevokeClassObject(firstRegisteredClass->dwCookie); 1494 } 1495 1496 LeaveCriticalSection( &csRegisteredClassList ); 1497 } 1498 1499 /**************************************************************************** 1500 * COM External Lock methods implementation 1501 * 1502 * This api provides a linked list to managed external references to 1503 * COM objects. 1504 * 1505 * The public interface consists of three calls: 1506 * COM_ExternalLockAddRef 1507 * COM_ExternalLockRelease 1508 * COM_ExternalLockFreeList 1509 */ 1510 1511 #define EL_END_OF_LIST 0 1512 #define EL_NOT_FOUND 0 1513 1514 /* 1515 * Declaration of the static structure that manage the 1516 * external lock to COM objects. 1517 */ 1518 typedef struct COM_ExternalLock COM_ExternalLock; 1519 typedef struct COM_ExternalLockList COM_ExternalLockList; 1520 1521 struct COM_ExternalLock 1522 { 1523 IUnknown *pUnk; /* IUnknown referenced */ 1524 ULONG uRefCount; /* external lock counter to IUnknown object*/ 1525 COM_ExternalLock *next; /* Pointer to next element in list */ 1526 }; 1527 1528 struct COM_ExternalLockList 1529 { 1530 COM_ExternalLock *head; /* head of list */ 1531 }; 1532 1533 /* 1534 * Declaration and initialization of the static structure that manages 1535 * the external lock to COM objects. 1536 */ 1537 static COM_ExternalLockList elList = { EL_END_OF_LIST }; 1538 1539 /* 1540 * Private methods used to managed the linked list 1541 */ 1542 1543 1544 static COM_ExternalLock* COM_ExternalLockLocate( 1545 COM_ExternalLock *element, 1546 IUnknown *pUnk); 1547 1548 /**************************************************************************** 1549 * Internal - Insert a new IUnknown* to the linked list 1550 */ 1551 static BOOL COM_ExternalLockInsert( 1552 IUnknown *pUnk) 1553 { 1554 COM_ExternalLock *newLock = NULL; 1555 COM_ExternalLock *previousHead = NULL; 1556 1557 /* 1558 * Allocate space for the new storage object 1559 */ 1560 newLock = HeapAlloc(GetProcessHeap(), 0, sizeof(COM_ExternalLock)); 1561 1562 if (newLock!=NULL) { 1563 if ( elList.head == EL_END_OF_LIST ) { 1564 elList.head = newLock; /* The list is empty */ 1820 1565 } else { 1821 /* search for this dll */ 1822 int found = FALSE; 1823 for (ptr = openDllList; ptr->next != NULL; ptr=ptr->next) { 1824 if (ptr->hLibrary == hLibrary) { 1825 found = TRUE; 1826 break; 1827 } 1828 } 1829 if (!found) { 1830 /* dll not found, add it */ 1831 tmp = openDllList; 1832 openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll)); 1833 openDllList->hLibrary = hLibrary; 1834 openDllList->next = tmp; 1835 } 1836 } 1837 1838 LeaveCriticalSection( &csOpenDllList ); 1839 1840 return hLibrary; 1841 } 1842 1843 /*********************************************************************** 1844 * CoInitializeWOW (OLE32.27) 1845 */ 1846 HRESULT WINAPI CoInitializeWOW(DWORD x,DWORD y) { 1847 FIXME("(0x%08lx,0x%08lx),stub!\n",x,y); 1848 return 0; 1849 } 1850 1851 /****************************************************************************** 1852 * CoLockObjectExternal [COMPOBJ.63] 1853 */ 1854 HRESULT WINAPI CoLockObjectExternal16( 1855 LPUNKNOWN pUnk, /* [in] object to be locked */ 1856 BOOL16 fLock, /* [in] do lock */ 1857 BOOL16 fLastUnlockReleases /* [in] ? */ 1858 ) { 1859 FIXME("(%p,%d,%d),stub!\n",pUnk,fLock,fLastUnlockReleases); 1860 return S_OK; 1566 /* insert does it at the head */ 1567 previousHead = elList.head; 1568 elList.head = newLock; 1569 } 1570 1571 /* Set new list item data member */ 1572 newLock->pUnk = pUnk; 1573 newLock->uRefCount = 1; 1574 newLock->next = previousHead; 1575 1576 return TRUE; 1577 } 1578 return FALSE; 1579 } 1580 1581 /**************************************************************************** 1582 * Internal - Method that removes an item from the linked list. 1583 */ 1584 static void COM_ExternalLockDelete( 1585 COM_ExternalLock *itemList) 1586 { 1587 COM_ExternalLock *current = elList.head; 1588 1589 if ( current == itemList ) { 1590 /* this section handles the deletion of the first node */ 1591 elList.head = itemList->next; 1592 HeapFree( GetProcessHeap(), 0, itemList); 1593 } else { 1594 do { 1595 if ( current->next == itemList ){ /* We found the item to free */ 1596 current->next = itemList->next; /* readjust the list pointers */ 1597 HeapFree( GetProcessHeap(), 0, itemList); 1598 break; 1599 } 1600 1601 /* Skip to the next item */ 1602 current = current->next; 1603 1604 } while ( current != EL_END_OF_LIST ); 1605 } 1606 } 1607 1608 /**************************************************************************** 1609 * Internal - Recursivity agent for IUnknownExternalLockList_Find 1610 * 1611 * NOTES: how long can the list be ?? (recursive!!!) 1612 */ 1613 static COM_ExternalLock* COM_ExternalLockLocate( COM_ExternalLock *element, IUnknown *pUnk) 1614 { 1615 if ( element == EL_END_OF_LIST ) 1616 return EL_NOT_FOUND; 1617 else if ( element->pUnk == pUnk ) /* We found it */ 1618 return element; 1619 else /* Not the right guy, keep on looking */ 1620 return COM_ExternalLockLocate( element->next, pUnk); 1621 } 1622 1623 /**************************************************************************** 1624 * Public - Method that increments the count for a IUnknown* in the linked 1625 * list. The item is inserted if not already in the list. 1626 */ 1627 static void COM_ExternalLockAddRef(IUnknown *pUnk) 1628 { 1629 COM_ExternalLock *externalLock = COM_ExternalLockLocate(elList.head, pUnk); 1630 1631 /* 1632 * Add an external lock to the object. If it was already externally 1633 * locked, just increase the reference count. If it was not. 1634 * add the item to the list. 1635 */ 1636 if ( externalLock == EL_NOT_FOUND ) 1637 COM_ExternalLockInsert(pUnk); 1638 else 1639 externalLock->uRefCount++; 1640 1641 /* 1642 * Add an internal lock to the object 1643 */ 1644 IUnknown_AddRef(pUnk); 1645 } 1646 1647 /**************************************************************************** 1648 * Public - Method that decrements the count for a IUnknown* in the linked 1649 * list. The item is removed from the list if its count end up at zero or if 1650 * bRelAll is TRUE. 1651 */ 1652 static void COM_ExternalLockRelease( 1653 IUnknown *pUnk, 1654 BOOL bRelAll) 1655 { 1656 COM_ExternalLock *externalLock = COM_ExternalLockLocate(elList.head, pUnk); 1657 1658 if ( externalLock != EL_NOT_FOUND ) { 1659 do { 1660 externalLock->uRefCount--; /* release external locks */ 1661 IUnknown_Release(pUnk); /* release local locks as well */ 1662 1663 if ( bRelAll == FALSE ) break; /* perform single release */ 1664 1665 } while ( externalLock->uRefCount > 0 ); 1666 1667 if ( externalLock->uRefCount == 0 ) /* get rid of the list entry */ 1668 COM_ExternalLockDelete(externalLock); 1669 } 1670 } 1671 /**************************************************************************** 1672 * Public - Method that frees the content of the list. 1673 */ 1674 static void COM_ExternalLockFreeList() 1675 { 1676 COM_ExternalLock *head; 1677 1678 head = elList.head; /* grab it by the head */ 1679 while ( head != EL_END_OF_LIST ) { 1680 COM_ExternalLockDelete(head); /* get rid of the head stuff */ 1681 head = elList.head; /* get the new head... */ 1682 } 1683 } 1684 1685 /**************************************************************************** 1686 * Public - Method that dump the content of the list. 1687 */ 1688 void COM_ExternalLockDump() 1689 { 1690 COM_ExternalLock *current = elList.head; 1691 1692 DPRINTF("\nExternal lock list contains:\n"); 1693 1694 while ( current != EL_END_OF_LIST ) { 1695 DPRINTF( "\t%p with %lu references count.\n", current->pUnk, current->uRefCount); 1696 1697 /* Skip to the next item */ 1698 current = current->next; 1699 } 1861 1700 } 1862 1701 … … 1870 1709 { 1871 1710 1872 if (fLock) 1873 { 1874 /* 1875 * Increment the external lock coutner, COM_ExternalLockAddRef also 1876 * increment the object's internal lock counter. 1877 */ 1878 COM_ExternalLockAddRef( pUnk); 1879 } 1880 else 1881 { 1882 /* 1883 * Decrement the external lock coutner, COM_ExternalLockRelease also 1884 * decrement the object's internal lock counter. 1885 */ 1886 COM_ExternalLockRelease( pUnk, fLastUnlockReleases); 1887 } 1888 1889 return S_OK; 1890 } 1891 1892 /*********************************************************************** 1893 * CoGetState [COMPOBJ.115] 1894 */ 1895 HRESULT WINAPI CoGetState16(LPDWORD state) 1896 { 1897 FIXME("(%p),stub!\n", state); 1898 *state = 0; 1899 return S_OK; 1900 } 1711 if (fLock) { 1712 /* 1713 * Increment the external lock coutner, COM_ExternalLockAddRef also 1714 * increment the object's internal lock counter. 1715 */ 1716 COM_ExternalLockAddRef( pUnk); 1717 } else { 1718 /* 1719 * Decrement the external lock coutner, COM_ExternalLockRelease also 1720 * decrement the object's internal lock counter. 1721 */ 1722 COM_ExternalLockRelease( pUnk, fLastUnlockReleases); 1723 } 1724 1725 return S_OK; 1726 } 1727 1728 /*********************************************************************** 1729 * CoInitializeWOW (OLE32.27) 1730 */ 1731 HRESULT WINAPI CoInitializeWOW(DWORD x,DWORD y) { 1732 FIXME("(0x%08lx,0x%08lx),stub!\n",x,y); 1733 return 0; 1734 } 1735 1736 static IUnknown * pUnkState = 0; /* FIXME: thread local */ 1737 static int nStatCounter = 0; /* global */ 1738 static HMODULE hOleAut32 = 0; /* global */ 1739 1740 /*********************************************************************** 1741 * CoGetState [OLE32.24] 1742 * 1743 * NOTES: might be incomplete 1744 */ 1745 HRESULT WINAPI CoGetState(IUnknown ** ppv) 1746 { 1747 FIXME("\n"); 1748 1749 if(pUnkState) { 1750 IUnknown_AddRef(pUnkState); 1751 *ppv = pUnkState; 1752 FIXME("-- %p\n", *ppv); 1753 return S_OK; 1754 } 1755 *ppv = NULL; 1756 return E_FAIL; 1757 1758 } 1759 1901 1760 /*********************************************************************** 1902 1761 * CoSetState [OLE32.42] 1903 */ 1904 HRESULT WINAPI CoSetState(LPDWORD state) 1905 { 1906 FIXME("(%p),stub!\n", state); 1907 if (state) *state = 0; 1908 return S_OK; 1909 } 1910 /*********************************************************************** 1911 * CoCreateFreeThreadedMarshaler [OLE32.5] 1912 */ 1913 HRESULT WINAPI CoCreateFreeThreadedMarshaler (LPUNKNOWN punkOuter, LPUNKNOWN* ppunkMarshal) 1914 { 1915 FIXME ("(%p %p): stub\n", punkOuter, ppunkMarshal); 1916 1917 return S_OK; 1918 } 1919 1920 /*** 1921 * COM_RevokeAllClasses 1922 * 1923 * This method is called when the COM libraries are uninitialized to 1924 * release all the references to the class objects registered with 1925 * the library 1926 */ 1927 static void COM_RevokeAllClasses() 1928 { 1929 EnterCriticalSection( &csRegisteredClassList ); 1930 1931 while (firstRegisteredClass!=0) 1932 { 1933 CoRevokeClassObject(firstRegisteredClass->dwCookie); 1934 } 1935 1936 LeaveCriticalSection( &csRegisteredClassList ); 1937 } 1938 1939 /**************************************************************************** 1940 * COM External Lock methods implementation 1941 */ 1942 1943 /**************************************************************************** 1944 * Public - Method that increments the count for a IUnknown* in the linked 1945 * list. The item is inserted if not already in the list. 1946 */ 1947 static void COM_ExternalLockAddRef( 1948 IUnknown *pUnk) 1949 { 1950 COM_ExternalLock *externalLock = COM_ExternalLockFind(pUnk); 1951 1952 /* 1953 * Add an external lock to the object. If it was already externally 1954 * locked, just increase the reference count. If it was not. 1955 * add the item to the list. 1956 */ 1957 if ( externalLock == EL_NOT_FOUND ) 1958 COM_ExternalLockInsert(pUnk); 1959 else 1960 externalLock->uRefCount++; 1961 1962 /* 1963 * Add an internal lock to the object 1964 */ 1965 IUnknown_AddRef(pUnk); 1966 } 1967 1968 /**************************************************************************** 1969 * Public - Method that decrements the count for a IUnknown* in the linked 1970 * list. The item is removed from the list if its count end up at zero or if 1971 * bRelAll is TRUE. 1972 */ 1973 static void COM_ExternalLockRelease( 1974 IUnknown *pUnk, 1975 BOOL bRelAll) 1976 { 1977 COM_ExternalLock *externalLock = COM_ExternalLockFind(pUnk); 1978 1979 if ( externalLock != EL_NOT_FOUND ) 1980 { 1981 do 1982 { 1983 externalLock->uRefCount--; /* release external locks */ 1984 IUnknown_Release(pUnk); /* release local locks as well */ 1985 1986 if ( bRelAll == FALSE ) 1987 break; /* perform single release */ 1988 1989 } while ( externalLock->uRefCount > 0 ); 1990 1991 if ( externalLock->uRefCount == 0 ) /* get rid of the list entry */ 1992 COM_ExternalLockDelete(externalLock); 1993 } 1994 } 1995 /**************************************************************************** 1996 * Public - Method that frees the content of the list. 1997 */ 1998 static void COM_ExternalLockFreeList() 1999 { 2000 COM_ExternalLock *head; 2001 2002 head = elList.head; /* grab it by the head */ 2003 while ( head != EL_END_OF_LIST ) 2004 { 2005 COM_ExternalLockDelete(head); /* get rid of the head stuff */ 2006 2007 head = elList.head; /* get the new head... */ 2008 } 2009 } 2010 2011 /**************************************************************************** 2012 * Public - Method that dump the content of the list. 2013 */ 2014 void COM_ExternalLockDump() 2015 { 2016 COM_ExternalLock *current = elList.head; 2017 2018 DPRINTF("\nExternal lock list contains:\n"); 2019 2020 while ( current != EL_END_OF_LIST ) 2021 { 2022 DPRINTF( "\t%p with %lu references count.\n", current->pUnk, current->uRefCount); 2023 2024 /* Skip to the next item */ 2025 current = current->next; 2026 } 2027 2028 } 2029 2030 /**************************************************************************** 2031 * Internal - Find a IUnknown* in the linked list 2032 */ 2033 static COM_ExternalLock* COM_ExternalLockFind( 2034 IUnknown *pUnk) 2035 { 2036 return COM_ExternalLockLocate(elList.head, pUnk); 2037 } 2038 2039 /**************************************************************************** 2040 * Internal - Recursivity agent for IUnknownExternalLockList_Find 2041 */ 2042 static COM_ExternalLock* COM_ExternalLockLocate( 2043 COM_ExternalLock *element, 2044 IUnknown *pUnk) 2045 { 2046 if ( element == EL_END_OF_LIST ) 2047 return EL_NOT_FOUND; 2048 2049 else if ( element->pUnk == pUnk ) /* We found it */ 2050 return element; 2051 2052 else /* Not the right guy, keep on looking */ 2053 return COM_ExternalLockLocate( element->next, pUnk); 2054 } 2055 2056 /**************************************************************************** 2057 * Internal - Insert a new IUnknown* to the linked list 2058 */ 2059 static BOOL COM_ExternalLockInsert( 2060 IUnknown *pUnk) 2061 { 2062 COM_ExternalLock *newLock = NULL; 2063 COM_ExternalLock *previousHead = NULL; 2064 2065 /* 2066 * Allocate space for the new storage object 2067 */ 2068 newLock = HeapAlloc(GetProcessHeap(), 0, sizeof(COM_ExternalLock)); 2069 2070 if (newLock!=NULL) 2071 { 2072 if ( elList.head == EL_END_OF_LIST ) 2073 { 2074 elList.head = newLock; /* The list is empty */ 2075 } 2076 else 2077 { 2078 /* 2079 * insert does it at the head 2080 */ 2081 previousHead = elList.head; 2082 elList.head = newLock; 2083 } 2084 2085 /* 2086 * Set new list item data member 2087 */ 2088 newLock->pUnk = pUnk; 2089 newLock->uRefCount = 1; 2090 newLock->next = previousHead; 2091 2092 return TRUE; 2093 } 2094 else 2095 return FALSE; 2096 } 2097 2098 /**************************************************************************** 2099 * Internal - Method that removes an item from the linked list. 2100 */ 2101 static void COM_ExternalLockDelete( 2102 COM_ExternalLock *itemList) 2103 { 2104 COM_ExternalLock *current = elList.head; 2105 2106 if ( current == itemList ) 2107 { 2108 /* 2109 * this section handles the deletion of the first node 2110 */ 2111 elList.head = itemList->next; 2112 HeapFree( GetProcessHeap(), 0, itemList); 2113 } 2114 else 2115 { 2116 do 2117 { 2118 if ( current->next == itemList ) /* We found the item to free */ 2119 { 2120 current->next = itemList->next; /* readjust the list pointers */ 2121 2122 HeapFree( GetProcessHeap(), 0, itemList); 2123 break; 2124 } 2125 2126 /* Skip to the next item */ 2127 current = current->next; 2128 2129 } while ( current != EL_END_OF_LIST ); 2130 } 2131 } 2132 2133 /*********************************************************************** 2134 * DllEntryPoint [COMPOBJ.116] 2135 * 2136 * Initialization code for the COMPOBJ DLL 2137 * 2138 * RETURNS: 2139 */ 2140 BOOL WINAPI COMPOBJ_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD HeapSize, DWORD res1, WORD res2) 2141 { 2142 TRACE("(%08lx, %04x, %04x, %04x, %08lx, %04x)\n", Reason, hInst, ds, HeapSize, 2143 res1, res2); 2144 switch(Reason) 2145 { 2146 case DLL_PROCESS_ATTACH: 2147 if (!COMPOBJ_Attach++) COMPOBJ_hInstance = hInst; 2148 break; 2149 2150 case DLL_PROCESS_DETACH: 2151 if(!--COMPOBJ_Attach) 2152 COMPOBJ_hInstance = 0; 2153 break; 2154 } 2155 return TRUE; 2156 } 1762 * 1763 * NOTES: FIXME: protect this with a crst 1764 */ 1765 HRESULT WINAPI CoSetState(IUnknown * pv) 1766 { 1767 FIXME("(%p),stub!\n", pv); 1768 1769 if (pv) { 1770 IUnknown_AddRef(pv); 1771 nStatCounter++; 1772 if (nStatCounter == 1) LoadLibraryA("OLEAUT32.DLL"); 1773 } 1774 1775 if (pUnkState) { 1776 TRACE("-- release %p now\n", pUnkState); 1777 IUnknown_Release(pUnkState); 1778 nStatCounter--; 1779 if (!nStatCounter) FreeLibrary(hOleAut32); 1780 } 1781 pUnkState = pv; 1782 return S_OK; 1783 } 1784 2157 1785 2158 1786 /****************************************************************************** … … 2184 1812 CLSIDFromString(wbuf,pClsidNew); 2185 1813 done: 2186 if (hkey) RegCloseKey(hkey); 2187 2188 return res; 1814 if (hkey) RegCloseKey(hkey); 1815 return res; 2189 1816 } 2190 1817 … … 2262 1889 return !memcmp(rguid1,rguid2,sizeof(GUID)); 2263 1890 } 1891 1892 /*********************************************************************** 1893 * CoInitializeSecurity [OLE32.164] 1894 */ 1895 HRESULT WINAPI CoInitializeSecurity(PSECURITY_DESCRIPTOR pSecDesc, LONG cAuthSvc, 1896 SOLE_AUTHENTICATION_SERVICE* asAuthSvc, 1897 void* pReserved1, DWORD dwAuthnLevel, 1898 DWORD dwImpLevel, void* pReserved2, 1899 DWORD dwCapabilities, void* pReserved3) 1900 { 1901 FIXME("(%p,%ld,%p,%p,%ld,%ld,%p,%ld,%p) - stub!\n", pSecDesc, cAuthSvc, 1902 asAuthSvc, pReserved1, dwAuthnLevel, dwImpLevel, pReserved2, 1903 dwCapabilities, pReserved3); 1904 return S_OK; 1905 } -
trunk/src/ole32/compobj_private.h
r8620 r9400 125 125 int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable); 126 126 127 HRESULT WINAPI __CLSIDFromStringA(LPCSTR idstr, CLSID *id); 128 127 129 #endif /* __WINE_OLE_COMPOBJ_H */ -
trunk/src/ole32/datacache.c
r8620 r9400 827 827 828 828 if (FAILED(hres)) 829 return hres;829 return (HMETAFILE)hres; 830 830 831 831 /* -
trunk/src/ole32/filemoniker.c
r8620 r9400 871 871 872 872 if (!IsEqualCLSID(&clsid,&CLSID_FileMoniker)) 873 874 873 return S_FALSE; 875 874 876 res=CreateBindCtx(0,&bind); 877 if (FAILED(res)) 878 return res; 879 880 IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath); 881 882 if (lstrcmpiW(filePath, 883 This->filePathName)!=0) 884 885 return S_FALSE; 886 887 return S_OK; 875 res = CreateBindCtx(0,&bind); 876 if (FAILED(res)) return res; 877 878 if (SUCCEEDED(IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&filePath))) { 879 int result = lstrcmpiW(filePath, This->filePathName); 880 CoTaskMemFree(filePath); 881 if ( result == 0 ) return S_OK; 882 } 883 return S_FALSE; 884 888 885 } 889 886 … … 1100 1097 int len=lstrlenW(str); 1101 1098 1099 TRACE("%s, %p\n", debugstr_w(str), *stringTable); 1100 1102 1101 strgtable =CoTaskMemAlloc(len*sizeof(LPOLESTR)); 1103 1102 -
trunk/src/ole32/hglobalstream.c
r8620 r9400 34 34 #include "winbase.h" 35 35 #include "winerror.h" 36 #include "winternl.h" 36 37 37 38 #include "wine/debug.h" … … 574 575 575 576 /* 576 * The caller is allowed to pass in NULL as the new position return value.577 * If it happens, we assign it to a dynamic variable to avoid special cases578 * in the code below.579 */580 if (plibNewPosition == 0)581 {582 plibNewPosition = &newPosition;583 }584 585 /*586 577 * The file pointer is moved depending on the given "function" 587 578 * parameter. … … 590 581 { 591 582 case STREAM_SEEK_SET: 592 plibNewPosition->s.HighPart = 0;593 plibNewPosition->s.LowPart= 0;583 newPosition.s.HighPart = 0; 584 newPosition.s.LowPart = 0; 594 585 break; 595 586 case STREAM_SEEK_CUR: 596 *plibNewPosition = This->currentPosition;587 newPosition = This->currentPosition; 597 588 break; 598 589 case STREAM_SEEK_END: 599 *plibNewPosition = This->streamSize;590 newPosition = This->streamSize; 600 591 break; 601 592 default: … … 604 595 605 596 /* 606 * We don't support files with offsets of 64 bits.607 */608 assert(dlibMove.s.HighPart == 0);609 610 /*611 * Check if we end-up before the beginning of the file. That should trigger an612 * error.613 */614 if ( (dlibMove.s.LowPart<0) && (plibNewPosition->s.LowPart < (ULONG)(-dlibMove.s.LowPart)) )615 {616 /*617 * I don't know what error to send there.618 */619 return E_FAIL;620 }621 622 /*623 597 * Move the actual file pointer 624 598 * If the file pointer ends-up after the end of the stream, the next Write operation will 625 599 * make the file larger. This is how it is documented. 626 600 */ 627 plibNewPosition->s.LowPart += dlibMove.s.LowPart; 628 This->currentPosition = *plibNewPosition; 601 #ifdef __WIN32OS2__ 602 *(LARGE_INTEGER *)&newPosition = RtlpLargeIntegerAdd( (LARGE_INTEGER *)&newPosition, &dlibMove ); 603 #else 604 newPosition.QuadPart = RtlLargeIntegerAdd(newPosition.QuadPart, dlibMove.QuadPart); 605 #endif 606 if (newPosition.QuadPart < 0) return STG_E_INVALIDFUNCTION; 607 608 if (plibNewPosition) *plibNewPosition = newPosition; 609 This->currentPosition = newPosition; 629 610 630 611 return S_OK; … … 844 825 IStream** ppstm) /* [out] */ 845 826 { 846 FIXME("not implemented!\n"); 847 return E_NOTIMPL; 848 } 827 ULARGE_INTEGER dummy; 828 LARGE_INTEGER offset; 829 HRESULT hr; 830 HGLOBALStreamImpl* const This=(HGLOBALStreamImpl*)iface; 831 TRACE(" Cloning %p (deleteOnRelease=%d seek position=%ld)\n",iface,This->deleteOnRelease,(long)This->currentPosition.QuadPart); 832 hr=CreateStreamOnHGlobal(This->supportHandle, FALSE, ppstm); 833 if(FAILED(hr)) 834 return hr; 835 offset.QuadPart=(LONGLONG)This->currentPosition.QuadPart; 836 HGLOBALStreamImpl_Seek(*ppstm,offset,STREAM_SEEK_SET,&dummy); 837 return S_OK; 838 } -
trunk/src/ole32/ifs.c
r8441 r9400 28 28 #include "ole2.h" 29 29 #include "windef.h" 30 #include "winbase.h" 30 31 #include "winerror.h" 31 32 32 33 #include "wine/obj_base.h" 33 #include "wine/winbase16.h"34 #include "ifs.h"35 34 36 35 #include "wine/debug.h" 37 36 38 WINE_DEFAULT_DEBUG_CHANNEL(relay); 39 40 /* --- IUnknown implementation */ 41 42 typedef struct 43 { 44 /* IUnknown fields */ 45 ICOM_VFIELD(IUnknown); 46 DWORD ref; 47 } IUnknownImpl; 48 49 /****************************************************************************** 50 * IUnknown_AddRef [VTABLE:IUNKNOWN.1] 51 */ 52 static ULONG WINAPI IUnknown_fnAddRef(LPUNKNOWN iface) { 53 ICOM_THIS(IUnknownImpl,iface); 54 TRACE("(%p)->AddRef()\n",This); 55 return ++(This->ref); 56 } 57 58 /****************************************************************************** 59 * IUnknown_Release [VTABLE:IUNKNOWN.2] 60 */ 61 static ULONG WINAPI IUnknown_fnRelease(LPUNKNOWN iface) { 62 ICOM_THIS(IUnknownImpl,iface); 63 TRACE("(%p)->Release()\n",This); 64 if (!--(This->ref)) { 65 HeapFree(GetProcessHeap(),0,This); 66 return 0; 67 } 68 return This->ref; 69 } 70 71 /****************************************************************************** 72 * IUnknown_QueryInterface [VTABLE:IUNKNOWN.0] 73 */ 74 static HRESULT WINAPI IUnknown_fnQueryInterface(LPUNKNOWN iface,REFIID refiid,LPVOID *obj) { 75 ICOM_THIS(IUnknownImpl,iface); 76 77 TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj); 78 79 if (!memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown))) { 80 *obj = This; 81 return 0; 82 } 83 return OLE_E_ENUM_NOMORE; 84 } 85 86 static ICOM_VTABLE(IUnknown) uvt = 37 #ifdef __WIN32OS2__ 38 #define CRITICAL_SECTION_INIT(name) { (void *)(__FILE__ ": " name), -1, 0, 0, 0, 0 } 39 #endif 40 41 WINE_DEFAULT_DEBUG_CHANNEL(ole); 42 43 /****************************************************************************** 44 * IMalloc32 implementation 45 * 46 * NOTES 47 * For supporting CoRegisterMallocSpy the IMalloc implementation must know if 48 * a given memory block was allocated with a spy active. 49 * 50 *****************************************************************************/ 51 /* set the vtable later */ 52 extern ICOM_VTABLE(IMalloc) VT_IMalloc32; 53 54 typedef struct { 55 ICOM_VFIELD(IMalloc); 56 DWORD dummy; /* nothing, we are static */ 57 IMallocSpy * pSpy; /* the spy when active */ 58 DWORD SpyedAllocationsLeft; /* number of spyed allocations left */ 59 BOOL SpyReleasePending; /* CoRevokeMallocSpy called with spyed allocations left*/ 60 LPVOID * SpyedBlocks; /* root of the table */ 61 int SpyedBlockTableLength; /* size of the table*/ 62 } _Malloc32; 63 64 /* this is the static object instance */ 65 _Malloc32 Malloc32 = {&VT_IMalloc32, 0, NULL, 0, 0, NULL, 0}; 66 67 /* with a spy active all calls from pre to post methods are threadsave */ 68 static CRITICAL_SECTION IMalloc32_SpyCS = CRITICAL_SECTION_INIT("IMalloc32_SpyCS"); 69 70 /* resize the old table */ 71 static int SetSpyedBlockTableLength ( int NewLength ) 72 { 73 Malloc32.SpyedBlocks = (LPVOID*)LocalReAlloc((HLOCAL)Malloc32.SpyedBlocks, NewLength, GMEM_ZEROINIT); 74 Malloc32.SpyedBlockTableLength = NewLength; 75 return Malloc32.SpyedBlocks ? 1 : 0; 76 } 77 78 /* add a location to the table */ 79 static int AddMemoryLocation(LPVOID * pMem) 80 { 81 LPVOID * Current; 82 83 /* allocate the table if not already allocated */ 84 if (!Malloc32.SpyedBlockTableLength) { 85 if (!SetSpyedBlockTableLength(0x1000)) return 0; 86 } 87 88 /* find a free location */ 89 Current = Malloc32.SpyedBlocks; 90 while (*Current) { 91 Current++; 92 if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) { 93 /* no more space in table, grow it */ 94 if (!SetSpyedBlockTableLength( Malloc32.SpyedBlockTableLength + 0x1000 )) return 0; 95 } 96 }; 97 98 /* put the location in our table */ 99 *Current = pMem; 100 Malloc32.SpyedAllocationsLeft++; 101 /*TRACE("%lu\n",Malloc32.SpyedAllocationsLeft);*/ 102 return 1; 103 } 104 105 static int RemoveMemoryLocation(LPVOID * pMem) 106 { 107 LPVOID * Current = Malloc32.SpyedBlocks; 108 109 /* find the location */ 110 while (*Current != pMem) { 111 Current++; 112 if (Current >= Malloc32.SpyedBlocks + Malloc32.SpyedBlockTableLength) return 0; /* not found */ 113 } 114 115 /* location found */ 116 Malloc32.SpyedAllocationsLeft--; 117 /*TRACE("%lu\n",Malloc32.SpyedAllocationsLeft);*/ 118 *Current = NULL; 119 return 1; 120 } 121 122 /****************************************************************************** 123 * IMalloc32_QueryInterface [VTABLE] 124 */ 125 static HRESULT WINAPI IMalloc_fnQueryInterface(LPMALLOC iface,REFIID refiid,LPVOID *obj) { 126 127 TRACE("(%s,%p)\n",debugstr_guid(refiid),obj); 128 129 if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMalloc,refiid)) { 130 *obj = (LPMALLOC)&Malloc32; 131 return S_OK; 132 } 133 return E_NOINTERFACE; 134 } 135 136 /****************************************************************************** 137 * IMalloc32_AddRefRelease [VTABLE] 138 */ 139 static ULONG WINAPI IMalloc_fnAddRefRelease (LPMALLOC iface) { 140 return 1; 141 } 142 143 /****************************************************************************** 144 * IMalloc32_Alloc [VTABLE] 145 */ 146 static LPVOID WINAPI IMalloc_fnAlloc(LPMALLOC iface, DWORD cb) { 147 148 LPVOID addr; 149 150 TRACE("(%ld)\n",cb); 151 152 if(Malloc32.pSpy) { 153 EnterCriticalSection(&IMalloc32_SpyCS); 154 cb = IMallocSpy_PreAlloc(Malloc32.pSpy, cb); 155 if (0==cb) { 156 /* PreAlloc can force Alloc to fail */ 157 LeaveCriticalSection(&IMalloc32_SpyCS); 158 return NULL; 159 } 160 } 161 162 163 addr = HeapAlloc(GetProcessHeap(),0,cb); 164 165 if(Malloc32.pSpy) { 166 addr = IMallocSpy_PostAlloc(Malloc32.pSpy, addr); 167 if (addr) AddMemoryLocation(addr); 168 LeaveCriticalSection(&IMalloc32_SpyCS); 169 } 170 171 TRACE("--(%p)\n",addr); 172 return addr; 173 } 174 175 /****************************************************************************** 176 * IMalloc32_Realloc [VTABLE] 177 */ 178 static LPVOID WINAPI IMalloc_fnRealloc(LPMALLOC iface,LPVOID pv,DWORD cb) { 179 180 LPVOID pNewMemory; 181 182 TRACE("(%p,%ld)\n",pv,cb); 183 184 if(Malloc32.pSpy) { 185 LPVOID pRealMemory; 186 BOOL fSpyed; 187 188 EnterCriticalSection(&IMalloc32_SpyCS); 189 fSpyed = RemoveMemoryLocation(pv); 190 cb = IMallocSpy_PreRealloc(Malloc32.pSpy, pv, cb, &pRealMemory, fSpyed); 191 192 /* check if can release the spy */ 193 if(Malloc32.SpyReleasePending && !Malloc32.SpyedAllocationsLeft) { 194 IMallocSpy_Release(Malloc32.pSpy); 195 Malloc32.SpyReleasePending = FALSE; 196 Malloc32.pSpy = NULL; 197 } 198 199 if (0==cb) { 200 /* PreRealloc can force Realloc to fail */ 201 LeaveCriticalSection(&IMalloc32_SpyCS); 202 return NULL; 203 } 204 pv = pRealMemory; 205 } 206 207 pNewMemory = HeapReAlloc(GetProcessHeap(),0,pv,cb); 208 209 if(Malloc32.pSpy) { 210 pNewMemory = IMallocSpy_PostRealloc(Malloc32.pSpy, pNewMemory, TRUE); 211 if (pNewMemory) AddMemoryLocation(pNewMemory); 212 LeaveCriticalSection(&IMalloc32_SpyCS); 213 } 214 215 TRACE("--(%p)\n",pNewMemory); 216 return pNewMemory; 217 } 218 219 /****************************************************************************** 220 * IMalloc32_Free [VTABLE] 221 */ 222 static VOID WINAPI IMalloc_fnFree(LPMALLOC iface,LPVOID pv) { 223 224 BOOL fSpyed = 0; 225 226 TRACE("(%p)\n",pv); 227 228 if(Malloc32.pSpy) { 229 EnterCriticalSection(&IMalloc32_SpyCS); 230 fSpyed = RemoveMemoryLocation(pv); 231 pv = IMallocSpy_PreFree(Malloc32.pSpy, pv, fSpyed); 232 } 233 234 HeapFree(GetProcessHeap(),0,pv); 235 236 if(Malloc32.pSpy) { 237 IMallocSpy_PostFree(Malloc32.pSpy, fSpyed); 238 239 /* check if can release the spy */ 240 if(Malloc32.SpyReleasePending && !Malloc32.SpyedAllocationsLeft) { 241 IMallocSpy_Release(Malloc32.pSpy); 242 Malloc32.SpyReleasePending = FALSE; 243 Malloc32.pSpy = NULL; 244 } 245 246 LeaveCriticalSection(&IMalloc32_SpyCS); 247 } 248 } 249 250 /****************************************************************************** 251 * IMalloc32_GetSize [VTABLE] 252 * 253 * NOTES 254 * FIXME returns: 255 * win95: size allocated (4 byte boundarys) 256 * win2k: size originally requested !!! (allocated on 8 byte boundarys) 257 */ 258 static DWORD WINAPI IMalloc_fnGetSize(LPMALLOC iface,LPVOID pv) { 259 260 DWORD cb; 261 BOOL fSpyed = 0; 262 263 TRACE("(%p)\n",pv); 264 265 if(Malloc32.pSpy) { 266 EnterCriticalSection(&IMalloc32_SpyCS); 267 pv = IMallocSpy_PreGetSize(Malloc32.pSpy, pv, fSpyed); 268 } 269 270 cb = HeapSize(GetProcessHeap(),0,pv); 271 272 if(Malloc32.pSpy) { 273 cb = IMallocSpy_PostGetSize(Malloc32.pSpy, cb, fSpyed); 274 LeaveCriticalSection(&IMalloc32_SpyCS); 275 } 276 277 return cb; 278 } 279 280 /****************************************************************************** 281 * IMalloc32_DidAlloc [VTABLE] 282 */ 283 static INT WINAPI IMalloc_fnDidAlloc(LPMALLOC iface,LPVOID pv) { 284 285 BOOL fSpyed = 0; 286 int didAlloc; 287 288 TRACE("(%p)\n",pv); 289 290 if(Malloc32.pSpy) { 291 EnterCriticalSection(&IMalloc32_SpyCS); 292 pv = IMallocSpy_PreDidAlloc(Malloc32.pSpy, pv, fSpyed); 293 } 294 295 didAlloc = -1; 296 297 if(Malloc32.pSpy) { 298 didAlloc = IMallocSpy_PostDidAlloc(Malloc32.pSpy, pv, fSpyed, didAlloc); 299 LeaveCriticalSection(&IMalloc32_SpyCS); 300 } 301 return didAlloc; 302 } 303 304 /****************************************************************************** 305 * IMalloc32_HeapMinimize [VTABLE] 306 */ 307 static VOID WINAPI IMalloc_fnHeapMinimize(LPMALLOC iface) { 308 TRACE("()\n"); 309 310 if(Malloc32.pSpy) { 311 EnterCriticalSection(&IMalloc32_SpyCS); 312 IMallocSpy_PreHeapMinimize(Malloc32.pSpy); 313 } 314 315 if(Malloc32.pSpy) { 316 IMallocSpy_PostHeapMinimize(Malloc32.pSpy); 317 LeaveCriticalSection(&IMalloc32_SpyCS); 318 } 319 } 320 321 #ifdef __WIN32OS2__ 322 ICOM_VTABLE(IMalloc) VT_IMalloc32 = 323 #else 324 static ICOM_VTABLE(IMalloc) VT_IMalloc32 = 325 #endif 87 326 { 88 327 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 89 IUnknown_fnQueryInterface, 90 IUnknown_fnAddRef, 91 IUnknown_fnRelease 328 IMalloc_fnQueryInterface, 329 IMalloc_fnAddRefRelease, 330 IMalloc_fnAddRefRelease, 331 IMalloc_fnAlloc, 332 IMalloc_fnRealloc, 333 IMalloc_fnFree, 334 IMalloc_fnGetSize, 335 IMalloc_fnDidAlloc, 336 IMalloc_fnHeapMinimize 92 337 }; 93 338 94 339 /****************************************************************************** 95 * IUnknown_Constructor [INTERNAL] 96 */ 97 LPUNKNOWN 98 IUnknown_Constructor() { 99 IUnknownImpl* unk; 100 101 unk = (IUnknownImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IUnknownImpl)); 102 ICOM_VTBL(unk) = &uvt; 103 unk->ref = 1; 104 return (LPUNKNOWN)unk; 105 } 106 107 #ifndef __WIN32OS2__ 108 /* --- IMalloc16 implementation */ 109 110 111 typedef struct 112 { 113 /* IUnknown fields */ 114 ICOM_VFIELD(IMalloc16); 115 DWORD ref; 116 /* IMalloc16 fields */ 117 } IMalloc16Impl; 118 119 /****************************************************************************** 120 * IMalloc16_QueryInterface [COMPOBJ.500] 121 */ 122 HRESULT WINAPI IMalloc16_fnQueryInterface(IMalloc16* iface,REFIID refiid,LPVOID *obj) { 123 ICOM_THIS(IMalloc16Impl,iface); 124 125 TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj); 126 if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) || 127 !memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc)) 128 ) { 129 *obj = This; 130 return 0; 131 } 132 return OLE_E_ENUM_NOMORE; 133 } 134 135 /****************************************************************************** 136 * IMalloc16_AddRef [COMPOBJ.501] 137 */ 138 ULONG WINAPI IMalloc16_fnAddRef(IMalloc16* iface) { 139 ICOM_THIS(IMalloc16Impl,iface); 140 TRACE("(%p)->AddRef()\n",This); 141 return 1; /* cannot be freed */ 142 } 143 144 /****************************************************************************** 145 * IMalloc16_Release [COMPOBJ.502] 146 */ 147 ULONG WINAPI IMalloc16_fnRelease(IMalloc16* iface) { 148 ICOM_THIS(IMalloc16Impl,iface); 149 TRACE("(%p)->Release()\n",This); 150 return 1; /* cannot be freed */ 151 } 152 153 /****************************************************************************** 154 * IMalloc16_Alloc [COMPOBJ.503] 155 */ 156 SEGPTR WINAPI IMalloc16_fnAlloc(IMalloc16* iface,DWORD cb) { 157 ICOM_THIS(IMalloc16Impl,iface); 158 TRACE("(%p)->Alloc(%ld)\n",This,cb); 159 return MapLS( HeapAlloc( GetProcessHeap(), 0, cb ) ); 160 } 161 162 /****************************************************************************** 163 * IMalloc16_Realloc [COMPOBJ.504] 164 */ 165 SEGPTR WINAPI IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb) 166 { 167 SEGPTR ret; 168 ICOM_THIS(IMalloc16Impl,iface); 169 TRACE("(%p)->Realloc(%08lx,%ld)\n",This,pv,cb); 170 ret = MapLS( HeapReAlloc( GetProcessHeap(), 0, MapSL(pv), cb ) ); 171 UnMapLS(pv); 172 return ret; 173 } 174 175 /****************************************************************************** 176 * IMalloc16_Free [COMPOBJ.505] 177 */ 178 VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv) 179 { 180 void *ptr = MapSL(pv); 181 ICOM_THIS(IMalloc16Impl,iface); 182 TRACE("(%p)->Free(%08lx)\n",This,pv); 183 UnMapLS(pv); 184 HeapFree( GetProcessHeap(), 0, ptr ); 185 } 186 187 /****************************************************************************** 188 * IMalloc16_GetSize [COMPOBJ.506] 189 */ 190 DWORD WINAPI IMalloc16_fnGetSize(const IMalloc16* iface,SEGPTR pv) 191 { 192 ICOM_CTHIS(IMalloc16Impl,iface); 193 TRACE("(%p)->GetSize(%08lx)\n",This,pv); 194 return HeapSize( GetProcessHeap(), 0, MapSL(pv) ); 195 } 196 197 /****************************************************************************** 198 * IMalloc16_DidAlloc [COMPOBJ.507] 199 */ 200 INT16 WINAPI IMalloc16_fnDidAlloc(const IMalloc16* iface,LPVOID pv) { 201 ICOM_CTHIS(IMalloc16,iface); 202 TRACE("(%p)->DidAlloc(%p)\n",This,pv); 203 return (INT16)-1; 204 } 205 206 /****************************************************************************** 207 * IMalloc16_HeapMinimize [COMPOBJ.508] 208 */ 209 LPVOID WINAPI IMalloc16_fnHeapMinimize(IMalloc16* iface) { 210 ICOM_THIS(IMalloc16Impl,iface); 211 TRACE("(%p)->HeapMinimize()\n",This); 212 return NULL; 213 } 214 215 /****************************************************************************** 216 * IMalloc16_Constructor [VTABLE] 217 */ 218 LPMALLOC16 219 IMalloc16_Constructor() 220 { 221 static ICOM_VTABLE(IMalloc16) vt16; 222 static SEGPTR msegvt16; 223 IMalloc16Impl* This; 224 HMODULE16 hcomp = GetModuleHandle16("COMPOBJ"); 225 226 This = HeapAlloc( GetProcessHeap(), 0, sizeof(IMalloc16Impl) ); 227 if (!msegvt16) 228 { 229 #define VTENT(x) vt16.x = (void*)GetProcAddress16(hcomp,"IMalloc16_"#x);assert(vt16.x) 230 VTENT(QueryInterface); 231 VTENT(AddRef); 232 VTENT(Release); 233 VTENT(Alloc); 234 VTENT(Realloc); 235 VTENT(Free); 236 VTENT(GetSize); 237 VTENT(DidAlloc); 238 VTENT(HeapMinimize); 239 #undef VTENT 240 msegvt16 = MapLS( &vt16 ); 340 * IMallocSpy implementation 341 *****************************************************************************/ 342 343 /* set the vtable later */ 344 extern ICOM_VTABLE(IMallocSpy) VT_IMallocSpy; 345 346 typedef struct { 347 ICOM_VFIELD(IMallocSpy); 348 DWORD ref; 349 } _MallocSpy; 350 351 /* this is the static object instance */ 352 _MallocSpy MallocSpy = {&VT_IMallocSpy, 0}; 353 354 /****************************************************************************** 355 * IMalloc32_QueryInterface [VTABLE] 356 */ 357 static HRESULT WINAPI IMallocSpy_fnQueryInterface(LPMALLOCSPY iface,REFIID refiid,LPVOID *obj) 358 { 359 360 TRACE("(%s,%p)\n",debugstr_guid(refiid),obj); 361 362 if (IsEqualIID(&IID_IUnknown,refiid) || IsEqualIID(&IID_IMallocSpy,refiid)) { 363 *obj = (LPMALLOC)&MallocSpy; 364 return S_OK; 365 } 366 return E_NOINTERFACE; 367 } 368 369 /****************************************************************************** 370 * IMalloc32_AddRef [VTABLE] 371 */ 372 static ULONG WINAPI IMallocSpy_fnAddRef (LPMALLOCSPY iface) 373 { 374 375 ICOM_THIS (_MallocSpy, iface); 376 377 TRACE ("(%p)->(count=%lu)\n", This, This->ref); 378 379 return ++(This->ref); 380 } 381 382 /****************************************************************************** 383 * IMalloc32_AddRelease [VTABLE] 384 * 385 * NOTES 386 * Our MallocSpy is static. If the count reaches 0 we dump the leaks 387 */ 388 static ULONG WINAPI IMallocSpy_fnRelease (LPMALLOCSPY iface) 389 { 390 391 ICOM_THIS (_MallocSpy, iface); 392 393 TRACE ("(%p)->(count=%lu)\n", This, This->ref); 394 395 if (!--(This->ref)) { 396 /* our allocation list MUST be empty here */ 241 397 } 242 ICOM_VTBL(This) = (ICOM_VTABLE(IMalloc16)*)msegvt16; 243 This->ref = 1; 244 return (LPMALLOC16)MapLS( This ); 245 } 398 return This->ref; 399 } 400 401 static ULONG WINAPI IMallocSpy_fnPreAlloc(LPMALLOCSPY iface, ULONG cbRequest) 402 { 403 ICOM_THIS (_MallocSpy, iface); 404 TRACE ("(%p)->(%lu)\n", This, cbRequest); 405 return cbRequest; 406 } 407 static PVOID WINAPI IMallocSpy_fnPostAlloc(LPMALLOCSPY iface, void* pActual) 408 { 409 ICOM_THIS (_MallocSpy, iface); 410 TRACE ("(%p)->(%p)\n", This, pActual); 411 return pActual; 412 } 413 414 static PVOID WINAPI IMallocSpy_fnPreFree(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed) 415 { 416 ICOM_THIS (_MallocSpy, iface); 417 TRACE ("(%p)->(%p %u)\n", This, pRequest, fSpyed); 418 return pRequest; 419 } 420 static void WINAPI IMallocSpy_fnPostFree(LPMALLOCSPY iface, BOOL fSpyed) 421 { 422 ICOM_THIS (_MallocSpy, iface); 423 TRACE ("(%p)->(%u)\n", This, fSpyed); 424 } 425 426 static ULONG WINAPI IMallocSpy_fnPreRealloc(LPMALLOCSPY iface, void* pRequest, ULONG cbRequest, void** ppNewRequest, BOOL fSpyed) 427 { 428 ICOM_THIS (_MallocSpy, iface); 429 TRACE ("(%p)->(%p %lu %u)\n", This, pRequest, cbRequest, fSpyed); 430 *ppNewRequest = pRequest; 431 return cbRequest; 432 } 433 434 static PVOID WINAPI IMallocSpy_fnPostRealloc(LPMALLOCSPY iface, void* pActual, BOOL fSpyed) 435 { 436 ICOM_THIS (_MallocSpy, iface); 437 TRACE ("(%p)->(%p %u)\n", This, pActual, fSpyed); 438 return pActual; 439 } 440 441 static PVOID WINAPI IMallocSpy_fnPreGetSize(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed) 442 { 443 ICOM_THIS (_MallocSpy, iface); 444 TRACE ("(%p)->(%p %u)\n", This, pRequest, fSpyed); 445 return pRequest; 446 } 447 448 static ULONG WINAPI IMallocSpy_fnPostGetSize(LPMALLOCSPY iface, ULONG cbActual, BOOL fSpyed) 449 { 450 ICOM_THIS (_MallocSpy, iface); 451 TRACE ("(%p)->(%lu %u)\n", This, cbActual, fSpyed); 452 return cbActual; 453 } 454 455 static PVOID WINAPI IMallocSpy_fnPreDidAlloc(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed) 456 { 457 ICOM_THIS (_MallocSpy, iface); 458 TRACE ("(%p)->(%p %u)\n", This, pRequest, fSpyed); 459 return pRequest; 460 } 461 462 static int WINAPI IMallocSpy_fnPostDidAlloc(LPMALLOCSPY iface, void* pRequest, BOOL fSpyed, int fActual) 463 { 464 ICOM_THIS (_MallocSpy, iface); 465 TRACE ("(%p)->(%p %u %u)\n", This, pRequest, fSpyed, fActual); 466 return fActual; 467 } 468 469 static int WINAPI IMallocSpy_fnPreHeapMinimize(LPMALLOCSPY iface) 470 { 471 ICOM_THIS (_MallocSpy, iface); 472 TRACE ("(%p)->()\n", This); 473 return 0; 474 } 475 476 static int WINAPI IMallocSpy_fnPostHeapMinimize(LPMALLOCSPY iface) 477 { 478 ICOM_THIS (_MallocSpy, iface); 479 TRACE ("(%p)->()\n", This); 480 return 0; 481 } 482 483 static void MallocSpyDumpLeaks() { 484 TRACE("leaks: %lu\n", Malloc32.SpyedAllocationsLeft); 485 } 486 487 #ifdef __WIN32OS2__ 488 ICOM_VTABLE(IMallocSpy) VT_IMallocSpy = 489 #else 490 static ICOM_VTABLE(IMallocSpy) VT_IMallocSpy = 246 491 #endif 247 248 /* --- IMalloc32 implementation */ 249 250 typedef struct 251 { 252 /* IUnknown fields */ 253 ICOM_VFIELD(IMalloc); 254 DWORD ref; 255 } IMalloc32Impl; 256 257 /****************************************************************************** 258 * IMalloc32_QueryInterface [VTABLE] 259 */ 260 static HRESULT WINAPI IMalloc_fnQueryInterface(LPMALLOC iface,REFIID refiid,LPVOID *obj) { 261 ICOM_THIS(IMalloc32Impl,iface); 262 263 TRACE("(%p)->QueryInterface(%s,%p)\n",This,debugstr_guid(refiid),obj); 264 if ( !memcmp(&IID_IUnknown,refiid,sizeof(IID_IUnknown)) || 265 !memcmp(&IID_IMalloc,refiid,sizeof(IID_IMalloc)) 266 ) { 267 *obj = This; 268 return S_OK; 269 } 270 return OLE_E_ENUM_NOMORE; 271 } 272 273 /****************************************************************************** 274 * IMalloc32_AddRef [VTABLE] 275 */ 276 static ULONG WINAPI IMalloc_fnAddRef(LPMALLOC iface) { 277 ICOM_THIS(IMalloc32Impl,iface); 278 TRACE("(%p)->AddRef()\n",This); 279 return 1; /* cannot be freed */ 280 } 281 282 /****************************************************************************** 283 * IMalloc32_Release [VTABLE] 284 */ 285 static ULONG WINAPI IMalloc_fnRelease(LPMALLOC iface) { 286 ICOM_THIS(IMalloc32Impl,iface); 287 TRACE("(%p)->Release()\n",This); 288 return 1; /* cannot be freed */ 289 } 290 291 /****************************************************************************** 292 * IMalloc32_Alloc [VTABLE] 293 */ 294 static LPVOID WINAPI IMalloc_fnAlloc(LPMALLOC iface,DWORD cb) { 295 LPVOID addr; 296 ICOM_THIS(IMalloc32Impl,iface); 297 addr = HeapAlloc(GetProcessHeap(),0,cb); 298 TRACE("(%p)->Alloc(%ld) -> %p\n",This,cb,addr); 299 return addr; 300 } 301 302 /****************************************************************************** 303 * IMalloc32_Realloc [VTABLE] 304 */ 305 static LPVOID WINAPI IMalloc_fnRealloc(LPMALLOC iface,LPVOID pv,DWORD cb) { 306 ICOM_THIS(IMalloc32Impl,iface); 307 TRACE("(%p)->Realloc(%p,%ld)\n",This,pv,cb); 308 return HeapReAlloc(GetProcessHeap(),0,pv,cb); 309 } 310 311 /****************************************************************************** 312 * IMalloc32_Free [VTABLE] 313 */ 314 static VOID WINAPI IMalloc_fnFree(LPMALLOC iface,LPVOID pv) { 315 ICOM_THIS(IMalloc32Impl,iface); 316 TRACE("(%p)->Free(%p)\n",This,pv); 317 HeapFree(GetProcessHeap(),0,pv); 318 } 319 320 /****************************************************************************** 321 * IMalloc32_GetSize [VTABLE] 322 */ 323 static DWORD WINAPI IMalloc_fnGetSize(LPMALLOC iface,LPVOID pv) { 324 ICOM_CTHIS(IMalloc,iface); 325 TRACE("(%p)->GetSize(%p)\n",This,pv); 326 return HeapSize(GetProcessHeap(),0,pv); 327 } 328 329 /****************************************************************************** 330 * IMalloc32_DidAlloc [VTABLE] 331 */ 332 static INT WINAPI IMalloc_fnDidAlloc(LPMALLOC iface,LPVOID pv) { 333 ICOM_CTHIS(IMalloc32Impl,iface); 334 TRACE("(%p)->DidAlloc(%p)\n",This,pv); 335 return -1; 336 } 337 338 /****************************************************************************** 339 * IMalloc32_HeapMinimize [VTABLE] 340 */ 341 static VOID WINAPI IMalloc_fnHeapMinimize(LPMALLOC iface) { 342 ICOM_THIS(IMalloc32Impl,iface); 343 TRACE("(%p)->HeapMinimize()\n",This); 344 } 345 346 static ICOM_VTABLE(IMalloc) VT_IMalloc32 = 347 { 348 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 349 IMalloc_fnQueryInterface, 350 IMalloc_fnAddRef, 351 IMalloc_fnRelease, 352 IMalloc_fnAlloc, 353 IMalloc_fnRealloc, 354 IMalloc_fnFree, 355 IMalloc_fnGetSize, 356 IMalloc_fnDidAlloc, 357 IMalloc_fnHeapMinimize 492 { 493 ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE 494 IMallocSpy_fnQueryInterface, 495 IMallocSpy_fnAddRef, 496 IMallocSpy_fnRelease, 497 IMallocSpy_fnPreAlloc, 498 IMallocSpy_fnPostAlloc, 499 IMallocSpy_fnPreFree, 500 IMallocSpy_fnPostFree, 501 IMallocSpy_fnPreRealloc, 502 IMallocSpy_fnPostRealloc, 503 IMallocSpy_fnPreGetSize, 504 IMallocSpy_fnPostGetSize, 505 IMallocSpy_fnPreDidAlloc, 506 IMallocSpy_fnPostDidAlloc, 507 IMallocSpy_fnPreHeapMinimize, 508 IMallocSpy_fnPostHeapMinimize 358 509 }; 359 510 360 511 /****************************************************************************** 361 * IMalloc32_Constructor [VTABLE] 362 */ 363 LPMALLOC 364 IMalloc_Constructor() { 365 IMalloc32Impl* This; 366 367 This = (IMalloc32Impl*)HeapAlloc(GetProcessHeap(),0,sizeof(IMalloc32Impl)); 368 ICOM_VTBL(This) = &VT_IMalloc32; 369 This->ref = 1; 370 return (LPMALLOC)This; 371 } 372 373 /**************************************************************************** 374 * API Functions 375 */ 512 * CoGetMalloc [OLE32.20] 513 * 514 * RETURNS 515 * The win32 IMalloc 516 */ 517 HRESULT WINAPI CoGetMalloc(DWORD dwMemContext, LPMALLOC *lpMalloc) 518 { 519 *lpMalloc = (LPMALLOC)&Malloc32; 520 return S_OK; 521 } 522 523 /*********************************************************************** 524 * CoTaskMemAlloc [OLE32.43] 525 * RETURNS 526 * pointer to newly allocated block 527 */ 528 LPVOID WINAPI CoTaskMemAlloc(ULONG size) 529 { 530 return IMalloc_Alloc((LPMALLOC)&Malloc32,size); 531 } 532 /*********************************************************************** 533 * CoTaskMemFree [OLE32.44] 534 */ 535 VOID WINAPI CoTaskMemFree(LPVOID ptr) 536 { 537 IMalloc_Free((LPMALLOC)&Malloc32, ptr); 538 } 539 540 /*********************************************************************** 541 * CoTaskMemRealloc [OLE32.45] 542 * RETURNS 543 * pointer to newly allocated block 544 */ 545 LPVOID WINAPI CoTaskMemRealloc(LPVOID pvOld, ULONG size) 546 { 547 return IMalloc_Realloc((LPMALLOC)&Malloc32, pvOld, size); 548 } 549 550 /*********************************************************************** 551 * CoRegisterMallocSpy [OLE32.37] 552 * 553 * NOTES 554 * if a mallocspy is already registered, we cant do it again since 555 * only the spy knows, how to free a memory block 556 */ 557 HRESULT WINAPI CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy) 558 { 559 IMallocSpy* pSpy; 560 HRESULT hres = E_INVALIDARG; 561 562 TRACE("\n"); 563 564 /* HACK TO ACTIVATE OUT SPY */ 565 if (pMallocSpy == (LPVOID)-1) pMallocSpy =(IMallocSpy*)&MallocSpy; 566 567 if(Malloc32.pSpy) return CO_E_OBJISREG; 568 569 EnterCriticalSection(&IMalloc32_SpyCS); 570 571 if (SUCCEEDED(IUnknown_QueryInterface(pMallocSpy, &IID_IMallocSpy, (LPVOID*)&pSpy))) { 572 Malloc32.pSpy = pSpy; 573 hres = S_OK; 574 } 575 576 LeaveCriticalSection(&IMalloc32_SpyCS); 577 578 return hres; 579 } 580 581 /*********************************************************************** 582 * CoRevokeMallocSpy [OLE32.41] 583 * 584 * NOTES 585 * we can't rewoke a malloc spy as long as memory blocks allocated with 586 * the spy are active since only the spy knows how to free them 587 */ 588 HRESULT WINAPI CoRevokeMallocSpy(void) 589 { 590 HRESULT hres = S_OK; 591 TRACE("\n"); 592 593 EnterCriticalSection(&IMalloc32_SpyCS); 594 595 /* if it's our spy it's time to dump the leaks */ 596 if (Malloc32.pSpy == (IMallocSpy*)&MallocSpy) { 597 MallocSpyDumpLeaks(); 598 } 599 600 if (Malloc32.SpyedAllocationsLeft) { 601 TRACE("SpyReleasePending with %lu allocations left\n", Malloc32.SpyedAllocationsLeft); 602 Malloc32.SpyReleasePending = TRUE; 603 hres = E_ACCESSDENIED; 604 } else { 605 IMallocSpy_Release(Malloc32.pSpy); 606 Malloc32.pSpy = NULL; 607 } 608 LeaveCriticalSection(&IMalloc32_SpyCS); 609 610 return S_OK; 611 } 376 612 377 613 /****************************************************************************** -
trunk/src/ole32/itemmoniker.c
r8620 r9400 388 388 if (!This->itemName) 389 389 return E_OUTOFMEMORY; 390 strcpyW(This->itemName,lpszItem);390 lstrcpyW(This->itemName,lpszItem); 391 391 392 392 if (!lpszDelim) … … 395 395 delim = lpszDelim ? lpszDelim : emptystr; 396 396 397 sizeStr2= strlenW(delim);397 sizeStr2=lstrlenW(delim); 398 398 This->itemDelimiter=HeapAlloc(GetProcessHeap(),0,sizeof(WCHAR)*(sizeStr2+1)); 399 399 if (!This->itemDelimiter) { … … 401 401 return E_OUTOFMEMORY; 402 402 } 403 strcpyW(This->itemDelimiter,delim);403 lstrcpyW(This->itemDelimiter,delim); 404 404 return S_OK; 405 405 } … … 612 612 LPOLESTR dispName1,dispName2; 613 613 IBindCtx* bind; 614 HRESULT res ;614 HRESULT res = S_FALSE; 615 615 616 616 TRACE("(%p,%p)\n",iface,pmkOtherMoniker); 617 617 618 if (pmkOtherMoniker==NULL) 619 return S_FALSE; 620 621 /* This method returns S_OK if both monikers are item monikers and their display names are */ 622 /* identical (using a case-insensitive comparison); otherwise, the method returns S_FALSE. */ 623 624 IMoniker_GetClassID(pmkOtherMoniker,&clsid); 625 626 if (!IsEqualCLSID(&clsid,&CLSID_ItemMoniker)) 627 return S_FALSE; 628 629 res=CreateBindCtx(0,&bind); 630 if (FAILED(res)) 631 return res; 632 633 IMoniker_GetDisplayName(iface,bind,NULL,&dispName1); 634 IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2); 635 636 if (lstrcmpW(dispName1,dispName2)!=0) 637 return S_FALSE; 638 639 return S_OK; 618 if (!pmkOtherMoniker) return S_FALSE; 619 620 621 /* check if both are ItemMoniker */ 622 if(FAILED (IMoniker_GetClassID(pmkOtherMoniker,&clsid))) return S_FALSE; 623 if(!IsEqualCLSID(&clsid,&CLSID_ItemMoniker)) return S_FALSE; 624 625 /* check if both displaynames are the same */ 626 if(SUCCEEDED ((res = CreateBindCtx(0,&bind)))) { 627 if(SUCCEEDED (IMoniker_GetDisplayName(iface,bind,NULL,&dispName1))) { 628 if(SUCCEEDED (IMoniker_GetDisplayName(pmkOtherMoniker,bind,NULL,&dispName2))) { 629 if(lstrcmpW(dispName1,dispName2)==0) res = S_OK; 630 CoTaskMemFree(dispName2); 631 } 632 CoTaskMemFree(dispName1); 633 } 634 } 635 return res; 640 636 } 641 637 … … 843 839 return E_OUTOFMEMORY; 844 840 845 strcpyW(*ppszDisplayName,This->itemDelimiter);846 strcatW(*ppszDisplayName,This->itemName);841 lstrcpyW(*ppszDisplayName,This->itemDelimiter); 842 lstrcatW(*ppszDisplayName,This->itemName); 847 843 848 844 return S_OK; -
trunk/src/ole32/marshal.c
r8620 r9400 317 317 } 318 318 hres = PIPE_GetNewPipeBuf(&mid,&chanbuf); 319 if (hres) 320 FIXME("Failed to get an rpc channel buffer for %s\n",debugstr_guid(riid)); 321 IRpcProxyBuffer_Connect(rpcproxy,chanbuf); 322 IRpcProxyBuffer_Release(rpcproxy); /* no need */ 319 if (hres) { 320 ERR("Failed to get an rpc channel buffer for %s\n",debugstr_guid(riid)); 321 } else { 322 IRpcProxyBuffer_Connect(rpcproxy,chanbuf); 323 IRpcProxyBuffer_Release(rpcproxy); /* no need */ 324 } 323 325 IPSFactoryBuffer_Release(psfacbuf); 324 return S_OK;326 return hres; 325 327 } 326 328 … … 483 485 MESSAGE(" Wine registry by running: `regedit winedefault.reg'\n\n"); 484 486 } else { 485 FIXME("Failed to Marshal the interface, %lx?\n",hres); 487 if (IsEqualGUID(riid,&IID_IOleObject)) { 488 ERR("WINE currently cannot marshal IOleObject interfaces. This means you cannot embed/link OLE objects between applications.\n"); 489 } else { 490 FIXME("Failed to marshal the interface %s, %lx?\n",debugstr_guid(riid),hres); 491 } 486 492 } 487 493 goto release_marshal; -
trunk/src/ole32/ole2stubs.c
r8620 r9400 98 98 FIXME("\n\t%s\n\t%s stub!\n", debugstr_guid(rclsid), debugstr_guid(riid)); 99 99 100 if (SUCCEEDED((hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER , riid, (LPVOID*)&pUnk))))100 if (SUCCEEDED((hres = CoCreateInstance(rclsid, 0, CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER|CLSCTX_LOCAL_SERVER , riid, (LPVOID*)&pUnk)))) 101 101 { 102 102 if (pClientSite) -
trunk/src/ole32/ole32.def
r8553 r9400 168 168 WriteStringStream = _WriteStringStream@0 @162 169 169 CoInitializeEx = _CoInitializeEx@8 @163 170 ;164 stub CoInitializeSecurity # stdcall (ptr long ptr ptr long long ptr long ptr) return 0,ERR_NOTIMPLEMENTED 170 CoInitializeSecurity = _CoInitializeSecurity@36 @164 171 171 CoCreateInstanceEx = _CoCreateInstanceEx@24 @165 172 172 PropVariantClear = _PropVariantClear@4 @166 -
trunk/src/ole32/ole32.mak
r8445 r9400 1 # $Id: ole32.mak,v 1.2 0 2002-05-16 19:26:29sandervl Exp $1 # $Id: ole32.mak,v 1.21 2002-11-12 17:06:02 sandervl Exp $ 2 2 3 3 # … … 39 39 $(OBJDIR)\bindctx.obj \ 40 40 $(OBJDIR)\compositemoniker.obj \ 41 $(OBJDIR)\compobj.obj \ 41 42 $(OBJDIR)\datacache.obj \ 42 43 $(OBJDIR)\defaulthandler.obj \ 43 44 $(OBJDIR)\errorinfo.obj \ 44 45 $(OBJDIR)\filemoniker.obj \ 46 $(OBJDIR)\ftmarshal.obj \ 45 47 $(OBJDIR)\hglobalstream.obj \ 46 48 $(OBJDIR)\initialise.obj \ … … 52 54 $(OBJDIR)\ole2.obj \ 53 55 $(OBJDIR)\oleobj.obj \ 54 $(OBJDIR)\compobj.obj \55 56 $(OBJDIR)\clipboard.obj \ 56 57 $(OBJDIR)\ole2stubs.obj \ -
trunk/src/ole32/ole32dbg.def
r8553 r9400 169 169 170 170 CoInitializeEx = _DbgCoInitializeEx@8 @163 171 ;164 stub CoInitializeSecurity # stdcall (ptr long ptr ptr long long ptr long ptr) return 0,ERR_NOTIMPLEMENTED 171 CoInitializeSecurity = _DbgCoInitializeSecurity@36 @164 172 172 CoCreateInstanceEx = _DbgCoCreateInstanceEx@24 @165 173 173 PropVariantClear = _DbgPropVariantClear@4 @166 -
trunk/src/ole32/stg_stream.c
r8636 r9400 30 30 #include "winbase.h" 31 31 #include "winerror.h" 32 #include " ntddk.h"32 #include "winternl.h" 33 33 #include "wine/debug.h" 34 34 … … 565 565 plibNewPosition->QuadPart = RtlLargeIntegerAdd( plibNewPosition->QuadPart, dlibMove.QuadPart ); 566 566 #endif 567 568 567 /* 569 568 * tell the caller what we calculated -
trunk/src/ole32/storage32.c
r8620 r9400 2321 2321 * Create the block chain abstractions. 2322 2322 */ 2323 This->rootBlockChain = 2324 BlockChainStream_Construct(This, &This->rootStartBlock, PROPERTY_NULL); 2325 2326 This->smallBlockDepotChain = BlockChainStream_Construct( 2327 This, 2328 &This->smallBlockDepotStart, 2329 PROPERTY_NULL); 2323 if(!(This->rootBlockChain = 2324 BlockChainStream_Construct(This, &This->rootStartBlock, PROPERTY_NULL))) 2325 return STG_E_READFAULT; 2326 2327 if(!(This->smallBlockDepotChain = 2328 BlockChainStream_Construct(This, &This->smallBlockDepotStart, 2329 PROPERTY_NULL))) 2330 return STG_E_READFAULT; 2330 2331 2331 2332 /* … … 2381 2382 { 2382 2383 /* TODO CLEANUP */ 2383 return E_FAIL;2384 return STG_E_READFAULT; 2384 2385 } 2385 2386 … … 2387 2388 * Create the block chain abstraction for the small block root chain. 2388 2389 */ 2389 This->smallBlockRootChain = BlockChainStream_Construct( 2390 This, 2391 NULL, 2392 This->rootPropertySetIndex); 2390 if(!(This->smallBlockRootChain = 2391 BlockChainStream_Construct(This, NULL, This->rootPropertySetIndex))) 2392 return STG_E_READFAULT; 2393 2393 2394 2394 return hr; … … 2731 2731 * blockIndex - Index of the block to retrieve the chain 2732 2732 * for. 2733 * nextBlockIndex - receives the return value. 2733 2734 * 2734 2735 * Returns: This method returns the index of the next block in the chain. … … 2745 2746 * See Windows documentation for more details on IStorage methods. 2746 2747 */ 2747 ULONGStorageImpl_GetNextBlockInChain(2748 HRESULT StorageImpl_GetNextBlockInChain( 2748 2749 StorageImpl* This, 2749 ULONG blockIndex) 2750 ULONG blockIndex, 2751 ULONG* nextBlockIndex) 2750 2752 { 2751 2753 ULONG offsetInDepot = blockIndex * sizeof (ULONG); 2752 2754 ULONG depotBlockCount = offsetInDepot / This->bigBlockSize; 2753 2755 ULONG depotBlockOffset = offsetInDepot % This->bigBlockSize; 2754 ULONG nextBlockIndex = BLOCK_SPECIAL;2755 2756 void* depotBuffer; 2756 2757 ULONG depotBlockIndexPos; 2757 2758 assert(depotBlockCount < This->bigBlockDepotCount); 2758 int index; 2759 2760 *nextBlockIndex = BLOCK_SPECIAL; 2761 2762 if(depotBlockCount >= This->bigBlockDepotCount) 2763 { 2764 WARN("depotBlockCount %ld, bigBlockDepotCount %ld\n", depotBlockCount, 2765 This->bigBlockDepotCount); 2766 return STG_E_READFAULT; 2767 } 2759 2768 2760 2769 /* … … 2779 2788 depotBuffer = StorageImpl_GetROBigBlock(This, depotBlockIndexPos); 2780 2789 2781 if (depotBuffer!=0) 2782 { 2783 int index; 2784 2785 for (index = 0; index < NUM_BLOCKS_PER_DEPOT_BLOCK; index++) 2786 { 2787 StorageUtl_ReadDWord(depotBuffer, index*sizeof(ULONG), &nextBlockIndex); 2788 This->blockDepotCached[index] = nextBlockIndex; 2789 } 2790 2791 StorageImpl_ReleaseBigBlock(This, depotBuffer); 2792 } 2793 } 2794 2795 nextBlockIndex = This->blockDepotCached[depotBlockOffset/sizeof(ULONG)]; 2796 2797 return nextBlockIndex; 2790 if (!depotBuffer) 2791 return STG_E_READFAULT; 2792 2793 for (index = 0; index < NUM_BLOCKS_PER_DEPOT_BLOCK; index++) 2794 { 2795 StorageUtl_ReadDWord(depotBuffer, index*sizeof(ULONG), nextBlockIndex); 2796 This->blockDepotCached[index] = *nextBlockIndex; 2797 } 2798 StorageImpl_ReleaseBigBlock(This, depotBuffer); 2799 } 2800 2801 *nextBlockIndex = This->blockDepotCached[depotBlockOffset/sizeof(ULONG)]; 2802 2803 return S_OK; 2798 2804 } 2799 2805 … … 3044 3050 StorageUtl_WriteWord(headerBigBlock, 0x1c, (WORD)-2); 3045 3051 StorageUtl_WriteDWord(headerBigBlock, 0x38, (DWORD)0x1000); 3046 StorageUtl_WriteDWord(headerBigBlock, 0x40, (DWORD)0x0001);3047 3052 } 3048 3053 … … 3050 3055 * Write the information to the header. 3051 3056 */ 3052 if (headerBigBlock!=0) 3053 { 3054 StorageUtl_WriteWord( 3055 headerBigBlock, 3056 OFFSET_BIGBLOCKSIZEBITS, 3057 This->bigBlockSizeBits); 3058 3059 StorageUtl_WriteWord( 3060 headerBigBlock, 3061 OFFSET_SMALLBLOCKSIZEBITS, 3062 This->smallBlockSizeBits); 3063 3057 StorageUtl_WriteWord( 3058 headerBigBlock, 3059 OFFSET_BIGBLOCKSIZEBITS, 3060 This->bigBlockSizeBits); 3061 3062 StorageUtl_WriteWord( 3063 headerBigBlock, 3064 OFFSET_SMALLBLOCKSIZEBITS, 3065 This->smallBlockSizeBits); 3066 3067 StorageUtl_WriteDWord( 3068 headerBigBlock, 3069 OFFSET_BBDEPOTCOUNT, 3070 This->bigBlockDepotCount); 3071 3072 StorageUtl_WriteDWord( 3073 headerBigBlock, 3074 OFFSET_ROOTSTARTBLOCK, 3075 This->rootStartBlock); 3076 3077 StorageUtl_WriteDWord( 3078 headerBigBlock, 3079 OFFSET_SBDEPOTSTART, 3080 This->smallBlockDepotStart); 3081 3082 StorageUtl_WriteDWord( 3083 headerBigBlock, 3084 OFFSET_SBDEPOTCOUNT, 3085 This->smallBlockDepotChain ? 3086 BlockChainStream_GetCount(This->smallBlockDepotChain) : 0); 3087 3088 StorageUtl_WriteDWord( 3089 headerBigBlock, 3090 OFFSET_EXTBBDEPOTSTART, 3091 This->extBigBlockDepotStart); 3092 3093 StorageUtl_WriteDWord( 3094 headerBigBlock, 3095 OFFSET_EXTBBDEPOTCOUNT, 3096 This->extBigBlockDepotCount); 3097 3098 for (index = 0; index < COUNT_BBDEPOTINHEADER; index ++) 3099 { 3064 3100 StorageUtl_WriteDWord( 3065 3101 headerBigBlock, 3066 OFFSET_BBDEPOTCOUNT, 3067 This->bigBlockDepotCount); 3068 3069 StorageUtl_WriteDWord( 3070 headerBigBlock, 3071 OFFSET_ROOTSTARTBLOCK, 3072 This->rootStartBlock); 3073 3074 StorageUtl_WriteDWord( 3075 headerBigBlock, 3076 OFFSET_SBDEPOTSTART, 3077 This->smallBlockDepotStart); 3078 3079 StorageUtl_WriteDWord( 3080 headerBigBlock, 3081 OFFSET_EXTBBDEPOTSTART, 3082 This->extBigBlockDepotStart); 3083 3084 StorageUtl_WriteDWord( 3085 headerBigBlock, 3086 OFFSET_EXTBBDEPOTCOUNT, 3087 This->extBigBlockDepotCount); 3088 3089 for (index = 0; index < COUNT_BBDEPOTINHEADER; index ++) 3090 { 3091 StorageUtl_WriteDWord( 3092 headerBigBlock, 3093 OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index), 3094 (This->bigBlockDepotStart[index])); 3095 } 3102 OFFSET_BBDEPOTSTART + (sizeof(ULONG)*index), 3103 (This->bigBlockDepotStart[index])); 3096 3104 } 3097 3105 … … 3382 3390 &bbHeadOfChain, 3383 3391 PROPERTY_NULL); 3384 3392 if(!bbTempChain) return NULL; 3385 3393 /* 3386 3394 * Grow the big block chain. … … 4163 4171 newStream->tailIndex = blockIndex; 4164 4172 4165 blockIndex = StorageImpl_GetNextBlockInChain( 4166 parentStorage, 4167 blockIndex); 4173 if(FAILED(StorageImpl_GetNextBlockInChain( 4174 parentStorage, 4175 blockIndex, 4176 &blockIndex))) 4177 { 4178 HeapFree(GetProcessHeap(), 0, newStream); 4179 return NULL; 4180 } 4168 4181 } 4169 4182 … … 4226 4239 count++; 4227 4240 4228 blockIndex =StorageImpl_GetNextBlockInChain(4241 if(FAILED(StorageImpl_GetNextBlockInChain( 4229 4242 This->parentStorage, 4230 blockIndex); 4243 blockIndex, 4244 &blockIndex))) 4245 return 0; 4231 4246 } 4232 4247 … … 4275 4290 while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) 4276 4291 { 4277 blockIndex = 4278 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4279 4292 if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, &blockIndex))) 4293 return FALSE; 4280 4294 blockNoInSequence--; 4281 4295 } … … 4310 4324 * Step to the next big block. 4311 4325 */ 4312 blockIndex =4313 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex);4326 if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, &blockIndex))) 4327 return FALSE; 4314 4328 4315 4329 bufferWalker += bytesToReadInBuffer; … … 4364 4378 while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) 4365 4379 { 4366 blockIndex =4367 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4368 4380 if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, 4381 &blockIndex))) 4382 return FALSE; 4369 4383 blockNoInSequence--; 4370 4384 } … … 4399 4413 * Step to the next big block. 4400 4414 */ 4401 blockIndex =4402 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4403 4415 if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, 4416 &blockIndex))) 4417 return FALSE; 4404 4418 bufferWalker += bytesToWrite; 4405 4419 size -= bytesToWrite; … … 4444 4458 while (count < numBlocks) 4445 4459 { 4446 blockIndex =4447 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4448 4460 if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, 4461 &blockIndex))) 4462 return FALSE; 4449 4463 count++; 4450 4464 } 4451 4465 4452 4466 /* Get the next block before marking the new end */ 4453 extraBlock = 4454 StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex); 4467 if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, blockIndex, 4468 &extraBlock))) 4469 return FALSE; 4455 4470 4456 4471 /* Mark the new end of chain */ … … 4468 4483 while (extraBlock != BLOCK_END_OF_CHAIN) 4469 4484 { 4470 blockIndex =4471 StorageImpl_GetNextBlockInChain(This->parentStorage, extraBlock); 4472 4485 if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, extraBlock, 4486 &blockIndex))) 4487 return FALSE; 4473 4488 StorageImpl_FreeBigBlock(This->parentStorage, extraBlock); 4474 4489 extraBlock = blockIndex; … … 4548 4563 currentBlock = blockIndex; 4549 4564 4550 blockIndex = 4551 StorageImpl_GetNextBlockInChain(This->parentStorage, currentBlock); 4565 if(FAILED(StorageImpl_GetNextBlockInChain(This->parentStorage, currentBlock, 4566 &blockIndex))) 4567 return FALSE; 4552 4568 } 4553 4569 … … 4736 4752 * - BLOCK_UNUSED: small block 'blockIndex' is free 4737 4753 */ 4738 ULONGSmallBlockChainStream_GetNextBlockInChain(4754 HRESULT SmallBlockChainStream_GetNextBlockInChain( 4739 4755 SmallBlockChainStream* This, 4740 ULONG blockIndex) 4756 ULONG blockIndex, 4757 ULONG* nextBlockInChain) 4741 4758 { 4742 4759 ULARGE_INTEGER offsetOfBlockInDepot; 4743 4760 DWORD buffer; 4744 ULONG nextBlockInChain = BLOCK_END_OF_CHAIN;4745 4761 ULONG bytesRead; 4746 4762 BOOL success; 4763 4764 *nextBlockInChain = BLOCK_END_OF_CHAIN; 4747 4765 4748 4766 offsetOfBlockInDepot.s.HighPart = 0; … … 4761 4779 if (success) 4762 4780 { 4763 StorageUtl_ReadDWord(&buffer, 0, &nextBlockInChain); 4764 } 4765 4766 return nextBlockInChain; 4781 StorageUtl_ReadDWord(&buffer, 0, nextBlockInChain); 4782 return S_OK; 4783 } 4784 4785 return STG_E_READFAULT; 4767 4786 } 4768 4787 … … 4869 4888 { 4870 4889 sbdIndex = nextBlock; 4871 nextBlock = 4872 StorageImpl_GetNextBlockInChain(This->parentStorage, sbdIndex); 4890 StorageImpl_GetNextBlockInChain(This->parentStorage, sbdIndex, &nextBlock); 4873 4891 } 4874 4892 … … 5007 5025 while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) 5008 5026 { 5009 blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); 5010 5027 if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, 5028 &blockIndex))) 5029 return FALSE; 5011 5030 blockNoInSequence--; 5012 5031 } … … 5049 5068 * Step to the next big block. 5050 5069 */ 5051 blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); 5070 if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, &blockIndex))) 5071 return FALSE; 5052 5072 bufferWalker += bytesToReadInBuffer; 5053 5073 size -= bytesToReadInBuffer; … … 5095 5115 while ( (blockNoInSequence > 0) && (blockIndex != BLOCK_END_OF_CHAIN)) 5096 5116 { 5097 blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex);5098 5117 if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, &blockIndex))) 5118 return FALSE; 5099 5119 blockNoInSequence--; 5100 5120 } … … 5139 5159 * Step to the next big block. 5140 5160 */ 5141 blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); 5161 if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, 5162 &blockIndex))) 5163 return FALSE; 5142 5164 bufferWalker += bytesToWriteInBuffer; 5143 5165 size -= bytesToWriteInBuffer; … … 5174 5196 while (count < numBlocks) 5175 5197 { 5176 blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); 5198 if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, 5199 &blockIndex))) 5200 return FALSE; 5177 5201 count++; 5178 5202 } … … 5204 5228 { 5205 5229 /* Get the next block before marking the new end */ 5206 extraBlock = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); 5230 if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, 5231 &extraBlock))) 5232 return FALSE; 5207 5233 5208 5234 /* Mark the new end of chain */ … … 5218 5244 while (extraBlock != BLOCK_END_OF_CHAIN) 5219 5245 { 5220 blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, extraBlock); 5246 if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, extraBlock, 5247 &blockIndex))) 5248 return FALSE; 5221 5249 SmallBlockChainStream_FreeBlock(This, extraBlock); 5222 5250 extraBlock = blockIndex; … … 5281 5309 oldNumBlocks++; 5282 5310 currentBlock = blockIndex; 5283 blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, currentBlock); 5311 if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, currentBlock, &blockIndex))) 5312 return FALSE; 5284 5313 } 5285 5314 … … 5321 5350 count++; 5322 5351 5323 blockIndex = SmallBlockChainStream_GetNextBlockInChain(This, blockIndex); 5352 if(FAILED(SmallBlockChainStream_GetNextBlockInChain(This, blockIndex, &blockIndex))) 5353 return 0; 5324 5354 } 5325 5355 … … 5744 5774 newStorage, 5745 5775 0, 5746 0,5776 0, 5747 5777 plkbyt, 5748 5778 grfMode, -
trunk/src/ole32/storage32.h
r8441 r9400 7 7 * 8 8 * This include file contains definitions of types and function 9 * prototypes that are used in the many files implementing the 9 * prototypes that are used in the many files implementing the 10 10 * storage functionality 11 11 * … … 43 43 static const ULONG OFFSET_ROOTSTARTBLOCK = 0x00000030; 44 44 static const ULONG OFFSET_SBDEPOTSTART = 0x0000003C; 45 static const ULONG OFFSET_SBDEPOTCOUNT = 0x00000040; 45 46 static const ULONG OFFSET_EXTBBDEPOTSTART = 0x00000044; 46 47 static const ULONG OFFSET_EXTBBDEPOTCOUNT = 0x00000048; … … 50 51 static const ULONG OFFSET_PS_PROPERTYTYPE = 0x00000042; 51 52 static const ULONG OFFSET_PS_PREVIOUSPROP = 0x00000044; 52 static const ULONG OFFSET_PS_NEXTPROP = 0x00000048; 53 static const ULONG OFFSET_PS_NEXTPROP = 0x00000048; 53 54 static const ULONG OFFSET_PS_DIRPROP = 0x0000004C; 54 55 static const ULONG OFFSET_PS_GUID = 0x00000050; … … 57 58 static const ULONG OFFSET_PS_TSS2 = 0x0000006C; 58 59 static const ULONG OFFSET_PS_TSD2 = 0x00000070; 59 static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074; 60 static const ULONG OFFSET_PS_SIZE = 0x00000078; 60 static const ULONG OFFSET_PS_STARTBLOCK = 0x00000074; 61 static const ULONG OFFSET_PS_SIZE = 0x00000078; 61 62 static const WORD DEF_BIG_BLOCK_SIZE_BITS = 0x0009; 62 63 static const WORD DEF_SMALL_BLOCK_SIZE_BITS = 0x0006; … … 70 71 71 72 #define PROPERTY_NAME_MAX_LEN 0x20 72 #define PROPERTY_NAME_BUFFER_LEN 0x40 73 #define PROPERTY_NAME_BUFFER_LEN 0x40 73 74 74 75 #define PROPSET_BLOCK_SIZE 0x00000080 … … 142 143 * 143 144 * The big block file is an abstraction of a flat file separated in 144 * same sized blocks. The implementation for the methods described in 145 * same sized blocks. The implementation for the methods described in 145 146 * this section appear in stg_bigblockfile.c 146 147 */ … … 209 210 */ 210 211 ULONG ref; 211 212 /* 213 * Ancestor storage (top level) 214 */ 215 StorageImpl* ancestorStorage; 216 212 213 /* 214 * Ancestor storage (top level) 215 */ 216 StorageImpl* ancestorStorage; 217 217 218 /* 218 219 * Index of the property for the root of … … 220 221 */ 221 222 ULONG rootPropertySetIndex; 222 223 /* 223 224 /* 224 225 * virtual Destructor method. 225 226 */ … … 235 236 REFIID riid, 236 237 void** ppvObject); 237 238 ULONG WINAPI StorageBaseImpl_AddRef( 238 239 ULONG WINAPI StorageBaseImpl_AddRef( 239 240 IStorage* iface); 240 241 ULONG WINAPI StorageBaseImpl_Release( 241 242 ULONG WINAPI StorageBaseImpl_Release( 242 243 IStorage* iface); 243 244 HRESULT WINAPI StorageBaseImpl_OpenStream( 244 245 HRESULT WINAPI StorageBaseImpl_OpenStream( 245 246 IStorage* iface, 246 247 const OLECHAR* pwcsName, /* [string][in] */ 247 248 void* reserved1, /* [unique][in] */ 248 DWORD grfMode, /* [in] */ 249 DWORD reserved2, /* [in] */ 250 IStream** ppstm); /* [out] */ 251 252 HRESULT WINAPI StorageBaseImpl_OpenStorage( 249 DWORD grfMode, /* [in] */ 250 DWORD reserved2, /* [in] */ 251 IStream** ppstm); /* [out] */ 252 253 HRESULT WINAPI StorageBaseImpl_OpenStorage( 253 254 IStorage* iface, 254 const OLECHAR* pwcsName, /* [string][unique][in] */ 255 IStorage* pstgPriority, /* [unique][in] */ 256 DWORD grfMode, /* [in] */ 257 SNB snbExclude, /* [unique][in] */ 258 DWORD reserved, /* [in] */ 259 IStorage** ppstg); /* [out] */ 260 261 HRESULT WINAPI StorageBaseImpl_EnumElements( 255 const OLECHAR* pwcsName, /* [string][unique][in] */ 256 IStorage* pstgPriority, /* [unique][in] */ 257 DWORD grfMode, /* [in] */ 258 SNB snbExclude, /* [unique][in] */ 259 DWORD reserved, /* [in] */ 260 IStorage** ppstg); /* [out] */ 261 262 HRESULT WINAPI StorageBaseImpl_EnumElements( 262 263 IStorage* iface, 263 DWORD reserved1, /* [in] */ 264 void* reserved2, /* [size_is][unique][in] */ 265 DWORD reserved3, /* [in] */ 266 IEnumSTATSTG** ppenum); /* [out] */ 267 268 HRESULT WINAPI StorageBaseImpl_Stat( 264 DWORD reserved1, /* [in] */ 265 void* reserved2, /* [size_is][unique][in] */ 266 DWORD reserved3, /* [in] */ 267 IEnumSTATSTG** ppenum); /* [out] */ 268 269 HRESULT WINAPI StorageBaseImpl_Stat( 269 270 IStorage* iface, 270 STATSTG* pstatstg, /* [out] */ 271 DWORD grfStatFlag); /* [in] */ 271 STATSTG* pstatstg, /* [out] */ 272 DWORD grfStatFlag); /* [in] */ 272 273 273 274 HRESULT WINAPI StorageBaseImpl_RenameElement( … … 304 305 */ 305 306 ULONG ref; 306 struct StorageImpl* ancestorStorage; 307 struct StorageImpl* ancestorStorage; 307 308 ULONG rootPropertySetIndex; 308 309 void (*v_destructor)(struct StorageImpl*); 309 310 310 311 /* 311 312 * The following data members are specific to the Storage32Impl … … 341 342 BlockChainStream* rootBlockChain; 342 343 BlockChainStream* smallBlockDepotChain; 343 BlockChainStream* smallBlockRootChain; 344 BlockChainStream* smallBlockRootChain; 344 345 345 346 /* 346 347 * Pointer to the big block file abstraction 347 348 */ 348 BigBlockFile* bigBlockFile; 349 BigBlockFile* bigBlockFile; 349 350 }; 350 351 351 352 /* 352 353 * Method declaration for the Storage32Impl class 353 */ 354 355 HRESULT WINAPI StorageImpl_CreateStorage( 354 */ 355 356 HRESULT WINAPI StorageImpl_CreateStorage( 356 357 IStorage* iface, 357 const OLECHAR* pwcsName, /* [string][in] */ 358 DWORD grfMode, /* [in] */ 359 DWORD dwStgFmt, /* [in] */ 360 DWORD reserved2, /* [in] */ 361 IStorage** ppstg); /* [out] */ 362 363 HRESULT WINAPI StorageImpl_CopyTo( 358 const OLECHAR* pwcsName, /* [string][in] */ 359 DWORD grfMode, /* [in] */ 360 DWORD dwStgFmt, /* [in] */ 361 DWORD reserved2, /* [in] */ 362 IStorage** ppstg); /* [out] */ 363 364 HRESULT WINAPI StorageImpl_CopyTo( 364 365 IStorage* iface, 365 DWORD ciidExclude, /* [in] */ 366 const IID* rgiidExclude, /* [size_is][unique][in] */ 367 SNB snbExclude, /* [unique][in] */ 368 IStorage* pstgDest); /* [unique][in] */ 369 370 HRESULT WINAPI StorageImpl_MoveElementTo( 366 DWORD ciidExclude, /* [in] */ 367 const IID* rgiidExclude, /* [size_is][unique][in] */ 368 SNB snbExclude, /* [unique][in] */ 369 IStorage* pstgDest); /* [unique][in] */ 370 371 HRESULT WINAPI StorageImpl_MoveElementTo( 371 372 IStorage* iface, 372 const OLECHAR* pwcsName, /* [string][in] */ 373 IStorage* pstgDest, /* [unique][in] */ 374 const OLECHAR* pwcsNewName, /* [string][in] */ 375 DWORD grfFlags); /* [in] */ 376 377 HRESULT WINAPI StorageImpl_Commit( 373 const OLECHAR* pwcsName, /* [string][in] */ 374 IStorage* pstgDest, /* [unique][in] */ 375 const OLECHAR* pwcsNewName, /* [string][in] */ 376 DWORD grfFlags); /* [in] */ 377 378 HRESULT WINAPI StorageImpl_Commit( 378 379 IStorage* iface, 379 DWORD grfCommitFlags); /* [in] */ 380 381 HRESULT WINAPI StorageImpl_Revert( 380 DWORD grfCommitFlags); /* [in] */ 381 382 HRESULT WINAPI StorageImpl_Revert( 382 383 IStorage* iface); 383 384 HRESULT WINAPI StorageImpl_DestroyElement( 384 385 HRESULT WINAPI StorageImpl_DestroyElement( 385 386 IStorage* iface, 386 const OLECHAR* pwcsName); /* [string][in] */ 387 388 HRESULT WINAPI StorageImpl_SetElementTimes( 387 const OLECHAR* pwcsName); /* [string][in] */ 388 389 HRESULT WINAPI StorageImpl_SetElementTimes( 389 390 IStorage* iface, 390 const OLECHAR* pwcsName, /* [string][in] */ 391 const FILETIME* pctime, /* [in] */ 392 const FILETIME* patime, /* [in] */ 393 const FILETIME* pmtime); /* [in] */ 394 395 HRESULT WINAPI StorageImpl_SetStateBits( 391 const OLECHAR* pwcsName, /* [string][in] */ 392 const FILETIME* pctime, /* [in] */ 393 const FILETIME* patime, /* [in] */ 394 const FILETIME* pmtime); /* [in] */ 395 396 HRESULT WINAPI StorageImpl_SetStateBits( 396 397 IStorage* iface, 397 DWORD grfStateBits, /* [in] */ 398 DWORD grfMask); /* [in] */ 398 DWORD grfStateBits, /* [in] */ 399 DWORD grfMask); /* [in] */ 399 400 400 401 HRESULT WINAPI StorageImpl_Stat(IStorage* iface, … … 443 444 ULONG blockIndex); 444 445 445 ULONG StorageImpl_GetNextBlockInChain( 446 StorageImpl* This, 447 ULONG blockIndex); 446 HRESULT StorageImpl_GetNextBlockInChain( 447 StorageImpl* This, 448 ULONG blockIndex, 449 ULONG* nextBlockIndex); 448 450 449 451 void StorageImpl_SetNextBlockInChain( 450 452 StorageImpl* This, 451 453 ULONG blockIndex, 452 ULONG nextBlock);454 ULONG nextBlock); 453 455 454 456 HRESULT StorageImpl_LoadFileHeader( … … 503 505 */ 504 506 ULONG ref; 505 struct StorageImpl* ancestorStorage; 507 struct StorageImpl* ancestorStorage; 506 508 ULONG rootPropertySetIndex; 507 509 void (*v_destructor)(struct StorageInternalImpl*); … … 516 518 */ 517 519 StorageInternalImpl* StorageInternalImpl_Construct( 518 StorageImpl* ancestorStorage, 520 StorageImpl* ancestorStorage, 519 521 ULONG rootTropertyIndex); 520 522 … … 522 524 StorageInternalImpl* This); 523 525 524 HRESULT WINAPI StorageInternalImpl_Commit( 526 HRESULT WINAPI StorageInternalImpl_Commit( 525 527 IStorage* iface, 526 DWORD grfCommitFlags); /* [in] */ 527 528 HRESULT WINAPI StorageInternalImpl_Revert( 528 DWORD grfCommitFlags); /* [in] */ 529 530 HRESULT WINAPI StorageInternalImpl_Revert( 529 531 IStorage* iface); 530 532 … … 541 543 ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the struct 542 544 * since we want to cast this in a IEnumSTATSTG pointer */ 543 545 544 546 ULONG ref; /* Reference count */ 545 547 StorageImpl* parentStorage; /* Reference to the parent storage */ … … 565 567 REFIID riid, 566 568 void** ppvObject); 567 569 568 570 ULONG WINAPI IEnumSTATSTGImpl_AddRef( 569 IEnumSTATSTG* iface); 570 571 IEnumSTATSTG* iface); 572 571 573 ULONG WINAPI IEnumSTATSTGImpl_Release( 572 574 IEnumSTATSTG* iface); 573 575 574 576 HRESULT WINAPI IEnumSTATSTGImpl_Next( 575 577 IEnumSTATSTG* iface, … … 577 579 STATSTG* rgelt, 578 580 ULONG* pceltFetched); 579 581 580 582 HRESULT WINAPI IEnumSTATSTGImpl_Skip( 581 583 IEnumSTATSTG* iface, 582 584 ULONG celt); 583 585 584 586 HRESULT WINAPI IEnumSTATSTGImpl_Reset( 585 587 IEnumSTATSTG* iface); 586 588 587 589 HRESULT WINAPI IEnumSTATSTGImpl_Clone( 588 590 IEnumSTATSTG* iface, … … 626 628 ICOM_VFIELD(IStream); /* Needs to be the first item in the struct 627 629 * since we want to cast this in a IStream pointer */ 628 630 629 631 /* 630 632 * Reference count … … 656 658 */ 657 659 ULARGE_INTEGER currentPosition; 658 660 659 661 /* 660 662 * The information in the stream is represented by a chain of small blocks … … 682 684 HRESULT WINAPI StgStreamImpl_QueryInterface( 683 685 IStream* iface, 684 REFIID riid, /* [in] */ 685 void** ppvObject); /* [iid_is][out] */ 686 686 REFIID riid, /* [in] */ 687 void** ppvObject); /* [iid_is][out] */ 688 687 689 ULONG WINAPI StgStreamImpl_AddRef( 688 690 IStream* iface); 689 691 690 692 ULONG WINAPI StgStreamImpl_Release( 691 693 IStream* iface); 692 693 HRESULT WINAPI StgStreamImpl_Read( 694 695 HRESULT WINAPI StgStreamImpl_Read( 694 696 IStream* iface, 695 697 void* pv, /* [length_is][size_is][out] */ 696 ULONG cb, /* [in] */ 697 ULONG* pcbRead); /* [out] */ 698 698 ULONG cb, /* [in] */ 699 ULONG* pcbRead); /* [out] */ 700 699 701 HRESULT WINAPI StgStreamImpl_Write( 700 702 IStream* iface, 701 const void* pv, /* [size_is][in] */ 702 ULONG cb, /* [in] */ 703 ULONG* pcbWritten); /* [out] */ 704 705 HRESULT WINAPI StgStreamImpl_Seek( 703 const void* pv, /* [size_is][in] */ 704 ULONG cb, /* [in] */ 705 ULONG* pcbWritten); /* [out] */ 706 707 HRESULT WINAPI StgStreamImpl_Seek( 706 708 IStream* iface, 707 LARGE_INTEGER dlibMove, /* [in] */ 708 DWORD dwOrigin, /* [in] */ 709 LARGE_INTEGER dlibMove, /* [in] */ 710 DWORD dwOrigin, /* [in] */ 709 711 ULARGE_INTEGER* plibNewPosition); /* [out] */ 710 711 HRESULT WINAPI StgStreamImpl_SetSize( 712 713 HRESULT WINAPI StgStreamImpl_SetSize( 712 714 IStream* iface, 713 ULARGE_INTEGER libNewSize); /* [in] */ 714 715 HRESULT WINAPI StgStreamImpl_CopyTo( 715 ULARGE_INTEGER libNewSize); /* [in] */ 716 717 HRESULT WINAPI StgStreamImpl_CopyTo( 716 718 IStream* iface, 717 IStream* pstm, /* [unique][in] */ 718 ULARGE_INTEGER cb, /* [in] */ 719 ULARGE_INTEGER* pcbRead, /* [out] */ 720 ULARGE_INTEGER* pcbWritten); /* [out] */ 721 722 HRESULT WINAPI StgStreamImpl_Commit( 719 IStream* pstm, /* [unique][in] */ 720 ULARGE_INTEGER cb, /* [in] */ 721 ULARGE_INTEGER* pcbRead, /* [out] */ 722 ULARGE_INTEGER* pcbWritten); /* [out] */ 723 724 HRESULT WINAPI StgStreamImpl_Commit( 723 725 IStream* iface, 724 DWORD grfCommitFlags); /* [in] */ 725 726 HRESULT WINAPI StgStreamImpl_Revert( 726 DWORD grfCommitFlags); /* [in] */ 727 728 HRESULT WINAPI StgStreamImpl_Revert( 727 729 IStream* iface); 728 729 HRESULT WINAPI StgStreamImpl_LockRegion( 730 731 HRESULT WINAPI StgStreamImpl_LockRegion( 730 732 IStream* iface, 731 ULARGE_INTEGER libOffset, /* [in] */ 732 ULARGE_INTEGER cb, /* [in] */ 733 DWORD dwLockType); /* [in] */ 734 735 HRESULT WINAPI StgStreamImpl_UnlockRegion( 733 ULARGE_INTEGER libOffset, /* [in] */ 734 ULARGE_INTEGER cb, /* [in] */ 735 DWORD dwLockType); /* [in] */ 736 737 HRESULT WINAPI StgStreamImpl_UnlockRegion( 736 738 IStream* iface, 737 ULARGE_INTEGER libOffset, /* [in] */ 738 ULARGE_INTEGER cb, /* [in] */ 739 DWORD dwLockType); /* [in] */ 740 741 HRESULT WINAPI StgStreamImpl_Stat( 739 ULARGE_INTEGER libOffset, /* [in] */ 740 ULARGE_INTEGER cb, /* [in] */ 741 DWORD dwLockType); /* [in] */ 742 743 HRESULT WINAPI StgStreamImpl_Stat( 742 744 IStream* iface, 743 745 STATSTG* pstatstg, /* [out] */ 744 DWORD grfStatFlag); /* [in] */ 745 746 HRESULT WINAPI StgStreamImpl_Clone( 746 DWORD grfStatFlag); /* [in] */ 747 748 HRESULT WINAPI StgStreamImpl_Clone( 747 749 IStream* iface, 748 IStream** ppstm); /* [out] */ 750 IStream** ppstm); /* [out] */ 749 751 750 752 751 753 /******************************************************************************** 752 754 * The StorageUtl_ functions are miscelaneous utility functions. Most of which are 753 * abstractions used to read values from file buffers without having to worry 755 * abstractions used to read values from file buffers without having to worry 754 756 * about bit order 755 757 */ … … 785 787 */ 786 788 BlockChainStream* BlockChainStream_Construct( 787 StorageImpl* parentStorage, 789 StorageImpl* parentStorage, 788 790 ULONG* headOfStreamPlaceHolder, 789 791 ULONG propertyIndex); … … 835 837 */ 836 838 SmallBlockChainStream* SmallBlockChainStream_Construct( 837 StorageImpl* parentStorage, 839 StorageImpl* parentStorage, 838 840 ULONG propertyIndex); 839 841 … … 844 846 SmallBlockChainStream* This); 845 847 846 ULONGSmallBlockChainStream_GetNextBlockInChain(848 HRESULT SmallBlockChainStream_GetNextBlockInChain( 847 849 SmallBlockChainStream* This, 848 ULONG blockIndex); 850 ULONG blockIndex, 851 ULONG* nextBlockIndex); 849 852 850 853 void SmallBlockChainStream_SetNextBlockInChain( … … 886 889 887 890 #endif /* __STORAGE32_H__ */ 888 889 890 -
trunk/src/ole32/stubs.cpp
r7958 r9400 1 /* $Id: stubs.cpp,v 1.2 1 2002-02-19 12:34:50sandervl Exp $ */1 /* $Id: stubs.cpp,v 1.22 2002-11-12 17:06:03 sandervl Exp $ */ 2 2 /* 3 3 * Win32 COM/OLE stubs for OS/2 … … 80 80 //******************************************************************************* 81 81 //******************************************************************************* 82 HRESULT WIN32API CoRegisterMallocSpy(LPMALLOCSPY pMallocSpy)83 {84 dprintf(("OLE32: CoRegisterMallocSpy - stub"));85 return CO_E_OBJISREG;86 }87 //*******************************************************************************88 //*******************************************************************************89 82 HRESULT WIN32API CoReleaseMarshalData(IStream *pStm) 90 83 { 91 84 dprintf(("OLE32: CoReleaseMarshalData - stub")); 92 85 return E_OUTOFMEMORY; 93 }94 //*******************************************************************************95 //*******************************************************************************96 HRESULT WIN32API CoRevokeMallocSpy()97 {98 dprintf(("OLE32: CoRevokeMallocSpy - stub"));99 return E_ACCESSDENIED;100 86 } 101 87 //******************************************************************************* … … 337 323 { 338 324 dprintf(("OLE32: CoImpersonateClient - Stub")); 339 return(S_OK);340 }341 342 //*******************************************************************************343 //*******************************************************************************344 HRESULT WIN32API CoInitializeSecurity( // DCOM - obj_clientserver.h345 PSECURITY_DESCRIPTOR pSecDesc,346 LONG cAuthSvc,347 SOLE_AUTHENTICATION_SERVICE *asAuthSvc,348 void *pReserved1,349 DWORD dwAuthnLevel,350 DWORD dwImpLevel,351 void *pReserved2,352 DWORD dwCapabilities,353 void *pReserved3 )354 {355 dprintf(("OLE32: CoInitializeSecurity - Stub"));356 325 return(S_OK); 357 326 }
Note:
See TracChangeset
for help on using the changeset viewer.
