[PATCH v4 8/9] tests/kernel32: Add MAX_PATH test for CreatePrivateNamespaceA.
Mohamad Al-Jaf
mohamadaljaf at gmail.com
Mon Feb 28 01:48:02 CST 2022
Signed-off-by: Mohamad Al-Jaf <mohamadaljaf at gmail.com>
---
dlls/kernel32/tests/security.c | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
diff --git a/dlls/kernel32/tests/security.c b/dlls/kernel32/tests/security.c
index e785bed33e0..52140994370 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;
}
@@ -61,11 +63,35 @@ void test_CreateBoundaryDescriptorA(void)
ok(res != NULL, "expected HANDLE to boundary descriptor\n");
}
+void test_CreatePrivateNamespaceA(void)
+{
+ DWORD error;
+ HANDLE res;
+ CHAR buffer[MAX_PATH] = "test";
+ CHAR overload[MAX_PATH + 100] = "";
+
+ for (int i = 0; i < (MAX_PATH + 100); 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(error != ERROR_FILENAME_EXCED_RANGE, "expected no MAX_PATH limit in buffer\n");
+ ok(res == NULL, "expected NULL pointer\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