> On May 22, 2015, at 12:24 PM, KSilva <kaleb.si...@iatecam.org.br> wrote:
> 
> Hello, I am trying write in file in the USB device, I am using the protocol
> EFI_SIMPLE_FILE_SYSTEM_PROTOCOL with  EFI_FILE_PROTOCOL,The file is create
> and opened,but I don't get to write, in the file shows only first letter.
> 

I did not see an issue in your code. 

%s is Unicode not ASCII, since ASCII is %a, so I assume your file is Unicode. 

A is 0x0041 in EFI 16-bit Unicode so in bytes that is 0x41 0x00. If you read a 
Unicode string as ASCII you get a NULL in the wrong place of the string. So 
maybe the issue is in the way you are looking at the file you wrote? 

Thanks,

Andrew Fish

> Someone help me?
> 
> 
> 
>       Status = gBS->LocateHandleBuffer(ByProtocol,
>                                       &gSimpleFileProtocol,
>                                       NULL,
>                                       &numFile,
>                                       &fileHandle);
>       if(!EFI_ERROR(Status))
>       {
>         for(index = 0;index < numFile;index++)
>         {
>           Status = gBS->HandleProtocol(fileHandle[index],
>                                       &gSimpleFileProtocol,
>                                       (VOID **)&fileSystemProtocol);
>            if(!EFI_ERROR(Status))
>           {
>               Status = fileSystemProtocol->OpenVolume(fileSystemProtocol,
>                                                       &root);
>               if(!EFI_ERROR(Status))
>               {
>                  Print(L"\nTexto: %s",texto);
>                 Status = root->Open(root,
>                                    &newHandle,
>                                    L"teste.txt",
>                                    EFI_FILE_MODE_CREATE | EFI_FILE_MODE_READ 
> | EFI_FILE_MODE_WRITE,
>                                    0);
>                if(!EFI_ERROR(Status))
>                 {
>                  BufferSize = 128;
>                  Print(L"Status root->Open(): %r\n", Status);
>                  Status = root->Write(newHandle,
>                                       &BufferSize,
>                                       texto);
>               }
>               Print(L"\nStatus do Write: %r\n",Status);
>                       root->Close(newHandle);
>                       Print(L"\nstatus Close :%r\n",Status);
>                       break;
>               }
>         }
>       }
> }
> 
> 

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to