[PATCH] ntdll: Add a simple test for RtlDosApplyFileIsolationRedirection_Ustr
Ivan Akulinchev
ivan.akulinchev at gmail.com
Sat Nov 5 20:54:18 CDT 2016
Signed-off-by: Ivan Akulinchev <ivan.akulinchev at gmail.com>
---
dlls/ntdll/tests/Makefile.in | 1 +
dlls/ntdll/tests/sxs.c | 141 +++++++++++++++++++++++++++++++++++++++++++
2 files changed, 142 insertions(+)
create mode 100644 dlls/ntdll/tests/sxs.c
diff --git a/dlls/ntdll/tests/Makefile.in b/dlls/ntdll/tests/Makefile.in
index fc352dd..7fe1a70 100644
--- a/dlls/ntdll/tests/Makefile.in
+++ b/dlls/ntdll/tests/Makefile.in
@@ -21,5 +21,6 @@ C_SRCS = \
rtlbitmap.c \
rtlstr.c \
string.c \
+ sxs.c \
threadpool.c \
time.c
diff --git a/dlls/ntdll/tests/sxs.c b/dlls/ntdll/tests/sxs.c
new file mode 100644
index 0000000..e04803b
--- /dev/null
+++ b/dlls/ntdll/tests/sxs.c
@@ -0,0 +1,141 @@
+/*
+ * Tests for the Windows side-by-side assemblies.
+ *
+ * Copyright 2016 Ivan Akulinchev
+ *
+ * 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 "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
+#include "winbase.h"
+#include "winuser.h"
+#include "winnls.h"
+#include "winternl.h"
+
+#include "wine/test.h"
+
+static NTSTATUS (WINAPI *pRtlDosApplyFileIsolationRedirection_Ustr)(ULONG,
+ PUNICODE_STRING,
+ PUNICODE_STRING,
+ PUNICODE_STRING,
+ PUNICODE_STRING,
+ PUNICODE_STRING *,
+ PULONG,
+ PULONG,
+ PULONG);
+
+static const CHAR manifest_name[] = "winsxs.manifest";
+
+/* Note: '\n' is intentionally skipped. */
+static const CHAR manifest[] =
+ "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
+ "<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
+ " <assemblyIdentity type=\"win32\""
+ " name=\"Wine.NtDll.Tests\""
+ " version=\"1.0.0.0\""
+ " processorArchitecture=\"*\" />"
+ " <dependency>"
+ " <dependentAssembly>"
+ " <assemblyIdentity type=\"win32\""
+ " name=\"microsoft.windows.common-controls\""
+ " version=\"6.0.0.0\""
+ " processorArchitecture=\"*\""
+ " publicKeyToken=\"6595b64144ccf1df\""
+ " language=\"*\" />"
+ " </dependentAssembly>"
+ " </dependency>"
+ "</assembly>";
+
+static void test_rtl_dos_apply_file_isolation_redirect(void)
+{
+ NTSTATUS status;
+ WCHAR buffer[MAX_PATH];
+ UNICODE_STRING original_name;
+ UNICODE_STRING extension;
+ UNICODE_STRING unknown1;
+ UNICODE_STRING unknown2;
+ UNICODE_STRING *path;
+
+ static const WCHAR original_nameW[] = {'c','o','m','c','t','l','3','2',0};
+ static const WCHAR extensionW[] = {'.','d','l','l',0};
+ static const WCHAR emptyW[] = {'\0',0};
+
+ RtlInitUnicodeString(&original_name, original_nameW);
+ RtlInitUnicodeString(&extension, extensionW);
+ RtlInitUnicodeString(&unknown2, emptyW);
+
+ unknown1.Buffer = buffer;
+ unknown1.Length = 0;
+ unknown1.MaximumLength = MAX_PATH;
+
+ status = pRtlDosApplyFileIsolationRedirection_Ustr(1, &original_name, &extension, &unknown1,
+ &unknown2, &path, NULL, NULL, NULL);
+
+ ok(status == STATUS_SUCCESS, "Expected STATUS_SUCCESS, got %x\n", status);
+
+ if (status == STATUS_SUCCESS)
+ {
+ trace("%s --> %s\n", wine_dbgstr_w(original_nameW), wine_dbgstr_w(path->Buffer));
+ }
+}
+
+static HANDLE activate_context(ULONG_PTR *cookie)
+{
+ HANDLE file;
+ HANDLE hctx;
+ ACTCTXA ctx;
+ DWORD written;
+
+ file = CreateFileA(manifest_name, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL);
+ WriteFile(file, manifest, sizeof(manifest) - 1, &written, NULL);
+ CloseHandle(file);
+
+ memset(&ctx, 0, sizeof(ctx));
+ ctx.cbSize = sizeof(ctx);
+ ctx.lpSource = manifest_name;
+
+ hctx = CreateActCtxA(&ctx);
+ ActivateActCtx(hctx, cookie);
+
+ return hctx;
+}
+
+static void deactivate_context(HANDLE context, ULONG_PTR cookie)
+{
+ DeactivateActCtx(0, cookie);
+ ReleaseActCtx(context);
+
+ DeleteFileA(manifest_name);
+}
+
+START_TEST(sxs)
+{
+ pRtlDosApplyFileIsolationRedirection_Ustr = (void *)GetProcAddress(
+ LoadLibraryA("ntdll.dll"), "RtlDosApplyFileIsolationRedirection_Ustr");
+
+ if (pRtlDosApplyFileIsolationRedirection_Ustr)
+ {
+ ULONG_PTR cookie;
+ HANDLE context = activate_context(&cookie);
+ test_rtl_dos_apply_file_isolation_redirect();
+ deactivate_context(context, cookie);
+ }
+ else
+ {
+ skip("RtlDosApplyFileIsolationRedirection_Ustr is not implemented.\n");
+ }
+}
--
2.7.4
More information about the wine-patches
mailing list