shell32: Build with msvcrt.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2021-09-17 17:16:11 +02:00
parent d1e1efe0f6
commit 48d62fc623
39 changed files with 378 additions and 460 deletions

View File

@ -6,6 +6,8 @@ DELAYIMPORTS = ole32 oleaut32 shdocvw version comctl32 gdiplus
# AUTHORS file is in the top-level directory # AUTHORS file is in the top-level directory
EXTRAINCL = -I$(top_srcdir) EXTRAINCL = -I$(top_srcdir)
EXTRADLLFLAGS = -mno-cygwin
C_SRCS = \ C_SRCS = \
appbar.c \ appbar.c \
assoc.c \ assoc.c \

View File

@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@ -32,7 +30,6 @@
#include "winuser.h" #include "winuser.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(appbar); WINE_DEFAULT_DEBUG_CHANNEL(appbar);

View File

@ -30,7 +30,6 @@
#include "shobjidl.h" #include "shobjidl.h"
#include "shell32_main.h" #include "shell32_main.h"
#include "ver.h" #include "ver.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
@ -395,7 +394,7 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
if (pszCommand[0] == '"') if (pszCommand[0] == '"')
{ {
pszStart = pszCommand + 1; pszStart = pszCommand + 1;
pszEnd = strchrW(pszStart, '"'); pszEnd = wcschr(pszStart, '"');
if (pszEnd) if (pszEnd)
*pszEnd = 0; *pszEnd = 0;
*len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL); *len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL);
@ -403,7 +402,7 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
else else
{ {
pszStart = pszCommand; pszStart = pszCommand;
for (pszEnd = pszStart; (pszEnd = strchrW(pszEnd, ' ')); pszEnd++) for (pszEnd = pszStart; (pszEnd = wcschr(pszEnd, ' ')); pszEnd++)
{ {
WCHAR c = *pszEnd; WCHAR c = *pszEnd;
*pszEnd = 0; *pszEnd = 0;
@ -529,7 +528,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
hr = ASSOC_GetCommand(This, pszExtra, &command); hr = ASSOC_GetCommand(This, pszExtra, &command);
if (SUCCEEDED(hr)) 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); heap_free(command);
} }
return hr; return hr;
@ -553,7 +552,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
/* hKeyProgID is NULL or there is no default value, so fail */ /* hKeyProgID is NULL or there is no default value, so fail */
return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION); 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); heap_free(docName);
return hr; return hr;
} }
@ -593,12 +592,12 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
DWORD *langCodeDesc = (DWORD *)bufW; DWORD *langCodeDesc = (DWORD *)bufW;
for (i = 0; i < flen / sizeof(DWORD); i++) 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])); HIWORD(langCodeDesc[i]));
if (VerQueryValueW(verinfoW, fileDescW, (LPVOID *)&bufW, &flen)) if (VerQueryValueW(verinfoW, fileDescW, (LPVOID *)&bufW, &flen))
{ {
/* Does strlenW(bufW) == 0 mean we use the filename? */ /* Does lstrlenW(bufW) == 0 mean we use the filename? */
len = strlenW(bufW) + 1; len = lstrlenW(bufW) + 1;
TRACE("found FileDescription: %s\n", debugstr_w(bufW)); TRACE("found FileDescription: %s\n", debugstr_w(bufW));
hr = ASSOC_ReturnString(flags, pszOut, pcchOut, bufW, len); hr = ASSOC_ReturnString(flags, pszOut, pcchOut, bufW, len);
heap_free(verinfoW); heap_free(verinfoW);
@ -610,7 +609,7 @@ get_friendly_name_fail:
PathRemoveExtensionW(path); PathRemoveExtensionW(path);
PathStripPathW(path); PathStripPathW(path);
TRACE("using filename: %s\n", debugstr_w(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); heap_free(verinfoW);
return hr; return hr;
} }
@ -631,7 +630,7 @@ get_friendly_name_fail:
{ {
ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, contentType, &size); ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, contentType, &size);
if (ret == ERROR_SUCCESS) 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 else
hr = HRESULT_FROM_WIN32(ret); hr = HRESULT_FROM_WIN32(ret);
heap_free(contentType); heap_free(contentType);
@ -657,7 +656,7 @@ get_friendly_name_fail:
{ {
ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, icon, &size); ret = RegGetValueW(This->hkeyProgID, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, icon, &size);
if (ret == ERROR_SUCCESS) 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 else
hr = HRESULT_FROM_WIN32(ret); hr = HRESULT_FROM_WIN32(ret);
heap_free(icon); heap_free(icon);
@ -667,7 +666,7 @@ get_friendly_name_fail:
} else { } else {
/* there is no DefaultIcon subkey or hkeyProgID is NULL, so return the default document icon */ /* there is no DefaultIcon subkey or hkeyProgID is NULL, so return the default document icon */
if (This->hkeyProgID == NULL) 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 else
return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION); return HRESULT_FROM_WIN32(ERROR_NO_ASSOCIATION);
} }
@ -685,8 +684,8 @@ get_friendly_name_fail:
hr = CLSIDFromString(pszExtra, &clsid); hr = CLSIDFromString(pszExtra, &clsid);
if (FAILED(hr)) return hr; if (FAILED(hr)) return hr;
strcpyW(keypath, shellexW); lstrcpyW(keypath, shellexW);
strcatW(keypath, pszExtra); lstrcatW(keypath, pszExtra);
ret = RegOpenKeyExW(This->hkeySource, keypath, 0, KEY_READ, &hkey); ret = RegOpenKeyExW(This->hkeySource, keypath, 0, KEY_READ, &hkey);
if (ret) return HRESULT_FROM_WIN32(ret); if (ret) return HRESULT_FROM_WIN32(ret);

View File

@ -25,7 +25,6 @@
- implement ACO_RTLREADING style - implement ACO_RTLREADING style
- implement ACO_WORD_FILTER style - implement ACO_WORD_FILTER style
*/ */
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
@ -48,8 +47,6 @@
#include "debughlp.h" #include "debughlp.h"
#include "shell32_main.h" #include "shell32_main.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
typedef struct typedef struct
@ -116,7 +113,7 @@ static inline WCHAR *filter_protocol(WCHAR *str)
{ {
static const WCHAR http[] = {'h','t','t','p'}; 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 += ARRAY_SIZE(http);
str += (*str == 's'); /* https */ str += (*str == 's'); /* https */
@ -130,7 +127,7 @@ static inline WCHAR *filter_www(WCHAR *str)
{ {
static const WCHAR www[] = {'w','w','w','.'}; 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 str + ARRAY_SIZE(www);
return NULL; return NULL;
} }
@ -147,7 +144,7 @@ static enum prefix_filtering get_text_prefix_filtering(const WCHAR *text)
UINT i; UINT i;
for (i = 0; i < ARRAY_SIZE(buf) - 1 && text[i]; 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'; buf[i] = '\0';
if (filter_protocol(buf)) return prefix_filtering_none; 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 *str1 = filter_str_prefix(a, pfx_filter);
WCHAR *str2 = filter_str_prefix(b, 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); 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); 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); 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_none,
sort_strs_cmpfn_protocol, sort_strs_cmpfn_protocol,
@ -259,7 +256,7 @@ static UINT find_matching_enum_str(IAutoCompleteImpl *ac, UINT start, WCHAR *tex
while (a < b) while (a < b)
{ {
UINT i = (a + b - 1) / 2; 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) if (cmp == 0)
{ {
index = i; index = i;
@ -351,7 +348,7 @@ static BOOL draw_listbox_item(IAutoCompleteImpl *ac, DRAWITEMSTRUCT *info, UINT
str = ac->listbox_strs[info->itemID]; str = ac->listbox_strs[info->itemID];
ExtTextOutW(hdc, info->rcItem.left + 1, info->rcItem.top, ExtTextOutW(hdc, info->rcItem.left + 1, info->rcItem.top,
ETO_OPAQUE | ETO_CLIPPED, &info->rcItem, str, ETO_OPAQUE | ETO_CLIPPED, &info->rcItem, str,
strlenW(str), NULL); lstrlenW(str), NULL);
if (state & ODS_SELECTED) if (state & ODS_SELECTED)
{ {
@ -400,7 +397,7 @@ static BOOL select_item_with_return_key(IAutoCompleteImpl *ac, HWND hwnd)
if (sel >= 0) if (sel >= 0)
{ {
text = ac->listbox_strs[sel]; 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); hide_listbox(ac, hwndListBox, TRUE);
ac->no_fwd_char = '\r'; /* RETURN char */ ac->no_fwd_char = '\r'; /* RETURN char */
return TRUE; return TRUE;
@ -457,7 +454,7 @@ static LRESULT change_selection(IAutoCompleteImpl *ac, HWND hwnd, UINT key)
SendMessageW(ac->hwndListBox, LB_SETCURSEL, sel, 0); SendMessageW(ac->hwndListBox, LB_SETCURSEL, sel, 0);
msg = (sel >= 0) ? ac->listbox_strs[sel] : ac->txtbackup; msg = (sel >= 0) ? ac->listbox_strs[sel] : ac->txtbackup;
len = strlenW(msg); len = lstrlenW(msg);
set_text_and_selection(ac, hwnd, msg, len, len); set_text_and_selection(ac, hwnd, msg, len, len);
return 0; return 0;
@ -493,23 +490,23 @@ static BOOL aclist_expand(IAutoCompleteImpl *ac, WCHAR *txt)
if (!ac->enum_strs) old_txt = empty; if (!ac->enum_strs) old_txt = empty;
/* skip the shared prefix */ /* 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; if (c == '\0') return FALSE;
i++; i++;
} }
/* they differ at this point, check for a delim further in txt */ /* 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; last_delim = p;
if (last_delim) return do_aclist_expand(ac, txt, last_delim); 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 */ /* 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) */ /* scan backwards to find the first delim before txt[i] (if any) */
while (i--) while (i--)
if (strchrW(delims, txt[i])) if (wcschr(delims, txt[i]))
return do_aclist_expand(ac, txt, &txt[i]); return do_aclist_expand(ac, txt, &txt[i]);
/* Windows doesn't expand without a delim, but it does reset */ /* 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, /* The character capitalization can be different,
so merge text and str into a new string */ 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)))) 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)))) if (!(text = heap_alloc((len + 1) * sizeof(WCHAR))))
return 0; return 0;
len = SendMessageW(hwnd, WM_GETTEXT, len + 1, (LPARAM)text); 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)))) if ((buf = heap_alloc(sz * sizeof(WCHAR))))
{ {
@ -860,7 +857,7 @@ static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
if (sel < 0) if (sel < 0)
return 0; return 0;
msg = This->listbox_strs[sel]; 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); hide_listbox(This, hwnd, TRUE);
return 0; return 0;
} }
@ -1091,7 +1088,7 @@ static HRESULT WINAPI IAutoComplete2_fnInit(
UINT i; UINT i;
/* pwszRegKeyPath contains the key as well as the value, so split it */ /* pwszRegKeyPath contains the key as well as the value, so split it */
value = strrchrW(pwzsRegKeyPath, '\\'); value = wcsrchr(pwzsRegKeyPath, '\\');
len = value - pwzsRegKeyPath; len = value - pwzsRegKeyPath;
if (value && (key = heap_alloc((len+1) * sizeof(*key))) != NULL) if (value && (key = heap_alloc((len+1) * sizeof(*key))) != NULL)
@ -1127,7 +1124,7 @@ static HRESULT WINAPI IAutoComplete2_fnInit(
if (!This->quickComplete && pwszQuickComplete) 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) if ((This->quickComplete = heap_alloc(len * sizeof(WCHAR))) != NULL)
memcpy(This->quickComplete, pwszQuickComplete, len * sizeof(WCHAR)); memcpy(This->quickComplete, pwszQuickComplete, len * sizeof(WCHAR));
} }
@ -1242,7 +1239,7 @@ static HRESULT WINAPI IAutoCompleteDropDown_fnGetDropDownStatus(
if (sel >= 0) if (sel >= 0)
{ {
WCHAR *str = This->listbox_strs[sel]; 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))) if (!(*ppwszString = CoTaskMemAlloc(size)))
return E_OUTOFMEMORY; return E_OUTOFMEMORY;

View File

@ -592,11 +592,11 @@ static LRESULT BrsFolder_Treeview_Rename(browse_info *info, NMTVDISPINFOW *pnmtv
item_data = (LPTV_ITEMDATA)item.lParam; item_data = (LPTV_ITEMDATA)item.lParam;
SHGetPathFromIDListW(item_data->lpifq, old_path); SHGetPathFromIDListW(item_data->lpifq, old_path);
if(!(p = strrchrW(old_path, '\\'))) if(!(p = wcsrchr(old_path, '\\')))
return 0; return 0;
p = new_path+(p-old_path+1); p = new_path+(p-old_path+1);
memcpy(new_path, old_path, (p-new_path)*sizeof(WCHAR)); 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)) if(!MoveFileW(old_path, new_path))
return 0; return 0;
@ -824,7 +824,7 @@ static HRESULT BrsFolder_NewFolder(browse_info *info)
goto cleanup; goto cleanup;
} }
len = strlenW(name); len = lstrlenW(name);
if(len<MAX_PATH) if(len<MAX_PATH)
name[len++] = '\\'; name[len++] = '\\';
hr = ISFHelper_GetUniqueName(sfhelper, &name[len], MAX_PATH-len); hr = ISFHelper_GetUniqueName(sfhelper, &name[len], MAX_PATH-len);

View File

@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@ -43,7 +40,6 @@
#include "shresdef.h" #include "shresdef.h"
#include "shlwapi.h" #include "shlwapi.h"
#include "pidl.h" #include "pidl.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); 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); lstrcpynW(szDest, sTemp, len);
} }
if (ParseFieldW (szDest, 2, sNum, 5)) if (ParseFieldW (szDest, 2, sNum, 5))
*picon_idx = atoiW(sNum); *picon_idx = wcstol(sNum, NULL, 10);
else else
*picon_idx=0; /* sometimes the icon number is missing */ *picon_idx=0; /* sometimes the icon number is missing */
ParseFieldW (szDest, 1, szDest, len); ParseFieldW (szDest, 1, szDest, len);
PathUnquoteSpacesW(szDest); PathUnquoteSpacesW(szDest);
return TRUE; return TRUE;

View File

