]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Update PeCoffExtraActionLib for NT32 to allow an app or driver to be loaded more...
authormdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 11 Feb 2010 04:32:34 +0000 (04:32 +0000)
committermdkinney <mdkinney@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 11 Feb 2010 04:32:34 +0000 (04:32 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9983 6f19259b-4bc3-4df7-8a09-765794883524

Nt32Pkg/Library/DxeNt32PeCoffExtraActionLib/DxeNt32PeCoffExtraActionLib.c

index bead36ae15e672cc2e56fbbe3c39195172e14ec5..93a2044cac46b11d564e2c70045d53b4f4ad1167 100644 (file)
@@ -160,6 +160,16 @@ AddModHandle (
   PDB_NAME_TO_MOD_HANDLE  *TempArray;\r
   HANDLE                  Handle;\r
 \r
+  //\r
+  // Return EFI_ALREADY_STARTED if this DLL has already been loaded\r
+  //\r
+  Array = mPdbNameModHandleArray;\r
+  for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {\r
+    if (Array->PdbPointer != NULL && Array->ModHandle == ModHandle) {\r
+      return EFI_ALREADY_STARTED;\r
+    }\r
+  }\r
+  \r
   Array = mPdbNameModHandleArray;\r
   for (Index = 0; Index < mPdbNameModHandleArraySize; Index++, Array++) {\r
     if (Array->PdbPointer == NULL) {\r
@@ -266,6 +276,7 @@ PeCoffLoaderRelocateImageExtraAction (
   IN OUT PE_COFF_LOADER_IMAGE_CONTEXT  *ImageContext\r
   )\r
 {\r
+  EFI_STATUS        Status;\r
   VOID              *DllEntryPoint;\r
   CHAR16            *DllFileName;\r
   HMODULE           Library;\r
@@ -333,10 +344,24 @@ PeCoffLoaderRelocateImageExtraAction (
     }\r
 \r
     if ((Library != NULL) && (DllEntryPoint != NULL)) {\r
-      AddModHandle (ImageContext, Library);\r
-      ImageContext->EntryPoint  = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;\r
-      DEBUG ((EFI_D_INFO, "LoadLibraryEx (%s,\n               NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName));\r
+      Status = AddModHandle (ImageContext, Library);\r
+      if (Status == EFI_ALREADY_STARTED) {\r
+        //\r
+        // If the DLL has already been loaded before, then this instance of the DLL can not be debugged.\r
+        //\r
+        ImageContext->PdbPointer = NULL;\r
+        DEBUG ((EFI_D_ERROR, "WARNING: DLL already loaded.  No source level debug %s. \n", DllFileName));\r
+      } else {\r
+        //\r
+        // This DLL is not already loaded, so source level debugging is suported.\r
+        //\r
+        ImageContext->EntryPoint  = (EFI_PHYSICAL_ADDRESS) (UINTN) DllEntryPoint;\r
+        DEBUG ((EFI_D_INFO, "LoadLibraryEx (%s,\n               NULL, DONT_RESOLVE_DLL_REFERENCES)\n", DllFileName));\r
+      }\r
     } else {\r
+      //\r
+      // This DLL does not support source level debugging at all.\r
+      //\r
       DEBUG ((EFI_D_ERROR, "WARNING: No source level debug %s. \n", DllFileName));\r
     }\r
 \r