From f7a9c01b65a7bf643c37802b0ad39bac1c565341 Mon Sep 17 00:00:00 2001 From: Michael Martin Date: Tue, 12 May 2009 08:58:38 +0000 Subject: [PATCH] - CreateFileMapping: SetLastError to ERROR_ALREADY_EXISTS for sections that already exists. SetLastError to ERROR_SUCCESS on success for all API's. More kernel32_winetest fixes for virtual. svn path=/trunk/; revision=40893 --- reactos/dll/win32/kernel32/mem/section.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/reactos/dll/win32/kernel32/mem/section.c b/reactos/dll/win32/kernel32/mem/section.c index 92e74a40348..c8f0465149b 100644 --- a/reactos/dll/win32/kernel32/mem/section.c +++ b/reactos/dll/win32/kernel32/mem/section.c @@ -138,6 +138,13 @@ CreateFileMappingW(HANDLE hFile, flProtect, Attributes, hFile); + + if (Status == STATUS_OBJECT_NAME_EXISTS) + { + SetLastError(ERROR_ALREADY_EXISTS); + return SectionHandle; + } + if (!NT_SUCCESS(Status)) { /* We failed */ @@ -145,6 +152,7 @@ CreateFileMappingW(HANDLE hFile, return NULL; } + SetLastError(ERROR_SUCCESS); /* Return the section */ return SectionHandle; } @@ -211,6 +219,7 @@ MapViewOfFileEx(HANDLE hFileMappingObject, return NULL; } + SetLastError(ERROR_SUCCESS); /* Return the base */ return ViewBase; } @@ -253,6 +262,7 @@ UnmapViewOfFile(LPCVOID lpBaseAddress) return FALSE; } + SetLastError(ERROR_SUCCESS); /* Otherwise, return sucess */ return TRUE; } @@ -343,6 +353,7 @@ OpenFileMappingW(DWORD dwDesiredAccess, return NULL; } + SetLastError(ERROR_SUCCESS); /* Otherwise, return the handle */ return SectionHandle; } @@ -374,6 +385,7 @@ FlushViewOfFile(LPCVOID lpBaseAddress, return FALSE; } + SetLastError(ERROR_SUCCESS); /* Return success */ return TRUE; }