Commit in reactos/lib/shell32 on MAIN
dialogs.c+16-291.11 -> 1.12
Merge back commit from winehq.
Mike McCormack <mike@codeweavers.com>
- Use Heap function in preference to malloc/free.

reactos/lib/shell32
dialogs.c 1.11 -> 1.12
diff -u -r1.11 -r1.12
--- dialogs.c	7 Sep 2004 14:27:04 -0000	1.11
+++ dialogs.c	22 Sep 2004 18:47:39 -0000	1.12
@@ -135,25 +135,6 @@
             return TRUE ;
 
         case WM_COMMAND :
-            {
-            STARTUPINFOA si ;
-            PROCESS_INFORMATION pi ;
-
-            si.cb = sizeof (STARTUPINFOA) ;
-            si.lpReserved = NULL ;
-            si.lpDesktop = NULL ;
-            si.lpTitle = NULL ;
-            si.dwX = 0 ;
-            si.dwY = 0 ;
-            si.dwXSize = 0 ;
-            si.dwYSize = 0 ;
-            si.dwXCountChars = 0 ;
-            si.dwYCountChars = 0 ;
-            si.dwFillAttribute = 0 ;
-            si.dwFlags = 0 ;
-            si.cbReserved2 = 0 ;
-            si.lpReserved2 = NULL ;
-
             switch (LOWORD (wParam))
                 {
                 case IDOK :
@@ -161,7 +142,7 @@
                     HWND htxt = NULL ;
                     if ((ic = GetWindowTextLengthA (htxt = GetDlgItem (hwnd, 12298))))
                         {
-                        psz = malloc (ic + 2) ;
+                        psz = HeapAlloc( GetProcessHeap, 0, (ic + 2) );
                         GetWindowTextA (htxt, psz, ic + 1) ;
 
                         if (ShellExecuteA(NULL, "open", psz, NULL, NULL, SW_SHOWNORMAL) < (HINSTANCE)33)
@@ -179,12 +160,12 @@
                             LocalFree ((HLOCAL)pszSysMsg) ;
                             MessageBoxA (hwnd, szMsg, "Nix", MB_OK | MB_ICONEXCLAMATION) ;
 
-                            free (psz) ;
+                            HeapFree(GetProcessHeap(), 0, psz);
                             SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
                             return TRUE ;
                             }
                         FillList (htxt, psz) ;
-                        free (psz) ;
+                        HeapFree(GetProcessHeap(), 0, psz);
                         EndDialog (hwnd, 0) ;
                         }
                     }
@@ -249,7 +230,6 @@
                     }
                 }
             return TRUE ;
-            }
         }
     return FALSE ;
     }
@@ -274,13 +254,14 @@
 
     if (icList > 0)
         {
-        pszList = malloc (icList) ;
+        pszList = HeapAlloc( GetProcessHeap(), 0, icList) ;
         if (ERROR_SUCCESS != RegQueryValueExA (hkey, "MRUList", NULL, NULL, pszList, &icList))
             MessageBoxA (hCb, "Unable to grab MRUList !", "Nix", MB_OK) ;
         }
     else
         {
-        pszList = malloc (icList = 1) ;
+        icList = 1 ;
+        pszList = HeapAlloc( GetProcessHeap(), 0, icList) ;
         pszList[0] = 0 ;
         }
 
@@ -293,7 +274,10 @@
 
         if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, NULL, &icCmd))
             MessageBoxA (hCb, "Unable to grab size of index", "Nix", MB_OK) ;
-        pszCmd = realloc (pszCmd, icCmd) ;
+        if( pszCmd )
+            pszCmd = HeapReAlloc(GetProcessHeap(), 0, pszCmd, icCmd) ;
+        else
+            pszCmd = HeapAlloc(GetProcessHeap(), 0, icCmd) ;
         if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, pszCmd, &icCmd))
             MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK) ;
 
@@ -359,7 +343,10 @@
         SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
 
         cMatch = ++cMax ;
-        pszList = realloc (pszList, ++icList) ;
+        if( pszList )
+            pszList = HeapReAlloc(GetProcessHeap(), 0, pszList, ++icList) ;
+        else
+            pszList = HeapAlloc(GetProcessHeap(), 0, ++icList) ;
         memmove (&pszList[1], pszList, icList - 1) ;
         pszList[0] = cMatch ;
         szIndex[0] = cMatch ;
@@ -368,8 +355,8 @@
 
     RegSetValueExA (hkey, "MRUList", 0, REG_SZ, pszList, strlen (pszList) + 1) ;
 
-    free (pszCmd) ;
-    free (pszList) ;
+    HeapFree( GetProcessHeap(), 0, pszCmd) ;
+    HeapFree( GetProcessHeap(), 0, pszList) ;
     }
 
 
CVSspam 0.2.8