Changeset 40198 in vbox for trunk/src/VBox/Additions/common
- Timestamp:
- Feb 21, 2012 2:02:26 PM (13 years ago)
- Location:
- trunk/src/VBox/Additions/common/VBoxGuest
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest-win.cpp
r40195 r40198 45 45 static NTSTATUS vboxguestwinIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp); 46 46 static NTSTATUS vboxguestwinInternalIOCtl(PDEVICE_OBJECT pDevObj, PIRP pIrp); 47 static NTSTATUS vboxguestwinRegistryReadDWORD(ULONG ulRoot, PCWSTR pwszPath, PWSTR pwszName, PULONG puValue); 47 48 static NTSTATUS vboxguestwinSystemControl(PDEVICE_OBJECT pDevObj, PIRP pIrp); 48 49 static NTSTATUS vboxguestwinShutdown(PDEVICE_OBJECT pDevObj, PIRP pIrp); … … 491 492 if (RT_SUCCESS(rc)) 492 493 { 494 ULONG ulValue = 0; 495 NTSTATUS s = vboxguestwinRegistryReadDWORD(RTL_REGISTRY_SERVICES, L"VBoxGuest", L"LoggingEnabled", 496 &ulValue); 497 if (NT_SUCCESS(s)) 498 { 499 pDevExt->fLoggingEnabled = ulValue >= 0xFF; 500 if (pDevExt->fLoggingEnabled) 501 Log(("Logging to release log enabled (0x%x)", ulValue)); 502 } 503 493 504 /* Ready to rumble! */ 494 505 Log(("VBoxGuest::vboxguestwinInit: Device is ready!\n")); … … 1023 1034 * we rely on the pDevExt->u32MousePosChangedSeq to be set to a non-zero value on a mouse event 1024 1035 * and queue the DPC in our ISR routine in that case doing KeSetEvent from the DPC routine */ 1036 } 1037 1038 1039 /** 1040 * Queries (gets) a DWORD value from the registry. 1041 * 1042 * @return NTSTATUS 1043 * @param ulRoot Relative path root. See RTL_REGISTRY_SERVICES or RTL_REGISTRY_ABSOLUTE. 1044 * @param pwszPath Path inside path root. 1045 * @param pwszName Actual value name to look up. 1046 * @param puValue On input this can specify the default value (if RTL_REGISTRY_OPTIONAL is 1047 * not specified in ulRoot), on output this will retrieve the looked up 1048 * registry value if found. 1049 */ 1050 NTSTATUS vboxguestwinRegistryReadDWORD(ULONG ulRoot, PCWSTR pwszPath, PWSTR pwszName, 1051 PULONG puValue) 1052 { 1053 if (!pwszPath || !pwszName || !puValue) 1054 return STATUS_INVALID_PARAMETER; 1055 1056 ULONG ulDefault = *puValue; 1057 1058 RTL_QUERY_REGISTRY_TABLE tblQuery[2]; 1059 RtlZeroMemory(tblQuery, sizeof(tblQuery)); 1060 /** @todo Add RTL_QUERY_REGISTRY_TYPECHECK! */ 1061 tblQuery[0].Flags = RTL_QUERY_REGISTRY_DIRECT; 1062 tblQuery[0].Name = pwszName; 1063 tblQuery[0].EntryContext = puValue; 1064 tblQuery[0].DefaultType = REG_DWORD; 1065 tblQuery[0].DefaultData = &ulDefault; 1066 tblQuery[0].DefaultLength = sizeof(ULONG); 1067 1068 return RtlQueryRegistryValues(ulRoot, 1069 pwszPath, 1070 &tblQuery[0], 1071 NULL /* Context */, 1072 NULL /* Environment */); 1025 1073 } 1026 1074 -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuest.cpp
r40197 r40198 713 713 pDevExt->fVRDPEnabled = false; 714 714 #endif 715 pDevExt->fLoggingEnabled = false; 715 716 pDevExt->f32PendingEvents = 0; 716 717 pDevExt->u32MousePosChangedSeq = 0; … … 2341 2342 * @returns VBox status code. 2342 2343 * 2344 * @param pDevExt The device extension. 2343 2345 * @param pch The log message (need not be NULL terminated). 2344 2346 * @param cbData Size of the buffer. 2345 2347 * @param pcbDataReturned Where to store the amount of returned data. Can be NULL. 2346 2348 */ 2347 static int VBoxGuestCommonIOCtl_Log( const char *pch, size_t cbData, size_t *pcbDataReturned)2349 static int VBoxGuestCommonIOCtl_Log(PVBOXGUESTDEVEXT pDevExt, const char *pch, size_t cbData, size_t *pcbDataReturned) 2348 2350 { 2349 2351 NOREF(pch); 2350 2352 NOREF(cbData); 2351 Log(("%.*s", cbData, pch)); 2353 if (pDevExt->fLoggingEnabled) 2354 RTLogBackdoorPrintf("%.*s", cbData, pch); 2355 else 2356 Log(("%.*s", cbData, pch)); 2352 2357 if (pcbDataReturned) 2353 2358 *pcbDataReturned = 0; … … 2479 2484 { 2480 2485 CHECKRET_MIN_SIZE("LOG", 1); 2481 rc = VBoxGuestCommonIOCtl_Log( (char *)pvData, cbData, pcbDataReturned);2486 rc = VBoxGuestCommonIOCtl_Log(pDevExt, (char *)pvData, cbData, pcbDataReturned); 2482 2487 } 2483 2488 else -
trunk/src/VBox/Additions/common/VBoxGuest/VBoxGuestInternal.h
r40195 r40198 153 153 bool fVRDPEnabled; 154 154 #endif 155 /** Flag indicating whether logging to the release log 156 * is enabled. */ 157 bool fLoggingEnabled; 155 158 /** Memory balloon information for RTR0MemObjAllocPhysNC(). */ 156 159 VBOXGUESTMEMBALLOON MemBalloon;
Note:
See TracChangeset
for help on using the changeset viewer.