- Implement RtlFindCharInUnicodeString

- Implement RtlInitializeSListHead, RtlFirstEntrySList, RtlQueryDepthSList
Based on Wine implementation

svn path=/trunk/; revision=36931
This commit is contained in:
Dmitry Chapyshev 2008-10-25 07:12:41 +00:00
parent 7661ad3e1c
commit df2aabc6ab
2 changed files with 187 additions and 96 deletions

View file

@ -19,21 +19,33 @@ VOID
NTAPI NTAPI
RtlInitializeSListHead(IN PSLIST_HEADER ListHead) RtlInitializeSListHead(IN PSLIST_HEADER ListHead)
{ {
#ifdef _WIN64
UNIMPLEMENTED; UNIMPLEMENTED;
#else
ListHead->Alignment = 0;
#endif
} }
PSLIST_ENTRY PSLIST_ENTRY
NTAPI NTAPI
RtlFirstEntrySList(IN const SLIST_HEADER *ListHead) RtlFirstEntrySList(IN const SLIST_HEADER *ListHead)
{ {
#ifdef _WIN64
UNIMPLEMENTED; UNIMPLEMENTED;
return NULL; return NULL;
#else
return ListHead->Next.Next;
#endif
} }
WORD WORD
NTAPI NTAPI
RtlQueryDepthSList(IN PSLIST_HEADER ListHead) RtlQueryDepthSList(IN PSLIST_HEADER ListHead)
{ {
#ifdef _WIN64
UNIMPLEMENTED; UNIMPLEMENTED;
return 0; return 0;
#else
return ListHead->Depth;
#endif
} }

View file

@ -2240,6 +2240,85 @@ RtlFindCharInUnicodeString(IN ULONG Flags,
IN PCUNICODE_STRING MatchString, IN PCUNICODE_STRING MatchString,
OUT PUSHORT Position) OUT PUSHORT Position)
{ {
UNIMPLEMENTED; int main_idx;
return STATUS_NOT_IMPLEMENTED; unsigned int search_idx;
switch (Flags)
{
case 0:
{
for (main_idx = 0; main_idx < SearchString->Length / sizeof(WCHAR); main_idx++)
{
for (search_idx = 0; search_idx < MatchString->Length / sizeof(WCHAR); search_idx++)
{
if (SearchString->Buffer[main_idx] == MatchString->Buffer[search_idx])
{
*Position = (main_idx + 1) * sizeof(WCHAR);
return STATUS_SUCCESS;
}
}
}
*Position = 0;
return STATUS_NOT_FOUND;
}
case 1:
{
for (main_idx = SearchString->Length / sizeof(WCHAR) - 1; main_idx >= 0; main_idx--)
{
for (search_idx = 0; search_idx < MatchString->Length / sizeof(WCHAR); search_idx++)
{
if (SearchString->Buffer[main_idx] == MatchString->Buffer[search_idx])
{
*Position = main_idx * sizeof(WCHAR);
return STATUS_SUCCESS;
}
}
}
*Position = 0;
return STATUS_NOT_FOUND;
}
case 2:
{
for (main_idx = 0; main_idx < SearchString->Length / sizeof(WCHAR); main_idx++)
{
search_idx = 0;
while (search_idx < MatchString->Length / sizeof(WCHAR) &&
SearchString->Buffer[main_idx] != MatchString->Buffer[search_idx])
{
search_idx++;
}
if (search_idx >= MatchString->Length / sizeof(WCHAR))
{
*Position = (main_idx + 1) * sizeof(WCHAR);
return STATUS_SUCCESS;
}
}
*Position = 0;
return STATUS_NOT_FOUND;
}
case 3:
{
for (main_idx = SearchString->Length / sizeof(WCHAR) - 1; main_idx >= 0; main_idx--)
{
search_idx = 0;
while (search_idx < MatchString->Length / sizeof(WCHAR) &&
SearchString->Buffer[main_idx] != MatchString->Buffer[search_idx])
{
search_idx++;
}
if (search_idx >= MatchString->Length / sizeof(WCHAR))
{
*Position = main_idx * sizeof(WCHAR);
return STATUS_SUCCESS;
}
}
*Position = 0;
return STATUS_NOT_FOUND;
}
} /* switch */
return STATUS_NOT_FOUND;
} }