ReactOS  0.4.14-dev-376-gaedba84
timedate.h File Reference
#include <stdarg.h>
#include <windef.h>
#include <winbase.h>
#include <winnls.h>
#include <winreg.h>
#include <wingdi.h>
#include <winuser.h>
#include <wchar.h>
#include <commctrl.h>
#include <cpl.h>
#include "resource.h"
Include dependency graph for timedate.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  APPLET
 
struct  _NMMCCSELCHANGE
 
struct  _NMMCCAUTOUPDATE
 

Macros

#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define WIN32_NO_STATUS
 
#define MAX_KEY_LENGTH   255
 
#define MAX_VALUE_NAME   16383
 
#define SERVERLISTSIZE   6
 
#define BUFSIZE   1024
 
#define ID_TIMER   1
 
#define CLM_STOPCLOCK   (WM_USER + 1)
 
#define CLM_STARTCLOCK   (WM_USER + 2)
 
#define MCCM_SETDATE   (WM_USER + 1)
 
#define MCCM_GETDATE   (WM_USER + 2)
 
#define MCCM_RESET   (WM_USER + 3)
 
#define MCCM_CHANGED   (WM_USER + 4)
 
#define MCCN_SELCHANGE   (1)
 
#define MCCN_AUTOUPDATE   (2)
 

Typedefs

typedef struct APPLETPAPPLET
 
typedef struct _NMMCCSELCHANGE NMMCCSELCHANGE
 
typedef struct _NMMCCSELCHANGEPNMMCCSELCHANGE
 
typedef struct _NMMCCAUTOUPDATE NMMCCAUTOUPDATE
 
typedef struct _NMMCCAUTOUPDATEPNMMCCAUTOUPDATE
 

Functions

INT_PTR CALLBACK DateTimePageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
BOOL SystemSetLocalTime (LPSYSTEMTIME lpSystemTime)
 
INT_PTR CALLBACK TimeZonePageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
INT_PTR CALLBACK InetTimePageProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
VOID DisplayWin32Error (DWORD dwErrorCode)
 
BOOL RegisterClockControl (VOID)
 
VOID UnregisterClockControl (VOID)
 
BOOL RegisterMonthCalControl (IN HINSTANCE hInstance)
 
VOID UnregisterMonthCalControl (IN HINSTANCE hInstance)
 

Variables

HINSTANCE hApplet
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 6 of file timedate.h.

◆ BUFSIZE

#define BUFSIZE   1024

Definition at line 25 of file timedate.h.

◆ CLM_STARTCLOCK

#define CLM_STARTCLOCK   (WM_USER + 2)

Definition at line 63 of file timedate.h.

◆ CLM_STOPCLOCK

#define CLM_STOPCLOCK   (WM_USER + 1)

Definition at line 62 of file timedate.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 7 of file timedate.h.

◆ ID_TIMER

#define ID_TIMER   1

Definition at line 26 of file timedate.h.

◆ MAX_KEY_LENGTH

#define MAX_KEY_LENGTH   255

Definition at line 22 of file timedate.h.

◆ MAX_VALUE_NAME

#define MAX_VALUE_NAME   16383

Definition at line 23 of file timedate.h.

◆ MCCM_CHANGED

#define MCCM_CHANGED   (WM_USER + 4)

Definition at line 73 of file timedate.h.

◆ MCCM_GETDATE

#define MCCM_GETDATE   (WM_USER + 2)

Definition at line 71 of file timedate.h.

◆ MCCM_RESET

#define MCCM_RESET   (WM_USER + 3)

Definition at line 72 of file timedate.h.

◆ MCCM_SETDATE

#define MCCM_SETDATE   (WM_USER + 1)

Definition at line 70 of file timedate.h.

◆ MCCN_AUTOUPDATE

#define MCCN_AUTOUPDATE   (2)

Definition at line 86 of file timedate.h.

◆ MCCN_SELCHANGE

#define MCCN_SELCHANGE   (1)

Definition at line 75 of file timedate.h.

◆ SERVERLISTSIZE

#define SERVERLISTSIZE   6

Definition at line 24 of file timedate.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file timedate.h.

Typedef Documentation

