Release 1.7.39.
[wine.git] / dlls / ntdll / om.c
blobf5f75c66237d0907c0d0364156fe6fe55120d133
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 = 1; /* at least one */
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 ObjectDataInformation:
155 OBJECT_DATA_INFORMATION* p = ptr;
157 if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
159 SERVER_START_REQ( set_handle_info )
161 req->handle = wine_server_obj_handle( handle );
162 req->flags = 0;
163 req->mask = 0;
164 status = wine_server_call( req );
165 if (status == STATUS_SUCCESS)
167 p->InheritHandle = (reply->old_flags & HANDLE_FLAG_INHERIT) != 0;
168 p->ProtectFromClose = (reply->old_flags & HANDLE_FLAG_PROTECT_FROM_CLOSE) != 0;
169 if (used_len) *used_len = sizeof(*p);
172 SERVER_END_REQ;
174 break;
175 default:
176 FIXME("Unsupported information class %u\n", info_class);
177 status = STATUS_NOT_IMPLEMENTED;
178 break;
180 return status;
183 /******************************************************************
184 * NtSetInformationObject [NTDLL.@]
185 * ZwSetInformationObject [NTDLL.@]
188 NTSTATUS WINAPI NtSetInformationObject(IN HANDLE handle,
189 IN OBJECT_INFORMATION_CLASS info_class,
190 IN PVOID ptr, IN ULONG len)
192 NTSTATUS status;
194 TRACE("(%p,0x%08x,%p,0x%08x)\n", handle, info_class, ptr, len);
196 switch (info_class)
198 case ObjectDataInformation:
200 OBJECT_DATA_INFORMATION* p = ptr;
202 if (len < sizeof(*p)) return STATUS_INVALID_BUFFER_SIZE;
204 SERVER_START_REQ( set_handle_info )
206 req->handle = wine_server_obj_handle( handle );
207 req->flags = 0;
208 req->mask = HANDLE_FLAG_INHERIT | HANDLE_FLAG_PROTECT_FROM_CLOSE;
209 if (p->InheritHandle) req->flags |= HANDLE_FLAG_INHERIT;
210 if (p->ProtectFromClose) req->flags |= HANDLE_FLAG_PROTECT_FROM_CLOSE;
211 status = wine_server_call( req );
213 SERVER_END_REQ;
215 break;
216 default:
217 FIXME("Unsupported information class %u\n", info_class);
218 status = STATUS_NOT_IMPLEMENTED;
219 break;
221 return status;
224 /******************************************************************************
225 * NtQuerySecurityObject [NTDLL.@]
227 * An ntdll analogue to GetKernelObjectSecurity().
230 NTSTATUS WINAPI
231 NtQuerySecurityObject(
232 IN HANDLE Object,
233 IN SECURITY_INFORMATION RequestedInformation,
234 OUT PSECURITY_DESCRIPTOR pSecurityDescriptor,
235 IN ULONG Length,
236 OUT PULONG ResultLength)
238 PISECURITY_DESCRIPTOR_RELATIVE psd = pSecurityDescriptor;
239 NTSTATUS status;
240 unsigned int buffer_size = 512;
241 BOOLEAN need_more_memory;
243 TRACE("(%p,0x%08x,%p,0x%08x,%p)\n",
244 Object, RequestedInformation, pSecurityDescriptor, Length, ResultLength);
248 char *buffer = RtlAllocateHeap(GetProcessHeap(), 0, buffer_size);
249 if (!buffer)
250 return STATUS_NO_MEMORY;
252 need_more_memory = FALSE;
254 SERVER_START_REQ( get_security_object )
256 req->handle = wine_server_obj_handle( Object );
257 req->security_info = RequestedInformation;
258 wine_server_set_reply( req, buffer, buffer_size );
259 status = wine_server_call( req );
260 if (status == STATUS_SUCCESS)
262 struct security_descriptor *sd = (struct security_descriptor *)buffer;
263 if (reply->sd_len)
265 *ResultLength = sizeof(SECURITY_DESCRIPTOR_RELATIVE) +
266 sd->owner_len + sd->group_len + sd->sacl_len + sd->dacl_len;
267 if (Length >= *ResultLength)
269 psd->Revision = SECURITY_DESCRIPTOR_REVISION;
270 psd->Sbz1 = 0;
271 psd->Control = sd->control | SE_SELF_RELATIVE;
272 psd->Owner = sd->owner_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) : 0;
273 psd->Group = sd->group_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) + sd->owner_len : 0;
274 psd->Sacl = sd->sacl_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) + sd->owner_len + sd->group_len : 0;
275 psd->Dacl = sd->dacl_len ? sizeof(SECURITY_DESCRIPTOR_RELATIVE) + sd->owner_len + sd->group_len + sd->sacl_len : 0;
276 /* owner, group, sacl and dacl are the same type as in the server
277 * and in the same order so we copy the memory in one block */
278 memcpy((char *)pSecurityDescriptor + sizeof(SECURITY_DESCRIPTOR_RELATIVE),
279 buffer + sizeof(struct security_descriptor),
280 sd->owner_len + sd->group_len + sd->sacl_len + sd->dacl_len);
282 else
283 status = STATUS_BUFFER_TOO_SMALL;
285 else
287 *ResultLength = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
288 if (Length >= *ResultLength)
290 memset(psd, 0, sizeof(*psd));
291 psd->Revision = SECURITY_DESCRIPTOR_REVISION;
292 psd->Control = SE_SELF_RELATIVE;
294 else
295 status = STATUS_BUFFER_TOO_SMALL;
298 else if (status == STATUS_BUFFER_TOO_SMALL)
300 buffer_size = reply->sd_len;
301 need_more_memory = TRUE;
304 SERVER_END_REQ;
305 RtlFreeHeap(GetProcessHeap(), 0, buffer);
306 } while (need_more_memory);
308 return status;
312 /******************************************************************************
313 * NtDuplicateObject [NTDLL.@]
314 * ZwDuplicateObject [NTDLL.@]
316 NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
317 HANDLE dest_process, PHANDLE dest,
318 ACCESS_MASK access, ULONG attributes, ULONG options )
320 NTSTATUS ret;
321 SERVER_START_REQ( dup_handle )
323 req->src_process = wine_server_obj_handle( source_process );
324 req->src_handle = wine_server_obj_handle( source );
325 req->dst_process = wine_server_obj_handle( dest_process );
326 req->access = access;
327 req->attributes = attributes;
328 req->options = options;
330 if (!(ret = wine_server_call( req )))
332 if (dest) *dest = wine_server_ptr_handle( reply->handle );
333 if (reply->closed && reply->self)
335 int fd = server_remove_fd_from_cache( source );
336 if (fd != -1) close( fd );
340 SERVER_END_REQ;
341 return ret;
344 /* Everquest 2 / Pirates of the Burning Sea hooks NtClose, so we need a wrapper */
345 NTSTATUS close_handle( HANDLE handle )
347 NTSTATUS ret;
348 int fd = server_remove_fd_from_cache( handle );
350 SERVER_START_REQ( close_handle )
352 req->handle = wine_server_obj_handle( handle );
353 ret = wine_server_call( req );
355 SERVER_END_REQ;
356 if (fd != -1) close( fd );
357 return ret;
360 /**************************************************************************
361 * NtClose [NTDLL.@]
363 * Close a handle reference to an object.
365 * PARAMS
366 * Handle [I] handle to close
368 * RETURNS
369 * Success: ERROR_SUCCESS.
370 * Failure: An NTSTATUS error code.
372 NTSTATUS WINAPI NtClose( HANDLE Handle )
374 return close_handle( Handle );
378 * Directory functions
381 /**************************************************************************
382 * NtOpenDirectoryObject [NTDLL.@]
383 * ZwOpenDirectoryObject [NTDLL.@]
385 * Open a namespace directory object.
387 * PARAMS
388 * DirectoryHandle [O] Destination for the new directory handle
389 * DesiredAccess [I] Desired access to the directory
390 * ObjectAttributes [I] Structure describing the directory
392 * RETURNS
393 * Success: ERROR_SUCCESS.
394 * Failure: An NTSTATUS error code.
396 NTSTATUS WINAPI NtOpenDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK DesiredAccess,
397 POBJECT_ATTRIBUTES ObjectAttributes)
399 NTSTATUS ret;
401 if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
402 if (!ObjectAttributes) return STATUS_INVALID_PARAMETER;
403 TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
404 /* Have to test it here because server won't know difference between
405 * ObjectName == NULL and ObjectName == "" */
406 if (!ObjectAttributes->ObjectName)
408 if (ObjectAttributes->RootDirectory)
409 return STATUS_OBJECT_NAME_INVALID;
410 else
411 return STATUS_OBJECT_PATH_SYNTAX_BAD;
414 SERVER_START_REQ(open_directory)
416 req->access = DesiredAccess;
417 req->attributes = ObjectAttributes->Attributes;
418 req->rootdir = wine_server_obj_handle( ObjectAttributes->RootDirectory );
419 if (ObjectAttributes->ObjectName)
420 wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
421 ObjectAttributes->ObjectName->Length);
422 ret = wine_server_call( req );
423 *DirectoryHandle = wine_server_ptr_handle( reply->handle );
425 SERVER_END_REQ;
426 return ret;
429 /******************************************************************************
430 * NtCreateDirectoryObject [NTDLL.@]
431 * ZwCreateDirectoryObject [NTDLL.@]
433 * Create a namespace directory object.
435 * PARAMS
436 * DirectoryHandle [O] Destination for the new directory handle
437 * DesiredAccess [I] Desired access to the directory
438 * ObjectAttributes [I] Structure describing the directory
440 * RETURNS
441 * Success: ERROR_SUCCESS.
442 * Failure: An NTSTATUS error code.
444 NTSTATUS WINAPI NtCreateDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK DesiredAccess,
445 POBJECT_ATTRIBUTES ObjectAttributes)
447 NTSTATUS ret;
449 if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
450 TRACE("(%p,0x%08x,%s)\n", DirectoryHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
452 SERVER_START_REQ(create_directory)
454 req->access = DesiredAccess;
455 req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
456 req->rootdir = wine_server_obj_handle( ObjectAttributes ? ObjectAttributes->RootDirectory : 0 );
457 if (ObjectAttributes && ObjectAttributes->ObjectName)
458 wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
459 ObjectAttributes->ObjectName->Length);
460 ret = wine_server_call( req );
461 *DirectoryHandle = wine_server_ptr_handle( reply->handle );
463 SERVER_END_REQ;
464 return ret;
467 /******************************************************************************
468 * NtQueryDirectoryObject [NTDLL.@]
469 * ZwQueryDirectoryObject [NTDLL.@]
471 * Read information from a namespace directory.
473 * PARAMS
474 * handle [I] Handle to a directory object
475 * buffer [O] Buffer to hold the read data
476 * size [I] Size of the buffer in bytes
477 * single_entry [I] If TRUE, return a single entry, if FALSE, return as many as fit in the buffer
478 * restart [I] If TRUE, start scanning from the start, if FALSE, scan from Context
479 * context [I/O] Indicates what point of the directory the scan is at
480 * ret_size [O] Caller supplied storage for the number of bytes written (or NULL)
482 * RETURNS
483 * Success: ERROR_SUCCESS.
484 * Failure: An NTSTATUS error code.
486 NTSTATUS WINAPI NtQueryDirectoryObject(HANDLE handle, PDIRECTORY_BASIC_INFORMATION buffer,
487 ULONG size, BOOLEAN single_entry, BOOLEAN restart,
488 PULONG context, PULONG ret_size)
490 NTSTATUS ret;
492 if (restart) *context = 0;
494 if (single_entry)
496 if (size <= sizeof(*buffer) + 2*sizeof(WCHAR)) return STATUS_BUFFER_OVERFLOW;
498 SERVER_START_REQ( get_directory_entry )
500 req->handle = wine_server_obj_handle( handle );
501 req->index = *context;
502 wine_server_set_reply( req, buffer + 1, size - sizeof(*buffer) - 2*sizeof(WCHAR) );
503 if (!(ret = wine_server_call( req )))
505 buffer->ObjectName.Buffer = (WCHAR *)(buffer + 1);
506 buffer->ObjectName.Length = reply->name_len;
507 buffer->ObjectName.MaximumLength = reply->name_len + sizeof(WCHAR);
508 buffer->ObjectTypeName.Buffer = (WCHAR *)(buffer + 1) + reply->name_len/sizeof(WCHAR) + 1;
509 buffer->ObjectTypeName.Length = wine_server_reply_size( reply ) - reply->name_len;
510 buffer->ObjectTypeName.MaximumLength = buffer->ObjectTypeName.Length + sizeof(WCHAR);
511 /* make room for the terminating null */
512 memmove( buffer->ObjectTypeName.Buffer, buffer->ObjectTypeName.Buffer - 1,
513 buffer->ObjectTypeName.Length );
514 buffer->ObjectName.Buffer[buffer->ObjectName.Length/sizeof(WCHAR)] = 0;
515 buffer->ObjectTypeName.Buffer[buffer->ObjectTypeName.Length/sizeof(WCHAR)] = 0;
516 (*context)++;
519 SERVER_END_REQ;
520 if (ret_size)
521 *ret_size = buffer->ObjectName.MaximumLength + buffer->ObjectTypeName.MaximumLength + sizeof(*buffer);
523 else
525 FIXME("multiple entries not implemented\n");
526 ret = STATUS_NOT_IMPLEMENTED;
529 return ret;
533 * Link objects
536 /******************************************************************************
537 * NtOpenSymbolicLinkObject [NTDLL.@]
538 * ZwOpenSymbolicLinkObject [NTDLL.@]
540 * Open a namespace symbolic link object.
542 * PARAMS
543 * LinkHandle [O] Destination for the new symbolic link handle
544 * DesiredAccess [I] Desired access to the symbolic link
545 * ObjectAttributes [I] Structure describing the symbolic link
547 * RETURNS
548 * Success: ERROR_SUCCESS.
549 * Failure: An NTSTATUS error code.
551 NTSTATUS WINAPI NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess,
552 IN POBJECT_ATTRIBUTES ObjectAttributes)
554 NTSTATUS ret;
555 TRACE("(%p,0x%08x,%s)\n",LinkHandle, DesiredAccess, debugstr_ObjectAttributes(ObjectAttributes));
557 if (!LinkHandle) return STATUS_ACCESS_VIOLATION;
558 if (!ObjectAttributes) return STATUS_INVALID_PARAMETER;
559 /* Have to test it here because server won't know difference between
560 * ObjectName == NULL and ObjectName == "" */
561 if (!ObjectAttributes->ObjectName)
563 if (ObjectAttributes->RootDirectory)
564 return STATUS_OBJECT_NAME_INVALID;
565 else
566 return STATUS_OBJECT_PATH_SYNTAX_BAD;
569 SERVER_START_REQ(open_symlink)
571 req->access = DesiredAccess;
572 req->attributes = ObjectAttributes->Attributes;
573 req->rootdir = wine_server_obj_handle( ObjectAttributes->RootDirectory );
574 if (ObjectAttributes->ObjectName)
575 wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
576 ObjectAttributes->ObjectName->Length);
577 ret = wine_server_call( req );
578 *LinkHandle = wine_server_ptr_handle( reply->handle );
580 SERVER_END_REQ;
581 return ret;
584 /******************************************************************************
585 * NtCreateSymbolicLinkObject [NTDLL.@]
586 * ZwCreateSymbolicLinkObject [NTDLL.@]
588 * Open a namespace symbolic link object.
590 * PARAMS
591 * SymbolicLinkHandle [O] Destination for the new symbolic link handle
592 * DesiredAccess [I] Desired access to the symbolic link
593 * ObjectAttributes [I] Structure describing the symbolic link
594 * TargetName [I] Name of the target symbolic link points to
596 * RETURNS
597 * Success: ERROR_SUCCESS.
598 * Failure: An NTSTATUS error code.
600 NTSTATUS WINAPI NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle,IN ACCESS_MASK DesiredAccess,
601 IN POBJECT_ATTRIBUTES ObjectAttributes,
602 IN PUNICODE_STRING TargetName)
604 NTSTATUS ret;
606 if (!SymbolicLinkHandle || !TargetName) return STATUS_ACCESS_VIOLATION;
607 if (!TargetName->Buffer) return STATUS_INVALID_PARAMETER;
609 TRACE("(%p,0x%08x,%s -> %s)\n", SymbolicLinkHandle, DesiredAccess,
610 debugstr_ObjectAttributes(ObjectAttributes), debugstr_us(TargetName));
612 SERVER_START_REQ(create_symlink)
614 req->access = DesiredAccess;
615 req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
616 req->rootdir = wine_server_obj_handle( ObjectAttributes ? ObjectAttributes->RootDirectory : 0 );
617 if (ObjectAttributes && ObjectAttributes->ObjectName)
619 req->name_len = ObjectAttributes->ObjectName->Length;
620 wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
621 ObjectAttributes->ObjectName->Length);
623 else
624 req->name_len = 0;
625 wine_server_add_data(req, TargetName->Buffer, TargetName->Length);
626 ret = wine_server_call( req );
627 *SymbolicLinkHandle = wine_server_ptr_handle( reply->handle );
629 SERVER_END_REQ;
630 return ret;
633 /******************************************************************************
634 * NtQuerySymbolicLinkObject [NTDLL.@]
635 * ZwQuerySymbolicLinkObject [NTDLL.@]
637 * Query a namespace symbolic link object target name.
639 * PARAMS
640 * handle [I] Handle to a symbolic link object
641 * target [O] Destination for the symbolic link target
642 * length [O] Size of returned data
644 * RETURNS
645 * Success: ERROR_SUCCESS.
646 * Failure: An NTSTATUS error code.
648 NTSTATUS WINAPI NtQuerySymbolicLinkObject( HANDLE handle, PUNICODE_STRING target, PULONG length )
650 NTSTATUS ret;
652 TRACE("(%p,%p,%p)\n", handle, target, length );
654 if (!target) return STATUS_ACCESS_VIOLATION;
656 SERVER_START_REQ(query_symlink)
658 req->handle = wine_server_obj_handle( handle );
659 if (target->MaximumLength >= sizeof(WCHAR))
660 wine_server_set_reply( req, target->Buffer, target->MaximumLength - sizeof(WCHAR) );
661 if (!(ret = wine_server_call( req )))
663 target->Length = wine_server_reply_size(reply);
664 target->Buffer[target->Length / sizeof(WCHAR)] = 0;
665 if (length) *length = reply->total + sizeof(WCHAR);
667 else if (length && ret == STATUS_BUFFER_TOO_SMALL) *length = reply->total + sizeof(WCHAR);
669 SERVER_END_REQ;
670 return ret;
673 /******************************************************************************
674 * NtAllocateUuids [NTDLL.@]
676 NTSTATUS WINAPI NtAllocateUuids(
677 PULARGE_INTEGER Time,
678 PULONG Range,
679 PULONG Sequence)
681 FIXME("(%p,%p,%p), stub.\n", Time, Range, Sequence);
682 return 0;
685 /**************************************************************************
686 * NtMakeTemporaryObject [NTDLL.@]
687 * ZwMakeTemporaryObject [NTDLL.@]
689 * Make a permanent object temporary.
691 * PARAMS
692 * Handle [I] handle to permanent object
694 * RETURNS
695 * Success: STATUS_SUCCESS.
696 * Failure: An NTSTATUS error code.
698 NTSTATUS WINAPI NtMakeTemporaryObject( HANDLE Handle )
700 FIXME("(%p), stub.\n", Handle);
701 return STATUS_SUCCESS;