[NTDLL] -Add preliminary tests for RtlDosApplyFileIsolationRedirection_Ustr.
[reactos.git] / rostests / apitests / ntdll / RtlDosApplyFileIsolationRedirection_Ustr.c
1 /*
2 * PROJECT: ReactOS api tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Test for RtlDosApplyFileIsolationRedirection_Ustr
5 * PROGRAMMER: Giannis Adamopoulos
6 */
7
8 #include <apitest.h>
9
10 #define WIN32_NO_STATUS
11 #include <ndk/rtlfuncs.h>
12
13 #define ok_eq_hex(value, expected) ok((value) == (expected), #value " = 0x%lx, expected 0x%lx\n", value, expected)
14 #define ok_eq_pointer(value, expected) ok((value) == (expected), #value " = %p, expected %p\n", value, expected)
15
16 UNICODE_STRING DotDll = RTL_CONSTANT_STRING(L".DLL");
17
18 void TestDefaultSxsRedirection(void)
19 {
20 UNICODE_STRING GdiPlusSXS = RTL_CONSTANT_STRING(L"\\WinSxS\\x86_microsoft.windows.gdiplus_6595b64144ccf1df_1.");
21 UNICODE_STRING Comctl32SXS = RTL_CONSTANT_STRING(L"\\WinSxS\\x86_microsoft.windows.common-controls_6595b64144ccf1df_5.82");
22 UNICODE_STRING Comctl32 = RTL_CONSTANT_STRING(L"COMCTL32.DLL");
23 UNICODE_STRING GdiPlus = RTL_CONSTANT_STRING(L"GDIPLUS.DLL");
24 UNICODE_STRING CallerBuffer;
25 UNICODE_STRING DynamicString;
26 PUNICODE_STRING FullNameOut;
27 USHORT Position;
28
29 NTSTATUS Status;
30
31 /* NOTE: in xp and 2k3 gdiplus does not exist in system32 */
32 RtlInitUnicodeString(&CallerBuffer, NULL);
33 RtlInitUnicodeString(&DynamicString, NULL);
34 FullNameOut = NULL;
35 Status = RtlDosApplyFileIsolationRedirection_Ustr(TRUE,
36 &GdiPlus,
37 &DotDll,
38 &CallerBuffer,
39 &DynamicString,
40 &FullNameOut,
41 NULL,
42 NULL,
43 NULL);
44 ok_eq_hex(Status, STATUS_SUCCESS);
45 ok_eq_pointer(CallerBuffer.Buffer, NULL);
46 ok_eq_pointer(FullNameOut, &DynamicString);
47 Status = RtlFindCharInUnicodeString(RTL_FIND_CHAR_IN_UNICODE_STRING_CASE_INSENSITIVE,
48 &GdiPlusSXS,
49 &DynamicString,
50 &Position);
51 ok_eq_hex(Status, STATUS_SUCCESS);
52
53
54 RtlInitUnicodeString(&CallerBuffer, NULL);
55 RtlInitUnicodeString(&DynamicString, NULL);
56 FullNameOut = NULL;
57 Status = RtlDosApplyFileIsolationRedirection_Ustr(TRUE,
58 &Comctl32,
59 &DotDll,
60 &CallerBuffer,
61 &DynamicString,
62 &FullNameOut,
63 NULL,
64 NULL,
65 NULL);
66 ok_eq_hex(Status, STATUS_SUCCESS);
67 ok_eq_pointer(CallerBuffer.Buffer, NULL);
68 ok_eq_pointer(FullNameOut, &DynamicString);
69 Status = RtlFindCharInUnicodeString(RTL_FIND_CHAR_IN_UNICODE_STRING_CASE_INSENSITIVE,
70 &Comctl32SXS,
71 &DynamicString,
72 &Position);
73 ok_eq_hex(Status, STATUS_SUCCESS);
74 }
75
76 void TestDotLocal(void)
77 {
78 }
79
80 START_TEST(RtlDosApplyFileIsolationRedirection_Ustr)
81 {
82 TestDotLocal();
83 TestDefaultSxsRedirection();
84 }