diff --git a/if1632/compobj.spec b/if1632/compobj.spec index 9e775dafb0f71c4c582dcccc7407975bc28f8fcf..8b4c0e7b41dcd7ef37c6aa36edfa1f2e12dae7ca 100644 --- a/if1632/compobj.spec +++ b/if1632/compobj.spec @@ -115,7 +115,7 @@ type win16 113 stub ?SETATGROW@CARRAYFVALUE@@RECHHPEX@Z 114 stub ?SETSIZE@CARRAYFVALUE@@RECHHH@Z 115 pascal CoGetState(ptr) CoGetState16 -116 stub DLLENTRYPOINT +116 pascal DllEntryPoint(long word word word long word) COMPOBJ_DllEntryPoint 117 stub ?RELEASE@CSTDMALLOC@@VEAKXZ 118 stub ?ALLOC@CSTDMALLOC@@VEAPEXK@Z 119 stub SHRRELEASE diff --git a/ole/compobj.c b/ole/compobj.c index 8f84d04e2fe7d4d7a4fabaae6e8355dee41c6c1b..450f8a8412dafa9c24527c47065fa7702515ba15 100644 --- a/ole/compobj.c +++ b/ole/compobj.c @@ -122,6 +122,10 @@ static COM_ExternalLock* COM_ExternalLockLocate( * * TODO: Most of these things will have to be made thread-safe. */ +HINSTANCE16 COMPOBJ_hInstance = 0; +HINSTANCE COMPOBJ_hInstance32 = 0; +static int COMPOBJ_Attach = 0; + LPMALLOC16 currentMalloc16=NULL; LPMALLOC currentMalloc32=NULL; @@ -1982,3 +1986,40 @@ static void COM_ExternalLockDelete( } while ( current != EL_END_OF_LIST ); } } + +/*********************************************************************** + * COMPOBJ_DllEntryPoint [COMPOBJ.entry] + * + * Initialization code for the COMPOBJ DLL + * + * RETURNS: + */ +BOOL WINAPI COMPOBJ_DllEntryPoint(DWORD Reason, HINSTANCE16 hInst, WORD ds, WORD HeapSize, DWORD res1, WORD res2) +{ + TRACE(ole, "(%08lx, %04x, %04x, %04x, %08lx, %04x)\n", Reason, hInst, ds, HeapSize, + res1, res2); + switch(Reason) + { + case DLL_PROCESS_ATTACH: + COMPOBJ_Attach++; + if(COMPOBJ_hInstance) + { + ERR(ole, "compobj.dll instantiated twice!\n"); + /* + * We should return FALSE here, but that will break + * most apps that use CreateProcess because we do + * not yet support seperate address-spaces. + */ + return TRUE; + } + + COMPOBJ_hInstance = hInst; + break; + + case DLL_PROCESS_DETACH: + if(!--COMPOBJ_Attach) + COMPOBJ_hInstance = 0; + break; + } + return TRUE; +}