Commit 76e48978 authored by Alexandre Julliard's avatar Alexandre Julliard

ntdll: Move more object manager functions to the Unix library.

parent 28bf959c
......@@ -159,7 +159,7 @@
@ stdcall NtConnectPort(ptr ptr ptr ptr ptr ptr ptr ptr)
@ stdcall -syscall NtContinue(ptr long)
# @ stub NtCreateDebugObject
@ stdcall NtCreateDirectoryObject(ptr long ptr)
@ stdcall -syscall NtCreateDirectoryObject(ptr long ptr)
@ stdcall -syscall NtCreateEvent(ptr long ptr long long)
@ stub NtCreateEventPair
@ stdcall -syscall NtCreateFile(ptr long ptr ptr ptr long long long long ptr long)
......@@ -181,7 +181,7 @@
@ stub NtCreateProfile
@ stdcall -syscall NtCreateSection(ptr long ptr ptr long long long)
@ stdcall -syscall NtCreateSemaphore(ptr long ptr long long)
@ stdcall NtCreateSymbolicLinkObject(ptr long ptr ptr)
@ stdcall -syscall NtCreateSymbolicLinkObject(ptr long ptr ptr)
@ stub NtCreateThread
@ stdcall -syscall NtCreateThreadEx(ptr long ptr long ptr ptr long long long long ptr)
@ stdcall -syscall NtCreateTimer(ptr long ptr long)
......@@ -242,7 +242,7 @@
# @ stub NtLockRegistryKey
@ stdcall -syscall NtLockVirtualMemory(long ptr ptr long)
# @ stub NtMakePermanentObject
@ stdcall NtMakeTemporaryObject(long)
@ stdcall -syscall NtMakeTemporaryObject(long)
# @ stub NtMapUserPhysicalPages
# @ stub NtMapUserPhysicalPagesScatter
@ stdcall -syscall NtMapViewOfSection(long long ptr long long ptr ptr long long long)
......@@ -250,7 +250,7 @@
@ stdcall -syscall NtNotifyChangeDirectoryFile(long long ptr ptr ptr ptr long long long)
@ stdcall -syscall NtNotifyChangeKey(long long ptr ptr ptr long long ptr long long)
@ stdcall -syscall NtNotifyChangeMultipleKeys(long long ptr long ptr ptr ptr long long ptr long long)
@ stdcall NtOpenDirectoryObject(ptr long ptr)
@ stdcall -syscall NtOpenDirectoryObject(ptr long ptr)
@ stdcall -syscall NtOpenEvent(ptr long ptr)
@ stub NtOpenEventPair
@ stdcall -syscall NtOpenFile(ptr long ptr ptr long long)
......@@ -268,7 +268,7 @@
@ stdcall NtOpenProcessTokenEx(long long long ptr)
@ stdcall -syscall NtOpenSection(ptr long ptr)
@ stdcall -syscall NtOpenSemaphore(ptr long ptr)
@ stdcall NtOpenSymbolicLinkObject (ptr long ptr)
@ stdcall -syscall NtOpenSymbolicLinkObject (ptr long ptr)
@ stdcall -syscall NtOpenThread(ptr long ptr ptr)
@ stdcall NtOpenThreadToken(long long long ptr)
@ stdcall NtOpenThreadTokenEx(long long long long ptr)
......@@ -287,7 +287,7 @@
@ stdcall NtQueryDefaultLocale(long ptr)
@ stdcall NtQueryDefaultUILanguage(ptr)
@ stdcall -syscall NtQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long)
@ stdcall NtQueryDirectoryObject(long ptr long long long ptr ptr)
@ stdcall -syscall NtQueryDirectoryObject(long ptr long long long ptr ptr)
@ stdcall -syscall NtQueryEaFile(long ptr ptr long long ptr long ptr long)
@ stdcall -syscall NtQueryEvent(long long ptr long ptr)
@ stdcall -syscall NtQueryFullAttributesFile(ptr ptr)
......@@ -313,7 +313,7 @@
@ stdcall -syscall NtQuerySection(long long ptr long ptr)
@ stdcall NtQuerySecurityObject(long long ptr long ptr)
@ stdcall -syscall NtQuerySemaphore (long long ptr long ptr)
@ stdcall NtQuerySymbolicLinkObject(long ptr ptr)
@ stdcall -syscall NtQuerySymbolicLinkObject(long ptr ptr)
@ stdcall NtQuerySystemEnvironmentValue(ptr ptr long ptr)
@ stdcall NtQuerySystemEnvironmentValueEx(ptr ptr ptr ptr ptr)
@ stdcall -syscall NtQuerySystemInformation(long ptr long ptr)
......@@ -1148,7 +1148,7 @@
@ stdcall -private ZwConnectPort(ptr ptr ptr ptr ptr ptr ptr ptr) NtConnectPort
@ stdcall -private -syscall ZwContinue(ptr long) NtContinue
# @ stub ZwCreateDebugObject
@ stdcall -private ZwCreateDirectoryObject(ptr long ptr) NtCreateDirectoryObject
@ stdcall -private -syscall ZwCreateDirectoryObject(ptr long ptr) NtCreateDirectoryObject
@ stdcall -private -syscall ZwCreateEvent(ptr long ptr long long) NtCreateEvent
@ stub ZwCreateEventPair
@ stdcall -private -syscall ZwCreateFile(ptr long ptr ptr ptr long long long long ptr long) NtCreateFile
......@@ -1169,7 +1169,7 @@
@ stub ZwCreateProfile
@ stdcall -private -syscall ZwCreateSection(ptr long ptr ptr long long long) NtCreateSection
@ stdcall -private -syscall ZwCreateSemaphore(ptr long ptr long long) NtCreateSemaphore
@ stdcall -private ZwCreateSymbolicLinkObject(ptr long ptr ptr) NtCreateSymbolicLinkObject
@ stdcall -private -syscall ZwCreateSymbolicLinkObject(ptr long ptr ptr) NtCreateSymbolicLinkObject
@ stub ZwCreateThread
@ stdcall -private -syscall ZwCreateThreadEx(ptr long ptr long ptr ptr long long long long ptr) NtCreateThreadEx
@ stdcall -private -syscall ZwCreateTimer(ptr long ptr long) NtCreateTimer
......@@ -1229,7 +1229,7 @@
# @ stub ZwLockRegistryKey
@ stdcall -private -syscall ZwLockVirtualMemory(long ptr ptr long) NtLockVirtualMemory
# @ stub ZwMakePermanentObject
@ stdcall -private ZwMakeTemporaryObject(long) NtMakeTemporaryObject
@ stdcall -private -syscall ZwMakeTemporaryObject(long) NtMakeTemporaryObject
# @ stub ZwMapUserPhysicalPages
# @ stub ZwMapUserPhysicalPagesScatter
@ stdcall -private -syscall ZwMapViewOfSection(long long ptr long long ptr ptr long long long) NtMapViewOfSection
......@@ -1237,7 +1237,7 @@
@ stdcall -private -syscall ZwNotifyChangeDirectoryFile(long long ptr ptr ptr ptr long long long) NtNotifyChangeDirectoryFile
@ stdcall -private -syscall ZwNotifyChangeKey(long long ptr ptr ptr long long ptr long long) NtNotifyChangeKey
@ stdcall -private -syscall ZwNotifyChangeMultipleKeys(long long ptr long ptr ptr ptr long long ptr long long) NtNotifyChangeMultipleKeys
@ stdcall -private ZwOpenDirectoryObject(ptr long ptr) NtOpenDirectoryObject
@ stdcall -private -syscall ZwOpenDirectoryObject(ptr long ptr) NtOpenDirectoryObject
@ stdcall -private -syscall ZwOpenEvent(ptr long ptr) NtOpenEvent
@ stub ZwOpenEventPair
@ stdcall -private -syscall ZwOpenFile(ptr long ptr ptr long long) NtOpenFile
......@@ -1255,7 +1255,7 @@
@ stdcall -private ZwOpenProcessTokenEx(long long long ptr) NtOpenProcessTokenEx
@ stdcall -private -syscall ZwOpenSection(ptr long ptr) NtOpenSection
@ stdcall -private -syscall ZwOpenSemaphore(ptr long ptr) NtOpenSemaphore
@ stdcall -private ZwOpenSymbolicLinkObject (ptr long ptr) NtOpenSymbolicLinkObject
@ stdcall -private -syscall ZwOpenSymbolicLinkObject (ptr long ptr) NtOpenSymbolicLinkObject
@ stdcall -private -syscall ZwOpenThread(ptr long ptr ptr) NtOpenThread
@ stdcall -private ZwOpenThreadToken(long long long ptr) NtOpenThreadToken
@ stdcall -private ZwOpenThreadTokenEx(long long long long ptr) NtOpenThreadTokenEx
......@@ -1274,7 +1274,7 @@
@ stdcall -private ZwQueryDefaultLocale(long ptr) NtQueryDefaultLocale
@ stdcall -private ZwQueryDefaultUILanguage(ptr) NtQueryDefaultUILanguage
@ stdcall -private -syscall ZwQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long) NtQueryDirectoryFile
@ stdcall -private ZwQueryDirectoryObject(long ptr long long long ptr ptr) NtQueryDirectoryObject
@ stdcall -private -syscall ZwQueryDirectoryObject(long ptr long long long ptr ptr) NtQueryDirectoryObject
@ stdcall -private -syscall ZwQueryEaFile(long ptr ptr long long ptr long ptr long) NtQueryEaFile
@ stdcall -private -syscall ZwQueryEvent(long long ptr long ptr) NtQueryEvent
@ stdcall -private -syscall ZwQueryFullAttributesFile(ptr ptr) NtQueryFullAttributesFile
......@@ -1300,7 +1300,7 @@
@ stdcall -private -syscall ZwQuerySection(long long ptr long ptr) NtQuerySection
@ stdcall -private ZwQuerySecurityObject(long long ptr long ptr) NtQuerySecurityObject
@ stdcall -private -syscall ZwQuerySemaphore(long long ptr long ptr) NtQuerySemaphore
@ stdcall -private ZwQuerySymbolicLinkObject(long ptr ptr) NtQuerySymbolicLinkObject
@ stdcall -private -syscall ZwQuerySymbolicLinkObject(long ptr ptr) NtQuerySymbolicLinkObject
@ stdcall -private ZwQuerySystemEnvironmentValue(ptr ptr long ptr) NtQuerySystemEnvironmentValue
@ stdcall -private ZwQuerySystemEnvironmentValueEx(ptr ptr ptr ptr ptr) NtQuerySystemEnvironmentValueEx
@ stdcall -private -syscall ZwQuerySystemInformation(long ptr long ptr) NtQuerySystemInformation
......
......@@ -73,7 +73,6 @@ extern NTSTATUS restart_process( RTL_USER_PROCESS_PARAMETERS *params, NTSTATUS s
extern BOOL is_wow64 DECLSPEC_HIDDEN;
extern NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_attributes **ret,
data_size_t *ret_len ) DECLSPEC_HIDDEN;
extern NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr ) DECLSPEC_HIDDEN;
/* module handling */
extern LIST_ENTRY tls_links DECLSPEC_HIDDEN;
......
......@@ -122,19 +122,6 @@ NTSTATUS alloc_object_attributes( const OBJECT_ATTRIBUTES *attr, struct object_a
return STATUS_SUCCESS;
}
NTSTATUS validate_open_object_attributes( const OBJECT_ATTRIBUTES *attr )
{
if (!attr || attr->Length != sizeof(*attr)) return STATUS_INVALID_PARAMETER;
if (attr->ObjectName)
{
if (attr->ObjectName->Length & (sizeof(WCHAR) - 1)) return STATUS_OBJECT_NAME_INVALID;
}
else if (attr->RootDirectory) return STATUS_OBJECT_NAME_INVALID;
return STATUS_SUCCESS;
}
/*
* Timers
*/
......
......@@ -905,6 +905,207 @@ NTSTATUS WINAPI NtAssignProcessToJobObject( HANDLE job, HANDLE process )
/**************************************************************************
* NtCreateDirectoryObject (NTDLL.@)
*/
NTSTATUS WINAPI NtCreateDirectoryObject( HANDLE *handle, ACCESS_MASK access, OBJECT_ATTRIBUTES *attr )
{
NTSTATUS ret;
data_size_t len;
struct object_attributes *objattr;
if (!handle) return STATUS_ACCESS_VIOLATION;
if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret;
SERVER_START_REQ( create_directory )
{
req->access = access;
wine_server_add_data( req, objattr, len );
ret = wine_server_call( req );
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
free( objattr );
return ret;
}
/**************************************************************************
* NtOpenDirectoryObject (NTDLL.@)
*/
NTSTATUS WINAPI NtOpenDirectoryObject( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr )
{
NTSTATUS ret;
if (!handle) return STATUS_ACCESS_VIOLATION;
if ((ret = validate_open_object_attributes( attr ))) return ret;
SERVER_START_REQ( open_directory )
{
req->access = access;
req->attributes = attr->Attributes;
req->rootdir = wine_server_obj_handle( attr->RootDirectory );
if (attr->ObjectName)
wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length );
ret = wine_server_call( req );
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
}
/**************************************************************************
* NtQueryDirectoryObject (NTDLL.@)
*/
NTSTATUS WINAPI NtQueryDirectoryObject( HANDLE handle, DIRECTORY_BASIC_INFORMATION *buffer,
ULONG size, BOOLEAN single_entry, BOOLEAN restart,
ULONG *context, ULONG *ret_size )
{
NTSTATUS ret;
if (restart) *context = 0;
if (single_entry)
{
if (size <= sizeof(*buffer) + 2 * sizeof(WCHAR)) return STATUS_BUFFER_OVERFLOW;
SERVER_START_REQ( get_directory_entry )
{
req->handle = wine_server_obj_handle( handle );
req->index = *context;
wine_server_set_reply( req, buffer + 1, size - sizeof(*buffer) - 2*sizeof(WCHAR) );
if (!(ret = wine_server_call( req )))
{
buffer->ObjectName.Buffer = (WCHAR *)(buffer + 1);
buffer->ObjectName.Length = reply->name_len;
buffer->ObjectName.MaximumLength = reply->name_len + sizeof(WCHAR);
buffer->ObjectTypeName.Buffer = (WCHAR *)(buffer + 1) + reply->name_len/sizeof(WCHAR) + 1;
buffer->ObjectTypeName.Length = wine_server_reply_size( reply ) - reply->name_len;
buffer->ObjectTypeName.MaximumLength = buffer->ObjectTypeName.Length + sizeof(WCHAR);
/* make room for the terminating null */
memmove( buffer->ObjectTypeName.Buffer, buffer->ObjectTypeName.Buffer - 1,
buffer->ObjectTypeName.Length );
buffer->ObjectName.Buffer[buffer->ObjectName.Length/sizeof(WCHAR)] = 0;
buffer->ObjectTypeName.Buffer[buffer->ObjectTypeName.Length/sizeof(WCHAR)] = 0;
(*context)++;
}
}
SERVER_END_REQ;
if (ret_size)
*ret_size = buffer->ObjectName.MaximumLength + buffer->ObjectTypeName.MaximumLength + sizeof(*buffer);
}
else
{
FIXME("multiple entries not implemented\n");
ret = STATUS_NOT_IMPLEMENTED;
}
return ret;
}
/**************************************************************************
* NtCreateSymbolicLinkObject (NTDLL.@)
*/
NTSTATUS WINAPI NtCreateSymbolicLinkObject( HANDLE *handle, ACCESS_MASK access,
OBJECT_ATTRIBUTES *attr, UNICODE_STRING *target )
{
NTSTATUS ret;
data_size_t len;
struct object_attributes *objattr;
if (!handle || !attr || !target) return STATUS_ACCESS_VIOLATION;
if (!target->Buffer) return STATUS_INVALID_PARAMETER;
if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret;
SERVER_START_REQ( create_symlink )
{
req->access = access;
wine_server_add_data( req, objattr, len );
wine_server_add_data( req, target->Buffer, target->Length );
ret = wine_server_call( req );
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
free( objattr );
return ret;
}
/**************************************************************************
* NtOpenSymbolicLinkObject (NTDLL.@)
*/
NTSTATUS WINAPI NtOpenSymbolicLinkObject( HANDLE *handle, ACCESS_MASK access,
const OBJECT_ATTRIBUTES *attr )
{
NTSTATUS ret;
if (!handle) return STATUS_ACCESS_VIOLATION;
if ((ret = validate_open_object_attributes( attr ))) return ret;
SERVER_START_REQ( open_symlink )
{
req->access = access;
req->attributes = attr->Attributes;
req->rootdir = wine_server_obj_handle( attr->RootDirectory );
if (attr->ObjectName)
wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length );
ret = wine_server_call( req );
*handle = wine_server_ptr_handle( reply->handle );
}
SERVER_END_REQ;
return ret;
}
/**************************************************************************
* NtQuerySymbolicLinkObject (NTDLL.@)
*/
NTSTATUS WINAPI NtQuerySymbolicLinkObject( HANDLE handle, UNICODE_STRING *target, ULONG *length )
{
NTSTATUS ret;
if (!target) return STATUS_ACCESS_VIOLATION;
SERVER_START_REQ( query_symlink )
{
req->handle = wine_server_obj_handle( handle );
if (target->MaximumLength >= sizeof(WCHAR))
wine_server_set_reply( req, target->Buffer, target->MaximumLength - sizeof(WCHAR) );
if (!(ret = wine_server_call( req )))
{
target->Length = wine_server_reply_size(reply);
target->Buffer[target->Length / sizeof(WCHAR)] = 0;
if (length) *length = reply->total + sizeof(WCHAR);
}
else if (length && ret == STATUS_BUFFER_TOO_SMALL) *length = reply->total + sizeof(WCHAR);
}
SERVER_END_REQ;
return ret;
}
/**************************************************************************
* NtMakeTemporaryObject (NTDLL.@)
*/
NTSTATUS WINAPI NtMakeTemporaryObject( HANDLE handle )
{
NTSTATUS ret;
TRACE("%p\n", handle);
SERVER_START_REQ( make_temporary )
{
req->handle = wine_server_obj_handle( handle );
ret = wine_server_call( req );
}
SERVER_END_REQ;
return ret;
}
/**************************************************************************
* NtCreateTimer (NTDLL.@)
*/
NTSTATUS WINAPI NtCreateTimer( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr,
......
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