Needed for IE11.
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- v2: - Use static sized buffer for name. - Create new security file in kernel32.
This function doesn't seem like it belongs in kernel_main and I didn't want to make a new file just for one function so I added all the relevant boundary descriptor functions. --- dlls/kernel32/Makefile.in | 1 + dlls/kernel32/kernel32.spec | 2 +- dlls/kernel32/security.c | 42 +++++++++++++++++++++++++++++++++++++ include/namespaceapi.h | 2 ++ 4 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 dlls/kernel32/security.c
diff --git a/dlls/kernel32/Makefile.in b/dlls/kernel32/Makefile.in index 7e68a950b71..bda8d03e90c 100644 --- a/dlls/kernel32/Makefile.in +++ b/dlls/kernel32/Makefile.in @@ -23,6 +23,7 @@ C_SRCS = \ process.c \ profile.c \ resource.c \ + security.c \ sync.c \ tape.c \ thread.c \ diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 7db82db375d..e040fedab08 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -266,7 +266,7 @@ @ stdcall CopyLZFile(long long) LZCopy @ stdcall CreateActCtxA(ptr) @ stdcall -import CreateActCtxW(ptr) -# @ stub CreateBoundaryDescriptorA +@ stdcall CreateBoundaryDescriptorA(str long) @ stdcall -import CreateBoundaryDescriptorW(wstr long) @ stdcall -import CreateConsoleScreenBuffer(long long ptr long ptr) @ stdcall -import CreateDirectoryA(str ptr) diff --git a/dlls/kernel32/security.c b/dlls/kernel32/security.c new file mode 100644 index 00000000000..ec8a348e1a2 --- /dev/null +++ b/dlls/kernel32/security.c @@ -0,0 +1,42 @@ +/* + * Kernel32 security functions + * + * Copyright (C) 2022 Mohamad Al-Jaf + * + * 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 <stdarg.h> + +#include "windef.h" +#include "winbase.h" +#include "winnls.h" + +/****************************************************************************** + * CreateBoundaryDescriptorA (KERNEL32.@) + */ +HANDLE WINAPI CreateBoundaryDescriptorA( LPCSTR name, ULONG flags ) +{ + WCHAR buffer[MAX_PATH]; + + if (!name) return CreateBoundaryDescriptorW( NULL, flags ); + + if (!MultiByteToWideChar( CP_ACP, 0, name, -1, buffer, MAX_PATH )) + { + SetLastError( ERROR_FILENAME_EXCED_RANGE ); + return 0; + } + return CreateBoundaryDescriptorW( buffer, flags ); +} diff --git a/include/namespaceapi.h b/include/namespaceapi.h index 9446806f82e..f219a2a7488 100644 --- a/include/namespaceapi.h +++ b/include/namespaceapi.h @@ -27,7 +27,9 @@ extern "C" {
WINBASEAPI BOOL WINAPI AddSIDToBoundaryDescriptor(HANDLE*,PSID); WINBASEAPI BOOLEAN WINAPI ClosePrivateNamespace(HANDLE,ULONG); +WINBASEAPI HANDLE WINAPI CreateBoundaryDescriptorA(LPCSTR,ULONG); WINBASEAPI HANDLE WINAPI CreateBoundaryDescriptorW(LPCWSTR,ULONG); +#define CreateBoundaryDescriptor WINELIB_NAME_AW(CreateBoundaryDescriptor) WINBASEAPI HANDLE WINAPI CreatePrivateNamespaceW(LPSECURITY_ATTRIBUTES,LPVOID,LPCWSTR); WINBASEAPI void WINAPI DeleteBoundaryDescriptor(HANDLE); WINBASEAPI HANDLE WINAPI OpenPrivateNamespaceW(LPVOID,LPCWSTR);
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- .../api-ms-win-core-namespace-l1-1-0.spec | 2 +- dlls/kernel32/kernel32.spec | 2 +- dlls/kernelbase/kernelbase.spec | 2 +- dlls/kernelbase/security.c | 9 +++++++++ 4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/api-ms-win-core-namespace-l1-1-0/api-ms-win-core-namespace-l1-1-0.spec b/dlls/api-ms-win-core-namespace-l1-1-0/api-ms-win-core-namespace-l1-1-0.spec index a47682fc9b9..15386ac841c 100644 --- a/dlls/api-ms-win-core-namespace-l1-1-0/api-ms-win-core-namespace-l1-1-0.spec +++ b/dlls/api-ms-win-core-namespace-l1-1-0/api-ms-win-core-namespace-l1-1-0.spec @@ -1,6 +1,6 @@ @ stub AddSIDToBoundaryDescriptor @ stub ClosePrivateNamespace @ stdcall CreateBoundaryDescriptorW(wstr long) kernelbase.CreateBoundaryDescriptorW -@ stub CreatePrivateNamespaceW +@ stdcall CreatePrivateNamespaceW(ptr ptr wstr) kernelbase.CreatePrivateNamespaceW @ stub DeleteBoundaryDescriptor @ stub OpenPrivateNamespaceW diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index b038aa23704..0e7ca8a69f8 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -309,7 +309,7 @@ # @ stub CreateNlsSecurityDescriptor @ stdcall -import CreatePipe(ptr ptr ptr long) # @ stub CreatePrivateNamespaceA -# @ stub CreatePrivateNamespaceW +@ stdcall -import CreatePrivateNamespaceW(ptr ptr wstr) @ stdcall -import CreateProcessA(str str ptr ptr long long ptr str ptr ptr) @ stdcall -import CreateProcessAsUserA(long str str ptr ptr long long ptr str ptr ptr) @ stdcall -import CreateProcessAsUserW(long wstr wstr ptr ptr long long ptr wstr ptr ptr) diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index c1175af2f9f..3692117a5cc 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -204,7 +204,7 @@ @ stdcall CreateMutexW(ptr long wstr) @ stdcall CreateNamedPipeW(wstr long long long long long long ptr) @ stdcall CreatePipe(ptr ptr ptr long) -# @ stub CreatePrivateNamespaceW +@ stdcall CreatePrivateNamespaceW(ptr ptr wstr) @ stdcall CreatePrivateObjectSecurity(ptr ptr ptr long long ptr) @ stdcall CreatePrivateObjectSecurityEx(ptr ptr ptr ptr long long long ptr) @ stdcall CreatePrivateObjectSecurityWithMultipleInheritance(ptr ptr ptr ptr long long long long ptr) diff --git a/dlls/kernelbase/security.c b/dlls/kernelbase/security.c index 26878982b6f..a20b20f32a8 100644 --- a/dlls/kernelbase/security.c +++ b/dlls/kernelbase/security.c @@ -931,6 +931,15 @@ HANDLE WINAPI CreateBoundaryDescriptorW( LPCWSTR name, ULONG flags ) return NULL; }
+/****************************************************************************** + * CreatePrivateNamespaceW (kernelbase.@) + */ +HANDLE WINAPI CreatePrivateNamespaceW( LPSECURITY_ATTRIBUTES attr, LPVOID descr, LPCWSTR prefix ) +{ + FIXME( "%p %p %s - stub\n", attr, descr, debugstr_w(prefix) ); + return NULL; +} + /****************************************************************************** * CreatePrivateObjectSecurity (kernelbase.@) */
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- .../api-ms-win-core-namespace-l1-1-0.spec | 2 +- dlls/kernel32/kernel32.spec | 2 +- dlls/kernelbase/kernelbase.spec | 2 +- dlls/kernelbase/security.c | 9 +++++++++ 4 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/dlls/api-ms-win-core-namespace-l1-1-0/api-ms-win-core-namespace-l1-1-0.spec b/dlls/api-ms-win-core-namespace-l1-1-0/api-ms-win-core-namespace-l1-1-0.spec index 15386ac841c..91d6b20b2bc 100644 --- a/dlls/api-ms-win-core-namespace-l1-1-0/api-ms-win-core-namespace-l1-1-0.spec +++ b/dlls/api-ms-win-core-namespace-l1-1-0/api-ms-win-core-namespace-l1-1-0.spec @@ -3,4 +3,4 @@ @ stdcall CreateBoundaryDescriptorW(wstr long) kernelbase.CreateBoundaryDescriptorW @ stdcall CreatePrivateNamespaceW(ptr ptr wstr) kernelbase.CreatePrivateNamespaceW @ stub DeleteBoundaryDescriptor -@ stub OpenPrivateNamespaceW +@ stdcall OpenPrivateNamespaceW(ptr wstr) kernelbase.OpenPrivateNamespaceW diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 0e7ca8a69f8..dc7253786c0 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -1136,7 +1136,7 @@ @ stdcall OpenMutexA(long long str) @ stdcall -import OpenMutexW(long long wstr) # @ stub OpenPrivateNamespaceA -# @ stub OpenPrivateNamespaceW +@ stdcall -import OpenPrivateNamespaceW(ptr wstr) @ stdcall -import OpenProcess(long long long) @ stdcall -import OpenProcessToken(long long ptr) @ stdcall OpenProfileUserMapping() diff --git a/dlls/kernelbase/kernelbase.spec b/dlls/kernelbase/kernelbase.spec index 3692117a5cc..4444e7da5af 100644 --- a/dlls/kernelbase/kernelbase.spec +++ b/dlls/kernelbase/kernelbase.spec @@ -1020,7 +1020,7 @@ @ stdcall OpenMutexW(long long wstr) # @ stub OpenPackageInfoByFullName # @ stub OpenPackageInfoByFullNameForUser -# @ stub OpenPrivateNamespaceW +@ stdcall OpenPrivateNamespaceW(ptr wstr) @ stdcall OpenProcess(long long long) @ stdcall OpenProcessToken(long long ptr) @ stub OpenRegKey diff --git a/dlls/kernelbase/security.c b/dlls/kernelbase/security.c index a20b20f32a8..70fbe435475 100644 --- a/dlls/kernelbase/security.c +++ b/dlls/kernelbase/security.c @@ -1200,6 +1200,15 @@ BOOL WINAPI MakeSelfRelativeSD( PSECURITY_DESCRIPTOR abs_descr, PSECURITY_DESCRI return set_ntstatus( RtlMakeSelfRelativeSD( abs_descr, rel_descr, len )); }
+/****************************************************************************** + * OpenPrivateNamespaceW (kernelbase.@) + */ +HANDLE WINAPI OpenPrivateNamespaceW( LPVOID descr, LPCWSTR prefix ) +{ + FIXME( "%p %s - stub\n", descr, debugstr_w(prefix) ); + return NULL; +} + /****************************************************************************** * SetFileSecurityW (kernelbase.@) */
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/kernel32/kernel32.spec | 2 +- dlls/kernel32/security.c | 17 +++++++++++++++++ include/namespaceapi.h | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index c108272f1b1..df340fa4d21 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -308,7 +308,7 @@ @ stdcall -import CreateNamedPipeW(wstr long long long long long long ptr) # @ stub CreateNlsSecurityDescriptor @ stdcall -import CreatePipe(ptr ptr ptr long) -# @ stub CreatePrivateNamespaceA +@ stdcall CreatePrivateNamespaceA(ptr ptr str) @ stdcall -import CreatePrivateNamespaceW(ptr ptr wstr) @ stdcall -import CreateProcessA(str str ptr ptr long long ptr str ptr ptr) @ stdcall -import CreateProcessAsUserA(long str str ptr ptr long long ptr str ptr ptr) diff --git a/dlls/kernel32/security.c b/dlls/kernel32/security.c index ec8a348e1a2..a75d5c2b67a 100644 --- a/dlls/kernel32/security.c +++ b/dlls/kernel32/security.c @@ -40,3 +40,20 @@ HANDLE WINAPI CreateBoundaryDescriptorA( LPCSTR name, ULONG flags ) } return CreateBoundaryDescriptorW( buffer, flags ); } + +/****************************************************************************** + * CreatePrivateNamespaceA (KERNEL32.@) + */ +HANDLE WINAPI CreatePrivateNamespaceA( LPSECURITY_ATTRIBUTES attr, LPVOID descr, LPCSTR prefix ) +{ + WCHAR buffer[MAX_PATH]; + + if (!prefix) return CreatePrivateNamespaceW( attr, descr, NULL ); + + if (!MultiByteToWideChar( CP_ACP, 0, prefix, -1, buffer, MAX_PATH )) + { + SetLastError( ERROR_FILENAME_EXCED_RANGE ); + return 0; + } + return CreatePrivateNamespaceW( attr, descr, buffer ); +} diff --git a/include/namespaceapi.h b/include/namespaceapi.h index f219a2a7488..6b3198b67c6 100644 --- a/include/namespaceapi.h +++ b/include/namespaceapi.h @@ -30,7 +30,9 @@ WINBASEAPI BOOLEAN WINAPI ClosePrivateNamespace(HANDLE,ULONG); WINBASEAPI HANDLE WINAPI CreateBoundaryDescriptorA(LPCSTR,ULONG); WINBASEAPI HANDLE WINAPI CreateBoundaryDescriptorW(LPCWSTR,ULONG); #define CreateBoundaryDescriptor WINELIB_NAME_AW(CreateBoundaryDescriptor) +WINBASEAPI HANDLE WINAPI CreatePrivateNamespaceA(LPSECURITY_ATTRIBUTES,LPVOID,LPCSTR); WINBASEAPI HANDLE WINAPI CreatePrivateNamespaceW(LPSECURITY_ATTRIBUTES,LPVOID,LPCWSTR); +#define CreatePrivateNamespace WINELIB_NAME_AW(CreatePrivateNamespace) WINBASEAPI void WINAPI DeleteBoundaryDescriptor(HANDLE); WINBASEAPI HANDLE WINAPI OpenPrivateNamespaceW(LPVOID,LPCWSTR);
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/kernel32/kernel32.spec | 2 +- dlls/kernel32/security.c | 17 +++++++++++++++++ include/namespaceapi.h | 2 ++ 3 files changed, 20 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index df340fa4d21..0bf462f1c30 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -1135,7 +1135,7 @@ @ stdcall OpenJobObjectW(long long wstr) @ stdcall OpenMutexA(long long str) @ stdcall -import OpenMutexW(long long wstr) -# @ stub OpenPrivateNamespaceA +@ stdcall OpenPrivateNamespaceA(ptr str) @ stdcall -import OpenPrivateNamespaceW(ptr wstr) @ stdcall -import OpenProcess(long long long) @ stdcall -import OpenProcessToken(long long ptr) diff --git a/dlls/kernel32/security.c b/dlls/kernel32/security.c index a75d5c2b67a..8763398265c 100644 --- a/dlls/kernel32/security.c +++ b/dlls/kernel32/security.c @@ -57,3 +57,20 @@ HANDLE WINAPI CreatePrivateNamespaceA( LPSECURITY_ATTRIBUTES attr, LPVOID descr, } return CreatePrivateNamespaceW( attr, descr, buffer ); } + +/****************************************************************************** + * OpenPrivateNamespaceA (KERNEL32.@) + */ +HANDLE WINAPI OpenPrivateNamespaceA( LPVOID descr, LPCSTR prefix ) +{ + WCHAR buffer[MAX_PATH]; + + if (!prefix) return OpenPrivateNamespaceW( descr, NULL ); + + if (!MultiByteToWideChar( CP_ACP, 0, prefix, -1, buffer, MAX_PATH )) + { + SetLastError( ERROR_FILENAME_EXCED_RANGE ); + return 0; + } + return OpenPrivateNamespaceW( descr, NULL ); +} diff --git a/include/namespaceapi.h b/include/namespaceapi.h index 6b3198b67c6..2210edea17a 100644 --- a/include/namespaceapi.h +++ b/include/namespaceapi.h @@ -34,7 +34,9 @@ WINBASEAPI HANDLE WINAPI CreatePrivateNamespaceA(LPSECURITY_ATTRIBUTES,LPVOID,L WINBASEAPI HANDLE WINAPI CreatePrivateNamespaceW(LPSECURITY_ATTRIBUTES,LPVOID,LPCWSTR); #define CreatePrivateNamespace WINELIB_NAME_AW(CreatePrivateNamespace) WINBASEAPI void WINAPI DeleteBoundaryDescriptor(HANDLE); +WINBASEAPI HANDLE WINAPI OpenPrivateNamespaceA(LPVOID,LPCSTR); WINBASEAPI HANDLE WINAPI OpenPrivateNamespaceW(LPVOID,LPCWSTR); +#define OpenPrivateNamespace WINELIB_NAME_AW(OpenPrivateNamespace)
#ifdef __cplusplus }
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/kernel32/kernel32.spec | 2 +- dlls/kernel32/security.c | 13 +++++++++++++ include/winbase.h | 1 + 3 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 0bf462f1c30..eba60aad8e5 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -141,7 +141,7 @@ @ stdcall AddConsoleAliasA(str str str) @ stdcall AddConsoleAliasW(wstr wstr wstr) @ stdcall -import AddDllDirectory(wstr) -# @ stub AddIntegrityLabelToBoundaryDescriptor +@ stdcall AddIntegrityLabelToBoundaryDescriptor(ptr ptr) # @ stub AddLocalAlternateComputerNameA # @ stub AddLocalAlternateComputerNameW @ stdcall -import AddRefActCtx(ptr) diff --git a/dlls/kernel32/security.c b/dlls/kernel32/security.c index 8763398265c..1fa6d060829 100644 --- a/dlls/kernel32/security.c +++ b/dlls/kernel32/security.c @@ -24,6 +24,19 @@ #include "winbase.h" #include "winnls.h"
+#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(security); + +/****************************************************************************** + * AddIntegrityLabelToBoundaryDescriptor (KERNEL32.@) + */ +BOOL WINAPI AddIntegrityLabelToBoundaryDescriptor( HANDLE *descr, PSID label ) +{ + FIXME( "(%p %p)- stub\n", descr, label ); + return TRUE; +} + /****************************************************************************** * CreateBoundaryDescriptorA (KERNEL32.@) */ diff --git a/include/winbase.h b/include/winbase.h index cce0033b925..14b8abcc416 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -1792,6 +1792,7 @@ WINADVAPI BOOL WINAPI AccessCheckByTypeResultListAndAuditAlarmByHandleW( #define AccessCheckByTypeResultListAndAuditAlarmByHandle WINELIB_NAME_AW(AccessCheckByTypeResultListAndAuditAlarmByHandle) WINBASEAPI VOID WINAPI AcquireSRWLockExclusive(PSRWLOCK); WINBASEAPI VOID WINAPI AcquireSRWLockShared(PSRWLOCK); +WINBASEAPI BOOL WINAPI AddIntegrityLabelToBoundaryDescriptor(HANDLE*,PSID); WINADVAPI BOOL WINAPI AdjustTokenPrivileges(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,PDWORD); WINADVAPI BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *); WINADVAPI BOOL WINAPI AllocateLocallyUniqueId(PLUID);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=109014
Your paranoid android.
=== debian11 (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/kernel32/tests/Makefile.in | 1 + dlls/kernel32/tests/security.c | 71 +++++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+) create mode 100644 dlls/kernel32/tests/security.c
diff --git a/dlls/kernel32/tests/Makefile.in b/dlls/kernel32/tests/Makefile.in index db106ab9fc9..517a9e27f09 100644 --- a/dlls/kernel32/tests/Makefile.in +++ b/dlls/kernel32/tests/Makefile.in @@ -31,6 +31,7 @@ SOURCES = \ profile.c \ resource.c \ resource.rc \ + security.c \ sync.c \ thread.c \ time.c \ diff --git a/dlls/kernel32/tests/security.c b/dlls/kernel32/tests/security.c new file mode 100644 index 00000000000..ef6c703406e --- /dev/null +++ b/dlls/kernel32/tests/security.c @@ -0,0 +1,71 @@ +/* + * Unit tests for security functions + * + * Copyright (c) 2022 Mohamad Al-Jaf + * + * 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 "wine/test.h" + +static HMODULE hdll; +static HANDLE (WINAPI *pCreateBoundaryDescriptorA)(LPCSTR,ULONG); + +static BOOL init_function_pointers(void) +{ + hdll = GetModuleHandleA("kernel32.dll"); + + if (hdll) + { + pCreateBoundaryDescriptorA = (void *)GetProcAddress(hdll, "CreateBoundaryDescriptorA"); + return TRUE; + } + + return FALSE; +} + +void test_CreateBoundaryDescriptorA(void) +{ + DWORD error; + HANDLE res; + CHAR buffer[MAX_PATH] = "test"; + CHAR overload[MAX_PATH + 5] = ""; + + for (int i = 0; i < (MAX_PATH + 5); i++) + overload[i] = 't'; + + res = pCreateBoundaryDescriptorA(NULL, 0); + ok(res == NULL, "expected NULL pointer\n"); + + res = pCreateBoundaryDescriptorA(buffer, 0); + todo_wine + ok(res != NULL, "expected HANDLE to boundary descriptor\n"); + + SetLastError(0xdeadbeef); + res = pCreateBoundaryDescriptorA(overload, 0); + error = GetLastError(); + ok(res == NULL && (error == ERROR_FILENAME_EXCED_RANGE), "expected name to exceed MAX_PATH\n"); +} + +START_TEST(security) +{ + if (init_function_pointers()) + { + test_CreateBoundaryDescriptorA(); + FreeLibrary(hdll); + } + else + skip("could not load kernel32.dll\n"); +}
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=109015
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/kernel32/tests/security.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/kernel32/tests/security.c b/dlls/kernel32/tests/security.c index ef6c703406e..b8ae1474a80 100644 --- a/dlls/kernel32/tests/security.c +++ b/dlls/kernel32/tests/security.c @@ -22,6 +22,7 @@
static HMODULE hdll; static HANDLE (WINAPI *pCreateBoundaryDescriptorA)(LPCSTR,ULONG); +static HANDLE (WINAPI *pCreatePrivateNamespaceA)(LPSECURITY_ATTRIBUTES,LPVOID,LPCSTR);
static BOOL init_function_pointers(void) { @@ -30,6 +31,7 @@ static BOOL init_function_pointers(void) if (hdll) { pCreateBoundaryDescriptorA = (void *)GetProcAddress(hdll, "CreateBoundaryDescriptorA"); + pCreatePrivateNamespaceA = (void *)GetProcAddress(hdll, "CreatePrivateNamespaceA"); return TRUE; }
@@ -59,11 +61,34 @@ void test_CreateBoundaryDescriptorA(void) ok(res == NULL && (error == ERROR_FILENAME_EXCED_RANGE), "expected name to exceed MAX_PATH\n"); }
+void test_CreatePrivateNamespaceA(void) +{ + DWORD error; + HANDLE res; + CHAR buffer[MAX_PATH] = "test"; + CHAR overload[MAX_PATH + 5] = ""; + + for (int i = 0; i < (MAX_PATH + 5); i++) + overload[i] = 't'; + + res = pCreatePrivateNamespaceA(NULL, NULL, 0); + ok(res == NULL, "expected NULL pointer\n"); + + res = pCreatePrivateNamespaceA(NULL, NULL, buffer); + ok(res == NULL, "expected NULL pointer\n"); + + SetLastError(0xdeadbeef); + res = pCreatePrivateNamespaceA(NULL, NULL, overload); + error = GetLastError(); + ok(res == NULL && (error == ERROR_FILENAME_EXCED_RANGE), "expected prefix to exceed MAX_PATH\n"); +} + START_TEST(security) { if (init_function_pointers()) { test_CreateBoundaryDescriptorA(); + test_CreatePrivateNamespaceA(); FreeLibrary(hdll); } else
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=109016
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply
Signed-off-by: Mohamad Al-Jaf mohamadaljaf@gmail.com --- dlls/kernel32/tests/security.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/kernel32/tests/security.c b/dlls/kernel32/tests/security.c index b8ae1474a80..1606c08ac8b 100644 --- a/dlls/kernel32/tests/security.c +++ b/dlls/kernel32/tests/security.c @@ -23,6 +23,7 @@ static HMODULE hdll; static HANDLE (WINAPI *pCreateBoundaryDescriptorA)(LPCSTR,ULONG); static HANDLE (WINAPI *pCreatePrivateNamespaceA)(LPSECURITY_ATTRIBUTES,LPVOID,LPCSTR); +static HANDLE (WINAPI *pOpenPrivateNamespaceA)(LPVOID,LPCSTR);
static BOOL init_function_pointers(void) { @@ -32,6 +33,7 @@ static BOOL init_function_pointers(void) { pCreateBoundaryDescriptorA = (void *)GetProcAddress(hdll, "CreateBoundaryDescriptorA"); pCreatePrivateNamespaceA = (void *)GetProcAddress(hdll, "CreatePrivateNamespaceA"); + pOpenPrivateNamespaceA = (void *)GetProcAddress(hdll, "OpenPrivateNamespaceA"); return TRUE; }
@@ -83,12 +85,35 @@ void test_CreatePrivateNamespaceA(void) ok(res == NULL && (error == ERROR_FILENAME_EXCED_RANGE), "expected prefix to exceed MAX_PATH\n"); }
+void test_OpenPrivateNamespaceA(void) +{ + DWORD error; + HANDLE res; + CHAR buffer[MAX_PATH] = "test"; + CHAR overload[MAX_PATH + 5] = ""; + + for (int i = 0; i < (MAX_PATH + 5); i++) + overload[i] = 't'; + + res = pOpenPrivateNamespaceA(NULL, NULL); + ok(res == NULL, "expected NULL pointer\n"); + + res = pOpenPrivateNamespaceA(NULL, buffer); + ok(res == NULL, "expected NULL pointer\n"); + + SetLastError(0xdeadbeef); + res = pOpenPrivateNamespaceA(NULL, overload); + error = GetLastError(); + ok(res == NULL && (error == ERROR_FILENAME_EXCED_RANGE), "expected prefix to exceed MAX_PATH\n"); +} + START_TEST(security) { if (init_function_pointers()) { test_CreateBoundaryDescriptorA(); test_CreatePrivateNamespaceA(); + test_OpenPrivateNamespaceA(); FreeLibrary(hdll); } else
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=109017
Your paranoid android.
=== build (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply
=== debian11 (build log) ===
error: patch failed: dlls/kernel32/kernel32.spec:141 error: patch failed: include/winbase.h:1792 Task: Patch failed to apply