]> code.delx.au - refind/blobdiff - refind/driver_support.c
Fixed bug that caused volume icons to be read only from default icons
[refind] / refind / driver_support.c
index e04dd9d28db644afe0a2f90f6ae01b7a48ace3e0..a547d654d25e6f2b9fc3f08f9234b3191a1cdfcd 100644 (file)
  */
 
 #include "driver_support.h"
-#include "refit_call_wrapper.h"
+#include "lib.h"
+#include "../include/refit_call_wrapper.h"
 
+#ifdef __MAKEWITH_GNUEFI
 // Following "global" constants are from EDK2's AutoGen.c....
 EFI_GUID gEfiLoadedImageProtocolGuid = { 0x5B1B31A1, 0x9562, 0x11D2, { 0x8E, 0x3F, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
 EFI_GUID gEfiDriverBindingProtocolGuid = { 0x18A031AB, 0xB443, 0x4D1A, { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 }};
@@ -31,6 +33,7 @@ EFI_GUID gEfiDriverDiagnostics2ProtocolGuid = { 0x4D330321, 0x025F, 0x4AAC, { 0x
 EFI_GUID gEfiComponentNameProtocolGuid = { 0x107A772C, 0xD5E1, 0x11D4, { 0x9A, 0x46, 0x00, 0x90, 0x27, 0x3F, 0xC1, 0x4D }};
 EFI_GUID gEfiComponentName2ProtocolGuid = { 0x6A7A5CFF, 0xE8D9, 0x4F70, { 0xBA, 0xDA, 0x75, 0xAB, 0x30, 0x25, 0xCE, 0x14 }};
 EFI_GUID gEfiDevicePathProtocolGuid = { 0x09576E91, 0x6D3F, 0x11D2, { 0x8E, 0x39, 0x00, 0xA0, 0xC9, 0x69, 0x72, 0x3B }};
+#endif
 
 // Below is from http://git.etherboot.org/?p=mirror/efi/shell/.git;a=commitdiff;h=b1b0c63423cac54dc964c2930e04aebb46a946ec;
 // Seems to have been replaced by ParseHandleDatabaseByRelationshipWithType(), but the latter isn't working for me....
@@ -56,14 +59,14 @@ LibScanHandleDatabase (
   UINTN                               OpenInfoIndex;
   UINTN                               ChildIndex;
   BOOLEAN                             DriverBindingHandleIndexValid;
-  BOOLEAN                             ControllerHandleIndexValid;
+//  BOOLEAN                             ControllerHandleIndexValid;
 
   DriverBindingHandleIndexValid = FALSE;
   if (DriverBindingHandleIndex != NULL) {
     *DriverBindingHandleIndex = 0xffffffff;
   }
 
-  ControllerHandleIndexValid = FALSE;
+//  ControllerHandleIndexValid = FALSE;
   if (ControllerHandleIndex != NULL) {
     *ControllerHandleIndex = 0xffffffff;
   }
@@ -108,7 +111,7 @@ LibScanHandleDatabase (
 
     if (ControllerHandle != NULL && ControllerHandleIndex != NULL && (*HandleBuffer)[HandleIndex] == ControllerHandle) {
       *ControllerHandleIndex      = (UINT32) HandleIndex;
-      ControllerHandleIndexValid  = TRUE;
+//      ControllerHandleIndexValid  = TRUE;
     }
 
   }
@@ -226,24 +229,19 @@ LibScanHandleDatabase (
             }
           }
 
-          FreePool (OpenInfo);
+          MyFreePool (OpenInfo);
         }
       }
 
-      FreePool (ProtocolGuidArray);
+      MyFreePool (ProtocolGuidArray);
     }
   }
 
   return EFI_SUCCESS;
 
 Error:
-  if (*HandleType != NULL) {
-    FreePool (*HandleType);
-  }
-
-  if (*HandleBuffer != NULL) {
-    FreePool (*HandleBuffer);
-  }
+  MyFreePool (*HandleType);
+  MyFreePool (*HandleBuffer);
 
   *HandleCount  = 0;
   *HandleBuffer = NULL;