server: Try2: add case-sensitivity comparison flag to find_object & co

Robert Shearman rob at
Mon Sep 19 10:48:36 CDT 2005

Vitaliy Margolen wrote:

>Monday, September 19, 2005, 7:47:08 AM, Alexandre Julliard wrote:
>>Vitaliy Margolen <wine-patch at> writes:
>>>I guess this one got lost. Resend it.
>>>Or is there anything wrong with it?
>>Well, you didn't change create_named_object, which looks
>>suspicious. Also I'd really like to see some regression tests for the
>>behavior of the various objects.
>Ah, I see. I new I was missing something. As far as regression testing - most
>of the named objects created from kernel32 and they are case insensitive. I
>purposely left it case sensitive to keep it same way as it was before. I know of
>at least named pipes that fail with current code, if I start mixing case - which
>does work on windows.

Something like this should test the behaviour (written in MSVC so will 
need some cleaning up before adding to a Wine test):

    WCHAR buffer1[] = L"\\BaseNamedObjects\\Test";
    WCHAR buffer2[] = L"\\BaseNamedObjects\\test";
    WCHAR buffer3[] = L"\\BaseNamedObjects\\TEst";
    HANDLE Event, Mutant, h;
    NTSTATUS status;

    attr.Length = sizeof(attr);
    attr.RootDirectory = NULL;
    attr.ObjectName = HeapAlloc(GetProcessHeap(), 0, 
    attr.Attributes = 0;
    attr.SecurityDescriptor = NULL;
    attr.SecurityQualityOfService = NULL;
    attr.ObjectName->Buffer = buffer2;
    attr.ObjectName->Length = wcslen(buffer2) * sizeof(WCHAR);
    attr.ObjectName->MaximumLength = (wcslen(buffer2) + 1) * sizeof(WCHAR);
    status = NtCreateMutant(&Mutant, GENERIC_ALL, &attr, FALSE);
    attr.ObjectName->Buffer = buffer1;
    attr.ObjectName->Length = wcslen(buffer1) * sizeof(WCHAR);
    attr.ObjectName->MaximumLength = (wcslen(buffer1) + 1) * sizeof(WCHAR);
    status = NtCreateEvent(&Event, GENERIC_ALL, &attr, FALSE, FALSE);
    attr.Attributes = OBJ_CASE_INSENSITIVE;
    attr.ObjectName->Buffer = buffer3;
    attr.ObjectName->Length = wcslen(buffer3) * sizeof(WCHAR);
    attr.ObjectName->MaximumLength = (wcslen(buffer3) + 1) * sizeof(WCHAR);
    status = NtOpenMutant(&h, GENERIC_ALL, &attr);
    ok(status == STATUS_OBJECT_TYPE_MISMATCH, "NtOpenMutant should have 
failed with STATUS_OBJECT_TYPE_MISMATCH because of case-insensitive 
search finding an event object\n");
    return 0;

Rob Shearman

More information about the wine-devel mailing list