@ -47,7 +47,6 @@
#include "shell32_main.h" #include "shell32_main.h"
#include "shlwapi.h" #include "shlwapi.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
@ -74,12 +73,12 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
SHGetPathFromIDListW(pidlRoot, wszRootPath); SHGetPathFromIDListW(pidlRoot, wszRootPath);
PathAddBackslashW(wszRootPath); PathAddBackslashW(wszRootPath);
rootlen = strlenW(wszRootPath); rootlen = lstrlenW(wszRootPath);
for (i=0; i<cidl;i++) for (i=0; i<cidl;i++)
{ {
_ILSimpleGetTextW(apidl[i], wszFileName, MAX_PATH); _ILSimpleGetTextW(apidl[i], wszFileName, MAX_PATH);
size += (rootlen + strlenW(wszFileName) + 1) * sizeof(WCHAR); size += (rootlen + lstrlenW(wszFileName) + 1) * sizeof(WCHAR);
} }
size += sizeof(WCHAR); size += sizeof(WCHAR);
@ -93,14 +92,14 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
pDropFiles->pFiles = offset * sizeof(WCHAR); pDropFiles->pFiles = offset * sizeof(WCHAR);
pDropFiles->fWide = TRUE; pDropFiles->fWide = TRUE;
strcpyW(wszFileName, wszRootPath); lstrcpyW(wszFileName, wszRootPath);
for (i=0; i<cidl;i++) for (i=0; i<cidl;i++)
{ {
_ILSimpleGetTextW(apidl[i], wszFileName + rootlen, MAX_PATH - rootlen); _ILSimpleGetTextW(apidl[i], wszFileName + rootlen, MAX_PATH - rootlen);
strcpyW(((WCHAR*)pDropFiles)+offset, wszFileName); lstrcpyW(((WCHAR*)pDropFiles)+offset, wszFileName);
offset += strlenW(wszFileName) + 1; offset += lstrlenW(wszFileName) + 1;
} }
((WCHAR*)pDropFiles)[offset] = 0; ((WCHAR*)pDropFiles)[offset] = 0;
@ -203,7 +202,7 @@ HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
if (!bSuccess) if (!bSuccess)
return 0; return 0;
size = (strlenW(szTemp)+1) * sizeof(WCHAR); size = (lstrlenW(szTemp)+1) * sizeof(WCHAR);
/* fill the structure */ /* fill the structure */
hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size); hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);

View File

