EFI Application Erorr Write Protected

随声附和 提交于 2020-08-10 19:34:07

问题


I tried to do some write/read operations on filesystems that I have enumerated for. The problem is when I want to write to other volumes rather than my self (fs0), it will return WRITE PROTECTED Error.

 ... Enumerated and opened all available volumes successfuly

 efiStatus = root->Open(root, &token, L"xxx", EFI_FILE_MODE_READ | EFI_FILE_MODE_WRITE | EFI_FILE_MODE_CREATE, 0);
    
    if (efiStatus == EFI_SUCCESS)
    {
        char* myStr = "Sample Content";
        UINTN myStrSize = strlenEx(myStr);

        efiStatus = token->Write(token, &myStrSize, myStr);
        if (efiStatus != EFI_SUCCESS)
        {
            Print(L"[X] ! Error [%r]!\n", efiStatus);
        }
        Print(L"Found Some\n", efiStatus);
    }

I Also tried ShellCreateDirectory, ShellWriteFile. Do I really can access write hard disk (pci) from EFI Application?

EDIT:

drivers command output:

                T   D
D           Y C I
R           P F A
V  VERSION  E G G #D #C DRIVER NAME                         IMAGE NAME
== ======== = = = == == =================================== ==========
43 00000014 D - -  1  - AMI USB Driver                      Uhcd
45 00000014 B - -  1  4 USB bus                             Uhcd
46 00000002 D - -  3  - USB Hid driver                      Uhcd
47 00000001 D - -  1  - USB Mass Storage driver             Uhcd
85 00010000 ? - -  -  - AMI ExFat Driver                    EXFAT
86 00010000 D - -  5  - AMI NTFS Driver                     NTFS
89 00000001 D - -  2  - <null string>                       MouseDriver
8B 00000001 B - -  1  3 AMI AHCI BUS Driver                 Ahci
8F 00000001 ? - -  -  - AMI NVMe BUS Driver                 Nvme
123 00000010 D - -  1  - Serial ATA Controller Initializatio SataController
12E 00000010 B - -  1  1 AMI Console Splitter Text Out Drive ConSplitter
12F 00000010 B - -  1  1 AMI Console Splitter Text In Driver ConSplitter
130 00000010 B - -  1  1 AMI Console Splitter Pointer Driver ConSplitter
133 00000010 D - -  1  - AMI Graphic Console Driver          GraphicsConsole
134 0000000A D - - 15  - Generic Disk I/O Driver             DiskIoDxe
135 0000000B B - -  3 11 Partition Driver(MBR/GPT/El Torito) PartitionDxe
137 00000000 ? - -  -  - Integrated Touch Driver             IntegratedTouch
13A 00000010 B - -  1  5 AMI Generic LPC Super I/O Driver    GenericSio
13C 00A50110 B - -  1 15 AMI PCI Bus Driver                  PciBus
13E 00000010 ? - -  -  - AMI PS/2 Driver                     Ps2Main
13F 00000000 ? - -  -  - DNS Network Service Driver          DnsDxe
140 00000000 ? - -  -  - DNS Network Service Driver          DnsDxe
145 0000000A D - -  2  - FAT File System Driver              Fat
147 00010001 ? - -  -  - AMI ISO9660 File System Driver      FsIso9660
149 00000001 ? - -  -  - <null string>                       PcieSataController
14A 00000001 ? - -  -  - <null string>                       PcieSataController
14B 0000001B B - -  1  3 Intel(R) RST 16.0.2.3402 RAID Drive RaidDriver
159 09000432 B - -  1  1 Intel(R) GOP Driver [9.0.1074]      MemoryMapped(0x3,0x845F3018,0x846040D8)

回答1:


My educated guess is that you trying to access NTFS volume (since you talked about Windows partitions) and NTFS is not supported by UEFI (by default). At least, I haven't seen any firmware that does. UEFI supports FAT32 file systems only.

If you drop into UEFI shell on your platform you should see the "Mapping table" (see the sample picture below), if there is a device labeled "FS0". This indicates that the firmware detected the disk, discovered the partition, and was able to mount the file system. The rest of the volumes labeled as BLK, which means UEFI can give the access using BlockIO Protocol only. No FS Protocol support.



来源:https://stackoverflow.com/questions/63029203/efi-application-erorr-write-protected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!