17 const WCHAR szUserNameFromNull[] =
L"(unknown)";
30 pCachedGetUserFromSid(
NULL, szUserName, &cchUserName);
31 ok(cchUserName == cchUserNameFromNull,
"cchUserName: expected %lu, got %lu\n", cchUserNameFromNull, cchUserName);
32 ok(
wcscmp(szUserName, szUserNameFromNull) == 0,
"szUserName: expected \"%S\", got \"%.*S\"\n", szUserNameFromNull, (
int)cchUserName, szUserName);
36 pCachedGetUserFromSid(
NULL, szUserName, &cchUserName);
37 ok(cchUserName == 0,
"cchUserName: expected 0, got %lu\n", cchUserName);
38 ok(szUserName[0] ==
UNICODE_NULL,
"szUserName: missing UNICODE_NULL, got \"%.*S\"\n", (
int)cchUserName, szUserName);
42 pCachedGetUserFromSid(
NULL, szUserName, &cchUserName);
43 ok(cchUserName == 1,
"cchUserName: expected 0, got %lu\n", cchUserName);
44 ok(szUserName[1] ==
UNICODE_NULL,
"szUserName: missing UNICODE_NULL, got \"%.*S\"\n", (
int)cchUserName, szUserName);
45 ok(
wcsncmp(szUserName, szUserNameFromNull, 1) == 0,
"szUserName: expected \"%.*S\", got \"%.*S\"\n", 1, szUserNameFromNull, (
int)cchUserName, szUserName);
48 cchUserName = cchUserNameFromNull;
49 pCachedGetUserFromSid(
NULL, szUserName, &cchUserName);
50 ok(cchUserName == cchUserNameFromNull - 1,
"cchUserName: expected %lu, got %lu\n", cchUserNameFromNull - 1, cchUserName);
51 ok(szUserName[cchUserNameFromNull - 1] ==
UNICODE_NULL,
"szUserName: missing UNICODE_NULL, got \"%.*S\"\n", (
int)cchUserName, szUserName);
52 ok(
wcsncmp(szUserName, szUserNameFromNull, cchUserNameFromNull - 1) == 0,
"szUserName: expected \"%.*S\", got \"%.*S\"\n", (
int)cchUserNameFromNull - 1, szUserNameFromNull, (
int)cchUserName, szUserName);
55 cchUserName = cchUserNameFromNull + 1;
56 pCachedGetUserFromSid(
NULL, szUserName, &cchUserName);
57 ok(cchUserName == cchUserNameFromNull,
"cchUserName: expected %lu, got %lu\n", cchUserNameFromNull, cchUserName);
58 ok(
wcscmp(szUserName, szUserNameFromNull) == 0,
"szUserName: expected \"%S\", got \"%.*S\"\n", szUserNameFromNull, (
int)cchUserName, szUserName);
63 const char szFunction[] =
"CachedGetUserFromSid";
74 ok(
FALSE,
"LoadLibraryW(\"%S\") failed! (dwLE = %lu)\n",
L"utildll.dll", dwLE);
83 ok(
FALSE,
"GetProcAddress(\"%s\") failed! (dwLE = %lu)\n", szFunction, dwLE);
84 skip(
"No function\n");
89 pCachedGetUserFromSid = pFunction;
static void test_Sid_Null(void)
static LPWSTR PULONG pcwcUserName
#define GetProcAddress(x, y)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
wchar_t *__cdecl wmemset(_Out_writes_all_(_N) wchar_t *_S, _In_ wchar_t _C, _In_ size_t _N)
VOID WINAPI CachedGetUserFromSid(PSID pSid, LPWSTR pUserName, PULONG pcwcUserName)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_Check_return_ _CRTIMP int __cdecl wcsncmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
DWORD WINAPI GetLastError(void)