@ -31,7 +31,6 @@
#include "winreg.h" #include "winreg.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "cpl.h" #include "cpl.h"
#include "wine/unicode.h"
#include "commctrl.h" #include "commctrl.h"
#define NO_SHLWAPI_REG #define NO_SHLWAPI_REG
@ -680,7 +679,7 @@ static void Control_DoWindow(CPanel* panel, HWND hWnd, HINSTANCE hInst)
/* first add .cpl files in the system directory */ /* first add .cpl files in the system directory */
GetSystemDirectoryW( buffer, MAX_PATH ); GetSystemDirectoryW( buffer, MAX_PATH );
p = buffer + strlenW(buffer); p = buffer + lstrlenW(buffer);
*p++ = '\\'; *p++ = '\\';
lstrcpyW(p, wszAllCpl); lstrcpyW(p, wszAllCpl);
@ -732,7 +731,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
*end = '\0'; *end = '\0';
if (beg) { if (beg) {
if (*beg == '@') { if (*beg == '@') {
sp = atoiW(beg + 1); sp = wcstol(beg + 1, NULL, 10);
} else if (*beg == '\0') { } else if (*beg == '\0') {
sp = -1; sp = -1;
} else { } else {
@ -780,7 +779,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
/* Now check if there had been a numerical value in the extra params */ /* Now check if there had been a numerical value in the extra params */
if ((extraPmts) && (*extraPmts == '@') && (sp == -1)) { if ((extraPmts) && (*extraPmts == '@') && (sp == -1)) {
sp = atoiW(extraPmts + 1); sp = wcstol(extraPmts + 1, NULL, 10);
} }
TRACE("cmd %s, extra %s, sp %d\n", debugstr_w(buffer), debugstr_w(extraPmts), sp); TRACE("cmd %s, extra %s, sp %d\n", debugstr_w(buffer), debugstr_w(extraPmts), sp);

View File

@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>

View File

@ -32,7 +32,6 @@
#include "shell32_main.h" #include "shell32_main.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
@ -124,7 +123,7 @@ static inline HDDEDATA Dde_OnRequest(UINT uFmt, HCONV hconv, HSZ hszTopic,
do do
{ {
if ((finddata.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && 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; len += lstrlenW(finddata.cFileName) + 2;
groups_data = heap_realloc(groups_data, len * sizeof(WCHAR)); 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; static WCHAR *last_group;
if (!strcmpiW(command, create_groupW)) if (!wcsicmp(command, create_groupW))
{ {
WCHAR *path; WCHAR *path;
@ -187,7 +186,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
heap_free(last_group); heap_free(last_group);
last_group = path; last_group = path;
} }
else if (!strcmpiW(command, delete_groupW)) else if (!wcsicmp(command, delete_groupW))
{ {
WCHAR *path, *path2; WCHAR *path, *path2;
SHFILEOPSTRUCTW shfos = {0}; SHFILEOPSTRUCTW shfos = {0};
@ -197,9 +196,9 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
path = get_programs_path(argv[0]); path = get_programs_path(argv[0]);
path2 = heap_alloc((strlenW(path) + 2) * sizeof(*path)); path2 = heap_alloc((lstrlenW(path) + 2) * sizeof(*path));
strcpyW(path2, path); lstrcpyW(path2, path);
path2[strlenW(path) + 1] = 0; path2[lstrlenW(path) + 1] = 0;
shfos.wFunc = FO_DELETE; shfos.wFunc = FO_DELETE;
shfos.pFrom = path2; shfos.pFrom = path2;
@ -212,7 +211,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
if (ret || shfos.fAnyOperationsAborted) return DDE_FNOTPROCESSED; if (ret || shfos.fAnyOperationsAborted) return DDE_FNOTPROCESSED;
} }
else if (!strcmpiW(command, show_groupW)) else if (!wcsicmp(command, show_groupW))
{ {
WCHAR *path; WCHAR *path;
@ -227,7 +226,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
heap_free(last_group); heap_free(last_group);
last_group = path; last_group = path;
} }
else if (!strcmpiW(command, add_itemW)) else if (!wcsicmp(command, add_itemW))
{ {
WCHAR *path, *name; WCHAR *path, *name;
DWORD len; DWORD len;
@ -253,13 +252,13 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
heap_free(path); heap_free(path);
if (argc >= 2) IShellLinkW_SetDescription(link, argv[1]); 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 >= 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 (argc >= 9)
{ {
if (atoiW(argv[8]) == 0) IShellLinkW_SetShowCmd(link, SW_SHOWMINNOACTIVE); if (wcstol(argv[8], NULL, 10) == 0) IShellLinkW_SetShowCmd(link, SW_SHOWMINNOACTIVE);
else if (atoiW(argv[8]) == 1) IShellLinkW_SetShowCmd(link, SW_SHOWNORMAL); else if (wcstol(argv[8], NULL, 10) == 1) IShellLinkW_SetShowCmd(link, SW_SHOWNORMAL);
} }
hres = IShellLinkW_QueryInterface(link, &IID_IPersistFile, (void **)&file); 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) 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); lstrcpyW(name, last_group);
lstrcatW(name, slashW); lstrcatW(name, slashW);
lstrcatW(name, argv[1]); lstrcatW(name, argv[1]);
@ -280,10 +279,10 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
{ {
const WCHAR *filename = PathFindFileNameW(argv[0]); const WCHAR *filename = PathFindFileNameW(argv[0]);
int len = PathFindExtensionW(filename) - filename; 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); lstrcpyW(name, last_group);
lstrcatW(name, slashW); lstrcatW(name, slashW);
lstrcpynW(name+strlenW(name), filename, len + 1); lstrcpynW(name+lstrlenW(name), filename, len + 1);
lstrcatW(name, dotlnkW); lstrcatW(name, dotlnkW);
} }
hres = IPersistFile_Save(file, name, TRUE); 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; 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; WCHAR *name;
BOOL ret; BOOL ret;
if (argc < 1) return DDE_FNOTPROCESSED; 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); lstrcpyW(name, last_group);
lstrcatW(name, slashW); lstrcatW(name, slashW);
lstrcatW(name, argv[0]); lstrcatW(name, argv[0]);
@ -313,7 +312,7 @@ static DWORD PROGMAN_OnExecute(WCHAR *command, int argc, WCHAR **argv)
if (!ret) return DDE_FNOTPROCESSED; if (!ret) return DDE_FNOTPROCESSED;
} }
else if (!strcmpiW(command, exit_progmanW)) else if (!wcsicmp(command, exit_progmanW))
{ {
/* do nothing */ /* do nothing */
} }
@ -345,7 +344,7 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command)
command++; command++;
while (*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); opcode = strndupW(command, p - command);
@ -361,11 +360,11 @@ static DWORD parse_dde_command(HSZ hszTopic, WCHAR *command)
if (*command == '"') if (*command == '"')
{ {
command++; command++;
if (!(p = strchrW(command, '"'))) goto error; if (!(p = wcschr(command, '"'))) goto error;
} }
else else
{ {
if (!(p = strpbrkW(command, param_end))) goto error; if (!(p = wcspbrk(command, param_end))) goto error;
while (p[-1] == ' ') p--; while (p[-1] == ' ') p--;
} }

View File

@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@ -121,7 +118,7 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
WCHAR *dest, *result, *result_end=NULL; WCHAR *dest, *result, *result_end=NULL;
static const WCHAR dotexeW[] = {'.','e','x','e',0}; 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; src = cmdline;
dest = result; dest = result;
@ -139,12 +136,12 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline)
else { else {
while (*src) while (*src)
{ {
if (isspaceW(*src)) if (iswspace(*src))
{ {
*dest = 0; *dest = 0;
if (INVALID_FILE_ATTRIBUTES != GetFileAttributesW(result)) if (INVALID_FILE_ATTRIBUTES != GetFileAttributesW(result))
break; break;
strcatW(dest, dotexeW); lstrcatW(dest, dotexeW);
if (INVALID_FILE_ATTRIBUTES != GetFileAttributesW(result)) if (INVALID_FILE_ATTRIBUTES != GetFileAttributesW(result))
break; 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_EXE, filter_exe, 256);
LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_FILTER_ALL, filter_all, 256); LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_FILTER_ALL, filter_all, 256);
LoadStringW(shell32_hInstance, IDS_RUNDLG_BROWSE_CAPTION, szCaption, MAX_PATH); 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)); ZeroMemory(&ofn, sizeof(ofn));
ofn.lStructSize = sizeof(OPENFILENAMEW); ofn.lStructSize = sizeof(OPENFILENAMEW);

View File

@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>

View File

@ -25,7 +25,6 @@
#define COBJMACROS #define COBJMACROS
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winreg.h" #include "winreg.h"
@ -77,9 +76,9 @@ BOOL CreateFolderEnumList(IEnumIDListImpl *list, LPCWSTR lpszPath, DWORD dwFlags
if(!lpszPath || !lpszPath[0]) return FALSE; if(!lpszPath || !lpszPath[0]) return FALSE;
strcpyW(szPath, lpszPath); lstrcpyW(szPath, lpszPath);
PathAddBackslashW(szPath); PathAddBackslashW(szPath);
strcatW(szPath,stars); lstrcatW(szPath,stars);
hFile = FindFirstFileW(szPath,&stffile); hFile = FindFirstFileW(szPath,&stffile);
if ( hFile != INVALID_HANDLE_VALUE ) if ( hFile != INVALID_HANDLE_VALUE )
@ -93,7 +92,7 @@ BOOL CreateFolderEnumList(IEnumIDListImpl *list, LPCWSTR lpszPath, DWORD dwFlags
{ {
if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && if ( (stffile.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) &&
dwFlags & SHCONTF_FOLDERS && dwFlags & SHCONTF_FOLDERS &&
strcmpW(stffile.cFileName, dot) && strcmpW(stffile.cFileName, dotdot)) wcscmp(stffile.cFileName, dot) && wcscmp(stffile.cFileName, dotdot))
{ {
pidl = _ILCreateFromFindDataW(&stffile); pidl = _ILCreateFromFindDataW(&stffile);
succeeded = succeeded && AddToEnumList(list, pidl); succeeded = succeeded && AddToEnumList(list, pidl);

View File

@ -17,9 +17,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@ -148,7 +145,7 @@ static HRESULT getIconLocationForFolder(IExtractIconWImpl *This, UINT uFlags, LP
WCHAR wszIconIndex[10]; WCHAR wszIconIndex[10];
SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, iconIndex, SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, iconIndex,
wszIconIndex, 10); wszIconIndex, 10);
*piIndex = atoiW(wszIconIndex); *piIndex = wcstol(wszIconIndex, NULL, 10);
} }
else if (SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, clsid, else if (SHELL32_GetCustomFolderAttribute(This->pidl, shellClassInfo, clsid,
wszCLSIDValue, CHARS_IN_GUID) && 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 }; '%','0','2','x','%','0','2','x','%','0','2','x','%','0','2','x','}',0 };
WCHAR xriid[50]; WCHAR xriid[50];
sprintfW(xriid, fmt, swprintf(xriid, ARRAY_SIZE(xriid), fmt,
riid->Data1, riid->Data2, riid->Data3, riid->Data1, riid->Data2, riid->Data3,
riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]); riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]);

View File

@ -18,15 +18,9 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <sys/types.h> #include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#define COBJMACROS #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)) (e1->dwFlags & GIL_FORSHORTCUT) != (e2->dwFlags & GIL_FORSHORTCUT))
return 1; return 1;
if (strcmpiW(e1->sSourceFile,e2->sSourceFile)) if (wcsicmp(e1->sSourceFile,e2->sSourceFile))
return 1; return 1;
return 0; return 0;
@ -129,7 +123,7 @@ HRESULT SIC_get_location( int list_idx, WCHAR *file, DWORD *size, int *res_idx )
if (dpa_idx != -1) if (dpa_idx != -1)
{ {
found = DPA_GetPtr( sic_hdpa, dpa_idx ); found = DPA_GetPtr( sic_hdpa, dpa_idx );
needed = (strlenW( found->sSourceFile ) + 1) * sizeof(WCHAR); needed = (lstrlenW( found->sSourceFile ) + 1) * sizeof(WCHAR);
if (needed <= *size) if (needed <= *size)
{ {
memcpy( file, found->sSourceFile, needed ); 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)); entry = SHAlloc(sizeof(*entry));
GetFullPathNameW(sourcefile, MAX_PATH, path, NULL); GetFullPathNameW(sourcefile, MAX_PATH, path, NULL);
entry->sSourceFile = heap_alloc( (strlenW(path)+1)*sizeof(WCHAR) ); entry->sSourceFile = heap_alloc( (lstrlenW(path)+1)*sizeof(WCHAR) );
strcpyW( entry->sSourceFile, path ); lstrcpyW( entry->sSourceFile, path );
entry->dwSourceIndex = src_index; entry->dwSourceIndex = src_index;
entry->dwFlags = flags; 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 (!RegQueryValueExW( key, ShellIconSize, NULL, &type, (BYTE *)buf, &size ) && type == REG_SZ)
{ {
if (size == sizeof(buf)) buf[size / sizeof(WCHAR) - 1] = 0; if (size == sizeof(buf)) buf[size / sizeof(WCHAR) - 1] = 0;
value = atoiW( buf ); value = wcstol( buf, NULL, 10 );
} }
RegCloseKey( key ); RegCloseKey( key );
} }
@ -579,7 +573,7 @@ INT SIC_GetIconIndex (LPCWSTR sSourceFile, INT dwSourceIndex, DWORD dwFlags )
*/ */
static int SIC_LoadOverlayIcon(int icon_idx) static int SIC_LoadOverlayIcon(int icon_idx)
{ {
WCHAR buffer[1024], wszIdx[8]; WCHAR buffer[1024], wszIdx[12];
HKEY hKeyShellIcons; HKEY hKeyShellIcons;
LPCWSTR iconPath; LPCWSTR iconPath;
int iconIdx; int iconIdx;
@ -598,12 +592,12 @@ static int SIC_LoadOverlayIcon(int icon_idx)
{ {
DWORD count = sizeof(buffer); DWORD count = sizeof(buffer);
sprintfW(wszIdx, wszNumFmt, icon_idx); swprintf(wszIdx, ARRAY_SIZE(wszIdx), wszNumFmt, icon_idx);
/* read icon path and index */ /* read icon path and index */
if (RegQueryValueExW(hKeyShellIcons, wszIdx, NULL, NULL, (LPBYTE)buffer, &count) == ERROR_SUCCESS) if (RegQueryValueExW(hKeyShellIcons, wszIdx, NULL, NULL, (LPBYTE)buffer, &count) == ERROR_SUCCESS)
{ {
LPWSTR p = strchrW(buffer, ','); LPWSTR p = wcschr(buffer, ',');
if (!p) if (!p)
{ {
@ -613,7 +607,7 @@ static int SIC_LoadOverlayIcon(int icon_idx)
} }
*p++ = 0; *p++ = 0;
iconPath = buffer; iconPath = buffer;
iconIdx = atoiW(p); iconIdx = wcstol(p, NULL, 10);
} }
RegCloseKey(hKeyShellIcons); RegCloseKey(hKeyShellIcons);

View File

@ -22,9 +22,6 @@
* *
*/ */
#include "config.h"
#include "wine/port.h"
#include <ctype.h> #include <ctype.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
@ -1783,7 +1780,7 @@ LPITEMIDLIST _ILCreateDrive(LPCWSTR lpszNew)
if (pszDest) if (pszDest)
{ {
strcpy(pszDest, "x:\\"); strcpy(pszDest, "x:\\");
pszDest[0]=toupperW(lpszNew[0]); pszDest[0]=towupper(lpszNew[0]);
TRACE("-- create Drive: %s\n", debugstr_a(pszDest)); TRACE("-- create Drive: %s\n", debugstr_a(pszDest));
} }
} }

View File

@ -20,8 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#define COBJMACROS #define COBJMACROS
#define NONAMELESSUNION #define NONAMELESSUNION
@ -30,6 +28,7 @@
#include "winerror.h" #include "winerror.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winternl.h"
#include "winreg.h" #include "winreg.h"
#include "winuser.h" #include "winuser.h"
#include "shlwapi.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}; static const WCHAR trashW[] = {'\\','.','T','r','a','s','h',0};
if (!GetEnvironmentVariableW( homedirW, var, MAX_PATH )) return TRUE; if (!GetEnvironmentVariableW( homedirW, var, MAX_PATH )) return TRUE;
files = heap_alloc( (strlenW(var) + strlenW(trashW) + 1) * sizeof(WCHAR) ); files = heap_alloc( (lstrlenW(var) + lstrlenW(trashW) + 1) * sizeof(WCHAR) );
strcpyW( files, var ); lstrcpyW( files, var );
strcatW( files, trashW ); lstrcatW( files, trashW );
files[1] = '\\'; /* change \??\ to \\?\ */ files[1] = '\\'; /* change \??\ to \\?\ */
#else #else
static const WCHAR dataW[] = {'X','D','G','_','D','A','T','A','_','H','O','M','E',0}; 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}; static const WCHAR config_fmtW[] = {'\\','?','?','\\','u','n','i','x','%','s','/','T','r','a','s','h',0};
const WCHAR *fmt = config_fmtW; const WCHAR *fmt = config_fmtW;
WCHAR *p; WCHAR *p;
ULONG len;
if (!GetEnvironmentVariableW( dataW, var + 8, MAX_PATH - 8 ) || !var[8]) if (!GetEnvironmentVariableW( dataW, var + 8, MAX_PATH - 8 ) || !var[8])
{ {
if (!GetEnvironmentVariableW( homedirW, var, MAX_PATH )) return TRUE; if (!GetEnvironmentVariableW( homedirW, var, MAX_PATH )) return TRUE;
fmt = home_fmtW; fmt = home_fmtW;
} }
files = heap_alloc( (strlenW(var) + strlenW(fmt) + strlenW(filesW) + 1) * sizeof(WCHAR) ); len = lstrlenW(var) + lstrlenW(fmt) + lstrlenW(filesW) + 1;
sprintfW( files, fmt, var ); files = heap_alloc( len * sizeof(WCHAR) );
swprintf( files, len, fmt, var );
files[1] = '\\'; /* change \??\ to \\?\ */ files[1] = '\\'; /* change \??\ to \\?\ */
for (p = files; *p; p++) if (*p == '/') *p = '\\'; for (p = files; *p; p++) if (*p == '/') *p = '\\';
CreateDirectoryW( files, NULL ); CreateDirectoryW( files, NULL );
info = heap_alloc( (strlenW(var) + strlenW(fmt) + strlenW(infoW) + 1) * sizeof(WCHAR) ); info = heap_alloc( len * sizeof(WCHAR) );
strcpyW( info, files ); lstrcpyW( info, files );
strcatW( files, filesW ); lstrcatW( files, filesW );
strcatW( info, infoW ); lstrcatW( info, infoW );
if (!CreateDirectoryW( info, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS) goto done; if (!CreateDirectoryW( info, NULL ) && GetLastError() != ERROR_ALREADY_EXISTS) goto done;
trash_info_dir = info; trash_info_dir = info;
#endif #endif
@ -265,34 +266,36 @@ BOOL trash_file( const WCHAR *path )
{ {
WCHAR *dest = NULL, *file = PathFindFileNameW( path ); WCHAR *dest = NULL, *file = PathFindFileNameW( path );
BOOL ret = TRUE; BOOL ret = TRUE;
ULONG i; ULONG i, len;
InitOnceExecuteOnce( &trash_dir_once, init_trash_dirs, NULL, NULL ); InitOnceExecuteOnce( &trash_dir_once, init_trash_dirs, NULL, NULL );
if (!trash_dir) return FALSE; 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) if (trash_info_dir)
{ {
static const WCHAR fmt[] = {'%','s','\\','%','s','.','t','r','a','s','h','i','n','f','o',0}; 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}; static const WCHAR fmt2[] = {'%','s','\\','%','s','-','%','0','8','x','.','t','r','a','s','h','i','n','f','o',0};
HANDLE handle; 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++) for (i = 0; i < 1000; i++)
{ {
handle = CreateFileW( info, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0 ); handle = CreateFileW( info, GENERIC_WRITE, 0, NULL, CREATE_NEW, 0, 0 );
if (handle != INVALID_HANDLE_VALUE) break; 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 (handle != INVALID_HANDLE_VALUE)
{ {
if ((ret = write_trashinfo_file( handle, path ))) if ((ret = write_trashinfo_file( handle, path )))
{ {
static const WCHAR fmt[] = {'%','s','%','.','*','s',0}; static const WCHAR fmt[] = {'%','s','%','.','*','s',0};
ULONG len = strlenW(info) - strlenW(trash_info_dir) - 10 /* .trashinfo */; ULONG namelen = lstrlenW(info) - lstrlenW(trash_info_dir) - 10 /* .trashinfo */;
sprintfW( dest, fmt, trash_dir, len, info + strlenW(trash_info_dir) ); swprintf( dest, len, fmt, trash_dir, namelen, info + lstrlenW(trash_info_dir) );
ret = MoveFileW( path, dest ); ret = MoveFileW( path, dest );
} }
CloseHandle( handle ); CloseHandle( handle );
@ -304,12 +307,12 @@ BOOL trash_file( const WCHAR *path )
static const WCHAR fmt[] = {'%','s','\\','%','s',0}; static const WCHAR fmt[] = {'%','s','\\','%','s',0};
static const WCHAR fmt2[] = {'%','s','\\','%','s','-','%','0','8','x',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++) for (i = 0; i < 1000; i++)
{ {
ret = MoveFileW( path, dest ); ret = MoveFileW( path, dest );
if (ret || GetLastError() != ERROR_ALREADY_EXISTS) break; 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) ); 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}; static const WCHAR dsstoreW[] = {'.','D','S','_','S','t','o','r','e',0};
return !!strcmpW( filename, dsstoreW ); return !!wcscmp( filename, dsstoreW );
} }
else else
{ {
static const WCHAR fmt[] = {'%','s','\\','%','s','.','t','r','a','s','h','i','n','f','o',0}; static const WCHAR fmt[] = {'%','s','\\','%','s','.','t','r','a','s','h','i','n','f','o',0};
HANDLE handle; 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 ); handle = CreateFileW( info, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
heap_free( info ); heap_free( info );
if (handle != INVALID_HANDLE_VALUE) return FALSE; if (handle == INVALID_HANDLE_VALUE) return FALSE;
read_trashinfo_file( handle, data ); read_trashinfo_file( handle, data );
CloseHandle( handle ); CloseHandle( handle );
return TRUE; return TRUE;
@ -347,14 +351,14 @@ static HRESULT add_trash_item( WIN32_FIND_DATAW *orig_data, LPITEMIDLIST **pidls
ITEMIDLIST *pidl; ITEMIDLIST *pidl;
WIN32_FIND_DATAW *data; WIN32_FIND_DATAW *data;
const WCHAR *filename = orig_data->cFileName; 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; if (!(pidl = SHAlloc( len + 2 ))) return E_OUTOFMEMORY;
pidl->mkid.cb = len; pidl->mkid.cb = len;
pidl->mkid.abID[0] = 0; pidl->mkid.abID[0] = 0;
data = (WIN32_FIND_DATAW *)(pidl->mkid.abID + 1); data = (WIN32_FIND_DATAW *)(pidl->mkid.abID + 1);
memcpy( data, orig_data, sizeof(*data) ); memcpy( data, orig_data, sizeof(*data) );
strcpyW( (WCHAR *)(data + 1), filename ); lstrcpyW( (WCHAR *)(data + 1), filename );
*(USHORT *)((char *)pidl + len) = 0; *(USHORT *)((char *)pidl + len) = 0;
if (get_trash_item_info( filename, data )) 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 ); InitOnceExecuteOnce( &trash_dir_once, init_trash_dirs, NULL, NULL );
if (!trash_dir) return E_FAIL; if (!trash_dir) return E_FAIL;
file = heap_alloc( (strlenW(trash_dir) + strlenW(wildcardW) + 1) * sizeof(WCHAR) ); file = heap_alloc( (lstrlenW(trash_dir) + lstrlenW(wildcardW) + 1) * sizeof(WCHAR) );
strcpyW( file, trash_dir ); lstrcpyW( file, trash_dir );
strcatW( file, wildcardW ); lstrcatW( file, wildcardW );
handle = FindFirstFileW( file, &data ); handle = FindFirstFileW( file, &data );
if (handle != INVALID_HANDLE_VALUE) 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 dotW[] = {'.',0};
static const WCHAR dotdotW[] = {'.','.',0}; static const WCHAR dotdotW[] = {'.','.',0};
if (!strcmpW( data.cFileName, dotW )) continue; if (!wcscmp( data.cFileName, dotW )) continue;
if (!strcmpW( data.cFileName, dotdotW )) continue; if (!wcscmp( data.cFileName, dotdotW )) continue;
hr = add_trash_item( &data, &ret, &count, &size ); hr = add_trash_item( &data, &ret, &count, &size );
} while (hr == S_OK && FindNextFileW( handle, &data )); } while (hr == S_OK && FindNextFileW( handle, &data ));
FindClose( handle ); FindClose( handle );
@ -422,29 +426,31 @@ static HRESULT enum_trash_items( LPITEMIDLIST **pidls, int *ret_count )
static void remove_trashinfo( const WCHAR *filename ) 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; WCHAR *info;
ULONG len;
if (!trash_info_dir) return; if (!trash_info_dir) return;
info = heap_alloc( (strlenW(trash_info_dir) + strlenW(filename) + 12) * sizeof(WCHAR) ); len = lstrlenW(trash_info_dir) + lstrlenW(filename) + 12;
sprintfW( info, fmt, trash_info_dir, filename ); info = heap_alloc( len * sizeof(WCHAR) );
swprintf( info, len, L"%s\\%s.trashinfo", trash_info_dir, filename );
DeleteFileW( info ); DeleteFileW( info );
heap_free( info ); heap_free( info );
} }
static HRESULT restore_trash_item( LPCITEMIDLIST pidl ) static HRESULT restore_trash_item( LPCITEMIDLIST pidl )
{ {
static const WCHAR fmt[] = {'%','s','\\','%','s',0};
const WIN32_FIND_DATAW *data = get_trash_item_data( pidl ); const WIN32_FIND_DATAW *data = get_trash_item_data( pidl );
WCHAR *from, *filename = (WCHAR *)(data + 1); 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) ); FIXME( "original name for %s not available\n", debugstr_w(data->cFileName) );
return E_NOTIMPL; return E_NOTIMPL;
} }
from = heap_alloc( (strlenW(trash_dir) + strlenW(filename) + 2) * sizeof(WCHAR) ); len = lstrlenW(trash_dir) + lstrlenW(filename) + 2;
sprintfW( from, fmt, trash_dir, filename ); from = heap_alloc( len * sizeof(WCHAR) );
swprintf( from, len, L"%s\\%s", trash_dir, filename );
if (MoveFileW( from, data->cFileName )) remove_trashinfo( 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) ); else WARN( "failed to restore %s to %s\n", debugstr_w(from), debugstr_w(data->cFileName) );
heap_free( from ); heap_free( from );
@ -453,12 +459,12 @@ static HRESULT restore_trash_item( LPCITEMIDLIST pidl )
static HRESULT erase_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 ); const WIN32_FIND_DATAW *data = get_trash_item_data( pidl );
WCHAR *from, *filename = (WCHAR *)(data + 1); 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) ); from = heap_alloc( len * sizeof(WCHAR) );
sprintfW( from, fmt, trash_dir, filename ); swprintf( from, len, L"%s\\%s", trash_dir, filename );
if (DeleteFileW( from )) remove_trashinfo( filename ); if (DeleteFileW( from )) remove_trashinfo( filename );
heap_free( from ); heap_free( from );
return S_OK; return S_OK;
@ -1170,9 +1176,8 @@ static HRESULT erase_items(HWND parent,const LPCITEMIDLIST * apidl, UINT cidl, B
} }
default: default:
{ {
static const WCHAR format[]={'%','u','\0'};
LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_ERASEMULTIPLE, message, ARRAY_SIZE(message)); LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_ERASEMULTIPLE, message, ARRAY_SIZE(message));
sprintfW(arg,format,cidl); swprintf(arg, ARRAY_SIZE(arg), L"%u", cidl);
break; break;
} }

View File

@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@ -51,7 +49,6 @@
#include "shfldr.h" #include "shfldr.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
@ -290,7 +287,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
else else
{ {
if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) if (dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
strcatW (psfi->szTypeName, szFolder); lstrcatW (psfi->szTypeName, szFolder);
else else
{ {
WCHAR sTemp[64]; WCHAR sTemp[64];
@ -307,7 +304,7 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
if (sTemp[0]) if (sTemp[0])
{ {
lstrcpynW (psfi->szTypeName, sTemp, 64); lstrcpynW (psfi->szTypeName, sTemp, 64);
strcatW (psfi->szTypeName, szSpaceFile); lstrcatW (psfi->szTypeName, szSpaceFile);
} }
else else
{ {
@ -361,12 +358,12 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) && HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &psfi->iIcon)) HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &psfi->iIcon))
{ {
if (lstrcmpW(p1W, sTemp)) if (wcscmp(p1W, sTemp))
strcpyW(psfi->szDisplayName, sTemp); lstrcpyW(psfi->szDisplayName, sTemp);
else else
{ {
/* the icon is in the file */ /* the icon is in the file */
strcpyW(psfi->szDisplayName, szFullPath); lstrcpyW(psfi->szDisplayName, szFullPath);
} }
} }
else else
@ -420,8 +417,8 @@ DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path,DWORD dwFileAttributes,
HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) && HCR_MapTypeToValueW(szExt, sTemp, MAX_PATH, TRUE) &&
HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &icon_idx)) HCR_GetDefaultIconW(sTemp, sTemp, MAX_PATH, &icon_idx))
{ {
if (!lstrcmpW(p1W,sTemp)) /* icon is in the file */ if (!wcscmp(p1W,sTemp)) /* icon is in the file */
strcpyW(sTemp, szFullPath); lstrcpyW(sTemp, szFullPath);
psfi->iIcon = SIC_GetIconIndex(sTemp, icon_idx, 0); psfi->iIcon = SIC_GetIconIndex(sTemp, icon_idx, 0);
if (psfi->iIcon == -1) if (psfi->iIcon == -1)
@ -891,12 +888,12 @@ static void add_authors( HWND list )
MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW ); MultiByteToWideChar( CP_UTF8, 0, strA, sizeA, strW, sizeW );
strW[sizeW - 1] = 0; strW[sizeW - 1] = 0;
start = strpbrkW( strW, eol ); /* skip the header line */ start = wcspbrk( strW, eol ); /* skip the header line */
while (start) while (start)
{ {
while (*start && strchrW( eol, *start )) start++; while (*start && wcschr( eol, *start )) start++;
if (!*start) break; if (!*start) break;
end = strpbrkW( start, eol ); end = wcspbrk( start, eol );
if (end) *end++ = 0; if (end) *end++ = 0;
SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start ); SendMessageW( list, LB_ADDSTRING, -1, (LPARAM)start );
start = end; start = end;
@ -928,7 +925,7 @@ static INT_PTR CALLBACK AboutDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
"wine_get_build_id"); "wine_get_build_id");
SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0); SendDlgItemMessageW(hWnd, stc1, STM_SETICON,(WPARAM)info->hIcon, 0);
GetWindowTextW( hWnd, template, ARRAY_SIZE(template) ); GetWindowTextW( hWnd, template, ARRAY_SIZE(template) );
sprintfW( buffer, template, info->szApp ); swprintf( buffer, ARRAY_SIZE(buffer), template, info->szApp );
SetWindowTextW( hWnd, buffer ); SetWindowTextW( hWnd, buffer );
SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT1), info->szApp ); SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT1), info->szApp );
SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT2), info->szOtherStuff ); 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) if (wine_get_build_id)
{ {
MultiByteToWideChar( CP_UTF8, 0, wine_get_build_id(), -1, version, ARRAY_SIZE(version) ); 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 ); SetWindowTextW( GetDlgItem(hWnd, IDC_ABOUT_STATIC_TEXT3), buffer );
} }
hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_LISTBOX); hWndCtl = GetDlgItem(hWnd, IDC_ABOUT_LISTBOX);

View File