◆ NMMCCAUTOUPDATE

◆ NMMCCSELCHANGE

◆ PAPPLET

typedef struct APPLET * PAPPLET

◆ PNMMCCAUTOUPDATE

◆ PNMMCCSELCHANGE

Function Documentation

◆ DateTimePageProc()

INT_PTR CALLBACK DateTimePageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 265 of file dateandtime.c.

269 {
270  SYSTEMTIME st;
271  GetLocalTime(&st);
272 
273  switch (uMsg)
274  {
275  case WM_INITDIALOG:
277  IDC_MONTHCB));
278 
279  SetTimer(hwndDlg, ID_TIMER, 1000, NULL);
280 
281  /* Set range and current year */
282  SendMessageW(GetDlgItem(hwndDlg, IDC_YEAR), UDM_SETRANGE, 0, MAKELONG ((short) 9999, (short) 1900));
283  SendMessageW(GetDlgItem(hwndDlg, IDC_YEAR), UDM_SETPOS, 0, MAKELONG( (short) st.wYear, 0));
284 
286  break;
287 
288  case WM_TIMER:
290  break;
291 
292  case WM_COMMAND:
293  switch (LOWORD(wParam))
294  {
295  case IDC_MONTHCB:
296  if (HIWORD(wParam) == CBN_SELCHANGE)
297  {
300  (WORD) -1,
302  (WORD) -1);
303  }
304  break;
305  }
306  break;
307 
308  case WM_CTLCOLORSTATIC:
309  if ((HWND)lParam == GetDlgItem(hwndDlg, IDC_YEARTEXT))
311  break;
312 
313  case WM_NOTIFY:
314  {
315  LPNMHDR lpnm = (LPNMHDR)lParam;
316 
317  switch (lpnm->idFrom)
318  {
319  case IDC_YEAR:
320  switch (lpnm->code)
321  {
322  case UDN_DELTAPOS:
323  {
324  SHORT wYear;
325  LPNMUPDOWN updown = (LPNMUPDOWN)lpnm;
326  wYear = (SHORT)SendMessageW(GetDlgItem(hwndDlg, IDC_YEAR), UDM_GETPOS, 0, 0);
327  /* Enable the 'Apply' button */
328  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
331  (WORD) -1,
332  (WORD) -1,
333  (WORD) (wYear + updown->iDelta));
334  }
335  break;
336  }
337  break;
338 
339  case IDC_TIMEPICKER:
340  switch (lpnm->code)
341  {
342  case DTN_DATETIMECHANGE:
343  /* Stop the timer */
344  KillTimer(hwndDlg, ID_TIMER);
345 
346  /* Tell the clock to stop ticking */
348  0, 0);
349 
350  /* Enable the 'Apply' button */
351  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
352  break;
353  }
354  break;
355 
356  case IDC_MONTHCALENDAR:
357  switch (lpnm->code)
358  {
359  case MCCN_SELCHANGE:
360  /* Enable the 'Apply' button */
361  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
362  break;
363 
364  case MCCN_AUTOUPDATE:
365  AutoUpdateMonthCal(hwndDlg,
366  (PNMMCCAUTOUPDATE)lpnm);
367  break;
368  }
369  break;
370 
371  default:
372  switch (lpnm->code)
373  {
374  case PSN_SETACTIVE:
375  SetTimeZoneName(hwndDlg);
376  break;
377 
378  case PSN_APPLY:
379  SetLocalSystemTime(hwndDlg);
380  SetTimer(hwndDlg, ID_TIMER, 1000, NULL);
381 
382  /* Tell the clock to start ticking */
384  0, 0);
385  return TRUE;
386  }
387  break;
388  }
389  }
390  break;
391 
392  case WM_TIMECHANGE:
393  /* FIXME: We don't get this message as we're not a top-level window... */
394  SendMessageW(GetDlgItem(hwndDlg,
396  MCCM_RESET,
397  0,
398  0);
399  break;
400 
401  case WM_DESTROY:
402  KillTimer(hwndDlg, ID_TIMER);
403  break;
404  }
405 
406  return FALSE;
407 }
#define LONG_PTR
Definition: treelist.c:79
#define TRUE
Definition: types.h:120
#define UDM_GETPOS
Definition: commctrl.h:2140
static WNDPROC pOldWndProc
Definition: dateandtime.c:14
#define MCCM_RESET
Definition: timedate.h:72
#define WM_CTLCOLORSTATIC
Definition: winuser.h:1754
struct _NM_UPDOWN * LPNMUPDOWN
#define PSN_APPLY
Definition: prsht.h:117
int32_t INT_PTR
Definition: typedefs.h:62
#define PSN_SETACTIVE
Definition: prsht.h:115
#define COLOR_WINDOW
Definition: winuser.h:908
WPARAM wParam
Definition: combotst.c:138
#define IDC_TIMEPICKER
Definition: resource.h:11
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3133
static VOID SetTimeZoneName(HWND hwnd)
Definition: dateandtime.c:111
#define IDC_YEARTEXT
Definition: resource.h:13
WORD wYear
Definition: winbase.h:877
short SHORT
Definition: pedump.c:59
UINT_PTR idFrom
Definition: winuser.h:3132
#define IDC_MONTHCB
Definition: resource.h:6
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:276
#define UDM_SETRANGE
Definition: commctrl.h:2137
UINT_PTR WINAPI SetTimer(_In_opt_ HWND, _In_ UINT_PTR, _In_ UINT, _In_opt_ TIMERPROC)
#define WM_DESTROY
Definition: winuser.h:1591
#define IDC_CLOCKWND
Definition: resource.h:9
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define WM_TIMER
Definition: winuser.h:1724
unsigned short WORD
Definition: ntddk_ex.h:93
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MCCN_SELCHANGE
Definition: timedate.h:75
static VOID SetLocalSystemTime(HWND hwnd)
Definition: dateandtime.c:76
#define DTM_SETSYSTEMTIME
Definition: commctrl.h:4327
BOOL WINAPI KillTimer(_In_opt_ HWND, _In_ UINT_PTR)
static VOID ChangeMonthCalDate(HWND hMonthCal, WORD Day, WORD Month, WORD Year)
Definition: dateandtime.c:220
#define UDN_DELTAPOS
Definition: commctrl.h:2165
#define ID_TIMER
Definition: resource.h:23
#define IDC_YEAR
Definition: resource.h:12
#define WM_COMMAND
Definition: winuser.h:1722
#define GWLP_WNDPROC
Definition: treelist.c:66
static WORD GetCBSelectedMonth(HWND hCombo)
Definition: dateandtime.c:195
LRESULT(CALLBACK * WNDPROC)(HWND, UINT, WPARAM, LPARAM)
Definition: winuser.h:2880
int iDelta
Definition: commctrl.h:2162
HWND WINAPI GetParent(_In_ HWND)
#define GDT_VALID
Definition: commctrl.h:4456
#define IDC_MONTHCALENDAR
Definition: resource.h:8
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define UDM_SETPOS
Definition: commctrl.h:2139
#define CBN_SELCHANGE
Definition: winuser.h:1961
static VOID FillMonthsComboBox(HWND hCombo)
Definition: dateandtime.c:146
#define HIWORD(l)
Definition: typedefs.h:246
#define CLM_STOPCLOCK
Definition: timedate.h:62
#define SetWindowLongPtrW
Definition: winuser.h:5247
#define CLM_STARTCLOCK
Definition: timedate.h:63
HBRUSH WINAPI GetSysColorBrush(_In_ int)
#define DTN_DATETIMECHANGE
Definition: commctrl.h:4362
static VOID AutoUpdateMonthCal(HWND hwndDlg, PNMMCCAUTOUPDATE lpAutoUpdate)
Definition: dateandtime.c:234
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61
#define MCCN_AUTOUPDATE
Definition: timedate.h:86
static INT_PTR CALLBACK DTPProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: dateandtime.c:246
#define WM_TIMECHANGE
Definition: winuser.h:1616

