Revision: 14588 http://sourceforge.net/p/edk2/code/14588 Author: niruiyu Date: 2013-08-22 05:44:23 +0000 (Thu, 22 Aug 2013) Log Message: ----------- 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...@intel.com> Reviewed-by: Eric Dong <eric.d...@intel.com> Modified Paths: -------------- trunk/edk2/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c Modified: trunk/edk2/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c =================================================================== --- trunk/edk2/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c 2013-08-22 05:15:05 UTC (rev 14587) +++ trunk/edk2/Nt32Pkg/WinNtBlockIoDxe/WinNtBlockIo.c 2013-08-22 05:44:23 UTC (rev 14588) @@ -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 @@ // 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) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Introducing Performance Central, a new site from SourceForge and AppDynamics. Performance Central is your source for news, insights, analysis and resources for efficient Application Performance Management. Visit us today! http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk _______________________________________________ edk2-commits mailing list edk2-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/edk2-commits