- Timestamp:
- Feb 15, 2002, 6:18:52 PM (24 years ago)
- Location:
- trunk/src/ole32
- Files:
-
- 3 added
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/ole32/antimoniker.c
r7508 r7926 4 4 * Copyright 1999 Noomen Hamza 5 5 ***************************************************************************************/ 6 6 7 #include <assert.h> 7 8 #include <string.h> … … 14 15 #include "wine/obj_moniker.h" 15 16 #include "debugtools.h" 16 17 17 18 18 DEFAULT_DEBUG_CHANNEL(ole); … … 620 620 621 621 /****************************************************************************** 622 * CreateAntiMoniker [OLE .55]622 * CreateAntiMoniker [OLE32.51] 623 623 ******************************************************************************/ 624 624 HRESULT WINAPI CreateAntiMoniker(LPMONIKER * ppmk) -
trunk/src/ole32/bindctx.c
r7508 r7926 15 15 #include "wine/obj_moniker.h" 16 16 #include "debugtools.h" 17 #include "heap.h"18 19 17 20 18 DEFAULT_DEBUG_CHANNEL(ole); … … 239 237 FIXME("This->bindCtxTableSize: %ld is out of data limite \n",This->bindCtxTableSize); 240 238 return E_FAIL; 241 }239 } 242 240 243 241 This->bindCtxTableSize+=BLOCK_TAB_SIZE; /* new table size */ … … 311 309 if (pbindopts->cbStruct > sizeof(BIND_OPTS2)) 312 310 { 313 WARN("invalid size ");311 WARN("invalid size\n"); 314 312 return E_INVALIDARG; /* FIXME : not verified */ 315 313 } … … 332 330 if (pbindopts->cbStruct > sizeof(BIND_OPTS2)) 333 331 { 334 WARN("invalid size ");332 WARN("invalid size\n"); 335 333 return E_INVALIDARG; /* FIXME : not verified */ 336 334 } … … 387 385 return E_OUTOFMEMORY; 388 386 strcpyW(This->bindCtxTable[This->bindCtxTableLastIndex].pkeyObj,pszkey); 389 }387 } 390 388 391 389 This->bindCtxTableLastIndex++; … … 521 519 522 520 /****************************************************************************** 523 * CreateBindCtx 521 * CreateBindCtx (OLE32.52) 524 522 ******************************************************************************/ 525 523 HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC * ppbc) -
trunk/src/ole32/compobj.c
r7508 r7926 6 6 * Copyright 1999 Francis Beaudet 7 7 * Copyright 1999 Sylvain St-Germain 8 * Copyright 2002 Marcus Meissner 8 9 */ 9 10 … … 14 15 #include <string.h> 15 16 #include <assert.h> 17 16 18 #include "windef.h" 19 #include "objbase.h" 20 #include "ole2.h" 21 #include "ole2ver.h" 22 #include "rpc.h" 23 #include "winerror.h" 24 #include "winreg.h" 25 #include "wownt32.h" 17 26 #include "wtypes.h" 18 #include "wingdi.h" 27 #include "wine/unicode.h" 28 #include "wine/obj_base.h" 29 #include "wine/obj_clientserver.h" 30 #include "wine/obj_misc.h" 31 #include "wine/obj_marshal.h" 32 #include "wine/obj_storage.h" 33 #include "wine/obj_channel.h" 19 34 #include "wine/winbase16.h" 20 #include " winerror.h"21 #include " wownt32.h"22 #include "ole2ver.h" 35 #include "compobj_private.h" 36 #include "ifs.h" 37 23 38 #include "debugtools.h" 24 #include "heap.h"25 #include "winreg.h"26 #include "rpc.h"27 28 #include "wine/obj_base.h"29 #include "wine/obj_misc.h"30 #include "wine/obj_storage.h"31 #include "wine/obj_clientserver.h"32 33 #include "ole.h"34 #include "ifs.h"35 #include "compobj_private.h"36 37 #ifdef __WIN32OS2__38 #include <heapstring.h>39 #endif40 39 41 40 DEFAULT_DEBUG_CHANNEL(ole); … … 44 43 * COM External Lock structures and methods declaration 45 44 * 46 * This api provides a linked list to managed external references to 47 * COM objects. 48 * 49 * The public interface consists of three calls: 45 * This api provides a linked list to managed external references to 46 * COM objects. 47 * 48 * The public interface consists of three calls: 50 49 * COM_ExternalLockAddRef 51 50 * COM_ExternalLockRelease … … 57 56 58 57 /* 59 * Declaration of the static structure that manage the 58 * Declaration of the static structure that manage the 60 59 * external lock to COM objects. 61 60 */ … … 82 81 83 82 /* 84 * Public Interface to the external lock list 83 * Public Interface to the external lock list 85 84 */ 86 85 static void COM_ExternalLockFreeList(); … … 90 89 91 90 /* 92 * Private methods used to managed the linked list 91 * Private methods used to managed the linked list 93 92 */ 94 93 static BOOL COM_ExternalLockInsert( … … 125 124 * libraries are freed 126 125 */ 127 static ULONG s_COMLockCount = 0;126 static LONG s_COMLockCount = 0; 128 127 129 128 /* … … 142 141 DWORD connectFlags; 143 142 DWORD dwCookie; 143 HANDLE hThread; /* only for localserver */ 144 144 struct tagRegisteredClass* nextClass; 145 145 } RegisteredClass; 146 146 147 static CRITICAL_SECTION csRegisteredClassList; 147 148 static RegisteredClass* firstRegisteredClass = NULL; 148 149 … … 152 153 */ 153 154 typedef struct tagOpenDll { 154 HINSTANCE hLibrary; 155 HINSTANCE hLibrary; 155 156 struct tagOpenDll *next; 156 157 } OpenDll; 157 158 159 static CRITICAL_SECTION csOpenDllList; 158 160 static OpenDll *openDllList = NULL; /* linked list of open dlls */ 159 161 … … 170 172 171 173 /****************************************************************************** 174 * Initialize/Uninitialize critical sections. 175 */ 176 void COMPOBJ_InitProcess( void ) 177 { 178 InitializeCriticalSection( &csRegisteredClassList ); 179 InitializeCriticalSection( &csOpenDllList ); 180 } 181 182 void COMPOBJ_UninitProcess( void ) 183 { 184 DeleteCriticalSection( &csRegisteredClassList ); 185 DeleteCriticalSection( &csOpenDllList ); 186 } 187 188 /****************************************************************************** 172 189 * CoBuildVersion [COMPOBJ.1] 190 * CoBuildVersion [OLE32.4] 173 191 * 174 192 * RETURNS … … 181 199 } 182 200 183 #ifndef __WIN32OS2__ 184 /****************************************************************************** 185 * CoInitialize16 [COMPOBJ.2] 201 /****************************************************************************** 202 * CoInitialize [COMPOBJ.2] 186 203 * Set the win16 IMalloc used for memory management 187 204 */ … … 192 209 return S_OK; 193 210 } 194 #endif195 211 196 212 /****************************************************************************** … … 204 220 LPVOID lpReserved /* [in] pointer to win32 malloc interface 205 221 (obsolete, should be NULL) */ 206 ) 222 ) 207 223 { 208 224 /* … … 225 241 * 226 242 * BUGS 227 * Only the single threaded model is supported. As a result RPC_E_CHANGED_MODE 243 * Only the single threaded model is supported. As a result RPC_E_CHANGED_MODE 228 244 * is never returned. 229 245 * … … 234 250 (obsolete, should be NULL) */ 235 251 DWORD dwCoInit /* [in] A value from COINIT specifies the threading model */ 236 ) 252 ) 237 253 { 238 254 HRESULT hr; … … 248 264 * Check for unsupported features. 249 265 */ 250 if (dwCoInit!=COINIT_APARTMENTTHREADED) 266 if (dwCoInit!=COINIT_APARTMENTTHREADED) 251 267 { 252 268 FIXME(":(%p,%x): unsupported flag %x\n", lpReserved, (int)dwCoInit, (int)dwCoInit); … … 257 273 * Check the lock count. If this is the first time going through the initialize 258 274 * process, we have to initialize the libraries. 275 * 276 * And crank-up that lock count. 259 277 */ 260 if ( s_COMLockCount==0)278 if (InterlockedExchangeAdd(&s_COMLockCount,1)==0) 261 279 { 262 280 /* … … 265 283 TRACE("() - Initializing the COM libraries\n"); 266 284 285 267 286 RunningObjectTableImpl_Initialize(); 268 287 … … 272 291 hr = S_FALSE; 273 292 274 /*275 * Crank-up that lock count.276 */277 s_COMLockCount++;278 279 293 return hr; 280 294 } 281 295 282 #ifndef __WIN32OS2__ 283 /*********************************************************************** 284 * CoUninitialize16 [COMPOBJ.3] 285 * Don't know what it does. 296 /*********************************************************************** 297 * CoUninitialize [COMPOBJ.3] 298 * Don't know what it does. 286 299 * 3-Nov-98 -- this was originally misspelled, I changed it to what I 287 300 * believe is the correct spelling … … 292 305 CoFreeAllLibraries(); 293 306 } 294 #endif295 307 296 308 /*********************************************************************** … … 303 315 void WINAPI CoUninitialize(void) 304 316 { 317 LONG lCOMRefCnt; 305 318 TRACE("()\n"); 306 319 307 320 /* 308 321 * Decrease the reference count. 309 */310 s_COMLockCount--;311 312 /*313 322 * If we are back to 0 locks on the COM library, make sure we free 314 323 * all the associated data structures. 315 324 */ 316 if (s_COMLockCount==0) 325 lCOMRefCnt = InterlockedExchangeAdd(&s_COMLockCount,-1); 326 if (lCOMRefCnt==1) 317 327 { 318 328 /* … … 336 346 */ 337 347 COM_ExternalLockFreeList(); 338 } 348 349 } 350 else if (lCOMRefCnt<1) { 351 ERR( "CoUninitialize() - not CoInitialized.\n" ); 352 InterlockedExchangeAdd(&s_COMLockCount,1); /* restore the lock count. */ 353 } 339 354 } 340 355 341 356 #ifndef __WIN32OS2__ 342 357 /*********************************************************************** 343 * CoGetMalloc 16[COMPOBJ.4]358 * CoGetMalloc [COMPOBJ.4] 344 359 * RETURNS 345 360 * The current win16 IMalloc … … 355 370 } 356 371 #endif 357 358 372 /****************************************************************************** 359 373 * CoGetMalloc [OLE32.20] … … 374 388 #ifndef __WIN32OS2__ 375 389 /*********************************************************************** 376 * CoCreateStandardMalloc 16[COMPOBJ.71]390 * CoCreateStandardMalloc [COMPOBJ.71] 377 391 */ 378 392 HRESULT WINAPI CoCreateStandardMalloc16(DWORD dwMemContext, … … 384 398 return S_OK; 385 399 } 400 #endif 386 401 387 402 /****************************************************************************** 388 403 * CoDisconnectObject [COMPOBJ.15] 404 * CoDisconnectObject [OLE32.8] 389 405 */ 390 406 HRESULT WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved ) … … 395 411 396 412 /*********************************************************************** 397 * IsEqualGUID 16[COMPOBJ.18]413 * IsEqualGUID [COMPOBJ.18] 398 414 * 399 415 * Compares two Unique Identifiers. … … 408 424 return !memcmp( g1, g2, sizeof(GUID) ); 409 425 } 410 #endif 411 412 /****************************************************************************** 413 * CLSIDFromString16 [COMPOBJ.20] 414 * Converts a unique identifier from its string representation into 426 427 /****************************************************************************** 428 * CLSIDFromString [COMPOBJ.20] 429 * Converts a unique identifier from its string representation into 415 430 * the GUID struct. 416 431 * 417 * Class id: DWORD-WORD-WORD-BYTES[2]-BYTES[6] 432 * Class id: DWORD-WORD-WORD-BYTES[2]-BYTES[6] 418 433 * 419 434 * RETURNS … … 516 531 /****************************************************************************** 517 532 * CLSIDFromString [OLE32.3] 518 * Converts a unique identifier from its string representation into 533 * IIDFromString [OLE32.74] 534 * Converts a unique identifier from its string representation into 519 535 * the GUID struct. 520 536 * … … 527 543 HRESULT WINAPI CLSIDFromString( 528 544 LPCOLESTR idstr, /* [in] string representation of GUID */ 529 CLSID *id /* [out] GUID represented by above string */ 530 ) { 531 LPOLESTR16 xid = HEAP_strdupWtoA(GetProcessHeap(),0,idstr); 532 HRESULT ret = CLSIDFromString16(xid,id); 533 534 HeapFree(GetProcessHeap(),0,xid); 545 CLSID *id ) /* [out] GUID represented by above string */ 546 { 547 char xid[40]; 548 HRESULT ret; 549 550 if (!WideCharToMultiByte( CP_ACP, 0, idstr, -1, xid, sizeof(xid), NULL, NULL )) 551 return CO_E_CLASSSTRING; 552 ret = CLSIDFromString16(xid,id); 535 553 if(ret != S_OK) { /* It appears a ProgID is also valid */ 536 554 ret = CLSIDFromProgID(idstr, id); … … 548 566 * the string representation and HRESULT 549 567 */ 550 #ifdef __WIN32OS2__ 551 HRESULT WINAPI WINE_StringFromCLSID( 568 HRESULT WINE_StringFromCLSID( 552 569 const CLSID *id, /* [in] GUID to be converted */ 553 570 LPSTR idstr /* [out] pointer to buffer to contain converted guid */ 554 #else555 static HRESULT WINE_StringFromCLSID(556 const CLSID *id, /* [in] GUID to be converted */557 LPSTR idstr /* [out] pointer to buffer to contain converted guid */558 #endif559 571 ) { 560 572 static const char *hex = "0123456789ABCDEF"; … … 567 579 return E_FAIL; 568 580 } 569 581 570 582 sprintf(idstr, "{%08lX-%04X-%04X-%02X%02X-", 571 583 id->Data1, id->Data2, id->Data3, … … 586 598 return S_OK; 587 599 } 600 588 601 #ifndef __WIN32OS2__ 589 602 /****************************************************************************** 590 * StringFromCLSID 16[COMPOBJ.19]603 * StringFromCLSID [COMPOBJ.19] 591 604 * Converts a GUID into the respective string representation. 592 605 * The target string is allocated using the OLE IMalloc. … … 629 642 } 630 643 #endif 644 631 645 /****************************************************************************** 632 646 * StringFromCLSID [OLE32.151] 647 * StringFromIID [OLE32.153] 633 648 * Converts a GUID into the respective string representation. 634 649 * The target string is allocated using the OLE IMalloc. … … 657 672 658 673 /****************************************************************************** 659 * StringFromGUID2 [COMPOBJ.76] [OLE32.152] 674 * StringFromGUID2 [COMPOBJ.76] 675 * StringFromGUID2 [OLE32.152] 660 676 * 661 677 * Converts a global unique identifier into a string of an API- … … 729 745 730 746 /****************************************************************************** 731 * CLSIDFromProgID 16[COMPOBJ.61]747 * CLSIDFromProgID [COMPOBJ.61] 732 748 * Converts a program id into the respective GUID. (By using a registry lookup) 733 749 * RETURNS … … 767 783 HRESULT WINAPI CLSIDFromProgID( 768 784 LPCOLESTR progid, /* [in] program id as found in registry */ 769 LPCLSID riid /* [out] associated CLSID */ 770 ) { 771 LPOLESTR16 pid = HEAP_strdupWtoA(GetProcessHeap(),0,progid); 772 HRESULT ret = CLSIDFromProgID16(pid,riid); 773 774 HeapFree(GetProcessHeap(),0,pid); 775 return ret; 785 LPCLSID riid ) /* [out] associated CLSID */ 786 { 787 static const WCHAR clsidW[] = { '\\','C','L','S','I','D',0 }; 788 char buf2[80]; 789 DWORD buf2len = sizeof(buf2); 790 HKEY xhkey; 791 792 WCHAR *buf = HeapAlloc( GetProcessHeap(),0,(strlenW(progid)+8) * sizeof(WCHAR) ); 793 strcpyW( buf, progid ); 794 strcatW( buf, clsidW ); 795 if (RegOpenKeyW(HKEY_CLASSES_ROOT,buf,&xhkey)) 796 { 797 HeapFree(GetProcessHeap(),0,buf); 798 return CO_E_CLASSSTRING; 799 } 800 HeapFree(GetProcessHeap(),0,buf); 801 802 if (RegQueryValueA(xhkey,NULL,buf2,&buf2len)) 803 { 804 RegCloseKey(xhkey); 805 return CO_E_CLASSSTRING; 806 } 807 RegCloseKey(xhkey); 808 return CLSIDFromString16(buf2,riid); 776 809 } 777 810 … … 782 815 * 783 816 * This function returns the CLSID of the DLL that implements the proxy and stub 784 * for the specified interface. 785 * 786 * It determines this by searching the 817 * for the specified interface. 818 * 819 * It determines this by searching the 787 820 * HKEY_CLASSES_ROOT\Interface\{string form of riid}\ProxyStubClsid32 in the registry 788 821 * and any interface id registered by CoRegisterPSClsid within the current process. 789 * 822 * 790 823 * FIXME: We only search the registry, not ids registered with CoRegisterPSClsid. 791 824 */ … … 822 855 823 856 /* ... Once we have the key, query the registry to get the 824 value of CLSID as a string, and convert it into a 857 value of CLSID as a string, and convert it into a 825 858 proper CLSID structure to be passed back to the app */ 826 859 buf2len = sizeof(buf2); … … 846 879 847 880 /*********************************************************************** 848 * WriteClassStm 881 * WriteClassStm (OLE32.159) 849 882 * 850 883 * This function write a CLSID on stream … … 861 894 862 895 /*********************************************************************** 863 * ReadClassStm 896 * ReadClassStm (OLE32.135) 864 897 * 865 898 * This function read a CLSID from a stream 866 899 */ 867 HRESULT WINAPI ReadClassStm(IStream *pStm, REFCLSID rclsid)900 HRESULT WINAPI ReadClassStm(IStream *pStm,CLSID *pclsid) 868 901 { 869 902 ULONG nbByte; 870 903 HRESULT res; 871 872 TRACE("(%p,%p)\n",pStm, rclsid);873 874 if ( rclsid==NULL)904 905 TRACE("(%p,%p)\n",pStm,pclsid); 906 907 if (pclsid==NULL) 875 908 return E_INVALIDARG; 876 877 res = IStream_Read(pStm,(void*) rclsid,sizeof(CLSID),&nbByte);909 910 res = IStream_Read(pStm,(void*)pclsid,sizeof(CLSID),&nbByte); 878 911 879 912 if (FAILED(res)) 880 913 return res; 881 914 882 915 if (nbByte != sizeof(CLSID)) 883 916 return S_FALSE; … … 908 941 return 0; 909 942 } 910 943 #endif 911 944 /* FIXME: this function is not declared in the WINELIB headers. But where should it go ? */ 912 945 /*********************************************************************** 913 * C allObjectInWOW (COMPOBJ.201)946 * CALLOBJECTINWOW (COMPOBJ.201) 914 947 */ 915 948 HRESULT WINAPI CallObjectInWOW(LPVOID p1,LPVOID p2) { … … 919 952 920 953 /****************************************************************************** 921 * CoRegisterClassObject 16[COMPOBJ.5]954 * CoRegisterClassObject [COMPOBJ.5] 922 955 * 923 956 * Don't know where it registers it ... … … 942 975 943 976 /****************************************************************************** 944 * CoRevokeClassObject 16[COMPOBJ.6]977 * CoRevokeClassObject [COMPOBJ.6] 945 978 * 946 979 */ … … 950 983 return 0; 951 984 } 952 #endif 953 985 986 /****************************************************************************** 987 * CoFileTimeToDosDateTime [COMPOBJ.30] 988 */ 989 BOOL16 WINAPI CoFileTimeToDosDateTime16(const FILETIME *ft, LPWORD lpDosDate, LPWORD lpDosTime) 990 { 991 return FileTimeToDosDateTime(ft, lpDosDate, lpDosTime); 992 } 993 994 /****************************************************************************** 995 * CoDosDateTimeToFileTime [COMPOBJ.31] 996 */ 997 BOOL16 WINAPI CoDosDateTimeToFileTime16(WORD wDosDate, WORD wDosTime, FILETIME *ft) 998 { 999 return DosDateTimeToFileTime(wDosDate, wDosTime, ft); 1000 } 954 1001 955 1002 /*** 956 1003 * COM_GetRegisteredClassObject 957 1004 * 958 * This internal method is used to scan the registered class list to 1005 * This internal method is used to scan the registered class list to 959 1006 * find a class object. 960 1007 * 961 * Params: 1008 * Params: 962 1009 * rclsid Class ID of the class to find. 963 1010 * dwClsContext Class context to match. … … 971 1018 LPUNKNOWN* ppUnk) 972 1019 { 1020 HRESULT hr = S_FALSE; 973 1021 RegisteredClass* curClass; 1022 1023 EnterCriticalSection( &csRegisteredClassList ); 974 1024 975 1025 /* … … 1002 1052 IUnknown_AddRef(curClass->classObject); 1003 1053 1004 return S_OK; 1054 hr = S_OK; 1055 goto end; 1005 1056 } 1006 1057 … … 1011 1062 } 1012 1063 1064 end: 1065 LeaveCriticalSection( &csRegisteredClassList ); 1013 1066 /* 1014 1067 * If we get to here, we haven't found our class. 1015 1068 */ 1016 return S_FALSE; 1069 return hr; 1070 } 1071 1072 static DWORD WINAPI 1073 _LocalServerThread(LPVOID param) { 1074 HANDLE hPipe; 1075 char pipefn[200]; 1076 RegisteredClass *newClass = (RegisteredClass*)param; 1077 HRESULT hres; 1078 IStream *pStm; 1079 STATSTG ststg; 1080 unsigned char *buffer; 1081 int buflen; 1082 IClassFactory *classfac; 1083 LARGE_INTEGER seekto; 1084 ULARGE_INTEGER newpos; 1085 ULONG res; 1086 1087 TRACE("Starting threader for %s.\n",debugstr_guid(&newClass->classIdentifier)); 1088 strcpy(pipefn,PIPEPREF); 1089 WINE_StringFromCLSID(&newClass->classIdentifier,pipefn+strlen(PIPEPREF)); 1090 1091 hres = IUnknown_QueryInterface(newClass->classObject,&IID_IClassFactory,(LPVOID*)&classfac); 1092 if (hres) return hres; 1093 1094 hres = CreateStreamOnHGlobal(0,TRUE,&pStm); 1095 if (hres) { 1096 FIXME("Failed to create stream on hglobal.\n"); 1097 return hres; 1098 } 1099 hres = CoMarshalInterface(pStm,&IID_IClassFactory,(LPVOID)classfac,0,NULL,0); 1100 if (hres) { 1101 FIXME("CoMarshalInterface failed, %lx!\n",hres); 1102 return hres; 1103 } 1104 hres = IStream_Stat(pStm,&ststg,0); 1105 if (hres) return hres; 1106 1107 buflen = ststg.cbSize.s.LowPart; 1108 buffer = HeapAlloc(GetProcessHeap(),0,buflen); 1109 seekto.s.LowPart = 0; 1110 seekto.s.HighPart = 0; 1111 hres = IStream_Seek(pStm,seekto,SEEK_SET,&newpos); 1112 if (hres) { 1113 FIXME("IStream_Seek failed, %lx\n",hres); 1114 return hres; 1115 } 1116 hres = IStream_Read(pStm,buffer,buflen,&res); 1117 if (hres) { 1118 FIXME("Stream Read failed, %lx\n",hres); 1119 return hres; 1120 } 1121 IStream_Release(pStm); 1122 1123 while (1) { 1124 hPipe = CreateNamedPipeA( 1125 pipefn, 1126 PIPE_ACCESS_DUPLEX, 1127 PIPE_TYPE_BYTE|PIPE_WAIT, 1128 PIPE_UNLIMITED_INSTANCES, 1129 4096, 1130 4096, 1131 NMPWAIT_USE_DEFAULT_WAIT, 1132 NULL 1133 ); 1134 if (hPipe == INVALID_HANDLE_VALUE) { 1135 FIXME("pipe creation failed for %s, le is %lx\n",pipefn,GetLastError()); 1136 return 1; 1137 } 1138 if (!ConnectNamedPipe(hPipe,NULL)) { 1139 ERR("Failure during ConnectNamedPipe %lx, ABORT!\n",GetLastError()); 1140 CloseHandle(hPipe); 1141 continue; 1142 } 1143 WriteFile(hPipe,buffer,buflen,&res,NULL); 1144 CloseHandle(hPipe); 1145 } 1146 return 0; 1017 1147 } 1018 1148 … … 1030 1160 DWORD flags, /* [in] REGCLS flags indicating how connections are made */ 1031 1161 LPDWORD lpdwRegister 1032 ) 1162 ) 1033 1163 { 1034 1164 RegisteredClass* newClass; 1035 1165 LPUNKNOWN foundObject; 1036 1166 HRESULT hr; 1037 char buf[80];1038 1039 WINE_StringFromCLSID(rclsid,buf);1040 1167 1041 1168 TRACE("(%s,%p,0x%08lx,0x%08lx,%p)\n", 1042 buf,pUnk,dwClsContext,flags,lpdwRegister); 1043 1044 /* 1045 * Perform a sanity check on the parameters 1046 */ 1169 debugstr_guid(rclsid),pUnk,dwClsContext,flags,lpdwRegister); 1170 1047 1171 if ( (lpdwRegister==0) || (pUnk==0) ) 1048 {1049 1172 return E_INVALIDARG; 1050 } 1051 1052 /* 1053 * Initialize the cookie (out parameter) 1054 */ 1173 1055 1174 *lpdwRegister = 0; 1056 1175 … … 1060 1179 */ 1061 1180 hr = COM_GetRegisteredClassObject(rclsid, dwClsContext, &foundObject); 1062 1063 if (hr == S_OK) 1064 { 1065 /* 1066 * The COM_GetRegisteredClassObject increased the reference count on the 1067 * object so it has to be released. 1068 */ 1181 if (hr == S_OK) { 1069 1182 IUnknown_Release(foundObject); 1070 1071 1183 return CO_E_OBJISREG; 1072 1184 } 1073 1074 /* 1075 * If it is not registered, we must create a new entry for this class and 1076 * append it to the registered class list. 1077 * We use the address of the chain node as the cookie since we are sure it's 1078 * unique. 1079 */ 1185 1080 1186 newClass = HeapAlloc(GetProcessHeap(), 0, sizeof(RegisteredClass)); 1081 1082 /* 1083 * Initialize the node. 1084 */ 1187 if ( newClass == NULL ) 1188 return E_OUTOFMEMORY; 1189 1190 EnterCriticalSection( &csRegisteredClassList ); 1191 1085 1192 newClass->classIdentifier = *rclsid; 1086 1193 newClass->runContext = dwClsContext; 1087 1194 newClass->connectFlags = flags; 1195 /* 1196 * Use the address of the chain node as the cookie since we are sure it's 1197 * unique. 1198 */ 1088 1199 newClass->dwCookie = (DWORD)newClass; 1089 1200 newClass->nextClass = firstRegisteredClass; … … 1097 1208 1098 1209 firstRegisteredClass = newClass; 1099 1100 /* 1101 * Assign the out parameter (cookie) 1102 */ 1210 LeaveCriticalSection( &csRegisteredClassList ); 1211 1103 1212 *lpdwRegister = newClass->dwCookie; 1104 1105 /* 1106 * We're successful Yippee! 1107 */ 1213 1214 if (dwClsContext & CLSCTX_LOCAL_SERVER) { 1215 DWORD tid; 1216 1217 STUBMGR_Start(); 1218 newClass->hThread=CreateThread(NULL,0,_LocalServerThread,newClass,0,&tid); 1219 } 1108 1220 return S_OK; 1109 1221 } … … 1117 1229 */ 1118 1230 HRESULT WINAPI CoRevokeClassObject( 1119 DWORD dwRegister) 1120 { 1231 DWORD dwRegister) 1232 { 1233 HRESULT hr = E_INVALIDARG; 1121 1234 RegisteredClass** prevClassLink; 1122 1235 RegisteredClass* curClass; 1123 1236 1124 1237 TRACE("(%08lx)\n",dwRegister); 1238 1239 EnterCriticalSection( &csRegisteredClassList ); 1125 1240 1126 1241 /* … … 1149 1264 /* 1150 1265 * Free the memory used by the chain node. 1151 */1266 */ 1152 1267 HeapFree(GetProcessHeap(), 0, curClass); 1153 1268 1154 return S_OK; 1155 } 1269 hr = S_OK; 1270 goto end; 1271 } 1156 1272 1157 1273 /* … … 1162 1278 } 1163 1279 1280 end: 1281 LeaveCriticalSection( &csRegisteredClassList ); 1164 1282 /* 1165 1283 * If we get to here, we haven't found our class. 1166 1284 */ 1167 return E_INVALIDARG; 1285 return hr; 1286 } 1287 1288 static HRESULT WINAPI Remote_CoGetClassObject( 1289 REFCLSID rclsid, DWORD dwClsContext, COSERVERINFO *pServerInfo, 1290 REFIID iid, LPVOID *ppv 1291 ) { 1292 HKEY key; 1293 char buf[200]; 1294 HRESULT hres = E_UNEXPECTED; 1295 char xclsid[80]; 1296 WCHAR dllName[MAX_PATH+1]; 1297 DWORD dllNameLen = sizeof(dllName); 1298 STARTUPINFOW sinfo; 1299 PROCESS_INFORMATION pinfo; 1300 1301 WINE_StringFromCLSID((LPCLSID)rclsid,xclsid); 1302 1303 sprintf(buf,"CLSID\\%s\\LocalServer32",xclsid); 1304 hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key); 1305 1306 if (hres != ERROR_SUCCESS) 1307 return REGDB_E_CLASSNOTREG; 1308 1309 memset(dllName,0,sizeof(dllName)); 1310 hres= RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)dllName,&dllNameLen); 1311 if (hres) 1312 return REGDB_E_CLASSNOTREG; /* FIXME: check retval */ 1313 RegCloseKey(key); 1314 1315 TRACE("found LocalServer32 exe %s\n", debugstr_w(dllName)); 1316 1317 memset(&sinfo,0,sizeof(sinfo)); 1318 sinfo.cb = sizeof(sinfo); 1319 if (!CreateProcessW(NULL,dllName,NULL,NULL,FALSE,0,NULL,NULL,&sinfo,&pinfo)) 1320 return E_FAIL; 1321 return create_marshalled_proxy(rclsid,iid,ppv); 1168 1322 } 1169 1323 1170 1324 /*********************************************************************** 1171 1325 * CoGetClassObject [COMPOBJ.7] 1326 * CoGetClassObject [OLE32.16] 1327 * 1328 * FIXME. If request allows of several options and there is a failure 1329 * with one (other than not being registered) do we try the 1330 * others or return failure? (E.g. inprocess is registered but 1331 * the DLL is not found but the server version works) 1172 1332 */ 1173 1333 HRESULT WINAPI CoGetClassObject( … … 1178 1338 HRESULT hres = E_UNEXPECTED; 1179 1339 char xclsid[80]; 1180 WCHAR dllName[MAX_PATH+1];1181 DWORD dllNameLen = sizeof(dllName);1340 WCHAR ProviderName[MAX_PATH+1]; 1341 DWORD ProviderNameLen = sizeof(ProviderName); 1182 1342 HINSTANCE hLibrary; 1183 1343 #ifdef __WIN32OS2__ 1184 typedef HRESULT (* CALLBACK DllGetClassObjectFunc)(REFCLSID clsid, 1344 typedef HRESULT (* CALLBACK DllGetClassObjectFunc)(REFCLSID clsid, 1185 1345 REFIID iid, LPVOID *ppv); 1186 1346 #else 1187 typedef HRESULT CALLBACK (*DllGetClassObjectFunc)(REFCLSID clsid,1347 typedef HRESULT (CALLBACK *DllGetClassObjectFunc)(REFCLSID clsid, 1188 1348 REFIID iid, LPVOID *ppv); 1189 1349 #endif 1190 1350 DllGetClassObjectFunc DllGetClassObject; 1351 HKEY key; 1352 char buf[200]; 1191 1353 1192 1354 WINE_StringFromCLSID((LPCLSID)rclsid,xclsid); … … 1203 1365 1204 1366 /* 1205 * First, try and see if we can't match the class ID with one of the 1367 * First, try and see if we can't match the class ID with one of the 1206 1368 * registered classes. 1207 1369 */ … … 1223 1385 } 1224 1386 1225 /* out of process and remote servers not supported yet */ 1226 if ( ((CLSCTX_LOCAL_SERVER|CLSCTX_REMOTE_SERVER) & dwClsContext) 1387 if (((CLSCTX_LOCAL_SERVER) & dwClsContext) 1388 && !((CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER) & dwClsContext)) 1389 return Remote_CoGetClassObject(rclsid,dwClsContext,pServerInfo,iid,ppv); 1390 1391 /* remote servers not supported yet */ 1392 if ( ((CLSCTX_REMOTE_SERVER) & dwClsContext) 1227 1393 && !((CLSCTX_INPROC_SERVER|CLSCTX_INPROC_HANDLER) & dwClsContext) 1228 1394 ){ 1229 FIXME("%s %s not supported!\n", 1230 (dwClsContext&CLSCTX_LOCAL_SERVER)?"CLSCTX_LOCAL_SERVER":"", 1231 (dwClsContext&CLSCTX_REMOTE_SERVER)?"CLSCTX_REMOTE_SERVER":"" 1232 ); 1233 return E_ACCESSDENIED; 1395 FIXME("CLSCTX_REMOTE_SERVER not supported!\n"); 1396 return E_NOINTERFACE; 1234 1397 } 1235 1398 … … 1238 1401 char buf[200]; 1239 1402 1403 memset(ProviderName,0,sizeof(ProviderName)); 1240 1404 sprintf(buf,"CLSID\\%s\\InprocServer32",xclsid); 1241 hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key); 1242 1243 if (hres != ERROR_SUCCESS) { 1244 return REGDB_E_CLASSNOTREG; 1405 if (((hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key)) != ERROR_SUCCESS) || 1406 ((hres = RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)ProviderName,&ProviderNameLen)), 1407 RegCloseKey (key), 1408 hres != ERROR_SUCCESS)) 1409 { 1410 hres = REGDB_E_CLASSNOTREG; 1411 } 1412 /* Don't ask me. MSDN says that CoGetClassObject does NOT call CoLoadLibrary */ 1413 else if ((hLibrary = CoLoadLibrary(ProviderName, TRUE)) == 0) 1414 { 1415 FIXME("couldn't load InprocServer32 dll %s\n", debugstr_w(ProviderName)); 1416 hres = E_ACCESSDENIED; /* or should this be CO_E_DLLNOTFOUND? */ 1245 1417 } 1246 1247 memset(dllName,0,sizeof(dllName)); 1248 hres= RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)dllName,&dllNameLen); 1249 if (hres) 1250 return REGDB_E_CLASSNOTREG; /* FIXME: check retval */ 1251 RegCloseKey(key); 1252 TRACE("found InprocServer32 dll %s\n", debugstr_w(dllName)); 1253 1254 /* open dll, call DllGetClassObject */ 1255 hLibrary = CoLoadLibrary(dllName, TRUE); 1256 if (hLibrary == 0) { 1257 FIXME("couldn't load InprocServer32 dll %s\n", debugstr_w(dllName)); 1258 return E_ACCESSDENIED; /* or should this be CO_E_DLLNOTFOUND? */ 1418 else if (!(DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject"))) 1419 { 1420 /* not sure if this should be called here CoFreeLibrary(hLibrary);*/ 1421 FIXME("couldn't find function DllGetClassObject in %s\n", debugstr_w(ProviderName)); 1422 hres = E_ACCESSDENIED; 1259 1423 } 1260 DllGetClassObject = (DllGetClassObjectFunc)GetProcAddress(hLibrary, "DllGetClassObject"); 1261 if (!DllGetClassObject) { 1262 /* not sure if this should be called here CoFreeLibrary(hLibrary);*/ 1263 FIXME("couldn't find function DllGetClassObject in %s\n", debugstr_w(dllName)); 1264 return E_ACCESSDENIED; 1424 else 1425 { 1426 /* Ask the DLL for its class object. (there was a note here about 1427 * class factories but this is good. 1428 */ 1429 return DllGetClassObject(rclsid, iid, ppv); 1430 } 1431 } 1432 1433 1434 /* Finally try out of process */ 1435 /* out of process and remote servers not supported yet */ 1436 if (CLSCTX_LOCAL_SERVER & dwClsContext) 1437 { 1438 memset(ProviderName,0,sizeof(ProviderName)); 1439 sprintf(buf,"CLSID\\%s\\LocalServer32",xclsid); 1440 if (((hres = RegOpenKeyExA(HKEY_CLASSES_ROOT, buf, 0, KEY_READ, &key)) != ERROR_SUCCESS) || 1441 ((hres = RegQueryValueExW(key,NULL,NULL,NULL,(LPBYTE)ProviderName,&ProviderNameLen)), 1442 RegCloseKey (key), 1443 hres != ERROR_SUCCESS)) 1444 { 1445 hres = REGDB_E_CLASSNOTREG; 1446 } 1447 else 1448 { 1449 /* CO_E_APPNOTFOUND if no exe */ 1450 FIXME("CLSCTX_LOCAL_SERVER %s registered but not yet supported!\n",debugstr_w(ProviderName)); 1451 hres = E_ACCESSDENIED; 1265 1452 } 1266 1267 /* 1268 * Ask the DLL for its class object. (there was a note here about class 1269 * factories but this is good. 1270 */ 1271 return DllGetClassObject(rclsid, iid, ppv); 1272 } 1453 } 1454 1455 if (CLSCTX_REMOTE_SERVER & dwClsContext) 1456 { 1457 FIXME ("CLSCTX_REMOTE_SERVER not supported\n"); 1458 hres = E_ACCESSDENIED; 1459 } 1460 1273 1461 return hres; 1274 1462 } 1275 1276 /*********************************************************************** 1277 * CoResumeClassObjects 1463 /*********************************************************************** 1464 * CoResumeClassObjects (OLE32.173) 1278 1465 * 1279 1466 * Resumes classobjects registered with REGCLS suspended … … 1286 1473 1287 1474 /*********************************************************************** 1288 * GetClassFile 1475 * GetClassFile (OLE32.67) 1289 1476 * 1290 1477 * This function supplies the CLSID associated with the given filename. 1291 1478 */ 1292 HRESULT WINAPI GetClassFile(LP OLESTR filePathName,CLSID *pclsid)1479 HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid) 1293 1480 { 1294 1481 IStorage *pstg=0; … … 1316 1503 pattern in the registry. this case is not frequently used ! so I present only the psodocode for 1317 1504 this case 1318 1505 1319 1506 for(i=0;i<nFileTypes;i++) 1320 1507 … … 1349 1536 length=lstrlenW(absFile); 1350 1537 for(i=length-1; ( (i>=0) && (extention[i]=absFile[i]) );i--); 1351 1538 1352 1539 /* get the progId associated to the extension */ 1353 1540 progId=CoTaskMemAlloc(sizeProgId); … … 1377 1564 #ifndef __WIN32OS2__ 1378 1565 /****************************************************************************** 1379 * CoRegisterMessageFilter 16[COMPOBJ.27]1566 * CoRegisterMessageFilter [COMPOBJ.27] 1380 1567 */ 1381 1568 HRESULT WINAPI CoRegisterMessageFilter16( … … 1387 1574 } 1388 1575 #endif 1389 1390 /*********************************************************************** 1391 * CoCreateInstance [ COMPOBJ.13,OLE32.7]1576 /*********************************************************************** 1577 * CoCreateInstance [COMPOBJ.13] 1578 * CoCreateInstance [OLE32.7] 1392 1579 */ 1393 1580 HRESULT WINAPI CoCreateInstance( … … 1396 1583 DWORD dwClsContext, 1397 1584 REFIID iid, 1398 LPVOID *ppv) 1585 LPVOID *ppv) 1399 1586 { 1400 1587 HRESULT hres; … … 1411 1598 */ 1412 1599 *ppv = 0; 1413 1600 1414 1601 /* 1415 1602 * Get a class factory to construct the object we want. … … 1422 1609 1423 1610 if (FAILED(hres)) { 1424 FIXME("no instance created for %s, hres is 0x%08lx\n",debugstr_guid(iid),hres); 1611 FIXME("no classfactory created for CLSID %s, hres is 0x%08lx\n", 1612 debugstr_guid(rclsid),hres); 1425 1613 return hres; 1426 1614 } … … 1431 1619 hres = IClassFactory_CreateInstance(lpclf, pUnkOuter, iid, ppv); 1432 1620 IClassFactory_Release(lpclf); 1621 if(FAILED(hres)) 1622 FIXME("no instance created for interface %s of class %s, hres is 0x%08lx\n", 1623 debugstr_guid(iid), debugstr_guid(rclsid),hres); 1433 1624 1434 1625 return hres; … … 1439 1630 */ 1440 1631 HRESULT WINAPI CoCreateInstanceEx( 1441 REFCLSID rclsid, 1632 REFCLSID rclsid, 1442 1633 LPUNKNOWN pUnkOuter, 1443 DWORD dwClsContext, 1634 DWORD dwClsContext, 1444 1635 COSERVERINFO* pServerInfo, 1445 1636 ULONG cmq, … … 1472 1663 * Get the object and get its IUnknown pointer. 1473 1664 */ 1474 hr = CoCreateInstance(rclsid, 1665 hr = CoCreateInstance(rclsid, 1475 1666 pUnkOuter, 1476 1667 dwClsContext, … … 1509 1700 1510 1701 /*********************************************************************** 1511 * CoFreeLibrary [ COMPOBJ.13]1702 * CoFreeLibrary [OLE32.13] 1512 1703 */ 1513 1704 void WINAPI CoFreeLibrary(HINSTANCE hLibrary) … … 1515 1706 OpenDll *ptr, *prev; 1516 1707 OpenDll *tmp; 1708 1709 EnterCriticalSection( &csOpenDllList ); 1517 1710 1518 1711 /* lookup library in linked list */ … … 1527 1720 if (ptr == NULL) { 1528 1721 /* shouldn't happen if user passed in a valid hLibrary */ 1529 return;1722 goto end; 1530 1723 } 1531 1724 /* assert: ptr points to the library entry to free */ … … 1542 1735 prev->next = tmp; 1543 1736 } 1544 1545 } 1546 1547 1548 /*********************************************************************** 1549 * CoFreeAllLibraries [COMPOBJ.12] 1737 end: 1738 LeaveCriticalSection( &csOpenDllList ); 1739 } 1740 1741 1742 /*********************************************************************** 1743 * CoFreeAllLibraries [OLE32.12] 1550 1744 */ 1551 1745 void WINAPI CoFreeAllLibraries(void) 1552 1746 { 1553 1747 OpenDll *ptr, *tmp; 1748 1749 EnterCriticalSection( &csOpenDllList ); 1554 1750 1555 1751 for (ptr = openDllList; ptr != NULL; ) { … … 1558 1754 ptr = tmp; 1559 1755 } 1756 1757 LeaveCriticalSection( &csOpenDllList ); 1560 1758 } 1561 1759 … … 1564 1762 /*********************************************************************** 1565 1763 * CoFreeUnusedLibraries [COMPOBJ.17] 1764 * CoFreeUnusedLibraries [OLE32.14] 1566 1765 */ 1567 1766 void WINAPI CoFreeUnusedLibraries(void) … … 1571 1770 DllCanUnloadNowFunc DllCanUnloadNow; 1572 1771 1772 EnterCriticalSection( &csOpenDllList ); 1773 1573 1774 for (ptr = openDllList; ptr != NULL; ) { 1574 1775 DllCanUnloadNow = (DllCanUnloadNowFunc) 1575 1776 GetProcAddress(ptr->hLibrary, "DllCanUnloadNow"); 1576 1777 1577 1778 if ( (DllCanUnloadNow != NULL) && 1578 1779 (DllCanUnloadNow() == S_OK) ) { … … 1584 1785 } 1585 1786 } 1586 } 1587 1588 /*********************************************************************** 1589 * CoFileTimeNow [COMPOBJ.82, OLE32.10] 1787 1788 LeaveCriticalSection( &csOpenDllList ); 1789 } 1790 1791 /*********************************************************************** 1792 * CoFileTimeNow [COMPOBJ.82] 1793 * CoFileTimeNow [OLE32.10] 1794 * 1590 1795 * RETURNS 1591 1796 * the current system time in lpFileTime … … 1608 1813 HRESULT ret = CoGetMalloc(0,&lpmalloc); 1609 1814 1610 if (FAILED(ret)) 1815 if (FAILED(ret)) 1611 1816 return NULL; 1612 1817 … … 1622 1827 HRESULT ret = CoGetMalloc(0,&lpmalloc); 1623 1828 1624 if (FAILED(ret)) 1829 if (FAILED(ret)) 1625 1830 return; 1626 1831 … … 1639 1844 LPMALLOC lpmalloc; 1640 1845 HRESULT ret = CoGetMalloc(0,&lpmalloc); 1641 1642 if (FAILED(ret)) 1846 1847 if (FAILED(ret)) 1643 1848 return NULL; 1644 1849 … … 1654 1859 OpenDll *ptr; 1655 1860 OpenDll *tmp; 1656 1861 1657 1862 TRACE("(%s, %d)\n", debugstr_w(lpszLibName), bAutoFree); 1658 1863 … … 1661 1866 if (!bAutoFree) 1662 1867 return hLibrary; 1868 1869 EnterCriticalSection( &csOpenDllList ); 1663 1870 1664 1871 if (openDllList == NULL) { … … 1684 1891 } 1685 1892 } 1686 1893 1894 LeaveCriticalSection( &csOpenDllList ); 1895 1687 1896 return hLibrary; 1688 1897 } … … 1696 1905 } 1697 1906 1698 #ifndef __WIN32OS2__ 1699 /****************************************************************************** 1700 * CoLockObjectExternal16 [COMPOBJ.63] 1907 /****************************************************************************** 1908 * CoLockObjectExternal [COMPOBJ.63] 1701 1909 */ 1702 1910 HRESULT WINAPI CoLockObjectExternal16( … … 1708 1916 return S_OK; 1709 1917 } 1710 #endif1711 1918 1712 1919 /****************************************************************************** … … 1719 1926 { 1720 1927 1721 if (fLock) 1928 if (fLock) 1722 1929 { 1723 /* 1930 /* 1724 1931 * Increment the external lock coutner, COM_ExternalLockAddRef also 1725 1932 * increment the object's internal lock counter. 1726 1933 */ 1727 COM_ExternalLockAddRef( pUnk); 1934 COM_ExternalLockAddRef( pUnk); 1728 1935 } 1729 1936 else 1730 1937 { 1731 /* 1938 /* 1732 1939 * Decrement the external lock coutner, COM_ExternalLockRelease also 1733 1940 * decrement the object's internal lock counter. … … 1739 1946 } 1740 1947 1741 #ifndef __WIN32OS2__ 1742 /*********************************************************************** 1743 * CoGetState16 [COMPOBJ.115] 1948 /*********************************************************************** 1949 * CoGetState [COMPOBJ.115] 1744 1950 */ 1745 1951 HRESULT WINAPI CoGetState16(LPDWORD state) … … 1750 1956 } 1751 1957 /*********************************************************************** 1752 * CoSetState [ COM32.42]1958 * CoSetState [OLE32.42] 1753 1959 */ 1754 1960 HRESULT WINAPI CoSetState(LPDWORD state) … … 1758 1964 return S_OK; 1759 1965 } 1760 #endif1761 1966 /*********************************************************************** 1762 1967 * CoCreateFreeThreadedMarshaler [OLE32.5] … … 1765 1970 { 1766 1971 FIXME ("(%p %p): stub\n", punkOuter, ppunkMarshal); 1767 1972 1768 1973 return S_OK; 1769 1974 } 1770 1771 1772 /***********************************************************************1773 * DllGetClassObject [OLE32.63]1774 */1775 HRESULT WINAPI OLE32_DllGetClassObject(REFCLSID rclsid, REFIID iid,LPVOID *ppv)1776 {1777 FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));1778 *ppv = NULL;1779 return CLASS_E_CLASSNOTAVAILABLE;1780 }1781 1782 1975 1783 1976 /*** 1784 1977 * COM_RevokeAllClasses 1785 1978 * 1786 * This method is called when the COM libraries are uninitialized to 1979 * This method is called when the COM libraries are uninitialized to 1787 1980 * release all the references to the class objects registered with 1788 1981 * the library … … 1790 1983 static void COM_RevokeAllClasses() 1791 1984 { 1985 EnterCriticalSection( &csRegisteredClassList ); 1986 1792 1987 while (firstRegisteredClass!=0) 1793 1988 { 1794 1989 CoRevokeClassObject(firstRegisteredClass->dwCookie); 1795 1990 } 1991 1992 LeaveCriticalSection( &csRegisteredClassList ); 1796 1993 } 1797 1994 … … 1801 1998 1802 1999 /**************************************************************************** 1803 * Public - Method that increments the count for a IUnknown* in the linked 2000 * Public - Method that increments the count for a IUnknown* in the linked 1804 2001 * list. The item is inserted if not already in the list. 1805 2002 */ … … 1822 2019 * Add an internal lock to the object 1823 2020 */ 1824 IUnknown_AddRef(pUnk); 2021 IUnknown_AddRef(pUnk); 1825 2022 } 1826 2023 1827 2024 /**************************************************************************** 1828 * Public - Method that decrements the count for a IUnknown* in the linked 2025 * Public - Method that decrements the count for a IUnknown* in the linked 1829 2026 * list. The item is removed from the list if its count end up at zero or if 1830 2027 * bRelAll is TRUE. … … 1843 2040 IUnknown_Release(pUnk); /* release local locks as well */ 1844 2041 1845 if ( bRelAll == FALSE ) 2042 if ( bRelAll == FALSE ) 1846 2043 break; /* perform single release */ 1847 2044 1848 } while ( externalLock->uRefCount > 0 ); 2045 } while ( externalLock->uRefCount > 0 ); 1849 2046 1850 2047 if ( externalLock->uRefCount == 0 ) /* get rid of the list entry */ … … 1864 2061 COM_ExternalLockDelete(head); /* get rid of the head stuff */ 1865 2062 1866 head = elList.head; /* get the new head... */ 2063 head = elList.head; /* get the new head... */ 1867 2064 } 1868 2065 } … … 1880 2077 { 1881 2078 DPRINTF( "\t%p with %lu references count.\n", current->pUnk, current->uRefCount); 1882 1883 /* Skip to the next item */ 2079 2080 /* Skip to the next item */ 1884 2081 current = current->next; 1885 } 2082 } 1886 2083 1887 2084 } … … 1903 2100 IUnknown *pUnk) 1904 2101 { 1905 if ( element == EL_END_OF_LIST ) 2102 if ( element == EL_END_OF_LIST ) 1906 2103 return EL_NOT_FOUND; 1907 2104 … … 1909 2106 return element; 1910 2107 1911 else /* Not the right guy, keep on looking */ 2108 else /* Not the right guy, keep on looking */ 1912 2109 return COM_ExternalLockLocate( element->next, pUnk); 1913 2110 } … … 1929 2126 if (newLock!=NULL) 1930 2127 { 1931 if ( elList.head == EL_END_OF_LIST ) 2128 if ( elList.head == EL_END_OF_LIST ) 1932 2129 { 1933 2130 elList.head = newLock; /* The list is empty */ 1934 2131 } 1935 else 2132 else 1936 2133 { 1937 /* 2134 /* 1938 2135 * insert does it at the head 1939 2136 */ … … 1943 2140 1944 2141 /* 1945 * Set new list item data member 2142 * Set new list item data member 1946 2143 */ 1947 2144 newLock->pUnk = pUnk; 1948 2145 newLock->uRefCount = 1; 1949 2146 newLock->next = previousHead; 1950 2147 1951 2148 return TRUE; 1952 2149 } … … 1965 2162 if ( current == itemList ) 1966 2163 { 1967 /* 1968 * this section handles the deletion of the first node 2164 /* 2165 * this section handles the deletion of the first node 1969 2166 */ 1970 2167 elList.head = itemList->next; 1971 HeapFree( GetProcessHeap(), 0, itemList); 2168 HeapFree( GetProcessHeap(), 0, itemList); 1972 2169 } 1973 2170 else 1974 2171 { 1975 do 2172 do 1976 2173 { 1977 2174 if ( current->next == itemList ) /* We found the item to free */ 1978 2175 { 1979 2176 current->next = itemList->next; /* readjust the list pointers */ 1980 1981 HeapFree( GetProcessHeap(), 0, itemList); 1982 break; 2177 2178 HeapFree( GetProcessHeap(), 0, itemList); 2179 break; 1983 2180 } 1984 1985 /* Skip to the next item */ 2181 2182 /* Skip to the next item */ 1986 2183 current = current->next; 1987 2184 1988 2185 } while ( current != EL_END_OF_LIST ); 1989 2186 } 1990 2187 } 1991 2188 1992 #ifndef __WIN32OS2__ 1993 /*********************************************************************** 1994 * COMPOBJ_DllEntryPoint [COMPOBJ.entry] 2189 /*********************************************************************** 2190 * DllEntryPoint [COMPOBJ.116] 1995 2191 * 1996 2192 * Initialization code for the COMPOBJ DLL … … 2015 2211 return TRUE; 2016 2212 } 2017 #endif 2213 2018 2214 /****************************************************************************** 2019 2215 * OleGetAutoConvert [OLE32.104] … … 2054 2250 HRESULT WINAPI OleSetAutoConvert(REFCLSID clsidOld, REFCLSID clsidNew) 2055 2251 { 2056 HKEY hkey = 0 , hkeyConvert = 0;2252 HKEY hkey = 0; 2057 2253 char buf[200], szClsidNew[200]; 2058 2254 HRESULT res = S_OK; 2059 2255 2060 TRACE("(% p,%p);\n", clsidOld, clsidNew);2256 TRACE("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew)); 2061 2257 sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]); 2062 2258 WINE_StringFromCLSID(clsidNew, szClsidNew); … … 2066 2262 goto done; 2067 2263 } 2068 if (Reg CreateKeyA(hkey, "AutoConvertTo", &hkeyConvert))2264 if (RegSetValueA(hkey, "AutoConvertTo", REG_SZ, szClsidNew, strlen(szClsidNew)+1)) 2069 2265 { 2070 2266 res = REGDB_E_WRITEREGDB; 2071 2267 goto done; 2072 2268 } 2073 if (RegSetValueExA(hkeyConvert, NULL, 0, 2074 REG_SZ, (LPBYTE)szClsidNew, strlen(szClsidNew)+1)) 2269 2270 done: 2271 if (hkey) RegCloseKey(hkey); 2272 return res; 2273 } 2274 2275 /****************************************************************************** 2276 * CoTreatAsClass [OLE32.46] 2277 */ 2278 HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew) 2279 { 2280 HKEY hkey = 0; 2281 char buf[200], szClsidNew[200]; 2282 HRESULT res = S_OK; 2283 2284 FIXME("(%s,%s)\n", debugstr_guid(clsidOld), debugstr_guid(clsidNew)); 2285 sprintf(buf,"CLSID\\");WINE_StringFromCLSID(clsidOld,&buf[6]); 2286 WINE_StringFromCLSID(clsidNew, szClsidNew); 2287 if (RegOpenKeyA(HKEY_CLASSES_ROOT,buf,&hkey)) 2288 { 2289 res = REGDB_E_CLASSNOTREG; 2290 goto done; 2291 } 2292 if (RegSetValueA(hkey, "AutoTreatAs", REG_SZ, szClsidNew, strlen(szClsidNew)+1)) 2075 2293 { 2076 2294 res = REGDB_E_WRITEREGDB; … … 2079 2297 2080 2298 done: 2081 if (hkeyConvert) RegCloseKey(hkeyConvert);2082 2299 if (hkey) RegCloseKey(hkey); 2083 2084 2300 return res; 2085 2301 } 2302 2086 2303 2087 2304 /*********************************************************************** … … 2101 2318 return !memcmp(rguid1,rguid2,sizeof(GUID)); 2102 2319 } 2103 2104 #ifdef __WIN32OS2__2105 // ----------------------------------------------------------------------2106 // CLSIDFromStringA()2107 // @@@PH: this is not a WINE API, but a replacement for CLSIDFromString162108 // which used to accept ASCII strings instead of OLE strings2109 // ----------------------------------------------------------------------2110 2111 HRESULT WIN32API CLSIDFromStringA(2112 LPCSTR lpsz, // [in] - ASCII string CLSID2113 LPCLSID pclsid) // [out] - Binary CLSID2114 {2115 return CLSIDFromString16(lpsz, pclsid);2116 }2117 #endif -
trunk/src/ole32/compobj_private.h
r5602 r7926 1 1 #ifndef __WINE_OLE_COMPOBJ_H 2 2 #define __WINE_OLE_COMPOBJ_H 3 4 #ifdef __WIN32OS2__ 5 #undef inline 6 #define inline 7 8 #include "wine/obj_moniker.h" 9 10 #endif 3 11 4 12 /* All private prototype functions used by OLE will be added to this header file */ 5 13 6 14 #include "wtypes.h" 15 16 extern HRESULT WINE_StringFromCLSID(const CLSID *id,LPSTR idstr); 17 extern HRESULT create_marshalled_proxy(REFCLSID rclsid, REFIID iid, LPVOID *ppv); 18 19 inline static HRESULT 20 get_facbuf_for_iid(REFIID riid,IPSFactoryBuffer **facbuf) { 21 HRESULT hres; 22 CLSID pxclsid; 23 24 if ((hres = CoGetPSClsid(riid,&pxclsid))) 25 return hres; 26 return CoGetClassObject(&pxclsid,CLSCTX_INPROC_SERVER,NULL,&IID_IPSFactoryBuffer,(LPVOID*)facbuf); 27 } 28 29 #define PIPEPREF "\\\\.\\pipe\\" 30 #define OLESTUBMGR PIPEPREF"WINE_OLE_StubMgr" 31 /* Standard Marshaling definitions */ 32 typedef struct _wine_marshal_id { 33 DWORD processid; 34 DWORD objectid; /* unique value corresp. IUnknown of object */ 35 IID iid; 36 } wine_marshal_id; 37 38 inline static BOOL 39 MARSHAL_Compare_Mids(wine_marshal_id *mid1,wine_marshal_id *mid2) { 40 return 41 (mid1->processid == mid2->processid) && 42 (mid1->objectid == mid2->objectid) && 43 IsEqualIID(&(mid1->iid),&(mid2->iid)) 44 ; 45 } 46 47 /* compare without interface compare */ 48 inline static BOOL 49 MARSHAL_Compare_Mids_NoInterface(wine_marshal_id *mid1, wine_marshal_id *mid2) { 50 return 51 (mid1->processid == mid2->processid) && 52 (mid1->objectid == mid2->objectid) 53 ; 54 } 55 56 HRESULT MARSHAL_Find_Stub_Buffer(wine_marshal_id *mid,IRpcStubBuffer **stub); 57 HRESULT MARSHAL_Find_Stub_Server(wine_marshal_id *mid,LPUNKNOWN *punk); 58 HRESULT MARSHAL_Register_Stub(wine_marshal_id *mid,LPUNKNOWN punk, IRpcStubBuffer *stub); 59 60 HRESULT MARSHAL_GetStandardMarshalCF(LPVOID *ppv); 61 62 typedef struct _wine_marshal_data { 63 DWORD dwDestContext; 64 DWORD mshlflags; 65 } wine_marshal_data; 66 67 68 #define REQTYPE_REQUEST 0 69 typedef struct _wine_rpc_request_header { 70 DWORD reqid; 71 wine_marshal_id mid; 72 DWORD iMethod; 73 DWORD cbBuffer; 74 } wine_rpc_request_header; 75 76 #define REQTYPE_RESPONSE 1 77 typedef struct _wine_rpc_response_header { 78 DWORD reqid; 79 DWORD cbBuffer; 80 DWORD retval; 81 } wine_rpc_response_header; 82 83 #define REQSTATE_START 0 84 #define REQSTATE_REQ_QUEUED 1 85 #define REQSTATE_REQ_WAITING_FOR_REPLY 2 86 #define REQSTATE_REQ_GOT 3 87 #define REQSTATE_INVOKING 4 88 #define REQSTATE_RESP_QUEUED 5 89 #define REQSTATE_RESP_GOT 6 90 #define REQSTATE_DONE 6 91 92 void STUBMGR_Start(); 93 94 extern HRESULT PIPE_GetNewPipeBuf(wine_marshal_id *mid, IRpcChannelBuffer **pipebuf); 7 95 8 96 /* This function initialize the Running Object Table */ … … 13 101 14 102 /* This function decomposes a String path to a String Table containing all the elements ("\" or "subDirectory" or "Directory" or "FileName") of the path */ 15 int WINAPI FileMonikerImpl_DecomposePath(LP OLESTR str, LPOLESTR** stringTable);103 int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable); 16 104 17 105 #endif /* __WINE_OLE_COMPOBJ_H */ -
trunk/src/ole32/compositemoniker.c
r7502 r7926 17 17 #include "ole2.h" 18 18 19 #ifdef __WIN32OS2__20 #undef FIXME21 #undef TRACE22 #ifdef DEBUG23 // PH 2001-11-3024 // this macro definition causes the control leave the scope of a25 // non-curly-braced preceeding if statement. Therefore,26 // if (p!=NULL)27 // TRACE("p->a=%d", p->a)28 // crashes.29 //30 // !!! ENSURE TRACES AND FIXMES WITH PRECEEDING IF STATEMENT31 // !!! ARE PUT INTO CURLY BRACES32 #define TRACE WriteLog("OLE32: %s", __FUNCTION__); WriteLog33 #define FIXME WriteLog("FIXME OLE32: %s", __FUNCTION__); WriteLog34 #else35 #define TRACE 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)36 #define FIXME 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)37 #endif38 #endif39 40 19 DEFAULT_DEBUG_CHANNEL(ole); 41 20 … … 47 26 ICOM_VTABLE(IMoniker)* lpvtbl1; /* VTable relative to the IMoniker interface.*/ 48 27 49 /* The ROT (RunningObjectTable implementation) uses the IROTData interface to test whether 50 * two monikers are equal. That's whay IROTData interface is implemented by monikers. 28 /* The ROT (RunningObjectTable implementation) uses the IROTData 29 * interface to test whether two monikers are equal. That's why IROTData 30 * interface is implemented by monikers. 51 31 */ 52 32 ICOM_VTABLE(IROTData)* lpvtbl2; /* VTable relative to the IROTData interface.*/ … … 362 342 return E_FAIL; 363 343 364 else{ 365 FIXME("()"); 344 else 345 { 346 FIXME("()\n"); 347 /* FIXME: To whoever wrote this code: It's either return or break. it cannot be both! */ 366 348 break; 367 349 return E_NOTIMPL; … … 394 376 TRACE("(%p,%p,%d)\n",iface,pStm,fClearDirty); 395 377 396 /* this function call OleSaveToStream function for each moniker within this object */ 397 398 /* when I tested this function in windows system ! I usually found this constant in the begining of */ 399 /* the stream I dont known why (there's no indication in specification) ! */ 378 /* This function calls OleSaveToStream function for each moniker within 379 * this object. 380 * When I tested this function in windows, I usually found this constant 381 * at the beginning of the stream. I don't known why (there's no 382 * indication in the specification) ! 383 */ 400 384 res=IStream_Write(pStm,&constant,sizeof(constant),NULL); 401 385 … … 429 413 ULARGE_INTEGER ptmpSize; 430 414 431 /* the sizeMax of this object is calculated by calling GetSizeMax on each moniker within this object then */ 432 /* suming all returned sizemax */ 415 /* The sizeMax of this object is calculated by calling GetSizeMax on 416 * each moniker within this object then summing all returned values 417 */ 433 418 434 419 TRACE("(%p,%p)\n",iface,pcbSize); … … 469 454 TRACE("(%p,%p,%p)\n",This,pmkFirst,pmkRest); 470 455 471 /* Initialize the virtual f gunction table. */456 /* Initialize the virtual function table. */ 472 457 This->lpvtbl1 = &VT_CompositeMonikerImpl; 473 458 This->lpvtbl2 = &VT_ROTDataImpl; … … 483 468 IMoniker_IsSystemMoniker(pmkFirst,&mkSys); 484 469 485 /* put the first moniker contents in the begin ing of the table */470 /* put the first moniker contents in the beginning of the table */ 486 471 if (mkSys!=MKSYS_GENERICCOMPOSITE){ 487 472 … … 557 542 else{ 558 543 559 /* add a composite moniker to the moniker table (do the same thing for each moniker within the */ 560 /* composite moniker as a simple moniker (see above how to add a simple moniker case) ) */ 544 /* add a composite moniker to the moniker table (do the same thing 545 * for each moniker within the composite moniker as a simple moniker 546 * (see above for how to add a simple moniker case) ) 547 */ 561 548 IMoniker_Enum(pmkRest,TRUE,&enumMoniker); 562 549 … … 1664 1651 1665 1652 /****************************************************************************** 1666 * CreateGenericComposite [OLE .55]1653 * CreateGenericComposite [OLE32.56] 1667 1654 ******************************************************************************/ 1668 1655 HRESULT WINAPI CreateGenericComposite(LPMONIKER pmkFirst, LPMONIKER pmkRest, LPMONIKER* ppmkComposite) … … 1713 1700 1714 1701 /****************************************************************************** 1715 * MonikerCommonPrefixWith [OLE .55]1702 * MonikerCommonPrefixWith [OLE32.82] 1716 1703 ******************************************************************************/ 1717 1704 HRESULT WINAPI MonikerCommonPrefixWith(IMoniker* pmkThis,IMoniker* pmkOther,IMoniker** ppmkCommon) -
trunk/src/ole32/errorinfo.c
r6711 r7926 10 10 11 11 #include <string.h> 12 #include "debugtools.h" 12 13 13 #include "windef.h" 14 #include "heap.h" 14 #include "winbase.h" 15 #include "oleauto.h" 15 16 #include "winerror.h" 16 #include "thread.h" 17 #include "debugtools.h" 17 18 18 #include "wine/obj_base.h" 19 19 #include "wine/obj_oleaut.h" 20 20 #include "wine/obj_errorinfo.h" 21 21 #include "wine/unicode.h" 22 #include "thread.h" 23 24 #include "debugtools.h" 22 25 23 26 DEFAULT_DEBUG_CHANNEL(ole); … … 41 44 /* 42 45 * Allocate a new buffer to hold the string. 43 * dont't forget to keep an empty spot at the begin ing of the46 * dont't forget to keep an empty spot at the beginning of the 44 47 * buffer for the character count and an extra character at the 45 * end for the NULL.48 * end for the '\0'. 46 49 */ 47 50 newBuffer = (DWORD*)HeapAlloc(GetProcessHeap(), … … 448 451 }; 449 452 /*********************************************************************** 450 * CreateErrorInfo 453 * CreateErrorInfo (OLE32.192) 451 454 */ 452 455 HRESULT WINAPI CreateErrorInfo(ICreateErrorInfo **pperrinfo) … … 464 467 465 468 /*********************************************************************** 466 * GetErrorInfo 469 * GetErrorInfo (OLE32.196) 467 470 */ 468 471 HRESULT WINAPI GetErrorInfo(ULONG dwReserved, IErrorInfo **pperrinfo) … … 479 482 480 483 /*********************************************************************** 481 * SetErrorInfo 484 * SetErrorInfo (OLE32.255) 482 485 */ 483 486 HRESULT WINAPI SetErrorInfo(ULONG dwReserved, IErrorInfo *perrinfo) -
trunk/src/ole32/filemoniker.c
r6711 r7926 85 85 HRESULT WINAPI FileMonikerImpl_Construct(FileMonikerImpl* iface, LPCOLESTR lpszPathName); 86 86 HRESULT WINAPI FileMonikerImpl_Destroy(FileMonikerImpl* iface); 87 int WINAPI FileMonikerImpl_DecomposePath(LP OLESTR str, LPOLESTR** tabStr);87 int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** tabStr); 88 88 89 89 … … 322 322 BOOL fClearDirty)/* Specifies whether to clear the dirty flag */ 323 323 { 324 /* this function saves data of this object. In the begining I thougth that I have just to write 325 * the filePath string on Stream. But, when I tested this function whith windows programs samples ! 326 * I noted that it was not the case. So I analysed data written by this function on Windows system and 327 * what did this function do exactly ! but I have no idear a bout its logic ! 328 * I guessed data who must be written on stream wich is: 329 * 1) WORD constant:zero 2) length of the path string ("\0" included) 3) path string type A 330 * 4) DWORD constant : 0xDEADFFFF 5) ten WORD constant: zero 6) DWORD: double-length of the the path 331 * string type W ("\0" not included) 7) WORD constant: 0x3 8) filePath unicode string. 332 * if the length(filePath) > 8 or.length(filePath) == 8 stop at step 5) 324 /* this function saves data of this object. In the beginning I thougth 325 * that I have just to write the filePath string on Stream. But, when I 326 * tested this function whith windows programs samples, I noticed that it 327 * was not the case. So I analysed data written by this function on 328 * Windows and what this did function exactly ! But I have no idea about 329 * its logic ! 330 * I guessed data which must be written on stream is: 331 * 1) WORD constant:zero 332 * 2) length of the path string ("\0" included) 333 * 3) path string type A 334 * 4) DWORD constant : 0xDEADFFFF 335 * 5) ten WORD constant: zero 336 * 6) DWORD: double-length of the the path string type W ("\0" not 337 * included) 338 * 7) WORD constant: 0x3 339 * 8) filePath unicode string. 340 * if the length(filePath) > 8 or length(filePath) == 8 stop at step 5) 333 341 */ 334 342 … … 596 604 if (pca!=NULL){ 597 605 598 FIXME("() ");606 FIXME("()\n"); 599 607 600 608 /*res=GetClassFile(This->filePathName,&clsID); … … 611 619 }*/ 612 620 } 613 }621 } 614 622 615 623 if (pObj!=NULL){ … … 689 697 FIXME("(%p,%p,%p,%p,%p)\n",iface,pbc,pmkToLeft,riid,ppvObject); 690 698 691 return E_NOTIMPL;692 }699 return E_NOTIMPL; 700 } 693 701 return res; 694 702 } … … 893 901 h = (h * 39) + val[off]; 894 902 } 895 }903 } 896 904 897 905 *pdwHash=h; … … 965 973 966 974 *pFileTime=info.ftLastWriteTime; 967 }975 } 968 976 969 977 return S_OK; … … 1036 1044 machimeNameCase=FALSE; 1037 1045 break; 1038 }1046 } 1039 1047 } 1040 1048 … … 1069 1077 * DecomposePath (local function) 1070 1078 ******************************************************************************/ 1071 int WINAPI FileMonikerImpl_DecomposePath(LP OLESTR str, LPOLESTR** stringTable)1079 int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable) 1072 1080 { 1073 1081 WCHAR bSlash[] = {'\\',0}; … … 1302 1310 1303 1311 /****************************************************************************** 1304 * CreateFileMoniker 161312 * CreateFileMoniker (OLE2.28) 1305 1313 ******************************************************************************/ 1306 1314 HRESULT WINAPI CreateFileMoniker16(LPCOLESTR16 lpszPathName,LPMONIKER* ppmk) … … 1312 1320 1313 1321 /****************************************************************************** 1314 * CreateFileMoniker 1322 * CreateFileMoniker (OLE32.55) 1315 1323 ******************************************************************************/ 1316 1324 HRESULT WINAPI CreateFileMoniker(LPCOLESTR lpszPathName, LPMONIKER * ppmk) -
trunk/src/ole32/hglobalstream.c
r6711 r7926 7 7 * Copyright 1999 Francis Beaudet 8 8 */ 9 10 #include "config.h" 11 9 12 #include <assert.h> 10 13 #include <stdlib.h> … … 12 15 #include <string.h> 13 16 17 #include "windef.h" 18 #include "objbase.h" 19 #include "ole2.h" 14 20 #include "winbase.h" 15 21 #include "winerror.h" 22 16 23 #include "debugtools.h" 17 18 #include "objbase.h"19 24 20 25 DEFAULT_DEBUG_CHANNEL(storage); … … 257 262 258 263 /* 259 * Start the stream at the begin ing.264 * Start the stream at the beginning. 260 265 */ 261 266 newStream->currentPosition.s.HighPart = 0; -
trunk/src/ole32/ifs.c
r6711 r7926 5 5 */ 6 6 7 #include "config.h" 8 7 9 #include <ctype.h> 8 10 #include <stdlib.h> 9 11 #include <string.h> 10 12 #include <assert.h> 13 14 #include "ole2.h" 15 #include "windef.h" 11 16 #include "winerror.h" 12 #include "heap.h" 17 18 #include "wine/obj_base.h" 13 19 #include "wine/winbase16.h" 14 #include "wine/obj_base.h" 20 #include "ifs.h" 21 15 22 #include "debugtools.h" 16 17 #include "ole.h"18 #include "ifs.h"19 23 20 24 DEFAULT_DEBUG_CHANNEL(relay); … … 139 143 ICOM_THIS(IMalloc16Impl,iface); 140 144 TRACE("(%p)->Alloc(%ld)\n",This,cb); 141 return MapLS( HeapAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, cb ) );145 return MapLS( HeapAlloc( GetProcessHeap(), 0, cb ) ); 142 146 } 143 147 … … 145 149 * IMalloc16_Realloc [COMPOBJ.504] 146 150 */ 147 SEGPTR WINAPI IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb) { 148 ICOM_THIS(IMalloc16Impl,iface); 149 TRACE("(%p)->Realloc(%08lx,%ld)\n",This,pv,cb); 150 return MapLS( HeapReAlloc( GetProcessHeap(), HEAP_WINE_SEGPTR, MapSL(pv), cb ) ); 151 SEGPTR WINAPI IMalloc16_fnRealloc(IMalloc16* iface,SEGPTR pv,DWORD cb) 152 { 153 SEGPTR ret; 154 ICOM_THIS(IMalloc16Impl,iface); 155 TRACE("(%p)->Realloc(%08lx,%ld)\n",This,pv,cb); 156 ret = MapLS( HeapReAlloc( GetProcessHeap(), 0, MapSL(pv), cb ) ); 157 UnMapLS(pv); 158 return ret; 151 159 } 152 160 … … 154 162 * IMalloc16_Free [COMPOBJ.505] 155 163 */ 156 VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv) { 157 ICOM_THIS(IMalloc16Impl,iface); 158 TRACE("(%p)->Free(%08lx)\n",This,pv); 159 HeapFree( GetProcessHeap(), HEAP_WINE_SEGPTR, MapSL(pv) ); 164 VOID WINAPI IMalloc16_fnFree(IMalloc16* iface,SEGPTR pv) 165 { 166 void *ptr = MapSL(pv); 167 ICOM_THIS(IMalloc16Impl,iface); 168 TRACE("(%p)->Free(%08lx)\n",This,pv); 169 UnMapLS(pv); 170 HeapFree( GetProcessHeap(), 0, ptr ); 160 171 } 161 172 … … 167 178 ICOM_CTHIS(IMalloc16Impl,iface); 168 179 TRACE("(%p)->GetSize(%08lx)\n",This,pv); 169 return HeapSize( GetProcessHeap(), HEAP_WINE_SEGPTR, MapSL(pv) );180 return HeapSize( GetProcessHeap(), 0, MapSL(pv) ); 170 181 } 171 182 … … 188 199 } 189 200 190 static ICOM_VTABLE(IMalloc16)* msegvt16 = NULL;191 192 201 /****************************************************************************** 193 202 * IMalloc16_Constructor [VTABLE] 194 203 */ 195 204 LPMALLOC16 196 IMalloc16_Constructor() { 197 IMalloc16Impl* This; 198 HMODULE16 hcomp = GetModuleHandle16("COMPOBJ"); 199 200 This = (IMalloc16Impl*)SEGPTR_NEW(IMalloc16Impl); 201 if (!msegvt16) { 202 msegvt16 = SEGPTR_NEW(ICOM_VTABLE(IMalloc16)); 203 204 #define VTENT(x) msegvt16->x = (void*)GetProcAddress16(hcomp,"IMalloc16_"#x);assert(msegvt16->x) 205 VTENT(QueryInterface); 206 VTENT(AddRef); 207 VTENT(Release); 208 VTENT(Alloc); 209 VTENT(Realloc); 210 VTENT(Free); 211 VTENT(GetSize); 212 VTENT(DidAlloc); 213 VTENT(HeapMinimize); 205 IMalloc16_Constructor() 206 { 207 static ICOM_VTABLE(IMalloc16) vt16; 208 static SEGPTR msegvt16; 209 IMalloc16Impl* This; 210 HMODULE16 hcomp = GetModuleHandle16("COMPOBJ"); 211 212 This = HeapAlloc( GetProcessHeap(), 0, sizeof(IMalloc16Impl) ); 213 if (!msegvt16) 214 { 215 #define VTENT(x) vt16.x = (void*)GetProcAddress16(hcomp,"IMalloc16_"#x);assert(vt16.x) 216 VTENT(QueryInterface); 217 VTENT(AddRef); 218 VTENT(Release); 219 VTENT(Alloc); 220 VTENT(Realloc); 221 VTENT(Free); 222 VTENT(GetSize); 223 VTENT(DidAlloc); 224 VTENT(HeapMinimize); 214 225 #undef VTENT 215 } 216 ICOM_VTBL(This) = (ICOM_VTABLE(IMalloc16)*)SEGPTR_GET(msegvt16); 217 This->ref = 1; 218 return (LPMALLOC16)SEGPTR_GET(This); 226 msegvt16 = MapLS( &vt16 ); 227 } 228 ICOM_VTBL(This) = (ICOM_VTABLE(IMalloc16)*)msegvt16; 229 This->ref = 1; 230 return (LPMALLOC16)MapLS( This ); 219 231 } 220 232 #endif -
trunk/src/ole32/imessagefilter.cpp
r4274 r7926 1 /* $Id: imessagefilter.cpp,v 1. 1 2000-09-17 10:31:04 davidrExp $ */1 /* $Id: imessagefilter.cpp,v 1.2 2002-02-15 17:18:49 sandervl Exp $ */ 2 2 /* 3 3 * … … 170 170 } 171 171 172 //*******************************************************************************173 //*******************************************************************************174 HRESULT WIN32API CoRegisterMessageFilter(LPMESSAGEFILTER lpMessageFilter,175 LPMESSAGEFILTER *lplpMessageFilter)176 {177 dprintf(("OLE32: CoRegisterMessageFilter - stub"));178 if (lplpMessageFilter)179 *lplpMessageFilter = NULL;180 return S_FALSE;181 }182 -
trunk/src/ole32/itemmoniker.c
r6711 r7926 557 557 tempMkComposite=*ppmkComposite; 558 558 IMoniker_AddRef(tempMkComposite); 559 }559 } 560 560 return res; 561 561 } … … 646 646 for (i = len ; i > 0; i--) { 647 647 h = (h * 37) + val[off++]; 648 }648 } 649 649 } else { 650 650 /* only sample some characters */ … … 748 748 749 749 IMoniker_Release(compositeMk); 750 }750 } 751 751 752 752 return res; … … 858 858 else{ 859 859 /* Otherwise, the method calls IMoniker::BindToObject on the pmkToLeft parameter, requesting an */ 860 /* IParseDisplayName interface pointer to the object identified by the moniker, and passes the display */ /* name to IParseDisplayName::ParseDisplayName */ 860 /* IParseDisplayName interface pointer to the object identified by the moniker, and passes the display */ 861 /* name to IParseDisplayName::ParseDisplayName */ 861 862 res=IMoniker_BindToObject(pmkToLeft,pbc,NULL,&IID_IOleItemContainer,(void**)&poic); 862 863 … … 872 873 IParseDisplayName_Release(ppdn); 873 874 } 874 }875 } 875 876 return res; 876 877 } … … 952 953 953 954 /****************************************************************************** 954 * CreateItemMoniker [OLE .55]955 * CreateItemMoniker [OLE32.58] 955 956 ******************************************************************************/ 956 957 HRESULT WINAPI CreateItemMoniker(LPCOLESTR lpszDelim,LPCOLESTR lpszItem, LPMONIKER * ppmk) -
trunk/src/ole32/memlockbytes.c
r6711 r7926 7 7 */ 8 8 9 #include "config.h" 10 9 11 #include <string.h> 12 13 #include "windef.h" 14 #include "objbase.h" 15 #include "ole2.h" 10 16 #include "winbase.h" 11 17 #include "winerror.h" 12 #include "objbase.h"13 18 14 19 #include "debugtools.h" -
trunk/src/ole32/moniker.c
r6711 r7926 16 16 #include "wine/obj_misc.h" 17 17 #include "wine/obj_moniker.h" 18 #ifdef __WIN32OS2__ 19 #include "wine/obj_channel.h" 20 #endif 21 18 22 #include "debugtools.h" 19 #include "heap.h"20 23 #include "ole2.h" 21 24 22 25 #include "compobj_private.h" 23 24 #ifdef __WIN32OS2__25 #undef FIXME26 #undef TRACE27 #ifdef DEBUG28 #define TRACE WriteLog("OLE32: %s", __FUNCTION__); WriteLog29 #define FIXME WriteLog("FIXME OLE32: %s", __FUNCTION__); WriteLog30 #else31 #define TRACE 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)32 #define FIXME 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)33 #endif34 #endif35 26 36 27 DEFAULT_DEBUG_CHANNEL(ole); … … 290 281 FIXME("runObjTabRegister: %ld is out of data limite \n",This->runObjTabRegister); 291 282 return E_FAIL; 292 }283 } 293 284 This->runObjTabRegister++; 294 285 This->runObjTabLastIndx++; … … 468 459 469 460 /****************************************************************************** 470 * GetRunningObjectTable 16[OLE2.30]461 * GetRunningObjectTable [OLE2.30] 471 462 */ 472 463 HRESULT WINAPI GetRunningObjectTable16(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot) … … 477 468 478 469 /*********************************************************************** 479 * GetRunningObjectTable (OLE 2.73)470 * GetRunningObjectTable (OLE32.73) 480 471 */ 481 472 HRESULT WINAPI GetRunningObjectTable(DWORD reserved, LPRUNNINGOBJECTTABLE *pprot) … … 505 496 ICOM_THIS(IRunnableObject,pUnknown); 506 497 LRESULT ret; 507 508 #ifdef __WIN32OS2__509 if(!IsValidInterface(pUnknown)) {510 return E_INVALIDARG;511 }512 #endif513 498 514 499 ret = IRunnableObject_QueryInterface(This,&IID_IRunnableObject,(LPVOID*)&runable); -
trunk/src/ole32/ole2.c
r6711 r7926 1 1 2 /* 2 3 * OLE2 library … … 6 7 * Copyright 1999 Noel Borthwick 7 8 */ 9 10 #include "config.h" 8 11 9 12 #include <assert.h> … … 12 15 #include <string.h> 13 16 17 #include "commctrl.h" 18 #include "ole2.h" 19 #include "ole2ver.h" 14 20 #include "windef.h" 15 21 #include "winbase.h" 16 #include "win gdi.h"22 #include "winerror.h" 17 23 #include "winuser.h" 18 #include "winerror.h" 19 #include "ole2.h" 20 #include "commctrl.h" 24 #include "winreg.h" 25 21 26 #include "wine/obj_clientserver.h" 22 27 #include "wine/winbase16.h" 23 28 #include "wine/wingdi16.h" 24 29 #include "wine/winuser16.h" 30 #include "ole32_main.h" 31 25 32 #include "debugtools.h" 26 #include "ole2ver.h"27 #include "winreg.h"28 #include "ole32_main.h"29 33 30 34 DEFAULT_DEBUG_CHANNEL(ole); … … 146 150 /****************************************************************************** 147 151 * OleBuildVersion [OLE2.1] 152 * OleBuildVersion [OLE32.84] 148 153 */ 149 154 DWORD WINAPI OleBuildVersion(void) … … 154 159 155 160 /*********************************************************************** 156 * OleInitialize (OLE2.2) (OLE32.108) 161 * OleInitialize (OLE2.2) 162 * OleInitialize (OLE32.108) 157 163 */ 158 164 HRESULT WINAPI OleInitialize(LPVOID reserved) … … 183 189 */ 184 190 if (OLE_moduleLockCount==0) 185 {191 { 186 192 /* 187 193 * Initialize the libraries. … … 203 209 */ 204 210 OLEMenu_Initialize(); 205 }211 } 206 212 207 213 /* … … 214 220 215 221 /****************************************************************************** 216 * CoGetCurrentProcess [COMPOBJ.34] [OLE2.2][OLE32.108] 222 * CoGetCurrentProcess [COMPOBJ.34] 223 * CoGetCurrentProcess [OLE32.18] 217 224 * 218 225 * NOTES … … 225 232 226 233 /****************************************************************************** 227 * OleUninitialize [OLE2.3] [OLE32.131] 234 * OleUninitialize [OLE2.3] 235 * OleUninitialize [OLE32.131] 228 236 */ 229 237 void WINAPI OleUninitialize(void) … … 268 276 } 269 277 270 #ifndef __WIN32OS2__271 //imessagefilter.cpp272 278 /****************************************************************************** 273 279 * CoRegisterMessageFilter [OLE32.38] … … 283 289 return S_OK; 284 290 } 285 #endif286 291 287 292 /****************************************************************************** … … 294 299 295 300 /*********************************************************************** 296 * RegisterDragDrop 16(OLE2.35)301 * RegisterDragDrop (OLE2.35) 297 302 */ 298 303 HRESULT WINAPI RegisterDragDrop16( … … 348 353 349 354 /*********************************************************************** 350 * RevokeDragDrop 16(OLE2.36)355 * RevokeDragDrop (OLE2.36) 351 356 */ 352 357 HRESULT WINAPI RevokeDragDrop16( … … 1067 1072 * The Edit, Object & Help groups belong to the server object 1068 1073 * and the other three belong to the container. 1069 * Loop thr uthe group widths and locate the group we are a member of.1074 * Loop through the group widths and locate the group we are a member of. 1070 1075 */ 1071 1076 for ( i = 0, nWidth = 0; i < 6; i++ ) … … 1413 1418 1414 1419 if(!lpMsg) return FALSE; 1420 1415 1421 #ifdef __WIN32OS2__ 1416 1422 if (!hAccel || !(lpAccelTbl = (LPACCEL16)LockResource(hAccel))) … … 1546 1552 (pmedium->u.hMetaFilePict!=0) ) 1547 1553 { 1548 LPMETAFILEPICT pMP = GlobalLock(pmedium->u.h MetaFilePict);1554 LPMETAFILEPICT pMP = GlobalLock(pmedium->u.hGlobal); 1549 1555 DeleteMetaFile(pMP->hMF); 1550 GlobalUnlock(pmedium->u.h MetaFilePict);1551 GlobalFree(pmedium->u.h MetaFilePict);1556 GlobalUnlock(pmedium->u.hGlobal); 1557 GlobalFree(pmedium->u.hGlobal); 1552 1558 } 1553 1559 … … 2200 2206 #ifndef __WIN32OS2__ 2201 2207 /****************************************************************************** 2202 * OleMetaFilePictFromIconAndLabel 2208 * OleMetaFilePictFromIconAndLabel (OLE2.56) 2203 2209 * 2204 2210 * Returns a global memory handle to a metafile which contains the icon and … … 2243 2249 } 2244 2250 #endif 2251 2245 2252 /****************************************************************************** 2246 * DllDebugObjectRPCHook 2253 * DllDebugObjectRPCHook (OLE32.62) 2247 2254 * turns on and off internal debugging, pointer is only used on macintosh 2248 2255 */ -
trunk/src/ole32/ole2impl.c
r6711 r7926 19 19 20 20 /****************************************************************************** 21 * Function : OleQueryCreateFromData [OLE32.117] 21 * OleQueryCreateFromData [OLE32.117] 22 * 22 23 * Author : Abey George 23 24 * Checks whether an object can become an embedded object. … … 66 67 67 68 /****************************************************************************** 68 * Function : OleCreateFromData [OLE32.92] 69 * OleCreateFromData [OLE32.92] 70 * 69 71 * Author : Abey George 70 72 * Creates an embedded object from data transfer object retrieved from -
trunk/src/ole32/ole2stubs.c
r6711 r7926 8 8 #include "windef.h" 9 9 #include "winbase.h" 10 #include "wingdi.h"11 10 #include "winuser.h" 12 11 #include "ole2.h" … … 59 58 60 59 /****************************************************************************** 61 * CoTreatAsClass [OLE32.46]62 */63 HRESULT WINAPI CoTreatAsClass(REFCLSID clsidOld, REFCLSID clsidNew)64 {65 FIXME("(%p,%p), stub!\n", clsidOld, clsidNew);66 return S_OK;67 }68 69 /******************************************************************************70 60 * SetConvertStg [OLE32.142] 71 61 */ … … 77 67 78 68 /****************************************************************************** 79 * OleCreate [OLE32.8 0]69 * OleCreate [OLE32.89] 80 70 * 81 71 */ … … 252 242 253 243 /*********************************************************************** 254 * CoIsOle1Class [OLE32 ]244 * CoIsOle1Class [OLE32.29] 255 245 */ 256 246 BOOL WINAPI CoIsOle1Class(REFCLSID clsid) -
trunk/src/ole32/ole32.cpp
r5602 r7926 1 /* $Id: ole32.cpp,v 1.1 5 2001-04-26 19:32:49sandervl Exp $ */1 /* $Id: ole32.cpp,v 1.16 2002-02-15 17:18:50 sandervl Exp $ */ 2 2 /* 3 3 * … … 42 42 return FileTimeToDosDateTime(lpFileTime, lpDosDate, lpDosTime); 43 43 } 44 45 // ---------------------------------------------------------------------- 46 // CLSIDFromStringA() 47 // @@@PH: this is not a WINE API, but a replacement for CLSIDFromString16 48 // which used to accept ASCII strings instead of OLE strings 49 // ---------------------------------------------------------------------- 50 51 HRESULT WIN32API CLSIDFromStringA( 52 LPCSTR lpsz, // [in] - ASCII string CLSID 53 LPCLSID pclsid) // [out] - Binary CLSID 54 { 55 return CLSIDFromString16(lpsz, pclsid); 56 } -
trunk/src/ole32/ole32.mak
r7909 r7926 1 # $Id: ole32.mak,v 1.1 6 2002-02-15 13:57:40 sandervl Exp $1 # $Id: ole32.mak,v 1.17 2002-02-15 17:18:50 sandervl Exp $ 2 2 3 3 # … … 49 49 $(OBJDIR)\imessagefilter.obj \ 50 50 $(OBJDIR)\memlockbytes.obj \ 51 $(OBJDIR)\moniker.obj \52 51 $(OBJDIR)\oString.obj \ 53 52 $(OBJDIR)\ole2impl.obj \ … … 63 62 $(OBJDIR)\stg_stream.obj \ 64 63 $(OBJDIR)\storage32.obj \ 64 $(OBJDIR)\marshal.obj \ 65 $(OBJDIR)\oleproxy.obj \ 66 $(OBJDIR)\rpc.obj \ 67 $(OBJDIR)\moniker.obj \ 65 68 $(OBJDIR)\stubs.obj \ 66 69 $(OBJDIR)\ifs.obj \ -
trunk/src/ole32/ole32_main.c
r6711 r7926 4 4 */ 5 5 #include "windef.h" 6 #ifdef __WIN32OS2__7 #include "winbase.h"8 #endif9 6 #include "winerror.h" 10 7 #include "ole32_main.h" … … 26 23 case DLL_PROCESS_ATTACH: 27 24 OLE32_hInstance = hinstDLL; 25 COMPOBJ_InitProcess(); 28 26 break; 29 27 30 28 case DLL_PROCESS_DETACH: 29 COMPOBJ_UninitProcess(); 31 30 OLE32_hInstance = 0; 32 31 break; … … 36 35 37 36 /*********************************************************************** 38 * DllRegisterServer (OLE32. @)37 * DllRegisterServer (OLE32.194) 39 38 */ 40 39 HRESULT WINAPI OLE32_DllRegisterServer() { -
trunk/src/ole32/ole32_main.h
r5602 r7926 6 6 extern HINSTANCE OLE32_hInstance; 7 7 8 void COMPOBJ_InitProcess( void ); 9 void COMPOBJ_UninitProcess( void ); 10 8 11 #endif /* __WINE_OLE32_MAIN_H */ -
trunk/src/ole32/olestd.h
r5918 r7926 8 8 #define __WINE_OLESTD_H_ 9 9 10 #if !defined(__cplusplus) && !defined( __TURBOC__) && !defined(NONAMELESSUNION)10 #if !defined(__cplusplus) && !defined( __TURBOC__) 11 11 #define NONAMELESSUNION /* use strict ANSI standard (for DVOBJ.H) */ 12 12 #endif -
trunk/src/ole32/stg_stream.c
r6711 r7926 10 10 */ 11 11 #ifdef __WIN32OS2__ 12 13 #include <odin.h>14 12 #include "ole32.h" 15 13 #include "heapstring.h" 16 17 14 #endif 15 18 16 #include <assert.h> 19 17 #include <stdlib.h> … … 27 25 28 26 #include "storage32.h" 29 30 #ifdef __WIN32OS2__31 #undef FIXME32 #undef TRACE33 #ifdef DEBUG34 #define TRACE WriteLog("OLE32: %s", __FUNCTION__); WriteLog35 #define FIXME WriteLog("FIXME OLE32: %s", __FUNCTION__); WriteLog36 #else37 #define TRACE 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)38 #define FIXME 1 ? (void)0 : (void)((int (*)(char *, ...)) NULL)39 #endif40 #endif41 27 42 28 DEFAULT_DEBUG_CHANNEL(storage); … … 104 90 105 91 /* 106 * Start the stream at the begin ing.92 * Start the stream at the beginning. 107 93 */ 108 94 newStream->currentPosition.s.HighPart = 0; … … 266 252 267 253 /* 268 * Make sure no old object is staying behind.254 * Make sure no old object is left over. 269 255 */ 270 256 if (This->smallBlockChain != 0) … … 323 309 * This method is part of the ISequentialStream interface. 324 310 * 325 * I freads a block of information from the stream at the current311 * It reads a block of information from the stream at the current 326 312 * position. It then moves the current position at the end of the 327 313 * read block … … 339 325 ULONG bytesReadBuffer; 340 326 ULONG bytesToReadFromBuffer; 327 HRESULT res = S_FALSE; 341 328 342 329 TRACE("(%p, %p, %ld, %p)\n", … … 344 331 345 332 /* 346 * If the caller is not interested in the nu bmer of bytes read,333 * If the caller is not interested in the number of bytes read, 347 334 * we use another buffer to avoid "if" statements in the code. 348 335 */ … … 358 345 /* 359 346 * Depending on the type of chain that was opened when the stream was constructed, 360 * we delegate the work to the method that read the block chains.347 * we delegate the work to the method that reads the block chains. 361 348 */ 362 349 if (This->smallBlockChain!=0) … … 385 372 386 373 *pcbRead = 0; 387 return S_OK; 374 res = S_OK; 375 goto end; 388 376 } 389 377 … … 399 387 This->currentPosition.s.LowPart += *pcbRead; 400 388 401 /* 402 * The function returns S_OK if the buffer was filled completely 403 * it returns S_FALSE if the end of the stream is reached before the 404 * buffer is filled 405 */ 406 if(*pcbRead == cb) 407 return S_OK; 408 409 return S_FALSE; 389 if(*pcbRead != cb) 390 { 391 WARN("read %ld instead of the required %ld bytes !\n", *pcbRead, cb); 392 /* 393 * this used to return S_FALSE, however MSDN docu says that an app should 394 * be prepared to handle error in case of stream end reached, as *some* 395 * implementations *might* return an error (IOW: most do *not*). 396 * As some program fails on returning S_FALSE, I better use S_OK here. 397 */ 398 res = S_OK; 399 } 400 else 401 res = S_OK; 402 403 end: 404 TRACE("<-- %08lx\n", res); 405 return res; 410 406 } 411 407 … … 554 550 return STG_E_INVALIDFUNCTION; 555 551 } 552 556 553 #ifdef __WIN32OS2__ 557 554 /* … … 697 694 698 695 /* 699 * Write t o the property the new information about this stream696 * Write the new information about this stream to the property 700 697 */ 701 698 Success = StorageImpl_ReadProperty(This->parentStorage->ancestorStorage, … … 751 748 752 749 /* 753 * use stack to store data temporar ly754 * there is surely more performant way of doing it, for now this basic750 * use stack to store data temporarily 751 * there is surely a more performant way of doing it, for now this basic 755 752 * implementation will do the job 756 753 */ … … 771 768 772 769 /* 773 * Check that read & write operations were succes full770 * Check that read & write operations were successful 774 771 */ 775 772 if (bytesRead != bytesWritten) -
trunk/src/ole32/storage32.c
r7508 r7926 10 10 * Copyright 1999 Thuy Nguyen 11 11 */ 12 13 12 #ifdef __WIN32OS2__ 14 13 #include <odin.h> … … 36 35 37 36 #define FILE_BEGIN 0 38 39 37 40 38 … … 167 165 StorageBaseImpl_SetClass, 168 166 StorageImpl_SetStateBits, 169 Storage BaseImpl_Stat167 StorageImpl_Stat 170 168 }; 171 169 … … 343 341 StgProperty currentProperty; 344 342 ULONG foundPropertyIndex; 343 HRESULT res = STG_E_UNKNOWN; 345 344 346 345 TRACE("(%p, %s, %p, %lx, %ld, %p)\n", … … 351 350 */ 352 351 if ( (pwcsName==NULL) || (ppstm==0) ) 353 return E_INVALIDARG; 352 { 353 res = E_INVALIDARG; 354 goto end; 355 } 354 356 355 357 /* 356 358 * Initialize the out parameter 357 359 */ 358 *ppstm = 0;360 *ppstm = NULL; 359 361 360 362 /* … … 362 364 */ 363 365 if ( FAILED( validateSTGM(grfMode) )) 364 return STG_E_INVALIDFLAG; 366 { 367 res = STG_E_INVALIDFLAG; 368 goto end; 369 } 365 370 366 371 /* … … 370 375 (grfMode & STGM_DELETEONRELEASE) || 371 376 (grfMode & STGM_TRANSACTED) ) 372 return STG_E_INVALIDFUNCTION; 377 { 378 res = STG_E_INVALIDFUNCTION; 379 goto end; 380 } 373 381 374 382 /* … … 411 419 StgStreamImpl_AddRef(*ppstm); 412 420 413 return S_OK; 421 res = S_OK; 422 goto end; 414 423 } 415 424 416 return E_OUTOFMEMORY; 417 } 418 419 return STG_E_FILENOTFOUND; 425 res = E_OUTOFMEMORY; 426 goto end; 427 } 428 429 res = STG_E_FILENOTFOUND; 430 431 end: 432 if (res == S_OK) 433 TRACE("<-- IStream %p\n", *ppstm); 434 TRACE("<-- %08lx\n", res); 435 return res; 420 436 } 421 437 … … 441 457 StgProperty currentProperty; 442 458 ULONG foundPropertyIndex; 459 HRESULT res = STG_E_UNKNOWN; 443 460 444 461 TRACE("(%p, %s, %p, %lx, %p, %ld, %p)\n", … … 450 467 */ 451 468 if ( (This==0) || (pwcsName==NULL) || (ppstg==0) ) 452 return E_INVALIDARG; 469 { 470 res = E_INVALIDARG; 471 goto end; 472 } 473 474 /* as documented */ 475 if (snbExclude != NULL) 476 { 477 res = STG_E_INVALIDPARAMETER; 478 goto end; 479 } 453 480 454 481 /* … … 456 483 */ 457 484 if ( FAILED( validateSTGM(grfMode) )) 458 return STG_E_INVALIDFLAG; 485 { 486 res = STG_E_INVALIDFLAG; 487 goto end; 488 } 459 489 460 490 /* … … 464 494 (grfMode & STGM_DELETEONRELEASE) || 465 495 (grfMode & STGM_PRIORITY) ) 466 return STG_E_INVALIDFUNCTION; 496 { 497 res = STG_E_INVALIDFUNCTION; 498 goto end; 499 } 467 500 468 501 /* 469 502 * Initialize the out parameter 470 503 */ 471 *ppstg = 0;504 *ppstg = NULL; 472 505 473 506 /* … … 514 547 StorageBaseImpl_AddRef(*ppstg); 515 548 516 return S_OK; 549 res = S_OK; 550 goto end; 517 551 } 518 552 519 return STG_E_INSUFFICIENTMEMORY; 520 } 521 522 return STG_E_FILENOTFOUND; 553 res = STG_E_INSUFFICIENTMEMORY; 554 goto end; 555 } 556 557 res = STG_E_FILENOTFOUND; 558 559 end: 560 TRACE("<-- %08lx\n", res); 561 return res; 523 562 } 524 563 … … 587 626 ICOM_THIS(StorageBaseImpl,iface); 588 627 StgProperty curProperty; 589 BOOL readSuccessful; 628 BOOL readSuccessful; 629 HRESULT res = STG_E_UNKNOWN; 590 630 591 631 TRACE("(%p, %p, %lx)\n", … … 596 636 */ 597 637 if ( (This==0) || (pstatstg==0)) 598 return E_INVALIDARG; 638 { 639 res = E_INVALIDARG; 640 goto end; 641 } 599 642 600 643 /* … … 613 656 grfStatFlag); 614 657 615 return S_OK; 616 } 617 618 return E_FAIL; 658 res = S_OK; 659 goto end; 660 } 661 662 res = E_FAIL; 663 664 end: 665 if (res == S_OK) 666 { 667 TRACE("<-- STATSTG: pwcsName: %s, type: %ld, cbSize.Low/High: %ld/%ld, grfMode: %08lx, grfLocksSupported: %ld, grfStateBits: %08lx\n", debugstr_w(pstatstg->pwcsName), pstatstg->type, pstatstg->cbSize.s.LowPart, pstatstg->cbSize.s.HighPart, pstatstg->grfMode, pstatstg->grfLocksSupported, pstatstg->grfStateBits); 668 } 669 TRACE("<-- %08lx\n", res); 670 return res; 619 671 } 620 672 … … 1687 1739 1688 1740 1741 /************************************************************************ 1742 * StorageImpl_Stat (IStorage) 1743 * 1744 * This method will retrieve information about this storage object. 1745 * 1746 * See Windows documentation for more details on IStorage methods. 1747 */ 1748 HRESULT WINAPI StorageImpl_Stat( IStorage* iface, 1749 STATSTG* pstatstg, /* [out] */ 1750 DWORD grfStatFlag) /* [in] */ 1751 { 1752 StorageImpl* const This = (StorageImpl*)iface; 1753 HRESULT result = StorageBaseImpl_Stat( iface, pstatstg, grfStatFlag ); 1754 1755 if ( !FAILED(result) && ((grfStatFlag & STATFLAG_NONAME) == 0) && This->pwcsName ) 1756 { 1757 CoTaskMemFree(pstatstg->pwcsName); 1758 pstatstg->pwcsName = CoTaskMemAlloc((lstrlenW(This->pwcsName)+1)*sizeof(WCHAR)); 1759 strcpyW(pstatstg->pwcsName, This->pwcsName); 1760 } 1761 1762 return result; 1763 } 1764 1765 1766 1689 1767 /********************************************************************* 1690 1768 * … … 2083 2161 const FILETIME *pmtime) /* [in] */ 2084 2162 { 2085 FIXME(" not implemented!\n");2086 return E_NOTIMPL;2163 FIXME("(%s,...), stub!\n",debugstr_w(pwcsName)); 2164 return S_OK; 2087 2165 } 2088 2166 … … 2102 2180 StorageImpl* This, 2103 2181 HANDLE hFile, 2182 LPCOLESTR pwcsName, 2104 2183 ILockBytes* pLkbyt, 2105 2184 DWORD openFlags, … … 2111 2190 BOOL readSuccessful; 2112 2191 ULONG currentPropertyIndex; 2113 2192 2114 2193 if ( FAILED( validateSTGM(openFlags) )) 2115 2194 return STG_E_INVALIDFLAG; … … 2118 2197 2119 2198 /* 2120 * Initialize the virtual f gunction table.2199 * Initialize the virtual function table. 2121 2200 */ 2122 2201 ICOM_VTBL(This) = &Storage32Impl_Vtbl; … … 2124 2203 2125 2204 /* 2126 * This is the top-level storage so initialize the ancest er pointer2205 * This is the top-level storage so initialize the ancestor pointer 2127 2206 * to this. 2128 2207 */ … … 2134 2213 This->hFile = hFile; 2135 2214 2215 /* 2216 * Store copy of file path. 2217 */ 2218 if(pwcsName) { 2219 This->pwcsName = HeapAlloc(GetProcessHeap(), 0, 2220 (lstrlenW(pwcsName)+1)*sizeof(WCHAR)); 2221 if (!This->pwcsName) 2222 return STG_E_INSUFFICIENTMEMORY; 2223 strcpyW(This->pwcsName, pwcsName); 2224 } 2225 2136 2226 /* 2137 2227 * Initialize the big block cache. … … 2251 2341 2252 2342 /* 2253 * Find the ID of the root in the property sets.2343 * Find the ID of the root in the property sets. 2254 2344 */ 2255 2345 currentPropertyIndex = 0; … … 2296 2386 { 2297 2387 TRACE("(%p)\n", This); 2388 2389 if(This->pwcsName) 2390 HeapFree(GetProcessHeap(), 0, This->pwcsName); 2298 2391 2299 2392 BlockChainStream_Destroy(This->smallBlockRootChain); … … 2881 2974 * blocks, just make sure they are what we're expecting. 2882 2975 */ 2883 assert( (This->bigBlockSize==DEF_BIG_BLOCK_SIZE) && 2884 (This->smallBlockSize==DEF_SMALL_BLOCK_SIZE)); 2976 if (This->bigBlockSize != DEF_BIG_BLOCK_SIZE || 2977 This->smallBlockSize != DEF_SMALL_BLOCK_SIZE) 2978 { 2979 WARN("Broken OLE storage file\n"); 2980 hr = STG_E_INVALIDHEADER; 2981 } 2982 else 2983 hr = S_OK; 2885 2984 2886 2985 /* … … 2888 2987 */ 2889 2988 StorageImpl_ReleaseBigBlock(This, headerBigBlock); 2890 2891 hr = S_OK;2892 2989 } 2893 2990 … … 3016 3113 currentProperty, 3017 3114 &bytesRead); 3018 3115 3019 3116 if (readSuccessful) 3020 3117 { 3118 /* replace the name of root entry (often "Root Entry") by the file name */ 3119 WCHAR *propName = (index == This->rootPropertySetIndex) ? 3120 This->filename : (WCHAR *)currentProperty+OFFSET_PS_NAME; 3121 3021 3122 memset(buffer->name, 0, sizeof(buffer->name)); 3022 3123 memcpy( 3023 3124 buffer->name, 3024 currentProperty+OFFSET_PS_NAME,3125 propName, 3025 3126 PROPERTY_NAME_BUFFER_LEN ); 3127 TRACE("storage name: %s\n", debugstr_w(buffer->name)); 3026 3128 3027 3129 memcpy(&buffer->propertyType, currentProperty + OFFSET_PS_PROPERTYTYPE, 1); … … 5368 5470 newStorage, 5369 5471 hFile, 5472 pwcsName, 5370 5473 NULL, 5371 5474 grfMode, … … 5406 5509 DWORD shareMode; 5407 5510 DWORD accessMode; 5511 WCHAR fullname[MAX_PATH]; 5512 WIN32_FILE_ATTRIBUTE_DATA Fad; 5408 5513 5409 5514 TRACE("(%s, %p, %lx, %p, %ld, %p)\n", … … 5415 5520 */ 5416 5521 if (( pwcsName == 0) || (ppstgOpen == 0) ) 5417 return STG_E_INVALIDPOINTER; 5522 { 5523 hr = STG_E_INVALIDPOINTER; 5524 goto end; 5525 } 5418 5526 5419 5527 /* … … 5421 5529 */ 5422 5530 if ( FAILED( validateSTGM(grfMode) )) 5423 return STG_E_INVALIDFLAG; 5531 { 5532 hr = STG_E_INVALIDFLAG; 5533 goto end; 5534 } 5424 5535 5425 5536 /* … … 5445 5556 if (hFile==INVALID_HANDLE_VALUE) 5446 5557 { 5447 HRESULT hr = E_FAIL;5448 5558 DWORD last_error = GetLastError(); 5559 5560 hr = E_FAIL; 5449 5561 5450 5562 switch (last_error) … … 5471 5583 } 5472 5584 5473 return hr;5585 goto end; 5474 5586 } 5475 5587 … … 5480 5592 5481 5593 if (newStorage == 0) 5482 return STG_E_INSUFFICIENTMEMORY; 5483 5594 { 5595 hr = STG_E_INSUFFICIENTMEMORY; 5596 goto end; 5597 } 5598 5599 /* if the file's length was zero, initialize the storage */ 5484 5600 hr = StorageImpl_Construct( 5485 5601 newStorage, 5486 5602 hFile, 5603 pwcsName, 5487 5604 NULL, 5488 5605 grfMode, 5489 5606 TRUE, 5490 FALSE);5607 !(Fad.nFileSizeHigh || Fad.nFileSizeLow) /* FALSE */ ); 5491 5608 5492 5609 if (FAILED(hr)) … … 5497 5614 */ 5498 5615 if(hr == STG_E_INVALIDHEADER) 5499 return STG_E_FILEALREADYEXISTS; 5500 return hr; 5501 } 5502 5616 hr = STG_E_FILEALREADYEXISTS; 5617 goto end; 5618 } 5619 5620 /* prepare the file name string given in lieu of the root property name */ 5621 GetFullPathNameW(pwcsName, MAX_PATH, fullname, NULL); 5622 memcpy(newStorage->filename, fullname, PROPERTY_NAME_BUFFER_LEN); 5623 newStorage->filename[PROPERTY_NAME_BUFFER_LEN-1] = '\0'; 5624 5503 5625 /* 5504 5626 * Get an "out" pointer for the caller. … … 5509 5631 (void**)ppstgOpen); 5510 5632 5633 end: 5634 TRACE("<-- %08lx, IStorage %p\n", hr, ppstgOpen ? *ppstgOpen : NULL); 5511 5635 return hr; 5512 5636 } … … 5541 5665 newStorage, 5542 5666 0, 5667 0, 5543 5668 plkbyt, 5544 5669 grfMode, … … 5605 5730 newStorage, 5606 5731 0, 5732 0, 5607 5733 plkbyt, 5608 5734 grfMode, … … 5629 5755 /****************************************************************************** 5630 5756 * StgSetTimes [ole32.150] 5631 * 5632 * 5633 * /5634 HRESULT WINAPI StgSetTimes(WCHAR * str, FILETIME * a, FILETIME * b, FILETIME *c ) 5635 { 5636 5637 FIXME("(% p, %p, %p, %p),stub!\n", str, a, b, c);5638 return FALSE;5757 * StgSetTimes [OLE32.150] 5758 * 5759 * 5760 */ 5761 HRESULT WINAPI StgSetTimes(OLECHAR *str, FILETIME *a, FILETIME *b, FILETIME *c ) 5762 { 5763 FIXME("(%s, %p, %p, %p),stub!\n", debugstr_w(str), a, b, c); 5764 return S_OK; 5639 5765 } 5640 5766 … … 5677 5803 5678 5804 /*********************************************************************** 5679 * ReadClassStg 5805 * ReadClassStg (OLE32.134) 5680 5806 * 5681 5807 * This method reads the CLSID previously written to a storage object with the WriteClassStg. … … 5702 5828 5703 5829 /*********************************************************************** 5704 * OleLoadFromStream 5830 * OleLoadFromStream (OLE32.113) 5705 5831 * 5706 5832 * This function loads an object from stream … … 5736 5862 5737 5863 /*********************************************************************** 5738 * OleSaveToStream 5864 * OleSaveToStream (OLE32.125) 5739 5865 * 5740 5866 * This function saves an object with the IPersistStream interface on it … … 6948 7074 if(hRes == S_OK) 6949 7075 { 6950 /* Was it originaly Ole10 */7076 /* Was it originally Ole10 */ 6951 7077 hRes = IStorage_OpenStream(pstg, wstrStreamName, 0, STGM_READ | STGM_SHARE_EXCLUSIVE, 0, &pStream); 6952 7078 if(hRes == S_OK) 6953 7079 { 6954 7080 IStream_Release(pStream); 6955 /* Get Presentation Data for Ole10Native */7081 /* Get Presentation Data for Ole10Native */ 6956 7082 OLECONVERT_GetOle10PresData(pstg, pOleStreamData); 6957 7083 } 6958 7084 else 6959 7085 { 6960 /* Get Presentation Data (OLE20)*/7086 /* Get Presentation Data (OLE20) */ 6961 7087 OLECONVERT_GetOle20PresData(pstg, pOleStreamData); 6962 7088 } … … 6992 7118 6993 7119 #ifdef __WIN32OS2__ 7120 6994 7121 static const BYTE STORAGE_notmagic[8]={0x0e,0x11,0xfc,0x0d,0xd0,0xcf,0x11,0xe0}; 6995 7122 6996 7123 /****************************************************************************** 6997 * StgIsStorageFile 16[STORAGE.5]7124 * StgIsStorageFile [STORAGE.5] 6998 7125 */ 6999 7126 HRESULT WINAPI StgIsStorageFile16(LPCOLESTR16 fn) { … … 7037 7164 StgIsStorageFile(LPCOLESTR fn) 7038 7165 { 7039 LPOLESTR16 xfn = HEAP_strdupWtoA(GetProcessHeap(),0,fn); 7040 HRESULT ret = StgIsStorageFile16(xfn); 7041 7042 HeapFree(GetProcessHeap(),0,xfn); 7043 return ret; 7166 HRESULT ret; 7167 DWORD len = WideCharToMultiByte( CP_ACP, 0, fn, -1, NULL, 0, NULL, NULL ); 7168 LPSTR strA = HeapAlloc( GetProcessHeap(), 0, len ); 7169 7170 WideCharToMultiByte( CP_ACP, 0, fn, -1, strA, len, NULL, NULL ); 7171 ret = StgIsStorageFile16(strA); 7172 HeapFree( GetProcessHeap(), 0, strA ); 7173 return ret; 7044 7174 } 7045 7175 #endif -
trunk/src/ole32/storage32.h
r5602 r7926 180 180 * Storage32BaseImpl definitions. 181 181 * 182 * This st ucture defines the base information contained in all implementations183 * of IStorage32 contained in this file estorage implementation.182 * This structure defines the base information contained in all implementations 183 * of IStorage32 contained in this file storage implementation. 184 184 * 185 185 * In OOP terms, this is the base class for all the IStorage32 implementations … … 188 188 struct StorageBaseImpl 189 189 { 190 ICOM_VFIELD(IStorage); /* Needs to be the first item in the st uct190 ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct 191 191 * since we want to cast this in a Storage32 pointer */ 192 192 … … 282 282 struct StorageImpl 283 283 { 284 ICOM_VFIELD(IStorage); /* Needs to be the first item in the stuct285 284 ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct 285 * since we want to cast this in a Storage32 pointer */ 286 286 287 287 /* … … 299 299 */ 300 300 HANDLE hFile; /* Physical support for the Docfile */ 301 301 LPOLESTR pwcsName; /* Full path of the document file */ 302 303 /* FIXME: should this be in Storage32BaseImpl ? */ 304 WCHAR filename[PROPERTY_NAME_BUFFER_LEN]; 305 302 306 /* 303 307 * File header … … 379 383 DWORD grfStateBits, /* [in] */ 380 384 DWORD grfMask); /* [in] */ 381 385 386 HRESULT WINAPI StorageImpl_Stat(IStorage* iface, 387 STATSTG* pstatstg, /* [out] */ 388 DWORD grfStatFlag); /* [in] */ 389 382 390 void StorageImpl_Destroy( 383 391 StorageImpl* This); … … 386 394 StorageImpl* This, 387 395 HANDLE hFile, 396 LPCOLESTR pwcsName, 388 397 ILockBytes* pLkbyt, 389 398 DWORD openFlags, … … 472 481 struct StorageInternalImpl 473 482 { 474 ICOM_VFIELD(IStorage); /* Needs to be the first item in the st uct483 ICOM_VFIELD(IStorage); /* Needs to be the first item in the struct 475 484 * since we want to cast this in a Storage32 pointer */ 476 485 … … 516 525 struct IEnumSTATSTGImpl 517 526 { 518 ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the st uct527 ICOM_VFIELD(IEnumSTATSTG); /* Needs to be the first item in the struct 519 528 * since we want to cast this in a IEnumSTATSTG pointer */ 520 529 … … 601 610 struct StgStreamImpl 602 611 { 603 ICOM_VFIELD(IStream); /* Needs to be the first item in the st uct612 ICOM_VFIELD(IStream); /* Needs to be the first item in the struct 604 613 * since we want to cast this in a IStream pointer */ 605 614 -
trunk/src/ole32/stubs.cpp
r5602 r7926 1 /* $Id: stubs.cpp,v 1.1 6 2001-04-26 19:32:52 sandervl Exp $ */1 /* $Id: stubs.cpp,v 1.17 2002-02-15 17:18:52 sandervl Exp $ */ 2 2 /* 3 3 * Win32 COM/OLE stubs for OS/2 … … 38 38 //***************************************************************************** 39 39 //***************************************************************************** 40 HRESULT WIN32API CoDisconnectObject(IUnknown *pUnk, DWORD dwReserved)41 {42 dprintf(("OLE32: CoDisconnectObject - stub"));43 return S_OK;44 }45 //*******************************************************************************46 //*******************************************************************************47 40 HRESULT WIN32API CoGetCallerTID() 48 41 { … … 56 49 dprintf(("OLE32: CoGetCurrentLogicalThreadId, UNKNOWN API - stub")); 57 50 return 0; 58 }59 //*******************************************************************************60 //*******************************************************************************61 HRESULT WIN32API CoGetInterfaceAndReleaseStream(LPSTREAM pStm, REFIID riid,62 LPVOID *ppv)63 {64 dprintf(("OLE32: CoGetInterfaceAndReleaseStream - stub"));65 return E_INVALIDARG;66 }67 //*******************************************************************************68 //*******************************************************************************69 HRESULT WIN32API CoGetMarshalSizeMax(ULONG *pulSize, REFIID riid, IUnknown *pUnk,70 DWORD dwDestContext, LPVOID pvDestContext,71 DWORD mshlflags)72 {73 dprintf(("OLE32: CoGetMarshalSizeMax - stub"));74 return CO_E_NOTINITIALIZED;75 }76 //*******************************************************************************77 //*******************************************************************************78 HRESULT WIN32API CoGetStandardMarshal(REFIID riid, IUnknown *pUnk, DWORD dwDestContext,79 LPVOID pvDestContext, DWORD mshlflags,80 LPMARSHAL *ppMarshal)81 {82 dprintf(("OLE32: CoGetStandardMarshal - stub"));83 return E_OUTOFMEMORY;84 51 } 85 52 //******************************************************************************* … … 120 87 //******************************************************************************* 121 88 //******************************************************************************* 122 HRESULT WIN32API CoMarshalInterThreadInterfaceInStream(REFIID riid,123 LPUNKNOWN pUnk,124 LPSTREAM *ppStm)125 {126 dprintf(("OLE32: CoMarshalInterThreadInterfaceInStream - stub"));127 return E_OUTOFMEMORY;128 }129 //*******************************************************************************130 //*******************************************************************************131 HRESULT WIN32API CoMarshalInterface(IStream *pStm, REFIID riid, IUnknown *pUnk,132 DWORD dwDestContext, void *pvDestContext,133 DWORD mshlflags)134 {135 dprintf(("OLE32: CoMarshalInterface - stub"));136 return E_OUTOFMEMORY;137 }138 //*******************************************************************************139 //*******************************************************************************140 89 HRESULT WIN32API CoQueryReleaseObject() 141 90 { … … 166 115 //******************************************************************************* 167 116 //******************************************************************************* 168 HRESULT WIN32API CoSetState(LPDWORD state)169 {170 dprintf(("OLE32: CoSetState (%p),stub!\n", state));171 if (state) *state = 0;172 return S_OK;173 }174 175 //*******************************************************************************176 //*******************************************************************************177 117 void WIN32API CoUnloadingWOW() 178 118 { … … 185 125 { 186 126 dprintf(("OLE32: CoUnmarshalHresult - stub")); 187 return S_OK;188 }189 //*******************************************************************************190 //*******************************************************************************191 HRESULT WIN32API CoUnmarshalInterface(IStream *pSTm, REFIID riid, void **ppv)192 {193 dprintf(("OLE32: CoUnmarshalInterface - stub"));194 127 return S_OK; 195 128 }
Note:
See TracChangeset
for help on using the changeset viewer.