Rebase against 4f1b297a14bbd304fb20da7c4b64266c14d110e5.

This commit is contained in:
Zebediah Figura 2021-02-05 18:01:09 -06:00
parent a2f82c5c85
commit 677b445b0d
24 changed files with 105 additions and 1969 deletions

View File

@ -1,4 +1,4 @@
From d468fdd5f1b4351f357fa75628096c6d759f0331 Mon Sep 17 00:00:00 2001
From e3bc0f8b38f7f68fe132db47a0fc239af4843181 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <zfigura@codeweavers.com>
Date: Mon, 6 Jul 2020 15:11:12 -0500
Subject: [PATCH] server: Create eventfd file descriptors for process objects.
@ -49,7 +49,7 @@ index 7ca4ca89394..6a0a367124d 100644
void esync_init(void);
+int esync_create_fd( int initval, int flags );
diff --git a/server/process.c b/server/process.c
index 310b2716dfa..d2919a2db09 100644
index e95c33132e6..7cf8953f47e 100644
--- a/server/process.c
+++ b/server/process.c
@@ -49,6 +49,7 @@
@ -60,7 +60,7 @@ index 310b2716dfa..d2919a2db09 100644
/* process object */
@@ -72,6 +73,7 @@ static struct security_descriptor *process_get_sd( struct object *obj );
@@ -81,6 +82,7 @@ static struct security_descriptor *process_get_sd( struct object *obj );
static void process_poll_event( struct fd *fd, int event );
static struct list *process_get_kernel_obj_list( struct object *obj );
static void process_destroy( struct object *obj );
@ -68,7 +68,7 @@ index 310b2716dfa..d2919a2db09 100644
static void terminate_process( struct process *process, struct thread *skip, int exit_code );
static const struct object_ops process_ops =
@@ -82,7 +84,7 @@ static const struct object_ops process_ops =
@@ -91,7 +93,7 @@ static const struct object_ops process_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
process_signaled, /* signaled */
@ -77,7 +77,7 @@ index 310b2716dfa..d2919a2db09 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
no_get_fd, /* get_fd */
@@ -547,6 +549,7 @@ struct process *create_process( int fd, struct process *parent, int inherit_all,
@@ -553,6 +555,7 @@ struct process *create_process( int fd, struct process *parent, int inherit_all,
process->trace_data = 0;
process->rawinput_mouse = NULL;
process->rawinput_kbd = NULL;
@ -85,7 +85,7 @@ index 310b2716dfa..d2919a2db09 100644
list_init( &process->kernel_object );
list_init( &process->thread_list );
list_init( &process->locks );
@@ -603,6 +606,9 @@ struct process *create_process( int fd, struct process *parent, int inherit_all,
@@ -609,6 +612,9 @@ struct process *create_process( int fd, struct process *parent, int inherit_all,
if (!token_assign_label( process->token, security_high_label_sid ))
goto error;
@ -95,7 +95,7 @@ index 310b2716dfa..d2919a2db09 100644
set_fd_events( process->msg_fd, POLLIN ); /* start listening to events */
return process;
@@ -649,6 +655,7 @@ static void process_destroy( struct object *obj )
@@ -655,6 +661,7 @@ static void process_destroy( struct object *obj )
if (process->id) free_ptid( process->id );
if (process->token) release_object( process->token );
free( process->dir_cache );
@ -103,7 +103,7 @@ index 310b2716dfa..d2919a2db09 100644
}
/* dump a process on stdout for debugging purposes */
@@ -666,6 +673,13 @@ static int process_signaled( struct object *obj, struct wait_queue_entry *entry
@@ -672,6 +679,13 @@ static int process_signaled( struct object *obj, struct wait_queue_entry *entry
return !process->running_threads;
}
@ -116,7 +116,7 @@ index 310b2716dfa..d2919a2db09 100644
+
static unsigned int process_map_access( struct object *obj, unsigned int access )
{
if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | PROCESS_QUERY_INFORMATION | PROCESS_VM_READ;
access = default_map_access( obj, access );
diff --git a/server/process.h b/server/process.h
index caab869c8a0..afa90581b97 100644
--- a/server/process.h

View File

@ -1,4 +1,4 @@
From bc87843880d2a1ef6f092793c09439c729fe7dbb Mon Sep 17 00:00:00 2001
From 0ffe77334eaf10be9a241dae48cf772228abde3b Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 8 Jun 2018 21:01:24 -0500
Subject: [PATCH] server: Create eventfd file descriptors for event objects.
@ -41,7 +41,7 @@ index 1e12560ddd6..fcbfd0989bb 100644
void esync_wake_up( struct object *obj );
+void esync_clear( int fd );
diff --git a/server/event.c b/server/event.c
index 7c57ce54d13..78d90dac5d6 100644
index 490fd9875bd..0938a73f648 100644
--- a/server/event.c
+++ b/server/event.c
@@ -35,6 +35,7 @@
@ -52,7 +52,7 @@ index 7c57ce54d13..78d90dac5d6 100644
static const WCHAR event_name[] = {'E','v','e','n','t'};
@@ -49,14 +50,17 @@ struct event
@@ -56,13 +57,16 @@ struct event
struct list kernel_object; /* list of kernel object pointers */
int manual_reset; /* is it a manual reset event? */
int signaled; /* event has been signaled */
@ -63,14 +63,13 @@ index 7c57ce54d13..78d90dac5d6 100644
static int event_signaled( struct object *obj, struct wait_queue_entry *entry );
static void event_satisfied( struct object *obj, struct wait_queue_entry *entry );
+static int event_get_esync_fd( struct object *obj, enum esync_type *type );
static unsigned int event_map_access( struct object *obj, unsigned int access );
static int event_signal( struct object *obj, unsigned int access);
static struct list *event_get_kernel_obj_list( struct object *obj );
+static void event_destroy( struct object *obj );
static const struct object_ops event_ops =
{
@@ -66,7 +70,7 @@ static const struct object_ops event_ops =
@@ -72,7 +76,7 @@ static const struct object_ops event_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
event_signaled, /* signaled */
@ -79,7 +78,7 @@ index 7c57ce54d13..78d90dac5d6 100644
event_satisfied, /* satisfied */
event_signal, /* signal */
no_get_fd, /* get_fd */
@@ -80,7 +84,7 @@ static const struct object_ops event_ops =
@@ -86,7 +90,7 @@ static const struct object_ops event_ops =
no_open_file, /* open_file */
event_get_kernel_obj_list, /* get_kernel_obj_list */
no_close_handle, /* close_handle */
@ -88,7 +87,7 @@ index 7c57ce54d13..78d90dac5d6 100644
};
@@ -140,6 +144,9 @@ struct event *create_event( struct object *root, const struct unicode_str *name,
@@ -152,6 +156,9 @@ struct event *create_event( struct object *root, const struct unicode_str *name,
list_init( &event->kernel_object );
event->manual_reset = manual_reset;
event->signaled = initial_state;
@ -98,7 +97,7 @@ index 7c57ce54d13..78d90dac5d6 100644
}
}
return event;
@@ -168,6 +175,9 @@ void set_event( struct event *event )
@@ -180,6 +187,9 @@ void set_event( struct event *event )
void reset_event( struct event *event )
{
event->signaled = 0;
@ -108,7 +107,7 @@ index 7c57ce54d13..78d90dac5d6 100644
}
static void event_dump( struct object *obj, int verbose )
@@ -185,6 +195,13 @@ static int event_signaled( struct object *obj, struct wait_queue_entry *entry )
@@ -197,6 +207,13 @@ static int event_signaled( struct object *obj, struct wait_queue_entry *entry )
return event->signaled;
}
@ -122,7 +121,7 @@ index 7c57ce54d13..78d90dac5d6 100644
static void event_satisfied( struct object *obj, struct wait_queue_entry *entry )
{
struct event *event = (struct event *)obj;
@@ -222,6 +239,14 @@ static struct list *event_get_kernel_obj_list( struct object *obj )
@@ -225,6 +242,14 @@ static struct list *event_get_kernel_obj_list( struct object *obj )
return &event->kernel_object;
}

View File

@ -1,4 +1,4 @@
From 183ec6174f0d6d02b9f94aaf0f0b35874e8b4b09 Mon Sep 17 00:00:00 2001
From 5bfa95c3058d8c869e7555514b05dc877a842e42 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 8 Jun 2018 22:04:29 -0500
Subject: [PATCH] server: Create eventfd file descriptors for thread objects.
@ -9,10 +9,10 @@ Subject: [PATCH] server: Create eventfd file descriptors for thread objects.
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/server/thread.c b/server/thread.c
index d3021d3d771..26cbeee68fd 100644
index 8432d0aa8ed..d4b88be3897 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -178,6 +178,7 @@ struct type_descr thread_type =
@@ -186,6 +186,7 @@ struct type_descr thread_type =
static void dump_thread( struct object *obj, int verbose );
static int thread_signaled( struct object *obj, struct wait_queue_entry *entry );
@ -20,7 +20,7 @@ index d3021d3d771..26cbeee68fd 100644
static unsigned int thread_map_access( struct object *obj, unsigned int access );
static void thread_poll_event( struct fd *fd, int event );
static struct list *thread_get_kernel_obj_list( struct object *obj );
@@ -191,7 +192,7 @@ static const struct object_ops thread_ops =
@@ -199,7 +200,7 @@ static const struct object_ops thread_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
thread_signaled, /* signaled */
@ -29,7 +29,7 @@ index d3021d3d771..26cbeee68fd 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
no_get_fd, /* get_fd */
@@ -231,6 +232,7 @@ static inline void init_thread_structure( struct thread *thread )
@@ -239,6 +240,7 @@ static inline void init_thread_structure( struct thread *thread )
thread->context = NULL;
thread->teb = 0;
thread->entry_point = 0;
@ -37,7 +37,7 @@ index d3021d3d771..26cbeee68fd 100644
thread->system_regs = 0;
thread->queue = NULL;
thread->wait = NULL;
@@ -366,6 +368,9 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
@@ -374,6 +376,9 @@ struct thread *create_thread( int fd, struct process *process, const struct secu
return NULL;
}
@ -47,7 +47,7 @@ index d3021d3d771..26cbeee68fd 100644
set_fd_events( thread->request_fd, POLLIN ); /* start listening to events */
add_process_thread( thread->process, thread );
return thread;
@@ -445,6 +450,9 @@ static void destroy_thread( struct object *obj )
@@ -453,6 +458,9 @@ static void destroy_thread( struct object *obj )
if (thread->exit_poll) remove_timeout_user( thread->exit_poll );
if (thread->id) free_ptid( thread->id );
if (thread->token) release_object( thread->token );
@ -57,7 +57,7 @@ index d3021d3d771..26cbeee68fd 100644
}
/* dump a thread on stdout for debugging purposes */
@@ -463,6 +471,13 @@ static int thread_signaled( struct object *obj, struct wait_queue_entry *entry )
@@ -471,6 +479,13 @@ static int thread_signaled( struct object *obj, struct wait_queue_entry *entry )
return mythread->state == TERMINATED && !mythread->exit_poll;
}
@ -70,7 +70,7 @@ index d3021d3d771..26cbeee68fd 100644
+
static unsigned int thread_map_access( struct object *obj, unsigned int access )
{
if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | THREAD_QUERY_INFORMATION | THREAD_GET_CONTEXT;
access = default_map_access( obj, access );
diff --git a/server/thread.h b/server/thread.h
index 077ab0929ba..99904557d44 100644
--- a/server/thread.h

View File

@ -1,4 +1,4 @@
From 8a5b98f58a86731874f7d8c0e387aeab22e15fea Mon Sep 17 00:00:00 2001
From 1ad0cfe6a328fd4ffdbce2c61e1cc7c822391734 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Fri, 15 Jun 2018 11:01:44 -0500
Subject: [PATCH] server: Create eventfd descriptors for timers.
@ -8,7 +8,7 @@ Subject: [PATCH] server: Create eventfd descriptors for timers.
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/server/timer.c b/server/timer.c
index be4d5943a41..f1abca3de90 100644
index 23d03aa3582..43b40a13032 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -36,6 +36,7 @@
@ -19,7 +19,7 @@ index be4d5943a41..f1abca3de90 100644
static const WCHAR timer_name[] = {'T','i','m','e','r'};
@@ -55,10 +56,12 @@ struct timer
@@ -62,10 +63,12 @@ struct timer
struct thread *thread; /* thread that set the APC function */
client_ptr_t callback; /* callback APC function */
client_ptr_t arg; /* callback argument */
@ -30,9 +30,9 @@ index be4d5943a41..f1abca3de90 100644
static int timer_signaled( struct object *obj, struct wait_queue_entry *entry );
+static int timer_get_esync_fd( struct object *obj, enum esync_type *type );
static void timer_satisfied( struct object *obj, struct wait_queue_entry *entry );
static unsigned int timer_map_access( struct object *obj, unsigned int access );
static void timer_destroy( struct object *obj );
@@ -71,7 +74,7 @@ static const struct object_ops timer_ops =
@@ -77,7 +80,7 @@ static const struct object_ops timer_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
timer_signaled, /* signaled */
@ -41,7 +41,7 @@ index be4d5943a41..f1abca3de90 100644
timer_satisfied, /* satisfied */
no_signal, /* signal */
no_get_fd, /* get_fd */
@@ -106,6 +109,10 @@ static struct timer *create_timer( struct object *root, const struct unicode_str
@@ -112,6 +115,10 @@ static struct timer *create_timer( struct object *root, const struct unicode_str
timer->period = 0;
timer->timeout = NULL;
timer->thread = NULL;
@ -52,7 +52,7 @@ index be4d5943a41..f1abca3de90 100644
}
}
return timer;
@@ -179,6 +186,9 @@ static int set_timer( struct timer *timer, timeout_t expire, unsigned int period
@@ -185,6 +192,9 @@ static int set_timer( struct timer *timer, timeout_t expire, unsigned int period
{
period = 0; /* period doesn't make any sense for a manual timer */
timer->signaled = 0;
@ -62,7 +62,7 @@ index be4d5943a41..f1abca3de90 100644
}
timer->when = (expire <= 0) ? expire - monotonic_time : max( expire, current_time );
timer->period = period;
@@ -206,6 +216,13 @@ static int timer_signaled( struct object *obj, struct wait_queue_entry *entry )
@@ -212,6 +222,13 @@ static int timer_signaled( struct object *obj, struct wait_queue_entry *entry )
return timer->signaled;
}

View File

@ -1,4 +1,4 @@
From 620371ae80be978b427c6d13e8f7b059bd4bb900 Mon Sep 17 00:00:00 2001
From d70b0135dbcaa414f1252b4d0a0d0389cb751e29 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Sat, 7 Jul 2018 12:57:47 +0200
Subject: [PATCH] server: Create eventfd descriptors for pseudo-fd objects and
@ -11,7 +11,7 @@ Subject: [PATCH] server: Create eventfd descriptors for pseudo-fd objects and
3 files changed, 25 insertions(+), 2 deletions(-)
diff --git a/server/fd.c b/server/fd.c
index d3b1e515b52..a7d81ec055b 100644
index aa629ff1824..be05795f822 100644
--- a/server/fd.c
+++ b/server/fd.c
@@ -102,6 +102,7 @@
@ -64,7 +64,7 @@ index d3b1e515b52..a7d81ec055b 100644
return fd;
}
@@ -2149,6 +2159,9 @@ void set_fd_signaled( struct fd *fd, int signaled )
@@ -2147,6 +2157,9 @@ void set_fd_signaled( struct fd *fd, int signaled )
if (fd->comp_flags & FILE_SKIP_SET_EVENT_ON_HANDLE) return;
fd->signaled = signaled;
if (signaled) wake_up( fd->user, 0 );
@ -74,7 +74,7 @@ index d3b1e515b52..a7d81ec055b 100644
}
/* handler for close_handle that refuses to close fd-associated handles in other processes */
@@ -2180,6 +2193,15 @@ int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry )
@@ -2178,6 +2191,15 @@ int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry )
return ret;
}
@ -87,11 +87,11 @@ index d3b1e515b52..a7d81ec055b 100644
+ return ret;
+}
+
/* default map_access() routine for objects that behave like an fd */
unsigned int default_fd_map_access( struct object *obj, unsigned int access )
int default_fd_get_poll_events( struct fd *fd )
{
int events = 0;
diff --git a/server/file.h b/server/file.h
index 477720f8b18..de260e29ddb 100644
index 686bae084c5..dab6d1506c3 100644
--- a/server/file.h
+++ b/server/file.h
@@ -102,6 +102,7 @@ extern void set_fd_signaled( struct fd *fd, int signaled );
@ -99,14 +99,14 @@ index 477720f8b18..de260e29ddb 100644
extern int default_fd_signaled( struct object *obj, struct wait_queue_entry *entry );
+extern int default_fd_get_esync_fd( struct object *obj, enum esync_type *type );
extern unsigned int default_fd_map_access( struct object *obj, unsigned int access );
extern int default_fd_get_poll_events( struct fd *fd );
extern void default_poll_event( struct fd *fd, int event );
extern void fd_queue_async( struct fd *fd, struct async *async, int type );
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 9ab99d915b9..b438682d214 100644
index 14596d46f6c..9b8fa97c67e 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -163,7 +163,7 @@ static const struct object_ops pipe_server_ops =
@@ -168,7 +168,7 @@ static const struct object_ops pipe_server_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
default_fd_signaled, /* signaled */
@ -115,7 +115,7 @@ index 9ab99d915b9..b438682d214 100644
no_satisfied, /* satisfied */
no_signal, /* signal */
pipe_end_get_fd, /* get_fd */
@@ -207,7 +207,7 @@ static const struct object_ops pipe_client_ops =
@@ -212,7 +212,7 @@ static const struct object_ops pipe_client_ops =
add_queue, /* add_queue */
remove_queue, /* remove_queue */
default_fd_signaled, /* signaled */
@ -125,5 +125,5 @@ index 9ab99d915b9..b438682d214 100644
no_signal, /* signal */
pipe_end_get_fd, /* get_fd */
--
2.28.0
2.20.1

View File

@ -1,4 +1,4 @@
From 8294521265f2ce0c316ddeadec39c50351239dd1 Mon Sep 17 00:00:00 2001
From b7328b5a416b09c66f37ba53cb010afe0266a12e Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Thu, 9 Jan 2020 13:44:01 -0600
Subject: [PATCH] ntdll/tests: Move some tests to a new sync.c file.
@ -23,7 +23,7 @@ index ed15c51339f..9a99c01bd7c 100644
time.c \
virtual.c
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 21de385a8bc..245a5ae2d15 100644
index 1878a480cb8..77370fb5c4a 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -30,10 +30,6 @@
@ -62,7 +62,7 @@ index 21de385a8bc..245a5ae2d15 100644
static NTSTATUS (WINAPI *pNtOpenProcess)( HANDLE *, ACCESS_MASK, const OBJECT_ATTRIBUTES *, const CLIENT_ID * );
static NTSTATUS (WINAPI *pNtCreateDebugObject)( HANDLE *, ACCESS_MASK, OBJECT_ATTRIBUTES *, ULONG );
@@ -1665,286 +1653,6 @@ static void test_type_mismatch(void)
@@ -1705,286 +1693,6 @@ static void test_type_mismatch(void)
pNtClose( h );
}
@ -349,7 +349,7 @@ index 21de385a8bc..245a5ae2d15 100644
static void test_null_device(void)
{
OBJECT_ATTRIBUTES attr;
@@ -2018,119 +1726,6 @@ static void test_null_device(void)
@@ -2058,119 +1766,6 @@ static void test_null_device(void)
CloseHandle(ov.hEvent);
}
@ -469,7 +469,7 @@ index 21de385a8bc..245a5ae2d15 100644
static void test_semaphore(void)
{
SEMAPHORE_BASIC_INFORMATION info;
@@ -2207,79 +1802,6 @@ static void test_semaphore(void)
@@ -2247,79 +1842,6 @@ static void test_semaphore(void)
NtClose( semaphore );
}
@ -549,7 +549,7 @@ index 21de385a8bc..245a5ae2d15 100644
static void test_process(void)
{
OBJECT_ATTRIBUTES attr;
@@ -2343,13 +1865,7 @@ START_TEST(om)
@@ -2562,13 +2084,7 @@ START_TEST(om)
pNtCreateMailslotFile = (void *)GetProcAddress(hntdll, "NtCreateMailslotFile");
pNtCreateMutant = (void *)GetProcAddress(hntdll, "NtCreateMutant");
pNtOpenEvent = (void *)GetProcAddress(hntdll, "NtOpenEvent");
@ -563,7 +563,7 @@ index 21de385a8bc..245a5ae2d15 100644
pNtOpenFile = (void *)GetProcAddress(hntdll, "NtOpenFile");
pNtClose = (void *)GetProcAddress(hntdll, "NtClose");
pRtlInitUnicodeString = (void *)GetProcAddress(hntdll, "RtlInitUnicodeString");
@@ -2370,15 +1886,9 @@ START_TEST(om)
@@ -2589,15 +2105,9 @@ START_TEST(om)
pNtReleaseSemaphore = (void *)GetProcAddress(hntdll, "NtReleaseSemaphore");
pNtCreateKeyedEvent = (void *)GetProcAddress(hntdll, "NtCreateKeyedEvent");
pNtOpenKeyedEvent = (void *)GetProcAddress(hntdll, "NtOpenKeyedEvent");
@ -579,7 +579,7 @@ index 21de385a8bc..245a5ae2d15 100644
pNtOpenProcess = (void *)GetProcAddress(hntdll, "NtOpenProcess");
pNtCreateDebugObject = (void *)GetProcAddress(hntdll, "NtCreateDebugObject");
@@ -2390,11 +1900,7 @@ START_TEST(om)
@@ -2609,12 +2119,8 @@ START_TEST(om)
test_symboliclink();
test_query_object();
test_type_mismatch();
@ -590,6 +590,7 @@ index 21de385a8bc..245a5ae2d15 100644
test_null_device();
- test_wait_on_address();
test_process();
test_object_types();
}
diff --git a/dlls/ntdll/tests/sync.c b/dlls/ntdll/tests/sync.c
new file mode 100644

