2016-03-30 10 views
0

döndürdü OpenProtocol döndürdü 2 OpenHopleBuffer tarafından döndürülen bir tanıtıcı açmak için OpenProtocol kullandığımda.OpenProtocol döndürdü 2 Bir tanıtıcı açmak için OpenProtocol kullandığımda

ana kod aşağıda gösterilmiştir:

Üçüncü parametre doğru değildi, bu yüzden doğru kod aşağıdaki gibi olmalıdır
//Entry Point for this application 
EFI_STATUS UefiMain (IN EFI_HANDLE ImageHandle,IN EFI_SYSTEM_TABLE *SystemTable)//ImageHandle and system table 
{ 
    //Define and initialize all the variables. 
    EFI_STATUS Status=EFI_SUCCESS;//zero 
    UINTN HandleIndex=0,HandleCount=0;//the index for handle buffer and the num of handle elem 
    EFI_HANDLE* DiskControllerHandles=NULL;//NULL 
    EFI_DISK_IO_PROTOCOL* DiskIOProtocol=NULL;//NULL 
    EFI_DEVICE_PATH_PROTOCOL* DiskDevicePathProtocol=NULL;//NULL 
    //the return result 
    Status=gBS->LocateHandleBuffer(ByProtocol,&gEfiDiskIoProtocolGuid,NULL,&HandleCount,&DiskControllerHandles);//Get all handles which support EFI_DISK_IO_PROTOCOL into the buffer. 
    if(EFI_ERROR(Status))//LocateHandleBuffer failed. 
    { 
     Print(L"UefiMain:gBS->LocateHandleBuffer failed,error=%d.\r\n",Status); 
     return EFI_SUCCESS;//failed 
    } 

    //Open the handle which supports EFI_DEVICE_PATH_TO_TEXT_PROTOCOL and was returned by LocateHandleBuffer previously. 
    //Loop 
    for(HandleIndex=0;HandleIndex<HandleCount;HandleIndex++) 
    { 
     DiskIOProtocol=NULL; 
     DiskDevicePathProtocol=NULL; 

     //Open each handle which supports EFI_DEVICE_PATH_PROTOCOL. 
     Status=gBS->OpenProtocol(DiskControllerHandles[HandleIndex],&gEfiDevicePathProtocolGuid,(VOID**)DiskDevicePathProtocol, 
     ImageHandle,NULL,EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL);//EFI_OPEN_PROTOCOL_GET_PROTOCOL);//Here 2 was returned. I haven't known why 2 was returned here after looking up Unified Extensible Firmware Interface 2.6 
    } 

    return EFI_SUCCESS;//return 
} 

cevap

0

:

Status=gBS->OpenProtocol(DiskControllerHandles[HandleIndex],&gEfiDevicePathProtocolGuid,(VOID**)&DiskDevicePathProtocol, 
     ImageHandle,NULL,EFI_OPEN_PROTOCOL_BY_HANDLE_PROTOCOL); 
İlgili konular