vbox的更動 36366 路徑 trunk/src/VBox/Runtime/r3
- 時間撮記:
- 2011-3-23 下午01:28:01 (14 年 以前)
- 檔案:
-
- 修改 1 筆資料
圖例:
- 未更動
- 新增
- 刪除
-
trunk/src/VBox/Runtime/r3/win/thread-win.cpp
r34507 r36366 1 1 /* $Id$ */ 2 2 /** @file 3 * IPRT - Threads, Win 32.3 * IPRT - Threads, Windows. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-20 07Oracle Corporation7 * Copyright (C) 2006-2011 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 97 97 98 98 /** 99 * Bitch about dangling COM and OLE references, dispose of them 100 * afterwards so we don't end up deadlocked somewhere below 101 * OLE32!DllMain. 102 */ 103 static void rtThreadNativeUninitComAndOle(void) 104 { 105 #if 0 /* experimental code */ 106 /* 107 * Read the counters. 108 */ 109 struct MySOleTlsData 110 { 111 void *apvReserved0[2]; /**< x86=0x00 W7/64=0x00 */ 112 DWORD adwReserved0[3]; /**< x86=0x08 W7/64=0x10 */ 113 void *apvReserved1[1]; /**< x86=0x14 W7/64=0x20 */ 114 DWORD cComInits; /**< x86=0x18 W7/64=0x28 */ 115 DWORD cOleInits; /**< x86=0x1c W7/64=0x2c */ 116 DWORD dwReserved1; /**< x86=0x20 W7/64=0x30 */ 117 void *apvReserved2[4]; /**< x86=0x24 W7/64=0x38 */ 118 DWORD adwReserved2[1]; /**< x86=0x34 W7/64=0x58 */ 119 void *pvCurrentCtx; /**< x86=0x38 W7/64=0x60 */ 120 IUnknown *pCallState; /**< x86=0x3c W7/64=0x68 */ 121 } *pOleTlsData = NULL; /* outside the try/except for debugging */ 122 DWORD cComInits = 0; 123 DWORD cOleInits = 0; 124 __try 125 { 126 void *pvTeb = NtCurrentTeb(); 127 # ifdef RT_ARCH_AMD64 128 pOleTlsData = *(struct MySOleTlsData **)((uintptr_t)pvTeb + 0x1758); /*TEB.ReservedForOle*/ 129 # elif RT_ARCH_X86 130 pOleTlsData = *(struct MySOleTlsData **)((uintptr_t)pvTeb + 0x0f80); /*TEB.ReservedForOle*/ 131 # else 132 # error "Port me!" 133 # endif 134 if (pOleTlsData) 135 { 136 cComInits = pOleTlsData->cComInits; 137 cOleInits = pOleTlsData->cOleInits; 138 } 139 } 140 __except(EXCEPTION_EXECUTE_HANDLER) 141 { 142 AssertFailedReturnVoid(); 143 } 144 145 /* 146 * Assert sanity. If any of these breaks, the structure layout above is 147 * probably not correct any longer. 148 */ 149 AssertMsgReturnVoid(cComInits < 1000, ("%u (%#x)\n", cComInits, cComInits)); 150 AssertMsgReturnVoid(cOleInits < 1000, ("%u (%#x)\n", cOleInits, cOleInits)); 151 AssertMsgReturnVoid(cComInits >= cOleInits, ("cComInits=%#x cOleInits=%#x\n", cComInits, cOleInits)); 152 153 /* 154 * Do the uninitializing. 155 */ 156 if (cComInits) 157 { 158 AssertMsgFailed(("cComInits=%u (%#x) cOleInits=%u (%#x) - dangling COM/OLE inits!\n", 159 cComInits, cComInits, cOleInits, cOleInits)); 160 161 HMODULE hOle32 = GetModuleHandle("OLE32"); 162 AssertReturnVoid(hOle32 != NULL); 163 164 typedef void (WINAPI *PFNOLEUNINITIALIZE)(void); 165 PFNOLEUNINITIALIZE pfnOleUninitialize = (PFNOLEUNINITIALIZE)GetProcAddress(hOle32, "OleUninitialize"); 166 AssertReturnVoid(pfnOleUninitialize); 167 168 typedef void (WINAPI *PFNCOUNINITIALIZE)(void); 169 PFNCOUNINITIALIZE pfnCoUninitialize = (PFNCOUNINITIALIZE)GetProcAddress(hOle32, "CoUninitialize"); 170 AssertReturnVoid(pfnCoUninitialize); 171 172 while (cOleInits-- > 0) 173 { 174 pfnOleUninitialize(); 175 cComInits--; 176 } 177 178 while (cComInits-- > 0) 179 pfnCoUninitialize(); 180 } 181 #endif 182 } 183 184 185 /** 99 186 * Wrapper which unpacks the param stuff and calls thread function. 100 187 */ … … 110 197 111 198 TlsSetValue(g_dwSelfTLS, NULL); 199 rtThreadNativeUninitComAndOle(); 112 200 _endthreadex(rc); 113 201 return rc; … … 246 334 return RTErrConvertFromWin32(iLastError); 247 335 } 336
注意:
瀏覽 TracChangeset
來幫助您使用更動檢視器