]> git.proxmox.com Git - mirror_edk2.git/commitdiff
Do not lock the volume when the volume maps to a file instead of a physical disk.
authorRuiyu Ni <ruiyu.ni@intel.com>
Thu, 22 Aug 2013 05:44:23 +0000 (05:44 +0000)
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>
Thu, 22 Aug 2013 05:44:23 +0000 (05:44 +0000)
Otherwise WriteBlocks() on the volume which maps to a file will fail.

Signed-off-by: Ruiyu Ni <ruiyu.ni@intel.com>
Reviewed-by: Eric Dong <eric.dong@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@14588 6f19259b-4bc3-4df7-8a09-765794883524

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