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
1
vote
1 answer

data send using DeviceIoControl from app to driver

I can send data driver to app. In app: DeviceIoControl(dHandle, IOCTL_TEST, (PVOID)InputBuffer, sizeof(InputBuffer), (PVOID)OutputBuffer, sizeof(OutputBuffer), &dwRet, 0); printf("num : %s\n", OutputBuffer); In driver: char…
Lightstar
  • 183
  • 3
  • 12
1
vote
3 answers

Get the partition type of a specific partition in C++, on a GPT disk

I'm working on a project which requires me to operate at a low level on Windows drives, and am doing so primarily using Windows API calls. But before I can operate on the drive, I need to know the types of partitions present on it. This is fairly…
1
vote
0 answers

Last cluster in an NTFS system

I need some clarification on finding the last cluster of a file. Here are some code snippets on to how I got cluster info. hFile = CreateFile(result, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ |…
dspaces1
  • 193
  • 1
  • 3
  • 15
1
vote
1 answer

Finding the last cluster of a file

I'm trying to find the last cluster of a target file and read the binary data off of it. I started off with CreateFile() and used that result in DeviceIoControl() with control code FSCTL_GET_RETRIEVAL_POINTERS. hfile = CreateFile(result, …
dspaces1
  • 193
  • 1
  • 3
  • 15
1
vote
1 answer

debugging USB read

I am debugging some code that uses a 3rd party 64-bit DLL to access a custom USB device. My environment is Microsoft Visual Studio 2012 on Windows 8.1 x64. According to an incomplete and unreliable document, the DLL is supposed to issue a…
Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
1
vote
0 answers

Sending keyboard input via DeviceIoControl

For the past 3 hours or so I've been attempting to send keyboard input by writing to the keyboard device. I have successfully found and opened the keyboard device, but I'm stuck at the final step. I don't know exactly how to format the…
ozdrgnaDiies
  • 1,909
  • 1
  • 19
  • 34
1
vote
1 answer

Enumerating all available change journal records

I have a problem with enumerating change journal records. //my params READ_USN_JOURNAL_DATA read_journal_data; read_journal_data.StartUsn = ... //next USN read_journal_data.ReasonMask = 0xFFFFFFFF; read_journal_data.ReturnOnlyOnClose =…
akekir
  • 523
  • 4
  • 9
1
vote
1 answer

How IOCTL works?

I want to know how IOCTL works. I know the basics: DeviceIoControl() -> kernel32.dll -> ntdll.dll -> the moment it gets from user mode to kernel mode -> I/O Manager -> IRP Question is how IOCTL gets form user mode to the kernel mode? Is it interrupt…
lmmalino
  • 81
  • 1
  • 1
  • 6
1
vote
0 answers

C to C# Translation, Calling a WinAPI function: ControlIoDevice

I'm trying to translate some Code written in C to C# (Compact Framework 2.0) (It's for a Windows CE Device with an RFID Reader). And in C this system call works fine, but it does not work in C#: Code In C HANDLE m_Power =NULL; //<-- This HANDLE is…
1
vote
1 answer

Identifying system reserved drive using DeviceIoControl function in C++

I am trying to identify if a drive is system reserved drive(PhysicalDrive0 or C-Drive) using DeviceIoControl function. However my code is always returning true for all the drives. HANDLE hDevice; // handle to the drive to be…
1
vote
2 answers

How to finalize Live File System (LiveUDF) disc with DeviceIoControl and FSCTL_MAKE_MEDIA_COMPATIBLE in C#?

I'm trying to finalize a Live File System (or "Live UDF") optical disc in C#. From what I understand from reading MSDN and TechNet articles along with various forum postings, the Image Mastering API (or IMAPI) does not support this type of…
1
vote
1 answer

Why does DeviceIoControl fail with "Incorrect Function"

I am trying to communicate with my USB driver. I am able to get a handle, but once I use DeviceIoControl it fails, GetLastError() says error is an incorrect function. I am stumped on how to debug this. I am using XP 32bit machine. Handle = …
IPA8654
  • 23
  • 1
  • 4
0
votes
0 answers

DeviceIoControl errors | error 87 invalid parameters | C++

I have this code in my driver.cpp uintptr_t driver::find_image() { uintptr_t image_address = { NULL }; t_image arguments = { NULL }; arguments.security_code = code_security; arguments.process_id = ProcId; arguments.address =…
0
votes
0 answers

How do I use IOCTL_BTH_DISCONNECT_DEVICE IOCTL to disconnect a Bluetooth device?

I have a Bluetooth device that I want to disconnect from a .NetCore3.1 app. How can I disconnect it using IOCTL? Can you share the code for it using following docs: IOCTL_BTH_DISCONNECT_DEVICE BLUETOOTH_FIND_RADIO_PARAMS Tried other methods.
0
votes
0 answers

Marshall ioctl in C# Correctly

I'm trying to get Informations about DVDs by ioctl in C# the C Structure Looks like this and is working in a mixed CLR C++ Library typedef enum { DvdChallengeKey = 0x01, DvdBusKey1, DvdBusKey2, DvdTitleKey, DvdAsf, …