@ -36,7 +36,6 @@
#include "shlobj.h" #include "shlobj.h"
#include "shellapi.h" #include "shellapi.h"
#include "wine/heap.h" #include "wine/heap.h"
#include "wine/unicode.h"
#include "wine/list.h" #include "wine/list.h"
/******************************************* /*******************************************

View File

@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#define COBJMACROS #define COBJMACROS

View File

@ -18,9 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>

View File

@ -309,15 +309,15 @@ BOOL run_winemenubuilder( const WCHAR *args )
void *redir; void *redir;
GetSystemDirectoryW( app, MAX_PATH - ARRAY_SIZE(menubuilder) ); 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 ); buffer = heap_alloc( len );
if( !buffer ) if( !buffer )
return FALSE; return FALSE;
strcpyW( buffer, app ); lstrcpyW( buffer, app );
strcatW( buffer, args ); lstrcatW( buffer, args );
TRACE("starting %s\n",debugstr_w(buffer)); TRACE("starting %s\n",debugstr_w(buffer));
@ -422,10 +422,10 @@ static HRESULT WINAPI IPersistFile_fnGetCurFile(IPersistFile* iface, LPOLESTR *f
return S_FALSE; return S_FALSE;
} }
*filename = CoTaskMemAlloc((strlenW(This->filepath) + 1) * sizeof(WCHAR)); *filename = CoTaskMemAlloc((lstrlenW(This->filepath) + 1) * sizeof(WCHAR));
if (!*filename) return E_OUTOFMEMORY; if (!*filename) return E_OUTOFMEMORY;
strcpyW(*filename, This->filepath); lstrcpyW(*filename, This->filepath);
return S_OK; return S_OK;
} }
@ -1946,7 +1946,7 @@ static HRESULT WINAPI IShellLinkW_fnSetIconLocation(IShellLinkW * iface, const W
heap_free(This->sIcoPath); heap_free(This->sIcoPath);
if (path) if (path)
{ {
size_t len = (strlenW(path) + 1) * sizeof(WCHAR); size_t len = (lstrlenW(path) + 1) * sizeof(WCHAR);
This->sIcoPath = heap_alloc(len); This->sIcoPath = heap_alloc(len);
if (!This->sIcoPath) if (!This->sIcoPath)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -2027,7 +2027,7 @@ static LPWSTR ShellLink_GetAdvertisedArg(LPCWSTR str)
if( !str ) if( !str )
return NULL; return NULL;
p = strchrW( str, ':' ); p = wcschr( str, ':' );
if( !p ) if( !p )
return NULL; return NULL;
len = p - str; len = p - str;
@ -2059,7 +2059,7 @@ static HRESULT ShellLink_SetAdvertiseInfo(IShellLinkImpl *This, LPCWSTR str)
str += 2; str += 2;
/* there must be a colon straight after a guid */ /* there must be a colon straight after a guid */
p = strchrW( str, ':' ); p = wcschr( str, ':' );
if( !p ) if( !p )
return E_FAIL; return E_FAIL;
len = p - str; len = p - str;
@ -2083,7 +2083,7 @@ static HRESULT ShellLink_SetAdvertiseInfo(IShellLinkImpl *This, LPCWSTR str)
return E_FAIL; return E_FAIL;
/* skip to the next field */ /* skip to the next field */
str = strchrW( str, ':' ); str = wcschr( str, ':' );
if( !str ) if( !str )
return E_FAIL; return E_FAIL;
} }
@ -2137,7 +2137,7 @@ static HRESULT WINAPI IShellLinkW_fnSetPath(IShellLinkW * iface, LPCWSTR pszFile
} }
/* any other quote marks are invalid */ /* any other quote marks are invalid */
if (strchrW(pszFile, '"')) if (wcschr(pszFile, '"'))
{ {
heap_free(unquoted); heap_free(unquoted);
return S_FALSE; return S_FALSE;
@ -2443,7 +2443,7 @@ ShellLink_QueryContextMenu( IContextMenu* iface, HMENU hmenu, UINT indexMenu,
mii.cbSize = sizeof mii; mii.cbSize = sizeof mii;
mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE; mii.fMask = MIIM_TYPE | MIIM_ID | MIIM_STATE;
mii.dwTypeData = szOpen; mii.dwTypeData = szOpen;
mii.cch = strlenW( mii.dwTypeData ); mii.cch = lstrlenW( mii.dwTypeData );
mii.wID = idCmdFirst + id++; mii.wID = idCmdFirst + id++;
mii.fState = MFS_DEFAULT | MFS_ENABLED; mii.fState = MFS_DEFAULT | MFS_ENABLED;
mii.fType = MFT_STRING; mii.fType = MFT_STRING;

View File

@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@ -42,7 +40,6 @@
#include "winerror.h" #include "winerror.h"
#include "undocshell.h" #include "undocshell.h"
#include "wine/unicode.h"
#include "shell32_main.h" #include "shell32_main.h"
#include "wine/debug.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 */ if ( !lpszwFile) goto end; /* needed buffer size */
lstrcpynW (lpszwFile, lpwDrop, lLength); lstrcpynW (lpszwFile, lpwDrop, lLength);
end: end:

View File

@ -19,7 +19,6 @@
* License along with this library; if not, write to the Free Software * License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@ -2012,7 +2011,7 @@ BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName,
if (GetFileAttributesW(pszLinkTo) == INVALID_FILE_ATTRIBUTES) if (GetFileAttributesW(pszLinkTo) == INVALID_FILE_ATTRIBUTES)
return FALSE; return FALSE;
basename = strrchrW(pszLinkTo, '\\'); basename = wcsrchr(pszLinkTo, '\\');
if (basename) if (basename)
basename = basename+1; basename = basename+1;
else else
@ -2022,13 +2021,13 @@ BOOL WINAPI SHGetNewLinkInfoW(LPCWSTR pszLinkTo, LPCWSTR pszDir, LPWSTR pszName,
if (!PathAddBackslashW(pszName)) if (!PathAddBackslashW(pszName))
return FALSE; 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) 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++; i++;
} }

View File

@ -26,16 +26,14 @@
#define COBJMACROS #define COBJMACROS
#include "config.h"
#include "wine/port.h"
#include <stdio.h> #include <stdio.h>
#include <stdarg.h> #include <stdarg.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include "wine/debug.h"
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "winternl.h"
#include "winnls.h" #include "winnls.h"
#include "winreg.h" #include "winreg.h"
#include "wingdi.h" #include "wingdi.h"
@ -50,12 +48,12 @@
#include "shell32_main.h" #include "shell32_main.h"
#include "undocshell.h" #include "undocshell.h"
#include "pidl.h" #include "pidl.h"
#include "wine/unicode.h"
#include "shlwapi.h" #include "shlwapi.h"
#include "sddl.h" #include "sddl.h"
#include "knownfolders.h" #include "knownfolders.h"
#include "initguid.h" #include "initguid.h"
#include "shobjidl.h" #include "shobjidl.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
@ -398,7 +396,7 @@ static BOOL PathIsExeW (LPCWSTR lpszPath)
TRACE("path=%s\n",debugstr_w(lpszPath)); TRACE("path=%s\n",debugstr_w(lpszPath));
for(i=0; lpszExtensions[i][0]; i++) for(i=0; lpszExtensions[i][0]; i++)
if (!strcmpiW(lpszExtension,lpszExtensions[i])) return TRUE; if (!wcsicmp(lpszExtension,lpszExtensions[i])) return TRUE;
return FALSE; return FALSE;
} }
@ -550,7 +548,7 @@ BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR sh
file = longname ? longname : shortname; file = longname ? longname : shortname;
PathCombineW(pathW, path, file); PathCombineW(pathW, path, file);
strcpyW(retW, pathW); lstrcpyW(retW, pathW);
PathRemoveExtensionW(pathW); PathRemoveExtensionW(pathW);
ext = PathFindExtensionW(file); ext = PathFindExtensionW(file);
@ -558,13 +556,11 @@ BOOL WINAPI PathYetAnotherMakeUniqueName(LPWSTR buffer, LPCWSTR path, LPCWSTR sh
/* now try to make it unique */ /* now try to make it unique */
while (PathFileExistsW(retW)) while (PathFileExistsW(retW))
{ {
static const WCHAR fmtW[] = {'%','s',' ','(','%','d',')','%','s',0}; swprintf(retW, ARRAY_SIZE(retW), L"%s (%d)%s", pathW, i, ext);
sprintfW(retW, fmtW, pathW, i, ext);
i++; i++;
} }
strcpyW(buffer, retW); lstrcpyW(buffer, retW);
TRACE("ret - %s\n", debugstr_w(buffer)); TRACE("ret - %s\n", debugstr_w(buffer));
return TRUE; return TRUE;
@ -602,7 +598,7 @@ int WINAPI PathCleanupSpec( LPCWSTR lpszPathW, LPWSTR lpszFileW )
TRACE("Cleanup %s\n",debugstr_w(lpszFileW)); TRACE("Cleanup %s\n",debugstr_w(lpszFileW));
if (lpszPathW) if (lpszPathW)
length = strlenW(lpszPathW); length = lstrlenW(lpszPathW);
while (*p) while (*p)
{ {
@ -788,8 +784,8 @@ static LONG PathProcessCommandW (
FIXME("(%s, %p, 0x%04x, 0x%04x) stub\n", FIXME("(%s, %p, 0x%04x, 0x%04x) stub\n",
debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags); debugstr_w(lpszPath), lpszBuff, dwBuffSize, dwFlags);
if(!lpszPath) return -1; if(!lpszPath) return -1;
if(lpszBuff) strcpyW(lpszBuff, lpszPath); if(lpszBuff) lstrcpyW(lpszBuff, lpszPath);
return strlenW(lpszPath); return lstrlenW(lpszPath);
} }
/************************************************************************* /*************************************************************************
@ -3509,13 +3505,13 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
if (userPrefix) if (userPrefix)
{ {
strcpyW(shellFolderPath, userPrefix); lstrcpyW(shellFolderPath, userPrefix);
PathAddBackslashW(shellFolderPath); PathAddBackslashW(shellFolderPath);
strcatW(shellFolderPath, szSHFolders); lstrcatW(shellFolderPath, szSHFolders);
pShellFolderPath = shellFolderPath; pShellFolderPath = shellFolderPath;
strcpyW(userShellFolderPath, userPrefix); lstrcpyW(userShellFolderPath, userPrefix);
PathAddBackslashW(userShellFolderPath); PathAddBackslashW(userShellFolderPath);
strcatW(userShellFolderPath, szSHUserFolders); lstrcatW(userShellFolderPath, szSHUserFolders);
pUserShellFolderPath = userShellFolderPath; pUserShellFolderPath = userShellFolderPath;
} }
else else
@ -3552,7 +3548,7 @@ static HRESULT _SHGetUserShellFolderPath(HKEY rootKey, LPCWSTR userPrefix,
lstrcpynW(path, szTemp, MAX_PATH); lstrcpynW(path, szTemp, MAX_PATH);
} }
ret = RegSetValueExW(shellFolderKey, value, 0, REG_SZ, (LPBYTE)path, ret = RegSetValueExW(shellFolderKey, value, 0, REG_SZ, (LPBYTE)path,
(strlenW(path) + 1) * sizeof(WCHAR)); (lstrlenW(path) + 1) * sizeof(WCHAR));
if (ret != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
hr = HRESULT_FROM_WIN32(ret); hr = HRESULT_FROM_WIN32(ret);
else else
@ -3571,12 +3567,12 @@ static void append_relative_path(BYTE folder, WCHAR *pszPath)
if (CSIDL_Data[folder].pszRelativePath) if (CSIDL_Data[folder].pszRelativePath)
{ {
PathAddBackslashW(pszPath); PathAddBackslashW(pszPath);
strcatW(pszPath, CSIDL_Data[folder].pszRelativePath); lstrcatW(pszPath, CSIDL_Data[folder].pszRelativePath);
} }
else if (CSIDL_Data[folder].szDefaultPath) else if (CSIDL_Data[folder].szDefaultPath)
{ {
PathAddBackslashW(pszPath); 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) switch (CSIDL_Data[folder].type)
{ {
case CSIDL_Type_User: case CSIDL_Type_User:
strcpyW(pszPath, UserProfileW); lstrcpyW(pszPath, UserProfileW);
break; break;
case CSIDL_Type_AllUsers: case CSIDL_Type_AllUsers:
strcpyW(pszPath, PublicProfileW); lstrcpyW(pszPath, PublicProfileW);
break; break;
case CSIDL_Type_ProgramData: case CSIDL_Type_ProgramData:
strcpyW(pszPath, ProgramDataVarW); lstrcpyW(pszPath, ProgramDataVarW);
break; break;
case CSIDL_Type_CurrVer: case CSIDL_Type_CurrVer:
strcpyW(pszPath, SystemDriveW); lstrcpyW(pszPath, SystemDriveW);
break; break;
default: default:
; /* no corresponding env. var, do nothing */ ; /* no corresponding env. var, do nothing */
@ -3707,7 +3703,7 @@ static HRESULT _SHGetCurrentVersionPath(DWORD dwFlags, BYTE folder,
/* fall through */ /* fall through */
default: default:
RegSetValueExW(hKey, CSIDL_Data[folder].szValueName, 0, dwType, RegSetValueExW(hKey, CSIDL_Data[folder].szValueName, 0, dwType,
(LPBYTE)pszPath, (strlenW(pszPath)+1)*sizeof(WCHAR)); (LPBYTE)pszPath, (lstrlenW(pszPath)+1)*sizeof(WCHAR));
} }
} }
else else
@ -3905,7 +3901,7 @@ static HRESULT _SHGetProfilesValue(HKEY profilesKey, LPCWSTR szValueName,
debugstr_w(szValue)); debugstr_w(szValue));
lRet = RegSetValueExW(profilesKey, szValueName, 0, REG_EXPAND_SZ, lRet = RegSetValueExW(profilesKey, szValueName, 0, REG_EXPAND_SZ,
(LPBYTE)szValue, (LPBYTE)szValue,
(strlenW(szValue) + 1) * sizeof(WCHAR)); (lstrlenW(szValue) + 1) * sizeof(WCHAR));
if (lRet) if (lRet)
hr = HRESULT_FROM_WIN32(lRet); hr = HRESULT_FROM_WIN32(lRet);
else else
@ -3940,7 +3936,7 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
/* short-circuit if there's nothing to expand */ /* short-circuit if there's nothing to expand */
if (szSrc[0] != '%') if (szSrc[0] != '%')
{ {
strcpyW(szDest, szSrc); lstrcpyW(szDest, szSrc);
hr = S_OK; hr = S_OK;
goto end; goto end;
} }
@ -3952,38 +3948,38 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
/* get the system drive */ /* get the system drive */
GetSystemDirectoryW(def_val, MAX_PATH); GetSystemDirectoryW(def_val, MAX_PATH);
strcpyW( def_val + 3, szDefaultProfileDirW ); lstrcpyW( def_val + 3, szDefaultProfileDirW );
hr = _SHGetProfilesValue(key, ProfilesDirectoryW, szProfilesPrefix, def_val ); hr = _SHGetProfilesValue(key, ProfilesDirectoryW, szProfilesPrefix, def_val );
} }
*szDest = 0; *szDest = 0;
strcpyW(szTemp, szSrc); lstrcpyW(szTemp, szSrc);
while (SUCCEEDED(hr) && szTemp[0] == '%') 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]; WCHAR szAllUsers[MAX_PATH], def_val[MAX_PATH];
GetSystemDirectoryW(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); hr = _SHGetProfilesValue(key, PublicW, szAllUsers, def_val);
PathAppendW(szDest, szAllUsers); 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]; WCHAR szAllUsers[MAX_PATH], def_val[MAX_PATH];
GetSystemDirectoryW(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); hr = _SHGetProfilesValue(key, PublicW, szAllUsers, def_val);
PathAppendW(szDest, szAllUsers); 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]; WCHAR szProgramData[MAX_PATH], def_val[MAX_PATH];
HKEY shellFolderKey; HKEY shellFolderKey;
@ -4002,27 +3998,27 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
if (!in_registry) if (!in_registry)
{ {
GetSystemDirectoryW(def_val, MAX_PATH); GetSystemDirectoryW(def_val, MAX_PATH);
strcpyW( def_val + 3, ProgramDataW ); lstrcpyW( def_val + 3, ProgramDataW );
} }
hr = _SHGetProfilesValue(key, ProgramDataW, szProgramData, def_val); hr = _SHGetProfilesValue(key, ProgramDataW, szProgramData, def_val);
PathAppendW(szDest, szProgramData); 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]; WCHAR userName[MAX_PATH];
DWORD userLen = MAX_PATH; DWORD userLen = MAX_PATH;
strcpyW(szDest, szProfilesPrefix); lstrcpyW(szDest, szProfilesPrefix);
GetUserNameW(userName, &userLen); GetUserNameW(userName, &userLen);
PathAppendW(szDest, userName); 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); GetSystemDirectoryW(szDest, MAX_PATH);
strcpyW(szDest + 3, szTemp + strlenW(SystemDriveW) + 1); lstrcpyW(szDest + 3, szTemp + lstrlenW(SystemDriveW) + 1);
} }
else else
{ {
@ -4032,9 +4028,9 @@ static HRESULT _SHExpandEnvironmentStrings(LPCWSTR szSrc, LPWSTR szDest)
hr = E_NOT_SUFFICIENT_BUFFER; hr = E_NOT_SUFFICIENT_BUFFER;
else if (ret == 0) else if (ret == 0)
hr = HRESULT_FROM_WIN32(GetLastError()); 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: end:
if (key) 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; if (!GetEnvironmentVariableW( homedirW, var, MAX_PATH )) return TRUE;
fmt = home_fmtW; fmt = home_fmtW;
} }
name = heap_alloc( (strlenW(var) + strlenW(fmt)) * sizeof(WCHAR) ); len = lstrlenW(var) + lstrlenW(fmt);
sprintfW( name, fmt, var ); name = heap_alloc( len * sizeof(WCHAR) );
swprintf( name, len, fmt, var );
name[1] = '\\'; /* change \??\ to \\?\ */ name[1] = '\\'; /* change \??\ to \\?\ */
for (ptr = name; *ptr; ptr++) if (*ptr == '/') *ptr = '\\'; for (ptr = name; *ptr; ptr++) if (*ptr == '/') *ptr = '\\';
@ -4381,7 +4378,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirW(
if (*szTemp == '%') if (*szTemp == '%')
hr = _SHExpandEnvironmentStrings(szTemp, szBuildPath); hr = _SHExpandEnvironmentStrings(szTemp, szBuildPath);
else else
strcpyW(szBuildPath, szTemp); lstrcpyW(szBuildPath, szTemp);
if (FAILED(hr)) goto end; if (FAILED(hr)) goto end;
@ -4397,7 +4394,7 @@ HRESULT WINAPI SHGetFolderPathAndSubDirW(
} }
/* Copy the path if it's available before we might return */ /* Copy the path if it's available before we might return */
if (SUCCEEDED(hr) && pszPath) if (SUCCEEDED(hr) && pszPath)
strcpyW(pszPath, szBuildPath); lstrcpyW(pszPath, szBuildPath);
/* if we don't care about existing directories we are ready */ /* if we don't care about existing directories we are ready */
if(nFolder & CSIDL_FLAG_DONT_VERIFY) goto end; if(nFolder & CSIDL_FLAG_DONT_VERIFY) goto end;
@ -4525,7 +4522,7 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken,
if (*path) if (*path)
{ {
ret = RegSetValueExW(hUserKey, szValueName, 0, REG_EXPAND_SZ, ret = RegSetValueExW(hUserKey, szValueName, 0, REG_EXPAND_SZ,
(LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR)); (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR));
if (ret) if (ret)
hr = HRESULT_FROM_WIN32(ret); hr = HRESULT_FROM_WIN32(ret);
else else
@ -4533,7 +4530,7 @@ static HRESULT _SHRegisterFolders(HKEY hRootKey, HANDLE hToken,
hr = SHGetFolderPathW(NULL, folders[i] | CSIDL_FLAG_CREATE, hr = SHGetFolderPathW(NULL, folders[i] | CSIDL_FLAG_CREATE,
hToken, SHGFP_TYPE_DEFAULT, path); hToken, SHGFP_TYPE_DEFAULT, path);
ret = RegSetValueExW(hKey, szValueName, 0, REG_SZ, ret = RegSetValueExW(hKey, szValueName, 0, REG_SZ,
(LPBYTE)path, (strlenW(path) + 1) * sizeof(WCHAR)); (LPBYTE)path, (lstrlenW(path) + 1) * sizeof(WCHAR));
if (ret) if (ret)
hr = HRESULT_FROM_WIN32(ret); hr = HRESULT_FROM_WIN32(ret);
} }
@ -4598,13 +4595,13 @@ static HRESULT _SHRegisterUserShellFolders(BOOL bDefault)
{ {
hToken = (HANDLE)-1; hToken = (HANDLE)-1;
hRootKey = HKEY_USERS; hRootKey = HKEY_USERS;
strcpyW(userShellFolderPath, DefaultW); lstrcpyW(userShellFolderPath, DefaultW);
PathAddBackslashW(userShellFolderPath); PathAddBackslashW(userShellFolderPath);
strcatW(userShellFolderPath, szSHUserFolders); lstrcatW(userShellFolderPath, szSHUserFolders);
pUserShellFolderPath = userShellFolderPath; pUserShellFolderPath = userShellFolderPath;
strcpyW(shellFolderPath, DefaultW); lstrcpyW(shellFolderPath, DefaultW);
PathAddBackslashW(shellFolderPath); PathAddBackslashW(shellFolderPath);
strcatW(shellFolderPath, szSHFolders); lstrcatW(shellFolderPath, szSHFolders);
pShellFolderPath = shellFolderPath; pShellFolderPath = shellFolderPath;
} }
else else
@ -4673,10 +4670,10 @@ static HRESULT create_extra_folders(void)
{ {
size = sizeof(path); size = sizeof(path);
if (RegQueryValueExW( hkey, TEMPW, NULL, &type, (LPBYTE)path, &size )) 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); size = sizeof(path);
if (RegQueryValueExW( hkey, TMPW, NULL, &type, (LPBYTE)path, &size )) 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 ); RegCloseKey( hkey );
@ -4740,9 +4737,9 @@ static HRESULT set_folder_attributes(void)
for (i = 0; i < ARRAY_SIZE(folders); i++) for (i = 0; i < ARRAY_SIZE(folders); i++)
{ {
strcpyW( buffer, clsidW ); lstrcpyW( buffer, clsidW );
StringFromGUID2( folders[i].clsid, buffer + strlenW(buffer), 39 ); StringFromGUID2( folders[i].clsid, buffer + lstrlenW(buffer), 39 );
strcatW( buffer, shellfolderW ); lstrcatW( buffer, shellfolderW );
res = RegCreateKeyExW( HKEY_CLASSES_ROOT, buffer, 0, NULL, 0, res = RegCreateKeyExW( HKEY_CLASSES_ROOT, buffer, 0, NULL, 0,
KEY_READ | KEY_WRITE, NULL, &hkey, NULL); KEY_READ | KEY_WRITE, NULL, &hkey, NULL);
if (res) return HRESULT_FROM_WIN32( res ); 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); 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) if (!*ret_path)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
strcpyW(*ret_path, pathW); lstrcpyW(*ret_path, pathW);
return hr; return hr;
} }
@ -4988,12 +4985,12 @@ HRESULT WINAPI SHGetFolderPathEx(REFKNOWNFOLDERID rfid, DWORD flags, HANDLE toke
hr = SHGetKnownFolderPath( rfid, flags, token, &buffer ); hr = SHGetKnownFolderPath( rfid, flags, token, &buffer );
if (SUCCEEDED( hr )) if (SUCCEEDED( hr ))
{ {
if (strlenW( buffer ) + 1 > len) if (lstrlenW( buffer ) + 1 > len)
{ {
CoTaskMemFree( buffer ); CoTaskMemFree( buffer );
return HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER ); return HRESULT_FROM_WIN32( ERROR_INSUFFICIENT_BUFFER );
} }
strcpyW( path, buffer ); lstrcpyW( path, buffer );
CoTaskMemFree( buffer ); CoTaskMemFree( buffer );
} }
return hr; return hr;
@ -5796,7 +5793,7 @@ static HRESULT WINAPI foldermanager_GetFolderByName(
heap_free( path ); heap_free( path );
if (FAILED( hr )) return hr; if (FAILED( hr )) return hr;
found = !strcmpiW( pszCanonicalName, name ); found = !wcsicmp( pszCanonicalName, name );
CoTaskMemFree( name ); CoTaskMemFree( name );
if (found) break; if (found) break;
} }

View File

