5
def getDeviceType(devType):
8
0x00000001 : "FILE_DEVICE_BEEP",
9
0x00000002 : "FILE_DEVICE_CD_ROM",
10
0x00000003 : "FILE_DEVICE_CD_ROM_FILE_SYSTEM",
11
0x00000004 : "FILE_DEVICE_CONTROLLER",
12
0x00000005 : "FILE_DEVICE_DATALINK",
13
0x00000006 : "FILE_DEVICE_DFS",
14
0x00000007 : "FILE_DEVICE_DISK",
15
0x00000008 : "FILE_DEVICE_DISK_FILE_SYSTEM",
16
0x00000009 : "FILE_DEVICE_FILE_SYSTEM",
17
0x0000000a : "FILE_DEVICE_INPORT_PORT",
18
0x0000000b : "FILE_DEVICE_KEYBOARD",
19
0x0000000c : "FILE_DEVICE_MAILSLOT",
20
0x0000000d : "FILE_DEVICE_MIDI_IN",
21
0x0000000e : "FILE_DEVICE_MIDI_OUT",
22
0x0000000f : "FILE_DEVICE_MOUSE",
23
0x00000010 : "FILE_DEVICE_MULTI_UNC_PROVIDER",
24
0x00000011 : "FILE_DEVICE_NAMED_PIPE",
25
0x00000012 : "FILE_DEVICE_NETWORK",
26
0x00000013 : "FILE_DEVICE_NETWORK_BROWSER",
27
0x00000014 : "FILE_DEVICE_NETWORK_FILE_SYSTEM",
28
0x00000015 : "FILE_DEVICE_NULL",
29
0x00000016 : "FILE_DEVICE_PARALLEL_PORT",
30
0x00000017 : "FILE_DEVICE_PHYSICAL_NETCARD",
31
0x00000018 : "FILE_DEVICE_PRINTER",
32
0x00000019 : "FILE_DEVICE_SCANNER",
33
0x0000001a : "FILE_DEVICE_SERIAL_MOUSE_PORT",
34
0x0000001b : "FILE_DEVICE_SERIAL_PORT",
35
0x0000001c : "FILE_DEVICE_SCREEN",
36
0x0000001d : "FILE_DEVICE_SOUND",
37
0x0000001e : "FILE_DEVICE_STREAMS",
38
0x0000001f : "FILE_DEVICE_TAPE",
39
0x00000020 : "FILE_DEVICE_TAPE_FILE_SYSTEM",
40
0x00000021 : "FILE_DEVICE_TRANSPORT",
41
0x00000022 : "FILE_DEVICE_UNKNOWN",
42
0x00000023 : "FILE_DEVICE_VIDEO",
43
0x00000024 : "FILE_DEVICE_VIRTUAL_DISK",
44
0x00000025 : "FILE_DEVICE_WAVE_IN",
45
0x00000026 : "FILE_DEVICE_WAVE_OUT",
46
0x00000027 : "FILE_DEVICE_8042_PORT",
47
0x00000028 : "FILE_DEVICE_NETWORK_REDIRECTOR",
48
0x00000029 : "FILE_DEVICE_BATTERY",
49
0x0000002a : "FILE_DEVICE_BUS_EXTENDER",
50
0x0000002b : "FILE_DEVICE_MODEM",
51
0x0000002c : "FILE_DEVICE_VDM",
52
0x0000002d : "FILE_DEVICE_MASS_STORAGE",
53
0x0000002e : "FILE_DEVICE_SMB",
54
0x0000002f : "FILE_DEVICE_KS",
55
0x00000030 : "FILE_DEVICE_CHANGER",
56
0x00000031 : "FILE_DEVICE_SMARTCARD",
57
0x00000032 : "FILE_DEVICE_ACPI",
58
0x00000033 : "FILE_DEVICE_DVD",
59
0x00000034 : "FILE_DEVICE_FULLSCREEN_VIDEO",
60
0x00000035 : "FILE_DEVICE_DFS_FILE_SYSTEM",
61
0x00000036 : "FILE_DEVICE_DFS_VOLUME",
62
0x00000037 : "FILE_DEVICE_SERENUM",
63
0x00000038 : "FILE_DEVICE_TERMSRV",
64
0x00000039 : "FILE_DEVICE_KSEC",
65
0x0000003A : "FILE_DEVICE_FIPS",
66
0x0000003B : "FILE_DEVICE_INFINIBAND",
67
0x0000003E : "FILE_DEVICE_VMBUS",
68
0x0000003F : "FILE_DEVICE_CRYPT_PROVIDER",
69
0x00000040 : "FILE_DEVICE_WPD",
70
0x00000041 : "FILE_DEVICE_BLUETOOTH",
71
0x00000042 : "FILE_DEVICE_MT_COMPOSITE",
72
0x00000043 : "FILE_DEVICE_MT_TRANSPORT",
73
0x00000044 : "FILE_DEVICE_BIOMETRIC",
74
0x00000045 : "FILE_DEVICE_PMI"
75
}.get( devType, "%#x" % devType )
88
1: "FILE_READ_ACCESS",
89
2: "FILE_WRITE_ACCESS",
94
devtype = ( ctl >> 16 ) & 0xFFFF
95
access = ( ctl >> 14 ) & 3
96
function = ( ctl >> 2 ) & 0xFFF
98
return "Device type: %s Function: %#x(%d) Method: %s Access: %s" % ( getDeviceType(devtype), function, function, getMethod(method), getAccess(access) )
102
dprintln( "!py ctlcode code")
106
if not isKernelDebugging():
107
dprintln( "This script is for kernel debugging only" )
109
if len(sys.argv) < 2:
113
dprintln( ctlcode( expr( sys.argv[1] ) ) )
115
if __name__ == "__main__":