VirtualBox

Ignore:
Timestamp:
Sep 1, 2022 8:36:22 PM (2 years ago)
Author:
vboxsync
Message:

HostDrives,Installer/win: Reworked the windows installer related code for no-CRT mode, where applicable, and changed the XxxxInstall.exe/XxxxUninstall.exe utilities to link against VBoxRT.dll instead of being statically linked. Lot's of cleanup. The change is uncomfortably large, but difficult to detangle these things. bugref:10261

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/VBoxUSB/win/testcase/USBTest.cpp

    r96407 r96572  
    4242#include <iprt/win/setupapi.h>
    4343#include <newdev.h>
     44
    4445#include <iprt/assert.h>
    45 #include <iprt/err.h>
     46#include <VBox/err.h>
    4647#include <iprt/param.h>
    4748#include <iprt/path.h>
     49#include <iprt/stream.h>
    4850#include <iprt/string.h>
    49 #include <VBox/err.h>
    50 #include <stdio.h>
    5151#include <VBox/usblib.h>
    5252#include <VBox/VBoxDrvCfg-win.h>
    5353
     54
     55/*********************************************************************************************************************************
     56*   Global Variables                                                                                                             *
     57*********************************************************************************************************************************/
    5458/** Handle to the open device. */
    5559static HANDLE   g_hUSBMonitor = INVALID_HANDLE_VALUE;
     
    5761static bool     g_fStartedService = false;
    5862
     63
    5964/**
    6065 * Attempts to start the service, creating it if necessary.
     
    8388int usbMonStopService(void)
    8489{
    85     printf("usbMonStopService\n");
     90    RTPrintf("usbMonStopService\n");
     91
    8692    /*
    8793     * Assume it didn't exist, so we'll create the service.
     
    141147    DWORD          cbReturned = 0;
    142148
    143     printf("usbLibReleaseDevice %x %x %x\n", usVendorId, usProductId, usRevision);
     149    RTPrintf("usbLibReleaseDevice %x %x %x\n", usVendorId, usProductId, usRevision);
    144150
    145151    release.usVendorId  = usVendorId;
     
    174180    Assert(g_hUSBMonitor);
    175181
    176     printf("usblibInsertFilter %04X %04X %04X\n", usVendorId, usProductId, usRevision);
     182    RTPrintf("usblibInsertFilter %04X %04X %04X\n", usVendorId, usProductId, usRevision);
    177183
    178184    USBFilterInit(&filter, USBFILTERTYPE_CAPTURE);
     
    222228    Assert(g_hUSBMonitor);
    223229
    224     printf("usblibRemoveFilter %p\n", aID);
     230    RTPrintf("usblibRemoveFilter %p\n", aID);
    225231
    226232    uId = (uintptr_t)aID;
     
    244250    DWORD          cbReturned;
    245251
    246     printf("usbproxy: usbLibInit\n");
     252    RTPrintf("usbproxy: usbLibInit\n");
    247253
    248254    g_hUSBMonitor = CreateFile (USBMON_DEVICE_NAME,
     
    269275        {
    270276            /* 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());
    272278            rc = VERR_FILE_NOT_FOUND;
    273279            goto failure;
     
    281287    if (!DeviceIoControl(g_hUSBMonitor, SUPUSBFLT_IOCTL_GET_VERSION, NULL, 0,&version, sizeof(version),  &cbReturned, NULL))
    282288    {
    283         printf("usbproxy: Unable to query filter version!! (rc=%lu)\n", GetLastError());
     289        RTPrintf("usbproxy: Unable to query filter version!! (rc=%lu)\n", GetLastError());
    284290        rc = VERR_VERSION_MISMATCH;
    285291        goto failure;
     
    292298        )
    293299    {
    294         printf("usbproxy: Filter driver version mismatch!!\n");
     300        RTPrintf("usbproxy: Filter driver version mismatch!!\n");
    295301        rc = VERR_VERSION_MISMATCH;
    296302        goto failure;
     
    344350    RT_NOREF2(argc, argv);
    345351
    346     printf("USB test\n");
     352    RTPrintf("USB test\n");
    347353
    348354    rc = usbMonitorInit();
     
    355361    usbMonInsertFilter(0x80EE, 0x0030, 0x0110, &pId3);
    356362
    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);
    359365    if (c == 'r')
    360366    {
    361367        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");
    368374    usbMonReleaseDevice(0xA16, 0x2499, 0x100);
    369375
     
    376382    return 0;
    377383}
     384
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette