mirror of
https://github.com/reactos/reactos.git
synced 2024-09-10 04:42:00 +00:00
[KERNEL32]
Fix usage of the 2nd parameter of NtFlushVirtualMemory, in the FlushViewOfFile file. This fixes the creation of "self-extracted" files from executables (e.g. DeviceTree utility from OSR or some Sysinternals tools). CORE-6572 #comment Partly fixed in revision r59793. Now the objinfo.sys file is created without corruption, but there are problems loading the driver itself... This fixes a bug introduced in revision 775 about 14 years ago! Many thanks to Oláf for having debugged DeviceTree and oriented me to the real problem :D svn path=/trunk/; revision=59793
This commit is contained in:
parent
3bb2ee8cd3
commit
3d31c7014a
|
@ -346,16 +346,14 @@ NTAPI
|
||||||
FlushViewOfFile(IN LPCVOID lpBaseAddress,
|
FlushViewOfFile(IN LPCVOID lpBaseAddress,
|
||||||
IN SIZE_T dwNumberOfBytesToFlush)
|
IN SIZE_T dwNumberOfBytesToFlush)
|
||||||
{
|
{
|
||||||
SIZE_T NumberOfBytesToFlush;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
PVOID BaseAddress = (PVOID)lpBaseAddress;
|
||||||
|
SIZE_T NumberOfBytesToFlush = dwNumberOfBytesToFlush;
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
|
|
||||||
/* Save amount of bytes to flush to a local var */
|
|
||||||
NumberOfBytesToFlush = dwNumberOfBytesToFlush;
|
|
||||||
|
|
||||||
/* Flush the view */
|
/* Flush the view */
|
||||||
Status = NtFlushVirtualMemory(NtCurrentProcess(),
|
Status = NtFlushVirtualMemory(NtCurrentProcess(),
|
||||||
(LPVOID)lpBaseAddress,
|
&BaseAddress,
|
||||||
&NumberOfBytesToFlush,
|
&NumberOfBytesToFlush,
|
||||||
&IoStatusBlock);
|
&IoStatusBlock);
|
||||||
if (!NT_SUCCESS(Status) && (Status != STATUS_NOT_MAPPED_DATA))
|
if (!NT_SUCCESS(Status) && (Status != STATUS_NOT_MAPPED_DATA))
|
||||||
|
|
Loading…
Reference in a new issue