if (VolumeHandle == INVALID_HANDLE_VALUE) {\r
fprintf (\r
stderr, \r
- "ERROR: E0005: CreateFile failed: Volume = %s, LastError = 0x%x\n", \r
+ "error E0005: CreateFile failed: Volume = %s, LastError = 0x%x\n", \r
VolumeAccessPath, \r
GetLastError ()\r
);\r
//\r
// Should have a type.\r
//\r
- fprintf (stderr, "ERROR: E3005: Fatal Error!!!\n");\r
+ fprintf (stderr, "error E3005: Fatal Error!!!\n");\r
return FALSE;\r
}\r
return TRUE;\r
// Check parameter\r
//\r
if (VolumeLetter == 0) {\r
- fprintf (stderr, "ERROR: E2003: Volume was not provided!\n");\r
+ fprintf (stderr, "error E2003: Volume was not provided!\n");\r
return 1;\r
}\r
\r
if (FilePath == NULL) {\r
- fprintf (stderr, "ERROR: E2003: File was not provided!\n");\r
+ fprintf (stderr, "error E2003: File was not provided!\n");\r
return 1;\r
}\r
\r
// Hard/USB disk\r
//\r
if (!GetDriveInfo (VolumeLetter, &DriveInfo)) {\r
- fprintf (stderr, "ERROR: E2004: GetDriveInfo - 0x%x\n", GetLastError ());\r
+ fprintf (stderr, "error E2004: GetDriveInfo - 0x%x\n", GetLastError ());\r
return 1;\r
}\r
\r
// very safe then:)\r
//\r
if (DriveInfo.DriveType->Type == DRIVE_FIXED && WriteToDisk) {\r
- fprintf (stderr, "ERROR: E0002: Error writing to local harddisk - permission denied!\n");\r
+ fprintf (stderr, "error E0002: Error writing to local harddisk - permission denied!\n");\r
return 1;\r
}\r
\r
}\r
\r
if (PatchType == PatchTypeUnknown) {\r
- fprintf (stderr, "ERROR: E3002: PatchType unknown!\n");\r
+ fprintf (stderr, "error E3002: PatchType unknown!\n");\r
return 1;\r
}\r
\r
FATSz = FatBpb->Fat32.BPB_FATSz32;\r
}\r
if (FATSz == 0) {\r
- fprintf (stderr, "ERROR: E3003: FAT - BPB_FATSz16, BPB_FATSz32 - 0, expected: Non-Zero number\n");\r
+ fprintf (stderr, "error E3003: FAT - BPB_FATSz16, BPB_FATSz32 - 0, expected: Non-Zero number\n");\r
return -1;\r
}\r
\r
TotSec = FatBpb->Fat12_16.BPB_TotSec32;\r
}\r
if (TotSec == 0) {\r
- fprintf (stderr, "ERROR: E3003: FAT - BPB_TotSec16, BPB_TotSec32 - 0, expected: Non-Zero number\n");\r
+ fprintf (stderr, "error E3003: FAT - BPB_TotSec16, BPB_TotSec32 - 0, expected: Non-Zero number\n");\r
return -1;\r
}\r
\r
//\r
PageFile = fopen (PageFileName, "w+b");\r
if (PageFile == NULL) {\r
- fprintf (stderr, "GenBinPage: Could not open file %s\n", PageFileName);\r
+ //fprintf (stderr, "GenBinPage: Could not open file %s\n", PageFileName);\r
+ Error (PageFileName, 0, 1, "File open failure", NULL);\r
return -1;\r
}\r
\r
NoPageFile = fopen (NoPageFileName, "r+b");\r
if (NoPageFile == NULL) {\r
- fprintf (stderr, "GenBinPage: Could not open file %s\n", NoPageFileName);\r
+ //fprintf (stderr, "GenBinPage: Could not open file %s\n", NoPageFileName);\r
+ Error (NoPageFileName, 0, 1, "File open failure", NULL);\r
fclose (PageFile);\r
return -1;\r
}\r
FileSize = ftell (NoPageFile);\r
fseek (NoPageFile, 0, SEEK_SET);\r
if (FileSize > gPageTableOffsetInFile) {\r
- fprintf (stderr, "GenBinPage: file size too large - 0x%x\n", FileSize);\r
+ //fprintf (stderr, "GenBinPage: file size too large - 0x%x\n", FileSize);\r
+ Error (NoPageFileName, 0, 0x4002, "file size too large", NULL);\r
fclose (PageFile);\r
fclose (NoPageFile);\r
return -1;\r
char* OutputFile = NULL;\r
char* InputFile = NULL;\r
\r
+ SetUtilityName("GenPage");\r
+\r
if (argc == 1) {\r
Usage();\r
return -1;\r
if ((stricmp (argv[0], "-o") == 0) || (stricmp (argv[0], "--output") == 0)) {\r
OutputFile = argv[1];\r
if (OutputFile == NULL) {\r
- Error (NULL, 0, 0, "NO output file specified.", NULL);\r
+ Error (NULL, 0, 0x1001, "NO output file specified.", NULL);\r
return -1;\r
}\r
argc -= 2;\r
if ((stricmp (argv[0], "-b") == 0) || (stricmp (argv[0], "--baseaddr") == 0)) {\r
\r
if (argv[1] == NULL) {\r
- Error (NULL, 0, 0, "NO base address specified.", NULL);\r
+ Error (NULL, 0, 0x1001, "NO base address specified.", NULL);\r
return STATUS_ERROR;\r
}\r
gPageTableBaseAddress = xtoi (argv[1]);\r
\r
if ((stricmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--offset") == 0)) {\r
if (argv[1] == NULL) {\r
- Error (NULL, 0, 0, "NO offset specified.", NULL);\r
+ Error (NULL, 0, 0x1001, "NO offset specified.", NULL);\r
return STATUS_ERROR;\r
}\r
gPageTableOffsetInFile = xtoi (argv[1]);\r
}\r
\r
if (InputFile == NULL) {\r
- Error (NULL, 0, 0, "NO Input file specified.", NULL);\r
+ Error (NULL, 0, 0x1001, "NO Input file specified.", NULL);\r
return STATUS_ERROR;\r
}\r
\r
if ((stricmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--filename") == 0)) {\r
InputFileName = argv[1];\r
if (InputFileName == NULL) {\r
- Error (NULL, 0, 0, "NO Input file specified.", NULL);\r
+ Error (NULL, 0, 0x1001, "NO Input file specified.", NULL);\r
return STATUS_ERROR;\r
}\r
argc -= 2;\r
if ((stricmp (argv[0], "-s") == 0) || (stricmp (argv[0], "--split") == 0)) {\r
Status = GetSplitValue(argv[1], &SplitValue);\r
if (EFI_ERROR (Status)) {\r
- Error (NULL, 0, 0, "Input split value is not one valid integer.", NULL);\r
+ Error (NULL, 0, 0x1003, "Input split value is not one valid integer.", NULL);\r
return STATUS_ERROR;\r
}\r
argc -= 2;\r
if (strlen(argv[0]) > 2) {\r
Status = CountVerboseLevel (&argv[0][2], strlen(argv[0]) - 2, &VerboseLevel);\r
if (EFI_ERROR (Status)) {\r
- Error (NULL, 0, 0, NULL, "%s is invaild paramter!", argv[0]);\r
+ Error (NULL, 0, 0x1003, NULL, "%s is invaild paramter!", argv[0]);\r
return STATUS_ERROR; \r
}\r
}\r
if ((stricmp (argv[0], "-d") == 0) || (stricmp (argv[0], "--debug") == 0)) {\r
Status = AsciiStringToUint64 (argv[1], FALSE, &DebugLevel);\r
if (EFI_ERROR (Status)) {\r
- Error (NULL, 0, 0, "Input debug level is not one valid integrator.", NULL);\r
+ Error (NULL, 0, 0x1003, "Input debug level is not one valid integrator.", NULL);\r
return STATUS_ERROR; \r
}\r
argc -= 2;\r
//\r
// Don't recognize the paramter.\r
//\r
- Error (NULL, 0, 0, NULL, "%s is invaild paramter!", argv[0]);\r
+ Error (NULL, 0, 0x1003, NULL, "%s is invaild paramter!", argv[0]);\r
return STATUS_ERROR;\r
}\r
\r
if (InputFileName == NULL) {\r
- Error (NULL, 0, 0, "NO Input file specified.", NULL);\r
+ Error (NULL, 0, 0x1001, "NO Input file specified.", NULL);\r
return STATUS_ERROR;\r
}\r
\r
In = fopen (InputFileName, "rb");\r
if (In == NULL) {\r
- printf ("Unable to open file \"%s\"\n", InputFileName);\r
+ // ("Unable to open file \"%s\"\n", InputFileName);\r
+ Error (InputFileName, 0, 1, "File open failure", NULL);\r
return STATUS_ERROR;\r
}\r
\r
\r
CurrentDir = (CHAR8*)getcwd((CHAR8*)0, 0);\r
if (EFI_ERROR(CreateDir(&OutFileName1))) {\r
- Error (NULL, 0, 0, "Create Dir for File1 Fail.", NULL);\r
+ Error (OutFileName1, 0, 5, "Create Dir for File1 Fail.", NULL);\r
return STATUS_ERROR;\r
}\r
chdir(CurrentDir);\r
\r
if (EFI_ERROR(CreateDir(&OutFileName2))) {\r
- Error (NULL, 0, 0, "Create Dir for File2 Fail.", NULL);\r
+ Error (OutFileName2, 0, 5, "Create Dir for File2 Fail.", NULL);\r
return STATUS_ERROR;\r
}\r
chdir(CurrentDir);\r
\r
Out1 = fopen (OutFileName1, "wb");\r
if (Out1 == NULL) {\r
- printf ("Unable to open file \"%s\"\n", OutFileName1);\r
+ // ("Unable to open file \"%s\"\n", OutFileName1);\r
+ Error (OutFileName1, 0, 1, "File open failure", NULL);\r
return STATUS_ERROR;\r
}\r
\r
Out2 = fopen (OutFileName2, "wb");\r
if (Out2 == NULL) {\r
- printf ("Unable to open file \"%s\"\n", OutFileName2);\r
+ // ("Unable to open file \"%s\"\n", OutFileName2);\r
+ Error (OutFileName2, 0, 1, "File open failure", NULL);\r
return STATUS_ERROR;\r
}\r
\r