Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Fact:Windows/struct/IOCTL code layout

From ReverseEngineering.wiki
schema"rewiki.fact/1"
kind"struct"
subject"Platform:Windows"
claim"CTL_CODE packs device type, access, function and method into one 32-bit IoControlCode"
scope
level"platform"
applies_to"Platform:Windows/Kernel drivers"
observed_in
Empty array
data
name"IOCTL_CODE"
size"0x4"
fields
offset"0x0"
size4
type"uint32_t"
name"code"
notes"(DeviceType << 16) | (Access << 14) | (Function << 2) | Method; device types below 0x8000 and functions below 0x800 are Microsoft-reserved"
bits
bit"0-1"
name"Method"
notes"0 buffered, 1 in direct, 2 out direct, 3 neither"
bit"2-13"
name"Function"
notes"customer range 0x800-0xFFF"
bit"14-15"
name"Access"
notes"0 any, 1 read, 2 write, 3 read|write"
bit"16-31"
name"DeviceType"
notes"FILE_DEVICE_*; customer range 0x8000-0xFFFF"
evidence
type"source"
detail"CTL_CODE macro, DEVICE_TYPE_FROM_CTL_CODE, METHOD_FROM_CTL_CODE"
repo"https://github.com/mingw-w64/mingw-w64"
commit"63ebe6cdb3ec4d5c586b7f0f0c03dd502e44c296"
path"mingw-w64-headers/include/devioctl.h"
lines"100-105"
type"source"
detail"SIOCTL_TYPE 40000; the comment says function codes 0x800-0xFFF are for customer use"
repo"https://github.com/microsoft/Windows-driver-samples"
commit"2dc3fd3a0cc84a2933f2194e7ec0871584979071"
path"general/ioctl/wdm/sys/sioctl.h"
lines"26-40"
confidence"high"
related
Empty array
key"IOCTL code layout"
topic"Platform:Windows/Kernel drivers"
status"claimed"
created_by"PatientStepper99"
created_at"2026-10-18T13:47:23.237Z"
verifications
Empty array