summaryrefslogtreecommitdiff
path: root/Nt32Pkg
diff options
context:
space:
mode:
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-11 04:32:34 +0000
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>2010-02-11 04:32:34 +0000
commit66352173507452dc6812269db140a3b2a470e90d (patch)
tree45db8a25e5854158b95320a409db7b3b0144dac7 /Nt32Pkg
parent0628eb2c761c32ab35127201c38cb124562dfa9c (diff)
downloadedk2-platforms-66352173507452dc6812269db140a3b2a470e90d.tar.xz
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
Diffstat (limited to 'Nt32Pkg')
-rw-r--r--Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c31
1 files changed, 28 insertions, 3 deletions
diff --git a/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c b/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c
index bead36ae15..93a2044cac 100644
--- a/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c
+++ b/Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c
@@ -160,6 +160,16 @@ AddModHandle (
PDB_NAME_TO_MOD_HANDLE *TempArray;
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;
for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {
if (Array->PdbPointer == NULL) {
@@ -266,6 +276,7 @@ PeCoffLoaderRelocateImageExtraAction (
IN OUT PE_COFF_LOADER_IMAGE_CONTEXT *ImageContext
)
{
+ EFI_STATUS Status;
VOID *DllEntryPoint;
CHAR16 *DllFileName;
HMODULE Library;
@@ -333,10 +344,24 @@ PeCoffLoaderRelocateImageExtraAction (
}
if ((Library != NULL) && (DllEntryPoint != NULL)) {
- AddModHandle (ImageContext, Library);
- ImageContext->EntryPoint = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;
- DEBUG ((EFI_D_INFO, "LoadLibraryEx (%s,\n NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName));
+ 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;
+ DEBUG ((EFI_D_INFO, "LoadLibraryEx (%s,\n NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName));
+ }
} else {
+ //
+ // This DLL does not support source level debugging at all.
+ //
DEBUG ((EFI_D_ERROR, "WARNING: No source level debug %s. \n", DllFileName));
}