1999-03-09 18:47:51 +01:00
|
|
|
/*
|
|
|
|
* Object management functions
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* Copyright 1999, 2000 Juergen Schmied
|
2005-11-30 19:22:57 +01:00
|
|
|
* Copyright 2005 Vitaliy Margolen
|
2002-03-10 00:29:33 +01:00
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 14:49:52 +02:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
|
|
|
|
2002-08-17 02:43:16 +02:00
|
|
|
#include "config.h"
|
|
|
|
|
2003-09-06 01:08:26 +02:00
|
|
|
#include <stdarg.h>
|
1999-03-09 18:47:51 +01:00
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
2002-08-26 23:53:24 +02:00
|
|
|
#ifdef HAVE_IO_H
|
|
|
|
# include <io.h>
|
|
|
|
#endif
|
2002-08-17 02:43:16 +02:00
|
|
|
#ifdef HAVE_UNISTD_H
|
|
|
|
# include <unistd.h>
|
|
|
|
#endif
|
1999-03-09 18:47:51 +01:00
|
|
|
|
2005-11-28 17:32:54 +01:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
|
|
|
#include "wine/debug.h"
|
2003-09-06 01:08:26 +02:00
|
|
|
#include "windef.h"
|
2002-09-13 00:07:02 +02:00
|
|
|
#include "winternl.h"
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
#include "ntdll_misc.h"
|
2001-07-19 02:39:09 +02:00
|
|
|
#include "wine/server.h"
|
1999-03-09 18:47:51 +01:00
|
|
|
|
2002-03-10 00:29:33 +01:00
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
|
1999-04-19 16:56:29 +02:00
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Generic object functions
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* NtQueryObject [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwQueryObject [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2003-05-20 21:20:42 +02:00
|
|
|
NTSTATUS WINAPI NtQueryObject(IN HANDLE handle,
|
|
|
|
IN OBJECT_INFORMATION_CLASS info_class,
|
|
|
|
OUT PVOID ptr, IN ULONG len, OUT PULONG used_len)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2003-05-20 21:20:42 +02:00
|
|
|
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;
|
|
|
|
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;
|
|
|
|
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;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtQuerySecurityObject [NTDLL.@]
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* An ntdll analogue to GetKernelObjectSecurity().
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*
|
|
|
|
* NOTES
|
|
|
|
* only the lowest 4 bit of SecurityObjectInformationClass are used
|
2002-06-01 01:06:46 +02:00
|
|
|
* 0x7-0xf returns STATUS_ACCESS_DENIED (even running with system privileges)
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
*
|
2003-03-18 19:35:48 +01:00
|
|
|
* FIXME
|
|
|
|
* We are constructing a fake sid (Administrators:Full, System:Full, Everyone:Read)
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
NTSTATUS WINAPI
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
NtQuerySecurityObject(
|
|
|
|
IN HANDLE Object,
|
|
|
|
IN SECURITY_INFORMATION RequestedInformation,
|
|
|
|
OUT PSECURITY_DESCRIPTOR pSecurityDesriptor,
|
|
|
|
IN ULONG Length,
|
|
|
|
OUT PULONG ResultLength)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
static SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
|
|
|
|
static SID_IDENTIFIER_AUTHORITY worldSidAuthority = {SECURITY_WORLD_SID_AUTHORITY};
|
|
|
|
BYTE Buffer[256];
|
|
|
|
PISECURITY_DESCRIPTOR_RELATIVE psd = (PISECURITY_DESCRIPTOR_RELATIVE)Buffer;
|
|
|
|
UINT BufferIndex = sizeof(SECURITY_DESCRIPTOR_RELATIVE);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
2002-12-05 20:56:15 +01:00
|
|
|
FIXME("(%p,0x%08lx,%p,0x%08lx,%p) stub!\n",
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
Object, RequestedInformation, pSecurityDesriptor, Length, ResultLength);
|
|
|
|
|
|
|
|
RequestedInformation &= 0x0000000f;
|
|
|
|
|
|
|
|
if (RequestedInformation & SACL_SECURITY_INFORMATION) return STATUS_ACCESS_DENIED;
|
|
|
|
|
|
|
|
ZeroMemory(Buffer, 256);
|
|
|
|
RtlCreateSecurityDescriptor((PSECURITY_DESCRIPTOR)psd, SECURITY_DESCRIPTOR_REVISION);
|
2002-06-01 01:06:46 +02:00
|
|
|
psd->Control = SE_SELF_RELATIVE |
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
((RequestedInformation & DACL_SECURITY_INFORMATION) ? SE_DACL_PRESENT:0);
|
|
|
|
|
|
|
|
/* owner: administrator S-1-5-20-220*/
|
|
|
|
if (OWNER_SECURITY_INFORMATION & RequestedInformation)
|
|
|
|
{
|
2004-08-14 01:55:43 +02:00
|
|
|
SID* psid = (SID*)&(Buffer[BufferIndex]);
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
|
|
|
psd->Owner = BufferIndex;
|
|
|
|
BufferIndex += RtlLengthRequiredSid(2);
|
|
|
|
|
|
|
|
psid->Revision = SID_REVISION;
|
|
|
|
psid->SubAuthorityCount = 2;
|
|
|
|
psid->IdentifierAuthority = localSidAuthority;
|
|
|
|
psid->SubAuthority[0] = SECURITY_BUILTIN_DOMAIN_RID;
|
|
|
|
psid->SubAuthority[1] = DOMAIN_ALIAS_RID_ADMINS;
|
|
|
|
}
|
2002-06-01 01:06:46 +02:00
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/* group: built in domain S-1-5-12 */
|
|
|
|
if (GROUP_SECURITY_INFORMATION & RequestedInformation)
|
|
|
|
{
|
2004-08-14 01:55:43 +02:00
|
|
|
SID* psid = (SID*) &(Buffer[BufferIndex]);
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
|
|
|
psd->Group = BufferIndex;
|
|
|
|
BufferIndex += RtlLengthRequiredSid(1);
|
|
|
|
|
|
|
|
psid->Revision = SID_REVISION;
|
|
|
|
psid->SubAuthorityCount = 1;
|
|
|
|
psid->IdentifierAuthority = localSidAuthority;
|
|
|
|
psid->SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* discretionary ACL */
|
|
|
|
if (DACL_SECURITY_INFORMATION & RequestedInformation)
|
|
|
|
{
|
|
|
|
/* acl header */
|
|
|
|
PACL pacl = (PACL)&(Buffer[BufferIndex]);
|
|
|
|
PACCESS_ALLOWED_ACE pace;
|
2004-08-14 01:55:43 +02:00
|
|
|
SID* psid;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
psd->Dacl = BufferIndex;
|
|
|
|
|
|
|
|
pacl->AclRevision = MIN_ACL_REVISION;
|
|
|
|
pacl->AceCount = 3;
|
|
|
|
pacl->AclSize = BufferIndex; /* storing the start index temporary */
|
|
|
|
|
|
|
|
BufferIndex += sizeof(ACL);
|
2002-06-01 01:06:46 +02:00
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/* ACE System - full access */
|
|
|
|
pace = (PACCESS_ALLOWED_ACE)&(Buffer[BufferIndex]);
|
|
|
|
BufferIndex += sizeof(ACCESS_ALLOWED_ACE)-sizeof(DWORD);
|
|
|
|
|
|
|
|
pace->Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
|
|
|
|
pace->Header.AceFlags = CONTAINER_INHERIT_ACE;
|
|
|
|
pace->Header.AceSize = sizeof(ACCESS_ALLOWED_ACE)-sizeof(DWORD) + RtlLengthRequiredSid(1);
|
|
|
|
pace->Mask = DELETE | READ_CONTROL | WRITE_DAC | WRITE_OWNER | 0x3f;
|
|
|
|
pace->SidStart = BufferIndex;
|
|
|
|
|
|
|
|
/* SID S-1-5-12 (System) */
|
2004-08-14 01:55:43 +02:00
|
|
|
psid = (SID*)&(Buffer[BufferIndex]);
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
|
|
|
BufferIndex += RtlLengthRequiredSid(1);
|
|
|
|
|
|
|
|
psid->Revision = SID_REVISION;
|
|
|
|
psid->SubAuthorityCount = 1;
|
|
|
|
psid->IdentifierAuthority = localSidAuthority;
|
|
|
|
psid->SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/* ACE Administrators - full access*/
|
|
|
|
pace = (PACCESS_ALLOWED_ACE) &(Buffer[BufferIndex]);
|
|
|
|
BufferIndex += sizeof(ACCESS_ALLOWED_ACE)-sizeof(DWORD);
|
|
|
|
|
|
|
|
pace->Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
|
|
|
|
pace->Header.AceFlags = CONTAINER_INHERIT_ACE;
|
|
|
|
pace->Header.AceSize = sizeof(ACCESS_ALLOWED_ACE)-sizeof(DWORD) + RtlLengthRequiredSid(2);
|
|
|
|
pace->Mask = DELETE | READ_CONTROL | WRITE_DAC | WRITE_OWNER | 0x3f;
|
|
|
|
pace->SidStart = BufferIndex;
|
|
|
|
|
|
|
|
/* S-1-5-12 (Administrators) */
|
2004-08-14 01:55:43 +02:00
|
|
|
psid = (SID*)&(Buffer[BufferIndex]);
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
|
|
|
BufferIndex += RtlLengthRequiredSid(2);
|
|
|
|
|
|
|
|
psid->Revision = SID_REVISION;
|
|
|
|
psid->SubAuthorityCount = 2;
|
|
|
|
psid->IdentifierAuthority = localSidAuthority;
|
|
|
|
psid->SubAuthority[0] = SECURITY_BUILTIN_DOMAIN_RID;
|
|
|
|
psid->SubAuthority[1] = DOMAIN_ALIAS_RID_ADMINS;
|
2002-06-01 01:06:46 +02:00
|
|
|
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
/* ACE Everyone - read access */
|
|
|
|
pace = (PACCESS_ALLOWED_ACE)&(Buffer[BufferIndex]);
|
|
|
|
BufferIndex += sizeof(ACCESS_ALLOWED_ACE)-sizeof(DWORD);
|
|
|
|
|
|
|
|
pace->Header.AceType = ACCESS_ALLOWED_ACE_TYPE;
|
|
|
|
pace->Header.AceFlags = CONTAINER_INHERIT_ACE;
|
|
|
|
pace->Header.AceSize = sizeof(ACCESS_ALLOWED_ACE)-sizeof(DWORD) + RtlLengthRequiredSid(1);
|
|
|
|
pace->Mask = READ_CONTROL| 0x19;
|
|
|
|
pace->SidStart = BufferIndex;
|
|
|
|
|
|
|
|
/* SID S-1-1-0 (Everyone) */
|
2004-08-14 01:55:43 +02:00
|
|
|
psid = (SID*)&(Buffer[BufferIndex]);
|
- implementation of RtlReg* (read access), RtlEvent*, RtlSemaphore*,
NtAllocateLocallyUniqueId
- implementation or stubs for NtAccessCheck, NtSetSecurityObject,
RtlClearBits, RtlEqualPrefixSid, RtlFindClearBits,
RtlFormatCurrentUserKeyPath, RtlGetControlSecurityDescriptor,
RtlIdentifierAuthoritySid, RtlImpersonateSelf, RtlInitializeBitMap,
RtlInitializeGenericTable, RtlMakeSelfRelativeSD,
RtlPrefixUnicodeString, RtlSetBits, RtlUnicodeToMultiByteN,
RtlUpcaseUnicodeStringToOemString, RtlUpcaseUnicodeToOemN,
RtlValidSid, RtlxUnicodeStringToOemSize
- corrected most RtlString* functions, added documentation
- more fixes and partial implementations
2000-01-23 23:35:33 +01:00
|
|
|
|
|
|
|
BufferIndex += RtlLengthRequiredSid(1);
|
|
|
|
|
|
|
|
psid->Revision = SID_REVISION;
|
|
|
|
psid->SubAuthorityCount = 1;
|
|
|
|
psid->IdentifierAuthority = worldSidAuthority;
|
|
|
|
psid->SubAuthority[0] = 0;
|
|
|
|
|
|
|
|
/* calculate used bytes */
|
|
|
|
pacl->AclSize = BufferIndex - pacl->AclSize;
|
|
|
|
}
|
|
|
|
*ResultLength = BufferIndex;
|
|
|
|
TRACE("len=%lu\n", *ResultLength);
|
|
|
|
if (Length < *ResultLength) return STATUS_BUFFER_TOO_SMALL;
|
|
|
|
memcpy(pSecurityDesriptor, Buffer, *ResultLength);
|
|
|
|
|
|
|
|
return STATUS_SUCCESS;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
2002-09-16 21:32:50 +02:00
|
|
|
|
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtDuplicateObject [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwDuplicateObject [NTDLL.@]
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2002-09-16 21:32:50 +02:00
|
|
|
NTSTATUS WINAPI NtDuplicateObject( HANDLE source_process, HANDLE source,
|
|
|
|
HANDLE dest_process, PHANDLE dest,
|
|
|
|
ACCESS_MASK access, ULONG attributes, ULONG options )
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2002-09-16 21:32:50 +02:00
|
|
|
NTSTATUS ret;
|
|
|
|
SERVER_START_REQ( dup_handle )
|
|
|
|
{
|
|
|
|
req->src_process = source_process;
|
|
|
|
req->src_handle = source;
|
|
|
|
req->dst_process = dest_process;
|
|
|
|
req->access = access;
|
2005-12-09 12:21:35 +01:00
|
|
|
req->attributes = attributes;
|
2002-09-16 21:32:50 +02:00
|
|
|
req->options = options;
|
|
|
|
|
|
|
|
if (!(ret = wine_server_call( req )))
|
|
|
|
{
|
|
|
|
if (dest) *dest = reply->handle;
|
|
|
|
if (reply->fd != -1) close( reply->fd );
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* NtClose [NTDLL.@]
|
2003-03-18 19:35:48 +01:00
|
|
|
*
|
|
|
|
* Close a handle reference to an object.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* Handle [I] handle to close
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
|
|
|
* Failure: An NTSTATUS error code.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2000-07-29 23:56:59 +02:00
|
|
|
NTSTATUS WINAPI NtClose( HANDLE Handle )
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2000-08-30 02:00:48 +02:00
|
|
|
NTSTATUS ret;
|
2001-02-27 03:09:16 +01:00
|
|
|
SERVER_START_REQ( close_handle )
|
2000-08-30 02:00:48 +02:00
|
|
|
{
|
|
|
|
req->handle = Handle;
|
2001-11-30 19:46:42 +01:00
|
|
|
ret = wine_server_call( req );
|
|
|
|
if (!ret && reply->fd != -1) close( reply->fd );
|
2000-08-30 02:00:48 +02:00
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Directory functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* NtOpenDirectoryObject [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwOpenDirectoryObject [NTDLL.@]
|
2003-03-18 19:35:48 +01:00
|
|
|
*
|
|
|
|
* Open a namespace directory object.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* DirectoryHandle [O] Destination for the new directory handle
|
|
|
|
* DesiredAccess [I] Desired access to the directory
|
|
|
|
* ObjectAttributes [I] Structure describing the directory
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
|
|
|
* Failure: An NTSTATUS error code.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2005-11-29 17:21:05 +01:00
|
|
|
NTSTATUS WINAPI NtOpenDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK DesiredAccess,
|
|
|
|
POBJECT_ATTRIBUTES ObjectAttributes)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2005-11-29 17:21:05 +01:00
|
|
|
NTSTATUS ret;
|
|
|
|
TRACE("(%p,0x%08lx)\n", DirectoryHandle, DesiredAccess);
|
|
|
|
dump_ObjectAttributes(ObjectAttributes);
|
|
|
|
|
|
|
|
if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
|
|
|
|
if (!ObjectAttributes) return STATUS_INVALID_PARAMETER;
|
|
|
|
/* Have to test it here because server won't know difference between
|
|
|
|
* ObjectName == NULL and ObjectName == "" */
|
|
|
|
if (!ObjectAttributes->ObjectName)
|
|
|
|
{
|
|
|
|
if (ObjectAttributes->RootDirectory)
|
|
|
|
return STATUS_OBJECT_NAME_INVALID;
|
|
|
|
else
|
|
|
|
return STATUS_OBJECT_PATH_SYNTAX_BAD;
|
|
|
|
}
|
|
|
|
|
|
|
|
SERVER_START_REQ(open_directory)
|
|
|
|
{
|
|
|
|
req->access = DesiredAccess;
|
|
|
|
req->attributes = ObjectAttributes->Attributes;
|
|
|
|
req->rootdir = ObjectAttributes->RootDirectory;
|
|
|
|
if (ObjectAttributes->ObjectName)
|
|
|
|
wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
|
|
|
|
ObjectAttributes->ObjectName->Length);
|
|
|
|
ret = wine_server_call( req );
|
|
|
|
*DirectoryHandle = reply->handle;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtCreateDirectoryObject [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwCreateDirectoryObject [NTDLL.@]
|
2005-11-29 17:21:05 +01:00
|
|
|
*
|
|
|
|
* Create a namespace directory object.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* DirectoryHandle [O] Destination for the new directory handle
|
|
|
|
* DesiredAccess [I] Desired access to the directory
|
|
|
|
* ObjectAttributes [I] Structure describing the directory
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
|
|
|
* Failure: An NTSTATUS error code.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2005-11-29 17:21:05 +01:00
|
|
|
NTSTATUS WINAPI NtCreateDirectoryObject(PHANDLE DirectoryHandle, ACCESS_MASK DesiredAccess,
|
|
|
|
POBJECT_ATTRIBUTES ObjectAttributes)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2005-11-29 17:21:05 +01:00
|
|
|
NTSTATUS ret;
|
|
|
|
TRACE("(%p,0x%08lx)\n", DirectoryHandle, DesiredAccess);
|
|
|
|
dump_ObjectAttributes(ObjectAttributes);
|
|
|
|
|
|
|
|
if (!DirectoryHandle) return STATUS_ACCESS_VIOLATION;
|
|
|
|
|
|
|
|
SERVER_START_REQ(create_directory)
|
|
|
|
{
|
|
|
|
req->access = DesiredAccess;
|
|
|
|
req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
|
|
|
|
req->rootdir = ObjectAttributes ? ObjectAttributes->RootDirectory : 0;
|
|
|
|
if (ObjectAttributes && ObjectAttributes->ObjectName)
|
|
|
|
wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
|
|
|
|
ObjectAttributes->ObjectName->Length);
|
|
|
|
ret = wine_server_call( req );
|
|
|
|
*DirectoryHandle = reply->handle;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-19 20:20:47 +02:00
|
|
|
* NtQueryDirectoryObject [NTDLL.@]
|
2001-07-11 20:56:41 +02:00
|
|
|
* ZwQueryDirectoryObject [NTDLL.@]
|
2003-03-18 19:35:48 +01:00
|
|
|
*
|
|
|
|
* Read information from a namespace directory.
|
|
|
|
*
|
|
|
|
* PARAMS
|
2005-10-28 18:42:11 +02:00
|
|
|
* DirectoryHandle [I] Handle to a directory object
|
|
|
|
* Buffer [O] Buffer to hold the read data
|
2003-03-18 19:35:48 +01:00
|
|
|
* BufferLength [I] Size of the buffer in bytes
|
2005-10-28 18:42:11 +02:00
|
|
|
* ReturnSingleEntry [I] If TRUE, return a single entry, if FALSE, return as many as fit in the buffer
|
|
|
|
* RestartScan [I] If TRUE, start scanning from the start, if FALSE, scan from Context
|
|
|
|
* Context [I/O] Indicates what point of the directory the scan is at
|
|
|
|
* ReturnLength [O] Caller supplied storage for the number of bytes written (or NULL)
|
2003-03-18 19:35:48 +01:00
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
|
|
|
* Failure: An NTSTATUS error code.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2005-10-28 18:42:11 +02:00
|
|
|
NTSTATUS WINAPI NtQueryDirectoryObject(IN HANDLE DirectoryHandle, OUT PDIRECTORY_BASIC_INFORMATION Buffer,
|
|
|
|
IN ULONG BufferLength, IN BOOLEAN ReturnSingleEntry, IN BOOLEAN RestartScan,
|
|
|
|
IN OUT PULONG Context, OUT PULONG ReturnLength OPTIONAL)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2005-10-28 18:42:11 +02:00
|
|
|
FIXME("(%p,%p,0x%08lx,0x%08x,0x%08x,%p,%p), stub\n", DirectoryHandle, Buffer, BufferLength, ReturnSingleEntry,
|
|
|
|
RestartScan, Context, ReturnLength);
|
|
|
|
|
|
|
|
return STATUS_NOT_IMPLEMENTED;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Link objects
|
|
|
|
*/
|
2002-06-01 01:06:46 +02:00
|
|
|
|
1999-03-09 18:47:51 +01:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtOpenSymbolicLinkObject [NTDLL.@]
|
2005-11-30 19:22:57 +01:00
|
|
|
* ZwOpenSymbolicLinkObject [NTDLL.@]
|
|
|
|
*
|
|
|
|
* Open a namespace symbolic link object.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* LinkHandle [O] Destination for the new symbolic link handle
|
|
|
|
* DesiredAccess [I] Desired access to the symbolic link
|
|
|
|
* ObjectAttributes [I] Structure describing the symbolic link
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
|
|
|
* Failure: An NTSTATUS error code.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2005-11-30 19:22:57 +01:00
|
|
|
NTSTATUS WINAPI NtOpenSymbolicLinkObject(OUT PHANDLE LinkHandle, IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2005-11-30 19:22:57 +01:00
|
|
|
NTSTATUS ret;
|
|
|
|
TRACE("(%p,0x%08lx,%p)\n",LinkHandle, DesiredAccess, ObjectAttributes);
|
|
|
|
dump_ObjectAttributes(ObjectAttributes);
|
|
|
|
|
|
|
|
if (!LinkHandle) return STATUS_ACCESS_VIOLATION;
|
|
|
|
if (!ObjectAttributes) return STATUS_INVALID_PARAMETER;
|
|
|
|
/* Have to test it here because server won't know difference between
|
|
|
|
* ObjectName == NULL and ObjectName == "" */
|
|
|
|
if (!ObjectAttributes->ObjectName)
|
|
|
|
{
|
|
|
|
if (ObjectAttributes->RootDirectory)
|
|
|
|
return STATUS_OBJECT_NAME_INVALID;
|
|
|
|
else
|
|
|
|
return STATUS_OBJECT_PATH_SYNTAX_BAD;
|
|
|
|
}
|
|
|
|
|
|
|
|
SERVER_START_REQ(open_symlink)
|
|
|
|
{
|
|
|
|
req->access = DesiredAccess;
|
2006-06-17 13:32:05 +02:00
|
|
|
req->attributes = ObjectAttributes->Attributes;
|
|
|
|
req->rootdir = ObjectAttributes->RootDirectory;
|
2005-11-30 19:22:57 +01:00
|
|
|
if (ObjectAttributes->ObjectName)
|
|
|
|
wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
|
|
|
|
ObjectAttributes->ObjectName->Length);
|
|
|
|
ret = wine_server_call( req );
|
|
|
|
*LinkHandle = reply->handle;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtCreateSymbolicLinkObject [NTDLL.@]
|
2005-11-30 19:22:57 +01:00
|
|
|
* ZwCreateSymbolicLinkObject [NTDLL.@]
|
|
|
|
*
|
|
|
|
* Open a namespace symbolic link object.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* SymbolicLinkHandle [O] Destination for the new symbolic link handle
|
|
|
|
* DesiredAccess [I] Desired access to the symbolic link
|
|
|
|
* ObjectAttributes [I] Structure describing the symbolic link
|
|
|
|
* TargetName [I] Name of the target symbolic link points to
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
|
|
|
* Failure: An NTSTATUS error code.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2005-11-30 19:22:57 +01:00
|
|
|
NTSTATUS WINAPI NtCreateSymbolicLinkObject(OUT PHANDLE SymbolicLinkHandle,IN ACCESS_MASK DesiredAccess,
|
|
|
|
IN POBJECT_ATTRIBUTES ObjectAttributes,
|
|
|
|
IN PUNICODE_STRING TargetName)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2005-11-30 19:22:57 +01:00
|
|
|
NTSTATUS ret;
|
|
|
|
TRACE("(%p,0x%08lx,%p, -> %s)\n", SymbolicLinkHandle, DesiredAccess, ObjectAttributes,
|
|
|
|
debugstr_us(TargetName));
|
|
|
|
dump_ObjectAttributes(ObjectAttributes);
|
|
|
|
|
|
|
|
if (!SymbolicLinkHandle || !TargetName) return STATUS_ACCESS_VIOLATION;
|
|
|
|
if (!TargetName->Buffer) return STATUS_INVALID_PARAMETER;
|
|
|
|
|
|
|
|
SERVER_START_REQ(create_symlink)
|
|
|
|
{
|
|
|
|
req->access = DesiredAccess;
|
|
|
|
req->attributes = ObjectAttributes ? ObjectAttributes->Attributes : 0;
|
|
|
|
req->rootdir = ObjectAttributes ? ObjectAttributes->RootDirectory : 0;
|
|
|
|
if (ObjectAttributes->ObjectName)
|
|
|
|
{
|
|
|
|
req->name_len = ObjectAttributes->ObjectName->Length;
|
|
|
|
wine_server_add_data(req, ObjectAttributes->ObjectName->Buffer,
|
|
|
|
ObjectAttributes->ObjectName->Length);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
req->name_len = 0;
|
|
|
|
wine_server_add_data(req, TargetName->Buffer, TargetName->Length);
|
|
|
|
ret = wine_server_call( req );
|
|
|
|
*SymbolicLinkHandle = reply->handle;
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtQuerySymbolicLinkObject [NTDLL.@]
|
2005-11-30 19:22:57 +01:00
|
|
|
* ZwQuerySymbolicLinkObject [NTDLL.@]
|
|
|
|
*
|
|
|
|
* Query a namespace symbolic link object target name.
|
|
|
|
*
|
|
|
|
* PARAMS
|
|
|
|
* LinkHandle [I] Handle to a symbolic link object
|
|
|
|
* LinkTarget [O] Destination for the symbolic link target
|
|
|
|
* ReturnedLength [O] Size of returned data
|
|
|
|
*
|
|
|
|
* RETURNS
|
|
|
|
* Success: ERROR_SUCCESS.
|
|
|
|
* Failure: An NTSTATUS error code.
|
1999-03-09 18:47:51 +01:00
|
|
|
*/
|
2005-11-30 19:22:57 +01:00
|
|
|
NTSTATUS WINAPI NtQuerySymbolicLinkObject(IN HANDLE LinkHandle, IN OUT PUNICODE_STRING LinkTarget,
|
|
|
|
OUT PULONG ReturnedLength OPTIONAL)
|
1999-03-09 18:47:51 +01:00
|
|
|
{
|
2005-11-30 19:22:57 +01:00
|
|
|
NTSTATUS ret;
|
|
|
|
TRACE("(%p,%p,%p)\n", LinkHandle, LinkTarget, ReturnedLength);
|
1999-03-09 18:47:51 +01:00
|
|
|
|
2005-11-30 19:22:57 +01:00
|
|
|
if (!LinkTarget) return STATUS_ACCESS_VIOLATION;
|
|
|
|
|
|
|
|
SERVER_START_REQ(query_symlink)
|
|
|
|
{
|
|
|
|
req->handle = LinkHandle;
|
|
|
|
wine_server_set_reply( req, LinkTarget->Buffer, LinkTarget->MaximumLength );
|
|
|
|
if (!(ret = wine_server_call( req )))
|
|
|
|
{
|
|
|
|
LinkTarget->Length = wine_server_reply_size(reply);
|
|
|
|
if (ReturnedLength) *ReturnedLength = LinkTarget->Length;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
SERVER_END_REQ;
|
|
|
|
return ret;
|
1999-03-09 18:47:51 +01:00
|
|
|
}
|
|
|
|
|
2000-04-13 17:56:40 +02:00
|
|
|
/******************************************************************************
|
2001-06-21 01:03:14 +02:00
|
|
|
* NtAllocateUuids [NTDLL.@]
|
2000-04-13 17:56:40 +02:00
|
|
|
*/
|
2005-06-16 12:46:11 +02:00
|
|
|
NTSTATUS WINAPI NtAllocateUuids(
|
|
|
|
PULARGE_INTEGER Time,
|
|
|
|
PULONG Range,
|
|
|
|
PULONG Sequence)
|
2000-04-13 17:56:40 +02:00
|
|
|
{
|
2005-06-16 12:46:11 +02:00
|
|
|
FIXME("(%p,%p,%p), stub.\n", Time, Range, Sequence);
|
2000-04-13 17:56:40 +02:00
|
|
|
return 0;
|
|
|
|
}
|