- Timestamp:
- Apr 9, 2013 7:08:17 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r0drv/nt/initterm-r0drv-nt.cpp
r45443 r45444 141 141 /* 142 142 * Do the CPU vendor test. 143 */ 143 * 144 * Note! The MmIsAddressValid call is the real #PF security here as the 145 * __try/__except has limited/no ability to catch everything we need. 146 */ 147 char *pszPrcbVendorString = (char *)&pbPrcb[pSet->KPRCB.offVendorString]; 148 if (!MmIsAddressValid(&pszPrcbVendorString[4 * 3 - 1])) 149 { 150 DbgPrint("IPRT: #%d invalid vendor string address.\n", pSet - &g_artNtSdbSets[0]); 151 return false; 152 } 144 153 __try 145 154 { 146 if (memcmp(&pbPrcb[pSet->KPRCB.offVendorString], pszVendor, 147 RT_MIN(4 * 3, pSet->KPRCB.cbVendorString)) != 0) 155 if (memcmp(pszPrcbVendorString, pszVendor, RT_MIN(4 * 3, pSet->KPRCB.cbVendorString)) != 0) 148 156 { 149 //DbgPrint("IPRT: #%d Vendor string mismatch.\n");157 DbgPrint("IPRT: #%d Vendor string mismatch.\n", pSet - &g_artNtSdbSets[0]); 150 158 return false; 151 159 } 152 160 } 153 __except(EXCEPTION_EXECUTE_HANDLER) /** @todo this handler doesn't seem to work... Because of Irql? */154 { 155 //DbgPrint("IPRT: Exception\n");161 __except(EXCEPTION_EXECUTE_HANDLER) 162 { 163 DbgPrint("IPRT: %#d Exception\n", pSet - &g_artNtSdbSets[0]); 156 164 return false; 157 165 } … … 224 232 225 233 /* 226 * HACK ALERT (and déjà vu warning)!234 * HACK ALERT! (and déjà vu warning - remember win32k.sys?) 227 235 * 228 236 * Try find _KPRCB::QuantumEnd and _KPRCB::[DpcData.]DpcQueueDepth. … … 230 238 * 231 239 * The offsets was initially derived by poking around with windbg 232 * (dt _KPRCB, !prcb ++, and such like). Systematic harvesting is now done233 * by means of dia2dump, grep and the symbol packs. Typically:240 * (dt _KPRCB, !prcb ++, and such like). Systematic harvesting was then 241 * planned using dia2dump, grep and the symbol pack in a manner like this: 234 242 * dia2dump -type _KDPC_DATA -type _KPRCB EXE\ntkrnlmp.pdb | grep -wE "QuantumEnd|DpcData|DpcQueueDepth|VendorString" 243 * 244 * The final solution ended up using a custom harvester program called 245 * ntBldSymDb that recursively searches thru unpacked symbol packages for 246 * the desired structure offsets. The program assumes that the packages 247 * are unpacked into directories with the same name as the package, with 248 * exception of some of the w2k packages which requires a 'w2k' prefix to 249 * be distinguishable from another. 235 250 */ 236 251 … … 253 268 254 269 uint8_t *pbPrcb; 255 __try 270 __try /* Warning. This try/except statement may provide some false safety. */ 256 271 { 257 272 #if defined(RT_ARCH_X86) … … 266 281 #endif 267 282 } 268 __except(EXCEPTION_EXECUTE_HANDLER) /** @todo this handler doesn't seem to work... Because of Irql? */283 __except(EXCEPTION_EXECUTE_HANDLER) 269 284 { 270 285 pbPrcb = NULL; 271 286 } 272 273 KeLowerIrql(OldIrql); /* Lowering the IRQL early in the hope that we may catch exceptions below. */274 287 275 288 /* … … 310 323 } 311 324 } 312 iBest = RT_ELEMENTS(g_artNtSdbSets)-1;313 325 if (iBest < RT_ELEMENTS(g_artNtSdbSets)) 314 326 { … … 333 345 DbgPrint("IPRT: Failed to get PCBR pointer.\n"); 334 346 347 KeLowerIrql(OldIrql); /* Lowering the IRQL early in the hope that we may catch exceptions below. */ 348 335 349 #ifndef IN_GUEST 336 350 if (!g_offrtNtPbQuantumEnd && !g_offrtNtPbDpcQueueDepth)
Note:
See TracChangeset
for help on using the changeset viewer.