fixed some bugs
authorChristoph von Wittich <christoph_vw@reactos.org>
Sun, 8 Jan 2006 19:07:16 +0000 (19:07 +0000)
committerChristoph von Wittich <christoph_vw@reactos.org>
Sun, 8 Jan 2006 19:07:16 +0000 (19:07 +0000)
use PCH when building with MSVC

svn path=/trunk/; revision=20719

reactos/subsys/system/msconfig/msconfig.xml
reactos/subsys/system/msconfig/srvpage.c
reactos/subsys/system/msconfig/startuppage.c
reactos/subsys/system/msconfig/toolspage.c

index 18aa5c8..76d3f79 100644 (file)
@@ -22,4 +22,5 @@
                <file>msconfig.c</file>
        </compilationunit>
        <file>msconfig.rc</file>
+       <pch>precomp.h</pch>
 </module>
index 2a8c7e9..aed2e01 100644 (file)
@@ -19,7 +19,7 @@ ServicesPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
         hServicesListCtrl = GetDlgItem(hDlg, IDC_SERVICES_LIST);
         hServicesDialog = hDlg;
 
-        dwStyle = SendMessage(hServicesListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
+        dwStyle = (DWORD) SendMessage(hServicesListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
         dwStyle = dwStyle | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES;
         SendMessage(hServicesListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
 
@@ -93,7 +93,7 @@ GetServices ( void )
             {
                 /* reserve memory for service info array */
                 pServiceStatus = (ENUM_SERVICE_STATUS_PROCESS *) HeapAlloc(GetProcessHeap(), 0, BytesNeeded);
-                if (pServiceStatus == NULL
+                if (!pServiceStatus
                                return;
 
                 /* fill array with service info */
@@ -111,6 +111,8 @@ GetServices ( void )
 
         if (NumServices)
         {
+            if (!pServiceStatus)
+                return;
             for (Index = 0; Index < NumServices; Index++)
             {
                 memset(&item, 0, sizeof(LV_ITEM));
index 87c109b..5d7a26e 100644 (file)
@@ -19,7 +19,7 @@ StartupPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
         hStartupListCtrl = GetDlgItem(hDlg, IDC_STARTUP_LIST);
         hStartupDialog = hDlg;
 
-        dwStyle = SendMessage(hStartupListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
+        dwStyle = (DWORD) SendMessage(hStartupListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
         dwStyle = dwStyle | LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES;
         SendMessage(hStartupListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);
 
@@ -62,7 +62,7 @@ GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName )
     HKEY hKey;
     DWORD Index, dwValues, retVal, dwType;
     DWORD dwValueLength, dwDataLength = MAX_VALUE_NAME; 
-    TCHAR Data[MAX_VALUE_NAME];
+    TCHAR* Data;
     TCHAR lpValueName[MAX_KEY_LENGTH];
     TCHAR Path[MAX_KEY_LENGTH + 5];
     LV_ITEM item;
@@ -73,8 +73,11 @@ GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName )
         {
             for (Index = 0, retVal = ERROR_SUCCESS; Index < dwValues; Index++) 
             {
-                dwValueLength = MAX_VALUE_NAME;
+                dwValueLength = MAX_KEY_LENGTH;
                 dwDataLength = MAX_VALUE_NAME;
+                Data = (TCHAR*) HeapAlloc(GetProcessHeap(), 0, MAX_VALUE_NAME);
+                if (Data == NULL)
+                    break;
                 retVal = RegEnumValue(hKey, Index, lpValueName, &dwValueLength, NULL, &dwType, (LPBYTE)Data, &dwDataLength);
                 if (retVal == ERROR_SUCCESS) 
                 {
@@ -88,21 +91,29 @@ GetAutostartEntriesFromRegistry ( HKEY hRootKey, TCHAR* KeyName )
 
                     if (dwType == REG_SZ)
                     {
-                        GetLongPathName(Data, Data, sizeof(Data));
+                        GetLongPathName(Data, Data, (DWORD) _tcsclen(Data));
                         item.pszText = Data;
                         item.iSubItem = 1;
                         SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
                     }
                     
-                    if (hRootKey == HKEY_LOCAL_MACHINE)
-                        _tcscpy(Path, _T("HKLM\\"));
-                    if (hRootKey == HKEY_CURRENT_USER)
-                        _tcscpy(Path, _T("HKCU\\"));
+                    switch (PtrToLong(hRootKey))
+                    {
+                    case HKEY_LOCAL_MACHINE:
+                        _tcscpy(Path, _T("HKLM\\\0"));
+                        break;
+                    case HKEY_CURRENT_USER:
+                        _tcscpy(Path, _T("HKCU\\\0"));
+                        break;
+                    default:
+                        _tcscpy(Path, _T("\0"));
+                    }
 
                     _tcscat(Path, KeyName);
                     item.pszText = Path;
                     item.iSubItem = 2;
                     SendMessage(hStartupListCtrl, LVM_SETITEMTEXT, item.iItem, (LPARAM) &item);
+                    HeapFree(GetProcessHeap(), 0, Data);
                 }
             }
         }
index 522d125..d020a45 100644 (file)
@@ -55,7 +55,7 @@ ToolsPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
         hToolsListCtrl = GetDlgItem(hDlg, IDC_TOOLS_LIST);
         hToolsDialog = hDlg;
 
-        dwStyle = SendMessage(hToolsListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
+        dwStyle = (DWORD) SendMessage(hToolsListCtrl, LVM_GETEXTENDEDLISTVIEWSTYLE, 0, 0);
         dwStyle = dwStyle | LVS_EX_FULLROWSELECT;
         SendMessage(hToolsListCtrl, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, dwStyle);