Questions tagged [deviceiocontrol]

The DeviceIoControl function provides a device input and output control (IOCTL) interface through which an application can communicate directly with a device driver.

The DeviceIoControl function provides a device input and output control (IOCTL) interface through which an application can communicate directly with a device driver. The DeviceIoControl function is a general-purpose interface that can send control codes to a variety of devices. Each control code represents an operation for the driver to perform. For example, a control code can ask a device driver to return information about the corresponding device, or direct the driver to carry out an action on the device, such as formatting a disk.

A number of standard control codes are defined in the SDK header files. In addition, device drivers can define their own device-specific control codes. For a list of standard control codes included in the SDK documentation, see the Remarks section of DeviceIoControl.

The types of control codes you can specify depend on the device being accessed and the platform on which your application is running. Applications can use the standard control codes or device-specific control codes to perform direct input and output operations on a floppy disk drive, hard disk drive, tape drive, or CD-ROM drive.

115 questions
0
votes
1 answer

DeviceIoControl works in C++ and C# but return ERROR_INVALID_FUNCTION when called in C++/CLI

I am trying to enumerate the MFT to get list of file names. This code works when used in a Win32 project: MFT_ENUM_DATA med; med.StartFileReferenceNumber = 0; med.LowUsn = 0; med.HighUsn = ujd.NextUsn; BYTE pData[sizeof(DWORDLONG) + 0x10000]; DWORD…
max_force
  • 769
  • 6
  • 12
0
votes
1 answer

DeviceIoControl with input unsigned char buffer C++

I have a problem with using DeviceIOControl to put 128 byte buffer to my driver, i use this code: int Initialize(unsigned char* public_signature, int size) { int ret = DeviceIoControl( DeviceFileHandle, 2236440, public_signature, …
Roman
  • 1,377
  • 2
  • 11
  • 12
0
votes
1 answer

Using DeviceIoControl with FSCTL_LOCK_VOLUME to lock a volume. Debugger issue

I'm using DeviceIoControl with FSCTL_LOCK_VOLUME to lock a USB pen drive prior to direct disk read/write. The program works - sometimes. I am having an issue with the lock call itself. When I step the command in Visual Studio 2008 the result is…
Matt
  • 31
  • 1
0
votes
1 answer

SetWindowsHookEx for DeviceIOControl, what hookid to be used?

HHOOK WINAPI SetWindowsHookEx( _In_ int idHook, _In_ HOOKPROC lpfn, _In_ HINSTANCE hMod, _In_ DWORD dwThreadId ); On MSDN listed available idHook values, there are: WH_CALLWNDPROC WH_CALLWNDPROCRET WH_CBT WH_DEBUG…
Reddy
  • 943
  • 6
  • 12
  • 21
-1
votes
0 answers

How to use DeviceIoControl on a rawinput device handle

So I have a program that is using multiple keyboards as input using raw input and I want to mess with the indicator lights of caps lock, scroll lock, and num lock per keyboard. So my approach was to RegisterRawInputDevices for keyboards using the…
yosmo78
  • 489
  • 4
  • 13
-1
votes
1 answer

Finding out which driver responds to which IO handle passed to a `DeviceIoControl` Call

I have a driver installed that responds to DeviceIoControl calls with the handle "\\.\ATKACPI". Is there a way to find out which driver provides or responds to that handle, or any other handle in general?
MrSomeone
  • 71
  • 1
  • 11
-1
votes
1 answer

What are some good strategies for working with DeviceIoControl?

I am looking for some guidance when it comes to call DeviceIoControl from C#, knowing that its generic aspect of accepting pointer parameters isn't always easy to express in C#. Here are two examples and explanations laid out below. Example 1: This…
aybe
  • 15,516
  • 9
  • 57
  • 105
-1
votes
1 answer

DeviceIoControl returns error 24

I am trying to run a custom made kernel mode driver on a windows 7(64 bit) machine. The driver service was started but the IO control request returns error. DeviceIoControl(hDevice, OPEN_PHYSICAL_MEMORY, NULL, 0, ph, sizeof(HANDLE), cb, NULL) and …
shijin
  • 51
  • 1
  • 10
-1
votes
2 answers

Free the memory allocated by DeviceIoControl

When calling DeviceIoControl with IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS, it fills VOLUME_DISK_EXTENTS structure with pointers to some data (Extents array). While the structure that is created in my code is deallocated by me, an array of pointers…
polkovnikov.ph
  • 6,256
  • 6
  • 44
  • 79
-2
votes
1 answer

I'm trying to retrieve the serial number of a hard drive or a battery tag

#include "stdafx.h" #include #include #include #include #include #include #include typedef struct _MEDIA_SERIAL_NUMBER_DATA { ULONG SerialNumberLength; …
JuJi
  • 13
  • 4
1 2 3 4 5 6 7
8