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

Winpcap and DeviceIoControl - Error code 1 on Win7

I'm trying to use Winpcap PacketRequest() function (located in packet32.h) in order to send OID to a network adapter. It works on XP32, doesn't work on Win7 32 and Win7 64 (in Win7 64 I get last error code 1, in 32 I don't know - I don't have access…
Kitty
  • 1
0
votes
1 answer

VOLUME_BITMAP_BUFFER - Accessing the BYTE Buffer?

As the title suggests, I'm doing some low-level volume access (as close to C code as possible) to make a disk clone program, I want to set all the free clusters to zero to use a simple compression and keep the size small. I've been beating my head…
BrainOverflow
  • 34
  • 1
  • 1
  • 7
0
votes
0 answers

Monitor read/write activity of optical drives (WIN32)?

I need to monitor the read/write state of optical drives efficiently in real-time, preferably using native WIN32 calls (I want to avoid WMI etc. if poss). For physical disks, DeviceIoControl() with IOCTL_DISK_PERFORMANCE works well, but it doesn't…
gl-
  • 41
  • 3
0
votes
0 answers

Pressing Close button should close CD Rom Tray but it is not closing - win32 C++

I am creating a win32 C++ app in which pressing the "Eject" button opens the CD Rom Tray and pressing the "Close" button closes the CD Rom Tray. The "Eject" button works and the tray opens, however, pressing the "Close" button does not close the CD…
Sophia
  • 57
  • 1
  • 9
0
votes
0 answers

Realocating file clusters with FSCTL_MOVE_FILE too slow

I'm writing a small program to relocate virtual clusters of large files (from 1GB up to 4GB) inside a USB pendrive using DeviceIoControl with the FSCTL_MOVE_FILE control code. The pendrive is formatted as FAT32 (this is a requirement) with a 64K…
Artemus
  • 1
  • 1
0
votes
1 answer

Using DeviceIoControl from C# code always returns empty output buffer

I have a driver, which I want to use from my C# client app. The issue here is that my output buffer is always empty (0). When I use this driver from C code - everything works like a charm, so I think the issue is in my client C# code. Extern is…
Alex Ovechkin
  • 810
  • 6
  • 20
0
votes
0 answers

C# adjusting BLE scan window size is not working on Win10

I have found the solution that adjust BLE scan window size: BLE Scan Interval Windows 10 But, it's not working. Many beacons are missed while scanning. using System; using System.Linq; using Windows.Devices.Bluetooth.Advertisement; using…
0
votes
2 answers

DeviceIoControl control codes

Im using deviceIoControl function in c# and I need a control code to define what will happen. I'm looking for their values but I can only find their names, for example FSCTL_FILESYSTEM_GET_STATISTICS. How can I know the value of the code for the…
sagicoh
  • 105
  • 11
0
votes
1 answer

How to send OID_PM_WOL_PATTERN_LIST to NDIS driver in C++?

I would like to query the Wake On Lan patterns defined on an Ethernet card in C++ (later on I would like to upload such patterns, but one step at once. :) ). As I understood I have to send the OID_PM_WOL_PATTERN_LIST request from the user space to…
TrueY
  • 7,360
  • 1
  • 41
  • 46
0
votes
0 answers

DeviceIoControl returns 1306 with IOCTL_SCSI_PASS_THROUGH

I am trying to use DeviceIoControl with IOCTL_SCSI_PASS_THROUGH control code in C#. But DeviceIoControl returns error code 1306. What I want to do is to get S.M.A.R.T of INTEL NVMe SSD. I've tried referring to the source code of Crystal Disk…
0
votes
1 answer

Is there a way to force windows to re-read the USB DeviceDescriptor?

I need 8 bits of out of band data (configuration / noise reading) on my CDC USB device, and I figured I could return that in the LSB of the bcdDevice in the DeviceDescriptor... but it seems that Windows only reads that on "Plug In Event" -- even if…
0
votes
2 answers

Creating symlink - The data present in the reparse point buffer is invalid

Goal: To create symbolic link using DeviceIoControl with FSCTL_SET_REPARSE_POINT I know there is CreateSymbolicLink WinApi call, it works, but I cannot use it for my purpose. Problem: I keep getting the 0x80071128 (The data present in the reparse…
0
votes
0 answers

Is there any change in windows 10 related to deviceiocontrol?

Received Error code 6 when calling ::DeviceIoControl with command CTL_CODE(FILE_DEVICE_UNKNOWN, IOCTL_USB_INDEX(0x0000) + 4, METHOD_BUFFERED, FILE_ANY_ACCESS) on windows 10. Getting error on windows 10 version 1809 but same code was/is working on…
0
votes
0 answers

How to open all connected LCD monitors' handle using CreateFile("\\\\.\\LCD")?

I am using DeviceIOControl() to send IOCTL system request to device drivers. My problem is of its first argument, the device path. For example, to open one monitor handle, I can use path name, "\\\\.\\LCD", to create handle using CreateFile() and…
Nick Chang
  • 1
  • 1
  • 4
0
votes
2 answers

When i try to get physical sector size via DeviceIoControl i receive Access is denied

From my webserver app i need to check the physical sector size of the harddrive where the app is located. For this i use DeviceIoControl with IOCTL_STORAGE_QUERY_PROPERTY to query StorageAccessAlignmentProperty. The problem is that when i try to run…
zeus
  • 12,173
  • 9
  • 63
  • 184