ntdll pending some winerror.h fixes Added: trunk/reactos/regtests/winetests/ntdll/ Added: trunk/reactos/regtests/winetests/ntdll/atom.c Added: trunk/reactos/regtests/winetests/ntdll/env.c Added: trunk/reactos/regtests/winetests/ntdll/error.c Added: trunk/reactos/regtests/winetests/ntdll/generated.c Added: trunk/reactos/regtests/winetests/ntdll/info.c Added: trunk/reactos/regtests/winetests/ntdll/large_int.c Added: trunk/reactos/regtests/winetests/ntdll/ntdll_test.h Added: trunk/reactos/regtests/winetests/ntdll/ntdll_test.xml Added: trunk/reactos/regtests/winetests/ntdll/path.c Added: trunk/reactos/regtests/winetests/ntdll/reg.c Added: trunk/reactos/regtests/winetests/ntdll/rtl.c Added: trunk/reactos/regtests/winetests/ntdll/rtlbitmap.c Added: trunk/reactos/regtests/winetests/ntdll/rtlstr.c Added: trunk/reactos/regtests/winetests/ntdll/string.c Added: trunk/reactos/regtests/winetests/ntdll/testlist.c Added: trunk/reactos/regtests/winetests/ntdll/time.c _____
Added: trunk/reactos/regtests/winetests/ntdll/atom.c --- trunk/reactos/regtests/winetests/ntdll/atom.c 2005-08-07 01:23:40 UTC (rev 17132) +++ trunk/reactos/regtests/winetests/ntdll/atom.c 2005-08-07 02:16:34 UTC (rev 17133) @@ -0,0 +1,402 @@
+/* Unit test suite for Ntdll atom API functions + * + * Copyright 2003 Gyorgy 'Nog' Jeney + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * NOTES + * We use function pointers here as there is no import library for NTDLL on + * windows. + */ + +#define _WIN32_WINNT 0x0501 + +#include <stdio.h> +#include <stdarg.h> +#include "windows.h" +#include "ntstatus.h" +#include "wine/test.h" +#include "wine/unicode.h" +#include "winternl.h" + +/* Function pointers for ntdll calls */ +static HMODULE hntdll = 0; +static NTSTATUS (WINAPI *pRtlCreateAtomTable)(ULONG,PRTL_ATOM_TABLE); +static NTSTATUS (WINAPI *pRtlDestroyAtomTable)(RTL_ATOM_TABLE); +static NTSTATUS (WINAPI *pRtlEmptyAtomTable)(RTL_ATOM_TABLE,BOOLEAN); +static NTSTATUS (WINAPI *pRtlAddAtomToAtomTable)(RTL_ATOM_TABLE,PCWSTR,PRTL_ATOM); +static NTSTATUS (WINAPI *pRtlDeleteAtomFromAtomTable)(RTL_ATOM_TABLE,RTL_ATOM); +static NTSTATUS (WINAPI *pRtlLookupAtomInAtomTable)(RTL_ATOM_TABLE,PCWSTR,PRTL_ATOM); +static NTSTATUS (WINAPI *pRtlPinAtomInAtomTable)(RTL_ATOM_TABLE,RTL_ATOM); +static NTSTATUS (WINAPI *pRtlQueryAtomInAtomTable)(RTL_ATOM_TABLE,RTL_ATOM,PULONG,PULONG,PWSTR,P ULONG); + +static const WCHAR EmptyAtom[] = {0}; +static const WCHAR testAtom1[] = {'H','e','l','l','o',' ','W','o','r','l','d',0}; +static const WCHAR testAtom2[] = {'H','e','l','l','o',' ','W','o','r','l','d','2',0}; +static const WCHAR testAtom3[] = {'H','e','l','l','o',' ','W','o','r','l','d','3',0}; + +static const WCHAR testAtom1Cap[] = {'H','E','L','L','O',' ','W','O','R','L','D',0}; +static const WCHAR testAtom1Low[] = {'h','e','l','l','o',' ','w','o','r','l','d',0}; + +static const WCHAR testAtomInt[] = {'#','1','3','2',0}; +static const WCHAR testAtomIntInv[] = {'#','2','3','4','z',0}; +static const WCHAR testAtomOTT[] = {'#','1','2','3',0}; + +static void InitFunctionPtr(void) +{ + hntdll = LoadLibraryA("ntdll.dll"); + ok(hntdll != 0, "Unable to load ntdll.dll\n"); + + if (hntdll) + { + pRtlCreateAtomTable = (void *)GetProcAddress(hntdll, "RtlCreateAtomTable"); + pRtlDestroyAtomTable = (void *)GetProcAddress(hntdll, "RtlDestroyAtomTable"); + pRtlEmptyAtomTable = (void *)GetProcAddress(hntdll, "RtlEmptyAtomTable"); + pRtlAddAtomToAtomTable = (void *)GetProcAddress(hntdll, "RtlAddAtomToAtomTable"); + pRtlDeleteAtomFromAtomTable = (void *)GetProcAddress(hntdll, "RtlDeleteAtomFromAtomTable"); + pRtlLookupAtomInAtomTable = (void *)GetProcAddress(hntdll, "RtlLookupAtomInAtomTable"); + pRtlPinAtomInAtomTable = (void *)GetProcAddress(hntdll, "RtlPinAtomInAtomTable"); + pRtlQueryAtomInAtomTable = (void *)GetProcAddress(hntdll, "RtlQueryAtomInAtomTable"); + } +} + +static DWORD RtlAtomTestThread(LPVOID Table) +{ + RTL_ATOM_TABLE AtomTable = *(PRTL_ATOM_TABLE)Table; + RTL_ATOM Atom; + NTSTATUS res; + ULONG RefCount = 0, PinCount = 0, Len = 0; + WCHAR Name[64]; + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom1, &Atom); + ok(!res, "Unable to find atom from another thread, retval: %lx\n", res); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom2, &Atom); + ok(!res, "Unable to lookup pinned atom in table, retval: %lx\n", res); + + res = pRtlQueryAtomInAtomTable(AtomTable, Atom, &RefCount, &PinCount, Name, &Len); + ok(res == STATUS_BUFFER_TOO_SMALL, "We got wrong retval: %lx\n", res); + + Len = 64; + res = pRtlQueryAtomInAtomTable(AtomTable, Atom, &RefCount, &PinCount, Name, &Len); + ok(!res, "Failed with longenough buffer, retval: %lx\n", res); + ok(RefCount == 1, "Refcount was not 1 but %lx\n", RefCount); + ok(PinCount == 1, "Pincount was not 1 but %lx\n", PinCount); + ok(!strcmpW(Name, testAtom2), "We found wrong atom!!\n"); + ok((strlenW(testAtom2) * sizeof(WCHAR)) == Len, "Returned wrong length %ld\n", Len); + + Len = 64; + res = pRtlQueryAtomInAtomTable(AtomTable, Atom, NULL, NULL, Name, &Len); + ok(!res, "RtlQueryAtomInAtomTable with optional args invalid failed, retval: %lx\n", res); + ok(!strcmpW(Name, testAtom2), "Found Wrong atom!\n"); + ok((strlenW(testAtom2) * sizeof(WCHAR)) == Len, "Returned wrong length %ld\n", Len); + + res = pRtlPinAtomInAtomTable(AtomTable, Atom); + ok(!res, "Unable to pin atom in atom table, retval: %lx\n", res); + + return 0; +} + +static void test_NtAtom(void) +{ + RTL_ATOM_TABLE AtomTable = NULL; + NTSTATUS res; + RTL_ATOM Atom1, Atom2, Atom3, testEAtom, testAtom; + HANDLE testThread; + ULONG RefCount = 0, PinCount = 0, Len = 0; + WCHAR Name[64]; + + /* If we pass a non-null string to create atom table, then it thinks that we + * have passed it an already allocated atom table */ + res = pRtlCreateAtomTable(0, &AtomTable); + ok(!res, "RtlCreateAtomTable should succeed with an atom table size of 0\n"); + + if (!res) + { + res = pRtlDestroyAtomTable(AtomTable); + ok(!res, "We could create the atom table, but we couldn't destroy it! retval: %lx\n", res); + } + + AtomTable = NULL; + res = pRtlCreateAtomTable(37, &AtomTable); + ok(!res, "We're unable to create an atom table with a valid table size retval: %lx\n", res); + if (!res) + { + res = pRtlAddAtomToAtomTable(AtomTable, testAtom1, &Atom1); + ok(!res, "We were unable to add a simple atom to the atom table, retval: %lx\n", res); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom1Cap, &testAtom); + ok(!res, "We were unable to find capital version of the atom, retval: %lx\n", res); + ok(Atom1 == testAtom, "Found wrong atom in table when querying capital atom\n"); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom1Low, &testAtom); + ok(!res, "Unable to find lowercase version of the atom, retval: %lx\n", res); + ok(testAtom == Atom1, "Found wrong atom when querying lowercase atom\n"); + + res = pRtlAddAtomToAtomTable(AtomTable, EmptyAtom, &testEAtom); + ok(res == STATUS_OBJECT_NAME_INVALID, "Got wrong retval, retval: %lx\n", res); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom1, &testAtom); + ok(!res, "Failed to find totally legitimate atom, retval: %lx\n", res); + ok(testAtom == Atom1, "Found wrong atom!\n"); + + res = pRtlAddAtomToAtomTable(AtomTable, testAtom2, &Atom2); + ok(!res, "Unable to add other legitimate atom to table, retval: %lx\n", res); + + res = pRtlPinAtomInAtomTable(AtomTable, Atom2); + ok(!res, "Unable to pin atom in atom table, retval: %lx\n", res); + + testThread = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)RtlAtomTestThread, &AtomTable, 0, NULL); + WaitForSingleObject(testThread, INFINITE); + + Len = 64; + res = pRtlQueryAtomInAtomTable(AtomTable, Atom2, &RefCount, &PinCount, Name, &Len); + ok(!res, "Unable to query atom in atom table, retval: %lx\n", res); + ok(RefCount == 1, "RefCount is not 1 but %lx\n", RefCount); + ok(PinCount == 1, "PinCount is not 1 but %lx\n", PinCount); + ok(!strcmpW(Name, testAtom2), "We found wrong atom\n"); + ok((strlenW(testAtom2) * sizeof(WCHAR)) == Len, "Returned wrong length %ld\n", Len); + + res = pRtlEmptyAtomTable(AtomTable, FALSE); + ok(!res, "Unable to empty atom table, retval %lx\n", res); + + Len = 64; + res = pRtlQueryAtomInAtomTable(AtomTable, Atom2, &RefCount, &PinCount, Name, &Len); + ok(!res, "It seems RtlEmptyAtomTable deleted our pinned atom eaven though we asked it not to, retval: %lx\n", res); + ok(RefCount == 1, "RefCount is not 1 but %lx\n", RefCount); + ok(PinCount == 1, "PinCount is not 1 but %lx\n", PinCount); + ok(!strcmpW(Name, testAtom2), "We found wrong atom\n"); + ok((strlenW(testAtom2) * sizeof(WCHAR)) == Len, "Returned wrong length %ld\n", Len); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom2, &testAtom); + ok(!res, "We can't find our pinned atom!! retval: %lx\n", res); + ok(testAtom == Atom2, "We found wrong atom!!!\n"); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom1, &testAtom); + ok(res == STATUS_OBJECT_NAME_NOT_FOUND, "We found the atom in our table eaven though we asked RtlEmptyAtomTable to remove it, retval: %lx\n", res); + + res = pRtlAddAtomToAtomTable(AtomTable, testAtom3, &Atom3); + ok(!res, "Unable to add atom to table, retval: %lx\n", res); + + res = pRtlEmptyAtomTable(AtomTable, TRUE); + ok(!res, "Unable to empty atom table, retval: %lx\n", res); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom2, &testAtom); + ok(res == STATUS_OBJECT_NAME_NOT_FOUND, "The pinned atom should be removed, retval: %lx\n", res); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom3, &testAtom); + ok(res == STATUS_OBJECT_NAME_NOT_FOUND, "Non pinned atom should also be removed, retval: %lx\n", res); + + res = pRtlDestroyAtomTable(AtomTable); + ok(!res, "Can't destroy atom table, retval: %lx\n", res); + } + + AtomTable = NULL; + res = pRtlCreateAtomTable(37, &AtomTable); + ok(!res, "Unable to create atom table, retval: %lx\n", res); + + if (!res) + { + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom1, &testAtom); + ok(res == STATUS_OBJECT_NAME_NOT_FOUND, "Didn't get expected retval with querying an empty atom table, retval: %lx\n", res); + + res = pRtlAddAtomToAtomTable(AtomTable, testAtom1, &Atom1); + ok(!res, "Unable to add atom to atom table, retval %lx\n", res); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom1, &testAtom); + ok(!res, "Can't find previously added atom in table, retval: %lx\n", res); + ok(testAtom == Atom1, "Found wrong atom! retval: %lx\n", res); + + res = pRtlDeleteAtomFromAtomTable(AtomTable, Atom1); + ok(!res, "Unable to delete atom from table, retval: %lx\n", res); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom1, &testAtom); + ok(res == STATUS_OBJECT_NAME_NOT_FOUND, "Able to find previously deleted atom in table, retval: %lx\n", res); + + res = pRtlAddAtomToAtomTable(AtomTable, testAtom1, &Atom1); + ok(!res, "Unable to add atom to atom table, retval: %lx\n", res); + + Len = 0; + res = pRtlQueryAtomInAtomTable(AtomTable, Atom1, NULL, NULL, Name, &Len); + ok(res == STATUS_BUFFER_TOO_SMALL, "Got wrong retval, retval: %lx\n", res); + ok((strlenW(testAtom1) * sizeof(WCHAR)) == Len, "Got wrong length %lx\n", Len); + + res = pRtlPinAtomInAtomTable(AtomTable, Atom1); + ok(!res, "Unable to pin atom in atom table, retval: %lx\n", res); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom1, &testAtom); + ok(!res, "Unable to find atom in atom table, retval: %lx\n", res); + ok(testAtom == Atom1, "Wrong atom found\n"); + + res = pRtlDeleteAtomFromAtomTable(AtomTable, Atom1); + ok(res == STATUS_WAS_LOCKED, "Unable to delete atom from table, retval: %lx\n", res); + + res = pRtlLookupAtomInAtomTable(AtomTable, testAtom1, &testAtom); + ok(!res, "Able to find deleted atom in table\n"); + + res = pRtlDestroyAtomTable(AtomTable); + ok(!res, "Unable to destroy atom table\n"); + } +} + +/* Test Adding integer atoms to atom table */ +static void test_NtIntAtom(void) +{ + NTSTATUS res; + RTL_ATOM_TABLE AtomTable; + RTL_ATOM testAtom; + ULONG RefCount = 0, PinCount = 0; + int i; + WCHAR Name[64]; + ULONG Len; + + AtomTable = NULL; + res = pRtlCreateAtomTable(37, &AtomTable); + ok(!res, "Unable to create atom table, %lx\n", res); + + if (!res) + { + /* According to the kernel32 functions, integer atoms are only allowd from + * 0x0001 to 0xbfff and not 0xc000 to 0xffff, which is correct */ + res = pRtlAddAtomToAtomTable(AtomTable, (PWSTR)0, &testAtom); + ok(res == STATUS_INVALID_PARAMETER, "Didn't get expected result from adding 0 int atom, retval: %lx\n", res); + for (i = 1; i <= 0xbfff; i++) + { + res = pRtlAddAtomToAtomTable(AtomTable, (PWSTR)i, &testAtom); + ok(!res, "Unable to add valid integer atom %i, retval: %lx\n", i, res); + } + + for (i = 1; i <= 0xbfff; i++) + { + res = pRtlLookupAtomInAtomTable(AtomTable, (PWSTR)i, &testAtom); + ok(!res, "Unable to find int atom %i, retval: %lx\n", i, res); + if (!res) + { + res = pRtlPinAtomInAtomTable(AtomTable, testAtom); + ok(!res, "Unable to pin int atom %i, retval: %lx\n", i, res); + } + } + + for (i = 0xc000; i <= 0xffff; i++) + { + res = pRtlAddAtomToAtomTable(AtomTable, (PWSTR)i, &testAtom); + ok(res, "Able to illeageal integer atom %i, retval: %lx\n", i, res); + } + + res = pRtlDestroyAtomTable(AtomTable); + ok(!res, "Unable to destroy atom table, retval: %lx\n", res); + } + + AtomTable = NULL; + res = pRtlCreateAtomTable(37, &AtomTable); + ok(!res, "Unable to create atom table, %lx\n", res); + if (!res) + { + res = pRtlLookupAtomInAtomTable(AtomTable, (PWSTR)123, &testAtom); + ok(!res, "Unable to query atom in atom table, retval: %lx\n", res); + + res = pRtlAddAtomToAtomTable(AtomTable, testAtomInt, &testAtom); + ok(!res, "Unable to add int atom to table, retval: %lx\n", res); + + res = pRtlAddAtomToAtomTable(AtomTable, testAtomIntInv, &testAtom); + ok(!res, "Unable to add int atom to table, retval: %lx\n", res); + + res = pRtlAddAtomToAtomTable(AtomTable, (PWSTR)123, &testAtom); + ok(!res, "Unable to add int atom to table, retval: %lx\n", res); + + res = pRtlAddAtomToAtomTable(AtomTable, (PWSTR)123, &testAtom); + ok(!res, "Unable to re-add int atom to table, retval: %lx\n", res); + + Len = 64; + res = pRtlQueryAtomInAtomTable(AtomTable, testAtom, &RefCount, &PinCount, Name, &Len); + ok(!res, "Unable to query atom in atom table, retval: %lx\n", res); + ok(PinCount == 1, "Expected pincount 1 but got %lx\n", PinCount); + ok(RefCount == 1, "Expected refcount 1 but got %lx\n", RefCount); + ok(!strcmpW(testAtomOTT, Name), "Got wrong atom name\n"); + ok((strlenW(testAtomOTT) * sizeof(WCHAR)) == Len, "Got wrong len %ld\n", Len); + + res = pRtlPinAtomInAtomTable(AtomTable, testAtom); + ok(!res, "Unable to pin int atom, retval: %lx\n", res); + + res = pRtlPinAtomInAtomTable(AtomTable, testAtom); + ok(!res, "Unable to pin int atom, retval: %lx\n", res); + + res = pRtlQueryAtomInAtomTable(AtomTable, testAtom, &RefCount, &PinCount, NULL, NULL); + ok(!res, "Unable to query atom in atom table, retval: %lx\n", res); + ok(PinCount == 1, "Expected pincount 1 but got %lx\n", PinCount); + ok(RefCount == 1, "Expected refcount 1 but got %lx\n", RefCount); + + res = pRtlDestroyAtomTable(AtomTable); + ok(!res, "Unable to destroy atom table, retval: %lx\n", res); + } +} + +/* Tests to see how the pincount and refcount actually works */ +static void test_NtRefPinAtom(void) +{ + RTL_ATOM_TABLE AtomTable; + RTL_ATOM Atom; + ULONG PinCount = 0, RefCount = 0; + NTSTATUS res; + + AtomTable = NULL; + res = pRtlCreateAtomTable(37, &AtomTable); + ok(!res, "Unable to create atom table, %lx\n", res); + + if (!res) + { + res = pRtlAddAtomToAtomTable(AtomTable, testAtom1, &Atom); + ok(!res, "Unable to add our atom to the atom table, retval: %lx\n", res); + + res = pRtlAddAtomToAtomTable(AtomTable, testAtom1, &Atom); + ok(!res, "Unable to add our atom to the atom table, retval: %lx\n", res); + + res = pRtlAddAtomToAtomTable(AtomTable, testAtom1, &Atom); + ok(!res, "Unable to add our atom to the atom table, retval: %lx\n", res); + + res = pRtlQueryAtomInAtomTable(AtomTable, Atom, &RefCount, &PinCount, NULL, NULL); + ok(!res, "Unable to query atom in atom table, retval: %lx\n", res); + ok(PinCount == 0, "Expected pincount 0 but got %lx\n", PinCount); + ok(RefCount == 3, "Expected refcount 3 but got %lx\n", RefCount); + + res = pRtlPinAtomInAtomTable(AtomTable, Atom); + ok(!res, "Unable to pin atom in atom table, retval: %lx\n", res); + + res = pRtlPinAtomInAtomTable(AtomTable, Atom); + ok(!res, "Unable to pin atom in atom table, retval: %lx\n", res); + + res = pRtlPinAtomInAtomTable(AtomTable, Atom); + ok(!res, "Unable to pin atom in atom table, retval: %lx\n", res); + + res = pRtlQueryAtomInAtomTable(AtomTable, Atom, &RefCount, &PinCount, NULL, NULL); + ok(!res, "Unable to query atom in atom table, retval: %lx\n", res); + ok(PinCount == 1, "Expected pincount 1 but got %lx\n", PinCount); + ok(RefCount == 3, "Expected refcount 3 but got %lx\n", RefCount); + + res = pRtlDestroyAtomTable(AtomTable); + ok(!res, "Unable to destroy atom table, retval: %lx\n", res); + } +} + +START_TEST(atom) +{ + InitFunctionPtr(); + if (pRtlCreateAtomTable) + { + test_NtAtom(); + test_NtIntAtom(); + test_NtRefPinAtom(); + } +} Property changes on: trunk/reactos/regtests/winetests/ntdll/atom.c ___________________________________________________________________ Name: svn:executable + * _____
Added: trunk/reactos/regtests/winetests/ntdll/env.c --- trunk/reactos/regtests/winetests/ntdll/env.c 2005-08-07 01:23:40 UTC (rev 17132) +++ trunk/reactos/regtests/winetests/ntdll/env.c 2005-08-07 02:16:34 UTC (rev 17133) @@ -0,0 +1,298 @@
+/* + * Unit test suite for ntdll path functions + * + * Copyright 2003 Eric Pouech + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include <stdio.h> + +#include "ntdll_test.h" +#include "wine/unicode.h" + +static NTSTATUS (WINAPI *pRtlMultiByteToUnicodeN)( LPWSTR dst, DWORD dstlen, LPDWORD reslen, + LPCSTR src, DWORD srclen ); +static NTSTATUS (WINAPI *pRtlCreateEnvironment)(BOOLEAN, PWSTR*); +static NTSTATUS (WINAPI *pRtlDestroyEnvironment)(PWSTR); +static NTSTATUS (WINAPI *pRtlQueryEnvironmentVariable_U)(PWSTR, PUNICODE_STRING, PUNICODE_STRING); +static void (WINAPI *pRtlSetCurrentEnvironment)(PWSTR, PWSTR*); +static NTSTATUS (WINAPI *pRtlSetEnvironmentVariable)(PWSTR*, PUNICODE_STRING, PUNICODE_STRING); +static NTSTATUS (WINAPI *pRtlExpandEnvironmentStrings_U)(LPWSTR, PUNICODE_STRING, PUNICODE_STRING, PULONG); + +static WCHAR small_env[] = {'f','o','o','=','t','o','t','o',0, + 'f','o','=','t','i','t','i',0, + 'f','o','o','o','=','t','u','t','u',0, + 's','r','=','a','n','=','o','u','o',0, + 'g','=','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 'a','a','a','a','a','a','a','a','a', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 'a','a','a','a','a','a','a', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 'a','a','a','a','a','a','a', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 'a','a','a','a','a','a','a', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 'a','a','a','a','a','a','a', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 'a','a','a','a','a','a','a', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 'a','a','a','a','a','a','a', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 'a','a','a','a','a','a','a', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 'a','a','a','a','a','a','a', + 'a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a','a', 'a','a','a','a','a','a','a',0, + '=','o','O','H','=','I','I','I',0, + 'n','u','l','=',0, + 0}; + +static void testQuery(void) +{ + struct test + { + const char *var; + int len; + NTSTATUS status; + const char *val; + }; + + static const struct test tests[] = + { + {"foo", 256, STATUS_SUCCESS, "toto"}, + {"FoO", 256, STATUS_SUCCESS, "toto"}, + {"foo=", 256, STATUS_VARIABLE_NOT_FOUND, NULL}, + {"foo ", 256, STATUS_VARIABLE_NOT_FOUND, NULL}, + {"foo", 1, STATUS_BUFFER_TOO_SMALL, "toto"}, + {"foo", 3, STATUS_BUFFER_TOO_SMALL, "toto"}, + {"foo", 4, STATUS_SUCCESS, "toto"}, + {"fooo", 256, STATUS_SUCCESS, "tutu"}, + {"f", 256, STATUS_VARIABLE_NOT_FOUND, NULL}, + {"g", 256, STATUS_SUCCESS, "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaa" +"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaa"}, + {"sr=an", 256, STATUS_VARIABLE_NOT_FOUND, NULL}, + {"sr", 256, STATUS_SUCCESS, "an=ouo"}, + {"=oOH", 256, STATUS_SUCCESS, "III"}, + {"", 256, STATUS_VARIABLE_NOT_FOUND, NULL}, + {"nul", 256, STATUS_SUCCESS, ""}, + {NULL, 0, 0, NULL} + }; + + WCHAR bn[257]; + WCHAR bv[257]; + UNICODE_STRING name; + UNICODE_STRING value; + const struct test* test; + NTSTATUS nts; + + for (test = tests; test->var; test++) + { + name.Length = strlen(test->var) * 2; + name.MaximumLength = name.Length + 2; + name.Buffer = bn; + value.Length = 0; + value.MaximumLength = test->len * 2; + value.Buffer = bv; + bv[test->len] = '@'; + + pRtlMultiByteToUnicodeN( bn, sizeof(bn), NULL, test->var, strlen(test->var)+1 ); + nts = pRtlQueryEnvironmentVariable_U(small_env, &name, &value); + ok( nts == test->status, "[%d]: Wrong status for '%s', expecting %lx got %lx\n", + test - tests, test->var, test->status, nts ); + if (nts == test->status) switch (nts) + { + case STATUS_SUCCESS: + pRtlMultiByteToUnicodeN( bn, sizeof(bn), NULL, test->val, strlen(test->val)+1 ); + ok( value.Length == strlen(test->val) * sizeof(WCHAR), "Wrong length %d/%d for %s\n", + value.Length, strlen(test->val) * sizeof(WCHAR), test->var ); + ok((value.Length == strlen(test->val) * sizeof(WCHAR) && strncmpW(bv, bn, test->len) == 0) || + strcmpW(bv, bn) == 0, + "Wrong result for %s/%d\n", test->var, test->len); + ok(bv[test->len] == '@', "Writing too far away in the buffer for %s/%d\n", test->var, test->len); + break; + case STATUS_BUFFER_TOO_SMALL: + ok( value.Length == strlen(test->val) * sizeof(WCHAR), + "Wrong returned length %d/%d (too small buffer) for %s\n", + value.Length, strlen(test->val) * sizeof(WCHAR), test->var ); + break; + } + } +} + +static void testSetHelper(LPWSTR* env, const char* var, const char* val, NTSTATUS ret) +{ + WCHAR bvar[256], bval1[256], bval2[256]; + UNICODE_STRING uvar; + UNICODE_STRING uval; + NTSTATUS nts; + + uvar.Length = strlen(var) * sizeof(WCHAR); + uvar.MaximumLength = uvar.Length + sizeof(WCHAR); + uvar.Buffer = bvar; + pRtlMultiByteToUnicodeN( bvar, sizeof(bvar), NULL, var, strlen(var)+1 ); + if (val) + { + uval.Length = strlen(val) * sizeof(WCHAR); + uval.MaximumLength = uval.Length + sizeof(WCHAR); + uval.Buffer = bval1; + pRtlMultiByteToUnicodeN( bval1, sizeof(bval1), NULL, val, strlen(val)+1 ); + } + nts = pRtlSetEnvironmentVariable(env, &uvar, val ? &uval : NULL); + ok(nts == ret, "Setting var %s=%s (%lx/%lx)\n", var, val, nts, ret); + if (nts == STATUS_SUCCESS) + { + uval.Length = 0; + uval.MaximumLength = sizeof(bval2); + uval.Buffer = bval2; + nts = pRtlQueryEnvironmentVariable_U(*env, &uvar, &uval); + switch (nts) + { + case STATUS_SUCCESS: + ok(strcmpW(bval1, bval2) == 0, "Cannot get value written to environment\n"); + break; + case STATUS_VARIABLE_NOT_FOUND: + ok(val == NULL, "Couldn't find variable, but didn't delete it. val = %s\n", val); + break; + default: + ok(0, "Wrong ret %lu for %s\n", nts, var); + break; + } + } +} + +static void testSet(void) +{ + LPWSTR env; + char tmp[16]; + int i; + + ok(pRtlCreateEnvironment(FALSE, &env) == STATUS_SUCCESS, "Creating environment\n"); + memmove(env, small_env, sizeof(small_env)); + + testSetHelper(&env, "cat", "dog", STATUS_SUCCESS); + testSetHelper(&env, "cat", "horse", STATUS_SUCCESS); + testSetHelper(&env, "cat", "zz", STATUS_SUCCESS); + testSetHelper(&env, "cat", NULL, STATUS_SUCCESS); + testSetHelper(&env, "cat", NULL, STATUS_VARIABLE_NOT_FOUND); + testSetHelper(&env, "foo", "meouw", STATUS_SUCCESS); + testSetHelper(&env, "me=too", "also", STATUS_INVALID_PARAMETER); + testSetHelper(&env, "me", "too=also", STATUS_SUCCESS); + testSetHelper(&env, "=too", "also", STATUS_SUCCESS); + testSetHelper(&env, "=", "also", STATUS_SUCCESS); + + for (i = 0; i < 128; i++) + { + sprintf(tmp, "zork%03d", i); + testSetHelper(&env, tmp, "is alive", STATUS_SUCCESS); + } + + for (i = 0; i < 128; i++) + { + sprintf(tmp, "zork%03d", i); + testSetHelper(&env, tmp, NULL, STATUS_SUCCESS); + } + testSetHelper(&env, "fOo", NULL, STATUS_SUCCESS); + + ok(pRtlDestroyEnvironment(env) == STATUS_SUCCESS, "Destroying environment\n"); +} + +static void testExpand(void) +{ + static const struct test + { + const char *src; + const char *dst; + } tests[] = + { + {"hello%foo%world", "hellototoworld"}, + {"hello%=oOH%world", "helloIIIworld"}, + {"hello%foo", "hello%foo"}, + {"hello%bar%world", "hello%bar%world"}, + /* + * {"hello%foo%world%=oOH%eeck", "hellototoworldIIIeeck"}, + * Interestingly enough, with a 8 WCHAR buffers, we get on 2k: + * helloIII + * so it seems like strings overflowing the buffer are written + * (troncated) but the write cursor is not advanced :-/ + */ + {NULL, NULL} + }; + + const struct test* test; + NTSTATUS nts; + UNICODE_STRING us_src, us_dst; + WCHAR src[256], dst[256], rst[256]; + ULONG ul; + + for (test = tests; test->src; test++) + { + pRtlMultiByteToUnicodeN(src, sizeof(src), NULL, test->src, strlen(test->src)+1); + pRtlMultiByteToUnicodeN(rst, sizeof(rst), NULL, test->dst, strlen(test->dst)+1); + + us_src.Length = strlen(test->src) * sizeof(WCHAR); + us_src.MaximumLength = us_src.Length + 2; + us_src.Buffer = src; + + us_dst.Length = 0; + us_dst.MaximumLength = 0; + us_dst.Buffer = NULL; + + nts = pRtlExpandEnvironmentStrings_U(small_env, &us_src, &us_dst, &ul); + ok(ul == strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR), + "Wrong returned length for %s: %lu <> %u\n", + test->src, ul, strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR)); + + us_dst.Length = 0; + us_dst.MaximumLength = sizeof(dst); + us_dst.Buffer = dst; + + nts = pRtlExpandEnvironmentStrings_U(small_env, &us_src, &us_dst, &ul); + ok(nts == STATUS_SUCCESS, "Call failed (%lu)\n", nts); + ok(ul == us_dst.Length + sizeof(WCHAR), + "Wrong returned length for %s: %lu <> %u\n", + test->src, ul, us_dst.Length + sizeof(WCHAR)); + ok(ul == strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR), + "Wrong returned length for %s: %lu <> %u\n", + test->src, ul, strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR)); + ok(strcmpW(dst, rst) == 0, "Wrong result for %s: expecting %s\n", + test->src, test->dst); + + us_dst.Length = 0; + us_dst.MaximumLength = 8 * sizeof(WCHAR); + us_dst.Buffer = dst; + dst[8] = '-'; + nts = pRtlExpandEnvironmentStrings_U(small_env, &us_src, &us_dst, &ul); + ok(nts == STATUS_BUFFER_TOO_SMALL, "Call failed (%lu)\n", nts); + ok(ul == strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR), + "Wrong returned length for %s (with buffer too small): %lu <> %u\n", + test->src, ul, strlen(test->dst) * sizeof(WCHAR) + sizeof(WCHAR)); + ok(strncmpW(dst, rst, 8) == 0, + "Wrong result for %s (with buffer too small): expecting %s\n", + test->src, test->dst); + ok(dst[8] == '-', "Writing too far in buffer (got %c/%d)\n", dst[8], dst[8]); + } + +} + +START_TEST(env) +{ + HMODULE mod = GetModuleHandleA("ntdll.dll"); + + pRtlMultiByteToUnicodeN = (void *)GetProcAddress(mod,"RtlMultiByteToUnicodeN"); + pRtlCreateEnvironment = (void*)GetProcAddress(mod, "RtlCreateEnvironment"); + pRtlDestroyEnvironment = (void*)GetProcAddress(mod, "RtlDestroyEnvironment"); + pRtlQueryEnvironmentVariable_U = (void*)GetProcAddress(mod, "RtlQueryEnvironmentVariable_U"); + pRtlSetCurrentEnvironment = (void*)GetProcAddress(mod, "RtlSetCurrentEnvironment"); + pRtlSetEnvironmentVariable = (void*)GetProcAddress(mod, "RtlSetEnvironmentVariable"); + pRtlExpandEnvironmentStrings_U = (void*)GetProcAddress(mod, "RtlExpandEnvironmentStrings_U"); + + if (pRtlQueryEnvironmentVariable_U) + testQuery(); + if (pRtlSetEnvironmentVariable) + testSet(); + if (pRtlExpandEnvironmentStrings_U) + testExpand(); +} Property changes on: trunk/reactos/regtests/winetests/ntdll/env.c ___________________________________________________________________ Name: svn:executable + * _____
Added: trunk/reactos/regtests/winetests/ntdll/error.c --- trunk/reactos/regtests/winetests/ntdll/error.c 2005-08-07 01:23:40 UTC (rev 17132) +++ trunk/reactos/regtests/winetests/ntdll/error.c 2005-08-07 02:16:34 UTC (rev 17133) @@ -0,0 +1,950 @@
+/* + * Unit tests for RtlNtStatusToDosError function + * + * Copyright (c) 2002 Andriy Palamarchuk + * + * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#define _WIN32_WINNT 0x0501 + +#include <stdarg.h> +#include <stdio.h> + +#include "ntstatus.h" +#define WIN32_NO_STATUS + +#include "wine/test.h" + +#include "windows.h" + +#include "windef.h" +#include "winbase.h" +#include "rpcnterr.h" +#include "winreg.h" +#include "winternl.h" + +/* FIXME!!! this test checks only mappings, defined by MSDN: + * http://support.microsoft.com/default.aspx?scid=KB;EN-US;q113996& + * It is necessary to add other mappings and to test them up to Windows XP. + * + * Some Windows platforms don't know about all the mappings, and in such + * cases they return somewhat strange results (Win98) or a generic error + * like ERROR_MR_MID_NOT_FOUND (NT4). Our tests have to know about these to + * not fail, but we would very much prefer Wine not to return such garbage. + * To you can pass the 'strict' option to this test to force it to only check + * results against the first listed value. This test should pass in strict + * mode on the latest Windows platform (currently XP) and in Wine. + * (of course older Windows platforms will fail to pass the strict mode) + */ + +static ULONG (WINAPI *statustodoserror)(NTSTATUS Status); +static int strict; + +static int prepare_test(void) +{ + HMODULE ntdll; + int argc; + char** argv; + + ntdll = LoadLibraryA("ntdll.dll"); + statustodoserror = (void*)GetProcAddress(ntdll, "RtlNtStatusToDosError"); + if (!statustodoserror) + return 0; + + argc = winetest_get_mainargs(&argv); + strict=(argc >= 3 && strcmp(argv[2],"strict")==0); + return 1; +} + +static void cmp_call(NTSTATUS win_nt, ULONG win32, const char* message) +{ + ULONG err; + + err = statustodoserror(win_nt); + ok(err == win32, + "%s (%lx): got %ld, expected %ld\n", + message, win_nt, err, win32); +} + +static void cmp_call2(NTSTATUS win_nt, ULONG win32, const char* message) +{ + ULONG err; + + err = statustodoserror(win_nt); + ok(err == win32 || + (!strict && err == ERROR_MR_MID_NOT_FOUND), + "%s (%lx): got %ld, expected %ld (or MID_NOT_FOUND)\n", + message, win_nt, err, win32); +} + +static void cmp_call3(NTSTATUS win_nt, ULONG win32_1, ULONG win32_2, const char* message) +{ + ULONG err; + + err = statustodoserror(win_nt); + ok(err == win32_1 || (!strict && err == win32_2), + "%s (%lx): got %ld, expected %ld or %ld\n", + message, win_nt, err, win32_1, win32_2); +} + +static void cmp_call4(NTSTATUS win_nt, ULONG win32_1, ULONG win32_2, const char* message) +{ + ULONG err; + + err = statustodoserror(win_nt); + ok(err == win32_1 || + (!strict && (err == win32_2 || err == ERROR_MR_MID_NOT_FOUND)), + "%s (%lx): got %ld, expected %ld or %ld\n", + message, win_nt, err, win32_1, win32_2); +} + +#define cmp(status, error) \ + cmp_call(status, error, #status) +#define cmp2(status, error) \ + cmp_call2(status, error, #status) +#define cmp3(status, error1, error2) \ + cmp_call3(status, error1, error2, #status) +#define cmp4(status, error1, error2) \ + cmp_call4(status, error1, error2, #status) + +static void run_error_tests(void) +{ + cmp(STATUS_DATATYPE_MISALIGNMENT, ERROR_NOACCESS); + cmp(STATUS_ACCESS_VIOLATION, ERROR_NOACCESS); + cmp2(STATUS_DATATYPE_MISALIGNMENT_ERROR, ERROR_NOACCESS); + cmp(STATUS_CTL_FILE_NOT_SUPPORTED, ERROR_NOT_SUPPORTED); + cmp(STATUS_PORT_ALREADY_SET, ERROR_INVALID_PARAMETER); + cmp(STATUS_SECTION_NOT_IMAGE, ERROR_INVALID_PARAMETER); + cmp(STATUS_BAD_WORKING_SET_LIMIT, ERROR_INVALID_PARAMETER); + cmp(STATUS_WORKING_SET_LIMIT_RANGE, ERROR_INVALID_PARAMETER); + cmp(STATUS_INCOMPATIBLE_FILE_MAP, ERROR_INVALID_PARAMETER); + cmp(STATUS_PORT_DISCONNECTED, ERROR_INVALID_HANDLE); + cmp(STATUS_NOT_LOCKED, ERROR_NOT_LOCKED); + cmp(STATUS_NOT_MAPPED_VIEW, ERROR_INVALID_ADDRESS); + cmp(STATUS_UNABLE_TO_FREE_VM, ERROR_INVALID_PARAMETER); + cmp(STATUS_UNABLE_TO_DELETE_SECTION, ERROR_INVALID_PARAMETER); + cmp(STATUS_MORE_PROCESSING_REQUIRED, ERROR_MORE_DATA); + cmp(STATUS_INVALID_CID, ERROR_INVALID_PARAMETER); + cmp(STATUS_STACK_OVERFLOW, ERROR_STACK_OVERFLOW); + cmp(STATUS_BAD_INITIAL_STACK, ERROR_STACK_OVERFLOW); + cmp(STATUS_INVALID_VOLUME_LABEL, ERROR_LABEL_TOO_LONG); + cmp(STATUS_SECTION_NOT_EXTENDED, ERROR_OUTOFMEMORY); + cmp(STATUS_NOT_MAPPED_DATA, ERROR_INVALID_ADDRESS); + cmp2(STATUS_NO_LDT, ERROR_INVALID_THREAD_ID); + cmp(STATUS_INFO_LENGTH_MISMATCH, ERROR_BAD_LENGTH); + cmp(STATUS_INVALID_INFO_CLASS, ERROR_INVALID_PARAMETER); + cmp(STATUS_SUSPEND_COUNT_EXCEEDED, ERROR_SIGNAL_REFUSED); + cmp(STATUS_NOTIFY_ENUM_DIR, ERROR_NOTIFY_ENUM_DIR); + cmp(STATUS_REGISTRY_RECOVERED, ERROR_REGISTRY_RECOVERED); + cmp(STATUS_REGISTRY_IO_FAILED, ERROR_REGISTRY_IO_FAILED); + cmp(STATUS_NOT_REGISTRY_FILE, ERROR_NOT_REGISTRY_FILE); + cmp(STATUS_KEY_DELETED, ERROR_KEY_DELETED); + cmp(STATUS_NO_LOG_SPACE, ERROR_NO_LOG_SPACE); + cmp(STATUS_KEY_HAS_CHILDREN, ERROR_KEY_HAS_CHILDREN); + cmp(STATUS_CHILD_MUST_BE_VOLATILE, ERROR_CHILD_MUST_BE_VOLATILE); + cmp(STATUS_REGISTRY_CORRUPT, ERROR_BADDB); + cmp(STATUS_DLL_NOT_FOUND, ERROR_MOD_NOT_FOUND); + cmp(STATUS_DLL_INIT_FAILED, ERROR_DLL_INIT_FAILED); + cmp2(STATUS_INVALID_IMPORT_OF_NON_DLL, ERROR_INVALID_IMPORT_OF_NON_DLL); + cmp(STATUS_ORDINAL_NOT_FOUND, ERROR_INVALID_ORDINAL); + cmp(STATUS_DRIVER_ORDINAL_NOT_FOUND, ERROR_INVALID_ORDINAL); + cmp2(STATUS_DRIVER_UNABLE_TO_LOAD, ERROR_BAD_DRIVER); + cmp(STATUS_ENTRYPOINT_NOT_FOUND, ERROR_PROC_NOT_FOUND); + cmp(STATUS_DRIVER_ENTRYPOINT_NOT_FOUND, ERROR_PROC_NOT_FOUND); + cmp(STATUS_PENDING, ERROR_IO_PENDING); + cmp(STATUS_MORE_ENTRIES, ERROR_MORE_DATA); + cmp(STATUS_INTEGER_OVERFLOW, ERROR_ARITHMETIC_OVERFLOW); + cmp(STATUS_BUFFER_OVERFLOW, ERROR_MORE_DATA); + cmp(STATUS_NO_MORE_FILES, ERROR_NO_MORE_FILES); + cmp(STATUS_NO_INHERITANCE, ERROR_NO_INHERITANCE); + cmp(STATUS_NO_MORE_EAS, ERROR_NO_MORE_ITEMS); + cmp(STATUS_NO_MORE_ENTRIES, ERROR_NO_MORE_ITEMS); + cmp(STATUS_GUIDS_EXHAUSTED, ERROR_NO_MORE_ITEMS); + cmp(STATUS_AGENTS_EXHAUSTED, ERROR_NO_MORE_ITEMS); + cmp(STATUS_UNSUCCESSFUL, ERROR_GEN_FAILURE); + cmp(STATUS_TOO_MANY_LINKS, ERROR_TOO_MANY_LINKS); + cmp(STATUS_NOT_IMPLEMENTED, ERROR_INVALID_FUNCTION); + cmp(STATUS_ILLEGAL_FUNCTION, ERROR_INVALID_FUNCTION); + cmp(STATUS_IN_PAGE_ERROR, ERROR_SWAPERROR); + cmp(STATUS_PAGEFILE_QUOTA, ERROR_PAGEFILE_QUOTA); + cmp(STATUS_COMMITMENT_LIMIT, ERROR_COMMITMENT_LIMIT); + cmp(STATUS_SECTION_TOO_BIG, ERROR_NOT_ENOUGH_MEMORY); + cmp(RPC_NT_SS_IN_NULL_CONTEXT, ERROR_INVALID_HANDLE); + cmp(RPC_NT_INVALID_BINDING, ERROR_INVALID_HANDLE); + cmp(STATUS_INVALID_HANDLE, ERROR_INVALID_HANDLE); + cmp(STATUS_OBJECT_TYPE_MISMATCH, ERROR_INVALID_HANDLE); + cmp(STATUS_FILE_CLOSED, ERROR_INVALID_HANDLE); + cmp(STATUS_INVALID_PORT_HANDLE, ERROR_INVALID_HANDLE); + cmp(STATUS_HANDLE_NOT_CLOSABLE, ERROR_INVALID_HANDLE); + cmp(STATUS_NOT_COMMITTED, ERROR_INVALID_ADDRESS); + cmp(STATUS_PARTIAL_COPY, ERROR_PARTIAL_COPY); + cmp(STATUS_LPC_REPLY_LOST, ERROR_INTERNAL_ERROR); + cmp(STATUS_INVALID_PARAMETER, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_1, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_2, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_3, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_4, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_5, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_6, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_7, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_8, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_9, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_10, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_11, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_12, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PARAMETER_MIX, ERROR_INVALID_PARAMETER); + cmp(STATUS_INVALID_PAGE_PROTECTION, ERROR_INVALID_PARAMETER); + cmp(STATUS_SECTION_PROTECTION, ERROR_INVALID_PARAMETER); + cmp(STATUS_RESOURCE_DATA_NOT_FOUND, ERROR_RESOURCE_DATA_NOT_FOUND); + cmp(STATUS_RESOURCE_TYPE_NOT_FOUND, ERROR_RESOURCE_TYPE_NOT_FOUND); + cmp(STATUS_RESOURCE_NAME_NOT_FOUND, ERROR_RESOURCE_NAME_NOT_FOUND); + cmp(STATUS_RESOURCE_LANG_NOT_FOUND, ERROR_RESOURCE_LANG_NOT_FOUND); + cmp(STATUS_NO_SUCH_DEVICE, ERROR_FILE_NOT_FOUND); + cmp(STATUS_NO_SUCH_FILE, ERROR_FILE_NOT_FOUND); + cmp(STATUS_INVALID_DEVICE_REQUEST, ERROR_INVALID_FUNCTION); + cmp2(STATUS_VOLUME_NOT_UPGRADED, ERROR_INVALID_FUNCTION); + cmp(STATUS_END_OF_FILE, ERROR_HANDLE_EOF); + cmp(STATUS_FILE_FORCED_CLOSED, ERROR_HANDLE_EOF); + cmp(STATUS_WRONG_VOLUME, ERROR_WRONG_DISK); + cmp(STATUS_NO_MEDIA, ERROR_NO_MEDIA_IN_DRIVE); + cmp(STATUS_NO_MEDIA_IN_DEVICE, ERROR_NOT_READY); + cmp(STATUS_VOLUME_DISMOUNTED, ERROR_NOT_READY); + cmp(STATUS_NONEXISTENT_SECTOR, ERROR_SECTOR_NOT_FOUND); + cmp(STATUS_WORKING_SET_QUOTA, ERROR_WORKING_SET_QUOTA); + cmp(STATUS_NO_MEMORY, ERROR_NOT_ENOUGH_MEMORY); + cmp(STATUS_CONFLICTING_ADDRESSES, ERROR_INVALID_ADDRESS); + cmp(STATUS_INVALID_SYSTEM_SERVICE, ERROR_INVALID_FUNCTION); + cmp(STATUS_THREAD_IS_TERMINATING, ERROR_ACCESS_DENIED); + cmp(STATUS_PROCESS_IS_TERMINATING, ERROR_ACCESS_DENIED); + cmp(STATUS_INVALID_LOCK_SEQUENCE, ERROR_ACCESS_DENIED); + cmp(STATUS_INVALID_VIEW_SIZE, ERROR_ACCESS_DENIED); + cmp(STATUS_ALREADY_COMMITTED, ERROR_ACCESS_DENIED); + cmp(STATUS_ACCESS_DENIED, ERROR_ACCESS_DENIED); + cmp(STATUS_FILE_IS_A_DIRECTORY, ERROR_ACCESS_DENIED); + cmp(STATUS_CANNOT_DELETE, ERROR_ACCESS_DENIED); + cmp(STATUS_INVALID_COMPUTER_NAME, ERROR_INVALID_COMPUTERNAME); + cmp(STATUS_FILE_DELETED, ERROR_ACCESS_DENIED); + cmp2(STATUS_FILE_RENAMED, ERROR_ACCESS_DENIED); + cmp(STATUS_DELETE_PENDING, ERROR_ACCESS_DENIED); + cmp(STATUS_PORT_CONNECTION_REFUSED, ERROR_ACCESS_DENIED); + cmp(STATUS_NO_SUCH_PRIVILEGE, ERROR_NO_SUCH_PRIVILEGE); + cmp(STATUS_PRIVILEGE_NOT_HELD, ERROR_PRIVILEGE_NOT_HELD); + cmp(STATUS_CANNOT_IMPERSONATE, ERROR_CANNOT_IMPERSONATE); + cmp(STATUS_LOGON_FAILURE, ERROR_LOGON_FAILURE); + cmp2(STATUS_MUTUAL_AUTHENTICATION_FAILED, ERROR_MUTUAL_AUTH_FAILED); + cmp2(STATUS_TIME_DIFFERENCE_AT_DC, ERROR_TIME_SKEW); + cmp2(STATUS_PKINIT_FAILURE, ERROR_PKINIT_FAILURE); + cmp2(STATUS_SMARTCARD_SUBSYSTEM_FAILURE, ERROR_SMARTCARD_SUBSYSTEM_FAILURE); + cmp2(STATUS_DOWNGRADE_DETECTED, ERROR_DOWNGRADE_DETECTED); + cmp2(STATUS_SMARTCARD_CERT_REVOKED, SEC_E_SMARTCARD_CERT_REVOKED); + cmp2(STATUS_ISSUING_CA_UNTRUSTED, SEC_E_ISSUING_CA_UNTRUSTED); + cmp2(STATUS_REVOCATION_OFFLINE_C, SEC_E_REVOCATION_OFFLINE_C); + cmp2(STATUS_PKINIT_CLIENT_FAILURE, SEC_E_PKINIT_CLIENT_FAILURE); + cmp2(STATUS_SMARTCARD_CERT_EXPIRED, SEC_E_SMARTCARD_CERT_EXPIRED); + cmp2(STATUS_NO_KERB_KEY, SEC_E_NO_KERB_KEY); + cmp2(STATUS_CURRENT_DOMAIN_NOT_ALLOWED, ERROR_CURRENT_DOMAIN_NOT_ALLOWED); + cmp2(STATUS_SMARTCARD_WRONG_PIN, SCARD_W_WRONG_CHV); + cmp2(STATUS_SMARTCARD_CARD_BLOCKED, SCARD_W_CHV_BLOCKED); + cmp2(STATUS_SMARTCARD_CARD_NOT_AUTHENTICATED,SCARD_W_CARD_NOT_AUTHENTICA TED); + cmp2(STATUS_SMARTCARD_NO_CARD, SCARD_E_NO_SMARTCARD); + cmp2(STATUS_SMARTCARD_NO_KEY_CONTAINER, NTE_NO_KEY); + cmp2(STATUS_SMARTCARD_NO_CERTIFICATE, SCARD_E_NO_SUCH_CERTIFICATE); + cmp2(STATUS_SMARTCARD_NO_KEYSET, NTE_BAD_KEYSET); + cmp2(STATUS_SMARTCARD_IO_ERROR, SCARD_E_COMM_DATA_LOST); + cmp(STATUS_ACCOUNT_RESTRICTION, ERROR_ACCOUNT_RESTRICTION); + cmp(STATUS_INVALID_LOGON_HOURS, ERROR_INVALID_LOGON_HOURS); + cmp(STATUS_INVALID_WORKSTATION, ERROR_INVALID_WORKSTATION); + cmp(STATUS_BUFFER_TOO_SMALL, ERROR_INSUFFICIENT_BUFFER); + cmp(STATUS_UNABLE_TO_DECOMMIT_VM, ERROR_INVALID_ADDRESS); + cmp(STATUS_DISK_CORRUPT_ERROR, ERROR_DISK_CORRUPT); + cmp(STATUS_FT_MISSING_MEMBER, ERROR_IO_DEVICE); + cmp(STATUS_FT_ORPHANING, ERROR_IO_DEVICE); + cmp(STATUS_VARIABLE_NOT_FOUND, ERROR_ENVVAR_NOT_FOUND); + cmp(STATUS_OBJECT_NAME_INVALID, ERROR_INVALID_NAME); + cmp(STATUS_OBJECT_NAME_NOT_FOUND, ERROR_FILE_NOT_FOUND); [truncated at 1000 lines; 9790 more skipped]