summaryrefslogtreecommitdiff
path: root/Nt32Pkg
diff options
context:
space:
mode:
authorRuiyu Ni <ruiyu.ni@intel.com>2013-08-22 05:44:23 +0000
committerniruiyu <niruiyu@6f19259b-4bc3-4df7-8a09-765794883524>2013-08-22 05:44:23 +0000
commit04492de53f40bb756b521d2a35744b38e08bc2a5 (patch)
treeee1e0514aa4cc70c66e84fafe4755603774d823c /Nt32Pkg
parentde49225db86a2209fc09afb1baade3db1542b0cb (diff)
Do not lock the volume when the volume maps to a file instead of a physical disk.
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
Diffstat (limited to 'Nt32Pkg')
-rw-r--r--Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c b/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c
index 1e12dd520..12924e659 100644
--- a/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c
+++ b/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c
@@ -1,6 +1,6 @@
/**@file
-Copyright (c) 2006 - 2012, Intel Corporation. All rights reserved.<BR>
+Copyright (c) 2006 - 2013, Intel Corporation. All rights reserved.<BR>
This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -990,11 +990,15 @@ WinNtBlockIoWriteBlocks (
// According the Windows requirement, first need to lock the volume before
// write to it.
//
- Locked = Private->WinNtThunk->DeviceIoControl (Private->NtHandle, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &BytesReturned, NULL);
- if (Locked == 0) {
- DEBUG ((EFI_D_INIT, "ReadBlocks: Lock volume failed. (%d)\n", Private->WinNtThunk->GetLastError ()));
- Status = WinNtBlockIoError (Private);
- goto Done;
+ if (Private->DeviceType == EfiWinNtPhysicalDisks) {
+ Locked = Private->WinNtThunk->DeviceIoControl (Private->NtHandle, FSCTL_LOCK_VOLUME, NULL, 0, NULL, 0, &BytesReturned, NULL);
+ if (Locked == 0) {
+ DEBUG ((EFI_D_INIT, "ReadBlocks: Lock volume failed. (%d)\n", Private->WinNtThunk->GetLastError ()));
+ Status = WinNtBlockIoError (Private);
+ goto Done;
+ }
+ } else {
+ Locked = 0;
}
Flag = Private->WinNtThunk->WriteFile (Private->NtHandle, Buffer, (DWORD) BufferSize, (LPDWORD) &BytesWritten, NULL);
if (Locked != 0) {