diff --git a/dlls/wow64/struct32.h b/dlls/wow64/struct32.h index e8b2e22cdcf..23144e9e15a 100644 --- a/dlls/wow64/struct32.h +++ b/dlls/wow64/struct32.h @@ -31,4 +31,10 @@ typedef struct ULONG SecurityQualityOfService; } OBJECT_ATTRIBUTES32; +typedef struct +{ + UNICODE_STRING32 ObjectName; + UNICODE_STRING32 ObjectTypeName; +} DIRECTORY_BASIC_INFORMATION32; + #endif /* __WOW64_STRUCT32_H */ diff --git a/dlls/wow64/sync.c b/dlls/wow64/sync.c index 596e90bc71d..55c0ed08e32 100644 --- a/dlls/wow64/sync.c +++ b/dlls/wow64/sync.c @@ -27,6 +27,9 @@ #include "winnt.h" #include "winternl.h" #include "wow64_private.h" +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(wow); /********************************************************************** @@ -52,6 +55,26 @@ NTSTATUS WINAPI wow64_NtClearEvent( UINT *args ) } +/********************************************************************** + * wow64_NtCreateDirectoryObject + */ +NTSTATUS WINAPI wow64_NtCreateDirectoryObject( UINT *args ) +{ + ULONG *handle_ptr = get_ptr( &args ); + ACCESS_MASK access = get_ulong( &args ); + OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args ); + + struct object_attr64 attr; + HANDLE handle = 0; + NTSTATUS status; + + *handle_ptr = 0; + status = NtCreateDirectoryObject( &handle, access, objattr_32to64( &attr, attr32 )); + put_handle( handle_ptr, handle ); + return status; +} + + /********************************************************************** * wow64_NtCreateEvent */ @@ -159,6 +182,26 @@ NTSTATUS WINAPI wow64_NtCreateTimer( UINT *args ) } +/********************************************************************** + * wow64_NtOpenDirectoryObject + */ +NTSTATUS WINAPI wow64_NtOpenDirectoryObject( UINT *args ) +{ + ULONG *handle_ptr = get_ptr( &args ); + ACCESS_MASK access = get_ulong( &args ); + OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args ); + + struct object_attr64 attr; + HANDLE handle = 0; + NTSTATUS status; + + *handle_ptr = 0; + status = NtOpenDirectoryObject( &handle, access, objattr_32to64( &attr, attr32 )); + put_handle( handle_ptr, handle ); + return status; +} + + /********************************************************************** * wow64_NtOpenEvent */ @@ -271,6 +314,43 @@ NTSTATUS WINAPI wow64_NtPulseEvent( UINT *args ) } +/********************************************************************** + * wow64_NtQueryDirectoryObject + */ +NTSTATUS WINAPI wow64_NtQueryDirectoryObject( UINT *args ) +{ + HANDLE handle = get_handle( &args ); + DIRECTORY_BASIC_INFORMATION32 *info32 = get_ptr( &args ); + ULONG size32 = get_ulong( &args ); + BOOLEAN single_entry = get_ulong( &args ); + BOOLEAN restart = get_ulong( &args ); + ULONG *context = get_ptr( &args ); + ULONG *retlen = get_ptr( &args ); + + NTSTATUS status; + DIRECTORY_BASIC_INFORMATION *info; + ULONG size = size32 + sizeof(*info) - sizeof(*info32); + + if (!single_entry) FIXME( "not implemented\n" ); + info = RtlAllocateHeap( GetProcessHeap(), 0, size ); + status = NtQueryDirectoryObject( handle, info, size, single_entry, restart, context, NULL ); + if (!status) + { + info32->ObjectName.Buffer = PtrToUlong( info32 + 1 ); + info32->ObjectName.Length = info->ObjectName.Length; + info32->ObjectName.MaximumLength = info->ObjectName.MaximumLength; + info32->ObjectTypeName.Buffer = info32->ObjectName.Buffer + info->ObjectName.MaximumLength; + info32->ObjectTypeName.Length = info->ObjectTypeName.Length; + info32->ObjectTypeName.MaximumLength = info->ObjectTypeName.MaximumLength; + size = info->ObjectName.MaximumLength + info->ObjectTypeName.MaximumLength; + memcpy( info32 + 1, info + 1, size ); + if (retlen) *retlen = sizeof(*info32) + size; + } + RtlFreeHeap( GetProcessHeap(), 0, info ); + return status; +} + + /********************************************************************** * wow64_NtQueryEvent */ diff --git a/dlls/wow64/syscall.h b/dlls/wow64/syscall.h index db2b386fe24..b64cabd15b5 100644 --- a/dlls/wow64/syscall.h +++ b/dlls/wow64/syscall.h @@ -28,6 +28,7 @@ SYSCALL_ENTRY( NtCancelTimer ) \ SYSCALL_ENTRY( NtClearEvent ) \ SYSCALL_ENTRY( NtClose ) \ + SYSCALL_ENTRY( NtCreateDirectoryObject ) \ SYSCALL_ENTRY( NtCreateEvent ) \ SYSCALL_ENTRY( NtCreateKeyedEvent ) \ SYSCALL_ENTRY( NtCreateMutant ) \ @@ -36,6 +37,7 @@ SYSCALL_ENTRY( NtDeleteAtom ) \ SYSCALL_ENTRY( NtFindAtom ) \ SYSCALL_ENTRY( NtGetCurrentProcessorNumber ) \ + SYSCALL_ENTRY( NtOpenDirectoryObject ) \ SYSCALL_ENTRY( NtOpenEvent ) \ SYSCALL_ENTRY( NtOpenKeyedEvent ) \ SYSCALL_ENTRY( NtOpenMutant ) \ @@ -44,6 +46,7 @@ SYSCALL_ENTRY( NtPulseEvent ) \ SYSCALL_ENTRY( NtQueryDefaultLocale ) \ SYSCALL_ENTRY( NtQueryDefaultUILanguage ) \ + SYSCALL_ENTRY( NtQueryDirectoryObject ) \ SYSCALL_ENTRY( NtQueryEvent ) \ SYSCALL_ENTRY( NtQueryInformationAtom ) \ SYSCALL_ENTRY( NtQueryInstallUILanguage ) \