@ -18,8 +18,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
@ -155,12 +153,8 @@ HRESULT WINAPI SHRegCloseKey (HKEY hkey)
*/ */
HRESULT WINAPI SHCreateSessionKey(REGSAM access, 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; DWORD session, ret;
WCHAR str[ARRAY_SIZE(session_format) + 16]; WCHAR str[ARRAY_SIZE(L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\SessionInfo\\") + 16];
if (hkey) if (hkey)
*hkey = NULL; *hkey = NULL;
@ -171,7 +165,8 @@ HRESULT WINAPI SHCreateSessionKey(REGSAM access, HKEY *hkey)
if (!ProcessIdToSessionId(GetCurrentProcessId(), &session)) if (!ProcessIdToSessionId(GetCurrentProcessId(), &session))
return E_INVALIDARG; 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)); TRACE("using session key %s\n", debugstr_w(str));
ret = RegCreateKeyExW(HKEY_CURRENT_USER, str, 0, NULL, REG_OPTION_VOLATILE, access, NULL, hkey, NULL); ret = RegCreateKeyExW(HKEY_CURRENT_USER, str, 0, NULL, REG_OPTION_VOLATILE, access, NULL, hkey, NULL);

View File

@ -35,7 +35,6 @@
#include "shlwapi.h" #include "shlwapi.h"
#include "shell32_main.h" #include "shell32_main.h"
#include "undocshell.h" #include "undocshell.h"
#include "wine/unicode.h"
#include "wine/debug.h" #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell); WINE_DEFAULT_DEBUG_CHANNEL(shell);
@ -155,8 +154,8 @@ static int StrToOleStrW (LPWSTR lpWideCharStr, LPCWSTR lpWString)
TRACE("(%p, %p %s)\n", TRACE("(%p, %p %s)\n",
lpWideCharStr, lpWString, debugstr_w(lpWString)); lpWideCharStr, lpWString, debugstr_w(lpWString));
strcpyW (lpWideCharStr, lpWString ); lstrcpyW (lpWideCharStr, lpWString );
return strlenW(lpWideCharStr); return lstrlenW(lpWideCharStr);
} }
BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString) BOOL WINAPI StrToOleStrAW (LPWSTR lpWideCharStr, LPCVOID lpString)

View File

@ -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','2','x','%','0','2','x','%','0','2','x','%','0','2','x',
'%','0','2','x','%','0','2','x','}',0 }; '%','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->Data1, guid->Data2, guid->Data3,
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3], guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]); guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);

View File

@ -20,9 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@ -189,7 +186,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
pidlTemp = _ILCreateMyComputer (); pidlTemp = _ILCreateMyComputer ();
szNext = lpszDisplayName; szNext = lpszDisplayName;
} }
else if (!strncmpW( lpszDisplayName, unix_root, 9 )) else if (!wcsncmp( lpszDisplayName, unix_root, 9 ))
{ {
pidlTemp = _ILCreateGuid(PT_GUID, &CLSID_UnixDosFolder); pidlTemp = _ILCreateGuid(PT_GUID, &CLSID_UnixDosFolder);
szNext = lpszDisplayName; szNext = lpszDisplayName;
@ -303,7 +300,7 @@ static void add_shell_namespace_extensions(IEnumIDListImpl *list, HKEY root)
DWORD attributes, value_size = sizeof(attributes); DWORD attributes, value_size = sizeof(attributes);
/* Check if extension is configured as nonenumerable */ /* 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, RegGetValueW(HKEY_CLASSES_ROOT, clsidkeyW, attributesW, RRF_RT_REG_DWORD | RRF_ZEROONFAILURE,
NULL, &attributes, &value_size); NULL, &attributes, &value_size);
@ -603,7 +600,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
{ {
if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) && if ((GET_SHGDN_RELATION (dwFlags) == SHGDN_NORMAL) &&
(GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING)) (GET_SHGDN_FOR (dwFlags) & SHGDN_FORPARSING))
strcpyW(pszPath, This->sPathTarget); lstrcpyW(pszPath, This->sPathTarget);
else else
HCR_GetClassNameW(&CLSID_ShellDesktop, pszPath, MAX_PATH); HCR_GetClassNameW(&CLSID_ShellDesktop, pszPath, MAX_PATH);
} }

View File

@ -20,9 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@ -346,16 +343,16 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
lstrcpynW( szPath + len, lpszDisplayName + 1, MAX_PATH - len ); lstrcpynW( szPath + len, lpszDisplayName + 1, MAX_PATH - len );
for (p = szPath + len; *p; p++) if (*p == '/') *p = '\\'; 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 ); lstrcpynW( szPath + len, lpszDisplayName + 9, MAX_PATH - len );
if ((p = strchrW( szPath + len, '\\' ))) if ((p = wcschr( szPath + len, '\\' )))
while (*p == '\\') *p++ = 0; while (*p == '\\') *p++ = 0;
szNext = p; szNext = p;
} }
/* Special case for the root folder. */ /* Special case for the root folder. */
if (!strcmpiW( szPath, unix_root )) if (!wcsicmp( szPath, unix_root ))
{ {
*ppidl = SHAlloc(sizeof(USHORT)); *ppidl = SHAlloc(sizeof(USHORT));
if (!*ppidl) return E_FAIL; if (!*ppidl) return E_FAIL;
@ -371,7 +368,7 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) && fsbd) if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND) && fsbd)
{ {
find_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; find_data.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY;
strcpyW( find_data.cFileName, szPath + len ); lstrcpyW( find_data.cFileName, szPath + len );
pidlTemp = _ILCreateFromFindDataW( &find_data ); pidlTemp = _ILCreateFromFindDataW( &find_data );
} }
if (pidlTemp) /* try to analyse the next element */ if (pidlTemp) /* try to analyse the next element */
@ -384,7 +381,7 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
{ {
if (FAILED( IFileSystemBindData_GetFindData( fsbd, &find_data ))) if (FAILED( IFileSystemBindData_GetFindData( fsbd, &find_data )))
find_data.dwFileAttributes = FILE_ATTRIBUTE_NORMAL; find_data.dwFileAttributes = FILE_ATTRIBUTE_NORMAL;
strcpyW( find_data.cFileName, szPath + len ); lstrcpyW( find_data.cFileName, szPath + len );
pidlTemp = _ILCreateFromFindDataW( &find_data ); pidlTemp = _ILCreateFromFindDataW( &find_data );
} }
else hr = _ILCreateFromPathW(szPath, &pidlTemp); else hr = _ILCreateFromPathW(szPath, &pidlTemp);
@ -623,7 +620,7 @@ static HRESULT SHELL32_CreateExtensionUIObject(IShellFolder2 *iface,
MultiByteToWideChar(CP_ACP, 0, extensionA, -1, extensionW, 20); 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[0], riid->Data4[1], riid->Data4[2], riid->Data4[3],
riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7]); 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 ); lstrcpynW( dest, path, MAX_PATH );
/* try to get a better path than the \\?\unix one */ /* 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) if (!is_unix)
{ {
@ -964,7 +961,7 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface,
/* pidl has to contain a single non-empty SHITEMID */ /* pidl has to contain a single non-empty SHITEMID */
if (_ILIsDesktop(pidl) || !_ILIsPidlSimple(pidl) || !_ILGetTextPointer(pidl)) return E_INVALIDARG; 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 */ /* build source path */
lstrcpynW(szSrc, This->sPathTarget, MAX_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)) { if(!(dwFlags & SHGDN_FORPARSING) && SHELL_FS_HideExtension(szSrc)) {
WCHAR *ext = PathFindExtensionW(szSrc); WCHAR *ext = PathFindExtensionW(szSrc);
if(*ext != '\0') { if(*ext != '\0') {
INT len = strlenW(szDest); INT len = lstrlenW(szDest);
lstrcpynW(szDest + len, ext, MAX_PATH - len); lstrcpynW(szDest + len, ext, MAX_PATH - len);
} }
} }
@ -1168,7 +1165,7 @@ next:
dwFetched) { dwFetched) {
_ILSimpleGetTextW (pidl, wszText, MAX_PATH); _ILSimpleGetTextW (pidl, wszText, MAX_PATH);
if (0 == lstrcmpiW (wszText, pwszName)) { if (0 == lstrcmpiW (wszText, pwszName)) {
snprintfW (pwszName, uLen, wszFormat, wszNewFolder, i++); swprintf (pwszName, uLen, wszFormat, wszNewFolder, i++);
if (i > 99) { if (i > 99) {
hr = E_FAIL; hr = E_FAIL;
break; break;
@ -1242,7 +1239,7 @@ ISFHelper_fnAddFolder (ISFHelper * iface, HWND hwnd, LPCWSTR pwszName,
/* Cannot Create folder because of permissions */ /* Cannot Create folder because of permissions */
LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_DENIED, wszTempText, ARRAY_SIZE(wszTempText)); LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_DENIED, wszTempText, ARRAY_SIZE(wszTempText));
LoadStringW (shell32_hInstance, IDS_CREATEFOLDER_CAPTION, wszCaption, ARRAY_SIZE(wszCaption)); 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); MessageBoxW (hwnd, wszText, wszCaption, MB_OK | MB_ICONEXCLAMATION);
} }
@ -1500,12 +1497,12 @@ IFSFldr_PersistFolder3_Initialize (IPersistFolder3 * iface, LPCITEMIDLIST pidl)
else else
{ {
static const WCHAR unix_root[] = {'\\','\\','?','\\','u','n','i','x','\\',0}; static const WCHAR unix_root[] = {'\\','\\','?','\\','u','n','i','x','\\',0};
strcpyW( wszTemp, unix_root ); lstrcpyW( wszTemp, unix_root );
} }
} }
else SHGetPathFromIDListW( pidl, wszTemp ); else SHGetPathFromIDListW( pidl, wszTemp );
if ((len = strlenW(wszTemp))) if ((len = lstrlenW(wszTemp)))
{ {
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR)); This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
if (!This->sPathTarget) return E_OUTOFMEMORY; if (!This->sPathTarget) return E_OUTOFMEMORY;
@ -1581,14 +1578,14 @@ IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface,
if (ppfti->csidl != -1) { if (ppfti->csidl != -1) {
if (SHGetSpecialFolderPathW (0, wszTemp, ppfti->csidl, if (SHGetSpecialFolderPathW (0, wszTemp, ppfti->csidl,
ppfti->csidl & CSIDL_FLAG_CREATE)) { ppfti->csidl & CSIDL_FLAG_CREATE)) {
int len = strlenW(wszTemp); int len = lstrlenW(wszTemp);
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR)); This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
if (!This->sPathTarget) if (!This->sPathTarget)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
memcpy(This->sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR)); memcpy(This->sPathTarget, wszTemp, (len + 1) * sizeof(WCHAR));
} }
} else if (ppfti->szTargetParsingName[0]) { } else if (ppfti->szTargetParsingName[0]) {
int len = strlenW(ppfti->szTargetParsingName); int len = lstrlenW(ppfti->szTargetParsingName);
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR)); This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
if (!This->sPathTarget) if (!This->sPathTarget)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
@ -1596,7 +1593,7 @@ IFSFldr_PersistFolder3_InitializeEx (IPersistFolder3 * iface,
(len + 1) * sizeof(WCHAR)); (len + 1) * sizeof(WCHAR));
} else if (ppfti->pidlTargetFolder) { } else if (ppfti->pidlTargetFolder) {
if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp)) { if (SHGetPathFromIDListW(ppfti->pidlTargetFolder, wszTemp)) {
int len = strlenW(wszTemp); int len = lstrlenW(wszTemp);
This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR)); This->sPathTarget = SHAlloc((len + 1) * sizeof(WCHAR));
if (!This->sPathTarget) if (!This->sPathTarget)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;

View File

@ -19,9 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@ -699,10 +696,10 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
GetVolumeInformationW (pszPath, wszDrive, ARRAY_SIZE(wszDrive) - 5, NULL, NULL, GetVolumeInformationW (pszPath, wszDrive, ARRAY_SIZE(wszDrive) - 5, NULL, NULL,
NULL, NULL, 0); NULL, NULL, 0);
strcatW (wszDrive, wszOpenBracket); lstrcatW (wszDrive, wszOpenBracket);
lstrcpynW (wszDrive + strlenW(wszDrive), pszPath, 3); lstrcpynW (wszDrive + lstrlenW(wszDrive), pszPath, 3);
strcatW (wszDrive, wszCloseBracket); lstrcatW (wszDrive, wszCloseBracket);
strcpyW (pszPath, wszDrive); lstrcpyW (pszPath, wszDrive);
} }
} }
else else

View File

@ -20,9 +20,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
@ -40,7 +37,6 @@
#include "shell32_main.h" #include "shell32_main.h"
#include "shresdef.h" #include "shresdef.h"
#include "wine/debug.h" #include "wine/debug.h"
#include "wine/unicode.h"
#include "debughlp.h" #include "debughlp.h"
#include "shfldr.h" #include "shfldr.h"
@ -196,8 +192,8 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * ifac
*ppidl = NULL; *ppidl = NULL;
szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH); szNext = GetNextElementW (lpszDisplayName, szElement, MAX_PATH);
len = strlenW(szElement); len = lstrlenW(szElement);
if (len == ARRAY_SIZE(wszEntireNetwork) && !strncmpiW(szElement, wszEntireNetwork, ARRAY_SIZE(wszEntireNetwork))) if (len == ARRAY_SIZE(wszEntireNetwork) && !wcsnicmp(szElement, wszEntireNetwork, ARRAY_SIZE(wszEntireNetwork)))
{ {
pidlTemp = _ILCreateEntireNetwork(); pidlTemp = _ILCreateEntireNetwork();
if (pidlTemp) if (pidlTemp)

View File

@ -19,16 +19,10 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>
#include <stdio.h> #include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
#include <ctype.h> #include <ctype.h>
#include <assert.h> #include <assert.h>
@ -163,11 +157,11 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
else else
cmd = lpFile; cmd = lpFile;
used += strlenW(cmd); used += lstrlenW(cmd);
if (used < len) if (used < len)
{ {
strcpyW(res, cmd); lstrcpyW(res, cmd);
res += strlenW(cmd); res += lstrlenW(cmd);
} }
} }
found_p1 = TRUE; 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':
case 'L': case 'L':
if (lpFile) { if (lpFile) {
used += strlenW(lpFile); used += lstrlenW(lpFile);
if (used < len) if (used < len)
{ {
strcpyW(res, lpFile); lstrcpyW(res, lpFile);
res += strlenW(lpFile); res += lstrlenW(lpFile);
} }
} }
found_p1 = TRUE; found_p1 = TRUE;
@ -201,13 +195,13 @@ static BOOL SHELL_ArgifyW(WCHAR* out, int len, const WCHAR* fmt, const WCHAR* lp
LPVOID pv; LPVOID pv;
HGLOBAL hmem = SHAllocShared(pidl, ILGetSize(pidl), 0); HGLOBAL hmem = SHAllocShared(pidl, ILGetSize(pidl), 0);
pv = SHLockShared(hmem, 0); pv = SHLockShared(hmem, 0);
chars = sprintfW(buf, wszILPtr, pv); chars = swprintf(buf, ARRAY_SIZE(buf), wszILPtr, pv);
if (chars >= ARRAY_SIZE(buf)) if (chars >= ARRAY_SIZE(buf))
ERR("pidl format buffer too small!\n"); ERR("pidl format buffer too small!\n");
used += chars; used += chars;
if (used < len) if (used < len)
{ {
strcpyW(res,buf); lstrcpyW(res,buf);
res += chars; res += chars;
} }
SHUnlockShared(pv); 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 %.*/ /* Make sure that we have at least one more %.*/
if (strchrW(fmt, '%')) if (wcschr(fmt, '%'))
{ {
WCHAR tmpBuffer[1024]; WCHAR tmpBuffer[1024];
PWSTR tmpB = tmpBuffer; 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); envRet = GetEnvironmentVariableW(tmpBuffer, tmpEnvBuff, MAX_PATH);
if (envRet == 0 || envRet > MAX_PATH) if (envRet == 0 || envRet > MAX_PATH)
{ {
used += strlenW(tmpBuffer); used += lstrlenW(tmpBuffer);
if (used < len) if (used < len)
{ {
strcpyW( res, tmpBuffer ); lstrcpyW( res, tmpBuffer );
res += strlenW(tmpBuffer); res += lstrlenW(tmpBuffer);
} }
} }
else else
{ {
used += strlenW(tmpEnvBuff); used += lstrlenW(tmpEnvBuff);
if (used < len) if (used < len)
{ {
strcpyW( res, tmpEnvBuff ); lstrcpyW( res, tmpEnvBuff );
res += strlenW(tmpEnvBuff); res += lstrlenW(tmpEnvBuff);
} }
} }
} }
@ -382,15 +376,15 @@ static void *SHELL_BuildEnvW( const WCHAR *path )
static const WCHAR wPath[] = {'P','A','T','H','=',0}; static const WCHAR wPath[] = {'P','A','T','H','=',0};
WCHAR *strings, *new_env; WCHAR *strings, *new_env;
WCHAR *p, *p2; WCHAR *p, *p2;
int total = strlenW(path) + 1; int total = lstrlenW(path) + 1;
BOOL got_path = FALSE; BOOL got_path = FALSE;
if (!(strings = GetEnvironmentStringsW())) return NULL; if (!(strings = GetEnvironmentStringsW())) return NULL;
p = strings; p = strings;
while (*p) while (*p)
{ {
int len = strlenW(p) + 1; int len = lstrlenW(p) + 1;
if (!strncmpiW( p, wPath, 5 )) got_path = TRUE; if (!wcsnicmp( p, wPath, 5 )) got_path = TRUE;
total += len; total += len;
p += len; p += len;
} }
@ -406,22 +400,22 @@ static void *SHELL_BuildEnvW( const WCHAR *path )
p2 = new_env; p2 = new_env;
while (*p) while (*p)
{ {
int len = strlenW(p) + 1; int len = lstrlenW(p) + 1;
memcpy( p2, p, len * sizeof(WCHAR) ); memcpy( p2, p, len * sizeof(WCHAR) );
if (!strncmpiW( p, wPath, 5 )) if (!wcsnicmp( p, wPath, 5 ))
{ {
p2[len - 1] = ';'; p2[len - 1] = ';';
strcpyW( p2 + len, path ); lstrcpyW( p2 + len, path );
p2 += strlenW(path) + 1; p2 += lstrlenW(path) + 1;
} }
p += len; p += len;
p2 += len; p2 += len;
} }
if (!got_path) if (!got_path)
{ {
strcpyW( p2, wPath ); lstrcpyW( p2, wPath );
strcatW( p2, path ); lstrcatW( p2, path );
p2 += strlenW(p2) + 1; p2 += lstrlenW(p2) + 1;
} }
*p2 = 0; *p2 = 0;
FreeEnvironmentStringsW( strings ); FreeEnvironmentStringsW( strings );
@ -449,8 +443,8 @@ static BOOL SHELL_TryAppPathW( LPCWSTR szName, LPWSTR lpResult, WCHAR **env)
BOOL found = FALSE; BOOL found = FALSE;
if (env) *env = NULL; if (env) *env = NULL;
strcpyW(buffer, wszKeyAppPaths); lstrcpyW(buffer, wszKeyAppPaths);
strcatW(buffer, szName); lstrcatW(buffer, szName);
res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, buffer, 0, KEY_READ, &hkApp); res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, buffer, 0, KEY_READ, &hkApp);
if (res) goto end; if (res) goto end;
@ -502,15 +496,15 @@ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classn
RegCloseKey(hkeyClass); RegCloseKey(hkeyClass);
/* Looking for ...buffer\shell\<verb>\command */ /* Looking for ...buffer\shell\<verb>\command */
strcatW(classname, wszShell); lstrcatW(classname, wszShell);
strcatW(classname, verb); lstrcatW(classname, verb);
strcatW(classname, wCommand); lstrcatW(classname, wCommand);
if (RegQueryValueW(HKEY_CLASSES_ROOT, classname, command, if (RegQueryValueW(HKEY_CLASSES_ROOT, classname, command,
&commandlen) == ERROR_SUCCESS) &commandlen) == ERROR_SUCCESS)
{ {
commandlen /= sizeof(WCHAR); commandlen /= sizeof(WCHAR);
if (key) strcpyW(key, classname); if (key) lstrcpyW(key, classname);
#if 0 #if 0
LPWSTR tmp; LPWSTR tmp;
WCHAR param[256]; WCHAR param[256];
@ -524,15 +518,15 @@ static UINT SHELL_FindExecutableByVerb(LPCWSTR lpVerb, LPWSTR key, LPWSTR classn
*/ */
/* Get the parameters needed by the application /* Get the parameters needed by the application
from the associated ddeexec key */ from the associated ddeexec key */
tmp = strstrW(classname, wCommand); tmp = wcsstr(classname, wCommand);
tmp[0] = '\0'; tmp[0] = '\0';
strcatW(classname, wDdeexec); lstrcatW(classname, wDdeexec);
if (RegQueryValueW(HKEY_CLASSES_ROOT, classname, param, if (RegQueryValueW(HKEY_CLASSES_ROOT, classname, param,
&paramlen) == ERROR_SUCCESS) &paramlen) == ERROR_SUCCESS)
{ {
paramlen /= sizeof(WCHAR); paramlen /= sizeof(WCHAR);
strcatW(command, wSpace); lstrcatW(command, wSpace);
strcatW(command, param); lstrcatW(command, param);
commandlen += paramlen; commandlen += paramlen;
} }
#endif #endif
@ -614,7 +608,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
attribs = GetFileAttributesW(lpFile); attribs = GetFileAttributesW(lpFile);
if (attribs!=INVALID_FILE_ATTRIBUTES && (attribs&FILE_ATTRIBUTE_DIRECTORY)) if (attribs!=INVALID_FILE_ATTRIBUTES && (attribs&FILE_ATTRIBUTE_DIRECTORY))
{ {
strcpyW(classname, wszFolder); lstrcpyW(classname, wszFolder);
} }
else else
{ {
@ -625,7 +619,7 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
return SE_ERR_FNF; return SE_ERR_FNF;
} }
/* First thing we need is the file's extension */ /* 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->Run in progman uses */
/* .\FILE.EXE :( */ /* .\FILE.EXE :( */
TRACE("xlpFile=%s,extension=%s\n", debugstr_w(xlpFile), debugstr_w(extension)); 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++; 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 /* Need to perhaps check that the file has a path
* attached */ * attached */
TRACE("found %s\n", debugstr_w(lpResult)); TRACE("found %s\n", debugstr_w(lpResult));
@ -733,16 +727,16 @@ static UINT SHELL_FindExecutable(LPCWSTR lpPath, LPCWSTR lpFile, LPCWSTR lpVerb,
{ {
if (*command) if (*command)
{ {
strcpyW(lpResult, command); lstrcpyW(lpResult, command);
tok = strchrW(lpResult, '^'); /* should be ^.extension? */ tok = wcschr(lpResult, '^'); /* should be ^.extension? */
if (tok != NULL) if (tok != NULL)
{ {
tok[0] = '\0'; tok[0] = '\0';
strcatW(lpResult, xlpFile); /* what if no dir in xlpFile? */ lstrcatW(lpResult, xlpFile); /* what if no dir in xlpFile? */
tok = strchrW(command, '^'); /* see above */ tok = wcschr(command, '^'); /* see above */
if ((tok != NULL) && (strlenW(tok)>5)) if ((tok != NULL) && (lstrlenW(tok)>5))
{ {
strcatW(lpResult, &tok[5]); lstrcatW(lpResult, &tok[5]);
} }
} }
retval = 33; /* FIXME - see above */ 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 wApplication[] = {'\\','a','p','p','l','i','c','a','t','i','o','n',0};
static const WCHAR wTopic[] = {'\\','t','o','p','i','c',0}; static const WCHAR wTopic[] = {'\\','t','o','p','i','c',0};
WCHAR regkey[256]; WCHAR regkey[256];
WCHAR * endkey = regkey + strlenW(key); WCHAR * endkey = regkey + lstrlenW(key);
WCHAR app[256], topic[256], ifexec[256], static_res[256]; WCHAR app[256], topic[256], ifexec[256], static_res[256];
WCHAR * dynamic_res=NULL; WCHAR * dynamic_res=NULL;
WCHAR * res; WCHAR * res;
@ -800,19 +794,19 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
unsigned ret = SE_ERR_NOASSOC; unsigned ret = SE_ERR_NOASSOC;
BOOL unicode = !(GetVersion() & 0x80000000); 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)); FIXME("input parameter %s larger than buffer\n", debugstr_w(key));
return 2; return 2;
} }
strcpyW(regkey, key); lstrcpyW(regkey, key);
endkeyLen = ARRAY_SIZE(regkey) - (endkey - regkey); 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)); FIXME("endkey %s overruns buffer\n", debugstr_w(wApplication));
return 2; return 2;
} }
strcpyW(endkey, wApplication); lstrcpyW(endkey, wApplication);
applen = sizeof(app); applen = sizeof(app);
if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, app, &applen) != ERROR_SUCCESS) 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 */ /* Get application command from start string and find filename of application */
if (*start == '"') 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", FIXME("size of input parameter %s larger than buffer\n",
debugstr_w(start + 1)); debugstr_w(start + 1));
return 2; return 2;
} }
strcpyW(command, start+1); lstrcpyW(command, start+1);
if ((ptr = strchrW(command, '"'))) if ((ptr = wcschr(command, '"')))
*ptr = 0; *ptr = 0;
ret = SearchPathW(NULL, command, wszExe, ARRAY_SIZE(fullpath), fullpath, &ptr); 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; LPCWSTR p;
LPWSTR space; LPWSTR space;
for (p=start; (space=strchrW(p, ' ')); p=space+1) for (p=start; (space=wcschr(p, ' ')); p=space+1)
{ {
int idx = space-start; int idx = space-start;
memcpy(command, start, idx*sizeof(WCHAR)); 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)); ERR("Unable to find application path for command %s\n", debugstr_w(start));
return ERROR_ACCESS_DENIED; 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)); FIXME("size of found path %s larger than buffer\n", debugstr_w(ptr));
return 2; return 2;
} }
strcpyW(app, ptr); lstrcpyW(app, ptr);
/* Remove extensions (including .so) */ /* Remove extensions (including .so) */
ptr = app + strlenW(app) - (sizeSo-1); ptr = app + lstrlenW(app) - (sizeSo-1);
if (strlenW(app) >= sizeSo && if (lstrlenW(app) >= sizeSo &&
!strcmpW(ptr, wSo)) !wcscmp(ptr, wSo))
*ptr = 0; *ptr = 0;
ptr = strrchrW(app, '.'); ptr = wcsrchr(app, '.');
assert(ptr); assert(ptr);
*ptr = 0; *ptr = 0;
} }
if (strlenW(wTopic) + 1 > endkeyLen) if (lstrlenW(wTopic) + 1 > endkeyLen)
{ {
FIXME("endkey %s overruns buffer\n", debugstr_w(wTopic)); FIXME("endkey %s overruns buffer\n", debugstr_w(wTopic));
return 2; return 2;
} }
strcpyW(endkey, wTopic); lstrcpyW(endkey, wTopic);
topiclen = sizeof(topic); topiclen = sizeof(topic);
if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, topic, &topiclen) != ERROR_SUCCESS) if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, topic, &topiclen) != ERROR_SUCCESS)
{ {
static const WCHAR wSystem[] = {'S','y','s','t','e','m',0}; static const WCHAR wSystem[] = {'S','y','s','t','e','m',0};
strcpyW(topic, wSystem); lstrcpyW(topic, wSystem);
} }
if (unicode) if (unicode)
@ -922,12 +916,12 @@ static unsigned dde_connect(const WCHAR* key, const WCHAR* start, WCHAR* ddeexec
SetLastError(ERROR_DDE_FAIL); SetLastError(ERROR_DDE_FAIL);
return 30; /* whatever */ return 30; /* whatever */
} }
if (strlenW(wIfexec) + 1 > endkeyLen) if (lstrlenW(wIfexec) + 1 > endkeyLen)
{ {
FIXME("endkey %s overruns buffer\n", debugstr_w(wIfexec)); FIXME("endkey %s overruns buffer\n", debugstr_w(wIfexec));
return 2; return 2;
} }
strcpyW(endkey, wIfexec); lstrcpyW(endkey, wIfexec);
ifexeclen = sizeof(ifexec); ifexeclen = sizeof(ifexec);
if (RegQueryValueW(HKEY_CLASSES_ROOT, regkey, ifexec, &ifexeclen) == ERROR_SUCCESS) 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. * error DMLERR_NOTPROCESSED on XTYP_EXECUTE request.
*/ */
if (unicode) 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); XTYP_EXECUTE, 30000, &tid);
else 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 /* Get the parameters needed by the application
from the associated ddeexec key */ from the associated ddeexec key */
tmp = strstrW(key, wCommand); tmp = wcsstr(key, wCommand);
assert(tmp); assert(tmp);
strcpyW(tmp, wDdeexec); lstrcpyW(tmp, wDdeexec);
if (RegQueryValueW(HKEY_CLASSES_ROOT, key, ddeexec, &ddeexeclen) == ERROR_SUCCESS) if (RegQueryValueW(HKEY_CLASSES_ROOT, key, ddeexec, &ddeexeclen) == ERROR_SUCCESS)
{ {
TRACE("Got ddeexec %s => %s\n", debugstr_w(key), debugstr_w(ddeexec)); 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); retval = dde_connect(key, param, ddeexec, lpFile, env, szCommandline, psei->lpIDList, execfunc, psei, psei_out);
} }
else if (param[0]) 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); retval = SHELL_FindExecutable(lpDirectory, lpFile, wszOpen, res, MAX_PATH, NULL, NULL, NULL, NULL);
if (retval > 32) if (retval > 32)
strcpyW(lpResult, res); lstrcpyW(lpResult, res);
TRACE("returning %s\n", debugstr_w(lpResult)); TRACE("returning %s\n", debugstr_w(lpResult));
if (lpDirectory) 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); done = SHELL_ArgifyW(wcmd, ARRAY_SIZE(wcmd), execCmd, wszApplicationName, psei->lpIDList, NULL, &resultLen);
if (!done && wszApplicationName[0]) if (!done && wszApplicationName[0])
{ {
strcatW(wcmd, wSpace); lstrcatW(wcmd, wSpace);
if (*wszApplicationName != '"') if (*wszApplicationName != '"')
{ {
strcatW(wcmd, wQuote); lstrcatW(wcmd, wQuote);
strcatW(wcmd, wszApplicationName); lstrcatW(wcmd, wszApplicationName);
strcatW(wcmd, wQuote); lstrcatW(wcmd, wQuote);
} }
else else
strcatW(wcmd, wszApplicationName); lstrcatW(wcmd, wszApplicationName);
} }
if (resultLen > ARRAY_SIZE(wcmd)) if (resultLen > ARRAY_SIZE(wcmd))
ERR("Argify buffer not large enough... truncating\n"); ERR("Argify buffer not large enough... truncating\n");
return execfunc(wcmd, NULL, FALSE, psei, psei_out); 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)); 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)); 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 (SUCCEEDED(SHELL_GetPathFromIDListForExecuteW(sei->lpIDList, buffer, ARRAY_SIZE(buffer)))) {
if (buffer[0]==':' && buffer[1]==':') { if (buffer[0]==':' && buffer[1]==':') {
/* open shell folder for the specified class GUID */ /* 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", ERR("parameters len exceeds buffer size (%i > %i), truncating\n",
lstrlenW(buffer) + 1, parametersLen); lstrlenW(buffer) + 1, parametersLen);
lstrcpynW(wszParameters, buffer, parametersLen); lstrcpynW(wszParameters, buffer, parametersLen);
if (strlenW(wExplorer) > dwApplicationNameLen) if (lstrlenW(wExplorer) > dwApplicationNameLen)
ERR("application len exceeds buffer size (%i > %i), truncating\n", ERR("application len exceeds buffer size (%i > %i), truncating\n",
lstrlenW(wExplorer) + 1, dwApplicationNameLen); lstrlenW(wExplorer) + 1, dwApplicationNameLen);
lstrcpynW(wszApplicationName, wExplorer, dwApplicationNameLen); lstrcpynW(wszApplicationName, wExplorer, dwApplicationNameLen);
@ -1450,7 +1444,7 @@ static void SHELL_translate_idlist( LPSHELLEXECUTEINFOW sei, LPWSTR wszParameter
DWORD resultLen; DWORD resultLen;
/* Check if we're executing a directory and if so use the /* Check if we're executing a directory and if so use the
handler for the Folder class */ handler for the Folder class */
strcpyW(target, buffer); lstrcpyW(target, buffer);
attribs = GetFileAttributesW(buffer); attribs = GetFileAttributesW(buffer);
if (attribs != INVALID_FILE_ATTRIBUTES && if (attribs != INVALID_FILE_ATTRIBUTES &&
(attribs & FILE_ATTRIBUTE_DIRECTORY) && (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, /* Must quote to handle case where cmd contains spaces,
* else security hole if malicious user creates executable file "C:\\Program" * else security hole if malicious user creates executable file "C:\\Program"
*/ */
strcpyW(wszQuotedCmd, wQuote); lstrcpyW(wszQuotedCmd, wQuote);
strcatW(wszQuotedCmd, wcmd); lstrcatW(wszQuotedCmd, wcmd);
strcatW(wszQuotedCmd, wQuote); lstrcatW(wszQuotedCmd, wQuote);
if (wszParameters[0]) { if (wszParameters[0]) {
strcatW(wszQuotedCmd, wSpace); lstrcatW(wszQuotedCmd, wSpace);
strcatW(wszQuotedCmd, wszParameters); lstrcatW(wszQuotedCmd, wszParameters);
} }
TRACE("%s/%s => %s/%s\n", debugstr_w(wszApplicationName), debugstr_w(psei->lpVerb), debugstr_w(wszQuotedCmd), debugstr_w(wszKeyname)); TRACE("%s/%s => %s/%s\n", debugstr_w(wszApplicationName), debugstr_w(psei->lpVerb), debugstr_w(wszQuotedCmd), debugstr_w(wszKeyname));
if (*wszKeyname) if (*wszKeyname)
@ -1512,11 +1506,11 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wcmd, LPSHELLEXECUTEI
INT iSize; INT iSize;
DWORD len; DWORD len;
lpstrRes = strchrW(lpFile, ':'); lpstrRes = wcschr(lpFile, ':');
if (lpstrRes) if (lpstrRes)
iSize = lpstrRes - lpFile; iSize = lpstrRes - lpFile;
else else
iSize = strlenW(lpFile); iSize = lstrlenW(lpFile);
TRACE("Got URL: %s\n", debugstr_w(lpFile)); TRACE("Got URL: %s\n", debugstr_w(lpFile));
/* Looking for ...<protocol>\shell\<lpVerb>\command */ /* Looking for ...<protocol>\shell\<lpVerb>\command */
@ -1528,9 +1522,9 @@ static UINT_PTR SHELL_execute_url( LPCWSTR lpFile, LPCWSTR wcmd, LPSHELLEXECUTEI
lpstrProtocol = heap_alloc(len * sizeof(WCHAR)); lpstrProtocol = heap_alloc(len * sizeof(WCHAR));
memcpy(lpstrProtocol, lpFile, iSize*sizeof(WCHAR)); memcpy(lpstrProtocol, lpFile, iSize*sizeof(WCHAR));
lpstrProtocol[iSize] = '\0'; lpstrProtocol[iSize] = '\0';
strcatW(lpstrProtocol, wShell); lstrcatW(lpstrProtocol, wShell);
strcatW(lpstrProtocol, psei->lpVerb && *psei->lpVerb ? psei->lpVerb: wszOpen); lstrcatW(lpstrProtocol, psei->lpVerb && *psei->lpVerb ? psei->lpVerb: wszOpen);
strcatW(lpstrProtocol, wCommand); lstrcatW(lpstrProtocol, wCommand);
retval = execute_from_key(lpstrProtocol, lpFile, NULL, psei->lpParameters, retval = execute_from_key(lpstrProtocol, lpFile, NULL, psei->lpParameters,
wcmd, execfunc, psei, psei_out); 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 = heap_alloc(dwApplicationNameLen*sizeof(WCHAR));
*wszApplicationName = '\0'; *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; if(len-1 >= dwApplicationNameLen) dwApplicationNameLen = len;
wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR)); wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR));
@ -1622,7 +1616,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
wszApplicationName[len-2] = '\0'; wszApplicationName[len-2] = '\0';
TRACE("wszApplicationName=%s\n",debugstr_w(wszApplicationName)); TRACE("wszApplicationName=%s\n",debugstr_w(wszApplicationName));
} else { } else {
DWORD l = strlenW(sei_tmp.lpFile)+1; DWORD l = lstrlenW(sei_tmp.lpFile)+1;
if(l > dwApplicationNameLen) dwApplicationNameLen = l+1; if(l > dwApplicationNameLen) dwApplicationNameLen = l+1;
wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR)); wszApplicationName = heap_alloc(dwApplicationNameLen*sizeof(WCHAR));
memcpy(wszApplicationName, sei_tmp.lpFile, l*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)); wszParameters = heap_alloc(len * sizeof(WCHAR));
parametersLen = len; parametersLen = len;
} }
strcpyW(wszParameters, sei_tmp.lpParameters); lstrcpyW(wszParameters, sei_tmp.lpParameters);
} }
else else
*wszParameters = '\0'; *wszParameters = '\0';
@ -1648,7 +1642,7 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
len = lstrlenW(sei_tmp.lpDirectory) + 1; len = lstrlenW(sei_tmp.lpDirectory) + 1;
if (len > ARRAY_SIZE(dirBuffer)) if (len > ARRAY_SIZE(dirBuffer))
wszDir = heap_alloc(len * sizeof(WCHAR)); wszDir = heap_alloc(len * sizeof(WCHAR));
strcpyW(wszDir, sei_tmp.lpDirectory); lstrcpyW(wszDir, sei_tmp.lpDirectory);
} }
else else
*wszDir = '\0'; *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)); TRACE("execute:%s,%s,%s\n", debugstr_w(wszApplicationName), debugstr_w(wszParameters), debugstr_w(wszDir));
lpFile = sei_tmp.lpFile; lpFile = sei_tmp.lpFile;
wcmd = wcmdBuffer; wcmd = wcmdBuffer;
strcpyW(wcmd, wszApplicationName); lstrcpyW(wcmd, wszApplicationName);
if (sei_tmp.lpDirectory) if (sei_tmp.lpDirectory)
{ {
LPCWSTR searchPath[] = { 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 wExplorer[] = {'e','x','p','l','o','r','e','r',0};
static const WCHAR wQuote[] = {'"',0}; static const WCHAR wQuote[] = {'"',0};
WCHAR wExec[MAX_PATH]; WCHAR wExec[MAX_PATH];
WCHAR * lpQuotedFile = heap_alloc( sizeof(WCHAR) * (strlenW(lpFile) + 3) ); WCHAR * lpQuotedFile = heap_alloc( sizeof(WCHAR) * (lstrlenW(lpFile) + 3) );
if (lpQuotedFile) if (lpQuotedFile)
{ {
@ -1849,9 +1843,9 @@ static BOOL SHELL_execute( LPSHELLEXECUTEINFOW sei, SHELL_ExecuteW32 execfunc )
NULL, &env, NULL, NULL ); NULL, &env, NULL, NULL );
if (retval > 32) if (retval > 32)
{ {
strcpyW(lpQuotedFile, wQuote); lstrcpyW(lpQuotedFile, wQuote);
strcatW(lpQuotedFile, lpFile); lstrcatW(lpQuotedFile, lpFile);
strcatW(lpQuotedFile, wQuote); lstrcatW(lpQuotedFile, wQuote);
retval = SHELL_quote_and_execute( wExec, lpQuotedFile, retval = SHELL_quote_and_execute( wExec, lpQuotedFile,
wszKeyname, wszKeyname,
wszApplicationName, env, 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 ); retval = SHELL_execute_url( lpFile, wcmd, &sei_tmp, sei, execfunc );
} }
/* Check if file specified is in the form www.??????.*** */ /* 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 */ /* if so, prefix lpFile with http:// and call ShellExecute */
WCHAR lpstrTmpFile[256]; WCHAR lpstrTmpFile[256];
strcpyW(lpstrTmpFile, wHttp); lstrcpyW(lpstrTmpFile, wHttp);
strcatW(lpstrTmpFile, lpFile); lstrcatW(lpstrTmpFile, lpFile);
retval = (UINT_PTR)ShellExecuteW(sei_tmp.hwnd, sei_tmp.lpVerb, lpstrTmpFile, NULL, NULL, 0); retval = (UINT_PTR)ShellExecuteW(sei_tmp.hwnd, sei_tmp.lpVerb, lpstrTmpFile, NULL, NULL, 0);
} }

View File

@ -21,9 +21,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#define COBJMACROS #define COBJMACROS
#include <stdarg.h> #include <stdarg.h>

View File

@ -21,9 +21,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdarg.h> #include <stdarg.h>

View File

@ -19,8 +19,6 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
* *
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>

View File

@ -331,9 +331,9 @@ static BOOL FileMenu_AppendItemW(
if (lpText != FM_SEPARATOR) if (lpText != FM_SEPARATOR)
{ {
int len = strlenW (lpText); int len = lstrlenW (lpText);
myItem = SHAlloc(sizeof(FMITEM) + len*sizeof(WCHAR)); myItem = SHAlloc(sizeof(FMITEM) + len*sizeof(WCHAR));
strcpyW (myItem->szItemText, lpText); lstrcpyW (myItem->szItemText, lpText);
myItem->cchItemText = len; myItem->cchItemText = len;
myItem->iIconIndex = icon; myItem->iIconIndex = icon;
myItem->hMenu = hMenu; myItem->hMenu = hMenu;

View File

@ -36,9 +36,6 @@
* Release() ??? * Release() ???
*/ */
#include "config.h"
#include "wine/port.h"
#include <stdarg.h> #include <stdarg.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>

View File

@ -389,7 +389,7 @@ static BOOL get_program_description(WCHAR *path, WCHAR *buffer, DWORD size)
for (i = 0; i < llen / sizeof(DWORD); i++) 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 (VerQueryValueW(data, fileDescW, (LPVOID *)&desc, &dlen))
{ {
if (dlen > size - 1) dlen = size - 1; 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); SetDlgItemTextW(hwndDlg, IDC_FPROP_PROG_NAME, buffer2);
else else
{ {
WCHAR *p = strrchrW(buffer, '\\'); WCHAR *p = wcsrchr(buffer, '\\');
SetDlgItemTextW(hwndDlg, IDC_FPROP_PROG_NAME, p ? ++p : 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 */ /* Update filename if it was changed */
if (GetDlgItemTextW(hwndDlg, IDC_FPROP_PATH, newname, ARRAY_SIZE(newname)) && if (GetDlgItemTextW(hwndDlg, IDC_FPROP_PATH, newname, ARRAY_SIZE(newname)) &&
strcmpW(props->filename, newname) && wcscmp(props->filename, newname) &&
strlenW(props->dir) + strlenW(newname) + 2 < ARRAY_SIZE(newpath)) lstrlenW(props->dir) + lstrlenW(newname) + 2 < ARRAY_SIZE(newpath))
{ {
static const WCHAR slash[] = {'\\', 0}; static const WCHAR slash[] = {'\\', 0};
strcpyW(newpath, props->dir); lstrcpyW(newpath, props->dir);
strcatW(newpath, slash); lstrcatW(newpath, slash);
strcatW(newpath, newname); lstrcatW(newpath, newname);
if (!MoveFileW(props->path, newpath)) if (!MoveFileW(props->path, newpath))
ERR("failed to move file %s to %s\n", debugstr_w(props->path), debugstr_w(newpath)); ERR("failed to move file %s to %s\n", debugstr_w(props->path), debugstr_w(newpath));
else else
{ {
WCHAR *p; WCHAR *p;
strcpyW(props->path, newpath); lstrcpyW(props->path, newpath);
strcpyW(props->dir, newpath); lstrcpyW(props->dir, newpath);
if ((p = strrchrW(props->dir, '\\'))) if ((p = wcsrchr(props->dir, '\\')))
{ {
*p = 0; *p = 0;
props->filename = p + 1; props->filename = p + 1;
@ -619,8 +619,8 @@ static void init_file_properties_pages(IDataObject *dataobject, LPFNADDPROPSHEET
if (props->attrib == INVALID_FILE_ATTRIBUTES) if (props->attrib == INVALID_FILE_ATTRIBUTES)
goto error; goto error;
strcpyW(props->dir, props->path); lstrcpyW(props->dir, props->path);
if ((p = strrchrW(props->dir, '\\'))) if ((p = wcsrchr(props->dir, '\\')))
{ {
*p = 0; *p = 0;
props->filename = p + 1; props->filename = p + 1;