Commit e8d7af2d authored by Rob Shearman's avatar Rob Shearman Committed by Alexandre Julliard

advapi32: Implement filter matching for CredEnumerate.

parent e6f28ebb
......@@ -676,10 +676,40 @@ BOOL WINAPI CredEnumerateA(LPCSTR Filter, DWORD Flags, DWORD *Count,
static BOOL credential_matches_filter(HKEY hkeyCred, LPCWSTR filter)
{
LPWSTR target_name;
DWORD ret;
DWORD type;
DWORD count;
LPCWSTR p;
if (!filter) return TRUE;
FIXME("%s\n", debugstr_w(filter));
return TRUE;
ret = RegQueryValueExW(hkeyCred, NULL, 0, &type, NULL, &count);
if (ret != ERROR_SUCCESS)
return FALSE;
else if (type != REG_SZ)
return FALSE;
target_name = HeapAlloc(GetProcessHeap(), 0, count);
if (!target_name)
return FALSE;
ret = RegQueryValueExW(hkeyCred, NULL, 0, &type, (LPVOID)target_name, &count);
if (ret != ERROR_SUCCESS || type != REG_SZ)
{
HeapFree(GetProcessHeap(), 0, target_name);
return FALSE;
}
TRACE("comparing filter %s to target name %s\n", debugstr_w(filter),
debugstr_w(target_name));
p = strchrW(filter, '*');
ret = CompareStringW(GetThreadLocale(), 0, filter,
(p && !p[1] ? p - filter : -1), target_name,
(p && !p[1] ? p - filter : -1)) == CSTR_EQUAL;
HeapFree(GetProcessHeap(), 0, target_name);
return ret;
}
/******************************************************************************
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment