[PATCH] ntdll: Add a simple test for RtlDosApplyFileIsolationRedirection_Ustr

Nikolay Sivov bunglehead at gmail.com
Sun Nov 6 15:35:43 CST 2016


On 07.11.2016 0:27, Ivan Akulinchev wrote:
> On Sunday, 6 November 2016 22:06:44 CET you wrote:
>> On 06.11.2016 4:54, Ivan Akulinchev wrote:
>>> 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);
>> Where does this prototype come from
> 
> I found this prototype on the Internet (just look for the name), and it is 
> likely to be wrong.
> 
>> and why do we need this function in a first place?
> 
> We needn't it in a first place, but we (probably) need to test every exported 
> function, because if an application can import something (especially by name, 
> not an ordinal number), this application can rely on it.

It's an unreasonable thing to do, unless you already have an application
that needs such export.

 For example, this
> function is required by some old viruses from the past decade (a computer 
> museum of the future may want to use Wine for demonstration purposes).
> 
> Also it is a very important function used by Windows to support "Side-by-Side 
> Assemblies", such as version 6 of comctl32. I can write a private mail with 
> details to everybody, who wants to know how does it work, and who is NOT going 
> to implement this function in Wine (to keep it clean from Microsoft's "trade 
> secrets" and so on).
> 

That's implementation details that we don't have to duplicate.




More information about the wine-devel mailing list