зеркало из https://github.com/mozilla/pjs.git
switching windows narrow char system calls to wide char b=418703 r=bsmedberg a=beltzner
This commit is contained in:
Родитель
b5805f559d
Коммит
7297b9e37e
|
@ -576,7 +576,7 @@ void nsAccessNodeWrap::InitAccessibility()
|
|||
}
|
||||
|
||||
if (!gmUserLib) {
|
||||
gmUserLib =::LoadLibrary("USER32.DLL");
|
||||
gmUserLib =::LoadLibraryW(L"USER32.DLL");
|
||||
}
|
||||
|
||||
if (gmUserLib) {
|
||||
|
|
|
@ -156,7 +156,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)
|
||||
|
|
|
@ -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), NS_ConvertUTF8toUTF16(fmt).get(), ap);
|
||||
MessageBoxW(NULL, msg, L"XULRunner", MB_OK | MB_ICONERROR);
|
||||
#else
|
||||
vfprintf(stderr, fmt, ap);
|
||||
#endif
|
||||
|
|
|
@ -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
|
||||
|
@ -1177,7 +1177,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
|
||||
|
@ -1410,20 +1410,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 = *aOutURL = (char*)ToNewUTF8String(nsDependentString(lpTemp));
|
||||
// free the string that GetURL alloc'd
|
||||
::CoTaskMemFree(lpTemp);
|
||||
}
|
||||
|
|
|
@ -396,8 +396,8 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs
|
|||
rv = appHelper->AppendNative(NS_LITERAL_CSTRING("helper.exe"));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString appHelperPath;
|
||||
rv = appHelper->GetNativePath(appHelperPath);
|
||||
nsAutoString appHelperPath;
|
||||
rv = appHelper->GetPath(appHelperPath);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
if (aForAllUsers) {
|
||||
|
@ -406,10 +406,10 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs
|
|||
appHelperPath.AppendLiteral(" /SetAsDefaultAppUser");
|
||||
}
|
||||
|
||||
STARTUPINFO si = {sizeof(si), 0};
|
||||
STARTUPINFOW si = {sizeof(si), 0};
|
||||
PROCESS_INFORMATION pi = {0};
|
||||
|
||||
BOOL ok = CreateProcess(NULL, (LPSTR)appHelperPath.get(), NULL, NULL,
|
||||
BOOL ok = CreateProcessW(NULL, (LPWSTR)appHelperPath.get(), NULL, NULL,
|
||||
FALSE, 0, NULL, NULL, &si, &pi);
|
||||
|
||||
if (!ok)
|
||||
|
|
|
@ -929,16 +929,6 @@ morkStdioFile::Steal(nsIMdbEnv* ev, nsIMdbFile* ioThief)
|
|||
void mork_fileflush(FILE * file)
|
||||
{
|
||||
fflush(file);
|
||||
#ifndef WINCE
|
||||
OSVERSIONINFOA vi = { sizeof(OSVERSIONINFOA) };
|
||||
if ((GetVersionExA(&vi) && vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS))
|
||||
{
|
||||
// Win9x/ME
|
||||
int fd = fileno(file);
|
||||
HANDLE fh = (HANDLE)_get_osfhandle(fd);
|
||||
FlushFileBuffers(fh);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif /*MORK_WIN*/
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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,25 +105,25 @@ 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))
|
||||
initFun = (PSecurityFunctionTableW (*)(void))
|
||||
GetProcAddress(sspi_lib, "InitSecurityInterfaceA");
|
||||
if (!initFun) {
|
||||
LOG(("InitSecurityInterfaceA not found"));
|
||||
|
@ -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);
|
||||
|
|
|
@ -44,18 +44,12 @@
|
|||
|
||||
|
||||
nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
|
||||
nsString *aFontName,
|
||||
gfxFontStyle *aFontStyle,
|
||||
PRBool aIsWide) const
|
||||
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]));
|
||||
}
|
||||
*aFontName = name;
|
||||
|
||||
// Do Style
|
||||
|
|
|
@ -51,8 +51,7 @@ public:
|
|||
gfxFontStyle *aFontStyle) const;
|
||||
private:
|
||||
nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
|
||||
nsString *aFontName, gfxFontStyle *aFontStyle,
|
||||
PRBool aIsWide = PR_FALSE) const;
|
||||
nsString *aFontName, gfxFontStyle *aFontStyle) const;
|
||||
nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID,
|
||||
nsString *aFontName,
|
||||
gfxFontStyle *aFontStyle) const;
|
||||
|
|
|
@ -310,7 +310,7 @@ NS_IMETHODIMP nsDeviceContextWin :: SetCanonicalPixelScale(float aScale)
|
|||
|
||||
|
||||
nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
|
||||
nsFont* aFont, PRBool aIsWide) const
|
||||
nsFont* aFont) const
|
||||
{
|
||||
PRUnichar name[LF_FACESIZE];
|
||||
name[0] = 0;
|
||||
|
|
|
@ -101,8 +101,7 @@ protected:
|
|||
void ComputeFullAreaUsingScreen ( nsRect* outRect ) ;
|
||||
nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsFont* aFont) const;
|
||||
|
||||
nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, nsFont* aFont,
|
||||
PRBool aIsWide = PR_FALSE) const;
|
||||
nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, nsFont* aFont) const;
|
||||
|
||||
PRBool mCachedClientRect;
|
||||
PRBool mCachedFullRect;
|
||||
|
|
|
@ -2121,40 +2121,9 @@ nsGlyphAgent::GetGlyphMetrics(HDC aDC,
|
|||
GLYPHMETRICS* aGlyphMetrics)
|
||||
{
|
||||
memset(aGlyphMetrics, 0, sizeof(GLYPHMETRICS)); // UMR: bug 46438
|
||||
if (eGlyphAgent_UNKNOWN == mState) { // first time we have been in this function
|
||||
// see if this platform implements GetGlyphOutlineW()
|
||||
DWORD len = GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat);
|
||||
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) {
|
||||
// next time, we won't bother trying GetGlyphOutlineW()
|
||||
mState = eGlyphAgent_ANSI;
|
||||
}
|
||||
else {
|
||||
// all is well with GetGlyphOutlineW(), we will be using it from now on
|
||||
mState = eGlyphAgent_UNICODE;
|
||||
return len;
|
||||
}
|
||||
}
|
||||
|
||||
if (eGlyphAgent_UNICODE == mState) {
|
||||
return GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat);
|
||||
}
|
||||
|
||||
// Otherwise, we are on a platform that doesn't implement GetGlyphOutlineW()
|
||||
// (see Q241358: The GetGlyphOutlineW Function Fails on Windows 95 & 98
|
||||
// http://support.microsoft.com/support/kb/articles/Q241/3/58.ASP)
|
||||
// we will use glyph indices as a work around.
|
||||
if (0 == aGlyphIndex) { // caller doesn't know the glyph index, so find it
|
||||
nsAutoChar16Buffer buf;
|
||||
if (NS_SUCCEEDED(GetGlyphIndices(aDC, nsnull, &aChar, 1, buf)))
|
||||
aGlyphIndex = *(buf.Elements());
|
||||
}
|
||||
if (0 < aGlyphIndex) {
|
||||
return GetGlyphOutlineA(aDC, aGlyphIndex, GGO_METRICS | GGO_GLYPH_INDEX, aGlyphMetrics, 0, nsnull, &mMat);
|
||||
}
|
||||
|
||||
// if we ever reach here, something went wrong in GetGlyphIndices() above
|
||||
// because the current font in aDC wasn't a Unicode font
|
||||
return GDI_ERROR;
|
||||
}
|
||||
|
||||
// the global glyph agent that we will be using
|
||||
|
|
|
@ -340,13 +340,13 @@ 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);
|
||||
|
||||
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;
|
||||
|
|
|
@ -168,27 +168,11 @@ 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;
|
||||
|
@ -196,23 +180,21 @@ nsresult gfxWindowsSurface::BeginPrinting(const nsAString& aTitle,
|
|||
titleStr.SetLength(DOC_TITLE_LENGTH-3);
|
||||
titleStr.AppendLiteral("...");
|
||||
}
|
||||
char *title = GetACPString(titleStr);
|
||||
|
||||
char *docName = nsnull;
|
||||
nsPromiseFlatString flatTitleStr(titleStr);
|
||||
const PRUnichar *title = (const PRUnichar*)(flatTitleStr.get());
|
||||
const PRUnichar *docName = nsnull;
|
||||
nsPromiseFlatString printToFileNameStr(aPrintToFileName);
|
||||
if (!aPrintToFileName.IsEmpty()) {
|
||||
docName = ToNewCString(aPrintToFileName);
|
||||
docName = (const PRUnichar*)(printToFileNameStr.get());
|
||||
}
|
||||
|
||||
docinfo.cbSize = sizeof(docinfo);
|
||||
docinfo.lpszDocName = title ? title : "Mozilla Document";
|
||||
docinfo.lpszDocName = title ? title : L"Mozilla Document";
|
||||
docinfo.lpszOutput = docName;
|
||||
docinfo.lpszDatatype = NULL;
|
||||
docinfo.fwType = 0;
|
||||
|
||||
::StartDoc(mDC, &docinfo);
|
||||
::StartDocW(mDC, &docinfo);
|
||||
|
||||
delete [] title;
|
||||
if (docName != nsnull) nsMemory::Free(docName);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -133,7 +133,7 @@ nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACS
|
|||
{
|
||||
nsCOMPtr<nsIWin32Locale> winLocale;
|
||||
LCID localeAsLCID;
|
||||
char acp_name[6];
|
||||
PRUnichar acp_name[6];
|
||||
|
||||
//
|
||||
// convert locale name to a code page (through the LCID)
|
||||
|
@ -147,11 +147,11 @@ nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACS
|
|||
rv = winLocale->GetPlatformLocale(localeName, &localeAsLCID);
|
||||
if (NS_FAILED(rv)) { return rv; }
|
||||
|
||||
if (GetLocaleInfo(localeAsLCID, LOCALE_IDEFAULTANSICODEPAGE, acp_name, sizeof(acp_name))==0) {
|
||||
if (GetLocaleInfoW(localeAsLCID, LOCALE_IDEFAULTANSICODEPAGE, acp_name, sizeof(acp_name))==0) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
nsAutoString acp_key(NS_LITERAL_STRING("acp."));
|
||||
acp_key.AppendWithConversion(acp_name);
|
||||
acp_key.Append(acp_name);
|
||||
|
||||
return MapToCharset(acp_key, oResult);
|
||||
}
|
||||
|
|
|
@ -112,7 +112,7 @@ ipcThreadWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
cd.dwData = GetCurrentProcessId();
|
||||
cd.cbData = (DWORD) msg->MsgLen();
|
||||
cd.lpData = (PVOID) msg->MsgBuf();
|
||||
SendMessageA(ipcDaemonHwnd, WM_COPYDATA, (WPARAM) hWnd, (LPARAM) &cd);
|
||||
SendMessage(ipcDaemonHwnd, WM_COPYDATA, (WPARAM) hWnd, (LPARAM) &cd);
|
||||
LOG((" done.\n"));
|
||||
delete msg;
|
||||
}
|
||||
|
|
|
@ -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,28 @@ 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, sizeof(fileNativePath));
|
||||
|
||||
LPITEMIDLIST idList;
|
||||
HRESULT hr = ::SHGetSpecialFolderLocation(NULL, aFolder, &idList);
|
||||
if (SUCCEEDED(hr)) {
|
||||
char specialNativePath[MAX_PATH];
|
||||
::SHGetPathFromIDList(idList, specialNativePath);
|
||||
::GetShortPathName(specialNativePath, specialNativePath, sizeof(specialNativePath));
|
||||
|
||||
if (nsDependentCString(fileNativePath).EqualsIgnoreCase(specialNativePath)) {
|
||||
PRUnichar specialNativePath[MAX_PATH];
|
||||
::SHGetPathFromIDListW(idList, specialNativePath);
|
||||
::GetShortPathNameW(specialNativePath, specialNativePath, sizeof(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(SHFILEINFOW), aInfoFlags);
|
||||
IMalloc* pMalloc;
|
||||
hr = ::SHGetMalloc(&pMalloc);
|
||||
if (SUCCEEDED(hr)) {
|
||||
|
@ -273,14 +273,14 @@ static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFO* aSFI,
|
|||
nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking)
|
||||
{
|
||||
nsXPIDLCString contentType;
|
||||
nsCAutoString filePath;
|
||||
nsCString filePath;
|
||||
nsCOMPtr<nsIFile> localFile; // file we want an icon for
|
||||
PRUint32 desiredImageSize;
|
||||
nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(localFile), &desiredImageSize, contentType, filePath);
|
||||
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;
|
||||
|
@ -342,7 +342,9 @@ 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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -66,14 +66,14 @@ ClearVersion(verBlock *ver)
|
|||
}
|
||||
|
||||
static BOOL
|
||||
FileExists(LPCSTR szFile)
|
||||
FileExists(wchar_t* szFile)
|
||||
{
|
||||
return GetFileAttributes(szFile) != 0xFFFFFFFF;
|
||||
return GetFileAttributesW(szFile) != 0xFFFFFFFF;
|
||||
}
|
||||
|
||||
// Get file version information from a file
|
||||
static BOOL
|
||||
GetFileVersion(LPSTR szFile, verBlock *vbVersion)
|
||||
GetFileVersion(wchar_t* szFile, verBlock *vbVersion)
|
||||
{
|
||||
UINT uLen;
|
||||
UINT dwLen;
|
||||
|
@ -86,12 +86,12 @@ GetFileVersion(LPSTR szFile, verBlock *vbVersion)
|
|||
ClearVersion(vbVersion);
|
||||
if (FileExists(szFile)) {
|
||||
bRv = TRUE;
|
||||
dwLen = GetFileVersionInfoSize(szFile, &dwHandle);
|
||||
dwLen = GetFileVersionInfoSizeW(szFile, &dwHandle);
|
||||
lpData = (LPVOID)malloc(dwLen);
|
||||
uLen = 0;
|
||||
|
||||
if (lpData && GetFileVersionInfo(szFile, dwHandle, dwLen, lpData) != 0) {
|
||||
if (VerQueryValue(lpData, "\\", &lpBuffer, &uLen) != 0) {
|
||||
if (lpData && GetFileVersionInfoW(szFile, dwHandle, dwLen, lpData) != 0) {
|
||||
if (VerQueryValueW(lpData, L"\\", &lpBuffer, &uLen) != 0) {
|
||||
lpBuffer2 = (VS_FIXEDFILEINFO *)lpBuffer;
|
||||
|
||||
vbVersion->wMajor = HIWORD(lpBuffer2->dwFileVersionMS);
|
||||
|
@ -124,15 +124,15 @@ CopyVersion(verBlock *ver1, verBlock *ver2)
|
|||
static void
|
||||
TranslateVersionStr(const char* szVersion, verBlock *vbVersion)
|
||||
{
|
||||
LPSTR szNum1 = NULL;
|
||||
LPSTR szNum2 = NULL;
|
||||
LPSTR szNum3 = NULL;
|
||||
LPSTR szNum4 = NULL;
|
||||
LPSTR szJavaBuild = NULL;
|
||||
char* szNum1 = NULL;
|
||||
char* szNum2 = NULL;
|
||||
char* szNum3 = NULL;
|
||||
char* szNum4 = NULL;
|
||||
char* szJavaBuild = NULL;
|
||||
|
||||
char *strVer = nsnull;
|
||||
char* strVer = nsnull;
|
||||
if (szVersion) {
|
||||
strVer = PL_strdup(szVersion);
|
||||
strVer = strdup(szVersion);
|
||||
}
|
||||
|
||||
if (!strVer) {
|
||||
|
@ -157,7 +157,7 @@ TranslateVersionStr(const char* szVersion, verBlock *vbVersion)
|
|||
vbVersion->wRelease = szNum3 ? atoi(szNum3) : 0;
|
||||
vbVersion->wBuild = szNum4 ? atoi(szNum4) : 0;
|
||||
|
||||
PL_strfree(strVer);
|
||||
free(strVer);
|
||||
}
|
||||
|
||||
// Compare two version struct, return zero if the same
|
||||
|
@ -195,26 +195,28 @@ CompareVersion(verBlock vbVersionOld, verBlock vbVersionNew)
|
|||
// Indicate whether we should try to use the new NPRuntime-based Java
|
||||
// Plug-In if it's available
|
||||
static PRBool
|
||||
TryToUseNPRuntimeJavaPlugIn(const char* javaVersion)
|
||||
TryToUseNPRuntimeJavaPlugIn(const wchar_t* javaVersion)
|
||||
{
|
||||
HKEY javaKey = NULL;
|
||||
char keyName[_MAX_PATH];
|
||||
keyName[0] = 0;
|
||||
PL_strcat(keyName, "Software\\JavaSoft\\Java Plug-in\\");
|
||||
PL_strcat(keyName, javaVersion);
|
||||
wchar_t keyName[_MAX_PATH];
|
||||
|
||||
wcsncpy(keyName, L"Software\\JavaSoft\\Java Plug-in\\", wcslen(L"Software\\JavaSoft\\Java Plug-in\\"));
|
||||
wcscpy(keyName, javaVersion);
|
||||
|
||||
DWORD val;
|
||||
DWORD valSize = sizeof(DWORD);
|
||||
|
||||
if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
keyName, 0, KEY_READ, &javaKey)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// Look for "UseNewJavaPlugin"
|
||||
if (ERROR_SUCCESS != ::RegQueryValueEx(javaKey, "UseNewJavaPlugin",
|
||||
NULL, NULL,
|
||||
(LPBYTE) &val,
|
||||
&valSize)) {
|
||||
if (ERROR_SUCCESS != ::RegQueryValueExW(javaKey,
|
||||
L"UseNewJavaPlugin",
|
||||
NULL, NULL,
|
||||
(LPBYTE) &val,
|
||||
&valSize)) {
|
||||
val = 0;
|
||||
}
|
||||
|
||||
|
@ -262,7 +264,7 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
return rv;
|
||||
}
|
||||
|
||||
if (nsCRT::strcmp(prop, NS_WIN_4DOTX_SCAN_KEY) == 0) {
|
||||
if (strcmp(prop, NS_WIN_4DOTX_SCAN_KEY) == 0) {
|
||||
// Check our prefs to see if scanning the 4.x folder has been
|
||||
// explictly overriden failure to get the pref is okay, we'll do
|
||||
// what we've been doing -- a filtered scan
|
||||
|
@ -277,38 +279,38 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
HKEY keyloc;
|
||||
long result;
|
||||
DWORD type;
|
||||
char szKey[_MAX_PATH] = "Software\\Netscape\\Netscape Navigator";
|
||||
char path[_MAX_PATH];
|
||||
wchar_t szKey[_MAX_PATH] = L"Software\\Netscape\\Netscape Navigator";
|
||||
wchar_t path[_MAX_PATH];
|
||||
|
||||
result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc);
|
||||
result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc);
|
||||
|
||||
if (result == ERROR_SUCCESS) {
|
||||
char current_version[80];
|
||||
wchar_t current_version[80];
|
||||
DWORD length = sizeof(current_version);
|
||||
|
||||
result = ::RegQueryValueEx(keyloc, "CurrentVersion", NULL, &type,
|
||||
result = ::RegQueryValueExW(keyloc, L"CurrentVersion", NULL, &type,
|
||||
(LPBYTE)¤t_version, &length);
|
||||
|
||||
::RegCloseKey(keyloc);
|
||||
PL_strcat(szKey, "\\");
|
||||
PL_strcat(szKey, current_version);
|
||||
PL_strcat(szKey, "\\Main");
|
||||
result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc);
|
||||
wcscat(szKey, L"\\");
|
||||
wcscat(szKey, current_version);
|
||||
wcscat(szKey, L"\\Main");
|
||||
result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc);
|
||||
|
||||
if (result == ERROR_SUCCESS) {
|
||||
DWORD pathlen = sizeof(path);
|
||||
|
||||
result = ::RegQueryValueEx(keyloc, "Plugins Directory", NULL, &type,
|
||||
result = ::RegQueryValueExW(keyloc, L"Plugins Directory", NULL, &type,
|
||||
(LPBYTE)&path, &pathlen);
|
||||
if (result == ERROR_SUCCESS) {
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE,
|
||||
getter_AddRefs(localFile));
|
||||
rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE,
|
||||
getter_AddRefs(localFile));
|
||||
}
|
||||
|
||||
::RegCloseKey(keyloc);
|
||||
}
|
||||
}
|
||||
} else if (nsCRT::strcmp(prop, NS_WIN_JRE_SCAN_KEY) == 0) {
|
||||
} else if (strcmp(prop, NS_WIN_JRE_SCAN_KEY) == 0) {
|
||||
nsXPIDLCString strVer;
|
||||
#ifdef OJI
|
||||
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
|
||||
|
@ -328,24 +330,25 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
DWORD pathlen;
|
||||
verBlock maxVer;
|
||||
ClearVersion(&maxVer);
|
||||
char curKey[_MAX_PATH] = "Software\\JavaSoft\\Java Runtime Environment";
|
||||
char path[_MAX_PATH];
|
||||
wchar_t curKey[_MAX_PATH] = L"Software\\JavaSoft\\Java Runtime Environment";
|
||||
wchar_t path[_MAX_PATH];
|
||||
|
||||
// Add + 15 to prevent buffer overrun when adding \bin (+ optionally
|
||||
// \new_plugin)
|
||||
#define JAVA_PATH_SIZE _MAX_PATH + 15
|
||||
char newestPath[JAVA_PATH_SIZE];
|
||||
const char mozPath[_MAX_PATH] = "Software\\mozilla.org\\Mozilla";
|
||||
char browserJavaVersion[_MAX_PATH];
|
||||
wchar_t newestPath[JAVA_PATH_SIZE];
|
||||
const wchar_t mozPath[_MAX_PATH] = L"Software\\mozilla.org\\Mozilla";
|
||||
wchar_t browserJavaVersion[_MAX_PATH];
|
||||
PRBool tryNPRuntimeJavaPlugIn = PR_FALSE;
|
||||
|
||||
newestPath[0] = 0;
|
||||
LONG result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ,
|
||||
LONG result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ,
|
||||
&baseloc);
|
||||
if (ERROR_SUCCESS != result)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
// Look for "BrowserJavaVersion"
|
||||
if (ERROR_SUCCESS != ::RegQueryValueEx(baseloc, "BrowserJavaVersion", NULL,
|
||||
if (ERROR_SUCCESS != ::RegQueryValueExW(baseloc, L"BrowserJavaVersion", NULL,
|
||||
NULL, (LPBYTE)&browserJavaVersion,
|
||||
&numChars))
|
||||
browserJavaVersion[0] = 0;
|
||||
|
@ -356,13 +359,13 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
path[0] = 0;
|
||||
numChars = _MAX_PATH;
|
||||
pathlen = sizeof(path);
|
||||
result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL,
|
||||
result = ::RegEnumKeyExW(baseloc, index, curKey, &numChars, NULL, NULL,
|
||||
NULL, &modTime);
|
||||
index++;
|
||||
|
||||
// Skip major.minor as it always points to latest in its family
|
||||
numChars = 0;
|
||||
for (char *p = curKey; *p; p++) {
|
||||
for (wchar_t *p = curKey; *p; p++) { // can I do this with wchar_t xxx?
|
||||
if (*p == '.') {
|
||||
numChars++;
|
||||
}
|
||||
|
@ -371,24 +374,24 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
continue;
|
||||
|
||||
if (ERROR_SUCCESS == result) {
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0,
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, curKey, 0,
|
||||
KEY_QUERY_VALUE, &keyloc)) {
|
||||
// We have a sub key
|
||||
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "JavaHome", NULL,
|
||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"JavaHome", NULL,
|
||||
&type, (LPBYTE)&path,
|
||||
&pathlen)) {
|
||||
verBlock curVer;
|
||||
TranslateVersionStr(curKey, &curVer);
|
||||
TranslateVersionStr(NS_ConvertUTF16toUTF8(curKey).get(), &curVer);
|
||||
if (CompareVersion(curVer, minVer) >= 0) {
|
||||
if (!strncmp(browserJavaVersion, curKey, _MAX_PATH)) {
|
||||
PL_strcpy(newestPath, path);
|
||||
if (!wcsncmp(browserJavaVersion, curKey, _MAX_PATH)) {
|
||||
wcscpy(newestPath, path);
|
||||
tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey);
|
||||
::RegCloseKey(keyloc);
|
||||
break;
|
||||
}
|
||||
|
||||
if (CompareVersion(curVer, maxVer) >= 0) {
|
||||
PL_strcpy(newestPath, path);
|
||||
wcscpy(newestPath, path);
|
||||
CopyVersion(&maxVer, &curVer);
|
||||
tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey);
|
||||
}
|
||||
|
@ -404,20 +407,20 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
// If nothing is found, then don't add \bin dir and don't set
|
||||
// CurrentVersion for Mozilla
|
||||
if (newestPath[0] != 0) {
|
||||
if (ERROR_SUCCESS == ::RegCreateKeyEx(HKEY_LOCAL_MACHINE, mozPath, 0,
|
||||
if (ERROR_SUCCESS == ::RegCreateKeyExW(HKEY_LOCAL_MACHINE, mozPath, 0,
|
||||
NULL, REG_OPTION_NON_VOLATILE,
|
||||
KEY_SET_VALUE|KEY_QUERY_VALUE,
|
||||
NULL, &entryloc, NULL)) {
|
||||
if (ERROR_SUCCESS != ::RegQueryValueEx(entryloc, "CurrentVersion", 0,
|
||||
if (ERROR_SUCCESS != ::RegQueryValueExW(entryloc, L"CurrentVersion", 0,
|
||||
NULL, NULL, NULL)) {
|
||||
::RegSetValueEx(entryloc, "CurrentVersion", 0, REG_SZ,
|
||||
::RegSetValueExW(entryloc, L"CurrentVersion", 0, REG_SZ,
|
||||
(const BYTE*)MOZILLA_VERSION,
|
||||
sizeof(MOZILLA_VERSION));
|
||||
}
|
||||
::RegCloseKey(entryloc);
|
||||
}
|
||||
|
||||
PL_strcat(newestPath,"\\bin");
|
||||
wcscat(newestPath,L"\\bin");
|
||||
|
||||
// See whether we should use the new NPRuntime-based Java Plug-In:
|
||||
// - If tryNPRuntimeJavaPlugIn is true, and
|
||||
|
@ -427,13 +430,13 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
// one any more.
|
||||
if (tryNPRuntimeJavaPlugIn) {
|
||||
// See whether the "new_plugin" directory exists
|
||||
char tmpPath[JAVA_PATH_SIZE];
|
||||
PL_strcpy(tmpPath, newestPath);
|
||||
PL_strcat(tmpPath, "\\new_plugin");
|
||||
wchar_t tmpPath[JAVA_PATH_SIZE];
|
||||
wcscpy(tmpPath, newestPath);
|
||||
wcscat(tmpPath, L"\\new_plugin");
|
||||
nsCOMPtr<nsILocalFile> tmpFile;
|
||||
if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(tmpPath),
|
||||
PR_TRUE,
|
||||
getter_AddRefs(tmpFile))) &&
|
||||
if (NS_SUCCEEDED(NS_NewLocalFile(nsDependentString(tmpPath),
|
||||
PR_TRUE,
|
||||
getter_AddRefs(tmpFile))) &&
|
||||
tmpFile) {
|
||||
PRBool exists = PR_FALSE;
|
||||
PRBool isDir = PR_FALSE;
|
||||
|
@ -442,15 +445,15 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
// Assume we're supposed to use this as the search
|
||||
// directory for the Java Plug-In instead of the normal
|
||||
// one
|
||||
PL_strcpy(newestPath, tmpPath);
|
||||
wcscpy(newestPath, tmpPath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(newestPath), PR_TRUE,
|
||||
getter_AddRefs(localFile));
|
||||
rv = NS_NewLocalFile(nsDependentString(newestPath), PR_TRUE,
|
||||
getter_AddRefs(localFile));
|
||||
}
|
||||
} else if (nsCRT::strcmp(prop, NS_WIN_QUICKTIME_SCAN_KEY) == 0) {
|
||||
} else if (strcmp(prop, NS_WIN_QUICKTIME_SCAN_KEY) == 0) {
|
||||
nsXPIDLCString strVer;
|
||||
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -463,33 +466,33 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
DWORD type;
|
||||
verBlock qtVer;
|
||||
ClearVersion(&qtVer);
|
||||
char path[_MAX_PATH];
|
||||
wchar_t path[_MAX_PATH];
|
||||
DWORD pathlen = sizeof(path);
|
||||
|
||||
// First we need to check the version of Quicktime via checking
|
||||
// the EXE's version table
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\QuickTimePlayer.exe", 0, KEY_READ, &keyloc)) {
|
||||
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type,
|
||||
(LPBYTE)&path, &pathlen)) {
|
||||
GetFileVersion((char*)path, &qtVer);
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\QuickTimePlayer.exe", 0, KEY_READ, &keyloc)) {
|
||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type,
|
||||
(LPBYTE)&path, &pathlen)) {
|
||||
GetFileVersion(path, &qtVer);
|
||||
}
|
||||
::RegCloseKey(keyloc);
|
||||
}
|
||||
if (CompareVersion(qtVer, minVer) < 0)
|
||||
return rv;
|
||||
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Apple Computer, Inc.\\QuickTime", 0, KEY_READ, &keyloc)) {
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Apple Computer, Inc.\\QuickTime", 0, KEY_READ, &keyloc)) {
|
||||
DWORD pathlen = sizeof(path);
|
||||
|
||||
result = ::RegQueryValueEx(keyloc, "InstallDir", NULL, &type,
|
||||
result = ::RegQueryValueExW(keyloc, L"InstallDir", NULL, &type,
|
||||
(LPBYTE)&path, &pathlen);
|
||||
PL_strcat(path, "\\Plugins");
|
||||
wcscat(path, L"\\Plugins");
|
||||
if (result == ERROR_SUCCESS)
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE,
|
||||
getter_AddRefs(localFile));
|
||||
rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE,
|
||||
getter_AddRefs(localFile));
|
||||
::RegCloseKey(keyloc);
|
||||
}
|
||||
} else if (nsCRT::strcmp(prop, NS_WIN_WMP_SCAN_KEY) == 0) {
|
||||
} else if (strcmp(prop, NS_WIN_WMP_SCAN_KEY) == 0) {
|
||||
nsXPIDLCString strVer;
|
||||
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -501,33 +504,33 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
DWORD type;
|
||||
verBlock wmpVer;
|
||||
ClearVersion(&wmpVer);
|
||||
char path[_MAX_PATH];
|
||||
wchar_t path[_MAX_PATH];
|
||||
DWORD pathlen = sizeof(path);
|
||||
|
||||
// First we need to check the version of WMP
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe", 0, KEY_READ, &keyloc)) {
|
||||
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type,
|
||||
(LPBYTE)&path, &pathlen)) {
|
||||
GetFileVersion((char*)path, &wmpVer);
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe", 0, KEY_READ, &keyloc)) {
|
||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type,
|
||||
(LPBYTE)&path, &pathlen)) {
|
||||
GetFileVersion(path, &wmpVer);
|
||||
}
|
||||
::RegCloseKey(keyloc);
|
||||
}
|
||||
if (CompareVersion(wmpVer, minVer) < 0)
|
||||
return rv;
|
||||
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||
"software\\Microsoft\\MediaPlayer", 0,
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
||||
L"software\\Microsoft\\MediaPlayer", 0,
|
||||
KEY_READ, &keyloc)) {
|
||||
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "Installation Directory",
|
||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"Installation Directory",
|
||||
NULL, &type, (LPBYTE)&path,
|
||||
&pathlen)) {
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE,
|
||||
getter_AddRefs(localFile));
|
||||
rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE,
|
||||
getter_AddRefs(localFile));
|
||||
}
|
||||
|
||||
::RegCloseKey(keyloc);
|
||||
}
|
||||
} else if (nsCRT::strcmp(prop, NS_WIN_ACROBAT_SCAN_KEY) == 0) {
|
||||
} else if (strcmp(prop, NS_WIN_ACROBAT_SCAN_KEY) == 0) {
|
||||
nsXPIDLCString strVer;
|
||||
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) {
|
||||
return NS_ERROR_FAILURE;
|
||||
|
@ -546,16 +549,16 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
DWORD pathlen;
|
||||
verBlock maxVer;
|
||||
ClearVersion(&maxVer);
|
||||
char curKey[_MAX_PATH] = "software\\Adobe\\Acrobat Reader";
|
||||
char path[_MAX_PATH];
|
||||
wchar_t curKey[_MAX_PATH] = L"software\\Adobe\\Acrobat Reader";
|
||||
wchar_t path[_MAX_PATH];
|
||||
// Add + 8 to prevent buffer overrun when adding \browser
|
||||
char newestPath[_MAX_PATH + 8];
|
||||
wchar_t newestPath[_MAX_PATH + 8];
|
||||
|
||||
newestPath[0] = 0;
|
||||
if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0,
|
||||
if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0,
|
||||
KEY_READ, &baseloc)) {
|
||||
PL_strcpy(curKey, "software\\Adobe\\Adobe Acrobat");
|
||||
if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0,
|
||||
wcscpy(curKey, L"software\\Adobe\\Adobe Acrobat");
|
||||
if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0,
|
||||
KEY_READ, &baseloc)) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -568,22 +571,22 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
path[0] = 0;
|
||||
numChars = _MAX_PATH;
|
||||
pathlen = sizeof(path);
|
||||
result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL,
|
||||
result = ::RegEnumKeyExW(baseloc, index, curKey, &numChars, NULL, NULL,
|
||||
NULL, &modTime);
|
||||
index++;
|
||||
|
||||
if (ERROR_SUCCESS == result) {
|
||||
verBlock curVer;
|
||||
TranslateVersionStr(curKey, &curVer);
|
||||
PL_strcat(curKey, "\\InstallPath");
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0,
|
||||
TranslateVersionStr(NS_ConvertUTF16toUTF8(curKey).get(), &curVer);
|
||||
wcscat(curKey, L"\\InstallPath");
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, curKey, 0,
|
||||
KEY_QUERY_VALUE, &keyloc)) {
|
||||
// We have a sub key
|
||||
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type,
|
||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type,
|
||||
(LPBYTE)&path, &pathlen)) {
|
||||
if (CompareVersion(curVer, maxVer) >= 0 &&
|
||||
CompareVersion(curVer, minVer) >= 0) {
|
||||
PL_strcpy(newestPath, path);
|
||||
wcscpy(newestPath, path);
|
||||
CopyVersion(&maxVer, &curVer);
|
||||
}
|
||||
}
|
||||
|
@ -596,9 +599,9 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
|||
::RegCloseKey(baseloc);
|
||||
|
||||
if (newestPath[0] != 0) {
|
||||
PL_strcat(newestPath,"\\browser");
|
||||
rv = NS_NewNativeLocalFile(nsDependentCString(newestPath), PR_TRUE,
|
||||
getter_AddRefs(localFile));
|
||||
wcscat(newestPath, L"\\browser");
|
||||
rv = NS_NewLocalFile(nsDependentString(newestPath), PR_TRUE,
|
||||
getter_AddRefs(localFile));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -626,32 +629,32 @@ nsPluginDirServiceProvider::GetPLIDDirectories(nsISimpleEnumerator **aEnumerator
|
|||
nsresult
|
||||
nsPluginDirServiceProvider::GetPLIDDirectoriesWithHKEY(HKEY aKey, nsCOMArray<nsILocalFile> &aDirs)
|
||||
{
|
||||
char subkey[_MAX_PATH] = "Software\\MozillaPlugins";
|
||||
wchar_t subkey[_MAX_PATH] = L"Software\\MozillaPlugins";
|
||||
HKEY baseloc;
|
||||
|
||||
if (ERROR_SUCCESS != ::RegOpenKeyEx(aKey, subkey, 0, KEY_READ, &baseloc))
|
||||
if (ERROR_SUCCESS != ::RegOpenKeyExW(aKey, subkey, 0, KEY_READ, &baseloc))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
DWORD index = 0;
|
||||
DWORD subkeylen = _MAX_PATH;
|
||||
FILETIME modTime;
|
||||
while (ERROR_SUCCESS == ::RegEnumKeyEx(baseloc, index++, subkey, &subkeylen,
|
||||
while (ERROR_SUCCESS == ::RegEnumKeyExW(baseloc, index++, subkey, &subkeylen,
|
||||
NULL, NULL, NULL, &modTime)) {
|
||||
subkeylen = _MAX_PATH;
|
||||
HKEY keyloc;
|
||||
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, subkey, 0, KEY_QUERY_VALUE,
|
||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, subkey, 0, KEY_QUERY_VALUE,
|
||||
&keyloc)) {
|
||||
DWORD type;
|
||||
char path[_MAX_PATH];
|
||||
wchar_t path[_MAX_PATH];
|
||||
DWORD pathlen = sizeof(path);
|
||||
|
||||
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "Path", NULL, &type,
|
||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"Path", NULL, &type,
|
||||
(LPBYTE)&path, &pathlen)) {
|
||||
nsCOMPtr<nsILocalFile> localFile;
|
||||
if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(path),
|
||||
PR_TRUE,
|
||||
getter_AddRefs(localFile))) &&
|
||||
if (NS_SUCCEEDED(NS_NewLocalFile(nsDependentString(path),
|
||||
PR_TRUE,
|
||||
getter_AddRefs(localFile))) &&
|
||||
localFile) {
|
||||
// Some vendors use a path directly to the DLL so chop off
|
||||
// the filename
|
||||
|
|
|
@ -4017,18 +4017,18 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType,
|
|||
#ifdef XP_WIN
|
||||
static BOOL firstJavaPlugin = FALSE;
|
||||
BOOL restoreOrigDir = FALSE;
|
||||
char origDir[_MAX_PATH];
|
||||
PRUnichar origDir[_MAX_PATH];
|
||||
if (isJavaPlugin && !firstJavaPlugin) {
|
||||
DWORD dw = ::GetCurrentDirectory(_MAX_PATH, origDir);
|
||||
DWORD dw = ::GetCurrentDirectoryW(_MAX_PATH, origDir);
|
||||
NS_ASSERTION(dw <= _MAX_PATH, "Falied to obtain the current directory, which may leads to incorrect class laoding");
|
||||
nsCOMPtr<nsIFile> binDirectory;
|
||||
result = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR,
|
||||
getter_AddRefs(binDirectory));
|
||||
|
||||
if (NS_SUCCEEDED(result)) {
|
||||
nsCAutoString path;
|
||||
binDirectory->GetNativePath(path);
|
||||
restoreOrigDir = ::SetCurrentDirectory(path.get());
|
||||
nsAutoString path;
|
||||
binDirectory->GetPath(path);
|
||||
restoreOrigDir = ::SetCurrentDirectoryW(path.get());
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -4036,7 +4036,7 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType,
|
|||
|
||||
#ifdef XP_WIN
|
||||
if (!firstJavaPlugin && restoreOrigDir) {
|
||||
BOOL bCheck = ::SetCurrentDirectory(origDir);
|
||||
BOOL bCheck = ::SetCurrentDirectoryW(origDir);
|
||||
NS_ASSERTION(bCheck, " Error restoring driectoy");
|
||||
firstJavaPlugin = TRUE;
|
||||
}
|
||||
|
|
|
@ -62,7 +62,7 @@
|
|||
|
||||
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); // needed for NS_TRY_SAFE_CALL
|
||||
|
||||
#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION "MozillaPluginWindowPropertyAssociation"
|
||||
#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION L"MozillaPluginWindowPropertyAssociation"
|
||||
|
||||
typedef nsTWeakRef<class nsPluginNativeWindowWin> PluginWindowWeakRef;
|
||||
|
||||
|
@ -203,7 +203,7 @@ NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run()
|
|||
*/
|
||||
static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||
nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||
if (!win)
|
||||
return TRUE;
|
||||
|
||||
|
@ -526,10 +526,10 @@ nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow()
|
|||
if (!mPluginWinProc)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||
nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||
NS_ASSERTION(!win || (win == this), "plugin window already has property and this is not us");
|
||||
|
||||
if (!::SetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (HANDLE)this))
|
||||
if (!::SetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (HANDLE)this))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
return NS_OK;
|
||||
|
@ -543,7 +543,7 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()
|
|||
// remove window property
|
||||
HWND hWnd = (HWND)window;
|
||||
if (IsWindow(hWnd))
|
||||
::RemoveProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||
::RemovePropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||
|
||||
// restore the original win proc
|
||||
// but only do this if this were us last time
|
||||
|
|
|
@ -58,25 +58,18 @@
|
|||
|
||||
/* Local helper functions */
|
||||
|
||||
static char* GetKeyValue(char* verbuf, char* key)
|
||||
static char* GetKeyValue(wchar_t* verbuf, wchar_t* key)
|
||||
{
|
||||
char *buf = NULL;
|
||||
wchar_t *buf = NULL;
|
||||
UINT blen;
|
||||
|
||||
::VerQueryValue(verbuf,
|
||||
TEXT(key),
|
||||
::VerQueryValueW(verbuf,
|
||||
key,
|
||||
(void **)&buf, &blen);
|
||||
|
||||
if(buf != NULL)
|
||||
{
|
||||
#ifdef WINCE
|
||||
// On windows CE, the verbuf is wide and the shunt
|
||||
// layer can't do much about it. So, here we
|
||||
// convert the wide string.
|
||||
return PL_strdup(NS_ConvertUTF16toUTF8((PRUnichar*)buf).get());
|
||||
#else
|
||||
return PL_strdup(buf);
|
||||
#endif
|
||||
return strdup(NS_ConvertUTF16toUTF8(buf).get());
|
||||
}
|
||||
|
||||
return nsnull;
|
||||
|
@ -216,35 +209,35 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
|
|||
if (!mPlugin)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCAutoString temp;
|
||||
mPlugin->GetNativePath(temp);
|
||||
nsAutoString temp;
|
||||
mPlugin->GetPath(temp);
|
||||
|
||||
char* index;
|
||||
char* pluginFolderPath = PL_strdup(temp.get());
|
||||
PRUnichar* index;
|
||||
PRUnichar* pluginFolderPath = _wcsdup(temp.get());
|
||||
|
||||
index = PL_strrchr(pluginFolderPath, '\\');
|
||||
index = wcsrchr(pluginFolderPath, '\\');
|
||||
*index = 0;
|
||||
|
||||
BOOL restoreOrigDir = FALSE;
|
||||
char aOrigDir[MAX_PATH + 1];
|
||||
DWORD dwCheck = ::GetCurrentDirectory(sizeof(aOrigDir), aOrigDir);
|
||||
PRUnichar aOrigDir[MAX_PATH + 1];
|
||||
DWORD dwCheck = ::GetCurrentDirectoryW(sizeof(aOrigDir), aOrigDir);
|
||||
NS_ASSERTION(dwCheck <= MAX_PATH + 1, "Error in Loading plugin");
|
||||
|
||||
if (dwCheck <= MAX_PATH + 1)
|
||||
{
|
||||
restoreOrigDir = ::SetCurrentDirectory(pluginFolderPath);
|
||||
restoreOrigDir = ::SetCurrentDirectoryW(pluginFolderPath);
|
||||
NS_ASSERTION(restoreOrigDir, "Error in Loading plugin");
|
||||
}
|
||||
|
||||
outLibrary = PR_LoadLibrary(temp.get());
|
||||
outLibrary = PR_LoadLibrary(NS_ConvertUTF16toUTF8(temp).get());
|
||||
|
||||
if (restoreOrigDir)
|
||||
{
|
||||
BOOL bCheck = ::SetCurrentDirectory(aOrigDir);
|
||||
BOOL bCheck = ::SetCurrentDirectoryW(aOrigDir);
|
||||
NS_ASSERTION(bCheck, "Error in Loading plugin");
|
||||
}
|
||||
|
||||
PL_strfree(pluginFolderPath);
|
||||
free(pluginFolderPath);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -256,37 +249,39 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
|||
{
|
||||
nsresult res = NS_OK;
|
||||
DWORD zerome, versionsize;
|
||||
char* verbuf = nsnull;
|
||||
PRUnichar* verbuf = nsnull;
|
||||
|
||||
const char* path;
|
||||
const PRUnichar* path;
|
||||
|
||||
if (!mPlugin)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsCAutoString temp;
|
||||
mPlugin->GetNativePath(temp);
|
||||
nsAutoString temp;
|
||||
mPlugin->GetPath(temp);
|
||||
path = temp.get();
|
||||
|
||||
versionsize = ::GetFileVersionInfoSize((char*)path, &zerome);
|
||||
versionsize = ::GetFileVersionInfoSizeW(path, &zerome);
|
||||
if (versionsize > 0)
|
||||
verbuf = (char *)PR_Malloc(versionsize);
|
||||
verbuf = (wchar_t *)PR_Malloc(versionsize);
|
||||
if(!verbuf)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
if(::GetFileVersionInfo((char*)path, NULL, versionsize, verbuf))
|
||||
if(::GetFileVersionInfoW(path, NULL, versionsize, verbuf))
|
||||
{
|
||||
info.fName = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\ProductName");
|
||||
info.fDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileDescription");
|
||||
info.fName = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\ProductName");
|
||||
info.fDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileDescription");
|
||||
|
||||
char *mimeType = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\MIMEType");
|
||||
char *mimeDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileOpenName");
|
||||
char *extensions = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileExtents");
|
||||
char *mimeType = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\MIMEType");
|
||||
char *mimeDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileOpenName");
|
||||
char *extensions = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileExtents");
|
||||
|
||||
info.fVariantCount = CalculateVariantCount(mimeType);
|
||||
info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType);
|
||||
info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription);
|
||||
info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions);
|
||||
info.fFileName = PL_strdup(path);
|
||||
|
||||
// fFileName is narrow. fix?
|
||||
info.fFileName = PL_strdup(NS_ConvertUTF16toUTF8(path).get());
|
||||
|
||||
PL_strfree(mimeType);
|
||||
PL_strfree(mimeDescription);
|
||||
|
|
|
@ -79,17 +79,18 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
|
|||
|
||||
pPlugin->m_hWndDialog = hWnd;
|
||||
|
||||
char szString[512];
|
||||
LoadString(hInst, IDS_TITLE, szString, sizeof(szString));
|
||||
SetWindowText(hWnd, szString);
|
||||
wchar_t szString[512];
|
||||
LoadStringW(hInst, IDS_TITLE, szString, sizeof(szString));
|
||||
SetWindowTextW(hWnd, szString);
|
||||
|
||||
LoadString(hInst, IDS_INFO, szString, sizeof(szString));
|
||||
SetDlgItemText(hWnd, IDC_STATIC_INFO, szString);
|
||||
LoadStringW(hInst, IDS_INFO, szString, sizeof(szString));
|
||||
SetDlgItemTextW(hWnd, IDC_STATIC_INFO, szString);
|
||||
|
||||
SetDlgItemText(hWnd, IDC_STATIC_INFOTYPE, (LPSTR)pPlugin->m_pNPMIMEType);
|
||||
// convert m_pNPMIMEType dougt
|
||||
SetDlgItemTextA(hWnd, IDC_STATIC_INFOTYPE, pPlugin->m_pNPMIMEType);
|
||||
|
||||
LoadString(hInst, IDS_LOCATION, szString, sizeof(szString));
|
||||
SetDlgItemText(hWnd, IDC_STATIC_LOCATION, szString);
|
||||
LoadStringW(hInst, IDS_LOCATION, szString, sizeof(szString));
|
||||
SetDlgItemTextW(hWnd, IDC_STATIC_LOCATION, szString);
|
||||
|
||||
char contentTypeIsJava = 0;
|
||||
|
||||
|
@ -99,30 +100,36 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
|
|||
}
|
||||
|
||||
if(pPlugin->m_szPageURL == NULL || contentTypeIsJava)
|
||||
LoadString(hInst, IDS_FINDER_PAGE, szString, sizeof(szString));
|
||||
LoadStringW(hInst, IDS_FINDER_PAGE, szString, sizeof(szString));
|
||||
else
|
||||
strncpy(szString, pPlugin->m_szPageURL,511); // defect #362738
|
||||
|
||||
{
|
||||
MultiByteToWideChar( CP_ACP, 0,
|
||||
pPlugin->m_szPageURL,
|
||||
strlen(pPlugin->m_szPageURL)+1,
|
||||
szString,
|
||||
511 ); // defect #362738
|
||||
}
|
||||
|
||||
SetDlgItemTextWrapped(hWnd, IDC_STATIC_URL, szString);
|
||||
|
||||
LoadString(hInst, IDS_QUESTION, szString, sizeof(szString));
|
||||
SetDlgItemText(hWnd, IDC_STATIC_QUESTION, szString);
|
||||
LoadStringW(hInst, IDS_QUESTION, szString, sizeof(szString));
|
||||
SetDlgItemTextW(hWnd, IDC_STATIC_QUESTION, szString);
|
||||
|
||||
SetDlgItemText(hWnd, IDC_STATIC_WARNING, "");
|
||||
SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, L"");
|
||||
|
||||
if(!pPlugin->m_bOnline)
|
||||
{
|
||||
EnableWindow(GetDlgItem(hWnd, IDC_GET_PLUGIN), FALSE);
|
||||
LoadString(hInst, IDS_WARNING_OFFLINE, szString, sizeof(szString));
|
||||
SetDlgItemText(hWnd, IDC_STATIC_WARNING, szString);
|
||||
SetDlgItemText(hWnd, IDC_STATIC_QUESTION, "");
|
||||
LoadStringW(hInst, IDS_WARNING_OFFLINE, szString, sizeof(szString));
|
||||
SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, szString);
|
||||
SetDlgItemTextW(hWnd, IDC_STATIC_QUESTION, L"");
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if((!pPlugin->m_bJava) || (!pPlugin->m_bJavaScript) || (!pPlugin->m_bSmartUpdate))
|
||||
{
|
||||
LoadString(hInst, IDS_WARNING_JS, szString, sizeof(szString));
|
||||
SetDlgItemText(hWnd, IDC_STATIC_WARNING, szString);
|
||||
LoadStringW(hInst, IDS_WARNING_JS, szString, sizeof(szString));
|
||||
SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, szString);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,18 +86,18 @@ NPError NP_LOADDS NPP_New(NPMIMEType pluginType,
|
|||
|
||||
for(int i = 0; i < argc; i++)
|
||||
{
|
||||
if(lstrcmpi(argn[i],"pluginspage") == 0 && argv[i] != NULL)
|
||||
if(strcmpi(argn[i],"pluginspage") == 0 && argv[i] != NULL)
|
||||
szPageURL = (char *)argv[i];
|
||||
else if(lstrcmpi(argn[i],"codebase") == 0 && argv[i] != NULL)
|
||||
else if(strcmpi(argn[i],"codebase") == 0 && argv[i] != NULL)
|
||||
szPageURL = (char *)argv[i];
|
||||
else if(lstrcmpi(argn[i],"pluginurl") == 0 && argv[i] != NULL)
|
||||
else if(strcmpi(argn[i],"pluginurl") == 0 && argv[i] != NULL)
|
||||
szFileURL = (char *)argv[i];
|
||||
else if(lstrcmpi(argn[i],"classid") == 0 && argv[i] != NULL)
|
||||
else if(strcmpi(argn[i],"classid") == 0 && argv[i] != NULL)
|
||||
szFileURL = (char *)argv[i];
|
||||
else if(lstrcmpi(argn[i],"SRC") == 0 && argv[i] != NULL)
|
||||
else if(strcmpi(argn[i],"SRC") == 0 && argv[i] != NULL)
|
||||
buf = (char *)argv[i];
|
||||
else if(lstrcmpi(argn[i],"HIDDEN") == 0 && argv[i] != NULL)
|
||||
bHidden = (lstrcmp((char *)argv[i], "TRUE") == 0);
|
||||
else if(strcmpi(argn[i],"HIDDEN") == 0 && argv[i] != NULL)
|
||||
bHidden = (strcmp((char *)argv[i], "TRUE") == 0);
|
||||
}
|
||||
|
||||
/* some post-processing on the filename to attempt to extract the extension: */
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
nsIServiceManager * gServiceManager = NULL;
|
||||
|
||||
static char szNullPluginWindowClassName[] = CLASS_NULL_PLUGIN;
|
||||
static wchar_t szNullPluginWindowClassName[] = CLASS_NULL_PLUGIN;
|
||||
|
||||
static LRESULT CALLBACK NP_LOADDS PluginWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||
|
||||
|
@ -66,7 +66,7 @@ BOOL RegisterNullPluginWindowClass()
|
|||
{
|
||||
assert(hInst != NULL);
|
||||
|
||||
WNDCLASS wc;
|
||||
WNDCLASSW wc;
|
||||
|
||||
memset(&wc, 0, sizeof(wc));
|
||||
|
||||
|
@ -78,14 +78,14 @@ BOOL RegisterNullPluginWindowClass()
|
|||
wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1);
|
||||
wc.lpszClassName = szNullPluginWindowClassName;
|
||||
|
||||
ATOM aRet = RegisterClass(&wc);
|
||||
ATOM aRet = RegisterClassW(&wc);
|
||||
return (aRet != NULL);
|
||||
}
|
||||
|
||||
void UnregisterNullPluginWindowClass()
|
||||
{
|
||||
assert(hInst != NULL);
|
||||
UnregisterClass(szNullPluginWindowClassName, hInst);
|
||||
UnregisterClassW(szNullPluginWindowClassName, hInst);
|
||||
}
|
||||
|
||||
/*********************************************/
|
||||
|
@ -129,41 +129,41 @@ CPlugin::CPlugin(HINSTANCE hInst,
|
|||
|
||||
if(pluginType && *pluginType)
|
||||
{
|
||||
m_pNPMIMEType = (NPMIMEType)new char[lstrlen((LPSTR)pluginType) + 1];
|
||||
m_pNPMIMEType = (NPMIMEType) new char[strlen(pluginType) + 1];
|
||||
if(m_pNPMIMEType != NULL)
|
||||
lstrcpy((LPSTR)m_pNPMIMEType, pluginType);
|
||||
strcpy(m_pNPMIMEType, pluginType);
|
||||
}
|
||||
|
||||
if(szPageURL && *szPageURL)
|
||||
{
|
||||
m_szPageURL = new char[lstrlen(szPageURL) + 1];
|
||||
m_szPageURL = new char[strlen(szPageURL) + 1];
|
||||
if(m_szPageURL != NULL)
|
||||
lstrcpy(m_szPageURL, szPageURL);
|
||||
strcpy(m_szPageURL, szPageURL);
|
||||
}
|
||||
|
||||
if(szFileURL && *szFileURL)
|
||||
{
|
||||
m_szFileURL = new char[lstrlen(szFileURL) + 1];
|
||||
m_szFileURL = new char[strlen(szFileURL) + 1];
|
||||
if(m_szFileURL != NULL)
|
||||
lstrcpy(m_szFileURL, szFileURL);
|
||||
strcpy(m_szFileURL, szFileURL);
|
||||
}
|
||||
|
||||
if(szFileExtension && *szFileExtension)
|
||||
{
|
||||
m_szFileExtension = new char[lstrlen(szFileExtension) + 1];
|
||||
m_szFileExtension = new char[strlen(szFileExtension) + 1];
|
||||
if(m_szFileExtension != NULL)
|
||||
lstrcpy(m_szFileExtension, szFileExtension);
|
||||
strcpy(m_szFileExtension, szFileExtension);
|
||||
}
|
||||
|
||||
m_hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_PLUGICON));
|
||||
|
||||
char szString[1024] = {'\0'};
|
||||
LoadString(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString));
|
||||
wchar_t szString[1024] = {'\0'};
|
||||
LoadStringW(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString));
|
||||
if(*szString)
|
||||
{
|
||||
m_szCommandMessage = new char[lstrlen(szString) + 1];
|
||||
m_szCommandMessage = new wchar_t[wcslen(szString) + 1];
|
||||
if(m_szCommandMessage != NULL)
|
||||
lstrcpy(m_szCommandMessage, szString);
|
||||
wcscpy(m_szCommandMessage, szString);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -253,8 +253,8 @@ BOOL CPlugin::init(HWND hWndParent)
|
|||
RECT rcParent;
|
||||
GetClientRect(m_hWndParent, &rcParent);
|
||||
|
||||
CreateWindow(szNullPluginWindowClassName,
|
||||
"NULL Plugin",
|
||||
CreateWindowW(szNullPluginWindowClassName,
|
||||
L"NULL Plugin",
|
||||
WS_CHILD,
|
||||
0,0, rcParent.right, rcParent.bottom,
|
||||
m_hWndParent,
|
||||
|
@ -332,10 +332,10 @@ LPSTR CPlugin::createURLString()
|
|||
// check if there is file URL first
|
||||
if(!m_bSmartUpdate && m_szFileURL != NULL)
|
||||
{
|
||||
m_szURLString = new char[lstrlen(m_szFileURL) + 1];
|
||||
m_szURLString = new char[strlen(m_szFileURL) + 1];
|
||||
if(m_szURLString == NULL)
|
||||
return NULL;
|
||||
lstrcpy(m_szURLString, m_szFileURL);
|
||||
strcpy(m_szURLString, m_szFileURL);
|
||||
return m_szURLString;
|
||||
}
|
||||
|
||||
|
@ -351,18 +351,18 @@ LPSTR CPlugin::createURLString()
|
|||
|
||||
if(!m_bSmartUpdate && m_szPageURL != NULL && !contentTypeIsJava)
|
||||
{
|
||||
szAddress = new char[lstrlen(m_szPageURL) + 1];
|
||||
szAddress = new char[strlen(m_szPageURL) + 1];
|
||||
if(szAddress == NULL)
|
||||
return NULL;
|
||||
lstrcpy(szAddress, m_szPageURL);
|
||||
strcpy(szAddress, m_szPageURL);
|
||||
|
||||
m_szURLString = new char[lstrlen(szAddress) + 1 + lstrlen((LPSTR)m_pNPMIMEType) + 1];
|
||||
m_szURLString = new char[strlen(szAddress) + 1 + strlen(m_pNPMIMEType) + 1];
|
||||
|
||||
if(m_szURLString == NULL)
|
||||
return NULL;
|
||||
|
||||
// Append the MIME type to the URL
|
||||
wsprintf(m_szURLString, "%s?%s", szAddress, (LPSTR)m_pNPMIMEType);
|
||||
sprintf(m_szURLString, "%s?%s", szAddress, (LPSTR)m_pNPMIMEType);
|
||||
}
|
||||
else // default
|
||||
{
|
||||
|
@ -374,20 +374,20 @@ LPSTR CPlugin::createURLString()
|
|||
urlToOpen = szPageUrlForJVM;
|
||||
}
|
||||
|
||||
szAddress = new char[lstrlen(urlToOpen) + 1];
|
||||
szAddress = new char[strlen(urlToOpen) + 1];
|
||||
if(szAddress == NULL)
|
||||
return NULL;
|
||||
lstrcpy(szAddress, urlToOpen);
|
||||
strcpy(szAddress, urlToOpen);
|
||||
|
||||
m_szURLString = new char[lstrlen(szAddress) + 10 +
|
||||
lstrlen((LPSTR)m_pNPMIMEType) + 1];
|
||||
m_szURLString = new char[strlen(szAddress) + 10 +
|
||||
strlen(m_pNPMIMEType) + 1];
|
||||
|
||||
if(m_szURLString == NULL)
|
||||
return NULL;
|
||||
|
||||
// Append the MIME type to the URL
|
||||
wsprintf(m_szURLString, "%s?mimetype=%s",
|
||||
szAddress, (LPSTR)m_pNPMIMEType);
|
||||
sprintf(m_szURLString, "%s?mimetype=%s",
|
||||
szAddress, m_pNPMIMEType);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -409,14 +409,15 @@ LPSTR CPlugin::createURLString()
|
|||
m_szFileURL[0] = '\0';
|
||||
}
|
||||
|
||||
m_szURLString = new char[lstrlen(szPluginFinderCommandBeginning) + lstrlen(urlToOpen) + 10 +
|
||||
lstrlen((LPSTR)m_pNPMIMEType) + 13 +
|
||||
lstrlen((LPSTR)m_szPageURL) + 11 +
|
||||
lstrlen((LPSTR)m_szFileURL) +
|
||||
lstrlen(szPluginFinderCommandEnd) + 1];
|
||||
wsprintf(m_szURLString, "%s%s?mimetype=%s&pluginspage=%s&pluginurl=%s%s",
|
||||
szPluginFinderCommandBeginning, urlToOpen,
|
||||
(LPSTR)m_pNPMIMEType, m_szPageURL, m_szFileURL, szPluginFinderCommandEnd);
|
||||
m_szURLString = new char[strlen(szPluginFinderCommandBeginning) + strlen(urlToOpen) + 10 +
|
||||
strlen((LPSTR)m_pNPMIMEType) + 13 +
|
||||
strlen((LPSTR)m_szPageURL) + 11 +
|
||||
strlen((LPSTR)m_szFileURL) +
|
||||
strlen(szPluginFinderCommandEnd) + 1];
|
||||
sprintf(m_szURLString, "%s%s?mimetype=%s&pluginspage=%s&pluginurl=%s%s",
|
||||
szPluginFinderCommandBeginning, urlToOpen,
|
||||
m_pNPMIMEType, m_szPageURL, m_szFileURL,
|
||||
szPluginFinderCommandEnd);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -512,13 +513,13 @@ void CPlugin::getPlugin()
|
|||
m_szCommandMessage = NULL;
|
||||
}
|
||||
|
||||
char szString[1024] = {'\0'};
|
||||
LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
|
||||
wchar_t szString[1024] = {'\0'};
|
||||
LoadStringW(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
|
||||
if(*szString)
|
||||
{
|
||||
m_szCommandMessage = new char[lstrlen(szString) + 1];
|
||||
m_szCommandMessage = new wchar_t[wcslen(szString) + 1];
|
||||
if(m_szCommandMessage != NULL)
|
||||
lstrcpy(m_szCommandMessage, szString);
|
||||
wcscpy(m_szCommandMessage, szString);
|
||||
}
|
||||
|
||||
InvalidateRect(m_hWnd, NULL, TRUE);
|
||||
|
@ -548,20 +549,20 @@ void CPlugin::URLNotify(const char * szURL)
|
|||
dbgOut2("CPlugin::URLNotify(), URL '%s'", szURL);
|
||||
|
||||
NPStream * pStream = NULL;
|
||||
char buf[256];
|
||||
wchar_t buf[256];
|
||||
|
||||
assert(m_hInst != NULL);
|
||||
assert(m_pNPInstance != NULL);
|
||||
|
||||
int iSize = LoadString(m_hInst, IDS_GOING2HTML, buf, sizeof(buf));
|
||||
int iSize = LoadStringW(m_hInst, IDS_GOING2HTML, buf, sizeof(buf));
|
||||
|
||||
NPError rc = NPN_NewStream(m_pNPInstance, "text/html", "asd_plugin_finder", &pStream);
|
||||
if (rc != NPERR_NO_ERROR)
|
||||
return;
|
||||
|
||||
//char buf[] = "<html>\n<body>\n\n<h2 align=center>NPN_NewStream / NPN_Write - This seems to work.</h2>\n\n</body>\n</html>";
|
||||
//wchar_t buf[] = L"<html>\n<body>\n\n<h2 align=center>NPN_NewStream / NPN_Write - This seems to work.</h2>\n\n</body>\n</html>";
|
||||
|
||||
NPN_Write(m_pNPInstance, pStream, iSize, buf);
|
||||
NPN_Write(m_pNPInstance, pStream, iSize, buf); // buf is unicode now.
|
||||
|
||||
NPN_DestroyStream(m_pNPInstance, pStream, NPRES_DONE);
|
||||
}
|
||||
|
@ -594,12 +595,12 @@ NPError CPlugin::destroyStream(NPStream *stream, NPError reason)
|
|||
|
||||
BOOL CPlugin::readyToRefresh()
|
||||
{
|
||||
char szString[1024] = {'\0'};
|
||||
LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
|
||||
wchar_t szString[1024] = {'\0'};
|
||||
LoadStringW(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
|
||||
if(m_szCommandMessage == NULL)
|
||||
return FALSE;
|
||||
|
||||
return (lstrcmp(m_szCommandMessage, szString) == 0);
|
||||
return (wcscmp(m_szCommandMessage, szString) == 0);
|
||||
}
|
||||
|
||||
//***************************
|
||||
|
@ -626,7 +627,7 @@ void CPlugin::onRButtonUp(HWND hWnd, int x, int y, UINT keyFlags)
|
|||
NPN_GetURL(m_pNPInstance, "javascript:navigator.plugins.refresh(true)", "_self");
|
||||
}
|
||||
|
||||
static void DrawCommandMessage(HDC hDC, LPSTR szString, LPRECT lprc)
|
||||
static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc)
|
||||
{
|
||||
if(szString == NULL)
|
||||
return;
|
||||
|
@ -637,7 +638,7 @@ static void DrawCommandMessage(HDC hDC, LPSTR szString, LPRECT lprc)
|
|||
|
||||
HFONT hFontOld = SelectFont(hDC, hFont);
|
||||
SIZE sz;
|
||||
GetTextExtentPoint32(hDC, szString, lstrlen(szString), &sz);
|
||||
GetTextExtentPoint32W(hDC, szString, wcslen(szString), &sz);
|
||||
POINT pt;
|
||||
pt.x = sz.cx;
|
||||
pt.y = sz.cy;
|
||||
|
@ -659,7 +660,7 @@ static void DrawCommandMessage(HDC hDC, LPSTR szString, LPRECT lprc)
|
|||
|
||||
int iModeOld = SetBkMode(hDC, TRANSPARENT);
|
||||
COLORREF crColorOld = SetTextColor(hDC, RGB(0,0,0));
|
||||
DrawText(hDC, szString, lstrlen(szString), &rcText, DT_CENTER|DT_VCENTER);
|
||||
DrawTextW(hDC, szString, wcslen(szString), &rcText, DT_CENTER|DT_VCENTER);
|
||||
SetTextColor(hDC, crColorOld);
|
||||
SetBkMode(hDC, iModeOld);
|
||||
SelectFont(hDC, hFontOld);
|
||||
|
|
|
@ -51,7 +51,7 @@ private:
|
|||
HICON m_hIcon;
|
||||
char* m_szURLString;
|
||||
|
||||
char* m_szCommandMessage;
|
||||
wchar_t* m_szCommandMessage;
|
||||
BOOL m_bWaitingStreamFromPFS;
|
||||
NPStream* m_PFSStream;
|
||||
|
||||
|
@ -118,7 +118,7 @@ public:
|
|||
#define JVM_SMARTUPDATE_URL "http://java.com/download"
|
||||
|
||||
#ifdef WIN32
|
||||
#define REGISTRY_PLACE "Software\\Netscape\\Netscape Navigator\\Default Plugin"
|
||||
#define REGISTRY_PLACE L"Software\\Netscape\\Netscape Navigator\\Default Plugin"
|
||||
#else
|
||||
#define GWL_USERDATA 0
|
||||
#define COLOR_3DSHADOW COLOR_BTNFACE
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
#define COLOR_3DDKSHADOW COLOR_BTNSHADOW
|
||||
#endif
|
||||
|
||||
#define CLASS_NULL_PLUGIN "NullPluginClass"
|
||||
#define CLASS_NULL_PLUGIN L"NullPluginClass"
|
||||
|
||||
BOOL RegisterNullPluginWindowClass();
|
||||
void UnregisterNullPluginWindowClass();
|
||||
|
|
|
@ -45,8 +45,8 @@ HKEY openRegistry()
|
|||
{
|
||||
HKEY phkResult;
|
||||
|
||||
if(RegCreateKey(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS)
|
||||
MessageBox(0, "Error creating Default Plugin registry key", "Default Plugin", MB_OK);
|
||||
if(RegCreateKeyW(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS)
|
||||
MessageBoxW(0, L"Error creating Default Plugin registry key", L"Default Plugin", MB_OK);
|
||||
|
||||
return phkResult;
|
||||
}
|
||||
|
@ -56,30 +56,37 @@ BOOL IsNewMimeType(LPSTR mime)
|
|||
{
|
||||
HKEY hkey = openRegistry();
|
||||
DWORD dwType, keysize = 512;
|
||||
char keybuf[512];
|
||||
wchar_t keybuf[512];
|
||||
wchar_t wideMime[64];
|
||||
|
||||
if(RegQueryValueEx(hkey, mime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS)
|
||||
MultiByteToWideChar(CP_ACP, 0,
|
||||
mime,
|
||||
strlen(mime) + 1,
|
||||
wideMime,
|
||||
64);
|
||||
|
||||
if(RegQueryValueExW(hkey, wideMime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS)
|
||||
{
|
||||
// key exists, must have already been here...
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(RegSetValueEx(hkey, mime, 0, REG_SZ, (LPBYTE) "(none)", 7) != ERROR_SUCCESS)
|
||||
MessageBox(0, "Error adding MIME type value", "Default Plugin", MB_OK);
|
||||
if(RegSetValueExW(hkey, wideMime, 0, REG_SZ, (LPBYTE) L"(none)", 7) != ERROR_SUCCESS)
|
||||
MessageBoxW(0, L"Error adding MIME type value", L"Default Plugin", MB_OK);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// string length in pixels for the specific window (selected font)
|
||||
static int getWindowStringLength(HWND hWnd, LPSTR lpsz)
|
||||
static int getWindowStringLength(HWND hWnd, wchar_t* lpsz)
|
||||
{
|
||||
SIZE sz;
|
||||
HDC hDC = GetDC(hWnd);
|
||||
HFONT hWindowFont = GetWindowFont(hWnd);
|
||||
HFONT hFontOld = SelectFont(hDC, hWindowFont);
|
||||
GetTextExtentPoint32(hDC, lpsz, lstrlen(lpsz), &sz);
|
||||
GetTextExtentPoint32W(hDC, lpsz, wcslen(lpsz), &sz);
|
||||
POINT pt;
|
||||
pt.x = sz.cx;
|
||||
pt.y = sz.cy;
|
||||
|
@ -89,20 +96,20 @@ static int getWindowStringLength(HWND hWnd, LPSTR lpsz)
|
|||
return (int)pt.x;
|
||||
}
|
||||
|
||||
/****************************************************************/
|
||||
/* */
|
||||
/* void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) */
|
||||
/* */
|
||||
/* helper to wrap long lines in a static control, which do not */
|
||||
/* wrap automatically if they do not have space characters */
|
||||
/* */
|
||||
/****************************************************************/
|
||||
void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText)
|
||||
/*******************************************************************/
|
||||
/* */
|
||||
/* void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) */
|
||||
/* */
|
||||
/* helper to wrap long lines in a static control, which do not */
|
||||
/* wrap automatically if they do not have space characters */
|
||||
/* */
|
||||
/*******************************************************************/
|
||||
void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
|
||||
{
|
||||
HWND hWndStatic = GetDlgItem(hWnd, iID);
|
||||
if((szText == NULL) || (lstrlen(szText) == 0))
|
||||
if((szText == NULL) || (wcslen(szText) == 0))
|
||||
{
|
||||
SetDlgItemText(hWnd, iID, "");
|
||||
SetDlgItemTextW(hWnd, iID, L"");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -114,7 +121,7 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText)
|
|||
|
||||
if(iStringLength <= iStaticLength)
|
||||
{
|
||||
SetDlgItemText(hWnd, iID, szText);
|
||||
SetDlgItemTextW(hWnd, iID, szText);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -122,19 +129,19 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText)
|
|||
if(iBreaks <= 0)
|
||||
return;
|
||||
|
||||
char * pBuf = new char[iStringLength + iBreaks + 1];
|
||||
wchar_t * pBuf = new wchar_t[iStringLength + iBreaks + 1];
|
||||
if(pBuf == NULL)
|
||||
return;
|
||||
|
||||
lstrcpy(pBuf, "");
|
||||
wcscpy(pBuf, L"");
|
||||
|
||||
int iStart = 0;
|
||||
int iLines = 0;
|
||||
for(int i = 0; i < iStringLength; i++)
|
||||
{
|
||||
char * sz = &szText[iStart];
|
||||
wchar_t* sz = &szText[iStart];
|
||||
int iIndex = i - iStart;
|
||||
char ch = sz[iIndex + 1];
|
||||
wchar_t ch = sz[iIndex + 1];
|
||||
|
||||
sz[iIndex + 1] = '\0';
|
||||
|
||||
|
@ -145,7 +152,7 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText)
|
|||
sz[iIndex + 1] = ch;
|
||||
if(iLines == iBreaks)
|
||||
{
|
||||
lstrcat(pBuf, sz);
|
||||
wcscat(pBuf, sz);
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
|
@ -157,15 +164,15 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText)
|
|||
ch = sz[iIndex];
|
||||
sz[iIndex] = '\0'; // terminate string one char shorter
|
||||
|
||||
lstrcat(pBuf, sz); // append the string
|
||||
lstrcat(pBuf, " "); // append space character for successful wrapping
|
||||
wcscat(pBuf, sz); // append the string
|
||||
wcscat(pBuf, L" "); // append space character for successful wrapping
|
||||
|
||||
iStart += lstrlen(sz);// shift new start position
|
||||
iStart += wcslen(sz); // shift new start position
|
||||
sz[iIndex] = ch; // restore zeroed element
|
||||
iLines++; // count lines
|
||||
}
|
||||
|
||||
SetDlgItemText(hWnd, iID, pBuf);
|
||||
SetDlgItemTextW(hWnd, iID, pBuf);
|
||||
|
||||
delete [] pBuf;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,6 @@
|
|||
|
||||
HKEY openRegistry();
|
||||
BOOL IsNewMimeType(LPSTR szMimeType);
|
||||
void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText);
|
||||
void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText);
|
||||
|
||||
#endif // __UTILS_H__
|
||||
|
|
|
@ -146,11 +146,11 @@ static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
|
|||
nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA);
|
||||
if (plugin) {
|
||||
const char * string = plugin->getVersion();
|
||||
DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
else {
|
||||
char string[] = "Error occured";
|
||||
DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
||||
EndPaint(hWnd, &ps);
|
||||
|
|
|
@ -220,10 +220,10 @@ static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
|
|||
// get our plugin instance object and ask it for the version string
|
||||
nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA);
|
||||
if (plugin)
|
||||
DrawText(hdc, plugin->mString, strlen(plugin->mString), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
DrawTextA(hdc, plugin->mString, strlen(plugin->mString), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
else {
|
||||
char string[] = "Error occured";
|
||||
DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||
}
|
||||
|
||||
EndPaint(hWnd, &ps);
|
||||
|
|
|
@ -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')))
|
||||
|
|
|
@ -58,14 +58,13 @@ nsUserInfo::GetUsername(char **aUsername)
|
|||
{
|
||||
*aUsername = nsnull;
|
||||
|
||||
TCHAR username[256];
|
||||
PRUnichar username[256];
|
||||
DWORD size = 256;
|
||||
|
||||
if (!GetUserName(username, &size))
|
||||
if (!GetUserNameW(username, &size))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
*aUsername = nsCRT::strdup(username);
|
||||
|
||||
|
||||
*aUsername = ToNewUTF8String(nsDependentString(username));
|
||||
if (*aUsername) return NS_OK;
|
||||
|
||||
return NS_ERROR_FAILURE;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -145,11 +145,11 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolSch
|
|||
if (aProtocolScheme && *aProtocolScheme)
|
||||
{
|
||||
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);
|
||||
|
|
|
@ -93,13 +93,13 @@ nsresult
|
|||
nsAppShell::Init()
|
||||
{
|
||||
if (!sMsgId)
|
||||
sMsgId = RegisterWindowMessage("nsAppShell:EventID");
|
||||
sMsgId = RegisterWindowMessageW(L"nsAppShell:EventID");
|
||||
|
||||
WNDCLASS wc;
|
||||
WNDCLASSW wc;
|
||||
HINSTANCE module = GetModuleHandle(NULL);
|
||||
|
||||
const char *const kWindowClass = "nsAppShell:EventWindowClass";
|
||||
if (!GetClassInfo(module, kWindowClass, &wc)) {
|
||||
const PRUnichar *const kWindowClass = L"nsAppShell:EventWindowClass";
|
||||
if (!GetClassInfoW(module, kWindowClass, &wc)) {
|
||||
wc.style = 0;
|
||||
wc.lpfnWndProc = EventWindowProc;
|
||||
wc.cbClsExtra = 0;
|
||||
|
@ -108,12 +108,12 @@ nsAppShell::Init()
|
|||
wc.hIcon = NULL;
|
||||
wc.hCursor = NULL;
|
||||
wc.hbrBackground = (HBRUSH) NULL;
|
||||
wc.lpszMenuName = (LPCSTR) NULL;
|
||||
wc.lpszMenuName = (LPCWSTR) NULL;
|
||||
wc.lpszClassName = kWindowClass;
|
||||
RegisterClass(&wc);
|
||||
RegisterClassW(&wc);
|
||||
}
|
||||
|
||||
mEventWnd = CreateWindow(kWindowClass, "nsAppShell:EventWindow",
|
||||
mEventWnd = CreateWindowW(kWindowClass, L"nsAppShell:EventWindow",
|
||||
0, 0, 0, 10, 10, NULL, NULL, module, NULL);
|
||||
NS_ENSURE_STATE(mEventWnd);
|
||||
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include <stdio.h>
|
||||
#include "nsBidiKeyboard.h"
|
||||
#include "prmem.h"
|
||||
#include <tchar.h>
|
||||
|
||||
NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard)
|
||||
|
||||
|
@ -63,8 +64,8 @@ NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel)
|
|||
return result;
|
||||
|
||||
// call LoadKeyboardLayout() only if the target keyboard layout is different from the current
|
||||
char currentLocaleName[KL_NAMELENGTH];
|
||||
strncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH);
|
||||
PRUnichar currentLocaleName[KL_NAMELENGTH];
|
||||
wcsncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH);
|
||||
currentLocaleName[KL_NAMELENGTH-1] = '\0'; // null terminate
|
||||
|
||||
NS_ASSERTION(*currentLocaleName,
|
||||
|
@ -96,26 +97,26 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL)
|
|||
currentLocale = ::GetKeyboardLayout(0);
|
||||
*aIsRTL = IsRTLLanguage(currentLocale);
|
||||
|
||||
if (!::GetKeyboardLayoutName(mCurrentLocaleName))
|
||||
if (!::GetKeyboardLayoutNameW(mCurrentLocaleName))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ASSERTION(*mCurrentLocaleName,
|
||||
"GetKeyboardLayoutName return string length == 0");
|
||||
NS_ASSERTION((strlen(mCurrentLocaleName) < KL_NAMELENGTH),
|
||||
NS_ASSERTION((wcslen(mCurrentLocaleName) < KL_NAMELENGTH),
|
||||
"GetKeyboardLayoutName return string length >= KL_NAMELENGTH");
|
||||
|
||||
// The language set by the user overrides the default language for that direction
|
||||
if (*aIsRTL) {
|
||||
strncpy(mRTLKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
|
||||
wcsncpy(mRTLKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
|
||||
mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
||||
} else {
|
||||
strncpy(mLTRKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
|
||||
wcsncpy(mLTRKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
|
||||
mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
||||
}
|
||||
|
||||
NS_ASSERTION((strlen(mRTLKeyboard) < KL_NAMELENGTH),
|
||||
NS_ASSERTION((wcslen(mRTLKeyboard) < KL_NAMELENGTH),
|
||||
"mLTRKeyboard has string length >= KL_NAMELENGTH");
|
||||
NS_ASSERTION((strlen(mLTRKeyboard) < KL_NAMELENGTH),
|
||||
NS_ASSERTION((wcslen(mLTRKeyboard) < KL_NAMELENGTH),
|
||||
"mRTLKeyboard has string length >= KL_NAMELENGTH");
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -132,7 +133,7 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
|
|||
int keyboards;
|
||||
HKL far* buf;
|
||||
HKL locale;
|
||||
char localeName[KL_NAMELENGTH];
|
||||
PRUnichar localeName[KL_NAMELENGTH];
|
||||
PRBool isLTRKeyboardSet = PR_FALSE;
|
||||
PRBool isRTLKeyboardSet = PR_FALSE;
|
||||
|
||||
|
@ -156,11 +157,11 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
|
|||
while (keyboards--) {
|
||||
locale = buf[keyboards];
|
||||
if (IsRTLLanguage(locale)) {
|
||||
sprintf(mRTLKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
|
||||
swprintf(mRTLKeyboard, L"%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
|
||||
isRTLKeyboardSet = PR_TRUE;
|
||||
}
|
||||
else {
|
||||
sprintf(mLTRKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
|
||||
swprintf( mLTRKeyboard, L"%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
|
||||
isLTRKeyboardSet = PR_TRUE;
|
||||
}
|
||||
}
|
||||
|
@ -178,20 +179,20 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
|
|||
// installed this prevents us from arbitrarily resetting the current
|
||||
// layout (bug 80274)
|
||||
locale = ::GetKeyboardLayout(0);
|
||||
if (!::GetKeyboardLayoutName(localeName))
|
||||
if (!::GetKeyboardLayoutNameW(localeName))
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
NS_ASSERTION(*localeName,
|
||||
"GetKeyboardLayoutName return string length == 0");
|
||||
NS_ASSERTION((strlen(localeName) < KL_NAMELENGTH),
|
||||
NS_ASSERTION((wcslen(localeName) < KL_NAMELENGTH),
|
||||
"GetKeyboardLayout return string length >= KL_NAMELENGTH");
|
||||
|
||||
if (IsRTLLanguage(locale)) {
|
||||
strncpy(mRTLKeyboard, localeName, KL_NAMELENGTH);
|
||||
swprintf(mRTLKeyboard, localeName, KL_NAMELENGTH);
|
||||
mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
||||
}
|
||||
else {
|
||||
strncpy(mLTRKeyboard, localeName, KL_NAMELENGTH);
|
||||
swprintf( mLTRKeyboard, localeName, KL_NAMELENGTH);
|
||||
mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
||||
}
|
||||
|
||||
|
|
|
@ -58,9 +58,9 @@ protected:
|
|||
|
||||
PRPackedBool mInitialized;
|
||||
PRPackedBool mHaveBidiKeyboards;
|
||||
char mLTRKeyboard[KL_NAMELENGTH];
|
||||
char mRTLKeyboard[KL_NAMELENGTH];
|
||||
char mCurrentLocaleName[KL_NAMELENGTH];
|
||||
PRUnichar mLTRKeyboard[KL_NAMELENGTH];
|
||||
PRUnichar mRTLKeyboard[KL_NAMELENGTH];
|
||||
PRUnichar mCurrentLocaleName[KL_NAMELENGTH];
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@
|
|||
|
||||
|
||||
// oddly, this isn't in the MSVC headers anywhere.
|
||||
UINT nsClipboard::CF_HTML = ::RegisterClipboardFormat("HTML Format");
|
||||
UINT nsClipboard::CF_HTML = ::RegisterClipboardFormatW(L"HTML Format");
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -111,7 +111,9 @@ UINT nsClipboard::GetFormat(const char* aMimeStr)
|
|||
else if (strcmp(aMimeStr, kNativeHTMLMime) == 0)
|
||||
format = CF_HTML;
|
||||
else
|
||||
format = ::RegisterClipboardFormat(aMimeStr);
|
||||
format = ::RegisterClipboardFormatW(NS_ConvertASCIItoUTF16(aMimeStr).get());
|
||||
|
||||
|
||||
|
||||
return format;
|
||||
}
|
||||
|
@ -316,7 +318,7 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, PRUint32 * aLe
|
|||
);
|
||||
|
||||
// Display the string.
|
||||
MessageBox( NULL, (const char *)lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION );
|
||||
MessageBoxW( NULL, (LPCWSTR)lpMsgBuf, L"GetLastError", MB_OK|MB_ICONINFORMATION );
|
||||
|
||||
// Free the buffer.
|
||||
LocalFree( lpMsgBuf );
|
||||
|
|
|
@ -82,10 +82,10 @@ IAsyncOperation : public IUnknown
|
|||
* See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/transferring/clipboard.asp
|
||||
*/
|
||||
#ifndef CFSTR_INETURLA
|
||||
#define CFSTR_INETURLA "UniformResourceLocator"
|
||||
#define CFSTR_INETURLA L"UniformResourceLocator"
|
||||
#endif
|
||||
#ifndef CFSTR_INETURLW
|
||||
#define CFSTR_INETURLW "UniformResourceLocatorW"
|
||||
#define CFSTR_INETURLW L"UniformResourceLocatorW"
|
||||
#endif
|
||||
|
||||
// For support of MinGW w32api v2.4.
|
||||
|
@ -93,10 +93,10 @@ IAsyncOperation : public IUnknown
|
|||
// http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/winsup/w32api/include/shlobj.h?cvsroot=src
|
||||
// then that can be made the base required version and this code should be removed.
|
||||
#ifndef CFSTR_FILEDESCRIPTORA
|
||||
# define CFSTR_FILEDESCRIPTORA "FileGroupDescriptor"
|
||||
# define CFSTR_FILEDESCRIPTORA L"FileGroupDescriptor"
|
||||
#endif
|
||||
#ifndef CFSTR_FILEDESCRIPTORW
|
||||
# define CFSTR_FILEDESCRIPTORW "FileGroupDescriptorW"
|
||||
# define CFSTR_FILEDESCRIPTORW L"FileGroupDescriptorW"
|
||||
#endif
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
|
|
@ -280,10 +280,10 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
|||
#ifndef WINCE
|
||||
}
|
||||
catch(...) {
|
||||
MessageBox(ofn.hwndOwner,
|
||||
0,
|
||||
"The filepicker was unexpectedly closed by Windows.",
|
||||
MB_ICONERROR);
|
||||
MessageBoxW(ofn.hwndOwner,
|
||||
0,
|
||||
L"The filepicker was unexpectedly closed by Windows.",
|
||||
MB_ICONERROR);
|
||||
result = PR_FALSE;
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -56,7 +56,7 @@ static CloseThemeDataPtr closeTheme = NULL;
|
|||
static GetThemeColorPtr getThemeColor = NULL;
|
||||
static IsAppThemedPtr isAppThemed = NULL;
|
||||
|
||||
static const char kThemeLibraryName[] = "uxtheme.dll";
|
||||
static const PRUnichar kThemeLibraryName[] = L"uxtheme.dll";
|
||||
static HINSTANCE gThemeDLLInst = NULL;
|
||||
static HANDLE gMenuTheme = NULL;
|
||||
|
||||
|
@ -105,13 +105,13 @@ static PRInt32 GetSystemParam(long flag, PRInt32 def)
|
|||
nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
|
||||
{
|
||||
#ifndef WINCE
|
||||
gShell32DLLInst = LoadLibrary("Shell32.dll");
|
||||
gShell32DLLInst = LoadLibraryW(L"Shell32.dll");
|
||||
if (gShell32DLLInst)
|
||||
{
|
||||
gSHAppBarMessage = (SHAppBarMessagePtr) GetProcAddress(gShell32DLLInst,
|
||||
"SHAppBarMessage");
|
||||
}
|
||||
gThemeDLLInst = LoadLibrary(kThemeLibraryName);
|
||||
gThemeDLLInst = LoadLibraryW(kThemeLibraryName);
|
||||
if(gThemeDLLInst)
|
||||
{
|
||||
openTheme = (OpenThemeDataPtr)GetProcAddress(gThemeDLLInst, "OpenThemeData");
|
||||
|
@ -504,7 +504,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
|||
if (gSHAppBarMessage)
|
||||
{
|
||||
// Get task bar window handle
|
||||
HWND shellWindow = FindWindow("Shell_TrayWnd", NULL);
|
||||
HWND shellWindow = FindWindowW(L"Shell_TrayWnd", NULL);
|
||||
|
||||
if (shellWindow != NULL)
|
||||
{
|
||||
|
|
|
@ -279,7 +279,7 @@ static GetThemeSysFontPtr getThemeSysFont = NULL;
|
|||
static GetThemeColorPtr getThemeColor = NULL;
|
||||
static GetThemeMarginsPtr getThemeMargins = NULL;
|
||||
|
||||
static const char kThemeLibraryName[] = "uxtheme.dll";
|
||||
static const PRUnichar kThemeLibraryName[] = L"uxtheme.dll";
|
||||
|
||||
static inline bool IsCheckboxWidgetType(PRUint8 aWidgetType)
|
||||
{
|
||||
|
@ -318,7 +318,7 @@ nsNativeThemeWin::nsNativeThemeWin() {
|
|||
mHeaderTheme = NULL;
|
||||
mMenuTheme = NULL;
|
||||
|
||||
mThemeDLL = ::LoadLibrary(kThemeLibraryName);
|
||||
mThemeDLL = ::LoadLibraryW(kThemeLibraryName);
|
||||
if (mThemeDLL) {
|
||||
openTheme = (OpenThemeDataPtr)GetProcAddress(mThemeDLL, "OpenThemeData");
|
||||
closeTheme = (CloseThemeDataPtr)GetProcAddress(mThemeDLL, "CloseThemeData");
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
#include "nscore.h"
|
||||
#include "plstr.h"
|
||||
#include <stdio.h>
|
||||
|
||||
#include "nsString.h"
|
||||
#include <windows.h>
|
||||
|
||||
// mmsystem.h is needed to build with WIN32_LEAN_AND_MEAN
|
||||
|
@ -125,7 +125,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader,
|
|||
flags |= SND_ASYNC;
|
||||
}
|
||||
|
||||
::PlaySound(reinterpret_cast<const char*>(data), 0, flags);
|
||||
::PlaySoundA(reinterpret_cast<const char*>(data), 0, flags);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -166,12 +166,10 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias)
|
|||
PurgeLastSound();
|
||||
|
||||
if (aSoundAlias.EqualsLiteral("_moz_mailbeep")) {
|
||||
::PlaySound("MailBeep", nsnull, SND_ALIAS | SND_ASYNC);
|
||||
::PlaySoundW(L"MailBeep", nsnull, SND_ALIAS | SND_ASYNC);
|
||||
}
|
||||
else {
|
||||
nsCAutoString nativeSoundAlias;
|
||||
NS_CopyUnicodeToNative(aSoundAlias, nativeSoundAlias);
|
||||
::PlaySound(nativeSoundAlias.get(), nsnull, SND_ALIAS | SND_ASYNC);
|
||||
::PlaySoundW(PromiseFlatString(aSoundAlias).get(), nsnull, SND_ALIAS | SND_ASYNC);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -264,7 +264,7 @@ nsToolkit::Startup(HMODULE hModule)
|
|||
typedef BOOL (*SetProcessDPIAwareFunc)(VOID);
|
||||
|
||||
SetProcessDPIAwareFunc setDPIAware = (SetProcessDPIAwareFunc)
|
||||
GetProcAddress(LoadLibrary("user32.dll"),
|
||||
GetProcAddress(LoadLibraryW(L"user32.dll"),
|
||||
"SetProcessDPIAware");
|
||||
|
||||
if (setDPIAware)
|
||||
|
@ -295,8 +295,8 @@ void nsToolkit::CreateInternalWindow(PRThread *aThread)
|
|||
// create the internal window
|
||||
//
|
||||
|
||||
mDispatchWnd = ::CreateWindow("nsToolkitClass",
|
||||
"NetscapeDispatchWnd",
|
||||
mDispatchWnd = ::CreateWindowW(L"nsToolkitClass",
|
||||
L"NetscapeDispatchWnd",
|
||||
WS_DISABLED,
|
||||
-50, -50,
|
||||
10, 10,
|
||||
|
|
|
@ -150,7 +150,7 @@
|
|||
#include "prprf.h"
|
||||
#include "prmem.h"
|
||||
|
||||
static const char kMozHeapDumpMessageString[] = "MOZ_HeapDump";
|
||||
static const PRUnichar kMozHeapDumpMessageString[] = L"MOZ_HeapDump";
|
||||
|
||||
#define kWindowPositionSlop 20
|
||||
|
||||
|
@ -699,7 +699,7 @@ nsWindow::nsWindow() : nsBaseWidget()
|
|||
|
||||
// Heap dump
|
||||
#ifndef WINCE
|
||||
nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessage(kMozHeapDumpMessageString);
|
||||
nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessageW(kMozHeapDumpMessageString);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -1119,26 +1119,26 @@ nsWindow::EventIsInsideWindow(UINT Msg, nsWindow* aWindow)
|
|||
return (PRBool) PtInRect(&r, mp);
|
||||
}
|
||||
|
||||
static char sPropName[40] = "";
|
||||
static char* GetNSWindowPropName() {
|
||||
static PRUnichar sPropName[40] = L"";
|
||||
static PRUnichar* GetNSWindowPropName() {
|
||||
if (!*sPropName)
|
||||
{
|
||||
_snprintf(sPropName, 39, "MozillansIWidgetPtr%p", _getpid());
|
||||
_snwprintf(sPropName, 39, L"MozillansIWidgetPtr%p", _getpid());
|
||||
sPropName[39] = '\0';
|
||||
}
|
||||
return sPropName;
|
||||
}
|
||||
|
||||
nsWindow * nsWindow::GetNSWindowPtr(HWND aWnd) {
|
||||
return (nsWindow *) ::GetPropA(aWnd, GetNSWindowPropName());
|
||||
return (nsWindow *) ::GetPropW(aWnd, GetNSWindowPropName());
|
||||
}
|
||||
|
||||
BOOL nsWindow::SetNSWindowPtr(HWND aWnd, nsWindow * ptr) {
|
||||
if (ptr == NULL) {
|
||||
::RemovePropA(aWnd, GetNSWindowPropName());
|
||||
::RemovePropW(aWnd, GetNSWindowPropName());
|
||||
return TRUE;
|
||||
} else {
|
||||
return ::SetPropA(aWnd, GetNSWindowPropName(), (HANDLE)ptr);
|
||||
return ::SetPropW(aWnd, GetNSWindowPropName(), (HANDLE)ptr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1788,7 +1788,7 @@ NS_IMETHODIMP nsWindow::SetSizeMode(PRInt32 aMode) {
|
|||
|
||||
// Play the minimize sound while we're here, since that is also
|
||||
// forgotten when we use SW_SHOWMINIMIZED.
|
||||
::PlaySound("Minimize", nsnull, SND_ALIAS | SND_NODEFAULT | SND_ASYNC);
|
||||
::PlaySoundW(L"Minimize", nsnull, SND_ALIAS | SND_NODEFAULT | SND_ASYNC);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
@ -5192,7 +5192,7 @@ LPCWSTR nsWindow::WindowPopupClassW()
|
|||
return className;
|
||||
}
|
||||
|
||||
LPCSTR nsWindow::WindowClass()
|
||||
LPCTSTR nsWindow::WindowClass()
|
||||
{
|
||||
// Call into the wide version to make sure things get
|
||||
// registered properly.
|
||||
|
@ -5200,7 +5200,9 @@ LPCSTR nsWindow::WindowClass()
|
|||
|
||||
// XXX: The class name used here must be kept in sync with
|
||||
// the classname used in WindowClassW();
|
||||
|
||||
#ifdef UNICODE
|
||||
return classNameW;
|
||||
#else
|
||||
if (classNameW == kWClassNameHidden) {
|
||||
return kClassNameHidden;
|
||||
}
|
||||
|
@ -5217,17 +5219,21 @@ LPCSTR nsWindow::WindowClass()
|
|||
return kClassNameContentFrame;
|
||||
}
|
||||
return kClassNameGeneral;
|
||||
#endif
|
||||
}
|
||||
|
||||
LPCSTR nsWindow::WindowPopupClass()
|
||||
LPCTSTR nsWindow::WindowPopupClass()
|
||||
{
|
||||
// Call into the wide version to make sure things get
|
||||
// registered properly.
|
||||
WindowPopupClassW();
|
||||
#ifdef UNICODE
|
||||
return WindowPopupClassW();
|
||||
#else
|
||||
|
||||
// XXX: The class name used here must be kept in sync with
|
||||
// the classname used in WindowPopupClassW();
|
||||
return "MozillaDropShadowWindowClass";
|
||||
#endif
|
||||
}
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
|
@ -7718,7 +7724,7 @@ STDMETHODIMP_(LRESULT) nsWindow::LresultFromObject(REFIID riid, WPARAM wParam, L
|
|||
{
|
||||
// open the dll dynamically
|
||||
if (!gmAccLib)
|
||||
gmAccLib =::LoadLibrary("OLEACC.DLL");
|
||||
gmAccLib =::LoadLibraryW(L"OLEACC.DLL");
|
||||
|
||||
if (gmAccLib) {
|
||||
if (!gmLresultFromObject)
|
||||
|
|
|
@ -105,6 +105,13 @@ const LPCSTR kClassNameContent = "MozillaContentWindowClass";
|
|||
const LPCSTR kClassNameContentFrame = "MozillaContentFrameWindowClass";
|
||||
const LPCSTR kClassNameGeneral = "MozillaWindowClass";
|
||||
const LPCSTR kClassNameDialog = "MozillaDialogClass";
|
||||
const LPCTSTR kTClassNameHidden = TEXT("MozillaHiddenWindowClass");
|
||||
const LPCTSTR kTClassNameUI = TEXT("MozillaUIWindowClass");
|
||||
const LPCTSTR kTClassNameContent = TEXT("MozillaContentWindowClass");
|
||||
const LPCTSTR kTClassNameContentFrame = TEXT("MozillaContentFrameWindowClass");
|
||||
const LPCTSTR kTClassNameGeneral = TEXT("MozillaWindowClass");
|
||||
const LPCTSTR kTClassNameDialog = TEXT("MozillaDialogClass");
|
||||
|
||||
|
||||
/**
|
||||
* Native WIN32 window wrapper.
|
||||
|
|
|
@ -66,6 +66,11 @@
|
|||
#include <signal.h>
|
||||
#endif
|
||||
|
||||
#if defined(XP_WIN)
|
||||
#include <tchar.h>
|
||||
#include "nsString.h"
|
||||
#endif
|
||||
|
||||
static void
|
||||
Abort(const char *aMsg);
|
||||
|
||||
|
@ -97,7 +102,7 @@ PRBool InDebugger()
|
|||
#ifndef WINCE
|
||||
PRBool fReturn = PR_FALSE;
|
||||
LPFNISDEBUGGERPRESENT lpfnIsDebuggerPresent = NULL;
|
||||
HINSTANCE hKernel = LoadLibrary("Kernel32.dll");
|
||||
HINSTANCE hKernel = LoadLibraryW(L"Kernel32.dll");
|
||||
|
||||
if(hKernel)
|
||||
{
|
||||
|
@ -401,9 +406,9 @@ Break(const char *aMsg)
|
|||
* See http://bugzilla.mozilla.org/show_bug.cgi?id=54792
|
||||
*/
|
||||
PROCESS_INFORMATION pi;
|
||||
STARTUPINFO si;
|
||||
char executable[MAX_PATH];
|
||||
char* pName;
|
||||
STARTUPINFOW si;
|
||||
PRUnichar executable[MAX_PATH];
|
||||
PRUnichar* pName;
|
||||
|
||||
memset(&pi, 0, sizeof(pi));
|
||||
|
||||
|
@ -412,13 +417,15 @@ Break(const char *aMsg)
|
|||
si.wShowWindow = SW_SHOW;
|
||||
|
||||
// 2nd arg of CreateProcess is in/out
|
||||
char *msgCopy = (char*) _alloca(strlen(aMsg) + 1);
|
||||
strcpy(msgCopy, aMsg);
|
||||
PRUnichar *msgCopy = (PRUnichar*) _alloca((strlen(aMsg) + 1)*sizeof(PRUnichar));
|
||||
wcscpy(msgCopy , (PRUnichar*)NS_ConvertUTF8toUTF16(aMsg).get());
|
||||
|
||||
if(GetModuleFileName(GetModuleHandle("xpcom.dll"), executable, MAX_PATH) &&
|
||||
NULL != (pName = strrchr(executable, '\\')) &&
|
||||
NULL != strcpy(pName+1, "windbgdlg.exe") &&
|
||||
CreateProcess(executable, msgCopy, NULL, NULL, PR_FALSE,
|
||||
if(GetModuleFileNameW(GetModuleHandleW(L"xpcom.dll"), (LPWCH)executable, MAX_PATH) &&
|
||||
NULL != (pName = wcsrchr(executable, '\\')) &&
|
||||
NULL !=
|
||||
wcscpy((WCHAR*)
|
||||
pName+1, L"windbgdlg.exe") &&
|
||||
CreateProcessW((LPCWSTR)executable, (LPWSTR)msgCopy, NULL, NULL, PR_FALSE,
|
||||
DETACHED_PROCESS | NORMAL_PRIORITY_CLASS,
|
||||
NULL, NULL, &si, &pi)) {
|
||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||
|
|
|
@ -328,9 +328,9 @@ EnsureImageHlpInitialized()
|
|||
|
||||
::InitializeCriticalSection(&gDbgHelpCS);
|
||||
|
||||
HMODULE module = ::LoadLibrary("DBGHELP.DLL");
|
||||
HMODULE module = ::LoadLibraryW(L"DBGHELP.DLL");
|
||||
if (!module) {
|
||||
module = ::LoadLibrary("IMAGEHLP.DLL");
|
||||
module = ::LoadLibraryW(L"IMAGEHLP.DLL");
|
||||
if (!module) return PR_FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -127,7 +127,7 @@ NS_COM void StartupSpecialSystemDirectory()
|
|||
#if defined (XP_WIN) && !defined (WINCE)
|
||||
// SHGetKnownFolderPath is only available on Windows Vista
|
||||
// so that we need to use GetProcAddress to get the pointer.
|
||||
gShell32DLLInst = LoadLibrary("Shell32.dll");
|
||||
gShell32DLLInst = LoadLibraryW(L"Shell32.dll");
|
||||
if(gShell32DLLInst)
|
||||
{
|
||||
gGetKnownFolderPath = (nsGetKnownFolderPath)
|
||||
|
|
|
@ -108,8 +108,8 @@ private:
|
|||
* HasMoreElements reads mLetter.
|
||||
* GetNext advances mLetter.
|
||||
*/
|
||||
nsCString mDrives;
|
||||
const char *mLetter;
|
||||
nsString mDrives;
|
||||
const PRUnichar *mLetter;
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
@ -2952,7 +2952,7 @@ nsresult nsDriveEnumerator::Init()
|
|||
/* The string is null terminated */
|
||||
if (!EnsureStringLength(mDrives, length+1))
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
if (!GetLogicalDriveStrings(length, mDrives.BeginWriting()))
|
||||
if (!GetLogicalDriveStringsW(length, mDrives.BeginWriting()))
|
||||
return NS_ERROR_FAILURE;
|
||||
mLetter = mDrives.get();
|
||||
return NS_OK;
|
||||
|
@ -2982,8 +2982,9 @@ NS_IMETHODIMP nsDriveEnumerator::GetNext(nsISupports **aNext)
|
|||
*aNext = nsnull;
|
||||
return NS_OK;
|
||||
}
|
||||
NS_ConvertASCIItoUTF16 drive(mLetter);
|
||||
nsString drive(mDrives);
|
||||
mLetter += drive.Length() + 1;
|
||||
|
||||
nsILocalFile *file;
|
||||
nsresult rv =
|
||||
NS_NewLocalFile(drive, PR_FALSE, &file);
|
||||
|
|
|
@ -106,10 +106,11 @@ nsProcess::Init(nsIFile* executable)
|
|||
|
||||
|
||||
#if defined(XP_WIN)
|
||||
static int assembleCmdLine(char *const *argv, char **cmdLine)
|
||||
static int assembleCmdLine(char *const *argv, PRUnichar **cmdLine)
|
||||
{
|
||||
char *const *arg;
|
||||
char *p, *q;
|
||||
PRUnichar *p;
|
||||
char *q;
|
||||
int cmdLineSize;
|
||||
int numBackslashes;
|
||||
int i;
|
||||
|
@ -131,7 +132,7 @@ static int assembleCmdLine(char *const *argv, char **cmdLine)
|
|||
+ 2 /* we quote every argument */
|
||||
+ 1; /* space in between, or final null */
|
||||
}
|
||||
p = *cmdLine = (char *) PR_MALLOC(cmdLineSize);
|
||||
p = *cmdLine = (PRUnichar *) PR_MALLOC(cmdLineSize*sizeof(PRUnichar));
|
||||
if (p == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
@ -237,10 +238,10 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count,
|
|||
my_argv[count+1] = NULL;
|
||||
|
||||
#if defined(XP_WIN) && !defined (WINCE) /* wince uses nspr */
|
||||
STARTUPINFO startupInfo;
|
||||
STARTUPINFOW startupInfo;
|
||||
PROCESS_INFORMATION procInfo;
|
||||
BOOL retVal;
|
||||
char *cmdLine;
|
||||
PRUnichar *cmdLine;
|
||||
|
||||
if (assembleCmdLine(my_argv, &cmdLine) == -1) {
|
||||
nsMemory::Free(my_argv);
|
||||
|
@ -250,20 +251,20 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count,
|
|||
ZeroMemory(&startupInfo, sizeof(startupInfo));
|
||||
startupInfo.cb = sizeof(startupInfo);
|
||||
|
||||
retVal = CreateProcess(NULL,
|
||||
// const_cast<char*>(mTargetPath.get()),
|
||||
cmdLine,
|
||||
NULL, /* security attributes for the new
|
||||
* process */
|
||||
NULL, /* security attributes for the primary
|
||||
* thread in the new process */
|
||||
FALSE, /* inherit handles */
|
||||
0, /* creation flags */
|
||||
NULL, /* env */
|
||||
NULL, /* current drive and directory */
|
||||
&startupInfo,
|
||||
&procInfo
|
||||
);
|
||||
retVal = CreateProcessW(NULL,
|
||||
// const_cast<char*>(mTargetPath.get()),
|
||||
cmdLine,
|
||||
NULL, /* security attributes for the new
|
||||
* process */
|
||||
NULL, /* security attributes for the primary
|
||||
* thread in the new process */
|
||||
FALSE, /* inherit handles */
|
||||
0, /* creation flags */
|
||||
NULL, /* env */
|
||||
NULL, /* current drive and directory */
|
||||
&startupInfo,
|
||||
&procInfo
|
||||
);
|
||||
PR_Free( cmdLine );
|
||||
if (blocking) {
|
||||
|
||||
|
|
|
@ -42,6 +42,8 @@ VPATH = @srcdir@
|
|||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
OS_LIBS += shell32.lib
|
||||
|
||||
SIMPLE_PROGRAMS = windbgdlg$(BIN_SUFFIX)
|
||||
|
||||
CPPSRCS = windbgdlg.cpp
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
|
||||
#include <windows.h>
|
||||
#include <stdlib.h>
|
||||
#include <shellapi.h>
|
||||
|
||||
int WINAPI
|
||||
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||
|
@ -59,10 +60,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
DWORD regValue = -1;
|
||||
DWORD regLength = sizeof regValue;
|
||||
HKEY hkeyCU, hkeyLM;
|
||||
RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU);
|
||||
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM);
|
||||
const char * const * argv = __argv;
|
||||
for (int i = __argc - 1; regValue == (DWORD)-1 && i; --i) {
|
||||
RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU);
|
||||
RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM);
|
||||
int argc =0;
|
||||
LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
||||
for (int i = argc - 1; regValue == (DWORD)-1 && i; --i) {
|
||||
bool ok = false;
|
||||
if (hkeyCU)
|
||||
ok = RegQueryValueEx(hkeyCU, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS;
|
||||
|
@ -77,15 +79,15 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
|||
RegCloseKey(hkeyLM);
|
||||
if (regValue != (DWORD)-1 && regValue != (DWORD)-2)
|
||||
return regValue;
|
||||
static char msg[4048];
|
||||
static PRUnichar msg[4048];
|
||||
|
||||
wsprintf(msg,
|
||||
"%s\n\nClick Abort to exit the Application.\n"
|
||||
"Click Retry to Debug the Application..\n"
|
||||
"Click Ignore to continue running the Application.",
|
||||
L"%s\n\nClick Abort to exit the Application.\n"
|
||||
L"Click Retry to Debug the Application..\n"
|
||||
L"Click Ignore to continue running the Application.",
|
||||
lpszCmdLine);
|
||||
|
||||
return MessageBox(NULL, msg, "NSGlue_Assertion",
|
||||
return MessageBoxW(NULL, msg, L"NSGlue_Assertion",
|
||||
MB_ICONSTOP | MB_SYSTEMMODAL|
|
||||
MB_ABORTRETRYIGNORE | MB_DEFBUTTON3);
|
||||
}
|
||||
|
|
|
@ -39,6 +39,7 @@
|
|||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
|
||||
//defines and includes for previous installation cleanup process
|
||||
#if defined (XP_WIN)
|
||||
|
@ -63,15 +64,18 @@ printf("\n****Inside ShowOSAlert ***\n");
|
|||
#endif
|
||||
|
||||
const PRInt32 max_len = 255;
|
||||
char message_copy[max_len+1] = { 0 };
|
||||
PRInt32 input_len = strlen(aMessage);
|
||||
PRInt32 copy_len = (input_len > max_len) ? max_len : input_len;
|
||||
#if defined (XP_WIN)
|
||||
NS_ConvertUTF8toUTF16 msg_str(aMessage, copy_len);
|
||||
PRUnichar* message_copy = (PRUnichar*)msg_str.get();
|
||||
MessageBoxW(NULL, message_copy, NULL, MB_OK | MB_ICONERROR | MB_SETFOREGROUND );
|
||||
#else
|
||||
char message_copy[max_len+1] = { 0 };
|
||||
strncpy(message_copy, aMessage, copy_len);
|
||||
message_copy[copy_len] = 0;
|
||||
|
||||
#if defined (XP_WIN)
|
||||
MessageBoxA(NULL, message_copy, NULL, MB_OK | MB_ICONERROR | MB_SETFOREGROUND );
|
||||
#elif (XP_MAC)
|
||||
#endif
|
||||
#if (XP_MAC)
|
||||
short buttonClicked;
|
||||
StandardAlert(kAlertStopAlert, c2pstr(message_copy), nil, nil, &buttonClicked);
|
||||
#elif defined (XP_OS2)
|
||||
|
|
Загрузка…
Ссылка в новой задаче