private void retrievePEHeaderInformation() {
		Program program = applicator.getProgram();
		if (program == null) {
			applicator.pdbLogAndErrorMessage(this,
				"Unable to retrieve Program header: program null", null);
			return;
		}

		List<FileBytes> allFileBytes = program.getMemory().getAllFileBytes();
		if (allFileBytes.isEmpty()) {
			applicator.pdbLogAndErrorMessage(this,
				"Unable to retrieve Program header: no FileBytes", null);
			return;
		}
		FileBytes fileBytes = allFileBytes.get(0); // Should be that of main imported file
		ByteProvider provider = new FileBytesProvider(fileBytes); // close not required
		try {
			PortableExecutable pe =
				new PortableExecutable(provider, SectionLayout.FILE, true, true);
			NTHeader ntHeader = pe.getNTHeader(); // will be null if header parse fails
			if (ntHeader == null) {
				applicator.pdbLogAndErrorMessage(this, "Unable to retrieve NTHeader from PE", null);
				return;
			}
			OptionalHeader optionalHeader = ntHeader.getOptionalHeader();
			originalImageBase = optionalHeader.getImageBase();
			int characteristics = ntHeader.getFileHeader().getCharacteristics();
			isDll = (characteristics & FileHeader.IMAGE_FILE_DLL) == FileHeader.IMAGE_FILE_DLL;
			DataDirectory[] dataDirectory = optionalHeader.getDataDirectories();
			int optionalHeaderCharaceristics = optionalHeader.getDllCharacteristics();
			isAslr = (optionalHeaderCharaceristics &
				OptionalHeader.IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA) == OptionalHeader.IMAGE_DLLCHARACTERISTICS_HIGH_ENTROPY_VA;
			if (OptionalHeader.IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR >= dataDirectory.length) {
				applicator.pdbLogAndErrorMessage(this,
					"Bad index (" + OptionalHeader.IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR +
						") for COMDescriptorDataDirectory in DataDirectory array of size " +
						dataDirectory.length,
					null);
				return;
			}
			COMDescriptorDataDirectory comDir =
				(COMDescriptorDataDirectory) dataDirectory[OptionalHeader.IMAGE_DIRECTORY_ENTRY_COM_DESCRIPTOR];
			ImageCor20Header header = comDir.getHeader();
			if (header == null) {
				applicator.pdbLogAndErrorMessage(this, "COMDir header not available", null);
				return;
			}
			metadataStream = header.getMetadata().getMetadataRoot().getMetadataStream();
		}
		catch (RuntimeException | IOException e) {
			// We do not know what can go wrong.  Some of the header parsing might have issues,
			// and we'd rather log the error and limp on by with whatever other processing we can
			// do than to fail here.
			applicator.pdbLogAndErrorMessage(this,
				"Unable to retrieve program header information: " + e.getMessage(), e);
			return;
		}
	}
Get CLI stream metadata.  Results directly filled into data members
Ghidra/Features/PDB/src/main/java/ghidra/app/util/pdb/pdbapplicator/PdbPeHeaderInfoManager.java