ReactOS 0.4.16-dev-329-g9223134
w32time.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <winreg.h>
#include <winsvc.h>
#include <winuser.h>
Include dependency graph for w32time.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _TIMEPACKET
 
struct  _NTPPACKET
 

Macros

#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define WIN32_NO_STATUS
 
#define MAX_VALUE_NAME   16383
 
#define NTPPORT   123
 
#define W32TIME_POLL_INTERVAL   (4 * 60 * 60)
 

Typedefs

typedef struct _TIMEPACKET TIMEPACKET
 
typedef struct _TIMEPACKETPTIMEPACKET
 
typedef struct _NTPPACKET NTPPACKET
 
typedef struct _NTPPACKETPNTPPACKET
 

Functions

ULONG GetServerTime (LPWSTR lpAddress)
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 6 of file w32time.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 7 of file w32time.h.

◆ MAX_VALUE_NAME

#define MAX_VALUE_NAME   16383

Definition at line 17 of file w32time.h.

◆ NTPPORT

#define NTPPORT   123

Definition at line 18 of file w32time.h.

◆ W32TIME_POLL_INTERVAL

#define W32TIME_POLL_INTERVAL   (4 * 60 * 60)

Definition at line 19 of file w32time.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file w32time.h.

Typedef Documentation

◆ NTPPACKET

◆ PNTPPACKET

◆ PTIMEPACKET

◆ TIMEPACKET

Function Documentation

◆ GetServerTime()

ULONG GetServerTime ( LPWSTR  lpAddress)

Definition at line 138 of file ntpclient.c.

139{
140 PINFO pInfo;
141 LPSTR lpAddr;
142 DWORD dwSize = wcslen(lpAddress) + 1;
143 ULONG ulTime = 0;
144
145 pInfo = (PINFO)HeapAlloc(GetProcessHeap(),
146 0,
147 sizeof(INFO));
148 lpAddr = (LPSTR)HeapAlloc(GetProcessHeap(),
149 0,
150 dwSize);
151
152 if (pInfo && lpAddr)
153 {
155 0,
156 lpAddress,
157 -1,
158 lpAddr,
159 dwSize,
160 NULL,
161 NULL))
162 {
163 if (InitConnection(pInfo, lpAddr))
164 {
165 if (SendData(pInfo))
166 {
167 ulTime = ReceiveData(pInfo);
168 }
169 }
170
172 }
173 }
174
175 if (pInfo)
176 HeapFree(GetProcessHeap(), 0, pInfo);
177 if (lpAddr)
178 HeapFree(GetProcessHeap(), 0, lpAddr);
179
180 return ulTime;
181}
#define NULL
Definition: types.h:112
#define GetProcessHeap()
Definition: compat.h:736
#define CP_ACP
Definition: compat.h:109
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define WideCharToMultiByte
Definition: compat.h:111
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
struct _INFO INFO
static BOOL SendData(PINFO pInfo)
Definition: ntpclient.c:76
static VOID DestroyConnection(VOID)
Definition: ntpclient.c:61
struct _INFO * PINFO
static BOOL InitConnection(PINFO pInfo, LPSTR lpAddress)
Definition: ntpclient.c:25
static ULONG ReceiveData(PINFO pInfo)
Definition: ntpclient.c:102
Definition: precomp.h:84
uint32_t ULONG
Definition: typedefs.h:59
char * LPSTR
Definition: xmlstorage.h:182

Referenced by SetTime().