[COMDLG32] Sync with Wine Staging 4.18. CORE-16441

This commit is contained in:
Amine Khaldi 2019-10-26 22:52:27 +01:00
parent 8addeea484
commit 5981ef3ecc
6 changed files with 56 additions and 61 deletions

View file

@ -45,9 +45,6 @@
*
*/
#include "config.h"
#include "wine/port.h"
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
@ -78,7 +75,6 @@
#include "filedlgbrowser.h"
#include "shlwapi.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
@ -324,7 +320,7 @@ static void filedlg_collect_places_pidls(FileOpenDlgInfos *fodInfos)
HRESULT hr;
WCHAR *str;
sprintfW(nameW, placeW, i);
swprintf(nameW, placeW, i);
if (get_config_key_dword(hkey, nameW, &value))
{
hr = SHGetSpecialFolderLocation(NULL, value, &fodInfos->places[i]);
@ -1032,13 +1028,13 @@ static INT_PTR FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPVOID result
COMDLG32_GetDisplayNameOf( fodInfos->ShellInfos.pidlAbsCurrent, buffer );
if (len)
{
p = buffer + strlenW(buffer);
p = buffer + lstrlenW(buffer);
*p++ = '\\';
SendMessageW( fodInfos->DlgInfos.hwndFileName, WM_GETTEXT, len + 1, (LPARAM)p );
}
if (fodInfos->unicode)
{
total = strlenW( buffer) + 1;
total = lstrlenW( buffer) + 1;
if (result) lstrcpynW( result, buffer, size );
TRACE( "CDM_GETFILEPATH: returning %u %s\n", total, debugstr_w(result));
}
@ -1690,7 +1686,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
{
/* 1. If win2000 or higher and filename contains a path, use it
in preference over the lpstrInitialDir */
if (win2000plus && *fodInfos->filename && strpbrkW(fodInfos->filename, szwSlash)) {
if (win2000plus && *fodInfos->filename && wcspbrk(fodInfos->filename, szwSlash)) {
WCHAR tmpBuf[MAX_PATH];
WCHAR *nameBit;
DWORD result;
@ -1783,7 +1779,7 @@ static LRESULT FILEDLG95_InitControls(HWND hwnd)
/* 3. All except w2k+: if filename contains a path use it */
if (!win2000plus && fodInfos->filename &&
*fodInfos->filename &&
strpbrkW(fodInfos->filename, szwSlash)) {
wcspbrk(fodInfos->filename, szwSlash)) {
WCHAR tmpBuf[MAX_PATH];
WCHAR *nameBit;
DWORD result;
@ -2346,7 +2342,7 @@ static WCHAR FILEDLG95_MRU_get_slot(LPCWSTR module_name, LPWSTR stored_path, PHK
continue;
}
if(!strcmpiW(module_name, value_data)){
if(!wcsicmp(module_name, value_data)){
if(!hkey_ret)
RegCloseKey(*hkey);
if(stored_path)
@ -2384,7 +2380,7 @@ static void FILEDLG95_MRU_save_filename(LPCWSTR filename)
WARN("GotModuleFileName failed: %d\n", GetLastError());
return;
}
module_name = strrchrW(module_path, '\\');
module_name = wcsrchr(module_path, '\\');
if(!module_name)
module_name = module_path;
else
@ -2400,7 +2396,7 @@ static void FILEDLG95_MRU_save_filename(LPCWSTR filename)
DWORD path_len, final_len;
/* use only the path segment of `filename' */
path_ends = strrchrW(filename, '\\');
path_ends = wcsrchr(filename, '\\');
path_len = path_ends - filename;
final_len = path_len + lstrlenW(module_name) + 2;
@ -2472,7 +2468,7 @@ static void FILEDLG95_MRU_load_filename(LPWSTR stored_path)
WARN("GotModuleFileName failed: %d\n", GetLastError());
return;
}
module_name = strrchrW(module_path, '\\');
module_name = wcsrchr(module_path, '\\');
if(!module_name)
module_name = module_path;
else
@ -2482,6 +2478,7 @@ static void FILEDLG95_MRU_load_filename(LPWSTR stored_path)
TRACE("got MRU path: %s\n", wine_dbgstr_w(stored_path));
}
#ifdef __REACTOS__
static const WCHAR s_subkey[] =
{
'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\',
@ -2699,7 +2696,8 @@ static void FILEDLG95_MRU_save_ext(LPCWSTR filename)
RegCloseKey(hOpenSaveMRT);
}
}
#endif
#endif /* __REACTOS__ */
void FILEDLG95_OnOpenMessage(HWND hwnd, int idCaption, int idText)
{
@ -2722,7 +2720,7 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf,
static const WCHAR szwInvalid[] = { '/',':','<','>','|', 0};
/* check for invalid chars */
if((strpbrkW(lpstrPathAndFile+3, szwInvalid) != NULL) && !(flags & OFN_NOVALIDATE))
if((wcspbrk(lpstrPathAndFile+3, szwInvalid) != NULL) && !(flags & OFN_NOVALIDATE))
{
FILEDLG95_OnOpenMessage(hwnd, IDS_INVALID_FILENAME_TITLE, IDS_INVALID_FILENAME);
return FALSE;
@ -2751,7 +2749,7 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf,
{
static const WCHAR wszWild[] = { '*', '?', 0 };
/* if the last element is a wildcard do a search */
if(strpbrkW(lpszTemp1, wszWild) != NULL)
if(wcspbrk(lpszTemp1, wszWild) != NULL)
{
nOpenAction = ONOPEN_SEARCH;
break;
@ -2799,7 +2797,7 @@ int FILEDLG95_ValidatePathAction(LPWSTR lpstrPathAndFile, IShellFolder **ppsf,
else if (!(flags & OFN_NOVALIDATE))
{
if(*lpszTemp || /* points to trailing null for last path element */
(lpwstrTemp[strlenW(lpwstrTemp)-1] == '\\')) /* or if last element ends in '\' */
(lpwstrTemp[lstrlenW(lpwstrTemp)-1] == '\\')) /* or if last element ends in '\' */
{
if(flags & OFN_PATHMUSTEXIST)
{
@ -3080,7 +3078,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
/* update dialog data */
SetWindowTextW(fodInfos->DlgInfos.hwndFileName, PathFindFileNameW(lpstrPathAndFile));
#else
#else /* __REACTOS__ */
if (! *ext && fodInfos->defext)
{
/* if no extension is specified with file name, then */
@ -3099,12 +3097,12 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
{
WCHAR* filterSearchIndex;
filterExt = heap_alloc((lstrlenW(lpstrFilter) + 1) * sizeof(WCHAR));
strcpyW(filterExt, lpstrFilter);
lstrcpyW(filterExt, lpstrFilter);
/* if a semicolon-separated list of file extensions was given, do not include the
semicolon or anything after it in the extension.
example: if filterExt was "*.abc;*.def", it will become "*.abc" */
filterSearchIndex = strchrW(filterExt, ';');
filterSearchIndex = wcschr(filterExt, ';');
if (filterSearchIndex)
{
filterSearchIndex[0] = '\0';
@ -3113,10 +3111,10 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
/* find the file extension by searching for the first dot in filterExt */
/* strip the * or anything else from the extension, "*.abc" becomes "abc" */
/* if the extension is invalid or contains a glob, ignore it */
filterSearchIndex = strchrW(filterExt, '.');
if (filterSearchIndex++ && !strchrW(filterSearchIndex, '*') && !strchrW(filterSearchIndex, '?'))
filterSearchIndex = wcschr(filterExt, '.');
if (filterSearchIndex++ && !wcschr(filterSearchIndex, '*') && !wcschr(filterSearchIndex, '?'))
{
strcpyW(filterExt, filterSearchIndex);
lstrcpyW(filterExt, filterSearchIndex);
}
else
{
@ -3129,7 +3127,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
{
/* use the default file extension */
filterExt = heap_alloc((lstrlenW(fodInfos->defext) + 1) * sizeof(WCHAR));
strcpyW(filterExt, fodInfos->defext);
lstrcpyW(filterExt, fodInfos->defext);
}
if (*filterExt) /* ignore filterExt="" */
@ -3154,7 +3152,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
else
fodInfos->ofnInfos->Flags |= OFN_EXTENSIONDIFFERENT;
}
#endif
#endif /* __REACTOS__ */
/* In Save dialog: check if the file already exists */
if (fodInfos->DlgInfos.dwDlgProp & FODPROP_SAVEDLG
@ -4695,7 +4693,7 @@ short WINAPI GetFileTitleW(LPCWSTR lpFile, LPWSTR lpTitle, WORD cbBuf)
if (len == 0)
return -1;
if(strpbrkW(lpFile, brkpoint))
if(wcspbrk(lpFile, brkpoint))
return -1;
len--;

View file

@ -28,7 +28,6 @@
#include "winnls.h"
#include "wingdi.h"
#include "winuser.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "winreg.h"
@ -107,13 +106,13 @@ static void FD31_StripEditControl(HWND hwnd)
WCHAR temp[BUFFILE], *cp;
GetDlgItemTextW( hwnd, edt1, temp, ARRAY_SIZE(temp));
cp = strrchrW(temp, '\\');
cp = wcsrchr(temp, '\\');
if (cp != NULL) {
strcpyW(temp, cp+1);
lstrcpyW(temp, cp+1);
}
cp = strrchrW(temp, ':');
cp = wcsrchr(temp, ':');
if (cp != NULL) {
strcpyW(temp, cp+1);
lstrcpyW(temp, cp+1);
}
/* FIXME: shouldn't we do something with the result here? ;-) */
}
@ -200,7 +199,7 @@ static BOOL FD31_ScanDir(const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath)
TRACE("Using filter %s\n", debugstr_w(filter));
SendMessageW(hdlg, LB_RESETCONTENT, 0, 0);
while (filter) {
scptr = strchrW(filter, ';');
scptr = wcschr(filter, ';');
if (scptr) *scptr = 0;
while (*filter == ' ') filter++;
TRACE("Using file spec %s\n", debugstr_w(filter));
@ -211,7 +210,7 @@ static BOOL FD31_ScanDir(const OPENFILENAMEW *ofn, HWND hWnd, LPCWSTR newPath)
}
/* list of directories */
strcpyW(buffer, FILE_star);
lstrcpyW(buffer, FILE_star);
if (GetDlgItem(hWnd, lst2) != 0) {
lRet = DlgDirListW(hWnd, buffer, lst2, stc1, DDL_EXCLUSIVE | DDL_DIRECTORY);
@ -342,7 +341,7 @@ static void FD31_UpdateResult(const FD31_DATA *lfs, const WCHAR *tmpstr)
tmpstr2[0] = '\0';
else
GetCurrentDirectoryW(BUFFILE, tmpstr2);
lenstr2 = strlenW(tmpstr2);
lenstr2 = lstrlenW(tmpstr2);
if (lenstr2 > 3)
tmpstr2[lenstr2++]='\\';
lstrcpynW(tmpstr2+lenstr2, tmpstr, BUFFILE-lenstr2);
@ -422,15 +421,15 @@ static LRESULT FD31_DirListDblClick( const FD31_DATA *lfs )
pstr = heap_alloc(BUFFILEALLOC);
SendDlgItemMessageW(hWnd, lst2, LB_GETTEXT, lRet,
(LPARAM)pstr);
strcpyW( tmpstr, pstr );
lstrcpyW( tmpstr, pstr );
heap_free(pstr);
/* get the selected directory in tmpstr */
if (tmpstr[0] == '[')
{
tmpstr[lstrlenW(tmpstr) - 1] = 0;
strcpyW(tmpstr,tmpstr+1);
lstrcpyW(tmpstr,tmpstr+1);
}
strcatW(tmpstr, FILE_bslash);
lstrcatW(tmpstr, FILE_bslash);
FD31_ScanDir(lfs->ofnW, hWnd, tmpstr);
/* notify the app */
@ -486,11 +485,11 @@ static LRESULT FD31_TestPath( const FD31_DATA *lfs, LPWSTR path )
LPWSTR pBeginFileName, pstr2;
WCHAR tmpstr2[BUFFILE];
pBeginFileName = strrchrW(path, '\\');
pBeginFileName = wcsrchr(path, '\\');
if (pBeginFileName == NULL)
pBeginFileName = strrchrW(path, ':');
pBeginFileName = wcsrchr(path, ':');
if (strchrW(path,'*') != NULL || strchrW(path,'?') != NULL)
if (wcschr(path,'*') != NULL || wcschr(path,'?') != NULL)
{
/* edit control contains wildcards */
if (pBeginFileName != NULL)
@ -500,7 +499,7 @@ static LRESULT FD31_TestPath( const FD31_DATA *lfs, LPWSTR path )
}
else
{
strcpyW(tmpstr2, path);
lstrcpyW(tmpstr2, path);
if(!(lfs->ofnW->Flags & OFN_NOVALIDATE))
*path = 0;
}
@ -516,7 +515,7 @@ static LRESULT FD31_TestPath( const FD31_DATA *lfs, LPWSTR path )
pstr2 = path + lstrlenW(path);
if (pBeginFileName == NULL || *(pBeginFileName + 1) != 0)
strcatW(path, FILE_bslash);
lstrcatW(path, FILE_bslash);
/* if ScanDir succeeds, we have changed the directory */
if (FD31_ScanDir(lfs->ofnW, hWnd, path))
@ -538,7 +537,7 @@ static LRESULT FD31_TestPath( const FD31_DATA *lfs, LPWSTR path )
{
return FALSE;
}
strcpyW(path, tmpstr2);
lstrcpyW(path, tmpstr2);
}
else
SetDlgItemTextW( hWnd, edt1, path );
@ -602,7 +601,7 @@ static LRESULT FD31_Validate( const FD31_DATA *lfs, LPCWSTR path, UINT control,
if (ofnW->lpstrFile)
{
LPWSTR str = ofnW->lpstrFile;
LPWSTR ptr = strrchrW(str, '\\');
LPWSTR ptr = wcsrchr(str, '\\');
str[lstrlenW(str) + 1] = '\0';
*ptr = 0;
}

View file

@ -33,7 +33,6 @@
#include "dlgs.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "wine/unicode.h"
#include "cderr.h"
#include "cdlg.h"
@ -423,7 +422,7 @@ static BOOL AddFontSizeToCombo3(HWND hwnd, UINT h, const CHOOSEFONTW *lpcf)
if ( (!(lpcf->Flags & CF_LIMITSIZE)) ||
((lpcf->Flags & CF_LIMITSIZE) && (h >= lpcf->nSizeMin) && (h <= lpcf->nSizeMax)))
{
sprintfW(buffer, fontsizefmtW, h);
swprintf(buffer, fontsizefmtW, h);
j=SendMessageW(hwnd, CB_FINDSTRINGEXACT, -1, (LPARAM)buffer);
if (j==CB_ERR)
{
@ -905,7 +904,7 @@ static INT get_dialog_font_point_size(HWND hDlg, CHOOSEFONTW *cf)
WCHAR buffW[8], *endptrW;
GetDlgItemTextW(hDlg, cmb3, buffW, ARRAY_SIZE(buffW));
size = strtolW(buffW, &endptrW, 10);
size = wcstol(buffW, &endptrW, 10);
invalid_size = size == 0 && *endptrW;
if (size == 0)

View file

@ -1286,7 +1286,7 @@ static UINT ctrl_container_resize(FileDialogImpl *This, UINT container_width)
/* Move the controls to their final destination
*/
cur_col_pos = 0, cur_row_pos = 0;
cur_col_pos = 0; cur_row_pos = 0;
LIST_FOR_EACH_ENTRY(ctrl, &This->cctrls, customctrl, entry)
{
if(ctrl->cdcstate & CDCS_VISIBLE)

View file

@ -40,7 +40,6 @@
#include "objbase.h"
#include "commdlg.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "dlgs.h"
@ -157,7 +156,7 @@ static LPWSTR strdupW(LPCWSTR p)
DWORD len;
if(!p) return NULL;
len = (strlenW(p) + 1) * sizeof(WCHAR);
len = (lstrlenW(p) + 1) * sizeof(WCHAR);
ret = HeapAlloc(GetProcessHeap(), 0, len);
memcpy(ret, p, len);
return ret;
@ -527,7 +526,7 @@ static BOOL PRINTDLG_CreateDevNamesW(HGLOBAL *hmem, LPCWSTR DeviceDriverName,
DWORD dwBufLen = ARRAY_SIZE(bufW);
const WCHAR *p;
p = strrchrW( DeviceDriverName, '\\' );
p = wcsrchr( DeviceDriverName, '\\' );
if (p) DeviceDriverName = p + 1;
size = sizeof(WCHAR)*lstrlenW(DeviceDriverName) + 2
@ -2818,9 +2817,9 @@ static void pagesetup_set_devnames(pagesetup_data *data, LPCWSTR drv, LPCWSTR de
if(data->unicode)
{
drv_len = (strlenW(drv) + 1) * sizeof(WCHAR);
dev_len = (strlenW(devname) + 1) * sizeof(WCHAR);
port_len = (strlenW(port) + 1) * sizeof(WCHAR);
drv_len = (lstrlenW(drv) + 1) * sizeof(WCHAR);
dev_len = (lstrlenW(devname) + 1) * sizeof(WCHAR);
port_len = (lstrlenW(port) + 1) * sizeof(WCHAR);
}
else
{
@ -2842,15 +2841,15 @@ static void pagesetup_set_devnames(pagesetup_data *data, LPCWSTR drv, LPCWSTR de
WCHAR *ptr = (WCHAR *)(dn + 1);
len = sizeof(DEVNAMES) / sizeof(WCHAR);
dn->wDriverOffset = len;
strcpyW(ptr, drv);
lstrcpyW(ptr, drv);
ptr += drv_len / sizeof(WCHAR);
len += drv_len / sizeof(WCHAR);
dn->wDeviceOffset = len;
strcpyW(ptr, devname);
lstrcpyW(ptr, devname);
ptr += dev_len / sizeof(WCHAR);
len += dev_len / sizeof(WCHAR);
dn->wOutputOffset = len;
strcpyW(ptr, port);
lstrcpyW(ptr, port);
}
else
{
@ -3248,7 +3247,7 @@ static void margin_edit_notification(HWND hDlg, const pagesetup_data *data, WORD
WCHAR *end;
WCHAR decimal = get_decimal_sep();
val = strtolW(buf, &end, 10);
val = wcstol(buf, &end, 10);
if(end != buf || *end == decimal)
{
int mult = is_metric(data) ? 100 : 1000;
@ -3259,7 +3258,7 @@ static void margin_edit_notification(HWND hDlg, const pagesetup_data *data, WORD
{
end++;
mult /= 10;
if(isdigitW(*end))
if(iswdigit(*end))
val += (*end - '0') * mult;
else
break;
@ -3640,7 +3639,7 @@ static LRESULT CALLBACK pagesetup_margin_editproc(HWND hwnd, UINT msg, WPARAM wp
{
WCHAR decimal = get_decimal_sep();
WCHAR wc = (WCHAR)wparam;
if(!isdigitW(wc) && wc != decimal && wc != VK_BACK) return 0;
if(!iswdigit(wc) && wc != decimal && wc != VK_BACK) return 0;
}
return CallWindowProcW(edit_wndproc, hwnd, msg, wparam, lparam);
}

View file

@ -56,7 +56,7 @@ dll/win32/cabinet # Synced to WineStaging-4.18
dll/win32/clusapi # Synced to WineStaging-3.3
dll/win32/comcat # Synced to WineStaging-3.3
dll/win32/comctl32 # Synced to WineStaging-3.3
dll/win32/comdlg32 # Synced to WineStaging-4.0
dll/win32/comdlg32 # Synced to WineStaging-4.18
dll/win32/compstui # Synced to WineStaging-3.3
dll/win32/credui # Synced to WineStaging-4.0
dll/win32/crypt32 # Synced to WineStaging-4.0