Merge back commit from winehq.

Mike McCormack <mike@codeweavers.com>
- Use Heap function in preference to malloc/free.

svn path=/trunk/; revision=10977
This commit is contained in:
Gé van Geldorp 2004-09-22 18:47:39 +00:00
parent 2e87325d12
commit f505dd6839

View file

@ -135,25 +135,6 @@ INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
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 @@ INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
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 @@ INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
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 @@ INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lPar
}
}
return TRUE ;
}
}
return FALSE ;
}
@ -274,13 +254,14 @@ void FillList (HWND hCb, char *pszLatest)
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 @@ void FillList (HWND hCb, char *pszLatest)
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 @@ void FillList (HWND hCb, char *pszLatest)
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 @@ void FillList (HWND hCb, char *pszLatest)
RegSetValueExA (hkey, "MRUList", 0, REG_SZ, pszList, strlen (pszList) + 1) ;
free (pszCmd) ;
free (pszList) ;
HeapFree( GetProcessHeap(), 0, pszCmd) ;
HeapFree( GetProcessHeap(), 0, pszList) ;
}