Rebase against a303f9cd101a06b7baf6302a90c8b3f6eb29a03c

This commit is contained in:
Alistair Leslie-Hughes 2018-10-16 09:15:58 +11:00
parent ad4de04511
commit a804fed0f7
8 changed files with 78 additions and 473 deletions

View File

@ -1,4 +1,4 @@
From 5128e0ff8263d52792c16c465869a90736ec76de Mon Sep 17 00:00:00 2001
From 166e7927af7f75184c6a785eb82626282830fc75 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sun, 6 Aug 2017 02:08:05 +0200
Subject: [PATCH] server: Implement support for creating processes using a
@ -15,19 +15,19 @@ Subject: [PATCH] server: Implement support for creating processes using a
7 files changed, 59 insertions(+), 21 deletions(-)
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index c2042b0..5e94fb0 100644
index 95e50e9..699f214 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -2207,7 +2207,7 @@ static NTSTATUS alloc_object_attributes( const SECURITY_ATTRIBUTES *attr, struct
@@ -2184,7 +2184,7 @@ static NTSTATUS alloc_object_attributes( const SECURITY_ATTRIBUTES *attr, struct
* Create a new process. If hFile is a valid handle we have an exe
* file, otherwise it is a Winelib app.
*/
-static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPWSTR env,
+static BOOL create_process( HANDLE token, HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPWSTR env,
LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags, LPSTARTUPINFOW startup,
-static BOOL create_process( HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
+static BOOL create_process( HANDLE token, HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags, const RTL_USER_PROCESS_PARAMETERS *params,
LPPROCESS_INFORMATION info, LPCSTR unixdir,
@@ -2314,6 +2314,7 @@ static BOOL create_process( HANDLE hFile, LPCWSTR filename, LPWSTR cmd_line, LPW
const pe_image_info_t *pe_info, int exec_only )
@@ -2285,6 +2285,7 @@ static BOOL create_process( HANDLE hFile, LPSECURITY_ATTRIBUTES psa, LPSECURITY_
req->access = PROCESS_ALL_ACCESS;
req->cpu = pe_info->cpu;
req->info_size = startup_info_size;
@ -35,45 +35,46 @@ index c2042b0..5e94fb0 100644
wine_server_add_data( req, objattr, attr_len );
wine_server_add_data( req, startup_info, startup_info_size );
wine_server_add_data( req, params->Environment, (env_end - params->Environment) * sizeof(WCHAR) );
@@ -2431,7 +2432,7 @@ error:
@@ -2401,7 +2402,7 @@ error:
*
* Create a new VDM process for a 16-bit or DOS application.
*/
-static BOOL create_vdm_process( LPCWSTR filename, LPWSTR cmd_line, LPWSTR env, LPCWSTR cur_dir,
+static BOOL create_vdm_process( HANDLE token, LPCWSTR filename, LPWSTR cmd_line, LPWSTR env, LPCWSTR cur_dir,
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags, LPSTARTUPINFOW startup,
-static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
+static BOOL create_vdm_process( HANDLE token, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags, const RTL_USER_PROCESS_PARAMETERS *params,
LPPROCESS_INFORMATION info, LPCSTR unixdir, int exec_only )
@@ -2456,7 +2457,7 @@ static BOOL create_vdm_process( LPCWSTR filename, LPWSTR cmd_line, LPWSTR env, L
sprintfW(new_cmd_line, argsW, winevdm, buffer, cmd_line);
{
@@ -2450,7 +2451,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES
memset( &pe_info, 0, sizeof(pe_info) );
pe_info.cpu = CPU_x86;
- ret = create_process( 0, winevdm, new_cmd_line, env, cur_dir, psa, tsa, inherit,
+ ret = create_process( token, 0, winevdm, new_cmd_line, env, cur_dir, psa, tsa, inherit,
flags, startup, info, unixdir, &pe_info, exec_only );
- ret = create_process( 0, psa, tsa, inherit, flags, new_params, info, unixdir, &pe_info, exec_only );
+ ret = create_process( token, 0, psa, tsa, inherit, flags, new_params, info, unixdir, &pe_info, exec_only );
RtlDestroyProcessParameters( new_params );
HeapFree( GetProcessHeap(), 0, new_cmd_line );
return ret;
@@ -2468,7 +2469,7 @@ static BOOL create_vdm_process( LPCWSTR filename, LPWSTR cmd_line, LPWSTR env, L
@@ -2462,7 +2463,7 @@ static BOOL create_vdm_process( LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES
*
* Create a new cmd shell process for a .BAT file.
*/
-static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, LPCWSTR cur_dir,
+static BOOL create_cmd_process( HANDLE token, LPCWSTR filename, LPWSTR cmd_line, LPVOID env, LPCWSTR cur_dir,
LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
-static BOOL create_cmd_process( LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
+static BOOL create_cmd_process( HANDLE token, LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSECURITY_ATTRIBUTES tsa,
BOOL inherit, DWORD flags, LPSTARTUPINFOW startup,
const RTL_USER_PROCESS_PARAMETERS *params,
LPPROCESS_INFORMATION info )
@@ -2496,8 +2497,8 @@ static BOOL create_cmd_process( LPCWSTR filename, LPWSTR cmd_line, LPVOID env, L
@@ -2491,9 +2492,9 @@ static BOOL create_cmd_process( LPCWSTR cur_dir, LPSECURITY_ATTRIBUTES psa, LPSE
strcatW( newcmdline, quotW );
strcatW( newcmdline, cmd_line );
strcatW( newcmdline, params->CommandLine.Buffer );
strcatW( newcmdline, quotW );
- ret = CreateProcessW( comspec, newcmdline, psa, tsa, inherit,
- flags, env, cur_dir, startup, info );
+ ret = CreateProcessInternalW( token, comspec, newcmdline, psa, tsa, inherit,
+ flags, env, cur_dir, startup, info, NULL );
flags, params->Environment, cur_dir,
- startup, info );
+ startup, info, NULL );
HeapFree( GetProcessHeap(), 0, newcmdline );
return ret;
}
@@ -2609,7 +2610,9 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
@@ -2606,7 +2607,9 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
TRACE("app %s cmdline %s\n", debugstr_w(app_name), debugstr_w(cmd_line) );
@ -84,69 +85,68 @@ index c2042b0..5e94fb0 100644
if (new_token) FIXME("No support for returning created process token\n");
if (!(tidy_cmdline = get_file_name( app_name, cmd_line, name, ARRAY_SIZE( name ), &hFile, &is_64bit )))
@@ -2696,18 +2699,18 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
@@ -2699,18 +2702,18 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
debugstr_w(name), is_64bit_arch(pe_info.cpu) ? 64 : 32,
wine_dbgstr_longlong(pe_info.base), wine_dbgstr_longlong(pe_info.base + pe_info.map_size),
cpu_names[pe_info.cpu] );
- retv = create_process( hFile, name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
+ retv = create_process( NULL, hFile, name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
inherit, flags, startup_info, info, unixdir, &pe_info, FALSE );
- retv = create_process( hFile, process_attr, thread_attr,
+ retv = create_process( NULL, hFile, process_attr, thread_attr,
inherit, flags, params, info, unixdir, &pe_info, FALSE );
break;
case BINARY_WIN16:
TRACE( "starting %s as Win16/DOS binary\n", debugstr_w(name) );
- retv = create_vdm_process( name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
+ retv = create_vdm_process( token, name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
inherit, flags, startup_info, info, unixdir, FALSE );
- retv = create_vdm_process( process_attr, thread_attr,
+ retv = create_vdm_process( token, process_attr, thread_attr,
inherit, flags, params, info, unixdir, FALSE );
break;
case BINARY_UNIX_LIB:
TRACE( "starting %s as %d-bit Winelib app\n",
debugstr_w(name), is_64bit_arch(pe_info.cpu) ? 64 : 32 );
- retv = create_process( hFile, name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
+ retv = create_process( token, hFile, name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
inherit, flags, startup_info, info, unixdir, &pe_info, FALSE );
- retv = create_process( hFile, process_attr, thread_attr,
+ retv = create_process( token, hFile, process_attr, thread_attr,
inherit, flags, params, info, unixdir, &pe_info, FALSE );
break;
case BINARY_UNKNOWN:
@@ -2717,14 +2720,14 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
@@ -2720,14 +2723,14 @@ BOOL WINAPI CreateProcessInternalW( HANDLE token, LPCWSTR app_name, LPWSTR cmd_l
if (!strcmpiW( p, comW ) || !strcmpiW( p, pifW ))
{
TRACE( "starting %s as DOS binary\n", debugstr_w(name) );
- retv = create_vdm_process( name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
+ retv = create_vdm_process( token, name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
inherit, flags, startup_info, info, unixdir, FALSE );
- retv = create_vdm_process( process_attr, thread_attr,
+ retv = create_vdm_process( token, process_attr, thread_attr,
inherit, flags, params, info, unixdir, FALSE );
break;
}
if (!strcmpiW( p, batW ) || !strcmpiW( p, cmdW ) )
{
TRACE( "starting %s as batch binary\n", debugstr_w(name) );
- retv = create_cmd_process( name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
+ retv = create_cmd_process( token, name, tidy_cmdline, envW, cur_dir, process_attr, thread_attr,
inherit, flags, startup_info, info );
- retv = create_cmd_process( cur_dir, process_attr, thread_attr,
+ retv = create_cmd_process( token, cur_dir, process_attr, thread_attr,
inherit, flags, startup_info, params, info );
break;
}
@@ -2840,12 +2843,12 @@ static void exec_process( LPCWSTR name )
@@ -2836,11 +2839,11 @@ static void exec_process( LPCWSTR name )
debugstr_w(name), is_64bit_arch(pe_info.cpu) ? 64 : 32,
wine_dbgstr_longlong(pe_info.base), wine_dbgstr_longlong(pe_info.base + pe_info.map_size),
cpu_names[pe_info.cpu] );
- create_process( hFile, name, GetCommandLineW(), NULL, NULL, NULL, NULL,
+ create_process( NULL, hFile, name, GetCommandLineW(), NULL, NULL, NULL, NULL,
FALSE, 0, &startup_info, &info, NULL, &pe_info, TRUE );
- create_process( hFile, NULL, NULL, FALSE, 0, params, &info, NULL, &pe_info, TRUE );
+ create_process( NULL, hFile, NULL, NULL, FALSE, 0, params, &info, NULL, &pe_info, TRUE );
break;
case BINARY_UNIX_LIB:
TRACE( "%s is a Unix library, starting as Winelib app\n", debugstr_w(name) );
- create_process( hFile, name, GetCommandLineW(), NULL, NULL, NULL, NULL,
+ create_process( NULL, hFile, name, GetCommandLineW(), NULL, NULL, NULL, NULL,
FALSE, 0, &startup_info, &info, NULL, &pe_info, TRUE );
- create_process( hFile, NULL, NULL, FALSE, 0, params, &info, NULL, &pe_info, TRUE );
+ create_process( NULL, hFile, NULL, NULL, FALSE, 0, params, &info, NULL, &pe_info, TRUE );
break;
case BINARY_UNKNOWN:
@@ -2855,7 +2858,7 @@ static void exec_process( LPCWSTR name )
/* check for .com or .pif extension */
@@ -2849,7 +2852,7 @@ static void exec_process( LPCWSTR name )
/* fall through */
case BINARY_WIN16:
TRACE( "starting %s as Win16/DOS binary\n", debugstr_w(name) );
- create_vdm_process( name, GetCommandLineW(), NULL, NULL, NULL, NULL,
+ create_vdm_process( NULL, name, GetCommandLineW(), NULL, NULL, NULL, NULL,
FALSE, 0, &startup_info, &info, NULL, TRUE );
- create_vdm_process( NULL, NULL, FALSE, 0, params, &info, NULL, TRUE );
+ create_vdm_process( NULL, NULL, NULL, FALSE, 0, params, &info, NULL, TRUE );
break;
default:
break;
diff --git a/server/process.c b/server/process.c
index 653e513..2bb49e2 100644
--- a/server/process.c
@ -287,7 +287,7 @@ index 21e90cc..32dfe5f 100644
static inline const ACE_HEADER *ace_next( const ACE_HEADER *ace )
{
diff --git a/server/token.c b/server/token.c
index de1d624..2804247 100644
index 1184241..5db97b4 100644
--- a/server/token.c
+++ b/server/token.c
@@ -836,6 +836,12 @@ int token_assign_label( struct token *token, PSID label )
@ -303,7 +303,7 @@ index de1d624..2804247 100644
struct token *token_create_admin( void )
{
struct token *token = NULL;
@@ -1263,6 +1269,11 @@ const SID *token_get_primary_group( struct token *token )
@@ -1262,6 +1268,11 @@ const SID *token_get_primary_group( struct token *token )
return token->primary_group;
}

View File

@ -1,4 +1,4 @@
From 82d0d3038097d3410feb4e405e4b9f8cd9ced21d Mon Sep 17 00:00:00 2001
From 8397d7b777db5ef44825b639d4009f6e372ca9ad Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Fri, 4 Mar 2016 22:22:42 +0100
Subject: [PATCH] ddraw: Set ddsOldCaps correctly in ddraw7_GetCaps.
@ -12,7 +12,7 @@ Subject: [PATCH] ddraw: Set ddsOldCaps correctly in ddraw7_GetCaps.
5 files changed, 106 insertions(+)
diff --git a/dlls/ddraw/ddraw.c b/dlls/ddraw/ddraw.c
index 37e44e8..a740995 100644
index 8247214..d70f2e2 100644
--- a/dlls/ddraw/ddraw.c
+++ b/dlls/ddraw/ddraw.c
@@ -1544,6 +1544,8 @@ static HRESULT WINAPI ddraw7_GetCaps(IDirectDraw7 *iface, DDCAPS *DriverCaps, DD
@ -25,10 +25,10 @@ index 37e44e8..a740995 100644
if(DriverCaps)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index ee4fa5b..c7b992e 100644
index 1f93a97..9a862e1 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -11539,6 +11539,31 @@ static void test_execute_data(void)
@@ -11543,6 +11543,31 @@ static void test_execute_data(void)
DestroyWindow(window);
}
@ -60,7 +60,7 @@ index ee4fa5b..c7b992e 100644
static void test_viewport(void)
{
static struct
@@ -11973,6 +11998,7 @@ START_TEST(ddraw1)
@@ -12030,6 +12055,7 @@ START_TEST(ddraw1)
test_depth_readback();
test_clear();
test_enum_surfaces();
@ -69,10 +69,10 @@ index ee4fa5b..c7b992e 100644
test_viewport();
test_find_device();
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 9394705..bc213db 100644
index 95cdf8b..d317cc1 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -12801,6 +12801,31 @@ static void test_enum_surfaces(void)
@@ -12805,6 +12805,31 @@ static void test_enum_surfaces(void)
IDirectDraw2_Release(ddraw);
}
@ -104,20 +104,20 @@ index 9394705..bc213db 100644
static void test_viewport(void)
{
static struct
@@ -13264,6 +13289,7 @@ START_TEST(ddraw2)
@@ -13321,6 +13346,7 @@ START_TEST(ddraw2)
test_depth_readback();
test_clear();
test_enum_surfaces();
+ test_caps();
test_viewport();
test_find_device();
}
test_killfocus();
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 6a3630a..1c9acf8 100644
index a62aaf0..e11ec0c 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -15247,6 +15247,31 @@ static void test_find_device(void)
IDirectDraw4_Release(ddraw);
@@ -15318,6 +15318,31 @@ static void test_killfocus(void)
UnregisterClassA("ddraw_killfocus_wndproc_wc", GetModuleHandleA(NULL));
}
+static void test_caps(void)
@ -148,20 +148,20 @@ index 6a3630a..1c9acf8 100644
START_TEST(ddraw4)
{
DDDEVICEIDENTIFIER identifier;
@@ -15372,6 +15397,7 @@ START_TEST(ddraw4)
@@ -15443,6 +15468,7 @@ START_TEST(ddraw4)
test_depth_readback();
test_clear();
test_enum_surfaces();
+ test_caps();
test_viewport();
test_find_device();
}
test_killfocus();
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 70318a8..f3dde43 100644
index 04048d4..ad4f63d 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -15035,6 +15035,31 @@ static void test_color_vertex(void)
DestroyWindow(window);
@@ -15106,6 +15106,31 @@ static void test_killfocus(void)
UnregisterClassA("ddraw_killfocus_wndproc_wc", GetModuleHandleA(NULL));
}
+static void test_caps(void)
@ -192,12 +192,13 @@ index 70318a8..f3dde43 100644
START_TEST(ddraw7)
{
DDDEVICEIDENTIFIER2 identifier;
@@ -15172,5 +15197,6 @@ START_TEST(ddraw7)
@@ -15243,6 +15268,7 @@ START_TEST(ddraw7)
test_enum_surfaces();
test_viewport();
test_device_load();
+ test_caps();
test_color_vertex();
test_killfocus();
}
--
1.9.1

View File

@ -1,108 +0,0 @@
From b7caf681c5fca6f1f6b1e089fc2ecddc47052820 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 15 Nov 2016 12:41:46 +0800
Subject: [PATCH] kernel32/tests: Fix compilation with PSDK.
---
dlls/kernel32/tests/file.c | 23 +++++++++++++----------
1 file changed, 13 insertions(+), 10 deletions(-)
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 19c1c7a..19e7148 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -38,9 +38,7 @@
#include "winnls.h"
#include "fileapi.h"
-#ifdef WINE_NO_UNICODE_MACROS
#undef DeleteFile /* needed for FILE_DISPOSITION_INFO */
-#endif
static HANDLE (WINAPI *pFindFirstFileExA)(LPCSTR,FINDEX_INFO_LEVELS,LPVOID,FINDEX_SEARCH_OPS,LPVOID,DWORD);
static BOOL (WINAPI *pReplaceFileA)(LPCSTR, LPCSTR, LPCSTR, DWORD, LPVOID, LPVOID);
@@ -61,6 +59,8 @@ static BOOL (WINAPI *pRtlDosPathNameToNtPathName_U)(LPCWSTR, PUNICODE_STRING, PW
static NTSTATUS (WINAPI *pRtlAnsiStringToUnicodeString)(PUNICODE_STRING, PCANSI_STRING, BOOLEAN);
static BOOL (WINAPI *pSetFileInformationByHandle)(HANDLE, FILE_INFO_BY_HANDLE_CLASS, void*, DWORD);
static BOOL (WINAPI *pGetQueuedCompletionStatusEx)(HANDLE, OVERLAPPED_ENTRY*, ULONG, ULONG*, DWORD, BOOL);
+static void (WINAPI *pRtlInitAnsiString)(PANSI_STRING,PCSZ);
+static void (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING);
static const char filename[] = "testfile.xxx";
static const char sillytext[] =
@@ -91,6 +91,8 @@ static void InitFunctionPointers(void)
pNtCreateFile = (void *)GetProcAddress(hntdll, "NtCreateFile");
pRtlDosPathNameToNtPathName_U = (void *)GetProcAddress(hntdll, "RtlDosPathNameToNtPathName_U");
pRtlAnsiStringToUnicodeString = (void *)GetProcAddress(hntdll, "RtlAnsiStringToUnicodeString");
+ pRtlInitAnsiString = (void *)GetProcAddress(hntdll, "RtlInitAnsiString");
+ pRtlFreeUnicodeString = (void *)GetProcAddress(hntdll, "RtlFreeUnicodeString");
pFindFirstFileExA=(void*)GetProcAddress(hkernel32, "FindFirstFileExA");
pReplaceFileA=(void*)GetProcAddress(hkernel32, "ReplaceFileA");
@@ -270,7 +272,8 @@ static void get_nt_pathW( const char *name, UNICODE_STRING *nameW )
ANSI_STRING str;
NTSTATUS status;
BOOLEAN ret;
- RtlInitAnsiString( &str, name );
+
+ pRtlInitAnsiString( &str, name );
status = pRtlAnsiStringToUnicodeString( &strW, &str, TRUE );
ok( !status, "RtlAnsiStringToUnicodeString failed with %08x\n", status );
@@ -278,7 +281,7 @@ static void get_nt_pathW( const char *name, UNICODE_STRING *nameW )
ret = pRtlDosPathNameToNtPathName_U( strW.Buffer, nameW, NULL, NULL );
ok( ret, "RtlDosPathNameToNtPathName_U failed\n" );
- RtlFreeUnicodeString( &strW );
+ pRtlFreeUnicodeString( &strW );
}
static void test__lcreat( void )
@@ -354,30 +357,30 @@ static void test__lcreat( void )
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- status = NtCreateFile( &file, GENERIC_READ | GENERIC_WRITE | DELETE, &attr, &io, NULL, 0,
+ status = pNtCreateFile( &file, GENERIC_READ | GENERIC_WRITE | DELETE, &attr, &io, NULL, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN, FILE_DELETE_ON_CLOSE | FILE_NON_DIRECTORY_FILE, NULL, 0 );
ok( status == STATUS_ACCESS_DENIED, "expected STATUS_ACCESS_DENIED, got %08x\n", status );
ok( GetFileAttributesA( filename ) != INVALID_FILE_ATTRIBUTES, "file was deleted\n" );
- status = NtCreateFile( &file, DELETE, &attr, &io, NULL, 0,
+ status = pNtCreateFile( &file, DELETE, &attr, &io, NULL, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN, FILE_DELETE_ON_CLOSE | FILE_NON_DIRECTORY_FILE, NULL, 0 );
ok( status == STATUS_CANNOT_DELETE, "expected STATUS_CANNOT_DELETE, got %08x\n", status );
- status = NtCreateFile( &file, DELETE, &attr, &io, NULL, 0,
+ status = pNtCreateFile( &file, DELETE, &attr, &io, NULL, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN, FILE_DELETE_ON_CLOSE | FILE_DIRECTORY_FILE, NULL, 0 );
ok( status == STATUS_NOT_A_DIRECTORY, "expected STATUS_NOT_A_DIRECTORY, got %08x\n", status );
- status = NtCreateFile( &file, DELETE, &attr, &io, NULL, 0,
+ status = pNtCreateFile( &file, DELETE, &attr, &io, NULL, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE,
FILE_OPEN_IF, FILE_DELETE_ON_CLOSE | FILE_NON_DIRECTORY_FILE, NULL, 0 );
todo_wine
ok( status == STATUS_CANNOT_DELETE, "expected STATUS_CANNOT_DELETE, got %08x\n", status );
if (!status) CloseHandle( file );
- RtlFreeUnicodeString( &filenameW );
+ pRtlFreeUnicodeString( &filenameW );
todo_wine
ok( GetFileAttributesA( filename ) != INVALID_FILE_ATTRIBUTES, "file was deleted\n" );
@@ -4999,7 +5002,7 @@ static void test_SetFileInformationByHandle(void)
{
FILE_ATTRIBUTE_TAG_INFO fileattrinfo = { 0 };
FILE_REMOTE_PROTOCOL_INFO protinfo = { 0 };
- FILE_STANDARD_INFO stdinfo = { };
+ FILE_STANDARD_INFO stdinfo = { {{0}},{{0}},0,FALSE,FALSE };
FILE_COMPRESSION_INFO compressinfo;
FILE_DISPOSITION_INFO dispinfo;
char tempFileName[MAX_PATH];
--
1.9.1

View File

@ -1,63 +0,0 @@
From 068af8dd9650d9a9820c61361dbfea8c8cf9a925 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 15 Nov 2016 12:45:30 +0800
Subject: kernel32/tests: Fix a bunch of access denied errors by using a
dedicated TEMP directory.
---
dlls/kernel32/tests/file.c | 21 ++++++++++++++++++---
1 file changed, 18 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 3d2bffa..ac29eb8 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -61,7 +61,7 @@ static BOOL (WINAPI *pSetFileInformationByHandle)(HANDLE, FILE_INFO_BY_HANDLE_CL
static void (WINAPI *pRtlInitAnsiString)(PANSI_STRING,PCSZ);
static void (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING);
-static const char filename[] = "testfile.xxx";
+static char filename[MAX_PATH];
static const char sillytext[] =
"en larvig liten text dx \033 gx hej 84 hej 4484 ! \001\033 bla bl\na.. bla bla."
"1234 43 4kljf lf &%%%&&&&&& 34 4 34 3############# 33 3 3 3 # 3## 3"
@@ -455,10 +455,15 @@ static void test__lcreat( void )
if (INVALID_HANDLE_VALUE==find)
ok (0, "file \"%s\" not found\n", filename);
else {
+ const char *name = strrchr(filename, '\\');
+
+ if (name) name++;
+ else name = filename;
+
ret = FindClose(find);
ok ( 0 != ret, "FindClose complains (%d)\n", GetLastError ());
- ok (!strcmp (filename, search_results.cFileName),
- "found unexpected name \"%s\"\n", search_results.cFileName);
+ ok (!strcmp (name, search_results.cFileName),
+ "expected \"%s\", got \"%s\"\n", name, search_results.cFileName);
search_results.dwFileAttributes &= ~FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
search_results.dwFileAttributes &= ~FILE_ATTRIBUTE_COMPRESSED;
ok (FILE_ATTRIBUTE_ARCHIVE==search_results.dwFileAttributes,
@@ -4719,8 +4724,18 @@ static void test_GetFileAttributesExW(void)
START_TEST(file)
{
+ char temp_path[MAX_PATH];
+ DWORD ret;
+
InitFunctionPointers();
+ ret = GetTempPathA(MAX_PATH, temp_path);
+ ok(ret != 0, "GetTempPath error %u\n", GetLastError());
+ ret = GetTempFileNameA(temp_path, "tmp", 0, filename);
+ ok(ret != 0, "GetTempFileName error %u\n", GetLastError());
+ ret = DeleteFileA(filename);
+ ok(ret != 0, "DeleteFile error %u\n", GetLastError());
+
test__hread( );
test__hwrite( );
test__lclose( );
--
2.9.0

View File

@ -1,36 +0,0 @@
From e81ccc4ba4bd31af55294ed6f31a119dada088b8 Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 15 Nov 2016 12:47:52 +0800
Subject: kernel32/tests: Move the MoveFile test where it belongs.
---
dlls/kernel32/tests/file.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index d109657..8932d53 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -703,9 +703,6 @@ static void test_CopyFileA(void)
ret = GetTempFileNameA(temp_path, prefix, 0, source);
ok(ret != 0, "GetTempFileNameA error %d\n", GetLastError());
- ret = MoveFileA(source, source);
- todo_wine ok(ret, "MoveFileA: failed, error %d\n", GetLastError());
-
/* copying a file to itself must fail */
retok = CopyFileA(source, source, FALSE);
ok( !retok && (GetLastError() == ERROR_SHARING_VIOLATION || broken(GetLastError() == ERROR_FILE_EXISTS) /* Win 9x */),
@@ -1887,6 +1884,9 @@ static void test_MoveFileA(void)
ret = GetTempFileNameA(tempdir, prefix, 0, dest);
ok(ret != 0, "GetTempFileNameA error %d\n", GetLastError());
+ ret = MoveFileA(source, source);
+ todo_wine ok(ret, "MoveFileA: failed, error %d\n", GetLastError());
+
ret = MoveFileA(source, dest);
ok(!ret && GetLastError() == ERROR_ALREADY_EXISTS,
"MoveFileA: unexpected error %d\n", GetLastError());
--
2.9.0

View File

@ -1,104 +0,0 @@
From de4b7a3055065faed4cdc9ca253248eed5a3a7bb Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 15 Nov 2016 13:02:13 +0800
Subject: [PATCH] kernel32: MoveFile(source, source) should succeed.
---
dlls/kernel32/path.c | 15 ++++++++++-----
dlls/kernel32/tests/file.c | 2 +-
dlls/msvcp120/tests/msvcp120.c | 2 +-
programs/cmd/tests/test_builtins.cmd.exp | 4 ++--
4 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index bde58e9dc4..c7c5cbd3f7 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1354,7 +1354,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
OBJECT_ATTRIBUTES attr;
IO_STATUS_BLOCK io;
NTSTATUS status;
- HANDLE source_handle = 0, dest_handle;
+ HANDLE source_handle = 0, dest_handle = 0;
ANSI_STRING source_unix, dest_unix;
DWORD options;
@@ -1414,18 +1414,22 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
status = NtOpenFile( &dest_handle, GENERIC_READ | GENERIC_WRITE | SYNCHRONIZE, &attr, &io, 0, options );
if (status == STATUS_SUCCESS) /* destination exists */
{
- NtClose( dest_handle );
if (!(flag & MOVEFILE_REPLACE_EXISTING))
{
- SetLastError( ERROR_ALREADY_EXISTS );
- RtlFreeUnicodeString( &nt_name );
- goto error;
+ if (!is_same_file( source_handle, dest_handle ))
+ {
+ SetLastError( ERROR_ALREADY_EXISTS );
+ RtlFreeUnicodeString( &nt_name );
+ goto error;
+ }
}
else if (info.FileAttributes & FILE_ATTRIBUTE_DIRECTORY) /* cannot replace directory */
{
SetLastError( ERROR_ACCESS_DENIED );
goto error;
}
+
+ NtClose( dest_handle );
}
else if (status != STATUS_OBJECT_NAME_NOT_FOUND)
{
@@ -1485,6 +1489,7 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
error:
if (source_handle) NtClose( source_handle );
+ if (dest_handle) NtClose( dest_handle );
RtlFreeAnsiString( &source_unix );
RtlFreeAnsiString( &dest_unix );
return FALSE;
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index ef4eebc31c..07b3ffb77b 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1886,7 +1886,7 @@ static void test_MoveFileA(void)
ok(ret != 0, "GetTempFileNameA error %d\n", GetLastError());
ret = MoveFileA(source, source);
- todo_wine ok(ret, "MoveFileA: failed, error %d\n", GetLastError());
+ ok(ret, "MoveFileA: failed, error %d\n", GetLastError());
ret = MoveFileA(source, dest);
ok(!ret && GetLastError() == ERROR_ALREADY_EXISTS,
diff --git a/dlls/msvcp120/tests/msvcp120.c b/dlls/msvcp120/tests/msvcp120.c
index d7b82a3aae..5141622d6a 100644
--- a/dlls/msvcp120/tests/msvcp120.c
+++ b/dlls/msvcp120/tests/msvcp120.c
@@ -1524,7 +1524,7 @@ static void test_tr2_sys__Rename(void)
CloseHandle(file);
ret = p_tr2_sys__Rename("tr2_test_dir\\f1", "tr2_test_dir\\f1");
- todo_wine ok(ERROR_SUCCESS == ret, "test_tr2_sys__Rename(): expect: ERROR_SUCCESS, got %d\n", ret);
+ ok(ERROR_SUCCESS == ret, "test_tr2_sys__Rename(): expect: ERROR_SUCCESS, got %d\n", ret);
for(i=0; i<ARRAY_SIZE(tests); i++) {
errno = 0xdeadbeef;
if(tests[i].val == ERROR_SUCCESS) {
diff --git a/programs/cmd/tests/test_builtins.cmd.exp b/programs/cmd/tests/test_builtins.cmd.exp
index ea4157c09d..298c4e9a9e 100644
--- a/programs/cmd/tests/test_builtins.cmd.exp
+++ b/programs/cmd/tests/test_builtins.cmd.exp
@@ -1295,8 +1295,8 @@ file move succeeded
@todo_wine@bar@or_broken@baz
read-only files are moveable
file moved in subdirectory
-@todo_wine@moving a file to itself is a no-op@or_broken@moving a file to itself should be a no-op!
-@todo_wine@ErrorLevel: 0@or_broken@ErrorLevel: 1
+moving a file to itself is a no-op@or_broken@moving a file to itself should be a no-op!
+ErrorLevel: 0@or_broken@ErrorLevel: 1
--- directory move
simple directory move succeeded
moving a directory to itself gives error; errlevel 1
--
2.18.0

View File

@ -1,74 +0,0 @@
From 8031fda3ffc4d2469524f21198ef0aaf9725562e Mon Sep 17 00:00:00 2001
From: Dmitry Timoshkov <dmitry@baikal.ru>
Date: Tue, 15 Nov 2016 13:32:42 +0800
Subject: [PATCH] kernel32: MoveFile should make sure that it has the delete
access to the source file.
---
dlls/kernel32/path.c | 4 ++--
dlls/kernel32/tests/file.c | 20 ++++++++------------
2 files changed, 10 insertions(+), 14 deletions(-)
diff --git a/dlls/kernel32/path.c b/dlls/kernel32/path.c
index c7c5cbd3f7..5388586094 100644
--- a/dlls/kernel32/path.c
+++ b/dlls/kernel32/path.c
@@ -1383,7 +1383,8 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
attr.SecurityDescriptor = NULL;
attr.SecurityQualityOfService = NULL;
- status = NtOpenFile( &source_handle, SYNCHRONIZE, &attr, &io, 0, FILE_SYNCHRONOUS_IO_NONALERT );
+ status = NtOpenFile( &source_handle, DELETE | SYNCHRONIZE, &attr, &io,
+ FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_SYNCHRONOUS_IO_NONALERT );
if (status == STATUS_SUCCESS)
status = wine_nt_to_unix_file_name( &nt_name, &source_unix, FILE_OPEN, FALSE );
RtlFreeUnicodeString( &nt_name );
@@ -1407,7 +1408,6 @@ BOOL WINAPI MoveFileWithProgressW( LPCWSTR source, LPCWSTR dest,
SetLastError( ERROR_PATH_NOT_FOUND );
goto error;
}
-
options = FILE_NON_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT;
if (flag & MOVEFILE_WRITE_THROUGH)
options |= FILE_WRITE_THROUGH;
diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c
index 07b3ffb77b..4729e75728 100644
--- a/dlls/kernel32/tests/file.c
+++ b/dlls/kernel32/tests/file.c
@@ -1906,12 +1906,10 @@ static void test_MoveFileA(void)
ok(hmapfile != NULL, "CreateFileMapping: error %d\n", GetLastError());
ret = MoveFileA(source, dest);
- todo_wine {
- ok(!ret, "MoveFileA: expected failure\n");
- ok(GetLastError() == ERROR_SHARING_VIOLATION ||
- broken(GetLastError() == ERROR_ACCESS_DENIED), /* Win9x and WinMe */
- "MoveFileA: expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
- }
+ ok(!ret, "MoveFileA: expected failure\n");
+ ok(GetLastError() == ERROR_SHARING_VIOLATION ||
+ broken(GetLastError() == ERROR_ACCESS_DENIED), /* Win9x and WinMe */
+ "MoveFileA: expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
CloseHandle(hmapfile);
CloseHandle(hfile);
@@ -1926,12 +1924,10 @@ static void test_MoveFileA(void)
ok(hmapfile != NULL, "CreateFileMapping: error %d\n", GetLastError());
ret = MoveFileA(source, dest);
- todo_wine {
- ok(!ret, "MoveFileA: expected failure\n");
- ok(GetLastError() == ERROR_SHARING_VIOLATION ||
- broken(GetLastError() == ERROR_ACCESS_DENIED), /* Win9x and WinMe */
- "MoveFileA: expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
- }
+ ok(!ret, "MoveFileA: expected failure\n");
+ ok(GetLastError() == ERROR_SHARING_VIOLATION ||
+ broken(GetLastError() == ERROR_ACCESS_DENIED), /* Win9x and WinMe */
+ "MoveFileA: expected ERROR_SHARING_VIOLATION, got %d\n", GetLastError());
CloseHandle(hmapfile);
CloseHandle(hfile);
--
2.18.0

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "3f4455c0f043650151873d899e6f7526b994fa93"
echo "a303f9cd101a06b7baf6302a90c8b3f6eb29a03c"
}
# Show version information
@ -3995,23 +3995,12 @@ fi
# | * [#14901] MoveFile with source == dest should succeed.
# |
# | Modified files:
# | * dlls/appwiz.cpl/addons.c, dlls/kernel32/path.c, dlls/kernel32/tests/file.c, dlls/msvcp120/tests/msvcp120.c,
# | dlls/urlmon/tests/url.c, programs/cmd/tests/test_builtins.cmd.exp
# | * dlls/appwiz.cpl/addons.c, dlls/urlmon/tests/url.c
# |
if test "$enable_kernel32_MoveFile" -eq 1; then
patch_apply kernel32-MoveFile/0001-kernel32-tests-Fix-compilation-with-PSDK.patch
patch_apply kernel32-MoveFile/0002-kernel32-tests-Fix-a-bunch-of-access-denied-errors-b.patch
patch_apply kernel32-MoveFile/0003-kernel32-tests-Move-the-MoveFile-test-where-it-belon.patch
patch_apply kernel32-MoveFile/0004-kernel32-MoveFile-source-source-should-succeed.patch
patch_apply kernel32-MoveFile/0005-kernel32-MoveFile-should-make-sure-that-it-has-the-d.patch
patch_apply kernel32-MoveFile/0006-urlmon-tests-Add-test-for-opening-cache-file-with-DE.patch
patch_apply kernel32-MoveFile/0007-appwiz.cpl-Copy-addons-to-cache-instead-of-moving.patch
(
printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32/tests: Fix compilation with PSDK.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32/tests: Fix a bunch of access denied errors by using a dedicated TEMP directory.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32/tests: Move the MoveFile test where it belongs.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: MoveFile(source, source) should succeed.", 1 },';
printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: MoveFile should make sure that it has the delete access to the source file.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "urlmon/tests: Add test for opening cache file with DELETE access.", 1 },';
printf '%s\n' '+ { "Sebastian Lackner", "appwiz.cpl: Copy addons to cache instead of moving.", 1 },';
) >> "$patchlist"