ReactOS  0.4.15-dev-341-g17c5fb8
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 <debug.h>
#include <strsafe.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  SYNC_STATUS
 
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 SYNC_STATUSPSYNC_STATUS
 
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 27 of file timedate.h.

◆ CLM_STARTCLOCK

#define CLM_STARTCLOCK   (WM_USER + 2)

Definition at line 74 of file timedate.h.

◆ CLM_STOPCLOCK

#define CLM_STOPCLOCK   (WM_USER + 1)

Definition at line 73 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 28 of file timedate.h.

◆ MAX_KEY_LENGTH

#define MAX_KEY_LENGTH   255

Definition at line 24 of file timedate.h.

◆ MAX_VALUE_NAME

#define MAX_VALUE_NAME   16383

Definition at line 25 of file timedate.h.

◆ MCCM_CHANGED

#define MCCM_CHANGED   (WM_USER + 4)

Definition at line 84 of file timedate.h.

◆ MCCM_GETDATE

#define MCCM_GETDATE   (WM_USER + 2)

Definition at line 82 of file timedate.h.

◆ MCCM_RESET

#define MCCM_RESET   (WM_USER + 3)

Definition at line 83 of file timedate.h.

◆ MCCM_SETDATE

#define MCCM_SETDATE   (WM_USER + 1)

Definition at line 81 of file timedate.h.

◆ MCCN_AUTOUPDATE

#define MCCN_AUTOUPDATE   (2)

Definition at line 97 of file timedate.h.

◆ MCCN_SELCHANGE

#define MCCN_SELCHANGE   (1)

Definition at line 86 of file timedate.h.

◆ SERVERLISTSIZE

#define SERVERLISTSIZE   6

Definition at line 26 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

◆ PSYNC_STATUS

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:83
#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:63
#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:3134
static VOID SetTimeZoneName(HWND hwnd)
Definition: dateandtime.c:111
#define IDC_YEARTEXT
Definition: resource.h:13
WORD wYear
Definition: winbase.h:883
short SHORT
Definition: pedump.c:59
UINT_PTR idFrom
Definition: winuser.h:3133
#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:286
#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:344
#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:86
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:2881
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:73
#define SetWindowLongPtrW
Definition: winuser.h:5321
#define CLM_STARTCLOCK
Definition: timedate.h:74
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:97
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:55
#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:5797
#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 OnAutoSync(), and SetNTPServer().

◆ InetTimePageProc()

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

Definition at line 381 of file internettime.c.

385 {
386  switch (uMsg)
387  {
388  case WM_INITDIALOG:
389  OnInitDialog(hwndDlg);
390  break;
391 
392  case WM_COMMAND:
393  switch(LOWORD(wParam))
394  {
395  case IDC_UPDATEBUTTON:
396  OnUpdate(hwndDlg);
397  break;
398 
399  case IDC_SERVERLIST:
401  {
402  /* Enable the 'Apply' button */
403  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
404  }
405  break;
406 
407  case IDC_AUTOSYNC:
408  if (HIWORD(wParam) == BN_CLICKED)
409  {
410  EnableDialogText(hwndDlg);
411 
412  /* Enable the 'Apply' button */
413  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
414  }
415  break;
416  }
417  break;
418 
419  case WM_DESTROY:
420  break;
421 
422  case WM_NOTIFY:
423  {
424  LPNMHDR lpnm = (LPNMHDR)lParam;
425 
426  switch (lpnm->code)
427  {
428  case PSN_APPLY:
429  SetNTPServer(hwndDlg, FALSE);
430 
432  OnAutoSync(TRUE);
433  else
434  OnAutoSync(FALSE);
435 
436  return TRUE;
437 
438  default:
439  break;
440  }
441  }
442  break;
443  }
444 
445  return FALSE;
446 }
#define TRUE
Definition: types.h:120
static VOID OnUpdate(HWND hwndDlg)
Definition: internettime.c:364
#define IDC_AUTOSYNC
Definition: resource.h:24
#define PSN_APPLY
Definition: prsht.h:117
WPARAM wParam
Definition: combotst.c:138
struct tagNMHDR * LPNMHDR
UINT code
Definition: winuser.h:3134
static VOID EnableDialogText(HWND hwnd)
Definition: internettime.c:175
#define BM_GETCHECK
Definition: winuser.h:1900
static VOID SetNTPServer(HWND hwnd, BOOL bBeginUpdate)
Definition: internettime.c:93
#define WM_DESTROY
Definition: winuser.h:1591
#define CBN_EDITCHANGE
Definition: winuser.h:1957
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#define IDC_UPDATEBUTTON
Definition: resource.h:23
#define BN_CLICKED
Definition: winuser.h:1907
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#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:311
static VOID OnInitDialog(HWND hwnd)
Definition: internettime.c:301
#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 275 of file clock.c.

