[ros-diffs] [gedmurphy] 22972: check reg for NTP setting fix a few typos and msvc warnings

gedmurphy at svn.reactos.org gedmurphy at svn.reactos.org
Sun Jul 9 18:19:40 CEST 2006


Author: gedmurphy
Date: Sun Jul  9 20:19:39 2006
New Revision: 22972

URL: http://svn.reactos.org/svn/reactos?rev=22972&view=rev
Log:
check reg for NTP setting
fix a few typos and msvc warnings

Modified:
    trunk/reactos/dll/cpl/timedate/internettime.c
    trunk/reactos/dll/cpl/timedate/monthcal.c
    trunk/reactos/dll/cpl/timedate/timezone.c

Modified: trunk/reactos/dll/cpl/timedate/internettime.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/timedate/internettime.c?rev=22972&r1=22971&r2=22972&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/timedate/internettime.c (original)
+++ trunk/reactos/dll/cpl/timedate/internettime.c Sun Jul  9 20:19:39 2006
@@ -216,7 +216,7 @@
     }
 
     RegCloseKey(hKey);
-    HeapFree(GetProcessHeap,
+    HeapFree(GetProcessHeap(),
              0,
              buf);
 
@@ -225,8 +225,8 @@
 fail:
     GetError();
     if (hKey) RegCloseKey(hKey);
-    HeapFree(GetProcessHeap, 0, buf);
-    HeapFree(GetProcessHeap, 0, *lpAddress);
+    HeapFree(GetProcessHeap(), 0, buf);
+    HeapFree(GetProcessHeap(), 0, *lpAddress);
     return FALSE;
 
 }
@@ -327,10 +327,52 @@
 
 
 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);

Modified: trunk/reactos/dll/cpl/timedate/monthcal.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/timedate/monthcal.c?rev=22972&r1=22971&r2=22972&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/timedate/monthcal.c (original)
+++ trunk/reactos/dll/cpl/timedate/monthcal.c Sun Jul  9 20:19:39 2006
@@ -237,11 +237,11 @@
     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 @@
 
 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 @@
 
             SetWindowLongPtr(hwnd,
                              0,
-                             (DWORD_PTR)infoPtr);
+                             (LONG_PTR)infoPtr);
 
             ZeroMemory(infoPtr,
                        sizeof(MONTHCALWND));

Modified: trunk/reactos/dll/cpl/timedate/timezone.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/timedate/timezone.c?rev=22972&r1=22971&r2=22972&view=diff
==============================================================================
--- trunk/reactos/dll/cpl/timedate/timezone.c (original)
+++ trunk/reactos/dll/cpl/timedate/timezone.c Sun Jul  9 20:19:39 2006
@@ -289,7 +289,7 @@
     while (i < dwIndex)
     {
         if (Entry == NULL)
-        return;
+            return;
 
         i++;
         Entry = Entry->Next;
@@ -328,6 +328,9 @@
                       &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,




More information about the Ros-diffs mailing list