Artifact b2a61832b0cfbdcf29c0bc7f02c52ed27701c433:
- File
src/win32/unknwn.d
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
The problem was __gshared. Replacing it with TLS fixed the issue. Remaining problem is that "hack.d"'s CloseHandle hack is not working anymore.
(user: kinaba) [annotate]
-
2015-05-05 06:49:05
- part of checkin
[9b639cf2d6]
on branch trunk
- Working version for update to 2.067.
0000: 2f 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a /*************** 0010: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0020: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0030: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0040: 2a 2a 2a 2a 2a 2a 2a 2a 5c 0d 0a 2a 20 20 20 20 ********\..* 0050: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0060: 20 20 20 20 20 20 20 20 20 20 20 20 75 6e 6b 6e unkn 0070: 77 6e 2e 64 20 20 20 20 20 20 20 20 20 20 20 20 wn.d 0080: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0090: 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 20 *..* 00a0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00c0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 00d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a 0d *. 00e0: 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 20 .* 00f0: 20 20 20 20 20 20 20 20 20 57 69 6e 64 6f 77 73 Windows 0100: 20 41 50 49 20 68 65 61 64 65 72 20 6d 6f 64 75 API header modu 0110: 6c 65 20 20 20 20 20 20 20 20 20 20 20 20 20 20 le 0120: 20 20 20 20 20 20 20 20 20 2a 0d 0a 2a 20 20 20 *..* 0130: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0140: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0150: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0160: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0170: 20 20 20 20 2a 0d 0a 2a 20 20 20 20 20 20 20 20 *..* 0180: 20 20 20 20 20 20 20 20 20 54 72 61 6e 73 6c 61 Transla 0190: 74 65 64 20 66 72 6f 6d 20 4d 69 6e 47 57 20 57 ted from MinGW W 01a0: 69 6e 64 6f 77 73 20 68 65 61 64 65 72 73 20 20 indows headers 01b0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 2a * 01c0: 0d 0a 2a 20 20 20 20 20 20 20 20 20 20 20 20 20 ..* 01d0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 01e0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 01f0: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0200: 20 20 20 20 20 20 20 20 20 20 2a 0d 0a 2a 20 20 *..* 0210: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0220: 20 20 20 20 20 50 6c 61 63 65 64 20 69 6e 74 6f Placed into 0230: 20 70 75 62 6c 69 63 20 64 6f 6d 61 69 6e 20 20 public domain 0240: 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 20 0250: 20 20 20 20 20 2a 0d 0a 5c 2a 2a 2a 2a 2a 2a 2a *..\******* 0260: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0270: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0280: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 0290: 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a **************** 02a0: 2f 0d 0a 6d 6f 64 75 6c 65 20 77 69 6e 33 32 2e /..module win32. 02b0: 75 6e 6b 6e 77 6e 3b 0d 0a 0d 0a 69 6d 70 6f 72 unknwn;....impor 02c0: 74 20 77 69 6e 33 32 2e 6f 62 6a 66 77 64 2c 20 t win32.objfwd, 02d0: 77 69 6e 33 32 2e 77 69 6e 64 65 66 2c 20 77 69 win32.windef, wi 02e0: 6e 33 32 2e 77 74 79 70 65 73 3b 0d 0a 70 72 69 n32.wtypes;..pri 02f0: 76 61 74 65 20 69 6d 70 6f 72 74 20 77 69 6e 33 vate import win3 0300: 32 2e 62 61 73 65 74 79 70 73 3b 0d 0a 0d 0a 65 2.basetyps;....e 0310: 78 74 65 72 6e 20 28 57 69 6e 64 6f 77 73 29 20 xtern (Windows) 0320: 7b 0d 0a 09 76 6f 69 64 2a 20 4d 49 44 4c 5f 75 {...void* MIDL_u 0330: 73 65 72 5f 61 6c 6c 6f 63 61 74 65 28 73 69 7a ser_allocate(siz 0340: 65 5f 74 29 3b 0d 0a 09 76 6f 69 64 20 4d 49 44 e_t);...void MID 0350: 4c 5f 75 73 65 72 5f 66 72 65 65 28 76 6f 69 64 L_user_free(void 0360: 2a 29 3b 0d 0a 7d 0d 0a 0d 0a 0d 0a 65 78 74 65 *);..}......exte 0370: 72 6e 20 28 57 69 6e 64 6f 77 73 29 20 7b 0d 0a rn (Windows) {.. 0380: 0d 0a 09 69 6e 74 65 72 66 61 63 65 20 49 55 6e ...interface IUn 0390: 6b 6e 6f 77 6e 20 7b 0d 0a 09 09 48 52 45 53 55 known {....HRESU 03a0: 4c 54 20 51 75 65 72 79 49 6e 74 65 72 66 61 63 LT QueryInterfac 03b0: 65 28 49 49 44 2a 20 72 69 69 64 2c 20 76 6f 69 e(IID* riid, voi 03c0: 64 2a 2a 20 70 76 4f 62 6a 65 63 74 29 3b 0d 0a d** pvObject);.. 03d0: 09 09 55 4c 4f 4e 47 20 41 64 64 52 65 66 28 29 ..ULONG AddRef() 03e0: 3b 0d 0a 09 09 55 4c 4f 4e 47 20 52 65 6c 65 61 ;....ULONG Relea 03f0: 73 65 28 29 3b 0d 0a 09 7d 0d 0a 0d 0a 09 61 6c se();...}.....al 0400: 69 61 73 20 49 55 6e 6b 6e 6f 77 6e 20 4c 50 55 ias IUnknown LPU 0410: 4e 4b 4e 4f 57 4e 3b 0d 0a 0d 0a 09 69 6e 74 65 NKNOWN;.....inte 0420: 72 66 61 63 65 20 49 43 6c 61 73 73 46 61 63 74 rface IClassFact 0430: 6f 72 79 20 3a 20 49 55 6e 6b 6e 6f 77 6e 20 7b ory : IUnknown { 0440: 0d 0a 09 09 48 52 45 53 55 4c 54 20 43 72 65 61 ....HRESULT Crea 0450: 74 65 49 6e 73 74 61 6e 63 65 28 49 55 6e 6b 6e teInstance(IUnkn 0460: 6f 77 6e 20 55 6e 6b 4f 75 74 65 72 2c 20 49 49 own UnkOuter, II 0470: 44 2a 20 72 69 69 64 2c 20 76 6f 69 64 2a 2a 20 D* riid, void** 0480: 70 76 4f 62 6a 65 63 74 29 3b 0d 0a 09 09 48 52 pvObject);....HR 0490: 45 53 55 4c 54 20 4c 6f 63 6b 53 65 72 76 65 72 ESULT LockServer 04a0: 28 42 4f 4f 4c 20 66 4c 6f 63 6b 29 3b 0d 0a 09 (BOOL fLock);... 04b0: 7d 0d 0a 09 61 6c 69 61 73 20 49 43 6c 61 73 73 }...alias IClass 04c0: 46 61 63 74 6f 72 79 20 4c 50 43 4c 41 53 53 46 Factory LPCLASSF 04d0: 41 43 54 4f 52 59 3b 0d 0a 0d 0a 09 2f 2b 0d 0a ACTORY;...../+.. 04e0: 09 2f 2f 20 54 68 65 73 65 20 64 6f 20 6e 6f 74 .// These do not 04f0: 20 73 65 65 6d 20 74 6f 20 62 65 20 6e 65 63 65 seem to be nece 0500: 73 73 61 72 79 20 28 6f 72 20 64 65 73 69 72 61 ssary (or desira 0510: 62 6c 65 29 20 66 6f 72 20 44 2e 0d 0a 09 48 52 ble) for D....HR 0520: 45 53 55 4c 54 20 49 55 6e 6b 6e 6f 77 6e 5f 51 ESULT IUnknown_Q 0530: 75 65 72 79 49 6e 74 65 72 66 61 63 65 5f 50 72 ueryInterface_Pr 0540: 6f 78 79 28 49 55 6e 6b 6e 6f 77 6e 2c 52 45 46 oxy(IUnknown,REF 0550: 49 49 44 2c 76 6f 69 64 2a 2a 29 3b 0d 0a 09 55 IID,void**);...U 0560: 4c 4f 4e 47 20 49 55 6e 6b 6e 6f 77 6e 5f 41 64 LONG IUnknown_Ad 0570: 64 52 65 66 5f 50 72 6f 78 79 28 49 55 6e 6b 6e dRef_Proxy(IUnkn 0580: 6f 77 6e 29 3b 0d 0a 09 55 4c 4f 4e 47 20 49 55 own);...ULONG IU 0590: 6e 6b 6e 6f 77 6e 5f 52 65 6c 65 61 73 65 5f 50 nknown_Release_P 05a0: 72 6f 78 79 28 49 55 6e 6b 6e 6f 77 6e 29 3b 0d roxy(IUnknown);. 05b0: 0a 09 48 52 45 53 55 4c 54 20 49 43 6c 61 73 73 ..HRESULT IClass 05c0: 46 61 63 74 6f 72 79 5f 52 65 6d 6f 74 65 43 72 Factory_RemoteCr 05d0: 65 61 74 65 49 6e 73 74 61 6e 63 65 5f 50 72 6f eateInstance_Pro 05e0: 78 79 28 49 43 6c 61 73 73 46 61 63 74 6f 72 79 xy(IClassFactory 05f0: 2c 52 45 46 49 49 44 2c 49 55 6e 6b 6e 6f 77 6e ,REFIID,IUnknown 0600: 2a 29 3b 0d 0a 09 48 52 45 53 55 4c 54 20 49 43 *);...HRESULT IC 0610: 6c 61 73 73 46 61 63 74 6f 72 79 5f 52 65 6d 6f lassFactory_Remo 0620: 74 65 4c 6f 63 6b 53 65 72 76 65 72 5f 50 72 6f teLockServer_Pro 0630: 78 79 28 49 43 6c 61 73 73 46 61 63 74 6f 72 79 xy(IClassFactory 0640: 2c 42 4f 4f 4c 29 3b 0d 0a 09 48 52 45 53 55 4c ,BOOL);...HRESUL 0650: 54 20 49 43 6c 61 73 73 46 61 63 74 6f 72 79 5f T IClassFactory_ 0660: 43 72 65 61 74 65 49 6e 73 74 61 6e 63 65 5f 50 CreateInstance_P 0670: 72 6f 78 79 28 49 43 6c 61 73 73 46 61 63 74 6f roxy(IClassFacto 0680: 72 79 2c 49 55 6e 6b 6e 6f 77 6e 2c 52 45 46 49 ry,IUnknown,REFI 0690: 49 44 2c 76 6f 69 64 2a 2a 29 3b 0d 0a 09 48 52 ID,void**);...HR 06a0: 45 53 55 4c 54 20 49 43 6c 61 73 73 46 61 63 74 ESULT IClassFact 06b0: 6f 72 79 5f 43 72 65 61 74 65 49 6e 73 74 61 6e ory_CreateInstan 06c0: 63 65 5f 53 74 75 62 28 49 43 6c 61 73 73 46 61 ce_Stub(IClassFa 06d0: 63 74 6f 72 79 2c 52 45 46 49 49 44 2c 49 55 6e ctory,REFIID,IUn 06e0: 6b 6e 6f 77 6e 2a 29 3b 0d 0a 09 48 52 45 53 55 known*);...HRESU 06f0: 4c 54 20 49 43 6c 61 73 73 46 61 63 74 6f 72 79 LT IClassFactory 0700: 5f 4c 6f 63 6b 53 65 72 76 65 72 5f 50 72 6f 78 _LockServer_Prox 0710: 79 28 49 43 6c 61 73 73 46 61 63 74 6f 72 79 2c y(IClassFactory, 0720: 42 4f 4f 4c 29 3b 0d 0a 09 48 52 45 53 55 4c 54 BOOL);...HRESULT 0730: 20 49 43 6c 61 73 73 46 61 63 74 6f 72 79 5f 4c IClassFactory_L 0740: 6f 63 6b 53 65 72 76 65 72 5f 53 74 75 62 28 49 ockServer_Stub(I 0750: 43 6c 61 73 73 46 61 63 74 6f 72 79 2c 42 4f 4f ClassFactory,BOO 0760: 4c 29 3b 0d 0a 0d 0a 09 76 6f 69 64 20 49 55 6e L);.....void IUn 0770: 6b 6e 6f 77 6e 5f 51 75 65 72 79 49 6e 74 65 72 known_QueryInter 0780: 66 61 63 65 5f 53 74 75 62 28 4c 50 52 50 43 53 face_Stub(LPRPCS 0790: 54 55 42 42 55 46 46 45 52 2c 4c 50 52 50 43 43 TUBBUFFER,LPRPCC 07a0: 48 41 4e 4e 45 4c 42 55 46 46 45 52 2c 50 52 50 HANNELBUFFER,PRP 07b0: 43 5f 4d 45 53 53 41 47 45 2c 50 44 57 4f 52 44 C_MESSAGE,PDWORD 07c0: 29 3b 0d 0a 09 76 6f 69 64 20 49 55 6e 6b 6e 6f );...void IUnkno 07d0: 77 6e 5f 41 64 64 52 65 66 5f 53 74 75 62 28 4c wn_AddRef_Stub(L 07e0: 50 52 50 43 53 54 55 42 42 55 46 46 45 52 2c 4c PRPCSTUBBUFFER,L 07f0: 50 52 50 43 43 48 41 4e 4e 45 4c 42 55 46 46 45 PRPCCHANNELBUFFE 0800: 52 2c 50 52 50 43 5f 4d 45 53 53 41 47 45 2c 50 R,PRPC_MESSAGE,P 0810: 44 57 4f 52 44 29 3b 0d 0a 09 76 6f 69 64 20 49 DWORD);...void I 0820: 55 6e 6b 6e 6f 77 6e 5f 52 65 6c 65 61 73 65 5f Unknown_Release_ 0830: 53 74 75 62 28 4c 50 52 50 43 53 54 55 42 42 55 Stub(LPRPCSTUBBU 0840: 46 46 45 52 2c 4c 50 52 50 43 43 48 41 4e 4e 45 FFER,LPRPCCHANNE 0850: 4c 42 55 46 46 45 52 2c 50 52 50 43 5f 4d 45 53 LBUFFER,PRPC_MES 0860: 53 41 47 45 2c 50 44 57 4f 52 44 29 3b 0d 0a 09 SAGE,PDWORD);... 0870: 76 6f 69 64 20 49 43 6c 61 73 73 46 61 63 74 6f void IClassFacto 0880: 72 79 5f 52 65 6d 6f 74 65 43 72 65 61 74 65 49 ry_RemoteCreateI 0890: 6e 73 74 61 6e 63 65 5f 53 74 75 62 28 4c 50 52 nstance_Stub(LPR 08a0: 50 43 53 54 55 42 42 55 46 46 45 52 2c 4c 50 52 PCSTUBBUFFER,LPR 08b0: 50 43 43 48 41 4e 4e 45 4c 42 55 46 46 45 52 2c PCCHANNELBUFFER, 08c0: 50 52 50 43 5f 4d 45 53 53 41 47 45 2c 50 44 57 PRPC_MESSAGE,PDW 08d0: 4f 52 44 29 3b 0d 0a 09 76 6f 69 64 20 49 43 6c ORD);...void ICl 08e0: 61 73 73 46 61 63 74 6f 72 79 5f 52 65 6d 6f 74 assFactory_Remot 08f0: 65 4c 6f 63 6b 53 65 72 76 65 72 5f 53 74 75 62 eLockServer_Stub 0900: 28 4c 50 52 50 43 53 54 55 42 42 55 46 46 45 52 (LPRPCSTUBBUFFER 0910: 2c 4c 50 52 50 43 43 48 41 4e 4e 45 4c 42 55 46 ,LPRPCCHANNELBUF 0920: 46 45 52 2c 50 52 50 43 5f 4d 45 53 53 41 47 45 FER,PRPC_MESSAGE 0930: 2c 50 44 57 4f 52 44 29 3b 0d 0a 09 2b 2f 0d 0a ,PDWORD);...+/.. 0940: 7d 0d 0a }..