Referenced by Applet().

◆ DisplayWin32Error()

VOID DisplayWin32Error ( DWORD  dwErrorCode)

Definition at line 28 of file timedate.c.

30 {
31  PWSTR lpMsgBuf;
32 #if DBG
33  WCHAR szMsg[255];
34 #endif
35 
39  NULL,
40  dwErrorCode,
42  (LPWSTR) &lpMsgBuf,
43  0,
44  NULL );
45 
46 #if DBG
47  if (swprintf(szMsg, L"%hs:%d: %s", file, line, (PWSTR)lpMsgBuf))
48  {
50  }
51 #else
52  MessageBox(NULL, lpMsgBuf, NULL, MB_OK | MB_ICONERROR);
53 #endif
54 
55  LocalFree(lpMsgBuf);
56 }
uint16_t * PWSTR
Definition: typedefs.h:54
#define LANG_NEUTRAL
Definition: nls.h:22
#define SUBLANG_DEFAULT
Definition: nls.h:168
DWORD WINAPI FormatMessageW(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, __ms_va_list *args)
Definition: format_msg.c:583
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
Definition: winbase.h:400
smooth NULL
Definition: ftsmooth.c:416
Definition: parser.c:48
#define FORMAT_MESSAGE_FROM_SYSTEM
Definition: winbase.h:404
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
static const WCHAR L[]
Definition: oid.c:1250
#define MB_ICONERROR
Definition: winuser.h:781
#define MessageBox
Definition: winuser.h:5723
#define FORMAT_MESSAGE_IGNORE_INSERTS
Definition: winbase.h:401
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define MB_OK
Definition: winuser.h:784
#define MAKELANGID(p, s)
Definition: nls.h:15
WCHAR * LPWSTR
Definition: xmlstorage.h:184
Definition: fci.c:126

