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

Get full path to file given its "Reference Number"

I want to use Windows' change journal to track some file changes. I managed using an exemple code to access the said journal and read records from it. The issue I face now is that the record only holds the related file name, but not the absolute…
axiagame
  • 95
  • 1
  • 9
1
vote
1 answer

Struct unpack on win32file.DeviceIoControl

I am trying to understand and work with win32file. I need to grab USN Journals and having a hard time understanding code snippets I found online. This is the code snippet I found - format = 'qqqqqLLLLqqqqq' length =…
Sushant
  • 3,499
  • 3
  • 17
  • 34
1
vote
1 answer

Kernel32.dll - DeviceIOControl returns false while trying to get String descriptor in Win 10

I am currently using the DeviceIOControl API from kernel32.dll to get the String Descriptors of the list of connected USB devices. public static String GetStringDescriptor(IntPtr deviceHandle, Int32 ConnectionIndex, Byte DescriptorIndex, UInt16…
Niranjan
  • 330
  • 1
  • 2
  • 13
1
vote
0 answers

How do I get the full path of a deleted file from the NTFS Change Journal?

I'm reading the NTFS change Journal to monitor any file changes on a drive but the USN_RECORD's returned only include the filename of the associated file and not the full path. To get the full path I'm using the FileReferenceNumber (Also in the…
BenS1
  • 183
  • 2
  • 11
1
vote
1 answer

Error 87 When Using DeviceIoControl(FSCTL_GET_RETRIEVAL_POINTERS)

I'm trying to get the physical location of a file on the disk. This is the current code: import win32file import winioctlcon handle = win32file.CreateFile(raw_input("File: "), win32file.GENERIC_READ, win32file.FILE_SHARE_READ |…
Amit Ron
  • 41
  • 1
  • 5
1
vote
1 answer

DeviceIoControl with FSCTL_SET_ZERO_DATA returns ERROR_INVALID_PARAMETER

I am trying to use DeviceIoControl with FSCTL_SET_ZERO_DATA control code in C#. I created the file C:\tmp\test.txt and inside it I put the text "aaaa". I ran the code and I received error number: 87 According to MSDN: "The parameter is…
E235
  • 11,560
  • 24
  • 91
  • 141
1
vote
1 answer

DeviceIoControl Invalid access to memory location

I am getting invalid access to memory location when I run the following code WIN32_FIND_DATAW FD; WCHAR cPath[MAX_PATH], cFindPath[MAX_PATH]; if (!GetCurrentDirectoryW(MAX_PATH, cPath)) ErrorExit("GetCurrentDirectory"); else printf("Current…
Venkatesh
  • 1,537
  • 15
  • 28
1
vote
1 answer

DeviceIoControl() with IOCTL_DISK_GET_DRIVE_GEOMETRY is failing and returning error code 87. Why?

Relevant code is as follows: std::wstring path = ApplicationData::Current->LocalFolder->Path->Data(); std::wstring testFileName = path + std::wstring(L"\\TestVariablySized"); this->hMappedFile = CreateFile2( testFileName.c_str(), …
MNagy
  • 423
  • 7
  • 20
1
vote
1 answer

I'm attempting to use jdk.dio on my rpi and I get 'no dio in java.library.path'

I am trying to use the Oracle Device I/O library. I have made the dio following the instructions on the oracle page and copied the build folder onto by development PC. I added the built jar to my project on my IDE(Intellij IDEA) with the natives I…
MAWood
  • 99
  • 1
  • 13
1
vote
0 answers

Error 6: Invalid Handle DeviceIoControl()

I'm trying to create a simple Monitor Brightness adjustion. SetMonitorBrightness() doesn't work on the desired monitor somehow (ERROR_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA) so I'm trying IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS. To get the handle, I used…
1
vote
0 answers

UWP APIs to use for accessing device driver from UWP applications

What are the UWP APIs to use for accessing device driver from UWP applications ? I need to send some IOCTL command from UWP application to the driver. Is this possible without using Win32 APIs ?
zk9099
  • 183
  • 10
1
vote
1 answer

SECURITY_SET_PASSWORD using DeviceIoControl() with ATA_PASS_THROUGH_EX failed

I've tried ATA_PASS_THROUGH_EX or ATA_PASS_THROUGH_DIRECT in DeviceIoControl() function with ATA command SECURITY_SET_PASSWORD but it always failed with GetLastError()=87 (invalid parameter). But ATA command IDENTIFY always succeed. OS Environment:…
luke
  • 11
  • 1
1
vote
1 answer

IOControlCode asks for UShort, but ours is DWORD

I am creating a Custom Device for Universal Apps in Windows 10. Our previous app (runs for XP, 7, and 8 without Universal) has been using Driver control codes as a DWORD, but the Windows.Devices.Custom Namespace uses a function IOControlCode() uses…
Seth Kitchen
  • 1,526
  • 19
  • 53
1
vote
1 answer

What does IOCTL_DISK_VERIFY do?

The documentation for IOCTL_DISK_VERIFY says: Verifies the specified extent on a fixed disk. But what does that mean? When and why do I need to do this?
Felix Dombek
  • 13,664
  • 17
  • 79
  • 131
1
vote
1 answer

Windows SCSI ReadCapacity16 in D

I'm attempting to send a scsi ReadCapacity16 (0x9E) to a volume on Windows using D. The CDBs are to spec and my ReadCapacity16 works on Linux and scsi Inquiries work on Windows. Only the not-inquiry calls on Windows fail to work with an "incorrect…
ljdelight
  • 486
  • 4
  • 13