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=109024
Your paranoid android.
=== w10pro64 (32 bit report) ===
kernel32: comm.c:859: Test failed: WaitCommEvent failed with a timeout comm.c:880: Test failed: WaitCommEvent error 0 comm.c:881: Test failed: WaitCommEvent: expected EV_TXEMPTY, got 0 comm.c:886: Test failed: WaitCommEvent used 1500 ms for waiting
=== w7u_2qxl (32 bit report) ===
kernel32: debugger.c:1027: Test failed: ole32.dll was not reported
=== w7u_adm (32 bit report) ===
kernel32: debugger.c:1027: Test failed: ole32.dll was not reported
=== w7u_el (32 bit report) ===
kernel32: debugger.c:1027: Test failed: ole32.dll was not reported
=== w1064_tsign (32 bit report) ===
kernel32: debugger.c:681: Test failed: debugger reported 7 failures debugger: Timeout
=== w1064_tsign (64 bit report) ===
kernel32: debugger.c:155: Test failed: unable to open 'C:\Users\winetest\AppData\Local\Temp\wt59F7.tmp' debugger.c:155: Test failed: failed to open: C:\Users\winetest\AppData\Local\Temp\wt59F7.tmp debugger.c:676: Test failed: the child and debugged pids don't match: 4744 != 2376
=== w10pro64_ar (64 bit report) ===
kernel32: loader.c:720: Test failed: 1192: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c0000131 loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c0000130 loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1197: wrong status c000012f/c000011b loader.c:720: Test failed: 1214: wrong status c000012f/c0000130 loader.c:720: Test failed: 1219: wrong status c000012f/c0000130 loader.c:720: Test failed: 1224: wrong status c000012f/c000007b loader.c:720: Test failed: 1229: wrong status c000012f/c000007b loader.c:720: Test failed: 1234: wrong status c000012f/c000007b loader.c:720: Test failed: 1239: wrong status c000012f/c000007b loader.c:720: Test failed: 1244: wrong status c000012f/c000007b loader.c:720: Test failed: 1260: wrong status c000012f/0 loader.c:720: Test failed: 1264: wrong status c000012f/0 loader.c:720: Test failed: 1269: wrong status c000012f/0 loader.c:720: Test failed: 1273: wrong status c000012f/0 loader.c:720: Test failed: 1277: wrong status c000012f/0 loader.c:720: Test failed: 1431: wrong status c000012f/c000007b loader.c:720: Test failed: 1439: wrong status c000012f/c000007b loader.c:720: Test failed: 1444: wrong status c000012f/0 loader.c:724: Test failed: 1444: failed with c000012f expected fallback loader.c:720: Test failed: 1450: wrong status c000012f/0 loader.c:724: Test failed: 1450: failed with c000012f expected fallback loader.c:720: Test failed: 1456: wrong status c000012f/0 loader.c:724: Test failed: 1456: failed with c000012f expected fallback loader.c:720: Test failed: 1463: wrong status c000012f/0 loader.c:724: Test failed: 1463: failed with c000012f expected fallback loader.c:720: Test failed: 1469: wrong status c000012f/0 loader.c:720: Test failed: 1478: wrong status c000012f/0 loader.c:720: Test failed: 1482: wrong status c000012f/0 loader.c:720: Test failed: 1486: wrong status c000012f/0 loader.c:720: Test failed: 1490: wrong status c000012f/0 loader.c:720: Test failed: 1494: wrong status c000012f/0
=== w10pro64_he (64 bit report) ===
kernel32: loader.c:720: Test failed: 1219: wrong status c000011b/c0000130 loader.c:720: Test failed: 1224: wrong status c000011b/c000007b loader.c:720: Test failed: 1229: wrong status c000011b/c000007b loader.c:720: Test failed: 1234: wrong status c000011b/c000007b loader.c:720: Test failed: 1239: wrong status c000011b/c000007b loader.c:720: Test failed: 1244: wrong status c000011b/c000007b loader.c:720: Test failed: 1260: wrong status c000011b/0 loader.c:720: Test failed: 1264: wrong status c000011b/0 loader.c:720: Test failed: 1269: wrong status c000011b/0 loader.c:720: Test failed: 1273: wrong status c000011b/0 loader.c:720: Test failed: 1277: wrong status c000011b/0 loader.c:720: Test failed: 1431: wrong status c000011b/c000007b loader.c:720: Test failed: 1439: wrong status c000011b/c000007b loader.c:720: Test failed: 1444: wrong status c000011b/0 loader.c:724: Test failed: 1444: failed with c000011b expected fallback loader.c:720: Test failed: 1450: wrong status c000011b/0 loader.c:724: Test failed: 1450: failed with c000011b expected fallback loader.c:720: Test failed: 1456: wrong status c000011b/0 loader.c:724: Test failed: 1456: failed with c000011b expected fallback loader.c:720: Test failed: 1463: wrong status c000011b/0 loader.c:724: Test failed: 1463: failed with c000011b expected fallback loader.c:720: Test failed: 1469: wrong status c000011b/0 loader.c:720: Test failed: 1478: wrong status c000011b/0
=== w8adm (32 bit report) ===
kernel32: path: Timeout
=== w8 (32 bit report) ===
kernel32: pipe.c:2866: Test failed: FlushFileBuffers should have failed pipe.c:2867: Test failed: FlushFileBuffers set error 87, expected 109
=== w8 (testbot log) ===
WineRunTask.pl:error: The previous 1 run(s) terminated abnormally
=== w10pro64 (testbot log) ===
WineRunTask.pl:error: The previous 1 run(s) terminated abnormally
=== w7u_2qxl (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w7u_adm (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w7u_el (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w8 (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w8adm (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w864 (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w1064v1507 (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w1064v1809 (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w1064v1809 (testbot log) ===
WineRunTask.pl:error: The previous 1 run(s) terminated abnormally
=== w1064 (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w1064_tsign (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w10pro64 (32 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w864 (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w1064v1507 (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w1064v1809 (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w1064 (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w1064_2qxl (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w1064_tsign (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w10pro64 (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w10pro64_ar (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w10pro64_he (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w10pro64_ja (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH
=== w10pro64_zh_CN (64 bit report) ===
kernel32: security.c:59: Test failed: expected name to exceed MAX_PATH