TESTING -- override pthreads to fix gstreamer v5
[wine/multimedia.git] / dlls / ntdll / om.c
blob3fadba79d613e154162bafca6af5c48c7d21db98
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"
42 WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
46 * Generic object functions
49 /******************************************************************************
50 * NtQueryObject [NTDLL.@]
51 * ZwQueryObject [NTDLL.@]
53 NTSTATUS WINAPI NtQueryObject(IN HANDLE handle,
54 IN OBJECT_INFORMATION_CLASS info_class,
55 OUT PVOID ptr, IN ULONG len, OUT PULONG used_len)
57 NTSTATUS status;
59 TRACE("(%p,0x%08x,%p,0x%08x,%p)\n", handle, info_class, ptr, len, used_len);
61 if (used_len) *used_len = 0;
63 switch (info_class)
65 case ObjectBasicInformation:
67 POBJECT_BASIC_INFORMATION p = ptr;
69 if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
71 SERVER_START_REQ( get_object_info )
73 req->handle = wine_server_obj_handle( handle );
74 status = wine_server_call( req );
75 if (status == STATUS_SUCCESS)
77 memset( p, 0, sizeof(*p) );
78 p->GrantedAccess = reply->access;
79 p->PointerCount = reply->ref_count;
80 p->HandleCount = reply->handle_count;
81 if (used_len) *used_len = sizeof(*p);
84 SERVER_END_REQ;
86 break;
87 case ObjectNameInformation:
89 OBJECT_NAME_INFORMATION* p = ptr;
90 ANSI_STRING unix_name;
92 /* first try as a file object */
94 if (!(status = server_get_unix_name( handle, &unix_name )))
96 UNICODE_STRING nt_name;
98 if (!(status = wine_unix_to_nt_file_name( &unix_name, &nt_name )))
100 if (len < sizeof(*p))
101 status = STATUS_INFO_LENGTH_MISMATCH;
102 else if (len < sizeof(*p) + nt_name.MaximumLength)
103 status = STATUS_BUFFER_OVERFLOW;
104 else
106 p->Name.Buffer = (WCHAR *)(p + 1);
107 p->Name.Length = nt_name.Length;
108 p->Name.MaximumLength = nt_name.MaximumLength;
109 memcpy( p->Name.Buffer, nt_name.Buffer, nt_name.MaximumLength );
111 if (used_len) *used_len = sizeof(*p) + nt_name.MaximumLength;
112 RtlFreeUnicodeString( &nt_name );
114 RtlFreeAnsiString( &unix_name );
115 break;
117 else if (status != STATUS_OBJECT_TYPE_MISMATCH) break;
119 /* not a file, treat as a generic object */
121 SERVER_START_REQ( get_object_info )
123 req->handle = wine_server_obj_handle( handle );
124 if (len > sizeof(*p)) wine_server_set_reply( req, p + 1, len - sizeof(*p) );
125 status = wine_server_call( req );
126 if (status == STATUS_SUCCESS)
128 if (!reply->total) /* no name */
130 if (sizeof(*p) > len) status = STATUS_INFO_LENGTH_MISMATCH;
131 else memset( p, 0, sizeof(*p) );
132 if (used_len) *used_len = sizeof(*p);
134 else if (sizeof(*p) + reply->total + sizeof(WCHAR) > len)
136 if (used_len) *used_len = sizeof(*p) + reply->total + sizeof(WCHAR);
137 status = STATUS_INFO_LENGTH_MISMATCH;
139 else
141 ULONG res = wine_server_reply_size( reply );
142 p->Name.Buffer = (WCHAR *)(p + 1);
143 p->Name.Length = res;
144 p->Name.MaximumLength = res + sizeof(WCHAR);
145 p->Name.Buffer[res / sizeof(WCHAR)] = 0;
146 if (used_len) *used_len = sizeof(*p) + p->Name.MaximumLength;
150 SERVER_END_REQ;
152 break;
153 case ObjectTypeInformation:
155 OBJECT_TYPE_INFORMATION *p = ptr;
157 SERVER_START_REQ( get_object_type )
159 req->handle = wine_server_obj_handle( handle );
160 if (len > sizeof(*p)) wine_server_set_reply( req, p + 1, len - sizeof(*p) );
161 status = wine_server_call( req );
162 if (status == STATUS_SUCCESS)
164 if (!reply->total) /* no name */
166 if (sizeof(*p) > len) status = STATUS_INFO_LENGTH_MISMATCH;
167 else memset( p, 0, sizeof(*p) );
168 if (used_len) *used_len = sizeof(*p);
170 else if (sizeof(*p) + reply->total + sizeof(WCHAR) > len)
172 if (used_len) *used_len = sizeof(*p) + reply->total + sizeof(WCHAR);
173 status = STATUS_INFO_LENGTH_MISMATCH;
175 else
177 ULONG res = wine_server_reply_size( reply );
178 p->TypeName.Buffer = (WCHAR *)(p + 1);
179 p->TypeName.Length = res;
180 p->TypeName.MaximumLength = res + sizeof(WCHAR);
181 p->TypeName.Buffer[res / sizeof(WCHAR)] = 0;
182 if (used_len) *used_len = sizeof(*p) + p->TypeName.MaximumLength;
186 SERVER_END_REQ;
188 break;
189 case ObjectDataInformation:
191 OBJECT_DATA_INFORMATION* p = ptr;
193 if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
195 SERVER_START_REQ( set_handle_info )
197 req->handle = wine_server_obj_handle( handle );
198 req->flags = 0;
199 req->mask = 0;
200 status = wine_server_call( req );
201 if (status == STATUS_SUCCESS)
203 p->InheritHandle = (reply->old_flags & HANDLE_FLAG_INHERIT) != 0;
204 p->ProtectFromClose = (reply->old_flags & HANDLE_FLAG_PROTECT_FROM_CLOSE) != 0;
205 if (used_len) *used_len = sizeof(*p);
208 SERVER_END_REQ;
210 break;
211 default:
212 FIXME("Unsupported information class %u\n", info_class);
213 status = STATUS_NOT_IMPLEMENTED;
214 break;
216 return status;
219 /******************************************************************
220 * NtSetInformationObject [NTDLL.@]
221 * ZwSetInformationObject [NTDLL.@]
224 NTSTATUS WINAPI NtSetInformationObject(IN HANDLE handle,
225 IN OBJECT_INFORMATION_CLASS info_class,
226 IN PVOID ptr, IN ULONG len)
228 NTSTATUS status;
230 TRACE("(%p,0x%08x,%p,0x%08x)\n", handle, info_class, ptr, len);
232 switch (info_class)
234 case ObjectDataInformation:
236 OBJECT_DATA_INFORMATION* p = ptr;
238 if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
240 SERVER_START_REQ( set_handle_info )
242 req->handle = wine_server_obj_handle( handle );
243 req->flags = 0;
244 req->mask = HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE;
245 if (p->InheritHandle) req->flags |= HANDLE_FLAG_INHERIT;
246 if (p->ProtectFromClose) req->flags |= HANDLE_FLAG_PROTECT_FROM_CLOSE;
247 status = wine_server_call( req );
249 SERVER_END_REQ;
251 break;
252 default:
253 FIXME("Unsupported information class %u\n", info_class);
254 status = STATUS_NOT_IMPLEMENTED;
255 break;
257 return status;
260 /******************************************************************************
261 * NtQuerySecurityObject [NTDLL.@]
263 * An ntdll analogue to GetKernelObjectSecurity().
266 NTSTATUS WINAPI
267 NtQuerySecurityObject(
268 IN HANDLE Object,
269 IN SECURITY_INFORMATION RequestedInformation,
270 OUT PSECURITY_DESCRIPTOR pSecurityDescriptor,
271 IN ULONG Length,
272 OUT PULONG ResultLength)
274 PISECURITY_DESCRIPTOR_RELATIVE psd = pSecurityDescriptor;
275 NTSTATUS status;
276 unsigned int buffer_size = 512;
277 BOOLEAN need_more_memory;
279 TRACE("(%p,0x%08x,%p,0x%08x,%p)\n",
280 Object, RequestedInformation, pSecurityDescriptor, Length, ResultLength);
284 char *buffer = RtlAllocateHeap(GetProcessHeap(), 0, buffer_size);
285 if (!buffer)
286 return STATUS_NO_MEMORY;
288 need_more_memory = FALSE;
290 SERVER_START_REQ( get_security_object )
292 req->handle = wine_server_obj_handle( Object );
293 req->security_info = RequestedInformation;
294 wine_server_set_reply( req, buffer, buffer_size );
295 status = wine_server_call( req );
296 if (status == STATUS_SUCCESS)
298 struct security_descriptor *sd = (struct security_descriptor *)buffer;
299 if (reply->sd_len)
301 *ResultLength = sizeof(SECURITY_DESCRIPTOR_RELATIVE) +
302 sd->owner_len + sd->group_len + sd->sacl_len + sd->dacl_len;
303 if (Length >= *ResultLength)
305 psd->Revision = SECURITY_DESCRIPTOR_REVISION;
306 psd->Sbz1 = 0;
307 psd->Control = sd->control | SE_SELF_RELATIVE;
308 psd->Owner = sd->owner_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) : 0;
309 psd->Group = sd->group_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) + sd->owner_len : 0;
310 psd->Sacl = sd->sacl_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) + sd->owner_len + sd->group_len : 0;
311 psd->Dacl = sd->dacl_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) + sd->owner_len + sd->group_len + sd->sacl_len : 0;
312 /* owner, group, sacl and dacl are the same type as in the server
313 * and in the same order so we copy the memory in one block */
314 memcpy((char *)pSecurityDescriptor + sizeof(SECURITY_DESCRIPTOR_RELATIVE),
315 buffer + sizeof(struct security_descriptor),
316 sd->owner_len + sd->group_len + sd->sacl_len + sd->dacl_len);
318 else
319 status = STATUS_BUFFER_TOO_SMALL;
321 else
323 *ResultLength = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
324 if (Length >= *ResultLength)
326 memset(psd, 0, sizeof(*psd));
327 psd->Revision = SECURITY_DESCRIPTOR_REVISION;
328 psd->Control = SE_SELF_RELATIVE;
330 else
331 status = STATUS_BUFFER_TOO_SMALL;
334 else if (status == STATUS_BUFFER_TOO_SMALL)
336 buffer_size = reply->sd_len;
337 need_more_memory = TRUE;
340 SERVER_END_REQ;
341 RtlFreeHeap(GetProcessHeap(), 0, buffer);
342 } while (need_more_memory);
344 return status;
348 /******************************************************************************
349 * NtDuplicateObject [NTDLL.@]
350 * ZwDuplicateObject [NTDLL.@]
352 NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
353 HANDLE dest_process, PHANDLE dest,
354 ACCESS_MASK access, ULONG attributes, ULONG options )
356 NTSTATUS ret;
357 SERVER_START_REQ( dup_handle )
359 req->src_process = wine_server_obj_handle( source_process );
360 req->src_handle = wine_server_obj_handle( source );
361 req->dst_process = wine_server_obj_handle( dest_process );
362 req->access = access;
363 req->attributes = attributes;
364 req->options = options;
366 if (!(ret = wine_server_call( req )))
368 if (dest) *dest = wine_server_ptr_handle( reply->handle );
369 if (reply->closed && reply->self)
371 int fd = server_remove_fd_from_cache( source );
372 if (fd != -1) close( fd );
376 SERVER_END_REQ;
377 return ret;
380 /* Everquest 2 / Pirates of the Burning Sea hooks NtClose, so we need a wrapper */
381 NTSTATUS close_handle( HANDLE handle )
383 NTSTATUS ret;
384 int fd = server_remove_fd_from_cache( handle );
386 SERVER_START_REQ( close_handle )
388 req->handle = wine_server_obj_handle( handle );
389 ret = wine_server_call( req );
391 SERVER_END_REQ;
392 if (fd != -1) close( fd );
393 return ret;
396 /**************************************************************************
397 * NtClose [NTDLL.@]
399 * Close a handle reference to an object.
401 * PARAMS
402 * Handle [I] handle to close
404 * RETURNS
405 * Success: ERROR_SUCCESS.
406 * Failure: An NTSTATUS error code.
408 NTSTATUS WINAPI NtClose( HANDLE Handle )
410 return close_handle( Handle );
414 * Directory functions
417 /**************************************************************************
418 * NtOpenDirectoryObject [NTDLL.@]
419 * ZwOpenDirectoryObject [NTDLL.@]
421 * Open a namespace directory object.
423 * PARAMS
424 * DirectoryHandle [O] Destination for the new directory handle
425 * DesiredAccess [I] Desired access to the directory
426 * ObjectAttributes [I] Structure describing the directory
428 * RETURNS
429 * Success: ERROR_SUCCESS.
430 * Failure: An NTSTATUS error code.
432 NTSTATUS WINAPI NtOpenDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK DesiredAccess,
433 POBJECT_ATTRIBUTES ObjectAttributes)
435 NTSTATUS ret;
437 if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
438 if (!ObjectAttributes) return STATUS_INVALID_PARAMETER;
439 TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
440 /* Have to test it here because server won't know difference between
441 * ObjectName == NULL and ObjectName == "" */
442 if (!ObjectAttributes->ObjectName)
444 if (ObjectAttributes->RootDirectory)
445 return STATUS_OBJECT_NAME_INVALID;
446 else
447 return STATUS_OBJECT_PATH_SYNTAX_BAD;
450 SERVER_START_REQ(open_directory)
452 req->access = DesiredAccess;
453 req->attributes = ObjectAttributes->Attributes;
454 req->rootdir = wine_server_obj_handle( ObjectAttributes->RootDirectory );
455 if (ObjectAttributes->ObjectName)
456 wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
457 ObjectAttributes->ObjectName->Length);
458 ret = wine_server_call( req );
459 *DirectoryHandle = wine_server_ptr_handle( reply->handle );
461 SERVER_END_REQ;
462 return ret;
465 /******************************************************************************
466 * NtCreateDirectoryObject [NTDLL.@]
467 * ZwCreateDirectoryObject [NTDLL.@]
469 * Create a namespace directory object.
471 * PARAMS
472 * DirectoryHandle [O] Destination for the new directory handle
473 * DesiredAccess [I] Desired access to the directory
474 * ObjectAttributes [I] Structure describing the directory
476 * RETURNS
477 * Success: ERROR_SUCCESS.
478 * Failure: An NTSTATUS error code.
480 NTSTATUS WINAPI NtCreateDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK DesiredAccess,
481 POBJECT_ATTRIBUTES ObjectAttributes)
483 NTSTATUS ret;
485 if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
486 TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
488 SERVER_START_REQ(create_directory)
490 req->access = DesiredAccess;
491 req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
492 req->rootdir = wine_server_obj_handle( ObjectAttributes ? ObjectAttributes->RootDirectory : 0 );
493 if (ObjectAttributes && ObjectAttributes->ObjectName)
494 wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
495 ObjectAttributes->ObjectName->Length);
496 ret = wine_server_call( req );
497 *DirectoryHandle = wine_server_ptr_handle( reply->handle );
499 SERVER_END_REQ;
500 return ret;
503 /******************************************************************************
504 * NtQueryDirectoryObject [NTDLL.@]
505 * ZwQueryDirectoryObject [NTDLL.@]
507 * Read information from a namespace directory.
509 * PARAMS
510 * handle [I] Handle to a directory object
511 * buffer [O] Buffer to hold the read data
512 * size [I] Size of the buffer in bytes
513 * single_entry [I] If TRUE, return a single entry, if FALSE, return as many as fit in the buffer
514 * restart [I] If TRUE, start scanning from the start, if FALSE, scan from Context
515 * context [I/O] Indicates what point of the directory the scan is at
516 * ret_size [O] Caller supplied storage for the number of bytes written (or NULL)
518 * RETURNS
519 * Success: ERROR_SUCCESS.
520 * Failure: An NTSTATUS error code.
522 NTSTATUS WINAPI NtQueryDirectoryObject(HANDLE handle, PDIRECTORY_BASIC_INFORMATION buffer,
523 ULONG size, BOOLEAN single_entry, BOOLEAN restart,
524 PULONG context, PULONG ret_size)
526 NTSTATUS ret;
528 if (restart) *context = 0;
530 if (single_entry)
532 if (size <= sizeof(*buffer) + 2*sizeof(WCHAR)) return STATUS_BUFFER_OVERFLOW;
534 SERVER_START_REQ( get_directory_entry )
536 req->handle = wine_server_obj_handle( handle );
537 req->index = *context;
538 wine_server_set_reply( req, buffer + 1, size - sizeof(*buffer) - 2*sizeof(WCHAR) );
539 if (!(ret = wine_server_call( req )))
541 buffer->ObjectName.Buffer = (WCHAR *)(buffer + 1);
542 buffer->ObjectName.Length = reply->name_len;
543 buffer->ObjectName.MaximumLength = reply->name_len + sizeof(WCHAR);
544 buffer->ObjectTypeName.Buffer = (WCHAR *)(buffer + 1) + reply->name_len/sizeof(WCHAR) + 1;
545 buffer->ObjectTypeName.Length = wine_server_reply_size( reply ) - reply->name_len;
546 buffer->ObjectTypeName.MaximumLength = buffer->ObjectTypeName.Length + sizeof(WCHAR);
547 /* make room for the terminating null */
548 memmove( buffer->ObjectTypeName.Buffer, buffer->ObjectTypeName.Buffer - 1,
549 buffer->ObjectTypeName.Length );
550 buffer->ObjectName.Buffer[buffer->ObjectName.Length/sizeof(WCHAR)] = 0;
551 buffer->ObjectTypeName.Buffer[buffer->ObjectTypeName.Length/sizeof(WCHAR)] = 0;
552 (*context)++;
555 SERVER_END_REQ;
556 if (ret_size)
557 *ret_size = buffer->ObjectName.MaximumLength + buffer->ObjectTypeName.MaximumLength + sizeof(*buffer);
559 else
561 FIXME("multiple entries not implemented\n");
562 ret = STATUS_NOT_IMPLEMENTED;
565 return ret;
569 * Link objects
572 /******************************************************************************
573 * NtOpenSymbolicLinkObject [NTDLL.@]
574 * ZwOpenSymbolicLinkObject [NTDLL.@]
576 * Open a namespace symbolic link object.
578 * PARAMS
579 * LinkHandle [O] Destination for the new symbolic link handle
580 * DesiredAccess [I] Desired access to the symbolic link
581 * ObjectAttributes [I] Structure describing the symbolic link
583 * RETURNS
584 * Success: ERROR_SUCCESS.
585 * Failure: An NTSTATUS error code.
587 NTSTATUS WINAPI NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess,
588 IN POBJECT_ATTRIBUTES ObjectAttributes)
590 NTSTATUS ret;
591 TRACE("(%p,0x%08x,%s)\n",LinkHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
593 if (!LinkHandle) return STATUS_ACCESS_VIOLATION;
594 if (!ObjectAttributes) return STATUS_INVALID_PARAMETER;
595 /* Have to test it here because server won't know difference between
596 * ObjectName == NULL and ObjectName == "" */
597 if (!ObjectAttributes->ObjectName)
599 if (ObjectAttributes->RootDirectory)
600 return STATUS_OBJECT_NAME_INVALID;
601 else
602 return STATUS_OBJECT_PATH_SYNTAX_BAD;
605 SERVER_START_REQ(open_symlink)
607 req->access = DesiredAccess;
608 req->attributes = ObjectAttributes->Attributes;
609 req->rootdir = wine_server_obj_handle( ObjectAttributes->RootDirectory );
610 if (ObjectAttributes->ObjectName)
611 wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
612 ObjectAttributes->ObjectName->Length);
613 ret = wine_server_call( req );
614 *LinkHandle = wine_server_ptr_handle( reply->handle );
616 SERVER_END_REQ;
617 return ret;
620 /******************************************************************************
621 * NtCreateSymbolicLinkObject [NTDLL.@]
622 * ZwCreateSymbolicLinkObject [NTDLL.@]
624 * Open a namespace symbolic link object.
626 * PARAMS
627 * SymbolicLinkHandle [O] Destination for the new symbolic link handle
628 * DesiredAccess [I] Desired access to the symbolic link
629 * ObjectAttributes [I] Structure describing the symbolic link
630 * TargetName [I] Name of the target symbolic link points to
632 * RETURNS
633 * Success: ERROR_SUCCESS.
634 * Failure: An NTSTATUS error code.
636 NTSTATUS WINAPI NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle,IN ACCESS_MASK DesiredAccess,
637 IN POBJECT_ATTRIBUTES ObjectAttributes,
638 IN PUNICODE_STRING TargetName)
640 NTSTATUS ret;
642 if (!SymbolicLinkHandle || !TargetName) return STATUS_ACCESS_VIOLATION;
643 if (!TargetName->Buffer) return STATUS_INVALID_PARAMETER;
645 TRACE("(%p,0x%08x,%s -> %s)\n", SymbolicLinkHandle, DesiredAccess,
646 debugstr_ObjectAttributes(ObjectAttributes), debugstr_us(TargetName));
648 SERVER_START_REQ(create_symlink)
650 req->access = DesiredAccess;
651 req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
652 req->rootdir = wine_server_obj_handle( ObjectAttributes ? ObjectAttributes->RootDirectory : 0 );
653 if (ObjectAttributes && ObjectAttributes->ObjectName)
655 req->name_len = ObjectAttributes->ObjectName->Length;
656 wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
657 ObjectAttributes->ObjectName->Length);
659 else
660 req->name_len = 0;
661 wine_server_add_data(req, TargetName->Buffer, TargetName->Length);
662 ret = wine_server_call( req );
663 *SymbolicLinkHandle = wine_server_ptr_handle( reply->handle );
665 SERVER_END_REQ;
666 return ret;
669 /******************************************************************************
670 * NtQuerySymbolicLinkObject [NTDLL.@]
671 * ZwQuerySymbolicLinkObject [NTDLL.@]
673 * Query a namespace symbolic link object target name.
675 * PARAMS
676 * handle [I] Handle to a symbolic link object
677 * target [O] Destination for the symbolic link target
678 * length [O] Size of returned data
680 * RETURNS
681 * Success: ERROR_SUCCESS.
682 * Failure: An NTSTATUS error code.
684 NTSTATUS WINAPI NtQuerySymbolicLinkObject( HANDLE handle, PUNICODE_STRING target, PULONG length )
686 NTSTATUS ret;
688 TRACE("(%p,%p,%p)\n", handle, target, length );
690 if (!target) return STATUS_ACCESS_VIOLATION;
692 SERVER_START_REQ(query_symlink)
694 req->handle = wine_server_obj_handle( handle );
695 if (target->MaximumLength >= sizeof(WCHAR))
696 wine_server_set_reply( req, target->Buffer, target->MaximumLength - sizeof(WCHAR) );
697 if (!(ret = wine_server_call( req )))
699 target->Length = wine_server_reply_size(reply);
700 target->Buffer[target->Length / sizeof(WCHAR)] = 0;
701 if (length) *length = reply->total + sizeof(WCHAR);
703 else if (length && ret == STATUS_BUFFER_TOO_SMALL) *length = reply->total + sizeof(WCHAR);
705 SERVER_END_REQ;
706 return ret;
709 /******************************************************************************
710 * NtAllocateUuids [NTDLL.@]
712 NTSTATUS WINAPI NtAllocateUuids(
713 PULARGE_INTEGER Time,
714 PULONG Range,
715 PULONG Sequence)
717 FIXME("(%p,%p,%p), stub.\n", Time, Range, Sequence);
718 return 0;
721 /**************************************************************************
722 * NtMakeTemporaryObject [NTDLL.@]
723 * ZwMakeTemporaryObject [NTDLL.@]
725 * Make a permanent object temporary.
727 * PARAMS
728 * Handle [I] handle to permanent object
730 * RETURNS
731 * Success: STATUS_SUCCESS.
732 * Failure: An NTSTATUS error code.
734 NTSTATUS WINAPI NtMakeTemporaryObject( HANDLE Handle )
736 FIXME("(%p), stub.\n", Handle);
737 return STATUS_SUCCESS;