ntdll: Implement ApiSetQueryApiSetPresence/Ex().

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2022-02-22 12:35:18 +01:00
parent 7b233f3032
commit cb2fb8c25e
5 changed files with 48 additions and 15 deletions

View File

@ -1468,7 +1468,6 @@ static void test_apisets(void)
win_skip( "ApiSetQueryApiSetPresence not implemented\n" );
return;
}
todo_wine
if (!pApiSetQueryApiSetPresenceEx) win_skip( "ApiSetQueryApiSetPresenceEx not implemented\n" );
todo_wine
if (!pIsApiSetImplemented) win_skip( "IsApiSetImplemented not implemented\n" );
@ -1480,9 +1479,7 @@ static void test_apisets(void)
winetest_push_context( "%u:%s", i, tests[i].name );
present = 0xff;
status = pApiSetQueryApiSetPresence( &name, &present );
todo_wine
ok( status == STATUS_SUCCESS, "wrong ret %x\n", status );
todo_wine_if( !tests[i].present )
ok( present == tests[i].present || broken(!present && tests[i].broken) /* win8 */,
"wrong present %u\n", present );
if (pApiSetQueryApiSetPresenceEx)

View File

@ -4526,6 +4526,51 @@ void WINAPI RtlReleasePath( PWSTR path )
}
/*********************************************************************
* ApiSetQueryApiSetPresence (NTDLL.@)
*/
NTSTATUS WINAPI ApiSetQueryApiSetPresence( const UNICODE_STRING *name, BOOLEAN *present )
{
const API_SET_NAMESPACE *map = NtCurrentTeb()->Peb->ApiSetMap;
const API_SET_NAMESPACE_ENTRY *entry;
UNICODE_STRING str;
*present = (!get_apiset_entry( map, name->Buffer, name->Length / sizeof(WCHAR), &entry ) &&
!get_apiset_target( map, entry, NULL, &str ));
return STATUS_SUCCESS;
}
/*********************************************************************
* ApiSetQueryApiSetPresenceEx (NTDLL.@)
*/
NTSTATUS WINAPI ApiSetQueryApiSetPresenceEx( const UNICODE_STRING *name, BOOLEAN *in_schema, BOOLEAN *present )
{
const API_SET_NAMESPACE *map = NtCurrentTeb()->Peb->ApiSetMap;
const API_SET_NAMESPACE_ENTRY *entry;
NTSTATUS status;
UNICODE_STRING str;
ULONG i, len = name->Length / sizeof(WCHAR);
/* extension not allowed */
for (i = 0; i < len; i++) if (name->Buffer[i] == '.') return STATUS_INVALID_PARAMETER;
status = get_apiset_entry( map, name->Buffer, len, &entry );
if (status == STATUS_APISET_NOT_PRESENT)
{
*in_schema = *present = FALSE;
return STATUS_SUCCESS;
}
if (status) return status;
/* the name must match exactly */
*in_schema = (entry->NameLength == name->Length &&
!wcsnicmp( (WCHAR *)((char *)map + entry->NameOffset), name->Buffer, len ));
*present = *in_schema && !get_apiset_target( map, entry, NULL, &str );
return STATUS_SUCCESS;
}
/******************************************************************
* DllMain (NTDLL.@)
*/

View File

@ -381,15 +381,3 @@ ULONG WINAPIV EtwTraceMessage( TRACEHANDLE handle, ULONG flags, LPGUID guid, /*U
va_end( valist );
return ret;
}
/*********************************************************************
* ApiSetQueryApiSetPresence (NTDLL.@)
*/
BOOL WINAPI ApiSetQueryApiSetPresence(const UNICODE_STRING *namespace, BOOLEAN *present)
{
FIXME("(%s, %p) stub!\n", debugstr_us(namespace), present);
if(present)
*present = TRUE;
return TRUE;
}

View File

@ -7,6 +7,7 @@
@ stdcall A_SHAInit(ptr)
@ stdcall A_SHAUpdate(ptr ptr long)
@ stdcall ApiSetQueryApiSetPresence(ptr ptr)
@ stdcall ApiSetQueryApiSetPresenceEx(ptr ptr ptr)
@ stub CsrAllocateCaptureBuffer
@ stub CsrAllocateCapturePointer
@ stub CsrAllocateMessagePointer

View File

@ -3866,6 +3866,8 @@ typedef struct _API_SET_VALUE_ENTRY
* Function declarations
*/
NTSYSAPI NTSTATUS WINAPI ApiSetQueryApiSetPresence(const UNICODE_STRING*,BOOLEAN*);
NTSYSAPI NTSTATUS WINAPI ApiSetQueryApiSetPresenceEx(const UNICODE_STRING*,BOOLEAN*,BOOLEAN*);
NTSYSAPI void WINAPI DbgBreakPoint(void);
NTSYSAPI NTSTATUS WINAPIV DbgPrint(LPCSTR fmt, ...);
NTSYSAPI NTSTATUS WINAPIV DbgPrintEx(ULONG iComponentId, ULONG Level, LPCSTR fmt, ...);