1 |
gbeauche |
1.1 |
/*
|
2 |
|
|
* ntcd.h - Interface to cdenable.sys driver
|
3 |
|
|
*
|
4 |
gbeauche |
1.2 |
* Basilisk II (C) 1997-2004 Christian Bauer
|
5 |
gbeauche |
1.1 |
*
|
6 |
|
|
* Windows platform specific code copyright (C) Lauri Pesonen
|
7 |
|
|
*
|
8 |
|
|
* This program is free software; you can redistribute it and/or modify
|
9 |
|
|
* it under the terms of the GNU General Public License as published by
|
10 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
11 |
|
|
* (at your option) any later version.
|
12 |
|
|
*
|
13 |
|
|
* This program is distributed in the hope that it will be useful,
|
14 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
* GNU General Public License for more details.
|
17 |
|
|
*
|
18 |
|
|
* You should have received a copy of the GNU General Public License
|
19 |
|
|
* along with this program; if not, write to the Free Software
|
20 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
21 |
|
|
*/
|
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/*
|
25 |
|
|
Installs the driver, if not already installed.
|
26 |
|
|
Starts the driver, if not already running.
|
27 |
|
|
|
28 |
|
|
You can either always call "CdenableSysInstallStart" when your
|
29 |
|
|
program fires up and "CdenableSysStopRemove" when it terminates,
|
30 |
|
|
or just let the installation program call "CdenableSysInstallStart"
|
31 |
|
|
and leave it always be present.
|
32 |
|
|
|
33 |
|
|
I recommend the latter option. Calling "CdenableSysInstallStart"
|
34 |
|
|
always doesn't hurt anything, it will immediately return
|
35 |
|
|
with success if the service is running.
|
36 |
|
|
|
37 |
|
|
Returns non-zero if installation/startup was succesfull,
|
38 |
|
|
zero if anything failed.
|
39 |
|
|
Returns non-zero also if the driver was already running.
|
40 |
|
|
|
41 |
|
|
The file "cdenable.sys" must already have been copied to
|
42 |
|
|
the directory "System32\Drivers"
|
43 |
|
|
*/
|
44 |
|
|
|
45 |
|
|
#ifndef _NT_CD_H_
|
46 |
|
|
#define _NT_CD_H_
|
47 |
|
|
|
48 |
|
|
#ifdef __cplusplus
|
49 |
|
|
extern "C" {
|
50 |
|
|
#endif
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
BOOL CdenableSysInstallStart(void);
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
/*
|
57 |
|
|
Stops and removes the driver. See above.
|
58 |
|
|
This must be called when new version of the driver is updated.
|
59 |
|
|
*/
|
60 |
|
|
void CdenableSysStopRemove(void);
|
61 |
|
|
|
62 |
|
|
|
63 |
|
|
/*
|
64 |
|
|
HANDLE h: returned from CreateFile ( "\\\\.\\X:", GENERIC_READ, ... );
|
65 |
|
|
Returns the bytes actually read (==count), 0 on failure.
|
66 |
|
|
NOTE: in my code, start and count are always aligned to
|
67 |
|
|
sector boundaries (2048 bytes).
|
68 |
|
|
I cannot guarantee that this works if they are not.
|
69 |
|
|
Max read is 64 kb.
|
70 |
|
|
Synchronous read, but quite fast.
|
71 |
|
|
*/
|
72 |
|
|
int CdenableSysReadCdBytes( HANDLE h, DWORD start, DWORD count, char *buf );
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
/*
|
76 |
|
|
Same as SysReadCdBytes, but "start" and "count" are in 2048 byte
|
77 |
|
|
sectors.
|
78 |
|
|
*/
|
79 |
|
|
int CdenableSysReadCdSectors( HANDLE h, DWORD start, DWORD count, char *buf );
|
80 |
|
|
|
81 |
|
|
|
82 |
|
|
/*
|
83 |
|
|
Ditto for writing stuff.
|
84 |
|
|
Not a cd of course but removable & hd media are supported now.
|
85 |
|
|
*/
|
86 |
|
|
int CdenableSysWriteCdBytes( HANDLE h, DWORD start, DWORD count, char *buf );
|
87 |
|
|
int CdenableSysWriteCdSectors( HANDLE h, DWORD start, DWORD count, char *buf );
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
/*
|
91 |
|
|
Returns CDENABLE_CURRENT_VERSION (of the driver).
|
92 |
|
|
*/
|
93 |
|
|
DWORD CdenableSysGetVersion( void );
|
94 |
|
|
|
95 |
|
|
#ifdef __cplusplus
|
96 |
|
|
} // extern "C"
|
97 |
|
|
#endif
|
98 |
|
|
|
99 |
|
|
#endif //_NT_CD_H_
|