diff --git a/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj b/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj index c5329bc6d..163c9f75a 100644 --- a/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj +++ b/Xcode/CloverX64/CloverX64.xcodeproj/project.pbxproj @@ -342,7 +342,6 @@ 9ACFE6C524309AF80071CC93 /* libscreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7424176C04005CDD5C /* libscreen.cpp */; }; 9ACFE6C624309AF80071CC93 /* strlen_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD2B241BC0DF00F3D247 /* strlen_test.cpp */; }; 9ACFE6C724309AF80071CC93 /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA624176C04005CDD5C /* panic.cpp */; }; - 9ACFE6C824309AF80071CC93 /* printlib-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF41561242BABC700D2644C /* printlib-test.cpp */; }; 9ACFE6C924309AF80071CC93 /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED824176C04005CDD5C /* XStringW_test.cpp */; }; 9ACFE6CA24309AF80071CC93 /* tool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8924176C04005CDD5C /* tool.cpp */; }; 9ACFE6CB24309AF80071CC93 /* BasicIO.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4173D242F15CC00D2644C /* BasicIO.cpp */; }; @@ -436,7 +435,6 @@ 9AF4155E242B8FA400D2644C /* poolprint-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF4155C242B8FA300D2644C /* poolprint-test.cpp */; }; 9AF41562242BABC700D2644C /* printlib-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF4155F242BABC700D2644C /* printlib-test-cpp_conf.h */; }; 9AF41563242BABC700D2644C /* printlib-test.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF41560242BABC700D2644C /* printlib-test.h */; }; - 9AF41564242BABC700D2644C /* printlib-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF41561242BABC700D2644C /* printlib-test.cpp */; }; 9AF41566242BAD5600D2644C /* printf_lite-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF41565242BAD5600D2644C /* printf_lite-test-cpp_conf.h */; }; 9AF41568242BAD7D00D2644C /* poolprint-test-cpp_conf.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AF41567242BAD7D00D2644C /* poolprint-test-cpp_conf.h */; }; 9AF41584242CD75C00D2644C /* panic.h in Headers */ = {isa = PBXBuildFile; fileRef = 9AC77FA924176C04005CDD5C /* panic.h */; }; @@ -558,7 +556,6 @@ 9AF415FB242CD75C00D2644C /* libscreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7424176C04005CDD5C /* libscreen.cpp */; }; 9AF415FC242CD75C00D2644C /* strlen_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD2B241BC0DF00F3D247 /* strlen_test.cpp */; }; 9AF415FD242CD75C00D2644C /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA624176C04005CDD5C /* panic.cpp */; }; - 9AF415FE242CD75C00D2644C /* printlib-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF41561242BABC700D2644C /* printlib-test.cpp */; }; 9AF415FF242CD75C00D2644C /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED824176C04005CDD5C /* XStringW_test.cpp */; }; 9AF41600242CD75C00D2644C /* tool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8924176C04005CDD5C /* tool.cpp */; }; 9AF41601242CD75C00D2644C /* lib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9624176C04005CDD5C /* lib.cpp */; }; @@ -765,7 +762,6 @@ 9AF416D8242CDA5800D2644C /* libscreen.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F7424176C04005CDD5C /* libscreen.cpp */; }; 9AF416D9242CDA5800D2644C /* strlen_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9A28CD2B241BC0DF00F3D247 /* strlen_test.cpp */; }; 9AF416DA242CDA5800D2644C /* panic.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77FA624176C04005CDD5C /* panic.cpp */; }; - 9AF416DB242CDA5800D2644C /* printlib-test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AF41561242BABC700D2644C /* printlib-test.cpp */; }; 9AF416DC242CDA5800D2644C /* XStringW_test.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77ED824176C04005CDD5C /* XStringW_test.cpp */; }; 9AF416DD242CDA5800D2644C /* tool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F8924176C04005CDD5C /* tool.cpp */; }; 9AF416DE242CDA5800D2644C /* lib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9AC77F9624176C04005CDD5C /* lib.cpp */; }; @@ -2093,7 +2089,6 @@ 9AC7805B24176C04005CDD5C /* libscreen.cpp in Sources */, 9A28CD31241BC0DF00F3D247 /* strlen_test.cpp in Sources */, 9AC7808824176C04005CDD5C /* panic.cpp in Sources */, - 9AF41564242BABC700D2644C /* printlib-test.cpp in Sources */, 9AC77FC524176C04005CDD5C /* XStringW_test.cpp in Sources */, 9AC7806F24176C04005CDD5C /* tool.cpp in Sources */, 9AF41740242F15CC00D2644C /* BasicIO.cpp in Sources */, @@ -2211,7 +2206,6 @@ 9ACFE6C524309AF80071CC93 /* libscreen.cpp in Sources */, 9ACFE6C624309AF80071CC93 /* strlen_test.cpp in Sources */, 9ACFE6C724309AF80071CC93 /* panic.cpp in Sources */, - 9ACFE6C824309AF80071CC93 /* printlib-test.cpp in Sources */, 9ACFE6C924309AF80071CC93 /* XStringW_test.cpp in Sources */, 9ACFE6CA24309AF80071CC93 /* tool.cpp in Sources */, 9ACFE6CB24309AF80071CC93 /* BasicIO.cpp in Sources */, @@ -2329,7 +2323,6 @@ 9AF415FB242CD75C00D2644C /* libscreen.cpp in Sources */, 9AF415FC242CD75C00D2644C /* strlen_test.cpp in Sources */, 9AF415FD242CD75C00D2644C /* panic.cpp in Sources */, - 9AF415FE242CD75C00D2644C /* printlib-test.cpp in Sources */, 9AF415FF242CD75C00D2644C /* XStringW_test.cpp in Sources */, 9AF41600242CD75C00D2644C /* tool.cpp in Sources */, 9AF41742242F15D600D2644C /* BasicIO.cpp in Sources */, @@ -2447,7 +2440,6 @@ 9AF416D8242CDA5800D2644C /* libscreen.cpp in Sources */, 9AF416D9242CDA5800D2644C /* strlen_test.cpp in Sources */, 9AF416DA242CDA5800D2644C /* panic.cpp in Sources */, - 9AF416DB242CDA5800D2644C /* printlib-test.cpp in Sources */, 9AF416DC242CDA5800D2644C /* XStringW_test.cpp in Sources */, 9AF416DD242CDA5800D2644C /* tool.cpp in Sources */, 9AF41743242F15D700D2644C /* BasicIO.cpp in Sources */, @@ -2562,6 +2554,7 @@ DEBUG_ON_SERIAL_PORT, "JCONST=CONST", NO_MSABI_VA_FUNCS, + DISABLE_PRINTLIB, ); HEADER_SEARCH_PATHS = ( $PROJECT_DIR/../../Build/Clover/DEBUG_XCODE8/X64/rEFIt_UEFI/refit/DEBUG, diff --git a/rEFIt_UEFI/Platform/AcpiPatcher.cpp b/rEFIt_UEFI/Platform/AcpiPatcher.cpp index 389344b4d..6378eb22c 100644 --- a/rEFIt_UEFI/Platform/AcpiPatcher.cpp +++ b/rEFIt_UEFI/Platform/AcpiPatcher.cpp @@ -1598,7 +1598,7 @@ BOOLEAN LoadPatchedAML(CHAR16* AcpiOemPath, CHAR16* PartName, UINTN Pass) return FALSE; } } - UnicodeSPrint(FullName, sizeof(FullName), L"%s\\%s", AcpiOemPath, PartName); + snwprintf(FullName, sizeof(FullName), "%ls\\%ls", AcpiOemPath, PartName); UINT8 *buffer = NULL; UINTN bufferLen = 0; EFI_STATUS Status = egLoadFile(SelfRootDir, FullName, &buffer, &bufferLen); @@ -2061,7 +2061,7 @@ EFI_STATUS PatchACPI(IN REFIT_VOLUME *Volume, CHAR8 *OSVersion) if (gSettings.DebugDSDT) { for (Index=0; Index < 60; Index++) { CHAR16 DsdtPatchedName[128]; - UnicodeSPrint(DsdtPatchedName, 256, L"\\EFI\\CLOVER\\ACPI\\origin\\DSDT-pa%d.aml", Index); + snwprintf(DsdtPatchedName, 256, "\\EFI\\CLOVER\\ACPI\\origin\\DSDT-pa%llu.aml", Index); if(!FileExists(SelfRootDir, DsdtPatchedName)){ Status = egSaveFile(SelfRootDir, DsdtPatchedName, (UINT8*)(UINTN)FadtPointer->XDsdt, bufferLen); diff --git a/rEFIt_UEFI/Platform/BootOptions.cpp b/rEFIt_UEFI/Platform/BootOptions.cpp index 8b517c431..c05760466 100644 --- a/rEFIt_UEFI/Platform/BootOptions.cpp +++ b/rEFIt_UEFI/Platform/BootOptions.cpp @@ -697,7 +697,7 @@ GetBootOption ( // Get BootXXXX var. // BootOption->BootNum = BootNum; - UnicodeSPrint (VarName, sizeof(VarName), L"Boot%04X", BootNum); + snwprintf(VarName, sizeof(VarName), "Boot%04X", BootNum); BootOption->Variable = (__typeof__(BootOption->Variable))GetNvramVariable (VarName, &gEfiGlobalVariableGuid, NULL, (UINTN *)(UINTN)(OFFSET_OF(BO_BOOT_OPTION, VariableSize) + (UINTN)BootOption)); if (BootOption->Variable == NULL) { @@ -724,7 +724,7 @@ FindFreeBootNum ( for (Index = 0; Index <= 0xFFFF; Index++) { - UnicodeSPrint (VarName, sizeof(VarName), L"Boot%04X", Index); + snwprintf(VarName, sizeof(VarName), "Boot%04llX", Index); VarSize = 0; Status = gRT->GetVariable (VarName, &gEfiGlobalVariableGuid, NULL, &VarSize, NULL); if (Status == EFI_NOT_FOUND) { @@ -947,7 +947,7 @@ AddBootOption ( return Status; } DBG(" Found BootNum: %04X\n", BootOption->BootNum); - UnicodeSPrint (VarName, sizeof(VarName), L"Boot%04X", BootOption->BootNum); + snwprintf(VarName, sizeof(VarName), "Boot%04X", BootOption->BootNum); // // Prepare BootOption variable @@ -1072,7 +1072,7 @@ DeleteBootOption ( DBG("DeleteBootOption: Boot%04X\n", BootNum); - UnicodeSPrint (VarName, sizeof(VarName), L"Boot%04X", BootNum); + snwprintf(VarName, sizeof(VarName), "Boot%04X", BootNum); // // Delete BootXXXX var diff --git a/rEFIt_UEFI/Platform/Events.cpp b/rEFIt_UEFI/Platform/Events.cpp index 1a4ae1626..b1a6d75d4 100644 --- a/rEFIt_UEFI/Platform/Events.cpp +++ b/rEFIt_UEFI/Platform/Events.cpp @@ -106,7 +106,7 @@ VOID CorrectMemoryMap(IN UINT32 memMap, memDescriptor->Attribute = 0; // DBG(L"Range BS %X corrected to conventional\n", memDescriptor->PhysicalStart); if(MEM_DEB) { - UnicodeSPrint(tmp, 160, L"Range BS %x corrected to conventional\n\r", memDescriptor->PhysicalStart); + snwprintf(tmp, 160, "Range BS %X corrected to conventional\n\r", memDescriptor->PhysicalStart); gST->ConOut->OutputString (gST->ConOut, tmp); // gBS->Stall(2000000); WaitForCR(); @@ -124,7 +124,7 @@ VOID CorrectMemoryMap(IN UINT32 memMap, memDescriptor->Attribute = 0xF; // DBG(L"Range WB %X corrected to conventional\n", memDescriptor->PhysicalStart); if(MEM_DEB) { - UnicodeSPrint(tmp, 160, L"Range WB %x corrected to conventional\n\r", memDescriptor->PhysicalStart); + snwprintf(tmp, 160, "Range WB %X corrected to conventional\n\r", memDescriptor->PhysicalStart); gST->ConOut->OutputString (gST->ConOut, tmp); //gBS->Stall(2000000); // WaitForCR(); @@ -163,7 +163,7 @@ VOID CorrectMemoryMap(IN UINT32 memMap, for (Index = 0; Index < *memMapSize / memDescriptorSize; Index ++) { Bytes = LShiftU64 (memDescriptor->NumberOfPages, 12); // DBG(L"%lX-%lX %lX %lX %X\n", - UnicodeSPrint(tmp, 160, L"%lX-%lX pages %lX type %lX attr %X \r\n\r\t", + snwprintf(tmp, 160, "%lX-%lX pages %lX type %lX attr %X \r\n\r\t", memDescriptor->PhysicalStart, memDescriptor->PhysicalStart + Bytes - 1, memDescriptor->NumberOfPages, diff --git a/rEFIt_UEFI/Platform/Hibernate.cpp b/rEFIt_UEFI/Platform/Hibernate.cpp index d8f10cda7..4f4ee74e1 100644 --- a/rEFIt_UEFI/Platform/Hibernate.cpp +++ b/rEFIt_UEFI/Platform/Hibernate.cpp @@ -429,7 +429,7 @@ GetSleepImageLocation(IN REFIT_VOLUME *Volume, REFIT_VOLUME **SleepImageVolume, } } if (VolName) { - UnicodeSPrint(VolName, VolNameSize, L"%a", VolNameStart); + snwprintf(VolName, VolNameSize, "%s", VolNameStart); ImageVolume = FindVolumeByName(VolName); if (ImageVolume) { ImageName = PoolPrint(L"%a", VolNameEnd); @@ -903,7 +903,7 @@ IsOsxHibernated (IN LOADER_ENTRY *Entry) CHAR16 *Ptr = (CHAR16*)&OffsetHexStr[0]; DBG(" boot-image before: %ls\n", FileDevicePathToStr((EFI_DEVICE_PATH_PROTOCOL*)Value)); - UnicodeSPrint(OffsetHexStr, sizeof(OffsetHexStr), L"%s", (CHAR16 *)(Value + 0x20)); + snwprintf(OffsetHexStr, sizeof(OffsetHexStr), "%ls", (CHAR16 *)(Value + 0x20)); // DBG("OffsetHexStr=%ls\n", OffsetHexStr); while ((*Ptr != L':') && (*Ptr != 0)) { Ptr++; @@ -1010,7 +1010,7 @@ PrepareHibernation (IN REFIT_VOLUME *Volume) } // Set boot-image var - UnicodeSPrint(OffsetHexStr, sizeof(OffsetHexStr), L"%lx", SleepImageOffset); + snwprintf(OffsetHexStr, sizeof(OffsetHexStr), "%llx", SleepImageOffset); BootImageDevPath = FileDevicePath(SleepImageVolume->WholeDiskDeviceHandle, OffsetHexStr); // DBG(" boot-image device path:\n"); Size = GetDevicePathSize(BootImageDevPath); diff --git a/rEFIt_UEFI/Platform/LegacyBiosThunk.h b/rEFIt_UEFI/Platform/LegacyBiosThunk.h index 1e63cabbc..1c2f2f0f0 100644 --- a/rEFIt_UEFI/Platform/LegacyBiosThunk.h +++ b/rEFIt_UEFI/Platform/LegacyBiosThunk.h @@ -38,7 +38,7 @@ extern "C" { #include #include -#include +//#include #include #include #include diff --git a/rEFIt_UEFI/Platform/Posix/stdio.cpp b/rEFIt_UEFI/Platform/Posix/stdio.cpp index d877372de..b2a613bfe 100755 --- a/rEFIt_UEFI/Platform/Posix/stdio.cpp +++ b/rEFIt_UEFI/Platform/Posix/stdio.cpp @@ -5,8 +5,18 @@ #include extern "C" { -#include -#include +# include +# include + +// UINTN +// EFIAPI +// AsciiSPrint ( +// OUT CHAR8 *StartOfBuffer, +// IN UINTN BufferSize, +// IN CONST CHAR8 *FormatString, +// ... +// ); + } #include "../../cpp_foundation/XString.h" diff --git a/rEFIt_UEFI/Platform/Settings.cpp b/rEFIt_UEFI/Platform/Settings.cpp index bef1a4fa4..a0bab02c9 100644 --- a/rEFIt_UEFI/Platform/Settings.cpp +++ b/rEFIt_UEFI/Platform/Settings.cpp @@ -3062,10 +3062,10 @@ GetEarlyUserSettings ( AsciiStrToUnicodeStrS (Prop->string, gSettings.LegacyBoot, 32); } else if (gFirmwareClover) { // default for CLOVER EFI boot - UnicodeSPrint (gSettings.LegacyBoot, sizeof(gSettings.LegacyBoot), L"PBR"); + snwprintf(gSettings.LegacyBoot, sizeof(gSettings.LegacyBoot), "PBR"); } else { // default for UEFI boot - UnicodeSPrint (gSettings.LegacyBoot, sizeof(gSettings.LegacyBoot), L"LegacyBiosDefault"); + snwprintf(gSettings.LegacyBoot, sizeof(gSettings.LegacyBoot), "LegacyBiosDefault"); } // Entry for LegacyBiosDefault @@ -3750,7 +3750,7 @@ GetListOfConfigs () continue; } - UnicodeSPrint(FullName, 512, L"%s\\%s", OEMPath, DirEntry->FileName); + snwprintf(FullName, 512, "%ls\\%ls", OEMPath, DirEntry->FileName); if (FileExists(SelfRootDir, FullName)) { if (StriCmp(DirEntry->FileName, L"config.plist") == 0) { OldChosenConfig = ConfigsNum; @@ -3783,7 +3783,7 @@ GetListOfDsdts () continue; } - UnicodeSPrint(FullName, 512, L"%s\\%s", AcpiPath, DirEntry->FileName); + snwprintf(FullName, 512, "%ls\\%ls", AcpiPath, DirEntry->FileName); if (FileExists(SelfRootDir, FullName)) { if (StriCmp(DirEntry->FileName, gSettings.DsdtName) == 0) { OldChosenDsdt = DsdtsNum; @@ -3820,7 +3820,7 @@ GetListOfACPI () continue; } - UnicodeSPrint(FullName, 512, L"%s\\%s", AcpiPath, DirEntry->FileName); + snwprintf(FullName, 512, "%ls\\%ls", AcpiPath, DirEntry->FileName); if (FileExists(SelfRootDir, FullName)) { BOOLEAN ACPIDisabled = FALSE; ACPIPatchedAMLTmp = (__typeof__(ACPIPatchedAMLTmp))AllocateZeroPool (sizeof(ACPI_PATCHED_AML)); @@ -9483,7 +9483,7 @@ SetFSInjection ( // get FSINJECTION_PROTOCOL Status = gBS->LocateProtocol(&gFSInjectProtocolGuid, NULL, (void **)&FSInject); if (EFI_ERROR (Status)) { - //Print (L"- No FSINJECTION_PROTOCOL, Status = %r\n", Status); + //Print (L"- No FSINJECTION_PROTOCOL, Status = %s\n", strerror(Status)); MsgLog (" - ERROR: gFSInjectProtocolGuid not found!\n"); return EFI_NOT_STARTED; } diff --git a/rEFIt_UEFI/Platform/ati.cpp b/rEFIt_UEFI/Platform/ati.cpp index 727fc3478..351c64f28 100644 --- a/rEFIt_UEFI/Platform/ati.cpp +++ b/rEFIt_UEFI/Platform/ati.cpp @@ -1630,13 +1630,13 @@ BOOLEAN load_vbios_file(UINT16 vendor_id, UINT16 device_id) CHAR16 FileName[64]; UINT8* buffer = 0; - UnicodeSPrint(FileName, 128, L"\\ROM\\%04x_%04x.rom", vendor_id, device_id); + snwprintf(FileName, 128, "\\ROM\\%04X_%04X.rom", vendor_id, device_id); if (FileExists(OEMDir, FileName)) { DBG("Found generic VBIOS ROM file (%04X_%04X.rom)\n", vendor_id, device_id); Status = egLoadFile(OEMDir, FileName, &buffer, &bufferLen); } if (EFI_ERROR(Status)) { - UnicodeSPrint(FileName, 128, L"\\EFI\\CLOVER\\ROM\\%04x_%04x.rom", vendor_id, device_id); + snwprintf(FileName, 128, "\\EFI\\CLOVER\\ROM\\%04X_%04X.rom", vendor_id, device_id); if (FileExists(SelfRootDir, FileName)){ DBG("Found generic VBIOS ROM file (%04X_%04X.rom)\n", vendor_id, device_id); Status = egLoadFile(SelfRootDir, FileName, &buffer, &bufferLen); diff --git a/rEFIt_UEFI/Platform/kext_inject.cpp b/rEFIt_UEFI/Platform/kext_inject.cpp index 35dfd9388..c3967f320 100644 --- a/rEFIt_UEFI/Platform/kext_inject.cpp +++ b/rEFIt_UEFI/Platform/kext_inject.cpp @@ -146,13 +146,13 @@ EFI_STATUS EFIAPI LoadKext(IN LOADER_ENTRY *Entry, IN EFI_FILE *RootDir, IN CHAR _BooterKextFileInfo *infoAddr = NULL; TempName = PoolPrint(L"%s\\%s", FileName, L"Contents\\Info.plist"); - // UnicodeSPrint(TempName, 512, L"%s\\%s", FileName, L"Contents\\Info.plist"); + // snwprintf(TempName, 512, L"%s\\%s", FileName, "Contents\\Info.plist"); Status = egLoadFile(RootDir, TempName, &infoDictBuffer, &infoDictBufferLength); FreePool(TempName); if (EFI_ERROR(Status)) { //try to find a planar kext, without Contents TempName = PoolPrint(L"%s\\%s", FileName, L"Info.plist"); - // UnicodeSPrint(TempName, 512, L"%s\\%s", FileName, L"Info.plist"); + // snwprintf(TempName, 512, L"%s\\%s", FileName, "Info.plist"); Status = egLoadFile(RootDir, TempName, &infoDictBuffer, &infoDictBufferLength); FreePool(TempName); if (EFI_ERROR(Status)) { @@ -179,10 +179,10 @@ EFI_STATUS EFIAPI LoadKext(IN LOADER_ENTRY *Entry, IN EFI_FILE *RootDir, IN CHAR // AsciiStrToUnicodeStrS(prop->string, Executable, 256); if (NoContents) { TempName = PoolPrint(L"%s\\%s", FileName, Executable); - // UnicodeSPrint(TempName, 512, L"%s\\%s", FileName, Executable); + // snwprintf(TempName, 512, "%s\\%s", FileName, Executable); } else { TempName = PoolPrint(L"%s\\%s\\%s", FileName, L"Contents\\MacOS",Executable); - // UnicodeSPrint(TempName, 512, L"%s\\%s\\%s", FileName, L"Contents\\MacOS",Executable); + // snwprintf(TempName, 512, L"%s\\%s\\%s", FileName, "Contents\\MacOS",Executable); } FreePool(Executable); Status = egLoadFile(RootDir, TempName, &executableFatBuffer, &executableBufferLength); @@ -286,7 +286,7 @@ VOID LoadPlugInKexts(IN LOADER_ENTRY *Entry, IN EFI_FILE *RootDir, IN CHAR16 *Di if (PlugInFile->FileName[0] == '.' || StrStr(PlugInFile->FileName, L".kext") == NULL) continue; // skip this FileName = PoolPrint(L"%s\\%s", DirName, PlugInFile->FileName); - // UnicodeSPrint(FileName, 512, L"%s\\%s", DirName, PlugInFile->FileName); + // snwprintf(FileName, 512, "%s\\%s", DirName, PlugInFile->FileName); MsgLog(" %ls PlugIn kext: %ls\n", Force ? L"Force" : L"Extra", FileName); AddKext(Entry, RootDir, FileName, archCpuType); FreePool(FileName); @@ -308,7 +308,7 @@ VOID AddKexts(IN LOADER_ENTRY *Entry, CONST CHAR16 *SrcDir, CONST CHAR16 *Path/* DBG(" current kext name=%ls path=%ls, match against=%ls\n", CurrentKext->FileName, CurrentKext->KextDirNameUnderOEMPath, Path); if (StrCmp(CurrentKext->KextDirNameUnderOEMPath, Path) == 0) { FileName = PoolPrint(L"%s\\%s", SrcDir, CurrentKext->FileName); - // UnicodeSPrint(FileName, 512, L"%s\\%s", SrcDir, CurrentKext->FileName); + // snwprintf(FileName, 512, "%s\\%s", SrcDir, CurrentKext->FileName); if (!(CurrentKext->MenuItem.BValue)) { // inject require MsgLog("->Extra kext: %ls (v.%ls)\n", FileName, CurrentKext->Version); @@ -318,7 +318,7 @@ VOID AddKexts(IN LOADER_ENTRY *Entry, CONST CHAR16 *SrcDir, CONST CHAR16 *Path/* CurrentPlugInKext = CurrentKext->PlugInList; while (CurrentPlugInKext) { PlugInName = PoolPrint(L"%s\\%s\\%s", FileName, L"Contents\\PlugIns", CurrentPlugInKext->FileName); - // UnicodeSPrint(PlugInName, 512, L"%s\\%s\\%s", FileName, L"Contents\\PlugIns", CurrentPlugInKext->FileName); + // snwprintf(PlugInName, 512, L"%s\\%s\\%s", FileName, "Contents\\PlugIns", CurrentPlugInKext->FileName); if (!(CurrentPlugInKext->MenuItem.BValue)) { // inject PlugIn require MsgLog(" |-- PlugIn kext: %ls (v.%ls)\n", PlugInName, CurrentPlugInKext->Version); @@ -403,11 +403,11 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry) if (PlugInFile->FileName[0] == '.' || StrStr(PlugInFile->FileName, L".kext") == NULL) continue; // skip this FileName = PoolPrint(L"%s\\%s", Entry->KernelAndKextPatches->ForceKexts[i], PlugInFile->FileName); - // UnicodeSPrint(FileName, 512, L"%s\\%s", Entry->KernelAndKextPatches->ForceKexts[i], PlugInFile->FileName); + // snwprintf(FileName, 512, "%s\\%s", Entry->KernelAndKextPatches->ForceKexts[i], PlugInFile->FileName); MsgLog(" Force kext: %ls\n", FileName); AddKext(Entry, Entry->Volume->RootDir, FileName, archCpuType); PlugIns = PoolPrint(L"%s\\Contents\\PlugIns", FileName); - // UnicodeSPrint(PlugIns, 512, L"%s\\Contents\\PlugIns", FileName); + // snwprintf(PlugIns, 512, "%s\\Contents\\PlugIns", FileName); LoadPlugInKexts(Entry, Entry->Volume->RootDir, PlugIns, archCpuType, TRUE); FreePool(FileName); FreePool(PlugIns); @@ -416,7 +416,7 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry) } else { AddKext(Entry, Entry->Volume->RootDir, Entry->KernelAndKextPatches->ForceKexts[i], archCpuType); PlugIns = PoolPrint(L"%s\\Contents\\PlugIns", Entry->KernelAndKextPatches->ForceKexts[i]); - // UnicodeSPrint(PlugIns, 512, L"%s\\Contents\\PlugIns", Entry->KernelAndKextPatches->ForceKexts[i]); + // snwprintf(PlugIns, 512, "%s\\Contents\\PlugIns", Entry->KernelAndKextPatches->ForceKexts[i]); LoadPlugInKexts(Entry, Entry->Volume->RootDir, PlugIns, archCpuType, TRUE); FreePool(PlugIns); } @@ -465,22 +465,22 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry) CHAR16 *DirName; CHAR16 *DirPath; OSAllVersionKextsDir = PoolPrint(L"%s\\kexts\\10", OEMPath); - // UnicodeSPrint(OSAllVersionKextsDir, sizeof(OSAllVersionKextsDir), L"%s\\kexts\\10", OEMPath); + // snwprintf(OSAllVersionKextsDir, sizeof(OSAllVersionKextsDir), "%s\\kexts\\10", OEMPath); AddKexts(Entry, OSAllVersionKextsDir, L"10", archCpuType); FreePool(OSAllVersionKextsDir); if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) { DirName = PoolPrint(L"10_install"); - // UnicodeSPrint(DirName, sizeof(DirName), L"10_install"); + // snwprintf(DirName, sizeof(DirName), "10_install"); } else if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) { DirName = PoolPrint(L"10_recovery"); - // UnicodeSPrint(DirName, sizeof(DirName), L"10_recovery"); + // snwprintf(DirName, sizeof(DirName), "10_recovery"); } else { DirName = PoolPrint(L"10_normal"); - // UnicodeSPrint(DirName, sizeof(DirName), L"10_normal"); + // snwprintf(DirName, sizeof(DirName), "10_normal"); } DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, DirName); - // UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName); + // snwprintf(DirPath, sizeof(DirPath), "%s\\kexts\\%s", OEMPath, DirName); AddKexts(Entry, DirPath, DirName, archCpuType); FreePool(DirPath); FreePool(DirName); @@ -489,22 +489,22 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry) // Add kext from 10.{version} OSShortVersionKextsDir = PoolPrint(L"%s\\kexts\\%s", OEMPath, UniShortOSVersion); - // UnicodeSPrint(OSShortVersionKextsDir, sizeof(OSShortVersionKextsDir), L"%s\\kexts\\%s", OEMPath, UniShortOSVersion); + // snwprintf(OSShortVersionKextsDir, sizeof(OSShortVersionKextsDir), "%s\\kexts\\%s", OEMPath, UniShortOSVersion); AddKexts(Entry, OSShortVersionKextsDir, UniShortOSVersion, archCpuType); FreePool(OSShortVersionKextsDir); if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) { DirName = PoolPrint(L"%s_install", UniShortOSVersion); - // UnicodeSPrint(DirName, sizeof(DirName), L"%s_install", UniShortOSVersion); + // snwprintf(DirName, sizeof(DirName), "%s_install", UniShortOSVersion); } else if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) { DirName = PoolPrint(L"%s_recovery", UniShortOSVersion); - // UnicodeSPrint(DirName, sizeof(DirName), L"%s_recovery", UniShortOSVersion); + // snwprintf(DirName, sizeof(DirName), "%s_recovery", UniShortOSVersion); } else { DirName = PoolPrint(L"%s_normal", UniShortOSVersion); - // UnicodeSPrint(DirName, sizeof(DirName), L"%s_normal", UniShortOSVersion); + // snwprintf(DirName, sizeof(DirName), "%s_normal", UniShortOSVersion); } DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, DirName); - // UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName); + // snwprintf(DirPath, sizeof(DirPath), "%s\\kexts\\%s", OEMPath, DirName); AddKexts(Entry, DirPath, DirName, archCpuType); FreePool(DirPath); FreePool(DirName); @@ -516,29 +516,29 @@ EFI_STATUS LoadKexts(IN LOADER_ENTRY *Entry) if ( AsciiStrCmp(ShortOSVersion, Entry->OSVersion) == 0 ) { OSVersionKextsDirName = PoolPrint(L"%a.0", Entry->OSVersion); - // UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a.0", Entry->OSVersion); + // snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%a.0", Entry->OSVersion); } else { OSVersionKextsDirName = PoolPrint(L"%a", Entry->OSVersion); - // UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a", Entry->OSVersion); + // snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%a", Entry->OSVersion); } DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, OSVersionKextsDirName); - // UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, OSVersionKextsDirName); + // snwprintf(DirPath, sizeof(DirPath), "%s\\kexts\\%s", OEMPath, OSVersionKextsDirName); AddKexts(Entry, DirPath, OSVersionKextsDirName, archCpuType); FreePool(DirPath); if ( OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) { DirName = PoolPrint(L"%s_install", OSVersionKextsDirName); - // UnicodeSPrint(DirName, sizeof(DirName), L"%s_install", OSVersionKextsDirName); + // snwprintf(DirName, sizeof(DirName), "%s_install", OSVersionKextsDirName); } else if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) { DirName = PoolPrint(L"%s_recovery", OSVersionKextsDirName); - // UnicodeSPrint(DirName, sizeof(DirName), L"%s_recovery", OSVersionKextsDirName); + // snwprintf(DirName, sizeof(DirName), "%s_recovery", OSVersionKextsDirName); } else { DirName = PoolPrint(L"%s_normal", OSVersionKextsDirName); - // UnicodeSPrint(DirName, sizeof(DirName), L"%s_normal", OSVersionKextsDirName); + // snwprintf(DirName, sizeof(DirName), "%s_normal", OSVersionKextsDirName); } DirPath = PoolPrint(L"%s\\kexts\\%s", OEMPath, DirName); - // UnicodeSPrint(DirPath, sizeof(DirPath), L"%s\\kexts\\%s", OEMPath, DirName); + // snwprintf(DirPath, sizeof(DirPath), "%s\\kexts\\%s", OEMPath, DirName); AddKexts(Entry, DirPath, DirName, archCpuType); FreePool(DirPath); FreePool(DirName); diff --git a/rEFIt_UEFI/Platform/nvidia.cpp b/rEFIt_UEFI/Platform/nvidia.cpp index 681db85e0..1f04a1e64 100644 --- a/rEFIt_UEFI/Platform/nvidia.cpp +++ b/rEFIt_UEFI/Platform/nvidia.cpp @@ -2255,14 +2255,14 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) if (load_vbios) { - UnicodeSPrint(FileName, 128, L"ROM\\10de_%04x_%04x_%04x.rom", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id); + snwprintf(FileName, 128, "ROM\\10de_%04X_%04X_%04X.rom", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id); if (FileExists(OEMDir, FileName)) { DBG("Found specific VBIOS ROM file (10de_%04X_%04X_%04X.rom)\n", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id); Status = egLoadFile(OEMDir, FileName, &buffer, &bufferLen); } else { - UnicodeSPrint(FileName, 128, L"ROM\\10de_%04x.rom", nvda_dev->device_id); + snwprintf(FileName, 128, "ROM\\10de_%04X.rom", nvda_dev->device_id); if (FileExists(OEMDir, FileName)) { DBG("Found generic VBIOS ROM file (10de_%04X.rom)\n", nvda_dev->device_id); @@ -2270,14 +2270,14 @@ BOOLEAN setup_nvidia_devprop(pci_dt_t *nvda_dev) } } - UnicodeSPrint(FileName, 128, L"\\EFI\\CLOVER\\ROM\\10de_%04x_%04x_%04x.rom", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id); + snwprintf(FileName, 128, "\\EFI\\CLOVER\\ROM\\10de_%04X_%04X_%04X.rom", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id); if (EFI_ERROR(Status)) { if (FileExists(SelfRootDir, FileName)) { DBG("Found specific VBIOS ROM file (10de_%04X_%04X_%04X.rom)\n", nvda_dev->device_id, nvda_dev->subsys_id.subsys.vendor_id, nvda_dev->subsys_id.subsys.device_id); Status = egLoadFile(SelfRootDir, FileName, &buffer, &bufferLen); } else { - UnicodeSPrint(FileName, 128, L"\\EFI\\CLOVER\\ROM\\10de_%04x.rom", nvda_dev->device_id); + snwprintf(FileName, 128, "\\EFI\\CLOVER\\ROM\\10de_%04X.rom", nvda_dev->device_id); if (FileExists(SelfRootDir, FileName)) { DBG("Found generic VBIOS ROM file (10de_%04X.rom)\n", nvda_dev->device_id); diff --git a/rEFIt_UEFI/Platform/smbios.cpp b/rEFIt_UEFI/Platform/smbios.cpp index c07e86c3b..475c12bbd 100644 --- a/rEFIt_UEFI/Platform/smbios.cpp +++ b/rEFIt_UEFI/Platform/smbios.cpp @@ -711,7 +711,7 @@ VOID GetTableType4() gCPUStructure.ExternalClock = (UINT32)((SmbiosTable.Type4->ExternalClock * 1000) + (res * 110));//MHz->kHz - //UnicodeSPrint(gSettings.BusSpeed, 10, L"%d", gCPUStructure.ExternalClock); + //snwprintf(gSettings.BusSpeed, 10, "%d", gCPUStructure.ExternalClock); //gSettings.BusSpeed = gCPUStructure.ExternalClock; //why duplicate?? gCPUStructure.CurrentSpeed = SmbiosTable.Type4->CurrentSpeed; gCPUStructure.MaxSpeed = SmbiosTable.Type4->MaxSpeed; @@ -722,7 +722,7 @@ VOID GetTableType4() gSettings.EnabledCores = 0; //to change later } - //UnicodeSPrint(gSettings.CpuFreqMHz, 10, L"%d", gCPUStructure.CurrentSpeed); + //snwprintf(gSettings.CpuFreqMHz, 10, "%d", gCPUStructure.CurrentSpeed); //gSettings.CpuFreqMHz = gCPUStructure.CurrentSpeed; return; diff --git a/rEFIt_UEFI/cpp_unit_test/printlib-test.cpp b/rEFIt_UEFI/cpp_unit_test/printlib-test.cpp index e45f2f8d1..48cb76339 100644 --- a/rEFIt_UEFI/cpp_unit_test/printlib-test.cpp +++ b/rEFIt_UEFI/cpp_unit_test/printlib-test.cpp @@ -12,6 +12,12 @@ #include #include "printlib-test.h" + +extern "C" { +# undef DISABLE_PRINTLIB +# include +} + static int nbTestFailed = 0; #ifdef DISPLAY_ONLY_FAILED static bool displayOnlyFailed = true; diff --git a/rEFIt_UEFI/entry_scan/loader.cpp b/rEFIt_UEFI/entry_scan/loader.cpp index 65bcef9f7..a35b41331 100644 --- a/rEFIt_UEFI/entry_scan/loader.cpp +++ b/rEFIt_UEFI/entry_scan/loader.cpp @@ -1488,7 +1488,7 @@ VOID ScanLoader(VOID) // Get the partition UUID and make sure it's lower case CHAR16 PartUUID[40]; ZeroMem(&PreviousTime, sizeof(EFI_TIME)); - UnicodeSPrint(PartUUID, sizeof(PartUUID), L"%s", strguid(PartGUID)); + snwprintf(PartUUID, sizeof(PartUUID), "%s", strguid(PartGUID)); StrToLower(PartUUID); // open the /boot directory (or whatever directory path) DirIterOpen(Volume->RootDir, LINUX_BOOT_PATH, &Iter); @@ -1927,7 +1927,7 @@ STATIC VOID AddCustomEntry(IN UINTN CustomIndex, DBG("skipped because volume does not have partition uuid\n"); continue; } - UnicodeSPrint(PartUUID, sizeof(PartUUID), L"%s", strguid(Guid)); + snwprintf(PartUUID, sizeof(PartUUID), "%s", strguid(Guid)); StrToLower(PartUUID); // open the /boot directory (or whatever directory path) DirIterOpen(Volume->RootDir, LINUX_BOOT_PATH, Iter); diff --git a/rEFIt_UEFI/entry_scan/secureboot.cpp b/rEFIt_UEFI/entry_scan/secureboot.cpp index ab280a349..349cb93ed 100644 --- a/rEFIt_UEFI/entry_scan/secureboot.cpp +++ b/rEFIt_UEFI/entry_scan/secureboot.cpp @@ -169,9 +169,9 @@ STATIC VOID DisableMessage(IN EFI_STATUS Status, { CHAR16 *Str = NULL; if (ErrorString != NULL) { - Str = PoolPrint(L"%s\n%s\n%r", String, ErrorString, Status); + Str = PoolPrint(L"%s\n%s\n%s", String, ErrorString, strerror(Status)); } else { - Str = PoolPrint(L"%s\n%r", String, Status); + Str = PoolPrint(L"%s\n%s", String, strerror(Status)); } if (Str != NULL) { DBG("Secure Boot: %ls", Str); diff --git a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp index cff4a1931..a63f48363 100644 --- a/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp +++ b/rEFIt_UEFI/gui/REFIT_MENU_SCREEN.cpp @@ -844,7 +844,7 @@ UINTN REFIT_MENU_SCREEN::InputDialog(IN MENU_STYLE_FUNC StyleFunc) case MENU_EXIT_ESCAPE: if (StrCmp(Item->SValue, Backup) != 0) { - UnicodeSPrint(Item->SValue, SVALUE_MAX_SIZE, L"%s", Backup); + snwprintf(Item->SValue, SVALUE_MAX_SIZE, "%ls", Backup); if (Item->ItemType != BoolValue) { Item->LineShift = BackupShift; (Entries[ScrollState.CurrentSelection]).Row = BackupPos; diff --git a/rEFIt_UEFI/libeg/FloatLib.h b/rEFIt_UEFI/libeg/FloatLib.h index c05af1ed4..0c4db142a 100644 --- a/rEFIt_UEFI/libeg/FloatLib.h +++ b/rEFIt_UEFI/libeg/FloatLib.h @@ -14,7 +14,7 @@ extern "C" { #include #include #include -#include +//#include } #define PI (3.1415926536f) diff --git a/rEFIt_UEFI/libeg/libeg.h b/rEFIt_UEFI/libeg/libeg.h index 12128c504..65db1325a 100755 --- a/rEFIt_UEFI/libeg/libeg.h +++ b/rEFIt_UEFI/libeg/libeg.h @@ -121,7 +121,7 @@ extern "C" { #include #include #include -#include +//#include #include #include #include diff --git a/rEFIt_UEFI/refit/IO.cpp b/rEFIt_UEFI/refit/IO.cpp index 559df960f..bcf7522de 100644 --- a/rEFIt_UEFI/refit/IO.cpp +++ b/rEFIt_UEFI/refit/IO.cpp @@ -29,6 +29,9 @@ Revision History #define PRINT_ITEM_BUFFER_LEN 100 #define PRINT_JOINT_BUFFER_LEN 4 +extern "C" { +# include +} typedef struct { BOOLEAN PageBreak; diff --git a/rEFIt_UEFI/refit/icns.cpp b/rEFIt_UEFI/refit/icns.cpp index cb1d8fc70..8c01941b9 100644 --- a/rEFIt_UEFI/refit/icns.cpp +++ b/rEFIt_UEFI/refit/icns.cpp @@ -279,7 +279,7 @@ EG_IMAGE * BuiltinIcon(IN UINTN Id) // *p = L'\0'; if (StrCmp(Text, L"shutdown") == 0) { // icon name is shutdown from historic reasons, but function is now exit - UnicodeSPrint(Text, 30, L"exit"); + snwprintf(Text, 30, "exit"); } egRenderText(Text, TextBuffer, 0, 0, 0xFFFF, 1); BuiltinIconTable[Id].Image = TextBuffer; @@ -324,7 +324,7 @@ EG_IMAGE * LoadOSIcon(IN CONST CHAR16 *OSIconName OPTIONAL, IN CONST CHAR16 *Fal continue; CopyMem(CutoutName, OSIconName + StartIndex, (Index - StartIndex) * sizeof(CHAR16)); CutoutName[Index - StartIndex] = 0; - UnicodeSPrint(FileName, 512, L"icons\\%s_%s.icns", + snwprintf(FileName, 512, "icons\\%ls_%ls.icns", BootLogo ? L"boot" : L"os", CutoutName); // try to load it @@ -342,7 +342,7 @@ EG_IMAGE * LoadOSIcon(IN CONST CHAR16 *OSIconName OPTIONAL, IN CONST CHAR16 *Fal } // try the fallback name - UnicodeSPrint(FileName, 512, L"icons\\%s_%s.icns", + snwprintf(FileName, 512, "icons\\%ls_%ls.icns", BootLogo ? L"boot" : L"os", FallbackIconName); Image = egLoadIcon(ThemeDir, FileName, PixelSize); if (Image != NULL) { diff --git a/rEFIt_UEFI/refit/lib.cpp b/rEFIt_UEFI/refit/lib.cpp index 62e121f82..49ed31c58 100644 --- a/rEFIt_UEFI/refit/lib.cpp +++ b/rEFIt_UEFI/refit/lib.cpp @@ -995,7 +995,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume) if (HdPath) { tmpName = (CHAR16*)AllocateZeroPool(60); - UnicodeSPrint(tmpName, 60, L"Legacy HD%d", HdPath->PartitionNumber); + snwprintf(tmpName, 60, "Legacy HD%d", HdPath->PartitionNumber); Volume->VolName = EfiStrDuplicate(tmpName); FreePool(tmpName); } else if (!Volume->VolName) { @@ -1071,7 +1071,7 @@ static EFI_STATUS ScanVolume(IN OUT REFIT_VOLUME *Volume) if (HdPath) { tmpName = (CHAR16*)AllocateZeroPool(128); - UnicodeSPrint(tmpName, 128, L"Unknown HD%d", HdPath->PartitionNumber); + snwprintf(tmpName, 128, "Unknown HD%d", HdPath->PartitionNumber); Volume->VolName = EfiStrDuplicate(tmpName); FreePool(tmpName); // NOTE: this is normal for Apple's VenMedia device paths diff --git a/rEFIt_UEFI/refit/main.cpp b/rEFIt_UEFI/refit/main.cpp index 9e4a5c9a7..96afe05ca 100644 --- a/rEFIt_UEFI/refit/main.cpp +++ b/rEFIt_UEFI/refit/main.cpp @@ -153,7 +153,7 @@ static EFI_STATUS LoadEFIImageList(IN EFI_DEVICE_PATH **DevicePaths, if (ReturnStatus != EFI_NOT_FOUND) break; } - UnicodeSPrint(ErrorInfo, 512, L"while loading %s", ImageTitle); + snwprintf(ErrorInfo, 512, "while loading %ls", ImageTitle); if (CheckError(Status, ErrorInfo)) { if (ErrorInStep != NULL) *ErrorInStep = 1; @@ -248,7 +248,7 @@ static EFI_STATUS StartEFILoadedImage(IN EFI_HANDLE ChildImageHandle, // control returns here when the child image calls Exit() if (ImageTitle) { - UnicodeSPrint(ErrorInfo, 512, L"returned from %s", ImageTitle); + snwprintf(ErrorInfo, 512, "returned from %ls", ImageTitle); } if (CheckError(Status, ErrorInfo)) { @@ -1170,7 +1170,7 @@ static VOID ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne } #undef BOOLEAN_AT_INDEX - UnicodeSPrint(FileName, 512, L"%s\\%s", Path, DirEntry->FileName); + snwprintf(FileName, 512, "%ls\\%ls", Path, DirEntry->FileName); Status = StartEFIImage(FileDevicePath(SelfLoadedImage->DeviceHandle, FileName), L"", DirEntry->FileName, DirEntry->FileName, NULL, &DriverHandle); if (EFI_ERROR(Status)) { @@ -1212,7 +1212,7 @@ static VOID ScanDriverDir(IN CONST CHAR16 *Path, OUT EFI_HANDLE **DriversToConne } Status = DirIterClose(&DirIter); if (Status != EFI_NOT_FOUND) { - UnicodeSPrint(FileName, 512, L"while scanning the %s directory", Path); + snwprintf(FileName, 512, "while scanning the %ls directory", Path); CheckError(Status, FileName); } @@ -1767,7 +1767,7 @@ BOOLEAN SetOEMPathIfExists(IN EFI_FILE *Root, IN CHAR16 *path, CONST CHAR16 *Con BOOLEAN res = FileExists(Root, path); if ( res ) { CHAR16 ConfigPath[1024]; - UnicodeSPrint(ConfigPath, sizeof(ConfigPath), L"%s\\%s.plist", path, ConfName); + snwprintf(ConfigPath, sizeof(ConfigPath), "%ls\\%ls.plist", path, ConfName); BOOLEAN res2 = FileExists(Root, ConfigPath); if ( res2 ) { OEMPath = path; @@ -2207,7 +2207,7 @@ RefitMain (IN EFI_HANDLE ImageHandle, Status = LoadUserSettings(SelfRootDir, L"config", &gConfigDict[0]); DBG("%ls\\config.plist%ls loaded: %s\n", OEMPath, EFI_ERROR(Status) ? L" not" : L"", strerror(Status)); } - UnicodeSPrint(gSettings.ConfigName, 64, L"%s%s%s", + snwprintf(gSettings.ConfigName, 64, "%ls%ls%ls", /* gSettings.ConfigName = PoolPrint(L"%s%s%s", */ gConfigDict[0] ? L"config": L"", (gConfigDict[0] && gConfigDict[1]) ? L" + ": L"", diff --git a/rEFIt_UEFI/refit/menu.cpp b/rEFIt_UEFI/refit/menu.cpp index 40d75ac0c..8965d1252 100644 --- a/rEFIt_UEFI/refit/menu.cpp +++ b/rEFIt_UEFI/refit/menu.cpp @@ -169,9 +169,9 @@ INTN ScrollWidth = 16; // ////EG_IMAGE *SelectionImages[6] = {NULL, NULL, NULL, NULL, NULL, NULL}; ////EG_IMAGE *Buttons[4] = {NULL, NULL, NULL, NULL}; -//#if !USE_XTHEME +#if !USE_XTHEME static EG_IMAGE *TextBuffer = NULL; -//#endif +#endif // ////EG_PIXEL SelectionBackgroundPixel = { 0xef, 0xef, 0xef, 0xff }; //non-trasparent // @@ -182,7 +182,9 @@ static EG_IMAGE *TextBuffer = NULL; //static INTN row1Count, row1PosX, row1PosXRunning; //static INTN *itemPosX = NULL; //static INTN *itemPosY = NULL; +#if !USE_XTHEME static INTN row0PosY /*, row1PosY, textPosY, FunctextPosY*/; +#endif ////static EG_IMAGE* MainImage; //static INTN OldX = 0, OldY = 0; //static INTN OldTextWidth = 0; @@ -275,17 +277,17 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(SVALUE_MAX_SIZE); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, L"%a ", gSettings.BootArgs); + snwprintf(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, "%s ", gSettings.BootArgs); InputItems[InputItemsCount].ItemType = UNIString; //1 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(32); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 32, L"%s", gSettings.DsdtName); // 1-> 2 + snwprintf(InputItems[InputItemsCount++].SValue, 32, "%ls", gSettings.DsdtName); // 1-> 2 InputItems[InputItemsCount].ItemType = UNIString; //2 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(63); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 63, L"%s", gSettings.BlockKexts); + snwprintf(InputItems[InputItemsCount++].SValue, 63, "%ls", gSettings.BlockKexts); InputItems[InputItemsCount].ItemType = RadioSwitch; //3 - Themes chooser InputItems[InputItemsCount++].IValue = 3; @@ -300,12 +302,12 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.PLimitDict); + snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gSettings.PLimitDict); InputItems[InputItemsCount].ItemType = Decimal; //8 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.UnderVoltStep); + snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gSettings.UnderVoltStep); InputItems[InputItemsCount].ItemType = BoolValue; //9 InputItems[InputItemsCount++].BValue = gSettings.GenerateCStates; InputItems[InputItemsCount].ItemType = BoolValue; //10 @@ -320,7 +322,7 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%06d", gSettings.QPI); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06d", gSettings.QPI); InputItems[InputItemsCount].ItemType = BoolValue; //15 InputItems[InputItemsCount++].BValue = gSettings.PatchNMI; InputItems[InputItemsCount].ItemType = BoolValue; //16 @@ -329,20 +331,20 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%x", gPlatformFeature); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%llX", gPlatformFeature); InputItems[InputItemsCount].ItemType = Hex; //18 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(36); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 36, L"0x%X", gSettings.BacklightLevel); + snwprintf(InputItems[InputItemsCount++].SValue, 36, "0x%X", gSettings.BacklightLevel); InputItems[InputItemsCount].ItemType = Decimal; //19 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } if (gSettings.BusSpeed > 20000) { - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%06d", gSettings.BusSpeed); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06d", gSettings.BusSpeed); } else { - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%06d", gCPUStructure.ExternalClock); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06llu", gCPUStructure.ExternalClock); } InputItemsCount = 20; for (i=0; i 2) { //fool proof: cfg_name is 3 character or more. - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 20, L"%s", gSettings.FBName); + snwprintf(InputItems[InputItemsCount++].SValue, 20, "%ls", gSettings.FBName); } else { - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 20, L"%a", gGraphics[i].Config); + snwprintf(InputItems[InputItemsCount++].SValue, 20, "%s", gGraphics[i].Config); } } else if (gGraphics[i].Vendor == Nvidia) { InputItems[InputItemsCount].ItemType = BoolValue; //21+i*6 @@ -374,7 +376,7 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(40); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 40, L"%a", tmp); + snwprintf(InputItems[InputItemsCount++].SValue, 40, "%s", tmp); //InputItems[InputItemsCount++].SValue = PoolPrint(L"%08x",*(UINT64*)&gSettings.Dcfg[0]); } else /*if (gGraphics[i].Vendor == Intel) */ { @@ -384,7 +386,7 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.IgPlatform); + snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.IgPlatform); // InputItemsCount += 3; // continue; } @@ -394,9 +396,9 @@ VOID FillInputs(BOOLEAN New) InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8); } if (gSettings.VideoPorts > 0) { - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.VideoPorts); + snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gSettings.VideoPorts); } else { - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gGraphics[i].Ports); + snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02d", gGraphics[i].Ports); } if (gGraphics[i].Vendor == Nvidia) { @@ -407,13 +409,13 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(84); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 84, L"%a", tmp); + snwprintf(InputItems[InputItemsCount++].SValue, 84, "%s", tmp); } else { //ATI and others there will be connectors InputItems[InputItemsCount].ItemType = Hex; //24+6i if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(20); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 20, L"%08lx", gGraphics[i].Connectors); + snwprintf(InputItems[InputItemsCount++].SValue, 20, "%08x", gGraphics[i].Connectors); } InputItems[InputItemsCount].ItemType = BoolValue; //25+6i @@ -439,13 +441,13 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%06d", gSettings.RefCLK); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "%06d", gSettings.RefCLK); InputItems[InputItemsCount].ItemType = ASString; //51 OS version if non-detected if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(SVALUE_MAX_SIZE); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, L"%a ", NonDetected); + snwprintf(InputItems[InputItemsCount++].SValue, SVALUE_MAX_SIZE, "%s ", NonDetected); InputItems[InputItemsCount].ItemType = BoolValue; //52 InputItems[InputItemsCount++].BValue = gSettings.InjectEDID; @@ -455,12 +457,12 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.VendorEDID); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04X", gSettings.VendorEDID); InputItems[InputItemsCount].ItemType = Decimal; //54 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.ProductEDID); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04X", gSettings.ProductEDID); // ErmaC: NvidiaGeneric menu selector y/n InputItems[InputItemsCount].ItemType = BoolValue; //55 @@ -477,7 +479,7 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%d", gSettings.HDALayoutId); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%d", gSettings.HDALayoutId); // syscl change here InputItems[InputItemsCount].ItemType = BoolValue; //61 @@ -488,13 +490,13 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(24); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 24, L"0x%08x", gFwFeatures); + snwprintf(InputItems[InputItemsCount++].SValue, 24, "0x%08X", gFwFeatures); InputItems[InputItemsCount].ItemType = Hex; //63 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(24); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 24, L"0x%08x", gFwFeaturesMask); + snwprintf(InputItems[InputItemsCount++].SValue, 24, "0x%08X", gFwFeaturesMask); // Debug for KernelAndKextPatches InputItems[InputItemsCount].ItemType = BoolValue; //64 @@ -519,12 +521,12 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(8); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 8, L"%02d", gSettings.PointerSpeed); + snwprintf(InputItems[InputItemsCount++].SValue, 8, "%02lld", gSettings.PointerSpeed); InputItems[InputItemsCount].ItemType = Decimal; //71 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%04d", gSettings.DoubleClickTime); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "%04llu", gSettings.DoubleClickTime); InputItems[InputItemsCount].ItemType = BoolValue; //72 InputItems[InputItemsCount++].BValue = gSettings.PointerMirror; @@ -538,68 +540,68 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.C3Latency); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04X", gSettings.C3Latency); InputItems[InputItemsCount].ItemType = Decimal; //76 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%02d", gSettings.EnabledCores); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "%02d", gSettings.EnabledCores); InputItems[InputItemsCount].ItemType = Decimal; //77 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%02d", gSettings.SavingMode); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "%02d", gSettings.SavingMode); InputItems[InputItemsCount].ItemType = ASString; //78 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.ProductName); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.ProductName); InputItems[InputItemsCount].ItemType = ASString; //79 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.VersionNr); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.VersionNr); InputItems[InputItemsCount].ItemType = ASString; //80 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.SerialNr); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.SerialNr); InputItems[InputItemsCount].ItemType = ASString; //81 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BoardNumber); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BoardNumber); InputItems[InputItemsCount].ItemType = ASString; //82 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BoardSerialNumber); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BoardSerialNumber); InputItems[InputItemsCount].ItemType = Decimal; //83 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%d", gSettings.BoardType); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%d", gSettings.BoardType); InputItems[InputItemsCount].ItemType = ASString; //84 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BoardVersion); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BoardVersion); InputItems[InputItemsCount].ItemType = Decimal; //85 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%d", gSettings.ChassisType); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%d", gSettings.ChassisType); InputItems[InputItemsCount].ItemType = ASString; //86 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.RomVersion); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.RomVersion); InputItems[InputItemsCount].ItemType = ASString; //87 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.ReleaseDate); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.ReleaseDate); InputItems[InputItemsCount].ItemType = BoolValue; //88 InputItems[InputItemsCount++].BValue = gSettings.DoubleFirstState; @@ -620,38 +622,38 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeATI); + snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeATI); InputItems[InputItemsCount].ItemType = Hex; //95 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeNVidia); + snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeNVidia); InputItems[InputItemsCount].ItemType = Hex; //96 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeIntel); + snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeIntel); InputItems[InputItemsCount].ItemType = Hex; //97 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeLAN); + snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeLAN); InputItems[InputItemsCount].ItemType = Hex; //98 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeWIFI); + snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeWIFI); InputItems[InputItemsCount].ItemType = Hex; //99 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeSATA); + snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeSATA); InputItems[InputItemsCount].ItemType = Hex; //100 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeXHCI); + snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeXHCI); InputItems[InputItemsCount].ItemType = CheckBit; //101 InputItems[InputItemsCount++].IValue = dropDSM; @@ -661,12 +663,12 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.FakeIMEI); + snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.FakeIMEI); InputItems[InputItemsCount].ItemType = Hex; //104 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(26); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 26, L"0x%08X", gSettings.KernelAndKextPatches.FakeCPUID); + snwprintf(InputItems[InputItemsCount++].SValue, 26, "0x%08X", gSettings.KernelAndKextPatches.FakeCPUID); InputItems[InputItemsCount].ItemType = BoolValue; //105 @@ -683,7 +685,7 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%01x", gSettings.DualLink); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "%01X", gSettings.DualLink); InputItems[InputItemsCount].ItemType = BoolValue; //110 InputItems[InputItemsCount++].BValue = gSettings.NvidiaNoEFI; @@ -694,7 +696,7 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"0x%04x", gSettings.IntelMaxValue); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "0x%04X", gSettings.IntelMaxValue); InputItems[InputItemsCount].ItemType = BoolValue; //113 InputItems[InputItemsCount++].BValue = gSettings.AutoMerge; @@ -709,12 +711,12 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.EfiVersion); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.EfiVersion); InputItems[InputItemsCount].ItemType = ASString; //118 if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(64); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 64, L"%a", gSettings.BooterCfgStr); + snwprintf(InputItems[InputItemsCount++].SValue, 64, "%s", gSettings.BooterCfgStr); InputItems[InputItemsCount].ItemType = RadioSwitch; //119 - Audio chooser InputItems[InputItemsCount++].IValue = 119; @@ -722,7 +724,7 @@ VOID FillInputs(BOOLEAN New) if (New) { InputItems[InputItemsCount].SValue = (__typeof__(InputItems[InputItemsCount].SValue))AllocateZeroPool(16); } - UnicodeSPrint(InputItems[InputItemsCount++].SValue, 16, L"%04d", DefaultAudioVolume); + snwprintf(InputItems[InputItemsCount++].SValue, 16, "%04d", DefaultAudioVolume); InputItems[InputItemsCount].ItemType = BoolValue; //121 InputItems[InputItemsCount++].BValue = gSettings.KernelAndKextPatches.KPPanicNoKextDump; @@ -775,11 +777,11 @@ VOID ApplyInputs(VOID) } i++; //1 if (InputItems[i].Valid) { - UnicodeSPrint(gSettings.DsdtName, sizeof(gSettings.DsdtName), L"%s", InputItems[i].SValue); + snwprintf(gSettings.DsdtName, sizeof(gSettings.DsdtName), "%ls", InputItems[i].SValue); } i++; //2 if (InputItems[i].Valid) { - UnicodeSPrint(gSettings.BlockKexts, sizeof(gSettings.BlockKexts), L"%s", InputItems[i].SValue); + snwprintf(gSettings.BlockKexts, sizeof(gSettings.BlockKexts), "%ls", InputItems[i].SValue); } i++; //3 if (InputItems[i].Valid) { @@ -898,7 +900,7 @@ VOID ApplyInputs(VOID) i++; //22 if (InputItems[i].Valid) { if (gGraphics[j].Vendor == Ati) { - UnicodeSPrint(gSettings.FBName, 32, L"%s", InputItems[i].SValue); + snwprintf(gSettings.FBName, 32, "%ls", InputItems[i].SValue); } else if (gGraphics[j].Vendor == Nvidia) { ZeroMem(AString, 256); snprintf(AString, 255, "%ls", InputItems[i].SValue); @@ -1168,7 +1170,7 @@ VOID ApplyInputs(VOID) Status = GetUserSettings(SelfRootDir, dict); if (gConfigDict[2]) FreeTag(gConfigDict[2]); gConfigDict[2] = dict; - UnicodeSPrint(gSettings.ConfigName, 64, L"%s", ConfigsList[OldChosenConfig]); + snwprintf(gSettings.ConfigName, 64, "%ls", ConfigsList[OldChosenConfig]); gBootChanged = TRUE; gThemeChanged = TRUE; } @@ -1298,9 +1300,9 @@ VOID ApplyInputs(VOID) i++; //116 if (InputItems[i].Valid) { if (OldChosenDsdt == 0xFFFF) { - UnicodeSPrint(gSettings.DsdtName, 64, L"BIOS.aml"); + snwprintf(gSettings.DsdtName, 64, "BIOS.aml"); } else { - UnicodeSPrint(gSettings.DsdtName, 64, L"%s", DsdtsList[OldChosenDsdt]); + snwprintf(gSettings.DsdtName, 64, "%ls", DsdtsList[OldChosenDsdt]); } } i++; //117 @@ -1334,7 +1336,7 @@ VOID ApplyInputs(VOID) if (DefaultAudioVolume > 100) { // correct wrong input DefaultAudioVolume = 90; - UnicodeSPrint(InputItems[i].SValue, 16, L"%04d", DefaultAudioVolume); + snwprintf(InputItems[i].SValue, 16, "%04d", DefaultAudioVolume); } SetNvramVariable(L"Clover.SoundVolume", &gEfiAppleBootGuid, EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_RUNTIME_ACCESS, @@ -2431,12 +2433,12 @@ REFIT_MENU_ITEM_OPTIONS* newREFIT_MENU_ITEM_OPTIONS(REFIT_MENU_SCREEN **SubScree VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry) { if (ChosenEntry->SubScreen->ID == SCREEN_DSDT) { -// UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"DSDT fix mask [0x%08x]->", gSettings.FixDsdt); // TODO jief : cast to fix +// snwprintf((CHAR16*)ChosenEntry->Title, 128, "DSDT fix mask [0x%08X]->", gSettings.FixDsdt); // TODO jief : cast to fix ChosenEntry->Title.SWPrintf("DSDT fix mask [0x%08x]->", gSettings.FixDsdt); // TODO jief : cast to fix //MsgLog("@ESC: %ls\n", (*ChosenEntry)->Title); } else if (ChosenEntry->SubScreen->ID == SCREEN_CSR) { // CSR -// UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"System Integrity Protection [0x%04x]->", gSettings.CsrActiveConfig); // TODO jief : cast to fix +// snwprintf((CHAR16*)ChosenEntry->Title, 128, "System Integrity Protection [0x%04X]->", gSettings.CsrActiveConfig); // TODO jief : cast to fix ChosenEntry->Title.SWPrintf("System Integrity Protection [0x%04x]->", gSettings.CsrActiveConfig); // TODO jief : cast to fix // check for the right booter flag to allow the application // of the new System Integrity Protection configuration. @@ -2445,10 +2447,10 @@ VOID ModifyTitles(REFIT_ABSTRACT_MENU_ENTRY *ChosenEntry) } } else if (ChosenEntry->SubScreen->ID == SCREEN_BLC) { -// UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"boot_args->flags [0x%04x]->", gSettings.BooterConfig); // TODO jief : cast to fix +// snwprintf((CHAR16*)ChosenEntry->Title, 128, "boot_args->flags [0x%04X]->", gSettings.BooterConfig); // TODO jief : cast to fix ChosenEntry->Title.SWPrintf("boot_args->flags [0x%04x]->", gSettings.BooterConfig); // TODO jief : cast to fix } else if (ChosenEntry->SubScreen->ID == SCREEN_DSM) { -// UnicodeSPrint((CHAR16*)ChosenEntry->Title, 128, L"Drop OEM _DSM [0x%04x]->", dropDSM); // TODO jief : cast to fix +// snwprintf((CHAR16*)ChosenEntry->Title, 128, "Drop OEM _DSM [0x%04X]->", dropDSM); // TODO jief : cast to fix ChosenEntry->Title.SWPrintf("Drop OEM _DSM [0x%04x]->", dropDSM); // TODO jief : cast to fix } } @@ -2741,14 +2743,14 @@ LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry) CHAR16 DirName[256]; if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) { - UnicodeSPrint(DirName, sizeof(DirName), L"10_install"); + snwprintf(DirName, sizeof(DirName), "10_install"); } else { if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) { - UnicodeSPrint(DirName, sizeof(DirName), L"10_recovery"); + snwprintf(DirName, sizeof(DirName), "10_recovery"); } else { - UnicodeSPrint(DirName, sizeof(DirName), L"10_normal"); + snwprintf(DirName, sizeof(DirName), "10_normal"); } } SubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true); @@ -2757,18 +2759,18 @@ LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry) // Add kext from 10.{version} { CHAR16 DirName[256]; - UnicodeSPrint(DirName, sizeof(DirName), L"%a", ShortOSVersion); + snwprintf(DirName, sizeof(DirName), "%s", ShortOSVersion); SubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true); if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) { - UnicodeSPrint(DirName, sizeof(DirName), L"%a_install", ShortOSVersion); + snwprintf(DirName, sizeof(DirName), "%s_install", ShortOSVersion); } else { if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) { - UnicodeSPrint(DirName, sizeof(DirName), L"%a_recovery", ShortOSVersion); + snwprintf(DirName, sizeof(DirName), "%s_recovery", ShortOSVersion); } else { - UnicodeSPrint(DirName, sizeof(DirName), L"%a_normal", ShortOSVersion); + snwprintf(DirName, sizeof(DirName), "%s_normal", ShortOSVersion); } } SubScreen->AddMenuEntry(SubMenuKextBlockInjection(DirName), true); @@ -2781,25 +2783,25 @@ LOADER_ENTRY *SubMenuKextInjectMgmt(LOADER_ENTRY *Entry) { CHAR16 OSVersionKextsDirName[256]; if ( AsciiStrCmp(ShortOSVersion, Entry->OSVersion) == 0 ) { - UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a.0", Entry->OSVersion); + snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%s.0", Entry->OSVersion); }else{ - UnicodeSPrint(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), L"%a", Entry->OSVersion); + snwprintf(OSVersionKextsDirName, sizeof(OSVersionKextsDirName), "%s", Entry->OSVersion); } SubScreen->AddMenuEntry(SubMenuKextBlockInjection(OSVersionKextsDirName), true); } CHAR16 DirName[256]; if (OSTYPE_IS_OSX_INSTALLER(Entry->LoaderType)) { - UnicodeSPrint(DirName, sizeof(DirName), L"%a_install", + snwprintf(DirName, sizeof(DirName), "%s_install", Entry->OSVersion); } else { if (OSTYPE_IS_OSX_RECOVERY(Entry->LoaderType)) { - UnicodeSPrint(DirName, sizeof(DirName), L"%a_recovery", + snwprintf(DirName, sizeof(DirName), "%s_recovery", Entry->OSVersion); } else { - UnicodeSPrint(DirName, sizeof(DirName), L"%a_normal", + snwprintf(DirName, sizeof(DirName), "%s_normal", Entry->OSVersion); } } diff --git a/rEFIt_UEFI/refit/screen.cpp b/rEFIt_UEFI/refit/screen.cpp index ef411ef62..a1b61e732 100644 --- a/rEFIt_UEFI/refit/screen.cpp +++ b/rEFIt_UEFI/refit/screen.cpp @@ -303,7 +303,7 @@ StatusToString ( EFI_STATUS Status ) { - UnicodeSPrint(Buffer, 64, L"EFI Error %r", Status); + snwprintf(Buffer, 64, "EFI Error %s", strerror(Status)); }*/ @@ -1039,7 +1039,7 @@ VOID REFIT_MENU_SCREEN::InitAnime() p = LoadSvgFrame(i); // DBG("frame %d loaded\n", i); } else { - UnicodeSPrint(FileName, 512, L"%s\\%s_%03d.png", Path, Path, i); + snwprintf(FileName, 512, "%ls\\%ls_%03llu.png", Path, Path, i); p = egLoadImage(ThemeX.ThemeDir, FileName, TRUE); } if (!p) { @@ -1152,7 +1152,7 @@ VOID REFIT_MENU_SCREEN::InitAnime() p = LoadSvgFrame(i); // DBG("frame %d loaded\n", i); } else { - UnicodeSPrint(FileName, 512, L"%s\\%s_%03d.png", Path, Path, i); + snwprintf(FileName, 512, "%ls\\%ls_%03llu.png", Path, Path, i); p = egLoadImage(ThemeDir, FileName, TRUE); } if (!p) {