Fetching additional resources from UEFI program when loaded over PXE

I have an UEFI program that requires additional files from the same medium it was started from. This works fine when booting from disk or USB; I can get the device path for the program itself by requesting the EFI_DEVICE_PATH_PROTOCOL (as EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL) from the handle passed to efi_main, and then I modify the path element at the end to find the other files.

When loading via PXE however, the device path I get only contains the path to the Ethernet adapter and the IP protocol:


The handle only has EFI_LOADED_IMAGE_PROTOCOL and EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL attached, and the FilePath member of the former is an empty path.

  • Do I still have an IP configuration at this point, or has this been discarded?
  • Can I find out where the current executable was loaded from?
  • Can I otherwise express “relative to the current executable”?

In principle I could also repeat the PXE boot, but the PXE menu might contain multiple TFTP servers for different OS installations, so

  • Can I recover the “active” PXE menu entry?