Import Usb/UsbBusDxe and Usb/UsbMassStorageDxe into MdeModulePkg.
[mirror_edk2.git] / EdkNt32Pkg / Sec / SecMain.h
1 /*++
2
3 Copyright (c) 2006, Intel Corporation
4 All rights reserved. This program and the accompanying materials
5 are licensed and made available under the terms and conditions of the BSD License
6 which accompanies this distribution. The full text of the license may be found at
7 http://opensource.org/licenses/bsd-license.php
8
9 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
10 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
11
12
13 Module Name:
14 SecMain.h
15
16 Abstract:
17 Include file for Windows API based SEC
18
19 --*/
20
21 #include <stdio.h>
22
23
24 #define STACK_SIZE 0x20000
25
26 typedef struct {
27 EFI_PHYSICAL_ADDRESS Address;
28 UINT64 Size;
29 } NT_FD_INFO;
30
31 #define NT_SYSTEM_MEMORY_FILENAME_SIZE 40
32
33 typedef struct {
34 CHAR16 FileName[NT_SYSTEM_MEMORY_FILENAME_SIZE];
35 EFI_PHYSICAL_ADDRESS Memory;
36 UINT64 Size;
37 } NT_SYSTEM_MEMORY;
38
39
40 #define MAX_PDB_NAME_TO_MOD_HANDLE_ARRAY_SIZE 0x100
41
42 typedef struct {
43 CHAR8 *PdbPointer;
44 VOID *ModHandle;
45 } PDB_NAME_TO_MOD_HANDLE;
46
47
48
49
50 EFI_STATUS
51 EFIAPI
52 SecWinNtPeiLoadFile (
53 VOID *Pe32Data, // TODO: add IN/OUT modifier to Pe32Data
54 EFI_PHYSICAL_ADDRESS *ImageAddress, // TODO: add IN/OUT modifier to ImageAddress
55 UINT64 *ImageSize, // TODO: add IN/OUT modifier to ImageSize
56 EFI_PHYSICAL_ADDRESS *EntryPoint // TODO: add IN/OUT modifier to EntryPoint
57 )
58 /*++
59
60 Routine Description:
61
62 TODO: Add function description
63
64 Arguments:
65
66 Pe32Data - TODO: add argument description
67 ImageAddress - TODO: add argument description
68 ImageSize - TODO: add argument description
69 EntryPoint - TODO: add argument description
70
71 Returns:
72
73 TODO: add return values
74
75 --*/
76 ;
77
78 EFI_STATUS
79 EFIAPI
80 SecWinNtPeiAutoScan (
81 IN UINTN Index,
82 OUT EFI_PHYSICAL_ADDRESS *MemoryBase,
83 OUT UINT64 *MemorySize
84 )
85 /*++
86
87 Routine Description:
88
89 TODO: Add function description
90
91 Arguments:
92
93 Index - TODO: add argument description
94 MemoryBase - TODO: add argument description
95 MemorySize - TODO: add argument description
96
97 Returns:
98
99 TODO: add return values
100
101 --*/
102 ;
103
104 VOID *
105 EFIAPI
106 SecWinNtWinNtThunkAddress (
107 VOID
108 )
109 /*++
110
111 Routine Description:
112
113 TODO: Add function description
114
115 Arguments:
116
117 InterfaceSize - TODO: add argument description
118 InterfaceBase - TODO: add argument description
119
120 Returns:
121
122 TODO: add return values
123
124 --*/
125 ;
126
127 EFI_STATUS
128 EFIAPI
129 SecWinNtWinNtFwhAddress (
130 IN OUT UINT64 *FwhSize,
131 IN OUT EFI_PHYSICAL_ADDRESS *FwhBase
132 )
133 /*++
134
135 Routine Description:
136
137 TODO: Add function description
138
139 Arguments:
140
141 FwhSize - TODO: add argument description
142 FwhBase - TODO: add argument description
143
144 Returns:
145
146 TODO: add return values
147
148 --*/
149 ;
150
151 EFI_STATUS
152 EFIAPI
153 SecPeiReportStatusCode (
154 IN EFI_PEI_SERVICES **PeiServices,
155 IN EFI_STATUS_CODE_TYPE CodeType,
156 IN EFI_STATUS_CODE_VALUE Value,
157 IN UINT32 Instance,
158 IN EFI_GUID * CallerId,
159 IN EFI_STATUS_CODE_DATA * Data OPTIONAL
160 )
161 /*++
162
163 Routine Description:
164
165 TODO: Add function description
166
167 Arguments:
168
169 PeiServices - TODO: add argument description
170 CodeType - TODO: add argument description
171 Value - TODO: add argument description
172 Instance - TODO: add argument description
173 CallerId - TODO: add argument description
174 Data - TODO: add argument description
175
176 Returns:
177
178 TODO: add return values
179
180 --*/
181 ;
182
183 INTN
184 EFIAPI
185 main (
186 IN INTN Argc,
187 IN CHAR8 **Argv,
188 IN CHAR8 **Envp
189 )
190 /*++
191
192 Routine Description:
193
194 TODO: Add function description
195
196 Arguments:
197
198 Argc - TODO: add argument description
199 Argv - TODO: add argument description
200 Envp - TODO: add argument description
201
202 Returns:
203
204 TODO: add return values
205
206 --*/
207 ;
208
209 EFI_STATUS
210 WinNtOpenFile (
211 CHAR16 *FileName,
212 UINT32 MapSize,
213 DWORD CreationDispostion,
214 EFI_PHYSICAL_ADDRESS *BaseAddress,
215 UINT64 *Length
216 )
217 /*++
218
219 Routine Description:
220
221 TODO: Add function description
222
223 Arguments:
224
225 FileName - TODO: add argument description
226 MapSize - TODO: add argument description
227 CreationDispostion - TODO: add argument description
228 BaseAddress - TODO: add argument description
229 Length - TODO: add argument description
230
231 Returns:
232
233 TODO: add return values
234
235 --*/
236 ;
237
238 VOID
239 SecLoadFromCore (
240 IN UINTN LargestRegion,
241 IN UINTN LargestRegionSize,
242 IN UINTN BootFirmwareVolumeBase,
243 IN VOID *PeiCoreFile
244 )
245 /*++
246
247 Routine Description:
248
249 TODO: Add function description
250
251 Arguments:
252
253 LargestRegion - TODO: add argument description
254 LargestRegionSize - TODO: add argument description
255 BootFirmwareVolumeBase - TODO: add argument description
256 PeiCoreFile - TODO: add argument description
257
258 Returns:
259
260 TODO: add return values
261
262 --*/
263 ;
264
265 EFI_STATUS
266 SecLoadFile (
267 IN VOID *Pe32Data,
268 IN EFI_PHYSICAL_ADDRESS *ImageAddress,
269 IN UINT64 *ImageSize,
270 IN EFI_PHYSICAL_ADDRESS *EntryPoint
271 )
272 /*++
273
274 Routine Description:
275
276 TODO: Add function description
277
278 Arguments:
279
280 Pe32Data - TODO: add argument description
281 ImageAddress - TODO: add argument description
282 ImageSize - TODO: add argument description
283 EntryPoint - TODO: add argument description
284
285 Returns:
286
287 TODO: add return values
288
289 --*/
290 ;
291
292 EFI_STATUS
293 SecFfsFindPeiCore (
294 IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
295 OUT VOID **Pe32Data
296 )
297 /*++
298
299 Routine Description:
300
301 TODO: Add function description
302
303 Arguments:
304
305 FwVolHeader - TODO: add argument description
306 Pe32Data - TODO: add argument description
307
308 Returns:
309
310 TODO: add return values
311
312 --*/
313 ;
314
315 EFI_STATUS
316 SecFfsFindNextFile (
317 IN EFI_FV_FILETYPE SearchType,
318 IN EFI_FIRMWARE_VOLUME_HEADER *FwVolHeader,
319 IN OUT EFI_FFS_FILE_HEADER **FileHeader
320 )
321 /*++
322
323 Routine Description:
324
325 TODO: Add function description
326
327 Arguments:
328
329 SearchType - TODO: add argument description
330 FwVolHeader - TODO: add argument description
331 FileHeader - TODO: add argument description
332
333 Returns:
334
335 TODO: add return values
336
337 --*/
338 ;
339
340 EFI_STATUS
341 SecFfsFindSectionData (
342 IN EFI_SECTION_TYPE SectionType,
343 IN EFI_FFS_FILE_HEADER *FfsFileHeader,
344 IN OUT VOID **SectionData
345 )
346 /*++
347
348 Routine Description:
349
350 TODO: Add function description
351
352 Arguments:
353
354 SectionType - TODO: add argument description
355 FfsFileHeader - TODO: add argument description
356 SectionData - TODO: add argument description
357
358 Returns:
359
360 TODO: add return values
361
362 --*/
363 ;
364
365 EFI_STATUS
366 EFIAPI
367 SecWinNtPeCoffLoaderLoadAsDll (
368 IN CHAR8 *PdbFileName,
369 IN VOID **ImageEntryPoint,
370 OUT VOID **ModHandle
371 )
372 /*++
373
374 Routine Description:
375
376 TODO: Add function description
377
378 Arguments:
379
380 PdbFileName - TODO: add argument description
381 ImageEntryPoint - TODO: add argument description
382 ModHandle - TODO: add argument description
383
384 Returns:
385
386 TODO: add return values
387
388 --*/
389 ;
390
391 EFI_STATUS
392 EFIAPI
393 SecWinNtPeCoffLoaderFreeLibrary (
394 OUT VOID *ModHandle
395 )
396 /*++
397
398 Routine Description:
399
400 TODO: Add function description
401
402 Arguments:
403
404 ModHandle - TODO: add argument description
405
406 Returns:
407
408 TODO: add return values
409
410 --*/
411 ;
412
413 EFI_STATUS
414 EFIAPI
415 SecWinNtFdAddress (
416 IN UINTN Index,
417 IN OUT EFI_PHYSICAL_ADDRESS *FdBase,
418 IN OUT UINT64 *FdSize
419 )
420 /*++
421
422 Routine Description:
423
424 TODO: Add function description
425
426 Arguments:
427
428 Index - TODO: add argument description
429 FdBase - TODO: add argument description
430 FdSize - TODO: add argument description
431
432 Returns:
433
434 TODO: add return values
435
436 --*/
437 ;
438
439 EFI_STATUS
440 GetImageReadFunction (
441 IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext,
442 IN EFI_PHYSICAL_ADDRESS *TopOfMemory
443 )
444 /*++
445
446 Routine Description:
447
448 TODO: Add function description
449
450 Arguments:
451
452 ImageContext - TODO: add argument description
453 TopOfMemory - TODO: add argument description
454
455 Returns:
456
457 TODO: add return values
458
459 --*/
460 ;
461
462 EFI_STATUS
463 EFIAPI
464 SecImageRead (
465 IN VOID *FileHandle,
466 IN UINTN FileOffset,
467 IN OUT UINTN *ReadSize,
468 OUT VOID *Buffer
469 )
470 /*++
471
472 Routine Description:
473
474 TODO: Add function description
475
476 Arguments:
477
478 FileHandle - TODO: add argument description
479 FileOffset - TODO: add argument description
480 ReadSize - TODO: add argument description
481 Buffer - TODO: add argument description
482
483 Returns:
484
485 TODO: add return values
486
487 --*/
488 ;
489
490 CHAR16 *
491 AsciiToUnicode (
492 IN CHAR8 *Ascii,
493 IN UINTN *StrLen OPTIONAL
494 )
495 /*++
496
497 Routine Description:
498
499 TODO: Add function description
500
501 Arguments:
502
503 Ascii - TODO: add argument description
504 StrLen - TODO: add argument description
505
506 Returns:
507
508 TODO: add return values
509
510 --*/
511 ;
512
513 UINTN
514 CountSeperatorsInString (
515 IN const CHAR16 *String,
516 IN CHAR16 Seperator
517 )
518 /*++
519
520 Routine Description:
521
522 TODO: Add function description
523
524 Arguments:
525
526 String - TODO: add argument description
527 Seperator - TODO: add argument description
528
529 Returns:
530
531 TODO: add return values
532
533 --*/
534 ;
535
536 EFI_STATUS
537 EFIAPI
538 SecNt32PeCoffGetImageInfo (
539 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
540 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
541 );
542
543 EFI_STATUS
544 EFIAPI
545 SecNt32PeCoffLoadImage (
546 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
547 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
548 );
549
550 EFI_STATUS
551 EFIAPI
552 SecNt32PeCoffRelocateImage (
553 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
554 IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
555 );
556
557 EFI_STATUS
558 EFIAPI
559 SecNt32PeCoffUnloadimage (
560 IN EFI_PEI_PE_COFF_LOADER_PROTOCOL *This,
561 IN PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
562 );
563
564
565 typedef struct {
566 EFI_PEI_PE_COFF_LOADER_PROTOCOL PeCoff;
567 VOID *ModHandle;
568 } EFI_PEI_PE_COFF_LOADER_PROTOCOL_INSTANCE;
569
570 extern EFI_WIN_NT_THUNK_PROTOCOL *gWinNt;