View File

@ -1,39 +0,0 @@
From fda39199958fc169372b7dfee2077e2d8ecfa350 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Sun, 13 Sep 2015 17:16:07 +0200
Subject: [PATCH] ntdll: Return STATUS_INVALID_DEVICE_REQUEST when trying to
call NtReadFile on directory.
---
dlls/ntdll/tests/file.c | 1 -
dlls/ntdll/unix/file.c | 2 +-
2 files changed, 1 insertion(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
index 184b7cdad59..6f830da85a2 100644
--- a/dlls/ntdll/tests/file.c
+++ b/dlls/ntdll/tests/file.c
@@ -171,7 +171,6 @@ static void create_file_test(void)
U(io).Status = 0xdeadbeef;
offset.QuadPart = 0;
status = pNtReadFile( dir, NULL, NULL, NULL, &io, buf, sizeof(buf), &offset, NULL );
- todo_wine
ok( status == STATUS_INVALID_DEVICE_REQUEST || status == STATUS_PENDING, "NtReadFile error %08x\n", status );
if (status == STATUS_PENDING)
{
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index ca6899b50f5..d160f1a050e 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -348,7 +348,7 @@ NTSTATUS errno_to_status( int err )
case EACCES: return STATUS_ACCESS_DENIED;
case ENOTDIR: return STATUS_OBJECT_PATH_NOT_FOUND;
case ENOENT: return STATUS_OBJECT_NAME_NOT_FOUND;
- case EISDIR: return STATUS_FILE_IS_A_DIRECTORY;
+ case EISDIR: return STATUS_INVALID_DEVICE_REQUEST;
case EMFILE:
case ENFILE: return STATUS_TOO_MANY_OPENED_FILES;
case EINVAL: return STATUS_INVALID_PARAMETER;
--
2.27.0

View File

@ -1 +0,0 @@
Fixes: Return STATUS_INVALID_DEVICE_REQUEST when trying to call NtReadFile on directory

View File

@ -51,7 +51,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "dd417540bb3afb3aa5a04a007eea9a7ee347655b"
echo "4f1b297a14bbd304fb20da7c4b64266c14d110e5"
}
# Show version information
@ -180,7 +180,6 @@ patch_enable_all ()
enable_ntdll_RtlQueryProcessPlaceholderCompatibilityMode="$1"
enable_ntdll_RtlQueryRegistryValuesEx="$1"
enable_ntdll_Serial_Port_Detection="$1"
enable_ntdll_Status_Mapping="$1"
enable_ntdll_Syscall_Emulation="$1"
enable_ntdll_SystemCodeIntegrityInformation="$1"
enable_ntdll_WRITECOPY="$1"
@ -623,9 +622,6 @@ patch_enable ()
ntdll-Serial_Port_Detection)
enable_ntdll_Serial_Port_Detection="$2"
;;
ntdll-Status_Mapping)
enable_ntdll_Status_Mapping="$2"
;;
ntdll-Syscall_Emulation)
enable_ntdll_Syscall_Emulation="$2"
;;
@ -3382,15 +3378,6 @@ if test "$enable_ntdll_Serial_Port_Detection" -eq 1; then
patch_apply ntdll-Serial_Port_Detection/0001-ntdll-Do-a-device-check-before-returning-a-default-s.patch
fi
# Patchset ntdll-Status_Mapping
# |
# | Modified files:
# | * dlls/ntdll/tests/file.c, dlls/ntdll/unix/file.c
# |
if test "$enable_ntdll_Status_Mapping" -eq 1; then
patch_apply ntdll-Status_Mapping/0001-ntdll-Return-STATUS_INVALID_DEVICE_REQUEST-when-tryi.patch
fi
# Patchset ntdll-Syscall_Emulation
# |
# | This patchset fixes the following Wine bugs:
@ -4397,11 +4384,6 @@ fi
# | tools/widl/utils.h, tools/widl/widltypes.h
# |
if test "$enable_widl_winrt_support" -eq 1; then
patch_apply widl-winrt-support/0001-widl-Factor-and-cleanup-interface-type-declaration-a.patch
patch_apply widl-winrt-support/0002-widl-Factor-and-cleanup-dispinterface-type-declarati.patch
patch_apply widl-winrt-support/0003-widl-Factor-and-cleanup-apicontract-type-declaration.patch
patch_apply widl-winrt-support/0004-widl-Factor-and-cleanup-module-type-declaration-and-.patch
patch_apply widl-winrt-support/0005-widl-Fold-aIDENTIFIER-aKNOWNTYPE-rules-together.patch
patch_apply widl-winrt-support/0006-widl-Add-explicit-namespace-parameter-to-find_type_o.patch
patch_apply widl-winrt-support/0007-widl-Use-explicit-namespace-parameter-for-qualified-.patch
patch_apply widl-winrt-support/0008-widl-Disallow-qualified-types-in-expressions.patch

View File

