diff options
author | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-16 18:33:28 +0100 |
---|---|---|
committer | Mounir IDRASSI <mounir.idrassi@idrix.fr> | 2024-11-16 18:33:28 +0100 |
commit | b7f6270c0d480318e307d3e2631fc686529776a3 (patch) | |
tree | 6249d69afdb2ac1bf5e03b2502a3698bdf9afb0d /src/Driver/Ntdriver.c | |
parent | a588b20975b18b56b513e12a1fa312d6a97e9396 (diff) | |
download | VeraCrypt-b7f6270c0d480318e307d3e2631fc686529776a3.tar.gz VeraCrypt-b7f6270c0d480318e307d3e2631fc686529776a3.zip |
Windows Driver: Add Unicode define to build and enhance tracing in debug mode
Diffstat (limited to 'src/Driver/Ntdriver.c')
-rw-r--r-- | src/Driver/Ntdriver.c | 226 |
1 files changed, 79 insertions, 147 deletions
diff --git a/src/Driver/Ntdriver.c b/src/Driver/Ntdriver.c index 63e95d69..e6b7af1f 100644 --- a/src/Driver/Ntdriver.c +++ b/src/Driver/Ntdriver.c @@ -571,8 +571,9 @@ NTSTATUS TCDispatchQueueIRP (PDEVICE_OBJECT DeviceObject, PIRP Irp) break; default: - Dump ("%ls (0x%x %d)\n", + Dump ("%ls 0x%.8X (0x%.4X %d)\n", TCTranslateCode (irpSp->Parameters.DeviceIoControl.IoControlCode), + (int) (irpSp->Parameters.DeviceIoControl.IoControlCode), (int) (irpSp->Parameters.DeviceIoControl.IoControlCode >> 16), (int) ((irpSp->Parameters.DeviceIoControl.IoControlCode & 0x1FFF) >> 2)); } @@ -1886,7 +1887,9 @@ NTSTATUS ProcessVolumeDeviceControlIrp (PDEVICE_OBJECT DeviceObject, PEXTENSION Irp->IoStatus.Information = 0; break; default: - Dump ("ProcessVolumeDeviceControlIrp (unknown code 0x%.8X)\n", irpSp->Parameters.DeviceIoControl.IoControlCode); + Dump ("ProcessVolumeDeviceControlIrp: unknown code 0x%.8X (0x%.4X %d)\n", irpSp->Parameters.DeviceIoControl.IoControlCode, + (int)(irpSp->Parameters.DeviceIoControl.IoControlCode >> 16), + (int)((irpSp->Parameters.DeviceIoControl.IoControlCode & 0x1FFF) >> 2)); return TCCompleteIrp (Irp, STATUS_INVALID_DEVICE_REQUEST, 0); } @@ -3274,152 +3277,81 @@ LPWSTR TCTranslateCode (ULONG ulCode) TC_CASE_RET_NAME (IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS); -#undef TC_CASE_RET_NAME - } + TC_CASE_RET_NAME(IOCTL_DISK_GET_DRIVE_GEOMETRY); + TC_CASE_RET_NAME(IOCTL_DISK_GET_DRIVE_GEOMETRY_EX); + TC_CASE_RET_NAME(IOCTL_MOUNTDEV_QUERY_DEVICE_NAME); + TC_CASE_RET_NAME(IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME); + TC_CASE_RET_NAME(IOCTL_MOUNTDEV_QUERY_UNIQUE_ID); + TC_CASE_RET_NAME(IOCTL_VOLUME_ONLINE); + TC_CASE_RET_NAME(IOCTL_MOUNTDEV_LINK_CREATED); + TC_CASE_RET_NAME(IOCTL_MOUNTDEV_LINK_DELETED); + TC_CASE_RET_NAME(IOCTL_MOUNTMGR_QUERY_POINTS); + TC_CASE_RET_NAME(IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED); + TC_CASE_RET_NAME(IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED); + TC_CASE_RET_NAME(IOCTL_DISK_GET_LENGTH_INFO); + TC_CASE_RET_NAME(IOCTL_STORAGE_GET_DEVICE_NUMBER); + TC_CASE_RET_NAME(IOCTL_DISK_GET_PARTITION_INFO); + TC_CASE_RET_NAME(IOCTL_DISK_GET_PARTITION_INFO_EX); + TC_CASE_RET_NAME(IOCTL_DISK_SET_PARTITION_INFO); + TC_CASE_RET_NAME(IOCTL_DISK_GET_DRIVE_LAYOUT); + TC_CASE_RET_NAME(IOCTL_DISK_GET_DRIVE_LAYOUT_EX); + TC_CASE_RET_NAME(IOCTL_DISK_SET_DRIVE_LAYOUT_EX); + TC_CASE_RET_NAME(IOCTL_DISK_VERIFY); + TC_CASE_RET_NAME(IOCTL_DISK_FORMAT_TRACKS); + TC_CASE_RET_NAME(IOCTL_DISK_REASSIGN_BLOCKS); + TC_CASE_RET_NAME(IOCTL_DISK_PERFORMANCE); + TC_CASE_RET_NAME(IOCTL_DISK_IS_WRITABLE); + TC_CASE_RET_NAME(IOCTL_DISK_LOGGING); + TC_CASE_RET_NAME(IOCTL_DISK_FORMAT_TRACKS_EX); + TC_CASE_RET_NAME(IOCTL_DISK_HISTOGRAM_STRUCTURE); + TC_CASE_RET_NAME(IOCTL_DISK_HISTOGRAM_DATA); + TC_CASE_RET_NAME(IOCTL_DISK_HISTOGRAM_RESET); + TC_CASE_RET_NAME(IOCTL_DISK_REQUEST_STRUCTURE); + TC_CASE_RET_NAME(IOCTL_DISK_REQUEST_DATA); + TC_CASE_RET_NAME(IOCTL_DISK_CONTROLLER_NUMBER); + TC_CASE_RET_NAME(SMART_GET_VERSION); + TC_CASE_RET_NAME(SMART_SEND_DRIVE_COMMAND); + TC_CASE_RET_NAME(SMART_RCV_DRIVE_DATA); + TC_CASE_RET_NAME(IOCTL_DISK_INTERNAL_SET_VERIFY); + TC_CASE_RET_NAME(IOCTL_DISK_INTERNAL_CLEAR_VERIFY); + TC_CASE_RET_NAME(IOCTL_DISK_CHECK_VERIFY); + TC_CASE_RET_NAME(IOCTL_DISK_MEDIA_REMOVAL); + TC_CASE_RET_NAME(IOCTL_STORAGE_MEDIA_REMOVAL); + TC_CASE_RET_NAME(IOCTL_DISK_EJECT_MEDIA); + TC_CASE_RET_NAME(IOCTL_DISK_LOAD_MEDIA); + TC_CASE_RET_NAME(IOCTL_DISK_RESERVE); + TC_CASE_RET_NAME(IOCTL_DISK_RELEASE); + TC_CASE_RET_NAME(IOCTL_DISK_FIND_NEW_DEVICES); + TC_CASE_RET_NAME(IOCTL_DISK_GET_MEDIA_TYPES); + TC_CASE_RET_NAME(IOCTL_DISK_IS_CLUSTERED); + TC_CASE_RET_NAME(IOCTL_DISK_UPDATE_DRIVE_SIZE); + TC_CASE_RET_NAME(IOCTL_STORAGE_GET_MEDIA_TYPES); + TC_CASE_RET_NAME(IOCTL_STORAGE_GET_HOTPLUG_INFO); + TC_CASE_RET_NAME(IOCTL_STORAGE_SET_HOTPLUG_INFO); + TC_CASE_RET_NAME(IOCTL_STORAGE_QUERY_PROPERTY); + TC_CASE_RET_NAME(IOCTL_VOLUME_GET_GPT_ATTRIBUTES); + TC_CASE_RET_NAME(FT_BALANCED_READ_MODE); + TC_CASE_RET_NAME(IOCTL_VOLUME_QUERY_ALLOCATION_HINT); + TC_CASE_RET_NAME(IOCTL_DISK_GET_CLUSTER_INFO); + TC_CASE_RET_NAME(IOCTL_DISK_ARE_VOLUMES_READY); + TC_CASE_RET_NAME(IOCTL_VOLUME_IS_DYNAMIC); + TC_CASE_RET_NAME(IOCTL_MOUNTDEV_QUERY_STABLE_GUID); + TC_CASE_RET_NAME(IOCTL_VOLUME_POST_ONLINE); + TC_CASE_RET_NAME(IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT); + TC_CASE_RET_NAME(IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES); + TC_CASE_RET_NAME(IOCTL_DISK_GROW_PARTITION); + TC_CASE_RET_NAME(IRP_MJ_READ); + TC_CASE_RET_NAME(IRP_MJ_WRITE); + TC_CASE_RET_NAME(IRP_MJ_CREATE); + TC_CASE_RET_NAME(IRP_MJ_CLOSE); + TC_CASE_RET_NAME(IRP_MJ_CLEANUP); + TC_CASE_RET_NAME(IRP_MJ_FLUSH_BUFFERS); + TC_CASE_RET_NAME(IRP_MJ_SHUTDOWN); + TC_CASE_RET_NAME(IRP_MJ_DEVICE_CONTROL); + default: + return (LPWSTR) L"IOCTL"; - if (ulCode == IOCTL_DISK_GET_DRIVE_GEOMETRY) - return (LPWSTR) _T ("IOCTL_DISK_GET_DRIVE_GEOMETRY"); - else if (ulCode == IOCTL_DISK_GET_DRIVE_GEOMETRY_EX) - return (LPWSTR) _T ("IOCTL_DISK_GET_DRIVE_GEOMETRY_EX"); - else if (ulCode == IOCTL_MOUNTDEV_QUERY_DEVICE_NAME) - return (LPWSTR) _T ("IOCTL_MOUNTDEV_QUERY_DEVICE_NAME"); - else if (ulCode == IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME) - return (LPWSTR) _T ("IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME"); - else if (ulCode == IOCTL_MOUNTDEV_QUERY_UNIQUE_ID) - return (LPWSTR) _T ("IOCTL_MOUNTDEV_QUERY_UNIQUE_ID"); - else if (ulCode == IOCTL_VOLUME_ONLINE) - return (LPWSTR) _T ("IOCTL_VOLUME_ONLINE"); - else if (ulCode == IOCTL_MOUNTDEV_LINK_CREATED) - return (LPWSTR) _T ("IOCTL_MOUNTDEV_LINK_CREATED"); - else if (ulCode == IOCTL_MOUNTDEV_LINK_DELETED) - return (LPWSTR) _T ("IOCTL_MOUNTDEV_LINK_DELETED"); - else if (ulCode == IOCTL_MOUNTMGR_QUERY_POINTS) - return (LPWSTR) _T ("IOCTL_MOUNTMGR_QUERY_POINTS"); - else if (ulCode == IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED) - return (LPWSTR) _T ("IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_CREATED"); - else if (ulCode == IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED) - return (LPWSTR) _T ("IOCTL_MOUNTMGR_VOLUME_MOUNT_POINT_DELETED"); - else if (ulCode == IOCTL_DISK_GET_LENGTH_INFO) - return (LPWSTR) _T ("IOCTL_DISK_GET_LENGTH_INFO"); - else if (ulCode == IOCTL_STORAGE_GET_DEVICE_NUMBER) - return (LPWSTR) _T ("IOCTL_STORAGE_GET_DEVICE_NUMBER"); - else if (ulCode == IOCTL_DISK_GET_PARTITION_INFO) - return (LPWSTR) _T ("IOCTL_DISK_GET_PARTITION_INFO"); - else if (ulCode == IOCTL_DISK_GET_PARTITION_INFO_EX) - return (LPWSTR) _T ("IOCTL_DISK_GET_PARTITION_INFO_EX"); - else if (ulCode == IOCTL_DISK_SET_PARTITION_INFO) - return (LPWSTR) _T ("IOCTL_DISK_SET_PARTITION_INFO"); - else if (ulCode == IOCTL_DISK_GET_DRIVE_LAYOUT) - return (LPWSTR) _T ("IOCTL_DISK_GET_DRIVE_LAYOUT"); - else if (ulCode == IOCTL_DISK_GET_DRIVE_LAYOUT_EX) - return (LPWSTR) _T ("IOCTL_DISK_GET_DRIVE_LAYOUT_EX"); - else if (ulCode == IOCTL_DISK_SET_DRIVE_LAYOUT_EX) - return (LPWSTR) _T ("IOCTL_DISK_SET_DRIVE_LAYOUT_EX"); - else if (ulCode == IOCTL_DISK_VERIFY) - return (LPWSTR) _T ("IOCTL_DISK_VERIFY"); - else if (ulCode == IOCTL_DISK_FORMAT_TRACKS) - return (LPWSTR) _T ("IOCTL_DISK_FORMAT_TRACKS"); - else if (ulCode == IOCTL_DISK_REASSIGN_BLOCKS) - return (LPWSTR) _T ("IOCTL_DISK_REASSIGN_BLOCKS"); - else if (ulCode == IOCTL_DISK_PERFORMANCE) - return (LPWSTR) _T ("IOCTL_DISK_PERFORMANCE"); - else if (ulCode == IOCTL_DISK_IS_WRITABLE) - return (LPWSTR) _T ("IOCTL_DISK_IS_WRITABLE"); - else if (ulCode == IOCTL_DISK_LOGGING) - return (LPWSTR) _T ("IOCTL_DISK_LOGGING"); - else if (ulCode == IOCTL_DISK_FORMAT_TRACKS_EX) - return (LPWSTR) _T ("IOCTL_DISK_FORMAT_TRACKS_EX"); - else if (ulCode == IOCTL_DISK_HISTOGRAM_STRUCTURE) - return (LPWSTR) _T ("IOCTL_DISK_HISTOGRAM_STRUCTURE"); - else if (ulCode == IOCTL_DISK_HISTOGRAM_DATA) - return (LPWSTR) _T ("IOCTL_DISK_HISTOGRAM_DATA"); - else if (ulCode == IOCTL_DISK_HISTOGRAM_RESET) - return (LPWSTR) _T ("IOCTL_DISK_HISTOGRAM_RESET"); - else if (ulCode == IOCTL_DISK_REQUEST_STRUCTURE) - return (LPWSTR) _T ("IOCTL_DISK_REQUEST_STRUCTURE"); - else if (ulCode == IOCTL_DISK_REQUEST_DATA) - return (LPWSTR) _T ("IOCTL_DISK_REQUEST_DATA"); - else if (ulCode == IOCTL_DISK_CONTROLLER_NUMBER) - return (LPWSTR) _T ("IOCTL_DISK_CONTROLLER_NUMBER"); - else if (ulCode == SMART_GET_VERSION) - return (LPWSTR) _T ("SMART_GET_VERSION"); - else if (ulCode == SMART_SEND_DRIVE_COMMAND) - return (LPWSTR) _T ("SMART_SEND_DRIVE_COMMAND"); - else if (ulCode == SMART_RCV_DRIVE_DATA) - return (LPWSTR) _T ("SMART_RCV_DRIVE_DATA"); - else if (ulCode == IOCTL_DISK_INTERNAL_SET_VERIFY) - return (LPWSTR) _T ("IOCTL_DISK_INTERNAL_SET_VERIFY"); - else if (ulCode == IOCTL_DISK_INTERNAL_CLEAR_VERIFY) - return (LPWSTR) _T ("IOCTL_DISK_INTERNAL_CLEAR_VERIFY"); - else if (ulCode == IOCTL_DISK_CHECK_VERIFY) - return (LPWSTR) _T ("IOCTL_DISK_CHECK_VERIFY"); - else if (ulCode == IOCTL_DISK_MEDIA_REMOVAL) - return (LPWSTR) _T ("IOCTL_DISK_MEDIA_REMOVAL"); - else if (ulCode == IOCTL_DISK_EJECT_MEDIA) - return (LPWSTR) _T ("IOCTL_DISK_EJECT_MEDIA"); - else if (ulCode == IOCTL_DISK_LOAD_MEDIA) - return (LPWSTR) _T ("IOCTL_DISK_LOAD_MEDIA"); - else if (ulCode == IOCTL_DISK_RESERVE) - return (LPWSTR) _T ("IOCTL_DISK_RESERVE"); - else if (ulCode == IOCTL_DISK_RELEASE) - return (LPWSTR) _T ("IOCTL_DISK_RELEASE"); - else if (ulCode == IOCTL_DISK_FIND_NEW_DEVICES) - return (LPWSTR) _T ("IOCTL_DISK_FIND_NEW_DEVICES"); - else if (ulCode == IOCTL_DISK_GET_MEDIA_TYPES) - return (LPWSTR) _T ("IOCTL_DISK_GET_MEDIA_TYPES"); - else if (ulCode == IOCTL_DISK_IS_CLUSTERED) - return (LPWSTR) _T ("IOCTL_DISK_IS_CLUSTERED"); - else if (ulCode == IOCTL_DISK_UPDATE_DRIVE_SIZE) - return (LPWSTR) _T ("IOCTL_DISK_UPDATE_DRIVE_SIZE"); - else if (ulCode == IOCTL_STORAGE_GET_MEDIA_TYPES) - return (LPWSTR) _T ("IOCTL_STORAGE_GET_MEDIA_TYPES"); - else if (ulCode == IOCTL_STORAGE_GET_HOTPLUG_INFO) - return (LPWSTR) _T ("IOCTL_STORAGE_GET_HOTPLUG_INFO"); - else if (ulCode == IOCTL_STORAGE_SET_HOTPLUG_INFO) - return (LPWSTR) _T ("IOCTL_STORAGE_SET_HOTPLUG_INFO"); - else if (ulCode == IOCTL_STORAGE_QUERY_PROPERTY) - return (LPWSTR) _T ("IOCTL_STORAGE_QUERY_PROPERTY"); - else if (ulCode == IOCTL_VOLUME_GET_GPT_ATTRIBUTES) - return (LPWSTR) _T ("IOCTL_VOLUME_GET_GPT_ATTRIBUTES"); - else if (ulCode == FT_BALANCED_READ_MODE) - return (LPWSTR) _T ("FT_BALANCED_READ_MODE"); - else if (ulCode == IOCTL_VOLUME_QUERY_ALLOCATION_HINT) - return (LPWSTR) _T ("IOCTL_VOLUME_QUERY_ALLOCATION_HINT"); - else if (ulCode == IOCTL_DISK_GET_CLUSTER_INFO) - return (LPWSTR) _T ("IOCTL_DISK_GET_CLUSTER_INFO"); - else if (ulCode == IOCTL_DISK_ARE_VOLUMES_READY) - return (LPWSTR) _T ("IOCTL_DISK_ARE_VOLUMES_READY"); - else if (ulCode == IOCTL_VOLUME_IS_DYNAMIC) - return (LPWSTR) _T ("IOCTL_VOLUME_IS_DYNAMIC"); - else if (ulCode == IOCTL_MOUNTDEV_QUERY_STABLE_GUID) - return (LPWSTR) _T ("IOCTL_MOUNTDEV_QUERY_STABLE_GUID"); - else if (ulCode == IOCTL_VOLUME_POST_ONLINE) - return (LPWSTR) _T ("IOCTL_VOLUME_POST_ONLINE"); - else if (ulCode == IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT) - return (LPWSTR) _T ("IOCTL_STORAGE_CHECK_PRIORITY_HINT_SUPPORT"); - else if (ulCode == IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES) - return (LPWSTR) _T ("IOCTL_STORAGE_MANAGE_DATA_SET_ATTRIBUTES"); - else if (ulCode == IOCTL_DISK_GROW_PARTITION) - return (LPWSTR) _T ("IOCTL_DISK_GROW_PARTITION"); - else if (ulCode == IRP_MJ_READ) - return (LPWSTR) _T ("IRP_MJ_READ"); - else if (ulCode == IRP_MJ_WRITE) - return (LPWSTR) _T ("IRP_MJ_WRITE"); - else if (ulCode == IRP_MJ_CREATE) - return (LPWSTR) _T ("IRP_MJ_CREATE"); - else if (ulCode == IRP_MJ_CLOSE) - return (LPWSTR) _T ("IRP_MJ_CLOSE"); - else if (ulCode == IRP_MJ_CLEANUP) - return (LPWSTR) _T ("IRP_MJ_CLEANUP"); - else if (ulCode == IRP_MJ_FLUSH_BUFFERS) - return (LPWSTR) _T ("IRP_MJ_FLUSH_BUFFERS"); - else if (ulCode == IRP_MJ_SHUTDOWN) - return (LPWSTR) _T ("IRP_MJ_SHUTDOWN"); - else if (ulCode == IRP_MJ_DEVICE_CONTROL) - return (LPWSTR) _T ("IRP_MJ_DEVICE_CONTROL"); - else - { - return (LPWSTR) _T ("IOCTL"); +#undef TC_CASE_RET_NAME } } |