Convert more API calls to Unicode.
This commit is contained in:
parent
55f46aef73
commit
316df99bf9
|
@ -56,4 +56,17 @@ static inline int SHELL32_GUIDToStringA (REFGUID guid, LPSTR str)
|
||||||
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static inline int SHELL32_GUIDToStringW (REFGUID guid, LPWSTR str)
|
||||||
|
{
|
||||||
|
static const WCHAR fmtW[] =
|
||||||
|
{ '{','%','0','8','l','x','-','%','0','4','x','-','%','0','4','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 };
|
||||||
|
return sprintfW(str, fmtW,
|
||||||
|
guid->Data1, guid->Data2, guid->Data3,
|
||||||
|
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
|
||||||
|
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7]);
|
||||||
|
}
|
||||||
|
|
||||||
void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags);
|
void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags);
|
||||||
|
|
|
@ -206,8 +206,6 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
|
||||||
LPCWSTR szNext = NULL;
|
LPCWSTR szNext = NULL;
|
||||||
LPITEMIDLIST pidlTemp = NULL;
|
LPITEMIDLIST pidlTemp = NULL;
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
char szPath[MAX_PATH];
|
|
||||||
DWORD len;
|
|
||||||
CLSID clsid;
|
CLSID clsid;
|
||||||
|
|
||||||
TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
|
TRACE ("(%p)->(HWND=%p,%p,%p=%s,%p,pidl=%p,%p)\n",
|
||||||
|
@ -251,13 +249,24 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
|
||||||
|
|
||||||
if (*lpszDisplayName)
|
if (*lpszDisplayName)
|
||||||
{
|
{
|
||||||
|
WCHAR szPath[MAX_PATH];
|
||||||
|
LPWSTR pathPtr;
|
||||||
|
|
||||||
/* build a complete path to create a simple pidl */
|
/* build a complete path to create a simple pidl */
|
||||||
lstrcpyA(szPath, This->sPathTarget);
|
MultiByteToWideChar(CP_ACP, 0, This->sPathTarget, -1, szPath,
|
||||||
PathAddBackslashA(szPath);
|
sizeof(szPath) / sizeof(szPath[0]));
|
||||||
len = lstrlenA(szPath);
|
pathPtr = PathAddBackslashW(szPath);
|
||||||
WideCharToMultiByte(CP_ACP, 0, lpszDisplayName, -1,
|
if (pathPtr)
|
||||||
szPath + len, MAX_PATH - len, NULL, NULL);
|
{
|
||||||
hr = _ILCreateFromPathA(szPath, &pidlTemp);
|
lstrcpynW(pathPtr, lpszDisplayName,
|
||||||
|
sizeof(szPath)/sizeof(szPath[0]) - (pathPtr - szPath));
|
||||||
|
hr = _ILCreateFromPathW(szPath, &pidlTemp);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* should never reach here, but for completeness */
|
||||||
|
hr = HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
pidlTemp = _ILCreateMyComputer();
|
pidlTemp = _ILCreateMyComputer();
|
||||||
|
@ -290,6 +299,12 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* CreateDesktopEnumList()
|
* CreateDesktopEnumList()
|
||||||
*/
|
*/
|
||||||
|
static const WCHAR Desktop_NameSpaceW[] = { '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','\\','D','e','s','k','t','o','p','\\','N','a','m','e','s','p',
|
||||||
|
'a','c','e','\0' };
|
||||||
|
|
||||||
static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
BOOL ret = TRUE;
|
BOOL ret = TRUE;
|
||||||
|
@ -306,9 +321,7 @@ static BOOL CreateDesktopEnumList(IEnumIDList *list, DWORD dwFlags)
|
||||||
/* create the pidl for This item */
|
/* create the pidl for This item */
|
||||||
ret = AddToEnumList(list, _ILCreateMyComputer());
|
ret = AddToEnumList(list, _ILCreateMyComputer());
|
||||||
|
|
||||||
r = RegOpenKeyExA(HKEY_LOCAL_MACHINE,
|
r = RegOpenKeyExW(HKEY_LOCAL_MACHINE, Desktop_NameSpaceW,
|
||||||
"SOFTWARE\\Microsoft\\Windows\\"
|
|
||||||
"CurrentVersion\\explorer\\desktop\\NameSpace",
|
|
||||||
0, KEY_READ, &hkey);
|
0, KEY_READ, &hkey);
|
||||||
if (ret && ERROR_SUCCESS == r)
|
if (ret && ERROR_SUCCESS == r)
|
||||||
{
|
{
|
||||||
|
@ -612,14 +625,21 @@ static HRESULT WINAPI ISF_Desktop_fnGetDisplayNameOf (IShellFolder2 * iface,
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* get the "WantsFORPARSING" flag from the registry */
|
/* get the "WantsFORPARSING" flag from the registry */
|
||||||
char szRegPath[100];
|
static const WCHAR clsidW[] =
|
||||||
|
{ 'C','L','S','I','D','\\',0 };
|
||||||
|
static const WCHAR shellfolderW[] =
|
||||||
|
{ '\\','s','h','e','l','l','f','o','l','d','e','r',0 };
|
||||||
|
static const WCHAR wantsForParsingW[] =
|
||||||
|
{ 'W','a','n','t','s','F','o','r','P','a','r','s','i','n',
|
||||||
|
'g',0 };
|
||||||
|
WCHAR szRegPath[100];
|
||||||
LONG r;
|
LONG r;
|
||||||
|
|
||||||
lstrcpyA (szRegPath, "CLSID\\");
|
lstrcpyW (szRegPath, clsidW);
|
||||||
SHELL32_GUIDToStringA (clsid, &szRegPath[6]);
|
SHELL32_GUIDToStringW (clsid, &szRegPath[6]);
|
||||||
lstrcatA (szRegPath, "\\shellfolder");
|
lstrcatW (szRegPath, shellfolderW);
|
||||||
r = SHGetValueA(HKEY_CLASSES_ROOT, szRegPath,
|
r = SHGetValueW(HKEY_CLASSES_ROOT, szRegPath,
|
||||||
"WantsFORPARSING", NULL, NULL, NULL);
|
wantsForParsingW, NULL, NULL, NULL);
|
||||||
if (r == ERROR_SUCCESS)
|
if (r == ERROR_SUCCESS)
|
||||||
bWantsForParsing = TRUE;
|
bWantsForParsing = TRUE;
|
||||||
else
|
else
|
||||||
|
|
|
@ -677,6 +677,15 @@ IShellFolder_fnGetUIObjectOf (IShellFolder2 * iface,
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const WCHAR AdvancedW[] = { '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','\\','A','d','v','a','n','c','e','d',0 };
|
||||||
|
static const WCHAR HideFileExtW[] = { 'H','i','d','e','F','i','l','e','E','x',
|
||||||
|
't',0 };
|
||||||
|
static const WCHAR NeverShowExtW[] = { 'N','e','v','e','r','S','h','o','w','E',
|
||||||
|
'x','t',0 };
|
||||||
|
|
||||||
void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags)
|
void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags)
|
||||||
{
|
{
|
||||||
/*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */
|
/*FIXME: MSDN also mentions SHGDN_FOREDITING which is not yet handled. */
|
||||||
|
@ -687,10 +696,9 @@ void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags)
|
||||||
DWORD dwDataSize = sizeof (DWORD);
|
DWORD dwDataSize = sizeof (DWORD);
|
||||||
BOOL doHide = FALSE; /* The default value is FALSE (win98 at least) */
|
BOOL doHide = FALSE; /* The default value is FALSE (win98 at least) */
|
||||||
|
|
||||||
if (!RegCreateKeyExA (HKEY_CURRENT_USER,
|
if (!RegCreateKeyExW (HKEY_CURRENT_USER, AdvancedW,
|
||||||
"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
|
||||||
0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) {
|
0, 0, 0, KEY_ALL_ACCESS, 0, &hKey, 0)) {
|
||||||
if (!RegQueryValueExA (hKey, "HideFileExt", 0, 0, (LPBYTE) &dwData,
|
if (!RegQueryValueExW (hKey, HideFileExtW, 0, 0, (LPBYTE) &dwData,
|
||||||
&dwDataSize))
|
&dwDataSize))
|
||||||
doHide = dwData;
|
doHide = dwData;
|
||||||
|
|
||||||
|
@ -701,18 +709,17 @@ void SHELL_FS_ProcessDisplayFilename(LPSTR szPath, DWORD dwFlags)
|
||||||
LPSTR ext = PathFindExtensionA(szPath);
|
LPSTR ext = PathFindExtensionA(szPath);
|
||||||
|
|
||||||
if (ext) {
|
if (ext) {
|
||||||
HKEY hkey;
|
|
||||||
char classname[MAX_PATH];
|
char classname[MAX_PATH];
|
||||||
LONG classlen = MAX_PATH;
|
LONG classlen = MAX_PATH;
|
||||||
|
|
||||||
if (!RegQueryValueA(HKEY_CLASSES_ROOT, ext, classname,
|
if (!RegQueryValueA(HKEY_CLASSES_ROOT, ext, classname,
|
||||||
&classlen))
|
&classlen))
|
||||||
if (!RegOpenKeyA(HKEY_CLASSES_ROOT, classname, &hkey)) {
|
if (!RegOpenKeyA(HKEY_CLASSES_ROOT, classname, &hKey)) {
|
||||||
if (!RegQueryValueExA(hkey, "NeverShowExt", 0, NULL,
|
if (!RegQueryValueExW(hKey, NeverShowExtW, 0, NULL,
|
||||||
NULL, NULL))
|
NULL, NULL))
|
||||||
doHide = TRUE;
|
doHide = TRUE;
|
||||||
|
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -813,9 +820,8 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface,
|
||||||
LPITEMIDLIST * pPidlOut)
|
LPITEMIDLIST * pPidlOut)
|
||||||
{
|
{
|
||||||
_ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
|
_ICOM_THIS_From_IShellFolder2 (IGenericSFImpl, iface)
|
||||||
char szSrc[MAX_PATH],
|
WCHAR szSrc[MAX_PATH], szDest[MAX_PATH];
|
||||||
szDest[MAX_PATH];
|
LPWSTR ptr;
|
||||||
int len;
|
|
||||||
BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
|
BOOL bIsFolder = _ILIsFolder (ILFindLastID (pidl));
|
||||||
|
|
||||||
TRACE ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl,
|
TRACE ("(%p)->(%p,pidl=%p,%s,%lu,%p)\n", This, hwndOwner, pidl,
|
||||||
|
@ -823,31 +829,29 @@ static HRESULT WINAPI IShellFolder_fnSetNameOf (IShellFolder2 * iface,
|
||||||
|
|
||||||
/* build source path */
|
/* build source path */
|
||||||
if (dwFlags & SHGDN_INFOLDER) {
|
if (dwFlags & SHGDN_INFOLDER) {
|
||||||
strcpy (szSrc, This->sPathTarget);
|
MultiByteToWideChar(CP_ACP, 0, This->sPathTarget, -1, szSrc, MAX_PATH);
|
||||||
PathAddBackslashA (szSrc);
|
ptr = PathAddBackslashW (szSrc);
|
||||||
len = strlen (szSrc);
|
if (ptr)
|
||||||
_ILSimpleGetText (pidl, szSrc + len, MAX_PATH - len);
|
_ILSimpleGetTextW (pidl, ptr, MAX_PATH - (ptr - szSrc));
|
||||||
} else {
|
} else {
|
||||||
/* FIXME: Can this work with a simple PIDL? */
|
/* FIXME: Can this work with a simple PIDL? */
|
||||||
SHGetPathFromIDListA (pidl, szSrc);
|
SHGetPathFromIDListW (pidl, szSrc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* build destination path */
|
/* build destination path */
|
||||||
strcpy (szDest, This->sPathTarget);
|
MultiByteToWideChar(CP_ACP, 0, This->sPathTarget, -1, szDest, MAX_PATH);
|
||||||
PathAddBackslashA (szDest);
|
ptr = PathAddBackslashW (szDest);
|
||||||
len = strlen (szDest);
|
if (ptr)
|
||||||
WideCharToMultiByte (CP_ACP, 0, lpName, -1, szDest + len, MAX_PATH - len,
|
lstrcpynW(ptr, lpName, MAX_PATH - (ptr - szDest));
|
||||||
NULL, NULL);
|
TRACE ("src=%s dest=%s\n", debugstr_w(szSrc), debugstr_w(szDest));
|
||||||
szDest[MAX_PATH - 1] = 0;
|
if (MoveFileW (szSrc, szDest)) {
|
||||||
TRACE ("src=%s dest=%s\n", szSrc, szDest);
|
|
||||||
if (MoveFileA (szSrc, szDest)) {
|
|
||||||
HRESULT hr = S_OK;
|
HRESULT hr = S_OK;
|
||||||
|
|
||||||
if (pPidlOut)
|
if (pPidlOut)
|
||||||
hr = _ILCreateFromPathA(szDest, pPidlOut);
|
hr = _ILCreateFromPathW(szDest, pPidlOut);
|
||||||
|
|
||||||
SHChangeNotify (bIsFolder ? SHCNE_RENAMEFOLDER : SHCNE_RENAMEITEM,
|
SHChangeNotify (bIsFolder ? SHCNE_RENAMEFOLDER : SHCNE_RENAMEITEM,
|
||||||
SHCNF_PATHA, szSrc, szDest);
|
SHCNF_PATHW, szSrc, szDest);
|
||||||
|
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -569,8 +569,15 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
|
||||||
{
|
{
|
||||||
if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)
|
if (GET_SHGDN_FOR (dwFlags) == SHGDN_FORPARSING)
|
||||||
{
|
{
|
||||||
|
static const WCHAR clsidW[] =
|
||||||
|
{ 'C','L','S','I','D','\\',0 };
|
||||||
|
static const WCHAR shellfolderW[] =
|
||||||
|
{ '\\','s','h','e','l','l','f','o','l','d','e','r',0 };
|
||||||
|
static const WCHAR wantsForParsingW[] =
|
||||||
|
{ 'W','a','n','t','s','F','o','r','P','a','r','s','i','n',
|
||||||
|
'g',0 };
|
||||||
int bWantsForParsing = FALSE;
|
int bWantsForParsing = FALSE;
|
||||||
char szRegPath[100];
|
WCHAR szRegPath[100];
|
||||||
LONG r;
|
LONG r;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -584,11 +591,11 @@ static HRESULT WINAPI ISF_MyComputer_fnGetDisplayNameOf (IShellFolder2 *iface,
|
||||||
* Get the "WantsFORPARSING" flag from the registry
|
* Get the "WantsFORPARSING" flag from the registry
|
||||||
*/
|
*/
|
||||||
|
|
||||||
lstrcpyA (szRegPath, "CLSID\\");
|
lstrcpyW (szRegPath, clsidW);
|
||||||
SHELL32_GUIDToStringA (clsid, &szRegPath[6]);
|
SHELL32_GUIDToStringW (clsid, &szRegPath[6]);
|
||||||
lstrcatA (szRegPath, "\\shellfolder");
|
lstrcatW (szRegPath, shellfolderW);
|
||||||
r = SHGetValueA (HKEY_CLASSES_ROOT, szRegPath,
|
r = SHGetValueW (HKEY_CLASSES_ROOT, szRegPath,
|
||||||
"WantsFORPARSING", NULL, NULL, NULL);
|
wantsForParsingW, NULL, NULL, NULL);
|
||||||
if (r == ERROR_SUCCESS)
|
if (r == ERROR_SUCCESS)
|
||||||
bWantsForParsing = TRUE;
|
bWantsForParsing = TRUE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue