diff --git a/patches/advapi32-CreateRestrictedToken/0001-ntdll-Implement-NtFilterToken.patch b/patches/advapi32-CreateRestrictedToken/0001-ntdll-Implement-NtFilterToken.patch index 775a2b99..af044c16 100644 --- a/patches/advapi32-CreateRestrictedToken/0001-ntdll-Implement-NtFilterToken.patch +++ b/patches/advapi32-CreateRestrictedToken/0001-ntdll-Implement-NtFilterToken.patch @@ -1,4 +1,4 @@ -From 3f314cc8251f62f592013abe7b1c3b977de0699a Mon Sep 17 00:00:00 2001 +From 1eb8acd819f9eee8fdf154d0ef43881008265916 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 4 Aug 2017 02:33:14 +0200 Subject: ntdll: Implement NtFilterToken. @@ -15,10 +15,10 @@ Subject: ntdll: Implement NtFilterToken. 8 files changed, 162 insertions(+), 5 deletions(-) diff --git a/dlls/ntdll/nt.c b/dlls/ntdll/nt.c -index 93554e929be..5822dec9b15 100644 +index c3f5df3..59a08de 100644 --- a/dlls/ntdll/nt.c +++ b/dlls/ntdll/nt.c -@@ -136,6 +136,65 @@ NTSTATUS WINAPI NtDuplicateToken( +@@ -119,6 +119,65 @@ NTSTATUS WINAPI NtDuplicateToken( } /****************************************************************************** @@ -85,10 +85,10 @@ index 93554e929be..5822dec9b15 100644 * ZwOpenProcessToken [NTDLL.@] */ diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec -index 4f7ee496437..275fda57970 100644 +index c260b0d..3c5e69c 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec -@@ -179,7 +179,7 @@ +@@ -176,7 +176,7 @@ # @ stub NtEnumerateSystemEnvironmentValuesEx @ stdcall NtEnumerateValueKey(long long long ptr long ptr) @ stub NtExtendSection @@ -98,10 +98,10 @@ index 4f7ee496437..275fda57970 100644 @ stdcall NtFlushBuffersFile(long ptr) @ stdcall NtFlushInstructionCache(long ptr long) diff --git a/include/winnt.h b/include/winnt.h -index f91f81eb559..891c9b6d4bb 100644 +index 16d96d8..4e238f9 100644 --- a/include/winnt.h +++ b/include/winnt.h -@@ -3844,6 +3844,11 @@ typedef enum _TOKEN_INFORMATION_CLASS { +@@ -3904,6 +3904,11 @@ typedef enum _TOKEN_INFORMATION_CLASS { TOKEN_ADJUST_SESSIONID | \ TOKEN_ADJUST_DEFAULT ) @@ -114,10 +114,10 @@ index f91f81eb559..891c9b6d4bb 100644 #define _SECURITY_DEFINED diff --git a/include/winternl.h b/include/winternl.h -index 140669b0105..899e8324d67 100644 +index c84e6d7..288f93e 100644 --- a/include/winternl.h +++ b/include/winternl.h -@@ -2348,6 +2348,7 @@ NTSYSAPI NTSTATUS WINAPI NtDuplicateToken(HANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES +@@ -2303,6 +2303,7 @@ NTSYSAPI NTSTATUS WINAPI NtDuplicateToken(HANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES NTSYSAPI NTSTATUS WINAPI NtEnumerateKey(HANDLE,ULONG,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *); NTSYSAPI NTSTATUS WINAPI NtEnumerateValueKey(HANDLE,ULONG,KEY_VALUE_INFORMATION_CLASS,PVOID,ULONG,PULONG); NTSYSAPI NTSTATUS WINAPI NtExtendSection(HANDLE,PLARGE_INTEGER); @@ -126,10 +126,10 @@ index 140669b0105..899e8324d67 100644 NTSYSAPI NTSTATUS WINAPI NtFlushBuffersFile(HANDLE,IO_STATUS_BLOCK*); NTSYSAPI NTSTATUS WINAPI NtFlushInstructionCache(HANDLE,LPCVOID,SIZE_T); diff --git a/server/process.c b/server/process.c -index cbe726afe81..f0f60edcd3f 100644 +index f8739d0..71d9d6d 100644 --- a/server/process.c +++ b/server/process.c -@@ -571,7 +571,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit +@@ -566,7 +566,7 @@ struct thread *create_process( int fd, struct thread *parent_thread, int inherit : alloc_handle_table( process, 0 ); /* Note: for security reasons, starting a new process does not attempt * to use the current impersonation token for the new process */ @@ -139,10 +139,10 @@ index cbe726afe81..f0f60edcd3f 100644 } if (!process->handles || !process->token) goto error; diff --git a/server/protocol.def b/server/protocol.def -index fc6e343af52..b3dce66eb9c 100644 +index 35824ae..6ee6d28 100644 --- a/server/protocol.def +++ b/server/protocol.def -@@ -3391,6 +3391,16 @@ enum caret_state +@@ -3356,6 +3356,16 @@ enum caret_state obj_handle_t new_handle; /* duplicated handle */ @END @@ -160,10 +160,10 @@ index fc6e343af52..b3dce66eb9c 100644 obj_handle_t handle; /* handle to the token */ unsigned int desired_access; /* desired access to the object */ diff --git a/server/security.h b/server/security.h -index 606dbb2ab2c..6c337143c3d 100644 +index 873bbc6..bc4a8f6 100644 --- a/server/security.h +++ b/server/security.h -@@ -56,7 +56,9 @@ extern const PSID security_high_label_sid; +@@ -55,7 +55,9 @@ extern const PSID security_high_label_sid; extern struct token *token_create_admin(void); extern int token_assign_label( struct token *token, PSID label ); extern struct token *token_duplicate( struct token *src_token, unsigned primary, @@ -175,10 +175,10 @@ index 606dbb2ab2c..6c337143c3d 100644 const LUID_AND_ATTRIBUTES *reqprivs, unsigned int count, LUID_AND_ATTRIBUTES *usedprivs); diff --git a/server/token.c b/server/token.c -index 74db66e1e24..acd7a4dedb5 100644 +index 0810a61..2f6a467 100644 --- a/server/token.c +++ b/server/token.c -@@ -299,6 +299,19 @@ static int acl_is_valid( const ACL *acl, data_size_t size ) +@@ -276,6 +276,19 @@ static int acl_is_valid( const ACL *acl, data_size_t size ) return TRUE; } @@ -198,7 +198,7 @@ index 74db66e1e24..acd7a4dedb5 100644 /* checks whether all members of a security descriptor fit inside the size * of memory specified */ int sd_is_valid( const struct security_descriptor *sd, data_size_t size ) -@@ -639,8 +652,36 @@ static struct token *create_token( unsigned primary, const SID *user, +@@ -619,8 +632,36 @@ static struct token *create_token( unsigned primary, const SID *user, return token; } @@ -236,7 +236,7 @@ index 74db66e1e24..acd7a4dedb5 100644 { const luid_t *modified_id = primary || (impersonation_level == src_token->impersonation_level) ? -@@ -676,6 +717,12 @@ struct token *token_duplicate( struct token *src_token, unsigned primary, +@@ -656,6 +697,12 @@ struct token *token_duplicate( struct token *src_token, unsigned primary, return NULL; } memcpy( newgroup, group, size ); @@ -248,8 +248,8 @@ index 74db66e1e24..acd7a4dedb5 100644 + } list_add_tail( &token->groups, &newgroup->entry ); if (src_token->primary_group == &group->sid) - token->primary_group = &newgroup->sid; -@@ -684,11 +731,14 @@ struct token *token_duplicate( struct token *src_token, unsigned primary, + { +@@ -667,11 +714,14 @@ struct token *token_duplicate( struct token *src_token, unsigned primary, /* copy privileges */ LIST_FOR_EACH_ENTRY( privilege, &src_token->privileges, struct privilege, entry ) @@ -264,7 +264,7 @@ index 74db66e1e24..acd7a4dedb5 100644 if (sd) default_set_sd( &token->obj, sd, OWNER_SECURITY_INFORMATION | GROUP_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION | SACL_SECURITY_INFORMATION ); -@@ -1322,7 +1372,7 @@ DECL_HANDLER(duplicate_token) +@@ -1304,7 +1354,7 @@ DECL_HANDLER(duplicate_token) TOKEN_DUPLICATE, &token_ops ))) { @@ -273,7 +273,7 @@ index 74db66e1e24..acd7a4dedb5 100644 if (token) { reply->new_handle = alloc_handle_no_access_check( current->process, token, req->access, objattr->attributes ); -@@ -1332,6 +1382,36 @@ DECL_HANDLER(duplicate_token) +@@ -1314,6 +1364,36 @@ DECL_HANDLER(duplicate_token) } } @@ -311,5 +311,5 @@ index 74db66e1e24..acd7a4dedb5 100644 DECL_HANDLER(check_token_privileges) { -- -2.13.1 +2.7.4 diff --git a/patches/advapi32-Token_Integrity_Level/0005-server-Use-all-group-attributes-in-create_token.patch b/patches/advapi32-Token_Integrity_Level/0005-server-Use-all-group-attributes-in-create_token.patch index 7b7b6e39..e2eaf981 100644 --- a/patches/advapi32-Token_Integrity_Level/0005-server-Use-all-group-attributes-in-create_token.patch +++ b/patches/advapi32-Token_Integrity_Level/0005-server-Use-all-group-attributes-in-create_token.patch @@ -1,4 +1,4 @@ -From 77c9e6c6f408a2b59a79f3773a379a43b6994f2c Mon Sep 17 00:00:00 2001 +From 48f4c131f9e8ffc091dde12437ad0772ed1c5ca6 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 6 Aug 2017 15:16:33 +0200 Subject: server: Use all group attributes in create_token. @@ -8,10 +8,10 @@ Subject: server: Use all group attributes in create_token. 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/token.c b/server/token.c -index 8d2de6ab58e..e61fe97bfa0 100644 +index 0019b3a..2a56664 100644 --- a/server/token.c +++ b/server/token.c -@@ -613,13 +613,13 @@ static struct token *create_token( unsigned primary, const SID *user, +@@ -592,13 +592,13 @@ static struct token *create_token( unsigned primary, const SID *user, return NULL; } memcpy( &group->sid, groups[i].Sid, security_sid_len( groups[i].Sid )); @@ -29,9 +29,9 @@ index 8d2de6ab58e..e61fe97bfa0 100644 + group->logon = (groups[i].Attributes & SE_GROUP_LOGON_ID) != 0; + group->resource = (groups[i].Attributes & SE_GROUP_RESOURCE) != 0; list_add_tail( &token->groups, &group->entry ); - /* Use first owner capable group as an owner */ + /* Use first owner capable group as owner and primary group */ if (!token->primary_group && group->owner) -@@ -1628,8 +1628,8 @@ DECL_HANDLER(get_token_groups) +@@ -1603,8 +1603,8 @@ DECL_HANDLER(get_token_groups) if (group->enabled) *attr_ptr |= SE_GROUP_ENABLED; if (group->owner) *attr_ptr |= SE_GROUP_OWNER; if (group->deny_only) *attr_ptr |= SE_GROUP_USE_FOR_DENY_ONLY; @@ -42,5 +42,5 @@ index 8d2de6ab58e..e61fe97bfa0 100644 memcpy(sid_ptr, &group->sid, security_sid_len( &group->sid )); -- -2.13.1 +2.7.4 diff --git a/patches/combase-RoApi/0003-combase-Implement-RoGetActivationFactory.patch b/patches/combase-RoApi/0003-combase-Implement-RoGetActivationFactory.patch deleted file mode 100644 index a7d7d1ee..00000000 --- a/patches/combase-RoApi/0003-combase-Implement-RoGetActivationFactory.patch +++ /dev/null @@ -1,196 +0,0 @@ -From 45b77996f35a193f0586110cd03377e8a04bda20 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sun, 17 Jan 2016 01:42:05 +0100 -Subject: [PATCH] combase: Implement RoGetActivationFactory. - ---- - dlls/combase/Makefile.in | 2 +- - dlls/combase/roapi.c | 139 +++++++++++++++++++++++++++++++++++++++++++++-- - 2 files changed, 135 insertions(+), 6 deletions(-) - -diff --git a/dlls/combase/Makefile.in b/dlls/combase/Makefile.in -index b1d759e49a8..df051ad2934 100644 ---- a/dlls/combase/Makefile.in -+++ b/dlls/combase/Makefile.in -@@ -1,5 +1,5 @@ - MODULE = combase.dll --IMPORTS = ole32 uuid -+IMPORTS = advapi32 ole32 uuid - - C_SRCS = \ - roapi.c \ -diff --git a/dlls/combase/roapi.c b/dlls/combase/roapi.c -index a2d625202d9..f7862fb774a 100644 ---- a/dlls/combase/roapi.c -+++ b/dlls/combase/roapi.c -@@ -1,5 +1,6 @@ - /* - * Copyright 2014 Martin Storsjo -+ * Copyright 2016 Michael Müller - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public -@@ -15,16 +16,96 @@ - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ -- -+#define COBJMACROS - #include "objbase.h" -+#include "initguid.h" - #include "roapi.h" - #include "roparameterizediid.h" --#include "hstring.h" -+#include "winstring.h" - - #include "wine/debug.h" - - WINE_DEFAULT_DEBUG_CHANNEL(combase); - -+static const char *debugstr_hstring(HSTRING hstr) -+{ -+ const WCHAR *str; -+ UINT32 len; -+ if (hstr && !((ULONG_PTR)hstr >> 16)) return "(invalid)"; -+ str = WindowsGetStringRawBuffer(hstr, &len); -+ return wine_dbgstr_wn(str, len); -+} -+ -+static HRESULT get_library_for_classid(const WCHAR *classid, WCHAR **out) -+{ -+ static const WCHAR classkeyW[] = {'S','o','f','t','w','a','r','e','\\', -+ 'M','i','c','r','o','s','o','f','t','\\', -+ 'W','i','n','d','o','w','s','R','u','n','t','i','m','e','\\', -+ 'A','c','t','i','v','a','t','a','b','l','e','C','l','a','s','s','I','d',0}; -+ static const WCHAR dllpathW[] = {'D','l','l','P','a','t','h',0}; -+ HKEY hkey_root, hkey_class; -+ DWORD type, size; -+ HRESULT hr; -+ WCHAR *buf = NULL; -+ -+ *out = NULL; -+ -+ /* load class registry key */ -+ if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, classkeyW, 0, KEY_READ, &hkey_root)) -+ return REGDB_E_READREGDB; -+ if (RegOpenKeyExW(hkey_root, classid, 0, KEY_READ, &hkey_class)) -+ { -+ WARN("Class %s not found in registry\n", debugstr_w(classid)); -+ RegCloseKey(hkey_root); -+ return REGDB_E_CLASSNOTREG; -+ } -+ RegCloseKey(hkey_root); -+ -+ /* load (and expand) DllPath registry value */ -+ if (RegQueryValueExW(hkey_class, dllpathW, NULL, &type, NULL, &size)) -+ { -+ hr = REGDB_E_READREGDB; -+ goto done; -+ } -+ if (type != REG_SZ && type != REG_EXPAND_SZ) -+ { -+ hr = REGDB_E_READREGDB; -+ goto done; -+ } -+ if (!(buf = HeapAlloc(GetProcessHeap(), 0, size))) -+ { -+ hr = E_OUTOFMEMORY; -+ goto done; -+ } -+ if (RegQueryValueExW(hkey_class, dllpathW, NULL, NULL, (BYTE *)buf, &size)) -+ { -+ hr = REGDB_E_READREGDB; -+ goto done; -+ } -+ if (type == REG_EXPAND_SZ) -+ { -+ WCHAR *expanded; -+ DWORD len = ExpandEnvironmentStringsW(buf, NULL, 0); -+ if (!(expanded = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)))) -+ { -+ hr = E_OUTOFMEMORY; -+ goto done; -+ } -+ ExpandEnvironmentStringsW(buf, expanded, len); -+ HeapFree(GetProcessHeap(), 0, buf); -+ buf = expanded; -+ } -+ -+ *out = buf; -+ return S_OK; -+ -+done: -+ HeapFree(GetProcessHeap(), 0, buf); -+ RegCloseKey(hkey_class); -+ return hr; -+} -+ -+ - /*********************************************************************** - * RoInitialize (combase.@) - */ -@@ -51,10 +132,58 @@ void WINAPI RoUninitialize(void) - /*********************************************************************** - * RoGetActivationFactory (combase.@) - */ --HRESULT WINAPI RoGetActivationFactory(HSTRING classid, REFIID iid, void **factory) -+HRESULT WINAPI RoGetActivationFactory(HSTRING classid, REFIID iid, void **class_factory) - { -- FIXME("stub: %p %p %p\n", classid, iid, factory); -- return E_NOTIMPL; -+ PFNGETACTIVATIONFACTORY pDllGetActivationFactory; -+ IActivationFactory *factory; -+ WCHAR *library; -+ HMODULE module; -+ HRESULT hr; -+ -+ FIXME("(%s, %s, %p): semi-stub\n", debugstr_hstring(classid), debugstr_guid(iid), class_factory); -+ -+ if (!iid || !class_factory) -+ return E_INVALIDARG; -+ -+ hr = get_library_for_classid(WindowsGetStringRawBuffer(classid, NULL), &library); -+ if (FAILED(hr)) -+ { -+ ERR("Failed to find library for %s\n", debugstr_hstring(classid)); -+ return hr; -+ } -+ -+ if (!(module = LoadLibraryW(library))) -+ { -+ ERR("Failed to load module %s\n", debugstr_w(library)); -+ hr = HRESULT_FROM_WIN32(GetLastError()); -+ goto done; -+ } -+ -+ if (!(pDllGetActivationFactory = (void *)GetProcAddress(module, "DllGetActivationFactory"))) -+ { -+ ERR("Module %s does not implement DllGetActivationFactory\n", debugstr_w(library)); -+ hr = E_FAIL; -+ goto done; -+ } -+ -+ TRACE("Found library %s for class %s\n", debugstr_w(library), debugstr_hstring(classid)); -+ -+ hr = pDllGetActivationFactory(classid, &factory); -+ if (SUCCEEDED(hr)) -+ { -+ hr = IActivationFactory_QueryInterface(factory, iid, class_factory); -+ if (SUCCEEDED(hr)) -+ { -+ TRACE("Created interface %p\n", *class_factory); -+ module = NULL; -+ } -+ IActivationFactory_Release(factory); -+ } -+ -+done: -+ HeapFree(GetProcessHeap(), 0, library); -+ if (module) FreeLibrary(module); -+ return hr; - } - - /*********************************************************************** --- -2.16.3 - diff --git a/patches/combase-RoApi/0004-combase-Implement-RoActivateInstance.patch b/patches/combase-RoApi/0004-combase-Implement-RoActivateInstance.patch deleted file mode 100644 index f22bb852..00000000 --- a/patches/combase-RoApi/0004-combase-Implement-RoActivateInstance.patch +++ /dev/null @@ -1,65 +0,0 @@ -From 4707618a4e4d1ecb55362e95052465266055eada Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Sun, 17 Jan 2016 01:45:30 +0100 -Subject: [PATCH] combase: Implement RoActivateInstance. - ---- - .../api-ms-win-core-winrt-l1-1-0.spec | 2 +- - dlls/combase/combase.spec | 2 +- - dlls/combase/roapi.c | 20 ++++++++++++++++++++ - 3 files changed, 22 insertions(+), 2 deletions(-) - -diff --git a/dlls/api-ms-win-core-winrt-l1-1-0/api-ms-win-core-winrt-l1-1-0.spec b/dlls/api-ms-win-core-winrt-l1-1-0/api-ms-win-core-winrt-l1-1-0.spec -index 74c9d27aae3..978c3dc6d07 100644 ---- a/dlls/api-ms-win-core-winrt-l1-1-0/api-ms-win-core-winrt-l1-1-0.spec -+++ b/dlls/api-ms-win-core-winrt-l1-1-0/api-ms-win-core-winrt-l1-1-0.spec -@@ -1,4 +1,4 @@ --@ stub RoActivateInstance -+@ stdcall RoActivateInstance(ptr ptr) combase.RoActivateInstance - @ stdcall RoGetActivationFactory(ptr ptr ptr) combase.RoGetActivationFactory - @ stub RoGetApartmentIdentifier - @ stdcall RoInitialize(long) combase.RoInitialize -diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec -index c238eb82db7..f42bdae605b 100644 ---- a/dlls/combase/combase.spec -+++ b/dlls/combase/combase.spec -@@ -242,7 +242,7 @@ - @ stdcall PropVariantClear(ptr) ole32.PropVariantClear - @ stdcall PropVariantCopy(ptr ptr) ole32.PropVariantCopy - @ stub ReleaseFuncDescs --@ stub RoActivateInstance -+@ stdcall RoActivateInstance(ptr ptr) - @ stub RoCaptureErrorContext - @ stub RoClearError - @ stub RoFailFastWithErrorContext -diff --git a/dlls/combase/roapi.c b/dlls/combase/roapi.c -index f7862fb774a..bfd07fb3f4e 100644 ---- a/dlls/combase/roapi.c -+++ b/dlls/combase/roapi.c -@@ -198,3 +198,23 @@ HRESULT WINAPI RoGetParameterizedTypeInstanceIID(UINT32 name_element_count, cons - if (hiid) *hiid = INVALID_HANDLE_VALUE; - return E_NOTIMPL; - } -+ -+/*********************************************************************** -+ * RoActivateInstance (combase.@) -+ */ -+HRESULT WINAPI RoActivateInstance(HSTRING classid, IInspectable **instance) -+{ -+ IActivationFactory *factory; -+ HRESULT hr; -+ -+ FIXME("(%p, %p): semi-stub\n", classid, instance); -+ -+ hr = RoGetActivationFactory(classid, &IID_IActivationFactory, (void **)&factory); -+ if (SUCCEEDED(hr)) -+ { -+ hr = IActivationFactory_ActivateInstance(factory, instance); -+ IActivationFactory_Release(factory); -+ } -+ -+ return hr; -+} --- -2.16.3 - diff --git a/patches/ntoskrnl-DriverTest/0002-ntoskrnl.exe-tests-Add-kernel-compliant-test-functio.patch b/patches/ntoskrnl-DriverTest/0002-ntoskrnl.exe-tests-Add-kernel-compliant-test-functio.patch deleted file mode 100644 index eacf0eb6..00000000 --- a/patches/ntoskrnl-DriverTest/0002-ntoskrnl.exe-tests-Add-kernel-compliant-test-functio.patch +++ /dev/null @@ -1,713 +0,0 @@ -From 8c09da5559b124f97fd5f24540c25b28009562f5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Michael=20M=C3=BCller?= -Date: Tue, 20 Jan 2015 18:39:36 +0100 -Subject: ntoskrnl.exe/tests: Add kernel compliant test functions. - ---- - dlls/ntoskrnl.exe/ntoskrnl.exe.spec | 2 +- - dlls/ntoskrnl.exe/tests/driver.sys/Makefile.in | 3 +- - dlls/ntoskrnl.exe/tests/driver.sys/driver.c | 65 ++++++--- - dlls/ntoskrnl.exe/tests/driver.sys/driver.h | 11 +- - dlls/ntoskrnl.exe/tests/driver.sys/test.c | 195 +++++++++++++++++++++++++ - dlls/ntoskrnl.exe/tests/driver.sys/test.h | 158 ++++++++++++++++++++ - dlls/ntoskrnl.exe/tests/driver.sys/util.h | 47 ++++++ - dlls/ntoskrnl.exe/tests/ntoskrnl.c | 36 ++--- - include/wine/test.h | 39 ++++- - 9 files changed, 509 insertions(+), 47 deletions(-) - create mode 100644 dlls/ntoskrnl.exe/tests/driver.sys/test.c - create mode 100644 dlls/ntoskrnl.exe/tests/driver.sys/test.h - create mode 100644 dlls/ntoskrnl.exe/tests/driver.sys/util.h - -diff --git a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec -index 25649c9b3b6..99c5749c6cf 100644 ---- a/dlls/ntoskrnl.exe/ntoskrnl.exe.spec -+++ b/dlls/ntoskrnl.exe/ntoskrnl.exe.spec -@@ -1427,7 +1427,7 @@ - @ cdecl -private _strrev(str) msvcrt._strrev - @ cdecl -private _strset(str long) msvcrt._strset - @ cdecl -private _strupr(str) msvcrt._strupr --@ cdecl -private _vsnprintf(ptr long str ptr) msvcrt._vsnprintf -+@ cdecl _vsnprintf(ptr long str ptr) msvcrt._vsnprintf - @ cdecl -private _vsnwprintf(ptr long wstr ptr) msvcrt._vsnwprintf - @ cdecl -private _wcsicmp(wstr wstr) msvcrt._wcsicmp - @ cdecl -private _wcslwr(wstr) msvcrt._wcslwr -diff --git a/dlls/ntoskrnl.exe/tests/driver.sys/Makefile.in b/dlls/ntoskrnl.exe/tests/driver.sys/Makefile.in -index 1c49b2bd5cd..b200eec7e95 100644 ---- a/dlls/ntoskrnl.exe/tests/driver.sys/Makefile.in -+++ b/dlls/ntoskrnl.exe/tests/driver.sys/Makefile.in -@@ -8,4 +8,5 @@ CROSSFLAGS = -nostartfiles -nostdlib -nodefaultlibs \ - -Wl,-entry,_DriverEntry@8 - - C_SRCS = \ -- driver.c -+ driver.c \ -+ test.c -diff --git a/dlls/ntoskrnl.exe/tests/driver.sys/driver.c b/dlls/ntoskrnl.exe/tests/driver.sys/driver.c -index 35f78d1ab2f..78fb55a961c 100644 ---- a/dlls/ntoskrnl.exe/tests/driver.sys/driver.c -+++ b/dlls/ntoskrnl.exe/tests/driver.sys/driver.c -@@ -30,6 +30,9 @@ - #include "winioctl.h" - #include "ddk/wdm.h" - -+#define WINE_KERNEL -+#include "util.h" -+#include "test.h" - #include "driver.h" - - const WCHAR driver_device[] = {'\\','D','e','v','i','c','e', -@@ -37,24 +40,25 @@ const WCHAR driver_device[] = {'\\','D','e','v','i','c','e', - const WCHAR driver_link[] = {'\\','D','o','s','D','e','v','i','c','e','s', - '\\','W','i','n','e','T','e','s','t','D','r','i','v','e','r',0}; - -+/* In each kernel testcase the following variables are available: -+ * -+ * device - DEVICE_OBJECT used for ioctl -+ * irp - IRP pointer passed to ioctl -+ * __state - used internally for test macros -+ */ - --static NTSTATUS test_basic_ioctl(IRP *irp, IO_STACK_LOCATION *stack, ULONG_PTR *info) -+KERNEL_TESTCASE(PsGetCurrentProcessId) - { -- const char str[] = "Wine is not an emulator"; -- ULONG length = stack->Parameters.DeviceIoControl.OutputBufferLength; -- char *buffer = irp->AssociatedIrp.SystemBuffer; -- int i; -- -- if (!buffer) -- return STATUS_ACCESS_VIOLATION; -- -- if (length < sizeof(str)-1) -- return STATUS_BUFFER_TOO_SMALL; -- -- for (i = 0; i < sizeof(str)-1; i++) -- buffer[i] = str[i]; -+ struct test_PsGetCurrentProcessId *test = (void *)&__state->userdata; -+ test->pid = (DWORD)(ULONG_PTR)PsGetCurrentProcessId(); -+ ok(test->pid, "Expected processid to be non zero\n"); -+ return STATUS_SUCCESS; -+} - -- *info = sizeof(str)-1; -+KERNEL_TESTCASE(PsGetCurrentThread) -+{ -+ PETHREAD thread = PsGetCurrentThread(); -+ todo_wine ok(thread != NULL, "Expected thread to be non-NULL\n"); - return STATUS_SUCCESS; - } - -@@ -69,19 +73,44 @@ static NTSTATUS WINAPI driver_Create(DEVICE_OBJECT *device, IRP *irp) - static NTSTATUS WINAPI driver_IoControl(DEVICE_OBJECT *device, IRP *irp) - { - IO_STACK_LOCATION *stack = IoGetCurrentIrpStackLocation(irp); -+ struct kernel_test_state *state = irp->AssociatedIrp.SystemBuffer; - NTSTATUS status = STATUS_NOT_SUPPORTED; - ULONG_PTR information = 0; - -+ if (!state) -+ { -+ status = STATUS_ACCESS_VIOLATION; -+ goto done; -+ } -+ -+ if (stack->Parameters.DeviceIoControl.InputBufferLength < sizeof(*state) || -+ stack->Parameters.DeviceIoControl.OutputBufferLength < sizeof(*state)) -+ { -+ status = STATUS_BUFFER_TOO_SMALL; -+ goto done; -+ } -+ -+ kernel_memset(&state->temp, 0, sizeof(state->temp)); -+ kernel_memset(&state->output, 0, sizeof(state->output)); -+ -+#define DECLARE_TEST(name) \ -+ case WINE_IOCTL_##name: status = test_##name(device, irp, state); break; -+ - switch (stack->Parameters.DeviceIoControl.IoControlCode) - { -- case IOCTL_WINETEST_BASIC_IOCTL: -- status = test_basic_ioctl(irp, stack, &information); -- break; -+ DECLARE_TEST(PsGetCurrentProcessId); -+ DECLARE_TEST(PsGetCurrentThread); - - default: - break; - } - -+#undef DECLARE_TEST -+ -+ kernel_memset(&state->temp, 0, sizeof(state->temp)); -+ if (status == STATUS_SUCCESS) information = sizeof(*state); -+ -+done: - irp->IoStatus.Status = status; - irp->IoStatus.Information = information; - IoCompleteRequest(irp, IO_NO_INCREMENT); -diff --git a/dlls/ntoskrnl.exe/tests/driver.sys/driver.h b/dlls/ntoskrnl.exe/tests/driver.sys/driver.h -index 372e9080896..1af2dcec249 100644 ---- a/dlls/ntoskrnl.exe/tests/driver.sys/driver.h -+++ b/dlls/ntoskrnl.exe/tests/driver.sys/driver.h -@@ -20,9 +20,12 @@ - * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - */ - -+#include "test.h" - --/* -- * All custom IOCTLs need to have a function value >= 0x800. -- */ -+#define WINE_IOCTL_PsGetCurrentProcessId WINE_TEST_IOCTL(0) -+#define WINE_IOCTL_PsGetCurrentThread WINE_TEST_IOCTL(1) - --#define IOCTL_WINETEST_BASIC_IOCTL CTL_CODE(FILE_DEVICE_UNKNOWN, 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS) -+struct test_PsGetCurrentProcessId -+{ -+ DWORD pid; -+}; -diff --git a/dlls/ntoskrnl.exe/tests/driver.sys/test.c b/dlls/ntoskrnl.exe/tests/driver.sys/test.c -new file mode 100644 -index 00000000000..01adf609371 ---- /dev/null -+++ b/dlls/ntoskrnl.exe/tests/driver.sys/test.c -@@ -0,0 +1,195 @@ -+/* -+ * ntoskrnl.exe testing framework -+ * -+ * Copyright 2015 Michael Müller -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ */ -+ -+#include -+ -+#include "ntstatus.h" -+#define WIN32_NO_STATUS -+#include "windef.h" -+#include "winbase.h" -+#include "winternl.h" -+#include "winioctl.h" -+#include "ddk/wdm.h" -+ -+#define WINE_KERNEL -+#include "util.h" -+#include "test.h" -+ -+extern int CDECL _vsnprintf(char *buffer, size_t count, const char *format, __ms_va_list argptr); -+ -+static void safe_vsnprintf(struct kernel_test_state *state, const char *msg, __ms_va_list args) -+{ -+ int remaining; -+ int length; -+ -+ if (state->output.overflow) -+ return; -+ -+ if (state->output.offset >= sizeof(state->output.debug) - 1) -+ { -+ state->output.overflow = TRUE; -+ return; -+ } -+ -+ remaining = (sizeof(state->output.debug) - 1) - state->output.offset; -+ length = _vsnprintf(&state->output.debug[state->output.offset], remaining, msg, args); -+ if (length < 0) -+ { -+ state->output.debug[state->output.offset] = 0; -+ state->output.overflow = TRUE; -+ return; -+ } -+ -+ state->output.offset += length; -+} -+ -+static void __cdecl safe_snprintf(struct kernel_test_state *state, const char *msg, ...) -+{ -+ __ms_va_list valist; -+ -+ __ms_va_start(valist, msg); -+ safe_vsnprintf(state, msg, valist); -+ __ms_va_end(valist); -+} -+ -+void winetest_set_location(struct kernel_test_state *state, const char *file, int line) -+{ -+ state->temp.file = kernel_strrchr(file, '/'); -+ if (state->temp.file == NULL) -+ state->temp.file = kernel_strrchr(file, '\\'); -+ if (state->temp.file == NULL) -+ state->temp.file = file; -+ else -+ state->temp.file++; -+ state->temp.line = line; -+} -+ -+int winetest_vok(struct kernel_test_state *state, int condition, const char *msg, __ms_va_list args) -+{ -+ if (state->temp.todo_level) -+ { -+ if (condition) -+ { -+ safe_snprintf( state, "%s:%d: Test succeeded inside todo block: ", -+ state->temp.file, state->temp.line ); -+ safe_vsnprintf(state, msg, args); -+ state->output.todo_failures++; -+ return 0; -+ } -+ else -+ { -+ if (state->input.debug_level > 0) -+ { -+ safe_snprintf( state, "%s:%d: Test marked todo: ", -+ state->temp.file, state->temp.line ); -+ safe_vsnprintf(state, msg, args); -+ } -+ state->output.todo_successes++; -+ return 1; -+ } -+ } -+ else -+ { -+ if (!condition) -+ { -+ safe_snprintf( state, "%s:%d: Test failed: ", -+ state->temp.file, state->temp.line ); -+ safe_vsnprintf(state, msg, args); -+ state->output.failures++; -+ return 0; -+ } -+ else -+ { -+ if (state->input.report_success) -+ safe_snprintf( state, "%s:%d: Test succeeded\n", -+ state->temp.file, state->temp.line); -+ state->output.successes++; -+ return 1; -+ } -+ } -+} -+ -+void __cdecl winetest_ok(struct kernel_test_state *state, int condition, const char *msg, ...) -+{ -+ __ms_va_list valist; -+ -+ __ms_va_start(valist, msg); -+ winetest_vok(state, condition, msg, valist); -+ __ms_va_end(valist); -+} -+ -+void __cdecl winetest_trace(struct kernel_test_state *state, const char *msg, ...) -+{ -+ __ms_va_list valist; -+ -+ if (state->input.debug_level > 0) -+ { -+ safe_snprintf( state, "%s:%d: ", state->temp.file, state->temp.line ); -+ __ms_va_start(valist, msg); -+ safe_vsnprintf(state, msg, valist); -+ __ms_va_end(valist); -+ } -+} -+ -+void winetest_vskip(struct kernel_test_state *state, const char *msg, __ms_va_list args) -+{ -+ safe_snprintf( state, "%s:%d: Tests skipped: ", state->temp.file, state->temp.line ); -+ safe_vsnprintf(state, msg, args); -+ state->output.skipped++; -+} -+ -+void __cdecl winetest_skip(struct kernel_test_state *state, const char *msg, ...) -+{ -+ __ms_va_list valist; -+ __ms_va_start(valist, msg); -+ winetest_vskip(state, msg, valist); -+ __ms_va_end(valist); -+} -+ -+void __cdecl winetest_win_skip(struct kernel_test_state *state, const char *msg, ...) -+{ -+ __ms_va_list valist; -+ __ms_va_start(valist, msg); -+ if (!state->input.windows) -+ winetest_vskip(state, msg, valist); -+ else -+ winetest_vok(state, 0, msg, valist); -+ __ms_va_end(valist); -+} -+ -+void winetest_start_todo(struct kernel_test_state *state, int windows) -+{ -+ if (state->input.windows == windows) -+ state->temp.todo_level++; -+ state->temp.todo_do_loop=1; -+} -+ -+int winetest_loop_todo(struct kernel_test_state *state) -+{ -+ int do_loop=state->temp.todo_do_loop; -+ state->temp.todo_do_loop=0; -+ return do_loop; -+} -+ -+void winetest_end_todo(struct kernel_test_state *state, int windows) -+{ -+ if (state->input.windows == windows) -+ state->temp.todo_level--; -+} -diff --git a/dlls/ntoskrnl.exe/tests/driver.sys/test.h b/dlls/ntoskrnl.exe/tests/driver.sys/test.h -new file mode 100644 -index 00000000000..65d08c0d645 ---- /dev/null -+++ b/dlls/ntoskrnl.exe/tests/driver.sys/test.h -@@ -0,0 +1,158 @@ -+/* -+ * ntoskrnl.exe testing framework -+ * -+ * Copyright 2015 Michael Müller -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ */ -+ -+#ifndef _WINE_KERNEL_TEST_ -+#define _WINE_KERNEL_TEST_ -+ -+struct kernel_test_state -+{ -+ char userdata[1024]; -+ struct -+ { -+ int debug_level; -+ int report_success; -+ BOOL windows; -+ } input; -+ struct -+ { -+ const char *file; -+ int line; -+ int todo_level; -+ int todo_do_loop; -+ } temp; -+ struct -+ { -+ LONG failures; -+ LONG successes; -+ LONG todo_failures; -+ LONG todo_successes; -+ LONG skipped; -+ -+ BOOL overflow; -+ DWORD offset; -+ char debug[4096]; -+ } output; -+}; -+ -+#define WINE_TEST_IOCTL(index) CTL_CODE(FILE_DEVICE_UNKNOWN, (index) + 0x800, METHOD_BUFFERED, FILE_ANY_ACCESS) -+ -+#ifdef WINE_KERNEL -+ -+#ifdef __GNUC__ -+void __cdecl winetest_ok(struct kernel_test_state *state, int condition, const char *msg, ...) __attribute__((format (printf,3,4) )); -+void __cdecl winetest_skip(struct kernel_test_state *state, const char *msg, ...) __attribute__((format (printf,2,3))); -+void __cdecl winetest_win_skip(struct kernel_test_state *state, const char *msg, ...) __attribute__((format (printf,2,3))); -+void __cdecl winetest_trace(struct kernel_test_state *state, const char *msg, ...) __attribute__((format (printf,2,3))); -+#else -+void __cdecl winetest_ok(struct kernel_test_state *state, int condition, const char *msg, ...); -+void __cdecl winetest_skip(struct kernel_test_state *state, const char *msg, ...); -+void __cdecl winetest_win_skip(struct kernel_test_state *state, const char *msg, ...); -+void __cdecl winetest_trace(struct kernel_test_state *state, const char *msg, ...); -+#endif /* __GNUC__ */ -+ -+void winetest_set_location(struct kernel_test_state *state, const char* file, int line); -+void winetest_start_todo(struct kernel_test_state *state, int windows); -+int winetest_loop_todo(struct kernel_test_state *state); -+void winetest_end_todo(struct kernel_test_state *state, int windows); -+ -+#define ok_(file, line) (winetest_set_location(__state, file, line), 0) ? (void)0 : winetest_ok -+#define skip_(file, line) (winetest_set_location(__state, file, line), 0) ? (void)0 : winetest_skip -+#define win_skip_(file, line) (winetest_set_location(__state, file, line), 0) ? (void)0 : winetest_win_skip -+#define trace_(file, line) (winetest_set_location(__state, file, line), 0) ? (void)0 : winetest_trace -+ -+#define _ok ok_(__FILE__, __LINE__) -+#define _skip skip_(__FILE__, __LINE__) -+#define _win_skip win_skip_(__FILE__, __LINE__) -+#define _trace trace_(__FILE__, __LINE__) -+ -+/* Variadic Macros */ -+#define ok(...) _ok(__state, __VA_ARGS__) -+#define skip(...) _skip(__state, __VA_ARGS__) -+#define win_skip(...) _win_skip(__state, __VA_ARGS__) -+#define trace(...) _trace(__state, __VA_ARGS__) -+ -+#define todo(windows) for (winetest_start_todo(__state, windows); \ -+ winetest_loop_todo(__state); \ -+ winetest_end_todo(__state, windows)) -+#define todo_wine todo(0) -+ -+#define KERNEL_TESTCASE(name) \ -+ static NTSTATUS test_##name(DEVICE_OBJECT *device, IRP *irp, \ -+ struct kernel_test_state *__state) -+ -+#else -+ -+#include -+ -+#define wine_run_kernel_test(device_path, ioctl, state) \ -+ __wine_run_kernel_test(__FILE__, __LINE__, device_path, ioctl, state) -+ -+static void __wine_run_kernel_test(const char *file, int line, const char *device_path, -+ DWORD ioctl, struct kernel_test_state *state) -+{ -+ struct kernel_test_state temp_state; -+ DWORD returned; -+ HANDLE device; -+ BOOL ret; -+ -+ device = CreateFileA(device_path, GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL); -+ ok_(file, line)(device != INVALID_HANDLE_VALUE, "CreateFileA failed with error %u\n", GetLastError()); -+ if (device == INVALID_HANDLE_VALUE) return; -+ -+ if (!state) -+ { -+ state = &temp_state; -+ memset(state, 0, sizeof(*state)); -+ } -+ -+ state->input.debug_level = winetest_get_debug(); -+ state->input.report_success = winetest_get_report_success(); -+ state->input.windows = !strcmp(winetest_platform, "windows"); -+ -+ ret = DeviceIoControl(device, ioctl, state, sizeof(*state), state, sizeof(*state), &returned, NULL); -+ ok_(file, line)(ret, "DeviceIoControl failed with error %u\n", GetLastError()); -+ ok_(file, line)(returned == sizeof(*state), "DeviceIoControl returned %u bytes\n", returned); -+ -+ if (state->output.offset >= sizeof(state->output.debug)) -+ state->output.offset = sizeof(state->output.debug) - 1; -+ -+ if (state->output.offset) -+ { -+ state->output.debug[state->output.offset] = 0; -+ fprintf(stdout, "%s", state->output.debug); -+ if (state->output.debug[state->output.offset - 1] != '\n') -+ fprintf(stdout, "\n"); -+ } -+ -+ if (state->output.overflow) -+ skip_(file, line)("Buffer was too small, kernel debug output is truncated!\n"); -+ -+ winetest_add_failures(state->output.failures); -+ winetest_add_successes(state->output.successes); -+ winetest_add_todo_failures(state->output.todo_failures); -+ winetest_add_todo_successes(state->output.todo_successes); -+ winetest_add_skipped(state->output.skipped); -+ -+ CloseHandle(device); -+} -+ -+#endif -+ -+#endif /* _WINE_KERNEL_TEST_ */ -diff --git a/dlls/ntoskrnl.exe/tests/driver.sys/util.h b/dlls/ntoskrnl.exe/tests/driver.sys/util.h -new file mode 100644 -index 00000000000..881a4a2952f ---- /dev/null -+++ b/dlls/ntoskrnl.exe/tests/driver.sys/util.h -@@ -0,0 +1,47 @@ -+/* -+ * ntoskrnl.exe testing framework -+ * -+ * Copyright 2015 Sebastian Lackner -+ * -+ * This library is free software; you can redistribute it and/or -+ * modify it under the terms of the GNU Lesser General Public -+ * License as published by the Free Software Foundation; either -+ * version 2.1 of the License, or (at your option) any later version. -+ * -+ * This library is distributed in the hope that it will be useful, -+ * but WITHOUT ANY WARRANTY; without even the implied warranty of -+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -+ * Lesser General Public License for more details. -+ * -+ * You should have received a copy of the GNU Lesser General Public -+ * License along with this library; if not, write to the Free Software -+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA -+ */ -+ -+#include -+ -+static inline const char* kernel_strrchr(const char *str, int character) -+{ -+ const char *ret = NULL; -+ for (; *str; str++) -+ { -+ if (*str == character) -+ ret = str; -+ } -+ return ret; -+} -+ -+static inline void* kernel_memcpy(void *destination, const void *source, size_t num) -+{ -+ const char *src = source; -+ char *dst = destination; -+ while (num--) *dst++ = *src++; -+ return destination; -+} -+ -+static inline void* kernel_memset(void *ptr, int value, size_t num) -+{ -+ char *dst = ptr; -+ while (num--) *dst++ = value; -+ return ptr; -+} -diff --git a/dlls/ntoskrnl.exe/tests/ntoskrnl.c b/dlls/ntoskrnl.exe/tests/ntoskrnl.c -index 9b8a6a7c5b0..6f020101b4c 100644 ---- a/dlls/ntoskrnl.exe/tests/ntoskrnl.c -+++ b/dlls/ntoskrnl.exe/tests/ntoskrnl.c -@@ -25,6 +25,7 @@ - #include "winioctl.h" - #include "wine/test.h" - -+#include "driver.sys/test.h" - #include "driver.sys/driver.h" - - static const char driver_name[] = "WineTestDriver"; -@@ -184,29 +185,21 @@ err: - return NULL; - } - --static void test_basic_ioctl(void) -+static void test_PsGetCurrentProcessId(void) - { -- const char str[] = "Wine is not an emulator"; -- DWORD bytes_returned; -- char buf[32]; -- HANDLE file; -- BOOL res; -+ struct kernel_test_state state; -+ struct test_PsGetCurrentProcessId *test = (void *)&state.userdata; - -- file = CreateFileA(device_path, GENERIC_READ | GENERIC_WRITE, -- 0, NULL, OPEN_EXISTING, 0, NULL); -- if (file == INVALID_HANDLE_VALUE) -- { -- ok(0, "Connecting to driver failed with %x\n", GetLastError()); -- return; -- } -- -- res = DeviceIoControl(file, IOCTL_WINETEST_BASIC_IOCTL, NULL, 0, buf, -- sizeof(buf), &bytes_returned, NULL); -- ok(res, "DeviceIoControl failed with %x\n", GetLastError()); -- ok(bytes_returned == sizeof(str)-1, "Unexpected number of bytes\n"); -- ok(!memcmp(buf, str, sizeof(str)-1), "Unexpected response data\n"); -+ memset(&state, 0, sizeof(state)); -+ trace("Running tests for PsGetCurrentProcessId\n"); -+ wine_run_kernel_test(device_path, WINE_IOCTL_PsGetCurrentProcessId, &state); -+ ok(test->pid == GetCurrentProcessId(), "Expected pid %u, got %u\n", GetCurrentProcessId(), test->pid); -+} - -- CloseHandle(file); -+static void test_PsGetCurrentThread(void) -+{ -+ trace("Running tests for PsGetCurrentThread\n"); -+ wine_run_kernel_test(device_path, WINE_IOCTL_PsGetCurrentThread, NULL); - } - - START_TEST(ntoskrnl) -@@ -220,7 +213,8 @@ START_TEST(ntoskrnl) - return; - } - -- test_basic_ioctl(); -+ test_PsGetCurrentProcessId(); -+ test_PsGetCurrentThread(); - - unload_driver(service, filename); - } -diff --git a/include/wine/test.h b/include/wine/test.h -index af602c0fac0..e7d7961f2a9 100644 ---- a/include/wine/test.h -+++ b/include/wine/test.h -@@ -61,7 +61,13 @@ extern int winetest_loop_todo(void); - extern void winetest_end_todo(void); - extern int winetest_get_mainargs( char*** pargv ); - extern LONG winetest_get_failures(void); -+extern int winetest_get_report_success(void); -+extern int winetest_get_debug(void); - extern void winetest_add_failures( LONG new_failures ); -+extern void winetest_add_successes( LONG new_successes ); -+extern void winetest_add_todo_failures( LONG new_todo_failures ); -+extern void winetest_add_todo_successes( LONG new_todo_successes ); -+extern void winetest_add_skipped( LONG new_skipped ); - extern void winetest_wait_child_process( HANDLE process ); - - extern const char *wine_dbgstr_wn( const WCHAR *str, int n ); -@@ -429,10 +435,39 @@ LONG winetest_get_failures(void) - return failures; - } - -+int winetest_get_report_success(void) -+{ -+ return report_success; -+} -+ -+int winetest_get_debug(void) -+{ -+ return winetest_debug; -+} -+ - void winetest_add_failures( LONG new_failures ) - { -- while (new_failures-- > 0) -- InterlockedIncrement( &failures ); -+ InterlockedExchangeAdd( &failures, new_failures ); -+} -+ -+void winetest_add_successes( LONG new_successes ) -+{ -+ InterlockedExchangeAdd( &successes, new_successes ); -+} -+ -+void winetest_add_todo_failures( LONG new_todo_failures ) -+{ -+ InterlockedExchangeAdd( &todo_failures, new_todo_failures ); -+} -+ -+void winetest_add_todo_successes( LONG new_todo_successes ) -+{ -+ InterlockedExchangeAdd( &todo_successes, new_todo_successes ); -+} -+ -+void winetest_add_skipped( LONG new_skipped ) -+{ -+ InterlockedExchangeAdd( &skipped, new_skipped ); - } - - void winetest_wait_child_process( HANDLE process ) --- -2.13.1 - diff --git a/patches/patchinstall.sh b/patches/patchinstall.sh index c578d69f..829c31c6 100755 --- a/patches/patchinstall.sh +++ b/patches/patchinstall.sh @@ -52,7 +52,7 @@ usage() # Get the upstream commit sha upstream_commit() { - echo "dbce559df683b7831861c747f1f4d28614eedbe2" + echo "8dca6c35e11a104385242ed8346ee05707b78ef7" } # Show version information @@ -2730,19 +2730,15 @@ fi # | # | Modified files: # | * dlls/api-ms-win-core-winrt-l1-1-0/api-ms-win-core-winrt-l1-1-0.spec, dlls/api-ms-win-core-winrt-registration-l1-1-0/api- -# | ms-win-core-winrt-registration-l1-1-0.spec, dlls/combase/Makefile.in, dlls/combase/combase.spec, dlls/combase/roapi.c +# | ms-win-core-winrt-registration-l1-1-0.spec, dlls/combase/combase.spec, dlls/combase/roapi.c # | if test "$enable_combase_RoApi" -eq 1; then - patch_apply combase-RoApi/0003-combase-Implement-RoGetActivationFactory.patch - patch_apply combase-RoApi/0004-combase-Implement-RoActivateInstance.patch patch_apply combase-RoApi/0005-combase-Add-stub-for-RoGetApartmentIdentifier.patch patch_apply combase-RoApi/0007-combase-Add-stub-for-RoRegisterForApartmentShutdown.patch patch_apply combase-RoApi/0008-combase-Add-stub-for-RoGetServerActivatableClasses.patch patch_apply combase-RoApi/0009-combase-Add-stub-for-RoRegisterActivationFactories.patch patch_apply combase-RoApi/0010-combase-Add-stub-for-CleanupTlsOleState.patch ( - printf '%s\n' '+ { "Michael Müller", "combase: Implement RoGetActivationFactory.", 1 },'; - printf '%s\n' '+ { "Michael Müller", "combase: Implement RoActivateInstance.", 1 },'; printf '%s\n' '+ { "Michael Müller", "combase: Add stub for RoGetApartmentIdentifier.", 1 },'; printf '%s\n' '+ { "Michael Müller", "combase: Add stub for RoRegisterForApartmentShutdown.", 1 },'; printf '%s\n' '+ { "Michael Müller", "combase: Add stub for RoGetServerActivatableClasses.", 1 },'; diff --git a/patches/server-Object_Types/0005-server-Add-type-Token.patch b/patches/server-Object_Types/0005-server-Add-type-Token.patch index 04f4ee89..e9a21762 100644 --- a/patches/server-Object_Types/0005-server-Add-type-Token.patch +++ b/patches/server-Object_Types/0005-server-Add-type-Token.patch @@ -1,4 +1,4 @@ -From b4ba31df8d342f736a590977ba950d6f07f2377c Mon Sep 17 00:00:00 2001 +From d1072993c562826d5392168f6f7937436a55b43b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Wed, 8 Mar 2017 03:48:02 +0100 Subject: server: Add type Token. @@ -10,10 +10,10 @@ Subject: server: Add type Token. 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/server/object.c b/server/object.c -index 960422df1c..c2c877f692 100644 +index 6bdf7f6..8d564b8 100644 --- a/server/object.c +++ b/server/object.c -@@ -716,7 +716,7 @@ static const struct unicode_str type_array[] = +@@ -706,7 +706,7 @@ static const struct unicode_str type_array[] = {type_Type, sizeof(type_Type)}, {type_Directory, sizeof(type_Directory)}, {type_SymbolicLink, sizeof(type_SymbolicLink)}, @@ -23,10 +23,10 @@ index 960422df1c..c2c877f692 100644 /* Process */ /* Thread */ diff --git a/server/object.h b/server/object.h -index 0ed46b159d..46a9f770ca 100644 +index f13de48..7bc8855 100644 --- a/server/object.h +++ b/server/object.h -@@ -257,6 +257,7 @@ static const WCHAR type_Section[] = {'S','e','c','t','i','o','n'}; +@@ -249,6 +249,7 @@ 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_Timer[] = {'T','i','m','e','r'}; @@ -35,10 +35,10 @@ index 0ed46b159d..46a9f770ca 100644 static const WCHAR type_WindowStation[] = {'W','i','n','d','o','w','S','t','a','t','i','o','n'}; diff --git a/server/token.c b/server/token.c -index 3b5c498147..f0afb95868 100644 +index b0875fc..2b0fc5f 100644 --- a/server/token.c +++ b/server/token.c -@@ -150,6 +150,7 @@ struct group +@@ -136,6 +136,7 @@ struct group }; static void token_dump( struct object *obj, int verbose ); @@ -46,7 +46,7 @@ index 3b5c498147..f0afb95868 100644 static unsigned int token_map_access( struct object *obj, unsigned int access ); static void token_destroy( struct object *obj ); -@@ -157,7 +158,7 @@ static const struct object_ops token_ops = +@@ -143,7 +144,7 @@ static const struct object_ops token_ops = { sizeof(struct token), /* size */ token_dump, /* dump */ @@ -55,8 +55,8 @@ index 3b5c498147..f0afb95868 100644 no_add_queue, /* add_queue */ NULL, /* remove_queue */ NULL, /* signaled */ -@@ -183,6 +184,12 @@ static void token_dump( struct object *obj, int verbose ) - /* FIXME: dump token members */ +@@ -169,6 +170,12 @@ static void token_dump( struct object *obj, int verbose ) + token->token_id.low_part, token->primary, token->impersonation_level ); } +static struct object_type *token_get_type( struct object *obj ) @@ -69,5 +69,5 @@ index 3b5c498147..f0afb95868 100644 { if (access & GENERIC_READ) access |= TOKEN_READ; -- -2.11.0 +2.7.4