mirror of
https://github.com/acidanthera/audk.git
synced 2025-07-31 01:24:12 +02:00
Update PeCoffExtraActionLib for NT32 to allow an app or driver to be loaded more than once. Only the first instance will support source level debug.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9983 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
0628eb2c76
commit
6635217350
@ -160,6 +160,16 @@ AddModHandle (
|
|||||||
PDB_NAME_TO_MOD_HANDLE *TempArray;
|
PDB_NAME_TO_MOD_HANDLE *TempArray;
|
||||||
HANDLE Handle;
|
HANDLE Handle;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Return EFI_ALREADY_STARTED if this DLL has already been loaded
|
||||||
|
//
|
||||||
|
Array = mPdbNameModHandleArray;
|
||||||
|
for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
|
||||||
|
if (Array->PdbPointer != NULL && Array->ModHandle == ModHandle) {
|
||||||
|
return EFI_ALREADY_STARTED;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Array = mPdbNameModHandleArray;
|
Array = mPdbNameModHandleArray;
|
||||||
for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
|
for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
|
||||||
if (Array->PdbPointer == NULL) {
|
if (Array->PdbPointer == NULL) {
|
||||||
@ -266,6 +276,7 @@ PeCoffLoaderRelocateImageExtraAction (
|
|||||||
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
EFI_STATUS Status;
|
||||||
VOID *DllEntryPoint;
|
VOID *DllEntryPoint;
|
||||||
CHAR16 *DllFileName;
|
CHAR16 *DllFileName;
|
||||||
HMODULE Library;
|
HMODULE Library;
|
||||||
@ -333,10 +344,24 @@ PeCoffLoaderRelocateImageExtraAction (
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((Library != NULL) && (DllEntryPoint != NULL)) {
|
if ((Library != NULL) && (DllEntryPoint != NULL)) {
|
||||||
AddModHandle (ImageContext, Library);
|
Status = AddModHandle (ImageContext, Library);
|
||||||
|
if (Status == EFI_ALREADY_STARTED) {
|
||||||
|
//
|
||||||
|
// If the DLL has already been loaded before, then this instance of the DLL can not be debugged.
|
||||||
|
//
|
||||||
|
ImageContext->PdbPointer = NULL;
|
||||||
|
DEBUG ((EFI_D_ERROR, "WARNING: DLL already loaded. No source level debug %s. \n", DllFileName));
|
||||||
|
} else {
|
||||||
|
//
|
||||||
|
// This DLL is not already loaded, so source level debugging is suported.
|
||||||
|
//
|
||||||
ImageContext->EntryPoint = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;
|
ImageContext->EntryPoint = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;
|
||||||
DEBUG ((EFI_D_INFO, "LoadLibraryEx (%s,\n NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName));
|
DEBUG ((EFI_D_INFO, "LoadLibraryEx (%s,\n NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
//
|
||||||
|
// This DLL does not support source level debugging at all.
|
||||||
|
//
|
||||||
DEBUG ((EFI_D_ERROR, "WARNING: No source level debug %s. \n", DllFileName));
|
DEBUG ((EFI_D_ERROR, "WARNING: No source level debug %s. \n", DllFileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user