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