Driveriocontrol returns error 24

I tried to transform win32 app with kernel mode driver to 64 bit version. I built the app and driver in x64. Test signed the driver for 64 bit. while executing the app, driver service was started successfully but Driveriocontrol returns error 24.
DeviceIoControl(hDevice, OPEN_PHYSICAL_MEMORY, NULL, 0, ph, sizeof(HANDLE), cb, NULL)

Using winerror.exe from the WDK:

E:\>winerror 24
24 ERROR_BAD_LENGTH <–> 0xc0000004 STATUS_INFO_LENGTH_MISMATCH

Put a breakpoint in your driver and start debugging.

-scott
OSR
@OSRDrivers

wrote in message news:xxxxx@ntdev…

I tried to transform win32 app with kernel mode driver to 64 bit version. I
built the app and driver in x64. Test signed the driver for 64 bit. while
executing the app, driver service was started successfully but
Driveriocontrol returns error 24.
DeviceIoControl(hDevice, OPEN_PHYSICAL_MEMORY, NULL, 0, ph, sizeof(HANDLE),
cb, NULL)

As you were already told in the forum sizeof (pointer) will yield different sizes on a 64 bit platform. The driver is checking for the 64 bit pointer size, the app is sending a 32 bit pointer, so you need to have better checks or better yet, not having the driver create handles on behalf of the app and returning them via IOCTLs

-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Scott Noone
Sent: Thursday, July 7, 2016 8:38 AM
To: Windows System Software Devs Interest List
Subject: Re:[ntdev] Driveriocontrol returns error 24

Using winerror.exe from the WDK:

E:&gt;winerror 24
24 ERROR_BAD_LENGTH <–> 0xc0000004 STATUS_INFO_LENGTH_MISMATCH

Put a breakpoint in your driver and start debugging.

-scott
OSR
@OSRDrivers

wrote in message news:xxxxx@ntdev…

I tried to transform win32 app with kernel mode driver to 64 bit version. I built the app and driver in x64. Test signed the driver for 64 bit. while executing the app, driver service was started successfully but Driveriocontrol returns error 24.
DeviceIoControl(hDevice, OPEN_PHYSICAL_MEMORY, NULL, 0, ph, sizeof(HANDLE), cb, NULL)


NTDEV is sponsored by OSR

Visit the list online at: http:

MONTHLY seminars on crash dump analysis, WDF, Windows internals and software drivers!
Details at http:

To unsubscribe, visit the List Server section of OSR Online at http:</http:></http:></http:>

xxxxx@gmail.com wrote:

I tried to transform win32 app with kernel mode driver to 64 bit version. I built the app and driver in x64. Test signed the driver for 64 bit. while executing the app, driver service was started successfully but Driveriocontrol returns error 24.
DeviceIoControl(hDevice, OPEN_PHYSICAL_MEMORY, NULL, 0, ph, sizeof(HANDLE), cb, NULL)

Are you quite sure your app is built for the 64-bit platform? Remember
that sizeof(HANDLE) is different in 32-bit builds and 64-bit builds. A
64-bit driver might encounter both, which is why it is dangerous to pass
handles around like this.

Is your driver checking for size 4, or is actually checking for
sizeof(HANDLE), which will now be 8?


Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.