Fixed another non-static structure initializer.

This commit is contained in:
Gregg Mattinson 2002-07-16 01:15:15 +00:00 committed by Alexandre Julliard
parent 69f18275d5
commit 0c5abf77a3
1 changed files with 41 additions and 34 deletions

View File

@ -30,7 +30,7 @@
#include "shell32_main.h" #include "shell32_main.h"
#include "undocshell.h" #include "undocshell.h"
typedef struct typedef struct
{ {
HWND hwndOwner ; HWND hwndOwner ;
HICON hIcon ; HICON hIcon ;
@ -39,7 +39,7 @@ typedef struct
LPCSTR lpstrDescription ; LPCSTR lpstrDescription ;
UINT uFlags ; UINT uFlags ;
} RUNFILEDLGPARAMS ; } RUNFILEDLGPARAMS ;
typedef BOOL (*LPFNOFN) (OPENFILENAMEA *) ; typedef BOOL (*LPFNOFN) (OPENFILENAMEA *) ;
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
@ -77,11 +77,18 @@ void WINAPI RunFileDlg(
UINT uFlags) UINT uFlags)
{ {
RUNFILEDLGPARAMS rfdp = {hwndOwner, hIcon, lpstrDirectory, lpstrTitle, lpstrDescription, uFlags} ; RUNFILEDLGPARAMS rfdp;
HRSRC hRes; HRSRC hRes;
LPVOID template; LPVOID template;
TRACE("\n"); TRACE("\n");
rfdp.hwndOwner = hwndOwner;
rfdp.hIcon = hIcon;
rfdp.lpstrDirectory = lpstrDirectory;
rfdp.lpstrTitle = lpstrTitle;
rfdp.lpstrDescription = lpstrDescription;
rfdp.uFlags = uFlags;
if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_RUN_DLG", RT_DIALOGA))) if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_RUN_DLG", RT_DIALOGA)))
{ {
MessageBoxA (hwndOwner, "Couldn't find dialog.", "Nix", MB_OK) ; MessageBoxA (hwndOwner, "Couldn't find dialog.", "Nix", MB_OK) ;
@ -104,7 +111,7 @@ BOOL CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
int ic ; int ic ;
char *psz, szMsg[256] ; char *psz, szMsg[256] ;
static RUNFILEDLGPARAMS *prfdp = NULL ; static RUNFILEDLGPARAMS *prfdp = NULL ;
switch (message) switch (message)
{ {
case WM_INITDIALOG : case WM_INITDIALOG :
@ -115,12 +122,12 @@ BOOL CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
FillList (GetDlgItem (hwnd, 12298), NULL) ; FillList (GetDlgItem (hwnd, 12298), NULL) ;
SetFocus (GetDlgItem (hwnd, 12298)) ; SetFocus (GetDlgItem (hwnd, 12298)) ;
return TRUE ; return TRUE ;
case WM_COMMAND : case WM_COMMAND :
{ {
STARTUPINFOA si ; STARTUPINFOA si ;
PROCESS_INFORMATION pi ; PROCESS_INFORMATION pi ;
si.cb = sizeof (STARTUPINFOA) ; si.cb = sizeof (STARTUPINFOA) ;
si.lpReserved = NULL ; si.lpReserved = NULL ;
si.lpDesktop = NULL ; si.lpDesktop = NULL ;
@ -135,7 +142,7 @@ BOOL CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
si.dwFlags = 0 ; si.dwFlags = 0 ;
si.cbReserved2 = 0 ; si.cbReserved2 = 0 ;
si.lpReserved2 = NULL ; si.lpReserved2 = NULL ;
switch (LOWORD (wParam)) switch (LOWORD (wParam))
{ {
case IDOK : case IDOK :
@ -145,7 +152,7 @@ BOOL CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{ {
psz = malloc (ic + 2) ; psz = malloc (ic + 2) ;
GetWindowTextA (htxt, psz, ic + 1) ; GetWindowTextA (htxt, psz, ic + 1) ;
if (!CreateProcessA (NULL, psz, NULL, NULL, TRUE, if (!CreateProcessA (NULL, psz, NULL, NULL, TRUE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi)) NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi))
{ {
@ -161,7 +168,7 @@ BOOL CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
sprintf (szMsg, "Error: %s", pszSysMsg) ; sprintf (szMsg, "Error: %s", pszSysMsg) ;
LocalFree ((HLOCAL)pszSysMsg) ; LocalFree ((HLOCAL)pszSysMsg) ;
MessageBoxA (hwnd, szMsg, "Nix", MB_OK | MB_ICONEXCLAMATION) ; MessageBoxA (hwnd, szMsg, "Nix", MB_OK | MB_ICONEXCLAMATION) ;
free (psz) ; free (psz) ;
SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
return TRUE ; return TRUE ;
@ -171,11 +178,11 @@ BOOL CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
EndDialog (hwnd, 0) ; EndDialog (hwnd, 0) ;
} }
} }
case IDCANCEL : case IDCANCEL :
EndDialog (hwnd, 0) ; EndDialog (hwnd, 0) ;
return TRUE ; return TRUE ;
case 12288 : case 12288 :
{ {
HMODULE hComdlg = (HMODULE)NULL ; HMODULE hComdlg = (HMODULE)NULL ;
@ -198,36 +205,36 @@ BOOL CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
"Browse", "Browse",
OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST, OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST,
0, 0,
0, 0,
(LPCSTR)NULL, (LPCSTR)NULL,
0, 0,
(LPOFNHOOKPROC)NULL, (LPOFNHOOKPROC)NULL,
(LPCSTR)NULL (LPCSTR)NULL
} ; } ;
ofn.hwndOwner = hwnd ; ofn.hwndOwner = hwnd ;
if ((HMODULE)NULL == (hComdlg = LoadLibraryExA ("comdlg32", (HANDLE)NULL, 0))) if ((HMODULE)NULL == (hComdlg = LoadLibraryExA ("comdlg32", (HANDLE)NULL, 0)))
{ {
MessageBoxA (hwnd, "Unable to display dialog box (LoadLibraryEx) !", "Nix", MB_OK | MB_ICONEXCLAMATION) ; MessageBoxA (hwnd, "Unable to display dialog box (LoadLibraryEx) !", "Nix", MB_OK | MB_ICONEXCLAMATION) ;
return TRUE ; return TRUE ;
} }
if ((LPFNOFN)NULL == (ofnProc = (LPFNOFN)GetProcAddress (hComdlg, "GetOpenFileNameA"))) if ((LPFNOFN)NULL == (ofnProc = (LPFNOFN)GetProcAddress (hComdlg, "GetOpenFileNameA")))
{ {
MessageBoxA (hwnd, "Unable to display dialog box (GetProcAddress) !", "Nix", MB_OK | MB_ICONEXCLAMATION) ; MessageBoxA (hwnd, "Unable to display dialog box (GetProcAddress) !", "Nix", MB_OK | MB_ICONEXCLAMATION) ;
return TRUE ; return TRUE ;
} }
ofnProc (&ofn) ; ofnProc (&ofn) ;
SetFocus (GetDlgItem (hwnd, IDOK)) ; SetFocus (GetDlgItem (hwnd, IDOK)) ;
SetWindowTextA (GetDlgItem (hwnd, 12298), szFName) ; SetWindowTextA (GetDlgItem (hwnd, 12298), szFName) ;
SendMessageA (GetDlgItem (hwnd, 12298), CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; SendMessageA (GetDlgItem (hwnd, 12298), CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
SetFocus (GetDlgItem (hwnd, IDOK)) ; SetFocus (GetDlgItem (hwnd, IDOK)) ;
FreeLibrary (hComdlg) ; FreeLibrary (hComdlg) ;
return TRUE ; return TRUE ;
} }
} }
@ -245,14 +252,14 @@ void FillList (HWND hCb, char *pszLatest)
char *pszList = NULL, *pszCmd = NULL, cMatch = 0, cMax = 0x60, szIndex[2] = "-" ; char *pszList = NULL, *pszCmd = NULL, cMatch = 0, cMax = 0x60, szIndex[2] = "-" ;
DWORD icList = 0, icCmd = 0 ; DWORD icList = 0, icCmd = 0 ;
int Nix ; int Nix ;
SendMessageA (hCb, CB_RESETCONTENT, 0, 0) ; SendMessageA (hCb, CB_RESETCONTENT, 0, 0) ;
if (ERROR_SUCCESS != RegCreateKeyExA ( if (ERROR_SUCCESS != RegCreateKeyExA (
HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU", HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU",
0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL)) 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL))
MessageBoxA (hCb, "Unable to open registry key !", "Nix", MB_OK) ; MessageBoxA (hCb, "Unable to open registry key !", "Nix", MB_OK) ;
RegQueryValueExA (hkey, "MRUList", NULL, NULL, NULL, &icList) ; RegQueryValueExA (hkey, "MRUList", NULL, NULL, NULL, &icList) ;
if (icList > 0) if (icList > 0)
@ -266,20 +273,20 @@ void FillList (HWND hCb, char *pszLatest)
pszList = malloc (icList = 1) ; pszList = malloc (icList = 1) ;
pszList[0] = 0 ; pszList[0] = 0 ;
} }
for (Nix = 0 ; Nix < icList - 1 ; Nix++) for (Nix = 0 ; Nix < icList - 1 ; Nix++)
{ {
if (pszList[Nix] > cMax) if (pszList[Nix] > cMax)
cMax = pszList[Nix] ; cMax = pszList[Nix] ;
szIndex[0] = pszList[Nix] ; szIndex[0] = pszList[Nix] ;
if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, NULL, &icCmd)) if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, NULL, &icCmd))
MessageBoxA (hCb, "Unable to grab size of index", "Nix", MB_OK) ; MessageBoxA (hCb, "Unable to grab size of index", "Nix", MB_OK) ;
pszCmd = realloc (pszCmd, icCmd) ; pszCmd = realloc (pszCmd, icCmd) ;
if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, pszCmd, &icCmd)) if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, pszCmd, &icCmd))
MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK) ; MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK) ;
if (NULL != pszLatest) if (NULL != pszLatest)
{ {
if (!strcasecmp (pszCmd, pszLatest)) if (!strcasecmp (pszCmd, pszLatest))
@ -291,14 +298,14 @@ void FillList (HWND hCb, char *pszLatest)
SendMessageA (hCb, CB_INSERTSTRING, 0, (LPARAM)pszCmd) ; SendMessageA (hCb, CB_INSERTSTRING, 0, (LPARAM)pszCmd) ;
SetWindowTextA (hCb, pszCmd) ; SetWindowTextA (hCb, pszCmd) ;
SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
cMatch = pszList[Nix] ; cMatch = pszList[Nix] ;
memmove (&pszList[1], pszList, Nix) ; memmove (&pszList[1], pszList, Nix) ;
pszList[0] = cMatch ; pszList[0] = cMatch ;
continue ; continue ;
} }
} }
if (26 != icList - 1 || icList - 2 != Nix || cMatch || NULL == pszLatest) if (26 != icList - 1 || icList - 2 != Nix || cMatch || NULL == pszLatest)
{ {
/* /*
@ -311,7 +318,7 @@ void FillList (HWND hCb, char *pszLatest)
SetWindowTextA (hCb, pszCmd) ; SetWindowTextA (hCb, pszCmd) ;
SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
} }
} }
else else
{ {
@ -322,7 +329,7 @@ void FillList (HWND hCb, char *pszLatest)
SendMessageA (hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest) ; SendMessageA (hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest) ;
SetWindowTextA (hCb, pszLatest) ; SetWindowTextA (hCb, pszLatest) ;
SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
cMatch = pszList[Nix] ; cMatch = pszList[Nix] ;
memmove (&pszList[1], pszList, Nix) ; memmove (&pszList[1], pszList, Nix) ;
pszList[0] = cMatch ; pszList[0] = cMatch ;
@ -340,7 +347,7 @@ void FillList (HWND hCb, char *pszLatest)
SendMessageA (hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest) ; SendMessageA (hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest) ;
SetWindowTextA (hCb, pszLatest) ; SetWindowTextA (hCb, pszLatest) ;
SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
cMatch = ++cMax ; cMatch = ++cMax ;
pszList = realloc (pszList, ++icList) ; pszList = realloc (pszList, ++icList) ;
memmove (&pszList[1], pszList, icList - 1) ; memmove (&pszList[1], pszList, icList - 1) ;
@ -350,8 +357,8 @@ void FillList (HWND hCb, char *pszLatest)
} }
RegSetValueExA (hkey, "MRUList", 0, REG_SZ, pszList, strlen (pszList) + 1) ; RegSetValueExA (hkey, "MRUList", 0, REG_SZ, pszList, strlen (pszList) + 1) ;
free (pszCmd) ; free (pszCmd) ;
free (pszList) ; free (pszList) ;
} }