even: move DbgPrint to head

This commit is contained in:
Zephyr Lykos 2024-03-30 17:46:25 +08:00
parent 837715f321
commit 0920dee45e
No known key found for this signature in database
GPG Key ID: D3E9D31E2F77F04D

12
even.c
View File

@ -194,6 +194,7 @@ static NTSTATUS __stdcall even_dispatch_device_control(IN PDEVICE_OBJECT DeviceO
switch (io_stack->Parameters.DeviceIoControl.IoControlCode) switch (io_stack->Parameters.DeviceIoControl.IoControlCode)
{ {
case IOCTL_CHECK_1: { case IOCTL_CHECK_1: {
DbgPrint("Even Htsysm7679: Check 1\r\n");
if (io_stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(htsysm_check_1)) if (io_stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(htsysm_check_1))
{ {
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
@ -203,11 +204,11 @@ static NTSTATUS __stdcall even_dispatch_device_control(IN PDEVICE_OBJECT DeviceO
RtlCopyBytes(Irp->AssociatedIrp.SystemBuffer, &htsysm_check_1, sizeof(htsysm_check_1)); RtlCopyBytes(Irp->AssociatedIrp.SystemBuffer, &htsysm_check_1, sizeof(htsysm_check_1));
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof(htsysm_check_1); Irp->IoStatus.Information = sizeof(htsysm_check_1);
DbgPrint("Even Htsysm7679: Check 1\r\n");
} }
break; break;
case IOCTL_CHECK_2: { case IOCTL_CHECK_2: {
DbgPrint("Even Htsysm7679: Check 2\r\n");
if (io_stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(htsysm_check_2)) if (io_stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(htsysm_check_2))
{ {
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
@ -217,11 +218,11 @@ static NTSTATUS __stdcall even_dispatch_device_control(IN PDEVICE_OBJECT DeviceO
RtlCopyBytes(Irp->AssociatedIrp.SystemBuffer, &htsysm_check_2, sizeof(htsysm_check_2)); RtlCopyBytes(Irp->AssociatedIrp.SystemBuffer, &htsysm_check_2, sizeof(htsysm_check_2));
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof(htsysm_check_2); Irp->IoStatus.Information = sizeof(htsysm_check_2);
DbgPrint("Even Htsysm7679: Check 2\r\n");
} }
break; break;
case IOCTL_CHECK_3: { case IOCTL_CHECK_3: {
DbgPrint("Even Htsysm7679: Check 3\r\n");
if (io_stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(htsysm_check_3)) if (io_stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(htsysm_check_3))
{ {
Irp->IoStatus.Status = STATUS_INVALID_PARAMETER; Irp->IoStatus.Status = STATUS_INVALID_PARAMETER;
@ -231,11 +232,11 @@ static NTSTATUS __stdcall even_dispatch_device_control(IN PDEVICE_OBJECT DeviceO
RtlCopyBytes(Irp->AssociatedIrp.SystemBuffer, &htsysm_check_3, sizeof(htsysm_check_3)); RtlCopyBytes(Irp->AssociatedIrp.SystemBuffer, &htsysm_check_3, sizeof(htsysm_check_3));
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof(htsysm_check_3); Irp->IoStatus.Information = sizeof(htsysm_check_3);
DbgPrint("Even Htsysm7679: Check 3\r\n");
} }
break; break;
case IOCTL_WRITE_PEB_1: { case IOCTL_WRITE_PEB_1: {
DbgPrint("Even Htsysm7679: Write PEB 1\r\n");
struct even_ioctl_in_data *even_in_data = (struct even_ioctl_in_data *)Irp->AssociatedIrp.SystemBuffer; struct even_ioctl_in_data *even_in_data = (struct even_ioctl_in_data *)Irp->AssociatedIrp.SystemBuffer;
struct even_ioctl_out_data *even_out_data = (struct even_ioctl_out_data *)Irp->AssociatedIrp.SystemBuffer; struct even_ioctl_out_data *even_out_data = (struct even_ioctl_out_data *)Irp->AssociatedIrp.SystemBuffer;
@ -270,7 +271,6 @@ static NTSTATUS __stdcall even_dispatch_device_control(IN PDEVICE_OBJECT DeviceO
RtlCopyBytes(&value, even_in_data->value, sizeof(value)); RtlCopyBytes(&value, even_in_data->value, sizeof(value));
value = ~value; value = ~value;
DbgPrint("Even Htsysm7679: Write PEB 1\r\n");
DbgPrint("Even Htsysm7679: Offset = %0x, Value = %0x\r\n", even_in_data->offset, value); DbgPrint("Even Htsysm7679: Offset = %0x, Value = %0x\r\n", even_in_data->offset, value);
for (size_t i = 0; i < 4; i++) for (size_t i = 0; i < 4; i++)
{ {
@ -284,6 +284,7 @@ static NTSTATUS __stdcall even_dispatch_device_control(IN PDEVICE_OBJECT DeviceO
break; break;
case IOCTL_WRITE_PEB_2: { case IOCTL_WRITE_PEB_2: {
DbgPrint("Even Htsysm7679: Write PEB 2\r\n");
struct even_ioctl_in_data *even_in_data = (struct even_ioctl_in_data *)Irp->AssociatedIrp.SystemBuffer; struct even_ioctl_in_data *even_in_data = (struct even_ioctl_in_data *)Irp->AssociatedIrp.SystemBuffer;
struct even_ioctl_out_data *even_out_data = (struct even_ioctl_out_data *)Irp->AssociatedIrp.SystemBuffer; struct even_ioctl_out_data *even_out_data = (struct even_ioctl_out_data *)Irp->AssociatedIrp.SystemBuffer;
@ -325,12 +326,12 @@ static NTSTATUS __stdcall even_dispatch_device_control(IN PDEVICE_OBJECT DeviceO
even_out_data->result = 1; even_out_data->result = 1;
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof(*even_out_data); Irp->IoStatus.Information = sizeof(*even_out_data);
DbgPrint("Even Htsysm7679: Write PEB 2\r\n");
DbgPrint("Even Htsysm7679: Offset = %0x, Value = %0x\r\n", even_in_data->offset, value); DbgPrint("Even Htsysm7679: Offset = %0x, Value = %0x\r\n", even_in_data->offset, value);
} }
break; break;
case IOCTL_READ_PEB: { case IOCTL_READ_PEB: {
DbgPrint("Even Htsysm7679: Read PEB\r\n");
struct even_ioctl_in_data *even_in_data = (struct even_ioctl_in_data *)Irp->AssociatedIrp.SystemBuffer; struct even_ioctl_in_data *even_in_data = (struct even_ioctl_in_data *)Irp->AssociatedIrp.SystemBuffer;
struct even_ioctl_out_data1 *even_out_data = (struct even_ioctl_out_data1 *)Irp->AssociatedIrp.SystemBuffer; struct even_ioctl_out_data1 *even_out_data = (struct even_ioctl_out_data1 *)Irp->AssociatedIrp.SystemBuffer;
@ -374,7 +375,6 @@ static NTSTATUS __stdcall even_dispatch_device_control(IN PDEVICE_OBJECT DeviceO
Irp->IoStatus.Status = STATUS_SUCCESS; Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = sizeof(*even_out_data); Irp->IoStatus.Information = sizeof(*even_out_data);
DbgPrint("Even Htsysm7679: Read PEB\r\n");
DbgPrint("Even Htsysm7679: Offset = %0x, Value = %0x\r\n", even_in_data->offset, *(int *)even_in_data->value); DbgPrint("Even Htsysm7679: Offset = %0x, Value = %0x\r\n", even_in_data->offset, *(int *)even_in_data->value);
DbgPrint("Even Htsysm7679: Return = %0x\r\n", *(int *)value); DbgPrint("Even Htsysm7679: Return = %0x\r\n", *(int *)value);
} }