1{
2    This file is part of the Free Pascal run time library.
3    Copyright (c) 2008 Free Pascal development team.
4
5    See the file COPYING.FPC, included in this distribution,
6    for details about the copyright.
7
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
11
12 ********************************************************************** }
13// *
14// * Module Name: winioctl.h
15// * Abstract: this module defines device IO control codes.
16// *
17
18//
19//  Microsoft Windows Mobile 6.0 for PocketPC SDK.
20//
21
22unit WinIOCtl;
23
24interface
25
26uses Windows;
27
28// The definition below is intentionally left SO FAR because some of useful
29// constants or macros declared here may be redeclared elsewhere by pure accident.
30{$IFNDEF _WINIOCTL_}
31  {$DEFINE _WINIOCTL_}
32{$ENDIF _WINIOCTL_}
33
34type
35     DEVICE_TYPE = ULONG;
36
37//
38// Macro definition for defining IOCTL and FSCTL function control codes.  Note
39// that function codes 0-2047 are reserved for Microsoft Corporation, and
40// 2048-4095 are reserved for customers.
41//
42function CTL_CODE(_DeviceType:DEVICE_TYPE; _Function:DWORD; _Method:DWORD; _Access:DWORD):DWORD;
43{ This macro was declared as:
44#define CTL_CODE( DeviceType, Function, Method, Access ) (                 \
45    ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method) \
46)
47}
48
49
50//
51// Define the method codes for how buffers are passed for I/O and FS controls
52//
53const
54      METHOD_BUFFERED                 = 0;
55      METHOD_IN_DIRECT                = 1;
56      METHOD_OUT_DIRECT               = 2;
57      METHOD_NEITHER                  = 3;
58
59//
60// Define the access check value for any access
61//
62//
63// The FILE_READ_ACCESS and FILE_WRITE_ACCESS constants are also defined in
64// ntioapi.h as FILE_READ_DATA and FILE_WRITE_DATA. The values for these
65// constants *MUST* always be in sync.
66//
67const
68      FILE_ANY_ACCESS                 = 0;
69      FILE_READ_ACCESS                = $0001;    // file & pipe
70      FILE_WRITE_ACCESS               = $0002;    // file & pipe
71
72//
73// Define the various device type values.  Note that values used by Microsoft
74// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
75// by customers.
76//
77const
78      FILE_DEVICE_BEEP                = $00000001;
79      FILE_DEVICE_CD_ROM              = $00000002;
80      FILE_DEVICE_CD_ROM_FILE_SYSTEM  = $00000003;
81      FILE_DEVICE_CONTROLLER          = $00000004;
82      FILE_DEVICE_DATALINK            = $00000005;
83      FILE_DEVICE_DFS                 = $00000006;
84      FILE_DEVICE_DISK                = $00000007;
85      FILE_DEVICE_DISK_FILE_SYSTEM    = $00000008;
86      FILE_DEVICE_FILE_SYSTEM         = $00000009;
87      FILE_DEVICE_INPORT_PORT         = $0000000a;
88      FILE_DEVICE_KEYBOARD            = $0000000b;
89      FILE_DEVICE_MAILSLOT            = $0000000c;
90      FILE_DEVICE_MIDI_IN             = $0000000d;
91      FILE_DEVICE_MIDI_OUT            = $0000000e;
92      FILE_DEVICE_MOUSE               = $0000000f;
93      FILE_DEVICE_MULTI_UNC_PROVIDER  = $00000010;
94      FILE_DEVICE_NAMED_PIPE          = $00000011;
95      FILE_DEVICE_NETWORK             = $00000012;
96      FILE_DEVICE_NETWORK_BROWSER     = $00000013;
97      FILE_DEVICE_NETWORK_FILE_SYSTEM = $00000014;
98      FILE_DEVICE_NULL                = $00000015;
99      FILE_DEVICE_PARALLEL_PORT       = $00000016;
100      FILE_DEVICE_PHYSICAL_NETCARD    = $00000017;
101      FILE_DEVICE_PRINTER             = $00000018;
102      FILE_DEVICE_SCANNER             = $00000019;
103      FILE_DEVICE_SERIAL_MOUSE_PORT   = $0000001a;
104      FILE_DEVICE_SERIAL_PORT         = $0000001b;
105      FILE_DEVICE_SCREEN              = $0000001c;
106      FILE_DEVICE_SOUND               = $0000001d;
107      FILE_DEVICE_STREAMS             = $0000001e;
108      FILE_DEVICE_TAPE                = $0000001f;
109      FILE_DEVICE_TAPE_FILE_SYSTEM    = $00000020;
110      FILE_DEVICE_TRANSPORT           = $00000021;
111      FILE_DEVICE_UNKNOWN             = $00000022;
112      FILE_DEVICE_VIDEO               = $00000023;
113      FILE_DEVICE_VIRTUAL_DISK        = $00000024;
114      FILE_DEVICE_WAVE_IN             = $00000025;
115      FILE_DEVICE_WAVE_OUT            = $00000026;
116      FILE_DEVICE_8042_PORT           = $00000027;
117      FILE_DEVICE_NETWORK_REDIRECTOR  = $00000028;
118      FILE_DEVICE_BATTERY             = $00000029;
119      FILE_DEVICE_BUS_EXTENDER        = $0000002a;
120      FILE_DEVICE_MODEM               = $0000002b;
121      FILE_DEVICE_VDM                 = $0000002c;
122      FILE_DEVICE_MASS_STORAGE        = $0000002d;
123      FILE_DEVICE_SMB                 = $0000002e;
124      FILE_DEVICE_KS                  = $0000002f;
125      FILE_DEVICE_CHANGER             = $00000030;
126      FILE_DEVICE_SMARTCARD           = $00000031;
127      FILE_DEVICE_ACPI                = $00000032;
128      FILE_DEVICE_DVD                 = $00000033;
129      FILE_DEVICE_FULLSCREEN_VIDEO    = $00000034;
130      FILE_DEVICE_DFS_FILE_SYSTEM     = $00000035;
131      FILE_DEVICE_DFS_VOLUME          = $00000036;
132
133//
134// Windows CE Specific Defines
135//
136const
137      FILE_DEVICE_HAL                 = $00000101;
138      FILE_DEVICE_CONSOLE             = $00000102;
139      FILE_DEVICE_PSL                 = $00000103;
140      FILE_DEVICE_SERVICE             = $00000104;
141      FILE_DEVICE_NLED                = $00000105;
142      FILE_DEVICE_NOTIFY              = $00000106;
143      FILE_DEVICE_GPS                 = $00000107;
144      FILE_DEVICE_SQM                 = $00000108;
145
146implementation
147
148function CTL_CODE(_DeviceType:DEVICE_TYPE; _Function:DWORD; _Method:DWORD; _Access:DWORD):DWORD; inline;
149begin
150  CTL_CODE:=(_DeviceType shl 16) or (_Access shl 14) or (_Function shl 2) or _Method;
151end;
152
153end.