1

Topic: To receive handle EFI system partition

Greetings, There was a task to receive  EFI system partition. I.e. it is necessary to receive Device Path for given partition, to transfer it in CreateFile and to receive . A hitch at a stage of obtaining Device Path. Tried four methods, any did not help. #1 - Win32 - FindFirstVolume/FindNextVolume - ESP not . #2 - SetupDiGetClassDevs, SetupDiEnumDeviceInterfaces, SetupDiGetDeviceInterfaceDetail It is similar with #1. ESP ignores #3 - CM_Get_Device_ID_List_Size, CM_Get_Device_ID_List, CM_Locate_DevNode, CM_Locate_DevNode ESP in results is, o it was not possible to derive DevicePath which CreateFile would accept (Invalid Parameter) #4 - SetupDiGetClassDevs, SetupDiEnumDeviceInfo, SetupDiCreateDeviceInterface, SetupDiGetDeviceInterfaceDetail it is similar #3 Somebody knows the correct method to receive  from user mode?

2

Re: To receive handle EFI system partition

Hello, dwebster, you wrote: D> Greetings, D>... D>#3 - CM_Get_Device_ID_List_Size, CM_Get_Device_ID_List, CM_Locate_DevNode, CM_Locate_DevNode D> ESP in results is, o it was not possible to derive DevicePath which CreateFile would accept (Invalid Parameter) D>... D> Somebody knows the correct method to receive  from user mode? So tried?

3

Re: To receive handle EFI system partition

Hello, rumit7, you wrote: R> so tried? Yes, it #3 also is. Produces the list in a type \Device\HarddiskVolume2 \Device\HarddiskVolume3..... But these ways are not suitable for transmission in CreateFile (invalid parameter)

4

Re: To receive handle EFI system partition

Hello, dwebster, you wrote: D> Hello, rumit7, you wrote: R>> so tried? D> yes, it #3 also is. D> produces the list in the form of D> \Device\HarddiskVolume2 D> \Device\HarddiskVolume3 D>..... D> But these ways are not suitable for transmission in CreateFile (invalid parameter) and if to feed NtOpenFile as on SO? UPD. Here too like a working example, I can not check up unfortunately

5

Re: To receive handle EFI system partition

Hello, dwebster, you wrote: D> \Device\HarddiskVolume2 D> \Device\HarddiskVolume3 D>..... D> But these ways are not suitable for transmission in CreateFile (invalid parameter) Add GLOBALROOT: \\? \GLOBALROOT\Device\HarddiskVolume2 \\? \GLOBALROOT\Device\HarddiskVolume3 auto handle = CreateFile ("\\\\? \\GLOBALROOT \\Device \\HarddiskVolume2", GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);

6

Re: To receive handle EFI system partition

Hello, Conr, you wrote: a C> Add GLOBALROOT: a C> \\? \GLOBALROOT\Device\HarddiskVolume2 a C> \\? \GLOBALROOT\Device\HarddiskVolume3 a C> a C> auto handle = CreateFile ("\\\\? \\GLOBALROOT \\Device \\HarddiskVolume2", a C> GENERIC_READ|GENERIC_WRITE, a C> FILE_SHARE_READ|FILE_SHARE_WRITE, a C> NULL, a C> OPEN_EXISTING, a C> FILE_ATTRIBUTE_NORMAL, a C> NULL); a C> it is valid. Thanks!)

7

Re: To receive handle EFI system partition

Hello, rumit7, you wrote: R> and if to feed NtOpenFile as on SO? R> UPD. Here too like a working example, I can not check up unfortunately Yes so too works. But the method with adding GLOBALROOT, offered Conr, is easier than Thanks!