276 {
277  WNDCLASSEXW wc = {0};
278 
279  wc.cbSize = sizeof(WNDCLASSEXW);
281  wc.hInstance = hApplet;
283  wc.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1);
285 
286  return RegisterClassExW(&wc) != (ATOM)0;
287 }
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:3201
HBRUSH hbrBackground
Definition: winuser.h:3199
UINT cbSize
Definition: winuser.h:3191
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
HINSTANCE hInstance
Definition: winuser.h:3196
#define COLOR_BTNFACE
Definition: winuser.h:918
HCURSOR hCursor
Definition: winuser.h:3198
WNDPROC lpfnWndProc
Definition: winuser.h:3193
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:3151
ATOM WINAPI RegisterClassW(_In_ CONST WNDCLASSW *)
HINSTANCE hInstance
Definition: charmap.c:20
WNDPROC lpfnWndProc
Definition: winuser.h:3152
smooth NULL
Definition: ftsmooth.c:416
LPCWSTR lpszClassName
Definition: winuser.h:3160
int cbWndExtra
Definition: winuser.h:3154
HCURSOR WINAPI LoadCursorW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2074
#define CS_DBLCLKS
Definition: winuser.h:646
HCURSOR hCursor
Definition: winuser.h:3157
#define MONTHCAL_CTRLBG
Definition: monthcal.c:18
HBRUSH hbrBackground
Definition: winuser.h:3158
struct _MONTHCALWND * PMONTHCALWND
static const WCHAR szMonthCalWndClass[]
Definition: monthcal.c:14
HINSTANCE hInstance
Definition: winuser.h:3155
#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:407
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:356
#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 257 of file timezone.c.

261 {
262  BITMAP bitmap;
263 
264  switch (uMsg)
265  {
266  case WM_INITDIALOG:
267  {
270 
273 
275  if (hBitmap != NULL)
276  {
277  GetObjectW(hBitmap, sizeof(bitmap), &bitmap);
278 
279  cxSource = bitmap.bmWidth;
280  cySource = bitmap.bmHeight;
281  }
282  break;
283  }
284 
285  case WM_DRAWITEM:
286  {
287  LPDRAWITEMSTRUCT lpDrawItem;
288  lpDrawItem = (LPDRAWITEMSTRUCT) lParam;
289  if(lpDrawItem->CtlID == IDC_WORLD_BACKGROUND)
290  {
291  HDC hdcMem;
292  hdcMem = CreateCompatibleDC(lpDrawItem->hDC);
293  if (hdcMem != NULL)
294  {
296  StretchBlt(lpDrawItem->hDC, lpDrawItem->rcItem.left, lpDrawItem->rcItem.top,
297  lpDrawItem->rcItem.right - lpDrawItem->rcItem.left,
298  lpDrawItem->rcItem.bottom - lpDrawItem->rcItem.top,
299  hdcMem, 0, 0, cxSource, cySource, SRCCOPY);
300  DeleteDC(hdcMem);
301  }
302  }
303  }
304  break;
305 
306  case WM_COMMAND:
309  {
310  /* Enable the 'Apply' button */
311  PropSheet_Changed(GetParent(hwndDlg), hwndDlg);
312  }
313  break;
314 
315  case WM_DESTROY:
318  break;
319 
320  case WM_NOTIFY:
321  {
322  LPNMHDR lpnm = (LPNMHDR)lParam;
323 
324  switch (lpnm->code)
325  {
326  case PSN_APPLY:
327  {
329  BM_GETCHECK, 0, 0) != BST_UNCHECKED);
332  return TRUE;
333  }
334 
335  default:
336  break;
337  }
338  }
339  break;
340  }
341 
342  return FALSE;
343 }
#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:307
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)
UINT_PTR WPARAM
Definition: windef.h:207
#define SendDlgItemMessage
Definition: winuser.h:5817
#define PSN_APPLY
Definition: prsht.h:117
LONG left
Definition: windef.h:306
LONG right
Definition: windef.h:308
#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
UINT code
Definition: winuser.h:3134
#define IDC_AUTODAYLIGHT
Definition: resource.h:17
static VOID ShowTimeZoneList(HWND hwnd)
Definition: timezone.c:167
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 BM_GETCHECK
Definition: winuser.h:1900
#define WM_DESTROY
Definition: winuser.h:1591
VOID SetAutoDaylight(IN BOOL EnableAutoDaylightTime)
Definition: tzlib.c:323
static int cxSource
Definition: timezone.c:27
Definition: uimain.c:88
#define BM_SETCHECK
Definition: winuser.h:1903
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define PropSheet_Changed(d, w)
Definition: prsht.h:344
#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
#define BST_UNCHECKED
Definition: winuser.h:199
static VOID DestroyTimeZoneList(VOID)
Definition: timezone.c:145
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:139
static int cySource
Definition: timezone.c:27
BOOL WINAPI DeleteDC(_In_ HDC)
Definition: bl.h:1331
#define IMAGE_BITMAP
Definition: winuser.h:211
#define CBN_SELCHANGE
Definition: winuser.h:1961
#define BST_CHECKED
Definition: winuser.h:197
static VOID SetLocalTimeZone(HWND hwnd)
Definition: timezone.c:211
#define WM_DRAWITEM
Definition: winuser.h:1627
BOOL GetAutoDaylight(VOID)
Definition: tzlib.c:283
#define HIWORD(l)
Definition: typedefs.h:246
LONG bottom
Definition: windef.h:309
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:26
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 291 of file clock.c.

292 {
294  hApplet);
295 }
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.