//\r
gBS = SystemTable->BootServices;\r
\r
- //\r
- // Retrieve the Loaded Image Protocol\r
- //\r
- Status = gBS->HandleProtocol (\r
- ImageHandle,\r
- &gEfiLoadedImageProtocolGuid,\r
- (VOID*)&LoadedImage\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
-\r
//\r
// Retrieve SMM Base Protocol\r
//\r
//\r
//\r
if (!InSmm) {\r
+ //\r
+ // Retrieve the Loaded Image Protocol\r
+ //\r
+ Status = gBS->HandleProtocol (\r
+ ImageHandle,\r
+ &gEfiLoadedImageProtocolGuid,\r
+ (VOID*)&LoadedImage\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
//\r
// Retrieve the Device Path Protocol from the DeviceHandle from which this driver was loaded\r
//\r
// Load the image in memory to SMRAM; it will automatically generate the\r
// SMI.\r
//\r
- Status = SmmBase->Register (SmmBase, CompleteFilePath, NULL, 0, &Handle, FALSE);\r
+ Status = SmmBase->Register (SmmBase, CompleteFilePath, LoadedImage->ImageBase, 0, &Handle, FALSE);\r
ASSERT_EFI_ERROR (Status);\r
+ //\r
+ // Optionally install the unload handler\r
+ //\r
+ if (_gDriverUnloadImageCount > 0) {\r
+ Status = gBS->HandleProtocol (\r
+ ImageHandle,\r
+ &gEfiLoadedImageProtocolGuid,\r
+ (VOID **)&LoadedImage\r
+ );\r
+ ASSERT_EFI_ERROR (Status);\r
+ LoadedImage->Unload = _DriverUnloadHandler;\r
+ }\r
+\r
return Status;\r
}\r
\r
//\r
ProcessLibraryConstructorList (ImageHandle, SystemTable);\r
\r
- //\r
- // Optionally install the unload handler\r
- //\r
- if (_gDriverUnloadImageCount > 0) {\r
- Status = gBS->HandleProtocol (\r
- ImageHandle,\r
- &gEfiLoadedImageProtocolGuid,\r
- (VOID **)&LoadedImage\r
- );\r
- ASSERT_EFI_ERROR (Status);\r
- LoadedImage->Unload = _DriverUnloadHandler;\r
- }\r
-\r
//\r
// Call the list of driver entry points\r
//\r