Changeset 55473 in vbox for trunk/src/VBox/HostDrivers/VBoxUSB
- Timestamp:
- Apr 28, 2015 8:52:30 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 99820
- Location:
- trunk/src/VBox/HostDrivers/VBoxUSB/win/mon
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUSBMon.inf
r36968 r55473 35 35 36 36 [DefaultInstall.NT.Services] 37 AddService = VBoxUSBMon, 0x00000002, VBoxUSBMon_Service_Inst 37 AddService = VBoxUSBMon, 0x00000002, VBoxUSBMon_Service_Inst, VBoxUSBMon_EventLog_Inst 38 38 39 39 [VBoxUSBMon_Service_Inst] … … 44 44 ErrorControl = 1 ; SERVICE_ERROR_NORMAL 45 45 ServiceBinary = %12%\VBoxUSBMon.sys 46 47 [VBoxUSBMon_EventLog_Inst] 48 AddReg = VBoxUSBMon_EventLog_AddReg 49 50 [VBoxUSBMon_EventLog_AddReg] 51 HKR,,EventMessageFile,0x00020000,"%%SystemRoot%%\System32\IoLogMsg.dll" 52 HKR,,TypesSupported,0x00010001,7 46 53 47 54 [SourceDisksNames] -
trunk/src/VBox/HostDrivers/VBoxUSB/win/mon/VBoxUsbMon.cpp
r54826 r55473 68 68 69 69 #ifdef VBOX_USB3PORT 70 #define VBOXUSBMON_MAXDRIVERS 370 #define VBOXUSBMON_MAXDRIVERS 5 71 71 typedef struct VBOXUSB_PNPDRIVER 72 72 { … … 1137 1137 VBOX_PNPHOOKSTUB(1) 1138 1138 VBOX_PNPHOOKSTUB(2) 1139 AssertCompile(VBOXUSBMON_MAXDRIVERS == 3); 1139 VBOX_PNPHOOKSTUB(3) 1140 VBOX_PNPHOOKSTUB(4) 1141 AssertCompile(VBOXUSBMON_MAXDRIVERS == 5); 1140 1142 1141 1143 typedef struct VBOXUSBMONHOOKDRIVERWALKER … … 1143 1145 PDRIVER_OBJECT pDrvObj; 1144 1146 } VBOXUSBMONHOOKDRIVERWALKER, *PVBOXUSBMONHOOKDRIVERWALKER; 1147 1148 /** 1149 * Logs an error to the system event log. 1150 * 1151 * @param ErrCode Error to report to event log. 1152 * @param ReturnedStatus Error that was reported by the driver to the caller. 1153 * @param uErrId Unique error id representing the location in the driver. 1154 * @param cbDumpData Number of bytes at pDumpData. 1155 * @param pDumpData Pointer to data that will be added to the message (see 'details' tab). 1156 */ 1157 static void vboxUsbMonLogError(NTSTATUS ErrCode, NTSTATUS ReturnedStatus, ULONG uErrId, USHORT cbDumpData, PVOID pDumpData) 1158 { 1159 PIO_ERROR_LOG_PACKET pErrEntry; 1160 1161 1162 /* Truncate dumps that do not fit into IO_ERROR_LOG_PACKET. */ 1163 if (FIELD_OFFSET(IO_ERROR_LOG_PACKET, DumpData) + cbDumpData > ERROR_LOG_MAXIMUM_SIZE) 1164 cbDumpData = ERROR_LOG_MAXIMUM_SIZE - FIELD_OFFSET(IO_ERROR_LOG_PACKET, DumpData); 1165 1166 pErrEntry = (PIO_ERROR_LOG_PACKET)IoAllocateErrorLogEntry(g_VBoxUsbMonGlobals.pDevObj, 1167 FIELD_OFFSET(IO_ERROR_LOG_PACKET, DumpData) + cbDumpData); 1168 if (pErrEntry) 1169 { 1170 uint8_t *pDump = (uint8_t *)pErrEntry->DumpData; 1171 if (cbDumpData) 1172 memcpy(pDump, pDumpData, cbDumpData); 1173 pErrEntry->MajorFunctionCode = 0; 1174 pErrEntry->RetryCount = 0; 1175 pErrEntry->DumpDataSize = cbDumpData; 1176 pErrEntry->NumberOfStrings = 0; 1177 pErrEntry->StringOffset = 0; 1178 pErrEntry->ErrorCode = ErrCode; 1179 pErrEntry->UniqueErrorValue = uErrId; 1180 pErrEntry->FinalStatus = ReturnedStatus; 1181 pErrEntry->IoControlCode = 0; 1182 IoWriteErrorLogEntry(pErrEntry); 1183 } 1184 else 1185 { 1186 LOG(("Failed to allocate error log entry (cb=%d)\n", FIELD_OFFSET(IO_ERROR_LOG_PACKET, DumpData) + cbDumpData)); 1187 } 1188 } 1145 1189 1146 1190 static DECLCALLBACK(BOOLEAN) vboxUsbMonHookDrvObjWalker(PFILE_OBJECT pFile, PDEVICE_OBJECT pTopDo, PDEVICE_OBJECT pHubDo, PVOID pvContext) … … 1181 1225 /* No empty slots! No reason to continue. */ 1182 1226 LOG(("No empty slots!\n")); 1227 ANSI_STRING ansiDrvName; 1228 NTSTATUS Status = RtlUnicodeStringToAnsiString(&ansiDrvName, &pDrvObj->DriverName, true); 1229 if (Status != STATUS_SUCCESS) 1230 { 1231 ansiDrvName.Length = 0; 1232 LOG(("RtlUnicodeStringToAnsiString failed with 0x%x", Status)); 1233 } 1234 vboxUsbMonLogError(IO_ERR_INSUFFICIENT_RESOURCES, STATUS_SUCCESS, 1, ansiDrvName.Length, ansiDrvName.Buffer); 1235 if (Status == STATUS_SUCCESS) 1236 RtlFreeAnsiString(&ansiDrvName); 1183 1237 return FALSE; 1184 1238 } … … 1860 1914 VBOX_PNPHOOKSTUB_INIT(1); 1861 1915 VBOX_PNPHOOKSTUB_INIT(2); 1862 AssertCompile(VBOXUSBMON_MAXDRIVERS == 3); 1916 VBOX_PNPHOOKSTUB_INIT(3); 1917 VBOX_PNPHOOKSTUB_INIT(4); 1918 AssertCompile(VBOXUSBMON_MAXDRIVERS == 5); 1863 1919 #endif /* VBOX_USB3PORT */ 1864 1920 KeInitializeEvent(&g_VBoxUsbMonGlobals.OpenSynchEvent, SynchronizationEvent, TRUE /* signaled */);
Note:
See TracChangeset
for help on using the changeset viewer.