SHELL32:RunFileDlg
Filip Navara
xnavara at volny.cz
Sun Jun 6 13:57:58 CDT 2004
Changelog:
RunFileDlg improvements:
- Support for RFF_NOBROWSE, RFF_NOLABEL and RFF_NODEFAULT flags.
- Properly take the parameters as unicode on Windows NT systems.
- Unicodified the whole function and corrected the prototype.
- Filip
-------------- next part --------------
--- dlls/shell32/dialogs.c 21 Jan 2004 18:38:53 -0000 1.6
+++ dlls/shell32/dialogs.c 6 Jun 2004 18:41:53 -0000
@@ -39,21 +39,21 @@
#include "undocshell.h"
typedef struct
- {
- HWND hwndOwner ;
- HICON hIcon ;
- LPCSTR lpstrDirectory ;
- LPCSTR lpstrTitle ;
- LPCSTR lpstrDescription ;
- UINT uFlags ;
- } RUNFILEDLGPARAMS ;
+{
+ HWND hwndOwner;
+ HICON hIcon;
+ LPCWSTR lpstrDirectory;
+ LPCWSTR lpstrTitle;
+ LPCWSTR lpstrDescription;
+ UINT uFlags;
+} RUNFILEDLGPARAMS;
-typedef BOOL (*LPFNOFN) (OPENFILENAMEA *) ;
+typedef BOOL (*LPFNOFN) (OPENFILENAMEW *) ;
WINE_DEFAULT_DEBUG_CHANNEL(shell);
-INT_PTR CALLBACK RunDlgProc (HWND, UINT, WPARAM, LPARAM) ;
-void FillList (HWND, char *) ;
+INT_PTR CALLBACK RunDlgProc(HWND, UINT, WPARAM, LPARAM);
+void FillList(HWND hCb, WCHAR *pszLatest, BOOL setDefault);
/*************************************************************************
* PickIconDlg [SHELL32.62]
@@ -74,20 +74,17 @@
* RunFileDlg [SHELL32.61]
*
* NOTES
- * Original name: RunFileDlg (exported by ordinal)
+ * The actual parameters are Unicode on Windows NT and ANSI on
+ * Windows 9x. This is handled in RunDlgProc.
*/
-void WINAPI RunFileDlg(
- HWND hwndOwner,
- HICON hIcon,
- LPCSTR lpstrDirectory,
- LPCSTR lpstrTitle,
- LPCSTR lpstrDescription,
- UINT uFlags)
+BOOL WINAPI RunFileDlg(HWND hwndOwner, HICON hIcon, LPCWSTR lpstrDirectory,
+ LPCWSTR lpstrTitle, LPCWSTR lpstrDescription,
+ UINT uFlags)
{
-
RUNFILEDLGPARAMS rfdp;
HRSRC hRes;
LPVOID template;
+
TRACE("\n");
rfdp.hwndOwner = hwndOwner;
@@ -97,117 +94,156 @@
rfdp.lpstrDescription = lpstrDescription;
rfdp.uFlags = uFlags;
- if(!(hRes = FindResourceA(shell32_hInstance, "SHELL_RUN_DLG", (LPSTR)RT_DIALOG)))
- {
- MessageBoxA (hwndOwner, "Couldn't find dialog.", "Nix", MB_OK) ;
- return;
- }
- if(!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
- {
- MessageBoxA (hwndOwner, "Couldn't load dialog.", "Nix", MB_OK) ;
- return;
- }
-
- DialogBoxIndirectParamA((HINSTANCE)GetWindowLongA( hwndOwner,
- GWL_HINSTANCE ),
- template, hwndOwner, RunDlgProc, (LPARAM)&rfdp);
+ if (!(hRes = FindResourceW(shell32_hInstance, L"SHELL_RUN_DLG", (LPWSTR)RT_DIALOG)))
+ {
+ return FALSE;
+ }
+ if (!(template = (LPVOID)LoadResource(shell32_hInstance, hRes)))
+ {
+ return FALSE;
+ }
+ return DialogBoxIndirectParamW((HINSTANCE)GetWindowLongW(hwndOwner, GWL_HINSTANCE),
+ template, hwndOwner, RunDlgProc, (LPARAM)&rfdp);
}
/* Dialog procedure for RunFileDlg */
-INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
- {
- int ic ;
- char *psz, szMsg[256] ;
- static RUNFILEDLGPARAMS *prfdp = NULL ;
-
+INT_PTR CALLBACK RunDlgProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
+{
switch (message)
+ {
+ case WM_INITDIALOG:
{
- case WM_INITDIALOG :
- prfdp = (RUNFILEDLGPARAMS *)lParam ;
- SetWindowTextA (hwnd, prfdp->lpstrTitle) ;
- SetClassLongA (hwnd, GCL_HICON, (LPARAM)prfdp->hIcon) ;
- SendMessageA (GetDlgItem (hwnd, 12297), STM_SETICON,
- (WPARAM)LoadIconA (NULL, (LPSTR)IDI_WINLOGO), 0);
- if (NULL != prfdp->lpstrDescription)
- {
- SetWindowTextA (GetDlgItem(hwnd, 12289), prfdp->lpstrDescription) ;
- }
- FillList (GetDlgItem (hwnd, 12298), NULL) ;
- SetFocus (GetDlgItem (hwnd, 12298)) ;
- return TRUE ;
+ RUNFILEDLGPARAMS *prfdp = (RUNFILEDLGPARAMS *)lParam;
+ HICON hIcon;
+ HWND hOkBtn, hCancelBtn, hBrowseBtn, hLabel;
+ RECT OkRect, CancelRect;
+
+ if (SHELL_OsIsUnicode())
+ {
+ if (prfdp->lpstrTitle != NULL)
+ SetWindowTextW(hwnd, prfdp->lpstrTitle);
+ if (prfdp->lpstrDescription != NULL)
+ SetWindowTextW(GetDlgItem(hwnd, 12289), prfdp->lpstrDescription);
+ }
+ else
+ {
+ if (prfdp->lpstrTitle != NULL)
+ SetWindowTextA(hwnd, (LPSTR)prfdp->lpstrTitle);
+ if (prfdp->lpstrDescription != NULL)
+ SetWindowTextA(GetDlgItem(hwnd, 12289), (LPSTR)prfdp->lpstrDescription);
+ }
+
+ hIcon = prfdp->hIcon == NULL ? LoadIconW(NULL, (LPWSTR)IDI_WINLOGO) : prfdp->hIcon;
+ SendMessageW(GetDlgItem(hwnd, 12297), STM_SETICON, (WPARAM)hIcon, 0);
+
+ if (prfdp->uFlags & RFF_NOBROWSE)
+ {
+ hOkBtn = GetDlgItem(hwnd, IDOK);
+ hCancelBtn = GetDlgItem(hwnd, IDCANCEL);
+ hBrowseBtn = GetDlgItem(hwnd, 12288);
+
+ GetWindowRect(hCancelBtn, &OkRect);
+ GetWindowRect(hBrowseBtn, &CancelRect);
+
+ SetWindowPos(hOkBtn, NULL, OkRect.left, OkRect.top, 0, 0, SWP_NOSIZE);
+ SetWindowPos(hCancelBtn, NULL, CancelRect.left, CancelRect.top, 0, 0, SWP_NOSIZE);
+ ShowWindow(hBrowseBtn, SW_HIDE);
+ }
- case WM_COMMAND :
+ if (prfdp->uFlags & RFF_NOLABEL)
{
- STARTUPINFOA si ;
- PROCESS_INFORMATION pi ;
+ hLabel = GetDlgItem(hwnd, 12305);
+ ShowWindow(hLabel, SW_HIDE);
+ }
- 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 ;
+ FillList(GetDlgItem(hwnd, 12298), NULL, !(prfdp->uFlags & RFF_NODEFAULT));
+ SetFocus(GetDlgItem(hwnd, 12298));
+
+ return TRUE;
+ }
- switch (LOWORD (wParam))
+ case WM_COMMAND:
+ {
+ switch (LOWORD(wParam))
+ {
+ case IDOK:
{
- case IDOK :
+ HWND htxt = NULL;
+ WCHAR *psz;
+ INT ic;
+ WCHAR szMsg[256];
+ STARTUPINFOW si;
+ PROCESS_INFORMATION pi;
+
+ htxt = GetDlgItem(hwnd, 12298);
+ if ((ic = GetWindowTextLengthW(htxt)))
{
- HWND htxt = NULL ;
- if ((ic = GetWindowTextLengthA (htxt = GetDlgItem (hwnd, 12298))))
- {
- psz = malloc (ic + 2) ;
- GetWindowTextA (htxt, psz, ic + 1) ;
+ psz = HeapAlloc(GetProcessHeap(), 0, (ic + 2) * sizeof(WCHAR));
+ GetWindowTextW(htxt, psz, ic + 1);
- if (!CreateProcessA (NULL, psz, NULL, NULL, TRUE,
+ /* FIXME: Send notification */
+
+ si.cb = sizeof(STARTUPINFOW);
+ 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;
+
+ /* FIXME: Should use ShellExecuteW */
+
+ if (!CreateProcessW(NULL, psz, NULL, NULL, TRUE,
NORMAL_PRIORITY_CLASS, NULL, NULL, &si, &pi))
- {
- char *pszSysMsg = NULL ;
- FormatMessageA (
+ {
+ WCHAR *pszSysMsg = NULL;
+ FormatMessageW(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, GetLastError (),
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
- (LPSTR)&pszSysMsg, 0, NULL
- ) ;
- sprintf (szMsg, "Error: %s", pszSysMsg) ;
- LocalFree ((HLOCAL)pszSysMsg) ;
- MessageBoxA (hwnd, szMsg, "Nix", MB_OK | MB_ICONEXCLAMATION) ;
-
- free (psz) ;
- SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
- return TRUE ;
- }
- FillList (htxt, psz) ;
- free (psz) ;
- EndDialog (hwnd, 0) ;
+ (LPWSTR)&pszSysMsg, 0, NULL);
+ swprintf(szMsg, L"Error: %s", pszSysMsg);
+ LocalFree((HLOCAL)pszSysMsg);
+ MessageBoxW(hwnd, szMsg, NULL, MB_OK | MB_ICONEXCLAMATION);
+
+ HeapFree(GetProcessHeap(), 0, psz);
+ SendMessageW(htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
+ return TRUE;
}
+ FillList(htxt, psz, FALSE);
+ HeapFree(GetProcessHeap(), 0, psz);
+ EndDialog(hwnd, TRUE);
}
+ return TRUE;
+ }
- case IDCANCEL :
- EndDialog (hwnd, 0) ;
- return TRUE ;
+ case IDCANCEL:
+ {
+ EndDialog(hwnd, FALSE);
+ return TRUE;
+ }
- case 12288 :
+ case 12288: /* Browse... */
+ {
+ HMODULE hComdlg = NULL;
+ LPFNOFN ofnProc = NULL;
+ static WCHAR szFName[1024] = L"", szFileTitle[256] = L"", szInitDir[768] = L"";
+ static OPENFILENAMEW ofn =
{
- HMODULE hComdlg = NULL ;
- LPFNOFN ofnProc = NULL ;
- static char szFName[1024] = "", szFileTitle[256] = "", szInitDir[768] = "" ;
- static OPENFILENAMEA ofn =
- {
- sizeof (OPENFILENAMEA),
+ sizeof(OPENFILENAMEW),
NULL,
NULL,
- "Executable Files\0*.exe\0All Files\0*.*\0\0\0\0",
+ L"Executable Files\0*.exe\0All Files\0*.*\0\0\0\0",
NULL,
0,
0,
@@ -215,8 +251,8 @@
1023,
szFileTitle,
255,
- (LPCSTR)szInitDir,
- "Browse",
+ (LPCWSTR)szInitDir,
+ L"Browse",
OFN_ENABLESIZING | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY | OFN_PATHMUSTEXIST,
0,
0,
@@ -224,159 +260,158 @@
0,
(LPOFNHOOKPROC)NULL,
NULL
- } ;
+ };
- ofn.hwndOwner = hwnd ;
+ ofn.hwndOwner = hwnd;
- if (NULL == (hComdlg = LoadLibraryExA ("comdlg32", NULL, 0)))
- {
- MessageBoxA (hwnd, "Unable to display dialog box (LoadLibraryEx) !", "Nix", MB_OK | MB_ICONEXCLAMATION) ;
- return TRUE ;
- }
+ if (NULL == (hComdlg = LoadLibraryExW(L"comdlg32", NULL, 0)))
+ {
+ MessageBoxW (hwnd, L"Unable to display dialog box (LoadLibraryEx) !", NULL, MB_OK | MB_ICONEXCLAMATION);
+ return TRUE;
+ }
- if ((LPFNOFN)NULL == (ofnProc = (LPFNOFN)GetProcAddress (hComdlg, "GetOpenFileNameA")))
- {
- MessageBoxA (hwnd, "Unable to display dialog box (GetProcAddress) !", "Nix", MB_OK | MB_ICONEXCLAMATION) ;
- return TRUE ;
- }
+ if ((LPFNOFN)NULL == (ofnProc = (LPFNOFN)GetProcAddress(hComdlg, "GetOpenFileNameW")))
+ {
+ MessageBoxW(hwnd, L"Unable to display dialog box (GetProcAddress) !", NULL, MB_OK | MB_ICONEXCLAMATION);
+ return TRUE;
+ }
- if (ofnProc (&ofn))
- {
- SetFocus (GetDlgItem (hwnd, IDOK)) ;
- SetWindowTextA (GetDlgItem (hwnd, 12298), szFName) ;
- SendMessageA (GetDlgItem (hwnd, 12298), CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
- SetFocus (GetDlgItem (hwnd, IDOK)) ;
- }
+ if (ofnProc(&ofn))
+ {
+ SetFocus(GetDlgItem (hwnd, IDOK));
+ SetWindowTextW(GetDlgItem(hwnd, 12298), szFName);
+ SendMessageW(GetDlgItem(hwnd, 12298), CB_SETEDITSEL, 0, MAKELPARAM (0, -1));
+ SetFocus(GetDlgItem(hwnd, IDOK));
+ }
- FreeLibrary (hComdlg) ;
+ FreeLibrary(hComdlg);
- return TRUE ;
- }
+ return TRUE;
}
- return TRUE ;
}
+ return TRUE;
}
- return FALSE ;
}
-/* This grabs the MRU list from the registry and fills the combo for the "Run" dialog above */
-void FillList (HWND hCb, char *pszLatest)
+ return FALSE;
+}
+
+/*************************************************************************
+ * FillList [Internal]
+ *
+ * Grabs the MRU list from the registry and fills the combo for the "Run"
+ * dialog above.
+ */
+
+void FillList(HWND hCb, WCHAR *pszLatest, BOOL setDefault)
+{
+ HKEY hkey;
+ WCHAR *pszList = NULL, *pszCmd = NULL, szIndex[2] = L"-";
+ char cMatch = 0, cMax = 0x60;
+ DWORD icList = 0, icCmd = 0;
+ UINT Nix;
+
+ SendMessageW(hCb, CB_RESETCONTENT, 0, 0);
+
+ if (ERROR_SUCCESS != RegCreateKeyExW (
+ HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU",
+ 0, L"", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL))
{
- HKEY hkey ;
-/* char szDbgMsg[256] = "" ; */
- char *pszList = NULL, *pszCmd = NULL, cMatch = 0, cMax = 0x60, szIndex[2] = "-" ;
- DWORD icList = 0, icCmd = 0 ;
- UINT Nix ;
-
- SendMessageA (hCb, CB_RESETCONTENT, 0, 0) ;
-
- if (ERROR_SUCCESS != RegCreateKeyExA (
- HKEY_CURRENT_USER, "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\RunMRU",
- 0, "", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, NULL, &hkey, NULL))
- MessageBoxA (hCb, "Unable to open registry key !", "Nix", MB_OK) ;
+ MessageBoxW(hCb, L"Unable to open registry key !", NULL, MB_OK);
+ }
- RegQueryValueExA (hkey, "MRUList", NULL, NULL, NULL, &icList) ;
+ RegQueryValueExW(hkey, L"MRUList", NULL, NULL, NULL, &icList);
if (icList > 0)
- {
- pszList = malloc (icList) ;
- if (ERROR_SUCCESS != RegQueryValueExA (hkey, "MRUList", NULL, NULL, pszList, &icList))
- MessageBoxA (hCb, "Unable to grab MRUList !", "Nix", MB_OK) ;
- }
+ {
+ pszList = HeapAlloc(GetProcessHeap(), 0, icList);
+ if (ERROR_SUCCESS != RegQueryValueExW (hkey, L"MRUList", NULL, NULL, (LPBYTE)pszList, &icList))
+ MessageBoxW(hCb, L"Unable to grab MRUList !", L"Nix", MB_OK);
+ }
else
- {
- pszList = malloc (icList = 1) ;
- pszList[0] = 0 ;
- }
+ {
+ pszList = HeapAlloc(GetProcessHeap(), 0, icList = sizeof(WCHAR));
+ pszList[0] = 0;
+ }
- for (Nix = 0 ; Nix < icList - 1 ; Nix++)
+ for (Nix = 0 ; Nix < (icList / sizeof(WCHAR)) - 1 ; Nix++)
{
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))
- MessageBoxA (hCb, "Unable to grab size of index", "Nix", MB_OK) ;
- pszCmd = realloc (pszCmd, icCmd) ;
- if (ERROR_SUCCESS != RegQueryValueExA (hkey, szIndex, NULL, NULL, pszCmd, &icCmd))
- MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK) ;
+ if (ERROR_SUCCESS != RegQueryValueExW (hkey, szIndex, NULL, NULL, NULL, &icCmd))
+ MessageBoxW(hCb, L"Unable to grab size of index", L"Nix", MB_OK);
+ if (pszCmd == NULL)
+ pszCmd = HeapAlloc(GetProcessHeap(), 0, icCmd);
+ else
+ pszCmd = HeapReAlloc(GetProcessHeap(), 0, pszCmd, icCmd);
+ if (ERROR_SUCCESS != RegQueryValueExW (hkey, szIndex, NULL, NULL, (LPBYTE)pszCmd, &icCmd))
+ MessageBoxW(hCb, L"Unable to grab index", L"Nix", MB_OK);
- if (NULL != pszLatest)
+ if (pszLatest != NULL)
+ {
+ if (!lstrcmpiW(pszCmd, pszLatest))
{
- if (!strcasecmp (pszCmd, pszLatest))
- {
- /*
- sprintf (szDbgMsg, "Found existing (%d).\n", Nix) ;
- MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ;
- */
- SendMessageA (hCb, CB_INSERTSTRING, 0, (LPARAM)pszCmd) ;
- SetWindowTextA (hCb, pszCmd) ;
- SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
-
- cMatch = pszList[Nix] ;
- memmove (&pszList[1], pszList, Nix) ;
- pszList[0] = cMatch ;
- continue ;
- }
+ SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszCmd);
+ if (setDefault)
+ SetWindowTextW(hCb, pszCmd);
+ SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
+
+ cMatch = pszList[Nix];
+ memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
+ pszList[0] = cMatch;
+ continue;
}
+ }
if (26 != icList - 1 || icList - 2 != Nix || cMatch || NULL == pszLatest)
- {
- /*
- sprintf (szDbgMsg, "Happily appending (%d).\n", Nix) ;
- MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ;
- */
- SendMessageA (hCb, CB_ADDSTRING, 0, (LPARAM)pszCmd) ;
+ {
+ SendMessageW(hCb, CB_ADDSTRING, 0, (LPARAM)pszCmd);
if (!Nix)
- {
- SetWindowTextA (hCb, pszCmd) ;
- SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
- }
-
- }
- else
{
- /*
- sprintf (szDbgMsg, "Doing loop thing.\n") ;
- MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ;
- */
- SendMessageA (hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest) ;
- SetWindowTextA (hCb, pszLatest) ;
- SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
-
- cMatch = pszList[Nix] ;
- memmove (&pszList[1], pszList, Nix) ;
- pszList[0] = cMatch ;
- szIndex[0] = cMatch ;
- RegSetValueExA (hkey, szIndex, 0, REG_SZ, pszLatest, strlen (pszLatest) + 1) ;
+ if (setDefault)
+ SetWindowTextW(hCb, pszCmd);
+ SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
}
}
-
- if (!cMatch && NULL != pszLatest)
+ else
{
- /*
- sprintf (szDbgMsg, "Simply inserting (increasing list).\n") ;
- MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ;
- */
- SendMessageA (hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest) ;
- SetWindowTextA (hCb, pszLatest) ;
- SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ;
-
- cMatch = ++cMax ;
- pszList = realloc (pszList, ++icList) ;
- memmove (&pszList[1], pszList, icList - 1) ;
- pszList[0] = cMatch ;
- szIndex[0] = cMatch ;
- RegSetValueExA (hkey, szIndex, 0, REG_SZ, pszLatest, strlen (pszLatest) + 1) ;
+ SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
+ if (setDefault)
+ SetWindowTextW(hCb, pszLatest);
+ SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
+
+ cMatch = pszList[Nix];
+ memmove(&pszList[1], pszList, Nix * sizeof(WCHAR));
+ pszList[0] = cMatch;
+ szIndex[0] = cMatch;
+ RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (strlenW (pszLatest) + 1) * sizeof(WCHAR));
}
+ }
- RegSetValueExA (hkey, "MRUList", 0, REG_SZ, pszList, strlen (pszList) + 1) ;
-
- free (pszCmd) ;
- free (pszList) ;
+ if (!cMatch && pszLatest != NULL)
+ {
+ SendMessageW(hCb, CB_INSERTSTRING, 0, (LPARAM)pszLatest);
+ if (setDefault)
+ SetWindowTextW(hCb, pszLatest);
+ SendMessageW(hCb, CB_SETEDITSEL, 0, MAKELPARAM(0, -1));
+
+ cMatch = ++cMax;
+ icList += sizeof(WCHAR);
+ pszList = HeapReAlloc(GetProcessHeap(), 0, pszList, icList);
+ memmove(&pszList[1], pszList, icList - sizeof(WCHAR));
+ pszList[0] = cMatch;
+ szIndex[0] = cMatch;
+ RegSetValueExW(hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, (strlenW (pszLatest) + 1) * sizeof(WCHAR));
}
+ RegSetValueExW(hkey, L"MRUList", 0, REG_SZ, (LPBYTE)pszList, (strlenW (pszList) + 1) * sizeof(WCHAR));
+
+ HeapFree(GetProcessHeap(), 0, pszCmd);
+ HeapFree(GetProcessHeap(), 0, pszList);
+}
/*************************************************************************
* RestartWindowsDialog [SHELL32.730]
--- dlls/shell32/shell32_Cs.rc 16 Jan 2004 23:39:01 -0000 1.2
+++ dlls/shell32/shell32_Cs.rc 6 Jun 2004 18:41:53 -0000
@@ -114,7 +114,7 @@
LISTBOX 99, 8, 65, 137, 82, LBS_NOTIFY | WS_VSCROLL | WS_BORDER
ICON "", 1088, 189, 10, 14, 16
LTEXT "", 100, 8, 10, 137, 33
- LTEXT "Wine je d¡lem:", 98, 8, 55, 137, 10
+ LTEXT "Wine je dílem:", 98, 8, 55, 137, 10
}
SHELL_RUN_DLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 0, 0, 227, 95
--- dlls/shell32/undocshell.h 16 Feb 2004 21:46:12 -0000 1.6
+++ dlls/shell32/undocshell.h 6 Jun 2004 18:41:55 -0000
@@ -112,8 +112,8 @@
typedef struct
{
NMHDR hdr;
- LPCSTR lpFile;
- LPCSTR lpDirectory;
+ LPCWSTR lpFile;
+ LPCWSTR lpDirectory;
int nShow;
} NM_RUNFILEDLG, * LPNM_RUNFILEDLG;
@@ -122,12 +122,12 @@
#define RF_CANCEL 0x01
#define RF_RETRY 0x02
-void WINAPI RunFileDlg(
+BOOL WINAPI RunFileDlg(
HWND hwndOwner,
HICON hIcon,
- LPCSTR lpstrDirectory,
- LPCSTR lpstrTitle,
- LPCSTR lpstrDescription,
+ LPCWSTR lpstrDirectory,
+ LPCWSTR lpstrTitle,
+ LPCWSTR lpstrDescription,
UINT uFlags);
void WINAPI ExitWindowsDialog(HWND hwndOwner);
More information about the wine-patches
mailing list