VirtualBox

Ignore:
Timestamp:
Dec 17, 2009 2:49:34 PM (15 years ago)
Author:
vboxsync
Message:

SUPDrv,++: Made SUPDrv.c platform agnostic and renamed SUPDrvAgnostic.c to SUPDrvSem.c. dprintf and dprintf2 are no more (Log/Log2), while OSDBGPRINT simply calls SUPR0Printf.

Location:
trunk/src/VBox/HostDrivers/Support/win
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/win/SUPDrv-win.cpp

    r25361 r25465  
    106106{
    107107    NTSTATUS    rc;
    108     dprintf(("VBoxDrv::DriverEntry\n"));
    109108
    110109    /*
     
    127126            if (RT_SUCCESS(rc))
    128127            {
     128                Log(("VBoxDrv::DriverEntry\n"));
     129
    129130                /*
    130131                 * Initialize the device extension.
     
    162163                        pDevExt->hPowerCallback = ExRegisterCallback(pDevExt->pObjPowerCallback, VBoxPowerDispatchCallback, pDevObj);
    163164
    164                     dprintf(("VBoxDrv::DriverEntry returning STATUS_SUCCESS\n"));
     165                    Log(("VBoxDrv::DriverEntry returning STATUS_SUCCESS\n"));
    165166                    return STATUS_SUCCESS;
    166167                }
    167168
    168                 dprintf(("supdrvInitDevExit failed with vrc=%d!\n", vrc));
     169                Log(("supdrvInitDevExit failed with vrc=%d!\n", vrc));
    169170                rc = VBoxDrvNtErr2NtStatus(vrc);
    170171
     
    174175            else
    175176            {
    176                 dprintf(("RTR0Init failed with vrc=%d!\n", vrc));
     177                Log(("RTR0Init failed with vrc=%d!\n", vrc));
    177178                rc = VBoxDrvNtErr2NtStatus(vrc);
    178179            }
    179180        }
    180181        else
    181             dprintf(("IoCreateSymbolicLink failed with rc=%#x!\n", rc));
     182            Log(("IoCreateSymbolicLink failed with rc=%#x!\n", rc));
    182183
    183184        IoDeleteDevice(pDevObj);
    184185    }
    185186    else
    186         dprintf(("IoCreateDevice failed with rc=%#x!\n", rc));
     187        Log(("IoCreateDevice failed with rc=%#x!\n", rc));
    187188
    188189    if (NT_SUCCESS(rc))
    189190        rc = STATUS_INVALID_PARAMETER;
    190     dprintf(("VBoxDrv::DriverEntry returning %#x\n", rc));
     191    Log(("VBoxDrv::DriverEntry returning %#x\n", rc));
    191192    return rc;
    192193}
     
    202203    PSUPDRVDEVEXT pDevExt = (PSUPDRVDEVEXT)pDrvObj->DeviceObject->DeviceExtension;
    203204
    204     dprintf(("VBoxDrvNtUnload at irql %d\n", KeGetCurrentIrql()));
     205    Log(("VBoxDrvNtUnload at irql %d\n", KeGetCurrentIrql()));
    205206
    206207    /* Clean up the power callback registration. */
     
    235236NTSTATUS _stdcall VBoxDrvNtCreate(PDEVICE_OBJECT pDevObj, PIRP pIrp)
    236237{
    237     dprintf(("VBoxDrvNtCreate\n"));
     238    Log(("VBoxDrvNtCreate\n"));
    238239    PIO_STACK_LOCATION  pStack = IoGetCurrentIrpStackLocation(pIrp);
    239240    PFILE_OBJECT        pFileObj = pStack->FileObject;
     
    285286    PIO_STACK_LOCATION  pStack = IoGetCurrentIrpStackLocation(pIrp);
    286287    PFILE_OBJECT        pFileObj = pStack->FileObject;
    287     dprintf(("VBoxDrvNtClose: pDevExt=%p pFileObj=%p pSession=%p\n",
    288              pDevExt, pFileObj, pFileObj->FsContext));
     288    Log(("VBoxDrvNtClose: pDevExt=%p pFileObj=%p pSession=%p\n",
     289         pDevExt, pFileObj, pFileObj->FsContext));
    289290    supdrvCloseSession(pDevExt, (PSUPDRVSESSION)pFileObj->FsContext);
    290291    pFileObj->FsContext = NULL;
     
    358359    unsigned    cbOut = 0;
    359360    int         rc = 0;
    360     dprintf2(("VBoxDrvNtDeviceControlSlow(%p,%p): ioctl=%#x pBuf=%p cbIn=%#x cbOut=%#x pSession=%p\n",
    361              pDevExt, pIrp, pStack->Parameters.DeviceIoControl.IoControlCode,
    362              pIrp->AssociatedIrp.SystemBuffer, pStack->Parameters.DeviceIoControl.InputBufferLength,
    363              pStack->Parameters.DeviceIoControl.OutputBufferLength, pSession));
     361    Log2(("VBoxDrvNtDeviceControlSlow(%p,%p): ioctl=%#x pBuf=%p cbIn=%#x cbOut=%#x pSession=%p\n",
     362          pDevExt, pIrp, pStack->Parameters.DeviceIoControl.IoControlCode,
     363          pIrp->AssociatedIrp.SystemBuffer, pStack->Parameters.DeviceIoControl.InputBufferLength,
     364          pStack->Parameters.DeviceIoControl.OutputBufferLength, pSession));
    364365
    365366#ifdef RT_ARCH_AMD64
     
    394395                else
    395396                    rcNt = STATUS_INVALID_PARAMETER;
    396                 dprintf2(("VBoxDrvNtDeviceControlSlow: returns %#x cbOut=%d rc=%#x\n", rcNt, cbOut, rc));
     397                Log2(("VBoxDrvNtDeviceControlSlow: returns %#x cbOut=%d rc=%#x\n", rcNt, cbOut, rc));
    397398            }
    398399            else
    399400            {
    400                 dprintf(("VBoxDrvNtDeviceControlSlow: Mismatching sizes (%#x) - Hdr=%#lx/%#lx Irp=%#lx/%#lx!\n",
    401                          pStack->Parameters.DeviceIoControl.IoControlCode,
    402                          pStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(*pHdr) ? pHdr->cbIn : 0,
    403                          pStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(*pHdr) ? pHdr->cbOut : 0,
    404                          pStack->Parameters.DeviceIoControl.InputBufferLength,
    405                          pStack->Parameters.DeviceIoControl.OutputBufferLength));
     401                Log(("VBoxDrvNtDeviceControlSlow: Mismatching sizes (%#x) - Hdr=%#lx/%#lx Irp=%#lx/%#lx!\n",
     402                     pStack->Parameters.DeviceIoControl.IoControlCode,
     403                     pStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(*pHdr) ? pHdr->cbIn : 0,
     404                     pStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(*pHdr) ? pHdr->cbOut : 0,
     405                     pStack->Parameters.DeviceIoControl.InputBufferLength,
     406                     pStack->Parameters.DeviceIoControl.OutputBufferLength));
    406407                rcNt = STATUS_INVALID_PARAMETER;
    407408            }
     
    409410        else
    410411        {
    411             dprintf(("VBoxDrvNtDeviceControlSlow: not buffered request (%#x) - not supported\n",
    412                      pStack->Parameters.DeviceIoControl.IoControlCode));
     412            Log(("VBoxDrvNtDeviceControlSlow: not buffered request (%#x) - not supported\n",
     413                 pStack->Parameters.DeviceIoControl.IoControlCode));
    413414            rcNt = STATUS_NOT_SUPPORTED;
    414415        }
     
    417418    else
    418419    {
    419         dprintf(("VBoxDrvNtDeviceControlSlow: WOW64 req - not supported\n"));
     420        Log(("VBoxDrvNtDeviceControlSlow: WOW64 req - not supported\n"));
    420421        rcNt = STATUS_NOT_SUPPORTED;
    421422    }
     
    445446    unsigned            cbOut = 0;
    446447    int                 rc = 0;
    447     dprintf2(("VBoxDrvNtInternalDeviceControl(%p,%p): ioctl=%#x pBuf=%p cbIn=%#x cbOut=%#x pSession=%p\n",
    448              pDevExt, pIrp, pStack->Parameters.DeviceIoControl.IoControlCode,
    449              pIrp->AssociatedIrp.SystemBuffer, pStack->Parameters.DeviceIoControl.InputBufferLength,
    450              pStack->Parameters.DeviceIoControl.OutputBufferLength, pSession));
     448    Log2(("VBoxDrvNtInternalDeviceControl(%p,%p): ioctl=%#x pBuf=%p cbIn=%#x cbOut=%#x pSession=%p\n",
     449          pDevExt, pIrp, pStack->Parameters.DeviceIoControl.IoControlCode,
     450          pIrp->AssociatedIrp.SystemBuffer, pStack->Parameters.DeviceIoControl.InputBufferLength,
     451          pStack->Parameters.DeviceIoControl.OutputBufferLength, pSession));
    451452
    452453/** @todo IDC on NT: figure when to create the session and that stuff... */
     
    478479                else
    479480                    rcNt = STATUS_INVALID_PARAMETER;
    480                 dprintf2(("VBoxDrvNtInternalDeviceControl: returns %#x/rc=%#x\n", rcNt, rc));
     481                Log2(("VBoxDrvNtInternalDeviceControl: returns %#x/rc=%#x\n", rcNt, rc));
    481482            }
    482483            else
    483484            {
    484                 dprintf(("VBoxDrvNtInternalDeviceControl: Mismatching sizes (%#x) - Hdr=%#lx Irp=%#lx/%#lx!\n",
    485                          pStack->Parameters.DeviceIoControl.IoControlCode,
    486                          pStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(*pHdr) ? pHdr->cb : 0,
    487                          pStack->Parameters.DeviceIoControl.InputBufferLength,
    488                          pStack->Parameters.DeviceIoControl.OutputBufferLength));
     485                Log(("VBoxDrvNtInternalDeviceControl: Mismatching sizes (%#x) - Hdr=%#lx Irp=%#lx/%#lx!\n",
     486                     pStack->Parameters.DeviceIoControl.IoControlCode,
     487                     pStack->Parameters.DeviceIoControl.InputBufferLength >= sizeof(*pHdr) ? pHdr->cb : 0,
     488                     pStack->Parameters.DeviceIoControl.InputBufferLength,
     489                     pStack->Parameters.DeviceIoControl.OutputBufferLength));
    489490                rcNt = STATUS_INVALID_PARAMETER;
    490491            }
     
    495496    else
    496497    {
    497         dprintf(("VBoxDrvNtInternalDeviceControl: not buffered request (%#x) - not supported\n",
    498                  pStack->Parameters.DeviceIoControl.IoControlCode));
     498        Log(("VBoxDrvNtInternalDeviceControl: not buffered request (%#x) - not supported\n",
     499             pStack->Parameters.DeviceIoControl.IoControlCode));
    499500        rcNt = STATUS_NOT_SUPPORTED;
    500501    }
     
    517518NTSTATUS _stdcall VBoxDrvNtNotSupportedStub(PDEVICE_OBJECT pDevObj, PIRP pIrp)
    518519{
    519     dprintf(("VBoxDrvNtNotSupportedStub\n"));
     520    Log(("VBoxDrvNtNotSupportedStub\n"));
    520521    pDevObj = pDevObj;
    521522
     
    539540    PDEVICE_OBJECT pDevObj = (PDEVICE_OBJECT)pCallbackContext;
    540541
    541     dprintf(("VBoxPowerDispatchCallback: %x %x\n", pArgument1, pArgument2));
     542    Log(("VBoxPowerDispatchCallback: %x %x\n", pArgument1, pArgument2));
    542543
    543544    /* Power change imminent? */
     
    545546    {
    546547        if ((unsigned)pArgument2 == 0)
    547             dprintf(("VBoxPowerDispatchCallback: about to go into suspend mode!\n"));
     548            Log(("VBoxPowerDispatchCallback: about to go into suspend mode!\n"));
    548549        else
    549             dprintf(("VBoxPowerDispatchCallback: resumed!\n"));
     550            Log(("VBoxPowerDispatchCallback: resumed!\n"));
    550551
    551552        /* Inform any clients that have registered themselves with IPRT. */
     
    885886
    886887/**
    887  * Converts a supdrv error code to an nt status code.
     888 * Converts an IPRT error code to an nt status code.
    888889 *
    889890 * @returns corresponding nt status code.
    890  * @param   rc  supdrv error code (SUPDRV_ERR_* defines).
     891 * @param   rc      IPRT error status code.
    891892 */
    892893static NTSTATUS     VBoxDrvNtErr2NtStatus(int rc)
     
    894895    switch (rc)
    895896    {
    896         case 0:                             return STATUS_SUCCESS;
    897         case SUPDRV_ERR_GENERAL_FAILURE:    return STATUS_NOT_SUPPORTED;
    898         case SUPDRV_ERR_INVALID_PARAM:      return STATUS_INVALID_PARAMETER;
    899         case SUPDRV_ERR_INVALID_MAGIC:      return STATUS_UNKNOWN_REVISION;
    900         case SUPDRV_ERR_INVALID_HANDLE:     return STATUS_INVALID_HANDLE;
    901         case SUPDRV_ERR_INVALID_POINTER:    return STATUS_INVALID_ADDRESS;
    902         case SUPDRV_ERR_LOCK_FAILED:        return STATUS_NOT_LOCKED;
    903         case SUPDRV_ERR_ALREADY_LOADED:     return STATUS_IMAGE_ALREADY_LOADED;
    904         case SUPDRV_ERR_PERMISSION_DENIED:  return STATUS_ACCESS_DENIED;
    905         case SUPDRV_ERR_VERSION_MISMATCH:   return STATUS_REVISION_MISMATCH;
     897        case VINF_SUCCESS:                  return STATUS_SUCCESS;
     898        case VERR_GENERAL_FAILURE:          return STATUS_NOT_SUPPORTED;
     899        case VERR_INVALID_PARAMETER:        return STATUS_INVALID_PARAMETER;
     900        case VERR_INVALID_MAGIC:            return STATUS_UNKNOWN_REVISION;
     901        case VERR_INVALID_HANDLE:           return STATUS_INVALID_HANDLE;
     902        case VERR_INVALID_POINTER:          return STATUS_INVALID_ADDRESS;
     903        case VERR_LOCK_FAILED:              return STATUS_NOT_LOCKED;
     904        case VERR_ALREADY_LOADED:           return STATUS_IMAGE_ALREADY_LOADED;
     905        case VERR_PERMISSION_DENIED:        return STATUS_ACCESS_DENIED;
     906        case VERR_VERSION_MISMATCH:         return STATUS_REVISION_MISMATCH;
    906907    }
    907908
  • trunk/src/VBox/HostDrivers/Support/win/SUPLib-win.cpp

    r19924 r25465  
    536536
    537537/**
    538  * Converts a supdrv error code to an nt status code.
    539  *
    540  * @returns corresponding SUPDRV_ERR_*.
     538 * Converts a supdrv win32 error code to an IPRT status code.
     539 *
     540 * @returns corresponding IPRT error code.
    541541 * @param   rc  Win32 error code.
    542542 */
     
    572572        //case 0:                             return STATUS_SUCCESS;
    573573        case 0:                             return VINF_SUCCESS;
    574         //case SUPDRV_ERR_GENERAL_FAILURE:    return STATUS_NOT_SUPPORTED;
    575574        case ERROR_NOT_SUPPORTED:           return VERR_GENERAL_FAILURE;
    576         //case SUPDRV_ERR_INVALID_PARAM:      return STATUS_INVALID_PARAMETER;
    577575        case ERROR_INVALID_PARAMETER:       return VERR_INVALID_PARAMETER;
    578         //case SUPDRV_ERR_INVALID_MAGIC:      return STATUS_ACCESS_DENIED;
    579576        case ERROR_UNKNOWN_REVISION:        return VERR_INVALID_MAGIC;
    580         //case SUPDRV_ERR_INVALID_HANDLE:     return STATUS_INVALID_HANDLE;
    581577        case ERROR_INVALID_HANDLE:          return VERR_INVALID_HANDLE;
    582         //case SUPDRV_ERR_INVALID_POINTER:    return STATUS_INVALID_ADDRESS;
    583578        case ERROR_UNEXP_NET_ERR:           return VERR_INVALID_POINTER;
    584         //case SUPDRV_ERR_LOCK_FAILED:        return STATUS_NOT_LOCKED;
    585579        case ERROR_NOT_LOCKED:              return VERR_LOCK_FAILED;
    586         //case SUPDRV_ERR_ALREADY_LOADED:     return STATUS_IMAGE_ALREADY_LOADED;
    587580        case ERROR_SERVICE_ALREADY_RUNNING: return VERR_ALREADY_LOADED;
    588         //case SUPDRV_ERR_PERMISSION_DENIED:  return STATUS_ACCESS_DENIED;
    589581        case ERROR_ACCESS_DENIED:           return VERR_PERMISSION_DENIED;
    590         //case SUPDRV_ERR_VERSION_MISMATCH:   return STATUS_REVISION_MISMATCH;
    591582        case ERROR_REVISION_MISMATCH:       return VERR_VERSION_MISMATCH;
    592583    }
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