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

Python win32file Module Incorrect DeviceIoControl Parameter

I have a Lenovo ThinkPad Laptop which has a build in accelerometer called Active Protection System. My operating system is Windows 7 and I have python 2.7 installed. I am trying to compile a python script that suppose to read data from accelerometer…
3
votes
1 answer

Freeze on SerialPort.Open / DeviceIoControl / GetcommState with usbser.sys

I have a C program which opens a handle to a COM port, writes some bytes to it, reads some bytes out, then closes the handle and exits. However, when I run the program like 10 times in a row, it starts to take very long to complete the GetCommState…
Etan
  • 17,014
  • 17
  • 89
  • 148
3
votes
1 answer

How to get USB device descriptor by doing DeviceIoControl() directly on the device?

I want to get the Device descriptor of USB devices on my system. I am creating a userspace application in Windows(un-managed, native c++ ). From these descriptors, I want to identify billboard devices and parse billboard capability descriptor…
Sahil Singh
  • 3,352
  • 39
  • 62
3
votes
0 answers

DeviceIoControlCE for I2C

I have been banging my head against a problem for days now. I would like your help. I am trying to interface to I2C from a board running Windows CE7. The board is a Boundary Devices Nitrogen6X. I am trying to code this in C#. After a lot of googling…
Bovaz
  • 375
  • 6
  • 20
3
votes
1 answer

How to disconnect a bluetooth device from C# .Net in Win7

I would like to disconnect a bluetooth device from my c# .Net application, that runs on Win 7 x64. I Know that MS provides very little functionnality reguarding BT on .Net. I've searched 32feet.Net, and found how to connect, discover, get…
miljbee
  • 300
  • 3
  • 8
3
votes
2 answers

Why does my C#/pinvoke DeviceIoControl call return 0 bytes read with garbage data?

I have an unmanaged C++ Windows console app that works fine. I want it in C#. I have done DllImport statements for the necessary Kernel32.dll symbols: [StructLayout(LayoutKind.Sequential)] internal struct DiskGeometry { public long Cylinders; …
Josh
  • 47
  • 7
2
votes
2 answers

How to enable "Better Performance" on an External USB HD programatically in C/C++

How do I enable "Better Performance" on an External USB HD programatically in C/C++. Specifically I am talking about the device properties pane in the control panel in Microsoft Windows. That enables a form of OS level write caching.
unixman83
  • 9,421
  • 10
  • 68
  • 102
2
votes
1 answer

How do you use win32.WriteFile() the same way as Windows WriteFile API in python?

I have a PCI card that uses a pipeline handle and in order to write to its buffers I need to write to its location. I am unfortunately not a software guy but instead have the code given to me in Tcl which my team asked me to convert into Python. The…
Kelble
  • 23
  • 3
2
votes
1 answer

DeviceIoControl - GetLastError: ERROR_NOACCESS - 998

I have a kernel driver written in C, where it is expecting a text of type PCWSTR. What's the Delphi type equivalent to send a control code? I tried sending using the following code but GetLastError reports ERROR_NOACCESS. How to solve that? program…
user13342579
2
votes
0 answers

Communicating kernel space from user-land in Windows

I'm noob on kernel-land of OS. Recently I've studied about how program works in kernel-land. I know several windows api calls are just wrapper of system call for kernel-land. That finally execute syscall/sysret/sysenter to enter kernel-land, and…
2
votes
2 answers

DeviceIoControl to initialize and create a NTFS partition

I'm trying to initialize a disk and create a NTFS partition via DeviceIOControl, without using either DiskPart or WMI. Using the below code I'm able to initialize the disk and create a RAW partition, but I'm unable to tweak the parameters so that…
sternr
  • 6,216
  • 9
  • 39
  • 63
2
votes
1 answer

Win32_Volume Capacity 4096 Bytes Smaller Than Win32 API DeviceIOControl IOCTL_DISK_GET_LENGTH_INFO

Unfortunately this link was closed, but it does have my actual question: Get size of volume on Windows When I use WMI to get the capacity of a volume in Windows, via Win32_Volume and the Capacity property for my c:\ drive, I get this…
mhaken
  • 1,075
  • 4
  • 14
  • 28
2
votes
0 answers

Windows IOCTL: How to write to SD card External CSD Register?

Can anybody guide me on how to Write into an External CSD Register of SD card on Windows through IOCTL. I am using IOCTL_SFFDISK_DEVICE_COMMAND to send CMD6(SWITCH) and modify some fields of eMMC External CSD Register. But the DeviceIoControl throws…
rakendra
  • 21
  • 3
2
votes
1 answer

How to initialize disk on Windows server 2008/2012 through a C++ program

We are trying to initialize disk with the properties of some existing disk on Windows server 2008/2012 through a C++ program. We are using DeviceIoControl() method and IOCTL_DISK_CREATE_DISK, IOCTL_DISK_SET_DRIVE_LAYOUT_EX, …
prasad
  • 53
  • 4
2
votes
0 answers

DeviceIoControl() function is working differently in Windows 7 and Windows 8

I am trying to get the Hard Disk Serial using DeviceIoControl function. And calling it with same parameters it gives different value in output buffer. I am caliing it as if ( DeviceIoControl (hPhysicalDriveIOCTL, IOCTL_STORAGE_QUERY_PROPERTY, …
dmittal
  • 59
  • 1
  • 4