]> git.proxmox.com Git - mirror_edk2.git/blobdiff - Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c
Do not lock the volume when the volume maps to a file instead of a physical disk.
[mirror_edk2.git] / Nt32Pkg / WinNtBlockIoDxe / WinNtBlockIo.c
index 1e12dd5204e46ce9c124d669da2e26aee6c30543..12924e659fbab77db9475d748767c5e8aebd792f 100644 (file)
@@ -1,6 +1,6 @@
 /**@file\r
 \r
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>\r
 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
@@ -990,11 +990,15 @@ WinNtBlockIoWriteBlocks (
   // According the Windows requirement, first need to lock the volume before \r
   // write to it.\r
   //\r
-  Locked = Private->WinNtThunk->DeviceIoControl (Private->NtHandle, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &BytesReturned, NULL);\r
-  if (Locked == 0) {\r
-    DEBUG ((EFI_D_INIT, "ReadBlocks: Lock volume failed. (%d)\n", Private->WinNtThunk->GetLastError ()));\r
-    Status = WinNtBlockIoError (Private);\r
-    goto Done;\r
+  if (Private->DeviceType == EfiWinNtPhysicalDisks) {\r
+    Locked = Private->WinNtThunk->DeviceIoControl (Private->NtHandle, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &BytesReturned, NULL);\r
+    if (Locked == 0) {\r
+      DEBUG ((EFI_D_INIT, "ReadBlocks: Lock volume failed. (%d)\n", Private->WinNtThunk->GetLastError ()));\r
+      Status = WinNtBlockIoError (Private);\r
+      goto Done;\r
+    }\r
+  } else {\r
+    Locked = 0;\r
   }\r
   Flag = Private->WinNtThunk->WriteFile (Private->NtHandle, Buffer, (DWORD) BufferSize, (LPDWORD) &BytesWritten, NULL);\r
   if (Locked != 0) {\r