Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
d76f9f96
Commit
d76f9f96
authored
Oct 01, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented a bunch of large integer functions in ntdll.
parent
a8378494
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
282 additions
and
139 deletions
+282
-139
time.c
dlls/kernel/time.c
+10
-0
Makefile.in
dlls/ntdll/Makefile.in
+1
-0
large_int.c
dlls/ntdll/large_int.c
+182
-0
ntdll.spec
dlls/ntdll/ntdll.spec
+16
-16
rtl.c
dlls/ntdll/rtl.c
+0
-43
time.c
dlls/ntdll/time.c
+39
-16
ntddk.h
include/ntddk.h
+24
-33
winnt.h
include/winnt.h
+2
-2
timer.c
scheduler/timer.c
+8
-16
time.c
win32/time.c
+0
-13
No files found.
dlls/kernel/time.c
View file @
d76f9f96
...
...
@@ -194,6 +194,16 @@ BOOL WINAPI SystemTimeToTzSpecificLocalTime(
return
FALSE
;
}
/***********************************************************************
* GetSystemTimeAsFileTime (KERNEL32)
*/
VOID
WINAPI
GetSystemTimeAsFileTime
(
LPFILETIME
time
)
{
NtQuerySystemTime
(
(
LARGE_INTEGER
*
)
time
);
}
/*********************************************************************
* TIME_ClockTimeToFileTime
* (olorin@fandra.org, 20-Sep-1998)
...
...
dlls/ntdll/Makefile.in
View file @
d76f9f96
...
...
@@ -12,6 +12,7 @@ C_SRCS = \
exception.c
\
error.c
\
file.c
\
large_int.c
\
misc.c
\
nt.c
\
om.c
\
...
...
dlls/ntdll/large_int.c
0 → 100644
View file @
d76f9f96
/*
* Large integer functions
*
* Copyright 2000 Alexandre Julliard
*/
#include "winnt.h"
#include "ntddk.h"
/*
* Note: we use LONGLONG instead of LARGE_INTEGER, because
* the latter is a structure and the calling convention for
* returning a structure would not be binary-compatible.
*
* FIXME: for platforms that don't have a native LONGLONG type,
* we should define LONGLONG as a structure similar to LARGE_INTEGER
* and do everything by hand. You are welcome to do it...
*/
/******************************************************************************
* RtlLargeIntegerAdd (NTDLL.@)
*/
LONGLONG
WINAPI
RtlLargeIntegerAdd
(
LONGLONG
a
,
LONGLONG
b
)
{
return
a
+
b
;
}
/******************************************************************************
* RtlLargeIntegerSubtract (NTDLL.@)
*/
LONGLONG
WINAPI
RtlLargeIntegerSubtract
(
LONGLONG
a
,
LONGLONG
b
)
{
return
a
-
b
;
}
/******************************************************************************
* RtlLargeIntegerNegate (NTDLL.@)
*/
LONGLONG
WINAPI
RtlLargeIntegerNegate
(
LONGLONG
a
)
{
return
-
a
;
}
/******************************************************************************
* RtlLargeIntegerShiftLeft (NTDLL.@)
*/
LONGLONG
WINAPI
RtlLargeIntegerShiftLeft
(
LONGLONG
a
,
INT
count
)
{
return
a
<<
count
;
}
/******************************************************************************
* RtlLargeIntegerShiftRight (NTDLL.@)
*/
LONGLONG
WINAPI
RtlLargeIntegerShiftRight
(
LONGLONG
a
,
INT
count
)
{
return
(
ULONGLONG
)
a
>>
count
;
}
/******************************************************************************
* RtlLargeIntegerArithmeticShift (NTDLL.@)
*/
LONGLONG
WINAPI
RtlLargeIntegerArithmeticShift
(
LONGLONG
a
,
INT
count
)
{
/* FIXME: gcc does arithmetic shift here, but it may not be true on all platforms */
return
a
>>
count
;
}
/******************************************************************************
* RtlLargeIntegerDivide (NTDLL.@)
*
* FIXME: should it be signed division instead?
*/
ULONGLONG
WINAPI
RtlLargeIntegerDivide
(
ULONGLONG
a
,
ULONGLONG
b
,
ULONGLONG
*
rem
)
{
ULONGLONG
ret
=
a
/
b
;
if
(
rem
)
*
rem
=
a
-
ret
*
b
;
return
ret
;
}
/******************************************************************************
* RtlConvertLongToLargeInteger (NTDLL.@)
*/
LONGLONG
WINAPI
RtlConvertLongToLargeInteger
(
LONG
a
)
{
return
a
;
}
/******************************************************************************
* RtlConvertUlongToLargeInteger (NTDLL.@)
*/
ULONGLONG
WINAPI
RtlConvertUlongToLargeInteger
(
ULONG
a
)
{
return
a
;
}
/******************************************************************************
* RtlEnlargedIntegerMultiply (NTDLL.@)
*/
LONGLONG
WINAPI
RtlEnlargedIntegerMultiply
(
INT
a
,
INT
b
)
{
return
(
LONGLONG
)
a
*
b
;
}
/******************************************************************************
* RtlEnlargedUnsignedMultiply (NTDLL.@)
*/
LONGLONG
WINAPI
RtlEnlargedUnsignedMultiply
(
UINT
a
,
UINT
b
)
{
return
(
ULONGLONG
)
a
*
b
;
}
/******************************************************************************
* RtlEnlargedUnsignedDivide (NTDLL.@)
*/
UINT
WINAPI
RtlEnlargedUnsignedDivide
(
ULONGLONG
a
,
UINT
b
,
UINT
*
remptr
)
{
#if defined(__i386__) && defined(__GNUC__)
UINT
ret
,
rem
;
__asm__
(
"div %4,%%eax"
:
"=a"
(
ret
),
"=d"
(
rem
)
:
"0"
(
*
(
UINT
*
)
&
a
),
"1"
(
*
((
UINT
*
)
&
a
+
1
)),
"g"
(
b
)
);
if
(
remptr
)
*
remptr
=
rem
;
return
ret
;
#else
UINT
ret
=
a
/
b
;
if
(
remptr
)
*
remptr
=
a
%
b
;
return
ret
;
#endif
}
/******************************************************************************
* RtlExtendedLargeIntegerDivide (NTDLL.@)
*/
LONGLONG
WINAPI
RtlExtendedLargeIntegerDivide
(
LONGLONG
a
,
INT
b
,
INT
*
rem
)
{
LONGLONG
ret
=
a
/
b
;
if
(
rem
)
*
rem
=
a
-
b
*
ret
;
return
ret
;
}
/******************************************************************************
* RtlExtendedIntegerMultiply (NTDLL.@)
*/
LONGLONG
WINAPI
RtlExtendedIntegerMultiply
(
LONGLONG
a
,
INT
b
)
{
return
a
*
b
;
}
/******************************************************************************
* RtlExtendedMagicDivide (NTDLL.@)
*
* This function computes (a * b) >> (64 + shift)
*
* This allows replacing a division by a longlong constant
* by a multiplication by the inverse constant.
*
* If 'c' is the constant divisor, the constants 'b' and 'shift'
* must be chosen such that b = 2^(64+shift) / c.
* Then we have RtlExtendedMagicDivide(a,b,shift) == a * b / 2^(64+shift) == a / c.
*
* I'm too lazy to implement it right now...
*/
/* LONGLONG WINAPI RtlExtendedMagicDivide( LONGLONG a, LONGLONG b, INT shift )
* {
* return 0;
* }
*/
dlls/ntdll/ntdll.spec
View file @
d76f9f96
...
...
@@ -174,7 +174,7 @@ type win32
@ stdcall NtQuerySymbolicLinkObject(long ptr ptr) NtQuerySymbolicLinkObject
@ stub NtQuerySystemEnvironmentValue
@ stdcall NtQuerySystemInformation(long long long long) NtQuerySystemInformation
@ stdcall NtQuerySystemTime(ptr)
GetSystemTimeAsFile
Time
@ stdcall NtQuerySystemTime(ptr)
NtQuerySystem
Time
@ stub NtQueryTimer
@ stdcall NtQueryTimerResolution(long long long) NtQueryTimerResolution
@ stdcall NtQueryValueKey(long long long long long long) NtQueryValueKey
...
...
@@ -298,11 +298,11 @@ type win32
@ stub RtlCompressBuffer
@ stub RtlConsoleMultiByteToUnicodeN
@ stub RtlConvertExclusiveToShared
@ st
ub
RtlConvertLongToLargeInteger
@ st
dcall64 RtlConvertLongToLargeInteger(long)
RtlConvertLongToLargeInteger
@ stub RtlConvertSharedToExclusive
@ stdcall RtlConvertSidToUnicodeString(ptr ptr)RtlConvertSidToUnicodeString
@ stub RtlConvertUiListToApiList
@ st
ub
RtlConvertUlongToLargeInteger
@ st
dcall64 RtlConvertUlongToLargeInteger(long)
RtlConvertUlongToLargeInteger
@ stub RtlCopyLuid
@ stub RtlCopyLuidAndAttributesArray
@ stub RtlCopySecurityDescriptor
...
...
@@ -345,9 +345,9 @@ type win32
@ stdcall RtlDosPathNameToNtPathName_U(ptr ptr long long) RtlDosPathNameToNtPathName_U
@ stub RtlDosSearchPath_U
@ stdcall RtlDumpResource(ptr) RtlDumpResource
@ st
ub
RtlEnlargedIntegerMultiply
@ st
ub
RtlEnlargedUnsignedDivide
@ st
ub
RtlEnlargedUnsignedMultiply
@ st
dcall64 RtlEnlargedIntegerMultiply(long long)
RtlEnlargedIntegerMultiply
@ st
dcall RtlEnlargedUnsignedDivide(long long long ptr)
RtlEnlargedUnsignedDivide
@ st
dcall64 RtlEnlargedUnsignedMultiply(long long)
RtlEnlargedUnsignedMultiply
@ stdcall RtlEnterCriticalSection(ptr) RtlEnterCriticalSection
@ stub RtlEnumProcessHeaps
@ stub RtlEnumerateGenericTable
...
...
@@ -362,8 +362,8 @@ type win32
@ stdcall RtlEraseUnicodeString(ptr) RtlEraseUnicodeString
@ stub RtlExpandEnvironmentStrings_U
@ stub RtlExtendHeap
@ stdcall RtlExtendedIntegerMultiply(long long long) RtlExtendedIntegerMultiply
@ stdcall RtlExtendedLargeIntegerDivide(long long long ptr) RtlExtendedLargeIntegerDivide
@ stdcall
64
RtlExtendedIntegerMultiply(long long long) RtlExtendedIntegerMultiply
@ stdcall
64
RtlExtendedLargeIntegerDivide(long long long ptr) RtlExtendedLargeIntegerDivide
@ stub RtlExtendedMagicDivide
@ stdcall RtlFillMemory(ptr long long) RtlFillMemory
@ stub RtlFillMemoryUlong
...
...
@@ -422,13 +422,13 @@ type win32
@ stub RtlIsGenericTableEmpty
@ stub RtlIsNameLegalDOS8Dot3
@ stdcall RtlIsTextUnicode(ptr long ptr) RtlIsTextUnicode
@ st
ub
RtlLargeIntegerAdd
@ st
ub
RtlLargeIntegerArithmeticShift
@ st
ub
RtlLargeIntegerDivide
@ st
ub
RtlLargeIntegerNegate
@ st
ub
RtlLargeIntegerShiftLeft
@ st
ub
RtlLargeIntegerShiftRight
@ st
ub
RtlLargeIntegerSubtract
@ st
dcall64 RtlLargeIntegerAdd(long long long long)
RtlLargeIntegerAdd
@ st
dcall64 RtlLargeIntegerArithmeticShift(long long long)
RtlLargeIntegerArithmeticShift
@ st
dcall64 RtlLargeIntegerDivide(long long long long ptr)
RtlLargeIntegerDivide
@ st
dcall64 RtlLargeIntegerNegate(long long)
RtlLargeIntegerNegate
@ st
dcall64 RtlLargeIntegerShiftLeft(long long long)
RtlLargeIntegerShiftLeft
@ st
dcall64 RtlLargeIntegerShiftRight(long long long)
RtlLargeIntegerShiftRight
@ st
dcall64 RtlLargeIntegerSubtract(long long long long)
RtlLargeIntegerSubtract
@ stub RtlLargeIntegerToChar
@ stdcall RtlLeaveCriticalSection(ptr) RtlLeaveCriticalSection
@ stdcall RtlLengthRequiredSid(long) RtlLengthRequiredSid
...
...
@@ -674,7 +674,7 @@ type win32
@ stub ZwQuerySymbolicLinkObject
@ stub ZwQuerySystemEnvironmentValue
@ stdcall ZwQuerySystemInformation(long long long long) NtQuerySystemInformation
@ stdcall ZwQuerySystemTime(ptr)
GetSystemTimeAsFile
Time
@ stdcall ZwQuerySystemTime(ptr)
NtQuerySystem
Time
@ stub ZwQueryTimer
@ stub ZwQueryTimerResolution
@ stub ZwQueryValueKey
...
...
dlls/ntdll/rtl.c
View file @
d76f9f96
...
...
@@ -370,49 +370,6 @@ void WINAPI NTDLL_alloca_probe( CONTEXT86 *context )
context
->
Esp
-=
context
->
Eax
;
}
/******************************************************************************
* RtlExtendedLargeIntegerDivide [NTDLL.359]
*/
INT
WINAPI
RtlExtendedLargeIntegerDivide
(
LARGE_INTEGER
dividend
,
DWORD
divisor
,
LPDWORD
rest
)
{
#if SIZEOF_LONG_LONG==8
long
long
x1
=
*
(
long
long
*
)
&
dividend
;
if
(
*
rest
)
*
rest
=
x1
%
divisor
;
return
x1
/
divisor
;
#else
FIXME
(
"((%ld<<32)+%ld,%ld,%p), implement this using normal integer arithmetic!
\n
"
,
dividend
.
s
.
HighPart
,
dividend
.
s
.
LowPart
,
divisor
,
rest
);
return
0
;
#endif
}
/******************************************************************************
* RtlExtendedIntegerMultiply [NTDLL.359]
* Note: This even works, since gcc returns 64bit values in eax/edx just like
* the caller expects. However... The relay code won't grok this I think.
*/
LARGE_INTEGER
WINAPI
RtlExtendedIntegerMultiply
(
LARGE_INTEGER
factor1
,
INT
factor2
)
{
#if SIZEOF_LONG_LONG==8
long
long
result
=
(
*
(
long
long
*
)
&
factor1
)
*
factor2
;
return
(
*
(
LARGE_INTEGER
*
)
&
result
);
#else
LARGE_INTEGER
result
;
result
.
s
.
HighPart
=
0
;
result
.
s
.
LowPart
=
0
;
FIXME
(
"((%ld<<32)+%ld,%d), implement this using normal integer arithmetic!
\n
"
,
factor1
.
s
.
HighPart
,
factor1
.
s
.
LowPart
,
factor2
);
return
result
;
#endif
}
/**************************************************************************
* RtlDosPathNameToNtPathName_U [NTDLL.338]
*
...
...
dlls/ntdll/time.c
View file @
d76f9f96
...
...
@@ -9,11 +9,13 @@
*/
#include <string.h>
#include <time.h>
#include <sys/time.h>
#include <unistd.h>
#include "ntddk.h"
#include "debugtools.h"
#include "file.h"
DEFAULT_DEBUG_CHANNEL
(
ntdll
)
DEFAULT_DEBUG_CHANNEL
(
ntdll
)
;
#define TICKSPERSEC 10000000
#define TICKSPERMSEC 10000
...
...
@@ -29,6 +31,12 @@ DEFAULT_DEBUG_CHANNEL(ntdll)
#define DAYSPERLEAPYEAR 366
#define MONSPERYEAR 12
/* 1601 to 1970 is 369 years plus 89 leap days */
#define SECS_1601_TO_1970 ((369 * 365 + 89) * 86400ULL)
/* 1601 to 1980 is 379 years plus 91 leap days */
#define SECS_1601_to_1980 ((379 * 365 + 91) * 86400ULL)
static
const
int
YearLengths
[
2
]
=
{
DAYSPERNORMALYEAR
,
DAYSPERLEAPYEAR
};
static
const
int
MonthLengths
[
2
][
MONSPERYEAR
]
=
{
...
...
@@ -182,41 +190,43 @@ VOID WINAPI RtlSystemTimeToLocalTime(
/******************************************************************************
* RtlTimeToSecondsSince1970 [NTDLL]
*/
BOOLEAN
WINAPI
RtlTimeToSecondsSince1970
(
LPFILETIME
ft
,
LPDWORD
timeret
)
BOOLEAN
WINAPI
RtlTimeToSecondsSince1970
(
const
FILETIME
*
time
,
LPDWORD
res
)
{
*
timeret
=
DOSFS_FileTimeToUnixTime
(
ft
,
NULL
);
ULONGLONG
tmp
=
RtlLargeIntegerDivide
(
((
LARGE_INTEGER
*
)
time
)
->
QuadPart
,
10000000LL
,
NULL
);
tmp
-=
SECS_1601_TO_1970
;
if
(
tmp
>
0xffffffff
)
return
FALSE
;
*
res
=
(
DWORD
)
tmp
;
return
TRUE
;
}
/******************************************************************************
* RtlTimeToSecondsSince1980 [NTDLL]
*/
BOOLEAN
WINAPI
RtlTimeToSecondsSince1980
(
LPFILETIME
ft
,
LPDWORD
timeret
)
BOOLEAN
WINAPI
RtlTimeToSecondsSince1980
(
const
FILETIME
*
time
,
LPDWORD
res
)
{
/* 1980 = 1970+10*365 days + 29. februar 1972 + 29.februar 1976 */
if
(
!
RtlTimeToSecondsSince1970
(
ft
,
timeret
))
return
FALSE
;
*
timeret
-=
(
10
*
365
+
2
)
*
24
*
60
*
60
;
ULONGLONG
tmp
=
RtlLargeIntegerDivide
(
((
LARGE_INTEGER
*
)
time
)
->
QuadPart
,
10000000LL
,
NULL
);
tmp
-=
SECS_1601_to_1980
;
if
(
tmp
>
0xffffffff
)
return
FALSE
;
*
res
=
(
DWORD
)
tmp
;
return
TRUE
;
}
/******************************************************************************
* RtlSecondsSince1970ToTime [NTDLL]
*/
void
WINAPI
RtlSecondsSince1970ToTime
(
DWORD
time
,
LPFILETIME
ft
)
void
WINAPI
RtlSecondsSince1970ToTime
(
DWORD
time
,
FILETIME
*
res
)
{
DOSFS_UnixTimeToFileTime
(
time
,
ft
,
0
);
LONGLONG
secs
=
time
+
SECS_1601_TO_1970
;
((
LARGE_INTEGER
*
)
res
)
->
QuadPart
=
RtlExtendedIntegerMultiply
(
secs
,
10000000
);
}
/******************************************************************************
* RtlSecondsSince1980ToTime [NTDLL]
*/
void
WINAPI
RtlSecondsSince1980ToTime
(
DWORD
time
,
LPFILETIME
ft
)
void
WINAPI
RtlSecondsSince1980ToTime
(
DWORD
time
,
FILETIME
*
res
)
{
RtlSecondsSince1970ToTime
(
time
+
(
10
*
365
+
2
)
*
24
*
60
*
60
,
ft
);
LONGLONG
secs
=
time
+
SECS_1601_to_1980
;
((
LARGE_INTEGER
*
)
res
)
->
QuadPart
=
RtlExtendedIntegerMultiply
(
secs
,
10000000
);
}
/******************************************************************************
...
...
@@ -229,3 +239,16 @@ VOID WINAPI RtlTimeToElapsedTimeFields(
{
FIXME
(
"(%p,%p): stub
\n
"
,
liTime
,
TimeFields
);
}
/***********************************************************************
* NtQuerySystemTime (NTDLL.@)
*/
void
WINAPI
NtQuerySystemTime
(
LARGE_INTEGER
*
time
)
{
LONGLONG
secs
;
struct
timeval
now
;
gettimeofday
(
&
now
,
0
);
secs
=
now
.
tv_sec
+
SECS_1601_TO_1970
;
time
->
QuadPart
=
RtlExtendedIntegerMultiply
(
secs
,
10000000
)
+
now
.
tv_usec
*
10
;
}
include/ntddk.h
View file @
d76f9f96
...
...
@@ -694,16 +694,12 @@ VOID WINAPI RtlTimeToElapsedTimeFields(
PLARGE_INTEGER
liTime
,
PTIME_FIELDS
TimeFields
);
BOOLEAN
WINAPI
RtlTimeToSecondsSince1980
(
LPFILETIME
ft
,
LPDWORD
timeret
);
void
WINAPI
NtQuerySystemTime
(
LARGE_INTEGER
*
time
);
BOOLEAN
WINAPI
RtlTimeToSecondsSince1970
(
LPFILETIME
ft
,
LPDWORD
timeret
);
void
WINAPI
RtlSecondsSince1970ToTime
(
DWORD
time
,
LPFILETIME
ft
);
void
WINAPI
RtlSecondsSince1980ToTime
(
DWORD
time
,
LPFILETIME
ft
);
BOOLEAN
WINAPI
RtlTimeToSecondsSince1980
(
const
FILETIME
*
time
,
LPDWORD
res
);
BOOLEAN
WINAPI
RtlTimeToSecondsSince1970
(
const
FILETIME
*
time
,
LPDWORD
res
);
void
WINAPI
RtlSecondsSince1970ToTime
(
DWORD
time
,
FILETIME
*
res
);
void
WINAPI
RtlSecondsSince1980ToTime
(
DWORD
time
,
FILETIME
*
res
);
/* heap functions */
...
...
@@ -756,14 +752,21 @@ VOID WINAPI RtlAcquirePebLock(void);
VOID
WINAPI
RtlReleasePebLock
(
void
);
/* mathematics */
INT
WINAPI
RtlExtendedLargeIntegerDivide
(
LARGE_INTEGER
dividend
,
DWORD
divisor
,
LPDWORD
rest
);
LARGE_INTEGER
WINAPI
RtlExtendedIntegerMultiply
(
LARGE_INTEGER
factor1
,
INT
factor2
);
LONGLONG
WINAPI
RtlConvertLongToLargeInteger
(
LONG
a
);
LONGLONG
WINAPI
RtlEnlargedIntegerMultiply
(
INT
a
,
INT
b
);
LONGLONG
WINAPI
RtlEnlargedUnsignedMultiply
(
UINT
a
,
UINT
b
);
LONGLONG
WINAPI
RtlExtendedMagicDivide
(
LONGLONG
a
,
LONGLONG
b
,
INT
shift
);
LONGLONG
WINAPI
RtlExtendedIntegerMultiply
(
LONGLONG
a
,
INT
b
);
LONGLONG
WINAPI
RtlExtendedLargeIntegerDivide
(
LONGLONG
a
,
INT
b
,
INT
*
rem
);
LONGLONG
WINAPI
RtlLargeIntegerAdd
(
LONGLONG
a
,
LONGLONG
b
);
LONGLONG
WINAPI
RtlLargeIntegerArithmeticShift
(
LONGLONG
a
,
INT
count
);
LONGLONG
WINAPI
RtlLargeIntegerNegate
(
LONGLONG
a
);
LONGLONG
WINAPI
RtlLargeIntegerShiftLeft
(
LONGLONG
a
,
INT
count
);
LONGLONG
WINAPI
RtlLargeIntegerShiftRight
(
LONGLONG
a
,
INT
count
);
LONGLONG
WINAPI
RtlLargeIntegerSubtract
(
LONGLONG
a
,
LONGLONG
b
);
UINT
WINAPI
RtlEnlargedUnsignedDivide
(
ULONGLONG
a
,
UINT
b
,
UINT
*
remptr
);
ULONGLONG
WINAPI
RtlConvertUlongToLargeInteger
(
ULONG
a
);
ULONGLONG
WINAPI
RtlLargeIntegerDivide
(
ULONGLONG
a
,
ULONGLONG
b
,
ULONGLONG
*
rem
);
/* environment */
DWORD
WINAPI
RtlCreateEnvironment
(
...
...
@@ -817,6 +820,10 @@ NTSTATUS WINAPI NtCreateKey(PHANDLE,ACCESS_MASK,const OBJECT_ATTRIBUTES*,ULON
NTSTATUS
WINAPI
NtDeleteKey
(
HANDLE
);
NTSTATUS
WINAPI
NtDeleteValueKey
(
HANDLE
,
const
UNICODE_STRING
*
);
NTSTATUS
WINAPI
NtOpenKey
(
PHANDLE
,
ACCESS_MASK
,
const
OBJECT_ATTRIBUTES
*
);
NTSTATUS
WINAPI
NtSetValueKey
(
HANDLE
,
const
UNICODE_STRING
*
,
ULONG
,
ULONG
,
const
void
*
,
ULONG
);
NTSTATUS
WINAPI
NtQueryValueKey
(
HANDLE
,
const
UNICODE_STRING
*
,
KEY_VALUE_INFORMATION_CLASS
,
void
*
,
DWORD
,
DWORD
*
);
NTSTATUS
WINAPI
NtEnumerateKey
(
HANDLE
KeyHandle
,
...
...
@@ -867,14 +874,6 @@ NTSTATUS WINAPI NtQueryMultipleValueKey(
ULONG
Length
,
PULONG
ReturnLength
);
NTSTATUS
WINAPI
NtQueryValueKey
(
IN
HANDLE
KeyHandle
,
IN
PUNICODE_STRING
ValueName
,
IN
KEY_VALUE_INFORMATION_CLASS
KeyValueInformationClass
,
OUT
PVOID
KeyValueInformation
,
IN
ULONG
Length
,
OUT
PULONG
ResultLength
);
NTSTATUS
WINAPI
NtReplaceKey
(
IN
POBJECT_ATTRIBUTES
ObjectAttributes
,
IN
HANDLE
Key
,
...
...
@@ -895,14 +894,6 @@ NTSTATUS WINAPI NtSetInformationKey(
IN
PVOID
KeyInformation
,
IN
ULONG
KeyInformationLength
);
NTSTATUS
WINAPI
NtSetValueKey
(
HANDLE
KeyHandle
,
PUNICODE_STRING
ValueName
,
ULONG
TitleIndex
,
ULONG
Type
,
PVOID
Data
,
ULONG
DataSize
);
NTSTATUS
WINAPI
NtUnloadKey
(
IN
HANDLE
KeyHandle
);
...
...
include/winnt.h
View file @
d76f9f96
...
...
@@ -2326,9 +2326,9 @@ typedef union _LARGE_INTEGER {
typedef
union
_ULARGE_INTEGER
{
struct
{
DWORD
LowPart
;
LONG
HighPart
;
DWORD
HighPart
;
}
DUMMYSTRUCTNAME
;
LONGLONG
QuadPart
;
U
LONGLONG
QuadPart
;
}
ULARGE_INTEGER
,
*
LPULARGE_INTEGER
,
*
PULARGE_INTEGER
;
/*
...
...
scheduler/timer.c
View file @
d76f9f96
...
...
@@ -134,29 +134,20 @@ BOOL WINAPI SetWaitableTimer( HANDLE handle, const LARGE_INTEGER *when, LONG per
PTIMERAPCROUTINE
callback
,
LPVOID
arg
,
BOOL
resume
)
{
BOOL
ret
;
FILETIME
ft
;
DWORD
remainder
;
LARGE_INTEGER
exp
=
*
when
;
if
(
when
->
s
.
HighPart
<
0
)
/* relative time */
if
(
exp
.
s
.
HighPart
<
0
)
/* relative time */
{
DWORD
low
;
GetSystemTimeAsFileTime
(
&
ft
);
low
=
ft
.
dwLowDateTime
;
ft
.
dwLowDateTime
-=
when
->
s
.
LowPart
;
ft
.
dwHighDateTime
-=
when
->
s
.
HighPart
;
if
(
low
<
ft
.
dwLowDateTime
)
ft
.
dwHighDateTime
--
;
/* overflow */
}
else
/* absolute time */
{
ft
.
dwLowDateTime
=
when
->
s
.
LowPart
;
ft
.
dwHighDateTime
=
when
->
s
.
HighPart
;
LARGE_INTEGER
now
;
NtQuerySystemTime
(
&
now
);
exp
.
QuadPart
=
RtlLargeIntegerSubtract
(
now
.
QuadPart
,
exp
.
QuadPart
);
}
SERVER_START_REQ
{
struct
set_timer_request
*
req
=
server_alloc_req
(
sizeof
(
*
req
),
0
);
if
(
!
ft
.
dwLowDateTime
&&
!
ft
.
dwHighDateTime
)
if
(
!
exp
.
s
.
LowPart
&&
!
exp
.
s
.
HighPart
)
{
/* special case to start timeout on now+period without too many calculations */
req
->
sec
=
0
;
...
...
@@ -164,7 +155,8 @@ BOOL WINAPI SetWaitableTimer( HANDLE handle, const LARGE_INTEGER *when, LONG per
}
else
{
req
->
sec
=
DOSFS_FileTimeToUnixTime
(
&
ft
,
&
remainder
);
DWORD
remainder
;
req
->
sec
=
DOSFS_FileTimeToUnixTime
(
(
FILETIME
*
)
&
exp
,
&
remainder
);
req
->
usec
=
remainder
/
10
;
/* convert from 100-ns to us units */
}
req
->
handle
=
handle
;
...
...
win32/time.c
View file @
d76f9f96
...
...
@@ -59,16 +59,3 @@ VOID WINAPI GetSystemTime(LPSYSTEMTIME systime)
systime
->
wSecond
=
local_tm
->
tm_sec
;
systime
->
wMilliseconds
=
(
tv
.
tv_usec
/
1000
)
%
1000
;
}
/***********************************************************************
* GetSystemTimeAsFileTime (KERNEL32)
*/
VOID
WINAPI
GetSystemTimeAsFileTime
(
LPFILETIME
systemtimeAsfiletime
)
{
struct
timeval
now
;
gettimeofday
(
&
now
,
0
);
/* FIXME: convert to UTC */
DOSFS_UnixTimeToFileTime
(
now
.
tv_sec
,
systemtimeAsfiletime
,
now
.
tv_usec
*
10
);
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment