Re-merge to pick up changeset 6464982e3c7f

This commit is contained in:
Blake Kaplan 2008-08-27 16:27:49 -07:00
commit 6a60ec5ab8
31 changed files with 538 additions and 219 deletions

View File

@ -595,7 +595,7 @@ void nsAccessNodeWrap::InitAccessibility()
}
if (!gmUserLib) {
gmUserLib =::LoadLibrary("USER32.DLL");
gmUserLib =::LoadLibraryW(L"USER32.DLL");
}
if (gmUserLib) {

View File

@ -158,7 +158,7 @@ STDMETHODIMP nsAccessibleWrap::AccessibleObjectFromWindow(HWND hwnd,
{
// open the dll dynamically
if (!gmAccLib)
gmAccLib =::LoadLibrary("OLEACC.DLL");
gmAccLib =::LoadLibraryW(L"OLEACC.DLL");
if (gmAccLib) {
if (!gmAccessibleObjectFromWindow)

View File

@ -64,11 +64,9 @@ static void Output(const char *fmt, ... )
va_start(ap, fmt);
#if defined(XP_WIN) && !MOZ_WINCONSOLE
char msg[2048];
_vsnprintf(msg, sizeof(msg), fmt, ap);
MessageBox(NULL, msg, "XULRunner", MB_OK | MB_ICONERROR);
PRUnichar msg[2048];
_vsnwprintf(msg, sizeof(msg)/sizeof(msg[0]), NS_ConvertUTF8toUTF16(fmt).get(), ap);
MessageBoxW(NULL, msg, L"XULRunner", MB_OK | MB_ICONERROR);
#else
vfprintf(stderr, fmt, ap);
#endif

View File

@ -867,7 +867,7 @@ nsIEProfileMigrator::CopyPasswords(PRBool aReplace)
nsresult rv;
nsVoidArray signonsFound;
HMODULE pstoreDLL = ::LoadLibrary("pstorec.dll");
HMODULE pstoreDLL = ::LoadLibraryW(L"pstorec.dll");
if (!pstoreDLL) {
// XXXben TODO
// Need to figure out what to do here on Windows 98 etc... it may be that the key is universal read
@ -1191,7 +1191,7 @@ nsIEProfileMigrator::CopyFormData(PRBool aReplace)
{
HRESULT hr;
HMODULE pstoreDLL = ::LoadLibrary("pstorec.dll");
HMODULE pstoreDLL = ::LoadLibraryW(L"pstorec.dll");
if (!pstoreDLL) {
// XXXben TODO
// Need to figure out what to do here on Windows 98 etc... it may be that the key is universal read
@ -1424,20 +1424,19 @@ nsIEProfileMigrator::ResolveShortcut(const nsString &aFileName, char** aOutURL)
{
HRESULT result;
IUniformResourceLocator* urlLink = nsnull;
IUniformResourceLocatorW* urlLink = nsnull;
result = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER,
IID_IUniformResourceLocator, (void**)&urlLink);
IID_IUniformResourceLocatorW, (void**)&urlLink);
if (SUCCEEDED(result) && urlLink) {
IPersistFile* urlFile = nsnull;
result = urlLink->QueryInterface(IID_IPersistFile, (void**)&urlFile);
if (SUCCEEDED(result) && urlFile) {
result = urlFile->Load(aFileName.get(), STGM_READ);
if (SUCCEEDED(result) ) {
LPSTR lpTemp = nsnull;
LPWSTR lpTemp = nsnull;
result = urlLink->GetURL(&lpTemp);
if (SUCCEEDED(result) && lpTemp) {
*aOutURL = PL_strdup(lpTemp);
*aOutURL = (char*)ToNewUTF8String(nsDependentString(lpTemp));
// free the string that GetURL alloc'd
::CoTaskMemFree(lpTemp);
}

View File

@ -73,6 +73,7 @@ CPPSRCS = \
nsPrincipal.cpp \
nsSystemPrincipal.cpp \
nsNullPrincipal.cpp \
nsNullPrincipalURI.cpp \
nsJSPrincipals.cpp \
nsScriptSecurityManager.cpp \
nsSecurityManagerFactory.cpp \

View File

@ -43,6 +43,7 @@
*/
#include "nsNullPrincipal.h"
#include "nsNullPrincipalURI.h"
#include "nsMemory.h"
#include "nsIUUIDGenerator.h"
#include "nsID.h"
@ -52,8 +53,6 @@
#include "nsDOMError.h"
#include "nsScriptSecurityManager.h"
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
NS_IMPL_QUERY_INTERFACE2_CI(nsNullPrincipal,
nsIPrincipal,
nsISerializable)
@ -119,22 +118,14 @@ nsNullPrincipal::Init()
str.Append(NS_NULLPRINCIPAL_PREFIX);
str.Append(chars);
if (str.Length() != prefixLen + suffixLen) {
NS_WARNING("Out of memory allocating null-principal URI");
return NS_ERROR_OUT_OF_MEMORY;
}
// Use CID so we're sure we get the impl we want. Note that creating the URI
// directly is ok because we have our own private URI scheme. In effect,
// we're being a protocol handler.
mURI = do_CreateInstance(kSimpleURICID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
rv = mURI->SetSpec(str);
NS_ENSURE_SUCCESS(rv, rv);
NS_TryToSetImmutable(mURI);
mURI = new nsNullPrincipalURI(str);
NS_ENSURE_TRUE(mURI, NS_ERROR_OUT_OF_MEMORY);
return mJSPrincipals.Init(this, str);
}

View File

@ -0,0 +1,262 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=2 sts=2 expandtab
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is the
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Shawn Wilsher <me@shawnwilsher.com> (Original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#include "nsNullPrincipalURI.h"
#include "nsNetUtil.h"
#include "nsEscape.h"
#include "nsCRT.h"
////////////////////////////////////////////////////////////////////////////////
//// nsNullPrincipalURI
nsNullPrincipalURI::nsNullPrincipalURI(const nsCString &aSpec)
{
PRInt32 dividerPosition = aSpec.FindChar(':');
NS_ASSERTION(dividerPosition != -1, "Malformed URI!");
PRInt32 n = aSpec.Left(mScheme, dividerPosition);
NS_ASSERTION(n == dividerPosition, "Storing the scheme failed!");
PRInt32 count = aSpec.Length() - dividerPosition - 1;
n = aSpec.Mid(mPath, dividerPosition + 1, count);
NS_ASSERTION(n == count, "Storing the path failed!");
ToLowerCase(mScheme);
}
static NS_DEFINE_CID(kNullPrincipalURIImplementationCID,
NS_NULLPRINCIPALURI_IMPLEMENTATION_CID);
NS_IMPL_THREADSAFE_ADDREF(nsNullPrincipalURI)
NS_IMPL_THREADSAFE_RELEASE(nsNullPrincipalURI)
NS_INTERFACE_MAP_BEGIN(nsNullPrincipalURI)
NS_INTERFACE_MAP_ENTRY(nsISupports)
if (aIID.Equals(kNullPrincipalURIImplementationCID))
foundInterface = static_cast<nsIURI *>(this);
else
NS_INTERFACE_MAP_ENTRY(nsIURI)
NS_INTERFACE_MAP_END
////////////////////////////////////////////////////////////////////////////////
//// nsIURI
NS_IMETHODIMP
nsNullPrincipalURI::GetAsciiHost(nsACString &_host)
{
_host.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetAsciiSpec(nsACString &_spec)
{
nsCAutoString buffer;
(void)GetSpec(buffer);
NS_EscapeURL(buffer, esc_OnlyNonASCII | esc_AlwaysCopy, _spec);
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetHost(nsACString &_host)
{
_host.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetHost(const nsACString &aHost)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetHostPort(nsACString &_host)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetHostPort(const nsACString &aHost)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetOriginCharset(nsACString &_charset)
{
_charset.Truncate();
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetPassword(nsACString &_password)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetPassword(const nsACString &aPassword)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetPath(nsACString &_path)
{
// We want to give a full copy of the string and not share a string buffer
_path = nsDependentCString(mPath);
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetPath(const nsACString &aPath)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetPrePath(nsACString &_prePath)
{
_prePath = mScheme + NS_LITERAL_CSTRING(":");
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetPort(PRInt32 *_port)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetPort(PRInt32 aPort)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetScheme(nsACString &_scheme)
{
// We want to give a full copy of the string and not share a string buffer
_scheme = nsDependentCString(mScheme);
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetScheme(const nsACString &aScheme)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetSpec(nsACString &_spec)
{
_spec = mScheme + NS_LITERAL_CSTRING(":") + mPath;
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetSpec(const nsACString &aSpec)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetUsername(nsACString &_username)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetUsername(const nsACString &aUsername)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::GetUserPass(nsACString &_userPass)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::SetUserPass(const nsACString &aUserPass)
{
return NS_ERROR_NOT_IMPLEMENTED;
}
NS_IMETHODIMP
nsNullPrincipalURI::Clone(nsIURI **_newURI)
{
nsCOMPtr<nsIURI> uri =
new nsNullPrincipalURI(mScheme + NS_LITERAL_CSTRING(":") + mPath);
NS_ENSURE_TRUE(uri, NS_ERROR_OUT_OF_MEMORY);
uri.forget(_newURI);
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::Equals(nsIURI *aOther, PRBool *_equals)
{
*_equals = PR_FALSE;
nsNullPrincipalURI *otherURI;
nsresult rv = aOther->QueryInterface(kNullPrincipalURIImplementationCID,
(void **)&otherURI);
if (NS_SUCCEEDED(rv)) {
*_equals = (0 == strcmp(mScheme.get(), otherURI->mScheme.get()) &&
0 == strcmp(mPath.get(), otherURI->mPath.get()));
NS_RELEASE(otherURI);
}
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::Resolve(const nsACString &aRelativePath,
nsACString &_resolvedURI)
{
_resolvedURI = aRelativePath;
return NS_OK;
}
NS_IMETHODIMP
nsNullPrincipalURI::SchemeIs(const char *aScheme, PRBool *_schemeIs)
{
*_schemeIs = (0 == nsCRT::strcasecmp(mScheme.get(), aScheme));
return NS_OK;
}

View File

@ -0,0 +1,69 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: sw=2 ts=2 sts=2 expandtab
* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is mozilla.org code.
*
* The Initial Developer of the Original Code is the
* Mozilla Corporation.
* Portions created by the Initial Developer are Copyright (C) 2008
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
* Shawn Wilsher <me@shawnwilsher.com> (Original author)
*
* Alternatively, the contents of this file may be used under the terms of
* either of the GNU General Public License Version 2 or later (the "GPL"),
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
/**
* This wraps nsSimpleURI so that all calls to it are done on the main thread.
*/
#ifndef __nsNullPrincipalURI_h__
#define __nsNullPrincipalURI_h__
#include "nsIURI.h"
#include "nsAutoPtr.h"
#include "nsString.h"
// {51fcd543-3b52-41f7-b91b-6b54102236e6}
#define NS_NULLPRINCIPALURI_IMPLEMENTATION_CID \
{0x51fcd543, 0x3b52, 0x41f7, \
{0xb9, 0x1b, 0x6b, 0x54, 0x10, 0x22, 0x36, 0xe6} }
class nsNullPrincipalURI : public nsIURI
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSIURI
nsNullPrincipalURI(const nsCString &aSpec);
private:
nsCString mScheme;
nsCString mPath;
};
#endif // __nsNullPrincipalURI_h__

View File

@ -233,4 +233,10 @@ interface nsIDOMWindowUtils : nsISupports {
* privileges in non-debug builds. Available to all callers in debug builds.
*/
void garbageCollect();
/**
* Force processing of any queued paints
*/
void processUpdates();
};

View File

@ -55,6 +55,8 @@
#include "nsIParser.h"
#include "nsJSEnvironment.h"
#include "nsIViewManager.h"
#if defined(MOZ_X11) && defined(MOZ_WIDGET_GTK2)
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
@ -466,3 +468,26 @@ nsDOMWindowUtils::GarbageCollect()
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::ProcessUpdates()
{
nsCOMPtr<nsIDocShell> docShell = mWindow->GetDocShell();
if (!docShell)
return NS_ERROR_UNEXPECTED;
nsCOMPtr<nsIPresShell> presShell;
nsresult rv = docShell->GetPresShell(getter_AddRefs(presShell));
if (!NS_SUCCEEDED(rv) || !presShell)
return NS_ERROR_UNEXPECTED;
nsIViewManager *viewManager = presShell->GetViewManager();
if (!viewManager)
return NS_ERROR_UNEXPECTED;
nsIViewManager::UpdateViewBatch batch;
batch.BeginUpdateViewBatch(viewManager);
batch.EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE);
return NS_OK;
}

View File

@ -1068,8 +1068,8 @@ nsDOMOfflineResourceList::CacheKeys()
return NS_ERROR_DOM_INVALID_STATE_ERR;
}
nsresult rv = appCache->GatherEntries(nsIApplicationCache::ITEM_DYNAMIC,
&mCachedKeysCount, &mCachedKeys);
return appCache->GatherEntries(nsIApplicationCache::ITEM_DYNAMIC,
&mCachedKeysCount, &mCachedKeys);
}
void

View File

@ -303,8 +303,7 @@ ShowError(MozAxPluginErrors errorCode, const CLSID &clsid)
LPOLESTR szClsid;
StringFromCLSID(clsid, &szClsid);
_sntprintf(szBuffer, kBufSize - 1,
_T("Could not create the control %s. Check that it has been installed on your computer "
"and that this page correctly references it."), OLE2T(szClsid));
_T("Could not create the control %s. Check that it has been installed on your computer and that this page correctly references it."), OLE2T(szClsid));
CoTaskMemFree(szClsid);
szMsg = szBuffer;
}

View File

@ -1915,7 +1915,7 @@ END_COM_MAP()
NS_SUCCEEDED(baseURI->GetSpec(spec)))
{
USES_CONVERSION;
if (FAILED(CreateURLMoniker(NULL, T2CW(spec.get()), &baseURLMoniker)))
if (FAILED(CreateURLMoniker(NULL, A2CW(spec.get()), &baseURLMoniker)))
return E_UNEXPECTED;
}
}

View File

@ -372,7 +372,7 @@ nsScriptablePeer::ConvertVariants(VARIANT *aIn, nsIVariant **aOut)
{
// do_CreateInstance macro is broken so load the component manager by
// hand and get it to create the component.
HMODULE hlib = ::LoadLibrary("xpcom.dll");
HMODULE hlib = ::LoadLibraryW(L"xpcom.dll");
if (hlib)
{
nsIComponentManager *pManager = nsnull; // A frozen interface, even in 1.0.x

View File

@ -52,6 +52,8 @@
#include "nsNetCID.h"
#include "nsCOMPtr.h"
#include <windows.h>
#define SEC_SUCCESS(Status) ((Status) >= 0)
#ifndef KERB_WRAP_NO_ENCRYPT
@ -103,34 +105,34 @@ static const char *MapErrorCode(int rc)
//-----------------------------------------------------------------------------
static HINSTANCE sspi_lib;
static PSecurityFunctionTable sspi;
static PSecurityFunctionTableW sspi;
static nsresult
InitSSPI()
{
PSecurityFunctionTable (*initFun)(void);
PSecurityFunctionTableW (*initFun)(void);
LOG((" InitSSPI\n"));
sspi_lib = LoadLibrary("secur32.dll");
sspi_lib = LoadLibraryW(L"secur32.dll");
if (!sspi_lib) {
sspi_lib = LoadLibrary("security.dll");
sspi_lib = LoadLibraryW(L"security.dll");
if (!sspi_lib) {
LOG(("SSPI library not found"));
return NS_ERROR_UNEXPECTED;
}
}
initFun = (PSecurityFunctionTable (*)(void))
GetProcAddress(sspi_lib, "InitSecurityInterfaceA");
initFun = (PSecurityFunctionTableW (*)(void))
GetProcAddress(sspi_lib, "InitSecurityInterfaceW");
if (!initFun) {
LOG(("InitSecurityInterfaceA not found"));
LOG(("InitSecurityInterfaceW not found"));
return NS_ERROR_UNEXPECTED;
}
sspi = initFun();
if (!sspi) {
LOG(("InitSecurityInterfaceA failed"));
LOG(("InitSecurityInterfaceW failed"));
return NS_ERROR_UNEXPECTED;
}
@ -242,11 +244,9 @@ nsAuthSSPI::Init(const char *serviceName,
if (NS_FAILED(rv))
return rv;
}
SEC_WCHAR *package;
SEC_CHAR *package;
package = (SEC_CHAR *) pTypeName[(int)mPackage];
package = (SEC_WCHAR *) pTypeName[(int)mPackage];
if (mPackage != PACKAGE_TYPE_NTLM)
{
rv = MakeSN(serviceName, mServiceName);
@ -257,8 +257,8 @@ nsAuthSSPI::Init(const char *serviceName,
SECURITY_STATUS rc;
PSecPkgInfo pinfo;
rc = (sspi->QuerySecurityPackageInfo)(package, &pinfo);
PSecPkgInfoW pinfo;
rc = (sspi->QuerySecurityPackageInfoW)(package, &pinfo);
if (rc != SEC_E_OK) {
LOG(("%s package not found\n", package));
return NS_ERROR_UNEXPECTED;
@ -268,7 +268,7 @@ nsAuthSSPI::Init(const char *serviceName,
TimeStamp useBefore;
rc = (sspi->AcquireCredentialsHandle)(NULL,
rc = (sspi->AcquireCredentialsHandleW)(NULL,
package,
SECPKG_CRED_OUTBOUND,
NULL,
@ -336,15 +336,13 @@ nsAuthSSPI::GetNextToken(const void *inToken,
if (!ob.pvBuffer)
return NS_ERROR_OUT_OF_MEMORY;
memset(ob.pvBuffer, 0, ob.cbBuffer);
SEC_CHAR *sn;
SEC_WCHAR *sn;
if (mPackage == PACKAGE_TYPE_NTLM)
sn = NULL;
else
sn = (SEC_CHAR *) mServiceName.get();
sn = (SEC_WCHAR *) mServiceName.get();
rc = (sspi->InitializeSecurityContext)(&mCred,
rc = (sspi->InitializeSecurityContextW)(&mCred,
ctxIn,
sn,
ctxReq,
@ -461,7 +459,7 @@ nsAuthSSPI::Wrap(const void *inToken,
secBuffers bufs;
SecPkgContext_Sizes sizes;
rc = (sspi->QueryContextAttributes)(
rc = (sspi->QueryContextAttributesW)(
&mCtxt,
SECPKG_ATTR_SIZES,
&sizes);

View File

@ -43,19 +43,13 @@
#include "nsSystemFontsWin.h"
nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
nsString *aFontName,
gfxFontStyle *aFontStyle,
PRBool aIsWide) const
nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLogFont,
nsString *aFontName,
gfxFontStyle *aFontStyle) const
{
PRUnichar name[LF_FACESIZE];
name[0] = 0;
if (aIsWide)
memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2);
else {
MultiByteToWideChar(CP_ACP, 0, ptrLogFont->lfFaceName,
strlen(ptrLogFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0]));
}
memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*sizeof(PRUnichar));
*aFontName = name;
// Do Style
@ -85,7 +79,7 @@ nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogF
// round, but take into account whether it is negative
float pixelHeight = -ptrLogFont->lfHeight;
if (pixelHeight < 0) {
HFONT hFont = ::CreateFontIndirect(ptrLogFont);
HFONT hFont = ::CreateFontIndirectW(ptrLogFont);
if (!hFont)
return NS_ERROR_OUT_OF_MEMORY;
HGDIOBJ hObject = ::SelectObject(*aHDC, hFont);
@ -116,32 +110,32 @@ nsresult nsSystemFontsWin::GetSysFontInfo(HDC aHDC, nsSystemFontID anID,
{
HGDIOBJ hGDI;
LOGFONT logFont;
LOGFONT* ptrLogFont = NULL;
LOGFONTW logFont;
LOGFONTW* ptrLogFont = NULL;
#ifdef WINCE
hGDI = ::GetStockObject(SYSTEM_FONT);
if (hGDI == NULL)
return NS_ERROR_UNEXPECTED;
if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0)
if (::GetObjectW(hGDI, sizeof(logFont), &logFont) > 0)
ptrLogFont = &logFont;
#else
NONCLIENTMETRICS ncm;
NONCLIENTMETRICSW ncm;
BOOL status;
if (anID == eSystemFont_Icon)
{
status = ::SystemParametersInfo(SPI_GETICONTITLELOGFONT,
sizeof(logFont),
(PVOID)&logFont,
0);
status = ::SystemParametersInfoW(SPI_GETICONTITLELOGFONT,
sizeof(logFont),
(PVOID)&logFont,
0);
}
else
{
ncm.cbSize = sizeof(NONCLIENTMETRICS);
status = ::SystemParametersInfo(SPI_GETNONCLIENTMETRICS,
ncm.cbSize = sizeof(NONCLIENTMETRICSW);
status = ::SystemParametersInfoW(SPI_GETNONCLIENTMETRICS,
sizeof(ncm),
(PVOID)&ncm,
0);
@ -196,7 +190,7 @@ nsresult nsSystemFontsWin::GetSysFontInfo(HDC aHDC, nsSystemFontID anID,
hGDI = ::GetStockObject(DEFAULT_GUI_FONT);
if (hGDI != NULL)
{
if (::GetObject(hGDI, sizeof(logFont), &logFont) > 0)
if (::GetObjectW(hGDI, sizeof(logFont), &logFont) > 0)
{
ptrLogFont = &logFont;
}

View File

@ -50,9 +50,8 @@ public:
nsresult GetSystemFont(nsSystemFontID anID, nsString *aFontName,
gfxFontStyle *aFontStyle) const;
private:
nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
nsString *aFontName, gfxFontStyle *aFontStyle,
PRBool aIsWide = PR_FALSE) const;
nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONTW* ptrLogFont,
nsString *aFontName, gfxFontStyle *aFontStyle) const;
nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID,
nsString *aFontName,
gfxFontStyle *aFontStyle) const;

View File

@ -642,7 +642,7 @@ gfxWindowsFont::ComputeMetrics()
// Cache the width of a single space.
SIZE size;
GetTextExtentPoint32(dc, " ", 1, &size);
GetTextExtentPoint32W(dc, L" ", 1, &size);
mMetrics->spaceWidth = ROUND(size.cx);
// Cache the width of digit zero.
@ -657,7 +657,7 @@ gfxWindowsFont::ComputeMetrics()
mSpaceGlyph = 0;
if (metrics.tmPitchAndFamily & TMPF_TRUETYPE) {
WORD glyph;
DWORD ret = GetGlyphIndicesA(dc, " ", 1, &glyph,
DWORD ret = GetGlyphIndicesW(dc, L" ", 1, &glyph,
GGI_MARK_NONEXISTING_GLYPHS);
if (ret != GDI_ERROR && glyph != 0xFFFF) {
mSpaceGlyph = glyph;

View File

@ -168,54 +168,26 @@ gfxWindowsSurface::OptimizeToDDB(HDC dc, const gfxIntSize& size, gfxImageFormat
return raw;
}
static char*
GetACPString(const nsAString& aStr)
{
int acplen = aStr.Length() * 2 + 1;
char * acp = new char[acplen];
if(acp) {
int outlen = ::WideCharToMultiByte(CP_ACP, 0,
PromiseFlatString(aStr).get(),
aStr.Length(),
acp, acplen, NULL, NULL);
if (outlen > 0)
acp[outlen] = '\0'; // null terminate
}
return acp;
}
nsresult gfxWindowsSurface::BeginPrinting(const nsAString& aTitle,
const nsAString& aPrintToFileName)
{
#define DOC_TITLE_LENGTH 30
DOCINFO docinfo;
DOCINFOW docinfo;
nsString titleStr;
titleStr = aTitle;
nsString titleStr(aTitle);
if (titleStr.Length() > DOC_TITLE_LENGTH) {
titleStr.SetLength(DOC_TITLE_LENGTH-3);
titleStr.AppendLiteral("...");
}
char *title = GetACPString(titleStr);
char *docName = nsnull;
if (!aPrintToFileName.IsEmpty()) {
docName = ToNewCString(aPrintToFileName);
}
nsString docName(aPrintToFileName);
docinfo.cbSize = sizeof(docinfo);
docinfo.lpszDocName = title ? title : "Mozilla Document";
docinfo.lpszOutput = docName;
docinfo.lpszDocName = titleStr.Length() > 0 ? titleStr.get() : L"Mozilla Document";
docinfo.lpszOutput = docName.Length() > 0 ? docName.get() : nsnull;
docinfo.lpszDatatype = NULL;
docinfo.fwType = 0;
int result = ::StartDoc(mDC, &docinfo);
delete [] title;
if (docName != nsnull) nsMemory::Free(docName);
if (result <= 0)
return NS_ERROR_FAILURE;
::StartDocW(mDC, &docinfo);
return NS_OK;
}

View File

@ -5051,8 +5051,10 @@ JS_EvaluateUCScriptForPrincipals(JSContext *cx, JSObject *obj,
? TCF_COMPILE_N_GO | TCF_NO_SCRIPT_RVAL
: TCF_COMPILE_N_GO,
chars, length, NULL, filename, lineno);
if (!script)
if (!script) {
LAST_FRAME_CHECKS(cx, script);
return JS_FALSE;
}
ok = js_Execute(cx, obj, script, NULL, 0, rval);
LAST_FRAME_CHECKS(cx, ok);
JS_DestroyScript(cx, script);

View File

@ -63,6 +63,7 @@
#include <windows.h>
#include <shellapi.h>
#include <shlobj.h>
#include <wchar.h>
struct ICONFILEHEADER {
PRUint16 ifhReserved;
@ -189,7 +190,7 @@ nsIconChannel::Open(nsIInputStream **_retval)
return MakeInputStream(_retval, PR_FALSE);
}
nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension)
nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsCString &aContentType, nsCString &aFileExtension)
{
nsresult rv = NS_OK;
nsCOMPtr<nsIMozIconURI> iconURI (do_QueryInterface(mUrl, &rv));
@ -236,29 +237,29 @@ NS_IMETHODIMP nsIconChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports
return rv;
}
static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFO* aSFI, UINT aInfoFlags)
static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI, UINT aInfoFlags)
{
DWORD shellResult = 0;
if (!aFile)
return shellResult;
char fileNativePath[MAX_PATH];
nsCAutoString fileNativePathStr;
aFile->GetNativePath(fileNativePathStr);
::GetShortPathName(fileNativePathStr.get(), fileNativePath, sizeof(fileNativePath));
PRUnichar fileNativePath[MAX_PATH];
nsAutoString fileNativePathStr;
aFile->GetPath(fileNativePathStr);
::GetShortPathNameW(fileNativePathStr.get(), fileNativePath, NS_ARRAY_LENGTH(fileNativePath));
LPITEMIDLIST idList;
HRESULT hr = ::SHGetSpecialFolderLocation(NULL, aFolder, &idList);
if (SUCCEEDED(hr)) {
char specialNativePath[MAX_PATH];
::SHGetPathFromIDList(idList, specialNativePath);
::GetShortPathName(specialNativePath, specialNativePath, sizeof(specialNativePath));
PRUnichar specialNativePath[MAX_PATH];
::SHGetPathFromIDListW(idList, specialNativePath);
::GetShortPathNameW(specialNativePath, specialNativePath, NS_ARRAY_LENGTH(specialNativePath));
if (nsDependentCString(fileNativePath).EqualsIgnoreCase(specialNativePath)) {
if (!wcsicmp(fileNativePath, specialNativePath)) {
aInfoFlags |= (SHGFI_PIDL | SHGFI_SYSICONINDEX);
shellResult = ::SHGetFileInfo((LPCTSTR)(LPCITEMIDLIST)idList, 0, aSFI,
sizeof(SHFILEINFO), aInfoFlags);
shellResult = ::SHGetFileInfoW((LPCWSTR)(LPCITEMIDLIST)idList, 0, aSFI,
sizeof(*aSFI), aInfoFlags);
IMalloc* pMalloc;
hr = ::SHGetMalloc(&pMalloc);
if (SUCCEEDED(hr)) {
@ -273,14 +274,14 @@ static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFO* aSFI,
nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking)
{
nsXPIDLCString contentType;
nsCAutoString fileExt;
nsCString fileExt;
nsCOMPtr<nsIFile> localFile; // file we want an icon for
PRUint32 desiredImageSize;
nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(localFile), &desiredImageSize, contentType, fileExt);
NS_ENSURE_SUCCESS(rv, rv);
// if the file exists, we are going to use it's real attributes...otherwise we only want to use it for it's extension...
SHFILEINFO sfi;
SHFILEINFOW sfi;
UINT infoFlags = SHGFI_ICON;
PRBool fileExists = PR_FALSE;
@ -343,7 +344,8 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBloc
// Not a special folder, or something else failed above.
if (!shellResult)
shellResult = ::SHGetFileInfo(filePath.get(), FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags);
shellResult = ::SHGetFileInfoW(NS_ConvertUTF8toUTF16(filePath).get(),
FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags);
if (shellResult && sfi.hIcon)
{

View File

@ -77,7 +77,7 @@ protected:
nsCOMPtr<nsIInputStreamPump> mPump;
nsCOMPtr<nsIStreamListener> mListener;
nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension);
nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsCString &aContentType, nsCString &aFileExtension);
nsresult MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking);
};

View File

@ -100,7 +100,7 @@ nsSymantecDebugManager::SetDebugAgentPassword(PRInt32 pwd)
// ("SetWindowLong returned %ld (err=%d)\n", err, GetLastError()));
/* continue so that we try to wake up the DebugManager */
}
sem = OpenSemaphore(SEMAPHORE_MODIFY_STATE, FALSE, "Netscape-Symantec Debugger");
sem = OpenSemaphoreW(SEMAPHORE_MODIFY_STATE, FALSE, L"Netscape-Symantec Debugger");
if (sem) {
ReleaseSemaphore(sem, 1, NULL);
CloseHandle(sem);

View File

@ -43,6 +43,7 @@
#include <windows.h>
#include <winsvc.h>
#include "nsString.h"
#include "nsAutodialWin.h"
#include "prlog.h"
@ -100,7 +101,7 @@ nsRASAutodial::nsRASAutodial()
mNumRASConnectionEntries(0),
mAutodialServiceDialingLocation(-1)
{
mOSVerInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
mOSVerInfo.dwOSVersionInfoSize = sizeof(mOSVerInfo);
GetVersionEx(&mOSVerInfo);
// Initializations that can be made again since RAS OS settings can
@ -139,8 +140,8 @@ nsresult nsRASAutodial::Init()
mNumRASConnectionEntries = NumRASEntries();
// Get the name of the default entry.
nsresult result = GetDefaultEntryName(mDefaultEntryName,
RAS_MaxEntryName + 1);
nsresult result = GetDefaultEntryName(mDefaultEntryName,
sizeof(mDefaultEntryName));
return result;
}
@ -205,9 +206,9 @@ int nsRASAutodial::QueryAutodialBehavior()
// If we get to here, then the service is not going to dial on error, so we
// can dial ourselves if the control panel settings are set up that way.
HKEY hKey = 0;
LONG result = ::RegOpenKeyEx(
LONG result = ::RegOpenKeyExW(
HKEY_CURRENT_USER,
"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
L"Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings",
0,
KEY_READ,
&hKey);
@ -223,7 +224,7 @@ int nsRASAutodial::QueryAutodialBehavior()
DWORD onDemand = 0;
DWORD paramSize = sizeof(DWORD);
result = ::RegQueryValueEx(hKey, "EnableAutodial", nsnull, &entryType, (LPBYTE)&autodial, &paramSize);
result = ::RegQueryValueExW(hKey, L"EnableAutodial", nsnull, &entryType, (LPBYTE)&autodial, &paramSize);
if (result != ERROR_SUCCESS)
{
::RegCloseKey(hKey);
@ -231,7 +232,7 @@ int nsRASAutodial::QueryAutodialBehavior()
return AUTODIAL_NEVER;
}
result = ::RegQueryValueEx(hKey, "NoNetAutodial", nsnull, &entryType, (LPBYTE)&onDemand, &paramSize);
result = ::RegQueryValueExW(hKey, L"NoNetAutodial", nsnull, &entryType, (LPBYTE)&onDemand, &paramSize);
if (result != ERROR_SUCCESS)
{
::RegCloseKey(hKey);
@ -269,9 +270,9 @@ static nsresult DoPPCConnection()
// Make the connection to the new network
CONNMGR_CONNECTIONINFO conn_info;
memset(&conn_info, 0, sizeof(CONNMGR_CONNECTIONINFO));
memset(&conn_info, 0, sizeof(conn_info));
conn_info.cbSize = sizeof(CONNMGR_CONNECTIONINFO);
conn_info.cbSize = sizeof(conn_info);
conn_info.dwParams = CONNMGR_PARAM_GUIDDESTNET;
conn_info.dwPriority = CONNMGR_PRIORITY_USERINTERACTIVE;
conn_info.guidDestNet = IID_DestNetInternet;
@ -321,7 +322,7 @@ static nsresult DoPPCConnection()
// Return values:
// NS_OK: dialing was successful and caller should retry
// all other values indicate that the caller should not retry
nsresult nsRASAutodial::DialDefault(const char* hostName)
nsresult nsRASAutodial::DialDefault(const PRUnichar* hostName)
{
#ifndef WINCE
mDontRetryUntil = 0;
@ -373,8 +374,8 @@ nsresult nsRASAutodial::DialDefault(const char* hostName)
LOGD(("Autodial: Dialing default: %s.",mDefaultEntryName));
RASDIALDLG rasDialDlg;
memset(&rasDialDlg, 0, sizeof(RASDIALDLG));
rasDialDlg.dwSize = sizeof(RASDIALDLG);
memset(&rasDialDlg, 0, sizeof(rasDialDlg));
rasDialDlg.dwSize = sizeof(rasDialDlg);
PRBool dialed =
(*mpRasDialDlg)(nsnull, mDefaultEntryName, nsnull, &rasDialDlg);
@ -404,8 +405,8 @@ nsresult nsRASAutodial::DialDefault(const char* hostName)
LOGD(("Autodial: Prompting for phonebook entry."));
RASPBDLG rasPBDlg;
memset(&rasPBDlg, 0, sizeof(RASPBDLG));
rasPBDlg.dwSize = sizeof(RASPBDLG);
memset(&rasPBDlg, 0, sizeof(rasPBDlg));
rasPBDlg.dwSize = sizeof(rasPBDlg);
PRBool dialed = (*mpRasPhonebookDlg)(nsnull, nsnull, &rasPBDlg);
@ -443,8 +444,8 @@ PRBool nsRASAutodial::IsRASConnected()
{
DWORD connections;
RASCONN rasConn;
rasConn.dwSize = sizeof(RASCONN);
DWORD structSize = sizeof(RASCONN);
rasConn.dwSize = sizeof(rasConn);
DWORD structSize = sizeof(rasConn);
if (!LoadRASapi32DLL())
return NS_ERROR_NULL_POINTER;
@ -462,15 +463,15 @@ PRBool nsRASAutodial::IsRASConnected()
}
// Get the first RAS dial entry name from the phonebook.
nsresult nsRASAutodial::GetFirstEntryName(char* entryName, int bufferSize)
nsresult nsRASAutodial::GetFirstEntryName(PRUnichar* entryName, int bufferSize)
{
// Need to load the DLL if not loaded yet.
if (!LoadRASapi32DLL())
return NS_ERROR_NULL_POINTER;
RASENTRYNAME rasEntryName;
rasEntryName.dwSize = sizeof(RASENTRYNAME);
DWORD cb = sizeof(RASENTRYNAME);
RASENTRYNAMEW rasEntryName;
rasEntryName.dwSize = sizeof(rasEntryName);
DWORD cb = sizeof(rasEntryName);
DWORD cEntries = 0;
DWORD result =
@ -479,9 +480,8 @@ nsresult nsRASAutodial::GetFirstEntryName(char* entryName, int bufferSize)
// ERROR_BUFFER_TOO_SMALL is OK because we only need one struct.
if (result == ERROR_SUCCESS || result == ERROR_BUFFER_TOO_SMALL)
{
#ifndef WINCE
strncpy(entryName, rasEntryName.szEntryName, bufferSize);
#endif
wcsncpy(entryName, rasEntryName.szEntryName,
bufferSize / sizeof(*entryName));
return NS_OK;
}
@ -495,9 +495,9 @@ int nsRASAutodial::NumRASEntries()
if (!LoadRASapi32DLL())
return 0;
RASENTRYNAME rasEntryName;
rasEntryName.dwSize = sizeof(RASENTRYNAME);
DWORD cb = sizeof(RASENTRYNAME);
RASENTRYNAMEW rasEntryName;
rasEntryName.dwSize = sizeof(rasEntryName);
DWORD cb = sizeof(rasEntryName);
DWORD cEntries = 0;
@ -514,7 +514,7 @@ int nsRASAutodial::NumRASEntries()
}
// Get the name of the default dial entry.
nsresult nsRASAutodial::GetDefaultEntryName(char* entryName, int bufferSize)
nsresult nsRASAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize)
{
// No RAS dialup entries.
if (mNumRASConnectionEntries <= 0)
@ -535,8 +535,8 @@ nsresult nsRASAutodial::GetDefaultEntryName(char* entryName, int bufferSize)
// or HKLM/Software/Microsoft/RAS Autodial/Default/DefaultInternet.
// For Windows 2K: HKCU/RemoteAccess/InternetProfile.
char* key = nsnull;
char* val = nsnull;
const PRUnichar* key = nsnull;
const PRUnichar* val = nsnull;
HKEY hKey = 0;
LONG result = 0;
@ -545,10 +545,10 @@ nsresult nsRASAutodial::GetDefaultEntryName(char* entryName, int bufferSize)
if ((mOSVerInfo.dwMajorVersion == 4) // Windows NT
|| ((mOSVerInfo.dwMajorVersion == 5) && (mOSVerInfo.dwMinorVersion == 0))) // Windows 2000
{
key = "RemoteAccess";
val = "InternetProfile";
key = L"RemoteAccess";
val = L"InternetProfile";
result = ::RegOpenKeyEx(
result = ::RegOpenKeyExW(
HKEY_CURRENT_USER,
key,
0,
@ -562,12 +562,12 @@ nsresult nsRASAutodial::GetDefaultEntryName(char* entryName, int bufferSize)
}
else // Windows XP
{
key = "Software\\Microsoft\\RAS Autodial\\Default";
val = "DefaultInternet";
key = L"Software\\Microsoft\\RAS Autodial\\Default";
val = L"DefaultInternet";
// Try HKCU first.
result = ::RegOpenKeyEx(
result = ::RegOpenKeyExW(
HKEY_CURRENT_USER,
key,
0,
@ -577,7 +577,7 @@ nsresult nsRASAutodial::GetDefaultEntryName(char* entryName, int bufferSize)
if (result != ERROR_SUCCESS)
{
// If not present, try HKLM.
result = ::RegOpenKeyEx(
result = ::RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
key,
0,
@ -595,7 +595,7 @@ nsresult nsRASAutodial::GetDefaultEntryName(char* entryName, int bufferSize)
DWORD entryType = 0;
DWORD buffSize = bufferSize;
result = ::RegQueryValueEx(hKey,
result = ::RegQueryValueExW(hKey,
val,
nsnull,
&entryType,
@ -631,7 +631,7 @@ PRBool nsRASAutodial::IsAutodialServiceRunning()
}
SC_HANDLE hService =
OpenService(hSCManager, "RasAuto", SERVICE_QUERY_STATUS);
OpenServiceW(hSCManager, L"RasAuto", SERVICE_QUERY_STATUS);
if (hSCManager == nsnull)
{
@ -655,23 +655,23 @@ PRBool nsRASAutodial::IsAutodialServiceRunning()
}
// Add the specified address to the autodial directory.
PRBool nsRASAutodial::AddAddressToAutodialDirectory(const char* hostName)
PRBool nsRASAutodial::AddAddressToAutodialDirectory(const PRUnichar* hostName)
{
// Need to load the DLL if not loaded yet.
if (!LoadRASapi32DLL())
return PR_FALSE;
// First see if there is already a db entry for this address.
RASAUTODIALENTRY autodialEntry;
autodialEntry.dwSize = sizeof(RASAUTODIALENTRY);
DWORD size = sizeof(RASAUTODIALENTRY);
RASAUTODIALENTRYW autodialEntry;
autodialEntry.dwSize = sizeof(autodialEntry);
DWORD size = sizeof(autodialEntry);
DWORD entries = 0;
DWORD result = (*mpRasGetAutodialAddress)(hostName,
nsnull,
&autodialEntry,
&size,
&entries);
nsnull,
&autodialEntry,
&size,
&entries);
// If there is already at least 1 entry in db for this address, return.
if (result != ERROR_FILE_NOT_FOUND)
@ -680,16 +680,16 @@ PRBool nsRASAutodial::AddAddressToAutodialDirectory(const char* hostName)
return PR_FALSE;
}
autodialEntry.dwSize = sizeof(RASAUTODIALENTRY);
autodialEntry.dwSize = sizeof(autodialEntry);
autodialEntry.dwFlags = 0;
autodialEntry.dwDialingLocation = mAutodialServiceDialingLocation;
GetDefaultEntryName(autodialEntry.szEntry, RAS_MaxEntryName);
GetDefaultEntryName(autodialEntry.szEntry, sizeof(autodialEntry.szEntry));
result = (*mpRasSetAutodialAddress)(hostName,
0,
&autodialEntry,
sizeof(RASAUTODIALENTRY),
1);
0,
&autodialEntry,
sizeof(autodialEntry),
1);
if (result != ERROR_SUCCESS)
{
@ -698,7 +698,7 @@ PRBool nsRASAutodial::AddAddressToAutodialDirectory(const char* hostName)
}
LOGD(("Autodial: Added address %s to RAS autodial db for entry %s.",
hostName, autodialEntry.szEntry));
hostName, NS_ConvertUTF16toUTF8(autodialEntry.szEntry).get()));
return PR_TRUE;
}
@ -707,9 +707,9 @@ PRBool nsRASAutodial::AddAddressToAutodialDirectory(const char* hostName)
int nsRASAutodial::GetCurrentLocation()
{
HKEY hKey = 0;
LONG result = ::RegOpenKeyEx(
LONG result = ::RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
"Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Locations",
L"Software\\Microsoft\\Windows\\CurrentVersion\\Telephony\\Locations",
0,
KEY_READ,
&hKey);
@ -724,7 +724,7 @@ int nsRASAutodial::GetCurrentLocation()
DWORD location = 0;
DWORD paramSize = sizeof(DWORD);
result = ::RegQueryValueEx(hKey, "CurrentID", nsnull, &entryType, (LPBYTE)&location, &paramSize);
result = ::RegQueryValueExW(hKey, L"CurrentID", nsnull, &entryType, (LPBYTE)&location, &paramSize);
if (result != ERROR_SUCCESS)
{
::RegCloseKey(hKey);
@ -762,7 +762,7 @@ PRBool nsRASAutodial::LoadRASapi32DLL()
{
if (!mhRASapi32)
{
mhRASapi32 = ::LoadLibrary("rasapi32.dll");
mhRASapi32 = ::LoadLibraryW(L"rasapi32.dll");
if ((UINT)mhRASapi32 > 32)
{
// RasEnumConnections
@ -811,16 +811,16 @@ PRBool nsRASAutodial::LoadRASdlgDLL()
{
if (!mhRASdlg)
{
mhRASdlg = ::LoadLibrary("rasdlg.dll");
mhRASdlg = ::LoadLibraryW(L"rasdlg.dll");
if ((UINT)mhRASdlg > 32)
{
// RasPhonebookDlg
mpRasPhonebookDlg =
(tRASPHONEBOOKDLG)::GetProcAddress(mhRASdlg, "RasPhonebookDlgA");
(tRASPHONEBOOKDLG)::GetProcAddress(mhRASdlg, "RasPhonebookDlgW");
// RasDialDlg
mpRasDialDlg =
(tRASDIALDLG)::GetProcAddress(mhRASdlg, "RasDialDlgA");
(tRASDIALDLG)::GetProcAddress(mhRASdlg, "RasDialDlgW");
}
}

View File

@ -52,21 +52,21 @@ typedef struct tagRASAUTODIALENTRYA {
DWORD dwSize;
DWORD dwFlags;
DWORD dwDialingLocation;
CHAR szEntry[RAS_MaxEntryName + 1];
} RASAUTODIALENTRYA, *LPRASAUTODIALENTRYA;
typedef RASAUTODIALENTRYA RASAUTODIALENTRY, *LPRASAUTODIALENTRY;
PRUnichar szEntry[RAS_MaxEntryName + 1];
} RASAUTODIALENTRYW, *LPRASAUTODIALENTRYW;
typedef RASAUTODIALENTRYW RASAUTODIALENTRY, *LPRASAUTODIALENTRY;
#define RASADP_LoginSessionDisable 1
#endif // WINVER
// Loading the RAS DLL dynamically.
typedef DWORD (WINAPI* tRASPHONEBOOKDLG)(LPTSTR,LPTSTR,LPRASPBDLG);
typedef DWORD (WINAPI* tRASDIALDLG)(LPTSTR,LPTSTR,LPTSTR,LPRASDIALDLG);
typedef DWORD (WINAPI* tRASPHONEBOOKDLG)(LPWSTR,LPWSTR,LPRASPBDLG);
typedef DWORD (WINAPI* tRASDIALDLG)(LPWSTR,LPWSTR,LPWSTR,LPRASDIALDLG);
typedef DWORD (WINAPI* tRASENUMCONNECTIONS)(LPRASCONN,LPDWORD,LPDWORD);
typedef DWORD (WINAPI* tRASENUMENTRIES)(LPTSTR,LPTSTR,LPRASENTRYNAME,LPDWORD,LPDWORD);
typedef DWORD (WINAPI* tRASSETAUTODIALADDRESS)(LPCTSTR,DWORD,LPRASAUTODIALENTRY,DWORD,DWORD);
typedef DWORD (WINAPI* tRASGETAUTODIALADDRESS)(LPCTSTR,LPDWORD,LPRASAUTODIALENTRY,LPDWORD,LPDWORD);
typedef DWORD (WINAPI* tRASENUMENTRIES)(LPWSTR,LPWSTR,LPRASENTRYNAMEW,LPDWORD,LPDWORD);
typedef DWORD (WINAPI* tRASSETAUTODIALADDRESS)(LPCWSTR,DWORD,LPRASAUTODIALENTRYW,DWORD,DWORD);
typedef DWORD (WINAPI* tRASGETAUTODIALADDRESS)(LPCWSTR,LPDWORD,LPRASAUTODIALENTRYW,LPDWORD,LPDWORD);
typedef DWORD (WINAPI* tRASGETAUTODIALENABLE)(DWORD,LPBOOL);
typedef DWORD (WINAPI* tRASGETAUTODIALPARAM)(DWORD,LPVOID,LPDWORD);
// For Windows NT 4, 2000, and XP, we sometimes want to open the RAS dialup
@ -107,10 +107,10 @@ private:
int NumRASEntries();
// Get the name of the default connection from the OS.
nsresult GetDefaultEntryName(char* entryName, int bufferSize);
nsresult GetDefaultEntryName(PRUnichar* entryName, int bufferSize);
// Get the name of the first RAS dial entry from the OS.
nsresult GetFirstEntryName(char* entryName, int bufferSize);
nsresult GetFirstEntryName(PRUnichar* entryName, int bufferSize);
// Check to see if RAS already has a dialup connection going.
PRBool IsRASConnected();
@ -119,7 +119,7 @@ private:
int QueryAutodialBehavior();
// Add the specified address to the autodial directory.
PRBool AddAddressToAutodialDirectory(const char* hostName);
PRBool AddAddressToAutodialDirectory(const PRUnichar* hostName);
// Get the current TAPI dialing location.
int GetCurrentLocation();
@ -145,7 +145,7 @@ private:
int mNumRASConnectionEntries;
// Default connection entry name.
char mDefaultEntryName[RAS_MaxEntryName + 1];
PRUnichar mDefaultEntryName[RAS_MaxEntryName + 1];
// Don't try to dial again within a few seconds of when user pressed cancel.
static PRIntervalTime mDontRetryUntil;
@ -184,7 +184,7 @@ public:
nsresult Init();
// Dial the default RAS dialup connection.
nsresult DialDefault(const char* hostName);
nsresult DialDefault(const PRUnichar* hostName);
// Should we try to dial on network error?
PRBool ShouldDialOnNetworkError();

View File

@ -44,7 +44,7 @@
PRBool
nsNativeConnectionHelper::OnConnectionFailed(const char* hostName)
nsNativeConnectionHelper::OnConnectionFailed(const PRUnichar* hostName)
{
nsRASAutodial autodial;

View File

@ -50,7 +50,7 @@ public:
*
* Return PR_TRUE if the connection should be re-attempted.
*/
static PRBool OnConnectionFailed(const char* hostName);
static PRBool OnConnectionFailed(const PRUnichar* hostName);
/**
* IsAutoDialEnabled

View File

@ -1252,8 +1252,10 @@ nsSocketTransport::RecoverFromError()
if (!tryAgain) {
PRBool autodialEnabled;
gSocketTransportService->GetAutodialEnabled(&autodialEnabled);
if (autodialEnabled)
tryAgain = nsNativeConnectionHelper::OnConnectionFailed(SocketHost().get());
if (autodialEnabled) {
tryAgain = nsNativeConnectionHelper::OnConnectionFailed(
NS_ConvertUTF8toUTF16(SocketHost()).get());
}
}
#endif

View File

@ -114,23 +114,22 @@ nsFileProtocolHandler::ReadURLFile(nsIFile* aFile, nsIURI** aURI)
rv = NS_ERROR_NOT_AVAILABLE;
IUniformResourceLocator* urlLink = nsnull;
IUniformResourceLocatorW* urlLink = nsnull;
result = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER,
IID_IUniformResourceLocator, (void**)&urlLink);
IID_IUniformResourceLocatorW, (void**)&urlLink);
if (SUCCEEDED(result) && urlLink) {
IPersistFile* urlFile = nsnull;
result = urlLink->QueryInterface(IID_IPersistFile, (void**)&urlFile);
if (SUCCEEDED(result) && urlFile) {
result = urlFile->Load(path.get(), STGM_READ);
if (SUCCEEDED(result) ) {
LPSTR lpTemp = nsnull;
LPWSTR lpTemp = nsnull;
// The URL this method will give us back seems to be already
// escaped. Hence, do not do escaping of our own.
result = urlLink->GetURL(&lpTemp);
if (SUCCEEDED(result) && lpTemp) {
rv = NS_NewURI(aURI, lpTemp);
rv = NS_NewURI(aURI, nsDependentString(lpTemp));
// free the string that GetURL alloc'd
CoTaskMemFree(lpTemp);
}

View File

@ -75,7 +75,7 @@ static void InitIPHelperLibrary(void)
if (sIPHelper)
return;
sIPHelper = LoadLibraryA("iphlpapi.dll");
sIPHelper = LoadLibraryW(L"iphlpapi.dll");
if (!sIPHelper)
return;

View File

@ -928,14 +928,15 @@ FileSystemDataSource::GetVolumeList(nsISimpleEnumerator** aResult)
#if defined (XP_WIN) && !defined (WINCE)
PRInt32 driveType;
char drive[32];
PRUnichar drive[32];
PRInt32 volNum;
char *url;
for (volNum = 0; volNum < 26; volNum++)
{
sprintf(drive, "%c:\\", volNum + 'A');
driveType = GetDriveType(drive);
swprintf( drive, L"%c:\\", volNum + (PRUnichar)'A');
driveType = GetDriveTypeW(drive);
if (driveType != DRIVE_UNKNOWN && driveType != DRIVE_NO_ROOT_DIR)
{
if (nsnull != (url = PR_smprintf("file:///%c|/", volNum + 'A')))