]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/WinNtBlockIoDxe/DriverDiagnostics.c
UefiCpuPkg: Remove double \r
[mirror_edk2.git] / Nt32Pkg / WinNtBlockIoDxe / DriverDiagnostics.c
index 1bfa3059b5eea5e90e9d1b219512e8538a4e8601..aebb74440064da75ee54b078f83483ab620424cc 100644 (file)
@@ -1,13 +1,7 @@
-/*++\r
-\r
-Copyright (c) 2006 - 2007, Intel Corporation\r
-All rights reserved. This program and the accompanying materials\r
-are licensed and made available under the terms and conditions of the BSD License\r
-which accompanies this distribution.  The full text of the license may be found at\r
-http://opensource.org/licenses/bsd-license.php\r
+/**@file\r
 \r
-THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
-WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+Copyright (c) 2006 - 2011, Intel Corporation. All rights reserved.<BR>\r
+SPDX-License-Identifier: BSD-2-Clause-Patent\r
 \r
 Module Name:\r
 \r
@@ -15,7 +9,7 @@ Module Name:
 \r
 Abstract:\r
 \r
---*/\r
+**/\r
 #include <Uefi.h>\r
 #include <WinNtDxe.h>\r
 #include <Protocol/BlockIo.h>\r
@@ -159,7 +153,7 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
       SupportedLanguages += 3;\r
     } else {\r
       for (Index = 0; SupportedLanguages[Index] != 0 && SupportedLanguages[Index] != ';'; Index++);\r
-      if (AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) {\r
+      if ((AsciiStrnCmp(SupportedLanguages, Language, Index) == 0) && (Language[Index] == 0)) {\r
         Found = TRUE;\r
         break;\r
       }\r
@@ -179,18 +173,25 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
   if (DiagnosticType != EfiDriverDiagnosticTypeStandard) {\r
     *ErrorType  = &gEfiBlockIoProtocolGuid;\r
     *BufferSize = 0x60;\r
-    Buffer = AllocatePool ((UINTN) (*BufferSize));\r
+    *Buffer = AllocatePool ((UINTN) (*BufferSize));\r
     CopyMem (*Buffer, L"Windows Block I/O Driver Diagnostics Failed\n", *BufferSize);\r
     return EFI_DEVICE_ERROR;\r
   }\r
 \r
+  //\r
+  // This is a device driver, so ChildHandle must be NULL.\r
+  //\r
+  if (ChildHandle != NULL) {\r
+    return EFI_UNSUPPORTED;\r
+  }\r
+\r
   //\r
   // Validate controller handle\r
   //\r
   Status = gBS->OpenProtocol (\r
                   ControllerHandle,\r
                   &gEfiWinNtIoProtocolGuid,\r
-                  &BlockIo,\r
+                  (VOID **) &BlockIo,\r
                   gWinNtBlockIoDriverBinding.DriverBindingHandle,\r
                   ControllerHandle,\r
                   EFI_OPEN_PROTOCOL_BY_DRIVER\r
@@ -207,6 +208,7 @@ WinNtBlockIoDriverDiagnosticsRunDiagnostics (
     return EFI_UNSUPPORTED;\r
   }\r
 \r
+  \r
   if (Status == EFI_UNSUPPORTED) {\r
     return Status;\r
   } else if (Status != EFI_ALREADY_STARTED) {\r