From 046f6604b763ca494bece1ff16a0919077ecb9d4 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Thu, 9 Jul 2020 23:17:40 -0500 Subject: [PATCH] Rebase against 18ae539c914a9b5a89f63d8cf9c2a21273eccc6c. --- ...storing-DOS-attributes-in-NtCreateFi.patch | 52 +++++---- ...e-Unix-style-hidden-file-check-withi.patch | 18 +-- ...slate-Unix-virtual-disks-to-FILE_DEV.patch | 57 ++++++++++ ...e-device-type-when-systemroot-is-loc.patch | 54 --------- patches/ntdll-Junction_Points/definition | 2 + ...opening-files-through-nt-device-path.patch | 35 ++---- ...NtQueryVirtualMemory-MemorySectionNa.patch | 47 ++++---- ...ive-symlinks-before-returning-sectio.patch | 17 +-- ...low-special-characters-in-pipe-names.patch | 12 +- patches/ntdll-ThreadTime/definition | 5 - ...ss-virtual-memory-counters-in-NtQuer.patch | 105 ------------------ ...lement-cuModuleLoad-wrapper-function.patch | 48 ++------ .../0001-nvcuvid-First-implementation.patch | 54 +++------ patches/patchinstall.sh | 86 +------------- ...open-files-without-any-permission-bi.patch | 20 ++-- patches/server-File_Permissions/definition | 1 - staging/upstream-commit | 2 +- 17 files changed, 189 insertions(+), 426 deletions(-) create mode 100644 patches/ntdll-DeviceType_Systemroot/0001-ntdll-Don-t-translate-Unix-virtual-disks-to-FILE_DEV.patch delete mode 100644 patches/ntdll-DeviceType_Systemroot/0001-ntdll-Return-fake-device-type-when-systemroot-is-loc.patch delete mode 100644 patches/ntdll-ThreadTime/definition delete mode 100644 patches/ntdll-ThreadTime/xxx6-ntdll-Fill-process-virtual-memory-counters-in-NtQuer.patch diff --git a/patches/ntdll-DOS_Attributes/0004-ntdll-Implement-storing-DOS-attributes-in-NtCreateFi.patch b/patches/ntdll-DOS_Attributes/0004-ntdll-Implement-storing-DOS-attributes-in-NtCreateFi.patch index 7fdc0af2..72f4a473 100644 --- a/patches/ntdll-DOS_Attributes/0004-ntdll-Implement-storing-DOS-attributes-in-NtCreateFi.patch +++ b/patches/ntdll-DOS_Attributes/0004-ntdll-Implement-storing-DOS-attributes-in-NtCreateFi.patch @@ -1,14 +1,14 @@ -From 7fbcb02d4e88819dead5b944c3b4676fb4c3bc35 Mon Sep 17 00:00:00 2001 +From 1deb289cab2a4271ec84b4636e39a467bd52b117 Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 20 Aug 2014 15:28:00 -0600 -Subject: [PATCH] ntdll: Implement storing DOS attributes in NtCreateFile. +Subject: [PATCH 3/7] ntdll: Implement storing DOS attributes in NtCreateFile. --- - dlls/ntdll/tests/directory.c | 24 +++++------ - dlls/ntdll/unix/file.c | 78 +++++++++++++++++++++++------------- + dlls/ntdll/tests/directory.c | 24 ++++++------ + dlls/ntdll/unix/file.c | 74 +++++++++++++++++++++++------------- include/wine/port.h | 2 + - libs/port/xattr.c | 20 +++++++++ - 4 files changed, 83 insertions(+), 41 deletions(-) + libs/port/xattr.c | 20 ++++++++++ + 4 files changed, 81 insertions(+), 39 deletions(-) diff --git a/dlls/ntdll/tests/directory.c b/dlls/ntdll/tests/directory.c index 248ed99ab20..e0f4debc624 100644 @@ -60,10 +60,10 @@ index 248ed99ab20..e0f4debc624 100644 } testfiles[i].nfound++; diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index e3477f5cb5b..73bacabb4f3 100644 +index d1f1b8c8f30..32653a110a2 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -3572,6 +3572,20 @@ void CDECL set_show_dot_files( BOOL enable ) +@@ -3580,6 +3580,20 @@ void CDECL set_show_dot_files( BOOL enable ) show_dot_files = enable; } @@ -84,7 +84,7 @@ index e3477f5cb5b..73bacabb4f3 100644 /****************************************************************************** * NtCreateFile (NTDLL.@) -@@ -3581,6 +3595,10 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU +@@ -3589,6 +3603,10 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU ULONG attributes, ULONG sharing, ULONG disposition, ULONG options, void *ea_buffer, ULONG ea_length ) { @@ -92,10 +92,10 @@ index e3477f5cb5b..73bacabb4f3 100644 + OBJECT_ATTRIBUTES unix_attr; + data_size_t len; + struct object_attributes *objattr; - ANSI_STRING unix_name; + char *unix_name; BOOL created = FALSE; -@@ -3623,36 +3641,34 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU +@@ -3631,36 +3649,34 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU io->u.Status = STATUS_SUCCESS; } @@ -106,11 +106,14 @@ index e3477f5cb5b..73bacabb4f3 100644 - OBJECT_ATTRIBUTES unix_attr = *attr; - data_size_t len; - struct object_attributes *objattr; -- ++ WARN("%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status ); ++ return io->u.Status; ++ } + - unix_attr.ObjectName = &empty_string; /* we send the unix name instead */ - if ((io->u.Status = alloc_object_attributes( &unix_attr, &objattr, &len ))) - { -- RtlFreeAnsiString( &unix_name ); +- RtlFreeHeap( GetProcessHeap(), 0, unix_name ); - return io->u.Status; - } - SERVER_START_REQ( create_file ) @@ -121,23 +124,17 @@ index e3477f5cb5b..73bacabb4f3 100644 - req->options = options; - req->attrs = attributes; - wine_server_add_data( req, objattr, len ); -- wine_server_add_data( req, unix_name.Buffer, unix_name.Length ); +- wine_server_add_data( req, unix_name, strlen(unix_name) ); - io->u.Status = wine_server_call( req ); - *handle = wine_server_ptr_handle( reply->handle ); - } - SERVER_END_REQ; - free( objattr ); -- RtlFreeAnsiString( &unix_name ); -+ WARN("%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status ); -+ return io->u.Status; - } -- else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status ); -+ + unix_attr = *attr; + unix_attr.ObjectName = &empty_string; /* we send the unix name instead */ + if ((io->u.Status = alloc_object_attributes( &unix_attr, &objattr, &len ))) + { -+ RtlFreeAnsiString( &unix_name ); + RtlFreeHeap( GetProcessHeap(), 0, unix_name ); + return io->u.Status; + } + @@ -149,32 +146,33 @@ index e3477f5cb5b..73bacabb4f3 100644 + req->options = options; + req->attrs = attributes; + wine_server_add_data( req, objattr, len ); -+ wine_server_add_data( req, unix_name.Buffer, unix_name.Length ); ++ wine_server_add_data( req, unix_name, strlen(unix_name) ); + io->u.Status = wine_server_call( req ); + *handle = wine_server_ptr_handle( reply->handle ); -+ } + } +- else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), io->u.Status ); + SERVER_END_REQ; + free( objattr ); if (io->u.Status == STATUS_SUCCESS) { -@@ -3674,6 +3690,11 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU +@@ -3682,6 +3698,11 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU io->Information = FILE_OVERWRITTEN; break; } + if (io->Information == FILE_CREATED) + { + /* set any DOS extended attributes */ -+ set_file_info( unix_name.Buffer, attributes ); ++ set_file_info( unix_name, attributes ); + } } else if (io->u.Status == STATUS_TOO_MANY_OPENED_FILES) { -@@ -3681,6 +3702,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU +@@ -3689,6 +3710,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU if (!once++) ERR_(winediag)( "Too many open files, ulimit -n probably needs to be increased\n" ); } -+ RtlFreeAnsiString( &unix_name ); ++ RtlFreeHeap( GetProcessHeap(), 0, unix_name ); return io->u.Status; } diff --git a/patches/ntdll-DOS_Attributes/0007-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch b/patches/ntdll-DOS_Attributes/0007-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch index b9156aea..a972a95e 100644 --- a/patches/ntdll-DOS_Attributes/0007-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch +++ b/patches/ntdll-DOS_Attributes/0007-ntdll-Perform-the-Unix-style-hidden-file-check-withi.patch @@ -1,4 +1,4 @@ -From 01a10dd50491ca0162a5293836cf9b9a3d3c0e34 Mon Sep 17 00:00:00 2001 +From 78f53ba7362227cf5d725d6d5b70e06267597b5e Mon Sep 17 00:00:00 2001 From: "Erich E. Hoover" Date: Wed, 20 Aug 2014 11:26:48 -0600 Subject: [PATCH] ntdll: Perform the Unix-style hidden file check within the @@ -9,10 +9,10 @@ Subject: [PATCH] ntdll: Perform the Unix-style hidden file check within the 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 496c92265e9..6f3772d20be 100644 +index 33fa49d0dea..a88daf1f7f3 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -1217,15 +1217,15 @@ static BOOLEAN get_dir_case_sensitivity( const char *dir ) +@@ -1238,15 +1238,15 @@ static BOOLEAN get_dir_case_sensitivity( const char *dir ) * * Check if the specified file should be hidden based on its name and the show dot files option. */ @@ -33,7 +33,7 @@ index 496c92265e9..6f3772d20be 100644 if (p == end || *p != '.') return FALSE; /* make sure it isn't '.' or '..' */ if (p + 1 == end) return FALSE; -@@ -1493,6 +1493,10 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr ) +@@ -1571,6 +1571,10 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr ) RtlFreeHeap( GetProcessHeap(), 0, parent_path ); } *attr |= get_file_attributes( st ); @@ -44,7 +44,7 @@ index 496c92265e9..6f3772d20be 100644 len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, hexattr, sizeof(hexattr)-1 ); if (len == -1) return ret; *attr |= get_file_xattr( hexattr, len ); -@@ -1684,11 +1688,6 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I +@@ -2081,11 +2085,6 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I if (class != FileNamesInformation) { if (st.st_dev != dir_data->id.dev) st.st_ino = 0; /* ignore inode if on a different device */ @@ -56,15 +56,15 @@ index 496c92265e9..6f3772d20be 100644 fill_file_info( &st, attributes, info, class ); } -@@ -3301,7 +3300,6 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr, +@@ -3857,7 +3856,6 @@ NTSTATUS WINAPI NtQueryFullAttributesFile( const OBJECT_ATTRIBUTES *attr, info->AllocationSize = std.AllocationSize; info->EndOfFile = std.EndOfFile; info->FileAttributes = basic.FileAttributes; - if (is_hidden_file( attr->ObjectName )) info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN; } - RtlFreeAnsiString( &unix_name ); + RtlFreeHeap( GetProcessHeap(), 0, unix_name ); } -@@ -3328,10 +3326,7 @@ NTSTATUS WINAPI NtQueryAttributesFile( const OBJECT_ATTRIBUTES *attr, FILE_BASIC +@@ -3884,10 +3882,7 @@ NTSTATUS WINAPI NtQueryAttributesFile( const OBJECT_ATTRIBUTES *attr, FILE_BASIC else if (!S_ISREG(st.st_mode) && !S_ISDIR(st.st_mode)) status = STATUS_INVALID_INFO_CLASS; else @@ -72,7 +72,7 @@ index 496c92265e9..6f3772d20be 100644 status = fill_file_info( &st, attributes, info, FileBasicInformation ); - if (is_hidden_file( attr->ObjectName )) info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN; - } - RtlFreeAnsiString( &unix_name ); + RtlFreeHeap( GetProcessHeap(), 0, unix_name ); } else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), status ); -- diff --git a/patches/ntdll-DeviceType_Systemroot/0001-ntdll-Don-t-translate-Unix-virtual-disks-to-FILE_DEV.patch b/patches/ntdll-DeviceType_Systemroot/0001-ntdll-Don-t-translate-Unix-virtual-disks-to-FILE_DEV.patch new file mode 100644 index 00000000..726aa6d1 --- /dev/null +++ b/patches/ntdll-DeviceType_Systemroot/0001-ntdll-Don-t-translate-Unix-virtual-disks-to-FILE_DEV.patch @@ -0,0 +1,57 @@ +From 835c102cf1c8edf8216b12ea98846cb1e3b40219 Mon Sep 17 00:00:00 2001 +From: Zebediah Figura +Date: Fri, 29 May 2015 19:57:22 +0200 +Subject: [PATCH] ntdll: Don't translate Unix virtual disks to + FILE_DEVICE_VIRTUAL_DISK. + +Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=36546 +Signed-off-by: Zebediah Figura +--- +Despite my sign-off, I don't profess to hold an opinion on whether this bug +should be solved, but multiple users have requested this behaviour, and it +seems not wholly unreasonable. I'm submitting this patch so that the question +at least doesn't languish on bugzilla forever. + +This patch was tested with FutureMark's SystemInfo version 4.28; it refuses to +install in a WINEPREFIX in tmpfs without this patch, and succeeds with it. + + dlls/ntdll/unix/file.c | 12 ++++++++---- + 1 file changed, 8 insertions(+), 4 deletions(-) + +diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c +index a0ad361fcbb..a28cfe9818f 100644 +--- a/dlls/ntdll/unix/file.c ++++ b/dlls/ntdll/unix/file.c +@@ -6001,12 +6001,15 @@ static NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info ) + info->DeviceType = FILE_DEVICE_NETWORK_FILE_SYSTEM; + info->Characteristics |= FILE_REMOTE_DEVICE; + break; +- case 0x01021994: /* tmpfs */ +- case 0x28cd3d45: /* cramfs */ + case 0x1373: /* devfs */ + case 0x9fa0: /* procfs */ + info->DeviceType = FILE_DEVICE_VIRTUAL_DISK; + break; ++ case 0x01021994: /* tmpfs */ ++ case 0x28cd3d45: /* cramfs */ ++ /* Don't map these to FILE_DEVICE_VIRTUAL_DISK by default. Virtual ++ * filesystems are rare on Windows, and some programs refuse to ++ * recognize them as valid. */ + default: + info->DeviceType = FILE_DEVICE_DISK_FILE_SYSTEM; + break; +@@ -6050,8 +6053,9 @@ static NTSTATUS get_device_info( int fd, FILE_FS_DEVICE_INFORMATION *info ) + info->Characteristics |= FILE_REMOVABLE_MEDIA; + break; + case DKC_MD: +- info->DeviceType = FILE_DEVICE_VIRTUAL_DISK; +- break; ++ /* Don't map these to FILE_DEVICE_VIRTUAL_DISK by default. Virtual ++ * filesystems are rare on Windows, and some programs refuse to ++ * recognize them as valid. */ + default: + info->DeviceType = FILE_DEVICE_DISK_FILE_SYSTEM; + } +-- +2.27.0 + diff --git a/patches/ntdll-DeviceType_Systemroot/0001-ntdll-Return-fake-device-type-when-systemroot-is-loc.patch b/patches/ntdll-DeviceType_Systemroot/0001-ntdll-Return-fake-device-type-when-systemroot-is-loc.patch deleted file mode 100644 index 0dcd93e2..00000000 --- a/patches/ntdll-DeviceType_Systemroot/0001-ntdll-Return-fake-device-type-when-systemroot-is-loc.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 6cf9c37c1e5b2211a61e8d61f97d46f89d86d753 Mon Sep 17 00:00:00 2001 -From: Sebastian Lackner -Date: Fri, 29 May 2015 19:57:22 +0200 -Subject: [PATCH] ntdll: Return fake device type when systemroot is located on - virtual disk. - ---- - dlls/ntdll/unix/file.c | 27 +++++++++++++++++++++++++++ - 1 file changed, 27 insertions(+) - -diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index ca6899b50f5..4f35de4da97 100644 ---- a/dlls/ntdll/unix/file.c -+++ b/dlls/ntdll/unix/file.c -@@ -6136,9 +6136,36 @@ NTSTATUS WINAPI NtQueryVolumeInformationFile( HANDLE handle, IO_STATUS_BLOCK *io - else - { - FILE_FS_DEVICE_INFORMATION *info = buffer; -+ ANSI_STRING unix_name; - - if ((io->u.Status = get_device_info( fd, info )) == STATUS_SUCCESS) -+ { - io->Information = sizeof(*info); -+ -+ /* Some MSI installers complain when the SystemRoot is located -+ * on a virtual disk. Fake return values for compatibility. */ -+ if (info->DeviceType == FILE_DEVICE_VIRTUAL_DISK && -+ user_shared_data->NtSystemRoot[1] == ':' && -+ !server_get_unix_name( handle, &unix_name )) -+ { -+ UNICODE_STRING nt_name; -+ if (!unix_to_nt_file_name( &unix_name, &nt_name )) -+ { -+ WCHAR *buf = nt_name.Buffer; -+ if (nt_name.Length >= 6 * sizeof(WCHAR) && -+ buf[0] == '\\' && buf[1] == '?' && buf[2] == '?' && buf[3] == '\\' && -+ buf[4] == user_shared_data->NtSystemRoot[0] && buf[5] == ':') -+ { -+ WARN( "returning fake disk type for %s\n", -+ debugstr_wn(buf, nt_name.Length/sizeof(WCHAR)) ); -+ info->DeviceType = FILE_DEVICE_DISK_FILE_SYSTEM; -+ } -+ RtlFreeUnicodeString( &nt_name ); -+ } -+ RtlFreeAnsiString( &unix_name ); -+ } -+ -+ } - } - break; - --- -2.27.0 - diff --git a/patches/ntdll-Junction_Points/definition b/patches/ntdll-Junction_Points/definition index 628a6a78..716aac06 100644 --- a/patches/ntdll-Junction_Points/definition +++ b/patches/ntdll-Junction_Points/definition @@ -4,3 +4,5 @@ Fixes: [44948] Multiple apps (Spine (Mod starter for Gothic), MS Office 365 inst # FIXME 2: patch 0019 needs to call RemoveDirectoryW() from kernelbase, but it's stuck in kernel32 for now... # FIXME 3: RemoveDirectory() doesn't work anymore, I think. Depends: ntdll-DOS_Attributes +# Someone needs to rewrite all of this string arithmetic. +Disabled: true diff --git a/patches/ntdll-NtDevicePath/0001-ntdll-Implement-opening-files-through-nt-device-path.patch b/patches/ntdll-NtDevicePath/0001-ntdll-Implement-opening-files-through-nt-device-path.patch index fd04fa01..82a0918c 100644 --- a/patches/ntdll-NtDevicePath/0001-ntdll-Implement-opening-files-through-nt-device-path.patch +++ b/patches/ntdll-NtDevicePath/0001-ntdll-Implement-opening-files-through-nt-device-path.patch @@ -1,15 +1,15 @@ -From 38833e0b211516ba54a68cb7e6f560c8caf952ff Mon Sep 17 00:00:00 2001 +From 0d4ebc66e01e42acef9db63872d38abc789d83c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 26 May 2017 05:17:17 +0200 Subject: [PATCH] ntdll: Implement opening files through nt device paths. --- dlls/ntdll/tests/file.c | 25 +++++++- - dlls/ntdll/unix/file.c | 132 +++++++++++++++++++++++++++++++++++++--- - 2 files changed, 147 insertions(+), 10 deletions(-) + dlls/ntdll/unix/file.c | 122 +++++++++++++++++++++++++++++++++++++++- + 2 files changed, 145 insertions(+), 2 deletions(-) diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c -index 9e65a1f6ddd..7b65152f7cf 100644 +index 6164b0c4bde..6610edbd042 100644 --- a/dlls/ntdll/tests/file.c +++ b/dlls/ntdll/tests/file.c @@ -135,18 +135,22 @@ static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved ) @@ -63,30 +63,19 @@ index 9e65a1f6ddd..7b65152f7cf 100644 static void open_file_test(void) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index a7f22e83e12..b93c169f856 100644 +index 3c4670e114c..6b0dbaa7b3d 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -3307,16 +3307,10 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, ANSI_S - - - /****************************************************************************** -- * nt_to_unix_file_name -- * -- * Convert a file name from NT namespace to Unix namespace. -- * -- * If disposition is not FILE_OPEN or FILE_OVERWRITE, the last path -- * element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is -- * returned, but the unix name is still filled in properly. -+ * nt_to_unix_file_name_internal +@@ -3279,7 +3279,7 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, char * + * element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is + * returned, but the unix name is still filled in properly. */ --NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, -- UINT disposition ) -+static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, -+ UINT disposition ) +-NTSTATUS nt_to_unix_file_name( const UNICODE_STRING *nameW, char **unix_name_ret, UINT disposition ) ++static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, char **unix_name_ret, UINT disposition ) { static const WCHAR unixW[] = {'u','n','i','x'}; static const WCHAR pipeW[] = {'p','i','p','e'}; -@@ -3430,6 +3424,126 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u +@@ -3417,6 +3417,126 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, char *nam return status; } @@ -165,7 +154,7 @@ index a7f22e83e12..b93c169f856 100644 + * element doesn't have to exist; in that case STATUS_NO_SUCH_FILE is + * returned, but the unix name is still filled in properly. + */ -+NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *unix_name_ret, ++NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, char **unix_name_ret, + UINT disposition ) +{ + static const WCHAR systemrootW[] = {'\\','S','y','s','t','e','m','R','o','o','t','\\',0}; diff --git a/patches/ntdll-NtQueryVirtualMemory/0003-ntdll-Implement-NtQueryVirtualMemory-MemorySectionNa.patch b/patches/ntdll-NtQueryVirtualMemory/0003-ntdll-Implement-NtQueryVirtualMemory-MemorySectionNa.patch index f91e8238..204a29ba 100644 --- a/patches/ntdll-NtQueryVirtualMemory/0003-ntdll-Implement-NtQueryVirtualMemory-MemorySectionNa.patch +++ b/patches/ntdll-NtQueryVirtualMemory/0003-ntdll-Implement-NtQueryVirtualMemory-MemorySectionNa.patch @@ -1,4 +1,4 @@ -From 30bc9bbd5b1b413c7a574d5e9574f79a03b48d16 Mon Sep 17 00:00:00 2001 +From c1b6bc02ee2534dc2b51d8184fb0ca6717c33cf3 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Sun, 28 May 2017 05:19:30 +0200 Subject: [PATCH] ntdll: Implement NtQueryVirtualMemory(MemorySectionName). @@ -8,42 +8,42 @@ Contains several improvements by Sebastian Lackner . --- dlls/ntdll/unix/file.c | 2 +- dlls/ntdll/unix/unix_private.h | 1 + - dlls/ntdll/unix/virtual.c | 91 +++++++++++++++++++++++++++++++++- + dlls/ntdll/unix/virtual.c | 96 +++++++++++++++++++++++++++++++++- dlls/psapi/tests/psapi_main.c | 8 +-- - server/mapping.c | 29 +++++++++++ + server/mapping.c | 29 ++++++++++ server/protocol.def | 9 ++++ - 6 files changed, 131 insertions(+), 9 deletions(-) + 6 files changed, 136 insertions(+), 9 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 551d0450584..49e807a5f24 100644 +index 6b0dbaa7b3d..2ac7fcaae35 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1767,7 +1767,7 @@ static NTSTATUS fill_file_info( const struct stat *st, ULONG attr, void *ptr, } --static NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) -+NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) +-static NTSTATUS server_get_unix_name( HANDLE handle, char **unix_name ) ++NTSTATUS server_get_unix_name( HANDLE handle, char **unix_name ) { data_size_t size = 1024; NTSTATUS ret; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index e14da3ff7ec..b9a96424b4c 100644 +index 711a0bed2b7..466c59da75a 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h -@@ -173,6 +173,7 @@ extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t * +@@ -170,6 +170,7 @@ extern unsigned int server_queue_process_apc( HANDLE process, const apc_call_t * apc_result_t *result ) DECLSPEC_HIDDEN; extern int server_get_unix_fd( HANDLE handle, unsigned int wanted_access, int *unix_fd, int *needs_close, enum server_fd_type *type, unsigned int *options ) DECLSPEC_HIDDEN; -+extern NTSTATUS server_get_unix_name( HANDLE handle, ANSI_STRING *unix_name ) DECLSPEC_HIDDEN; ++extern NTSTATUS server_get_unix_name( HANDLE handle, char **unix_name ) DECLSPEC_HIDDEN; extern void server_init_process(void) DECLSPEC_HIDDEN; extern size_t server_init_thread( void *entry_point, BOOL *suspend ) DECLSPEC_HIDDEN; extern int server_pipe( int fd[2] ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index c49c60166c2..086943bdae8 100644 +index cd1bd162a2a..570a8a3bf49 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c -@@ -4011,6 +4011,93 @@ static NTSTATUS get_working_set_ex( HANDLE process, LPCVOID addr, +@@ -4013,6 +4013,98 @@ static NTSTATUS get_working_set_ex( HANDLE process, LPCVOID addr, return STATUS_SUCCESS; } @@ -53,7 +53,8 @@ index c49c60166c2..086943bdae8 100644 + SIZE_T len, SIZE_T *res_len ) +{ + UNICODE_STRING nt_name; -+ ANSI_STRING unix_name; ++ WCHAR *nt_nameW; ++ char *unix_name; + data_size_t size = 1024; + WCHAR *name = NULL; + NTSTATUS status; @@ -76,10 +77,14 @@ index c49c60166c2..086943bdae8 100644 + NtClose( mapping ); + if (!status) + { -+ status = wine_unix_to_nt_file_name( &unix_name, &nt_name ); -+ RtlFreeAnsiString( &unix_name ); ++ status = unix_to_nt_file_name( unix_name, &nt_nameW ); ++ RtlFreeHeap( GetProcessHeap(), 0, unix_name ); ++ } ++ if (!status) ++ { ++ RtlInitUnicodeString( &nt_name, nt_nameW ); ++ goto found; + } -+ if (!status) goto found; + if (status == STATUS_OBJECT_TYPE_MISMATCH) status = STATUS_FILE_INVALID; + return status; + } @@ -137,7 +142,7 @@ index c49c60166c2..086943bdae8 100644 #define UNIMPLEMENTED_INFO_CLASS(c) \ case c: \ FIXME("(process=%p,addr=%p) Unimplemented information class: " #c "\n", process, addr); \ -@@ -4035,8 +4122,10 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr, +@@ -4037,8 +4129,10 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr, case MemoryWorkingSetExInformation: return get_working_set_ex( process, addr, buffer, len, res_len ); @@ -177,10 +182,10 @@ index da7524dd60a..bfe14231a9b 100644 } diff --git a/server/mapping.c b/server/mapping.c -index 07c51c246d6..7f19a7572df 100644 +index db0debe0af5..6e74f5b770f 100644 --- a/server/mapping.c +++ b/server/mapping.c -@@ -1095,6 +1095,35 @@ DECL_HANDLER(unmap_view) +@@ -1099,6 +1099,35 @@ DECL_HANDLER(unmap_view) if (view) free_memory_view( view ); } @@ -217,10 +222,10 @@ index 07c51c246d6..7f19a7572df 100644 DECL_HANDLER(get_mapping_committed_range) { diff --git a/server/protocol.def b/server/protocol.def -index 6416306c0a1..bdc1eeeb5c3 100644 +index bd6841d8000..345e0966c14 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -1853,6 +1853,15 @@ enum char_info_mode +@@ -1756,6 +1756,15 @@ enum char_info_mode @END diff --git a/patches/ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch b/patches/ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch index 8bc31e86..e66390a1 100644 --- a/patches/ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch +++ b/patches/ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch @@ -1,4 +1,4 @@ -From 01031e9eb282bffce2449891e68eb9efeded1ee9 Mon Sep 17 00:00:00 2001 +From bb973ee8d79d0a1117c437afe8d62f34b9d9d3c8 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 28 May 2017 11:17:26 +0200 Subject: [PATCH] ntdll: Resolve drive symlinks before returning section name. @@ -11,10 +11,10 @@ Subject: [PATCH] ntdll: Resolve drive symlinks before returning section name. 4 files changed, 34 insertions(+), 12 deletions(-) diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 551d0450584..65ddf0df4a2 100644 +index 2ac7fcaae35..d39c98b2e49 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -3425,7 +3425,7 @@ static NTSTATUS nt_to_unix_file_name_internal( const UNICODE_STRING *nameW, ANSI +@@ -3418,7 +3418,7 @@ NTSTATUS CDECL wine_nt_to_unix_file_name( const UNICODE_STRING *nameW, char *nam } /* read the contents of an NT symlink object */ @@ -24,7 +24,7 @@ index 551d0450584..65ddf0df4a2 100644 OBJECT_ATTRIBUTES attr; UNICODE_STRING targetW; diff --git a/dlls/ntdll/unix/unix_private.h b/dlls/ntdll/unix/unix_private.h -index e14da3ff7ec..5410248e8a7 100644 +index 466c59da75a..884dff1e1b1 100644 --- a/dlls/ntdll/unix/unix_private.h +++ b/dlls/ntdll/unix/unix_private.h @@ -103,6 +103,7 @@ extern void CDECL get_initial_directory( UNICODE_STRING *dir ) DECLSPEC_HIDDEN; @@ -36,7 +36,7 @@ index e14da3ff7ec..5410248e8a7 100644 const LARGE_INTEGER *offset_ptr, SIZE_T *size_ptr, ULONG alloc_type, ULONG protect, pe_image_info_t *image_info ) DECLSPEC_HIDDEN; diff --git a/dlls/ntdll/unix/virtual.c b/dlls/ntdll/unix/virtual.c -index 1515963b9c7..5cee0da5d24 100644 +index 570a8a3bf49..c040adfaf23 100644 --- a/dlls/ntdll/unix/virtual.c +++ b/dlls/ntdll/unix/virtual.c @@ -188,6 +188,8 @@ static BYTE **pages_vprot; @@ -48,14 +48,15 @@ index 1515963b9c7..5cee0da5d24 100644 static struct file_view *view_block_start, *view_block_end, *next_free_view; #ifdef _WIN64 static const size_t view_block_size = 0x200000; -@@ -4016,12 +4018,15 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr, +@@ -4018,13 +4020,16 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr, MEMORY_SECTION_NAME *info, SIZE_T len, SIZE_T *res_len ) { + static const WCHAR dosprefixW[] = {'\\','?','?','\\'}; + WCHAR symlinkW[MAX_DIR_ENTRY_LEN] = {0}; UNICODE_STRING nt_name; - ANSI_STRING unix_name; + WCHAR *nt_nameW; + char *unix_name; data_size_t size = 1024; - WCHAR *name = NULL; + WCHAR *ptr, *name = NULL; @@ -65,7 +66,7 @@ index 1515963b9c7..5cee0da5d24 100644 if (!addr || !info || !res_len) return STATUS_INVALID_PARAMETER; -@@ -4080,14 +4085,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr, +@@ -4087,14 +4092,34 @@ static NTSTATUS get_section_name( HANDLE process, LPCVOID addr, } found: diff --git a/patches/ntdll-Pipe_SpecialCharacters/0001-ntdll-Allow-special-characters-in-pipe-names.patch b/patches/ntdll-Pipe_SpecialCharacters/0001-ntdll-Allow-special-characters-in-pipe-names.patch index 4fd35b35..192ec010 100644 --- a/patches/ntdll-Pipe_SpecialCharacters/0001-ntdll-Allow-special-characters-in-pipe-names.patch +++ b/patches/ntdll-Pipe_SpecialCharacters/0001-ntdll-Allow-special-characters-in-pipe-names.patch @@ -1,4 +1,4 @@ -From addb612dfe7429c29adeb31144976713cb0756b4 Mon Sep 17 00:00:00 2001 +From 56459884534d5b0acb6a410d2ba04f6f3aa15ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sun, 27 Jul 2014 03:35:42 +0200 Subject: [PATCH] ntdll: Allow special characters in pipe names. @@ -38,18 +38,18 @@ index 3c7ca06a045..453dcc80b7b 100644 } diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c -index 61340a0e010..a7f22e83e12 100644 +index a0ad361fcbb..3c4670e114c 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c -@@ -3319,6 +3319,7 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u - UINT disposition ) +@@ -3282,6 +3282,7 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, char * + NTSTATUS nt_to_unix_file_name( const UNICODE_STRING *nameW, char **unix_name_ret, UINT disposition ) { static const WCHAR unixW[] = {'u','n','i','x'}; + static const WCHAR pipeW[] = {'p','i','p','e'}; static const WCHAR invalid_charsW[] = { INVALID_NT_CHARS, 0 }; NTSTATUS status = STATUS_SUCCESS; -@@ -3329,6 +3330,7 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u +@@ -3292,6 +3293,7 @@ NTSTATUS nt_to_unix_file_name( const UNICODE_STRING *nameW, char **unix_name_ret WCHAR prefix[MAX_DIR_ENTRY_LEN + 1]; BOOLEAN check_case = FALSE; BOOLEAN is_unix = FALSE; @@ -57,7 +57,7 @@ index 61340a0e010..a7f22e83e12 100644 name = nameW->Buffer; name_len = nameW->Length / sizeof(WCHAR); -@@ -3362,13 +3364,17 @@ NTSTATUS CDECL nt_to_unix_file_name( const UNICODE_STRING *nameW, ANSI_STRING *u +@@ -3325,13 +3327,17 @@ NTSTATUS nt_to_unix_file_name( const UNICODE_STRING *nameW, char **unix_name_ret name += prefix_len; name_len -= prefix_len; diff --git a/patches/ntdll-ThreadTime/definition b/patches/ntdll-ThreadTime/definition deleted file mode 100644 index 6b2dd9c7..00000000 --- a/patches/ntdll-ThreadTime/definition +++ /dev/null @@ -1,5 +0,0 @@ -Fixes: Return correct thread creation time in SystemProcessInformation -Fixes: Fill process virtual memory counters in NtQuerySystemInformation -# Patch 6 is broken. We should really be returning this information from the -# server, but that needs a bit more work. -Disabled: true diff --git a/patches/ntdll-ThreadTime/xxx6-ntdll-Fill-process-virtual-memory-counters-in-NtQuer.patch b/patches/ntdll-ThreadTime/xxx6-ntdll-Fill-process-virtual-memory-counters-in-NtQuer.patch deleted file mode 100644 index 829d8f4d..00000000 --- a/patches/ntdll-ThreadTime/xxx6-ntdll-Fill-process-virtual-memory-counters-in-NtQuer.patch +++ /dev/null @@ -1,105 +0,0 @@ -From ee29bbfa7e10de295db39ab6b89f2175d00692c5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Thu, 9 Mar 2017 22:56:45 +0100 -Subject: [PATCH] ntdll: Fill process virtual memory counters in - NtQuerySystemInformation. - -FIXME: fill_VM_COUNTERS now uses a different method ... which one is better? ---- - dlls/ntdll/nt.c | 3 +++ - dlls/ntdll/ntdll_misc.h | 1 + - dlls/ntdll/process.c | 2 +- - dlls/ntdll/thread.c | 36 ++++++++++++++++++++++++++++++++++++ - 4 files changed, 41 insertions(+), 1 deletion(-) - -diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c -index cbb7937631d..bb078c1aa21 100644 ---- a/dlls/ntdll/nt.c -+++ b/dlls/ntdll/nt.c -@@ -2686,8 +2686,11 @@ NTSTATUS WINAPI NtQuerySystemInformation( - /* spi->ti will be set later on */ - - if (reply->unix_pid != -1) -+ { - read_process_time(reply->unix_pid, -1, clk_tck, - &spi->KernelTime, &spi->UserTime); -+ read_process_memory_stats(reply->unix_pid, &spi->vmCounters); -+ } - unix_pid = reply->unix_pid; - } - len += procstructlen; -diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h -index 6e77694d87b..d725a678246 100644 ---- a/dlls/ntdll/ntdll_misc.h -+++ b/dlls/ntdll/ntdll_misc.h -@@ -248,6 +248,7 @@ void WINAPI LdrInitializeThunk(CONTEXT*,void**,ULONG_PTR,ULONG_PTR); - /* process / thread time */ - extern BOOL read_process_time(int unix_pid, int unix_tid, unsigned long clk_tck, - LARGE_INTEGER *kernel, LARGE_INTEGER *user) DECLSPEC_HIDDEN; -+extern BOOL read_process_memory_stats(int unix_pid, VM_COUNTERS *pvmi) DECLSPEC_HIDDEN; - - /* string functions */ - int __cdecl NTDLL_tolower( int c ); -diff --git a/dlls/ntdll/process.c b/dlls/ntdll/process.c -index 35937ce6026..b4f2dbc8160 100644 ---- a/dlls/ntdll/process.c -+++ b/dlls/ntdll/process.c -@@ -192,7 +192,7 @@ static void fill_VM_COUNTERS(VM_COUNTERS* pvmi) - - static void fill_VM_COUNTERS(VM_COUNTERS* pvmi) - { -- /* FIXME : real data */ -+ read_process_memory_stats(getpid(), pvmi); - } - - #endif -diff --git a/dlls/ntdll/thread.c b/dlls/ntdll/thread.c -index 14198d77b7b..8ae8251f975 100644 ---- a/dlls/ntdll/thread.c -+++ b/dlls/ntdll/thread.c -@@ -381,6 +381,42 @@ NTSTATUS WINAPI NtCreateThreadEx( HANDLE *handle_ptr, ACCESS_MASK access, OBJECT - flags, zero_bits, stack_commit, stack_reserve, attr_list ); - } - -+BOOL read_process_memory_stats(int unix_pid, VM_COUNTERS *pvmi) -+{ -+ BOOL ret = FALSE; -+#ifdef __linux__ -+ unsigned long size, resident, shared, trs, drs, lrs, dt; -+ char buf[512]; -+ FILE *fp; -+ -+ sprintf( buf, "/proc/%u/statm", unix_pid ); -+ if ((fp = fopen( buf, "r" ))) -+ { -+ if (fscanf( fp, "%lu %lu %lu %lu %lu %lu %lu", -+ &size, &resident, &shared, &trs, &drs, &lrs, &dt ) == 7) -+ { -+ pvmi->VirtualSize = size * page_size; -+ pvmi->WorkingSetSize = resident * page_size; -+ pvmi->PrivatePageCount = size - shared; -+ -+ /* these values are not available through /proc/pid/statm */ -+ pvmi->PeakVirtualSize = pvmi->VirtualSize; -+ pvmi->PageFaultCount = 0; -+ pvmi->PeakWorkingSetSize = pvmi->WorkingSetSize; -+ pvmi->QuotaPagedPoolUsage = pvmi->VirtualSize; -+ pvmi->QuotaPeakPagedPoolUsage = pvmi->QuotaPagedPoolUsage; -+ pvmi->QuotaPeakNonPagedPoolUsage = 0; -+ pvmi->QuotaNonPagedPoolUsage = 0; -+ pvmi->PagefileUsage = 0; -+ pvmi->PeakPagefileUsage = 0; -+ -+ ret = TRUE; -+ } -+ fclose( fp ); -+ } -+#endif -+ return ret; -+} - - /*********************************************************************** - * RtlCreateUserThread (NTDLL.@) --- -2.26.2 - diff --git a/patches/nvcuda-CUDA_Support/0009-nvcuda-Implement-cuModuleLoad-wrapper-function.patch b/patches/nvcuda-CUDA_Support/0009-nvcuda-Implement-cuModuleLoad-wrapper-function.patch index 2b648b03..f2d069e1 100644 --- a/patches/nvcuda-CUDA_Support/0009-nvcuda-Implement-cuModuleLoad-wrapper-function.patch +++ b/patches/nvcuda-CUDA_Support/0009-nvcuda-Implement-cuModuleLoad-wrapper-function.patch @@ -1,23 +1,23 @@ -From 73f255bdc5edef27f9a03b7e8917686490d3bf7a Mon Sep 17 00:00:00 2001 +From 9d4e8c921196c2303812e3673b27f781218943aa Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 7 Mar 2015 06:20:55 +0100 Subject: [PATCH] nvcuda: Implement cuModuleLoad wrapper function. --- - dlls/nvcuda/nvcuda.c | 46 +++++++++++++++++++++++++++++++++++++++++ + dlls/nvcuda/nvcuda.c | 22 ++++++++++++++++++++++ dlls/nvcuda/nvcuda.spec | 2 +- include/cuda.h | 1 + - 3 files changed, 48 insertions(+), 1 deletion(-) + 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/dlls/nvcuda/nvcuda.c b/dlls/nvcuda/nvcuda.c -index e11a1d51a9d..14b695f3371 100644 +index e11a1d51a9d..7c296cb6861 100644 --- a/dlls/nvcuda/nvcuda.c +++ b/dlls/nvcuda/nvcuda.c @@ -29,6 +29,7 @@ #include "windef.h" #include "winbase.h" -+#include "winternl.h" ++#include "winnls.h" #include "wine/library.h" #include "wine/debug.h" #include "wine/list.h" @@ -37,38 +37,14 @@ index e11a1d51a9d..14b695f3371 100644 LOAD_FUNCPTR(cuModuleLoadData); LOAD_FUNCPTR(cuModuleLoadDataEx); LOAD_FUNCPTR(cuModuleLoadFatBinary); -@@ -1883,6 +1886,49 @@ CUresult WINAPI wine_cuModuleGetTexRef(CUtexref *pTexRef, CUmodule hmod, const c +@@ -1883,6 +1886,25 @@ CUresult WINAPI wine_cuModuleGetTexRef(CUtexref *pTexRef, CUmodule hmod, const c return pcuModuleGetTexRef(pTexRef, hmod, name); } -+/* FIXME: Should we pay attention to AreFileApisANSI() ? */ -+static BOOL get_unix_path(ANSI_STRING *unix_name, const char *filename) -+{ -+ UNICODE_STRING dospathW, ntpathW; -+ ANSI_STRING dospath; -+ NTSTATUS status; -+ -+ RtlInitAnsiString(&dospath, filename); -+ -+ if (RtlAnsiStringToUnicodeString(&dospathW, &dospath, TRUE)) -+ return FALSE; -+ -+ if (!RtlDosPathNameToNtPathName_U(dospathW.Buffer, &ntpathW, NULL, NULL)) -+ { -+ RtlFreeUnicodeString(&dospathW); -+ return FALSE; -+ } -+ -+ status = wine_nt_to_unix_file_name(&ntpathW, unix_name, FILE_OPEN); -+ -+ RtlFreeUnicodeString(&ntpathW); -+ RtlFreeUnicodeString(&dospathW); -+ return !status; -+} -+ +CUresult WINAPI wine_cuModuleLoad(CUmodule *module, const char *fname) +{ -+ ANSI_STRING unix_name; ++ WCHAR filenameW[MAX_PATH]; ++ char *unix_name; + CUresult ret; + + TRACE("(%p, %s)\n", module, fname); @@ -76,11 +52,11 @@ index e11a1d51a9d..14b695f3371 100644 + if (!fname) + return CUDA_ERROR_INVALID_VALUE; + -+ if (!get_unix_path(&unix_name, fname)) -+ return CUDA_ERROR_FILE_NOT_FOUND; ++ MultiByteToWideChar(CP_ACP, 0, fname, -1, filenameW, ARRAY_SIZE(filenameW)); ++ unix_name = wine_get_unix_file_name( filenameW ); + -+ ret = pcuModuleLoad(module, unix_name.Buffer); -+ RtlFreeAnsiString(&unix_name); ++ ret = pcuModuleLoad(module, unix_name); ++ HeapFree(GetProcessHeap(), 0, unix_name); + return ret; +} + diff --git a/patches/nvcuvid-CUDA_Video_Support/0001-nvcuvid-First-implementation.patch b/patches/nvcuvid-CUDA_Video_Support/0001-nvcuvid-First-implementation.patch index ed89575c..00bba4bf 100644 --- a/patches/nvcuvid-CUDA_Video_Support/0001-nvcuvid-First-implementation.patch +++ b/patches/nvcuvid-CUDA_Video_Support/0001-nvcuvid-First-implementation.patch @@ -1,19 +1,19 @@ -From ecde4f4f994831bbeb1029d93e0b06f815c503b2 Mon Sep 17 00:00:00 2001 +From 3519cb4a7b8bb9c9bbf3dacbd9e6766b48dd121b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Tue, 6 Jan 2015 05:16:36 +0100 -Subject: nvcuvid: First implementation. (rev 2) +Subject: [PATCH] nvcuvid: First implementation. (rev 2) Changes by Sebastian Lackner : * Convert structures properly where the Windows and Linux definition differs. --- configure.ac | 1 + dlls/nvcuvid/Makefile.in | 4 + - dlls/nvcuvid/nvcuvid.c | 537 ++++++++++++++++++++++++++++++++++++++ + dlls/nvcuvid/nvcuvid.c | 513 ++++++++++++++++++++++++++++++++++++++ dlls/nvcuvid/nvcuvid.spec | 24 ++ include/Makefile.in | 2 + - include/cuviddec.h | 99 +++++++ + include/cuviddec.h | 99 ++++++++ include/nvcuvid.h | 79 ++++++ - 7 files changed, 746 insertions(+) + 7 files changed, 722 insertions(+) create mode 100644 dlls/nvcuvid/Makefile.in create mode 100644 dlls/nvcuvid/nvcuvid.c create mode 100644 dlls/nvcuvid/nvcuvid.spec @@ -44,10 +44,10 @@ index 00000000000..2c2dc8ccf67 + nvcuvid.c diff --git a/dlls/nvcuvid/nvcuvid.c b/dlls/nvcuvid/nvcuvid.c new file mode 100644 -index 00000000000..2704bfa9a63 +index 00000000000..a586c15eafb --- /dev/null +++ b/dlls/nvcuvid/nvcuvid.c -@@ -0,0 +1,537 @@ +@@ -0,0 +1,513 @@ +/* + * Copyright (C) 2015 Michael Müller + * @@ -73,7 +73,7 @@ index 00000000000..2704bfa9a63 + +#include "windef.h" +#include "winbase.h" -+#include "winternl.h" ++#include "winnls.h" +#include "wine/library.h" +#include "wine/debug.h" +#include "nvcuvid.h" @@ -320,36 +320,12 @@ index 00000000000..2704bfa9a63 + return CUDA_SUCCESS; +} + -+/* FIXME: Should we pay attention to AreFileApisANSI() ? */ -+static BOOL get_unix_path(ANSI_STRING *unix_name, const char *filename) -+{ -+ UNICODE_STRING dospathW, ntpathW; -+ ANSI_STRING dospath; -+ NTSTATUS status; -+ -+ RtlInitAnsiString(&dospath, filename); -+ -+ if (RtlAnsiStringToUnicodeString(&dospathW, &dospath, TRUE)) -+ return FALSE; -+ -+ if (!RtlDosPathNameToNtPathName_U(dospathW.Buffer, &ntpathW, NULL, NULL)) -+ { -+ RtlFreeUnicodeString(&dospathW); -+ return FALSE; -+ } -+ -+ status = wine_nt_to_unix_file_name(&ntpathW, unix_name, FILE_OPEN); -+ -+ RtlFreeUnicodeString(&ntpathW); -+ RtlFreeUnicodeString(&dospathW); -+ return !status; -+} -+ +CUresult WINAPI wine_cuvidCreateVideoSource(CUvideosource *pObj, const char *pszFileName, CUVIDSOURCEPARAMS *pParams) +{ ++ WCHAR filenameW[MAX_PATH]; + struct fake_source *source; + CUVIDSOURCEPARAMS fake_params; -+ ANSI_STRING unix_name; ++ char *unix_name; + CUresult ret; + + TRACE("(%p, %s, %p)\n", pObj, pszFileName, pParams); @@ -361,13 +337,13 @@ index 00000000000..2704bfa9a63 + if (!pszFileName) + return CUDA_ERROR_UNKNOWN; + -+ if (!get_unix_path(&unix_name, pszFileName)) -+ return CUDA_ERROR_UNKNOWN; ++ MultiByteToWideChar(CP_ACP, 0, pszFileName, -1, filenameW, ARRAY_SIZE(filenameW)); ++ unix_name = wine_get_unix_file_name( filenameW ); + + source = HeapAlloc(GetProcessHeap(), 0, sizeof(*source)); + if (!source) + { -+ RtlFreeAnsiString(&unix_name); ++ HeapFree(GetProcessHeap(), 0, &unix_name); + return CUDA_ERROR_OUT_OF_MEMORY; + } + @@ -388,8 +364,8 @@ index 00000000000..2704bfa9a63 + source->orig_data = pParams->pUserData; + fake_params.pUserData = source; + -+ ret = pcuvidCreateVideoSource((void *)&source->orig_source, unix_name.Buffer, &fake_params); -+ RtlFreeAnsiString(&unix_name); ++ ret = pcuvidCreateVideoSource((void *)&source->orig_source, unix_name, &fake_params); ++ HeapFree(GetProcessHeap(), 0, &unix_name); + + if (ret) + { diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index 60412bcd..00a07003 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "262e4ab9e0eeb126dde5cb4cba13fbf7f1d1cef0" + echo "18ae539c914a9b5a89f63d8cf9c2a21273eccc6c" } # Show version information @@ -177,7 +177,6 @@ patch_enable_all () enable_ntdll_Heap_Improvements="$1" enable_ntdll_Hide_Wine_Exports="$1" enable_ntdll_Interrupt_0x2e="$1" - enable_ntdll_Junction_Points="$1" enable_ntdll_Manifest_Range="$1" enable_ntdll_NtAccessCheck="$1" enable_ntdll_NtDevicePath="$1" @@ -621,9 +620,6 @@ patch_enable () ntdll-Interrupt-0x2e) enable_ntdll_Interrupt_0x2e="$2" ;; - ntdll-Junction_Points) - enable_ntdll_Junction_Points="$2" - ;; ntdll-Manifest_Range) enable_ntdll_Manifest_Range="$2" ;; @@ -1575,13 +1571,6 @@ if test "$enable_server_Stored_ACLs" -eq 1; then enable_server_File_Permissions=1 fi -if test "$enable_server_File_Permissions" -eq 1; then - if test "$enable_ntdll_Junction_Points" -gt 1; then - abort "Patchset ntdll-Junction_Points disabled, but server-File_Permissions depends on that." - fi - enable_ntdll_Junction_Points=1 -fi - if test "$enable_server_Desktop_Refcount" -eq 1; then if test "$enable_ws2_32_WSACleanup" -gt 1; then abort "Patchset ws2_32-WSACleanup disabled, but server-Desktop_Refcount depends on that." @@ -1635,13 +1624,6 @@ if test "$enable_ntdll_NtDevicePath" -eq 1; then enable_ntdll_Pipe_SpecialCharacters=1 fi -if test "$enable_ntdll_Junction_Points" -eq 1; then - if test "$enable_ntdll_DOS_Attributes" -gt 1; then - abort "Patchset ntdll-DOS_Attributes disabled, but ntdll-Junction_Points depends on that." - fi - enable_ntdll_DOS_Attributes=1 -fi - if test "$enable_ntdll_Hide_Wine_Exports" -eq 1; then if test "$enable_advapi32_Token_Integrity_Level" -gt 1; then abort "Patchset advapi32-Token_Integrity_Level disabled, but ntdll-Hide_Wine_Exports depends on that." @@ -3518,9 +3500,9 @@ fi # | * dlls/ntdll/unix/file.c # | if test "$enable_ntdll_DeviceType_Systemroot" -eq 1; then - patch_apply ntdll-DeviceType_Systemroot/0001-ntdll-Return-fake-device-type-when-systemroot-is-loc.patch + patch_apply ntdll-DeviceType_Systemroot/0001-ntdll-Don-t-translate-Unix-virtual-disks-to-FILE_DEV.patch ( - printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Return fake device type when systemroot is located on virtual disk.", 1 },'; + printf '%s\n' '+ { "Zebediah Figura", "ntdll: Don'\''t translate Unix virtual disks to FILE_DEVICE_VIRTUAL_DISK.", 1 },'; ) >> "$patchlist" fi @@ -3657,61 +3639,6 @@ if test "$enable_ntdll_Interrupt_0x2e" -eq 1; then ) >> "$patchlist" fi -# Patchset ntdll-Junction_Points -# | -# | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-DOS_Attributes -# | -# | This patchset fixes the following Wine bugs: -# | * [#12401] NET Framework 2.0, 3.0, 4.0 installers and other apps that make use of GAC API for managed assembly -# | installation on NTFS filesystems need reparse point/junction API support -# | (FSCTL_SET_REPARSE_POINT/FSCTL_GET_REPARSE_POINT) -# | * [#44948] Multiple apps (Spine (Mod starter for Gothic), MS Office 365 installer) need CreateSymbolicLinkW implementation -# | -# | Modified files: -# | * configure.ac, dlls/kernel32/path.c, dlls/kernel32/tests/path.c, dlls/kernelbase/file.c, dlls/msvcp120/tests/msvcp120.c, -# | dlls/msvcp140/tests/msvcp140.c, dlls/ntdll/tests/file.c, dlls/ntdll/unix/file.c, include/Makefile.in, include/ntifs.h, -# | include/wine/port.h, include/winternl.h, libs/port/Makefile.in, libs/port/renameat2.c, server/fd.c -# | -if test "$enable_ntdll_Junction_Points" -eq 1; then - patch_apply ntdll-Junction_Points/0001-ntdll-Add-support-for-junction-point-creation.patch - patch_apply ntdll-Junction_Points/0002-ntdll-Add-support-for-reading-junction-points.patch - patch_apply ntdll-Junction_Points/0003-ntdll-Add-support-for-deleting-junction-points.patch - patch_apply ntdll-Junction_Points/0004-ntdll-Add-a-test-for-junction-point-advertisement.patch - patch_apply ntdll-Junction_Points/0005-kernel32-ntdll-Add-support-for-deleting-junction-poi.patch - patch_apply ntdll-Junction_Points/0007-ntdll-Add-support-for-absolute-symlink-creation.patch - patch_apply ntdll-Junction_Points/0008-ntdll-Add-support-for-reading-absolute-symlinks.patch - patch_apply ntdll-Junction_Points/0009-ntdll-Add-support-for-deleting-symlinks.patch - patch_apply ntdll-Junction_Points/0010-ntdll-Add-support-for-relative-symlink-creation.patch - patch_apply ntdll-Junction_Points/0011-ntdll-Add-support-for-reading-relative-symlinks.patch - patch_apply ntdll-Junction_Points/0012-ntdll-Add-support-for-file-symlinks.patch - patch_apply ntdll-Junction_Points/0013-ntdll-Allow-creation-of-dangling-reparse-points-to-n.patch - patch_apply ntdll-Junction_Points/0014-ntdll-Correctly-report-file-symbolic-links-as-files.patch - patch_apply ntdll-Junction_Points/0016-server-Properly-handle-file-symlink-deletion.patch - patch_apply ntdll-Junction_Points/0017-ntdll-Always-report-symbolic-links-as-containing-zer.patch - patch_apply ntdll-Junction_Points/0018-ntdll-Find-dangling-symlinks-quickly.patch - patch_apply ntdll-Junction_Points/0019-kernel32-Implement-CreateSymbolicLink-A-W-with-ntdll.patch - ( - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for junction point creation.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for reading junction points.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for deleting junction points.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add a test for junction point advertisement.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "kernel32,ntdll: Add support for deleting junction points with RemoveDirectory.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for absolute symlink creation.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for reading absolute symlinks.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for deleting symlinks.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for relative symlink creation.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for reading relative symlinks.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Add support for file symlinks.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Allow creation of dangling reparse points to non-existent paths.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Correctly report file symbolic links as files.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "server: Properly handle file symlink deletion.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Always report symbolic links as containing zero bytes.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "ntdll: Find dangling symlinks quickly.", 1 },'; - printf '%s\n' '+ { "Erich E. Hoover", "kernel32: Implement CreateSymbolicLink[A|W] with ntdll reparse points.", 1 },'; - ) >> "$patchlist" -fi - # Patchset ntdll-Manifest_Range # | # | This patchset fixes the following Wine bugs: @@ -4367,9 +4294,6 @@ fi # Patchset server-File_Permissions # | -# | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-DOS_Attributes, ntdll-Junction_Points -# | # | This patchset fixes the following Wine bugs: # | * [#44691] Improve mapping of DACL to file permissions # | @@ -4400,7 +4324,7 @@ fi # Patchset server-Stored_ACLs # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-DOS_Attributes, ntdll-Junction_Points, server-File_Permissions +# | * ntdll-DOS_Attributes, server-File_Permissions # | # | This patchset fixes the following Wine bugs: # | * [#33576] Support for stored file ACLs @@ -4431,7 +4355,7 @@ fi # Patchset server-Inherited_ACLs # | # | This patchset has the following (direct or indirect) dependencies: -# | * ntdll-DOS_Attributes, ntdll-Junction_Points, server-File_Permissions, server-Stored_ACLs +# | * ntdll-DOS_Attributes, server-File_Permissions, server-Stored_ACLs # | # | Modified files: # | * dlls/advapi32/tests/security.c, server/file.c diff --git a/patches/server-File_Permissions/0002-server-Allow-to-open-files-without-any-permission-bi.patch b/patches/server-File_Permissions/0002-server-Allow-to-open-files-without-any-permission-bi.patch index cefe93f4..b8580e80 100644 --- a/patches/server-File_Permissions/0002-server-Allow-to-open-files-without-any-permission-bi.patch +++ b/patches/server-File_Permissions/0002-server-Allow-to-open-files-without-any-permission-bi.patch @@ -1,4 +1,4 @@ -From 9ecf9653d3f4d564f000d4e0f7f96ae0cd3610b2 Mon Sep 17 00:00:00 2001 +From b1dcc9759921e696a554c46d7aee2c4c29d3c7ae Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Fri, 3 Apr 2015 03:58:47 +0200 Subject: [PATCH] server: Allow to open files without any permission bits. (try @@ -13,7 +13,7 @@ Changes in v2: 2 files changed, 32 insertions(+), 20 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c -index 1ec2e6bbb48..cc59210e609 100644 +index 825f8451904..948c257cea2 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -3702,17 +3702,13 @@ static void test_CreateDirectoryA(void) @@ -65,10 +65,10 @@ index 1ec2e6bbb48..cc59210e609 100644 done: diff --git a/server/fd.c b/server/fd.c -index d238c43cf1f..8292a0b82f2 100644 +index e5e1fdbbf32..188a632575f 100644 --- a/server/fd.c +++ b/server/fd.c -@@ -1825,6 +1825,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, +@@ -1835,6 +1835,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, int root_fd = -1; int rw_mode; char *path; @@ -76,10 +76,10 @@ index d238c43cf1f..8292a0b82f2 100644 int created = (flags & O_CREAT); if (((options & FILE_DELETE_ON_CLOSE) && !(access & DELETE)) || -@@ -1891,10 +1892,28 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, - fd->unix_fd = open( name, rw_mode | O_SYMLINK | (flags & ~O_TRUNC), *mode ); +@@ -1894,10 +1895,28 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, + if ((access & FILE_UNIX_WRITE_ACCESS) || (flags & O_CREAT)) + fd->unix_fd = open( name, O_RDONLY | (flags & ~(O_TRUNC | O_CREAT | O_EXCL)), *mode ); } - #endif + else if (errno == EACCES) + { + /* try to change permissions temporarily to open a file descriptor */ @@ -105,14 +105,14 @@ index d238c43cf1f..8292a0b82f2 100644 goto error; } } -@@ -1909,6 +1928,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, +@@ -1912,6 +1931,7 @@ struct fd *open_fd( struct fd *root, const char *name, int flags, mode_t *mode, closed_fd->unix_fd = fd->unix_fd; closed_fd->unlink = 0; closed_fd->unix_name = fd->unix_name; + if (do_chmod) chmod( name, *mode ); - lstat( fd->unix_name, &st ); + fstat( fd->unix_fd, &st ); *mode = st.st_mode; -- -2.25.1 +2.27.0 diff --git a/patches/server-File_Permissions/definition b/patches/server-File_Permissions/definition index a699a6fd..0ebcf3ac 100644 --- a/patches/server-File_Permissions/definition +++ b/patches/server-File_Permissions/definition @@ -1,3 +1,2 @@ Fixes: Allow to open files/directories without any access rights in order to query attributes Fixes: [44691] Improve mapping of DACL to file permissions -Depends: ntdll-Junction_Points diff --git a/staging/upstream-commit b/staging/upstream-commit index 628d798f..aca0050a 100644 --- a/staging/upstream-commit +++ b/staging/upstream-commit @@ -1 +1 @@ -262e4ab9e0eeb126dde5cb4cba13fbf7f1d1cef0 +18ae539c914a9b5a89f63d8cf9c2a21273eccc6c