Referenced by InetTimePageProc(), OnAutoSync(), and SetNTPServer().

◆ InetTimePageProc()

INT_PTR CALLBACK InetTimePageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 258 of file internettime.c.

262 {
263  switch (uMsg)
264  {
265  case WM_INITDIALOG:
266  OnInitDialog(hwndDlg);
267  break;
268 
269  case WM_COMMAND:
270  switch(LOWORD(wParam))
271  {
272  case IDC_UPDATEBUTTON:
273  {
274  DWORD dwError;
275 
276  SetNTPServer(hwndDlg);
277 
278  dwError = W32TimeSyncNow(L"localhost", 0, 0);
279  if (dwError != ERROR_SUCCESS)
280  {
281  DisplayWin32Error(dwError);
282  }
283  }
284  break;
285 
286  case IDC_SERVERLIST:
288  {
289  /* Enable the 'Apply' button */
290  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
291  }
292  break;
293 
294  case IDC_AUTOSYNC:
295  if (HIWORD(wParam) == BN_CLICKED)
296  {
297  EnableDialogText(hwndDlg);
298 
299  /* Enable the 'Apply' button */
300  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
301  }
302  break;
303  }
304  break;
305 
306  case WM_DESTROY:
307  break;
308 
309  case WM_NOTIFY:
310  {
311  LPNMHDR lpnm = (LPNMHDR)lParam;
312 
313  switch (lpnm->code)
314  {
315  case PSN_APPLY:
316  SetNTPServer(hwndDlg);
317 
319  OnAutoSync(TRUE);
320  else
321  OnAutoSync(FALSE);
322 
323  return TRUE;
324 
325  default:
326  break;
327  }
328  }
329  break;
330  }
331 
332  return FALSE;
333 }
DWORD WINAPI W32TimeSyncNow(LPCWSTR cmdline, UINT blocking, UINT flags)
Definition: w32time.c:338
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDC_AUTOSYNC
Definition: resource.h:24
static VOID SetNTPServer(HWND hwnd)
Definition: internettime.c:92
#define PSN_APPLY
Definition: prsht.h:117
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3133
VOID DisplayWin32Error(DWORD dwErrorCode)
Definition: timedate.c:28
static VOID EnableDialogText(HWND hwnd)
Definition: internettime.c:165
#define BM_GETCHECK
Definition: winuser.h:1900
#define WM_DESTROY
Definition: winuser.h:1591
#define CBN_EDITCHANGE
Definition: winuser.h:1957
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define IDC_UPDATEBUTTON
Definition: resource.h:23
#define BN_CLICKED
Definition: winuser.h:1907
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
static const WCHAR L[]
Definition: oid.c:1250
#define IDC_SERVERLIST
Definition: resource.h:22
#define WM_COMMAND
Definition: winuser.h:1722
HWND WINAPI GetParent(_In_ HWND)
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define BST_CHECKED
Definition: winuser.h:197
#define HIWORD(l)
Definition: typedefs.h:246
static VOID OnAutoSync(BOOL Sync)
Definition: internettime.c:222
static VOID OnInitDialog(HWND hwnd)
Definition: internettime.c:214
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by Applet().

