Changeset 96572 in vbox for trunk/src/VBox/HostDrivers/VBoxUSB
- Timestamp:
- Sep 1, 2022 8:36:22 PM (3 years ago)
- svn:sync-xref-src-repo-rev:
- 153448
- Location:
- trunk/src/VBox/HostDrivers/VBoxUSB/win
- Files:
-
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/HostDrivers/VBoxUSB/win/Install/USBInstall.cpp
r96407 r96572 75 75 76 76 77 static DECLCALLBACK(void) vboxUsbLog(VBOXDRVCFG_LOG_SEVERITY enmSeverity, char *pszMsg, void *pvContext)77 static DECLCALLBACK(void) vboxUsbLog(VBOXDRVCFG_LOG_SEVERITY_T enmSeverity, char *pszMsg, void *pvContext) 78 78 { 79 79 RT_NOREF1(pvContext); … … 84 84 break; 85 85 case VBOXDRVCFG_LOG_SEVERITY_REL: 86 RT Printf("%s", pszMsg);86 RTMsgInfo("%s", pszMsg); 87 87 break; 88 88 default: … … 106 106 return RTMsgInitFailure(rc); 107 107 108 RTMsgInfo("USB installation"); 109 108 110 VBoxDrvCfgLoggerSet(vboxUsbLog, NULL); 109 111 VBoxDrvCfgPanicSet(vboxUsbPanic, NULL); 110 111 RTPrintf("USB installation\n");112 112 113 113 rc = usblibOsCreateService(); … … 130 130 HRESULT hr = VBoxDrvCfgInfInstall(pwszInfFile); 131 131 if (hr == S_OK) 132 RT Printf("Installation successful.\n");132 RTMsgInfo("Installation successful!"); 133 133 else 134 rc = -1; 134 { 135 RTMsgError("Installation failed: %Rhrc", hr); 136 rc = VERR_GENERAL_FAILURE; 137 } 135 138 136 139 RTUtf16Free(pwszInfFile); … … 139 142 RTMsgError("Failed to construct INF path: %Rrc", rc); 140 143 } 144 else 145 RTMsgError("Service creation failed: %Rrc", rc); 141 146 142 147 return RT_SUCCESS(rc) ? RTEXITCODE_SUCCESS : RTEXITCODE_FAILURE; -
trunk/src/VBox/HostDrivers/VBoxUSB/win/Install/USBUninstall.cpp
r96407 r96572 45 45 #include <iprt/assert.h> 46 46 #include <iprt/errcore.h> 47 #include <iprt/initterm.h> 48 #include <iprt/message.h> 47 49 #include <iprt/param.h> 48 50 #include <iprt/path.h> 49 51 #include <iprt/string.h> 50 #include <iprt/errcore.h>51 52 #include <VBox/VBoxDrvCfg-win.h> 52 #include <stdio.h> 53 54 55 int usblibOsStopService(void); 56 int usblibOsDeleteService(void); 57 58 static DECLCALLBACK(void) vboxUsbLog(VBOXDRVCFG_LOG_SEVERITY enmSeverity, char *pszMsg, void *pvContext) 59 { 60 RT_NOREF1(pvContext); 61 switch (enmSeverity) 62 { 63 case VBOXDRVCFG_LOG_SEVERITY_FLOW: 64 case VBOXDRVCFG_LOG_SEVERITY_REGULAR: 65 break; 66 case VBOXDRVCFG_LOG_SEVERITY_REL: 67 printf("%s", pszMsg); 68 break; 69 default: 70 break; 71 } 72 } 73 74 static DECLCALLBACK(void) vboxUsbPanic(void *pvPanic) 75 { 76 RT_NOREF1(pvPanic); 77 #ifndef DEBUG_bird 78 AssertFailed(); 79 #endif 80 } 81 82 83 int __cdecl main(int argc, char **argv) 84 { 85 RT_NOREF2(argc, argv); 86 printf("USB uninstallation\n"); 87 88 VBoxDrvCfgLoggerSet(vboxUsbLog, NULL); 89 VBoxDrvCfgPanicSet(vboxUsbPanic, NULL); 90 91 usblibOsStopService(); 92 usblibOsDeleteService(); 93 94 HRESULT hr = VBoxDrvCfgInfUninstallAllF(L"USB", L"USB\\VID_80EE&PID_CAFE", SUOI_FORCEDELETE); 95 if (hr != S_OK) 96 { 97 printf("SetupUninstallOEMInf failed with hr=0x%lx\n", hr); 98 return 1; 99 } 100 101 printf("USB uninstallation succeeded!\n"); 102 103 return 0; 104 } 105 53 54 55 /********************************************************************************************************************************* 56 * Defined Constants And Macros * 57 *********************************************************************************************************************************/ 106 58 /** The support service name. */ 107 59 #define SERVICE_NAME "VBoxUSBMon" … … 113 65 #define DEVICE_NAME_DOS L"\\DosDevices\\VBoxUSBMon" 114 66 67 68 /********************************************************************************************************************************* 69 * Internal Functions * 70 *********************************************************************************************************************************/ 71 static int usblibOsStopService(void); 72 static int usblibOsDeleteService(void); 73 74 75 static DECLCALLBACK(void) vboxUsbLog(VBOXDRVCFG_LOG_SEVERITY_T enmSeverity, char *pszMsg, void *pvContext) 76 { 77 RT_NOREF1(pvContext); 78 switch (enmSeverity) 79 { 80 case VBOXDRVCFG_LOG_SEVERITY_FLOW: 81 case VBOXDRVCFG_LOG_SEVERITY_REGULAR: 82 break; 83 case VBOXDRVCFG_LOG_SEVERITY_REL: 84 RTMsgInfo("%s", pszMsg); 85 break; 86 default: 87 break; 88 } 89 } 90 91 static DECLCALLBACK(void) vboxUsbPanic(void *pvPanic) 92 { 93 RT_NOREF1(pvPanic); 94 #ifndef DEBUG_bird 95 AssertFailed(); 96 #endif 97 } 98 99 100 int __cdecl main(int argc, char **argv) 101 { 102 RTR3InitExeNoArguments(0); 103 if (argc != 1) 104 return RTMsgErrorExit(RTEXITCODE_SYNTAX, "This utility takes no arguments\n"); 105 NOREF(argv); 106 RTMsgInfo("USB uninstallation\n"); 107 108 VBoxDrvCfgLoggerSet(vboxUsbLog, NULL); 109 VBoxDrvCfgPanicSet(vboxUsbPanic, NULL); 110 111 usblibOsStopService(); 112 usblibOsDeleteService(); 113 114 HRESULT hr = VBoxDrvCfgInfUninstallAllF(L"USB", L"USB\\VID_80EE&PID_CAFE", SUOI_FORCEDELETE); 115 if (hr != S_OK) 116 return RTMsgErrorExitFailure("SetupUninstallOEMInf failed: %Rhrc\n", hr); 117 118 RTMsgInfo("USB uninstallation succeeded!"); 119 return 0; 120 } 121 122 115 123 /** 116 124 * Stops a possibly running service. … … 119 127 * @returns -1 on failure. 120 128 */ 121 int usblibOsStopService(void)129 static int usblibOsStopService(void) 122 130 { 123 131 /* … … 176 184 * @returns -1 on failure. 177 185 */ 178 int usblibOsDeleteService(void)186 static int usblibOsDeleteService(void) 179 187 { 180 188 /* -
trunk/src/VBox/HostDrivers/VBoxUSB/win/Makefile.kmk
r96407 r96572 122 122 # 123 123 TEMPLATE_VBoxUsbR3 = Template for USBInstalls, USBUninstall and USBTest 124 TEMPLATE_VBoxUsbR3_EXTENDS = VBoxR3Static 125 TEMPLATE_VBoxUsbR3_SDKS = $(TEMPLATE_VBoxR3Static_SDKS) ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_WIN_NEWDEV 126 TEMPLATE_VBoxUsbR3_CXXFLAGS = $(TEMPLATE_VBoxR3Static_CXXFLAGS) -Gz 127 TEMPLATE_VBoxUsbR3_CFLAGS = $(TEMPLATE_VBoxR3Static_CFLAGS) -Gz 128 TEMPLATE_VBoxUsbR3_LIBS = $(TEMPLATE_VBoxR3Static_LIBS) \ 129 $(PATH_STAGE_LIB)/VBoxDrvCfg$(VBOX_SUFF_LIB) 124 TEMPLATE_VBoxUsbR3_EXTENDS = VBOXR3EXE 125 TEMPLATE_VBoxUsbR3_SDKS = $(TEMPLATE_VBOXR3EXE_SDKS) ReorderCompilerIncs $(VBOX_WINPSDK) $(VBOX_WINDDK) VBOX_WIN_NEWDEV 126 TEMPLATE_VBoxUsbR3_CXXFLAGS = $(TEMPLATE_VBOXR3EXE_CXXFLAGS) -Gz 127 TEMPLATE_VBoxUsbR3_CFLAGS = $(TEMPLATE_VBOXR3EXE_CFLAGS) -Gz 128 TEMPLATE_VBoxUsbR3_LIBS = $(TEMPLATE_VBOXR3EXE_LIBS) \ 129 $(PATH_STAGE_LIB)/VBoxDrvCfgExe$(VBOX_SUFF_LIB) \ 130 $(LIB_RUNTIME) 130 131 131 132 # -
trunk/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp
r96407 r96572 42 42 #include <iprt/win/setupapi.h> 43 43 #include <newdev.h> 44 44 45 #include <iprt/assert.h> 45 #include < iprt/err.h>46 #include <VBox/err.h> 46 47 #include <iprt/param.h> 47 48 #include <iprt/path.h> 49 #include <iprt/stream.h> 48 50 #include <iprt/string.h> 49 #include <VBox/err.h>50 #include <stdio.h>51 51 #include <VBox/usblib.h> 52 52 #include <VBox/VBoxDrvCfg-win.h> 53 53 54 55 /********************************************************************************************************************************* 56 * Global Variables * 57 *********************************************************************************************************************************/ 54 58 /** Handle to the open device. */ 55 59 static HANDLE g_hUSBMonitor = INVALID_HANDLE_VALUE; … … 57 61 static bool g_fStartedService = false; 58 62 63 59 64 /** 60 65 * Attempts to start the service, creating it if necessary. … … 83 88 int usbMonStopService(void) 84 89 { 85 printf("usbMonStopService\n"); 90 RTPrintf("usbMonStopService\n"); 91 86 92 /* 87 93 * Assume it didn't exist, so we'll create the service. … … 141 147 DWORD cbReturned = 0; 142 148 143 printf("usbLibReleaseDevice %x %x %x\n", usVendorId, usProductId, usRevision);149 RTPrintf("usbLibReleaseDevice %x %x %x\n", usVendorId, usProductId, usRevision); 144 150 145 151 release.usVendorId = usVendorId; … … 174 180 Assert(g_hUSBMonitor); 175 181 176 printf("usblibInsertFilter %04X %04X %04X\n", usVendorId, usProductId, usRevision);182 RTPrintf("usblibInsertFilter %04X %04X %04X\n", usVendorId, usProductId, usRevision); 177 183 178 184 USBFilterInit(&filter, USBFILTERTYPE_CAPTURE); … … 222 228 Assert(g_hUSBMonitor); 223 229 224 printf("usblibRemoveFilter %p\n", aID);230 RTPrintf("usblibRemoveFilter %p\n", aID); 225 231 226 232 uId = (uintptr_t)aID; … … 244 250 DWORD cbReturned; 245 251 246 printf("usbproxy: usbLibInit\n");252 RTPrintf("usbproxy: usbLibInit\n"); 247 253 248 254 g_hUSBMonitor = CreateFile (USBMON_DEVICE_NAME, … … 269 275 { 270 276 /* AssertFailed(); */ 271 printf("usbproxy: Unable to open filter driver!! (rc=%lu)\n", GetLastError());277 RTPrintf("usbproxy: Unable to open filter driver!! (rc=%lu)\n", GetLastError()); 272 278 rc = VERR_FILE_NOT_FOUND; 273 279 goto failure; … … 281 287 if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_GET_VERSION, NULL, 0,&version, sizeof(version), &cbReturned, NULL)) 282 288 { 283 printf("usbproxy: Unable to query filter version!! (rc=%lu)\n", GetLastError());289 RTPrintf("usbproxy: Unable to query filter version!! (rc=%lu)\n", GetLastError()); 284 290 rc = VERR_VERSION_MISMATCH; 285 291 goto failure; … … 292 298 ) 293 299 { 294 printf("usbproxy: Filter driver version mismatch!!\n");300 RTPrintf("usbproxy: Filter driver version mismatch!!\n"); 295 301 rc = VERR_VERSION_MISMATCH; 296 302 goto failure; … … 344 350 RT_NOREF2(argc, argv); 345 351 346 printf("USB test\n");352 RTPrintf("USB test\n"); 347 353 348 354 rc = usbMonitorInit(); … … 355 361 usbMonInsertFilter(0x80EE, 0x0030, 0x0110, &pId3); 356 362 357 printf("Waiting to capture devices... enter 'r' to run filters\n");358 c = getchar();363 RTPrintf("Waiting to capture devices... enter 'r' to run filters\n"); 364 c = RTStrmGetCh(g_pStdIn); 359 365 if (c == 'r') 360 366 { 361 367 usbMonRunFilters(); 362 printf("Waiting to capture devices...\n");363 getchar(); /* eat the '\n' */364 getchar(); /* wait for more input */365 } 366 367 printf("Releasing device\n");368 RTPrintf("Waiting to capture devices...\n"); 369 RTStrmGetCh(g_pStdIn); /* eat the '\n' */ 370 RTStrmGetCh(g_pStdIn); /* wait for more input */ 371 } 372 373 RTPrintf("Releasing device\n"); 368 374 usbMonReleaseDevice(0xA16, 0x2499, 0x100); 369 375 … … 376 382 return 0; 377 383 } 384
Note:
See TracChangeset
for help on using the changeset viewer.