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
0 answers

One Drive as Reparse Point

Consider a following standalone source code which I am experimenting on Win 10 Fall Creators Update Version 10.0.16299 Build 16299 #include #include #include #include #if !defined…
Recker
  • 1,915
  • 25
  • 55
0
votes
1 answer

Windows Storage Management API - VDS (Virtual Disk Service) Uninstall Disk Equivalent method

Since VDS is being deprecated and the Windows Storage Management API is replacing it - are there any WMI, IOCTL, DeviceIoControl or Windows Storage Management API methods that are equivalent to the VDS method "UninstallDisks"? I'm not able to find…
0
votes
1 answer

DeviceIoControl GetLastError 87 (ERROR_INVALID_PARAMETER)

This code is perfectly fine when launched on Windows 7: HANDLE hVol = CreateFile(L"\\\\.\\c:", GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); // hVol is always successful…
Basj
  • 41,386
  • 99
  • 383
  • 673
0
votes
0 answers

DeviceIoControl Kernel to Usermode with HANDLE c++

I have a driver on Windows 7 x64, which works fine, but I can't figure out how to push a handle from the driver to my usermode application. Here is my kernel mode code: HANDLE hTest= 0xD34D; memcpy(IRP->AssociatedIrp.SystemBuffer, &hTest,…
Marcel Mar
  • 43
  • 6
0
votes
1 answer

DeviceIoControl with DWORD

My OS is Win7 64bit. I'm trying to pass the value of a variable, not the address of it (process id, DWORD) via DeviceIoControl to my driver. I have tried it several times, but only got bluescreens or the error code of 998. On usermode side, I make…
Marcel Mar
  • 43
  • 6
0
votes
0 answers

Windows API - IOCTL_CHANGER_GET_PRODUCT_DATA always returning ERROR_INVALID_PARAMETER

I am the author of a communication library which needs to be able to communicate with serial devices and USB devices, through libusb and the native driver which corresponds to our case (CESG502, made by CASIO). Serial and libusb communication are…
Cakeisalie5
  • 384
  • 3
  • 10
0
votes
1 answer

Error partitioning and formatting USB flash drive in C++

I'm stuck attempting to re-partition and format a USB flash drive using C++, any help would be great! The goal is to re-partition any arbitrary flash drive with a single partition taking the entire space and formatted FAT32 (later options NTFS and…
Matt
  • 391
  • 5
  • 15
0
votes
1 answer

Marshal.GetLastWin32Error() throws Access Denied in UWP C#

I have the below code in my UWP app public static class DeviceIoControlHelper { [DllImport("kernel32.dll", SetLastError = true, CharSet = CharSet.Ansi)] private static extern SafeFileHandle CreateFile( string lpFileName, …
Yeasin Abedin
  • 2,081
  • 4
  • 23
  • 41
0
votes
1 answer

How do I convert drive Letter to a physical drive name in c++?

My question is this: Given an offline disk connected to my windows machine, how can I get it's volume letter? The scenario: I need to create a handler to a shared storage (with CreateFile function) in order to use it in the DeviceIoControl function…
Hasholef
  • 703
  • 3
  • 10
  • 17
0
votes
1 answer

Using DevicIOControl with VC#

I have created two different Visual C# dll's that make use of DeviceIOControl calls and I have defined them as below: In first dll: [DllImport("kernel32.dll", SetLastError = true)] static extern BOOL DeviceIoControl( HANDLE hDevice, DWORD…
hazzelnuttie
  • 1,403
  • 1
  • 12
  • 22
0
votes
1 answer

How to read data form WinCE 5.0 's Debug Serial port?

In my project, I need to input some command into my WinCE device through the debug Serial Port. But I found that I can only use "printf" or "RETAILMSG" to output my debug info but I can't simply call "scanf" to get the data of debug Serial Port. By…
pipicold
  • 3
  • 1
0
votes
3 answers

C# calling deviceIOControl with complex structures

So I am trying to write a C# wrapper to talk to one of our device drivers. (creating unit test) The driver is new, but coded against old c++ headers, so the structure layouts are defined, and can't really change. So I have replicated the c++…
nagates
  • 620
  • 13
  • 40
0
votes
1 answer

DeviceIoControl for SCSI INQUIRY command returns error 50

I am trying to access a USB scanner through the IOCTL commands. This is on Windows 7. I did not deal with IOCTL coding before, so I first tried the following snippet based on what I could find with a quick search. #include "stdafx.h" #include…
alokoko
  • 1,405
  • 4
  • 21
  • 35
0
votes
1 answer

DeviceIoControl error 87 for OID_802_11_BSSID_LIST

I'm trying to get the available access points from a network GUID but I'm always getting error 87 (wrong param) for DeviceIoControl(). It's getting me crazy for a while, as I don't know which param is wrong! I've been googling for hours and can't…
Miquel
  • 8,339
  • 11
  • 59
  • 82
0
votes
0 answers

Windows DeviceIoContro() with IOCTL_DISK_GET_LENGTH_INFO takes realllllllly long

The call DeviceIoContro() with IOCTL_DISK_GET_LENGTH_INFO holds in windows for a minute or more on drives that are not mounted. I am trying to survey and print online drives with their lengths. This hold behavior is unacceptable in the user…
Scott Franco
  • 481
  • 2
  • 15