◆ RegisterClockControl()

BOOL RegisterClockControl ( VOID  )

Definition at line 274 of file clock.c.

275 {
276  WNDCLASSEXW wc = {0};
277 
278  wc.cbSize = sizeof(WNDCLASSEXW);
280  wc.hInstance = hApplet;
282  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
284 
285  return RegisterClassExW(&wc) != (ATOM)0;
286 }
WORD ATOM
Definition: dimm.idl:113
HINSTANCE hApplet
Definition: access.c:17
struct _WNDCLASSEXW WNDCLASSEXW
ATOM WINAPI RegisterClassExW(_In_ CONST WNDCLASSEXW *)
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR lpszClassName
Definition: winuser.h:3200
HBRUSH hbrBackground
Definition: winuser.h:3198
UINT cbSize
Definition: winuser.h:3190
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HINSTANCE hInstance
Definition: winuser.h:3195
#define COLOR_BTNFACE
Definition: winuser.h:918
HCURSOR hCursor
Definition: winuser.h:3197
WNDPROC lpfnWndProc
Definition: winuser.h:3192
static const WCHAR szClockWndClass[]
Definition: clock.c:30
#define IDC_ARROW
Definition: winuser.h:682
static LRESULT CALLBACK ClockWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: clock.c:135

Referenced by Applet().

◆ RegisterMonthCalControl()

BOOL RegisterMonthCalControl ( IN HINSTANCE  hInstance)

Definition at line 1102 of file monthcal.c.

1103 {
1104  WNDCLASSW wc = {0};
1105 
1106  wc.style = CS_DBLCLKS;
1108  wc.cbWndExtra = sizeof(PMONTHCALWND);
1109  wc.hInstance = hInstance;
1110  wc.hCursor = LoadCursorW(NULL,
1111  (LPWSTR)IDC_ARROW);
1112  wc.hbrBackground = (HBRUSH)(MONTHCAL_CTRLBG + 1);
1114 
1115  return RegisterClassW(&wc) != 0;
1116 }
UINT style
Definition: winuser.h:3150
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
HINSTANCE hInstance
Definition: charmap.c:20
WNDPROC lpfnWndProc
Definition: winuser.h:3151
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR lpszClassName
Definition: winuser.h:3159
int cbWndExtra
Definition: winuser.h:3153
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define CS_DBLCLKS
Definition: winuser.h:646
HCURSOR hCursor
Definition: winuser.h:3156
#define MONTHCAL_CTRLBG
Definition: monthcal.c:18
HBRUSH hbrBackground
Definition: winuser.h:3157
struct _MONTHCALWND * PMONTHCALWND
static const WCHAR szMonthCalWndClass[]
Definition: monthcal.c:14
HINSTANCE hInstance
Definition: winuser.h:3154
#define IDC_ARROW
Definition: winuser.h:682
static LRESULT CALLBACK MonthCalWndProc(IN HWND hwnd, IN UINT uMsg, IN WPARAM wParam, IN LPARAM lParam)
Definition: monthcal.c:688
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by Applet().

◆ SystemSetLocalTime()

BOOL SystemSetLocalTime ( LPSYSTEMTIME  lpSystemTime)

Definition at line 17 of file dateandtime.c.

