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
2
votes
1 answer

How to use IOCTL_SCSI_MINIPORT via DeviceIoControl from C#.net?

My task is to implement a reliable solution to retrieve the serial number of the hard drive. Unfortunately the WMI method isn't reliable at all. So I'm looking for another solution. I've found this small piece of software, which does exactly that…
Robin
  • 8,162
  • 7
  • 56
  • 101
2
votes
0 answers

Device unique ID (hardware serial ID vs volume serial ID) Windows

I've been messing around with the Windows API (I've been told to stay away from WMI as it's unreliable), trying to get device serial numbers for my HDs and attached USB devices. But it seems that the majority of the functionality is designed to…
user1853098
  • 99
  • 3
  • 10
2
votes
1 answer

DeviceIoControl does not set output buffer

I'm having some problems with DeviceIOControl. I'm trying to read the disk geometry from a physical drive but the output buffer is never set. Here is a sample of my code, a simple function that is supposed to get the disk geometry and return…
Johan
  • 35
  • 1
  • 7
2
votes
0 answers

Sending IDENTIFY DEVICE COMMAND - ATA PASS THROUGH on raid - SSD

My aim is to detect Solid State Drives in systems with raid configuration. Using smartmontools' following command I observe bit 434 (217) shows value 1 for SSD: smartctl -i -r ataioctl,2 /dev/csmi0,0 Attempting to read the same 512 bytes of data I…
pp99
  • 23
  • 1
  • 7
1
vote
2 answers

LARGE_INTEGER value gets changed while marshalling : from LARGE_INTEGER to UINT64 (C) to C#'s uint64

I try to marshal NdisGetCurrentSystemTime result to a C# program via ioctl. LARGE_INTEGER data; NdisGetCurrentSystemTime (&data ); marshal_data->time = (UINT64)(data.QuadPart / 10^6); DBGPRINT(("Time: %64u", marshal_data->time)); At C# receiver…
kagali-san
  • 2,964
  • 7
  • 48
  • 87
1
vote
0 answers

Trying to get StorageAdapterPhysicalTopologyProperty using STORAGE_PROPERTY_QUERY doesn't work

I am using DeviceIoControl with IOCTL_STORAGE_QUERY_PROPERTY to retrieve StorageAdapterPhysicalTopologyProperty. When i try this i get an 1117 error, "The request could not be performed because of an I/O device error". I have determined that the…
Mark Welo
  • 11
  • 3
1
vote
0 answers

Toggle USB Video Camera torchlight mode

I am trying to implement a win32 console application using C++ that takes an ON/OFF input for a specific camera which determines the state its torchlight. The camera is integrated to my laptop and the device description states its a USB Video…
Valio Raltchev
  • 113
  • 2
  • 13
1
vote
0 answers

Read HDD SMART attributes using DeviceIoControl

I run my program that gets HDD SMART attributes as admin, but get this error: Failed to get S.M.A.R.T. data. Error code: 5 Error message: Access is denied. Why access is denied?How to fix it?Program seems to be correct,if not,please help to correct…
Bogdaniv
  • 23
  • 2
1
vote
2 answers

error: 'IOCTL_STORAGE_QUERY_PROPERTY' was not declared in this scop

I've included winioctl.h and there is no #define for IOCTL_STORAGE_QUERY_PROPERTY in that file !! http://www.osronline.com/ddkx/storage/k307_8z3m.htm Says Its in ntddstor.h But I cannot find any ntddstor.h on my Windows XP.…
Neel Basu
  • 12,638
  • 12
  • 82
  • 146
1
vote
0 answers

Using DeviceIOControl to get SMART-Info from USB-connected HDD

I want to read the SMART-attributes of an USB-attached HDD via Powershell. Calling DeviceIOControl works fine if the HDD is build-in, but I dont understand the correct logics for getting the same info via USB. Here is a code snippet I have so far to…
Carsten
  • 1,612
  • 14
  • 21
1
vote
1 answer

FSCTL_LOCK_VOLUME fails with ERROR_ACCESS_DENIED on mounted VHD

I'm working on a program that installs FreeDOS onto a Virtual Hard Disk. It generates and executes a DiskPart script to create the VHD, partition it, format it, then assign it a drive letter. This works fine. My installer copies everything to the…
David Brown
  • 35,411
  • 11
  • 83
  • 132
1
vote
1 answer

How are memory mapped devices allocated an address and how does the CPU know what it is

I gather that the main ways of the CPU addressing devices are "port" and "memory" mapped. In both of these: How are devices dynamically assigned an address - who assigns it and how? How does the CPU then know a device exists, has been assigned and…
1
vote
1 answer

Trigger Keypress on Physical Keyboard

I want to trigger a Keypress on a Keyboard. On the physical keyboard - so that it has to travel through all the Kernel Filters with that specific keyboard as its source. Is something like that even possible? I looked at DeviceIOCtrl and…
CShark
  • 1,413
  • 15
  • 25
1
vote
0 answers

How would I read the NTFS master file table in C (*not* C++)?

I need a simple, lightweight way to read the NTFS MFT on a Windows server, using only C. My goal is to return a collection of directories and their permissions in a programmatic way for an application my company is building. Every other answer I've…
Cade Bryant
  • 737
  • 2
  • 7
  • 19
1
vote
0 answers

Max transfer size of SCSI Read(10) on a Physical Drive

Refer to here, IOCTL_STORAGE_QUERY_PROPERTY with StorageAdapterProperty can be used to get the max transfer size of per SCSI Read(10) command. In this code, 16 sectors are read from start of lba. I tried to modify the number and in my Win7…
林偉誠
  • 11
  • 3