Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SystemTime.c « winapi « peloader - github.com/taviso/loadlibrary.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 26b65d70da144c1a991eec13f8f223797b34d9bf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include <stdint.h>
#include <stddef.h>
#include <string.h>
#include <stdbool.h>
#include <search.h>
#include <stdlib.h>
#include <time.h>
#include <assert.h>

#include "winnt_types.h"
#include "log.h"
#include "winexports.h"
#include "util.h"

typedef struct _SYSTEMTIME {
  WORD wYear;
  WORD wMonth;
  WORD wDayOfWeek;
  WORD wDay;
  WORD wHour;
  WORD wMinute;
  WORD wSecond;
  WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME;

extern void WINAPI SetLastError(DWORD dwErrCode);

// These routines are called to check if signing certificates have expired, so
// should return similar values.

STATIC VOID WINAPI GetSystemTime(PSYSTEMTIME lpSystemTime)
{
    memset(lpSystemTime, 0, sizeof(SYSTEMTIME));
    return;
}

STATIC BOOL WINAPI SystemTimeToFileTime(SYSTEMTIME *lpSystemTime, PFILETIME lpFileTime)
{
    memset(lpFileTime, 0, sizeof(FILETIME));
    return TRUE;
}

STATIC VOID WINAPI GetSystemTimePreciseAsFileTime(PFILETIME lpSystemTimeAsFileTime)
{
    memset(lpSystemTimeAsFileTime, 0, sizeof(FILETIME));
    return;
}

STATIC VOID WINAPI GetSystemTimeAsFileTime(PVOID lpSystemTimeAsFileTime)
{
    memset(lpSystemTimeAsFileTime, 0, sizeof(FILETIME));
    return;
}

STATIC BOOL WINAPI QueryPerformanceCounter(LARGE_INTEGER *lpPerformanceCount)
{
    struct timespec tm;
    DebugLog("");

    SetLastError(0);

    if (clock_gettime(CLOCK_MONOTONIC_RAW, &tm) != 0)
        return FALSE;

    *lpPerformanceCount = tm.tv_nsec;

    return TRUE;
}

STATIC DWORD WINAPI GetTickCount(VOID)
{
    return 0;
}

STATIC ULONGLONG WINAPI GetTickCount64(VOID)
{
    return 0;
}

STATIC BOOL WINAPI QueryPerformanceFrequency(LARGE_INTEGER *lpFrequency)
{
    struct timespec tm;

    DebugLog("");

    if (clock_getres(CLOCK_MONOTONIC_RAW, &tm) != 0)
        return FALSE;

    *lpFrequency = tm.tv_nsec;

    SetLastError(0);

    return TRUE;
}

STATIC BOOL WINAPI GetProcessTimes(HANDLE hProcess, PFILETIME lpCreationTime, PFILETIME lpExitTime, PFILETIME lpKernelTime, PFILETIME lpUserTime)
{
    SetLastError(0);
    DebugLog("");
    return FALSE;
}

STATIC BOOL WINAPI DosDateTimeToFileTime(WORD wFatDate, WORD wFatTime, PFILETIME lpFileTime)
{
    DebugLog("");
    return FALSE;
}

STATIC BOOL WINAPI FileTimeToSystemTime(PFILETIME lpFileTime, PSYSTEMTIME lpSystemTime)
{
    DebugLog("");
    return FALSE;
}

DECLARE_CRT_EXPORT("GetSystemTime", GetSystemTime);
DECLARE_CRT_EXPORT("SystemTimeToFileTime", SystemTimeToFileTime);
DECLARE_CRT_EXPORT("GetSystemTimePreciseAsFileTime", GetSystemTimePreciseAsFileTime);
DECLARE_CRT_EXPORT("GetSystemTimeAsFileTime", GetSystemTimeAsFileTime);
DECLARE_CRT_EXPORT("QueryPerformanceCounter", QueryPerformanceCounter);
DECLARE_CRT_EXPORT("QueryPerformanceFrequency", QueryPerformanceFrequency);
DECLARE_CRT_EXPORT("GetTickCount", GetTickCount);
DECLARE_CRT_EXPORT("GetTickCount64", GetTickCount64);
DECLARE_CRT_EXPORT("GetProcessTimes", GetProcessTimes);
DECLARE_CRT_EXPORT("DosDateTimeToFileTime", DosDateTimeToFileTime);
DECLARE_CRT_EXPORT("FileTimeToSystemTime", FileTimeToSystemTime);