Rebase against bc282905d9491b9f9fe4ae4b69a8ccdf99c5aaa8.

This commit is contained in:
Zebediah Figura
2020-06-23 18:07:36 -05:00
parent 8402c95961
commit 7766c17912
36 changed files with 524 additions and 1918 deletions

View File

@@ -1,79 +0,0 @@
From 64f380eeb8ba1de36b47b6035510373fd1edeaac Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 24 Feb 2016 19:18:52 +0100
Subject: [PATCH] server: Assign random name when no name was passed to
create_winstation.
---
dlls/user32/tests/winstation.c | 4 ++--
server/winstation.c | 23 ++++++++++++++++++++++-
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/dlls/user32/tests/winstation.c b/dlls/user32/tests/winstation.c
index 4aa5565b96c..9eb3b433c11 100644
--- a/dlls/user32/tests/winstation.c
+++ b/dlls/user32/tests/winstation.c
@@ -225,8 +225,8 @@ static void test_handles(void)
memset( buffer, 0, sizeof(buffer) );
ret = GetUserObjectInformationA( w2, UOI_NAME, buffer, sizeof(buffer), &size );
ok( ret, "GetUserObjectInformationA failed with error %u\n", GetLastError() );
- todo_wine ok( !memcmp(buffer, "Service-0x0-", 12), "unexpected window station name '%s'\n", buffer );
- todo_wine ok( buffer[strlen(buffer) - 1] == '$', "unexpected window station name '%s'\n", buffer );
+ ok( !memcmp(buffer, "Service-0x0-", 12), "unexpected window station name '%s'\n", buffer );
+ ok( buffer[strlen(buffer) - 1] == '$', "unexpected window station name '%s'\n", buffer );
SetLastError( 0xdeadbeef );
w3 = OpenWindowStationA( "", TRUE, WINSTA_ALL_ACCESS );
diff --git a/server/winstation.c b/server/winstation.c
index b120859b39a..fee8980224c 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -38,6 +38,7 @@
#include "user.h"
#include "file.h"
#include "security.h"
+#include "unicode.h"
static struct list winstation_list = LIST_INIT(winstation_list);
@@ -114,9 +115,28 @@ static const struct object_ops desktop_ops =
static struct winstation *create_winstation( struct object *root, const struct unicode_str *name,
unsigned int attr, unsigned int flags )
{
+ static unsigned int id = 0x10000;
struct winstation *winstation;
+ struct unicode_str default_name;
+ char buffer[32];
- if ((winstation = create_named_object( root, &winstation_ops, name, attr, NULL )))
+ if (name->len)
+ {
+ winstation = create_named_object( root, &winstation_ops, name, attr, NULL );
+ goto done;
+ }
+
+ do
+ {
+ if (!++id) id = 1; /* avoid an id of 0 */
+ sprintf( buffer, "Service-0x0-%x$", id);
+ ascii_to_unicode_str( buffer, &default_name );
+ winstation = create_named_object( root, &winstation_ops, &default_name, attr & ~OBJ_OPENIF, NULL );
+ }
+ while (!winstation && get_error() == STATUS_OBJECT_NAME_COLLISION);
+
+done:
+ if (winstation)
{
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
{
@@ -134,6 +154,7 @@ static struct winstation *create_winstation( struct object *root, const struct u
}
else clear_error();
}
+
return winstation;
}
--
2.25.1

View File

@@ -1,4 +1,3 @@
Fixes: Fix possible leak of explorer.exe processes and implement proper desktop refcounting
Fixes: Assign random name when trying to create Window Station without name
Fixes: [46967] GOG Galaxy doesn't run in virtual desktop.
Depends: ws2_32-WSACleanup