[PATCH v2 8/9] tests/kernel32: Add MAX_PATH test for CreatePrivateNamespaceA.
Mohamad Al-Jaf
mohamadaljaf at gmail.com
Wed Feb 23 00:02:06 CST 2022
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf at 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
--
2.35.1
More information about the wine-devel
mailing list