18 {
19  HANDLE hToken;
20  DWORD PrevSize;
21  TOKEN_PRIVILEGES priv, previouspriv;
22  BOOL Ret = FALSE;
23 
24  /*
25  * Enable the SeSystemtimePrivilege privilege
26  */
27 
30  &hToken))
31  {
32  priv.PrivilegeCount = 1;
34 
37  &priv.Privileges[0].Luid))
38  {
39  if (AdjustTokenPrivileges(hToken,
40  FALSE,
41  &priv,
42  sizeof(previouspriv),
43  &previouspriv,
44  &PrevSize) &&
46  {
47  /*
48  * We successfully enabled it, we're permitted to change the time.
49  * Call SetLocalTime twice to ensure correct results.
50  */
51  Ret = SetLocalTime(lpSystemTime) &&
52  SetLocalTime(lpSystemTime);
53 
54  /*
55  * For the sake of security, restore the previous status again
56  */
57  if (previouspriv.PrivilegeCount > 0)
58  {
59  AdjustTokenPrivileges(hToken,
60  FALSE,
61  &previouspriv,
62  0,
63  NULL,
64  0);
65  }
66  }
67  }
68  CloseHandle(hToken);
69  }
70 
71  return Ret;
72 }
#define CloseHandle
Definition: compat.h:406
BOOL WINAPI LookupPrivilegeValueW(LPCWSTR lpSystemName, LPCWSTR lpPrivilegeName, PLUID lpLuid)
Definition: misc.c:782
#define ERROR_SUCCESS
Definition: deptool.c:10
$ULONG PrivilegeCount
Definition: setypes.h:969
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define SE_PRIVILEGE_ENABLED
Definition: setypes.h:63
unsigned int BOOL
Definition: ntddk_ex.h:94
#define SE_SYSTEMTIME_NAME
Definition: winnt_old.h:376
smooth NULL
Definition: ftsmooth.c:416
#define TOKEN_QUERY
Definition: setypes.h:874
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI AdjustTokenPrivileges(HANDLE TokenHandle, BOOL DisableAllPrivileges, PTOKEN_PRIVILEGES NewState, DWORD BufferLength, PTOKEN_PRIVILEGES PreviousState, PDWORD ReturnLength)
Definition: security.c:376
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
LUID_AND_ATTRIBUTES Privileges[ANYSIZE_ARRAY]
Definition: setypes.h:970
BOOL WINAPI SetLocalTime(IN CONST SYSTEMTIME *lpSystemTime)
Definition: time.c:346
#define TOKEN_ADJUST_PRIVILEGES
Definition: setypes.h:876

Referenced by SetLocalSystemTime().

◆ TimeZonePageProc()

INT_PTR CALLBACK TimeZonePageProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 389 of file timezone.c.

