Commit 02d45e52 authored by Juergen Schmied's avatar Juergen Schmied Committed by Alexandre Julliard

- 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
parent 2527a333
......@@ -112,7 +112,7 @@ type win32
@ stub ImpersonateLoggedOnUser
@ stub ImpersonateNamedPipeClient
@ stdcall ImpersonateSelf(long) ImpersonateSelf
@ stub InitializeAcl
@ stdcall InitializeAcl(ptr long long) InitializeAcl
@ stdcall InitializeSecurityDescriptor(ptr long) InitializeSecurityDescriptor
@ stdcall InitializeSid(ptr ptr long) InitializeSid
@ stub InitiateSystemShutdownA
......@@ -224,7 +224,7 @@ type win32
@ stub SetAclInformation
@ stdcall SetFileSecurityA(str long ptr ) SetFileSecurityA
@ stdcall SetFileSecurityW(wstr long ptr) SetFileSecurityW
@ stub SetKernelObjectSecurity
@ stdcall SetKernelObjectSecurity(long long ptr) SetKernelObjectSecurity
@ stub SetPrivateObjectSecurity
@ stdcall SetSecurityDescriptorDacl(ptr long ptr long) SetSecurityDescriptorDacl
@ stdcall SetSecurityDescriptorGroup (ptr ptr long) SetSecurityDescriptorGroup
......@@ -241,7 +241,7 @@ type win32
@ stdcall StartServiceW(long long ptr) StartServiceW
@ stub UnlockServiceDatabase
@ stdcall LsaOpenPolicy(long long long long) LsaOpenPolicy
@ stub LsaLookupSids
@ stdcall LsaLookupSids(ptr long ptr ptr ptr) LsaLookupSids
@ stdcall LsaFreeMemory(ptr)LsaFreeMemory
@ stdcall LsaQueryInformationPolicy(ptr long ptr)LsaQueryInformationPolicy
@ stdcall LsaClose(ptr)LsaClose
......
......@@ -10,6 +10,7 @@ SPEC_SRCS = ntdll.spec
C_SRCS = \
exception.c \
file.c \
misc.c \
nt.c \
om.c \
reg.c \
......
#include <stdlib.h>
#include <string.h>
#include "debugtools.h"
#include "ntdll_misc.h"
#include "ntddk.h"
......@@ -25,10 +26,10 @@ NTSTATUS WINAPI NtOpenFile(
ULONG ShareAccess,
ULONG OpenOptions)
{
FIXME("(%p,0x%08lx,%p(%s),%p,0x%08lx,0x%08lx) stub\n",
FIXME("(%p,0x%08lx,%p,%p,0x%08lx,0x%08lx) stub\n",
FileHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
IoStatusBlock, ShareAccess, OpenOptions);
dump_ObjectAttributes (ObjectAttributes);
return 0;
}
......@@ -64,11 +65,11 @@ NTSTATUS WINAPI NtCreateFile(
PVOID EaBuffer,
ULONG EaLength)
{
FIXME("(%p,0x%08lx,%p(%s),%p,%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p,0x%08lx) stub\n",
FIXME("(%p,0x%08lx,%p,%p,%p,0x%08lx,0x%08lx,0x%08lx,0x%08lx,%p,0x%08lx) stub\n",
FileHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
IoStatusBlock,AllocateSize,FileAttributes,
ShareAccess,CreateDisposition,CreateOptions,EaBuffer,EaLength);
dump_ObjectAttributes (ObjectAttributes);
return 0;
}
......@@ -210,6 +211,21 @@ NTSTATUS WINAPI NtQueryDirectoryFile(
FIXME("(0x%08x 0x%08x %p %p %p %p 0x%08lx 0x%08x 0x%08x %p 0x%08x\n",
FileHandle, Event, ApcRoutine, ApcContext, IoStatusBlock, FileInformation,
Length, FileInformationClass, ReturnSingleEntry,
debugstr_w(FileName->Buffer),RestartScan);
debugstr_us(FileName),RestartScan);
return 0;
}
/******************************************************************************
* NtQueryVolumeInformationFile [NTDLL]
*/
NTSTATUS WINAPI NtQueryVolumeInformationFile (
IN HANDLE FileHandle,
OUT PIO_STATUS_BLOCK IoStatusBlock,
OUT PVOID FSInformation,
IN ULONG Length,
IN FS_INFORMATION_CLASS FSInformationClass)
{
TRACE("(0x%08x %p %p 0x%08lx 0x%08x) stub\n",
FileHandle, IoStatusBlock, FSInformation, Length, FSInformationClass);
return STATUS_SUCCESS;
}
/*
* Helper functions for ntdll
*/
#include <time.h>
#include "config.h"
#include "debugstr.h"
#include "debugtools.h"
#include "ntdll_misc.h"
DEFAULT_DEBUG_CHANNEL(ntdll)
void dump_ObjectAttributes (POBJECT_ATTRIBUTES oa)
{
if (oa)
TRACE("%p:(name=%s, attr=0x%08lx, hRoot=0x%08x, sd=%p) \n",
oa, debugstr_us(oa->ObjectName),
oa->Attributes, oa->RootDirectory, oa->SecurityDescriptor);
}
void dump_AnsiString(PANSI_STRING as, BOOLEAN showstring)
{
if (as)
{
if (showstring)
TRACE("%p %p(%s) (%u %u)\n", as, as->Buffer, debugstr_as(as), as->Length, as->MaximumLength);
else
TRACE("%p %p(<OUT>) (%u %u)\n", as, as->Buffer, as->Length, as->MaximumLength);
}
}
void dump_UnicodeString(PUNICODE_STRING us, BOOLEAN showstring)
{
if (us)
{
if (showstring)
TRACE("%p %p(%s) (%u %u)\n", us, us->Buffer, debugstr_us(us), us->Length, us->MaximumLength);
else
TRACE("%p %p(<OUT>) (%u %u)\n", us, us->Buffer, us->Length, us->MaximumLength);
}
}
LPSTR debugstr_as (PANSI_STRING us)
{
if (!us) return NULL;
return debugstr_an(us->Buffer, us->Length);
}
LPSTR debugstr_us (PUNICODE_STRING us)
{
if (!us) return NULL;
return debugstr_wn(us->Buffer, us->Length);
}
......@@ -15,6 +15,7 @@
#include "debugtools.h"
#include "ntddk.h"
#include "ntdll_misc.h"
DEFAULT_DEBUG_CHANNEL(ntdll)
......@@ -31,10 +32,9 @@ NTSTATUS WINAPI NtCreateTimer(
IN POBJECT_ATTRIBUTES ObjectAttributes OPTIONAL,
IN TIMER_TYPE TimerType)
{
FIXME("(%p,0x%08lx,%p(%s),0x%08x) stub\n",
TimerHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
TimerType);
FIXME("(%p,0x%08lx,%p,0x%08x) stub\n",
TimerHandle,DesiredAccess,ObjectAttributes, TimerType);
dump_ObjectAttributes(ObjectAttributes);
return 0;
}
/**************************************************************************
......@@ -192,8 +192,9 @@ NTSTATUS WINAPI NtDuplicateToken(
OUT PHANDLE NewToken)
{
FIXME("(0x%08x,0x%08lx,%p,0x%08x,0x%08x,%p),stub!\n",
ExistingToken, DesiredAccess, ObjectAttributes, ImpersonationLevel,
TokenType, NewToken);
ExistingToken, DesiredAccess, ObjectAttributes,
ImpersonationLevel, TokenType, NewToken);
dump_ObjectAttributes(ObjectAttributes);
return 0;
}
......@@ -247,6 +248,11 @@ NTSTATUS WINAPI NtAdjustPrivilegesToken(
/******************************************************************************
* NtQueryInformationToken [NTDLL.156]
*
* NOTES
* Buffer for TokenUser:
* 0x00 TOKEN_USER the PSID field points to the SID
* 0x08 SID
*
*/
NTSTATUS WINAPI NtQueryInformationToken(
HANDLE token,
......@@ -263,7 +269,20 @@ NTSTATUS WINAPI NtQueryInformationToken(
*retlen = sizeof (TOKEN_GROUPS);
break;
case TokenUser: /* 1 */
*retlen = sizeof (TOKEN_USER);
{
int len = sizeof (TOKEN_USER)+ sizeof(SID);
*retlen = len;
if ( len <= tokeninfolength)
if( tokeninfo )
{
TOKEN_USER * tuser = tokeninfo;
PSID sid = (PSID) &((LPBYTE)tokeninfo)[sizeof(TOKEN_USER)];
SID_IDENTIFIER_AUTHORITY localSidAuthority = {SECURITY_NT_AUTHORITY};
RtlInitializeSid(sid, &localSidAuthority, 1);
*(RtlSubAuthoritySid(sid, 0)) = SECURITY_INTERACTIVE_RID;
tuser->User.Sid = sid;
}
}
break;
case TokenPrivileges:
*retlen = sizeof (TOKEN_PRIVILEGES);
......@@ -308,10 +327,10 @@ NTSTATUS WINAPI NtCreateSection(
IN ULONG AllocationAttributes,
IN HANDLE FileHandle OPTIONAL)
{
FIXME("(%p,0x%08lx,%p(%s),%p,0x%08lx,0x%08lx,0x%08x) stub\n",
SectionHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
FIXME("(%p,0x%08lx,%p,%p,0x%08lx,0x%08lx,0x%08x) stub\n",
SectionHandle,DesiredAccess, ObjectAttributes,
MaximumSize,SectionPageProtection,AllocationAttributes,FileHandle);
dump_ObjectAttributes(ObjectAttributes);
return 0;
}
......@@ -323,9 +342,9 @@ NTSTATUS WINAPI NtOpenSection(
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME("(%p,0x%08lx,%p(%s)),stub!\n",
SectionHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
FIXME("(%p,0x%08lx,%p),stub!\n",
SectionHandle,DesiredAccess,ObjectAttributes);
dump_ObjectAttributes(ObjectAttributes);
return 0;
}
......@@ -549,6 +568,35 @@ NTSTATUS WINAPI NtDisplayString (
}
/******************************************************************************
* _alldiv [NTDLL.937]
*
*
*/
long long WINAPI _alldiv(LARGE_INTEGER a, LARGE_INTEGER b)
{
#if SIZEOF_LONG_LONG==8
return (*(long long*)&a / *(long long*)&b);
#else
FIXME(ntdll,"stub\n");
retrun 0;
#endif
}
/******************************************************************************
* _allmul [NTDLL.938]
*
*
*/
long long WINAPI _allmul(LARGE_INTEGER a, LARGE_INTEGER b)
{
#if SIZEOF_LONG_LONG==8
return (*(long long*)&a * *(long long*)&b);
#else
FIXME(ntdll,"stub\n");
retrun 0;
#endif
}
/******************************************************************************
* NtPowerInformation [NTDLL]
*
*/
......@@ -557,3 +605,20 @@ NTSTATUS WINAPI NtPowerInformation(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3,x4,x5);
return 0;
}
/******************************************************************************
* NtAllocateLocallyUniqueId
*
* FIXME: the server should do that
*/
NTSTATUS WINAPI NtAllocateLocallyUniqueId(PLUID Luid)
{
static LUID luid;
FIXME("%p (0x%08lx%08lx)\n", Luid, luid.DUMMYSTRUCTNAME.HighPart, luid.DUMMYSTRUCTNAME.LowPart);
luid.QuadPart++;
Luid->QuadPart = luid.QuadPart;
return STATUS_SUCCESS;
}
......@@ -57,19 +57,19 @@ type win32
@ stub NlsMbCodePageTag
@ stub NlsMbOemCodePageTag
@ stdcall NtAcceptConnectPort(long long long long long long) NtAcceptConnectPort
@ stub NtAccessCheck
@ stdcall NtAccessCheck(ptr long long ptr ptr ptr ptr ptr) NtAccessCheck
@ stub NtAccessCheckAndAuditAlarm
@ stub NtAdjustGroupsToken
@ stdcall NtAdjustPrivilegesToken(long long long long long long) NtAdjustPrivilegesToken
@ stub NtAlertResumeThread
@ stub NtAlertThread
@ stub NtAllocateLocallyUniqueId
@ stdcall NtAllocateLocallyUniqueId(ptr) NtAllocateLocallyUniqueId
@ stub NtAllocateUuids
@ stub NtAllocateVirtualMemory
@ stub NtCallbackReturn
@ stub NtCancelIoFile
@ stub NtCancelTimer
@ stub NtClearEvent
@ stdcall NtClearEvent(long) NtClearEvent
@ stdcall NtClose(long) NtClose
@ stub NtCloseObjectAuditAlarm
@ stdcall NtCompleteConnectPort(long) NtCompleteConnectPort
......@@ -150,13 +150,13 @@ type win32
@ stub NtPrivilegeObjectAuditAlarm
@ stub NtPrivilegedServiceAuditAlarm
@ stub NtProtectVirtualMemory
@ stub NtPulseEvent
@ stdcall NtPulseEvent(long ptr) NtPulseEvent
@ stub NtQueryAttributesFile
@ stub NtQueryDefaultLocale
@ stdcall NtQueryDirectoryFile(long long ptr ptr ptr ptr long long long ptr long)NtQueryDirectoryFile
@ stdcall NtQueryDirectoryObject(long long long long long long long) NtQueryDirectoryObject
@ stub NtQueryEaFile
@ stub NtQueryEvent
@ stdcall NtQueryEvent(long long ptr long ptr) NtQueryEvent
@ stdcall NtQueryInformationFile(long long long long long) NtQueryInformationFile
@ stub NtQueryInformationPort
@ stdcall NtQueryInformationProcess(long long long long long) NtQueryInformationProcess
......@@ -179,7 +179,6 @@ type win32
@ stdcall NtQueryTimerResolution(long long long) NtQueryTimerResolution
@ stdcall NtQueryValueKey(long long long long long long) NtQueryValueKey
@ stub NtQueryVirtualMemory
@ stub NtQueryVolumeInformationFile
@ stdcall NtRaiseException(ptr ptr long) NtRaiseException
@ stub NtRaiseHardError
@ stdcall NtReadFile(long long long long long long long long long) NtReadFile
......@@ -197,7 +196,7 @@ type win32
@ stub NtReplyWaitReplyPort
@ stub NtRequestPort
@ stdcall NtRequestWaitReplyPort(long long long) NtRequestWaitReplyPort
@ stub NtResetEvent
@ stdcall NtResetEvent(long ptr) NtResetEvent
@ stdcall NtRestoreKey(long long long) NtRestoreKey
@ stdcall NtResumeThread(long long) NtResumeThread
@ stdcall NtSaveKey(long long) NtSaveKey
......@@ -221,7 +220,7 @@ type win32
@ stub NtSetLowEventPair
@ stub NtSetLowWaitHighEventPair
@ stub NtSetLowWaitHighThread
@ stub NtSetSecurityObject
@ stdcall NtSetSecurityObject(long long ptr) NtSetSecurityObject
@ stub NtSetSystemEnvironmentValue
@ stub NtSetSystemInformation
@ stub NtSetSystemPowerState
......@@ -290,7 +289,7 @@ type win32
@ stub RtlCharToInteger
@ stub RtlCheckRegistryKey
@ stub RtlClearAllBits
@ stub RtlClearBits
@ stdcall RtlClearBits(long long long) RtlClearBits
@ stub RtlCompactHeap
@ stub RtlCompareMemory
@ stub RtlCompareMemoryUlong
......@@ -356,7 +355,7 @@ type win32
@ stub RtlEqualComputerName
@ stub RtlEqualDomainName
@ stub RtlEqualLuid
@ stub RtlEqualPrefixSid
@ stdcall RtlEqualPrefixSid(ptr ptr) RtlEqualPrefixSid
@ stdcall RtlEqualSid (long long) RtlEqualSid
@ stub RtlEqualString
@ stdcall RtlEqualUnicodeString(long long long) RtlEqualUnicodeString
......@@ -368,7 +367,7 @@ type win32
@ stub RtlExtendedMagicDivide
@ stdcall RtlFillMemory(ptr long long) RtlFillMemory
@ stub RtlFillMemoryUlong
@ stub RtlFindClearBits
@ stdcall RtlFindClearBits(long long long) RtlFindClearBits
@ stub RtlFindClearBitsAndSet
@ stub RtlFindLongestRunClear
@ stub RtlFindLongestRunSet
......@@ -376,7 +375,7 @@ type win32
@ stub RtlFindSetBits
@ stub RtlFindSetBitsAndClear
@ stdcall RtlFirstFreeAce(ptr ptr) RtlFirstFreeAce
@ stdcall RtlFormatCurrentUserKeyPath(wstr) RtlFormatCurrentUserKeyPath
@ stdcall RtlFormatCurrentUserKeyPath(ptr) RtlFormatCurrentUserKeyPath
@ stub RtlFormatMessage
@ stdcall RtlFreeAnsiString(long) RtlFreeAnsiString
@ stdcall RtlFreeHeap(long long long) RtlFreeHeap
......@@ -387,7 +386,7 @@ type win32
@ stdcall RtlGetAce(ptr long ptr) RtlGetAce
@ stub RtlGetCallersAddress
@ stub RtlGetCompressionWorkSpaceSize
@ stub RtlGetControlSecurityDescriptor
@ stdcall RtlGetControlSecurityDescriptor(ptr ptr ptr) RtlGetControlSecurityDescriptor
@ stub RtlGetCurrentDirectory_U
@ stdcall RtlGetDaclSecurityDescriptor(ptr ptr ptr ptr) RtlGetDaclSecurityDescriptor
@ stub RtlGetElementGenericTable
......@@ -400,19 +399,19 @@ type win32
@ stub RtlGetProcessHeaps
@ stdcall RtlGetSaclSecurityDescriptor(ptr ptr ptr ptr)RtlGetSaclSecurityDescriptor
@ stub RtlGetUserInfoHeap
@ stub RtlIdentifierAuthoritySid
@ stdcall RtlIdentifierAuthoritySid(ptr) RtlIdentifierAuthoritySid
@ stub RtlImageDirectoryEntryToData
@ stdcall RtlImageNtHeader(long) RtlImageNtHeader
@ stub RtlImpersonateSelf
@ stdcall RtlImpersonateSelf(long) RtlImpersonateSelf
@ stdcall RtlInitAnsiString(ptr str) RtlInitAnsiString
@ stub RtlInitCodePageTable
@ stub RtlInitNlsTables
@ stdcall RtlInitString(ptr str) RtlInitString
@ stdcall RtlInitUnicodeString(ptr wstr) RtlInitUnicodeString
@ stub RtlInitializeBitMap
@ stdcall RtlInitializeBitMap(long long long) RtlInitializeBitMap
@ stub RtlInitializeContext
@ stdcall RtlInitializeCriticalSection(ptr) InitializeCriticalSection
@ stub RtlInitializeGenericTable
@ stdcall RtlInitializeGenericTable() RtlInitializeGenericTable
@ stub RtlInitializeRXact
@ stdcall RtlInitializeResource(ptr) RtlInitializeResource
@ stdcall RtlInitializeSid(ptr ptr long) RtlInitializeSid
......@@ -438,7 +437,7 @@ type win32
@ stub RtlLocalTimeToSystemTime
@ stub RtlLockHeap
@ stub RtlLookupElementGenericTable
@ stub RtlMakeSelfRelativeSD
@ stdcall RtlMakeSelfRelativeSD(ptr ptr ptr) RtlMakeSelfRelativeSD
@ stub RtlMapGenericMask
@ stdcall RtlMoveMemory(ptr ptr long) RtlMoveMemory
@ stdcall RtlMultiByteToUnicodeN(ptr long ptr ptr long) RtlMultiByteToUnicodeN
......@@ -457,7 +456,7 @@ type win32
@ stdcall RtlOpenCurrentUser(long ptr) RtlOpenCurrentUser
@ stub RtlPcToFileHeader
@ stub RtlPrefixString
@ stub RtlPrefixUnicodeString
@ stdcall RtlPrefixUnicodeString(ptr ptr long) RtlPrefixUnicodeString
@ stub RtlProtectHeap
@ stdcall RtlQueryEnvironmentVariable_U(long long long) RtlQueryEnvironmentVariable_U
@ stub RtlQueryInformationAcl
......@@ -485,7 +484,7 @@ type win32
@ stub RtlSecondsSince1980ToTime
@ stub RtlSelfRelativeToAbsoluteSD
@ stub RtlSetAllBits
@ stub RtlSetBits
@ stdcall RtlSetBits(long long long) RtlSetBits
@ stub RtlSetCurrentDirectory_U
@ stub RtlSetCurrentEnvironment
@ stdcall RtlSetDaclSecurityDescriptor(ptr long ptr long) RtlSetDaclSecurityDescriptor
......@@ -518,7 +517,7 @@ type win32
@ stub RtlUnicodeStringToOemSize
@ stdcall RtlUnicodeStringToOemString(ptr ptr long) RtlUnicodeStringToOemString
@ stub RtlUnicodeToCustomCPN
@ stub RtlUnicodeToMultiByteN
@ stdcall RtlUnicodeToMultiByteN(ptr long ptr ptr long) RtlUnicodeToMultiByteN
@ stub RtlUnicodeToMultiByteSize
@ stdcall RtlUnicodeToOemN(ptr long ptr ptr long) RtlUnicodeToOemN
@ stub RtlUniform
......@@ -528,16 +527,16 @@ type win32
@ stdcall RtlUpcaseUnicodeString(ptr ptr long) RtlUpcaseUnicodeString
@ stub RtlUpcaseUnicodeStringToAnsiString
@ stub RtlUpcaseUnicodeStringToCountedOemString
@ stub RtlUpcaseUnicodeStringToOemString
@ stdcall RtlUpcaseUnicodeStringToOemString(ptr ptr long) RtlUpcaseUnicodeStringToOemString
@ stub RtlUpcaseUnicodeToCustomCPN
@ stub RtlUpcaseUnicodeToMultiByteN
@ stub RtlUpcaseUnicodeToOemN
@ stdcall RtlUpcaseUnicodeToOemN(ptr long ptr ptr long) RtlUpcaseUnicodeToOemN
@ stub RtlUpperChar
@ stub RtlUpperString
@ stub RtlUsageHeap
@ stub RtlValidAcl
@ stdcall RtlValidSecurityDescriptor(ptr) RtlValidSecurityDescriptor
@ stub RtlValidSid
@ stdcall RtlValidSid(ptr) RtlValidSid
@ stub RtlValidateHeap
@ stub RtlValidateProcessHeaps
@ stub RtlWalkHeap
......@@ -556,7 +555,7 @@ type win32
@ stdcall RtlxAnsiStringToUnicodeSize(ptr) RtlxAnsiStringToUnicodeSize
@ stdcall RtlxOemStringToUnicodeSize(ptr) RtlxOemStringToUnicodeSize
@ stub RtlxUnicodeStringToAnsiSize
@ stub RtlxUnicodeStringToOemSize
@ stdcall RtlxUnicodeStringToOemSize(ptr) RtlxUnicodeStringToOemSize
@ stub SaveEm87Context
@ stdcall ZwAcceptConnectPort(long long long long long long) NtAcceptConnectPort
@ stub ZwAccessCheck
......@@ -956,8 +955,6 @@ type win32
@ cdecl wcstol(wstr ptr long) CRTDLL_wcstol
@ cdecl wcstombs(ptr ptr long) CRTDLL_wcstombs
@ stub wcstoul
# NT 4 additions
@ stub NtAddAtom
@ stub NtDeleteAtom
@ stub NtFindAtom
......
#ifndef __WINE_NTDLL_MISC_H
#define __WINE_NTDLL_MISC_H
#include "ntdef.h"
#include "winnt.h"
/* debug helper */
extern LPSTR debugstr_as (PANSI_STRING us);
extern LPSTR debugstr_us (PUNICODE_STRING us);
extern void dump_ObjectAttributes (POBJECT_ATTRIBUTES ObjectAttributes);
extern void dump_AnsiString(PANSI_STRING as, BOOLEAN showstring);
extern void dump_UnicodeString(PUNICODE_STRING us, BOOLEAN showstring);
#endif
......@@ -7,6 +7,7 @@
#include "debugtools.h"
#include "ntddk.h"
#include "ntdll_misc.h"
DEFAULT_DEBUG_CHANNEL(ntdll)
......@@ -34,11 +35,157 @@ NTSTATUS WINAPI NtQueryObject(
/******************************************************************************
* NtQuerySecurityObject [NTDLL]
*
* analogue to GetKernelObjectSecurity
*
* NOTES
* only the lowest 4 bit of SecurityObjectInformationClass are used
* 0x7-0xf returns STATUS_ACCESS_DENIED (even running with system priviledges)
*
* FIXME: we are constructing a fake sid
* (Administrators:Full, System:Full, Everyone:Read)
*/
NTSTATUS WINAPI NtQuerySecurityObject(DWORD x1,DWORD x2,DWORD x3,DWORD x4,DWORD x5)
NTSTATUS WINAPI
NtQuerySecurityObject(
IN HANDLE Object,
IN SECURITY_INFORMATION RequestedInformation,
OUT PSECURITY_DESCRIPTOR pSecurityDesriptor,
IN ULONG Length,
OUT PULONG ResultLength)
{
FIXME("(0x%08lx,0x%08lx,0x%08lx,0x%08lx,0x%08lx) stub!\n",x1,x2,x3,x4,x5);
return 0;
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);
FIXME("(0x%08x,0x%08lx,%p,0x%08lx,%p) stub!\n",
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);
psd->Control = SE_SELF_RELATIVE |
((RequestedInformation & DACL_SECURITY_INFORMATION) ? SE_DACL_PRESENT:0);
/* owner: administrator S-1-5-20-220*/
if (OWNER_SECURITY_INFORMATION & RequestedInformation)
{
PSID psid = (PSID)&(Buffer[BufferIndex]);
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;
}
/* group: built in domain S-1-5-12 */
if (GROUP_SECURITY_INFORMATION & RequestedInformation)
{
PSID psid = (PSID) &(Buffer[BufferIndex]);
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;
PSID psid;
psd->Dacl = BufferIndex;
pacl->AclRevision = MIN_ACL_REVISION;
pacl->AceCount = 3;
pacl->AclSize = BufferIndex; /* storing the start index temporary */
BufferIndex += sizeof(ACL);
/* 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) */
psid = (PSID)&(Buffer[BufferIndex]);
BufferIndex += RtlLengthRequiredSid(1);
psid->Revision = SID_REVISION;
psid->SubAuthorityCount = 1;
psid->IdentifierAuthority = localSidAuthority;
psid->SubAuthority[0] = SECURITY_LOCAL_SYSTEM_RID;
/* 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) */
psid = (PSID)&(Buffer[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;
/* 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) */
psid = (PSID)&(Buffer[BufferIndex]);
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;
}
/******************************************************************************
* NtDuplicateObject [NTDLL]
......@@ -68,8 +215,10 @@ NTSTATUS WINAPI NtDuplicateObject(
NTSTATUS WINAPI NtClose(
HANDLE Handle)
{
FIXME("(0x%08x),stub!\n",Handle);
return 1;
TRACE("(0x%08x)\n",Handle);
if (CloseHandle(Handle))
return STATUS_SUCCESS;
return STATUS_UNSUCCESSFUL; /*fixme*/
}
/******************************************************************************
......@@ -102,10 +251,10 @@ NTSTATUS WINAPI NtOpenDirectoryObject(
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME("(%p,0x%08lx,%p(%s)): stub\n",
DirectoryHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
return 0;
FIXME("(%p,0x%08lx,%p): stub\n",
DirectoryHandle, DesiredAccess, ObjectAttributes);
dump_ObjectAttributes(ObjectAttributes);
return 0;
}
/******************************************************************************
......@@ -116,9 +265,9 @@ NTSTATUS WINAPI NtCreateDirectoryObject(
ACCESS_MASK DesiredAccess,
POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME("(%p,0x%08lx,%p(%s)),stub!\n",
DirectoryHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
FIXME("(%p,0x%08lx,%p),stub!\n",
DirectoryHandle,DesiredAccess,ObjectAttributes);
dump_ObjectAttributes(ObjectAttributes);
return 0;
}
......@@ -162,9 +311,9 @@ NTSTATUS WINAPI NtOpenSymbolicLinkObject(
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME("(%p,0x%08lx,%p(%s)) stub\n",
LinkHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
FIXME("(%p,0x%08lx,%p) stub\n",
LinkHandle, DesiredAccess, ObjectAttributes);
dump_ObjectAttributes(ObjectAttributes);
return 0;
}
......@@ -177,10 +326,9 @@ NTSTATUS WINAPI NtCreateSymbolicLinkObject(
IN POBJECT_ATTRIBUTES ObjectAttributes,
IN PUNICODE_STRING Name)
{
FIXME("(%p,0x%08lx,%p(%s), %p) stub\n",
SymbolicLinkHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
debugstr_w(Name->Buffer));
FIXME("(%p,0x%08lx,%p, %p) stub\n",
SymbolicLinkHandle, DesiredAccess, ObjectAttributes, debugstr_us(Name));
dump_ObjectAttributes(ObjectAttributes);
return 0;
}
......@@ -193,7 +341,7 @@ NTSTATUS WINAPI NtQuerySymbolicLinkObject(
OUT PULONG ReturnedLength OPTIONAL)
{
FIXME("(0x%08x,%p,%p) stub\n",
LinkHandle, debugstr_w(LinkTarget->Buffer), ReturnedLength);
LinkHandle, debugstr_us(LinkTarget), ReturnedLength);
return 0;
}
......
......@@ -239,7 +239,7 @@ PVOID WINAPI RtlAllocateHeap(
ULONG Flags,
ULONG Size)
{
FIXME("(0x%08x, 0x%08lx, 0x%08lx) semi stub\n",
TRACE("(0x%08x, 0x%08lx, 0x%08lx) semi stub\n",
Heap, Flags, Size);
return HeapAlloc(Heap, Flags, Size);
}
......@@ -252,7 +252,7 @@ BOOLEAN WINAPI RtlFreeHeap(
ULONG Flags,
PVOID Address)
{
FIXME("(0x%08x, 0x%08lx, %p) semi stub\n",
TRACE("(0x%08x, 0x%08lx, %p) semi stub\n",
Heap, Flags, Address);
return HeapFree(Heap, Flags, Address);
}
......@@ -265,7 +265,7 @@ BOOLEAN WINAPI RtlFreeHeap(
BOOLEAN WINAPI RtlDestroyHeap(
HANDLE Heap)
{
FIXME("(0x%08x) semi stub\n", Heap);
TRACE("(0x%08x) semi stub\n", Heap);
return HeapDestroy(Heap);
}
......@@ -347,20 +347,72 @@ LPVOID WINAPI RtlNormalizeProcessParams(LPVOID x)
/**************************************************************************
* RtlNtStatusToDosError [NTDLL.442]
*/
DWORD WINAPI RtlNtStatusToDosError(DWORD error)
DWORD WINAPI RtlNtStatusToDosError(DWORD Status)
{
FIXME("(%lx): map STATUS_ to ERROR_\n",error);
switch (error)
{ case STATUS_SUCCESS: return ERROR_SUCCESS;
case STATUS_INVALID_PARAMETER: return ERROR_BAD_ARGUMENTS;
case STATUS_BUFFER_TOO_SMALL: return ERROR_INSUFFICIENT_BUFFER;
/* case STATUS_INVALID_SECURITY_DESCR: return ERROR_INVALID_SECURITY_DESCR;*/
case STATUS_NO_MEMORY: return ERROR_NOT_ENOUGH_MEMORY;
/* case STATUS_UNKNOWN_REVISION:
case STATUS_BUFFER_OVERFLOW:*/
TRACE("(0x%08lx)\n",Status);
switch (Status & 0xC0000000)
{
case 0x00000000:
switch (Status)
{
/*00*/ case STATUS_SUCCESS: return ERROR_SUCCESS;
}
break;
case 0x40000000:
switch (Status)
{
}
break;
case 0x80000000:
switch (Status)
{
case STATUS_GUARD_PAGE_VIOLATION: return STATUS_GUARD_PAGE_VIOLATION;
case STATUS_DATATYPE_MISALIGNMENT: return ERROR_NOACCESS;
case STATUS_BREAKPOINT: return STATUS_BREAKPOINT;
case STATUS_SINGLE_STEP: return STATUS_SINGLE_STEP;
case STATUS_BUFFER_OVERFLOW: return ERROR_MORE_DATA;
case STATUS_NO_MORE_FILES: return ERROR_NO_MORE_FILES;
/* case STATUS_NO_INHERITANCE: return ERROR_NO_INHERITANCE;*/
case STATUS_PARTIAL_COPY: return ERROR_PARTIAL_COPY;
/* case STATUS_DEVICE_PAPER_EMPTY: return ERROR_OUT_OF_PAPER;*/
case STATUS_DEVICE_POWERED_OFF: return ERROR_NOT_READY;
case STATUS_DEVICE_OFF_LINE: return ERROR_NOT_READY;
case STATUS_DEVICE_BUSY: return ERROR_BUSY;
case STATUS_NO_MORE_EAS: return ERROR_NO_MORE_ITEMS;
case STATUS_INVALID_EA_NAME: return ERROR_INVALID_EA_NAME;
case STATUS_EA_LIST_INCONSISTENT: return ERROR_EA_LIST_INCONSISTENT;
case STATUS_INVALID_EA_FLAG: return ERROR_EA_LIST_INCONSISTENT;
/* case STATUS_VERIFY_REQUIRED: return ERROR_MEDIA_CHANGED;*/
case STATUS_NO_MORE_ENTRIES: return ERROR_NO_MORE_ITEMS;
/* case STATUS_FILEMARK_DETECTED: return ERROR_FILEMARK_DETECTED;*/
/* case STATUS_MEDIA_CHANGED: return ERROR_MEDIA_CHANGED;*/
/* case STATUS_BUS_RESET: return ERROR_BUS_RESET;*/
/* case STATUS_END_OF_MEDIA: return ERROR_END_OF_MEDIA;*/
/* case STATUS_BEGINNING_OF_MEDIA: return ERROR_BEGINNING_OF_MEDIA;*/
/* case STATUS_SETMARK_DETECTED: return ERROR_SETMARK_DETECTED;*/
/* case STATUS_NO_DATA_DETECTED: return ERROR_NO_DATA_DETECTED;*/
case STATUS_ALREADY_DISCONNECTED: return ERROR_ACTIVE_CONNECTIONS;
}
break;
case 0xC0000000:
switch (Status)
{
/*01*/ case STATUS_UNSUCCESSFUL: return ERROR_GEN_FAILURE;
/*08*/ case STATUS_NO_MEMORY: return ERROR_NOT_ENOUGH_MEMORY;
/*0d*/ case STATUS_INVALID_PARAMETER: return ERROR_INVALID_PARAMETER;
/*22*/ case STATUS_ACCESS_DENIED: return ERROR_ACCESS_DENIED;
/*23*/ case STATUS_BUFFER_TOO_SMALL: return ERROR_INSUFFICIENT_BUFFER;
/*34*/ case STATUS_OBJECT_NAME_NOT_FOUND: return ERROR_FILE_NOT_FOUND;
/*15c*/ case STATUS_NOT_REGISTRY_FILE: return ERROR_NOT_REGISTRY_FILE;
/*17c*/ case STATUS_KEY_DELETED: return ERROR_KEY_DELETED;
/*181*/ case STATUS_CHILD_MUST_BE_VOLATILE: return ERROR_CHILD_MUST_BE_VOLATILE;
}
break;
}
FIXME("unknown status (%lx)\n",error);
return ERROR_SUCCESS;
FIXME("unknown status (%lx)\n",Status);
return ERROR_MR_MID_NOT_FOUND; /*317*/
}
/**************************************************************************
......@@ -430,30 +482,6 @@ LARGE_INTEGER WINAPI RtlExtendedIntegerMultiply(
#endif
}
/******************************************************************************
* RtlFormatCurrentUserKeyPath [NTDLL.371]
*/
DWORD WINAPI RtlFormatCurrentUserKeyPath(PUNICODE_STRING String)
{
FIXME("(%p): stub\n",String);
return 1;
}
/******************************************************************************
* RtlOpenCurrentUser [NTDLL]
*/
DWORD WINAPI RtlOpenCurrentUser(DWORD x1, DWORD *x2)
{
/* Note: this is not the correct solution,
* But this works pretty good on wine and NT4.0 binaries
*/
if ( x1 == 0x2000000 ) {
*x2 = HKEY_CURRENT_USER;
return TRUE;
}
return FALSE;
}
/**************************************************************************
* RtlDosPathNameToNtPathName_U [NTDLL.338]
*
......@@ -494,3 +522,52 @@ DWORD WINAPI RtlQueryEnvironmentVariable_U(DWORD x1,PUNICODE_STRING key,PUNICODE
FIXME("(0x%08lx,%s,%p),stub!\n",x1,debugstr_w(key->Buffer),val);
return 0;
}
/******************************************************************************
* RtlInitializeGenericTable [NTDLL]
*/
DWORD WINAPI RtlInitializeGenericTable(void)
{
FIXME("\n");
return 0;
}
/******************************************************************************
* RtlInitializeBitMap [NTDLL]
*
*/
NTSTATUS WINAPI RtlInitializeBitMap(DWORD x1,DWORD x2,DWORD x3)
{
FIXME("(0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3);
return 0;
}
/******************************************************************************
* RtlSetBits [NTDLL]
*
*/
NTSTATUS WINAPI RtlSetBits(DWORD x1,DWORD x2,DWORD x3)
{
FIXME("(0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3);
return 0;
}
/******************************************************************************
* RtlFindClearBits [NTDLL]
*
*/
NTSTATUS WINAPI RtlFindClearBits(DWORD x1,DWORD x2,DWORD x3)
{
FIXME("(0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3);
return 0;
}
/******************************************************************************
* RtlClearBits [NTDLL]
*
*/
NTSTATUS WINAPI RtlClearBits(DWORD x1,DWORD x2,DWORD x3)
{
FIXME("(0x%08lx,0x%08lx,0x%08lx),stub\n",x1,x2,x3);
return 0;
}
......@@ -9,16 +9,46 @@
#include "debugstr.h"
#include "debugtools.h"
#include "winerror.h"
#include "server.h"
#include "ntddk.h"
#include "ntdll_misc.h"
DEFAULT_DEBUG_CHANNEL(ntdll)
#define nt_server_call(kind) (ret=ErrorCodeToStatus(server_call_noerr(kind)))
/* helper to make the server functions return STATUS_ codes */
static NTSTATUS ErrorCodeToStatus (DWORD Error)
{
TRACE("err=%lu\n", Error);
switch (Error)
{
case NO_ERROR: return STATUS_SUCCESS;
default:
FIXME("Error code %lu not implemented\n", Error);
}
return STATUS_UNSUCCESSFUL;
}
/* copy a key name into the request buffer */
static inline NTSTATUS copy_nameU( LPWSTR Dest, PUNICODE_STRING Name )
{
if (Name->Buffer)
{
if ((Name->Length) > MAX_PATH) return STATUS_BUFFER_OVERFLOW;
lstrcpyW( Dest, Name->Buffer );
}
else Dest[0] = 0;
return STATUS_SUCCESS;
}
/*
* Semaphore
* Semaphores
*/
/******************************************************************************
* NtCreateSemaphore [NTDLL]
* NtCreateSemaphore
*/
NTSTATUS WINAPI NtCreateSemaphore(
OUT PHANDLE SemaphoreHandle,
......@@ -27,29 +57,52 @@ NTSTATUS WINAPI NtCreateSemaphore(
IN ULONG InitialCount,
IN ULONG MaximumCount)
{
FIXME("(%p,0x%08lx,%p(%s),0x%08lx,0x%08lx) stub!\n",
SemaphoreHandle, DesiredAccess, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
InitialCount, MaximumCount);
return 0;
struct create_semaphore_request *req = get_req_buffer();
HRESULT ret;
FIXME("(%p,0x%08lx,%p,0x%08lx,0x%08lx) stub!\n",
SemaphoreHandle, DesiredAccess, ObjectAttributes, InitialCount, MaximumCount);
dump_ObjectAttributes(ObjectAttributes);
if ((MaximumCount <= 0) || (InitialCount < 0) || (InitialCount > MaximumCount))
return STATUS_INVALID_PARAMETER;
*SemaphoreHandle = 0;
req->initial = InitialCount;
req->max = MaximumCount;
req->inherit = ObjectAttributes->Attributes & OBJ_INHERIT;
copy_nameU( req->name, ObjectAttributes->ObjectName );
if (nt_server_call( REQ_CREATE_SEMAPHORE ) != STATUS_SUCCESS) return ret;
*SemaphoreHandle = req->handle;
return ret;
}
/******************************************************************************
* NtOpenSemaphore [NTDLL]
* NtOpenSemaphore
*
* FIXME
*/
NTSTATUS WINAPI NtOpenSemaphore(
IN HANDLE SemaphoreHandle,
IN ACCESS_MASK DesiredAcces,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME("(0x%08x,0x%08lx,%p(%s)) stub!\n",
SemaphoreHandle, DesiredAcces, ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
return 0;
struct open_semaphore_request *req = get_req_buffer();
HRESULT ret;
FIXME("(0x%08x,0x%08lx,%p) stub!\n",
SemaphoreHandle, DesiredAcces, ObjectAttributes);
dump_ObjectAttributes(ObjectAttributes);
req->access = DesiredAcces;
req->inherit = ObjectAttributes->Attributes & OBJ_INHERIT;
copy_nameU( req->name, ObjectAttributes->ObjectName );
if (nt_server_call( REQ_OPEN_SEMAPHORE ) != STATUS_SUCCESS) return -1;
return req->handle;
}
/******************************************************************************
* NtQuerySemaphore [NTDLL]
* NtQuerySemaphore
*/
NTSTATUS WINAPI NtQuerySemaphore(
HANDLE SemaphoreHandle,
......@@ -60,27 +113,39 @@ NTSTATUS WINAPI NtQuerySemaphore(
{
FIXME("(0x%08x,%p,%p,0x%08lx,%p) stub!\n",
SemaphoreHandle, SemaphoreInformationClass, SemaphoreInformation, Length, ReturnLength);
return 0;
return STATUS_SUCCESS;
}
/******************************************************************************
* NtReleaseSemaphore [NTDLL]
* NtReleaseSemaphore
*/
NTSTATUS WINAPI NtReleaseSemaphore(
IN HANDLE SemaphoreHandle,
IN ULONG ReleaseCount,
IN PULONG PreviousCount)
{
struct release_semaphore_request *req = get_req_buffer();
HRESULT ret;
FIXME("(0x%08x,0x%08lx,%p,) stub!\n",
SemaphoreHandle, ReleaseCount, PreviousCount);
return 0;
if (ReleaseCount < 0) return STATUS_INVALID_PARAMETER;
req->handle = SemaphoreHandle;
req->count = ReleaseCount;
if (nt_server_call( REQ_RELEASE_SEMAPHORE ) == STATUS_SUCCESS)
{
if (PreviousCount) *PreviousCount = req->prev_count;
}
return ret;
}
/*
* Event
* Events
*/
/**************************************************************************
* NtCreateEvent [NTDLL.71]
* NtCreateEvent
*/
NTSTATUS WINAPI NtCreateEvent(
OUT PHANDLE EventHandle,
......@@ -89,36 +154,128 @@ NTSTATUS WINAPI NtCreateEvent(
IN BOOLEAN ManualReset,
IN BOOLEAN InitialState)
{
FIXME("(%p,0x%08lx,%p(%s),%08x,%08x): empty stub\n",
EventHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL,
ManualReset,InitialState);
return 0;
struct create_event_request *req = get_req_buffer();
HRESULT ret;
FIXME("(%p,0x%08lx,%p,%08x,%08x): empty stub\n",
EventHandle,DesiredAccess,ObjectAttributes,ManualReset,InitialState);
dump_ObjectAttributes(ObjectAttributes);
*EventHandle = 0;
req->manual_reset = ManualReset;
req->initial_state = InitialState;
req->inherit = ObjectAttributes->Attributes & OBJ_INHERIT;
copy_nameU( req->name, ObjectAttributes->ObjectName );
if (nt_server_call( REQ_CREATE_EVENT ) != STATUS_SUCCESS) return ret;
*EventHandle = req->handle;
return STATUS_SUCCESS;
}
/******************************************************************************
* NtOpenEvent [NTDLL]
* NtOpenEvent
*/
NTSTATUS WINAPI NtOpenEvent(
OUT PHANDLE EventHandle,
IN ACCESS_MASK DesiredAccess,
IN POBJECT_ATTRIBUTES ObjectAttributes)
{
FIXME("(%p,0x%08lx,%p(%s)),stub!\n",
EventHandle,DesiredAccess,ObjectAttributes,
ObjectAttributes ? debugstr_w(ObjectAttributes->ObjectName->Buffer) : NULL);
return 0;
struct open_event_request *req = get_req_buffer();
HRESULT ret;
FIXME("(%p,0x%08lx,%p),stub!\n",
EventHandle,DesiredAccess,ObjectAttributes);
dump_ObjectAttributes(ObjectAttributes);
*EventHandle = 0;
req->access = DesiredAccess;
req->inherit = ObjectAttributes->Attributes & OBJ_INHERIT;
copy_nameU( req->name, ObjectAttributes->ObjectName );
if (nt_server_call( REQ_OPEN_EVENT ) != STATUS_SUCCESS) return ret;
*EventHandle = req->handle;
return ret;
}
/***********************************************************************
* EVENT_Operation
*
* Execute an event operation (set,reset,pulse).
*/
static NTSTATUS EVENT_Operation(
HANDLE handle,
PULONG NumberOfThreadsReleased,
enum event_op op )
{
struct event_op_request *req = get_req_buffer();
HRESULT ret;
req->handle = handle;
req->op = op;
nt_server_call( REQ_EVENT_OP );
return ret;
}
/******************************************************************************
* NtSetEvent [NTDLL]
* NtSetEvent
*/
NTSTATUS WINAPI NtSetEvent(
IN HANDLE EventHandle,
PULONG NumberOfThreadsReleased)
{
FIXME("(0x%08x,%p)\n",
EventHandle, NumberOfThreadsReleased);
return 0;
FIXME("(0x%08x,%p)\n", EventHandle, NumberOfThreadsReleased);
return EVENT_Operation(EventHandle, NumberOfThreadsReleased, SET_EVENT);
}
/******************************************************************************
* NtResetEvent
*/
NTSTATUS WINAPI NtResetEvent(
IN HANDLE EventHandle,
PULONG NumberOfThreadsReleased)
{
FIXME("(0x%08x,%p)\n", EventHandle, NumberOfThreadsReleased);
return EVENT_Operation(EventHandle, NumberOfThreadsReleased, RESET_EVENT);
}
/******************************************************************************
* NtClearEvent
*
* FIXME
* same as NtResetEvent ???
*/
NTSTATUS WINAPI NtClearEvent (
IN HANDLE EventHandle)
{
FIXME("(0x%08x)\n", EventHandle);
return EVENT_Operation(EventHandle, NULL, RESET_EVENT);
}
/******************************************************************************
* NtPulseEvent
*
* FIXME
* PulseCount
*/
NTSTATUS WINAPI NtPulseEvent(
IN HANDLE EventHandle,
IN PULONG PulseCount)
{
FIXME("(0x%08x,%p)\n", EventHandle, PulseCount);
return EVENT_Operation(EventHandle, NULL, PULSE_EVENT);
}
/******************************************************************************
* NtQueryEvent
*/
NTSTATUS WINAPI NtQueryEvent (
IN HANDLE EventHandle,
IN UINT EventInformationClass,
OUT PVOID EventInformation,
IN ULONG EventInformationLength,
OUT PULONG ReturnLength)
{
FIXME("(0x%08x)\n", EventHandle);
return STATUS_SUCCESS;
}
......@@ -4,6 +4,8 @@
#include "basetsd.h"
#include "windef.h"
#include "pshpack1.h"
#ifdef __cplusplus
extern "C" {
#endif
......@@ -80,8 +82,20 @@ typedef struct _OBJECT_ATTRIBUTES
typedef OBJECT_ATTRIBUTES *POBJECT_ATTRIBUTES;
#define InitializeObjectAttributes(p,n,a,r,s) \
{ (p)->Length = sizeof(OBJECT_ATTRIBUTES); \
(p)->RootDirectory = r; \
(p)->Attributes = a; \
(p)->ObjectName = n; \
(p)->SecurityDescriptor = s; \
(p)->SecurityQualityOfService = NULL; \
}
#ifdef __cplusplus
}
#endif
#include "poppack.h"
#endif
......@@ -32,6 +32,22 @@ typedef enum
PolicyDnsDomainInformation
} POLICY_INFORMATION_CLASS, *PPOLICY_INFORMATION_CLASS;
typedef ULONG POLICY_AUDIT_EVENT_OPTIONS, *PPOLICY_AUDIT_EVENT_OPTIONS;
typedef struct
{
BOOLEAN AuditingMode;
PPOLICY_AUDIT_EVENT_OPTIONS EventAuditingOptions;
ULONG MaximumAuditEventCount;
} POLICY_AUDIT_EVENTS_INFO, *PPOLICY_AUDIT_EVENTS_INFO;
typedef struct
{
LSA_UNICODE_STRING Name;
PSID Sid;
} POLICY_PRIMARY_DOMAIN_INFO, *PPOLICY_PRIMARY_DOMAIN_INFO;
NTSTATUS WINAPI LsaQueryInformationPolicy(LSA_HANDLE,POLICY_INFORMATION_CLASS,PVOID*);
NTSTATUS WINAPI LsaFreeMemory(PVOID);
......
......@@ -1374,12 +1374,15 @@ LONG WINAPI InterlockedDecrement(LPLONG);
LONG WINAPI InterlockedExchange(LPLONG,LONG);
LONG WINAPI InterlockedExchangeAdd(PLONG,LONG);
LONG WINAPI InterlockedIncrement(LPLONG);
BOOL WINAPI IsDBCSLeadByteEx(UINT,BYTE);
BOOL WINAPI IsProcessorFeaturePresent(DWORD);
BOOL WINAPI IsValidLocale(DWORD,DWORD);
BOOL WINAPI LocalFileTimeToFileTime(const FILETIME*,LPFILETIME);
BOOL WINAPI LockFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
BOOL WINAPI LockFileEx(HANDLE, DWORD, DWORD, DWORD, DWORD, LPOVERLAPPED);
BOOL WINAPI IsDBCSLeadByteEx(UINT,BYTE);
BOOL WINAPI IsProcessorFeaturePresent(DWORD);
BOOL WINAPI IsValidLocale(DWORD,DWORD);
BOOL WINAPI LookupAccountSidA(LPCSTR,PSID,LPSTR,LPDWORD,LPSTR,LPDWORD,PSID_NAME_USE);
BOOL WINAPI LookupAccountSidW(LPCWSTR,PSID,LPWSTR,LPDWORD,LPWSTR,LPDWORD,PSID_NAME_USE);
#define LookupAccountSid WINELIB_NAME_AW(LookupAccountSidW)
BOOL WINAPI LocalFileTimeToFileTime(const FILETIME*,LPFILETIME);
BOOL WINAPI LockFile(HANDLE,DWORD,DWORD,DWORD,DWORD);
BOOL WINAPI LockFileEx(HANDLE, DWORD, DWORD, DWORD, DWORD, LPOVERLAPPED);
BOOL WINAPI LookupPrivilegeValueA(LPCSTR,LPCSTR,LPVOID);
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR,LPCWSTR,LPVOID);
#define LookupPrivilegeValue WINELIB_NAME_AW(LookupPrivilegeValue)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment