mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 07:42:59 +00:00
[FORMATTING]
Fix indentation and coding style. No code changes! svn path=/trunk/; revision=57334
This commit is contained in:
parent
c31b441d5c
commit
c2ab3689b3
8 changed files with 1381 additions and 1349 deletions
|
@ -31,28 +31,20 @@
|
||||||
*
|
*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
SIZE_T NTAPI
|
SIZE_T
|
||||||
|
NTAPI
|
||||||
RtlCompareMemory(IN const VOID *Source1,
|
RtlCompareMemory(IN const VOID *Source1,
|
||||||
IN const VOID *Source2,
|
IN const VOID *Source2,
|
||||||
IN SIZE_T Length)
|
IN SIZE_T Length)
|
||||||
{
|
{
|
||||||
SIZE_T i;
|
SIZE_T i;
|
||||||
for(i=0; (i<Length) && (((PUCHAR)Source1)[i]==((PUCHAR)Source2)[i]); i++)
|
for (i = 0; (i < Length) && (((PUCHAR)Source1)[i] == ((PUCHAR)Source2)[i]); i++)
|
||||||
;
|
;
|
||||||
return i;
|
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
SIZE_T
|
|
||||||
NTAPI
|
|
||||||
RtlCompareMemoryUlong (
|
|
||||||
PVOID Source,
|
|
||||||
SIZE_T Length,
|
|
||||||
ULONG Value
|
|
||||||
)
|
|
||||||
/*
|
/*
|
||||||
* FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal bytes
|
* FUNCTION: Compares a block of ULONGs with an ULONG and returns the number of equal bytes
|
||||||
* ARGUMENTS:
|
* ARGUMENTS:
|
||||||
|
@ -60,20 +52,28 @@ RtlCompareMemoryUlong (
|
||||||
* Length = Number of bytes to compare
|
* Length = Number of bytes to compare
|
||||||
* Value = Value to compare
|
* Value = Value to compare
|
||||||
* RETURNS: Number of equal bytes
|
* RETURNS: Number of equal bytes
|
||||||
|
*
|
||||||
|
* @implemented
|
||||||
*/
|
*/
|
||||||
|
SIZE_T
|
||||||
|
NTAPI
|
||||||
|
RtlCompareMemoryUlong(IN PVOID Source,
|
||||||
|
IN SIZE_T Length,
|
||||||
|
IN ULONG Value)
|
||||||
{
|
{
|
||||||
PULONG ptr = (PULONG)Source;
|
PULONG ptr = (PULONG)Source;
|
||||||
ULONG_PTR len = Length / sizeof(ULONG);
|
ULONG_PTR len = Length / sizeof(ULONG);
|
||||||
ULONG_PTR i;
|
ULONG_PTR i;
|
||||||
|
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
if (*ptr != Value)
|
if (*ptr != Value)
|
||||||
break;
|
break;
|
||||||
ptr++;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (SIZE_T)((PCHAR)ptr - (PCHAR)Source);
|
ptr++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (SIZE_T)((PCHAR)ptr - (PCHAR)Source);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -83,13 +83,11 @@ RtlCompareMemoryUlong (
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlFillMemory (
|
RtlFillMemory(PVOID Destination,
|
||||||
PVOID Destination,
|
SIZE_T Length,
|
||||||
SIZE_T Length,
|
UCHAR Fill)
|
||||||
UCHAR Fill
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
memset(Destination, Fill, Length);
|
memset(Destination, Fill, Length);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -99,21 +97,19 @@ RtlFillMemory (
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlFillMemoryUlong (
|
RtlFillMemoryUlong(PVOID Destination,
|
||||||
PVOID Destination,
|
SIZE_T Length,
|
||||||
SIZE_T Length,
|
ULONG Fill)
|
||||||
ULONG Fill
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
PULONG Dest = Destination;
|
PULONG Dest = Destination;
|
||||||
SIZE_T Count = Length / sizeof(ULONG);
|
SIZE_T Count = Length / sizeof(ULONG);
|
||||||
|
|
||||||
while (Count > 0)
|
while (Count > 0)
|
||||||
{
|
{
|
||||||
*Dest = Fill;
|
*Dest = Fill;
|
||||||
Dest++;
|
Dest++;
|
||||||
Count--;
|
Count--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -123,32 +119,25 @@ RtlFillMemoryUlong (
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlMoveMemory (
|
RtlMoveMemory(PVOID Destination,
|
||||||
PVOID Destination,
|
CONST VOID *Source,
|
||||||
CONST VOID * Source,
|
SIZE_T Length)
|
||||||
SIZE_T Length
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
memmove (
|
memmove(Destination, Source, Length);
|
||||||
Destination,
|
|
||||||
Source,
|
|
||||||
Length
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
FASTCALL
|
FASTCALL
|
||||||
RtlPrefetchMemoryNonTemporal(
|
RtlPrefetchMemoryNonTemporal(IN PVOID Source,
|
||||||
IN PVOID Source,
|
IN SIZE_T Length)
|
||||||
IN SIZE_T Length
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
/* By nature of prefetch, this is non-portable. */
|
/* By nature of prefetch, this is non-portable. */
|
||||||
(void)Source;
|
(void)Source;
|
||||||
(void)Length;
|
(void)Length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,16 +147,10 @@ RtlPrefetchMemoryNonTemporal(
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlZeroMemory (
|
RtlZeroMemory(PVOID Destination,
|
||||||
PVOID Destination,
|
SIZE_T Length)
|
||||||
SIZE_T Length
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
RtlFillMemory (
|
RtlFillMemory(Destination, Length, 0);
|
||||||
Destination,
|
|
||||||
Length,
|
|
||||||
0
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
1156
reactos/lib/rtl/sd.c
1156
reactos/lib/rtl/sd.c
File diff suppressed because it is too large
Load diff
|
@ -18,67 +18,66 @@
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
|
RtlImpersonateSelf(IN SECURITY_IMPERSONATION_LEVEL ImpersonationLevel)
|
||||||
{
|
{
|
||||||
HANDLE ProcessToken;
|
HANDLE ProcessToken;
|
||||||
HANDLE ImpersonationToken;
|
HANDLE ImpersonationToken;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
OBJECT_ATTRIBUTES ObjAttr;
|
OBJECT_ATTRIBUTES ObjAttr;
|
||||||
SECURITY_QUALITY_OF_SERVICE Sqos;
|
SECURITY_QUALITY_OF_SERVICE Sqos;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
Status = ZwOpenProcessToken(NtCurrentProcess(),
|
Status = ZwOpenProcessToken(NtCurrentProcess(),
|
||||||
TOKEN_DUPLICATE,
|
TOKEN_DUPLICATE,
|
||||||
&ProcessToken);
|
&ProcessToken);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtOpenProcessToken() failed (Status %lx)\n", Status);
|
DPRINT1("NtOpenProcessToken() failed (Status %lx)\n", Status);
|
||||||
return(Status);
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sqos.Length = sizeof(SECURITY_QUALITY_OF_SERVICE);
|
Sqos.Length = sizeof(SECURITY_QUALITY_OF_SERVICE);
|
||||||
Sqos.ImpersonationLevel = ImpersonationLevel;
|
Sqos.ImpersonationLevel = ImpersonationLevel;
|
||||||
Sqos.ContextTrackingMode = 0;
|
Sqos.ContextTrackingMode = 0;
|
||||||
Sqos.EffectiveOnly = FALSE;
|
Sqos.EffectiveOnly = FALSE;
|
||||||
|
|
||||||
InitializeObjectAttributes(
|
InitializeObjectAttributes(&ObjAttr,
|
||||||
&ObjAttr,
|
NULL,
|
||||||
NULL,
|
0,
|
||||||
0,
|
NULL,
|
||||||
NULL,
|
NULL);
|
||||||
NULL
|
|
||||||
);
|
|
||||||
|
|
||||||
ObjAttr.SecurityQualityOfService = &Sqos;
|
ObjAttr.SecurityQualityOfService = &Sqos;
|
||||||
|
|
||||||
Status = ZwDuplicateToken(ProcessToken,
|
Status = ZwDuplicateToken(ProcessToken,
|
||||||
TOKEN_IMPERSONATE,
|
TOKEN_IMPERSONATE,
|
||||||
&ObjAttr,
|
&ObjAttr,
|
||||||
Sqos.EffectiveOnly, /* why both here _and_ in Sqos? */
|
Sqos.EffectiveOnly, /* why both here _and_ in Sqos? */
|
||||||
TokenImpersonation,
|
TokenImpersonation,
|
||||||
&ImpersonationToken);
|
&ImpersonationToken);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtDuplicateToken() failed (Status %lx)\n", Status);
|
DPRINT1("NtDuplicateToken() failed (Status %lx)\n", Status);
|
||||||
NtClose(ProcessToken);
|
NtClose(ProcessToken);
|
||||||
return(Status);
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = ZwSetInformationThread(NtCurrentThread(),
|
Status = ZwSetInformationThread(NtCurrentThread(),
|
||||||
ThreadImpersonationToken,
|
ThreadImpersonationToken,
|
||||||
&ImpersonationToken,
|
&ImpersonationToken,
|
||||||
sizeof(HANDLE));
|
sizeof(HANDLE));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtSetInformationThread() failed (Status %lx)\n", Status);
|
DPRINT1("NtSetInformationThread() failed (Status %lx)\n", Status);
|
||||||
}
|
}
|
||||||
|
|
||||||
ZwClose(ImpersonationToken);
|
ZwClose(ImpersonationToken);
|
||||||
ZwClose(ProcessToken);
|
ZwClose(ProcessToken);
|
||||||
|
|
||||||
return(Status);
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -108,79 +107,81 @@ RtlReleasePrivilege(IN PVOID ReturnedState)
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
RtlAdjustPrivilege(IN ULONG Privilege,
|
RtlAdjustPrivilege(IN ULONG Privilege,
|
||||||
IN BOOLEAN Enable,
|
IN BOOLEAN Enable,
|
||||||
IN BOOLEAN CurrentThread,
|
IN BOOLEAN CurrentThread,
|
||||||
OUT PBOOLEAN Enabled)
|
OUT PBOOLEAN Enabled)
|
||||||
{
|
{
|
||||||
TOKEN_PRIVILEGES NewState;
|
TOKEN_PRIVILEGES NewState;
|
||||||
TOKEN_PRIVILEGES OldState;
|
TOKEN_PRIVILEGES OldState;
|
||||||
ULONG ReturnLength;
|
ULONG ReturnLength;
|
||||||
HANDLE TokenHandle;
|
HANDLE TokenHandle;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
DPRINT ("RtlAdjustPrivilege() called\n");
|
DPRINT("RtlAdjustPrivilege() called\n");
|
||||||
|
|
||||||
if (CurrentThread)
|
if (CurrentThread)
|
||||||
{
|
{
|
||||||
Status = ZwOpenThreadToken (NtCurrentThread (),
|
Status = ZwOpenThreadToken(NtCurrentThread(),
|
||||||
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
|
|
||||||
FALSE,
|
|
||||||
&TokenHandle);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Status = ZwOpenProcessToken (NtCurrentProcess (),
|
|
||||||
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
|
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
|
||||||
|
FALSE,
|
||||||
&TokenHandle);
|
&TokenHandle);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Status = ZwOpenProcessToken(NtCurrentProcess(),
|
||||||
|
TOKEN_ADJUST_PRIVILEGES | TOKEN_QUERY,
|
||||||
|
&TokenHandle);
|
||||||
|
}
|
||||||
|
|
||||||
if (!NT_SUCCESS (Status))
|
if (!NT_SUCCESS (Status))
|
||||||
{
|
{
|
||||||
DPRINT1 ("Retrieving token handle failed (Status %lx)\n", Status);
|
DPRINT1("Retrieving token handle failed (Status %lx)\n", Status);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
OldState.PrivilegeCount = 1;
|
OldState.PrivilegeCount = 1;
|
||||||
|
|
||||||
NewState.PrivilegeCount = 1;
|
NewState.PrivilegeCount = 1;
|
||||||
NewState.Privileges[0].Luid.LowPart = Privilege;
|
NewState.Privileges[0].Luid.LowPart = Privilege;
|
||||||
NewState.Privileges[0].Luid.HighPart = 0;
|
NewState.Privileges[0].Luid.HighPart = 0;
|
||||||
NewState.Privileges[0].Attributes = (Enable) ? SE_PRIVILEGE_ENABLED : 0;
|
NewState.Privileges[0].Attributes = (Enable) ? SE_PRIVILEGE_ENABLED : 0;
|
||||||
|
|
||||||
Status = ZwAdjustPrivilegesToken (TokenHandle,
|
Status = ZwAdjustPrivilegesToken(TokenHandle,
|
||||||
FALSE,
|
FALSE,
|
||||||
&NewState,
|
&NewState,
|
||||||
sizeof(TOKEN_PRIVILEGES),
|
sizeof(TOKEN_PRIVILEGES),
|
||||||
&OldState,
|
&OldState,
|
||||||
&ReturnLength);
|
&ReturnLength);
|
||||||
ZwClose (TokenHandle);
|
ZwClose (TokenHandle);
|
||||||
if (Status == STATUS_NOT_ALL_ASSIGNED)
|
if (Status == STATUS_NOT_ALL_ASSIGNED)
|
||||||
{
|
{
|
||||||
DPRINT1 ("Failed to assign all privileges\n");
|
DPRINT1("Failed to assign all privileges\n");
|
||||||
return STATUS_PRIVILEGE_NOT_HELD;
|
return STATUS_PRIVILEGE_NOT_HELD;
|
||||||
}
|
}
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1 ("NtAdjustPrivilegesToken() failed (Status %lx)\n", Status);
|
|
||||||
return Status;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (OldState.PrivilegeCount == 0)
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
*Enabled = Enable;
|
DPRINT1("NtAdjustPrivilegesToken() failed (Status %lx)\n", Status);
|
||||||
}
|
return Status;
|
||||||
else
|
}
|
||||||
{
|
|
||||||
*Enabled = (OldState.Privileges[0].Attributes & SE_PRIVILEGE_ENABLED);
|
|
||||||
}
|
|
||||||
|
|
||||||
DPRINT ("RtlAdjustPrivilege() done\n");
|
if (OldState.PrivilegeCount == 0)
|
||||||
|
{
|
||||||
|
*Enabled = Enable;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
*Enabled = (OldState.Privileges[0].Attributes & SE_PRIVILEGE_ENABLED);
|
||||||
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
DPRINT("RtlAdjustPrivilege() done\n");
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -17,153 +17,162 @@
|
||||||
|
|
||||||
/* FUNCTIONS ***************************************************************/
|
/* FUNCTIONS ***************************************************************/
|
||||||
|
|
||||||
BOOLEAN NTAPI
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
RtlValidSid(IN PSID Sid_)
|
RtlValidSid(IN PSID Sid_)
|
||||||
{
|
{
|
||||||
PISID Sid = Sid_;
|
PISID Sid = Sid_;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if ((Sid->Revision != SID_REVISION) ||
|
if ((Sid->Revision != SID_REVISION) ||
|
||||||
(Sid->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES))
|
(Sid->SubAuthorityCount > SID_MAX_SUB_AUTHORITIES))
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
ULONG NTAPI
|
ULONG
|
||||||
|
NTAPI
|
||||||
RtlLengthRequiredSid(IN ULONG SubAuthorityCount)
|
RtlLengthRequiredSid(IN ULONG SubAuthorityCount)
|
||||||
{
|
{
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
return (ULONG)FIELD_OFFSET(SID,
|
return (ULONG)FIELD_OFFSET(SID,
|
||||||
SubAuthority[SubAuthorityCount]);
|
SubAuthority[SubAuthorityCount]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
RtlInitializeSid(IN PSID Sid_,
|
RtlInitializeSid(IN PSID Sid_,
|
||||||
IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
|
IN PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
|
||||||
IN UCHAR SubAuthorityCount)
|
IN UCHAR SubAuthorityCount)
|
||||||
{
|
{
|
||||||
PISID Sid = Sid_;
|
PISID Sid = Sid_;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
Sid->Revision = SID_REVISION;
|
Sid->Revision = SID_REVISION;
|
||||||
Sid->SubAuthorityCount = SubAuthorityCount;
|
Sid->SubAuthorityCount = SubAuthorityCount;
|
||||||
memcpy(&Sid->IdentifierAuthority,
|
memcpy(&Sid->IdentifierAuthority,
|
||||||
IdentifierAuthority,
|
IdentifierAuthority,
|
||||||
sizeof(SID_IDENTIFIER_AUTHORITY));
|
sizeof(SID_IDENTIFIER_AUTHORITY));
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
PULONG NTAPI
|
PULONG
|
||||||
|
NTAPI
|
||||||
RtlSubAuthoritySid(IN PSID Sid_,
|
RtlSubAuthoritySid(IN PSID Sid_,
|
||||||
IN ULONG SubAuthority)
|
IN ULONG SubAuthority)
|
||||||
{
|
{
|
||||||
PISID Sid = Sid_;
|
PISID Sid = Sid_;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
return (PULONG)&Sid->SubAuthority[SubAuthority];
|
return (PULONG)&Sid->SubAuthority[SubAuthority];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
PUCHAR NTAPI
|
PUCHAR
|
||||||
|
NTAPI
|
||||||
RtlSubAuthorityCountSid(IN PSID Sid_)
|
RtlSubAuthorityCountSid(IN PSID Sid_)
|
||||||
{
|
{
|
||||||
PISID Sid = Sid_;
|
PISID Sid = Sid_;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
return &Sid->SubAuthorityCount;
|
return &Sid->SubAuthorityCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOLEAN NTAPI
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
RtlEqualSid(IN PSID Sid1_,
|
RtlEqualSid(IN PSID Sid1_,
|
||||||
IN PSID Sid2_)
|
IN PSID Sid2_)
|
||||||
{
|
{
|
||||||
PISID Sid1 = Sid1_;
|
PISID Sid1 = Sid1_;
|
||||||
PISID Sid2 = Sid2_;
|
PISID Sid2 = Sid2_;
|
||||||
SIZE_T SidLen;
|
SIZE_T SidLen;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (Sid1->Revision != Sid2->Revision ||
|
if (Sid1->Revision != Sid2->Revision ||
|
||||||
(*RtlSubAuthorityCountSid(Sid1)) != (*RtlSubAuthorityCountSid(Sid2)))
|
(*RtlSubAuthorityCountSid(Sid1)) != (*RtlSubAuthorityCountSid(Sid2)))
|
||||||
{
|
{
|
||||||
return(FALSE);
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SidLen = RtlLengthSid(Sid1);
|
SidLen = RtlLengthSid(Sid1);
|
||||||
return RtlCompareMemory(Sid1, Sid2, SidLen) == SidLen;
|
return RtlCompareMemory(Sid1, Sid2, SidLen) == SidLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
ULONG NTAPI
|
ULONG
|
||||||
|
NTAPI
|
||||||
RtlLengthSid(IN PSID Sid_)
|
RtlLengthSid(IN PSID Sid_)
|
||||||
{
|
{
|
||||||
PISID Sid = Sid_;
|
PISID Sid = Sid_;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
return (ULONG)FIELD_OFFSET(SID,
|
return (ULONG)FIELD_OFFSET(SID,
|
||||||
SubAuthority[Sid->SubAuthorityCount]);
|
SubAuthority[Sid->SubAuthorityCount]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
RtlCopySid(ULONG BufferLength,
|
RtlCopySid(ULONG BufferLength,
|
||||||
PSID Dest,
|
PSID Dest,
|
||||||
PSID Src)
|
PSID Src)
|
||||||
{
|
{
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (BufferLength < RtlLengthSid(Src))
|
if (BufferLength < RtlLengthSid(Src))
|
||||||
{
|
{
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
memmove(Dest,
|
memmove(Dest,
|
||||||
Src,
|
Src,
|
||||||
RtlLengthSid(Src));
|
RtlLengthSid(Src));
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
RtlCopySidAndAttributesArray(ULONG Count,
|
RtlCopySidAndAttributesArray(ULONG Count,
|
||||||
PSID_AND_ATTRIBUTES Src,
|
PSID_AND_ATTRIBUTES Src,
|
||||||
ULONG SidAreaSize,
|
ULONG SidAreaSize,
|
||||||
|
@ -172,110 +181,115 @@ RtlCopySidAndAttributesArray(ULONG Count,
|
||||||
PVOID* RemainingSidArea,
|
PVOID* RemainingSidArea,
|
||||||
PULONG RemainingSidAreaSize)
|
PULONG RemainingSidAreaSize)
|
||||||
{
|
{
|
||||||
ULONG SidLength;
|
ULONG SidLength;
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
Length = SidAreaSize;
|
Length = SidAreaSize;
|
||||||
|
|
||||||
for (i=0; i<Count; i++)
|
for (i = 0; i < Count; i++)
|
||||||
{
|
|
||||||
if (RtlLengthSid(Src[i].Sid) > Length)
|
|
||||||
{
|
|
||||||
return(STATUS_BUFFER_TOO_SMALL);
|
|
||||||
}
|
|
||||||
SidLength = RtlLengthSid(Src[i].Sid);
|
|
||||||
Length = Length - SidLength;
|
|
||||||
Dest[i].Sid = SidArea;
|
|
||||||
Dest[i].Attributes = Src[i].Attributes;
|
|
||||||
RtlCopySid(SidLength,
|
|
||||||
SidArea,
|
|
||||||
Src[i].Sid);
|
|
||||||
SidArea = (PVOID)((ULONG_PTR)SidArea + SidLength);
|
|
||||||
}
|
|
||||||
*RemainingSidArea = SidArea;
|
|
||||||
*RemainingSidAreaSize = Length;
|
|
||||||
return(STATUS_SUCCESS);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
PSID_IDENTIFIER_AUTHORITY NTAPI
|
|
||||||
RtlIdentifierAuthoritySid(IN PSID Sid_)
|
|
||||||
{
|
|
||||||
PISID Sid = Sid_;
|
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
|
||||||
|
|
||||||
return &Sid->IdentifierAuthority;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
NTSTATUS NTAPI
|
|
||||||
RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
|
|
||||||
UCHAR SubAuthorityCount,
|
|
||||||
ULONG SubAuthority0,
|
|
||||||
ULONG SubAuthority1,
|
|
||||||
ULONG SubAuthority2,
|
|
||||||
ULONG SubAuthority3,
|
|
||||||
ULONG SubAuthority4,
|
|
||||||
ULONG SubAuthority5,
|
|
||||||
ULONG SubAuthority6,
|
|
||||||
ULONG SubAuthority7,
|
|
||||||
PSID *Sid)
|
|
||||||
{
|
|
||||||
PISID pSid;
|
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
|
||||||
|
|
||||||
if (SubAuthorityCount > 8)
|
|
||||||
return STATUS_INVALID_SID;
|
|
||||||
|
|
||||||
if (Sid == NULL)
|
|
||||||
return STATUS_INVALID_PARAMETER;
|
|
||||||
|
|
||||||
pSid = RtlpAllocateMemory(RtlLengthRequiredSid(SubAuthorityCount),
|
|
||||||
TAG_SID);
|
|
||||||
if (pSid == NULL)
|
|
||||||
return STATUS_NO_MEMORY;
|
|
||||||
|
|
||||||
pSid->Revision = SID_REVISION;
|
|
||||||
pSid->SubAuthorityCount = SubAuthorityCount;
|
|
||||||
memcpy(&pSid->IdentifierAuthority,
|
|
||||||
IdentifierAuthority,
|
|
||||||
sizeof(SID_IDENTIFIER_AUTHORITY));
|
|
||||||
|
|
||||||
switch (SubAuthorityCount)
|
|
||||||
{
|
{
|
||||||
case 8:
|
if (RtlLengthSid(Src[i].Sid) > Length)
|
||||||
pSid->SubAuthority[7] = SubAuthority7;
|
{
|
||||||
case 7:
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
pSid->SubAuthority[6] = SubAuthority6;
|
}
|
||||||
case 6:
|
|
||||||
pSid->SubAuthority[5] = SubAuthority5;
|
SidLength = RtlLengthSid(Src[i].Sid);
|
||||||
case 5:
|
Length = Length - SidLength;
|
||||||
pSid->SubAuthority[4] = SubAuthority4;
|
Dest[i].Sid = SidArea;
|
||||||
case 4:
|
Dest[i].Attributes = Src[i].Attributes;
|
||||||
pSid->SubAuthority[3] = SubAuthority3;
|
RtlCopySid(SidLength,
|
||||||
case 3:
|
SidArea,
|
||||||
pSid->SubAuthority[2] = SubAuthority2;
|
Src[i].Sid);
|
||||||
case 2:
|
SidArea = (PVOID)((ULONG_PTR)SidArea + SidLength);
|
||||||
pSid->SubAuthority[1] = SubAuthority1;
|
|
||||||
case 1:
|
|
||||||
pSid->SubAuthority[0] = SubAuthority0;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
*Sid = pSid;
|
*RemainingSidArea = SidArea;
|
||||||
|
*RemainingSidAreaSize = Length;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
PSID_IDENTIFIER_AUTHORITY
|
||||||
|
NTAPI
|
||||||
|
RtlIdentifierAuthoritySid(IN PSID Sid_)
|
||||||
|
{
|
||||||
|
PISID Sid = Sid_;
|
||||||
|
|
||||||
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
|
return &Sid->IdentifierAuthority;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
|
RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
|
||||||
|
UCHAR SubAuthorityCount,
|
||||||
|
ULONG SubAuthority0,
|
||||||
|
ULONG SubAuthority1,
|
||||||
|
ULONG SubAuthority2,
|
||||||
|
ULONG SubAuthority3,
|
||||||
|
ULONG SubAuthority4,
|
||||||
|
ULONG SubAuthority5,
|
||||||
|
ULONG SubAuthority6,
|
||||||
|
ULONG SubAuthority7,
|
||||||
|
PSID *Sid)
|
||||||
|
{
|
||||||
|
PISID pSid;
|
||||||
|
|
||||||
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
|
if (SubAuthorityCount > 8)
|
||||||
|
return STATUS_INVALID_SID;
|
||||||
|
|
||||||
|
if (Sid == NULL)
|
||||||
|
return STATUS_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
pSid = RtlpAllocateMemory(RtlLengthRequiredSid(SubAuthorityCount),
|
||||||
|
TAG_SID);
|
||||||
|
if (pSid == NULL)
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
|
||||||
|
pSid->Revision = SID_REVISION;
|
||||||
|
pSid->SubAuthorityCount = SubAuthorityCount;
|
||||||
|
memcpy(&pSid->IdentifierAuthority,
|
||||||
|
IdentifierAuthority,
|
||||||
|
sizeof(SID_IDENTIFIER_AUTHORITY));
|
||||||
|
|
||||||
|
switch (SubAuthorityCount)
|
||||||
|
{
|
||||||
|
case 8:
|
||||||
|
pSid->SubAuthority[7] = SubAuthority7;
|
||||||
|
case 7:
|
||||||
|
pSid->SubAuthority[6] = SubAuthority6;
|
||||||
|
case 6:
|
||||||
|
pSid->SubAuthority[5] = SubAuthority5;
|
||||||
|
case 5:
|
||||||
|
pSid->SubAuthority[4] = SubAuthority4;
|
||||||
|
case 4:
|
||||||
|
pSid->SubAuthority[3] = SubAuthority3;
|
||||||
|
case 3:
|
||||||
|
pSid->SubAuthority[2] = SubAuthority2;
|
||||||
|
case 2:
|
||||||
|
pSid->SubAuthority[1] = SubAuthority1;
|
||||||
|
case 1:
|
||||||
|
pSid->SubAuthority[0] = SubAuthority0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
*Sid = pSid;
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -286,116 +300,120 @@ RtlAllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY IdentifierAuthority,
|
||||||
* Docs says FreeSid does NOT return a value
|
* Docs says FreeSid does NOT return a value
|
||||||
* even thou it's defined to return a PVOID...
|
* even thou it's defined to return a PVOID...
|
||||||
*/
|
*/
|
||||||
PVOID NTAPI
|
PVOID
|
||||||
|
NTAPI
|
||||||
RtlFreeSid(IN PSID Sid)
|
RtlFreeSid(IN PSID Sid)
|
||||||
{
|
{
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
RtlpFreeMemory(Sid, TAG_SID);
|
RtlpFreeMemory(Sid, TAG_SID);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
BOOLEAN NTAPI
|
BOOLEAN
|
||||||
|
NTAPI
|
||||||
RtlEqualPrefixSid(IN PSID Sid1_,
|
RtlEqualPrefixSid(IN PSID Sid1_,
|
||||||
IN PSID Sid2_)
|
IN PSID Sid2_)
|
||||||
{
|
{
|
||||||
PISID Sid1 = Sid1_;
|
PISID Sid1 = Sid1_;
|
||||||
PISID Sid2 = Sid2_;
|
PISID Sid2 = Sid2_;
|
||||||
SIZE_T SidLen;
|
SIZE_T SidLen;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (Sid1->SubAuthorityCount == Sid2->SubAuthorityCount)
|
if (Sid1->SubAuthorityCount == Sid2->SubAuthorityCount)
|
||||||
{
|
{
|
||||||
SidLen = FIELD_OFFSET(SID,
|
SidLen = FIELD_OFFSET(SID,
|
||||||
SubAuthority[Sid1->SubAuthorityCount]);
|
SubAuthority[Sid1->SubAuthorityCount]);
|
||||||
return RtlCompareMemory(Sid1,
|
return RtlCompareMemory(Sid1,
|
||||||
Sid2,
|
Sid2,
|
||||||
SidLen) == SidLen;
|
SidLen) == SidLen;
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
RtlConvertSidToUnicodeString(PUNICODE_STRING String,
|
RtlConvertSidToUnicodeString(PUNICODE_STRING String,
|
||||||
PSID Sid_,
|
PSID Sid_,
|
||||||
BOOLEAN AllocateBuffer)
|
BOOLEAN AllocateBuffer)
|
||||||
{
|
{
|
||||||
WCHAR Buffer[256];
|
WCHAR Buffer[256];
|
||||||
PWSTR wcs;
|
PWSTR wcs;
|
||||||
SIZE_T Length;
|
SIZE_T Length;
|
||||||
ULONG i;
|
ULONG i;
|
||||||
PISID Sid = Sid_;
|
PISID Sid = Sid_;
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
if (RtlValidSid (Sid) == FALSE)
|
if (RtlValidSid (Sid) == FALSE)
|
||||||
return STATUS_INVALID_SID;
|
return STATUS_INVALID_SID;
|
||||||
|
|
||||||
wcs = Buffer;
|
wcs = Buffer;
|
||||||
wcs += swprintf (wcs, L"S-%u-", Sid->Revision);
|
wcs += swprintf(wcs, L"S-%u-", Sid->Revision);
|
||||||
if (Sid->IdentifierAuthority.Value[0] == 0 &&
|
|
||||||
Sid->IdentifierAuthority.Value[1] == 0)
|
|
||||||
{
|
|
||||||
wcs += swprintf (wcs,
|
|
||||||
L"%lu",
|
|
||||||
(ULONG)Sid->IdentifierAuthority.Value[2] << 24 |
|
|
||||||
(ULONG)Sid->IdentifierAuthority.Value[3] << 16 |
|
|
||||||
(ULONG)Sid->IdentifierAuthority.Value[4] << 8 |
|
|
||||||
(ULONG)Sid->IdentifierAuthority.Value[5]);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
wcs += swprintf (wcs,
|
|
||||||
L"0x%02hx%02hx%02hx%02hx%02hx%02hx",
|
|
||||||
Sid->IdentifierAuthority.Value[0],
|
|
||||||
Sid->IdentifierAuthority.Value[1],
|
|
||||||
Sid->IdentifierAuthority.Value[2],
|
|
||||||
Sid->IdentifierAuthority.Value[3],
|
|
||||||
Sid->IdentifierAuthority.Value[4],
|
|
||||||
Sid->IdentifierAuthority.Value[5]);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < Sid->SubAuthorityCount; i++)
|
if (Sid->IdentifierAuthority.Value[0] == 0 &&
|
||||||
{
|
Sid->IdentifierAuthority.Value[1] == 0)
|
||||||
wcs += swprintf (wcs,
|
{
|
||||||
L"-%u",
|
wcs += swprintf(wcs,
|
||||||
Sid->SubAuthority[i]);
|
L"%lu",
|
||||||
}
|
(ULONG)Sid->IdentifierAuthority.Value[2] << 24 |
|
||||||
|
(ULONG)Sid->IdentifierAuthority.Value[3] << 16 |
|
||||||
|
(ULONG)Sid->IdentifierAuthority.Value[4] << 8 |
|
||||||
|
(ULONG)Sid->IdentifierAuthority.Value[5]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wcs += swprintf(wcs,
|
||||||
|
L"0x%02hx%02hx%02hx%02hx%02hx%02hx",
|
||||||
|
Sid->IdentifierAuthority.Value[0],
|
||||||
|
Sid->IdentifierAuthority.Value[1],
|
||||||
|
Sid->IdentifierAuthority.Value[2],
|
||||||
|
Sid->IdentifierAuthority.Value[3],
|
||||||
|
Sid->IdentifierAuthority.Value[4],
|
||||||
|
Sid->IdentifierAuthority.Value[5]);
|
||||||
|
}
|
||||||
|
|
||||||
if (AllocateBuffer)
|
for (i = 0; i < Sid->SubAuthorityCount; i++)
|
||||||
{
|
{
|
||||||
if (!RtlCreateUnicodeString(String,
|
wcs += swprintf(wcs,
|
||||||
Buffer))
|
L"-%u",
|
||||||
{
|
Sid->SubAuthority[i]);
|
||||||
return STATUS_NO_MEMORY;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
Length = (wcs - Buffer) * sizeof(WCHAR);
|
|
||||||
|
|
||||||
if (Length > String->MaximumLength)
|
if (AllocateBuffer)
|
||||||
return STATUS_BUFFER_TOO_SMALL;
|
{
|
||||||
|
if (!RtlCreateUnicodeString(String,
|
||||||
|
Buffer))
|
||||||
|
{
|
||||||
|
return STATUS_NO_MEMORY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
Length = (wcs - Buffer) * sizeof(WCHAR);
|
||||||
|
|
||||||
String->Length = (USHORT)Length;
|
if (Length > String->MaximumLength)
|
||||||
RtlCopyMemory (String->Buffer,
|
return STATUS_BUFFER_TOO_SMALL;
|
||||||
Buffer,
|
|
||||||
Length);
|
|
||||||
if (Length < String->MaximumLength)
|
|
||||||
String->Buffer[Length / sizeof(WCHAR)] = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
String->Length = (USHORT)Length;
|
||||||
|
RtlCopyMemory(String->Buffer,
|
||||||
|
Buffer,
|
||||||
|
Length);
|
||||||
|
if (Length < String->MaximumLength)
|
||||||
|
String->Buffer[Length / sizeof(WCHAR)] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -49,16 +49,16 @@ static const UCHAR MonthLengths[2][MONSPERYEAR] =
|
||||||
|
|
||||||
static __inline int IsLeapYear(int Year)
|
static __inline int IsLeapYear(int Year)
|
||||||
{
|
{
|
||||||
return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0;
|
return Year % 4 == 0 && (Year % 100 != 0 || Year % 400 == 0) ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int DaysSinceEpoch(int Year)
|
static int DaysSinceEpoch(int Year)
|
||||||
{
|
{
|
||||||
int Days;
|
int Days;
|
||||||
Year--; /* Don't include a leap day from the current year */
|
Year--; /* Don't include a leap day from the current year */
|
||||||
Days = Year * DAYSPERNORMALYEAR + Year / 4 - Year / 100 + Year / 400;
|
Days = Year * DAYSPERNORMALYEAR + Year / 4 - Year / 100 + Year / 400;
|
||||||
Days -= (EPOCHYEAR - 1) * DAYSPERNORMALYEAR + (EPOCHYEAR - 1) / 4 - (EPOCHYEAR - 1) / 100 + (EPOCHYEAR - 1) / 400;
|
Days -= (EPOCHYEAR - 1) * DAYSPERNORMALYEAR + (EPOCHYEAR - 1) / 4 - (EPOCHYEAR - 1) / 100 + (EPOCHYEAR - 1) / 400;
|
||||||
return Days;
|
return Days;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
@ -72,93 +72,93 @@ RtlCutoverTimeToSystemTime(IN PTIME_FIELDS CutoverTimeFields,
|
||||||
IN PLARGE_INTEGER CurrentTime,
|
IN PLARGE_INTEGER CurrentTime,
|
||||||
IN BOOLEAN ThisYearsCutoverOnly)
|
IN BOOLEAN ThisYearsCutoverOnly)
|
||||||
{
|
{
|
||||||
TIME_FIELDS AdjustedTimeFields;
|
TIME_FIELDS AdjustedTimeFields;
|
||||||
TIME_FIELDS CurrentTimeFields;
|
TIME_FIELDS CurrentTimeFields;
|
||||||
TIME_FIELDS CutoverSystemTimeFields;
|
TIME_FIELDS CutoverSystemTimeFields;
|
||||||
LARGE_INTEGER CutoverSystemTime;
|
LARGE_INTEGER CutoverSystemTime;
|
||||||
UCHAR MonthLength;
|
UCHAR MonthLength;
|
||||||
CSHORT Days;
|
CSHORT Days;
|
||||||
BOOLEAN NextYearsCutover = FALSE;
|
BOOLEAN NextYearsCutover = FALSE;
|
||||||
|
|
||||||
/* Check fixed cutover time */
|
/* Check fixed cutover time */
|
||||||
if (CutoverTimeFields->Year != 0)
|
if (CutoverTimeFields->Year != 0)
|
||||||
{
|
{
|
||||||
if (!RtlTimeFieldsToTime(CutoverTimeFields, SystemTime))
|
if (!RtlTimeFieldsToTime(CutoverTimeFields, SystemTime))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (SystemTime->QuadPart < CurrentTime->QuadPart)
|
if (SystemTime->QuadPart < CurrentTime->QuadPart)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Compute recurring cutover time
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Day must be between 1(first) and 5(last) */
|
||||||
|
if (CutoverTimeFields->Day == 0 || CutoverTimeFields->Day > 5)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
RtlTimeToTimeFields(CurrentTime, &CurrentTimeFields);
|
||||||
|
|
||||||
|
while (TRUE)
|
||||||
|
{
|
||||||
|
/* Compute the cutover time of the first day of the current month */
|
||||||
|
AdjustedTimeFields.Year = CurrentTimeFields.Year;
|
||||||
|
if (NextYearsCutover == TRUE)
|
||||||
|
AdjustedTimeFields.Year++;
|
||||||
|
|
||||||
|
AdjustedTimeFields.Month = CutoverTimeFields->Month;
|
||||||
|
AdjustedTimeFields.Day = 1;
|
||||||
|
AdjustedTimeFields.Hour = CutoverTimeFields->Hour;
|
||||||
|
AdjustedTimeFields.Minute = CutoverTimeFields->Minute;
|
||||||
|
AdjustedTimeFields.Second = CutoverTimeFields->Second;
|
||||||
|
AdjustedTimeFields.Milliseconds = CutoverTimeFields->Milliseconds;
|
||||||
|
|
||||||
|
if (!RtlTimeFieldsToTime(&AdjustedTimeFields, &CutoverSystemTime))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
RtlTimeToTimeFields(&CutoverSystemTime, &CutoverSystemTimeFields);
|
||||||
|
|
||||||
|
/* Adjust day to first matching weekday */
|
||||||
|
if (CutoverSystemTimeFields.Weekday != CutoverTimeFields->Weekday)
|
||||||
|
{
|
||||||
|
if (CutoverSystemTimeFields.Weekday < CutoverTimeFields->Weekday)
|
||||||
|
Days = CutoverTimeFields->Weekday - CutoverSystemTimeFields.Weekday;
|
||||||
|
else
|
||||||
|
Days = DAYSPERWEEK - (CutoverSystemTimeFields.Weekday - CutoverTimeFields->Weekday);
|
||||||
|
|
||||||
|
AdjustedTimeFields.Day += Days;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Adjust the number of weeks */
|
||||||
|
if (CutoverTimeFields->Day > 1)
|
||||||
|
{
|
||||||
|
Days = DAYSPERWEEK * (CutoverTimeFields->Day - 1);
|
||||||
|
MonthLength = MonthLengths[IsLeapYear(AdjustedTimeFields.Year)][AdjustedTimeFields.Month - 1];
|
||||||
|
if ((AdjustedTimeFields.Day + Days) > MonthLength)
|
||||||
|
Days -= DAYSPERWEEK;
|
||||||
|
|
||||||
|
AdjustedTimeFields.Day += Days;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!RtlTimeFieldsToTime(&AdjustedTimeFields, &CutoverSystemTime))
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (ThisYearsCutoverOnly == TRUE ||
|
||||||
|
NextYearsCutover == TRUE ||
|
||||||
|
CutoverSystemTime.QuadPart >= CurrentTime->QuadPart)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
NextYearsCutover = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
SystemTime->QuadPart = CutoverSystemTime.QuadPart;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Compute recurring cutover time
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* Day must be between 1(first) and 5(last) */
|
|
||||||
if (CutoverTimeFields->Day == 0 || CutoverTimeFields->Day > 5)
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
RtlTimeToTimeFields(CurrentTime, &CurrentTimeFields);
|
|
||||||
|
|
||||||
while (TRUE)
|
|
||||||
{
|
|
||||||
/* Compute the cutover time of the first day of the current month */
|
|
||||||
AdjustedTimeFields.Year = CurrentTimeFields.Year;
|
|
||||||
if (NextYearsCutover == TRUE)
|
|
||||||
AdjustedTimeFields.Year++;
|
|
||||||
|
|
||||||
AdjustedTimeFields.Month = CutoverTimeFields->Month;
|
|
||||||
AdjustedTimeFields.Day = 1;
|
|
||||||
AdjustedTimeFields.Hour = CutoverTimeFields->Hour;
|
|
||||||
AdjustedTimeFields.Minute = CutoverTimeFields->Minute;
|
|
||||||
AdjustedTimeFields.Second = CutoverTimeFields->Second;
|
|
||||||
AdjustedTimeFields.Milliseconds = CutoverTimeFields->Milliseconds;
|
|
||||||
|
|
||||||
if (!RtlTimeFieldsToTime(&AdjustedTimeFields, &CutoverSystemTime))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
RtlTimeToTimeFields(&CutoverSystemTime, &CutoverSystemTimeFields);
|
|
||||||
|
|
||||||
/* Adjust day to first matching weekday */
|
|
||||||
if (CutoverSystemTimeFields.Weekday != CutoverTimeFields->Weekday)
|
|
||||||
{
|
|
||||||
if (CutoverSystemTimeFields.Weekday < CutoverTimeFields->Weekday)
|
|
||||||
Days = CutoverTimeFields->Weekday - CutoverSystemTimeFields.Weekday;
|
|
||||||
else
|
|
||||||
Days = DAYSPERWEEK - (CutoverSystemTimeFields.Weekday - CutoverTimeFields->Weekday);
|
|
||||||
|
|
||||||
AdjustedTimeFields.Day += Days;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Adjust the number of weeks */
|
|
||||||
if (CutoverTimeFields->Day > 1)
|
|
||||||
{
|
|
||||||
Days = DAYSPERWEEK * (CutoverTimeFields->Day - 1);
|
|
||||||
MonthLength = MonthLengths[IsLeapYear(AdjustedTimeFields.Year)][AdjustedTimeFields.Month - 1];
|
|
||||||
if ((AdjustedTimeFields.Day + Days) > MonthLength)
|
|
||||||
Days -= DAYSPERWEEK;
|
|
||||||
|
|
||||||
AdjustedTimeFields.Day += Days;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!RtlTimeFieldsToTime(&AdjustedTimeFields, &CutoverSystemTime))
|
|
||||||
return FALSE;
|
|
||||||
|
|
||||||
if (ThisYearsCutoverOnly == TRUE ||
|
|
||||||
NextYearsCutover == TRUE ||
|
|
||||||
CutoverSystemTime.QuadPart >= CurrentTime->QuadPart)
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
NextYearsCutover = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
SystemTime->QuadPart = CutoverSystemTime.QuadPart;
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -167,44 +167,43 @@ RtlCutoverTimeToSystemTime(IN PTIME_FIELDS CutoverTimeFields,
|
||||||
*/
|
*/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlTimeFieldsToTime(
|
RtlTimeFieldsToTime(IN PTIME_FIELDS TimeFields,
|
||||||
IN PTIME_FIELDS TimeFields,
|
OUT PLARGE_INTEGER Time)
|
||||||
OUT PLARGE_INTEGER Time)
|
|
||||||
{
|
{
|
||||||
int CurMonth;
|
int CurMonth;
|
||||||
TIME_FIELDS IntTimeFields;
|
TIME_FIELDS IntTimeFields;
|
||||||
|
|
||||||
memcpy(&IntTimeFields,
|
memcpy(&IntTimeFields,
|
||||||
TimeFields,
|
TimeFields,
|
||||||
sizeof(TIME_FIELDS));
|
sizeof(TIME_FIELDS));
|
||||||
|
|
||||||
if (TimeFields->Milliseconds < 0 || TimeFields->Milliseconds > 999 ||
|
if (TimeFields->Milliseconds < 0 || TimeFields->Milliseconds > 999 ||
|
||||||
TimeFields->Second < 0 || TimeFields->Second > 59 ||
|
TimeFields->Second < 0 || TimeFields->Second > 59 ||
|
||||||
TimeFields->Minute < 0 || TimeFields->Minute > 59 ||
|
TimeFields->Minute < 0 || TimeFields->Minute > 59 ||
|
||||||
TimeFields->Hour < 0 || TimeFields->Hour > 23 ||
|
TimeFields->Hour < 0 || TimeFields->Hour > 23 ||
|
||||||
TimeFields->Month < 1 || TimeFields->Month > 12 ||
|
TimeFields->Month < 1 || TimeFields->Month > 12 ||
|
||||||
TimeFields->Day < 1 ||
|
TimeFields->Day < 1 ||
|
||||||
TimeFields->Day >
|
TimeFields->Day >
|
||||||
MonthLengths[IsLeapYear(TimeFields->Year)][TimeFields->Month - 1] ||
|
MonthLengths[IsLeapYear(TimeFields->Year)][TimeFields->Month - 1] ||
|
||||||
TimeFields->Year < 1601)
|
TimeFields->Year < 1601)
|
||||||
{
|
{
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Compute the time */
|
/* Compute the time */
|
||||||
Time->QuadPart = DaysSinceEpoch(IntTimeFields.Year);
|
Time->QuadPart = DaysSinceEpoch(IntTimeFields.Year);
|
||||||
for (CurMonth = 1; CurMonth < IntTimeFields.Month; CurMonth++)
|
for (CurMonth = 1; CurMonth < IntTimeFields.Month; CurMonth++)
|
||||||
{
|
{
|
||||||
Time->QuadPart += MonthLengths[IsLeapYear(IntTimeFields.Year)][CurMonth - 1];
|
Time->QuadPart += MonthLengths[IsLeapYear(IntTimeFields.Year)][CurMonth - 1];
|
||||||
}
|
}
|
||||||
Time->QuadPart += IntTimeFields.Day - 1;
|
Time->QuadPart += IntTimeFields.Day - 1;
|
||||||
Time->QuadPart *= SECSPERDAY;
|
Time->QuadPart *= SECSPERDAY;
|
||||||
Time->QuadPart += IntTimeFields.Hour * SECSPERHOUR + IntTimeFields.Minute * SECSPERMIN +
|
Time->QuadPart += IntTimeFields.Hour * SECSPERHOUR + IntTimeFields.Minute * SECSPERMIN +
|
||||||
IntTimeFields.Second;
|
IntTimeFields.Second;
|
||||||
Time->QuadPart *= TICKSPERSEC;
|
Time->QuadPart *= TICKSPERSEC;
|
||||||
Time->QuadPart += IntTimeFields.Milliseconds * TICKSPERMSEC;
|
Time->QuadPart += IntTimeFields.Milliseconds * TICKSPERMSEC;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -216,33 +215,33 @@ NTAPI
|
||||||
RtlTimeToElapsedTimeFields(IN PLARGE_INTEGER Time,
|
RtlTimeToElapsedTimeFields(IN PLARGE_INTEGER Time,
|
||||||
OUT PTIME_FIELDS TimeFields)
|
OUT PTIME_FIELDS TimeFields)
|
||||||
{
|
{
|
||||||
ULONGLONG ElapsedSeconds;
|
ULONGLONG ElapsedSeconds;
|
||||||
ULONG SecondsInDay;
|
ULONG SecondsInDay;
|
||||||
ULONG SecondsInMinute;
|
ULONG SecondsInMinute;
|
||||||
|
|
||||||
/* Extract millisecond from time */
|
/* Extract millisecond from time */
|
||||||
TimeFields->Milliseconds = (CSHORT)((Time->QuadPart % TICKSPERSEC) / TICKSPERMSEC);
|
TimeFields->Milliseconds = (CSHORT)((Time->QuadPart % TICKSPERSEC) / TICKSPERMSEC);
|
||||||
|
|
||||||
/* Compute elapsed seconds */
|
/* Compute elapsed seconds */
|
||||||
ElapsedSeconds = (ULONGLONG)Time->QuadPart / TICKSPERSEC;
|
ElapsedSeconds = (ULONGLONG)Time->QuadPart / TICKSPERSEC;
|
||||||
|
|
||||||
/* Compute seconds within the day */
|
/* Compute seconds within the day */
|
||||||
SecondsInDay = ElapsedSeconds % SECSPERDAY;
|
SecondsInDay = ElapsedSeconds % SECSPERDAY;
|
||||||
|
|
||||||
/* Compute elapsed minutes within the day */
|
/* Compute elapsed minutes within the day */
|
||||||
SecondsInMinute = SecondsInDay % SECSPERHOUR;
|
SecondsInMinute = SecondsInDay % SECSPERHOUR;
|
||||||
|
|
||||||
/* Compute elapsed time of day */
|
/* Compute elapsed time of day */
|
||||||
TimeFields->Hour = (CSHORT)(SecondsInDay / SECSPERHOUR);
|
TimeFields->Hour = (CSHORT)(SecondsInDay / SECSPERHOUR);
|
||||||
TimeFields->Minute = (CSHORT)(SecondsInMinute / SECSPERMIN);
|
TimeFields->Minute = (CSHORT)(SecondsInMinute / SECSPERMIN);
|
||||||
TimeFields->Second = (CSHORT)(SecondsInMinute % SECSPERMIN);
|
TimeFields->Second = (CSHORT)(SecondsInMinute % SECSPERMIN);
|
||||||
|
|
||||||
/* Compute elapsed days */
|
/* Compute elapsed days */
|
||||||
TimeFields->Day = (CSHORT)(ElapsedSeconds / SECSPERDAY);
|
TimeFields->Day = (CSHORT)(ElapsedSeconds / SECSPERDAY);
|
||||||
|
|
||||||
/* The elapsed number of months and days cannot be calculated */
|
/* The elapsed number of months and days cannot be calculated */
|
||||||
TimeFields->Month = 0;
|
TimeFields->Month = 0;
|
||||||
TimeFields->Year = 0;
|
TimeFields->Year = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -251,56 +250,55 @@ RtlTimeToElapsedTimeFields(IN PLARGE_INTEGER Time,
|
||||||
*/
|
*/
|
||||||
VOID
|
VOID
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlTimeToTimeFields(
|
RtlTimeToTimeFields(IN PLARGE_INTEGER Time,
|
||||||
IN PLARGE_INTEGER Time,
|
OUT PTIME_FIELDS TimeFields)
|
||||||
OUT PTIME_FIELDS TimeFields)
|
|
||||||
{
|
{
|
||||||
const UCHAR *Months;
|
const UCHAR *Months;
|
||||||
ULONG SecondsInDay, CurYear;
|
ULONG SecondsInDay, CurYear;
|
||||||
ULONG LeapYear, CurMonth;
|
ULONG LeapYear, CurMonth;
|
||||||
ULONG Days;
|
ULONG Days;
|
||||||
ULONGLONG IntTime = Time->QuadPart;
|
ULONGLONG IntTime = Time->QuadPart;
|
||||||
|
|
||||||
/* Extract millisecond from time and convert time into seconds */
|
/* Extract millisecond from time and convert time into seconds */
|
||||||
TimeFields->Milliseconds = (CSHORT) ((IntTime % TICKSPERSEC) / TICKSPERMSEC);
|
TimeFields->Milliseconds = (CSHORT) ((IntTime % TICKSPERSEC) / TICKSPERMSEC);
|
||||||
IntTime = IntTime / TICKSPERSEC;
|
IntTime = IntTime / TICKSPERSEC;
|
||||||
|
|
||||||
/* Split the time into days and seconds within the day */
|
/* Split the time into days and seconds within the day */
|
||||||
Days = (ULONG)(IntTime / SECSPERDAY);
|
Days = (ULONG)(IntTime / SECSPERDAY);
|
||||||
SecondsInDay = IntTime % SECSPERDAY;
|
SecondsInDay = IntTime % SECSPERDAY;
|
||||||
|
|
||||||
/* compute time of day */
|
/* compute time of day */
|
||||||
TimeFields->Hour = (CSHORT) (SecondsInDay / SECSPERHOUR);
|
TimeFields->Hour = (CSHORT) (SecondsInDay / SECSPERHOUR);
|
||||||
SecondsInDay = SecondsInDay % SECSPERHOUR;
|
SecondsInDay = SecondsInDay % SECSPERHOUR;
|
||||||
TimeFields->Minute = (CSHORT) (SecondsInDay / SECSPERMIN);
|
TimeFields->Minute = (CSHORT) (SecondsInDay / SECSPERMIN);
|
||||||
TimeFields->Second = (CSHORT) (SecondsInDay % SECSPERMIN);
|
TimeFields->Second = (CSHORT) (SecondsInDay % SECSPERMIN);
|
||||||
|
|
||||||
/* compute day of week */
|
/* compute day of week */
|
||||||
TimeFields->Weekday = (CSHORT) ((EPOCHWEEKDAY + Days) % DAYSPERWEEK);
|
TimeFields->Weekday = (CSHORT) ((EPOCHWEEKDAY + Days) % DAYSPERWEEK);
|
||||||
|
|
||||||
/* compute year */
|
/* compute year */
|
||||||
CurYear = EPOCHYEAR;
|
CurYear = EPOCHYEAR;
|
||||||
CurYear += Days / DAYSPERLEAPYEAR;
|
CurYear += Days / DAYSPERLEAPYEAR;
|
||||||
Days -= DaysSinceEpoch(CurYear);
|
Days -= DaysSinceEpoch(CurYear);
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
LeapYear = IsLeapYear(CurYear);
|
LeapYear = IsLeapYear(CurYear);
|
||||||
if (Days < YearLengths[LeapYear])
|
if (Days < YearLengths[LeapYear])
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CurYear++;
|
CurYear++;
|
||||||
Days = Days - YearLengths[LeapYear];
|
Days = Days - YearLengths[LeapYear];
|
||||||
}
|
}
|
||||||
TimeFields->Year = (CSHORT) CurYear;
|
TimeFields->Year = (CSHORT) CurYear;
|
||||||
|
|
||||||
/* Compute month of year */
|
/* Compute month of year */
|
||||||
LeapYear = IsLeapYear(CurYear);
|
LeapYear = IsLeapYear(CurYear);
|
||||||
Months = MonthLengths[LeapYear];
|
Months = MonthLengths[LeapYear];
|
||||||
for (CurMonth = 0; Days >= Months[CurMonth]; CurMonth++)
|
for (CurMonth = 0; Days >= Months[CurMonth]; CurMonth++)
|
||||||
Days = Days - Months[CurMonth];
|
Days = Days - Months[CurMonth];
|
||||||
TimeFields->Month = (CSHORT) (CurMonth + 1);
|
TimeFields->Month = (CSHORT) (CurMonth + 1);
|
||||||
TimeFields->Day = (CSHORT) (Days + 1);
|
TimeFields->Day = (CSHORT) (Days + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -309,21 +307,20 @@ RtlTimeToTimeFields(
|
||||||
*/
|
*/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlTimeToSecondsSince1970(
|
RtlTimeToSecondsSince1970(IN PLARGE_INTEGER Time,
|
||||||
IN PLARGE_INTEGER Time,
|
OUT PULONG SecondsSince1970)
|
||||||
OUT PULONG SecondsSince1970)
|
|
||||||
{
|
{
|
||||||
LARGE_INTEGER IntTime;
|
LARGE_INTEGER IntTime;
|
||||||
|
|
||||||
IntTime.QuadPart = Time->QuadPart - TICKSTO1970;
|
IntTime.QuadPart = Time->QuadPart - TICKSTO1970;
|
||||||
IntTime.QuadPart = IntTime.QuadPart / TICKSPERSEC;
|
IntTime.QuadPart = IntTime.QuadPart / TICKSPERSEC;
|
||||||
|
|
||||||
if (IntTime.u.HighPart != 0)
|
if (IntTime.u.HighPart != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*SecondsSince1970 = IntTime.u.LowPart;
|
*SecondsSince1970 = IntTime.u.LowPart;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -332,21 +329,20 @@ RtlTimeToSecondsSince1970(
|
||||||
*/
|
*/
|
||||||
BOOLEAN
|
BOOLEAN
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlTimeToSecondsSince1980(
|
RtlTimeToSecondsSince1980(IN PLARGE_INTEGER Time,
|
||||||
IN PLARGE_INTEGER Time,
|
OUT PULONG SecondsSince1980)
|
||||||
OUT PULONG SecondsSince1980)
|
|
||||||
{
|
{
|
||||||
LARGE_INTEGER IntTime;
|
LARGE_INTEGER IntTime;
|
||||||
|
|
||||||
IntTime.QuadPart = Time->QuadPart - TICKSTO1980;
|
IntTime.QuadPart = Time->QuadPart - TICKSTO1980;
|
||||||
IntTime.QuadPart = IntTime.QuadPart / TICKSPERSEC;
|
IntTime.QuadPart = IntTime.QuadPart / TICKSPERSEC;
|
||||||
|
|
||||||
if (IntTime.u.HighPart != 0)
|
if (IntTime.u.HighPart != 0)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
*SecondsSince1980 = IntTime.u.LowPart;
|
*SecondsSince1980 = IntTime.u.LowPart;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -358,20 +354,20 @@ NTAPI
|
||||||
RtlLocalTimeToSystemTime(IN PLARGE_INTEGER LocalTime,
|
RtlLocalTimeToSystemTime(IN PLARGE_INTEGER LocalTime,
|
||||||
OUT PLARGE_INTEGER SystemTime)
|
OUT PLARGE_INTEGER SystemTime)
|
||||||
{
|
{
|
||||||
SYSTEM_TIMEOFDAY_INFORMATION TimeInformation;
|
SYSTEM_TIMEOFDAY_INFORMATION TimeInformation;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = ZwQuerySystemInformation(SystemTimeOfDayInformation,
|
Status = ZwQuerySystemInformation(SystemTimeOfDayInformation,
|
||||||
&TimeInformation,
|
&TimeInformation,
|
||||||
sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
|
sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
SystemTime->QuadPart = LocalTime->QuadPart +
|
SystemTime->QuadPart = LocalTime->QuadPart +
|
||||||
TimeInformation.TimeZoneBias.QuadPart;
|
TimeInformation.TimeZoneBias.QuadPart;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -383,20 +379,32 @@ NTAPI
|
||||||
RtlSystemTimeToLocalTime(IN PLARGE_INTEGER SystemTime,
|
RtlSystemTimeToLocalTime(IN PLARGE_INTEGER SystemTime,
|
||||||
OUT PLARGE_INTEGER LocalTime)
|
OUT PLARGE_INTEGER LocalTime)
|
||||||
{
|
{
|
||||||
SYSTEM_TIMEOFDAY_INFORMATION TimeInformation;
|
SYSTEM_TIMEOFDAY_INFORMATION TimeInformation;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
Status = ZwQuerySystemInformation(SystemTimeOfDayInformation,
|
Status = ZwQuerySystemInformation(SystemTimeOfDayInformation,
|
||||||
&TimeInformation,
|
&TimeInformation,
|
||||||
sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
|
sizeof(SYSTEM_TIMEOFDAY_INFORMATION),
|
||||||
NULL);
|
NULL);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
return Status;
|
return Status;
|
||||||
|
|
||||||
LocalTime->QuadPart = SystemTime->QuadPart -
|
LocalTime->QuadPart = SystemTime->QuadPart -
|
||||||
TimeInformation.TimeZoneBias.QuadPart;
|
TimeInformation.TimeZoneBias.QuadPart;
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* @implemented
|
||||||
|
*/
|
||||||
|
VOID
|
||||||
|
NTAPI
|
||||||
|
RtlSecondsSince1970ToTime(IN ULONG SecondsSince1970,
|
||||||
|
OUT PLARGE_INTEGER Time)
|
||||||
|
{
|
||||||
|
Time->QuadPart = ((LONGLONG)SecondsSince1970 * TICKSPERSEC) + TICKSTO1970;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -404,23 +412,10 @@ RtlSystemTimeToLocalTime(IN PLARGE_INTEGER SystemTime,
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
VOID NTAPI
|
VOID NTAPI
|
||||||
RtlSecondsSince1970ToTime(
|
RtlSecondsSince1980ToTime(IN ULONG SecondsSince1980,
|
||||||
IN ULONG SecondsSince1970,
|
OUT PLARGE_INTEGER Time)
|
||||||
OUT PLARGE_INTEGER Time)
|
|
||||||
{
|
{
|
||||||
Time->QuadPart = ((LONGLONG)SecondsSince1970 * TICKSPERSEC) + TICKSTO1970;
|
Time->QuadPart = ((LONGLONG)SecondsSince1980 * TICKSPERSEC) + TICKSTO1980;
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* @implemented
|
|
||||||
*/
|
|
||||||
VOID NTAPI
|
|
||||||
RtlSecondsSince1980ToTime(
|
|
||||||
IN ULONG SecondsSince1980,
|
|
||||||
OUT PLARGE_INTEGER Time)
|
|
||||||
{
|
|
||||||
Time->QuadPart = ((LONGLONG)SecondsSince1980 * TICKSPERSEC) + TICKSTO1980;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -18,156 +18,158 @@
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
RtlQueryTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
|
RtlQueryTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
|
||||||
{
|
{
|
||||||
RTL_QUERY_REGISTRY_TABLE QueryTable[8];
|
RTL_QUERY_REGISTRY_TABLE QueryTable[8];
|
||||||
UNICODE_STRING StandardName;
|
UNICODE_STRING StandardName;
|
||||||
UNICODE_STRING DaylightName;
|
UNICODE_STRING DaylightName;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("RtlQueryTimeZoneInformation()\n");
|
DPRINT("RtlQueryTimeZoneInformation()\n");
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
RtlZeroMemory(QueryTable,
|
RtlZeroMemory(QueryTable,
|
||||||
sizeof(QueryTable));
|
sizeof(QueryTable));
|
||||||
|
|
||||||
StandardName.Length = 0;
|
StandardName.Length = 0;
|
||||||
StandardName.MaximumLength = 32 * sizeof(WCHAR);
|
StandardName.MaximumLength = 32 * sizeof(WCHAR);
|
||||||
StandardName.Buffer = TimeZoneInformation->StandardName;
|
StandardName.Buffer = TimeZoneInformation->StandardName;
|
||||||
|
|
||||||
DaylightName.Length = 0;
|
DaylightName.Length = 0;
|
||||||
DaylightName.MaximumLength = 32 * sizeof(WCHAR);
|
DaylightName.MaximumLength = 32 * sizeof(WCHAR);
|
||||||
DaylightName.Buffer = TimeZoneInformation->DaylightName;
|
DaylightName.Buffer = TimeZoneInformation->DaylightName;
|
||||||
|
|
||||||
QueryTable[0].Name = L"Bias";
|
QueryTable[0].Name = L"Bias";
|
||||||
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
QueryTable[0].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
||||||
QueryTable[0].EntryContext = &TimeZoneInformation->Bias;
|
QueryTable[0].EntryContext = &TimeZoneInformation->Bias;
|
||||||
|
|
||||||
QueryTable[1].Name = L"Standard Name";
|
QueryTable[1].Name = L"Standard Name";
|
||||||
QueryTable[1].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
QueryTable[1].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
||||||
QueryTable[1].EntryContext = &StandardName;
|
QueryTable[1].EntryContext = &StandardName;
|
||||||
|
|
||||||
QueryTable[2].Name = L"Standard Bias";
|
QueryTable[2].Name = L"Standard Bias";
|
||||||
QueryTable[2].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
QueryTable[2].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
||||||
QueryTable[2].EntryContext = &TimeZoneInformation->StandardBias;
|
QueryTable[2].EntryContext = &TimeZoneInformation->StandardBias;
|
||||||
|
|
||||||
QueryTable[3].Name = L"Standard Start";
|
QueryTable[3].Name = L"Standard Start";
|
||||||
QueryTable[3].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
QueryTable[3].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
||||||
QueryTable[3].EntryContext = &TimeZoneInformation->StandardDate;
|
QueryTable[3].EntryContext = &TimeZoneInformation->StandardDate;
|
||||||
|
|
||||||
QueryTable[4].Name = L"Daylight Name";
|
QueryTable[4].Name = L"Daylight Name";
|
||||||
QueryTable[4].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
QueryTable[4].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
||||||
QueryTable[4].EntryContext = &DaylightName;
|
QueryTable[4].EntryContext = &DaylightName;
|
||||||
|
|
||||||
QueryTable[5].Name = L"Daylight Bias";
|
QueryTable[5].Name = L"Daylight Bias";
|
||||||
QueryTable[5].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
QueryTable[5].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
||||||
QueryTable[5].EntryContext = &TimeZoneInformation->DaylightBias;
|
QueryTable[5].EntryContext = &TimeZoneInformation->DaylightBias;
|
||||||
|
|
||||||
QueryTable[6].Name = L"Daylight Start";
|
QueryTable[6].Name = L"Daylight Start";
|
||||||
QueryTable[6].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
QueryTable[6].Flags = RTL_QUERY_REGISTRY_DIRECT;
|
||||||
QueryTable[6].EntryContext = &TimeZoneInformation->DaylightDate;
|
QueryTable[6].EntryContext = &TimeZoneInformation->DaylightDate;
|
||||||
|
|
||||||
Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
|
Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL,
|
||||||
L"TimeZoneInformation",
|
L"TimeZoneInformation",
|
||||||
QueryTable,
|
QueryTable,
|
||||||
NULL,
|
NULL,
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
NTSTATUS NTAPI
|
NTSTATUS
|
||||||
|
NTAPI
|
||||||
RtlSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
|
RtlSetTimeZoneInformation(PRTL_TIME_ZONE_INFORMATION TimeZoneInformation)
|
||||||
{
|
{
|
||||||
SIZE_T Length;
|
SIZE_T Length;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
|
||||||
DPRINT("RtlSetTimeZoneInformation()\n");
|
DPRINT("RtlSetTimeZoneInformation()\n");
|
||||||
|
|
||||||
PAGED_CODE_RTL();
|
PAGED_CODE_RTL();
|
||||||
|
|
||||||
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
||||||
L"TimeZoneInformation",
|
L"TimeZoneInformation",
|
||||||
L"Bias",
|
L"Bias",
|
||||||
REG_DWORD,
|
REG_DWORD,
|
||||||
&TimeZoneInformation->Bias,
|
&TimeZoneInformation->Bias,
|
||||||
sizeof(LONG));
|
sizeof(LONG));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Length = (wcslen(TimeZoneInformation->StandardName) + 1) * sizeof(WCHAR);
|
Length = (wcslen(TimeZoneInformation->StandardName) + 1) * sizeof(WCHAR);
|
||||||
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
||||||
L"TimeZoneInformation",
|
L"TimeZoneInformation",
|
||||||
L"Standard Name",
|
L"Standard Name",
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
TimeZoneInformation->StandardName,
|
TimeZoneInformation->StandardName,
|
||||||
(ULONG)Length);
|
(ULONG)Length);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
||||||
L"TimeZoneInformation",
|
L"TimeZoneInformation",
|
||||||
L"Standard Bias",
|
L"Standard Bias",
|
||||||
REG_DWORD,
|
REG_DWORD,
|
||||||
&TimeZoneInformation->StandardBias,
|
&TimeZoneInformation->StandardBias,
|
||||||
sizeof(LONG));
|
sizeof(LONG));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
||||||
L"TimeZoneInformation",
|
L"TimeZoneInformation",
|
||||||
L"Standard Start",
|
L"Standard Start",
|
||||||
REG_BINARY,
|
REG_BINARY,
|
||||||
&TimeZoneInformation->StandardDate,
|
&TimeZoneInformation->StandardDate,
|
||||||
sizeof(SYSTEMTIME));
|
sizeof(SYSTEMTIME));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Length = (wcslen(TimeZoneInformation->DaylightName) + 1) * sizeof(WCHAR);
|
Length = (wcslen(TimeZoneInformation->DaylightName) + 1) * sizeof(WCHAR);
|
||||||
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
||||||
L"TimeZoneInformation",
|
L"TimeZoneInformation",
|
||||||
L"Daylight Name",
|
L"Daylight Name",
|
||||||
REG_SZ,
|
REG_SZ,
|
||||||
TimeZoneInformation->DaylightName,
|
TimeZoneInformation->DaylightName,
|
||||||
(ULONG)Length);
|
(ULONG)Length);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
||||||
L"TimeZoneInformation",
|
L"TimeZoneInformation",
|
||||||
L"Daylight Bias",
|
L"Daylight Bias",
|
||||||
REG_DWORD,
|
REG_DWORD,
|
||||||
&TimeZoneInformation->DaylightBias,
|
&TimeZoneInformation->DaylightBias,
|
||||||
sizeof(LONG));
|
sizeof(LONG));
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
Status = RtlWriteRegistryValue(RTL_REGISTRY_CONTROL,
|
||||||
L"TimeZoneInformation",
|
L"TimeZoneInformation",
|
||||||
L"Daylight Start",
|
L"Daylight Start",
|
||||||
REG_BINARY,
|
REG_BINARY,
|
||||||
&TimeZoneInformation->DaylightDate,
|
&TimeZoneInformation->DaylightDate,
|
||||||
sizeof(SYSTEMTIME));
|
sizeof(SYSTEMTIME));
|
||||||
|
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -154,37 +154,38 @@ RtlVerifyVersionInfo(
|
||||||
/*
|
/*
|
||||||
* @implemented
|
* @implemented
|
||||||
*/
|
*/
|
||||||
ULONGLONG NTAPI
|
ULONGLONG
|
||||||
|
NTAPI
|
||||||
VerSetConditionMask(IN ULONGLONG dwlConditionMask,
|
VerSetConditionMask(IN ULONGLONG dwlConditionMask,
|
||||||
IN DWORD dwTypeBitMask,
|
IN DWORD dwTypeBitMask,
|
||||||
IN BYTE dwConditionMask)
|
IN BYTE dwConditionMask)
|
||||||
{
|
{
|
||||||
if(dwTypeBitMask == 0)
|
if (dwTypeBitMask == 0)
|
||||||
|
return dwlConditionMask;
|
||||||
|
|
||||||
|
dwConditionMask &= VER_CONDITION_MASK;
|
||||||
|
|
||||||
|
if (dwConditionMask == 0)
|
||||||
|
return dwlConditionMask;
|
||||||
|
|
||||||
|
if (dwTypeBitMask & VER_PRODUCT_TYPE)
|
||||||
|
dwlConditionMask |= dwConditionMask << 7 * VER_NUM_BITS_PER_CONDITION_MASK;
|
||||||
|
else if (dwTypeBitMask & VER_SUITENAME)
|
||||||
|
dwlConditionMask |= dwConditionMask << 6 * VER_NUM_BITS_PER_CONDITION_MASK;
|
||||||
|
else if (dwTypeBitMask & VER_SERVICEPACKMAJOR)
|
||||||
|
dwlConditionMask |= dwConditionMask << 5 * VER_NUM_BITS_PER_CONDITION_MASK;
|
||||||
|
else if (dwTypeBitMask & VER_SERVICEPACKMINOR)
|
||||||
|
dwlConditionMask |= dwConditionMask << 4 * VER_NUM_BITS_PER_CONDITION_MASK;
|
||||||
|
else if (dwTypeBitMask & VER_PLATFORMID)
|
||||||
|
dwlConditionMask |= dwConditionMask << 3 * VER_NUM_BITS_PER_CONDITION_MASK;
|
||||||
|
else if (dwTypeBitMask & VER_BUILDNUMBER)
|
||||||
|
dwlConditionMask |= dwConditionMask << 2 * VER_NUM_BITS_PER_CONDITION_MASK;
|
||||||
|
else if (dwTypeBitMask & VER_MAJORVERSION)
|
||||||
|
dwlConditionMask |= dwConditionMask << 1 * VER_NUM_BITS_PER_CONDITION_MASK;
|
||||||
|
else if (dwTypeBitMask & VER_MINORVERSION)
|
||||||
|
dwlConditionMask |= dwConditionMask << 0 * VER_NUM_BITS_PER_CONDITION_MASK;
|
||||||
|
|
||||||
return dwlConditionMask;
|
return dwlConditionMask;
|
||||||
|
|
||||||
dwConditionMask &= VER_CONDITION_MASK;
|
|
||||||
|
|
||||||
if(dwConditionMask == 0)
|
|
||||||
return dwlConditionMask;
|
|
||||||
|
|
||||||
if(dwTypeBitMask & VER_PRODUCT_TYPE)
|
|
||||||
dwlConditionMask |= dwConditionMask << 7 * VER_NUM_BITS_PER_CONDITION_MASK;
|
|
||||||
else if(dwTypeBitMask & VER_SUITENAME)
|
|
||||||
dwlConditionMask |= dwConditionMask << 6 * VER_NUM_BITS_PER_CONDITION_MASK;
|
|
||||||
else if(dwTypeBitMask & VER_SERVICEPACKMAJOR)
|
|
||||||
dwlConditionMask |= dwConditionMask << 5 * VER_NUM_BITS_PER_CONDITION_MASK;
|
|
||||||
else if(dwTypeBitMask & VER_SERVICEPACKMINOR)
|
|
||||||
dwlConditionMask |= dwConditionMask << 4 * VER_NUM_BITS_PER_CONDITION_MASK;
|
|
||||||
else if(dwTypeBitMask & VER_PLATFORMID)
|
|
||||||
dwlConditionMask |= dwConditionMask << 3 * VER_NUM_BITS_PER_CONDITION_MASK;
|
|
||||||
else if(dwTypeBitMask & VER_BUILDNUMBER)
|
|
||||||
dwlConditionMask |= dwConditionMask << 2 * VER_NUM_BITS_PER_CONDITION_MASK;
|
|
||||||
else if(dwTypeBitMask & VER_MAJORVERSION)
|
|
||||||
dwlConditionMask |= dwConditionMask << 1 * VER_NUM_BITS_PER_CONDITION_MASK;
|
|
||||||
else if(dwTypeBitMask & VER_MINORVERSION)
|
|
||||||
dwlConditionMask |= dwConditionMask << 0 * VER_NUM_BITS_PER_CONDITION_MASK;
|
|
||||||
|
|
||||||
return dwlConditionMask;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* EOF */
|
/* EOF */
|
||||||
|
|
|
@ -127,7 +127,7 @@ Wait_thread_proc(LPVOID Arg)
|
||||||
*|WT_EXECUTELONGFUNCTION - Hints that the execution can take a long time.
|
*|WT_EXECUTELONGFUNCTION - Hints that the execution can take a long time.
|
||||||
*|WT_TRANSFER_IMPERSONATION - Executes the function with the current access token.
|
*|WT_TRANSFER_IMPERSONATION - Executes the function with the current access token.
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlRegisterWait(PHANDLE NewWaitObject,
|
RtlRegisterWait(PHANDLE NewWaitObject,
|
||||||
HANDLE Object,
|
HANDLE Object,
|
||||||
|
@ -194,8 +194,8 @@ RtlRegisterWait(PHANDLE NewWaitObject,
|
||||||
* Success: STATUS_SUCCESS.
|
* Success: STATUS_SUCCESS.
|
||||||
* Failure: Any NTSTATUS code.
|
* Failure: Any NTSTATUS code.
|
||||||
*/
|
*/
|
||||||
NTSTATUS
|
NTSTATUS
|
||||||
NTAPI
|
NTAPI
|
||||||
RtlDeregisterWaitEx(HANDLE WaitHandle,
|
RtlDeregisterWaitEx(HANDLE WaitHandle,
|
||||||
HANDLE CompletionEvent)
|
HANDLE CompletionEvent)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue