check reg for NTP setting

fix a few typos and msvc warnings

svn path=/trunk/; revision=22972
This commit is contained in:
Ged Murphy 2006-07-09 16:19:39 +00:00
parent ae1a33083a
commit ab8a344656
3 changed files with 59 additions and 14 deletions

View file

@ -216,7 +216,7 @@ GetNTPServerAddress(LPSTR* lpAddress)
}
RegCloseKey(hKey);
HeapFree(GetProcessHeap,
HeapFree(GetProcessHeap(),
0,
buf);
@ -225,8 +225,8 @@ GetNTPServerAddress(LPSTR* lpAddress)
fail:
GetError();
if (hKey) RegCloseKey(hKey);
HeapFree(GetProcessHeap, 0, buf);
HeapFree(GetProcessHeap, 0, *lpAddress);
HeapFree(GetProcessHeap(), 0, buf);
HeapFree(GetProcessHeap(), 0, *lpAddress);
return FALSE;
}
@ -326,11 +326,53 @@ EnableDialogText(HWND hwnd)
}
static VOID
GetSyncSetting(HWND hwnd)
{
HKEY hKey;
HWND hCheck;
LONG Ret;
WCHAR Data[8];
DWORD Size;
Ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\DateTime\\Parameters",
0,
KEY_QUERY_VALUE,
&hKey);
if (Ret != ERROR_SUCCESS)
{
GetError();
return;
}
Size = sizeof(Data);
Ret = RegQueryValueExW(hKey,
L"Type",
NULL,
NULL,
(LPBYTE)Data,
&Size);
if (Ret != ERROR_SUCCESS)
{
GetError();
}
if (lstrcmp(Data, L"NTP") == 0)
{
hCheck = GetDlgItem(hwnd, IDC_AUTOSYNC);
SendMessageW(hCheck, BM_SETCHECK, 0, 0);
}
RegCloseKey(hKey);
}
static VOID
InitialiseDialog(HWND hwnd)
{
//check registry if button should be checked
//set button
GetSyncSetting(hwnd);
EnableDialogText(hwnd);
CreateNTPServerList(hwnd);

View file

@ -237,11 +237,11 @@ MonthCalReload(IN PMONTHCALWND infoPtr)
TCHAR szBuf[64];
UINT i;
infoPtr->UIState = (DWORD) SendMessage(GetAncestor(infoPtr->hSelf,
GA_PARENT),
WM_QUERYUISTATE,
0,
0);
infoPtr->UIState = (DWORD)SendMessage(GetAncestor(infoPtr->hSelf,
GA_PARENT),
WM_QUERYUISTATE,
0,
0);
/* cache the configuration */
infoPtr->FirstDayOfWeek = MonthCalFirstDayOfWeek();
@ -631,8 +631,8 @@ MonthCalChangeFont(IN PMONTHCALWND infoPtr,
static WORD
MonthCalPtToDay(IN PMONTHCALWND infoPtr,
IN SHORT x,
IN SHORT y)
IN INT x,
IN INT y)
{
WORD Ret = 0;
@ -1017,7 +1017,7 @@ MonthCalWndProc(IN HWND hwnd,
SetWindowLongPtr(hwnd,
0,
(DWORD_PTR)infoPtr);
(LONG_PTR)infoPtr);
ZeroMemory(infoPtr,
sizeof(MONTHCALWND));

View file

@ -289,7 +289,7 @@ SetLocalTimeZone(HWND hwnd)
while (i < dwIndex)
{
if (Entry == NULL)
return;
return;
i++;
Entry = Entry->Next;
@ -328,6 +328,9 @@ GetAutoDaylightInfo(HWND hwnd)
&hKey))
return;
/* if the call fails (non zero), the reg value isn't available,
* which means it shouldn't be disabled, so we should check the button.
*/
if (RegQueryValueExW(hKey,
L"DisableAutoDaylightTimeSet",
NULL,