From 85e289ebf0e37f2233050ea3b975b83fcce83c0a Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 26 Apr 2017 18:42:37 +0300 Subject: fix compiler warnings --- src/nt_path_converter/device.c | 4 ++++ src/nt_path_converter/main.c | 4 ++++ src/sysenter/main.c | 9 ++++++++- src/test/device.c | 10 ++++++++++ src/test/main.c | 6 +++++- 5 files changed, 31 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/nt_path_converter/device.c b/src/nt_path_converter/device.c index ae93f15..a179984 100644 --- a/src/nt_path_converter/device.c +++ b/src/nt_path_converter/device.c @@ -15,6 +15,8 @@ static NTSTATUS device_open(DEVICE_OBJECT *device_object, IRP *irp) { NTSTATUS status = STATUS_SUCCESS; + UNREFERENCED_PARAMETER(device_object); + irp->IoStatus.Status = status; irp->IoStatus.Information = 0; IoCompleteRequest(irp, IO_NO_INCREMENT); @@ -73,6 +75,8 @@ static NTSTATUS device_ioctl(DEVICE_OBJECT *device_object, IRP *irp) ioctl_handler handler; NTSTATUS status = STATUS_UNSUCCESSFUL; + UNREFERENCED_PARAMETER(device_object); + irp->IoStatus.Status = status; irp->IoStatus.Information = 0; io_stack_loc = IoGetCurrentIrpStackLocation(irp); diff --git a/src/nt_path_converter/main.c b/src/nt_path_converter/main.c index a781a82..a1c08e8 100644 --- a/src/nt_path_converter/main.c +++ b/src/nt_path_converter/main.c @@ -11,6 +11,8 @@ static void on_driver_unload(DRIVER_OBJECT *driver_object) { + UNREFERENCED_PARAMETER(driver_object); + destroy_devices(); } @@ -18,6 +20,8 @@ NTSTATUS DriverEntry( DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path) { + UNREFERENCED_PARAMETER(registry_path); + driver_object->DriverUnload = on_driver_unload; return set_up_devices(driver_object); } diff --git a/src/sysenter/main.c b/src/sysenter/main.c index 58ecddb..9eb9b28 100644 --- a/src/sysenter/main.c +++ b/src/sysenter/main.c @@ -56,7 +56,10 @@ static void hook_sysenter() */ old_msr_value = __readmsr(IA32_SYSENTER_EIP); +#pragma warning(push) +#pragma warning(disable: 4305) old_ki_fast_call_entry = (void *) old_msr_value; +#pragma warning(pop) __writemsr(IA32_SYSENTER_EIP, new_ki_fast_call_entry); } @@ -80,10 +83,12 @@ static void on_driver_unload(DRIVER_OBJECT *driver_object) KTIMER timer; LARGE_INTEGER time_out; + UNREFERENCED_PARAMETER(driver_object); + unhook_sysenter(); KeInitializeTimer(&timer); - time_out.QuadPart = -30000000; // 3 sec + time_out.QuadPart = -30000000; KeSetTimer(&timer, time_out, NULL); KeWaitForSingleObject(&timer, Executive, KernelMode, FALSE, NULL); @@ -93,6 +98,8 @@ NTSTATUS DriverEntry( DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path) { + UNREFERENCED_PARAMETER(registry_path); + driver_object->DriverUnload = on_driver_unload; hook_sysenter(); return STATUS_SUCCESS; diff --git a/src/test/device.c b/src/test/device.c index dcd6f1b..7b871a3 100644 --- a/src/test/device.c +++ b/src/test/device.c @@ -13,6 +13,8 @@ static NTSTATUS device_open(DEVICE_OBJECT *device_object, IRP *irp) { NTSTATUS status = STATUS_SUCCESS; + UNREFERENCED_PARAMETER(device_object); + irp->IoStatus.Status = status; irp->IoStatus.Information = 0; IoCompleteRequest(irp, IO_NO_INCREMENT); @@ -31,6 +33,12 @@ static NTSTATUS handle_say_hello( unsigned long out_buf_size, ULONG_PTR *nbwritten) { + UNREFERENCED_PARAMETER(in_buf); + UNREFERENCED_PARAMETER(in_buf_size); + UNREFERENCED_PARAMETER(out_buf); + UNREFERENCED_PARAMETER(out_buf_size); + UNREFERENCED_PARAMETER(nbwritten); + DbgPrint("Hello, world!\n"); return STATUS_SUCCESS; } @@ -72,6 +80,8 @@ static NTSTATUS device_ioctl(DEVICE_OBJECT *device_object, IRP *irp) ioctl_handler handler; NTSTATUS status = STATUS_UNSUCCESSFUL; + UNREFERENCED_PARAMETER(device_object); + irp->IoStatus.Status = status; irp->IoStatus.Information = 0; io_stack_loc = IoGetCurrentIrpStackLocation(irp); diff --git a/src/test/main.c b/src/test/main.c index 22600ee..b3d2b58 100644 --- a/src/test/main.c +++ b/src/test/main.c @@ -9,8 +9,10 @@ #include -VOID on_driver_unload(DRIVER_OBJECT *driver_object) +static void on_driver_unload(DRIVER_OBJECT *driver_object) { + UNREFERENCED_PARAMETER(driver_object); + DbgPrint("Unloading test driver...\n"); destroy_devices(); } @@ -19,6 +21,8 @@ NTSTATUS DriverEntry( DRIVER_OBJECT *driver_object, UNICODE_STRING *registry_path) { + UNREFERENCED_PARAMETER(registry_path); + DbgPrint("Loading test driver...\n"); driver_object->DriverUnload = on_driver_unload; return set_up_devices(driver_object); -- cgit v1.2.3