ReactOS  0.4.15-dev-494-g1d8c567
w32time.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <winreg.h>
#include <winsvc.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
 

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 16 of file w32time.h.

◆ NTPPORT

#define NTPPORT   123

Definition at line 17 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 WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
char * LPSTR
Definition: xmlstorage.h:182
static BOOL InitConnection(PINFO pInfo, LPSTR lpAddress)
Definition: ntpclient.c:25
static VOID DestroyConnection(VOID)
Definition: ntpclient.c:61
static ULONG ReceiveData(PINFO pInfo)
Definition: ntpclient.c:102
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:404
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: precomp.h:83
static BOOL SendData(PINFO pInfo)
Definition: ntpclient.c:76
unsigned int ULONG
Definition: retypes.h:1
struct _INFO * PINFO
struct _INFO INFO
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:403
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by SetTime().