source: trunk/src/win32k/kKrnlLib/tools/kDevTest/kDevTest.h

Last change on this file was 9311, checked in by bird, 23 years ago

Initial coding.

File size: 7.0 KB
Line 
1/* $Id: kDevTest.h,v 1.1 2002-09-30 23:53:53 bird Exp $
2 *
3 * Ring-3 Device Testing: Prototypes, structures, defines.
4 *
5 * Copyright (c) 2002 knut st. osmundsen <bird@anduin.net>
6 *
7 *
8 * This file is part of kKrnlLib.
9 *
10 * kKrnlLib is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * kKrnlLib is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with kKrnlLib; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 *
24 */
25
26#ifndef __kDevTest_h__
27#define __kDevTest_h__
28
29
30/*******************************************************************************
31* Defined Constants And Macros *
32*******************************************************************************/
33#define SEL_FLAT_MASK 0x1fff0000
34#define SEL_FLAT_SHIFT 0x0d
35#define SEL_LDT_RPL3 0x07
36
37#define FPToFlat(fp) SelToFlat( (((ULONG)(fp)) >> 16), (USHORT)(fp))
38
39#define SelToFlat(sel, off) \
40 (PVOID)( (((unsigned)(sel) << SEL_FLAT_SHIFT) & SEL_FLAT_MASK) + (unsigned)(off))
41
42#define FlatToSel(flataddr) \
43 (PVOID)( ( (((unsigned)(flataddr) << 3) & 0xfff80000) | (SEL_LDT_RPL3 << 16) ) | ((unsigned)(flataddr) & 0xffff) )
44
45/*
46 * Strategy Commands.
47 */
48#define CMDInit 0 /* INIT command */
49#define CMDMedChk 1 /* Media Check */
50#define CMDBldBPB 2 /* build BPB */
51#define CMDIOCTLR 3 /* reserved for 3.x compatability */
52#define CMDINPUT 4 /* read data from device */
53#define CMDNDR 5 /* non-destructive read */
54#define CMDInputS 6 /* input status */
55#define CMDInputF 7 /* input flush */
56#define CMDOUTPUT 8 /* write data to device */
57#define CMDOUTPUTV 9 /* write data and verify */
58#define CMDOutputS 10 /* output status */
59#define CMDOutputF 11 /* output flush */
60#define CMDIOCTLW 12 /* reserved for 3.x compatability */
61#define CMDOpen 13 /* device open */
62#define CMDClose 14 /* device close */
63#define CMDRemMed 15 /* is media removable */
64#define CMDGenIOCTL 16 /* Generic IOCTL */
65#define CMDResMed 17 /* reset media uncertain */
66#define CMDGetLogMap 18
67#define CMDSetLogMap 19
68#define CMDDeInstall 20 /* De-Install driver */
69#define CMDPartfixeddisks 22 /* Partitionable Fixed Disks */
70#define CMDGetfd_logunitsmap 23 /* Get Fixed Disk/Logical Unit Map */
71#define CMDInputBypass 24 /* cache bypass read data */
72#define CMDOutputBypass 25 /* cache bypass write data */
73#define CMDOutputBypassV 26 /* cache bypass write data and verify */
74#define CMDInitBase 27 /* INIT command for base DDs */
75#define CMDShutdown 28
76#define CMDGetDevSupport 29 /* query for extended capability */
77#define CMDInitComplete 31 /* Init complete for all DD's */
78#define CMDSaveRestore 32
79#define CMDAddOnPrep 97 /* Prepare for add on */
80#define CMDStar 98 /* start console output */
81#define CMDStop 99 /* stop console output */
82
83
84/*
85 * Status codes.
86 */
87#define STERR 0x8000 /* Bit 15 - Error */
88#define STINTER 0x0400 /* Bit 10 - Interim character */
89#define STBUI 0x0200 /* Bit 9 - Busy */
90#define STDON 0x0100 /* Bit 8 - Done */
91#define STECODE 0x00FF /* Error code */
92#define WRECODE 0x0000
93
94
95
96/*******************************************************************************
97* Structures and Typedefs *
98*******************************************************************************/
99#pragma pack(1)
100
101/*
102 * Device header.
103 */
104typedef struct _DevHdr
105{
106 unsigned long fpNext;
107 unsigned short usAttr;
108 unsigned short offStrat;
109 unsigned short offInt;
110 unsigned char achName[8];
111 unsigned short selProtCS;
112 unsigned short selProtDS;
113 unsigned short selRealCS;
114 unsigned short selRealDS;
115 unsigned long ulCaps;
116} DEVHDR, *PDEVHDR;
117
118
119
120/*
121 * Request packets.
122 */
123
124typedef struct _RPH32
125{
126 UCHAR Len;
127 UCHAR Unit;
128 UCHAR Cmd;
129 USHORT Status;
130 UCHAR Flags;
131 UCHAR Reserved_1[3];
132 ULONG Link;
133} RPH32;
134
135typedef struct _RP32INITIN
136{
137 RPH32 rph;
138 UCHAR Unit;
139 ULONG DevHlpEP; /* 16 bit far pointer */
140 ULONG InitArgs; /* 16 bit far pointer */
141 UCHAR DriveNum;
142} RP32INITIN, *PRP32INITIN;
143
144typedef struct _RP32INITOUT
145{
146 RPH32 rph;
147 UCHAR Unit;
148 USHORT CodeEnd;
149 USHORT DataEnd;
150 ULONG BPBArray; /* (BPBS far ptr) */
151 USHORT Status;
152} RP32INITOUT, *PRP32INITOUT;
153
154typedef union _RP32INIT
155{
156 RP32INITIN in;
157 RP32INITOUT out;
158} RP32INIT, *PRP32INIT;
159
160
161
162/*
163 * Module structures.
164 */
165
166typedef struct _ModObjTable
167{
168 ULONG ote_size; /* Object virtual size */
169 ULONG ote_base; /* Object base virtual address */
170 ULONG ote_flags; /* Attribute flags */
171 ULONG ote_pagemap; /* Object page map index */
172 ULONG ote_mapsize; /* Num of entries in obj page map */
173 USHORT ote_sel; /* Object Selector */
174 USHORT ote_hob; /* Object Handle */
175} MODOBJTABLE, *PMODOBJTABLE;
176
177#define MOD_MAX_OBJS 32
178typedef struct _ModInfo
179{
180 CHAR szName[CCHMAXPATH]; /* Module name (no path) */
181 HMODULE hmod; /* module handle */
182 ULONG cObjs; /* Number of object. */
183 MODOBJTABLE aObjs[MOD_MAX_OBJS]; /* Object details. */
184} MODINFO, *PMODINFO;
185
186#pragma pack()
187
188
189/*
190 * Device Help + more.
191 */
192void kdtDHInit(void); /* _System/_Optlink !! */
193ULONG kdtDHGetRouterFP(void); /* _System/_Optlink !! */
194void kdtStackThunk32To16(void); /* _System/_Optlink !! */
195void kdtStackThunk16To32(void); /* _System/_Optlink !! */
196
197
198/*
199 * Loader
200 */
201PMODINFO kdtLoadDriver(const char *pszModule);
202BOOL kdtLoadValidateDriver(PMODINFO pModInfo);
203
204
205/*
206 * Init.
207 */
208BOOL kdtInitDriver(PMODINFO pModInfo, const char *pszArgs, BOOL fBaseDev);
209
210
211/*
212 * Strategy.
213 */
214BOOL kdtStrategySend(ULONG fpfnStrat, ULONG fpRP);
215
216
217#endif
218
Note: See TracBrowser for help on using the repository browser.