From ec1478a4d39b0823e2fcdf516a02d968906d6504 Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Mon, 7 Jul 2008 18:57:08 -0400 Subject: [PATCH] Bug 422791 - Reduce ambiguous wide/narrow char API calls in uriloader r=bsmedberg --- uriloader/exthandler/win/nsMIMEInfoWin.cpp | 14 ++++++++------ uriloader/exthandler/win/nsOSHelperAppService.cpp | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/uriloader/exthandler/win/nsMIMEInfoWin.cpp b/uriloader/exthandler/win/nsMIMEInfoWin.cpp index a9b1ee2a35dc..0c6961eaf0a9 100755 --- a/uriloader/exthandler/win/nsMIMEInfoWin.cpp +++ b/uriloader/exthandler/win/nsMIMEInfoWin.cpp @@ -266,7 +266,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) SFGAOF sfgao; // Bug 394974 - HMODULE hDll = ::LoadLibrary("shell32.dll"); + HMODULE hDll = ::LoadLibraryW(L"shell32.dll"); MySHParseDisplayName pMySHParseDisplayName = NULL; // Version 6.0 and higher if (pMySHParseDisplayName = @@ -274,19 +274,19 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) "SHParseDisplayName")) { if (SUCCEEDED(pMySHParseDisplayName(NS_ConvertUTF8toUTF16(urlSpec).get(), NULL, &pidl, 0, &sfgao))) { - static const char cmdVerb[] = "open"; - SHELLEXECUTEINFO sinfo; + static const PRUnichar cmdVerb[] = L"open"; + SHELLEXECUTEINFOW sinfo; memset(&sinfo, 0, sizeof(SHELLEXECUTEINFO)); sinfo.cbSize = sizeof(SHELLEXECUTEINFO); sinfo.fMask = SEE_MASK_FLAG_DDEWAIT | SEE_MASK_FLAG_NO_UI | SEE_MASK_INVOKEIDLIST; sinfo.hwnd = NULL; - sinfo.lpVerb = (LPCSTR)&cmdVerb; + sinfo.lpVerb = (LPWSTR)&cmdVerb; sinfo.nShow = SW_SHOWNORMAL; sinfo.lpIDList = pidl; - BOOL result = ShellExecuteEx(&sinfo); + BOOL result = ShellExecuteExW(&sinfo); CoTaskMemFree(pidl); @@ -295,7 +295,9 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL) } } else { // Version of shell32.dll < 6.0 - LONG r = (LONG) ::ShellExecute(NULL, "open", urlSpec.get(), NULL, NULL, + LONG r = (LONG) ::ShellExecuteW(NULL, L"open", + NS_ConvertUTF8toUTF16(urlSpec).get(), + NULL, NULL, SW_SHOWNORMAL); if (r < 32) rv = NS_ERROR_FAILURE; diff --git a/uriloader/exthandler/win/nsOSHelperAppService.cpp b/uriloader/exthandler/win/nsOSHelperAppService.cpp index 1e6bc327284b..c0701ccd957e 100644 --- a/uriloader/exthandler/win/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/win/nsOSHelperAppService.cpp @@ -177,11 +177,11 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolSch #endif HKEY hKey; - LONG err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0, + LONG err = ::RegOpenKeyExA(HKEY_CLASSES_ROOT, aProtocolScheme, 0, KEY_QUERY_VALUE, &hKey); if (err == ERROR_SUCCESS) { - err = ::RegQueryValueEx(hKey, "URL Protocol", NULL, NULL, NULL, NULL); + err = ::RegQueryValueExW(hKey, L"URL Protocol", NULL, NULL, NULL, NULL); *aHandlerExists = (err == ERROR_SUCCESS); // close the key ::RegCloseKey(hKey);