Changeset 18019 in vbox for trunk/src/VBox
- Timestamp:
- Mar 17, 2009 1:08:12 PM (16 years ago)
- Location:
- trunk/src/VBox/Additions/WINNT/VBoxGuest
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/WINNT/VBoxGuest/Helper.cpp
r13837 r18019 23 23 #include "Helper.h" 24 24 #include <VBox/err.h> 25 #include <VBox/log.h> 25 26 #include <VBox/VBoxGuestLib.h> 27 28 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 29 #ifndef TARGET_NT4 30 #include <aux_klib.h> 31 #endif 32 #endif 26 33 27 34 #ifdef ALLOC_PRAGMA … … 245 252 return RT_FAILURE(rc) ? STATUS_UNSUCCESSFUL : STATUS_SUCCESS; 246 253 } 254 255 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 256 NTSTATUS hlpRegisterBugCheckCallback (PVBOXGUESTDEVEXT pDevExt) 257 { 258 int rc = STATUS_SUCCESS; 259 260 #ifndef TARGET_NT4 261 rc = AuxKlibInitialize(); 262 if (NT_ERROR(rc)) 263 { 264 dprintf(("VBoxGuest::VBoxGuestAddDevice: Unabled to initialize AuxKlib!\n")); 265 return STATUS_DRIVER_UNABLE_TO_LOAD; 266 } 267 #endif 268 269 /* 270 * Setup bugcheck callback routine ASAP. 271 */ 272 pDevExt->bBugcheckCallbackRegistered = FALSE; 273 pDevExt->bugcheckContext = (VBOXBUGCHECKCONTEXT*)ExAllocatePool(NonPagedPool, sizeof(VBOXBUGCHECKCONTEXT)); 274 if(!pDevExt->bugcheckContext) 275 { 276 dprintf(("VBoxGuest::VBoxGuestAddDevice: Not enough memory for bugcheck context!\n")); 277 return STATUS_INSUFFICIENT_RESOURCES; 278 } 279 280 KeInitializeCallbackRecord(&pDevExt->bugcheckContext->bugcheckRecord); 281 if (FALSE == KeRegisterBugCheckCallback(&pDevExt->bugcheckContext->bugcheckRecord, 282 &hlpVBoxGuestBugCheckCallback, 283 pDevExt->bugcheckContext, 284 sizeof(VBOXBUGCHECKCONTEXT), 285 (PUCHAR)"VBoxGuest")) 286 { 287 LogRelBackdoor(("Could not register bugcheck callback routine!\n")); 288 } 289 else 290 { 291 pDevExt->bBugcheckCallbackRegistered = TRUE; 292 dprintf(("VBoxGuest::VBoxGuestAddDevice: Bugcheck callback registered.\n")); 293 } 294 295 return rc; 296 } 297 298 VOID hlpVBoxGuestBugCheckCallback(PVOID pvBuffer, ULONG ulLength) 299 { 300 NTSTATUS rc = 0; 301 PVBOXBUGCHECKCONTEXT pContext = (PVBOXBUGCHECKCONTEXT)pvBuffer; 302 303 LogRelBackdoor(("Windows bugcheck (bluescreen) detected!\n")); 304 305 #ifndef TARGET_NT4 306 KBUGCHECK_DATA bugcheckData; 307 bugcheckData.BugCheckDataSize = sizeof(KBUGCHECK_DATA); 308 rc = AuxKlibGetBugCheckData(&bugcheckData); 309 if (!RT_SUCCESS(rc)) 310 { 311 LogRelBackdoor(("Unable to retrieve bugcheck details! Error: %d\n", rc)); 312 return; 313 } 314 315 LogRelBackdoor(("Bugcheck code: 0x%08x\n", bugcheckData.BugCheckCode)); 316 LogRelBackdoor(("Bugcheck parameters: 1=%ld 2=%ld 3=%ld 4=%ld\n", 317 bugcheckData.Parameter1, 318 bugcheckData.Parameter2, 319 bugcheckData.Parameter3, 320 bugcheckData.Parameter4)); 321 #else 322 LogRelBackdoor(("No additional information for Windows NT 4.0 bugcheck available.\n")); 323 #endif 324 325 if (pvBuffer) 326 { 327 /* @todo - Not used yet. */ 328 } 329 330 /* @todo Notify the host somehow over DevVMM. */ 331 } 332 #endif -
trunk/src/VBox/Additions/WINNT/VBoxGuest/Helper.h
r8155 r18019 54 54 */ 55 55 NTSTATUS hlpVBoxReportGuestInfo (PVBOXGUESTDEVEXT pDevExt); 56 57 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 58 /** 59 * Helper for registering the bugcheck callback rountine(s). 60 * 61 * @param pDevExt VMMDev device extension 62 * @return NT status code 63 */ 64 NTSTATUS hlpRegisterBugCheckCallback (PVBOXGUESTDEVEXT pDevExt); 65 66 VOID hlpVBoxGuestBugCheckCallback (PVOID pvBuffer, ULONG ulLength); 67 #endif 56 68 } 57 69 -
trunk/src/VBox/Additions/WINNT/VBoxGuest/Makefile.kmk
r14491 r18019 32 32 endif 33 33 VBoxGuest_DEFS = LOG_TO_BACKDOOR VBGL_VBOXGUEST VBOX_WITH_HGCM VBOX_REBOOT_ON_UNINSTALL 34 ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 35 VBoxGuest_DEFS += VBOX_WITH_GUEST_BUGCHECK_DETECTION 36 endif 34 37 #VBoxGuest_DEFS += LOG_ENABLED 35 VBoxGuest_INCS = ../include 38 VBoxGuest_INCS = \ 39 ../include 36 40 VBoxGuest_LDFLAGS.x86 = -Entry:DriverEntry@8 37 41 VBoxGuest_LDFLAGS.amd64 = -Entry:DriverEntry 38 VBoxGuest_SOURCES = \ 42 VBoxGuest_SDKS = WINDDKWLH 43 VBoxGuest_SOURCES = \ 39 44 VBoxGuest.cpp \ 40 45 VBoxGuestPnP.cpp \ … … 42 47 VBoxGuest.rc 43 48 VBoxGuest_LIBS = \ 44 $(PATH_SDK_W 2K3DDK_LIB)/ntoskrnl.lib \45 $(PATH_SDK_W 2K3DDK_LIB)/hal.lib \49 $(PATH_SDK_WINDDKWLH_LIB)/ntoskrnl.lib \ 50 $(PATH_SDK_WINDDKWLH_LIB)/hal.lib \ 46 51 $(VBOX_LIB_VBGL_R0BASE) \ 47 $(VBOX_LIB_IPRT_GUEST_R0) 52 $(VBOX_LIB_IPRT_GUEST_R0) \ 48 53 54 ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 55 VBoxGuest_LIBS += \ 56 $(PATH_SDK_WINDDKWLH_LIB)/ksecdd.lib \ 57 $(PATH_SDK_WINDDKWLH_LIB)/BufferOverflowK.lib \ 58 $(PATH_SDK_WINDDKWLH_LIB)/aux_klib.lib 59 endif 49 60 50 61 # … … 55 66 VBoxGuestNT_NOINST = $(NO_SUCH_VARIABLE) 56 67 VBoxGuestNT_DEFS = $(VBoxGuest_DEFS) TARGET_NT4 68 57 69 VBoxGuestNT_SOURCES = \ 58 70 VBoxGuest.cpp \ -
trunk/src/VBox/Additions/WINNT/VBoxGuest/NTLegacy.cpp
r17163 r18019 129 129 pDevExt->busNumber = busNumber; 130 130 pDevExt->slotNumber = slotNumber; 131 132 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 133 rc = hlpRegisterBugCheckCallback(pDevExt); 134 #endif 131 135 132 136 // -
trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuest.cpp
r17499 r18019 32 32 #include "Helper.h" 33 33 #include <excpt.h> 34 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 35 #ifndef TARGET_NT4 36 #include <aux_klib.h> 37 #endif 38 #endif 34 39 #include <VBox/err.h> 35 40 #include <VBox/log.h> … … 67 72 static NTSTATUS VBoxGuestShutdown(PDEVICE_OBJECT pDevObj, PIRP pIrp); 68 73 static NTSTATUS VBoxGuestNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp); 69 static VOID VBoxGuestBugCheckCallback(PVOID pszBuffer, ULONG ulLength);70 74 static VOID vboxWorkerThread(PVOID context); 71 75 static VOID reserveHypervisorMemory(PVBOXGUESTDEVEXT pDevExt); … … 242 246 #endif 243 247 244 /* 245 * Setup bugcheck callback routine ASAP. 246 */ 247 #if 0 /** @todo r=bird: The 3rd and 4th parameters aren't according to spec and 248 * pcBugcheckBuffer isn't initialized anywhere. (Figuring out what it's 249 * good for is also nice.) Either explain why the spec is wrong in the 250 * comment above or fix it. Also pc should be pch if you wish to keep it 251 * a char pointer. */ 252 RtlZeroMemory(pDevExt->szDriverName, sizeof(pDevExt->szDriverName)); 253 KeInitializeCallbackRecord(&pDevExt->bugcheckRecord); 254 255 if (FALSE == KeRegisterBugCheckCallback(&pDevExt->bugcheckRecord, 256 &VBoxGuestBugCheckCallback, 257 pDevExt->pcBugcheckBuffer, 258 sizeof(&pDevExt->szDriverName), 259 pDevExt->szDriverName)) 260 { 261 dprintf(("VBoxGuest::VBoxGuestAddDevice: Could not register bugcheck callback routine!\n")); 262 } 263 else 264 { 265 dprintf(("VBoxGuest::VBoxGuestAddDevice: Bugcheck callback registered.\n")); 266 } 248 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 249 rc = hlpRegisterBugCheckCallback(pDevExt); 267 250 #endif 268 251 … … 309 292 VBoxCleanupMemBalloon(pDevExt); 310 293 311 #if 0 /** @todo r=bird: code temporarily disabled. Btw. it would be a good idea not to 312 * try deregister it if we didn't successfully register it in the first place... */ 294 #ifdef VBOX_WITH_GUEST_BUGCHECK_DETECTION 313 295 /* Unregister bugcheck callback. */ 314 if (FALSE == KeDeregisterBugCheckCallback(&pDevExt->bugcheckRecord)) 315 dprintf(("VBoxGuest::VBoxGuestUnload: Unregistering bugcheck callback routine failed!\n")); 296 if (pDevExt->bBugcheckCallbackRegistered && pDevExt->bugcheckContext) 297 { 298 if (FALSE == KeDeregisterBugCheckCallback(&pDevExt->bugcheckContext->bugcheckRecord)) 299 dprintf(("VBoxGuest::VBoxGuestUnload: Unregistering bugcheck callback routine failed!\n")); 300 301 ExFreePool(&pDevExt->bugcheckContext); 302 pDevExt->bBugcheckCallbackRegistered = FALSE; 303 } 316 304 #endif 317 305 … … 1543 1531 } 1544 1532 1545 VOID VBoxGuestBugCheckCallback(PVOID pszBuffer, ULONG ulLength)1546 {1547 /** @todo r=bird: The buffer is the 3rd argument of the registration call1548 * according to the spec and ulLength is the 4th... so either the spec1549 * is wrong of this code dosn't make sense... */1550 LogRelBackdoor(("Windows bluescreen detected! "));1551 if (pszBuffer)1552 {1553 LogRelBackdoor(("Additional information: %s\n", (char*)pszBuffer));1554 }1555 else LogRelBackdoor(("No additional information given.\n"));1556 1557 /* @todo Notify the host somehow over DevVMM. */1558 }1559 1560 1533 /** 1561 1534 * Worker thread to do periodic things such as notify other -
trunk/src/VBox/Additions/WINNT/VBoxGuest/VBoxGuest_Internal.h
r17480 r18019 125 125 } BASE_ADDRESS, *PBASE_ADDRESS; 126 126 127 typedef struct 128 { 129 KBUGCHECK_CALLBACK_RECORD bugcheckRecord; 130 } VBOXBUGCHECKCONTEXT, *PVBOXBUGCHECKCONTEXT; 127 131 128 132 /** … … 216 220 VMMDevPowerStateRequest *powerStateRequest; 217 221 218 /* Record for bugcheck callback routine. */219 KBUGCHECK_CALLBACK_RECORD bugcheckRecord;220 CHAR* pcBugcheckBuffer;222 /* Bugcheck context. */ 223 BOOLEAN bBugcheckCallbackRegistered; 224 PVBOXBUGCHECKCONTEXT bugcheckContext; 221 225 222 226 } VBOXGUESTDEVEXT, *PVBOXGUESTDEVEXT;
Note:
See TracChangeset
for help on using the changeset viewer.