[1166] | 1 | /**
|
---|
| 2 | * This file has no copyright assigned and is placed in the Public Domain.
|
---|
| 3 | * This file is part of the mingw-w64 runtime package.
|
---|
| 4 | * No warranty is given; refer to the file DISCLAIMER.PD within this package.
|
---|
| 5 | */
|
---|
| 6 | #ifndef TIMEPROV_H
|
---|
| 7 | #define TIMEPROV_H
|
---|
| 8 |
|
---|
| 9 | #ifdef __cplusplus
|
---|
| 10 | extern "C" {
|
---|
| 11 | #endif
|
---|
| 12 |
|
---|
| 13 | #define wszW32TimeRegKeyTimeProviders L"System\\CurrentControlSet\\Services\\W32Time\\TimeProviders"
|
---|
| 14 | #define wszW32TimeRegKeyPolicyTimeProviders L"Software\\Policies\\Microsoft\\W32Time\\TimeProviders"
|
---|
| 15 | #define wszW32TimeRegValueEnabled L"Enabled"
|
---|
| 16 | #define wszW32TimeRegValueDllName L"DllName"
|
---|
| 17 | #define wszW32TimeRegValueInputProvider L"InputProvider"
|
---|
| 18 |
|
---|
| 19 | #define TSF_Hardware 0x00000001
|
---|
| 20 | #define TSF_Authenticated 0x00000002
|
---|
| 21 |
|
---|
| 22 | typedef enum TimeProvCmd {
|
---|
| 23 | TPC_TimeJumped,TPC_UpdateConfig,TPC_PollIntervalChanged,TPC_GetSamples,TPC_NetTopoChange,TPC_Query,TPC_Shutdown
|
---|
| 24 | } TimeProvCmd;
|
---|
| 25 |
|
---|
| 26 | typedef enum TimeSysInfo {
|
---|
| 27 | TSI_LastSyncTime,TSI_ClockTickSize,TSI_ClockPrecision,TSI_CurrentTime,TSI_PhaseOffset,TSI_TickCount,TSI_LeapFlags,TSI_Stratum,
|
---|
| 28 | TSI_ReferenceIdentifier,TSI_PollInterval,TSI_RootDelay,TSI_RootDispersion,TSI_TSFlags
|
---|
| 29 | } TimeSysInfo;
|
---|
| 30 |
|
---|
| 31 | typedef enum TimeJumpedFlags {
|
---|
| 32 | TJF_Default=0,TJF_UserRequested=1
|
---|
| 33 | } TimeJumpedFlags;
|
---|
| 34 |
|
---|
| 35 | typedef enum NetTopoChangeFlags {
|
---|
| 36 | NTC_Default=0,NTC_UserRequested=1
|
---|
| 37 | } NetTopoChangeFlags;
|
---|
| 38 |
|
---|
| 39 | typedef enum TimeProvState {
|
---|
| 40 | TPS_Running,TPS_Error
|
---|
| 41 | } TimeProvState;
|
---|
| 42 |
|
---|
| 43 | struct SetProviderStatusInfo;
|
---|
| 44 |
|
---|
| 45 | typedef void (WINAPI SetProviderStatusInfoFreeFunc)(struct SetProviderStatusInfo *pspsi);
|
---|
| 46 |
|
---|
| 47 | typedef struct SetProviderStatusInfo {
|
---|
| 48 | TimeProvState tpsCurrentState;
|
---|
| 49 | DWORD dwStratum;
|
---|
| 50 | LPWSTR wszProvName;
|
---|
| 51 | HANDLE hWaitEvent;
|
---|
| 52 | SetProviderStatusInfoFreeFunc *pfnFree;
|
---|
| 53 | HRESULT *pHr;
|
---|
| 54 | DWORD *pdwSysStratum;
|
---|
| 55 | } SetProviderStatusInfo;
|
---|
| 56 |
|
---|
| 57 | typedef HRESULT (WINAPI GetTimeSysInfoFunc)(TimeSysInfo eInfo,void *pvInfo);
|
---|
| 58 | typedef HRESULT (WINAPI LogTimeProvEventFunc)(WORD wType,WCHAR *wszProvName,WCHAR *wszMessage);
|
---|
| 59 | typedef HRESULT (WINAPI AlertSamplesAvailFunc)(void);
|
---|
| 60 | typedef HRESULT (WINAPI SetProviderStatusFunc)(SetProviderStatusInfo *pspsi);
|
---|
| 61 |
|
---|
| 62 | typedef struct TimeProvSysCallbacks {
|
---|
| 63 | DWORD dwSize;
|
---|
| 64 | GetTimeSysInfoFunc *pfnGetTimeSysInfo;
|
---|
| 65 | LogTimeProvEventFunc *pfnLogTimeProvEvent;
|
---|
| 66 | AlertSamplesAvailFunc *pfnAlertSamplesAvail;
|
---|
| 67 | SetProviderStatusFunc *pfnSetProviderStatus;
|
---|
| 68 | } TimeProvSysCallbacks;
|
---|
| 69 |
|
---|
| 70 | typedef void *TimeProvArgs;
|
---|
| 71 |
|
---|
| 72 | typedef struct TimeSample {
|
---|
| 73 | DWORD dwSize;
|
---|
| 74 | DWORD dwRefid;
|
---|
| 75 | __MINGW_EXTENSION signed __int64 toOffset;
|
---|
| 76 | __MINGW_EXTENSION signed __int64 toDelay;
|
---|
| 77 | __MINGW_EXTENSION unsigned __int64 tpDispersion;
|
---|
| 78 | __MINGW_EXTENSION unsigned __int64 nSysTickCount;
|
---|
| 79 | __MINGW_EXTENSION signed __int64 nSysPhaseOffset;
|
---|
| 80 | BYTE nLeapFlags;
|
---|
| 81 | BYTE nStratum;
|
---|
| 82 | DWORD dwTSFlags;
|
---|
| 83 | WCHAR wszUniqueName[256];
|
---|
| 84 | } TimeSample;
|
---|
| 85 |
|
---|
| 86 | typedef struct TpcGetSamplesArgs {
|
---|
| 87 | BYTE *pbSampleBuf;
|
---|
| 88 | DWORD cbSampleBuf;
|
---|
| 89 | DWORD dwSamplesReturned;
|
---|
| 90 | DWORD dwSamplesAvailable;
|
---|
| 91 | } TpcGetSamplesArgs;
|
---|
| 92 |
|
---|
| 93 | typedef struct TpcTimeJumpedArgs {
|
---|
| 94 | TimeJumpedFlags tjfFlags;
|
---|
| 95 | } TpcTimeJumpedArgs;
|
---|
| 96 |
|
---|
| 97 | typedef struct TpcNetTopoChangeArgs {
|
---|
| 98 | NetTopoChangeFlags ntcfFlags;
|
---|
| 99 | } TpcNetTopoChangeArgs;
|
---|
| 100 |
|
---|
| 101 | typedef void *TimeProvHandle;
|
---|
| 102 |
|
---|
| 103 | HRESULT WINAPI TimeProvOpen(WCHAR *wszName,TimeProvSysCallbacks *pSysCallbacks,TimeProvHandle *phTimeProv);
|
---|
| 104 | HRESULT WINAPI TimeProvCommand(TimeProvHandle hTimeProv,TimeProvCmd eCmd,TimeProvArgs pvArgs);
|
---|
| 105 | HRESULT WINAPI TimeProvClose(TimeProvHandle hTimeProv);
|
---|
| 106 |
|
---|
| 107 | #ifdef __cplusplus
|
---|
| 108 | }
|
---|
| 109 | #endif
|
---|
| 110 | #endif
|
---|