@ -1,19 +1,19 @@
From 6b6b0104bb50897030fef3e9f49321f1ac33edae Mon Sep 17 00:00:00 2001
From 2964ee0ea43ead52e9b34da5f9cc97792c41010b Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Fri, 18 Apr 2014 14:08:36 -0600
Subject: server: Inherit security attributes from parent directories on
creation. (try 7)
Subject: [PATCH] server: Inherit security attributes from parent directories
on creation. (try 7)
---
dlls/advapi32/tests/security.c | 8 +-
server/file.c | 137 +++++++++++++++++++++++++++++++++
2 files changed, 141 insertions(+), 4 deletions(-)
server/file.c | 138 +++++++++++++++++++++++++++++++++
2 files changed, 142 insertions(+), 4 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 53bea200..fbde5213 100644
index 9b2193f6232..21cd746fd2a 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -3654,7 +3654,7 @@ static void test_CreateDirectoryA(void)
@@ -3661,7 +3661,7 @@ static void test_CreateDirectoryA(void)
(PSID *)&owner, NULL, &pDacl, NULL, &pSD);
ok(error == ERROR_SUCCESS, "Failed to get permissions on file\n");
test_inherited_dacl(pDacl, admin_sid, user_sid, INHERITED_ACE,
@ -22,7 +22,7 @@ index 53bea200..fbde5213 100644
LocalFree(pSD);
CloseHandle(hTemp);
@@ -3722,7 +3722,7 @@ static void test_CreateDirectoryA(void)
@@ -3728,7 +3728,7 @@ static void test_CreateDirectoryA(void)
(PSID *)&owner, NULL, &pDacl, NULL, &pSD);
ok(error == ERROR_SUCCESS, "Failed to get permissions on file\n");
test_inherited_dacl(pDacl, admin_sid, user_sid, INHERITED_ACE,
@ -31,7 +31,7 @@ index 53bea200..fbde5213 100644
LocalFree(pSD);
CloseHandle(hTemp);
@@ -3787,7 +3787,7 @@ static void test_CreateDirectoryA(void)
@@ -3793,7 +3793,7 @@ static void test_CreateDirectoryA(void)
ok(error == ERROR_SUCCESS, "Failed to get permissions on file\n");
test_inherited_dacl(pDacl, admin_sid, user_sid,
OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERITED_ACE,
@ -40,7 +40,7 @@ index 53bea200..fbde5213 100644
LocalFree(pSD);
bret = RemoveDirectoryA(tmpfile);
ok(bret == TRUE, "RemoveDirectoryA failed with error %u\n", GetLastError());
@@ -3868,7 +3868,7 @@ static void test_CreateDirectoryA(void)
@@ -3873,7 +3873,7 @@ static void test_CreateDirectoryA(void)
ok(error == ERROR_SUCCESS, "Failed to get permissions on file\n");
test_inherited_dacl(pDacl, admin_sid, user_sid,
OBJECT_INHERIT_ACE | CONTAINER_INHERIT_ACE | INHERITED_ACE,
@ -50,18 +50,19 @@ index 53bea200..fbde5213 100644
CloseHandle(hTemp);
diff --git a/server/file.c b/server/file.c
index 107fea65..7d80a003 100644
index fce2ab0a5b6..85940727347 100644
--- a/server/file.c
+++ b/server/file.c
@@ -71,6 +71,7 @@ struct file
@@ -105,6 +105,8 @@ struct file
struct list kernel_object; /* list of kernel object pointers */
};
static unsigned int generic_file_map_access( unsigned int access );
+static struct security_descriptor *get_xattr_sd( int fd );
+
static void file_dump( struct object *obj, int verbose );
static struct fd *file_get_fd( struct object *obj );
@@ -223,11 +224,142 @@ static void set_xattr_sd( int fd, const struct security_descriptor *sd )
static struct security_descriptor *file_get_sd( struct object *obj );
@@ -311,11 +313,142 @@ static void set_xattr_sd( int fd, const struct security_descriptor *sd )
xattr_fset( fd, WINE_XATTR_SD, buffer, len );
}
@ -204,7 +205,7 @@ index 107fea65..7d80a003 100644
struct object *obj = NULL;
struct fd *fd;
int flags;
@@ -256,6 +388,10 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si
@@ -344,6 +477,10 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si
default: set_error( STATUS_INVALID_PARAMETER ); goto done;
}
@ -215,7 +216,7 @@ index 107fea65..7d80a003 100644
if (sd)
{
const SID *owner = sd_get_owner( sd );
@@ -295,6 +431,7 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si
@@ -382,6 +519,7 @@ static struct object *create_file( struct fd *root, const char *nameptr, data_si
release_object( fd );
done:

View File

@ -1,285 +0,0 @@
From 09687ecf83e4ba5b6363bf2ada5df63798e398cd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 8 Mar 2017 02:12:37 +0100
Subject: [PATCH] ntdll: Implement ObjectTypesInformation in NtQueryObject.
---
dlls/ntdll/tests/om.c | 57 ++++++++++++++++++++++++++++++++++++++++++
dlls/ntdll/unix/file.c | 53 +++++++++++++++++++++++++++++++++++++++
include/winternl.h | 30 ++++++++++++++++++++--
server/directory.c | 23 +++++++++++++++++
server/protocol.def | 9 +++++++
5 files changed, 170 insertions(+), 2 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 21de385a8bc..84a09bb1bfa 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -83,6 +83,21 @@ static NTSTATUS (WINAPI *pNtCreateDebugObject)( HANDLE *, ACCESS_MASK, OBJECT_AT
#define KEYEDEVENT_WAKE 0x0002
#define KEYEDEVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x0003)
+#define ROUND_UP(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment)-1))
+
+static LPCSTR wine_dbgstr_us( const UNICODE_STRING *us )
+{
+ if (!us) return "(null)";
+ return wine_dbgstr_wn(us->Buffer, us->Length / sizeof(WCHAR));
+}
+
+static inline int strncmpW( const WCHAR *str1, const WCHAR *str2, int n )
+{
+ if (n <= 0) return 0;
+ while ((--n > 0) && *str1 && (*str1 == *str2)) { str1++; str2++; }
+ return *str1 - *str2;
+}
+
static void test_case_sensitive (void)
{
NTSTATUS status;
@@ -1643,6 +1658,47 @@ static void test_query_object(void)
pNtClose( handle );
}
+static void test_query_object_types(void)
+{
+ static const WCHAR typeW[] = {'T','y','p','e'};
+ OBJECT_TYPES_INFORMATION *buffer;
+ OBJECT_TYPE_INFORMATION *type;
+ NTSTATUS status;
+ ULONG len, i;
+
+ buffer = HeapAlloc( GetProcessHeap(), 0, sizeof(OBJECT_TYPES_INFORMATION) );
+ ok( buffer != NULL, "Failed to allocate memory\n" );
+
+ status = pNtQueryObject( NULL, ObjectTypesInformation, buffer, sizeof(OBJECT_TYPES_INFORMATION), &len );
+ ok( status == STATUS_INFO_LENGTH_MISMATCH, "NtQueryObject failed %x\n", status );
+ ok( len, "len is zero\n");
+
+ buffer = HeapReAlloc( GetProcessHeap(), 0, buffer, len );
+ ok( buffer != NULL, "Failed to allocate memory\n" );
+
+ memset( buffer, 0, len );
+ status = pNtQueryObject( NULL, ObjectTypesInformation, buffer, len, &len );
+ ok( status == STATUS_SUCCESS, "NtQueryObject failed %x\n", status );
+ ok( buffer->NumberOfTypes, "NumberOfTypes is zero\n" );
+
+ type = (OBJECT_TYPE_INFORMATION *)(buffer + 1);
+ for (i = 0; i < buffer->NumberOfTypes; i++)
+ {
+ USHORT length = type->TypeName.MaximumLength;
+ trace( "Type %u: %s\n", i, wine_dbgstr_us(&type->TypeName) );
+
+ if (i == 0)
+ {
+ todo_wine ok( type->TypeName.Length == sizeof(typeW) && !strncmpW(typeW, type->TypeName.Buffer, 4),
+ "Expected 'Type' as first type, got %s\n", wine_dbgstr_us(&type->TypeName) );
+ }
+
+ type = (OBJECT_TYPE_INFORMATION *)ROUND_UP( (DWORD_PTR)(type + 1) + length, sizeof(DWORD_PTR) );
+ }
+
+ HeapFree( GetProcessHeap(), 0, buffer );
+}
+
static void test_type_mismatch(void)
{
HANDLE h;
@@ -2389,6 +2445,7 @@ START_TEST(om)
test_directory();
test_symboliclink();
test_query_object();
+ test_query_object_types();
test_type_mismatch();
test_event();
test_mutant();
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 7a77b0a874d..342c97c2426 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -145,6 +145,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(file);
WINE_DECLARE_DEBUG_CHANNEL(winediag);
+#define ROUND_UP(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment)-1))
+
#define MAX_DOS_DRIVES 26
#define FILE_WRITE_TO_END_OF_FILE ((LONGLONG)-1)
@@ -7544,6 +7546,57 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
break;
}
+ case ObjectTypesInformation:
+ {
+ OBJECT_TYPES_INFORMATION *p = ptr;
+ OBJECT_TYPE_INFORMATION *type = (OBJECT_TYPE_INFORMATION *)(p + 1);
+ ULONG count, type_len, req_len = sizeof(OBJECT_TYPES_INFORMATION);
+
+ for (count = 0, status = STATUS_SUCCESS; !status; count++)
+ {
+ SERVER_START_REQ( get_object_type_by_index )
+ {
+ req->index = count;
+ if (len > sizeof(*type))
+ wine_server_set_reply( req, type + 1, len - sizeof(*type) );
+ status = wine_server_call( req );
+ if (status == STATUS_SUCCESS)
+ {
+ type_len = sizeof(*type);
+ if (reply->total)
+ type_len += ROUND_UP( reply->total + sizeof(WCHAR), sizeof(DWORD_PTR) );
+ req_len += type_len;
+ }
+ if (status == STATUS_SUCCESS && len >= req_len)
+ {
+ ULONG res = wine_server_reply_size( reply );
+ memset( type, 0, sizeof(*type) );
+ if (reply->total)
+ {
+ type->TypeName.Buffer = (WCHAR *)(type + 1);
+ type->TypeName.Length = res;
+ type->TypeName.MaximumLength = res + sizeof(WCHAR);
+ type->TypeName.Buffer[res / sizeof(WCHAR)] = 0;
+ }
+ type->TypeIndex = count;
+ type = (OBJECT_TYPE_INFORMATION *)((char *)type + type_len);
+ }
+ }
+ SERVER_END_REQ;
+ }
+
+ if (status != STATUS_NO_MORE_ENTRIES)
+ return status;
+
+ if (used_len) *used_len = req_len;
+ if (len < req_len)
+ return STATUS_INFO_LENGTH_MISMATCH;
+
+ p->NumberOfTypes = count - 1;
+ status = STATUS_SUCCESS;
+ break;
+ }
+
case ObjectDataInformation:
{
OBJECT_DATA_INFORMATION* p = ptr;
diff --git a/include/winternl.h b/include/winternl.h
index 45b4eddd815..4d8b5841d17 100644
--- a/include/winternl.h
+++ b/include/winternl.h
@@ -1161,7 +1161,7 @@ typedef enum _OBJECT_INFORMATION_CLASS {
ObjectBasicInformation,
ObjectNameInformation,
ObjectTypeInformation,
- ObjectAllInformation,
+ ObjectTypesInformation,
ObjectDataInformation
} OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS;
@@ -1600,9 +1600,35 @@ typedef struct _OBJECT_NAME_INFORMATION {
typedef struct __OBJECT_TYPE_INFORMATION {
UNICODE_STRING TypeName;
- ULONG Reserved [22];
+ ULONG TotalNumberOfObjects;
+ ULONG TotalNumberOfHandles;
+ ULONG TotalPagedPoolUsage;
+ ULONG TotalNonPagedPoolUsage;
+ ULONG TotalNamePoolUsage;
+ ULONG TotalHandleTableUsage;
+ ULONG HighWaterNumberOfObjects;
+ ULONG HighWaterNumberOfHandles;
+ ULONG HighWaterPagedPoolUsage;
+ ULONG HighWaterNonPagedPoolUsage;
+ ULONG HighWaterNamePoolUsage;
+ ULONG HighWaterHandleTableUsage;
+ ULONG InvalidAttributes;
+ GENERIC_MAPPING GenericMapping;
+ ULONG ValidAccessMask;
+ BOOLEAN SecurityRequired;
+ BOOLEAN MaintainHandleCount;
+ UCHAR TypeIndex;
+ CHAR Reserved;
+ ULONG PoolType;
+ ULONG DefaultPagedPoolCharge;
+ ULONG DefaultNonPagedPoolCharge;
} OBJECT_TYPE_INFORMATION, *POBJECT_TYPE_INFORMATION;
+typedef struct _OBJECT_TYPES_INFORMATION
+{
+ ULONG NumberOfTypes;
+} OBJECT_TYPES_INFORMATION, *POBJECT_TYPES_INFORMATION;
+
typedef struct _PROCESS_BASIC_INFORMATION {
#ifdef __WINESRC__
DWORD_PTR ExitStatus;
diff --git a/server/directory.c b/server/directory.c
index 2d25667106e..955be98faca 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -74,6 +74,8 @@ static const struct object_ops object_type_ops =
no_destroy /* destroy */
};
+static struct object_type *object_type_list[64];
+static unsigned int object_type_count;
struct directory
{
@@ -238,7 +240,14 @@ struct object_type *get_object_type( const struct unicode_str *name )
if ((type = create_named_object( &dir_objtype->obj, &object_type_ops, name,
OBJ_OPENIF | OBJ_PERMANENT, NULL )))
+ {
+ if (get_error() != STATUS_OBJECT_NAME_EXISTS)
+ {
+ assert( object_type_count < ARRAY_SIZE(object_type_list) );
+ object_type_list[ object_type_count++ ] = (struct object_type *)grab_object( type );
+ }
clear_error();
+ }
return type;
}
@@ -542,3 +551,17 @@ DECL_HANDLER(get_object_type)
}
release_object( obj );
}
+
+/* query object type name information by index */
+DECL_HANDLER(get_object_type_by_index)
+{
+ struct object_type *type;
+ const WCHAR *name;
+
+ if (req->index < object_type_count && (type = object_type_list[ req->index ]))
+ {
+ if ((name = get_object_name( &type->obj, &reply->total )))
+ set_reply_data( name, min( reply->total, get_reply_max_size() ) );
+ }
+ else set_error( STATUS_NO_MORE_ENTRIES );
+}
diff --git a/server/protocol.def b/server/protocol.def
index 5ff2cd3d082..d1d72e625e9 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3311,6 +3311,15 @@ struct handle_info
@END
+/* Query object type name information */
+@REQ(get_object_type_by_index)
+ unsigned int index; /* index of the type */
+@REPLY
+ data_size_t total; /* needed size for type name */
+ VARARG(type,unicode_str); /* type name */
+@END
+
+
/* Query the impersonation level of an impersonation token */
@REQ(get_token_impersonation_level)
obj_handle_t handle; /* handle to the object */
--
2.29.2

View File

@ -1,385 +0,0 @@
From b79e8d5b9ecadb8e14276b0abcf6497ff3b5608d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 8 Mar 2017 03:32:43 +0100
Subject: [PATCH] server: Register types during startup.
---
server/completion.c | 3 +--
server/directory.c | 6 ++----
server/event.c | 6 ++----
server/file.c | 3 +--
server/mailslot.c | 3 +--
server/main.c | 1 +
server/mapping.c | 3 +--
server/mutex.c | 3 +--
server/named_pipe.c | 3 +--
server/object.c | 36 ++++++++++++++++++++++++++++++++++++
server/object.h | 24 ++++++++++++++++++++++++
server/process.c | 6 ++----
server/registry.c | 3 +--
server/semaphore.c | 3 +--
server/symlink.c | 3 +--
server/thread.c | 3 +--
server/timer.c | 3 +--
server/token.c | 3 +--
server/winstation.c | 6 ++----
19 files changed, 81 insertions(+), 40 deletions(-)
diff --git a/server/completion.c b/server/completion.c
index 176cf1b817e..ef66260c991 100644
--- a/server/completion.c
+++ b/server/completion.c
@@ -111,8 +111,7 @@ static void completion_dump( struct object *obj, int verbose )
static struct object_type *completion_get_type( struct object *obj )
{
- static const WCHAR name[] = {'I','o','C','o','m','p','l','e','t','i','o','n'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_IoCompletion, sizeof(type_IoCompletion) };
return get_object_type( &str );
}
diff --git a/server/directory.c b/server/directory.c
index 04d27946ad9..6e09168b783 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -125,8 +125,7 @@ static void object_type_dump( struct object *obj, int verbose )
static struct object_type *object_type_get_type( struct object *obj )
{
- static const WCHAR name[] = {'O','b','j','e','c','t','T','y','p','e'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_ObjectType, sizeof(type_ObjectType) };
return get_object_type( &str );
}
@@ -137,8 +136,7 @@ static void directory_dump( struct object *obj, int verbose )
static struct object_type *directory_get_type( struct object *obj )
{
- static const WCHAR name[] = {'D','i','r','e','c','t','o','r','y'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Directory, sizeof(type_Directory) };
return get_object_type( &str );
}
diff --git a/server/event.c b/server/event.c
index b6f989d4d6a..8607b494b6d 100644
--- a/server/event.c
+++ b/server/event.c
@@ -193,8 +193,7 @@ static void event_dump( struct object *obj, int verbose )
static struct object_type *event_get_type( struct object *obj )
{
- static const WCHAR name[] = {'E','v','e','n','t'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Event, sizeof(type_Event) };
return get_object_type( &str );
}
@@ -284,8 +283,7 @@ static void keyed_event_dump( struct object *obj, int verbose )
static struct object_type *keyed_event_get_type( struct object *obj )
{
- static const WCHAR name[] = {'K','e','y','e','d','E','v','e','n','t'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_KeyedEvent, sizeof(type_KeyedEvent) };
return get_object_type( &str );
}
diff --git a/server/file.c b/server/file.c
index b64c3bf0bcf..2edc2d1be8f 100644
--- a/server/file.c
+++ b/server/file.c
@@ -522,8 +522,7 @@ static void file_dump( struct object *obj, int verbose )
struct object_type *file_get_type( struct object *obj )
{
- static const WCHAR name[] = {'F','i','l','e'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_File, sizeof(type_File) };
return get_object_type( &str );
}
diff --git a/server/mailslot.c b/server/mailslot.c
index 2e09bab22fa..3b8f8086dd1 100644
--- a/server/mailslot.c
+++ b/server/mailslot.c
@@ -393,8 +393,7 @@ static void mailslot_device_dump( struct object *obj, int verbose )
static struct object_type *mailslot_device_get_type( struct object *obj )
{
- static const WCHAR name[] = {'D','e','v','i','c','e'};
- static const struct unicode_str str = { name, sizeof(name) };
+ const struct unicode_str str = { type_Device, sizeof(type_Device) };
return get_object_type( &str );
}
diff --git a/server/main.c b/server/main.c
index f68888d0fa8..89a326ed8ce 100644
--- a/server/main.c
+++ b/server/main.c
@@ -151,6 +151,7 @@ int main( int argc, char *argv[] )
init_signals();
init_directories( load_intl_file() );
init_registry();
+ init_types();
main_loop();
return 0;
}
diff --git a/server/mapping.c b/server/mapping.c
index d06ceaa1a66..7729d958247 100644
--- a/server/mapping.c
+++ b/server/mapping.c
@@ -956,8 +956,7 @@ static void mapping_dump( struct object *obj, int verbose )
static struct object_type *mapping_get_type( struct object *obj )
{
- static const WCHAR name[] = {'S','e','c','t','i','o','n'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Section, sizeof(type_Section) };
return get_object_type( &str );
}
diff --git a/server/mutex.c b/server/mutex.c
index fc236b3e623..1235ab4731f 100644
--- a/server/mutex.c
+++ b/server/mutex.c
@@ -144,8 +144,7 @@ static void mutex_dump( struct object *obj, int verbose )
static struct object_type *mutex_get_type( struct object *obj )
{
- static const WCHAR name[] = {'M','u','t','a','n','t'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Mutant, sizeof(type_Mutant) };
return get_object_type( &str );
}
diff --git a/server/named_pipe.c b/server/named_pipe.c
index 1638b83ee67..12fd301d49d 100644
--- a/server/named_pipe.c
+++ b/server/named_pipe.c
@@ -498,8 +498,7 @@ static void named_pipe_device_dump( struct object *obj, int verbose )
static struct object_type *named_pipe_device_get_type( struct object *obj )
{
- static const WCHAR name[] = {'D','e','v','i','c','e'};
- static const struct unicode_str str = { name, sizeof(name) };
+ const struct unicode_str str = { type_Device, sizeof(type_Device) };
return get_object_type( &str );
}
diff --git a/server/object.c b/server/object.c
index fb7a335c167..b9ccfdf1f2e 100644
--- a/server/object.c
+++ b/server/object.c
@@ -717,3 +717,39 @@ int no_close_handle( struct object *obj, struct process *process, obj_handle_t h
void no_destroy( struct object *obj )
{
}
+
+static const struct unicode_str type_array[] =
+{
+ {type_ObjectType, sizeof(type_ObjectType)},
+ {type_Directory, sizeof(type_Directory)},
+ {type_SymbolicLink, sizeof(type_SymbolicLink)},
+ {type_Token, sizeof(type_Token)},
+ {type_Job, sizeof(type_Job)},
+ {type_Process, sizeof(type_Process)},
+ {type_Thread, sizeof(type_Thread)},
+ {type_Event, sizeof(type_Event)},
+ {type_Mutant, sizeof(type_Mutant)},
+ {type_Semaphore, sizeof(type_Semaphore)},
+ {type_Timer, sizeof(type_Timer)},
+ {type_KeyedEvent, sizeof(type_KeyedEvent)},
+ {type_WindowStation, sizeof(type_WindowStation)},
+ {type_Desktop, sizeof(type_Desktop)},
+ {type_Device, sizeof(type_Device)},
+ /* Driver */
+ {type_IoCompletion, sizeof(type_IoCompletion)},
+ {type_File, sizeof(type_File)},
+ {type_Section, sizeof(type_Section)},
+ {type_Key, sizeof(type_Key)},
+};
+
+void init_types(void)
+{
+ struct object_type *type;
+ unsigned int i;
+
+ for (i = 0; i < sizeof(type_array) / sizeof(type_array[0]); i++)
+ {
+ type = get_object_type(&type_array[i]);
+ if (type) release_object(type);
+ }
+}
diff --git a/server/object.h b/server/object.h
index 8134439859d..31740cbe713 100644
--- a/server/object.h
+++ b/server/object.h
@@ -251,6 +251,30 @@ extern struct object_type *get_object_type( const struct unicode_str *name );
extern int directory_link_name( struct object *obj, struct object_name *name, struct object *parent );
extern void init_directories( struct fd *intl_fd );
+/* type functions */
+
+static const WCHAR type_Desktop[] = {'D','e','s','k','t','o','p'};
+static const WCHAR type_Device[] = {'D','e','v','i','c','e'};
+static const WCHAR type_Directory[] = {'D','i','r','e','c','t','o','r','y'};
+static const WCHAR type_Event[] = {'E','v','e','n','t'};
+static const WCHAR type_File[] = {'F','i','l','e'};
+static const WCHAR type_IoCompletion[] = {'I','o','C','o','m','p','l','e','t','i','o','n'};
+static const WCHAR type_Job[] = {'J','o','b'};
+static const WCHAR type_Key[] = {'K','e','y'};
+static const WCHAR type_KeyedEvent[] = {'K','e','y','e','d','E','v','e','n','t'};
+static const WCHAR type_Mutant[] = {'M','u','t','a','n','t'};
+static const WCHAR type_ObjectType[] = {'O','b','j','e','c','t','T','y','p','e'};
+static const WCHAR type_Process[] = {'P','r','o','c','e','s','s'};
+static const WCHAR type_Section[] = {'S','e','c','t','i','o','n'};
+static const WCHAR type_Semaphore[] = {'S','e','m','a','p','h','o','r','e'};
+static const WCHAR type_SymbolicLink[] = {'S','y','m','b','o','l','i','c','L','i','n','k'};
+static const WCHAR type_Thread[] = {'T','h','r','e','a','d'};
+static const WCHAR type_Timer[] = {'T','i','m','e','r'};
+static const WCHAR type_Token[] = {'T','o','k','e','n'};
+static const WCHAR type_WindowStation[] = {'W','i','n','d','o','w','S','t','a','t','i','o','n'};
+
+extern void init_types(void);
+
/* symbolic link functions */
extern struct object *create_obj_symlink( struct object *root, const struct unicode_str *name,
diff --git a/server/process.c b/server/process.c
index dfa5bd728f7..9fcb609d5ab 100644
--- a/server/process.c
+++ b/server/process.c
@@ -226,8 +226,7 @@ static struct job *get_job_obj( struct process *process, obj_handle_t handle, un
static struct object_type *job_get_type( struct object *obj )
{
- static const WCHAR name[] = {'J','o','b'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Job, sizeof(type_Job) };
return get_object_type( &str );
};
@@ -669,8 +668,7 @@ static void process_dump( struct object *obj, int verbose )
static struct object_type *process_get_type( struct object *obj )
{
- static const WCHAR name[] = {'P','r','o','c','e','s','s'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Process, sizeof(type_Process) };
return get_object_type( &str );
}
diff --git a/server/registry.c b/server/registry.c
index 8110bbb340c..95b8b4abf0e 100644
--- a/server/registry.c
+++ b/server/registry.c
@@ -307,8 +307,7 @@ static void key_dump( struct object *obj, int verbose )
static struct object_type *key_get_type( struct object *obj )
{
- static const WCHAR name[] = {'K','e','y'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Key, sizeof(type_Key) };
return get_object_type( &str );
}
diff --git a/server/semaphore.c b/server/semaphore.c
index ff94e42576b..d7d3a24e48f 100644
--- a/server/semaphore.c
+++ b/server/semaphore.c
@@ -130,8 +130,7 @@ static void semaphore_dump( struct object *obj, int verbose )
static struct object_type *semaphore_get_type( struct object *obj )
{
- static const WCHAR name[] = {'S','e','m','a','p','h','o','r','e'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Semaphore, sizeof(type_Semaphore) };
return get_object_type( &str );
}
diff --git a/server/symlink.c b/server/symlink.c
index c7212618cac..67eaa4594ba 100644
--- a/server/symlink.c
+++ b/server/symlink.c
@@ -89,8 +89,7 @@ static void symlink_dump( struct object *obj, int verbose )
static struct object_type *symlink_get_type( struct object *obj )
{
- static const WCHAR name[] = {'S','y','m','b','o','l','i','c','L','i','n','k'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_SymbolicLink, sizeof(type_SymbolicLink) };
return get_object_type( &str );
}
diff --git a/server/thread.c b/server/thread.c
index f320f2b26e9..1a245c58396 100644
--- a/server/thread.c
+++ b/server/thread.c
@@ -467,8 +467,7 @@ static void dump_thread( struct object *obj, int verbose )
static struct object_type *thread_get_type( struct object *obj )
{
- static const WCHAR name[] = {'T','h','r','e','a','d'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Thread, sizeof(type_Thread) };
return get_object_type( &str );
}
diff --git a/server/timer.c b/server/timer.c
index 11fcdf3bae7..dcbc9e2ece5 100644
--- a/server/timer.c
+++ b/server/timer.c
@@ -205,8 +205,7 @@ static void timer_dump( struct object *obj, int verbose )
static struct object_type *timer_get_type( struct object *obj )
{
- static const WCHAR name[] = {'T','i','m','e','r'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Timer, sizeof(type_Timer) };
return get_object_type( &str );
}
diff --git a/server/token.c b/server/token.c
index fafa86f292c..0f128728b0f 100644
--- a/server/token.c
+++ b/server/token.c
@@ -174,8 +174,7 @@ static void token_dump( struct object *obj, int verbose )
static struct object_type *token_get_type( struct object *obj )
{
- static const WCHAR name[] = {'T','o','k','e','n'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Token, sizeof(type_Token) };
return get_object_type( &str );
}
diff --git a/server/winstation.c b/server/winstation.c
index 22228d6f987..ac570b81903 100644
--- a/server/winstation.c
+++ b/server/winstation.c
@@ -146,8 +146,7 @@ static void winstation_dump( struct object *obj, int verbose )
static struct object_type *winstation_get_type( struct object *obj )
{
- static const WCHAR name[] = {'W','i','n','d','o','w','S','t','a','t','i','o','n'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_WindowStation, sizeof(type_WindowStation) };
return get_object_type( &str );
}
@@ -251,8 +250,7 @@ static void desktop_dump( struct object *obj, int verbose )
static struct object_type *desktop_get_type( struct object *obj )
{
- static const WCHAR name[] = {'D','e','s','k','t','o','p'};
- static const struct unicode_str str = { name, sizeof(name) };
+ static const struct unicode_str str = { type_Desktop, sizeof(type_Desktop) };
return get_object_type( &str );
}
--
2.29.2

View File

@ -1,74 +0,0 @@
From 4d38c295f01f346087b3e0ee2214f9e031e21327 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 8 Mar 2017 03:44:19 +0100
Subject: server: Rename ObjectType to Type.
---
dlls/ntdll/tests/om.c | 2 +-
server/directory.c | 2 +-
server/object.c | 2 +-
server/object.h | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index dbe7be39..a94b9866 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -1625,7 +1625,7 @@ static void test_query_object_types(void)
if (i == 0)
{
- todo_wine ok( type->TypeName.Length == sizeof(typeW) && !strncmpW(typeW, type->TypeName.Buffer, 4),
+ ok( type->TypeName.Length == sizeof(typeW) && !strncmpW(typeW, type->TypeName.Buffer, 4),
"Expected 'Type' as first type, got %s\n", wine_dbgstr_us(&type->TypeName) );
}
diff --git a/server/directory.c b/server/directory.c
index 65a77a89..79bd46fc 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -119,7 +119,7 @@ static void object_type_dump( struct object *obj, int verbose )
static struct object_type *object_type_get_type( struct object *obj )
{
- static const struct unicode_str str = { type_ObjectType, sizeof(type_ObjectType) };
+ static const struct unicode_str str = { type_Type, sizeof(type_Type) };
return get_object_type( &str );
}
diff --git a/server/object.c b/server/object.c
index 8b4a8429..f7182eca 100644
--- a/server/object.c
+++ b/server/object.c
@@ -703,7 +703,7 @@ void no_destroy( struct object *obj )
static const struct unicode_str type_array[] =
{
- {type_ObjectType, sizeof(type_ObjectType)},
+ {type_Type, sizeof(type_Type)},
{type_Directory, sizeof(type_Directory)},
{type_SymbolicLink, sizeof(type_SymbolicLink)},
{type_Token, sizeof(type_Token)},
diff --git a/server/object.h b/server/object.h
index f75ccc0c..58ad2da1 100644
--- a/server/object.h
+++ b/server/object.h
@@ -245,7 +245,6 @@ static const WCHAR type_Job[] = {'J','o','b'};
static const WCHAR type_Key[] = {'K','e','y'};
static const WCHAR type_KeyedEvent[] = {'K','e','y','e','d','E','v','e','n','t'};
static const WCHAR type_Mutant[] = {'M','u','t','a','n','t'};
-static const WCHAR type_ObjectType[] = {'O','b','j','e','c','t','T','y','p','e'};
static const WCHAR type_Process[] = {'P','r','o','c','e','s','s'};
static const WCHAR type_Section[] = {'S','e','c','t','i','o','n'};
static const WCHAR type_Semaphore[] = {'S','e','m','a','p','h','o','r','e'};
@@ -253,6 +252,7 @@ static const WCHAR type_SymbolicLink[] = {'S','y','m','b','o','l','i','c','L','
static const WCHAR type_Thread[] = {'T','h','r','e','a','d'};
static const WCHAR type_Timer[] = {'T','i','m','e','r'};
static const WCHAR type_Token[] = {'T','o','k','e','n'};
+static const WCHAR type_Type[] = {'T','y','p','e'};
static const WCHAR type_WindowStation[] = {'W','i','n','d','o','w','S','t','a','t','i','o','n'};
extern void init_types(void);
--
2.20.1

View File

@ -1,72 +0,0 @@
From dfb9f91425d239620669215e9c914fbb1288dc4e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 8 Mar 2017 17:41:11 +0100
Subject: [PATCH] ntdll: Set TypeIndex for ObjectTypeInformation in
NtQueryObject.
---
dlls/ntdll/unix/file.c | 4 ++++
server/directory.c | 5 ++++-
server/protocol.def | 1 +
3 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index 93678aa70e5..d72a8370500 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -7554,6 +7554,10 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
p->TypeName.Buffer[res / sizeof(WCHAR)] = 0;
if (used_len) *used_len = sizeof(*p) + p->TypeName.MaximumLength;
}
+ if (status == STATUS_SUCCESS)
+ {
+ p->TypeIndex = reply->index;
+ }
}
}
SERVER_END_REQ;
diff --git a/server/directory.c b/server/directory.c
index 65357e7f2e3..99eafb9c53a 100644
--- a/server/directory.c
+++ b/server/directory.c
@@ -44,6 +44,7 @@
struct object_type
{
struct object obj; /* object header */
+ unsigned int index; /* type index */
};
static void object_type_dump( struct object *obj, int verbose );
@@ -240,7 +241,8 @@ struct object_type *get_object_type( const struct unicode_str *name )
if (get_error() != STATUS_OBJECT_NAME_EXISTS)
{
assert( object_type_count < ARRAY_SIZE(object_type_list) );
- object_type_list[ object_type_count++ ] = (struct object_type *)grab_object( type );
+ type->index = object_type_count++;
+ object_type_list[ type->index ] = (struct object_type *)type;
}
clear_error();
}
@@ -535,6 +537,7 @@ DECL_HANDLER(get_object_type)
{
if ((name = get_object_name( &type->obj, &reply->total )))
set_reply_data( name, min( reply->total, get_reply_max_size() ) );
+ reply->index = type->index;
release_object( type );
}
release_object( obj );
diff --git a/server/protocol.def b/server/protocol.def
index 8956e7175bf..9102f557e38 100644
--- a/server/protocol.def
+++ b/server/protocol.def
@@ -3319,6 +3319,7 @@ struct handle_info
@REQ(get_object_type)
obj_handle_t handle; /* handle to the object */
@REPLY
+ unsigned int index; /* type index */
data_size_t total; /* needed size for type name */
VARARG(type,unicode_str); /* type name */
@END
--
2.26.2

View File

@ -1,188 +0,0 @@
From 97644f6ad1f0ff31758356d12818de5454640fbb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Wed, 8 Mar 2017 19:39:29 +0100
Subject: [PATCH] ntdll: Mimic object type behavior for different windows
versions.
---
dlls/ntdll/tests/om.c | 65 +++++++++++++++++++++++++++++++++++++++-
dlls/ntdll/unix/file.c | 5 +++-
dlls/ntdll/unix/system.c | 17 +++++++++--
3 files changed, 82 insertions(+), 5 deletions(-)
diff --git a/dlls/ntdll/tests/om.c b/dlls/ntdll/tests/om.c
index 13035e12140..b318c0b2e64 100644
--- a/dlls/ntdll/tests/om.c
+++ b/dlls/ntdll/tests/om.c
@@ -78,6 +78,7 @@ static void (WINAPI *pRtlWakeAddressAll)( const void * );
static void (WINAPI *pRtlWakeAddressSingle)( const void * );
static NTSTATUS (WINAPI *pNtOpenProcess)( HANDLE *, ACCESS_MASK, const OBJECT_ATTRIBUTES *, const CLIENT_ID * );
static NTSTATUS (WINAPI *pNtCreateDebugObject)( HANDLE *, ACCESS_MASK, OBJECT_ATTRIBUTES *, ULONG );
+static NTSTATUS (WINAPI *pNtQuerySystemInformation)(SYSTEM_INFORMATION_CLASS, PVOID, ULONG, PULONG);
#define KEYEDEVENT_WAIT 0x0001
#define KEYEDEVENT_WAKE 0x0002
@@ -1658,13 +1659,31 @@ static void test_query_object(void)
pNtClose( handle );
}
+static BOOL winver_equal_or_newer(WORD major, WORD minor)
+{
+ OSVERSIONINFOEXW info = {sizeof(info)};
+ ULONGLONG mask = 0;
+
+ info.dwMajorVersion = major;
+ info.dwMinorVersion = minor;
+
+ VER_SET_CONDITION(mask, VER_MAJORVERSION, VER_GREATER_EQUAL);
+ VER_SET_CONDITION(mask, VER_MINORVERSION, VER_GREATER_EQUAL);
+
+ return VerifyVersionInfoW(&info, VER_MAJORVERSION | VER_MINORVERSION, mask);
+}
+
static void test_query_object_types(void)
{
static const WCHAR typeW[] = {'T','y','p','e'};
+ static const WCHAR eventW[] = {'E','v','e','n','t'};
+ SYSTEM_HANDLE_INFORMATION_EX *shi;
OBJECT_TYPES_INFORMATION *buffer;
OBJECT_TYPE_INFORMATION *type;
NTSTATUS status;
- ULONG len, i;
+ HANDLE handle;
+ BOOL found;
+ ULONG len, i, event_type_index = 0;
buffer = HeapAlloc( GetProcessHeap(), 0, sizeof(OBJECT_TYPES_INFORMATION) );
ok( buffer != NULL, "Failed to allocate memory\n" );
@@ -1692,11 +1711,54 @@ static void test_query_object_types(void)
ok( type->TypeName.Length == sizeof(typeW) && !strncmpW(typeW, type->TypeName.Buffer, 4),
"Expected 'Type' as first type, got %s\n", wine_dbgstr_us(&type->TypeName) );
}
+ if (type->TypeName.Length == sizeof(eventW) && !strncmpW(eventW, type->TypeName.Buffer, 5))
+ {
+ if (winver_equal_or_newer( 6, 2 ))
+ event_type_index = type->TypeIndex;
+ else
+ event_type_index = winver_equal_or_newer( 6, 1 ) ? i + 2 : i + 1;
+ }
type = (OBJECT_TYPE_INFORMATION *)ROUND_UP( (DWORD_PTR)(type + 1) + length, sizeof(DWORD_PTR) );
}
HeapFree( GetProcessHeap(), 0, buffer );
+
+ ok( event_type_index, "Could not find object type for events\n" );
+
+ handle = CreateEventA( NULL, FALSE, FALSE, NULL );
+ ok( handle != NULL, "Failed to create event\n" );
+
+ shi = HeapAlloc( GetProcessHeap(), 0, sizeof(*shi) );
+ ok( shi != NULL, "Failed to allocate memory\n" );
+
+ status = pNtQuerySystemInformation( SystemExtendedHandleInformation, shi, sizeof(*shi), &len );
+ ok( status == STATUS_INFO_LENGTH_MISMATCH, "Expected STATUS_INFO_LENGTH_MISMATCH, got %08x\n", status );
+
+ shi = HeapReAlloc( GetProcessHeap(), 0, shi, len );
+ ok( shi != NULL, "Failed to allocate memory\n" );
+
+ status = pNtQuerySystemInformation( SystemExtendedHandleInformation, shi, len, &len );
+ ok( status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %08x\n", status );
+
+ found = FALSE;
+ for (i = 0; i < shi->Count; i++)
+ {
+ if (shi->Handle[i].UniqueProcessId != GetCurrentProcessId())
+ continue;
+ if ((HANDLE)(ULONG_PTR)shi->Handle[i].HandleValue != handle)
+ continue;
+
+ ok( shi->Handle[i].ObjectTypeIndex == event_type_index, "Event type does not match: %u vs %u\n",
+ shi->Handle[i].ObjectTypeIndex, event_type_index );
+
+ found = TRUE;
+ break;
+ }
+ ok( found, "Expected to find event handle %p (pid %x) in handle list\n", handle, GetCurrentProcessId() );
+
+ HeapFree( GetProcessHeap(), 0, shi );
+ CloseHandle( handle );
}
static void test_type_mismatch(void)
@@ -2437,6 +2499,7 @@ START_TEST(om)
pRtlWakeAddressSingle = (void *)GetProcAddress(hntdll, "RtlWakeAddressSingle");
pNtOpenProcess = (void *)GetProcAddress(hntdll, "NtOpenProcess");
pNtCreateDebugObject = (void *)GetProcAddress(hntdll, "NtCreateDebugObject");
+ pNtQuerySystemInformation = (void *)GetProcAddress(hntdll, "NtQuerySystemInformation");
test_case_sensitive();
test_namespace_pipe();
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c
index c237a4550e3..98b2be9776e 100644
--- a/dlls/ntdll/unix/file.c
+++ b/dlls/ntdll/unix/file.c
@@ -7542,7 +7542,10 @@ NTSTATUS WINAPI NtQueryObject( HANDLE handle, OBJECT_INFORMATION_CLASS info_clas
}
if (status == STATUS_SUCCESS)
{
- p->TypeIndex = reply->index;
+ WORD version = MAKEWORD(NtCurrentTeb()->Peb->OSMinorVersion,
+ NtCurrentTeb()->Peb->OSMajorVersion);
+ if (version >= 0x0602)
+ p->TypeIndex = reply->index;
}
}
}
diff --git a/dlls/ntdll/unix/system.c b/dlls/ntdll/unix/system.c
index 5eb1bbf9203..21a7abd30a5 100644
--- a/dlls/ntdll/unix/system.c
+++ b/dlls/ntdll/unix/system.c
@@ -2055,6 +2055,18 @@ static void get_timezone_info( RTL_DYNAMIC_TIME_ZONE_INFORMATION *tzi )
mutex_unlock( &tz_mutex );
}
+static DWORD translate_object_index(DWORD index)
+{
+ WORD version = MAKEWORD(NtCurrentTeb()->Peb->OSMinorVersion, NtCurrentTeb()->Peb->OSMajorVersion);
+
+ /* Process Hacker depends on this logic */
+ if (version >= 0x0602)
+ return index;
+ else if (version == 0x0601)
+ return index + 2;
+ else
+ return index + 1;
+}
/******************************************************************************
* NtQuerySystemInformation (NTDLL.@)
@@ -2446,7 +2458,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
shi->Handle[i].OwnerPid = handle_info[i].owner;
shi->Handle[i].HandleValue = handle_info[i].handle;
shi->Handle[i].AccessMask = handle_info[i].access;
- shi->Handle[i].ObjectType = handle_info[i].type;
+ shi->Handle[i].ObjectType = translate_object_index( handle_info[i].type );
/* FIXME: Fill out HandleFlags, ObjectPointer */
}
}
@@ -2499,7 +2511,7 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
shi->Handle[i].UniqueProcessId = handle_info[i].owner;
shi->Handle[i].HandleValue = handle_info[i].handle;
shi->Handle[i].GrantedAccess = handle_info[i].access;
- shi->Handle[i].ObjectTypeIndex = handle_info[i].type;
+ shi->Handle[i].ObjectTypeIndex = translate_object_index( handle_info[i].type );
/* FIXME: Fill out remaining fields */
}
}
@@ -2741,7 +2753,6 @@ NTSTATUS WINAPI NtQuerySystemInformation( SYSTEM_INFORMATION_CLASS class,
return ret;
}
-
/******************************************************************************
* NtQuerySystemInformationEx (NTDLL.@)
*/
--
2.29.2

View File

@ -1,4 +1,4 @@
From 2756f2f11aaa25a9d31eee8eae603f278bbc20f1 Mon Sep 17 00:00:00 2001
From c1c4b5f185231e12dfb488d9b4530c4b10c2765d Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Mon, 30 Mar 2015 12:32:34 +0200
Subject: [PATCH] server: Add a helper function set_sd_from_token_internal to
@ -10,10 +10,10 @@ Subject: [PATCH] server: Add a helper function set_sd_from_token_internal to
2 files changed, 40 insertions(+), 22 deletions(-)
diff --git a/server/object.c b/server/object.c
index c4c62cb78ad..9342e94ae81 100644
index b2779fd61fe..9b1cca62af6 100644
--- a/server/object.c
+++ b/server/object.c
@@ -554,8 +554,9 @@ struct security_descriptor *default_get_sd( struct object *obj )
@@ -538,8 +538,9 @@ struct security_descriptor *default_get_sd( struct object *obj )
return obj->sd;
}
@ -25,7 +25,7 @@ index c4c62cb78ad..9342e94ae81 100644
{
struct security_descriptor new_sd, *new_sd_ptr;
int present;
@@ -564,8 +565,6 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
@@ -548,8 +549,6 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
ACL *replaced_sacl = NULL;
char *ptr;
@ -34,7 +34,7 @@ index c4c62cb78ad..9342e94ae81 100644
new_sd.control = sd->control & ~SE_SELF_RELATIVE;
if (set_info & OWNER_SECURITY_INFORMATION && sd->owner_len)
@@ -573,10 +572,10 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
@@ -557,10 +556,10 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
owner = sd_get_owner( sd );
new_sd.owner_len = sd->owner_len;
}
@ -48,7 +48,7 @@ index c4c62cb78ad..9342e94ae81 100644
}
else if (token)
{
@@ -590,10 +589,10 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
@@ -574,10 +573,10 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
group = sd_get_group( sd );
new_sd.group_len = sd->group_len;
}
@ -62,7 +62,7 @@ index c4c62cb78ad..9342e94ae81 100644
}
else if (token)
{
@@ -611,20 +610,20 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
@@ -595,20 +594,20 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
else if (set_info & LABEL_SECURITY_INFORMATION && present)
{
const ACL *old_sacl = NULL;
@ -88,7 +88,7 @@ index c4c62cb78ad..9342e94ae81 100644
}
else
new_sd.sacl_len = 0;
@@ -638,12 +637,12 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
@@ -622,12 +621,12 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
}
else
{
@ -104,7 +104,7 @@ index c4c62cb78ad..9342e94ae81 100644
}
else if (token)
{
@@ -659,7 +658,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
@@ -643,7 +642,7 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
if (!ptr)
{
free( replaced_sacl );
@ -113,7 +113,7 @@ index c4c62cb78ad..9342e94ae81 100644
}
new_sd_ptr = (struct security_descriptor*)ptr;
@@ -674,9 +673,25 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
@@ -658,9 +657,25 @@ int set_sd_defaults_from_token( struct object *obj, const struct security_descri
memcpy( ptr, dacl, new_sd.dacl_len );
free( replaced_sacl );
@ -143,11 +143,11 @@ index c4c62cb78ad..9342e94ae81 100644
/** Set the security descriptor using the current primary token for defaults. */
diff --git a/server/object.h b/server/object.h
index 53e37b61a21..8203889323a 100644
index 5b2c309f0b2..4f354cca177 100644
--- a/server/object.h
+++ b/server/object.h
@@ -164,6 +164,9 @@ extern struct fd *no_get_fd( struct object *obj );
extern unsigned int no_map_access( struct object *obj, unsigned int access );
@@ -174,6 +174,9 @@ extern struct fd *no_get_fd( struct object *obj );
extern unsigned int default_map_access( struct object *obj, unsigned int access );
extern struct security_descriptor *default_get_sd( struct object *obj );
extern int default_set_sd( struct object *obj, const struct security_descriptor *sd, unsigned int set_info );
+extern struct security_descriptor *set_sd_from_token_internal( const struct security_descriptor *sd,
@ -157,5 +157,5 @@ index 53e37b61a21..8203889323a 100644
unsigned int set_info, struct token *token );
extern WCHAR *no_get_full_name( struct object *obj, data_size_t *ret_len );
--
2.28.0
2.20.1

View File

@ -1,4 +1,4 @@
From bb39aec79b0478b743dd77b306117acfd2657461 Mon Sep 17 00:00:00 2001
From 6cf91ff22e2b7c07e46a6b3fe5a9ec1185c27c63 Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Mon, 30 Mar 2015 13:04:23 +0200
Subject: [PATCH] server: Store file security attributes with extended file
@ -9,7 +9,7 @@ Subject: [PATCH] server: Store file security attributes with extended file
1 file changed, 78 insertions(+)
diff --git a/server/file.c b/server/file.c
index d97cec98e67..0a0beb03303 100644
index d40995fce99..cde04a594a9 100644
--- a/server/file.c
+++ b/server/file.c
@@ -32,6 +32,7 @@
@ -36,8 +36,8 @@ index d97cec98e67..0a0beb03303 100644
#include "ntstatus.h"
#define WIN32_NO_STATUS
@@ -59,6 +69,21 @@ struct type_descr file_type =
{ file_name, sizeof(file_name) }, /* name */
@@ -66,6 +76,21 @@ struct type_descr file_type =
},
};
+#ifndef XATTR_USER_PREFIX
@ -58,7 +58,7 @@ index d97cec98e67..0a0beb03303 100644
struct file
{
struct object obj; /* object header */
@@ -211,6 +236,56 @@ int is_file_executable( const char *name )
@@ -216,6 +241,56 @@ int is_file_executable( const char *name )
return len >= 4 && (!strcasecmp( name + len - 4, ".exe") || !strcasecmp( name + len - 4, ".com" ));
}
@ -115,7 +115,7 @@ index d97cec98e67..0a0beb03303 100644
static struct object *create_file( struct fd *root, const char *nameptr, data_size_t len,
unsigned int access, unsigned int sharing, int create,
unsigned int options, unsigned int attrs,
@@ -617,6 +692,9 @@ int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid,
@@ -613,6 +688,9 @@ int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid,
*mode = (*mode & S_IFMT) | new_mode;
}

View File

@ -1,4 +1,4 @@
From 3a62e2af870b66bb3b57721a48d30dec87fb3d0e Mon Sep 17 00:00:00 2001
From 950b2b3feea2040879c6a0ec69a8aecc92b49d9d Mon Sep 17 00:00:00 2001
From: "Erich E. Hoover" <erich.e.hoover@gmail.com>
Date: Fri, 18 Apr 2014 14:05:32 -0600
Subject: [PATCH] server: Convert return of file security masks with generic
@ -10,10 +10,10 @@ Subject: [PATCH] server: Convert return of file security masks with generic
2 files changed, 26 insertions(+), 3 deletions(-)
diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c
index 7e8f2443cd33..a27cd41cde81 100644
index fe88964f53f..957b407061d 100644
--- a/dlls/advapi32/tests/security.c
+++ b/dlls/advapi32/tests/security.c
@@ -4913,8 +4913,8 @@ static void test_GetSecurityInfo(void)
@@ -4919,8 +4919,8 @@ static void test_GetSecurityInfo(void)
ok(bret, "Current User ACE (%s) != Current User SID (%s).\n", debugstr_sid(&ace->SidStart), debugstr_sid(user_sid));
ok(((ACE_HEADER *)ace)->AceFlags == 0,
"Current User ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags);
@ -24,7 +24,7 @@ index 7e8f2443cd33..a27cd41cde81 100644
}
if (acl_size.AceCount > 1)
{
@@ -4924,7 +4924,7 @@ static void test_GetSecurityInfo(void)
@@ -4930,7 +4930,7 @@ static void test_GetSecurityInfo(void)
ok(bret, "Administators Group ACE (%s) != Administators Group SID (%s).\n", debugstr_sid(&ace->SidStart), debugstr_sid(admin_sid));
ok(((ACE_HEADER *)ace)->AceFlags == 0,
"Administators Group ACE has unexpected flags (0x%x != 0x0)\n", ((ACE_HEADER *)ace)->AceFlags);
@ -34,10 +34,10 @@ index 7e8f2443cd33..a27cd41cde81 100644
}
LocalFree(pSD);
diff --git a/server/file.c b/server/file.c
index 5e542b62e77e..818bd42af76a 100644
index cde04a594a9..3055e6ff5b1 100644
--- a/server/file.c
+++ b/server/file.c
@@ -475,6 +475,26 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID
@@ -506,6 +506,26 @@ struct security_descriptor *mode_to_sd( mode_t mode, const SID *user, const SID
return sd;
}
@ -56,7 +56,7 @@ index 5e542b62e77e..818bd42af76a 100644
+ for (i = 0; i < dacl->AceCount; i++, ace = ace_next( ace ))
+ {
+ DWORD *mask = (DWORD *)(ace + 1);
+ *mask = generic_file_map_access( *mask );
+ *mask = map_access( *mask, &file_type.mapping );
+ }
+ }
+}
@ -64,7 +64,7 @@ index 5e542b62e77e..818bd42af76a 100644
struct security_descriptor *get_file_sd( struct object *obj, struct fd *fd, mode_t *mode,
uid_t *uid )
{
@@ -613,6 +633,9 @@ int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid,
@@ -647,6 +667,9 @@ int set_file_sd( struct object *obj, struct fd *fd, mode_t *mode, uid_t *uid,
new_sd = set_sd_from_token_internal( sd, obj->sd, set_info, current->process->token );
if (new_sd)
{
@ -75,5 +75,5 @@ index 5e542b62e77e..818bd42af76a 100644
{
owner = sd_get_owner( new_sd );
--
2.26.2
2.20.1

View File

@ -1,162 +0,0 @@
From 72fb994d9750998fde2d8ecbb9bd98983aeb66f8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 4 Feb 2021 10:35:39 +0100
Subject: [PATCH] widl: Factor and cleanup interface type declaration and
definition.
---
tools/widl/parser.y | 34 ++++++++++------------------------
tools/widl/typetree.c | 19 ++++++++++++++++++-
tools/widl/typetree.h | 4 +++-
3 files changed, 31 insertions(+), 26 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 1505e3e88a0..44716deb5b6 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -87,7 +87,6 @@ static void push_lookup_namespace(const char *name);
static void check_arg_attrs(const var_t *arg);
static void check_statements(const statement_list_t *stmts, int is_inside_library);
static void check_all_user_types(const statement_list_t *stmts);
-static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_function_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_typedef_attrs(attr_list_t *attrs);
static attr_list_t *check_enum_attrs(attr_list_t *attrs);
@@ -281,7 +280,6 @@ static typelib_t *current_typelib;
%type <expr> m_expr expr expr_const expr_int_const array m_bitfield
%type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
%type <expr> contract_req
-%type <type> interfacehdr
%type <stgclass> storage_cls_spec
%type <type_qualifier> type_qualifier m_type_qual_list
%type <function_specifier> function_specifier
@@ -971,31 +969,20 @@ inherit: { $$ = NULL; }
| ':' qualified_type { $$ = $2; }
;
-interface: tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
- | tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
+interface:
+ tINTERFACE aIDENTIFIER { $$ = type_interface_declare($2, current_namespace); }
+ | tINTERFACE aKNOWNTYPE { $$ = type_interface_declare($2, current_namespace); }
;
-interfacehdr: attributes interface { $$ = $2;
- check_def($2);
- $2->attrs = check_iface_attrs($2->name, $1);
- $2->defined = TRUE;
- }
- ;
-
-interfacedef: interfacehdr inherit
- '{' int_statements '}' semicolon_opt { $$ = $1;
- if($$ == $2)
- error_loc("Interface can't inherit from itself\n");
- type_interface_define($$, $2, $4);
+interfacedef: attributes interface inherit
+ '{' int_statements '}' semicolon_opt { $$ = type_interface_define($2, $1, $3, $5);
check_async_uuid($$);
}
/* MIDL is able to import the definition of a base class from inside the
* definition of a derived class, I'll try to support it with this rule */
- | interfacehdr ':' aIDENTIFIER
+ | attributes interface ':' aIDENTIFIER
'{' import int_statements '}'
- semicolon_opt { $$ = $1;
- type_interface_define($$, find_type_or_error($3), $6);
- }
+ semicolon_opt { $$ = type_interface_define($2, $1, find_type_or_error($4), $7); }
| dispinterfacedef semicolon_opt { $$ = $1; }
;
@@ -2340,7 +2327,7 @@ const char *get_attr_display_name(enum attr_type type)
return allowed_attr[type].display_name;
}
-static attr_list_t *check_iface_attrs(const char *name, attr_list_t *attrs)
+attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs)
{
const attr_t *attr;
if (!attrs) return attrs;
@@ -2978,8 +2965,7 @@ static void check_async_uuid(type_t *iface)
if (!inherit)
error_loc("async_uuid applied to an interface with incompatible parent\n");
- async_iface = get_type(TYPE_INTERFACE, strmake("Async%s", iface->name), iface->namespace, 0);
- async_iface->attrs = map_attrs(iface->attrs, async_iface_attrs);
+ async_iface = type_interface_declare(strmake("Async%s", iface->name), iface->namespace);
STATEMENTS_FOR_EACH_FUNC( stmt, type_iface_get_stmts(iface) )
{
@@ -3010,7 +2996,7 @@ static void check_async_uuid(type_t *iface)
stmts = append_statement(stmts, make_statement_declaration(finish_func));
}
- type_interface_define(async_iface, inherit, stmts);
+ type_interface_define(async_iface, map_attrs(iface->attrs, async_iface_attrs), inherit, stmts);
iface->details.iface->async_iface = async_iface->details.iface->async_iface = async_iface;
}
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 825348ddef4..84be75fa3b7 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -442,8 +442,24 @@ static unsigned int compute_method_indexes(type_t *iface)
return idx;
}
-void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts)
+type_t *type_interface_declare(char *name, struct namespace *namespace)
{
+ type_t *type = get_type(TYPE_INTERFACE, name, namespace, 0);
+ if (type_get_type_detect_alias(type) != TYPE_INTERFACE)
+ error_loc("interface %s previously not declared an interface at %s:%d\n",
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
+ return type;
+}
+
+type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts)
+{
+ if (iface->defined)
+ error_loc("interface %s already defined at %s:%d\n",
+ iface->name, iface->loc_info.input_name, iface->loc_info.line_number);
+ if (iface == inherit)
+ error_loc("interface %s can't inherit from itself\n",
+ iface->name);
+ iface->attrs = check_interface_attrs(iface->name, attrs);
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
iface->details.iface->disp_props = NULL;
iface->details.iface->disp_methods = NULL;
@@ -453,6 +469,7 @@ void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stm
iface->details.iface->async_iface = NULL;
iface->defined = TRUE;
compute_method_indexes(iface);
+ return iface;
}
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods)
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 8a8e1c529ac..7b67f3b996a 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -30,6 +30,7 @@ enum name_type {
};
attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
+attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs);
attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs);
type_t *type_new_function(var_list_t *args);
@@ -48,7 +49,8 @@ type_t *type_new_nonencapsulated_union(const char *name, int defined, var_list_t
type_t *type_new_encapsulated_union(char *name, var_t *switch_field, var_t *union_field, var_list_t *cases);
type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
type_t *type_runtimeclass_declare(char *name, struct namespace *namespace);
-void type_interface_define(type_t *iface, type_t *inherit, statement_list_t *stmts);
+type_t *type_interface_declare(char *name, struct namespace *namespace);
+type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts);
void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
void type_module_define(type_t *module, statement_list_t *stmts);
--
2.20.1

View File

@ -1,182 +0,0 @@
From ae71cd3e9512f1b96ef79eb76507046128e94f6e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 4 Feb 2021 10:34:24 +0100
Subject: [PATCH] widl: Factor and cleanup dispinterface type declaration and
definition.
---
tools/widl/parser.y | 36 +++++++++++++-----------------------
tools/widl/typetree.c | 23 +++++++++++++++++++++--
tools/widl/typetree.h | 6 ++++--
3 files changed, 38 insertions(+), 27 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 44716deb5b6..349e4730d96 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -95,7 +95,6 @@ static attr_list_t *check_struct_attrs(attr_list_t *attrs);
static attr_list_t *check_union_attrs(attr_list_t *attrs);
static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs);
-static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs);
const char *get_attr_display_name(enum attr_type type);
@@ -276,6 +275,7 @@ static typelib_t *current_typelib;
%type <attr> attribute acf_attribute
%type <attr_list> m_attributes attributes attrib_list
%type <attr_list> acf_attributes acf_attribute_list
+%type <attr_list> dispattributes
%type <str_list> str_list
%type <expr> m_expr expr expr_const expr_int_const array m_bitfield
%type <expr_list> m_exprs /* exprs expr_list */ expr_list_int_const
@@ -286,7 +286,7 @@ static typelib_t *current_typelib;
%type <declspec> decl_spec decl_spec_no_type m_decl_spec_no_type
%type <type> inherit interface interfacedef
%type <type> interfaceref
-%type <type> dispinterface dispinterfacehdr dispinterfacedef
+%type <type> dispinterface dispinterfacedef
%type <type> module modulehdr moduledef
%type <str> namespacedef
%type <type> base_type int_std
@@ -932,17 +932,12 @@ class_interface:
m_attributes interfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; }
;
-dispinterface: tDISPINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
- | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
+dispinterface:
+ tDISPINTERFACE aIDENTIFIER { $$ = type_dispinterface_declare($2); }
+ | tDISPINTERFACE aKNOWNTYPE { $$ = type_dispinterface_declare($2); }
;
-dispinterfacehdr: attributes dispinterface { attr_t *attrs;
- $$ = $2;
- check_def($$);
- attrs = make_attr(ATTR_DISPINTERFACE);
- $$->attrs = append_attr( check_dispiface_attrs($2->name, $1), attrs );
- $$->defined = TRUE;
- }
+dispattributes: attributes { $$ = append_attr($1, make_attr(ATTR_DISPINTERFACE)); }
;
dispint_props: tPROPERTIES ':' { $$ = NULL; }
@@ -953,16 +948,11 @@ dispint_meths: tMETHODS ':' { $$ = NULL; }
| dispint_meths funcdef ';' { $$ = append_var( $1, $2 ); }
;
-dispinterfacedef: dispinterfacehdr '{'
- dispint_props
- dispint_meths
- '}' { $$ = $1;
- type_dispinterface_define($$, $3, $4);
- }
- | dispinterfacehdr
- '{' interface ';' '}' { $$ = $1;
- type_dispinterface_define_from_iface($$, $3);
- }
+dispinterfacedef:
+ dispattributes dispinterface '{' dispint_props dispint_meths '}'
+ { $$ = type_dispinterface_define($2, $1, $4, $5); }
+ | dispattributes dispinterface '{' interface ';' '}'
+ { $$ = type_dispinterface_define_from_iface($2, $1, $4); }
;
inherit: { $$ = NULL; }
@@ -2214,7 +2204,7 @@ struct allowed_attr allowed_attr[] =
/* ATTR_DEFAULTVALUE */ { 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "defaultvalue" },
/* ATTR_DEFAULTVTABLE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, "defaultvtable" },
/* ATTR_DISABLECONSISTENCYCHECK */{ 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "disable_consistency_check" },
- /* ATTR_DISPINTERFACE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, NULL },
+ /* ATTR_DISPINTERFACE */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, NULL },
/* ATTR_DISPLAYBIND */ { 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "displaybind" },
/* ATTR_DLLNAME */ { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, "dllname" },
/* ATTR_DUAL */ { 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, "dual" },
@@ -2471,7 +2461,7 @@ static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs)
return attrs;
}
-static attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs)
+attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs)
{
const attr_t *attr;
if (!attrs) return attrs;
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 84be75fa3b7..81eaba5556b 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -472,8 +472,21 @@ type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit
return iface;
}
-void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods)
+type_t *type_dispinterface_declare(char *name)
{
+ type_t *type = get_type(TYPE_INTERFACE, name, NULL, 0);
+ if (type_get_type_detect_alias(type) != TYPE_INTERFACE)
+ error_loc("dispinterface %s previously not declared a dispinterface at %s:%d\n",
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
+ return type;
+}
+
+type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods)
+{
+ if (iface->defined)
+ error_loc("dispinterface %s already defined at %s:%d\n",
+ iface->name, iface->loc_info.input_name, iface->loc_info.line_number);
+ iface->attrs = check_dispiface_attrs(iface->name, attrs);
iface->details.iface = xmalloc(sizeof(*iface->details.iface));
iface->details.iface->disp_props = props;
iface->details.iface->disp_methods = methods;
@@ -484,10 +497,15 @@ void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *met
iface->details.iface->async_iface = NULL;
iface->defined = TRUE;
compute_method_indexes(iface);
+ return iface;
}
-void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface)
+type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *attrs, type_t *iface)
{
+ if (dispiface->defined)
+ error_loc("dispinterface %s already defined at %s:%d\n",
+ dispiface->name, dispiface->loc_info.input_name, dispiface->loc_info.line_number);
+ dispiface->attrs = check_dispiface_attrs(dispiface->name, attrs);
dispiface->details.iface = xmalloc(sizeof(*dispiface->details.iface));
dispiface->details.iface->disp_props = NULL;
dispiface->details.iface->disp_methods = NULL;
@@ -498,6 +516,7 @@ void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface)
dispiface->details.iface->async_iface = NULL;
dispiface->defined = TRUE;
compute_method_indexes(dispiface);
+ return dispiface;
}
void type_module_define(type_t *module, statement_list_t *stmts)
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 7b67f3b996a..280d2e722cf 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -30,6 +30,7 @@ enum name_type {
};
attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
+attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs);
attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs);
attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs);
@@ -51,8 +52,9 @@ type_t *type_new_bitfield(type_t *field_type, const expr_t *bits);
type_t *type_runtimeclass_declare(char *name, struct namespace *namespace);
type_t *type_interface_declare(char *name, struct namespace *namespace);
type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit, statement_list_t *stmts);
-void type_dispinterface_define(type_t *iface, var_list_t *props, var_list_t *methods);
-void type_dispinterface_define_from_iface(type_t *dispiface, type_t *iface);
+type_t *type_dispinterface_declare(char *name);
+type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods);
+type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *attrs, type_t *iface);
void type_module_define(type_t *module, statement_list_t *stmts);
type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *ifaces);
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces);
--
2.20.1

