Rebase against 0b9620266f08d57c2db41b934a77b6ce4a94aeda.

This commit is contained in:
Zebediah Figura 2023-05-02 18:03:24 -05:00
parent 00ec1171cc
commit 2524bc48fe
14 changed files with 1 additions and 1250 deletions

View File

@ -1,123 +0,0 @@
From cd0e7d0bd693a35fde5a83f76af16cd04b17c5e3 Mon Sep 17 00:00:00 2001
From: Torge Matthies <tmatthies@codeweavers.com>
Date: Thu, 30 Mar 2023 05:46:38 +0200
Subject: [PATCH 1/6] ntdll/tests: Add test for file attributes of files with
names beginning with a dot.
---
dlls/ntdll/tests/file.c | 92 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 92 insertions(+)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 6186afdfb63..beaa4734931 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -4051,6 +4051,97 @@ static void test_file_attribute_tag_information(void)
CloseHandle( h );
}
+static void rename_file( HANDLE h, const WCHAR *filename )
+{
+ FILE_RENAME_INFORMATION *fri;
+ UNICODE_STRING ntpath;
+ IO_STATUS_BLOCK io;
+ NTSTATUS status;
+ BOOLEAN ret;
+ ULONG size;
+
+ ret = pRtlDosPathNameToNtPathName_U( filename, &ntpath, NULL, NULL );
+ ok( ret, "RtlDosPathNameToNtPathName_U failed\n" );
+
+ size = offsetof( FILE_RENAME_INFORMATION, FileName ) + ntpath.Length;
+ fri = HeapAlloc( GetProcessHeap(), 0, size );
+ ok( fri != NULL, "HeapAlloc failed\n" );
+ fri->ReplaceIfExists = TRUE;
+ fri->RootDirectory = NULL;
+ fri->FileNameLength = ntpath.Length;
+ memcpy( fri->FileName, ntpath.Buffer, ntpath.Length );
+ pRtlFreeUnicodeString( &ntpath );
+
+ status = pNtSetInformationFile( h, &io, fri, size, FileRenameInformation );
+ HeapFree( GetProcessHeap(), 0, fri );
+ ok( status == STATUS_SUCCESS, "got %#lx\n", status );
+}
+
+static void test_dotfile_file_attributes(void)
+{
+ char temppath[MAX_PATH], filename[MAX_PATH];
+ WCHAR temppathW[MAX_PATH], filenameW[MAX_PATH];
+ FILE_BASIC_INFORMATION info = {};
+ IO_STATUS_BLOCK io;
+ NTSTATUS status;
+ DWORD attrs;
+ HANDLE h;
+
+ GetTempPathA( MAX_PATH, temppath );
+ GetTempFileNameA( temppath, ".foo", 0, filename );
+ h = CreateFileA( filename, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, 0 );
+ ok( h != INVALID_HANDLE_VALUE, "failed to create temp file\n" );
+
+ status = nt_get_file_attrs(filename, &attrs);
+ ok( status == STATUS_SUCCESS, "got %#lx\n", status );
+ todo_wine ok( !(attrs & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", attrs );
+
+ status = pNtQueryInformationFile( h, &io, &info, sizeof(info), FileBasicInformation );
+ ok( status == STATUS_SUCCESS, "got %#lx\n", status );
+ ok( !(info.FileAttributes & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", info.FileAttributes );
+
+ info.FileAttributes = FILE_ATTRIBUTE_SYSTEM;
+ status = pNtSetInformationFile( h, &io, &info, sizeof(info), FileBasicInformation );
+ ok( status == STATUS_SUCCESS, "got %#lx\n", status );
+
+ status = nt_get_file_attrs(filename, &attrs);
+ ok( status == STATUS_SUCCESS, "got %#lx\n", status );
+ ok( attrs & FILE_ATTRIBUTE_SYSTEM, "got attributes %#lx\n", attrs );
+ todo_wine ok( !(attrs & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", attrs );
+
+ status = pNtQueryInformationFile( h, &io, &info, sizeof(info), FileBasicInformation );
+ ok( status == STATUS_SUCCESS, "got %#lx\n", status );
+ ok( info.FileAttributes & FILE_ATTRIBUTE_SYSTEM, "got attributes %#lx\n", info.FileAttributes );
+ ok( !(info.FileAttributes & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", info.FileAttributes );
+
+ CloseHandle( h );
+
+ GetTempPathW( MAX_PATH, temppathW );
+ GetTempFileNameW( temppathW, L"foo", 0, filenameW );
+ h = CreateFileW( filenameW, GENERIC_READ | GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_FLAG_DELETE_ON_CLOSE, 0 );
+ ok( h != INVALID_HANDLE_VALUE, "failed to create temp file\n" );
+
+ GetTempFileNameW( temppathW, L".foo", 0, filenameW );
+ winetest_push_context("foo -> .foo");
+ rename_file( h, filenameW );
+ winetest_pop_context();
+
+ status = pNtQueryInformationFile( h, &io, &info, sizeof(info), FileBasicInformation );
+ ok( status == STATUS_SUCCESS, "got %#lx\n", status );
+ ok( !(info.FileAttributes & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", info.FileAttributes );
+
+ GetTempFileNameW( temppathW, L"foo", 0, filenameW );
+ winetest_push_context(".foo -> foo");
+ rename_file( h, filenameW );
+ winetest_pop_context();
+
+ status = pNtQueryInformationFile( h, &io, &info, sizeof(info), FileBasicInformation );
+ ok( status == STATUS_SUCCESS, "got %#lx\n", status );
+ ok( !(info.FileAttributes & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", info.FileAttributes );
+
+ CloseHandle( h );
+}
+
static void test_file_mode(void)
{
UNICODE_STRING file_name, pipe_dev_name, mountmgr_dev_name, mailslot_dev_name;
@@ -5499,6 +5590,7 @@ START_TEST(file)
test_file_id_information();
test_file_access_information();
test_file_attribute_tag_information();
+ test_dotfile_file_attributes();
test_file_mode();
test_file_readonly_access();
test_query_volume_information_file();
--
2.40.0

View File

@ -1,46 +0,0 @@
From bf28841ea6e717ed625ccd02a025fb6153f45677 Mon Sep 17 00:00:00 2001
From: Torge Matthies <tmatthies@codeweavers.com>
Date: Thu, 30 Mar 2023 05:46:39 +0200
Subject: [PATCH 2/6] ntdll: Do not open-code hidden file handling in
get_dir_data_entry.
Signed-off-by: Torge Matthies <tmatthies@codeweavers.com>
---
dlls/ntdll/unix/file.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index eca75b2d4fb..f48de4641b3 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1303,7 +1303,7 @@ static BOOL is_hidden_file( const UNICODE_STRING *name )
end = p = name->Buffer + name->Length/sizeof(WCHAR);
while (p > name->Buffer && p[-1] == '\\') p--;
while (p > name->Buffer && p[-1] != '\\') p--;
- return (p < end && *p == '.');
+ return (p < end && p + 1 != end && p[0] == '.' && p[1] != '\\' && (p[1] != '.' || (p + 2 != end && p[2] != '\\')));
}
@@ -2224,6 +2224,7 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I
union file_directory_info *info;
struct stat st;
ULONG name_len, start, dir_size, attributes;
+ UNICODE_STRING name;
if (get_file_info( names->unix_name, &st, &attributes ) == -1)
{
@@ -2253,8 +2254,8 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I
{
if (st.st_dev != dir_data->id.dev) st.st_ino = 0; /* ignore inode if on a different device */
- if (!show_dot_files && names->long_name[0] == '.' && names->long_name[1] &&
- (names->long_name[1] != '.' || names->long_name[2]))
+ RtlInitUnicodeString( &name, names->long_name );
+ if (is_hidden_file( &name ))
attributes |= FILE_ATTRIBUTE_HIDDEN;
fill_file_info( &st, attributes, info, class );
--
2.40.0

View File

@ -1,91 +0,0 @@
From 46d8829db7ced55d93da228e7777b9f7a6a02e7d Mon Sep 17 00:00:00 2001
From: Torge Matthies <tmatthies@codeweavers.com>
Date: Thu, 30 Mar 2023 05:46:39 +0200
Subject: [PATCH 3/6] ntdll: Handle hidden file names inside get_file_info
instead of after it.
Signed-off-by: Torge Matthies <tmatthies@codeweavers.com>
---
dlls/ntdll/unix/file.c | 25 +++++++++----------------
1 file changed, 9 insertions(+), 16 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index f48de4641b3..59e96a88279 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1292,17 +1292,17 @@ static BOOLEAN get_dir_case_sensitivity( const char *dir )
/***********************************************************************
* is_hidden_file
*
- * Check if the specified file should be hidden based on its name and the show dot files option.
+ * Check if the specified file should be hidden based on its unix path and the show dot files option.
*/
-static BOOL is_hidden_file( const UNICODE_STRING *name )
+static BOOL is_hidden_file( const char *name )
{
- WCHAR *p, *end;
+ const char *p, *end;
if (show_dot_files) return FALSE;
- end = p = name->Buffer + name->Length/sizeof(WCHAR);
- while (p > name->Buffer && p[-1] == '\\') p--;
- while (p > name->Buffer && p[-1] != '\\') p--;
+ end = p = name + strlen( name );
+ while (p > name && p[-1] == '/') p--;
+ while (p > name && p[-1] != '/') p--;
return (p < end && p + 1 != end && p[0] == '.' && p[1] != '\\' && (p[1] != '.' || (p + 2 != end && p[2] != '\\')));
}
@@ -1677,6 +1677,9 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
}
*attr |= get_file_attributes( st );
+ if (is_hidden_file( path ))
+ *attr |= FILE_ATTRIBUTE_HIDDEN;
+
attr_len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, attr_data, sizeof(attr_data)-1 );
if (attr_len != -1)
*attr |= parse_samba_dos_attrib_data( attr_data, attr_len );
@@ -2224,7 +2227,6 @@ static NTSTATUS get_dir_data_entry( struct dir_data *dir_data, void *info_ptr, I
union file_directory_info *info;
struct stat st;
ULONG name_len, start, dir_size, attributes;
- UNICODE_STRING name;
if (get_file_info( names->unix_name, &st, &attributes ) == -1)
{
@@ -2253,11 +2255,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 */
-
- RtlInitUnicodeString( &name, names->long_name );
- if (is_hidden_file( &name ))
- attributes |= FILE_ATTRIBUTE_HIDDEN;
-
fill_file_info( &st, attributes, info, class );
}
@@ -4219,7 +4216,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;
}
free( unix_name );
}
@@ -4250,10 +4246,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
- {
status = fill_file_info( &st, attributes, info, FileBasicInformation );
- if (is_hidden_file( attr->ObjectName )) info->FileAttributes |= FILE_ATTRIBUTE_HIDDEN;
- }
free( unix_name );
}
else WARN( "%s not found (%x)\n", debugstr_us(attr->ObjectName), status );
--
2.40.0

View File

@ -1,49 +0,0 @@
From 0fa1566f7cab73de95f7d4b51b83766576a60727 Mon Sep 17 00:00:00 2001
From: Torge Matthies <tmatthies@codeweavers.com>
Date: Thu, 30 Mar 2023 05:46:39 +0200
Subject: [PATCH 4/6] ntdll: Only infer hidden attribute from file name if
xattr is not present.
Signed-off-by: Torge Matthies <tmatthies@codeweavers.com>
---
dlls/ntdll/tests/file.c | 2 +-
dlls/ntdll/unix/file.c | 5 ++---
2 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index beaa4734931..cdd924a7226 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -4107,7 +4107,7 @@ static void test_dotfile_file_attributes(void)
status = nt_get_file_attrs(filename, &attrs);
ok( status == STATUS_SUCCESS, "got %#lx\n", status );
ok( attrs & FILE_ATTRIBUTE_SYSTEM, "got attributes %#lx\n", attrs );
- todo_wine ok( !(attrs & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", attrs );
+ ok( !(attrs & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", attrs );
status = pNtQueryInformationFile( h, &io, &info, sizeof(info), FileBasicInformation );
ok( status == STATUS_SUCCESS, "got %#lx\n", status );
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 59e96a88279..d127e113230 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1677,14 +1677,13 @@ static int get_file_info( const char *path, struct stat *st, ULONG *attr )
}
*attr |= get_file_attributes( st );
- if (is_hidden_file( path ))
- *attr |= FILE_ATTRIBUTE_HIDDEN;
-
attr_len = xattr_get( path, SAMBA_XATTR_DOS_ATTRIB, attr_data, sizeof(attr_data)-1 );
if (attr_len != -1)
*attr |= parse_samba_dos_attrib_data( attr_data, attr_len );
else
{
+ if (is_hidden_file( path ))
+ *attr |= FILE_ATTRIBUTE_HIDDEN;
if (errno == ENOTSUP) return ret;
#ifdef ENODATA
if (errno == ENODATA) return ret;
--
2.40.0

View File

@ -1,132 +0,0 @@
From 2ad3cf7addcbf191db85365c0c52aa24935dcdf5 Mon Sep 17 00:00:00 2001
From: Torge Matthies <tmatthies@codeweavers.com>
Date: Thu, 30 Mar 2023 05:46:39 +0200
Subject: [PATCH 5/6] ntdll: Set xattr in NtCreateFile if inferred and
requested attributes don't match.
And make sure it doesn't get deleted.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53826
Signed-off-by: Torge Matthies <tmatthies@codeweavers.com>
---
dlls/ntdll/tests/file.c | 2 +-
dlls/ntdll/unix/file.c | 26 +++++++++++++++++++-------
2 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index cdd924a7226..b96b2e5b072 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -4094,7 +4094,7 @@ static void test_dotfile_file_attributes(void)
status = nt_get_file_attrs(filename, &attrs);
ok( status == STATUS_SUCCESS, "got %#lx\n", status );
- todo_wine ok( !(attrs & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", attrs );
+ ok( !(attrs & FILE_ATTRIBUTE_HIDDEN), "got attributes %#lx\n", attrs );
status = pNtQueryInformationFile( h, &io, &info, sizeof(info), FileBasicInformation );
ok( status == STATUS_SUCCESS, "got %#lx\n", status );
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index d127e113230..5f5aa9be87c 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -1600,11 +1600,11 @@ static int fd_get_file_info( int fd, unsigned int options, struct stat *st, ULON
}
-static int fd_set_dos_attrib( int fd, UINT attr )
+static int fd_set_dos_attrib( int fd, UINT attr, BOOL force_set )
{
/* we only store the HIDDEN and SYSTEM attributes */
attr &= XATTR_ATTRIBS_MASK;
- if (attr != 0)
+ if (force_set || attr != 0)
{
/* encode the attributes in Samba 3 ASCII format. Samba 4 has extended
* this format with more features, but retains compatibility with the
@@ -1618,7 +1618,7 @@ static int fd_set_dos_attrib( int fd, UINT attr )
/* set the stat info and file attributes for a file (by file descriptor) */
-static NTSTATUS fd_set_file_info( int fd, UINT attr )
+static NTSTATUS fd_set_file_info( int fd, UINT attr, BOOL force_set_xattr )
{
struct stat st;
@@ -1637,7 +1637,8 @@ static NTSTATUS fd_set_file_info( int fd, UINT attr )
}
if (fchmod( fd, st.st_mode ) == -1) return errno_to_status( errno );
- if (fd_set_dos_attrib( fd, attr ) == -1 && errno != ENOTSUP)
+ force_set_xattr = force_set_xattr || st.st_nlink > 1;
+ if (fd_set_dos_attrib( fd, attr, force_set_xattr ) == -1 && errno != ENOTSUP)
WARN( "Failed to set extended attribute " SAMBA_XATTR_DOS_ATTRIB ". errno %d (%s)\n",
errno, strerror( errno ) );
@@ -3963,6 +3964,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
OBJECT_ATTRIBUTES new_attr;
UNICODE_STRING nt_name;
char *unix_name;
+ BOOL name_hidden = FALSE;
BOOL created = FALSE;
unsigned int status;
@@ -4005,6 +4007,7 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
if (status == STATUS_SUCCESS)
{
+ name_hidden = is_hidden_file( unix_name );
status = open_unix_file( handle, unix_name, access, &new_attr, attributes,
sharing, disposition, options, ea_buffer, ea_length );
free( unix_name );
@@ -4032,14 +4035,15 @@ NTSTATUS WINAPI NtCreateFile( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBU
break;
}
- if (io->Information == FILE_CREATED && (attributes & XATTR_ATTRIBS_MASK))
+ if (io->Information == FILE_CREATED &&
+ ((attributes & XATTR_ATTRIBS_MASK) || name_hidden))
{
int fd, needs_close;
/* set any DOS extended attributes */
if (!server_get_unix_fd( *handle, 0, &fd, &needs_close, NULL, NULL ))
{
- if (fd_set_dos_attrib( fd, attributes ) == -1 && errno != ENOTSUP)
+ if (fd_set_dos_attrib( fd, attributes, TRUE ) == -1 && errno != ENOTSUP)
WARN( "Failed to set extended attribute " SAMBA_XATTR_DOS_ATTRIB ". errno %d (%s)",
errno, strerror( errno ) );
if (needs_close) close( fd );
@@ -4561,10 +4565,14 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
{
const FILE_BASIC_INFORMATION *info = ptr;
LARGE_INTEGER mtime, atime;
+ char *unix_name;
if ((status = server_get_unix_fd( handle, 0, &fd, &needs_close, NULL, NULL )))
return io->u.Status = status;
+ if ((status = server_get_unix_name( handle, &unix_name )))
+ unix_name = NULL;
+
mtime.QuadPart = info->LastWriteTime.QuadPart == -1 ? 0 : info->LastWriteTime.QuadPart;
atime.QuadPart = info->LastAccessTime.QuadPart == -1 ? 0 : info->LastAccessTime.QuadPart;
@@ -4572,9 +4580,13 @@ NTSTATUS WINAPI NtSetInformationFile( HANDLE handle, IO_STATUS_BLOCK *io,
status = set_file_times( fd, &mtime, &atime );
if (status == STATUS_SUCCESS && info->FileAttributes)
- status = fd_set_file_info( fd, info->FileAttributes );
+ {
+ BOOL force_xattr = unix_name && is_hidden_file( unix_name );
+ status = fd_set_file_info( fd, info->FileAttributes, force_xattr );
+ }
if (needs_close) close( fd );
+ free( unix_name );
}
else status = STATUS_INVALID_PARAMETER_3;
break;
--
2.40.0

View File

@ -1,43 +0,0 @@
From 6fa8d2eea71223e52ab957247cb91011404ee381 Mon Sep 17 00:00:00 2001
From: Torge Matthies <tmatthies@codeweavers.com>
Date: Thu, 30 Mar 2023 05:46:39 +0200
Subject: [PATCH 6/6] ntdll/tests: Increase margins in timer merging tests.
This test failed in the GitLab test runner.
Signed-off-by: Torge Matthies <tmatthies@codeweavers.com>
---
dlls/ntdll/tests/threadpool.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/tests/threadpool.c b/dlls/ntdll/tests/threadpool.c
index 168f00c2852..c23157d3207 100644
--- a/dlls/ntdll/tests/threadpool.c
+++ b/dlls/ntdll/tests/threadpool.c
@@ -1563,18 +1563,18 @@ static void test_tp_window_length(void)
info2.ticks = 0;
NtQuerySystemTime( &when );
- when.QuadPart += (ULONGLONG)250 * 10000;
+ when.QuadPart += (ULONGLONG)500 * 10000;
pTpSetTimer(timer2, &when, 0, 0);
- Sleep(50);
- when.QuadPart -= (ULONGLONG)150 * 10000;
- pTpSetTimer(timer1, &when, 0, 75);
+ Sleep(100);
+ when.QuadPart -= (ULONGLONG)300 * 10000;
+ pTpSetTimer(timer1, &when, 0, 150);
result = WaitForSingleObject(semaphore, 1000);
ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
result = WaitForSingleObject(semaphore, 1000);
ok(result == WAIT_OBJECT_0, "WaitForSingleObject returned %lu\n", result);
ok(info1.ticks != 0 && info2.ticks != 0, "expected that ticks are nonzero\n");
- ok(info2.ticks >= info1.ticks + 75 || broken(info2.ticks < info1.ticks + 75) /* Win 2008 */,
+ ok(info2.ticks >= info1.ticks + 150 || broken(info2.ticks < info1.ticks + 150) /* Win 2008 */,
"expected that timers are not merged\n");
/* timers will be merged */
--
2.40.0

View File

@ -1,2 +0,0 @@
Fixes: [53826] Attempting to install / update battle.net fails with Qt error
MR: [1148] ntdll: Mark created files beginning with a dot as not hidden.

View File

@ -1,370 +0,0 @@
From 2a65304628648472b9c9bd85d2230a020aa5ca1c Mon Sep 17 00:00:00 2001
From: Louis Lenders <xerox.xerox2000x@gmail.com>
Date: Wed, 5 Aug 2020 08:39:14 +0200
Subject: [PATCH] findstr: add basic functionality (also support literal search
option e.g. c:/"foo bar")
Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
---
programs/findstr/Makefile.in | 4 +
programs/findstr/findstr.rc | 27 ++++
programs/findstr/main.c | 243 ++++++++++++++++++++++++++++++++++-
programs/findstr/resources.h | 29 +++++
4 files changed, 299 insertions(+), 4 deletions(-)
create mode 100644 programs/findstr/findstr.rc
create mode 100644 programs/findstr/resources.h
diff --git a/programs/findstr/Makefile.in b/programs/findstr/Makefile.in
index e97ec9c20e3..40142508981 100644
--- a/programs/findstr/Makefile.in
+++ b/programs/findstr/Makefile.in
@@ -1,6 +1,10 @@
MODULE = findstr.exe
+IMPORTS = user32
EXTRADLLFLAGS = -mconsole -municode
C_SRCS = \
main.c
+
+RC_SRCS = \
+ findstr.rc
diff --git a/programs/findstr/findstr.rc b/programs/findstr/findstr.rc
new file mode 100644
index 00000000000..3a6fad7eb1a
--- /dev/null
+++ b/programs/findstr/findstr.rc
@@ -0,0 +1,27 @@
+/*
+ * Copyright 2019 Fabian Maurer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "resources.h"
+
+STRINGTABLE
+{
+ IDS_INVALID_PARAMETER "FINDSTR: Parameter format not correct\r\n"
+ IDS_INVALID_SWITCH "FINDSTR: Invalid switch\r\n"
+ IDS_FILE_NOT_FOUND "File not found - %s\r\n"
+ IDS_USAGE "Usage: findstr /options string filename\r\n"
+}
diff --git a/programs/findstr/main.c b/programs/findstr/main.c
index d25e1965f6e..dc73fbba666 100644
--- a/programs/findstr/main.c
+++ b/programs/findstr/main.c
@@ -1,5 +1,6 @@
/*
* Copyright 2012 Qian Hong
+ * Copyright 2018 Fabian Maurer
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -16,18 +17,252 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include <windows.h>
+#include <stdlib.h>
+#include <shlwapi.h>
+
+#include "wine/heap.h"
#include "wine/debug.h"
+#include "resources.h"
WINE_DEFAULT_DEBUG_CHANNEL(findstr);
+static BOOL read_char_from_handle(HANDLE handle, char *char_out)
+{
+ static char buffer[4096];
+ static DWORD buffer_max = 0;
+ static DWORD buffer_pos = 0;
+
+ /* Read next content into buffer */
+ if (buffer_pos >= buffer_max)
+ {
+ BOOL success = ReadFile(handle, buffer, 4096, &buffer_max, NULL);
+ if (!success || !buffer_max)
+ return FALSE;
+ buffer_pos = 0;
+ }
+
+ *char_out = buffer[buffer_pos++];
+ return TRUE;
+}
+
+/* Read a line from a handle, returns NULL if the end is reached */
+static WCHAR* read_line_from_handle(HANDLE handle)
+{
+ int line_max = 4096;
+ int length = 0;
+ WCHAR *line_converted;
+ int line_converted_length;
+ BOOL success;
+ char *line = heap_alloc(line_max);
+
+ for (;;)
+ {
+ char c;
+ success = read_char_from_handle(handle, &c);
+
+ /* Check for EOF */
+ if (!success)
+ {
+ if (length == 0)
+ return NULL;
+ else
+ break;
+ }
+
+ if (c == '\n')
+ break;
+
+ /* Make sure buffer is large enough */
+ if (length + 1 >= line_max)
+ {
+ line_max *= 2;
+ line = heap_realloc(line, line_max);
+ }
+
+ line[length++] = c;
+ }
+
+ line[length] = 0;
+ if (length - 1 >= 0 && line[length - 1] == '\r') /* Strip \r of windows line endings */
+ line[length - 1] = 0;
+
+ line_converted_length = MultiByteToWideChar(CP_ACP, 0, line, -1, 0, 0);
+ line_converted = heap_alloc(line_converted_length * sizeof(WCHAR));
+ MultiByteToWideChar(CP_ACP, 0, line, -1, line_converted, line_converted_length);
+
+ heap_free(line);
+
+ return line_converted;
+}
+
+static void write_to_stdout(const WCHAR *str)
+{
+ char *str_converted;
+ UINT str_converted_length;
+ DWORD bytes_written;
+ UINT str_length = lstrlenW(str);
+ int codepage = CP_ACP;
+
+ str_converted_length = WideCharToMultiByte(codepage, 0, str, str_length, NULL, 0, NULL, NULL);
+ str_converted = heap_alloc(str_converted_length);
+ WideCharToMultiByte(codepage, 0, str, str_length, str_converted, str_converted_length, NULL, NULL);
+
+ WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), str_converted, str_converted_length, &bytes_written, NULL);
+ if (bytes_written < str_converted_length)
+ ERR("Failed to write output\n");
+
+ heap_free(str_converted);
+}
+
+static BOOL run_find_for_line(const WCHAR *line, const WCHAR *tofind)
+{
+ WCHAR *found;
+ WCHAR lineending[] = {'\r', '\n', 0};
+
+ if (lstrlenW(line) == 0 || lstrlenW(tofind) == 0)
+ return FALSE;
+
+ found = wcsstr(line, tofind);
+
+ if (found)
+ {
+ write_to_stdout(line);
+ write_to_stdout(lineending);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
+static void output_resource_message(int id)
+{
+ WCHAR buffer[64];
+ LoadStringW(GetModuleHandleW(NULL), id, buffer, ARRAY_SIZE(buffer));
+ write_to_stdout(buffer);
+}
+
int __cdecl wmain(int argc, WCHAR *argv[])
{
+ WCHAR *line;
+ WCHAR *pattern = NULL; WCHAR *tofind = NULL;
int i;
+ int exitcode;
+ int file_paths_len = 0;
+ int file_paths_max = 0;
+ WCHAR** file_paths = NULL;
+ BOOL exact_match = FALSE;
- WINE_FIXME("stub:");
+ TRACE("running find:");
for (i = 0; i < argc; i++)
- WINE_FIXME(" %s", wine_dbgstr_w(argv[i]));
- WINE_FIXME("\n");
+ {
+ FIXME(" %s", wine_dbgstr_w(argv[i]));
+ }
+ TRACE("\n");
+
+ for (i = 1; i < argc; i++)
+ {
+ if (argv[i][0] == '/')
+ {
+ switch(argv[i][1])
+ {
+ case '?':
+ output_resource_message(IDS_USAGE);
+ return 0;
+ case 'C':
+ case 'c':
+ if (argv[i][2] == ':')
+ {
+ pattern = argv[i] + 3;
+ exact_match = TRUE;
+ }
+ break;
+ default:
+ ;
+ }
+ }
+ else if (pattern == NULL)
+ {
+ pattern = argv[i];
+ }
+ else
+ {
+ if (file_paths_len >= file_paths_max)
+ {
+ file_paths_max = file_paths_max ? file_paths_max * 2 : 2;
+ file_paths = heap_realloc(file_paths, sizeof(WCHAR*) * file_paths_max);
+ }
+ file_paths[file_paths_len++] = argv[i];
+ }
+ }
+
+ if (pattern == NULL)
+ {
+ output_resource_message(IDS_INVALID_PARAMETER);
+ return 2;
+ }
+
+ exitcode = 1;
+
+ if (file_paths_len > 0)
+ {
+ for (i = 0; i < file_paths_len; i++)
+ {
+ HANDLE input;
+ WCHAR file_path_upper[MAX_PATH];
+
+ wcscpy(file_path_upper, file_paths[i]);
+ wcsupr(file_path_upper);
+
+ input = CreateFileW(file_paths[i], GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, NULL);
+
+ if (input == INVALID_HANDLE_VALUE)
+ {
+ WCHAR buffer_message[64];
+ WCHAR message[300];
+
+ LoadStringW(GetModuleHandleW(NULL), IDS_FILE_NOT_FOUND, buffer_message, ARRAY_SIZE(buffer_message));
+
+ wsprintfW(message, buffer_message, file_path_upper);
+ write_to_stdout(message);
+ continue;
+ }
+ while ((line = read_line_from_handle(input)) != NULL)
+ {
+ tofind = _wcstok (pattern, exact_match ? L"" : L" |" ); /* break up (if necessary) search pattern like "foo bar" or "foo | bar" into "foo" and "bar" */
+ while (tofind != NULL)
+ {
+ if (run_find_for_line(line, tofind))
+ {
+ exitcode = 0;
+ break;
+ }
+ tofind = _wcstok (NULL, L" |");
+ }
+ heap_free(line);
+ }
+ CloseHandle(input);
+ }
+ }
+ else
+ {
+ HANDLE input = GetStdHandle(STD_INPUT_HANDLE);
+ while ((line = read_line_from_handle(input)) != NULL)
+ {
+ tofind = _wcstok (pattern, exact_match ? L"" : L" |" ); /* break up (if necessary) search pattern like "foo bar" or "foo | bar" into "foo" and "bar" */
+ while (tofind != NULL)
+ {
+ if (run_find_for_line(line, tofind))
+ {
+ exitcode = 0;
+ break;
+ }
+ tofind = _wcstok (NULL, L" |");
+ }
+ heap_free(line);
+ }
+ }
- return 0;
+ heap_free(file_paths);
+ return exitcode;
}
diff --git a/programs/findstr/resources.h b/programs/findstr/resources.h
new file mode 100644
index 00000000000..e868c7efa4a
--- /dev/null
+++ b/programs/findstr/resources.h
@@ -0,0 +1,29 @@
+/*
+ * Resource IDs
+ *
+ * Copyright 2019 Fabian Maurer
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#ifndef __WINE_FINDSTR_RESOURCES_H
+#define __WINE_FINDSTR_RESOURCES_H
+
+#define IDS_INVALID_PARAMETER 1000
+#define IDS_INVALID_SWITCH 1001
+#define IDS_FILE_NOT_FOUND 1002
+#define IDS_USAGE 1003
+
+#endif /* __WINE_FINDSTR_RESOURCES_H */
--
2.33.0

View File

@ -1 +0,0 @@
Fixes: [35254] findstr: Add minimal implementation

View File

@ -1,215 +0,0 @@
From b3c4bb00f3047ec00bce174a2c74519859e234fc Mon Sep 17 00:00:00 2001
From: Louis Lenders <xerox.xerox2000x@gmail.com>
Date: Mon, 17 Feb 2020 23:33:29 +0100
Subject: [PATCH] tasklist.exe: add minimal functionality
Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
---
programs/tasklist/tasklist.c | 180 ++++++++++++++++++++++++++++++++++-
1 file changed, 179 insertions(+), 1 deletion(-)
diff --git a/programs/tasklist/tasklist.c b/programs/tasklist/tasklist.c
index fd03f50dae..6e88895d5e 100644
--- a/programs/tasklist/tasklist.c
+++ b/programs/tasklist/tasklist.c
@@ -16,18 +16,196 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include <windows.h>
+#include <winternl.h>
+
+#include "wine/heap.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(tasklist);
+static HRESULT (WINAPI *pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS,void*,ULONG,ULONG*);
+
+static BOOL has_pid = FALSE, has_eq = FALSE, has_filter=FALSE, has_imagename = FALSE;
+
+WCHAR req_pid[sizeof(HANDLE)];
+WCHAR req_imagename[MAX_PATH];
+
+static void write_to_stdout(const WCHAR *str)
+{
+ char *str_converted;
+ UINT str_converted_length;
+ DWORD bytes_written;
+ UINT str_length = lstrlenW(str);
+ int codepage = CP_ACP;
+
+ str_converted_length = WideCharToMultiByte(codepage, 0, str, str_length, NULL, 0, NULL, NULL);
+ str_converted = heap_alloc(str_converted_length);
+ WideCharToMultiByte(codepage, 0, str, str_length, str_converted, str_converted_length, NULL, NULL);
+
+ WriteFile(GetStdHandle(STD_OUTPUT_HANDLE), str_converted, str_converted_length, &bytes_written, NULL);
+ if (bytes_written < str_converted_length)
+ ERR("Failed to write output\n");
+
+ heap_free(str_converted);
+}
+
+static void write_out_processes(void)
+{
+ ULONG ret_size, i;
+ NTSTATUS status;
+ BYTE *buf = NULL;
+ ULONG size = 0;
+ SYSTEM_PROCESS_INFORMATION *spi = NULL;
+ ULONG processcount = 0;
+ WCHAR pid[sizeof(HANDLE)];
+
+ do
+ {
+ size += 0x10000;
+ buf = heap_alloc(size);
+
+ status = pNtQuerySystemInformation(SystemProcessInformation, buf, size, &ret_size);
+
+ if (status == STATUS_INFO_LENGTH_MISMATCH)
+ heap_free(buf);
+
+ } while (status == STATUS_INFO_LENGTH_MISMATCH);
+
+ /* Get number of processes */
+ spi = (SYSTEM_PROCESS_INFORMATION *)buf;
+ while (spi)
+ {
+ processcount++;
+ if (spi->NextEntryOffset == 0)
+ break;
+ spi = (SYSTEM_PROCESS_INFORMATION *)((BYTE *)spi + spi->NextEntryOffset);
+ }
+
+ spi = (SYSTEM_PROCESS_INFORMATION *)buf;
+ /* only print non-verbose processname + pid in csv format*/
+ for (i=0; i<processcount; i++)
+ {
+ swprintf(pid, ARRAY_SIZE(pid), L"%d", spi->UniqueProcessId);
+
+ if (has_filter && has_pid && has_eq && wcsicmp(pid,req_pid))
+ TRACE("filter on, skip writing info for %s\n", wine_dbgstr_w(pid));
+ else if (has_filter && has_imagename && has_eq && wcsicmp(spi->ProcessName.Buffer,req_imagename))
+ TRACE("filter on, skip writing onfo for %s\n", wine_dbgstr_w(spi->ProcessName.Buffer));
+ else
+ {
+ write_to_stdout(spi->ProcessName.Buffer);
+ write_to_stdout(L",");
+ write_to_stdout(pid);
+ write_to_stdout(L"\n");
+ }
+ spi = (SYSTEM_PROCESS_INFORMATION *)((BYTE *)spi + spi->NextEntryOffset);
+ }
+}
+
+
+static BOOL process_arguments(int argc, WCHAR *argv[])
+{
+ int i;
+ WCHAR *argdata;
+
+ if (argc == 1)
+ return TRUE;
+
+ for (i = 1; i < argc; i++)
+ {
+ argdata = argv[i];
+
+ if (*argdata != '/')
+ goto invalid;
+ argdata++;
+
+ if (!wcsicmp(L"nh", argdata) || !wcsicmp(L"v", argdata))
+ FIXME("Option %s ignored\n", wine_dbgstr_w(argdata));
+
+ if (!wcsicmp(L"fo", argdata))
+ {
+ i++;
+ FIXME("Option %s ignored\n", wine_dbgstr_w(argdata));
+ }
+
+ if (!wcsicmp(L"\?", argdata) || !wcsicmp(L"s", argdata) || !wcsicmp(L"svc", argdata) ||
+ !wcsicmp(L"u", argdata) || !wcsicmp(L"p", argdata) || !wcsicmp(L"m", argdata))
+ {
+ FIXME("Option %s not implemented, returning error for now\n", wine_dbgstr_w(argdata));
+ return FALSE;
+ }
+
+ if (!wcsicmp(L"fi", argdata))
+ {
+ has_filter = TRUE;
+
+ if (!argv[i + 1])
+ goto invalid;
+ i++;
+
+ argdata = argv[i];
+
+ while(iswspace(*argdata)) ++argdata;
+ /* FIXME might need more invalid option stings here */
+ if (!wcsnicmp(L"PID", argdata,3))
+ has_pid = TRUE;
+
+ else if (!wcsnicmp(L"Imagename", argdata,9))
+ has_imagename = TRUE;
+ /* FIXME report other unhandled stuff like STATUS, CPUTIME etc. here */
+ else
+ FIXME("Filter option %s ignored\n", wine_dbgstr_w(argdata));
+
+ while(!iswspace(*argdata)) ++argdata;
+ while(iswspace(*argdata)) ++argdata;
+
+ if (!wcsnicmp(L"eq", argdata,2))
+ has_eq = TRUE;
+ else
+ FIXME("Filter operator %s ignored\n", wine_dbgstr_w(argdata));
+
+ while(!iswspace(*argdata)) ++argdata;
+ while(iswspace(*argdata)) ++argdata;
+ /* FIXME report / return error if pid or imagename is missing in command line (?)*/
+ if(has_pid)
+ lstrcpyW(req_pid, argdata);
+
+ if(has_imagename)
+ lstrcpyW(req_imagename, argdata);
+ }
+ }
+
+ return TRUE;
+
+ invalid:
+ ERR("Invalid usage\n");
+ return FALSE;
+}
+
int __cdecl wmain(int argc, WCHAR *argv[])
{
int i;
- WINE_FIXME("stub:");
+ pNtQuerySystemInformation = (void *)GetProcAddress(GetModuleHandleW(L"ntdll.dll"), "NtQuerySystemInformation");
+
+ if (!pNtQuerySystemInformation)
+ {
+ ERR("failed to get functionpointer\n");
+ return -1;
+ }
+
+ WINE_FIXME("stub, only printing tasks in cvs format...\n");
for (i = 0; i < argc; i++)
WINE_FIXME(" %s", wine_dbgstr_w(argv[i]));
WINE_FIXME("\n");
+ if(!process_arguments(argc, argv))
+ return 1;
+
+ write_out_processes();
+
return 0;
}
--
2.25.0

View File

@ -1 +0,0 @@
Fixes: [48596] Tasklist add basic functionality.

View File

@ -1,174 +0,0 @@
From d83180d032eee8c3ec72c22fc2706d8b7231090e Mon Sep 17 00:00:00 2001
From: Alex Henrie <alexhenrie24@gmail.com>
Date: Sun, 1 Mar 2020 17:58:12 -0700
Subject: [PATCH] winemenubuilder: Blacklist desktop integration for certain
associations
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=41275
Signed-off-by: Alex Henrie <alexhenrie24@gmail.com>
---
dlls/mshtml/mshtml.inf | 6 +++
loader/wine.inf.in | 10 +++++
programs/winemenubuilder/winemenubuilder.c | 52 +++++++++++++++++++---
3 files changed, 62 insertions(+), 6 deletions(-)
diff --git a/dlls/mshtml/mshtml.inf b/dlls/mshtml/mshtml.inf
index 4a650b444fc..548739f4326 100644
--- a/dlls/mshtml/mshtml.inf
+++ b/dlls/mshtml/mshtml.inf
@@ -111,6 +111,7 @@ HKCR,"giffile\shell\open\ddeexec",,,"""file:%%1"",,-1,,,,,"
HKCR,"giffile\shell\open\ddeexec\Application",,,"IExplore"
HKCR,"giffile\shell\open\ddeexec\Topic",,,"WWW_OpenURL"
;; HKCR,"giffile\DefaultIcon",,,"%16422%\Internet Explorer\iexplore.exe,9"
+HKCU,Software\Wine\FileOpenBlacklist\.gif,"iexplore",,"""%16422%\Internet Explorer\iexplore.exe"" -nohome"
;; GZIP
HKCR,"MIME\Database\Content Type\application/x-gzip","Extension",,".gz"
@@ -158,6 +159,7 @@ HKCR,"jpegfile\shell\open\ddeexec",,,"""file:%%1"",,-1,,,,,"
HKCR,"jpegfile\shell\open\ddeexec\Application",,,"IExplore"
HKCR,"jpegfile\shell\open\ddeexec\Topic",,,"WWW_OpenURL"
;; HKCR,"jpegfile\DefaultIcon",,,"%16422%\Internet Explorer\iexplore.exe,8"
+HKCU,Software\Wine\FileOpenBlacklist\.jpe,"iexplore",,"""%16422%\Internet Explorer\iexplore.exe"" -nohome"
;; JPEG
HKCR,"MIME\Database\Content Type\image/jpeg","CLSID",,"%CLSID_HTMLDocument%"
@@ -173,6 +175,7 @@ HKCR,"jpegfile\shell\open\ddeexec",,,"""file:%%1"",,-1,,,,,"
HKCR,"jpegfile\shell\open\ddeexec\Application",,,"IExplore"
HKCR,"jpegfile\shell\open\ddeexec\Topic",,,"WWW_OpenURL"
;; HKCR,"jpegfile\DefaultIcon",,,"%16422%\Internet Explorer\iexplore.exe,8"
+HKCU,Software\Wine\FileOpenBlacklist\.jpeg,"iexplore",,"""%16422%\Internet Explorer\iexplore.exe"" -nohome"
;; JPG
HKCR,".jpg",,2,"jpegfile"
@@ -184,6 +187,7 @@ HKCR,"jpegfile\shell\open\ddeexec",,,"""file:%%1"",,-1,,,,,"
HKCR,"jpegfile\shell\open\ddeexec\Application",,,"IExplore"
HKCR,"jpegfile\shell\open\ddeexec\Topic",,,"WWW_OpenURL"
;; HKCR,"jpegfile\DefaultIcon",,,"%16422%\Internet Explorer\iexplore.exe,8"
+HKCU,Software\Wine\FileOpenBlacklist\.jpg,"iexplore",,"""%16422%\Internet Explorer\iexplore.exe"" -nohome"
;; MHTML
HKCR,"MIME\Database\Content Type\message/rfc822","CLSID",,"%CLSID_MHTMLDocument%"
@@ -221,6 +225,7 @@ HKCR,"pjpegfile\shell\open\ddeexec",,,"""file:%%1"",,-1,,,,,"
HKCR,"pjpegfile\shell\open\ddeexec\Application",,,"IExplore"
HKCR,"pjpegfile\shell\open\ddeexec\Topic",,,"WWW_OpenURL"
;; HKCR,"pjpegfile\DefaultIcon",,,"%16422%\Internet Explorer\iexplore.exe,8"
+HKCU,Software\Wine\FileOpenBlacklist\.jfif,"iexplore",,"""%16422%\Internet Explorer\iexplore.exe"" -nohome"
;; PNG
HKCR,"MIME\Database\Content Type\image/png","Extension",,".png"
@@ -234,6 +239,7 @@ HKCR,"pngfile\shell\open\ddeexec",,,"""file:%%1"",,-1,,,,,"
HKCR,"pngfile\shell\open\ddeexec\Application",,,"IExplore"
HKCR,"pngfile\shell\open\ddeexec\Topic",,,"WWW_OpenURL"
;; HKCR,"pngfile\DefaultIcon",,,"%16422%\Internet Explorer\iexplore.exe,9"
+HKCU,Software\Wine\FileOpenBlacklist\.png,"iexplore",,"""%16422%\Internet Explorer\iexplore.exe"" -nohome"
;; PS
HKCR,"MIME\Database\Content Type\application/postscript","Extension",,".ps"
diff --git a/loader/wine.inf.in b/loader/wine.inf.in
index 131fd34ed7a..48c867cd216 100644
--- a/loader/wine.inf.in
+++ b/loader/wine.inf.in
@@ -329,6 +329,16 @@ HKCR,http\shell\open\command,,2,"""%11%\winebrowser.exe"" ""%1"""
HKCR,https\shell\open\command,,2,"""%11%\winebrowser.exe"" ""%1"""
HKCR,mailto\shell\open\command,,2,"""%11%\winebrowser.exe"" ""%1"""
+HKCU,Software\Wine\FileOpenBlacklist\.htm,"winebrowser",,"""%11%\winebrowser.exe"" -nohome"
+HKCU,Software\Wine\FileOpenBlacklist\.html,"winebrowser",,"""%11%\winebrowser.exe"" -nohome"
+HKCU,Software\Wine\FileOpenBlacklist\.ini,"notepad",,"%11%\notepad.exe %1"
+HKCU,Software\Wine\FileOpenBlacklist\.pdf,"winebrowser",,"""%11%\winebrowser.exe"" -nohome"
+HKCU,Software\Wine\FileOpenBlacklist\.rtf,"wordpad",,"""%16422%\Windows NT\Accessories\wordpad.exe"" %1"
+HKCU,Software\Wine\FileOpenBlacklist\.txt,"notepad",,"%11%\notepad.exe %1"
+HKCU,Software\Wine\FileOpenBlacklist\.url,"ieframe",,"rundll32.exe ieframe.dll,OpenURL %l"
+HKCU,Software\Wine\FileOpenBlacklist\.wri,"wordpad",,"""%16422%\Windows NT\Accessories\wordpad.exe"" %1"
+HKCU,Software\Wine\FileOpenBlacklist\.xml,"winebrowser",,"""%11%\winebrowser.exe"" -nohome"
+
[ContentIndex]
HKLM,System\CurrentControlSet\Control\ContentIndex\Language\Neutral,"WBreakerClass",,"{369647e0-17b0-11ce-9950-00aa004bbb1f}"
HKLM,System\CurrentControlSet\Control\ContentIndex\Language\Neutral,"StemmerClass",,""
diff --git a/programs/winemenubuilder/winemenubuilder.c b/programs/winemenubuilder/winemenubuilder.c
index 31c97107802..0226d0d7ad9 100644
--- a/programs/winemenubuilder/winemenubuilder.c
+++ b/programs/winemenubuilder/winemenubuilder.c
@@ -1954,7 +1954,7 @@ static BOOL write_freedesktop_mime_type_entry(const WCHAR *packages_dir, const W
return ret;
}
-static BOOL is_extension_banned(LPCWSTR extension)
+static BOOL is_extension_banned(const WCHAR *extension)
{
/* These are managed through external tools like wine.desktop, to evade malware created file type associations */
if (!wcsicmp(extension, L".com") ||
@@ -1964,6 +1964,42 @@ static BOOL is_extension_banned(LPCWSTR extension)
return FALSE;
}
+static BOOL is_soft_blacklisted(const WCHAR *extension, const WCHAR *command)
+{
+ static const WCHAR FileOpenBlacklistW[] = {'S','o','f','t','w','a','r','e','\\',
+ 'W','i','n','e','\\',
+ 'F','i','l','e','O','p','e','n','B','l','a','c','k','l','i','s','t','\\',0};
+ WCHAR blacklist_key_path[MAX_PATH];
+ HKEY blacklist_key;
+ WCHAR program_name[MAX_PATH], *blacklisted_command;
+ DWORD len = ARRAY_SIZE(program_name);
+ DWORD i = 0;
+
+ if (ARRAY_SIZE(FileOpenBlacklistW) + lstrlenW(extension) > ARRAY_SIZE(blacklist_key_path))
+ return FALSE;
+
+ lstrcpyW(blacklist_key_path, FileOpenBlacklistW);
+ lstrcatW(blacklist_key_path, extension);
+
+ if (RegOpenKeyExW(HKEY_CURRENT_USER, blacklist_key_path, 0, KEY_QUERY_VALUE, &blacklist_key) != ERROR_SUCCESS)
+ return FALSE;
+
+ while (RegEnumValueW(blacklist_key, i, program_name, &len, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
+ {
+ blacklisted_command = reg_get_valW(HKEY_CURRENT_USER, blacklist_key_path, program_name);
+ if (wcscmp(command, blacklisted_command) == 0)
+ {
+ RegCloseKey(blacklist_key);
+ return TRUE;
+ }
+ len = ARRAY_SIZE(program_name);
+ i++;
+ }
+
+ RegCloseKey(blacklist_key);
+ return FALSE;
+}
+
static WCHAR *get_special_mime_type(LPCWSTR extension)
{
if (!wcsicmp(extension, L".lnk"))
@@ -2044,6 +2080,15 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
WCHAR *mimeProgId = NULL;
struct rb_string_entry *entry;
+ commandW = assoc_query(ASSOCSTR_COMMAND, extensionW, L"open");
+ if (commandW == NULL)
+ /* no command => no application is associated */
+ goto end;
+
+ if (is_soft_blacklisted(extensionW, commandW))
+ /* command is on the blacklist => desktop integration is not desirable */
+ goto end;
+
wcslwr(extensionW);
friendlyDocNameW = assoc_query(ASSOCSTR_FRIENDLYDOCNAME, extensionW, NULL);
@@ -2083,11 +2128,6 @@ static BOOL generate_associations(const WCHAR *packages_dir, const WCHAR *applic
hasChanged = TRUE;
}
- commandW = assoc_query(ASSOCSTR_COMMAND, extensionW, L"open");
- if (commandW == NULL)
- /* no command => no application is associated */
- goto end;
-
executableW = assoc_query(ASSOCSTR_EXECUTABLE, extensionW, L"open");
if (executableW)
openWithIcon = compute_native_identifier(0, executableW, NULL);
--
2.35.1

View File

@ -1,2 +0,0 @@
Fixes: [41275] Winemenubuilder should respect existing defaults for filetype associations
Fixes: [22904] Register URL protocol handlers under Linux

View File

@ -1 +1 @@
c732d2458994d3242741552c47d45d8b04eeb915
0b9620266f08d57c2db41b934a77b6ce4a94aeda