comdlg32: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
stable
Alexandre Julliard 2019-05-29 08:48:52 +02:00
parent e4e2e8e551
commit 2cfe907584
5 changed files with 51 additions and 56 deletions

View File

@ -3,6 +3,8 @@ IMPORTLIB = comdlg32
IMPORTS = uuid shell32 shlwapi comctl32 winspool user32 gdi32 advapi32
DELAYIMPORTS = ole32
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \
cdlg32.c \
colordlg.c \

View File

@ -45,9 +45,6 @@
*
*/
#include "config.h"
#include "wine/port.h"
#include <ctype.h>
#include <stdlib.h>
#include <stdarg.h>
@ -73,7 +70,6 @@
#include "filedlgbrowser.h"
#include "shlwapi.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
@ -315,7 +311,7 @@ static void filedlg_collect_places_pidls(FileOpenDlgInfos *fodInfos)
HRESULT hr;
WCHAR *str;
sprintfW(nameW, placeW, i);
swprintf(nameW, ARRAY_SIZE(nameW), placeW, i);
if (get_config_key_dword(hkey, nameW, &value))
{
hr = SHGetSpecialFolderLocation(NULL, value, &fodInfos->places[i]);
@ -1006,13 +1002,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));
}
@ -1664,7 +1660,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;
@ -1737,7 +1733,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;
@ -2300,7 +2296,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)
@ -2338,7 +2334,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
@ -2354,7 +2350,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;
@ -2426,7 +2422,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
@ -2457,7 +2453,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;
@ -2486,7 +2482,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;
@ -2534,7 +2530,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)
{
@ -2738,12 +2734,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';
@ -2752,10 +2748,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
{
@ -2768,7 +2764,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="" */
@ -4347,7 +4343,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, ARRAY_SIZE(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

@ -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);
}