View File

@ -1,154 +0,0 @@
From 623643c78b618ae83aaebaaf16988d8765bf5eff Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 4 Feb 2021 10:56:18 +0100
Subject: [PATCH] widl: Factor and cleanup apicontract type declaration and
definition.
And remove unused check_def helper.
---
tools/widl/parser.y | 35 +++++++++++++++--------------------
tools/widl/typetree.c | 19 +++++++++++++++++++
tools/widl/typetree.h | 3 +++
3 files changed, 37 insertions(+), 20 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 349e4730d96..8c805e481f8 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -96,10 +96,8 @@ static attr_list_t *check_union_attrs(attr_list_t *attrs);
static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
-static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs);
const char *get_attr_display_name(enum attr_type type);
static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func);
-static void check_def(const type_t *t);
static void check_async_uuid(type_t *iface);
@@ -305,7 +303,7 @@ static typelib_t *current_typelib;
%type <declarator_list> declarator_list struct_declarator_list
%type <type> coclass coclassdef
%type <type> runtimeclass runtimeclass_def
-%type <type> apicontract
+%type <type> apicontract apicontract_def
%type <num> contract_ver
%type <num> pointer_type threading_type marshaling_behavior version
%type <str> libraryhdr callconv cppquote importlib import t_ident
@@ -364,8 +362,9 @@ gbl_statements: { $$ = NULL; }
| gbl_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2));
reg_type($2, $2->name, current_namespace, 0);
}
- | gbl_statements apicontract ';' { $$ = append_statement($1, make_statement_type_decl($2));
- reg_type($2, $2->name, current_namespace, 0); }
+ | gbl_statements apicontract ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
+ | gbl_statements apicontract_def { $$ = append_statement($1, make_statement_type_decl($2));
+ reg_type($2, $2->name, current_namespace, 0); }
| gbl_statements runtimeclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
| gbl_statements runtimeclass_def { $$ = append_statement($1, make_statement_type_decl($2));
reg_type($2, $2->name, current_namespace, 0); }
@@ -384,8 +383,9 @@ imp_statements: { $$ = NULL; }
| imp_statements coclassdef { $$ = append_statement($1, make_statement_type_decl($2));
reg_type($2, $2->name, current_namespace, 0);
}
- | imp_statements apicontract ';' { $$ = append_statement($1, make_statement_type_decl($2));
- reg_type($2, $2->name, current_namespace, 0); }
+ | imp_statements apicontract ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
+ | imp_statements apicontract_def { $$ = append_statement($1, make_statement_type_decl($2));
+ reg_type($2, $2->name, current_namespace, 0); }
| imp_statements runtimeclass ';' { $$ = $1; reg_type($2, $2->name, current_namespace, 0); }
| imp_statements runtimeclass_def { $$ = append_statement($1, make_statement_type_decl($2));
reg_type($2, $2->name, current_namespace, 0); }
@@ -913,11 +913,13 @@ runtimeclass_def: attributes runtimeclass '{' class_interfaces '}' semicolon_opt
{ $$ = type_runtimeclass_define($2, $1, $4); }
;
-apicontract: attributes tAPICONTRACT aIDENTIFIER '{' '}'
- { $$ = get_type(TYPE_APICONTRACT, $3, current_namespace, 0);
- check_def($$);
- $$->attrs = check_apicontract_attrs($$->name, $1);
- }
+apicontract:
+ tAPICONTRACT aIDENTIFIER { $$ = type_apicontract_declare($2, current_namespace); }
+ | tAPICONTRACT aKNOWNTYPE { $$ = type_apicontract_declare($2, current_namespace); }
+ ;
+
+apicontract_def: attributes apicontract '{' '}' semicolon_opt
+ { $$ = type_apicontract_define($2, $1); }
;
namespacedef: tNAMESPACE aIDENTIFIER { $$ = $2; }
@@ -2511,7 +2513,7 @@ attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs)
return attrs;
}
-static attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs)
+attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs)
{
const attr_t *attr;
if (!attrs) return attrs;
@@ -3205,10 +3207,3 @@ void init_loc_info(loc_info_t *i)
i->line_number = line_number;
i->near_text = parser_text;
}
-
-static void check_def(const type_t *t)
-{
- if (t->defined)
- error_loc("%s: redefinition error; original definition was at %s:%d\n",
- t->name, t->loc_info.input_name, t->loc_info.line_number);
-}
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 81eaba5556b..004f7fc7b0d 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -569,6 +569,25 @@ type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref
return runtimeclass;
}
+type_t *type_apicontract_declare(char *name, struct namespace *namespace)
+{
+ type_t *type = get_type(TYPE_APICONTRACT, name, namespace, 0);
+ if (type_get_type_detect_alias(type) != TYPE_APICONTRACT)
+ error_loc("apicontract %s previously not declared a apicontract at %s:%d\n",
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
+ return type;
+}
+
+type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs)
+{
+ if (apicontract->defined)
+ error_loc("apicontract %s already defined at %s:%d\n",
+ apicontract->name, apicontract->loc_info.input_name, apicontract->loc_info.line_number);
+ apicontract->attrs = check_apicontract_attrs(apicontract->name, attrs);
+ apicontract->defined = TRUE;
+ return apicontract;
+}
+
int type_is_equal(const type_t *type1, const type_t *type2)
{
if (type_get_type_detect_alias(type1) != type_get_type_detect_alias(type2))
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 280d2e722cf..7c19da8e045 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -29,6 +29,7 @@ enum name_type {
NAME_C
};
+attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs);
attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs);
attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs);
@@ -58,6 +59,8 @@ type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *att
void type_module_define(type_t *module, statement_list_t *stmts);
type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *ifaces);
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces);
+type_t *type_apicontract_declare(char *name, struct namespace *namespace);
+type_t *type_apicontract_define(type_t *apicontract, attr_list_t *attrs);
int type_is_equal(const type_t *type1, const type_t *type2);
const char *type_get_name(const type_t *type, enum name_type name_type);
char *gen_name(void);
--
2.20.1