393 {
394  BITMAP bitmap;
395 
396  switch (uMsg)
397  {
398  case WM_INITDIALOG:
403  if (hBitmap != NULL)
404  {
405  GetObjectW(hBitmap, sizeof(bitmap), &bitmap);
406 
407  cxSource = bitmap.bmWidth;
408  cySource = bitmap.bmHeight;
409  }
410  break;
411 
412  case WM_DRAWITEM:
413  {
414  LPDRAWITEMSTRUCT lpDrawItem;
415  lpDrawItem = (LPDRAWITEMSTRUCT) lParam;
416  if(lpDrawItem->CtlID == IDC_WORLD_BACKGROUND)
417  {
418  HDC hdcMem;
419  hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
420  if (hdcMem != NULL)
421  {
423  StretchBlt(lpDrawItem->hDC, lpDrawItem->rcItem.left, lpDrawItem->rcItem.top,
424  lpDrawItem->rcItem.right - lpDrawItem->rcItem.left,
425  lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
426  hdcMem, 0, 0, cxSource, cySource, SRCCOPY);
427  DeleteDC(hdcMem);
428  }
429  }
430  }
431  break;
432 
433  case WM_COMMAND:
436  {
437  /* Enable the 'Apply' button */
438  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
439  }
440  break;
441 
442  case WM_DESTROY:
445  break;
446 
447  case WM_NOTIFY:
448  {
449  LPNMHDR lpnm = (LPNMHDR)lParam;
450 
451  switch (lpnm->code)
452  {
453  case PSN_APPLY:
454  {
458  return TRUE;
459  }
460 
461  default:
462  break;
463  }
464  }
465  break;
466  }
467 
468  return FALSE;
469 }
#define TRUE
Definition: types.h:120
struct tagDRAWITEMSTRUCT * LPDRAWITEMSTRUCT
#define IDC_TIMEZONELIST
Definition: resource.h:16
static HDC
Definition: imagelist.c:92
LONG top
Definition: windef.h:292
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
Definition: dc.c:1497
BOOL WINAPI DeleteObject(_In_ HGDIOBJ)
HINSTANCE hApplet
Definition: access.c:17
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
#define PSN_APPLY
Definition: prsht.h:117
LONG left
Definition: windef.h:291
LONG right
Definition: windef.h:293
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI StretchBlt(_In_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_opt_ HDC, _In_ int, _In_ int, _In_ int, _In_ int, _In_ DWORD)
WPARAM wParam
Definition: combotst.c:138
#define DWLP_MSGRESULT
Definition: winuser.h:864
struct tagNMHDR * LPNMHDR
static VOID SetAutoDaylightInfo(HWND hwnd)
Definition: timezone.c:356
UINT code
Definition: winuser.h:3133
#define IDC_AUTODAYLIGHT
Definition: resource.h:17
static VOID ShowTimeZoneList(HWND hwnd)
Definition: timezone.c:244
HANDLE WINAPI LoadImageW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_ UINT, _In_ int, _In_ int, _In_ UINT)
Definition: cursoricon.c:2172
smooth NULL
Definition: ftsmooth.c:416
#define WM_DESTROY
Definition: winuser.h:1591
static int cxSource
Definition: timezone.c:36
Definition: uimain.c:88
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:326
#define BN_CLICKED
Definition: winuser.h:1907
#define IDC_WORLD_BACKGROUND
Definition: resource.h:18
#define IDC_WORLD
Definition: resource.h:19
#define PSNRET_NOERROR
Definition: prsht.h:129
#define WM_COMMAND
Definition: winuser.h:1722
static VOID DestroyTimeZoneList(VOID)
Definition: timezone.c:222
int WINAPI GetObjectW(_In_ HANDLE h, _In_ int c, _Out_writes_bytes_opt_(c) LPVOID pv)
HWND WINAPI GetParent(_In_ HWND)
static VOID CreateTimeZoneList(VOID)
Definition: timezone.c:119
static int cySource
Definition: timezone.c:36
BOOL WINAPI DeleteDC(_In_ HDC)
Definition: bl.h:1331
#define IMAGE_BITMAP
Definition: winuser.h:211
#define CBN_SELCHANGE
Definition: winuser.h:1961
static VOID SetLocalTimeZone(HWND hwnd)
Definition: timezone.c:278
#define WM_DRAWITEM
Definition: winuser.h:1627
static VOID GetAutoDaylightInfo(HWND hwnd)
Definition: timezone.c:323
#define HIWORD(l)
Definition: typedefs.h:246
LONG bottom
Definition: windef.h:294
static HBITMAP bitmap
Definition: clipboard.c:1344
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define LR_DEFAULTCOLOR
Definition: winuser.h:1077
#define WM_INITDIALOG
Definition: winuser.h:1721
static HBITMAP hBitmap
Definition: timezone.c:35
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define SRCCOPY
Definition: wingdi.h:332
HDC hdcMem
Definition: welcome.c:104
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by Applet().

◆ UnregisterClockControl()

VOID UnregisterClockControl ( VOID  )

Definition at line 290 of file clock.c.

291 {
293  hApplet);
294 }
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
HINSTANCE hApplet
Definition: access.c:17
static const WCHAR szClockWndClass[]
Definition: clock.c:30

Referenced by Applet().

◆ UnregisterMonthCalControl()

VOID UnregisterMonthCalControl ( IN HINSTANCE  hInstance)

Definition at line 1119 of file monthcal.c.

1120 {
1122  hInstance);
1123 }
BOOL WINAPI UnregisterClassW(_In_ LPCWSTR, HINSTANCE)
HINSTANCE hInstance
Definition: charmap.c:20
static const WCHAR szMonthCalWndClass[]
Definition: monthcal.c:14

Referenced by Applet().

Variable Documentation

◆ hApplet

HINSTANCE hApplet

Definition at line 17 of file access.c.