diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index b54ba82f750..676fa2c8907 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -215,7 +215,7 @@ @ stub NtSetHighWaitLowThread @ stdcall NtSetInformationFile(long long long long long) @ stdcall NtSetInformationKey(long long ptr long) -@ stub NtSetInformationObject +@ stdcall NtSetInformationObject(long long ptr long) @ stdcall NtSetInformationProcess(long long long long) @ stdcall NtSetInformationThread(long long long long) @ stub NtSetInformationToken @@ -742,7 +742,7 @@ @ stub ZwSetHighWaitLowThread @ stdcall ZwSetInformationFile(long long long long long) NtSetInformationFile @ stdcall ZwSetInformationKey(long long ptr long) NtSetInformationKey -@ stub ZwSetInformationObject +@ stdcall ZwSetInformationObject(long long ptr long) NtSetInformationObject @ stdcall ZwSetInformationProcess(long long long long) NtSetInformationProcess @ stdcall ZwSetInformationThread(long long long long) NtSetInformationThread @ stub ZwSetInformationToken diff --git a/dlls/ntdll/om.c b/dlls/ntdll/om.c index c998b6fc0c0..7aef800120b 100644 --- a/dlls/ntdll/om.c +++ b/dlls/ntdll/om.c @@ -47,16 +47,91 @@ typedef void * POBJDIR_INFORMATION; * NtQueryObject [NTDLL.@] * ZwQueryObject [NTDLL.@] */ -NTSTATUS WINAPI NtQueryObject( - IN HANDLE ObjectHandle, - IN OBJECT_INFORMATION_CLASS ObjectInformationClass, - OUT PVOID ObjectInformation, - IN ULONG Length, - OUT PULONG ResultLength) +NTSTATUS WINAPI NtQueryObject(IN HANDLE handle, + IN OBJECT_INFORMATION_CLASS info_class, + OUT PVOID ptr, IN ULONG len, OUT PULONG used_len) { - FIXME("(%p,0x%08x,%p,0x%08lx,%p): stub\n", - ObjectHandle, ObjectInformationClass, ObjectInformation, Length, ResultLength); - return 0; + NTSTATUS status; + + TRACE("(%p,0x%08x,%p,0x%08lx,%p): stub\n", + handle, info_class, ptr, len, used_len); + + if (used_len) *used_len = 0; + + switch (info_class) + { + case ObjectDataInformation: + { + OBJECT_DATA_INFORMATION* p = (OBJECT_DATA_INFORMATION*)ptr; + + if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE; + + SERVER_START_REQ( set_handle_info ) + { + req->handle = handle; + req->flags = 0; + req->mask = 0; + req->fd = -1; + status = wine_server_call( req ); + if (status == STATUS_SUCCESS) + { + p->InheritHandle = (reply->old_flags & HANDLE_FLAG_INHERIT) ? TRUE : FALSE; + p->ProtectFromClose = (reply->old_flags & HANDLE_FLAG_PROTECT_FROM_CLOSE) ? TRUE : FALSE; + if (used_len) *used_len = sizeof(*p); + } + } + SERVER_END_REQ; + } + break; + default: + FIXME("Unsupported information class %u\n", info_class); + status = STATUS_NOT_IMPLEMENTED; + break; + } + return status; +} + +/****************************************************************** + * NtSetInformationObject [NTDLL.@] + * ZwSetInformationObject [NTDLL.@] + * + */ +NTSTATUS WINAPI NtSetInformationObject(IN HANDLE handle, + IN OBJECT_INFORMATION_CLASS info_class, + IN PVOID ptr, IN ULONG len) +{ + NTSTATUS status; + + TRACE("(%p,0x%08x,%p,0x%08lx): stub\n", + handle, info_class, ptr, len); + + switch (info_class) + { + case ObjectDataInformation: + { + OBJECT_DATA_INFORMATION* p = (OBJECT_DATA_INFORMATION*)ptr; + + if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE; + + SERVER_START_REQ( set_handle_info ) + { + req->handle = handle; + req->flags = 0; + req->mask = HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE; + req->fd = -1; + if (p->InheritHandle) req->flags |= HANDLE_FLAG_INHERIT; + if (p->ProtectFromClose) req->flags |= HANDLE_FLAG_PROTECT_FROM_CLOSE; + status = wine_server_call( req ); + } + SERVER_END_REQ; + } + break; + default: + FIXME("Unsupported information class %u\n", info_class); + status = STATUS_NOT_IMPLEMENTED; + break; + } + return status; } /****************************************************************************** diff --git a/include/winternl.h b/include/winternl.h index 831398d1a0a..7efa558f465 100644 --- a/include/winternl.h +++ b/include/winternl.h @@ -229,7 +229,11 @@ typedef enum _KEY_VALUE_INFORMATION_CLASS { } KEY_VALUE_INFORMATION_CLASS; typedef enum _OBJECT_INFORMATION_CLASS { - DunnoTheConstants1 /* FIXME */ + ObjectBasicInformation, + ObjectNameInformation, + ObjectTypeInformation, + ObjectAllInformation, + ObjectDataInformation } OBJECT_INFORMATION_CLASS, *POBJECT_INFORMATION_CLASS; typedef enum _PROCESSINFOCLASS { @@ -499,6 +503,11 @@ typedef struct _OBJECT_ATTRIBUTES { PVOID SecurityQualityOfService; /* type SECURITY_QUALITY_OF_SERVICE */ } OBJECT_ATTRIBUTES, *POBJECT_ATTRIBUTES; +typedef struct _OBJECT_DATA_INFORMATION { + BOOLEAN InheritHandle; + BOOLEAN ProtectFromClose; +} OBJECT_DATA_INFORMATION, *POBJECT_DATA_INFORMATION; + typedef struct _PROCESS_BASIC_INFORMATION { #ifdef __WINESRC__ DWORD ExitStatus; @@ -896,6 +905,7 @@ NTSTATUS WINAPI NtQueryInformationThread(HANDLE,THREADINFOCLASS,PVOID,ULONG,PUL NTSTATUS WINAPI NtQueryInformationToken(HANDLE,DWORD,LPVOID,DWORD,LPDWORD); NTSTATUS WINAPI NtQueryKey(HKEY,KEY_INFORMATION_CLASS,void *,DWORD,DWORD *); NTSTATUS WINAPI NtQueryMultipleValueKey(HKEY,PVALENTW,ULONG,PVOID,ULONG,PULONG); +NTSTATUS WINAPI NtQueryObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG); NTSTATUS WINAPI NtQuerySecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR,ULONG,PULONG); NTSTATUS WINAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS,PVOID,ULONG,PULONG); NTSTATUS WINAPI NtQuerySystemTime(PLARGE_INTEGER); @@ -913,6 +923,7 @@ NTSTATUS WINAPI NtSetContextThread(HANDLE,const CONTEXT*); NTSTATUS WINAPI NtSetDefaultLocale(BOOLEAN,LCID); NTSTATUS WINAPI NtSetEvent(HANDLE,PULONG); NTSTATUS WINAPI NtSetInformationKey(HKEY,const int,PVOID,ULONG); +NTSTATUS WINAPI NtSetInformationObject(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG); NTSTATUS WINAPI NtSetSecurityObject(HANDLE,SECURITY_INFORMATION,PSECURITY_DESCRIPTOR); NTSTATUS WINAPI NtSetSystemTime(const LARGE_INTEGER*,LARGE_INTEGER*); NTSTATUS WINAPI NtSetTimer(HANDLE, const LARGE_INTEGER*, PTIMERAPCROUTINE, PVOID, BOOLEAN, ULONG, BOOLEAN*);