kernelbase-ReOpenFile: Use a handle we know is invalid.

Also fixes a compiler warning spotted by Marcus Meissner.
This commit is contained in:
Zebediah Figura 2019-12-05 10:43:54 -06:00
parent af616c5fc3
commit 3a14d63abf

View File

@ -1,4 +1,4 @@
From e42bb02d6f8feecac8b6c57a84ac90003ca99e79 Mon Sep 17 00:00:00 2001
From 94fa98ee5bb6e098d6d22f05332da3fe814b112b Mon Sep 17 00:00:00 2001
From: Louis Lenders <xerox.xerox2000x@gmail.com>
Date: Fri, 4 Oct 2019 23:10:29 +0200
Subject: [PATCH] kernelbase: Improve stub for ReOpenFile and add small test
@ -12,7 +12,7 @@ Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
2 files changed, 76 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 5bd168276f..67e56e0950 100644
index 5bd168276..0ed5aa6f0 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -59,6 +59,7 @@ static BOOL (WINAPI *pRtlDosPathNameToNtPathName_U)(LPCWSTR, PUNICODE_STRING, PW
@ -51,7 +51,7 @@ index 5bd168276f..67e56e0950 100644
+
+ /* Test calling with invalid handle */
+ SetLastError(0xcafecafe);
+ h = pReOpenFile(0xfafa, GENERIC_WRITE, FILE_SHARE_WRITE, FILE_FLAG_DELETE_ON_CLOSE);
+ h = pReOpenFile(INVALID_HANDLE_VALUE, GENERIC_WRITE, FILE_SHARE_WRITE, FILE_FLAG_DELETE_ON_CLOSE);
+ ok(h == INVALID_HANDLE_VALUE, "Expected INVALID_HANDLE_VALUE, got %u\n", h);
+ ok(GetLastError() == ERROR_INVALID_HANDLE, "Expected ERROR_INVALID_HANDLE, got %u\n", GetLastError());
+
@ -91,7 +91,7 @@ index 5bd168276f..67e56e0950 100644
test_OpenFileById();
test_SetFileValidData();
diff --git a/dlls/kernelbase/file.c b/dlls/kernelbase/file.c
index aa2ebfcc69..5139913b8b 100644
index 23ca5629a..3a68097f7 100644
--- a/dlls/kernelbase/file.c
+++ b/dlls/kernelbase/file.c
@@ -43,6 +43,8 @@
@ -103,7 +103,7 @@ index aa2ebfcc69..5139913b8b 100644
const WCHAR windows_dir[] = {'C',':','\\','w','i','n','d','o','w','s',0};
const WCHAR system_dir[] = {'C',':','\\','w','i','n','d','o','w','s','\\','s','y','s','t','e','m','3','2',0};
@@ -2127,8 +2129,33 @@ HANDLE WINAPI DECLSPEC_HOTPATCH OpenFileById( HANDLE handle, LPFILE_ID_DESCRIPTO
@@ -2159,8 +2161,33 @@ HANDLE WINAPI DECLSPEC_HOTPATCH OpenFileById( HANDLE handle, LPFILE_ID_DESCRIPTO
*/
HANDLE WINAPI /* DECLSPEC_HOTPATCH */ ReOpenFile( HANDLE handle, DWORD access, DWORD sharing, DWORD flags )
{
@ -140,5 +140,5 @@ index aa2ebfcc69..5139913b8b 100644
--
2.17.1
2.23.0