View File

@ -1,146 +0,0 @@
From fd50398643cafcfa3868a9e47429db7136a16ef5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 4 Feb 2021 11:02:09 +0100
Subject: [PATCH] widl: Factor and cleanup module type declaration and
definition.
---
tools/widl/parser.y | 20 ++++++--------------
tools/widl/typetree.c | 27 +++++++++++++++------------
tools/widl/typetree.h | 5 +++--
3 files changed, 24 insertions(+), 28 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 8c805e481f8..782ed39643c 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -95,7 +95,6 @@ static attr_list_t *check_struct_attrs(attr_list_t *attrs);
static attr_list_t *check_union_attrs(attr_list_t *attrs);
static attr_list_t *check_field_attrs(const char *name, attr_list_t *attrs);
static attr_list_t *check_library_attrs(const char *name, attr_list_t *attrs);
-static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
const char *get_attr_display_name(enum attr_type type);
static void add_explicit_handle_if_necessary(const type_t *iface, var_t *func);
@@ -285,7 +284,7 @@ static typelib_t *current_typelib;
%type <type> inherit interface interfacedef
%type <type> interfaceref
%type <type> dispinterface dispinterfacedef
-%type <type> module modulehdr moduledef
+%type <type> module moduledef
%type <str> namespacedef
%type <type> base_type int_std
%type <type> enumdef structdef uniondef typedecl
@@ -985,19 +984,12 @@ interfaceref:
| tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
;
-module: tMODULE aIDENTIFIER { $$ = type_new_module($2); }
- | tMODULE aKNOWNTYPE { $$ = type_new_module($2); }
+module: tMODULE aIDENTIFIER { $$ = type_module_declare($2); }
+ | tMODULE aKNOWNTYPE { $$ = type_module_declare($2); }
;
-modulehdr: attributes module { $$ = $2;
- $$->attrs = check_module_attrs($2->name, $1);
- }
- ;
-
-moduledef: modulehdr '{' int_statements '}'
- semicolon_opt { $$ = $1;
- type_module_define($$, $3);
- }
+moduledef: attributes module '{' int_statements '}' semicolon_opt
+ { $$ = type_module_define($2, $1, $4); }
;
storage_cls_spec:
@@ -2476,7 +2468,7 @@ attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs)
return attrs;
}
-static attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs)
+attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs)
{
const attr_t *attr;
if (!attrs) return attrs;
diff --git a/tools/widl/typetree.c b/tools/widl/typetree.c
index 004f7fc7b0d..b3f0725f00e 100644
--- a/tools/widl/typetree.c
+++ b/tools/widl/typetree.c
@@ -195,16 +195,6 @@ type_t *type_new_alias(const decl_spec_t *t, const char *name)
return a;
}
-type_t *type_new_module(char *name)
-{
- type_t *type = get_type(TYPE_MODULE, name, NULL, 0);
- if (type->type_type != TYPE_MODULE || type->defined)
- error_loc("%s: redefinition error; original definition was at %s:%d\n",
- type->name, type->loc_info.input_name, type->loc_info.line_number);
- type->name = name;
- return type;
-}
-
type_t *type_new_array(const char *name, const decl_spec_t *element, int declptr,
unsigned int dim, expr_t *size_is, expr_t *length_is)
{
@@ -519,12 +509,25 @@ type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *att
return dispiface;
}
-void type_module_define(type_t *module, statement_list_t *stmts)
+type_t *type_module_declare(char *name)
+{
+ type_t *type = get_type(TYPE_MODULE, name, NULL, 0);
+ if (type_get_type_detect_alias(type) != TYPE_MODULE)
+ error_loc("module %s previously not declared a module at %s:%d\n",
+ type->name, type->loc_info.input_name, type->loc_info.line_number);
+ return type;
+}
+
+type_t *type_module_define(type_t* module, attr_list_t *attrs, statement_list_t *stmts)
{
- if (module->details.module) error_loc("multiple definition error\n");
+ if (module->defined)
+ error_loc("module %s already defined at %s:%d\n",
+ module->name, module->loc_info.input_name, module->loc_info.line_number);
+ module->attrs = check_module_attrs(module->name, attrs);
module->details.module = xmalloc(sizeof(*module->details.module));
module->details.module->stmts = stmts;
module->defined = TRUE;
+ return module;
}
type_t *type_coclass_declare(char *name)
diff --git a/tools/widl/typetree.h b/tools/widl/typetree.h
index 7c19da8e045..8e04537ab4d 100644
--- a/tools/widl/typetree.h
+++ b/tools/widl/typetree.h
@@ -33,12 +33,13 @@ attr_list_t *check_apicontract_attrs(const char *name, attr_list_t *attrs);
attr_list_t *check_coclass_attrs(const char *name, attr_list_t *attrs);
attr_list_t *check_dispiface_attrs(const char *name, attr_list_t *attrs);
attr_list_t *check_interface_attrs(const char *name, attr_list_t *attrs);
+attr_list_t *check_module_attrs(const char *name, attr_list_t *attrs);
attr_list_t *check_runtimeclass_attrs(const char *name, attr_list_t *attrs);
type_t *type_new_function(var_list_t *args);
type_t *type_new_pointer(type_t *ref);
type_t *type_new_alias(const decl_spec_t *t, const char *name);
-type_t *type_new_module(char *name);
+type_t *type_module_declare(char *name);
type_t *type_new_array(const char *name, const decl_spec_t *element, int declptr,
unsigned int dim, expr_t *size_is, expr_t *length_is);
type_t *type_new_basic(enum type_basic_type basic_type);
@@ -56,7 +57,7 @@ type_t *type_interface_define(type_t *iface, attr_list_t *attrs, type_t *inherit
type_t *type_dispinterface_declare(char *name);
type_t *type_dispinterface_define(type_t *iface, attr_list_t *attrs, var_list_t *props, var_list_t *methods);
type_t *type_dispinterface_define_from_iface(type_t *dispiface, attr_list_t *attrs, type_t *iface);
-void type_module_define(type_t *module, statement_list_t *stmts);
+type_t *type_module_define(type_t* module, attr_list_t *attrs, statement_list_t *stmts);
type_t *type_coclass_define(type_t *coclass, attr_list_t *attrs, ifref_list_t *ifaces);
type_t *type_runtimeclass_define(type_t *runtimeclass, attr_list_t *attrs, ifref_list_t *ifaces);
type_t *type_apicontract_declare(char *name, struct namespace *namespace);
--
2.20.1

View File

@ -1,159 +0,0 @@
From bc7044d3cd826d7b3e01566514f9515c3fd7bc5c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Bernon?= <rbernon@codeweavers.com>
Date: Thu, 4 Feb 2021 16:46:40 +0100
Subject: [PATCH] widl: Fold aIDENTIFIER / aKNOWNTYPE rules together.
Splitting t_ident rule as typename / m_typename rules.
---
tools/widl/parser.y | 55 ++++++++++++++++++---------------------------
1 file changed, 22 insertions(+), 33 deletions(-)
diff --git a/tools/widl/parser.y b/tools/widl/parser.y
index 782ed39643c..2d527805c14 100644
--- a/tools/widl/parser.y
+++ b/tools/widl/parser.y
@@ -305,7 +305,8 @@ static typelib_t *current_typelib;
%type <type> apicontract apicontract_def
%type <num> contract_ver
%type <num> pointer_type threading_type marshaling_behavior version
-%type <str> libraryhdr callconv cppquote importlib import t_ident
+%type <str> libraryhdr callconv cppquote importlib import
+%type <str> typename m_typename
%type <uuid> uuid_string
%type <import> import_start
%type <typelib> library_start librarydef
@@ -459,8 +460,7 @@ importlib: tIMPORTLIB '(' aSTRING ')'
semicolon_opt { $$ = $3; if(!parse_only) add_importlib($3, current_typelib); }
;
-libraryhdr: tLIBRARY aIDENTIFIER { $$ = $2; }
- | tLIBRARY aKNOWNTYPE { $$ = $2; }
+libraryhdr: tLIBRARY typename { $$ = $2; }
;
library_start: attributes libraryhdr '{' { $$ = make_library($2, check_library_attrs($2, $1));
if (!parse_only && do_typelib) current_typelib = $$;
@@ -715,7 +715,7 @@ enum: enum_member '=' expr_int_const { $$ = reg_const($1);
}
;
-enumdef: tENUM t_ident '{' enums '}' { $$ = type_new_enum($2, current_namespace, TRUE, $4); }
+enumdef: tENUM m_typename '{' enums '}' { $$ = type_new_enum($2, current_namespace, TRUE, $4); }
;
m_exprs: m_expr { $$ = append_expr( NULL, $1 ); }
@@ -847,14 +847,15 @@ m_ident: { $$ = NULL; }
| ident
;
-t_ident: { $$ = NULL; }
- | aIDENTIFIER { $$ = $1; }
- | aKNOWNTYPE { $$ = $1; }
+m_typename: { $$ = NULL; }
+ | typename
;
-ident: aIDENTIFIER { $$ = make_var($1); }
-/* some "reserved words" used in attributes are also used as field names in some MS IDL files */
- | aKNOWNTYPE { $$ = make_var($<str>1); }
+typename: aIDENTIFIER
+ | aKNOWNTYPE
+ ;
+
+ident: typename { $$ = make_var($1); }
;
base_type: tBYTE { $$ = find_type_or_error($<str>1); }
@@ -895,26 +896,21 @@ qualified_type:
| aNAMESPACE '.' { init_lookup_namespace($1); } qualified_seq { $$ = $4; }
;
-coclass: tCOCLASS aIDENTIFIER { $$ = type_coclass_declare($2); }
- | tCOCLASS aKNOWNTYPE { $$ = type_coclass_declare($2); }
+coclass: tCOCLASS typename { $$ = type_coclass_declare($2); }
;
coclassdef: attributes coclass '{' class_interfaces '}' semicolon_opt
{ $$ = type_coclass_define($2, $1, $4); }
;
-runtimeclass:
- tRUNTIMECLASS aIDENTIFIER { $$ = type_runtimeclass_declare($2, current_namespace); }
- | tRUNTIMECLASS aKNOWNTYPE { $$ = type_runtimeclass_declare($2, current_namespace); }
+runtimeclass: tRUNTIMECLASS typename { $$ = type_runtimeclass_declare($2, current_namespace); }
;
runtimeclass_def: attributes runtimeclass '{' class_interfaces '}' semicolon_opt
{ $$ = type_runtimeclass_define($2, $1, $4); }
;
-apicontract:
- tAPICONTRACT aIDENTIFIER { $$ = type_apicontract_declare($2, current_namespace); }
- | tAPICONTRACT aKNOWNTYPE { $$ = type_apicontract_declare($2, current_namespace); }
+apicontract: tAPICONTRACT typename { $$ = type_apicontract_declare($2, current_namespace); }
;
apicontract_def: attributes apicontract '{' '}' semicolon_opt
@@ -933,9 +929,7 @@ class_interface:
m_attributes interfaceref ';' { $$ = make_ifref($2); $$->attrs = $1; }
;
-dispinterface:
- tDISPINTERFACE aIDENTIFIER { $$ = type_dispinterface_declare($2); }
- | tDISPINTERFACE aKNOWNTYPE { $$ = type_dispinterface_declare($2); }
+dispinterface: tDISPINTERFACE typename { $$ = type_dispinterface_declare($2); }
;
dispattributes: attributes { $$ = append_attr($1, make_attr(ATTR_DISPINTERFACE)); }
@@ -960,9 +954,7 @@ inherit: { $$ = NULL; }
| ':' qualified_type { $$ = $2; }
;
-interface:
- tINTERFACE aIDENTIFIER { $$ = type_interface_declare($2, current_namespace); }
- | tINTERFACE aKNOWNTYPE { $$ = type_interface_declare($2, current_namespace); }
+interface: tINTERFACE typename { $$ = type_interface_declare($2, current_namespace); }
;
interfacedef: attributes interface inherit
@@ -978,14 +970,11 @@ interfacedef: attributes interface inherit
;
interfaceref:
- tINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
- | tINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
- | tDISPINTERFACE aIDENTIFIER { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
- | tDISPINTERFACE aKNOWNTYPE { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
+ tINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
+ | tDISPINTERFACE typename { $$ = get_type(TYPE_INTERFACE, $2, current_namespace, 0); }
;
-module: tMODULE aIDENTIFIER { $$ = type_module_declare($2); }
- | tMODULE aKNOWNTYPE { $$ = type_module_declare($2); }
+module: tMODULE typename { $$ = type_module_declare($2); }
;
moduledef: attributes module '{' int_statements '}' semicolon_opt
@@ -1153,7 +1142,7 @@ pointer_type:
| tPTR { $$ = FC_FP; }
;
-structdef: tSTRUCT t_ident '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); }
+structdef: tSTRUCT m_typename '{' fields '}' { $$ = type_new_struct($2, current_namespace, TRUE, $4); }
;
type: tVOID { $$ = type_new_void(); }
@@ -1175,9 +1164,9 @@ typedef: m_attributes tTYPEDEF m_attributes decl_spec declarator_list
}
;
-uniondef: tUNION t_ident '{' ne_union_fields '}'
+uniondef: tUNION m_typename '{' ne_union_fields '}'
{ $$ = type_new_nonencapsulated_union($2, TRUE, $4); }
- | tUNION t_ident
+ | tUNION m_typename
tSWITCH '(' s_field ')'
m_ident '{' cases '}' { $$ = type_new_encapsulated_union($2, $5, $7, $9); }
;
--
2.20.1

View File

@ -1 +1 @@
dd417540bb3afb3aa5a04a007eea9a7ee347655b
4f1b297a14bbd304fb20da7c4b64266c14d110e5