Fix a couple of problems with FreeLDR portability.
[reactos.git] / reactos / boot / freeldr / freeldr / machine.c
1 /* $Id$
2 *
3 * FreeLoader
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 */
19
20 #include <freeldr.h>
21
22 #undef MachConsPutChar
23 #undef MachConsKbHit
24 #undef MachConsGetCh
25 #undef MachVideoClearScreen
26 #undef MachVideoSetDisplayMode
27 #undef MachVideoGetDisplaySize
28 #undef MachVideoGetBufferSize
29 #undef MachVideoSetTextCursorPosition
30 #undef MachVideoHideShowTextCursor
31 #undef MachVideoPutChar
32 #undef MachVideoCopyOffScreenBufferToVRAM
33 #undef MachVideoIsPaletteFixed
34 #undef MachVideoSetPaletteColor
35 #undef MachVideoGetPaletteColor
36 #undef MachVideoSync
37 #undef MachBeep
38 #undef MachPrepareForReactOS
39 #undef MachGetMemoryMap
40 #undef MachDiskGetBootVolume
41 #undef MachDiskGetSystemVolume
42 #undef MachDiskGetBootPath
43 #undef MachDiskGetBootDevice
44 #undef MachDiskBootingFromFloppy
45 #undef MachDiskNormalizeSystemPath
46 #undef MachDiskReadLogicalSectors
47 #undef MachDiskGetPartitionEntry
48 #undef MachDiskGetDriveGeometry
49 #undef MachDiskGetCacheableBlockCount
50 #undef MachRTCGetCurrentDateTime
51 #undef MachHwDetect
52
53 MACHVTBL MachVtbl;
54
55 VOID
56 MachConsPutChar(int Ch)
57 {
58 MachVtbl.ConsPutChar(Ch);
59 }
60
61 BOOLEAN
62 MachConsKbHit()
63 {
64 return MachVtbl.ConsKbHit();
65 }
66
67 int
68 MachConsGetCh()
69 {
70 return MachVtbl.ConsGetCh();
71 }
72
73 VOID
74 MachVideoClearScreen(UCHAR Attr)
75 {
76 MachVtbl.VideoClearScreen(Attr);
77 }
78
79 VIDEODISPLAYMODE
80 MachVideoSetDisplayMode(char *DisplayMode, BOOLEAN Init)
81 {
82 return MachVtbl.VideoSetDisplayMode(DisplayMode, Init);
83 }
84
85 VOID
86 MachVideoGetDisplaySize(PULONG Width, PULONG Height, PULONG Depth)
87 {
88 return MachVtbl.VideoGetDisplaySize(Width, Height, Depth);
89 }
90
91 ULONG
92 MachVideoGetBufferSize(VOID)
93 {
94 return MachVtbl.VideoGetBufferSize();
95 }
96
97 VOID
98 MachVideoSetTextCursorPosition(ULONG X, ULONG Y)
99 {
100 return MachVtbl.VideoSetTextCursorPosition(X, Y);
101 }
102
103 VOID
104 MachVideoHideShowTextCursor(BOOLEAN Show)
105 {
106 MachVtbl.VideoHideShowTextCursor(Show);
107 }
108
109 VOID
110 MachVideoPutChar(int Ch, UCHAR Attr, unsigned X, unsigned Y)
111 {
112 MachVtbl.VideoPutChar(Ch, Attr, X, Y);
113 }
114
115 VOID
116 MachVideoCopyOffScreenBufferToVRAM(PVOID Buffer)
117 {
118 MachVtbl.VideoCopyOffScreenBufferToVRAM(Buffer);
119 }
120
121 BOOLEAN
122 MachVideoIsPaletteFixed(VOID)
123 {
124 return MachVtbl.VideoIsPaletteFixed();
125 }
126
127 VOID
128 MachVideoSetPaletteColor(UCHAR Color, UCHAR Red, UCHAR Green, UCHAR Blue)
129 {
130 return MachVtbl.VideoSetPaletteColor(Color, Red, Green, Blue);
131 }
132
133 VOID
134 MachVideoGetPaletteColor(UCHAR Color, UCHAR *Red, UCHAR *Green, UCHAR *Blue)
135 {
136 return MachVtbl.VideoGetPaletteColor(Color, Red, Green, Blue);
137 }
138
139 VOID
140 MachVideoSync(VOID)
141 {
142 MachVtbl.VideoSync();
143 }
144
145 VOID
146 MachBeep(VOID)
147 {
148 MachVtbl.Beep();
149 }
150
151 VOID
152 MachPrepareForReactOS(IN BOOLEAN Setup)
153 {
154 MachVtbl.PrepareForReactOS(Setup);
155 }
156
157 ULONG
158 MachGetMemoryMap(PBIOS_MEMORY_MAP BiosMemoryMap, ULONG MaxMemoryMapSize)
159 {
160 return MachVtbl.GetMemoryMap(BiosMemoryMap, MaxMemoryMapSize);
161 }
162
163 BOOLEAN
164 MachDiskGetBootVolume(PULONG DriveNumber, PULONGLONG StartSector, PULONGLONG SectorCount, int *FsType)
165 {
166 return MachVtbl.DiskGetBootVolume(DriveNumber, StartSector, SectorCount, FsType);
167 }
168
169 BOOLEAN
170 MachDiskGetSystemVolume(char *SystemPath,
171 char *RemainingPath,
172 PULONG Device,
173 PULONG DriveNumber,
174 PULONGLONG StartSector,
175 PULONGLONG SectorCount,
176 int *FsType)
177 {
178 return MachVtbl.DiskGetSystemVolume(SystemPath, RemainingPath, Device,
179 DriveNumber, StartSector, SectorCount,
180 FsType);
181 }
182
183 BOOLEAN
184 MachDiskGetBootPath(char *BootPath, unsigned Size)
185 {
186 return MachVtbl.DiskGetBootPath(BootPath, Size);
187 }
188
189 VOID
190 MachDiskGetBootDevice(PULONG BootDevice)
191 {
192 MachVtbl.DiskGetBootDevice(BootDevice);
193 }
194
195 BOOLEAN
196 MachDiskBootingFromFloppy()
197 {
198 return MachVtbl.DiskBootingFromFloppy();
199 }
200
201 BOOLEAN
202 MachDiskNormalizeSystemPath(char *SystemPath, unsigned Size)
203 {
204 return MachVtbl.DiskNormalizeSystemPath(SystemPath, Size);
205 }
206
207 BOOLEAN
208 MachDiskReadLogicalSectors(ULONG DriveNumber, ULONGLONG SectorNumber, ULONG SectorCount, PVOID Buffer)
209 {
210 return MachVtbl.DiskReadLogicalSectors(DriveNumber, SectorNumber, SectorCount, Buffer);
211 }
212
213 BOOLEAN
214 MachDiskGetPartitionEntry(ULONG DriveNumber, ULONG PartitionNumber, PPARTITION_TABLE_ENTRY PartitionTableEntry)
215 {
216 return MachVtbl.DiskGetPartitionEntry(DriveNumber, PartitionNumber, PartitionTableEntry);
217 }
218
219 BOOLEAN
220 MachDiskGetDriveGeometry(ULONG DriveNumber, PGEOMETRY DriveGeometry)
221 {
222 return MachVtbl.DiskGetDriveGeometry(DriveNumber, DriveGeometry);
223 }
224
225 ULONG
226 MachDiskGetCacheableBlockCount(ULONG DriveNumber)
227 {
228 return MachVtbl.DiskGetCacheableBlockCount(DriveNumber);
229 }
230
231 VOID
232 MachRTCGetCurrentDateTime(PULONG Year, PULONG Month, PULONG Day, PULONG Hour, PULONG Minute, PULONG Second)
233 {
234 MachVtbl.RTCGetCurrentDateTime(Year, Month, Day, Hour, Minute, Second);
235 }
236
237 VOID
238 MachHwDetect(VOID)
239 {
240 MachVtbl.HwDetect();
241 }
242
243 /* EOF */