diff --git a/dlls/shell32/Makefile.in b/dlls/shell32/Makefile.in index 8a37ee4822a..04dd196cfe8 100644 --- a/dlls/shell32/Makefile.in +++ b/dlls/shell32/Makefile.in @@ -6,6 +6,8 @@ DELAYIMPORTS = ole32 oleaut32 shdocvw version comctl32 gdiplus # AUTHORS file is in the top-level directory EXTRAINCL = -I$(top_srcdir) +EXTRADLLFLAGS = -mno-cygwin + C_SRCS = \ appbar.c \ assoc.c \ diff --git a/dlls/shell32/appbar.c b/dlls/shell32/appbar.c index c5bd3d46f44..40bafdbc98e 100644 --- a/dlls/shell32/appbar.c +++ b/dlls/shell32/appbar.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include @@ -32,7 +30,6 @@ #include "winuser.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(appbar); diff --git a/dlls/shell32/assoc.c b/dlls/shell32/assoc.c index 49751048f34..8b7fef000ed 100644 --- a/dlls/shell32/assoc.c +++ b/dlls/shell32/assoc.c @@ -30,7 +30,6 @@ #include "shobjidl.h" #include "shell32_main.h" #include "ver.h" -#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -395,7 +394,7 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This, if (pszCommand[0] == '"') { pszStart = pszCommand + 1; - pszEnd = strchrW(pszStart, '"'); + pszEnd = wcschr(pszStart, '"'); if (pszEnd) *pszEnd = 0; *len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL); @@ -403,7 +402,7 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This, else { pszStart = pszCommand; - for (pszEnd = pszStart; (pszEnd = strchrW(pszEnd, ' ')); pszEnd++) + for (pszEnd = pszStart; (pszEnd = wcschr(pszEnd, ' ')); pszEnd++) { WCHAR c = *pszEnd; *pszEnd = 0; @@ -529,7 +528,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString( hr = ASSOC_GetCommand(This, pszExtra, &command); if (SUCCEEDED(hr)) { - hr = ASSOC_ReturnString(flags, pszOut, pcchOut, command, strlenW(command) + 1); + hr = ASSOC_ReturnString(flags, pszOut, pcchOut, command, lstrlenW(command) + 1); heap_free(command); } return hr; @@ -553,7 +552,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString( /* hKeyProgID is NULL or there is no default value, so fail */ return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION); } - hr = ASSOC_ReturnString(flags, pszOut, pcchOut, docName, strlenW(docName) + 1); + hr = ASSOC_ReturnString(flags, pszOut, pcchOut, docName, lstrlenW(docName) + 1); heap_free(docName); return hr; } @@ -593,12 +592,12 @@ static HRESULT WINAPI IQueryAssociations_fnGetString( DWORD *langCodeDesc = (DWORD *)bufW; for (i = 0; i < flen / sizeof(DWORD); i++) { - sprintfW(fileDescW, fileDescFmtW, LOWORD(langCodeDesc[i]), + swprintf(fileDescW, ARRAY_SIZE(fileDescW), fileDescFmtW, LOWORD(langCodeDesc[i]), HIWORD(langCodeDesc[i])); if (VerQueryValueW(verinfoW, fileDescW, (LPVOID *)&bufW, &flen)) { - /* Does strlenW(bufW) == 0 mean we use the filename? */ - len = strlenW(bufW) + 1; + /* Does lstrlenW(bufW) == 0 mean we use the filename? */ + len = lstrlenW(bufW) + 1; TRACE("found FileDescription: %s\n", debugstr_w(bufW)); hr = ASSOC_ReturnString(flags, pszOut, pcchOut, bufW, len); heap_free(verinfoW); @@ -610,7 +609,7 @@ get_friendly_name_fail: PathRemoveExtensionW(path); PathStripPathW(path); TRACE("using filename: %s\n", debugstr_w(path)); - hr = ASSOC_ReturnString(flags, pszOut, pcchOut, path, strlenW(path) + 1); + hr = ASSOC_ReturnString(flags, pszOut, pcchOut, path, lstrlenW(path) + 1); heap_free(verinfoW); return hr; } @@ -631,7 +630,7 @@ get_friendly_name_fail: { ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, contentType, &size); if (ret == ERROR_SUCCESS) - hr = ASSOC_ReturnString(flags, pszOut, pcchOut, contentType, strlenW(contentType) + 1); + hr = ASSOC_ReturnString(flags, pszOut, pcchOut, contentType, lstrlenW(contentType) + 1); else hr = HRESULT_FROM_WIN32(ret); heap_free(contentType); @@ -657,7 +656,7 @@ get_friendly_name_fail: { ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, icon, &size); if (ret == ERROR_SUCCESS) - hr = ASSOC_ReturnString(flags, pszOut, pcchOut, icon, strlenW(icon) + 1); + hr = ASSOC_ReturnString(flags, pszOut, pcchOut, icon, lstrlenW(icon) + 1); else hr = HRESULT_FROM_WIN32(ret); heap_free(icon); @@ -667,7 +666,7 @@ get_friendly_name_fail: } else { /* there is no DefaultIcon subkey or hkeyProgID is NULL, so return the default document icon */ if (This->hkeyProgID == NULL) - hr = ASSOC_ReturnString(flags, pszOut, pcchOut, documentIcon, strlenW(documentIcon) + 1); + hr = ASSOC_ReturnString(flags, pszOut, pcchOut, documentIcon, lstrlenW(documentIcon) + 1); else return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION); } @@ -685,8 +684,8 @@ get_friendly_name_fail: hr = CLSIDFromString(pszExtra, &clsid); if (FAILED(hr)) return hr; - strcpyW(keypath, shellexW); - strcatW(keypath, pszExtra); + lstrcpyW(keypath, shellexW); + lstrcatW(keypath, pszExtra); ret = RegOpenKeyExW(This->hkeySource, keypath, 0, KEY_READ, &hkey); if (ret) return HRESULT_FROM_WIN32(ret); diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c index ac97527852d..d838a18dd77 100644 --- a/dlls/shell32/autocomplete.c +++ b/dlls/shell32/autocomplete.c @@ -25,7 +25,6 @@ - implement ACO_RTLREADING style - implement ACO_WORD_FILTER style */ -#include "config.h" #include #include @@ -48,8 +47,6 @@ #include "debughlp.h" #include "shell32_main.h" -#include "wine/unicode.h" - WINE_DEFAULT_DEBUG_CHANNEL(shell); typedef struct @@ -116,7 +113,7 @@ static inline WCHAR *filter_protocol(WCHAR *str) { static const WCHAR http[] = {'h','t','t','p'}; - if (!strncmpW(str, http, ARRAY_SIZE(http))) + if (!wcsncmp(str, http, ARRAY_SIZE(http))) { str += ARRAY_SIZE(http); str += (*str == 's'); /* https */ @@ -130,7 +127,7 @@ static inline WCHAR *filter_www(WCHAR *str) { static const WCHAR www[] = {'w','w','w','.'}; - if (!strncmpW(str, www, ARRAY_SIZE(www))) + if (!wcsncmp(str, www, ARRAY_SIZE(www))) return str + ARRAY_SIZE(www); return NULL; } @@ -147,7 +144,7 @@ static enum prefix_filtering get_text_prefix_filtering(const WCHAR *text) UINT i; for (i = 0; i < ARRAY_SIZE(buf) - 1 && text[i]; i++) - buf[i] = tolowerW(text[i]); + buf[i] = towlower(text[i]); buf[i] = '\0'; if (filter_protocol(buf)) return prefix_filtering_none; @@ -176,25 +173,25 @@ static inline int sort_strs_cmpfn_impl(WCHAR *a, WCHAR *b, enum prefix_filtering { WCHAR *str1 = filter_str_prefix(a, pfx_filter); WCHAR *str2 = filter_str_prefix(b, pfx_filter); - return strcmpiW(str1, str2); + return wcsicmp(str1, str2); } -static int sort_strs_cmpfn_none(const void *a, const void *b) +static int __cdecl sort_strs_cmpfn_none(const void *a, const void *b) { return sort_strs_cmpfn_impl(*(WCHAR* const*)a, *(WCHAR* const*)b, prefix_filtering_none); } -static int sort_strs_cmpfn_protocol(const void *a, const void *b) +static int __cdecl sort_strs_cmpfn_protocol(const void *a, const void *b) { return sort_strs_cmpfn_impl(*(WCHAR* const*)a, *(WCHAR* const*)b, prefix_filtering_protocol); } -static int sort_strs_cmpfn_all(const void *a, const void *b) +static int __cdecl sort_strs_cmpfn_all(const void *a, const void *b) { return sort_strs_cmpfn_impl(*(WCHAR* const*)a, *(WCHAR* const*)b, prefix_filtering_all); } -static int (*const sort_strs_cmpfn[])(const void*, const void*) = +static int (* __cdecl sort_strs_cmpfn[])(const void*, const void*) = { sort_strs_cmpfn_none, sort_strs_cmpfn_protocol, @@ -259,7 +256,7 @@ static UINT find_matching_enum_str(IAutoCompleteImpl *ac, UINT start, WCHAR *tex while (a < b) { UINT i = (a + b - 1) / 2; - int cmp = strncmpiW(text, filter_str_prefix(strs[i], pfx_filter), len); + int cmp = wcsnicmp(text, filter_str_prefix(strs[i], pfx_filter), len); if (cmp == 0) { index = i; @@ -351,7 +348,7 @@ static BOOL draw_listbox_item(IAutoCompleteImpl *ac, DRAWITEMSTRUCT *info, UINT str = ac->listbox_strs[info->itemID]; ExtTextOutW(hdc, info->rcItem.left + 1, info->rcItem.top, ETO_OPAQUE | ETO_CLIPPED, &info->rcItem, str, - strlenW(str), NULL); + lstrlenW(str), NULL); if (state & ODS_SELECTED) { @@ -400,7 +397,7 @@ static BOOL select_item_with_return_key(IAutoCompleteImpl *ac, HWND hwnd) if (sel >= 0) { text = ac->listbox_strs[sel]; - set_text_and_selection(ac, hwnd, text, 0, strlenW(text)); + set_text_and_selection(ac, hwnd, text, 0, lstrlenW(text)); hide_listbox(ac, hwndListBox, TRUE); ac->no_fwd_char = '\r'; /* RETURN char */ return TRUE; @@ -457,7 +454,7 @@ static LRESULT change_selection(IAutoCompleteImpl *ac, HWND hwnd, UINT key) SendMessageW(ac->hwndListBox, LB_SETCURSEL, sel, 0); msg = (sel >= 0) ? ac->listbox_strs[sel] : ac->txtbackup; - len = strlenW(msg); + len = lstrlenW(msg); set_text_and_selection(ac, hwnd, msg, len, len); return 0; @@ -493,23 +490,23 @@ static BOOL aclist_expand(IAutoCompleteImpl *ac, WCHAR *txt) if (!ac->enum_strs) old_txt = empty; /* skip the shared prefix */ - while ((c = tolowerW(txt[i])) == tolowerW(old_txt[i])) + while ((c = towlower(txt[i])) == towlower(old_txt[i])) { if (c == '\0') return FALSE; i++; } /* they differ at this point, check for a delim further in txt */ - for (last_delim = NULL, p = &txt[i]; (p = strpbrkW(p, delims)) != NULL; p++) + for (last_delim = NULL, p = &txt[i]; (p = wcspbrk(p, delims)) != NULL; p++) last_delim = p; if (last_delim) return do_aclist_expand(ac, txt, last_delim); /* txt has no delim after i, check for a delim further in old_txt */ - if (strpbrkW(&old_txt[i], delims)) + if (wcspbrk(&old_txt[i], delims)) { /* scan backwards to find the first delim before txt[i] (if any) */ while (i--) - if (strchrW(delims, txt[i])) + if (wcschr(delims, txt[i])) return do_aclist_expand(ac, txt, &txt[i]); /* Windows doesn't expand without a delim, but it does reset */ @@ -532,7 +529,7 @@ static void autoappend_str(IAutoCompleteImpl *ac, WCHAR *text, UINT len, WCHAR * /* The character capitalization can be different, so merge text and str into a new string */ - size = len + strlenW(&str[len]) + 1; + size = len + lstrlenW(&str[len]) + 1; if ((tmp = heap_alloc(size * sizeof(*tmp)))) { @@ -694,7 +691,7 @@ static LRESULT ACEditSubclassProc_KeyDown(IAutoCompleteImpl *ac, HWND hwnd, UINT if (!(text = heap_alloc((len + 1) * sizeof(WCHAR)))) return 0; len = SendMessageW(hwnd, WM_GETTEXT, len + 1, (LPARAM)text); - sz = strlenW(ac->quickComplete) + 1 + len; + sz = lstrlenW(ac->quickComplete) + 1 + len; if ((buf = heap_alloc(sz * sizeof(WCHAR)))) { @@ -860,7 +857,7 @@ static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, if (sel < 0) return 0; msg = This->listbox_strs[sel]; - set_text_and_selection(This, This->hwndEdit, msg, 0, strlenW(msg)); + set_text_and_selection(This, This->hwndEdit, msg, 0, lstrlenW(msg)); hide_listbox(This, hwnd, TRUE); return 0; } @@ -1091,7 +1088,7 @@ static HRESULT WINAPI IAutoComplete2_fnInit( UINT i; /* pwszRegKeyPath contains the key as well as the value, so split it */ - value = strrchrW(pwzsRegKeyPath, '\\'); + value = wcsrchr(pwzsRegKeyPath, '\\'); len = value - pwzsRegKeyPath; if (value && (key = heap_alloc((len+1) * sizeof(*key))) != NULL) @@ -1127,7 +1124,7 @@ static HRESULT WINAPI IAutoComplete2_fnInit( if (!This->quickComplete && pwszQuickComplete) { - size_t len = strlenW(pwszQuickComplete)+1; + size_t len = lstrlenW(pwszQuickComplete)+1; if ((This->quickComplete = heap_alloc(len * sizeof(WCHAR))) != NULL) memcpy(This->quickComplete, pwszQuickComplete, len * sizeof(WCHAR)); } @@ -1242,7 +1239,7 @@ static HRESULT WINAPI IAutoCompleteDropDown_fnGetDropDownStatus( if (sel >= 0) { WCHAR *str = This->listbox_strs[sel]; - size_t size = (strlenW(str) + 1) * sizeof(*str); + size_t size = (lstrlenW(str) + 1) * sizeof(*str); if (!(*ppwszString = CoTaskMemAlloc(size))) return E_OUTOFMEMORY; diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c index 188524d6a99..cea30902b4e 100644 --- a/dlls/shell32/brsfolder.c +++ b/dlls/shell32/brsfolder.c @@ -592,11 +592,11 @@ static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv item_data = (LPTV_ITEMDATA)item.lParam; SHGetPathFromIDListW(item_data->lpifq, old_path); - if(!(p = strrchrW(old_path, '\\'))) + if(!(p = wcsrchr(old_path, '\\'))) return 0; p = new_path+(p-old_path+1); memcpy(new_path, old_path, (p-new_path)*sizeof(WCHAR)); - strcpyW(p, pnmtv->item.pszText); + lstrcpyW(p, pnmtv->item.pszText); if(!MoveFileW(old_path, new_path)) return 0; @@ -824,7 +824,7 @@ static HRESULT BrsFolder_NewFolder(browse_info *info) goto cleanup; } - len = strlenW(name); + len = lstrlenW(name); if(len #include #include @@ -43,7 +40,6 @@ #include "shresdef.h" #include "shlwapi.h" #include "pidl.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -234,9 +230,9 @@ static BOOL HCR_RegGetDefaultIconW(HKEY hkey, LPWSTR szDest, DWORD len, int* pic lstrcpynW(szDest, sTemp, len); } if (ParseFieldW (szDest, 2, sNum, 5)) - *picon_idx = atoiW(sNum); - else - *picon_idx=0; /* sometimes the icon number is missing */ + *picon_idx = wcstol(sNum, NULL, 10); + else + *picon_idx=0; /* sometimes the icon number is missing */ ParseFieldW (szDest, 1, szDest, len); PathUnquoteSpacesW(szDest); return TRUE; diff --git a/dlls/shell32/clipboard.c b/dlls/shell32/clipboard.c index 82df5341536..578e933105b 100644 --- a/dlls/shell32/clipboard.c +++ b/dlls/shell32/clipboard.c @@ -47,7 +47,6 @@ #include "shell32_main.h" #include "shlwapi.h" -#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -74,12 +73,12 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl) SHGetPathFromIDListW(pidlRoot, wszRootPath); PathAddBackslashW(wszRootPath); - rootlen = strlenW(wszRootPath); + rootlen = lstrlenW(wszRootPath); for (i=0; ipFiles = offset * sizeof(WCHAR); pDropFiles->fWide = TRUE; - strcpyW(wszFileName, wszRootPath); + lstrcpyW(wszFileName, wszRootPath); for (i=0; i #include #include diff --git a/dlls/shell32/dde.c b/dlls/shell32/dde.c index c8b93d31f64..2186cbffe9e 100644 --- a/dlls/shell32/dde.c +++ b/dlls/shell32/dde.c @@ -32,7 +32,6 @@ #include "shell32_main.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -124,7 +123,7 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic, do { if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && - lstrcmpW(finddata.cFileName, dotW) && lstrcmpW(finddata.cFileName, dotdotW)) + wcscmp(finddata.cFileName, dotW) && wcscmp(finddata.cFileName, dotdotW)) { len += lstrlenW(finddata.cFileName) + 2; groups_data = heap_realloc(groups_data, len * sizeof(WCHAR)); @@ -173,7 +172,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) static WCHAR *last_group; - if (!strcmpiW(command, create_groupW)) + if (!wcsicmp(command, create_groupW)) { WCHAR *path; @@ -187,7 +186,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) heap_free(last_group); last_group = path; } - else if (!strcmpiW(command, delete_groupW)) + else if (!wcsicmp(command, delete_groupW)) { WCHAR *path, *path2; SHFILEOPSTRUCTW shfos = {0}; @@ -197,9 +196,9 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) path = get_programs_path(argv[0]); - path2 = heap_alloc((strlenW(path) + 2) * sizeof(*path)); - strcpyW(path2, path); - path2[strlenW(path) + 1] = 0; + path2 = heap_alloc((lstrlenW(path) + 2) * sizeof(*path)); + lstrcpyW(path2, path); + path2[lstrlenW(path) + 1] = 0; shfos.wFunc = FO_DELETE; shfos.pFrom = path2; @@ -212,7 +211,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (ret || shfos.fAnyOperationsAborted) return DDE_FNOTPROCESSED; } - else if (!strcmpiW(command, show_groupW)) + else if (!wcsicmp(command, show_groupW)) { WCHAR *path; @@ -227,7 +226,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) heap_free(last_group); last_group = path; } - else if (!strcmpiW(command, add_itemW)) + else if (!wcsicmp(command, add_itemW)) { WCHAR *path, *name; DWORD len; @@ -253,13 +252,13 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) heap_free(path); if (argc >= 2) IShellLinkW_SetDescription(link, argv[1]); - if (argc >= 4) IShellLinkW_SetIconLocation(link, argv[2], atoiW(argv[3])); + if (argc >= 4) IShellLinkW_SetIconLocation(link, argv[2], wcstol(argv[3], NULL, 10)); if (argc >= 7) IShellLinkW_SetWorkingDirectory(link, argv[6]); - if (argc >= 8) IShellLinkW_SetHotkey(link, atoiW(argv[7])); + if (argc >= 8) IShellLinkW_SetHotkey(link, wcstol(argv[7], NULL, 10)); if (argc >= 9) { - if (atoiW(argv[8]) == 0) IShellLinkW_SetShowCmd(link, SW_SHOWMINNOACTIVE); - else if (atoiW(argv[8]) == 1) IShellLinkW_SetShowCmd(link, SW_SHOWNORMAL); + if (wcstol(argv[8], NULL, 10) == 0) IShellLinkW_SetShowCmd(link, SW_SHOWMINNOACTIVE); + else if (wcstol(argv[8], NULL, 10) == 1) IShellLinkW_SetShowCmd(link, SW_SHOWNORMAL); } hres = IShellLinkW_QueryInterface(link, &IID_IPersistFile, (void **)&file); @@ -270,7 +269,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) } if (argc >= 2) { - name = heap_alloc((strlenW(last_group) + 1 + strlenW(argv[1]) + 5) * sizeof(*name)); + name = heap_alloc((lstrlenW(last_group) + 1 + lstrlenW(argv[1]) + 5) * sizeof(*name)); lstrcpyW(name, last_group); lstrcatW(name, slashW); lstrcatW(name, argv[1]); @@ -280,10 +279,10 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) { const WCHAR *filename = PathFindFileNameW(argv[0]); int len = PathFindExtensionW(filename) - filename; - name = heap_alloc((strlenW(last_group) + 1 + len + 5) * sizeof(*name)); + name = heap_alloc((lstrlenW(last_group) + 1 + len + 5) * sizeof(*name)); lstrcpyW(name, last_group); lstrcatW(name, slashW); - lstrcpynW(name+strlenW(name), filename, len + 1); + lstrcpynW(name+lstrlenW(name), filename, len + 1); lstrcatW(name, dotlnkW); } hres = IPersistFile_Save(file, name, TRUE); @@ -294,14 +293,14 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (FAILED(hres)) return DDE_FNOTPROCESSED; } - else if (!strcmpiW(command, delete_itemW) || !strcmpiW(command, replace_itemW)) + else if (!wcsicmp(command, delete_itemW) || !wcsicmp(command, replace_itemW)) { WCHAR *name; BOOL ret; if (argc < 1) return DDE_FNOTPROCESSED; - name = heap_alloc((strlenW(last_group) + 1 + strlenW(argv[0]) + 5) * sizeof(*name)); + name = heap_alloc((lstrlenW(last_group) + 1 + lstrlenW(argv[0]) + 5) * sizeof(*name)); lstrcpyW(name, last_group); lstrcatW(name, slashW); lstrcatW(name, argv[0]); @@ -313,7 +312,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv) if (!ret) return DDE_FNOTPROCESSED; } - else if (!strcmpiW(command, exit_progmanW)) + else if (!wcsicmp(command, exit_progmanW)) { /* do nothing */ } @@ -345,7 +344,7 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command) command++; while (*command == ' ') command++; - if (!(p = strpbrkW(command, opcode_end))) goto error; + if (!(p = wcspbrk(command, opcode_end))) goto error; opcode = strndupW(command, p - command); @@ -361,11 +360,11 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command) if (*command == '"') { command++; - if (!(p = strchrW(command, '"'))) goto error; + if (!(p = wcschr(command, '"'))) goto error; } else { - if (!(p = strpbrkW(command, param_end))) goto error; + if (!(p = wcspbrk(command, param_end))) goto error; while (p[-1] == ' ') p--; } diff --git a/dlls/shell32/dialogs.c b/dlls/shell32/dialogs.c index c6d8e95e966..f6291e3e55c 100644 --- a/dlls/shell32/dialogs.c +++ b/dlls/shell32/dialogs.c @@ -18,9 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -121,7 +118,7 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline) WCHAR *dest, *result, *result_end=NULL; static const WCHAR dotexeW[] = {'.','e','x','e',0}; - result = heap_alloc(sizeof(WCHAR)*(strlenW(cmdline)+5)); + result = heap_alloc(sizeof(WCHAR)*(lstrlenW(cmdline)+5)); src = cmdline; dest = result; @@ -139,12 +136,12 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline) else { while (*src) { - if (isspaceW(*src)) + if (iswspace(*src)) { *dest = 0; if (INVALID_FILE_ATTRIBUTES != GetFileAttributesW(result)) break; - strcatW(dest, dotexeW); + lstrcatW(dest, dotexeW); if (INVALID_FILE_ATTRIBUTES != GetFileAttributesW(result)) break; } @@ -267,7 +264,7 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_FILTER_EXE, filter_exe, 256); LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_FILTER_ALL, filter_all, 256); LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_CAPTION, szCaption, MAX_PATH); - snprintfW( filter, MAX_PATH, filterW, filter_exe, 0, 0, filter_all, 0, 0 ); + swprintf( filter, MAX_PATH, filterW, filter_exe, 0, 0, filter_all, 0, 0 ); ZeroMemory(&ofn, sizeof(ofn)); ofn.lStructSize = sizeof(OPENFILENAMEW); diff --git a/dlls/shell32/dragdrophelper.c b/dlls/shell32/dragdrophelper.c index 55a906afd53..53bbe46cb14 100644 --- a/dlls/shell32/dragdrophelper.c +++ b/dlls/shell32/dragdrophelper.c @@ -19,9 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include diff --git a/dlls/shell32/enumidlist.c b/dlls/shell32/enumidlist.c index 3c28426ce43..5bd4315d89f 100644 --- a/dlls/shell32/enumidlist.c +++ b/dlls/shell32/enumidlist.c @@ -25,7 +25,6 @@ #define COBJMACROS #include "wine/debug.h" -#include "wine/unicode.h" #include "windef.h" #include "winbase.h" #include "winreg.h" @@ -77,9 +76,9 @@ BOOL CreateFolderEnumList(IEnumIDListImpl *list, LPCWSTR lpszPath, DWORD dwFlags if(!lpszPath || !lpszPath[0]) return FALSE; - strcpyW(szPath, lpszPath); + lstrcpyW(szPath, lpszPath); PathAddBackslashW(szPath); - strcatW(szPath,stars); + lstrcatW(szPath,stars); hFile = FindFirstFileW(szPath,&stffile); if ( hFile != INVALID_HANDLE_VALUE ) @@ -93,7 +92,7 @@ BOOL CreateFolderEnumList(IEnumIDListImpl *list, LPCWSTR lpszPath, DWORD dwFlags { if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && dwFlags & SHCONTF_FOLDERS && - strcmpW(stffile.cFileName, dot) && strcmpW(stffile.cFileName, dotdot)) + wcscmp(stffile.cFileName, dot) && wcscmp(stffile.cFileName, dotdot)) { pidl = _ILCreateFromFindDataW(&stffile); succeeded = succeeded && AddToEnumList(list, pidl); diff --git a/dlls/shell32/folders.c b/dlls/shell32/folders.c index d42907513e8..e6b587d56f0 100644 --- a/dlls/shell32/folders.c +++ b/dlls/shell32/folders.c @@ -17,9 +17,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -148,7 +145,7 @@ static HRESULT getIconLocationForFolder(IExtractIconWImpl *This, UINT uFlags, LP WCHAR wszIconIndex[10]; SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, iconIndex, wszIconIndex, 10); - *piIndex = atoiW(wszIconIndex); + *piIndex = wcstol(wszIconIndex, NULL, 10); } else if (SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, clsid, wszCLSIDValue, CHARS_IN_GUID) && @@ -218,7 +215,7 @@ static HRESULT WINAPI IExtractIconW_fnGetIconLocation(IExtractIconW * iface, UIN '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0 }; WCHAR xriid[50]; - sprintfW(xriid, fmt, + swprintf(xriid, ARRAY_SIZE(xriid), fmt, riid->Data1, riid->Data2, riid->Data3, riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]); diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c index d1be5408fbb..f1d95e851eb 100644 --- a/dlls/shell32/iconcache.c +++ b/dlls/shell32/iconcache.c @@ -18,15 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include -#ifdef HAVE_UNISTD_H -# include -#endif #define COBJMACROS @@ -103,7 +97,7 @@ static INT CALLBACK SIC_CompareEntries( LPVOID p1, LPVOID p2, LPARAM lparam) (e1->dwFlags & GIL_FORSHORTCUT) != (e2->dwFlags & GIL_FORSHORTCUT)) return 1; - if (strcmpiW(e1->sSourceFile,e2->sSourceFile)) + if (wcsicmp(e1->sSourceFile,e2->sSourceFile)) return 1; return 0; @@ -129,7 +123,7 @@ HRESULT SIC_get_location( int list_idx, WCHAR *file, DWORD *size, int *res_idx ) if (dpa_idx != -1) { found = DPA_GetPtr( sic_hdpa, dpa_idx ); - needed = (strlenW( found->sSourceFile ) + 1) * sizeof(WCHAR); + needed = (lstrlenW( found->sSourceFile ) + 1) * sizeof(WCHAR); if (needed <= *size) { memcpy( file, found->sSourceFile, needed ); @@ -311,8 +305,8 @@ static INT SIC_IconAppend (const WCHAR *sourcefile, INT src_index, HICON *hicons entry = SHAlloc(sizeof(*entry)); GetFullPathNameW(sourcefile, MAX_PATH, path, NULL); - entry->sSourceFile = heap_alloc( (strlenW(path)+1)*sizeof(WCHAR) ); - strcpyW( entry->sSourceFile, path ); + entry->sSourceFile = heap_alloc( (lstrlenW(path)+1)*sizeof(WCHAR) ); + lstrcpyW( entry->sSourceFile, path ); entry->dwSourceIndex = src_index; entry->dwFlags = flags; @@ -422,7 +416,7 @@ static int get_shell_icon_size(void) if (!RegQueryValueExW( key, ShellIconSize, NULL, &type, (BYTE *)buf, &size ) && type == REG_SZ) { if (size == sizeof(buf)) buf[size / sizeof(WCHAR) - 1] = 0; - value = atoiW( buf ); + value = wcstol( buf, NULL, 10 ); } RegCloseKey( key ); } @@ -579,7 +573,7 @@ INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags ) */ static int SIC_LoadOverlayIcon(int icon_idx) { - WCHAR buffer[1024], wszIdx[8]; + WCHAR buffer[1024], wszIdx[12]; HKEY hKeyShellIcons; LPCWSTR iconPath; int iconIdx; @@ -598,12 +592,12 @@ static int SIC_LoadOverlayIcon(int icon_idx) { DWORD count = sizeof(buffer); - sprintfW(wszIdx, wszNumFmt, icon_idx); + swprintf(wszIdx, ARRAY_SIZE(wszIdx), wszNumFmt, icon_idx); /* read icon path and index */ if (RegQueryValueExW(hKeyShellIcons, wszIdx, NULL, NULL, (LPBYTE)buffer, &count) == ERROR_SUCCESS) { - LPWSTR p = strchrW(buffer, ','); + LPWSTR p = wcschr(buffer, ','); if (!p) { @@ -613,7 +607,7 @@ static int SIC_LoadOverlayIcon(int icon_idx) } *p++ = 0; iconPath = buffer; - iconIdx = atoiW(p); + iconIdx = wcstol(p, NULL, 10); } RegCloseKey(hKeyShellIcons); diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c index 41058bda043..7a9fbe1398a 100644 --- a/dlls/shell32/pidl.c +++ b/dlls/shell32/pidl.c @@ -22,9 +22,6 @@ * */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -1783,7 +1780,7 @@ LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew) if (pszDest) { strcpy(pszDest, "x:\\"); - pszDest[0]=toupperW(lpszNew[0]); + pszDest[0]=towupper(lpszNew[0]); TRACE("-- create Drive: %s\n", debugstr_a(pszDest)); } } diff --git a/dlls/shell32/recyclebin.c b/dlls/shell32/recyclebin.c index 6dc49d72c10..7db504c18cd 100644 --- a/dlls/shell32/recyclebin.c +++ b/dlls/shell32/recyclebin.c @@ -20,8 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #define COBJMACROS #define NONAMELESSUNION @@ -30,6 +28,7 @@ #include "winerror.h" #include "windef.h" #include "winbase.h" +#include "winternl.h" #include "winreg.h" #include "winuser.h" #include "shlwapi.h" @@ -89,9 +88,9 @@ static BOOL WINAPI init_trash_dirs( INIT_ONCE *once, void *param, void **context static const WCHAR trashW[] = {'\\','.','T','r','a','s','h',0}; if (!GetEnvironmentVariableW( homedirW, var, MAX_PATH )) return TRUE; - files = heap_alloc( (strlenW(var) + strlenW(trashW) + 1) * sizeof(WCHAR) ); - strcpyW( files, var ); - strcatW( files, trashW ); + files = heap_alloc( (lstrlenW(var) + lstrlenW(trashW) + 1) * sizeof(WCHAR) ); + lstrcpyW( files, var ); + lstrcatW( files, trashW ); files[1] = '\\'; /* change \??\ to \\?\ */ #else static const WCHAR dataW[] = {'X','D','G','_','D','A','T','A','_','H','O','M','E',0}; @@ -101,21 +100,23 @@ static BOOL WINAPI init_trash_dirs( INIT_ONCE *once, void *param, void **context static const WCHAR config_fmtW[] = {'\\','?','?','\\','u','n','i','x','%','s','/','T','r','a','s','h',0}; const WCHAR *fmt = config_fmtW; WCHAR *p; + ULONG len; if (!GetEnvironmentVariableW( dataW, var + 8, MAX_PATH - 8 ) || !var[8]) { if (!GetEnvironmentVariableW( homedirW, var, MAX_PATH )) return TRUE; fmt = home_fmtW; } - files = heap_alloc( (strlenW(var) + strlenW(fmt) + strlenW(filesW) + 1) * sizeof(WCHAR) ); - sprintfW( files, fmt, var ); + len = lstrlenW(var) + lstrlenW(fmt) + lstrlenW(filesW) + 1; + files = heap_alloc( len * sizeof(WCHAR) ); + swprintf( files, len, fmt, var ); files[1] = '\\'; /* change \??\ to \\?\ */ for (p = files; *p; p++) if (*p == '/') *p = '\\'; CreateDirectoryW( files, NULL ); - info = heap_alloc( (strlenW(var) + strlenW(fmt) + strlenW(infoW) + 1) * sizeof(WCHAR) ); - strcpyW( info, files ); - strcatW( files, filesW ); - strcatW( info, infoW ); + info = heap_alloc( len * sizeof(WCHAR) ); + lstrcpyW( info, files ); + lstrcatW( files, filesW ); + lstrcatW( info, infoW ); if (!CreateDirectoryW( info, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS) goto done; trash_info_dir = info; #endif @@ -265,34 +266,36 @@ BOOL trash_file( const WCHAR *path ) { WCHAR *dest = NULL, *file = PathFindFileNameW( path ); BOOL ret = TRUE; - ULONG i; + ULONG i, len; InitOnceExecuteOnce( &trash_dir_once, init_trash_dirs, NULL, NULL ); if (!trash_dir) return FALSE; - dest = heap_alloc( (strlenW(trash_dir) + strlenW(file) + 11) * sizeof(WCHAR) ); + len = lstrlenW(trash_dir) + lstrlenW(file) + 11; + dest = heap_alloc( len * sizeof(WCHAR) ); if (trash_info_dir) { static const WCHAR fmt[] = {'%','s','\\','%','s','.','t','r','a','s','h','i','n','f','o',0}; static const WCHAR fmt2[] = {'%','s','\\','%','s','-','%','0','8','x','.','t','r','a','s','h','i','n','f','o',0}; HANDLE handle; - WCHAR *info = heap_alloc( (strlenW(trash_info_dir) + strlenW(file) + 21) * sizeof(WCHAR) ); + ULONG infolen = lstrlenW(trash_info_dir) + lstrlenW(file) + 21; + WCHAR *info = heap_alloc( infolen * sizeof(WCHAR) ); - sprintfW( info, fmt, trash_info_dir, file ); + swprintf( info, infolen, fmt, trash_info_dir, file ); for (i = 0; i < 1000; i++) { handle = CreateFileW( info, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0 ); if (handle != INVALID_HANDLE_VALUE) break; - sprintfW( info, fmt2, trash_info_dir, file, RtlRandom( &random_seed )); + swprintf( info, infolen, fmt2, trash_info_dir, file, RtlRandom( &random_seed )); } if (handle != INVALID_HANDLE_VALUE) { if ((ret = write_trashinfo_file( handle, path ))) { static const WCHAR fmt[] = {'%','s','%','.','*','s',0}; - ULONG len = strlenW(info) - strlenW(trash_info_dir) - 10 /* .trashinfo */; - sprintfW( dest, fmt, trash_dir, len, info + strlenW(trash_info_dir) ); + ULONG namelen = lstrlenW(info) - lstrlenW(trash_info_dir) - 10 /* .trashinfo */; + swprintf( dest, len, fmt, trash_dir, namelen, info + lstrlenW(trash_info_dir) ); ret = MoveFileW( path, dest ); } CloseHandle( handle ); @@ -304,12 +307,12 @@ BOOL trash_file( const WCHAR *path ) static const WCHAR fmt[] = {'%','s','\\','%','s',0}; static const WCHAR fmt2[] = {'%','s','\\','%','s','-','%','0','8','x',0}; - sprintfW( dest, fmt, trash_dir, file ); + swprintf( dest, len, fmt, trash_dir, file ); for (i = 0; i < 1000; i++) { ret = MoveFileW( path, dest ); if (ret || GetLastError() != ERROR_ALREADY_EXISTS) break; - sprintfW( dest, fmt2, trash_dir, file, RtlRandom( &random_seed )); + swprintf( dest, len, fmt2, trash_dir, file, RtlRandom( &random_seed )); } } if (ret) TRACE( "%s -> %s\n", debugstr_w(path), debugstr_w(dest) ); @@ -323,18 +326,19 @@ static BOOL get_trash_item_info( const WCHAR *filename, WIN32_FIND_DATAW *data ) { static const WCHAR dsstoreW[] = {'.','D','S','_','S','t','o','r','e',0}; - return !!strcmpW( filename, dsstoreW ); + return !!wcscmp( filename, dsstoreW ); } else { static const WCHAR fmt[] = {'%','s','\\','%','s','.','t','r','a','s','h','i','n','f','o',0}; HANDLE handle; - WCHAR *info = heap_alloc( (strlenW(trash_info_dir) + strlenW(filename) + 12) * sizeof(WCHAR) ); + ULONG len = lstrlenW(trash_info_dir) + lstrlenW(filename) + 12; + WCHAR *info = heap_alloc( len * sizeof(WCHAR) ); - sprintfW( info, fmt, trash_info_dir, filename ); + swprintf( info, len, fmt, trash_info_dir, filename ); handle = CreateFileW( info, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 ); heap_free( info ); - if (handle != INVALID_HANDLE_VALUE) return FALSE; + if (handle == INVALID_HANDLE_VALUE) return FALSE; read_trashinfo_file( handle, data ); CloseHandle( handle ); return TRUE; @@ -347,14 +351,14 @@ static HRESULT add_trash_item( WIN32_FIND_DATAW *orig_data, LPITEMIDLIST **pidls ITEMIDLIST *pidl; WIN32_FIND_DATAW *data; const WCHAR *filename = orig_data->cFileName; - ULONG len = offsetof( ITEMIDLIST, mkid.abID[1 + sizeof(*data) + (strlenW(filename)+1) * sizeof(WCHAR)]); + ULONG len = offsetof( ITEMIDLIST, mkid.abID[1 + sizeof(*data) + (lstrlenW(filename)+1) * sizeof(WCHAR)]); if (!(pidl = SHAlloc( len + 2 ))) return E_OUTOFMEMORY; pidl->mkid.cb = len; pidl->mkid.abID[0] = 0; data = (WIN32_FIND_DATAW *)(pidl->mkid.abID + 1); memcpy( data, orig_data, sizeof(*data) ); - strcpyW( (WCHAR *)(data + 1), filename ); + lstrcpyW( (WCHAR *)(data + 1), filename ); *(USHORT *)((char *)pidl + len) = 0; if (get_trash_item_info( filename, data )) @@ -391,9 +395,9 @@ static HRESULT enum_trash_items( LPITEMIDLIST **pidls, int *ret_count ) InitOnceExecuteOnce( &trash_dir_once, init_trash_dirs, NULL, NULL ); if (!trash_dir) return E_FAIL; - file = heap_alloc( (strlenW(trash_dir) + strlenW(wildcardW) + 1) * sizeof(WCHAR) ); - strcpyW( file, trash_dir ); - strcatW( file, wildcardW ); + file = heap_alloc( (lstrlenW(trash_dir) + lstrlenW(wildcardW) + 1) * sizeof(WCHAR) ); + lstrcpyW( file, trash_dir ); + lstrcatW( file, wildcardW ); handle = FindFirstFileW( file, &data ); if (handle != INVALID_HANDLE_VALUE) { @@ -402,8 +406,8 @@ static HRESULT enum_trash_items( LPITEMIDLIST **pidls, int *ret_count ) static const WCHAR dotW[] = {'.',0}; static const WCHAR dotdotW[] = {'.','.',0}; - if (!strcmpW( data.cFileName, dotW )) continue; - if (!strcmpW( data.cFileName, dotdotW )) continue; + if (!wcscmp( data.cFileName, dotW )) continue; + if (!wcscmp( data.cFileName, dotdotW )) continue; hr = add_trash_item( &data, &ret, &count, &size ); } while (hr == S_OK && FindNextFileW( handle, &data )); FindClose( handle ); @@ -422,29 +426,31 @@ static HRESULT enum_trash_items( LPITEMIDLIST **pidls, int *ret_count ) static void remove_trashinfo( const WCHAR *filename ) { - static const WCHAR fmt[] = {'%','s','\\','%','s','.','t','r','a','s','h','i','n','f','o',0}; WCHAR *info; + ULONG len; if (!trash_info_dir) return; - info = heap_alloc( (strlenW(trash_info_dir) + strlenW(filename) + 12) * sizeof(WCHAR) ); - sprintfW( info, fmt, trash_info_dir, filename ); + len = lstrlenW(trash_info_dir) + lstrlenW(filename) + 12; + info = heap_alloc( len * sizeof(WCHAR) ); + swprintf( info, len, L"%s\\%s.trashinfo", trash_info_dir, filename ); DeleteFileW( info ); heap_free( info ); } static HRESULT restore_trash_item( LPCITEMIDLIST pidl ) { - static const WCHAR fmt[] = {'%','s','\\','%','s',0}; const WIN32_FIND_DATAW *data = get_trash_item_data( pidl ); WCHAR *from, *filename = (WCHAR *)(data + 1); + ULONG len; - if (!strchrW( data->cFileName, '\\' )) + if (!wcschr( data->cFileName, '\\' )) { FIXME( "original name for %s not available\n", debugstr_w(data->cFileName) ); return E_NOTIMPL; } - from = heap_alloc( (strlenW(trash_dir) + strlenW(filename) + 2) * sizeof(WCHAR) ); - sprintfW( from, fmt, trash_dir, filename ); + len = lstrlenW(trash_dir) + lstrlenW(filename) + 2; + from = heap_alloc( len * sizeof(WCHAR) ); + swprintf( from, len, L"%s\\%s", trash_dir, filename ); if (MoveFileW( from, data->cFileName )) remove_trashinfo( filename ); else WARN( "failed to restore %s to %s\n", debugstr_w(from), debugstr_w(data->cFileName) ); heap_free( from ); @@ -453,12 +459,12 @@ static HRESULT restore_trash_item( LPCITEMIDLIST pidl ) static HRESULT erase_trash_item( LPCITEMIDLIST pidl ) { - static const WCHAR fmt[] = {'%','s','\\','%','s',0}; const WIN32_FIND_DATAW *data = get_trash_item_data( pidl ); WCHAR *from, *filename = (WCHAR *)(data + 1); + ULONG len = lstrlenW(trash_dir) + lstrlenW(filename) + 2; - from = heap_alloc( (strlenW(trash_dir) + strlenW(filename) + 2) * sizeof(WCHAR) ); - sprintfW( from, fmt, trash_dir, filename ); + from = heap_alloc( len * sizeof(WCHAR) ); + swprintf( from, len, L"%s\\%s", trash_dir, filename ); if (DeleteFileW( from )) remove_trashinfo( filename ); heap_free( from ); return S_OK; @@ -1170,9 +1176,8 @@ static HRESULT erase_items(HWND parent,const LPCITEMIDLIST * apidl, UINT cidl, B } default: { - static const WCHAR format[]={'%','u','\0'}; LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_ERASEMULTIPLE, message, ARRAY_SIZE(message)); - sprintfW(arg,format,cidl); + swprintf(arg, ARRAY_SIZE(arg), L"%u", cidl); break; } diff --git a/dlls/shell32/shell32_main.c b/dlls/shell32/shell32_main.c index defa5f11a50..96eb37e1968 100644 --- a/dlls/shell32/shell32_main.c +++ b/dlls/shell32/shell32_main.c @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include @@ -51,7 +49,6 @@ #include "shfldr.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -290,7 +287,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, else { if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - strcatW (psfi->szTypeName, szFolder); + lstrcatW (psfi->szTypeName, szFolder); else { WCHAR sTemp[64]; @@ -307,7 +304,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, if (sTemp[0]) { lstrcpynW (psfi->szTypeName, sTemp, 64); - strcatW (psfi->szTypeName, szSpaceFile); + lstrcatW (psfi->szTypeName, szSpaceFile); } else { @@ -361,12 +358,12 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) && HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &psfi->iIcon)) { - if (lstrcmpW(p1W, sTemp)) - strcpyW(psfi->szDisplayName, sTemp); + if (wcscmp(p1W, sTemp)) + lstrcpyW(psfi->szDisplayName, sTemp); else { /* the icon is in the file */ - strcpyW(psfi->szDisplayName, szFullPath); + lstrcpyW(psfi->szDisplayName, szFullPath); } } else @@ -420,8 +417,8 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes, HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) && HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &icon_idx)) { - if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */ - strcpyW(sTemp, szFullPath); + if (!wcscmp(p1W,sTemp)) /* icon is in the file */ + lstrcpyW(sTemp, szFullPath); psfi->iIcon = SIC_GetIconIndex(sTemp, icon_idx, 0); if (psfi->iIcon == -1) @@ -891,12 +888,12 @@ static void add_authors( HWND list ) MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW ); strW[sizeW - 1] = 0; - start = strpbrkW( strW, eol ); /* skip the header line */ + start = wcspbrk( strW, eol ); /* skip the header line */ while (start) { - while (*start && strchrW( eol, *start )) start++; + while (*start && wcschr( eol, *start )) start++; if (!*start) break; - end = strpbrkW( start, eol ); + end = wcspbrk( start, eol ); if (end) *end++ = 0; SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start ); start = end; @@ -928,7 +925,7 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, "wine_get_build_id"); SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0); GetWindowTextW( hWnd, template, ARRAY_SIZE(template) ); - sprintfW( buffer, template, info->szApp ); + swprintf( buffer, ARRAY_SIZE(buffer), template, info->szApp ); SetWindowTextW( hWnd, buffer ); SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT1), info->szApp ); SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT2), info->szOtherStuff ); @@ -937,7 +934,7 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam, if (wine_get_build_id) { MultiByteToWideChar( CP_UTF8, 0, wine_get_build_id(), -1, version, ARRAY_SIZE(version) ); - sprintfW( buffer, template, version ); + swprintf( buffer, ARRAY_SIZE(buffer), template, version ); SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3), buffer ); } hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_LISTBOX); diff --git a/dlls/shell32/shell32_main.h b/dlls/shell32/shell32_main.h index 950110927c9..b98629298aa 100644 --- a/dlls/shell32/shell32_main.h +++ b/dlls/shell32/shell32_main.h @@ -36,7 +36,6 @@ #include "shlobj.h" #include "shellapi.h" #include "wine/heap.h" -#include "wine/unicode.h" #include "wine/list.h" /******************************************* diff --git a/dlls/shell32/shelldispatch.c b/dlls/shell32/shelldispatch.c index b0eefa59999..93f61144912 100644 --- a/dlls/shell32/shelldispatch.c +++ b/dlls/shell32/shelldispatch.c @@ -18,9 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #define COBJMACROS diff --git a/dlls/shell32/shellitem.c b/dlls/shell32/shellitem.c index 9d565ab0745..4693641d6ef 100644 --- a/dlls/shell32/shellitem.c +++ b/dlls/shell32/shellitem.c @@ -18,9 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include diff --git a/dlls/shell32/shelllink.c b/dlls/shell32/shelllink.c index 1a8eca3abe4..04643ebff7f 100644 --- a/dlls/shell32/shelllink.c +++ b/dlls/shell32/shelllink.c @@ -309,15 +309,15 @@ BOOL run_winemenubuilder( const WCHAR *args ) void *redir; GetSystemDirectoryW( app, MAX_PATH - ARRAY_SIZE(menubuilder) ); - strcatW( app, menubuilder ); + lstrcatW( app, menubuilder ); - len = (strlenW( app ) + strlenW( args ) + 1) * sizeof(WCHAR); + len = (lstrlenW( app ) + lstrlenW( args ) + 1) * sizeof(WCHAR); buffer = heap_alloc( len ); if( !buffer ) return FALSE; - strcpyW( buffer, app ); - strcatW( buffer, args ); + lstrcpyW( buffer, app ); + lstrcatW( buffer, args ); TRACE("starting %s\n",debugstr_w(buffer)); @@ -422,10 +422,10 @@ static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *f return S_FALSE; } - *filename = CoTaskMemAlloc((strlenW(This->filepath) + 1) * sizeof(WCHAR)); + *filename = CoTaskMemAlloc((lstrlenW(This->filepath) + 1) * sizeof(WCHAR)); if (!*filename) return E_OUTOFMEMORY; - strcpyW(*filename, This->filepath); + lstrcpyW(*filename, This->filepath); return S_OK; } @@ -1946,7 +1946,7 @@ static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, const W heap_free(This->sIcoPath); if (path) { - size_t len = (strlenW(path) + 1) * sizeof(WCHAR); + size_t len = (lstrlenW(path) + 1) * sizeof(WCHAR); This->sIcoPath = heap_alloc(len); if (!This->sIcoPath) return E_OUTOFMEMORY; @@ -2027,7 +2027,7 @@ static LPWSTR ShellLink_GetAdvertisedArg(LPCWSTR str) if( !str ) return NULL; - p = strchrW( str, ':' ); + p = wcschr( str, ':' ); if( !p ) return NULL; len = p - str; @@ -2059,7 +2059,7 @@ static HRESULT ShellLink_SetAdvertiseInfo(IShellLinkImpl *This, LPCWSTR str) str += 2; /* there must be a colon straight after a guid */ - p = strchrW( str, ':' ); + p = wcschr( str, ':' ); if( !p ) return E_FAIL; len = p - str; @@ -2083,7 +2083,7 @@ static HRESULT ShellLink_SetAdvertiseInfo(IShellLinkImpl *This, LPCWSTR str) return E_FAIL; /* skip to the next field */ - str = strchrW( str, ':' ); + str = wcschr( str, ':' ); if( !str ) return E_FAIL; } @@ -2137,7 +2137,7 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile } /* any other quote marks are invalid */ - if (strchrW(pszFile, '"')) + if (wcschr(pszFile, '"')) { heap_free(unquoted); return S_FALSE; @@ -2443,7 +2443,7 @@ ShellLink_QueryContextMenu( IContextMenu* iface, HMENU hmenu, UINT indexMenu, mii.cbSize = sizeof mii; mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; mii.dwTypeData = szOpen; - mii.cch = strlenW( mii.dwTypeData ); + mii.cch = lstrlenW( mii.dwTypeData ); mii.wID = idCmdFirst + id++; mii.fState = MFS_DEFAULT | MFS_ENABLED; mii.fType = MFT_STRING; diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c index 9870afe162e..d1f1afc3780 100644 --- a/dlls/shell32/shellole.c +++ b/dlls/shell32/shellole.c @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include @@ -42,7 +40,6 @@ #include "winerror.h" #include "undocshell.h" -#include "wine/unicode.h" #include "shell32_main.h" #include "wine/debug.h" @@ -668,7 +665,7 @@ UINT WINAPI DragQueryFileW( } } - i = strlenW(lpwDrop); + i = lstrlenW(lpwDrop); if ( !lpszwFile) goto end; /* needed buffer size */ lstrcpynW (lpszwFile, lpwDrop, lLength); end: diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c index 639576ca50d..c0a7303c705 100644 --- a/dlls/shell32/shellord.c +++ b/dlls/shell32/shellord.c @@ -19,7 +19,6 @@ * License along with this library; if not, write to the Free Software * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" #include #include @@ -2012,7 +2011,7 @@ BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, if (GetFileAttributesW(pszLinkTo) == INVALID_FILE_ATTRIBUTES) return FALSE; - basename = strrchrW(pszLinkTo, '\\'); + basename = wcsrchr(pszLinkTo, '\\'); if (basename) basename = basename+1; else @@ -2022,13 +2021,13 @@ BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName, if (!PathAddBackslashW(pszName)) return FALSE; - dst_basename = pszName + strlenW(pszName); + dst_basename = pszName + lstrlenW(pszName); - snprintfW(dst_basename, pszName + MAX_PATH - dst_basename, lnkformat, basename); + swprintf(dst_basename, pszName + MAX_PATH - dst_basename, lnkformat, basename); while (GetFileAttributesW(pszName) != INVALID_FILE_ATTRIBUTES) { - snprintfW(dst_basename, pszName + MAX_PATH - dst_basename, lnkformatnum, basename, i); + swprintf(dst_basename, pszName + MAX_PATH - dst_basename, lnkformatnum, basename, i); i++; } diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 4c8913b977c..876602b7585 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -26,16 +26,14 @@ #define COBJMACROS -#include "config.h" -#include "wine/port.h" - #include #include #include #include -#include "wine/debug.h" + #include "windef.h" #include "winbase.h" +#include "winternl.h" #include "winnls.h" #include "winreg.h" #include "wingdi.h" @@ -50,12 +48,12 @@ #include "shell32_main.h" #include "undocshell.h" #include "pidl.h" -#include "wine/unicode.h" #include "shlwapi.h" #include "sddl.h" #include "knownfolders.h" #include "initguid.h" #include "shobjidl.h" +#include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -398,7 +396,7 @@ static BOOL PathIsExeW (LPCWSTR lpszPath) TRACE("path=%s\n",debugstr_w(lpszPath)); for(i=0; lpszExtensions[i][0]; i++) - if (!strcmpiW(lpszExtension,lpszExtensions[i])) return TRUE; + if (!wcsicmp(lpszExtension,lpszExtensions[i])) return TRUE; return FALSE; } @@ -550,7 +548,7 @@ BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR sh file = longname ? longname : shortname; PathCombineW(pathW, path, file); - strcpyW(retW, pathW); + lstrcpyW(retW, pathW); PathRemoveExtensionW(pathW); ext = PathFindExtensionW(file); @@ -558,13 +556,11 @@ BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR sh /* now try to make it unique */ while (PathFileExistsW(retW)) { - static const WCHAR fmtW[] = {'%','s',' ','(','%','d',')','%','s',0}; - - sprintfW(retW, fmtW, pathW, i, ext); + swprintf(retW, ARRAY_SIZE(retW), L"%s (%d)%s", pathW, i, ext); i++; } - strcpyW(buffer, retW); + lstrcpyW(buffer, retW); TRACE("ret - %s\n", debugstr_w(buffer)); return TRUE; @@ -602,7 +598,7 @@ int WINAPI PathCleanupSpec( LPCWSTR lpszPathW, LPWSTR lpszFileW ) TRACE("Cleanup %s\n",debugstr_w(lpszFileW)); if (lpszPathW) - length = strlenW(lpszPathW); + length = lstrlenW(lpszPathW); while (*p) { @@ -788,8 +784,8 @@ static LONG PathProcessCommandW ( FIXME("(%s, %p, 0x%04x, 0x%04x) stub\n", debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags); if(!lpszPath) return -1; - if(lpszBuff) strcpyW(lpszBuff, lpszPath); - return strlenW(lpszPath); + if(lpszBuff) lstrcpyW(lpszBuff, lpszPath); + return lstrlenW(lpszPath); } /************************************************************************* @@ -3509,13 +3505,13 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix, if (userPrefix) { - strcpyW(shellFolderPath, userPrefix); + lstrcpyW(shellFolderPath, userPrefix); PathAddBackslashW(shellFolderPath); - strcatW(shellFolderPath, szSHFolders); + lstrcatW(shellFolderPath, szSHFolders); pShellFolderPath = shellFolderPath; - strcpyW(userShellFolderPath, userPrefix); + lstrcpyW(userShellFolderPath, userPrefix); PathAddBackslashW(userShellFolderPath); - strcatW(userShellFolderPath, szSHUserFolders); + lstrcatW(userShellFolderPath, szSHUserFolders); pUserShellFolderPath = userShellFolderPath; } else @@ -3552,7 +3548,7 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix, lstrcpynW(path, szTemp, MAX_PATH); } ret = RegSetValueExW(shellFolderKey, value, 0, REG_SZ, (LPBYTE)path, - (strlenW(path) + 1) * sizeof(WCHAR)); + (lstrlenW(path) + 1) * sizeof(WCHAR)); if (ret != ERROR_SUCCESS) hr = HRESULT_FROM_WIN32(ret); else @@ -3571,12 +3567,12 @@ static void append_relative_path(BYTE folder, WCHAR *pszPath) if (CSIDL_Data[folder].pszRelativePath) { PathAddBackslashW(pszPath); - strcatW(pszPath, CSIDL_Data[folder].pszRelativePath); + lstrcatW(pszPath, CSIDL_Data[folder].pszRelativePath); } else if (CSIDL_Data[folder].szDefaultPath) { PathAddBackslashW(pszPath); - strcatW(pszPath, CSIDL_Data[folder].szDefaultPath); + lstrcatW(pszPath, CSIDL_Data[folder].szDefaultPath); } } @@ -3628,16 +3624,16 @@ static HRESULT _SHGetDefaultValue(BYTE folder, LPWSTR pszPath) switch (CSIDL_Data[folder].type) { case CSIDL_Type_User: - strcpyW(pszPath, UserProfileW); + lstrcpyW(pszPath, UserProfileW); break; case CSIDL_Type_AllUsers: - strcpyW(pszPath, PublicProfileW); + lstrcpyW(pszPath, PublicProfileW); break; case CSIDL_Type_ProgramData: - strcpyW(pszPath, ProgramDataVarW); + lstrcpyW(pszPath, ProgramDataVarW); break; case CSIDL_Type_CurrVer: - strcpyW(pszPath, SystemDriveW); + lstrcpyW(pszPath, SystemDriveW); break; default: ; /* no corresponding env. var, do nothing */ @@ -3707,7 +3703,7 @@ static HRESULT _SHGetCurrentVersionPath(DWORD dwFlags, BYTE folder, /* fall through */ default: RegSetValueExW(hKey, CSIDL_Data[folder].szValueName, 0, dwType, - (LPBYTE)pszPath, (strlenW(pszPath)+1)*sizeof(WCHAR)); + (LPBYTE)pszPath, (lstrlenW(pszPath)+1)*sizeof(WCHAR)); } } else @@ -3905,7 +3901,7 @@ static HRESULT _SHGetProfilesValue(HKEY profilesKey, LPCWSTR szValueName, debugstr_w(szValue)); lRet = RegSetValueExW(profilesKey, szValueName, 0, REG_EXPAND_SZ, (LPBYTE)szValue, - (strlenW(szValue) + 1) * sizeof(WCHAR)); + (lstrlenW(szValue) + 1) * sizeof(WCHAR)); if (lRet) hr = HRESULT_FROM_WIN32(lRet); else @@ -3940,7 +3936,7 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest) /* short-circuit if there's nothing to expand */ if (szSrc[0] != '%') { - strcpyW(szDest, szSrc); + lstrcpyW(szDest, szSrc); hr = S_OK; goto end; } @@ -3952,38 +3948,38 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest) /* get the system drive */ GetSystemDirectoryW(def_val, MAX_PATH); - strcpyW( def_val + 3, szDefaultProfileDirW ); + lstrcpyW( def_val + 3, szDefaultProfileDirW ); hr = _SHGetProfilesValue(key, ProfilesDirectoryW, szProfilesPrefix, def_val ); } *szDest = 0; - strcpyW(szTemp, szSrc); + lstrcpyW(szTemp, szSrc); while (SUCCEEDED(hr) && szTemp[0] == '%') { - if (!strncmpiW(szTemp, AllUsersProfileW, strlenW(AllUsersProfileW))) + if (!wcsnicmp(szTemp, AllUsersProfileW, lstrlenW(AllUsersProfileW))) { WCHAR szAllUsers[MAX_PATH], def_val[MAX_PATH]; GetSystemDirectoryW(def_val, MAX_PATH); - strcpyW( def_val + 3, UsersPublicW ); + lstrcpyW( def_val + 3, UsersPublicW ); hr = _SHGetProfilesValue(key, PublicW, szAllUsers, def_val); PathAppendW(szDest, szAllUsers); - PathAppendW(szDest, szTemp + strlenW(AllUsersProfileW)); + PathAppendW(szDest, szTemp + lstrlenW(AllUsersProfileW)); } - else if (!strncmpiW(szTemp, PublicProfileW, strlenW(PublicProfileW))) + else if (!wcsnicmp(szTemp, PublicProfileW, lstrlenW(PublicProfileW))) { WCHAR szAllUsers[MAX_PATH], def_val[MAX_PATH]; GetSystemDirectoryW(def_val, MAX_PATH); - strcpyW( def_val + 3, UsersPublicW ); + lstrcpyW( def_val + 3, UsersPublicW ); hr = _SHGetProfilesValue(key, PublicW, szAllUsers, def_val); PathAppendW(szDest, szAllUsers); - PathAppendW(szDest, szTemp + strlenW(PublicProfileW)); + PathAppendW(szDest, szTemp + lstrlenW(PublicProfileW)); } - else if (!strncmpiW(szTemp, ProgramDataVarW, strlenW(ProgramDataVarW))) + else if (!wcsnicmp(szTemp, ProgramDataVarW, lstrlenW(ProgramDataVarW))) { WCHAR szProgramData[MAX_PATH], def_val[MAX_PATH]; HKEY shellFolderKey; @@ -4002,27 +3998,27 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest) if (!in_registry) { GetSystemDirectoryW(def_val, MAX_PATH); - strcpyW( def_val + 3, ProgramDataW ); + lstrcpyW( def_val + 3, ProgramDataW ); } hr = _SHGetProfilesValue(key, ProgramDataW, szProgramData, def_val); PathAppendW(szDest, szProgramData); - PathAppendW(szDest, szTemp + strlenW(ProgramDataVarW)); + PathAppendW(szDest, szTemp + lstrlenW(ProgramDataVarW)); } - else if (!strncmpiW(szTemp, UserProfileW, strlenW(UserProfileW))) + else if (!wcsnicmp(szTemp, UserProfileW, lstrlenW(UserProfileW))) { WCHAR userName[MAX_PATH]; DWORD userLen = MAX_PATH; - strcpyW(szDest, szProfilesPrefix); + lstrcpyW(szDest, szProfilesPrefix); GetUserNameW(userName, &userLen); PathAppendW(szDest, userName); - PathAppendW(szDest, szTemp + strlenW(UserProfileW)); + PathAppendW(szDest, szTemp + lstrlenW(UserProfileW)); } - else if (!strncmpiW(szTemp, SystemDriveW, strlenW(SystemDriveW))) + else if (!wcsnicmp(szTemp, SystemDriveW, lstrlenW(SystemDriveW))) { GetSystemDirectoryW(szDest, MAX_PATH); - strcpyW(szDest + 3, szTemp + strlenW(SystemDriveW) + 1); + lstrcpyW(szDest + 3, szTemp + lstrlenW(SystemDriveW) + 1); } else { @@ -4032,9 +4028,9 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest) hr = E_NOT_SUFFICIENT_BUFFER; else if (ret == 0) hr = HRESULT_FROM_WIN32(GetLastError()); - else if (!strcmpW( szTemp, szDest )) break; /* nothing expanded */ + else if (!wcscmp( szTemp, szDest )) break; /* nothing expanded */ } - if (SUCCEEDED(hr)) strcpyW(szTemp, szDest); + if (SUCCEEDED(hr)) lstrcpyW(szTemp, szDest); } end: if (key) @@ -4065,8 +4061,9 @@ static BOOL WINAPI init_xdg_dirs( INIT_ONCE *once, void *param, void **context ) if (!GetEnvironmentVariableW( homedirW, var, MAX_PATH )) return TRUE; fmt = home_fmtW; } - name = heap_alloc( (strlenW(var) + strlenW(fmt)) * sizeof(WCHAR) ); - sprintfW( name, fmt, var ); + len = lstrlenW(var) + lstrlenW(fmt); + name = heap_alloc( len * sizeof(WCHAR) ); + swprintf( name, len, fmt, var ); name[1] = '\\'; /* change \??\ to \\?\ */ for (ptr = name; *ptr; ptr++) if (*ptr == '/') *ptr = '\\'; @@ -4381,7 +4378,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirW( if (*szTemp == '%') hr = _SHExpandEnvironmentStrings(szTemp, szBuildPath); else - strcpyW(szBuildPath, szTemp); + lstrcpyW(szBuildPath, szTemp); if (FAILED(hr)) goto end; @@ -4397,7 +4394,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirW( } /* Copy the path if it's available before we might return */ if (SUCCEEDED(hr) && pszPath) - strcpyW(pszPath, szBuildPath); + lstrcpyW(pszPath, szBuildPath); /* if we don't care about existing directories we are ready */ if(nFolder & CSIDL_FLAG_DONT_VERIFY) goto end; @@ -4525,7 +4522,7 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, if (*path) { ret = RegSetValueExW(hUserKey, szValueName, 0, REG_EXPAND_SZ, - (LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR)); + (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR)); if (ret) hr = HRESULT_FROM_WIN32(ret); else @@ -4533,7 +4530,7 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken, hr = SHGetFolderPathW(NULL, folders[i] | CSIDL_FLAG_CREATE, hToken, SHGFP_TYPE_DEFAULT, path); ret = RegSetValueExW(hKey, szValueName, 0, REG_SZ, - (LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR)); + (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR)); if (ret) hr = HRESULT_FROM_WIN32(ret); } @@ -4598,13 +4595,13 @@ static HRESULT _SHRegisterUserShellFolders(BOOL bDefault) { hToken = (HANDLE)-1; hRootKey = HKEY_USERS; - strcpyW(userShellFolderPath, DefaultW); + lstrcpyW(userShellFolderPath, DefaultW); PathAddBackslashW(userShellFolderPath); - strcatW(userShellFolderPath, szSHUserFolders); + lstrcatW(userShellFolderPath, szSHUserFolders); pUserShellFolderPath = userShellFolderPath; - strcpyW(shellFolderPath, DefaultW); + lstrcpyW(shellFolderPath, DefaultW); PathAddBackslashW(shellFolderPath); - strcatW(shellFolderPath, szSHFolders); + lstrcatW(shellFolderPath, szSHFolders); pShellFolderPath = shellFolderPath; } else @@ -4673,10 +4670,10 @@ static HRESULT create_extra_folders(void) { size = sizeof(path); if (RegQueryValueExW( hkey, TEMPW, NULL, &type, (LPBYTE)path, &size )) - RegSetValueExW( hkey, TEMPW, 0, REG_SZ, (LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR) ); + RegSetValueExW( hkey, TEMPW, 0, REG_SZ, (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR) ); size = sizeof(path); if (RegQueryValueExW( hkey, TMPW, NULL, &type, (LPBYTE)path, &size )) - RegSetValueExW( hkey, TMPW, 0, REG_SZ, (LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR) ); + RegSetValueExW( hkey, TMPW, 0, REG_SZ, (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR) ); } RegCloseKey( hkey ); @@ -4740,9 +4737,9 @@ static HRESULT set_folder_attributes(void) for (i = 0; i < ARRAY_SIZE(folders); i++) { - strcpyW( buffer, clsidW ); - StringFromGUID2( folders[i].clsid, buffer + strlenW(buffer), 39 ); - strcatW( buffer, shellfolderW ); + lstrcpyW( buffer, clsidW ); + StringFromGUID2( folders[i].clsid, buffer + lstrlenW(buffer), 39 ); + lstrcatW( buffer, shellfolderW ); res = RegCreateKeyExW( HKEY_CLASSES_ROOT, buffer, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &hkey, NULL); if (res) return HRESULT_FROM_WIN32( res ); @@ -4965,10 +4962,10 @@ HRESULT WINAPI SHGetKnownFolderPath(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE t TRACE("Final path is %s, %#x\n", debugstr_w(pathW), hr); - *ret_path = CoTaskMemAlloc((strlenW(pathW) + 1) * sizeof(WCHAR)); + *ret_path = CoTaskMemAlloc((lstrlenW(pathW) + 1) * sizeof(WCHAR)); if (!*ret_path) return E_OUTOFMEMORY; - strcpyW(*ret_path, pathW); + lstrcpyW(*ret_path, pathW); return hr; } @@ -4988,12 +4985,12 @@ HRESULT WINAPI SHGetFolderPathEx(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE toke hr = SHGetKnownFolderPath( rfid, flags, token, &buffer ); if (SUCCEEDED( hr )) { - if (strlenW( buffer ) + 1 > len) + if (lstrlenW( buffer ) + 1 > len) { CoTaskMemFree( buffer ); return HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER ); } - strcpyW( path, buffer ); + lstrcpyW( path, buffer ); CoTaskMemFree( buffer ); } return hr; @@ -5796,7 +5793,7 @@ static HRESULT WINAPI foldermanager_GetFolderByName( heap_free( path ); if (FAILED( hr )) return hr; - found = !strcmpiW( pszCanonicalName, name ); + found = !wcsicmp( pszCanonicalName, name ); CoTaskMemFree( name ); if (found) break; } diff --git a/dlls/shell32/shellreg.c b/dlls/shell32/shellreg.c index 2ecd0af754a..751ebc31a00 100644 --- a/dlls/shell32/shellreg.c +++ b/dlls/shell32/shellreg.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include @@ -155,12 +153,8 @@ HRESULT WINAPI SHRegCloseKey (HKEY hkey) */ HRESULT WINAPI SHCreateSessionKey(REGSAM access, HKEY *hkey) { - static const WCHAR session_format[] = { - 'S','o','f','t','w','a','r','e','\\','M','i','c','r','o','s','o','f','t','\\', - 'W','i','n','d','o','w','s','\\','C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\', - 'E','x','p','l','o','r','e','r','\\','S','e','s','s','i','o','n','I','n','f','o','\\','%','u',0}; DWORD session, ret; - WCHAR str[ARRAY_SIZE(session_format) + 16]; + WCHAR str[ARRAY_SIZE(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\") + 16]; if (hkey) *hkey = NULL; @@ -171,7 +165,8 @@ HRESULT WINAPI SHCreateSessionKey(REGSAM access, HKEY *hkey) if (!ProcessIdToSessionId(GetCurrentProcessId(), &session)) return E_INVALIDARG; - sprintfW(str, session_format, session); + swprintf(str, ARRAY_SIZE(str), + L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\%u", session); TRACE("using session key %s\n", debugstr_w(str)); ret = RegCreateKeyExW(HKEY_CURRENT_USER, str, 0, NULL, REG_OPTION_VOLATILE, access, NULL, hkey, NULL); diff --git a/dlls/shell32/shellstring.c b/dlls/shell32/shellstring.c index 3b70a2a94b1..143679d6cf9 100644 --- a/dlls/shell32/shellstring.c +++ b/dlls/shell32/shellstring.c @@ -35,7 +35,6 @@ #include "shlwapi.h" #include "shell32_main.h" #include "undocshell.h" -#include "wine/unicode.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); @@ -155,8 +154,8 @@ static int StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString) TRACE("(%p, %p %s)\n", lpWideCharStr, lpWString, debugstr_w(lpWString)); - strcpyW (lpWideCharStr, lpWString ); - return strlenW(lpWideCharStr); + lstrcpyW (lpWideCharStr, lpWString ); + return lstrlenW(lpWideCharStr); } BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString) diff --git a/dlls/shell32/shfldr.h b/dlls/shell32/shfldr.h index 6ebd82bb1b6..e176d82de2f 100644 --- a/dlls/shell32/shfldr.h +++ b/dlls/shell32/shfldr.h @@ -74,7 +74,7 @@ static inline int SHELL32_GUIDToStringW (REFGUID guid, LPWSTR str) '%','0','2','x','%','0','2','x','-', '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x', '%','0','2','x','%','0','2','x','}',0 }; - return sprintfW(str, fmtW, + return swprintf(str, CHARS_IN_GUID, fmtW, guid->Data1, guid->Data2, guid->Data3, guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); diff --git a/dlls/shell32/shfldr_desktop.c b/dlls/shell32/shfldr_desktop.c index 60cea772b01..a90d3fcecf5 100644 --- a/dlls/shell32/shfldr_desktop.c +++ b/dlls/shell32/shfldr_desktop.c @@ -20,9 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -189,7 +186,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface, pidlTemp = _ILCreateMyComputer (); szNext = lpszDisplayName; } - else if (!strncmpW( lpszDisplayName, unix_root, 9 )) + else if (!wcsncmp( lpszDisplayName, unix_root, 9 )) { pidlTemp = _ILCreateGuid(PT_GUID, &CLSID_UnixDosFolder); szNext = lpszDisplayName; @@ -303,7 +300,7 @@ static void add_shell_namespace_extensions(IEnumIDListImpl *list, HKEY root) DWORD attributes, value_size = sizeof(attributes); /* Check if extension is configured as nonenumerable */ - sprintfW(clsidkeyW, clsidfmtW, guid); + swprintf(clsidkeyW, ARRAY_SIZE(clsidkeyW), clsidfmtW, guid); RegGetValueW(HKEY_CLASSES_ROOT, clsidkeyW, attributesW, RRF_RT_REG_DWORD | RRF_ZEROONFAILURE, NULL, &attributes, &value_size); @@ -603,7 +600,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface, { if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING)) - strcpyW(pszPath, This->sPathTarget); + lstrcpyW(pszPath, This->sPathTarget); else HCR_GetClassNameW(&CLSID_ShellDesktop, pszPath, MAX_PATH); } diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c index 2fa17dee1dc..0b680be046b 100644 --- a/dlls/shell32/shfldr_fs.c +++ b/dlls/shell32/shfldr_fs.c @@ -20,9 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -346,16 +343,16 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, lstrcpynW( szPath + len, lpszDisplayName + 1, MAX_PATH - len ); for (p = szPath + len; *p; p++) if (*p == '/') *p = '\\'; } - else if (!strncmpiW( lpszDisplayName, unix_root, 9 )) + else if (!wcsnicmp( lpszDisplayName, unix_root, 9 )) { lstrcpynW( szPath + len, lpszDisplayName + 9, MAX_PATH - len ); - if ((p = strchrW( szPath + len, '\\' ))) + if ((p = wcschr( szPath + len, '\\' ))) while (*p == '\\') *p++ = 0; szNext = p; } /* Special case for the root folder. */ - if (!strcmpiW( szPath, unix_root )) + if (!wcsicmp( szPath, unix_root )) { *ppidl = SHAlloc(sizeof(USHORT)); if (!*ppidl) return E_FAIL; @@ -371,7 +368,7 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) && fsbd) { find_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; - strcpyW( find_data.cFileName, szPath + len ); + lstrcpyW( find_data.cFileName, szPath + len ); pidlTemp = _ILCreateFromFindDataW( &find_data ); } if (pidlTemp) /* try to analyse the next element */ @@ -384,7 +381,7 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface, { if (FAILED( IFileSystemBindData_GetFindData( fsbd, &find_data ))) find_data.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; - strcpyW( find_data.cFileName, szPath + len ); + lstrcpyW( find_data.cFileName, szPath + len ); pidlTemp = _ILCreateFromFindDataW( &find_data ); } else hr = _ILCreateFromPathW(szPath, &pidlTemp); @@ -623,7 +620,7 @@ static HRESULT SHELL32_CreateExtensionUIObject(IShellFolder2 *iface, MultiByteToWideChar(CP_ACP, 0, extensionA, -1, extensionW, 20); - sprintfW(buf, formatW, extensionW, riid->Data1, riid->Data2, riid->Data3, + swprintf(buf, ARRAY_SIZE(buf), formatW, extensionW, riid->Data1, riid->Data2, riid->Data3, riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]); @@ -832,7 +829,7 @@ static void get_display_name( WCHAR dest[MAX_PATH], const WCHAR *path, LPCITEMID lstrcpynW( dest, path, MAX_PATH ); /* try to get a better path than the \\?\unix one */ - if (!strncmpiW( path, unix_root, 9 )) + if (!wcsnicmp( path, unix_root, 9 )) { if (!is_unix) { @@ -964,7 +961,7 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, /* pidl has to contain a single non-empty SHITEMID */ if (_ILIsDesktop(pidl) || !_ILIsPidlSimple(pidl) || !_ILGetTextPointer(pidl)) return E_INVALIDARG; - if (strpbrkW( lpName, invalid_chars )) return HRESULT_FROM_WIN32(ERROR_CANCELLED); + if (wcspbrk( lpName, invalid_chars )) return HRESULT_FROM_WIN32(ERROR_CANCELLED); /* build source path */ lstrcpynW(szSrc, This->sPathTarget, MAX_PATH); @@ -979,7 +976,7 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface, if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) { WCHAR *ext = PathFindExtensionW(szSrc); if(*ext != '\0') { - INT len = strlenW(szDest); + INT len = lstrlenW(szDest); lstrcpynW(szDest + len, ext, MAX_PATH - len); } } @@ -1168,7 +1165,7 @@ next: dwFetched) { _ILSimpleGetTextW (pidl, wszText, MAX_PATH); if (0 == lstrcmpiW (wszText, pwszName)) { - snprintfW (pwszName, uLen, wszFormat, wszNewFolder, i++); + swprintf (pwszName, uLen, wszFormat, wszNewFolder, i++); if (i > 99) { hr = E_FAIL; break; @@ -1242,7 +1239,7 @@ ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCWSTR pwszName, /* Cannot Create folder because of permissions */ LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_DENIED, wszTempText, ARRAY_SIZE(wszTempText)); LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_CAPTION, wszCaption, ARRAY_SIZE(wszCaption)); - sprintfW (wszText, wszTempText, wszNewDir); + swprintf (wszText, ARRAY_SIZE(wszText), wszTempText, wszNewDir); MessageBoxW (hwnd, wszText, wszCaption, MB_OK | MB_ICONEXCLAMATION); } @@ -1500,12 +1497,12 @@ IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface, LPCITEMIDLIST pidl) else { static const WCHAR unix_root[] = {'\\','\\','?','\\','u','n','i','x','\\',0}; - strcpyW( wszTemp, unix_root ); + lstrcpyW( wszTemp, unix_root ); } } else SHGetPathFromIDListW( pidl, wszTemp ); - if ((len = strlenW(wszTemp))) + if ((len = lstrlenW(wszTemp))) { This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR)); if (!This->sPathTarget) return E_OUTOFMEMORY; @@ -1581,14 +1578,14 @@ IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface, if (ppfti->csidl != -1) { if (SHGetSpecialFolderPathW (0, wszTemp, ppfti->csidl, ppfti->csidl & CSIDL_FLAG_CREATE)) { - int len = strlenW(wszTemp); + int len = lstrlenW(wszTemp); This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR)); if (!This->sPathTarget) return E_OUTOFMEMORY; memcpy(This->sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR)); } } else if (ppfti->szTargetParsingName[0]) { - int len = strlenW(ppfti->szTargetParsingName); + int len = lstrlenW(ppfti->szTargetParsingName); This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR)); if (!This->sPathTarget) return E_OUTOFMEMORY; @@ -1596,7 +1593,7 @@ IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface, (len + 1) * sizeof(WCHAR)); } else if (ppfti->pidlTargetFolder) { if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp)) { - int len = strlenW(wszTemp); + int len = lstrlenW(wszTemp); This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR)); if (!This->sPathTarget) return E_OUTOFMEMORY; diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c index 56d08cc87e9..004de03a088 100644 --- a/dlls/shell32/shfldr_mycomp.c +++ b/dlls/shell32/shfldr_mycomp.c @@ -19,9 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -699,10 +696,10 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface, GetVolumeInformationW (pszPath, wszDrive, ARRAY_SIZE(wszDrive) - 5, NULL, NULL, NULL, NULL, 0); - strcatW (wszDrive, wszOpenBracket); - lstrcpynW (wszDrive + strlenW(wszDrive), pszPath, 3); - strcatW (wszDrive, wszCloseBracket); - strcpyW (pszPath, wszDrive); + lstrcatW (wszDrive, wszOpenBracket); + lstrcpynW (wszDrive + lstrlenW(wszDrive), pszPath, 3); + lstrcatW (wszDrive, wszCloseBracket); + lstrcpyW (pszPath, wszDrive); } } else diff --git a/dlls/shell32/shfldr_netplaces.c b/dlls/shell32/shfldr_netplaces.c index be99b7f5875..460fa4745c9 100644 --- a/dlls/shell32/shfldr_netplaces.c +++ b/dlls/shell32/shfldr_netplaces.c @@ -20,9 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -40,7 +37,6 @@ #include "shell32_main.h" #include "shresdef.h" #include "wine/debug.h" -#include "wine/unicode.h" #include "debughlp.h" #include "shfldr.h" @@ -196,8 +192,8 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * ifac *ppidl = NULL; szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH); - len = strlenW(szElement); - if (len == ARRAY_SIZE(wszEntireNetwork) && !strncmpiW(szElement, wszEntireNetwork, ARRAY_SIZE(wszEntireNetwork))) + len = lstrlenW(szElement); + if (len == ARRAY_SIZE(wszEntireNetwork) && !wcsnicmp(szElement, wszEntireNetwork, ARRAY_SIZE(wszEntireNetwork))) { pidlTemp = _ILCreateEntireNetwork(); if (pidlTemp) diff --git a/dlls/shell32/shlexec.c b/dlls/shell32/shlexec.c index 49f7867ef7e..ba393ad7794 100644 --- a/dlls/shell32/shlexec.c +++ b/dlls/shell32/shlexec.c @@ -19,16 +19,10 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include #include -#ifdef HAVE_UNISTD_H -# include -#endif #include #include @@ -163,11 +157,11 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp else cmd = lpFile; - used += strlenW(cmd); + used += lstrlenW(cmd); if (used < len) { - strcpyW(res, cmd); - res += strlenW(cmd); + lstrcpyW(res, cmd); + res += lstrlenW(cmd); } } found_p1 = TRUE; @@ -181,11 +175,11 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp case 'l': case 'L': if (lpFile) { - used += strlenW(lpFile); + used += lstrlenW(lpFile); if (used < len) { - strcpyW(res, lpFile); - res += strlenW(lpFile); + lstrcpyW(res, lpFile); + res += lstrlenW(lpFile); } } found_p1 = TRUE; @@ -201,13 +195,13 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp LPVOID pv; HGLOBAL hmem = SHAllocShared(pidl, ILGetSize(pidl), 0); pv = SHLockShared(hmem, 0); - chars = sprintfW(buf, wszILPtr, pv); + chars = swprintf(buf, ARRAY_SIZE(buf), wszILPtr, pv); if (chars >= ARRAY_SIZE(buf)) ERR("pidl format buffer too small!\n"); used += chars; if (used < len) { - strcpyW(res,buf); + lstrcpyW(res,buf); res += chars; } SHUnlockShared(pv); @@ -221,7 +215,7 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp */ /* Make sure that we have at least one more %.*/ - if (strchrW(fmt, '%')) + if (wcschr(fmt, '%')) { WCHAR tmpBuffer[1024]; PWSTR tmpB = tmpBuffer; @@ -237,20 +231,20 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp envRet = GetEnvironmentVariableW(tmpBuffer, tmpEnvBuff, MAX_PATH); if (envRet == 0 || envRet > MAX_PATH) { - used += strlenW(tmpBuffer); + used += lstrlenW(tmpBuffer); if (used < len) { - strcpyW( res, tmpBuffer ); - res += strlenW(tmpBuffer); + lstrcpyW( res, tmpBuffer ); + res += lstrlenW(tmpBuffer); } } else { - used += strlenW(tmpEnvBuff); + used += lstrlenW(tmpEnvBuff); if (used < len) { - strcpyW( res, tmpEnvBuff ); - res += strlenW(tmpEnvBuff); + lstrcpyW( res, tmpEnvBuff ); + res += lstrlenW(tmpEnvBuff); } } } @@ -382,15 +376,15 @@ static void *SHELL_BuildEnvW( const WCHAR *path ) static const WCHAR wPath[] = {'P','A','T','H','=',0}; WCHAR *strings, *new_env; WCHAR *p, *p2; - int total = strlenW(path) + 1; + int total = lstrlenW(path) + 1; BOOL got_path = FALSE; if (!(strings = GetEnvironmentStringsW())) return NULL; p = strings; while (*p) { - int len = strlenW(p) + 1; - if (!strncmpiW( p, wPath, 5 )) got_path = TRUE; + int len = lstrlenW(p) + 1; + if (!wcsnicmp( p, wPath, 5 )) got_path = TRUE; total += len; p += len; } @@ -406,22 +400,22 @@ static void *SHELL_BuildEnvW( const WCHAR *path ) p2 = new_env; while (*p) { - int len = strlenW(p) + 1; + int len = lstrlenW(p) + 1; memcpy( p2, p, len * sizeof(WCHAR) ); - if (!strncmpiW( p, wPath, 5 )) + if (!wcsnicmp( p, wPath, 5 )) { p2[len - 1] = ';'; - strcpyW( p2 + len, path ); - p2 += strlenW(path) + 1; + lstrcpyW( p2 + len, path ); + p2 += lstrlenW(path) + 1; } p += len; p2 += len; } if (!got_path) { - strcpyW( p2, wPath ); - strcatW( p2, path ); - p2 += strlenW(p2) + 1; + lstrcpyW( p2, wPath ); + lstrcatW( p2, path ); + p2 += lstrlenW(p2) + 1; } *p2 = 0; FreeEnvironmentStringsW( strings ); @@ -449,8 +443,8 @@ static BOOL SHELL_TryAppPathW( LPCWSTR szName, LPWSTR lpResult, WCHAR **env) BOOL found = FALSE; if (env) *env = NULL; - strcpyW(buffer, wszKeyAppPaths); - strcatW(buffer, szName); + lstrcpyW(buffer, wszKeyAppPaths); + lstrcatW(buffer, szName); res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, buffer, 0, KEY_READ, &hkApp); if (res) goto end; @@ -502,15 +496,15 @@ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classn RegCloseKey(hkeyClass); /* Looking for ...buffer\shell\\command */ - strcatW(classname, wszShell); - strcatW(classname, verb); - strcatW(classname, wCommand); + lstrcatW(classname, wszShell); + lstrcatW(classname, verb); + lstrcatW(classname, wCommand); if (RegQueryValueW(HKEY_CLASSES_ROOT, classname, command, &commandlen) == ERROR_SUCCESS) { commandlen /= sizeof(WCHAR); - if (key) strcpyW(key, classname); + if (key) lstrcpyW(key, classname); #if 0 LPWSTR tmp; WCHAR param[256]; @@ -524,15 +518,15 @@ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classn */ /* Get the parameters needed by the application from the associated ddeexec key */ - tmp = strstrW(classname, wCommand); + tmp = wcsstr(classname, wCommand); tmp[0] = '\0'; - strcatW(classname, wDdeexec); + lstrcatW(classname, wDdeexec); if (RegQueryValueW(HKEY_CLASSES_ROOT, classname, param, ¶mlen) == ERROR_SUCCESS) { paramlen /= sizeof(WCHAR); - strcatW(command, wSpace); - strcatW(command, param); + lstrcatW(command, wSpace); + lstrcatW(command, param); commandlen += paramlen; } #endif @@ -614,7 +608,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb, attribs = GetFileAttributesW(lpFile); if (attribs!=INVALID_FILE_ATTRIBUTES && (attribs&FILE_ATTRIBUTE_DIRECTORY)) { - strcpyW(classname, wszFolder); + lstrcpyW(classname, wszFolder); } else { @@ -625,7 +619,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb, return SE_ERR_FNF; } /* First thing we need is the file's extension */ - extension = strrchrW(xlpFile, '.'); /* Assume last "." is the one; */ + extension = wcsrchr(xlpFile, '.'); /* Assume last "." is the one; */ /* File->Run in progman uses */ /* .\FILE.EXE :( */ TRACE("xlpFile=%s,extension=%s\n", debugstr_w(xlpFile), debugstr_w(extension)); @@ -661,9 +655,9 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb, while (*p == ' ' || *p == '\t') p++; } - if (strcmpiW(tok, &extension[1]) == 0) /* have to skip the leading "." */ + if (wcsicmp(tok, &extension[1]) == 0) /* have to skip the leading "." */ { - strcpyW(lpResult, xlpFile); + lstrcpyW(lpResult, xlpFile); /* Need to perhaps check that the file has a path * attached */ TRACE("found %s\n", debugstr_w(lpResult)); @@ -733,16 +727,16 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb, { if (*command) { - strcpyW(lpResult, command); - tok = strchrW(lpResult, '^'); /* should be ^.extension? */ + lstrcpyW(lpResult, command); + tok = wcschr(lpResult, '^'); /* should be ^.extension? */ if (tok != NULL) { tok[0] = '\0'; - strcatW(lpResult, xlpFile); /* what if no dir in xlpFile? */ - tok = strchrW(command, '^'); /* see above */ - if ((tok != NULL) && (strlenW(tok)>5)) + lstrcatW(lpResult, xlpFile); /* what if no dir in xlpFile? */ + tok = wcschr(command, '^'); /* see above */ + if ((tok != NULL) && (lstrlenW(tok)>5)) { - strcatW(lpResult, &tok[5]); + lstrcatW(lpResult, &tok[5]); } } retval = 33; /* FIXME - see above */ @@ -785,7 +779,7 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec static const WCHAR wApplication[] = {'\\','a','p','p','l','i','c','a','t','i','o','n',0}; static const WCHAR wTopic[] = {'\\','t','o','p','i','c',0}; WCHAR regkey[256]; - WCHAR * endkey = regkey + strlenW(key); + WCHAR * endkey = regkey + lstrlenW(key); WCHAR app[256], topic[256], ifexec[256], static_res[256]; WCHAR * dynamic_res=NULL; WCHAR * res; @@ -800,19 +794,19 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec unsigned ret = SE_ERR_NOASSOC; BOOL unicode = !(GetVersion() & 0x80000000); - if (strlenW(key) + 1 > ARRAY_SIZE(regkey)) + if (lstrlenW(key) + 1 > ARRAY_SIZE(regkey)) { FIXME("input parameter %s larger than buffer\n", debugstr_w(key)); return 2; } - strcpyW(regkey, key); + lstrcpyW(regkey, key); endkeyLen = ARRAY_SIZE(regkey) - (endkey - regkey); - if (strlenW(wApplication) + 1 > endkeyLen) + if (lstrlenW(wApplication) + 1 > endkeyLen) { FIXME("endkey %s overruns buffer\n", debugstr_w(wApplication)); return 2; } - strcpyW(endkey, wApplication); + lstrcpyW(endkey, wApplication); applen = sizeof(app); if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, app, &applen) != ERROR_SUCCESS) { @@ -825,14 +819,14 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec /* Get application command from start string and find filename of application */ if (*start == '"') { - if (strlenW(start + 1) + 1 > ARRAY_SIZE(command)) + if (lstrlenW(start + 1) + 1 > ARRAY_SIZE(command)) { FIXME("size of input parameter %s larger than buffer\n", debugstr_w(start + 1)); return 2; } - strcpyW(command, start+1); - if ((ptr = strchrW(command, '"'))) + lstrcpyW(command, start+1); + if ((ptr = wcschr(command, '"'))) *ptr = 0; ret = SearchPathW(NULL, command, wszExe, ARRAY_SIZE(fullpath), fullpath, &ptr); } @@ -840,7 +834,7 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec { LPCWSTR p; LPWSTR space; - for (p=start; (space=strchrW(p, ' ')); p=space+1) + for (p=start; (space=wcschr(p, ' ')); p=space+1) { int idx = space-start; memcpy(command, start, idx*sizeof(WCHAR)); @@ -857,35 +851,35 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec ERR("Unable to find application path for command %s\n", debugstr_w(start)); return ERROR_ACCESS_DENIED; } - if (strlenW(ptr) + 1 > ARRAY_SIZE(app)) + if (lstrlenW(ptr) + 1 > ARRAY_SIZE(app)) { FIXME("size of found path %s larger than buffer\n", debugstr_w(ptr)); return 2; } - strcpyW(app, ptr); + lstrcpyW(app, ptr); /* Remove extensions (including .so) */ - ptr = app + strlenW(app) - (sizeSo-1); - if (strlenW(app) >= sizeSo && - !strcmpW(ptr, wSo)) + ptr = app + lstrlenW(app) - (sizeSo-1); + if (lstrlenW(app) >= sizeSo && + !wcscmp(ptr, wSo)) *ptr = 0; - ptr = strrchrW(app, '.'); + ptr = wcsrchr(app, '.'); assert(ptr); *ptr = 0; } - if (strlenW(wTopic) + 1 > endkeyLen) + if (lstrlenW(wTopic) + 1 > endkeyLen) { FIXME("endkey %s overruns buffer\n", debugstr_w(wTopic)); return 2; } - strcpyW(endkey, wTopic); + lstrcpyW(endkey, wTopic); topiclen = sizeof(topic); if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, topic, &topiclen) != ERROR_SUCCESS) { static const WCHAR wSystem[] = {'S','y','s','t','e','m',0}; - strcpyW(topic, wSystem); + lstrcpyW(topic, wSystem); } if (unicode) @@ -922,12 +916,12 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec SetLastError(ERROR_DDE_FAIL); return 30; /* whatever */ } - if (strlenW(wIfexec) + 1 > endkeyLen) + if (lstrlenW(wIfexec) + 1 > endkeyLen) { FIXME("endkey %s overruns buffer\n", debugstr_w(wIfexec)); return 2; } - strcpyW(endkey, wIfexec); + lstrcpyW(endkey, wIfexec); ifexeclen = sizeof(ifexec); if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, ifexec, &ifexeclen) == ERROR_SUCCESS) { @@ -949,7 +943,7 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec * error DMLERR_NOTPROCESSED on XTYP_EXECUTE request. */ if (unicode) - hDdeData = DdeClientTransaction((LPBYTE)res, (strlenW(res) + 1) * sizeof(WCHAR), hConv, 0L, 0, + hDdeData = DdeClientTransaction((LPBYTE)res, (lstrlenW(res) + 1) * sizeof(WCHAR), hConv, 0L, 0, XTYP_EXECUTE, 30000, &tid); else { @@ -1015,14 +1009,14 @@ static UINT_PTR execute_from_key(LPCWSTR key, LPCWSTR lpFile, WCHAR *env, LPCWST /* Get the parameters needed by the application from the associated ddeexec key */ - tmp = strstrW(key, wCommand); + tmp = wcsstr(key, wCommand); assert(tmp); - strcpyW(tmp, wDdeexec); + lstrcpyW(tmp, wDdeexec); if (RegQueryValueW(HKEY_CLASSES_ROOT, key, ddeexec, &ddeexeclen) == ERROR_SUCCESS) { TRACE("Got ddeexec %s => %s\n", debugstr_w(key), debugstr_w(ddeexec)); - if (!param[0]) strcpyW(param, executable_name); + if (!param[0]) lstrcpyW(param, executable_name); retval = dde_connect(key, param, ddeexec, lpFile, env, szCommandline, psei->lpIDList, execfunc, psei, psei_out); } else if (param[0]) @@ -1103,7 +1097,7 @@ HINSTANCE WINAPI FindExecutableW(LPCWSTR lpFile, LPCWSTR lpDirectory, LPWSTR lpR retval = SHELL_FindExecutable(lpDirectory, lpFile, wszOpen, res, MAX_PATH, NULL, NULL, NULL, NULL); if (retval > 32) - strcpyW(lpResult, res); + lstrcpyW(lpResult, res); TRACE("returning %s\n", debugstr_w(lpResult)); if (lpDirectory) @@ -1398,22 +1392,22 @@ static UINT_PTR SHELL_execute_class( LPCWSTR wszApplicationName, LPSHELLEXECUTEI done = SHELL_ArgifyW(wcmd, ARRAY_SIZE(wcmd), execCmd, wszApplicationName, psei->lpIDList, NULL, &resultLen); if (!done && wszApplicationName[0]) { - strcatW(wcmd, wSpace); + lstrcatW(wcmd, wSpace); if (*wszApplicationName != '"') { - strcatW(wcmd, wQuote); - strcatW(wcmd, wszApplicationName); - strcatW(wcmd, wQuote); + lstrcatW(wcmd, wQuote); + lstrcatW(wcmd, wszApplicationName); + lstrcatW(wcmd, wQuote); } else - strcatW(wcmd, wszApplicationName); + lstrcatW(wcmd, wszApplicationName); } if (resultLen > ARRAY_SIZE(wcmd)) ERR("Argify buffer not large enough... truncating\n"); return execfunc(wcmd, NULL, FALSE, psei, psei_out); } - strcpyW(classname, psei->lpClass); + lstrcpyW(classname, psei->lpClass); rslt = SHELL_FindExecutableByVerb(psei->lpVerb, NULL, classname, execCmd, sizeof(execCmd)); TRACE("SHELL_FindExecutableByVerb returned %u (%s, %s)\n", (unsigned int)rslt, debugstr_w(classname), debugstr_w(execCmd)); @@ -1434,11 +1428,11 @@ static void SHELL_translate_idlist( LPSHELLEXECUTEINFOW sei, LPWSTR wszParameter if (SUCCEEDED(SHELL_GetPathFromIDListForExecuteW(sei->lpIDList, buffer, ARRAY_SIZE(buffer)))) { if (buffer[0]==':' && buffer[1]==':') { /* open shell folder for the specified class GUID */ - if (strlenW(buffer) + 1 > parametersLen) + if (lstrlenW(buffer) + 1 > parametersLen) ERR("parameters len exceeds buffer size (%i > %i), truncating\n", lstrlenW(buffer) + 1, parametersLen); lstrcpynW(wszParameters, buffer, parametersLen); - if (strlenW(wExplorer) > dwApplicationNameLen) + if (lstrlenW(wExplorer) > dwApplicationNameLen) ERR("application len exceeds buffer size (%i > %i), truncating\n", lstrlenW(wExplorer) + 1, dwApplicationNameLen); lstrcpynW(wszApplicationName, wExplorer, dwApplicationNameLen); @@ -1450,7 +1444,7 @@ static void SHELL_translate_idlist( LPSHELLEXECUTEINFOW sei, LPWSTR wszParameter DWORD resultLen; /* Check if we're executing a directory and if so use the handler for the Folder class */ - strcpyW(target, buffer); + lstrcpyW(target, buffer); attribs = GetFileAttributesW(buffer); if (attribs != INVALID_FILE_ATTRIBUTES && (attribs & FILE_ATTRIBUTE_DIRECTORY) && @@ -1486,12 +1480,12 @@ static UINT_PTR SHELL_quote_and_execute( LPCWSTR wcmd, LPCWSTR wszParameters, LP /* Must quote to handle case where cmd contains spaces, * else security hole if malicious user creates executable file "C:\\Program" */ - strcpyW(wszQuotedCmd, wQuote); - strcatW(wszQuotedCmd, wcmd); - strcatW(wszQuotedCmd, wQuote); + lstrcpyW(wszQuotedCmd, wQuote); + lstrcatW(wszQuotedCmd, wcmd); + lstrcatW(wszQuotedCmd, wQuote); if (wszParameters[0]) { - strcatW(wszQuotedCmd, wSpace); - strcatW(wszQuotedCmd, wszParameters); + lstrcatW(wszQuotedCmd, wSpace); + lstrcatW(wszQuotedCmd, wszParameters); } TRACE("%s/%s => %s/%s\n", debugstr_w(wszApplicationName), debugstr_w(psei->lpVerb), debugstr_w(wszQuotedCmd), debugstr_w(wszKeyname)); if (*wszKeyname) @@ -1512,11 +1506,11 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wcmd, LPSHELLEXECUTEI INT iSize; DWORD len; - lpstrRes = strchrW(lpFile, ':'); + lpstrRes = wcschr(lpFile, ':'); if (lpstrRes) iSize = lpstrRes - lpFile; else - iSize = strlenW(lpFile); + iSize = lstrlenW(lpFile); TRACE("Got URL: %s\n", debugstr_w(lpFile)); /* Looking for ...\shell\\command */ @@ -1528,9 +1522,9 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wcmd, LPSHELLEXECUTEI lpstrProtocol = heap_alloc(len * sizeof(WCHAR)); memcpy(lpstrProtocol, lpFile, iSize*sizeof(WCHAR)); lpstrProtocol[iSize] = '\0'; - strcatW(lpstrProtocol, wShell); - strcatW(lpstrProtocol, psei->lpVerb && *psei->lpVerb ? psei->lpVerb: wszOpen); - strcatW(lpstrProtocol, wCommand); + lstrcatW(lpstrProtocol, wShell); + lstrcatW(lpstrProtocol, psei->lpVerb && *psei->lpVerb ? psei->lpVerb: wszOpen); + lstrcatW(lpstrProtocol, wCommand); retval = execute_from_key(lpstrProtocol, lpFile, NULL, psei->lpParameters, wcmd, execfunc, psei, psei_out); @@ -1613,7 +1607,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR)); *wszApplicationName = '\0'; } - else if (*sei_tmp.lpFile == '\"' && sei_tmp.lpFile[(len = strlenW(sei_tmp.lpFile))-1] == '\"') + else if (*sei_tmp.lpFile == '\"' && sei_tmp.lpFile[(len = lstrlenW(sei_tmp.lpFile))-1] == '\"') { if(len-1 >= dwApplicationNameLen) dwApplicationNameLen = len; wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR)); @@ -1622,7 +1616,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) wszApplicationName[len-2] = '\0'; TRACE("wszApplicationName=%s\n",debugstr_w(wszApplicationName)); } else { - DWORD l = strlenW(sei_tmp.lpFile)+1; + DWORD l = lstrlenW(sei_tmp.lpFile)+1; if(l > dwApplicationNameLen) dwApplicationNameLen = l+1; wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR)); memcpy(wszApplicationName, sei_tmp.lpFile, l*sizeof(WCHAR)); @@ -1637,7 +1631,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) wszParameters = heap_alloc(len * sizeof(WCHAR)); parametersLen = len; } - strcpyW(wszParameters, sei_tmp.lpParameters); + lstrcpyW(wszParameters, sei_tmp.lpParameters); } else *wszParameters = '\0'; @@ -1648,7 +1642,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) len = lstrlenW(sei_tmp.lpDirectory) + 1; if (len > ARRAY_SIZE(dirBuffer)) wszDir = heap_alloc(len * sizeof(WCHAR)); - strcpyW(wszDir, sei_tmp.lpDirectory); + lstrcpyW(wszDir, sei_tmp.lpDirectory); } else *wszDir = '\0'; @@ -1802,7 +1796,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) TRACE("execute:%s,%s,%s\n", debugstr_w(wszApplicationName), debugstr_w(wszParameters), debugstr_w(wszDir)); lpFile = sei_tmp.lpFile; wcmd = wcmdBuffer; - strcpyW(wcmd, wszApplicationName); + lstrcpyW(wcmd, wszApplicationName); if (sei_tmp.lpDirectory) { LPCWSTR searchPath[] = { @@ -1840,7 +1834,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) static const WCHAR wExplorer[] = {'e','x','p','l','o','r','e','r',0}; static const WCHAR wQuote[] = {'"',0}; WCHAR wExec[MAX_PATH]; - WCHAR * lpQuotedFile = heap_alloc( sizeof(WCHAR) * (strlenW(lpFile) + 3) ); + WCHAR * lpQuotedFile = heap_alloc( sizeof(WCHAR) * (lstrlenW(lpFile) + 3) ); if (lpQuotedFile) { @@ -1849,9 +1843,9 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) NULL, &env, NULL, NULL ); if (retval > 32) { - strcpyW(lpQuotedFile, wQuote); - strcatW(lpQuotedFile, lpFile); - strcatW(lpQuotedFile, wQuote); + lstrcpyW(lpQuotedFile, wQuote); + lstrcatW(lpQuotedFile, lpFile); + lstrcatW(lpQuotedFile, wQuote); retval = SHELL_quote_and_execute( wExec, lpQuotedFile, wszKeyname, wszApplicationName, env, @@ -1868,12 +1862,12 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc ) retval = SHELL_execute_url( lpFile, wcmd, &sei_tmp, sei, execfunc ); } /* Check if file specified is in the form www.??????.*** */ - else if (!strncmpiW(lpFile, wWww, 3)) + else if (!wcsnicmp(lpFile, wWww, 3)) { /* if so, prefix lpFile with http:// and call ShellExecute */ WCHAR lpstrTmpFile[256]; - strcpyW(lpstrTmpFile, wHttp); - strcatW(lpstrTmpFile, lpFile); + lstrcpyW(lpstrTmpFile, wHttp); + lstrcatW(lpstrTmpFile, lpFile); retval = (UINT_PTR)ShellExecuteW(sei_tmp.hwnd, sei_tmp.lpVerb, lpstrTmpFile, NULL, NULL, 0); } diff --git a/dlls/shell32/shlfileop.c b/dlls/shell32/shlfileop.c index 2f6d50d7fea..e07b0daec53 100644 --- a/dlls/shell32/shlfileop.c +++ b/dlls/shell32/shlfileop.c @@ -21,9 +21,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #define COBJMACROS #include diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c index e84733d2676..91d283fd93f 100644 --- a/dlls/shell32/shlfolder.c +++ b/dlls/shell32/shlfolder.c @@ -21,9 +21,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include diff --git a/dlls/shell32/shlfsbind.c b/dlls/shell32/shlfsbind.c index 14d3a8629cb..20158232ef7 100644 --- a/dlls/shell32/shlfsbind.c +++ b/dlls/shell32/shlfsbind.c @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * */ -#include "config.h" -#include "wine/port.h" #include diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c index 4047c714d30..393d496d574 100644 --- a/dlls/shell32/shlmenu.c +++ b/dlls/shell32/shlmenu.c @@ -331,9 +331,9 @@ static BOOL FileMenu_AppendItemW( if (lpText != FM_SEPARATOR) { - int len = strlenW (lpText); + int len = lstrlenW (lpText); myItem = SHAlloc(sizeof(FMITEM) + len*sizeof(WCHAR)); - strcpyW (myItem->szItemText, lpText); + lstrcpyW (myItem->szItemText, lpText); myItem->cchItemText = len; myItem->iIconIndex = icon; myItem->hMenu = hMenu; diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c index 63512deb4b2..b9528cea1bd 100644 --- a/dlls/shell32/shlview.c +++ b/dlls/shell32/shlview.c @@ -36,9 +36,6 @@ * Release() ??? */ -#include "config.h" -#include "wine/port.h" - #include #include #include diff --git a/dlls/shell32/shlview_cmenu.c b/dlls/shell32/shlview_cmenu.c index e116e343446..6290cd0f9c8 100644 --- a/dlls/shell32/shlview_cmenu.c +++ b/dlls/shell32/shlview_cmenu.c @@ -389,7 +389,7 @@ static BOOL get_program_description(WCHAR *path, WCHAR *buffer, DWORD size) for (i = 0; i < llen / sizeof(DWORD); i++) { - sprintfW(fileDescW, fileDescFmtW, LOWORD(lang[i]), HIWORD(lang[i])); + swprintf(fileDescW, ARRAY_SIZE(fileDescW), fileDescFmtW, LOWORD(lang[i]), HIWORD(lang[i])); if (VerQueryValueW(data, fileDescW, (LPVOID *)&desc, &dlen)) { if (dlen > size - 1) dlen = size - 1; @@ -476,7 +476,7 @@ static void init_file_properties_dlg(HWND hwndDlg, struct file_properties_info * SetDlgItemTextW(hwndDlg, IDC_FPROP_PROG_NAME, buffer2); else { - WCHAR *p = strrchrW(buffer, '\\'); + WCHAR *p = wcsrchr(buffer, '\\'); SetDlgItemTextW(hwndDlg, IDC_FPROP_PROG_NAME, p ? ++p : buffer); } } @@ -538,22 +538,22 @@ static INT_PTR CALLBACK file_properties_proc(HWND hwndDlg, UINT uMsg, WPARAM wPa /* Update filename if it was changed */ if (GetDlgItemTextW(hwndDlg, IDC_FPROP_PATH, newname, ARRAY_SIZE(newname)) && - strcmpW(props->filename, newname) && - strlenW(props->dir) + strlenW(newname) + 2 < ARRAY_SIZE(newpath)) + wcscmp(props->filename, newname) && + lstrlenW(props->dir) + lstrlenW(newname) + 2 < ARRAY_SIZE(newpath)) { static const WCHAR slash[] = {'\\', 0}; - strcpyW(newpath, props->dir); - strcatW(newpath, slash); - strcatW(newpath, newname); + lstrcpyW(newpath, props->dir); + lstrcatW(newpath, slash); + lstrcatW(newpath, newname); if (!MoveFileW(props->path, newpath)) ERR("failed to move file %s to %s\n", debugstr_w(props->path), debugstr_w(newpath)); else { WCHAR *p; - strcpyW(props->path, newpath); - strcpyW(props->dir, newpath); - if ((p = strrchrW(props->dir, '\\'))) + lstrcpyW(props->path, newpath); + lstrcpyW(props->dir, newpath); + if ((p = wcsrchr(props->dir, '\\'))) { *p = 0; props->filename = p + 1; @@ -619,8 +619,8 @@ static void init_file_properties_pages(IDataObject *dataobject, LPFNADDPROPSHEET if (props->attrib == INVALID_FILE_ATTRIBUTES) goto error; - strcpyW(props->dir, props->path); - if ((p = strrchrW(props->dir, '\\'))) + lstrcpyW(props->dir, props->path); + if ((p = wcsrchr(props->dir, '\\'))) { *p = 0; props->filename = p + 1;