summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
d60f6af)
Signed-off-by: ydong10
Reviewed-by: niruiyu
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@13013
6f19259b-4bc3-4df7-8a09-
765794883524
-Copyright (c) 2006 - 2007, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2006 - 2012, 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
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
WIN_NT_BLOCK_IO_PRIVATE *Private;\r
UINTN BytesWritten;\r
BOOL Flag;\r
WIN_NT_BLOCK_IO_PRIVATE *Private;\r
UINTN BytesWritten;\r
BOOL Flag;\r
EFI_STATUS Status;\r
EFI_TPL OldTpl;\r
EFI_STATUS Status;\r
EFI_TPL OldTpl;\r
\r
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
\r
OldTpl = gBS->RaiseTPL (TPL_CALLBACK);\r
\r
+ //\r
+ // 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
+ }\r
Flag = Private->WinNtThunk->WriteFile (Private->NtHandle, Buffer, (DWORD) BufferSize, (LPDWORD) &BytesWritten, NULL);\r
Flag = Private->WinNtThunk->WriteFile (Private->NtHandle, Buffer, (DWORD) BufferSize, (LPDWORD) &BytesWritten, NULL);\r
+ if (Locked != 0) {\r
+ Private->WinNtThunk->DeviceIoControl (Private->NtHandle, FSCTL_UNLOCK_VOLUME, NULL, 0, NULL, 0, &BytesReturned, NULL);\r
+ }\r
if (!Flag || (BytesWritten != BufferSize)) {\r
DEBUG ((EFI_D_INIT, "ReadBlocks: WriteFile failed. (%d)\n", Private->WinNtThunk->GetLastError ()));\r
Status = WinNtBlockIoError (Private);\r
if (!Flag || (BytesWritten != BufferSize)) {\r
DEBUG ((EFI_D_INIT, "ReadBlocks: WriteFile failed. (%d)\n", Private->WinNtThunk->GetLastError ()));\r
Status = WinNtBlockIoError (Private);\r