ntdll: Partially implement RtlRandomEx().
[wine.git] / dlls / ntdll / om.c
blob0b56251348949acfdc7977e64c97d11a344be6fc
1 /*
2 * Object management functions
4 * Copyright 1999, 2000 Juergen Schmied
5 * Copyright 2005 Vitaliy Margolen
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 #include "config.h"
24 #include <stdarg.h>
25 #include <stdlib.h>
26 #include <string.h>
27 #ifdef HAVE_IO_H
28 # include <io.h>
29 #endif
30 #ifdef HAVE_UNISTD_H
31 # include <unistd.h>
32 #endif
34 #include "ntstatus.h"
35 #define WIN32_NO_STATUS
36 #include "wine/debug.h"
37 #include "windef.h"
38 #include "winternl.h"
39 #include "ntdll_misc.h"
40 #include "wine/server.h"
41 #include "wine/exception.h"
43 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
47 * Generic object functions
50 /******************************************************************************
51 * NtQueryObject [NTDLL.@]
52 * ZwQueryObject [NTDLL.@]
54 NTSTATUS WINAPI NtQueryObject(IN HANDLE handle,
55 IN OBJECT_INFORMATION_CLASS info_class,
56 OUT PVOID ptr, IN ULONG len, OUT PULONG used_len)
58 NTSTATUS status;
60 TRACE("(%p,0x%08x,%p,0x%08x,%p)\n", handle, info_class, ptr, len, used_len);
62 if (used_len) *used_len = 0;
64 switch (info_class)
66 case ObjectBasicInformation:
68 POBJECT_BASIC_INFORMATION p = ptr;
70 if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
72 SERVER_START_REQ( get_object_info )
74 req->handle = wine_server_obj_handle( handle );
75 status = wine_server_call( req );
76 if (status == STATUS_SUCCESS)
78 memset( p, 0, sizeof(*p) );
79 p->GrantedAccess = reply->access;
80 p->PointerCount = reply->ref_count;
81 p->HandleCount = reply->handle_count;
82 if (used_len) *used_len = sizeof(*p);
85 SERVER_END_REQ;
87 break;
88 case ObjectNameInformation:
90 OBJECT_NAME_INFORMATION* p = ptr;
91 ANSI_STRING unix_name;
93 /* first try as a file object */
95 if (!(status = server_get_unix_name( handle, &unix_name )))
97 UNICODE_STRING nt_name;
99 if (!(status = wine_unix_to_nt_file_name( &unix_name, &nt_name )))
101 if (len < sizeof(*p))
102 status = STATUS_INFO_LENGTH_MISMATCH;
103 else if (len < sizeof(*p) + nt_name.MaximumLength)
104 status = STATUS_BUFFER_OVERFLOW;
105 else
107 p->Name.Buffer = (WCHAR *)(p + 1);
108 p->Name.Length = nt_name.Length;
109 p->Name.MaximumLength = nt_name.MaximumLength;
110 memcpy( p->Name.Buffer, nt_name.Buffer, nt_name.MaximumLength );
112 if (used_len) *used_len = sizeof(*p) + nt_name.MaximumLength;
113 RtlFreeUnicodeString( &nt_name );
115 RtlFreeAnsiString( &unix_name );
116 break;
118 else if (status != STATUS_OBJECT_TYPE_MISMATCH) break;
120 /* not a file, treat as a generic object */
122 SERVER_START_REQ( get_object_info )
124 req->handle = wine_server_obj_handle( handle );
125 if (len > sizeof(*p)) wine_server_set_reply( req, p + 1, len - sizeof(*p) );
126 status = wine_server_call( req );
127 if (status == STATUS_SUCCESS)
129 if (!reply->total) /* no name */
131 if (sizeof(*p) > len) status = STATUS_INFO_LENGTH_MISMATCH;
132 else memset( p, 0, sizeof(*p) );
133 if (used_len) *used_len = sizeof(*p);
135 else if (sizeof(*p) + reply->total + sizeof(WCHAR) > len)
137 if (used_len) *used_len = sizeof(*p) + reply->total + sizeof(WCHAR);
138 status = STATUS_INFO_LENGTH_MISMATCH;
140 else
142 ULONG res = wine_server_reply_size( reply );
143 p->Name.Buffer = (WCHAR *)(p + 1);
144 p->Name.Length = res;
145 p->Name.MaximumLength = res + sizeof(WCHAR);
146 p->Name.Buffer[res / sizeof(WCHAR)] = 0;
147 if (used_len) *used_len = sizeof(*p) + p->Name.MaximumLength;
151 SERVER_END_REQ;
153 break;
154 case ObjectTypeInformation:
156 OBJECT_TYPE_INFORMATION *p = ptr;
158 SERVER_START_REQ( get_object_type )
160 req->handle = wine_server_obj_handle( handle );
161 if (len > sizeof(*p)) wine_server_set_reply( req, p + 1, len - sizeof(*p) );
162 status = wine_server_call( req );
163 if (status == STATUS_SUCCESS)
165 if (!reply->total) /* no name */
167 if (sizeof(*p) > len) status = STATUS_INFO_LENGTH_MISMATCH;
168 else memset( p, 0, sizeof(*p) );
169 if (used_len) *used_len = sizeof(*p);
171 else if (sizeof(*p) + reply->total + sizeof(WCHAR) > len)
173 if (used_len) *used_len = sizeof(*p) + reply->total + sizeof(WCHAR);
174 status = STATUS_INFO_LENGTH_MISMATCH;
176 else
178 ULONG res = wine_server_reply_size( reply );
179 p->TypeName.Buffer = (WCHAR *)(p + 1);
180 p->TypeName.Length = res;
181 p->TypeName.MaximumLength = res + sizeof(WCHAR);
182 p->TypeName.Buffer[res / sizeof(WCHAR)] = 0;
183 if (used_len) *used_len = sizeof(*p) + p->TypeName.MaximumLength;
187 SERVER_END_REQ;
189 break;
190 case ObjectDataInformation:
192 OBJECT_DATA_INFORMATION* p = ptr;
194 if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
196 SERVER_START_REQ( set_handle_info )
198 req->handle = wine_server_obj_handle( handle );
199 req->flags = 0;
200 req->mask = 0;
201 status = wine_server_call( req );
202 if (status == STATUS_SUCCESS)
204 p->InheritHandle = (reply->old_flags & HANDLE_FLAG_INHERIT) != 0;
205 p->ProtectFromClose = (reply->old_flags & HANDLE_FLAG_PROTECT_FROM_CLOSE) != 0;
206 if (used_len) *used_len = sizeof(*p);
209 SERVER_END_REQ;
211 break;
212 default:
213 FIXME("Unsupported information class %u\n", info_class);
214 status = STATUS_NOT_IMPLEMENTED;
215 break;
217 return status;
220 /******************************************************************
221 * NtSetInformationObject [NTDLL.@]
222 * ZwSetInformationObject [NTDLL.@]
225 NTSTATUS WINAPI NtSetInformationObject(IN HANDLE handle,
226 IN OBJECT_INFORMATION_CLASS info_class,
227 IN PVOID ptr, IN ULONG len)
229 NTSTATUS status;
231 TRACE("(%p,0x%08x,%p,0x%08x)\n", handle, info_class, ptr, len);
233 switch (info_class)
235 case ObjectDataInformation:
237 OBJECT_DATA_INFORMATION* p = ptr;
239 if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
241 SERVER_START_REQ( set_handle_info )
243 req->handle = wine_server_obj_handle( handle );
244 req->flags = 0;
245 req->mask = HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE;
246 if (p->InheritHandle) req->flags |= HANDLE_FLAG_INHERIT;
247 if (p->ProtectFromClose) req->flags |= HANDLE_FLAG_PROTECT_FROM_CLOSE;
248 status = wine_server_call( req );
250 SERVER_END_REQ;
252 break;
253 default:
254 FIXME("Unsupported information class %u\n", info_class);
255 status = STATUS_NOT_IMPLEMENTED;
256 break;
258 return status;
261 /******************************************************************************
262 * NtQuerySecurityObject [NTDLL.@]
264 * An ntdll analogue to GetKernelObjectSecurity().
267 NTSTATUS WINAPI
268 NtQuerySecurityObject(
269 IN HANDLE Object,
270 IN SECURITY_INFORMATION RequestedInformation,
271 OUT PSECURITY_DESCRIPTOR pSecurityDescriptor,
272 IN ULONG Length,
273 OUT PULONG ResultLength)
275 PISECURITY_DESCRIPTOR_RELATIVE psd = pSecurityDescriptor;
276 NTSTATUS status;
277 unsigned int buffer_size = 512;
278 BOOLEAN need_more_memory;
280 TRACE("(%p,0x%08x,%p,0x%08x,%p)\n",
281 Object, RequestedInformation, pSecurityDescriptor, Length, ResultLength);
285 char *buffer = RtlAllocateHeap(GetProcessHeap(), 0, buffer_size);
286 if (!buffer)
287 return STATUS_NO_MEMORY;
289 need_more_memory = FALSE;
291 SERVER_START_REQ( get_security_object )
293 req->handle = wine_server_obj_handle( Object );
294 req->security_info = RequestedInformation;
295 wine_server_set_reply( req, buffer, buffer_size );
296 status = wine_server_call( req );
297 if (status == STATUS_SUCCESS)
299 struct security_descriptor *sd = (struct security_descriptor *)buffer;
300 if (reply->sd_len)
302 *ResultLength = sizeof(SECURITY_DESCRIPTOR_RELATIVE) +
303 sd->owner_len + sd->group_len + sd->sacl_len + sd->dacl_len;
304 if (Length >= *ResultLength)
306 psd->Revision = SECURITY_DESCRIPTOR_REVISION;
307 psd->Sbz1 = 0;
308 psd->Control = sd->control | SE_SELF_RELATIVE;
309 psd->Owner = sd->owner_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) : 0;
310 psd->Group = sd->group_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) + sd->owner_len : 0;
311 psd->Sacl = sd->sacl_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) + sd->owner_len + sd->group_len : 0;
312 psd->Dacl = sd->dacl_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) + sd->owner_len + sd->group_len + sd->sacl_len : 0;
313 /* owner, group, sacl and dacl are the same type as in the server
314 * and in the same order so we copy the memory in one block */
315 memcpy((char *)pSecurityDescriptor + sizeof(SECURITY_DESCRIPTOR_RELATIVE),
316 buffer + sizeof(struct security_descriptor),
317 sd->owner_len + sd->group_len + sd->sacl_len + sd->dacl_len);
319 else
320 status = STATUS_BUFFER_TOO_SMALL;
322 else
324 *ResultLength = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
325 if (Length >= *ResultLength)
327 memset(psd, 0, sizeof(*psd));
328 psd->Revision = SECURITY_DESCRIPTOR_REVISION;
329 psd->Control = SE_SELF_RELATIVE;
331 else
332 status = STATUS_BUFFER_TOO_SMALL;
335 else if (status == STATUS_BUFFER_TOO_SMALL)
337 buffer_size = reply->sd_len;
338 need_more_memory = TRUE;
341 SERVER_END_REQ;
342 RtlFreeHeap(GetProcessHeap(), 0, buffer);
343 } while (need_more_memory);
345 return status;
349 /******************************************************************************
350 * NtDuplicateObject [NTDLL.@]
351 * ZwDuplicateObject [NTDLL.@]
353 NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
354 HANDLE dest_process, PHANDLE dest,
355 ACCESS_MASK access, ULONG attributes, ULONG options )
357 NTSTATUS ret;
358 SERVER_START_REQ( dup_handle )
360 req->src_process = wine_server_obj_handle( source_process );
361 req->src_handle = wine_server_obj_handle( source );
362 req->dst_process = wine_server_obj_handle( dest_process );
363 req->access = access;
364 req->attributes = attributes;
365 req->options = options;
367 if (!(ret = wine_server_call( req )))
369 if (dest) *dest = wine_server_ptr_handle( reply->handle );
370 if (reply->closed && reply->self)
372 int fd = server_remove_fd_from_cache( source );
373 if (fd != -1) close( fd );
377 SERVER_END_REQ;
378 return ret;
381 static LONG WINAPI invalid_handle_exception_handler( EXCEPTION_POINTERS *eptr )
383 EXCEPTION_RECORD *rec = eptr->ExceptionRecord;
384 return (rec->ExceptionCode == EXCEPTION_INVALID_HANDLE) ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH;
387 /* Everquest 2 / Pirates of the Burning Sea hooks NtClose, so we need a wrapper */
388 NTSTATUS close_handle( HANDLE handle )
390 NTSTATUS ret;
391 int fd = server_remove_fd_from_cache( handle );
393 SERVER_START_REQ( close_handle )
395 req->handle = wine_server_obj_handle( handle );
396 ret = wine_server_call( req );
398 SERVER_END_REQ;
399 if (fd != -1) close( fd );
401 if (ret == STATUS_INVALID_HANDLE && handle && NtCurrentTeb()->Peb->BeingDebugged)
403 __TRY
405 EXCEPTION_RECORD record;
406 record.ExceptionCode = EXCEPTION_INVALID_HANDLE;
407 record.ExceptionFlags = 0;
408 record.ExceptionRecord = NULL;
409 record.ExceptionAddress = NULL;
410 record.NumberParameters = 0;
411 RtlRaiseException( &record );
413 __EXCEPT(invalid_handle_exception_handler)
416 __ENDTRY
419 return ret;
422 /**************************************************************************
423 * NtClose [NTDLL.@]
425 * Close a handle reference to an object.
427 * PARAMS
428 * Handle [I] handle to close
430 * RETURNS
431 * Success: ERROR_SUCCESS.
432 * Failure: An NTSTATUS error code.
434 NTSTATUS WINAPI NtClose( HANDLE Handle )
436 return close_handle( Handle );
440 * Directory functions
443 /**************************************************************************
444 * NtOpenDirectoryObject [NTDLL.@]
445 * ZwOpenDirectoryObject [NTDLL.@]
447 * Open a namespace directory object.
449 * PARAMS
450 * DirectoryHandle [O] Destination for the new directory handle
451 * DesiredAccess [I] Desired access to the directory
452 * ObjectAttributes [I] Structure describing the directory
454 * RETURNS
455 * Success: ERROR_SUCCESS.
456 * Failure: An NTSTATUS error code.
458 NTSTATUS WINAPI NtOpenDirectoryObject( HANDLE *handle, ACCESS_MASK access, const OBJECT_ATTRIBUTES *attr)
460 NTSTATUS ret;
462 if (!handle) return STATUS_ACCESS_VIOLATION;
463 if ((ret = validate_open_object_attributes( attr ))) return ret;
465 TRACE("(%p,0x%08x,%s)\n", handle, access, debugstr_ObjectAttributes(attr));
467 SERVER_START_REQ(open_directory)
469 req->access = access;
470 req->attributes = attr->Attributes;
471 req->rootdir = wine_server_obj_handle( attr->RootDirectory );
472 if (attr->ObjectName)
473 wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length );
474 ret = wine_server_call( req );
475 *handle = wine_server_ptr_handle( reply->handle );
477 SERVER_END_REQ;
478 return ret;
481 /******************************************************************************
482 * NtCreateDirectoryObject [NTDLL.@]
483 * ZwCreateDirectoryObject [NTDLL.@]
485 * Create a namespace directory object.
487 * PARAMS
488 * DirectoryHandle [O] Destination for the new directory handle
489 * DesiredAccess [I] Desired access to the directory
490 * ObjectAttributes [I] Structure describing the directory
492 * RETURNS
493 * Success: ERROR_SUCCESS.
494 * Failure: An NTSTATUS error code.
496 NTSTATUS WINAPI NtCreateDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK DesiredAccess,
497 OBJECT_ATTRIBUTES *attr )
499 NTSTATUS ret;
500 data_size_t len;
501 struct object_attributes *objattr;
503 if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
504 TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(attr));
506 if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret;
508 SERVER_START_REQ(create_directory)
510 req->access = DesiredAccess;
511 wine_server_add_data( req, objattr, len );
512 ret = wine_server_call( req );
513 *DirectoryHandle = wine_server_ptr_handle( reply->handle );
515 SERVER_END_REQ;
517 RtlFreeHeap( GetProcessHeap(), 0, objattr );
518 return ret;
521 /******************************************************************************
522 * NtQueryDirectoryObject [NTDLL.@]
523 * ZwQueryDirectoryObject [NTDLL.@]
525 * Read information from a namespace directory.
527 * PARAMS
528 * handle [I] Handle to a directory object
529 * buffer [O] Buffer to hold the read data
530 * size [I] Size of the buffer in bytes
531 * single_entry [I] If TRUE, return a single entry, if FALSE, return as many as fit in the buffer
532 * restart [I] If TRUE, start scanning from the start, if FALSE, scan from Context
533 * context [I/O] Indicates what point of the directory the scan is at
534 * ret_size [O] Caller supplied storage for the number of bytes written (or NULL)
536 * RETURNS
537 * Success: ERROR_SUCCESS.
538 * Failure: An NTSTATUS error code.
540 NTSTATUS WINAPI NtQueryDirectoryObject(HANDLE handle, PDIRECTORY_BASIC_INFORMATION buffer,
541 ULONG size, BOOLEAN single_entry, BOOLEAN restart,
542 PULONG context, PULONG ret_size)
544 NTSTATUS ret;
546 if (restart) *context = 0;
548 if (single_entry)
550 if (size <= sizeof(*buffer) + 2*sizeof(WCHAR)) return STATUS_BUFFER_OVERFLOW;
552 SERVER_START_REQ( get_directory_entry )
554 req->handle = wine_server_obj_handle( handle );
555 req->index = *context;
556 wine_server_set_reply( req, buffer + 1, size - sizeof(*buffer) - 2*sizeof(WCHAR) );
557 if (!(ret = wine_server_call( req )))
559 buffer->ObjectName.Buffer = (WCHAR *)(buffer + 1);
560 buffer->ObjectName.Length = reply->name_len;
561 buffer->ObjectName.MaximumLength = reply->name_len + sizeof(WCHAR);
562 buffer->ObjectTypeName.Buffer = (WCHAR *)(buffer + 1) + reply->name_len/sizeof(WCHAR) + 1;
563 buffer->ObjectTypeName.Length = wine_server_reply_size( reply ) - reply->name_len;
564 buffer->ObjectTypeName.MaximumLength = buffer->ObjectTypeName.Length + sizeof(WCHAR);
565 /* make room for the terminating null */
566 memmove( buffer->ObjectTypeName.Buffer, buffer->ObjectTypeName.Buffer - 1,
567 buffer->ObjectTypeName.Length );
568 buffer->ObjectName.Buffer[buffer->ObjectName.Length/sizeof(WCHAR)] = 0;
569 buffer->ObjectTypeName.Buffer[buffer->ObjectTypeName.Length/sizeof(WCHAR)] = 0;
570 (*context)++;
573 SERVER_END_REQ;
574 if (ret_size)
575 *ret_size = buffer->ObjectName.MaximumLength + buffer->ObjectTypeName.MaximumLength + sizeof(*buffer);
577 else
579 FIXME("multiple entries not implemented\n");
580 ret = STATUS_NOT_IMPLEMENTED;
583 return ret;
587 * Link objects
590 /******************************************************************************
591 * NtOpenSymbolicLinkObject [NTDLL.@]
592 * ZwOpenSymbolicLinkObject [NTDLL.@]
594 * Open a namespace symbolic link object.
596 * PARAMS
597 * LinkHandle [O] Destination for the new symbolic link handle
598 * DesiredAccess [I] Desired access to the symbolic link
599 * ObjectAttributes [I] Structure describing the symbolic link
601 * RETURNS
602 * Success: ERROR_SUCCESS.
603 * Failure: An NTSTATUS error code.
605 NTSTATUS WINAPI NtOpenSymbolicLinkObject( HANDLE *handle, ACCESS_MASK access,
606 const OBJECT_ATTRIBUTES *attr)
608 NTSTATUS ret;
610 TRACE("(%p,0x%08x,%s)\n", handle, access, debugstr_ObjectAttributes(attr));
612 if (!handle) return STATUS_ACCESS_VIOLATION;
613 if ((ret = validate_open_object_attributes( attr ))) return ret;
615 SERVER_START_REQ(open_symlink)
617 req->access = access;
618 req->attributes = attr->Attributes;
619 req->rootdir = wine_server_obj_handle( attr->RootDirectory );
620 if (attr->ObjectName)
621 wine_server_add_data( req, attr->ObjectName->Buffer, attr->ObjectName->Length );
622 ret = wine_server_call( req );
623 *handle = wine_server_ptr_handle( reply->handle );
625 SERVER_END_REQ;
626 return ret;
629 /******************************************************************************
630 * NtCreateSymbolicLinkObject [NTDLL.@]
631 * ZwCreateSymbolicLinkObject [NTDLL.@]
633 * Open a namespace symbolic link object.
635 * PARAMS
636 * SymbolicLinkHandle [O] Destination for the new symbolic link handle
637 * DesiredAccess [I] Desired access to the symbolic link
638 * ObjectAttributes [I] Structure describing the symbolic link
639 * TargetName [I] Name of the target symbolic link points to
641 * RETURNS
642 * Success: ERROR_SUCCESS.
643 * Failure: An NTSTATUS error code.
645 NTSTATUS WINAPI NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle,IN ACCESS_MASK DesiredAccess,
646 POBJECT_ATTRIBUTES attr, PUNICODE_STRING TargetName)
648 NTSTATUS ret;
649 data_size_t len;
650 struct object_attributes *objattr;
652 if (!SymbolicLinkHandle || !attr || !TargetName) return STATUS_ACCESS_VIOLATION;
653 if (!TargetName->Buffer) return STATUS_INVALID_PARAMETER;
655 TRACE("(%p,0x%08x,%s -> %s)\n", SymbolicLinkHandle, DesiredAccess,
656 debugstr_ObjectAttributes(attr), debugstr_us(TargetName));
658 if ((ret = alloc_object_attributes( attr, &objattr, &len ))) return ret;
660 SERVER_START_REQ(create_symlink)
662 req->access = DesiredAccess;
663 wine_server_add_data( req, objattr, len );
664 wine_server_add_data(req, TargetName->Buffer, TargetName->Length);
665 ret = wine_server_call( req );
666 *SymbolicLinkHandle = wine_server_ptr_handle( reply->handle );
668 SERVER_END_REQ;
670 RtlFreeHeap( GetProcessHeap(), 0, objattr );
671 return ret;
674 /******************************************************************************
675 * NtQuerySymbolicLinkObject [NTDLL.@]
676 * ZwQuerySymbolicLinkObject [NTDLL.@]
678 * Query a namespace symbolic link object target name.
680 * PARAMS
681 * handle [I] Handle to a symbolic link object
682 * target [O] Destination for the symbolic link target
683 * length [O] Size of returned data
685 * RETURNS
686 * Success: ERROR_SUCCESS.
687 * Failure: An NTSTATUS error code.
689 NTSTATUS WINAPI NtQuerySymbolicLinkObject( HANDLE handle, PUNICODE_STRING target, PULONG length )
691 NTSTATUS ret;
693 TRACE("(%p,%p,%p)\n", handle, target, length );
695 if (!target) return STATUS_ACCESS_VIOLATION;
697 SERVER_START_REQ(query_symlink)
699 req->handle = wine_server_obj_handle( handle );
700 if (target->MaximumLength >= sizeof(WCHAR))
701 wine_server_set_reply( req, target->Buffer, target->MaximumLength - sizeof(WCHAR) );
702 if (!(ret = wine_server_call( req )))
704 target->Length = wine_server_reply_size(reply);
705 target->Buffer[target->Length / sizeof(WCHAR)] = 0;
706 if (length) *length = reply->total + sizeof(WCHAR);
708 else if (length && ret == STATUS_BUFFER_TOO_SMALL) *length = reply->total + sizeof(WCHAR);
710 SERVER_END_REQ;
711 return ret;
714 /******************************************************************************
715 * NtAllocateUuids [NTDLL.@]
717 NTSTATUS WINAPI NtAllocateUuids( ULARGE_INTEGER *time, ULONG *delta, ULONG *sequence, UCHAR *seed )
719 FIXME("(%p,%p,%p,%p), stub.\n", time, delta, sequence, seed);
720 return STATUS_SUCCESS;
723 /**************************************************************************
724 * NtMakeTemporaryObject [NTDLL.@]
725 * ZwMakeTemporaryObject [NTDLL.@]
727 * Make a permanent object temporary.
729 * PARAMS
730 * Handle [I] handle to permanent object
732 * RETURNS
733 * Success: STATUS_SUCCESS.
734 * Failure: An NTSTATUS error code.
736 NTSTATUS WINAPI NtMakeTemporaryObject( HANDLE Handle )
738 FIXME("(%p), stub.\n", Handle);
739 return STATUS_SUCCESS;