backing out b=418703, caused test 40118 to fail on WINNT 5.2 qm-win2k3-01 dep unit test tinderbox
This commit is contained in:
Родитель
cd4aa1cd4e
Коммит
8e0ee5cdcc
|
@ -576,7 +576,7 @@ void nsAccessNodeWrap::InitAccessibility()
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!gmUserLib) {
|
if (!gmUserLib) {
|
||||||
gmUserLib =::LoadLibraryW(L"USER32.DLL");
|
gmUserLib =::LoadLibrary("USER32.DLL");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gmUserLib) {
|
if (gmUserLib) {
|
||||||
|
|
|
@ -156,7 +156,7 @@ STDMETHODIMP nsAccessibleWrap::AccessibleObjectFromWindow(HWND hwnd,
|
||||||
{
|
{
|
||||||
// open the dll dynamically
|
// open the dll dynamically
|
||||||
if (!gmAccLib)
|
if (!gmAccLib)
|
||||||
gmAccLib =::LoadLibraryW(L"OLEACC.DLL");
|
gmAccLib =::LoadLibrary("OLEACC.DLL");
|
||||||
|
|
||||||
if (gmAccLib) {
|
if (gmAccLib) {
|
||||||
if (!gmAccessibleObjectFromWindow)
|
if (!gmAccessibleObjectFromWindow)
|
||||||
|
|
|
@ -64,9 +64,11 @@ static void Output(const char *fmt, ... )
|
||||||
va_start(ap, fmt);
|
va_start(ap, fmt);
|
||||||
|
|
||||||
#if defined(XP_WIN) && !MOZ_WINCONSOLE
|
#if defined(XP_WIN) && !MOZ_WINCONSOLE
|
||||||
PRUnichar msg[2048];
|
char msg[2048];
|
||||||
_vsnwprintf(msg, sizeof(msg), NS_ConvertUTF8toUTF16(fmt).get(), ap);
|
|
||||||
MessageBoxW(NULL, msg, L"XULRunner", MB_OK | MB_ICONERROR);
|
_vsnprintf(msg, sizeof(msg), fmt, ap);
|
||||||
|
|
||||||
|
MessageBox(NULL, msg, "XULRunner", MB_OK | MB_ICONERROR);
|
||||||
#else
|
#else
|
||||||
vfprintf(stderr, fmt, ap);
|
vfprintf(stderr, fmt, ap);
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -867,7 +867,7 @@ nsIEProfileMigrator::CopyPasswords(PRBool aReplace)
|
||||||
nsresult rv;
|
nsresult rv;
|
||||||
nsVoidArray signonsFound;
|
nsVoidArray signonsFound;
|
||||||
|
|
||||||
HMODULE pstoreDLL = ::LoadLibraryW(L"pstorec.dll");
|
HMODULE pstoreDLL = ::LoadLibrary("pstorec.dll");
|
||||||
if (!pstoreDLL) {
|
if (!pstoreDLL) {
|
||||||
// XXXben TODO
|
// XXXben TODO
|
||||||
// Need to figure out what to do here on Windows 98 etc... it may be that the key is universal read
|
// 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;
|
HRESULT hr;
|
||||||
|
|
||||||
HMODULE pstoreDLL = ::LoadLibraryW(L"pstorec.dll");
|
HMODULE pstoreDLL = ::LoadLibrary("pstorec.dll");
|
||||||
if (!pstoreDLL) {
|
if (!pstoreDLL) {
|
||||||
// XXXben TODO
|
// XXXben TODO
|
||||||
// Need to figure out what to do here on Windows 98 etc... it may be that the key is universal read
|
// Need to figure out what to do here on Windows 98 etc... it may be that the key is universal read
|
||||||
|
@ -1410,19 +1410,20 @@ nsIEProfileMigrator::ResolveShortcut(const nsString &aFileName, char** aOutURL)
|
||||||
{
|
{
|
||||||
HRESULT result;
|
HRESULT result;
|
||||||
|
|
||||||
IUniformResourceLocatorW* urlLink = nsnull;
|
IUniformResourceLocator* urlLink = nsnull;
|
||||||
result = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER,
|
result = ::CoCreateInstance(CLSID_InternetShortcut, NULL, CLSCTX_INPROC_SERVER,
|
||||||
IID_IUniformResourceLocatorW, (void**)&urlLink);
|
IID_IUniformResourceLocator, (void**)&urlLink);
|
||||||
if (SUCCEEDED(result) && urlLink) {
|
if (SUCCEEDED(result) && urlLink) {
|
||||||
IPersistFile* urlFile = nsnull;
|
IPersistFile* urlFile = nsnull;
|
||||||
result = urlLink->QueryInterface(IID_IPersistFile, (void**)&urlFile);
|
result = urlLink->QueryInterface(IID_IPersistFile, (void**)&urlFile);
|
||||||
if (SUCCEEDED(result) && urlFile) {
|
if (SUCCEEDED(result) && urlFile) {
|
||||||
result = urlFile->Load(aFileName.get(), STGM_READ);
|
result = urlFile->Load(aFileName.get(), STGM_READ);
|
||||||
if (SUCCEEDED(result) ) {
|
if (SUCCEEDED(result) ) {
|
||||||
LPWSTR lpTemp = nsnull;
|
LPSTR lpTemp = nsnull;
|
||||||
result = urlLink->GetURL(&lpTemp);
|
result = urlLink->GetURL(&lpTemp);
|
||||||
if (SUCCEEDED(result) && lpTemp) {
|
if (SUCCEEDED(result) && lpTemp) {
|
||||||
*aOutURL = *aOutURL = (char*)ToNewUTF8String(nsDependentString(lpTemp));
|
*aOutURL = PL_strdup(lpTemp);
|
||||||
|
|
||||||
// free the string that GetURL alloc'd
|
// free the string that GetURL alloc'd
|
||||||
::CoTaskMemFree(lpTemp);
|
::CoTaskMemFree(lpTemp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,8 +396,8 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs
|
||||||
rv = appHelper->AppendNative(NS_LITERAL_CSTRING("helper.exe"));
|
rv = appHelper->AppendNative(NS_LITERAL_CSTRING("helper.exe"));
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
nsAutoString appHelperPath;
|
nsCAutoString appHelperPath;
|
||||||
rv = appHelper->GetPath(appHelperPath);
|
rv = appHelper->GetNativePath(appHelperPath);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
NS_ENSURE_SUCCESS(rv, rv);
|
||||||
|
|
||||||
if (aForAllUsers) {
|
if (aForAllUsers) {
|
||||||
|
@ -406,10 +406,10 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs
|
||||||
appHelperPath.AppendLiteral(" /SetAsDefaultAppUser");
|
appHelperPath.AppendLiteral(" /SetAsDefaultAppUser");
|
||||||
}
|
}
|
||||||
|
|
||||||
STARTUPINFOW si = {sizeof(si), 0};
|
STARTUPINFO si = {sizeof(si), 0};
|
||||||
PROCESS_INFORMATION pi = {0};
|
PROCESS_INFORMATION pi = {0};
|
||||||
|
|
||||||
BOOL ok = CreateProcessW(NULL, (LPWSTR)appHelperPath.get(), NULL, NULL,
|
BOOL ok = CreateProcess(NULL, (LPSTR)appHelperPath.get(), NULL, NULL,
|
||||||
FALSE, 0, NULL, NULL, &si, &pi);
|
FALSE, 0, NULL, NULL, &si, &pi);
|
||||||
|
|
||||||
if (!ok)
|
if (!ok)
|
||||||
|
|
|
@ -929,6 +929,16 @@ morkStdioFile::Steal(nsIMdbEnv* ev, nsIMdbFile* ioThief)
|
||||||
void mork_fileflush(FILE * file)
|
void mork_fileflush(FILE * file)
|
||||||
{
|
{
|
||||||
fflush(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*/
|
#endif /*MORK_WIN*/
|
||||||
|
|
|
@ -303,7 +303,8 @@ ShowError(MozAxPluginErrors errorCode, const CLSID &clsid)
|
||||||
LPOLESTR szClsid;
|
LPOLESTR szClsid;
|
||||||
StringFromCLSID(clsid, &szClsid);
|
StringFromCLSID(clsid, &szClsid);
|
||||||
_sntprintf(szBuffer, kBufSize - 1,
|
_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);
|
CoTaskMemFree(szClsid);
|
||||||
szMsg = szBuffer;
|
szMsg = szBuffer;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1915,7 +1915,7 @@ END_COM_MAP()
|
||||||
NS_SUCCEEDED(baseURI->GetSpec(spec)))
|
NS_SUCCEEDED(baseURI->GetSpec(spec)))
|
||||||
{
|
{
|
||||||
USES_CONVERSION;
|
USES_CONVERSION;
|
||||||
if (FAILED(CreateURLMoniker(NULL, A2CW(spec.get()), &baseURLMoniker)))
|
if (FAILED(CreateURLMoniker(NULL, T2CW(spec.get()), &baseURLMoniker)))
|
||||||
return E_UNEXPECTED;
|
return E_UNEXPECTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -372,7 +372,7 @@ nsScriptablePeer::ConvertVariants(VARIANT *aIn, nsIVariant **aOut)
|
||||||
{
|
{
|
||||||
// do_CreateInstance macro is broken so load the component manager by
|
// do_CreateInstance macro is broken so load the component manager by
|
||||||
// hand and get it to create the component.
|
// hand and get it to create the component.
|
||||||
HMODULE hlib = ::LoadLibraryW(L"xpcom.dll");
|
HMODULE hlib = ::LoadLibrary("xpcom.dll");
|
||||||
if (hlib)
|
if (hlib)
|
||||||
{
|
{
|
||||||
nsIComponentManager *pManager = nsnull; // A frozen interface, even in 1.0.x
|
nsIComponentManager *pManager = nsnull; // A frozen interface, even in 1.0.x
|
||||||
|
|
|
@ -52,8 +52,6 @@
|
||||||
#include "nsNetCID.h"
|
#include "nsNetCID.h"
|
||||||
#include "nsCOMPtr.h"
|
#include "nsCOMPtr.h"
|
||||||
|
|
||||||
#include <windows.h>
|
|
||||||
|
|
||||||
#define SEC_SUCCESS(Status) ((Status) >= 0)
|
#define SEC_SUCCESS(Status) ((Status) >= 0)
|
||||||
|
|
||||||
#ifndef KERB_WRAP_NO_ENCRYPT
|
#ifndef KERB_WRAP_NO_ENCRYPT
|
||||||
|
@ -105,25 +103,25 @@ static const char *MapErrorCode(int rc)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
static HINSTANCE sspi_lib;
|
static HINSTANCE sspi_lib;
|
||||||
static PSecurityFunctionTableW sspi;
|
static PSecurityFunctionTable sspi;
|
||||||
|
|
||||||
static nsresult
|
static nsresult
|
||||||
InitSSPI()
|
InitSSPI()
|
||||||
{
|
{
|
||||||
PSecurityFunctionTableW (*initFun)(void);
|
PSecurityFunctionTable (*initFun)(void);
|
||||||
|
|
||||||
LOG((" InitSSPI\n"));
|
LOG((" InitSSPI\n"));
|
||||||
|
|
||||||
sspi_lib = LoadLibraryW(L"secur32.dll");
|
sspi_lib = LoadLibrary("secur32.dll");
|
||||||
if (!sspi_lib) {
|
if (!sspi_lib) {
|
||||||
sspi_lib = LoadLibraryW(L"security.dll");
|
sspi_lib = LoadLibrary("security.dll");
|
||||||
if (!sspi_lib) {
|
if (!sspi_lib) {
|
||||||
LOG(("SSPI library not found"));
|
LOG(("SSPI library not found"));
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
initFun = (PSecurityFunctionTableW (*)(void))
|
initFun = (PSecurityFunctionTable (*)(void))
|
||||||
GetProcAddress(sspi_lib, "InitSecurityInterfaceA");
|
GetProcAddress(sspi_lib, "InitSecurityInterfaceA");
|
||||||
if (!initFun) {
|
if (!initFun) {
|
||||||
LOG(("InitSecurityInterfaceA not found"));
|
LOG(("InitSecurityInterfaceA not found"));
|
||||||
|
@ -244,9 +242,11 @@ nsAuthSSPI::Init(const char *serviceName,
|
||||||
if (NS_FAILED(rv))
|
if (NS_FAILED(rv))
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
SEC_WCHAR *package;
|
|
||||||
|
|
||||||
package = (SEC_WCHAR *) pTypeName[(int)mPackage];
|
SEC_CHAR *package;
|
||||||
|
|
||||||
|
package = (SEC_CHAR *) pTypeName[(int)mPackage];
|
||||||
|
|
||||||
if (mPackage != PACKAGE_TYPE_NTLM)
|
if (mPackage != PACKAGE_TYPE_NTLM)
|
||||||
{
|
{
|
||||||
rv = MakeSN(serviceName, mServiceName);
|
rv = MakeSN(serviceName, mServiceName);
|
||||||
|
@ -257,8 +257,8 @@ nsAuthSSPI::Init(const char *serviceName,
|
||||||
|
|
||||||
SECURITY_STATUS rc;
|
SECURITY_STATUS rc;
|
||||||
|
|
||||||
PSecPkgInfoW pinfo;
|
PSecPkgInfo pinfo;
|
||||||
rc = (sspi->QuerySecurityPackageInfoW)(package, &pinfo);
|
rc = (sspi->QuerySecurityPackageInfo)(package, &pinfo);
|
||||||
if (rc != SEC_E_OK) {
|
if (rc != SEC_E_OK) {
|
||||||
LOG(("%s package not found\n", package));
|
LOG(("%s package not found\n", package));
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
|
@ -268,7 +268,7 @@ nsAuthSSPI::Init(const char *serviceName,
|
||||||
|
|
||||||
TimeStamp useBefore;
|
TimeStamp useBefore;
|
||||||
|
|
||||||
rc = (sspi->AcquireCredentialsHandleW)(NULL,
|
rc = (sspi->AcquireCredentialsHandle)(NULL,
|
||||||
package,
|
package,
|
||||||
SECPKG_CRED_OUTBOUND,
|
SECPKG_CRED_OUTBOUND,
|
||||||
NULL,
|
NULL,
|
||||||
|
@ -336,13 +336,15 @@ nsAuthSSPI::GetNextToken(const void *inToken,
|
||||||
if (!ob.pvBuffer)
|
if (!ob.pvBuffer)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
memset(ob.pvBuffer, 0, ob.cbBuffer);
|
memset(ob.pvBuffer, 0, ob.cbBuffer);
|
||||||
SEC_WCHAR *sn;
|
|
||||||
|
SEC_CHAR *sn;
|
||||||
|
|
||||||
if (mPackage == PACKAGE_TYPE_NTLM)
|
if (mPackage == PACKAGE_TYPE_NTLM)
|
||||||
sn = NULL;
|
sn = NULL;
|
||||||
else
|
else
|
||||||
sn = (SEC_WCHAR *) mServiceName.get();
|
sn = (SEC_CHAR *) mServiceName.get();
|
||||||
|
|
||||||
rc = (sspi->InitializeSecurityContextW)(&mCred,
|
rc = (sspi->InitializeSecurityContext)(&mCred,
|
||||||
ctxIn,
|
ctxIn,
|
||||||
sn,
|
sn,
|
||||||
ctxReq,
|
ctxReq,
|
||||||
|
@ -459,7 +461,7 @@ nsAuthSSPI::Wrap(const void *inToken,
|
||||||
secBuffers bufs;
|
secBuffers bufs;
|
||||||
SecPkgContext_Sizes sizes;
|
SecPkgContext_Sizes sizes;
|
||||||
|
|
||||||
rc = (sspi->QueryContextAttributesW)(
|
rc = (sspi->QueryContextAttributes)(
|
||||||
&mCtxt,
|
&mCtxt,
|
||||||
SECPKG_ATTR_SIZES,
|
SECPKG_ATTR_SIZES,
|
||||||
&sizes);
|
&sizes);
|
||||||
|
|
|
@ -44,12 +44,18 @@
|
||||||
|
|
||||||
|
|
||||||
nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
|
nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
|
||||||
nsString *aFontName,
|
nsString *aFontName,
|
||||||
gfxFontStyle *aFontStyle) const
|
gfxFontStyle *aFontStyle,
|
||||||
|
PRBool aIsWide) const
|
||||||
{
|
{
|
||||||
PRUnichar name[LF_FACESIZE];
|
PRUnichar name[LF_FACESIZE];
|
||||||
name[0] = 0;
|
name[0] = 0;
|
||||||
|
if (aIsWide)
|
||||||
memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2);
|
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;
|
*aFontName = name;
|
||||||
|
|
||||||
// Do Style
|
// Do Style
|
||||||
|
|
|
@ -51,7 +51,8 @@ public:
|
||||||
gfxFontStyle *aFontStyle) const;
|
gfxFontStyle *aFontStyle) const;
|
||||||
private:
|
private:
|
||||||
nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
|
nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
|
||||||
nsString *aFontName, gfxFontStyle *aFontStyle) const;
|
nsString *aFontName, gfxFontStyle *aFontStyle,
|
||||||
|
PRBool aIsWide = PR_FALSE) const;
|
||||||
nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID,
|
nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID,
|
||||||
nsString *aFontName,
|
nsString *aFontName,
|
||||||
gfxFontStyle *aFontStyle) const;
|
gfxFontStyle *aFontStyle) const;
|
||||||
|
|
|
@ -310,7 +310,7 @@ NS_IMETHODIMP nsDeviceContextWin :: SetCanonicalPixelScale(float aScale)
|
||||||
|
|
||||||
|
|
||||||
nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
|
nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
|
||||||
nsFont* aFont) const
|
nsFont* aFont, PRBool aIsWide) const
|
||||||
{
|
{
|
||||||
PRUnichar name[LF_FACESIZE];
|
PRUnichar name[LF_FACESIZE];
|
||||||
name[0] = 0;
|
name[0] = 0;
|
||||||
|
|
|
@ -101,7 +101,8 @@ protected:
|
||||||
void ComputeFullAreaUsingScreen ( nsRect* outRect ) ;
|
void ComputeFullAreaUsingScreen ( nsRect* outRect ) ;
|
||||||
nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsFont* aFont) const;
|
nsresult GetSysFontInfo(HDC aHDC, nsSystemFontID anID, nsFont* aFont) const;
|
||||||
|
|
||||||
nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, nsFont* aFont) const;
|
nsresult CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont, nsFont* aFont,
|
||||||
|
PRBool aIsWide = PR_FALSE) const;
|
||||||
|
|
||||||
PRBool mCachedClientRect;
|
PRBool mCachedClientRect;
|
||||||
PRBool mCachedFullRect;
|
PRBool mCachedFullRect;
|
||||||
|
|
|
@ -2121,9 +2121,40 @@ nsGlyphAgent::GetGlyphMetrics(HDC aDC,
|
||||||
GLYPHMETRICS* aGlyphMetrics)
|
GLYPHMETRICS* aGlyphMetrics)
|
||||||
{
|
{
|
||||||
memset(aGlyphMetrics, 0, sizeof(GLYPHMETRICS)); // UMR: bug 46438
|
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;
|
mState = eGlyphAgent_UNICODE;
|
||||||
return GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat);
|
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
|
// the global glyph agent that we will be using
|
||||||
|
|
|
@ -340,13 +340,13 @@ gfxWindowsFont::ComputeMetrics()
|
||||||
|
|
||||||
// Cache the width of a single space.
|
// Cache the width of a single space.
|
||||||
SIZE size;
|
SIZE size;
|
||||||
GetTextExtentPoint32W(dc, L" ", 1, &size);
|
GetTextExtentPoint32(dc, " ", 1, &size);
|
||||||
mMetrics->spaceWidth = ROUND(size.cx);
|
mMetrics->spaceWidth = ROUND(size.cx);
|
||||||
|
|
||||||
mSpaceGlyph = 0;
|
mSpaceGlyph = 0;
|
||||||
if (metrics.tmPitchAndFamily & TMPF_TRUETYPE) {
|
if (metrics.tmPitchAndFamily & TMPF_TRUETYPE) {
|
||||||
WORD glyph;
|
WORD glyph;
|
||||||
DWORD ret = GetGlyphIndicesW(dc, L" ", 1, &glyph,
|
DWORD ret = GetGlyphIndicesA(dc, " ", 1, &glyph,
|
||||||
GGI_MARK_NONEXISTING_GLYPHS);
|
GGI_MARK_NONEXISTING_GLYPHS);
|
||||||
if (ret != GDI_ERROR && glyph != 0xFFFF) {
|
if (ret != GDI_ERROR && glyph != 0xFFFF) {
|
||||||
mSpaceGlyph = glyph;
|
mSpaceGlyph = glyph;
|
||||||
|
|
|
@ -168,11 +168,27 @@ gfxWindowsSurface::OptimizeToDDB(HDC dc, const gfxIntSize& size, gfxImageFormat
|
||||||
return raw;
|
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,
|
nsresult gfxWindowsSurface::BeginPrinting(const nsAString& aTitle,
|
||||||
const nsAString& aPrintToFileName)
|
const nsAString& aPrintToFileName)
|
||||||
{
|
{
|
||||||
#define DOC_TITLE_LENGTH 30
|
#define DOC_TITLE_LENGTH 30
|
||||||
DOCINFOW docinfo;
|
DOCINFO docinfo;
|
||||||
|
|
||||||
nsString titleStr;
|
nsString titleStr;
|
||||||
titleStr = aTitle;
|
titleStr = aTitle;
|
||||||
|
@ -180,21 +196,23 @@ nsresult gfxWindowsSurface::BeginPrinting(const nsAString& aTitle,
|
||||||
titleStr.SetLength(DOC_TITLE_LENGTH-3);
|
titleStr.SetLength(DOC_TITLE_LENGTH-3);
|
||||||
titleStr.AppendLiteral("...");
|
titleStr.AppendLiteral("...");
|
||||||
}
|
}
|
||||||
nsPromiseFlatString flatTitleStr(titleStr);
|
char *title = GetACPString(titleStr);
|
||||||
const PRUnichar *title = (const PRUnichar*)(flatTitleStr.get());
|
|
||||||
const PRUnichar *docName = nsnull;
|
char *docName = nsnull;
|
||||||
nsPromiseFlatString printToFileNameStr(aPrintToFileName);
|
|
||||||
if (!aPrintToFileName.IsEmpty()) {
|
if (!aPrintToFileName.IsEmpty()) {
|
||||||
docName = (const PRUnichar*)(printToFileNameStr.get());
|
docName = ToNewCString(aPrintToFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
docinfo.cbSize = sizeof(docinfo);
|
docinfo.cbSize = sizeof(docinfo);
|
||||||
docinfo.lpszDocName = title ? title : L"Mozilla Document";
|
docinfo.lpszDocName = title ? title : "Mozilla Document";
|
||||||
docinfo.lpszOutput = docName;
|
docinfo.lpszOutput = docName;
|
||||||
docinfo.lpszDatatype = NULL;
|
docinfo.lpszDatatype = NULL;
|
||||||
docinfo.fwType = 0;
|
docinfo.fwType = 0;
|
||||||
|
|
||||||
::StartDocW(mDC, &docinfo);
|
::StartDoc(mDC, &docinfo);
|
||||||
|
|
||||||
|
delete [] title;
|
||||||
|
if (docName != nsnull) nsMemory::Free(docName);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -133,7 +133,7 @@ nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACS
|
||||||
{
|
{
|
||||||
nsCOMPtr<nsIWin32Locale> winLocale;
|
nsCOMPtr<nsIWin32Locale> winLocale;
|
||||||
LCID localeAsLCID;
|
LCID localeAsLCID;
|
||||||
PRUnichar acp_name[6];
|
char acp_name[6];
|
||||||
|
|
||||||
//
|
//
|
||||||
// convert locale name to a code page (through the LCID)
|
// 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);
|
rv = winLocale->GetPlatformLocale(localeName, &localeAsLCID);
|
||||||
if (NS_FAILED(rv)) { return rv; }
|
if (NS_FAILED(rv)) { return rv; }
|
||||||
|
|
||||||
if (GetLocaleInfoW(localeAsLCID, LOCALE_IDEFAULTANSICODEPAGE, acp_name, sizeof(acp_name))==0) {
|
if (GetLocaleInfo(localeAsLCID, LOCALE_IDEFAULTANSICODEPAGE, acp_name, sizeof(acp_name))==0) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
nsAutoString acp_key(NS_LITERAL_STRING("acp."));
|
nsAutoString acp_key(NS_LITERAL_STRING("acp."));
|
||||||
acp_key.Append(acp_name);
|
acp_key.AppendWithConversion(acp_name);
|
||||||
|
|
||||||
return MapToCharset(acp_key, oResult);
|
return MapToCharset(acp_key, oResult);
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,7 +112,7 @@ ipcThreadWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
||||||
cd.dwData = GetCurrentProcessId();
|
cd.dwData = GetCurrentProcessId();
|
||||||
cd.cbData = (DWORD) msg->MsgLen();
|
cd.cbData = (DWORD) msg->MsgLen();
|
||||||
cd.lpData = (PVOID) msg->MsgBuf();
|
cd.lpData = (PVOID) msg->MsgBuf();
|
||||||
SendMessage(ipcDaemonHwnd, WM_COPYDATA, (WPARAM) hWnd, (LPARAM) &cd);
|
SendMessageA(ipcDaemonHwnd, WM_COPYDATA, (WPARAM) hWnd, (LPARAM) &cd);
|
||||||
LOG((" done.\n"));
|
LOG((" done.\n"));
|
||||||
delete msg;
|
delete msg;
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,6 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <shellapi.h>
|
#include <shellapi.h>
|
||||||
#include <shlobj.h>
|
#include <shlobj.h>
|
||||||
#include <wchar.h>
|
|
||||||
|
|
||||||
struct ICONFILEHEADER {
|
struct ICONFILEHEADER {
|
||||||
PRUint16 ifhReserved;
|
PRUint16 ifhReserved;
|
||||||
|
@ -190,7 +189,7 @@ nsIconChannel::Open(nsIInputStream **_retval)
|
||||||
return MakeInputStream(_retval, PR_FALSE);
|
return MakeInputStream(_retval, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsCString &aContentType, nsCString &aFileExtension)
|
nsresult nsIconChannel::ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension)
|
||||||
{
|
{
|
||||||
nsresult rv = NS_OK;
|
nsresult rv = NS_OK;
|
||||||
nsCOMPtr<nsIMozIconURI> iconURI (do_QueryInterface(mUrl, &rv));
|
nsCOMPtr<nsIMozIconURI> iconURI (do_QueryInterface(mUrl, &rv));
|
||||||
|
@ -237,28 +236,29 @@ NS_IMETHODIMP nsIconChannel::AsyncOpen(nsIStreamListener *aListener, nsISupports
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI, UINT aInfoFlags)
|
static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFO* aSFI, UINT aInfoFlags)
|
||||||
{
|
{
|
||||||
DWORD shellResult = 0;
|
DWORD shellResult = 0;
|
||||||
|
|
||||||
if (!aFile)
|
if (!aFile)
|
||||||
return shellResult;
|
return shellResult;
|
||||||
|
|
||||||
PRUnichar fileNativePath[MAX_PATH];
|
char fileNativePath[MAX_PATH];
|
||||||
nsAutoString fileNativePathStr;
|
nsCAutoString fileNativePathStr;
|
||||||
aFile->GetPath(fileNativePathStr);
|
aFile->GetNativePath(fileNativePathStr);
|
||||||
::GetShortPathNameW(fileNativePathStr.get(), fileNativePath, sizeof(fileNativePath));
|
::GetShortPathName(fileNativePathStr.get(), fileNativePath, sizeof(fileNativePath));
|
||||||
|
|
||||||
LPITEMIDLIST idList;
|
LPITEMIDLIST idList;
|
||||||
HRESULT hr = ::SHGetSpecialFolderLocation(NULL, aFolder, &idList);
|
HRESULT hr = ::SHGetSpecialFolderLocation(NULL, aFolder, &idList);
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
PRUnichar specialNativePath[MAX_PATH];
|
char specialNativePath[MAX_PATH];
|
||||||
::SHGetPathFromIDListW(idList, specialNativePath);
|
::SHGetPathFromIDList(idList, specialNativePath);
|
||||||
::GetShortPathNameW(specialNativePath, specialNativePath, sizeof(specialNativePath));
|
::GetShortPathName(specialNativePath, specialNativePath, sizeof(specialNativePath));
|
||||||
if (!wcsicmp(fileNativePath,specialNativePath)) {
|
|
||||||
|
if (nsDependentCString(fileNativePath).EqualsIgnoreCase(specialNativePath)) {
|
||||||
aInfoFlags |= (SHGFI_PIDL | SHGFI_SYSICONINDEX);
|
aInfoFlags |= (SHGFI_PIDL | SHGFI_SYSICONINDEX);
|
||||||
shellResult = ::SHGetFileInfoW((LPCWSTR)(LPCITEMIDLIST)idList, 0, aSFI,
|
shellResult = ::SHGetFileInfo((LPCTSTR)(LPCITEMIDLIST)idList, 0, aSFI,
|
||||||
sizeof(SHFILEINFOW), aInfoFlags);
|
sizeof(SHFILEINFO), aInfoFlags);
|
||||||
IMalloc* pMalloc;
|
IMalloc* pMalloc;
|
||||||
hr = ::SHGetMalloc(&pMalloc);
|
hr = ::SHGetMalloc(&pMalloc);
|
||||||
if (SUCCEEDED(hr)) {
|
if (SUCCEEDED(hr)) {
|
||||||
|
@ -273,14 +273,14 @@ static DWORD GetSpecialFolderIcon(nsIFile* aFile, int aFolder, SHFILEINFOW* aSFI
|
||||||
nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking)
|
nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking)
|
||||||
{
|
{
|
||||||
nsXPIDLCString contentType;
|
nsXPIDLCString contentType;
|
||||||
nsCString filePath;
|
nsCAutoString filePath;
|
||||||
nsCOMPtr<nsIFile> localFile; // file we want an icon for
|
nsCOMPtr<nsIFile> localFile; // file we want an icon for
|
||||||
PRUint32 desiredImageSize;
|
PRUint32 desiredImageSize;
|
||||||
nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(localFile), &desiredImageSize, contentType, filePath);
|
nsresult rv = ExtractIconInfoFromUrl(getter_AddRefs(localFile), &desiredImageSize, contentType, filePath);
|
||||||
NS_ENSURE_SUCCESS(rv, rv);
|
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...
|
// if the file exists, we are going to use it's real attributes...otherwise we only want to use it for it's extension...
|
||||||
SHFILEINFOW sfi;
|
SHFILEINFO sfi;
|
||||||
UINT infoFlags = SHGFI_ICON;
|
UINT infoFlags = SHGFI_ICON;
|
||||||
|
|
||||||
PRBool fileExists = PR_FALSE;
|
PRBool fileExists = PR_FALSE;
|
||||||
|
@ -342,9 +342,7 @@ nsresult nsIconChannel::MakeInputStream(nsIInputStream** _retval, PRBool nonBloc
|
||||||
|
|
||||||
// Not a special folder, or something else failed above.
|
// Not a special folder, or something else failed above.
|
||||||
if (!shellResult)
|
if (!shellResult)
|
||||||
shellResult = ::SHGetFileInfoW(
|
shellResult = ::SHGetFileInfo(filePath.get(), FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags);
|
||||||
NS_ConvertUTF8toUTF16(filePath).get(),
|
|
||||||
FILE_ATTRIBUTE_ARCHIVE, &sfi, sizeof(sfi), infoFlags);
|
|
||||||
|
|
||||||
if (shellResult && sfi.hIcon)
|
if (shellResult && sfi.hIcon)
|
||||||
{
|
{
|
||||||
|
|
|
@ -77,7 +77,7 @@ protected:
|
||||||
nsCOMPtr<nsIInputStreamPump> mPump;
|
nsCOMPtr<nsIInputStreamPump> mPump;
|
||||||
nsCOMPtr<nsIStreamListener> mListener;
|
nsCOMPtr<nsIStreamListener> mListener;
|
||||||
|
|
||||||
nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsCString &aContentType, nsCString &aFileExtension);
|
nsresult ExtractIconInfoFromUrl(nsIFile ** aLocalFile, PRUint32 * aDesiredImageSize, nsACString &aContentType, nsACString &aFileExtension);
|
||||||
nsresult MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking);
|
nsresult MakeInputStream(nsIInputStream** _retval, PRBool nonBlocking);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -100,7 +100,7 @@ nsSymantecDebugManager::SetDebugAgentPassword(PRInt32 pwd)
|
||||||
// ("SetWindowLong returned %ld (err=%d)\n", err, GetLastError()));
|
// ("SetWindowLong returned %ld (err=%d)\n", err, GetLastError()));
|
||||||
/* continue so that we try to wake up the DebugManager */
|
/* continue so that we try to wake up the DebugManager */
|
||||||
}
|
}
|
||||||
sem = OpenSemaphoreW(SEMAPHORE_MODIFY_STATE, FALSE, L"Netscape-Symantec Debugger");
|
sem = OpenSemaphore(SEMAPHORE_MODIFY_STATE, FALSE, "Netscape-Symantec Debugger");
|
||||||
if (sem) {
|
if (sem) {
|
||||||
ReleaseSemaphore(sem, 1, NULL);
|
ReleaseSemaphore(sem, 1, NULL);
|
||||||
CloseHandle(sem);
|
CloseHandle(sem);
|
||||||
|
|
|
@ -66,14 +66,14 @@ ClearVersion(verBlock *ver)
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
FileExists(wchar_t* szFile)
|
FileExists(LPCSTR szFile)
|
||||||
{
|
{
|
||||||
return GetFileAttributesW(szFile) != 0xFFFFFFFF;
|
return GetFileAttributes(szFile) != 0xFFFFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get file version information from a file
|
// Get file version information from a file
|
||||||
static BOOL
|
static BOOL
|
||||||
GetFileVersion(wchar_t* szFile, verBlock *vbVersion)
|
GetFileVersion(LPSTR szFile, verBlock *vbVersion)
|
||||||
{
|
{
|
||||||
UINT uLen;
|
UINT uLen;
|
||||||
UINT dwLen;
|
UINT dwLen;
|
||||||
|
@ -86,12 +86,12 @@ GetFileVersion(wchar_t* szFile, verBlock *vbVersion)
|
||||||
ClearVersion(vbVersion);
|
ClearVersion(vbVersion);
|
||||||
if (FileExists(szFile)) {
|
if (FileExists(szFile)) {
|
||||||
bRv = TRUE;
|
bRv = TRUE;
|
||||||
dwLen = GetFileVersionInfoSizeW(szFile, &dwHandle);
|
dwLen = GetFileVersionInfoSize(szFile, &dwHandle);
|
||||||
lpData = (LPVOID)malloc(dwLen);
|
lpData = (LPVOID)malloc(dwLen);
|
||||||
uLen = 0;
|
uLen = 0;
|
||||||
|
|
||||||
if (lpData && GetFileVersionInfoW(szFile, dwHandle, dwLen, lpData) != 0) {
|
if (lpData && GetFileVersionInfo(szFile, dwHandle, dwLen, lpData) != 0) {
|
||||||
if (VerQueryValueW(lpData, L"\\", &lpBuffer, &uLen) != 0) {
|
if (VerQueryValue(lpData, "\\", &lpBuffer, &uLen) != 0) {
|
||||||
lpBuffer2 = (VS_FIXEDFILEINFO *)lpBuffer;
|
lpBuffer2 = (VS_FIXEDFILEINFO *)lpBuffer;
|
||||||
|
|
||||||
vbVersion->wMajor = HIWORD(lpBuffer2->dwFileVersionMS);
|
vbVersion->wMajor = HIWORD(lpBuffer2->dwFileVersionMS);
|
||||||
|
@ -124,15 +124,15 @@ CopyVersion(verBlock *ver1, verBlock *ver2)
|
||||||
static void
|
static void
|
||||||
TranslateVersionStr(const char* szVersion, verBlock *vbVersion)
|
TranslateVersionStr(const char* szVersion, verBlock *vbVersion)
|
||||||
{
|
{
|
||||||
char* szNum1 = NULL;
|
LPSTR szNum1 = NULL;
|
||||||
char* szNum2 = NULL;
|
LPSTR szNum2 = NULL;
|
||||||
char* szNum3 = NULL;
|
LPSTR szNum3 = NULL;
|
||||||
char* szNum4 = NULL;
|
LPSTR szNum4 = NULL;
|
||||||
char* szJavaBuild = NULL;
|
LPSTR szJavaBuild = NULL;
|
||||||
|
|
||||||
char* strVer = nsnull;
|
char *strVer = nsnull;
|
||||||
if (szVersion) {
|
if (szVersion) {
|
||||||
strVer = strdup(szVersion);
|
strVer = PL_strdup(szVersion);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strVer) {
|
if (!strVer) {
|
||||||
|
@ -157,7 +157,7 @@ TranslateVersionStr(const char* szVersion, verBlock *vbVersion)
|
||||||
vbVersion->wRelease = szNum3 ? atoi(szNum3) : 0;
|
vbVersion->wRelease = szNum3 ? atoi(szNum3) : 0;
|
||||||
vbVersion->wBuild = szNum4 ? atoi(szNum4) : 0;
|
vbVersion->wBuild = szNum4 ? atoi(szNum4) : 0;
|
||||||
|
|
||||||
free(strVer);
|
PL_strfree(strVer);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Compare two version struct, return zero if the same
|
// Compare two version struct, return zero if the same
|
||||||
|
@ -195,28 +195,26 @@ CompareVersion(verBlock vbVersionOld, verBlock vbVersionNew)
|
||||||
// Indicate whether we should try to use the new NPRuntime-based Java
|
// Indicate whether we should try to use the new NPRuntime-based Java
|
||||||
// Plug-In if it's available
|
// Plug-In if it's available
|
||||||
static PRBool
|
static PRBool
|
||||||
TryToUseNPRuntimeJavaPlugIn(const wchar_t* javaVersion)
|
TryToUseNPRuntimeJavaPlugIn(const char* javaVersion)
|
||||||
{
|
{
|
||||||
HKEY javaKey = NULL;
|
HKEY javaKey = NULL;
|
||||||
wchar_t keyName[_MAX_PATH];
|
char keyName[_MAX_PATH];
|
||||||
|
keyName[0] = 0;
|
||||||
wcsncpy(keyName, L"Software\\JavaSoft\\Java Plug-in\\", wcslen(L"Software\\JavaSoft\\Java Plug-in\\"));
|
PL_strcat(keyName, "Software\\JavaSoft\\Java Plug-in\\");
|
||||||
wcscpy(keyName, javaVersion);
|
PL_strcat(keyName, javaVersion);
|
||||||
|
|
||||||
DWORD val;
|
DWORD val;
|
||||||
DWORD valSize = sizeof(DWORD);
|
DWORD valSize = sizeof(DWORD);
|
||||||
|
|
||||||
if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
keyName, 0, KEY_READ, &javaKey)) {
|
keyName, 0, KEY_READ, &javaKey)) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Look for "UseNewJavaPlugin"
|
// Look for "UseNewJavaPlugin"
|
||||||
if (ERROR_SUCCESS != ::RegQueryValueExW(javaKey,
|
if (ERROR_SUCCESS != ::RegQueryValueEx(javaKey, "UseNewJavaPlugin",
|
||||||
L"UseNewJavaPlugin",
|
NULL, NULL,
|
||||||
NULL, NULL,
|
(LPBYTE) &val,
|
||||||
(LPBYTE) &val,
|
&valSize)) {
|
||||||
&valSize)) {
|
|
||||||
val = 0;
|
val = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +262,7 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(prop, NS_WIN_4DOTX_SCAN_KEY) == 0) {
|
if (nsCRT::strcmp(prop, NS_WIN_4DOTX_SCAN_KEY) == 0) {
|
||||||
// Check our prefs to see if scanning the 4.x folder has been
|
// 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
|
// explictly overriden failure to get the pref is okay, we'll do
|
||||||
// what we've been doing -- a filtered scan
|
// what we've been doing -- a filtered scan
|
||||||
|
@ -279,38 +277,38 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
HKEY keyloc;
|
HKEY keyloc;
|
||||||
long result;
|
long result;
|
||||||
DWORD type;
|
DWORD type;
|
||||||
wchar_t szKey[_MAX_PATH] = L"Software\\Netscape\\Netscape Navigator";
|
char szKey[_MAX_PATH] = "Software\\Netscape\\Netscape Navigator";
|
||||||
wchar_t path[_MAX_PATH];
|
char path[_MAX_PATH];
|
||||||
|
|
||||||
result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc);
|
result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc);
|
||||||
|
|
||||||
if (result == ERROR_SUCCESS) {
|
if (result == ERROR_SUCCESS) {
|
||||||
wchar_t current_version[80];
|
char current_version[80];
|
||||||
DWORD length = sizeof(current_version);
|
DWORD length = sizeof(current_version);
|
||||||
|
|
||||||
result = ::RegQueryValueExW(keyloc, L"CurrentVersion", NULL, &type,
|
result = ::RegQueryValueEx(keyloc, "CurrentVersion", NULL, &type,
|
||||||
(LPBYTE)¤t_version, &length);
|
(LPBYTE)¤t_version, &length);
|
||||||
|
|
||||||
::RegCloseKey(keyloc);
|
::RegCloseKey(keyloc);
|
||||||
wcscat(szKey, L"\\");
|
PL_strcat(szKey, "\\");
|
||||||
wcscat(szKey, current_version);
|
PL_strcat(szKey, current_version);
|
||||||
wcscat(szKey, L"\\Main");
|
PL_strcat(szKey, "\\Main");
|
||||||
result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc);
|
result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc);
|
||||||
|
|
||||||
if (result == ERROR_SUCCESS) {
|
if (result == ERROR_SUCCESS) {
|
||||||
DWORD pathlen = sizeof(path);
|
DWORD pathlen = sizeof(path);
|
||||||
|
|
||||||
result = ::RegQueryValueExW(keyloc, L"Plugins Directory", NULL, &type,
|
result = ::RegQueryValueEx(keyloc, "Plugins Directory", NULL, &type,
|
||||||
(LPBYTE)&path, &pathlen);
|
(LPBYTE)&path, &pathlen);
|
||||||
if (result == ERROR_SUCCESS) {
|
if (result == ERROR_SUCCESS) {
|
||||||
rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE,
|
rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE,
|
||||||
getter_AddRefs(localFile));
|
getter_AddRefs(localFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
::RegCloseKey(keyloc);
|
::RegCloseKey(keyloc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (strcmp(prop, NS_WIN_JRE_SCAN_KEY) == 0) {
|
} else if (nsCRT::strcmp(prop, NS_WIN_JRE_SCAN_KEY) == 0) {
|
||||||
nsXPIDLCString strVer;
|
nsXPIDLCString strVer;
|
||||||
#ifdef OJI
|
#ifdef OJI
|
||||||
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
|
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
|
||||||
|
@ -330,25 +328,24 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
DWORD pathlen;
|
DWORD pathlen;
|
||||||
verBlock maxVer;
|
verBlock maxVer;
|
||||||
ClearVersion(&maxVer);
|
ClearVersion(&maxVer);
|
||||||
wchar_t curKey[_MAX_PATH] = L"Software\\JavaSoft\\Java Runtime Environment";
|
char curKey[_MAX_PATH] = "Software\\JavaSoft\\Java Runtime Environment";
|
||||||
wchar_t path[_MAX_PATH];
|
char path[_MAX_PATH];
|
||||||
|
|
||||||
// Add + 15 to prevent buffer overrun when adding \bin (+ optionally
|
// Add + 15 to prevent buffer overrun when adding \bin (+ optionally
|
||||||
// \new_plugin)
|
// \new_plugin)
|
||||||
#define JAVA_PATH_SIZE _MAX_PATH + 15
|
#define JAVA_PATH_SIZE _MAX_PATH + 15
|
||||||
wchar_t newestPath[JAVA_PATH_SIZE];
|
char newestPath[JAVA_PATH_SIZE];
|
||||||
const wchar_t mozPath[_MAX_PATH] = L"Software\\mozilla.org\\Mozilla";
|
const char mozPath[_MAX_PATH] = "Software\\mozilla.org\\Mozilla";
|
||||||
wchar_t browserJavaVersion[_MAX_PATH];
|
char browserJavaVersion[_MAX_PATH];
|
||||||
PRBool tryNPRuntimeJavaPlugIn = PR_FALSE;
|
PRBool tryNPRuntimeJavaPlugIn = PR_FALSE;
|
||||||
|
|
||||||
newestPath[0] = 0;
|
newestPath[0] = 0;
|
||||||
LONG result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ,
|
LONG result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ,
|
||||||
&baseloc);
|
&baseloc);
|
||||||
if (ERROR_SUCCESS != result)
|
if (ERROR_SUCCESS != result)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
// Look for "BrowserJavaVersion"
|
// Look for "BrowserJavaVersion"
|
||||||
if (ERROR_SUCCESS != ::RegQueryValueExW(baseloc, L"BrowserJavaVersion", NULL,
|
if (ERROR_SUCCESS != ::RegQueryValueEx(baseloc, "BrowserJavaVersion", NULL,
|
||||||
NULL, (LPBYTE)&browserJavaVersion,
|
NULL, (LPBYTE)&browserJavaVersion,
|
||||||
&numChars))
|
&numChars))
|
||||||
browserJavaVersion[0] = 0;
|
browserJavaVersion[0] = 0;
|
||||||
|
@ -359,13 +356,13 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
path[0] = 0;
|
path[0] = 0;
|
||||||
numChars = _MAX_PATH;
|
numChars = _MAX_PATH;
|
||||||
pathlen = sizeof(path);
|
pathlen = sizeof(path);
|
||||||
result = ::RegEnumKeyExW(baseloc, index, curKey, &numChars, NULL, NULL,
|
result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL,
|
||||||
NULL, &modTime);
|
NULL, &modTime);
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
// Skip major.minor as it always points to latest in its family
|
// Skip major.minor as it always points to latest in its family
|
||||||
numChars = 0;
|
numChars = 0;
|
||||||
for (wchar_t *p = curKey; *p; p++) { // can I do this with wchar_t xxx?
|
for (char *p = curKey; *p; p++) {
|
||||||
if (*p == '.') {
|
if (*p == '.') {
|
||||||
numChars++;
|
numChars++;
|
||||||
}
|
}
|
||||||
|
@ -374,24 +371,24 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (ERROR_SUCCESS == result) {
|
if (ERROR_SUCCESS == result) {
|
||||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, curKey, 0,
|
if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0,
|
||||||
KEY_QUERY_VALUE, &keyloc)) {
|
KEY_QUERY_VALUE, &keyloc)) {
|
||||||
// We have a sub key
|
// We have a sub key
|
||||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"JavaHome", NULL,
|
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "JavaHome", NULL,
|
||||||
&type, (LPBYTE)&path,
|
&type, (LPBYTE)&path,
|
||||||
&pathlen)) {
|
&pathlen)) {
|
||||||
verBlock curVer;
|
verBlock curVer;
|
||||||
TranslateVersionStr(NS_ConvertUTF16toUTF8(curKey).get(), &curVer);
|
TranslateVersionStr(curKey, &curVer);
|
||||||
if (CompareVersion(curVer, minVer) >= 0) {
|
if (CompareVersion(curVer, minVer) >= 0) {
|
||||||
if (!wcsncmp(browserJavaVersion, curKey, _MAX_PATH)) {
|
if (!strncmp(browserJavaVersion, curKey, _MAX_PATH)) {
|
||||||
wcscpy(newestPath, path);
|
PL_strcpy(newestPath, path);
|
||||||
tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey);
|
tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey);
|
||||||
::RegCloseKey(keyloc);
|
::RegCloseKey(keyloc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CompareVersion(curVer, maxVer) >= 0) {
|
if (CompareVersion(curVer, maxVer) >= 0) {
|
||||||
wcscpy(newestPath, path);
|
PL_strcpy(newestPath, path);
|
||||||
CopyVersion(&maxVer, &curVer);
|
CopyVersion(&maxVer, &curVer);
|
||||||
tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey);
|
tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey);
|
||||||
}
|
}
|
||||||
|
@ -407,20 +404,20 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
// If nothing is found, then don't add \bin dir and don't set
|
// If nothing is found, then don't add \bin dir and don't set
|
||||||
// CurrentVersion for Mozilla
|
// CurrentVersion for Mozilla
|
||||||
if (newestPath[0] != 0) {
|
if (newestPath[0] != 0) {
|
||||||
if (ERROR_SUCCESS == ::RegCreateKeyExW(HKEY_LOCAL_MACHINE, mozPath, 0,
|
if (ERROR_SUCCESS == ::RegCreateKeyEx(HKEY_LOCAL_MACHINE, mozPath, 0,
|
||||||
NULL, REG_OPTION_NON_VOLATILE,
|
NULL, REG_OPTION_NON_VOLATILE,
|
||||||
KEY_SET_VALUE|KEY_QUERY_VALUE,
|
KEY_SET_VALUE|KEY_QUERY_VALUE,
|
||||||
NULL, &entryloc, NULL)) {
|
NULL, &entryloc, NULL)) {
|
||||||
if (ERROR_SUCCESS != ::RegQueryValueExW(entryloc, L"CurrentVersion", 0,
|
if (ERROR_SUCCESS != ::RegQueryValueEx(entryloc, "CurrentVersion", 0,
|
||||||
NULL, NULL, NULL)) {
|
NULL, NULL, NULL)) {
|
||||||
::RegSetValueExW(entryloc, L"CurrentVersion", 0, REG_SZ,
|
::RegSetValueEx(entryloc, "CurrentVersion", 0, REG_SZ,
|
||||||
(const BYTE*)MOZILLA_VERSION,
|
(const BYTE*)MOZILLA_VERSION,
|
||||||
sizeof(MOZILLA_VERSION));
|
sizeof(MOZILLA_VERSION));
|
||||||
}
|
}
|
||||||
::RegCloseKey(entryloc);
|
::RegCloseKey(entryloc);
|
||||||
}
|
}
|
||||||
|
|
||||||
wcscat(newestPath,L"\\bin");
|
PL_strcat(newestPath,"\\bin");
|
||||||
|
|
||||||
// See whether we should use the new NPRuntime-based Java Plug-In:
|
// See whether we should use the new NPRuntime-based Java Plug-In:
|
||||||
// - If tryNPRuntimeJavaPlugIn is true, and
|
// - If tryNPRuntimeJavaPlugIn is true, and
|
||||||
|
@ -430,13 +427,13 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
// one any more.
|
// one any more.
|
||||||
if (tryNPRuntimeJavaPlugIn) {
|
if (tryNPRuntimeJavaPlugIn) {
|
||||||
// See whether the "new_plugin" directory exists
|
// See whether the "new_plugin" directory exists
|
||||||
wchar_t tmpPath[JAVA_PATH_SIZE];
|
char tmpPath[JAVA_PATH_SIZE];
|
||||||
wcscpy(tmpPath, newestPath);
|
PL_strcpy(tmpPath, newestPath);
|
||||||
wcscat(tmpPath, L"\\new_plugin");
|
PL_strcat(tmpPath, "\\new_plugin");
|
||||||
nsCOMPtr<nsILocalFile> tmpFile;
|
nsCOMPtr<nsILocalFile> tmpFile;
|
||||||
if (NS_SUCCEEDED(NS_NewLocalFile(nsDependentString(tmpPath),
|
if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(tmpPath),
|
||||||
PR_TRUE,
|
PR_TRUE,
|
||||||
getter_AddRefs(tmpFile))) &&
|
getter_AddRefs(tmpFile))) &&
|
||||||
tmpFile) {
|
tmpFile) {
|
||||||
PRBool exists = PR_FALSE;
|
PRBool exists = PR_FALSE;
|
||||||
PRBool isDir = PR_FALSE;
|
PRBool isDir = PR_FALSE;
|
||||||
|
@ -445,15 +442,15 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
// Assume we're supposed to use this as the search
|
// Assume we're supposed to use this as the search
|
||||||
// directory for the Java Plug-In instead of the normal
|
// directory for the Java Plug-In instead of the normal
|
||||||
// one
|
// one
|
||||||
wcscpy(newestPath, tmpPath);
|
PL_strcpy(newestPath, tmpPath);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = NS_NewLocalFile(nsDependentString(newestPath), PR_TRUE,
|
rv = NS_NewNativeLocalFile(nsDependentCString(newestPath), PR_TRUE,
|
||||||
getter_AddRefs(localFile));
|
getter_AddRefs(localFile));
|
||||||
}
|
}
|
||||||
} else if (strcmp(prop, NS_WIN_QUICKTIME_SCAN_KEY) == 0) {
|
} else if (nsCRT::strcmp(prop, NS_WIN_QUICKTIME_SCAN_KEY) == 0) {
|
||||||
nsXPIDLCString strVer;
|
nsXPIDLCString strVer;
|
||||||
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
|
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -466,33 +463,33 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
DWORD type;
|
DWORD type;
|
||||||
verBlock qtVer;
|
verBlock qtVer;
|
||||||
ClearVersion(&qtVer);
|
ClearVersion(&qtVer);
|
||||||
wchar_t path[_MAX_PATH];
|
char path[_MAX_PATH];
|
||||||
DWORD pathlen = sizeof(path);
|
DWORD pathlen = sizeof(path);
|
||||||
|
|
||||||
// First we need to check the version of Quicktime via checking
|
// First we need to check the version of Quicktime via checking
|
||||||
// the EXE's version table
|
// the EXE's version table
|
||||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\QuickTimePlayer.exe", 0, KEY_READ, &keyloc)) {
|
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\QuickTimePlayer.exe", 0, KEY_READ, &keyloc)) {
|
||||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type,
|
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type,
|
||||||
(LPBYTE)&path, &pathlen)) {
|
(LPBYTE)&path, &pathlen)) {
|
||||||
GetFileVersion(path, &qtVer);
|
GetFileVersion((char*)path, &qtVer);
|
||||||
}
|
}
|
||||||
::RegCloseKey(keyloc);
|
::RegCloseKey(keyloc);
|
||||||
}
|
}
|
||||||
if (CompareVersion(qtVer, minVer) < 0)
|
if (CompareVersion(qtVer, minVer) < 0)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Apple Computer, Inc.\\QuickTime", 0, KEY_READ, &keyloc)) {
|
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Apple Computer, Inc.\\QuickTime", 0, KEY_READ, &keyloc)) {
|
||||||
DWORD pathlen = sizeof(path);
|
DWORD pathlen = sizeof(path);
|
||||||
|
|
||||||
result = ::RegQueryValueExW(keyloc, L"InstallDir", NULL, &type,
|
result = ::RegQueryValueEx(keyloc, "InstallDir", NULL, &type,
|
||||||
(LPBYTE)&path, &pathlen);
|
(LPBYTE)&path, &pathlen);
|
||||||
wcscat(path, L"\\Plugins");
|
PL_strcat(path, "\\Plugins");
|
||||||
if (result == ERROR_SUCCESS)
|
if (result == ERROR_SUCCESS)
|
||||||
rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE,
|
rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE,
|
||||||
getter_AddRefs(localFile));
|
getter_AddRefs(localFile));
|
||||||
::RegCloseKey(keyloc);
|
::RegCloseKey(keyloc);
|
||||||
}
|
}
|
||||||
} else if (strcmp(prop, NS_WIN_WMP_SCAN_KEY) == 0) {
|
} else if (nsCRT::strcmp(prop, NS_WIN_WMP_SCAN_KEY) == 0) {
|
||||||
nsXPIDLCString strVer;
|
nsXPIDLCString strVer;
|
||||||
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
|
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -504,33 +501,33 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
DWORD type;
|
DWORD type;
|
||||||
verBlock wmpVer;
|
verBlock wmpVer;
|
||||||
ClearVersion(&wmpVer);
|
ClearVersion(&wmpVer);
|
||||||
wchar_t path[_MAX_PATH];
|
char path[_MAX_PATH];
|
||||||
DWORD pathlen = sizeof(path);
|
DWORD pathlen = sizeof(path);
|
||||||
|
|
||||||
// First we need to check the version of WMP
|
// First we need to check the version of WMP
|
||||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe", 0, KEY_READ, &keyloc)) {
|
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe", 0, KEY_READ, &keyloc)) {
|
||||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type,
|
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type,
|
||||||
(LPBYTE)&path, &pathlen)) {
|
(LPBYTE)&path, &pathlen)) {
|
||||||
GetFileVersion(path, &wmpVer);
|
GetFileVersion((char*)path, &wmpVer);
|
||||||
}
|
}
|
||||||
::RegCloseKey(keyloc);
|
::RegCloseKey(keyloc);
|
||||||
}
|
}
|
||||||
if (CompareVersion(wmpVer, minVer) < 0)
|
if (CompareVersion(wmpVer, minVer) < 0)
|
||||||
return rv;
|
return rv;
|
||||||
|
|
||||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
|
||||||
L"software\\Microsoft\\MediaPlayer", 0,
|
"software\\Microsoft\\MediaPlayer", 0,
|
||||||
KEY_READ, &keyloc)) {
|
KEY_READ, &keyloc)) {
|
||||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"Installation Directory",
|
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "Installation Directory",
|
||||||
NULL, &type, (LPBYTE)&path,
|
NULL, &type, (LPBYTE)&path,
|
||||||
&pathlen)) {
|
&pathlen)) {
|
||||||
rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE,
|
rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE,
|
||||||
getter_AddRefs(localFile));
|
getter_AddRefs(localFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
::RegCloseKey(keyloc);
|
::RegCloseKey(keyloc);
|
||||||
}
|
}
|
||||||
} else if (strcmp(prop, NS_WIN_ACROBAT_SCAN_KEY) == 0) {
|
} else if (nsCRT::strcmp(prop, NS_WIN_ACROBAT_SCAN_KEY) == 0) {
|
||||||
nsXPIDLCString strVer;
|
nsXPIDLCString strVer;
|
||||||
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) {
|
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -549,16 +546,16 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
DWORD pathlen;
|
DWORD pathlen;
|
||||||
verBlock maxVer;
|
verBlock maxVer;
|
||||||
ClearVersion(&maxVer);
|
ClearVersion(&maxVer);
|
||||||
wchar_t curKey[_MAX_PATH] = L"software\\Adobe\\Acrobat Reader";
|
char curKey[_MAX_PATH] = "software\\Adobe\\Acrobat Reader";
|
||||||
wchar_t path[_MAX_PATH];
|
char path[_MAX_PATH];
|
||||||
// Add + 8 to prevent buffer overrun when adding \browser
|
// Add + 8 to prevent buffer overrun when adding \browser
|
||||||
wchar_t newestPath[_MAX_PATH + 8];
|
char newestPath[_MAX_PATH + 8];
|
||||||
|
|
||||||
newestPath[0] = 0;
|
newestPath[0] = 0;
|
||||||
if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0,
|
if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0,
|
||||||
KEY_READ, &baseloc)) {
|
KEY_READ, &baseloc)) {
|
||||||
wcscpy(curKey, L"software\\Adobe\\Adobe Acrobat");
|
PL_strcpy(curKey, "software\\Adobe\\Adobe Acrobat");
|
||||||
if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0,
|
if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0,
|
||||||
KEY_READ, &baseloc)) {
|
KEY_READ, &baseloc)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
@ -571,22 +568,22 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
path[0] = 0;
|
path[0] = 0;
|
||||||
numChars = _MAX_PATH;
|
numChars = _MAX_PATH;
|
||||||
pathlen = sizeof(path);
|
pathlen = sizeof(path);
|
||||||
result = ::RegEnumKeyExW(baseloc, index, curKey, &numChars, NULL, NULL,
|
result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL,
|
||||||
NULL, &modTime);
|
NULL, &modTime);
|
||||||
index++;
|
index++;
|
||||||
|
|
||||||
if (ERROR_SUCCESS == result) {
|
if (ERROR_SUCCESS == result) {
|
||||||
verBlock curVer;
|
verBlock curVer;
|
||||||
TranslateVersionStr(NS_ConvertUTF16toUTF8(curKey).get(), &curVer);
|
TranslateVersionStr(curKey, &curVer);
|
||||||
wcscat(curKey, L"\\InstallPath");
|
PL_strcat(curKey, "\\InstallPath");
|
||||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, curKey, 0,
|
if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0,
|
||||||
KEY_QUERY_VALUE, &keyloc)) {
|
KEY_QUERY_VALUE, &keyloc)) {
|
||||||
// We have a sub key
|
// We have a sub key
|
||||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type,
|
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type,
|
||||||
(LPBYTE)&path, &pathlen)) {
|
(LPBYTE)&path, &pathlen)) {
|
||||||
if (CompareVersion(curVer, maxVer) >= 0 &&
|
if (CompareVersion(curVer, maxVer) >= 0 &&
|
||||||
CompareVersion(curVer, minVer) >= 0) {
|
CompareVersion(curVer, minVer) >= 0) {
|
||||||
wcscpy(newestPath, path);
|
PL_strcpy(newestPath, path);
|
||||||
CopyVersion(&maxVer, &curVer);
|
CopyVersion(&maxVer, &curVer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -599,9 +596,9 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
|
||||||
::RegCloseKey(baseloc);
|
::RegCloseKey(baseloc);
|
||||||
|
|
||||||
if (newestPath[0] != 0) {
|
if (newestPath[0] != 0) {
|
||||||
wcscat(newestPath, L"\\browser");
|
PL_strcat(newestPath,"\\browser");
|
||||||
rv = NS_NewLocalFile(nsDependentString(newestPath), PR_TRUE,
|
rv = NS_NewNativeLocalFile(nsDependentCString(newestPath), PR_TRUE,
|
||||||
getter_AddRefs(localFile));
|
getter_AddRefs(localFile));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -629,32 +626,32 @@ nsPluginDirServiceProvider::GetPLIDDirectories(nsISimpleEnumerator **aEnumerator
|
||||||
nsresult
|
nsresult
|
||||||
nsPluginDirServiceProvider::GetPLIDDirectoriesWithHKEY(HKEY aKey, nsCOMArray<nsILocalFile> &aDirs)
|
nsPluginDirServiceProvider::GetPLIDDirectoriesWithHKEY(HKEY aKey, nsCOMArray<nsILocalFile> &aDirs)
|
||||||
{
|
{
|
||||||
wchar_t subkey[_MAX_PATH] = L"Software\\MozillaPlugins";
|
char subkey[_MAX_PATH] = "Software\\MozillaPlugins";
|
||||||
HKEY baseloc;
|
HKEY baseloc;
|
||||||
|
|
||||||
if (ERROR_SUCCESS != ::RegOpenKeyExW(aKey, subkey, 0, KEY_READ, &baseloc))
|
if (ERROR_SUCCESS != ::RegOpenKeyEx(aKey, subkey, 0, KEY_READ, &baseloc))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
DWORD index = 0;
|
DWORD index = 0;
|
||||||
DWORD subkeylen = _MAX_PATH;
|
DWORD subkeylen = _MAX_PATH;
|
||||||
FILETIME modTime;
|
FILETIME modTime;
|
||||||
while (ERROR_SUCCESS == ::RegEnumKeyExW(baseloc, index++, subkey, &subkeylen,
|
while (ERROR_SUCCESS == ::RegEnumKeyEx(baseloc, index++, subkey, &subkeylen,
|
||||||
NULL, NULL, NULL, &modTime)) {
|
NULL, NULL, NULL, &modTime)) {
|
||||||
subkeylen = _MAX_PATH;
|
subkeylen = _MAX_PATH;
|
||||||
HKEY keyloc;
|
HKEY keyloc;
|
||||||
|
|
||||||
if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, subkey, 0, KEY_QUERY_VALUE,
|
if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, subkey, 0, KEY_QUERY_VALUE,
|
||||||
&keyloc)) {
|
&keyloc)) {
|
||||||
DWORD type;
|
DWORD type;
|
||||||
wchar_t path[_MAX_PATH];
|
char path[_MAX_PATH];
|
||||||
DWORD pathlen = sizeof(path);
|
DWORD pathlen = sizeof(path);
|
||||||
|
|
||||||
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"Path", NULL, &type,
|
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "Path", NULL, &type,
|
||||||
(LPBYTE)&path, &pathlen)) {
|
(LPBYTE)&path, &pathlen)) {
|
||||||
nsCOMPtr<nsILocalFile> localFile;
|
nsCOMPtr<nsILocalFile> localFile;
|
||||||
if (NS_SUCCEEDED(NS_NewLocalFile(nsDependentString(path),
|
if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(path),
|
||||||
PR_TRUE,
|
PR_TRUE,
|
||||||
getter_AddRefs(localFile))) &&
|
getter_AddRefs(localFile))) &&
|
||||||
localFile) {
|
localFile) {
|
||||||
// Some vendors use a path directly to the DLL so chop off
|
// Some vendors use a path directly to the DLL so chop off
|
||||||
// the filename
|
// the filename
|
||||||
|
|
|
@ -4017,18 +4017,18 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType,
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
static BOOL firstJavaPlugin = FALSE;
|
static BOOL firstJavaPlugin = FALSE;
|
||||||
BOOL restoreOrigDir = FALSE;
|
BOOL restoreOrigDir = FALSE;
|
||||||
PRUnichar origDir[_MAX_PATH];
|
char origDir[_MAX_PATH];
|
||||||
if (isJavaPlugin && !firstJavaPlugin) {
|
if (isJavaPlugin && !firstJavaPlugin) {
|
||||||
DWORD dw = ::GetCurrentDirectoryW(_MAX_PATH, origDir);
|
DWORD dw = ::GetCurrentDirectory(_MAX_PATH, origDir);
|
||||||
NS_ASSERTION(dw <= _MAX_PATH, "Falied to obtain the current directory, which may leads to incorrect class laoding");
|
NS_ASSERTION(dw <= _MAX_PATH, "Falied to obtain the current directory, which may leads to incorrect class laoding");
|
||||||
nsCOMPtr<nsIFile> binDirectory;
|
nsCOMPtr<nsIFile> binDirectory;
|
||||||
result = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR,
|
result = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR,
|
||||||
getter_AddRefs(binDirectory));
|
getter_AddRefs(binDirectory));
|
||||||
|
|
||||||
if (NS_SUCCEEDED(result)) {
|
if (NS_SUCCEEDED(result)) {
|
||||||
nsAutoString path;
|
nsCAutoString path;
|
||||||
binDirectory->GetPath(path);
|
binDirectory->GetNativePath(path);
|
||||||
restoreOrigDir = ::SetCurrentDirectoryW(path.get());
|
restoreOrigDir = ::SetCurrentDirectory(path.get());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -4036,7 +4036,7 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType,
|
||||||
|
|
||||||
#ifdef XP_WIN
|
#ifdef XP_WIN
|
||||||
if (!firstJavaPlugin && restoreOrigDir) {
|
if (!firstJavaPlugin && restoreOrigDir) {
|
||||||
BOOL bCheck = ::SetCurrentDirectoryW(origDir);
|
BOOL bCheck = ::SetCurrentDirectory(origDir);
|
||||||
NS_ASSERTION(bCheck, " Error restoring driectoy");
|
NS_ASSERTION(bCheck, " Error restoring driectoy");
|
||||||
firstJavaPlugin = TRUE;
|
firstJavaPlugin = TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@
|
||||||
|
|
||||||
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); // needed for NS_TRY_SAFE_CALL
|
static NS_DEFINE_CID(kCPluginManagerCID, NS_PLUGINMANAGER_CID); // needed for NS_TRY_SAFE_CALL
|
||||||
|
|
||||||
#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION L"MozillaPluginWindowPropertyAssociation"
|
#define NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION "MozillaPluginWindowPropertyAssociation"
|
||||||
|
|
||||||
typedef nsTWeakRef<class nsPluginNativeWindowWin> PluginWindowWeakRef;
|
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)
|
static LRESULT CALLBACK PluginWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
|
||||||
{
|
{
|
||||||
nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||||
if (!win)
|
if (!win)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
|
@ -526,10 +526,10 @@ nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow()
|
||||||
if (!mPluginWinProc)
|
if (!mPluginWinProc)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
nsPluginNativeWindowWin * win = (nsPluginNativeWindowWin *)::GetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||||
NS_ASSERTION(!win || (win == this), "plugin window already has property and this is not us");
|
NS_ASSERTION(!win || (win == this), "plugin window already has property and this is not us");
|
||||||
|
|
||||||
if (!::SetPropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (HANDLE)this))
|
if (!::SetProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION, (HANDLE)this))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -543,7 +543,7 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()
|
||||||
// remove window property
|
// remove window property
|
||||||
HWND hWnd = (HWND)window;
|
HWND hWnd = (HWND)window;
|
||||||
if (IsWindow(hWnd))
|
if (IsWindow(hWnd))
|
||||||
::RemovePropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
::RemoveProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
|
||||||
|
|
||||||
// restore the original win proc
|
// restore the original win proc
|
||||||
// but only do this if this were us last time
|
// but only do this if this were us last time
|
||||||
|
|
|
@ -58,18 +58,25 @@
|
||||||
|
|
||||||
/* Local helper functions */
|
/* Local helper functions */
|
||||||
|
|
||||||
static char* GetKeyValue(wchar_t* verbuf, wchar_t* key)
|
static char* GetKeyValue(char* verbuf, char* key)
|
||||||
{
|
{
|
||||||
wchar_t *buf = NULL;
|
char *buf = NULL;
|
||||||
UINT blen;
|
UINT blen;
|
||||||
|
|
||||||
::VerQueryValueW(verbuf,
|
::VerQueryValue(verbuf,
|
||||||
key,
|
TEXT(key),
|
||||||
(void **)&buf, &blen);
|
(void **)&buf, &blen);
|
||||||
|
|
||||||
if(buf != NULL)
|
if(buf != NULL)
|
||||||
{
|
{
|
||||||
return strdup(NS_ConvertUTF16toUTF8(buf).get());
|
#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 nsnull;
|
return nsnull;
|
||||||
|
@ -209,35 +216,35 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
|
||||||
if (!mPlugin)
|
if (!mPlugin)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsAutoString temp;
|
nsCAutoString temp;
|
||||||
mPlugin->GetPath(temp);
|
mPlugin->GetNativePath(temp);
|
||||||
|
|
||||||
PRUnichar* index;
|
char* index;
|
||||||
PRUnichar* pluginFolderPath = _wcsdup(temp.get());
|
char* pluginFolderPath = PL_strdup(temp.get());
|
||||||
|
|
||||||
index = wcsrchr(pluginFolderPath, '\\');
|
index = PL_strrchr(pluginFolderPath, '\\');
|
||||||
*index = 0;
|
*index = 0;
|
||||||
|
|
||||||
BOOL restoreOrigDir = FALSE;
|
BOOL restoreOrigDir = FALSE;
|
||||||
PRUnichar aOrigDir[MAX_PATH + 1];
|
char aOrigDir[MAX_PATH + 1];
|
||||||
DWORD dwCheck = ::GetCurrentDirectoryW(sizeof(aOrigDir), aOrigDir);
|
DWORD dwCheck = ::GetCurrentDirectory(sizeof(aOrigDir), aOrigDir);
|
||||||
NS_ASSERTION(dwCheck <= MAX_PATH + 1, "Error in Loading plugin");
|
NS_ASSERTION(dwCheck <= MAX_PATH + 1, "Error in Loading plugin");
|
||||||
|
|
||||||
if (dwCheck <= MAX_PATH + 1)
|
if (dwCheck <= MAX_PATH + 1)
|
||||||
{
|
{
|
||||||
restoreOrigDir = ::SetCurrentDirectoryW(pluginFolderPath);
|
restoreOrigDir = ::SetCurrentDirectory(pluginFolderPath);
|
||||||
NS_ASSERTION(restoreOrigDir, "Error in Loading plugin");
|
NS_ASSERTION(restoreOrigDir, "Error in Loading plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
outLibrary = PR_LoadLibrary(NS_ConvertUTF16toUTF8(temp).get());
|
outLibrary = PR_LoadLibrary(temp.get());
|
||||||
|
|
||||||
if (restoreOrigDir)
|
if (restoreOrigDir)
|
||||||
{
|
{
|
||||||
BOOL bCheck = ::SetCurrentDirectoryW(aOrigDir);
|
BOOL bCheck = ::SetCurrentDirectory(aOrigDir);
|
||||||
NS_ASSERTION(bCheck, "Error in Loading plugin");
|
NS_ASSERTION(bCheck, "Error in Loading plugin");
|
||||||
}
|
}
|
||||||
|
|
||||||
free(pluginFolderPath);
|
PL_strfree(pluginFolderPath);
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -249,39 +256,37 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
|
||||||
{
|
{
|
||||||
nsresult res = NS_OK;
|
nsresult res = NS_OK;
|
||||||
DWORD zerome, versionsize;
|
DWORD zerome, versionsize;
|
||||||
PRUnichar* verbuf = nsnull;
|
char* verbuf = nsnull;
|
||||||
|
|
||||||
const PRUnichar* path;
|
const char* path;
|
||||||
|
|
||||||
if (!mPlugin)
|
if (!mPlugin)
|
||||||
return NS_ERROR_NULL_POINTER;
|
return NS_ERROR_NULL_POINTER;
|
||||||
|
|
||||||
nsAutoString temp;
|
nsCAutoString temp;
|
||||||
mPlugin->GetPath(temp);
|
mPlugin->GetNativePath(temp);
|
||||||
path = temp.get();
|
path = temp.get();
|
||||||
|
|
||||||
versionsize = ::GetFileVersionInfoSizeW(path, &zerome);
|
versionsize = ::GetFileVersionInfoSize((char*)path, &zerome);
|
||||||
if (versionsize > 0)
|
if (versionsize > 0)
|
||||||
verbuf = (wchar_t *)PR_Malloc(versionsize);
|
verbuf = (char *)PR_Malloc(versionsize);
|
||||||
if(!verbuf)
|
if(!verbuf)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
if(::GetFileVersionInfoW(path, NULL, versionsize, verbuf))
|
if(::GetFileVersionInfo((char*)path, NULL, versionsize, verbuf))
|
||||||
{
|
{
|
||||||
info.fName = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\ProductName");
|
info.fName = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\ProductName");
|
||||||
info.fDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileDescription");
|
info.fDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileDescription");
|
||||||
|
|
||||||
char *mimeType = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\MIMEType");
|
char *mimeType = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\MIMEType");
|
||||||
char *mimeDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileOpenName");
|
char *mimeDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileOpenName");
|
||||||
char *extensions = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileExtents");
|
char *extensions = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileExtents");
|
||||||
|
|
||||||
info.fVariantCount = CalculateVariantCount(mimeType);
|
info.fVariantCount = CalculateVariantCount(mimeType);
|
||||||
info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType);
|
info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType);
|
||||||
info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription);
|
info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription);
|
||||||
info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions);
|
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(mimeType);
|
||||||
PL_strfree(mimeDescription);
|
PL_strfree(mimeDescription);
|
||||||
|
|
|
@ -79,18 +79,17 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
|
||||||
|
|
||||||
pPlugin->m_hWndDialog = hWnd;
|
pPlugin->m_hWndDialog = hWnd;
|
||||||
|
|
||||||
wchar_t szString[512];
|
char szString[512];
|
||||||
LoadStringW(hInst, IDS_TITLE, szString, sizeof(szString));
|
LoadString(hInst, IDS_TITLE, szString, sizeof(szString));
|
||||||
SetWindowTextW(hWnd, szString);
|
SetWindowText(hWnd, szString);
|
||||||
|
|
||||||
LoadStringW(hInst, IDS_INFO, szString, sizeof(szString));
|
LoadString(hInst, IDS_INFO, szString, sizeof(szString));
|
||||||
SetDlgItemTextW(hWnd, IDC_STATIC_INFO, szString);
|
SetDlgItemText(hWnd, IDC_STATIC_INFO, szString);
|
||||||
|
|
||||||
// convert m_pNPMIMEType dougt
|
SetDlgItemText(hWnd, IDC_STATIC_INFOTYPE, (LPSTR)pPlugin->m_pNPMIMEType);
|
||||||
SetDlgItemTextA(hWnd, IDC_STATIC_INFOTYPE, pPlugin->m_pNPMIMEType);
|
|
||||||
|
|
||||||
LoadStringW(hInst, IDS_LOCATION, szString, sizeof(szString));
|
LoadString(hInst, IDS_LOCATION, szString, sizeof(szString));
|
||||||
SetDlgItemTextW(hWnd, IDC_STATIC_LOCATION, szString);
|
SetDlgItemText(hWnd, IDC_STATIC_LOCATION, szString);
|
||||||
|
|
||||||
char contentTypeIsJava = 0;
|
char contentTypeIsJava = 0;
|
||||||
|
|
||||||
|
@ -100,36 +99,30 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(pPlugin->m_szPageURL == NULL || contentTypeIsJava)
|
if(pPlugin->m_szPageURL == NULL || contentTypeIsJava)
|
||||||
LoadStringW(hInst, IDS_FINDER_PAGE, szString, sizeof(szString));
|
LoadString(hInst, IDS_FINDER_PAGE, szString, sizeof(szString));
|
||||||
else
|
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);
|
SetDlgItemTextWrapped(hWnd, IDC_STATIC_URL, szString);
|
||||||
|
|
||||||
LoadStringW(hInst, IDS_QUESTION, szString, sizeof(szString));
|
LoadString(hInst, IDS_QUESTION, szString, sizeof(szString));
|
||||||
SetDlgItemTextW(hWnd, IDC_STATIC_QUESTION, szString);
|
SetDlgItemText(hWnd, IDC_STATIC_QUESTION, szString);
|
||||||
|
|
||||||
SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, L"");
|
SetDlgItemText(hWnd, IDC_STATIC_WARNING, "");
|
||||||
|
|
||||||
if(!pPlugin->m_bOnline)
|
if(!pPlugin->m_bOnline)
|
||||||
{
|
{
|
||||||
EnableWindow(GetDlgItem(hWnd, IDC_GET_PLUGIN), FALSE);
|
EnableWindow(GetDlgItem(hWnd, IDC_GET_PLUGIN), FALSE);
|
||||||
LoadStringW(hInst, IDS_WARNING_OFFLINE, szString, sizeof(szString));
|
LoadString(hInst, IDS_WARNING_OFFLINE, szString, sizeof(szString));
|
||||||
SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, szString);
|
SetDlgItemText(hWnd, IDC_STATIC_WARNING, szString);
|
||||||
SetDlgItemTextW(hWnd, IDC_STATIC_QUESTION, L"");
|
SetDlgItemText(hWnd, IDC_STATIC_QUESTION, "");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if((!pPlugin->m_bJava) || (!pPlugin->m_bJavaScript) || (!pPlugin->m_bSmartUpdate))
|
if((!pPlugin->m_bJava) || (!pPlugin->m_bJavaScript) || (!pPlugin->m_bSmartUpdate))
|
||||||
{
|
{
|
||||||
LoadStringW(hInst, IDS_WARNING_JS, szString, sizeof(szString));
|
LoadString(hInst, IDS_WARNING_JS, szString, sizeof(szString));
|
||||||
SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, szString);
|
SetDlgItemText(hWnd, IDC_STATIC_WARNING, szString);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,18 +86,18 @@ NPError NP_LOADDS NPP_New(NPMIMEType pluginType,
|
||||||
|
|
||||||
for(int i = 0; i < argc; i++)
|
for(int i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
if(strcmpi(argn[i],"pluginspage") == 0 && argv[i] != NULL)
|
if(lstrcmpi(argn[i],"pluginspage") == 0 && argv[i] != NULL)
|
||||||
szPageURL = (char *)argv[i];
|
szPageURL = (char *)argv[i];
|
||||||
else if(strcmpi(argn[i],"codebase") == 0 && argv[i] != NULL)
|
else if(lstrcmpi(argn[i],"codebase") == 0 && argv[i] != NULL)
|
||||||
szPageURL = (char *)argv[i];
|
szPageURL = (char *)argv[i];
|
||||||
else if(strcmpi(argn[i],"pluginurl") == 0 && argv[i] != NULL)
|
else if(lstrcmpi(argn[i],"pluginurl") == 0 && argv[i] != NULL)
|
||||||
szFileURL = (char *)argv[i];
|
szFileURL = (char *)argv[i];
|
||||||
else if(strcmpi(argn[i],"classid") == 0 && argv[i] != NULL)
|
else if(lstrcmpi(argn[i],"classid") == 0 && argv[i] != NULL)
|
||||||
szFileURL = (char *)argv[i];
|
szFileURL = (char *)argv[i];
|
||||||
else if(strcmpi(argn[i],"SRC") == 0 && argv[i] != NULL)
|
else if(lstrcmpi(argn[i],"SRC") == 0 && argv[i] != NULL)
|
||||||
buf = (char *)argv[i];
|
buf = (char *)argv[i];
|
||||||
else if(strcmpi(argn[i],"HIDDEN") == 0 && argv[i] != NULL)
|
else if(lstrcmpi(argn[i],"HIDDEN") == 0 && argv[i] != NULL)
|
||||||
bHidden = (strcmp((char *)argv[i], "TRUE") == 0);
|
bHidden = (lstrcmp((char *)argv[i], "TRUE") == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* some post-processing on the filename to attempt to extract the extension: */
|
/* some post-processing on the filename to attempt to extract the extension: */
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
nsIServiceManager * gServiceManager = NULL;
|
nsIServiceManager * gServiceManager = NULL;
|
||||||
|
|
||||||
static wchar_t szNullPluginWindowClassName[] = CLASS_NULL_PLUGIN;
|
static char szNullPluginWindowClassName[] = CLASS_NULL_PLUGIN;
|
||||||
|
|
||||||
static LRESULT CALLBACK NP_LOADDS PluginWndProc(HWND, UINT, WPARAM, LPARAM);
|
static LRESULT CALLBACK NP_LOADDS PluginWndProc(HWND, UINT, WPARAM, LPARAM);
|
||||||
|
|
||||||
|
@ -66,7 +66,7 @@ BOOL RegisterNullPluginWindowClass()
|
||||||
{
|
{
|
||||||
assert(hInst != NULL);
|
assert(hInst != NULL);
|
||||||
|
|
||||||
WNDCLASSW wc;
|
WNDCLASS wc;
|
||||||
|
|
||||||
memset(&wc, 0, sizeof(wc));
|
memset(&wc, 0, sizeof(wc));
|
||||||
|
|
||||||
|
@ -78,14 +78,14 @@ BOOL RegisterNullPluginWindowClass()
|
||||||
wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1);
|
wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1);
|
||||||
wc.lpszClassName = szNullPluginWindowClassName;
|
wc.lpszClassName = szNullPluginWindowClassName;
|
||||||
|
|
||||||
ATOM aRet = RegisterClassW(&wc);
|
ATOM aRet = RegisterClass(&wc);
|
||||||
return (aRet != NULL);
|
return (aRet != NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnregisterNullPluginWindowClass()
|
void UnregisterNullPluginWindowClass()
|
||||||
{
|
{
|
||||||
assert(hInst != NULL);
|
assert(hInst != NULL);
|
||||||
UnregisterClassW(szNullPluginWindowClassName, hInst);
|
UnregisterClass(szNullPluginWindowClassName, hInst);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*********************************************/
|
/*********************************************/
|
||||||
|
@ -129,41 +129,41 @@ CPlugin::CPlugin(HINSTANCE hInst,
|
||||||
|
|
||||||
if(pluginType && *pluginType)
|
if(pluginType && *pluginType)
|
||||||
{
|
{
|
||||||
m_pNPMIMEType = (NPMIMEType) new char[strlen(pluginType) + 1];
|
m_pNPMIMEType = (NPMIMEType)new char[lstrlen((LPSTR)pluginType) + 1];
|
||||||
if(m_pNPMIMEType != NULL)
|
if(m_pNPMIMEType != NULL)
|
||||||
strcpy(m_pNPMIMEType, pluginType);
|
lstrcpy((LPSTR)m_pNPMIMEType, pluginType);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(szPageURL && *szPageURL)
|
if(szPageURL && *szPageURL)
|
||||||
{
|
{
|
||||||
m_szPageURL = new char[strlen(szPageURL) + 1];
|
m_szPageURL = new char[lstrlen(szPageURL) + 1];
|
||||||
if(m_szPageURL != NULL)
|
if(m_szPageURL != NULL)
|
||||||
strcpy(m_szPageURL, szPageURL);
|
lstrcpy(m_szPageURL, szPageURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(szFileURL && *szFileURL)
|
if(szFileURL && *szFileURL)
|
||||||
{
|
{
|
||||||
m_szFileURL = new char[strlen(szFileURL) + 1];
|
m_szFileURL = new char[lstrlen(szFileURL) + 1];
|
||||||
if(m_szFileURL != NULL)
|
if(m_szFileURL != NULL)
|
||||||
strcpy(m_szFileURL, szFileURL);
|
lstrcpy(m_szFileURL, szFileURL);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(szFileExtension && *szFileExtension)
|
if(szFileExtension && *szFileExtension)
|
||||||
{
|
{
|
||||||
m_szFileExtension = new char[strlen(szFileExtension) + 1];
|
m_szFileExtension = new char[lstrlen(szFileExtension) + 1];
|
||||||
if(m_szFileExtension != NULL)
|
if(m_szFileExtension != NULL)
|
||||||
strcpy(m_szFileExtension, szFileExtension);
|
lstrcpy(m_szFileExtension, szFileExtension);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_PLUGICON));
|
m_hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_PLUGICON));
|
||||||
|
|
||||||
wchar_t szString[1024] = {'\0'};
|
char szString[1024] = {'\0'};
|
||||||
LoadStringW(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString));
|
LoadString(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString));
|
||||||
if(*szString)
|
if(*szString)
|
||||||
{
|
{
|
||||||
m_szCommandMessage = new wchar_t[wcslen(szString) + 1];
|
m_szCommandMessage = new char[lstrlen(szString) + 1];
|
||||||
if(m_szCommandMessage != NULL)
|
if(m_szCommandMessage != NULL)
|
||||||
wcscpy(m_szCommandMessage, szString);
|
lstrcpy(m_szCommandMessage, szString);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,8 +253,8 @@ BOOL CPlugin::init(HWND hWndParent)
|
||||||
RECT rcParent;
|
RECT rcParent;
|
||||||
GetClientRect(m_hWndParent, &rcParent);
|
GetClientRect(m_hWndParent, &rcParent);
|
||||||
|
|
||||||
CreateWindowW(szNullPluginWindowClassName,
|
CreateWindow(szNullPluginWindowClassName,
|
||||||
L"NULL Plugin",
|
"NULL Plugin",
|
||||||
WS_CHILD,
|
WS_CHILD,
|
||||||
0,0, rcParent.right, rcParent.bottom,
|
0,0, rcParent.right, rcParent.bottom,
|
||||||
m_hWndParent,
|
m_hWndParent,
|
||||||
|
@ -332,10 +332,10 @@ LPSTR CPlugin::createURLString()
|
||||||
// check if there is file URL first
|
// check if there is file URL first
|
||||||
if(!m_bSmartUpdate && m_szFileURL != NULL)
|
if(!m_bSmartUpdate && m_szFileURL != NULL)
|
||||||
{
|
{
|
||||||
m_szURLString = new char[strlen(m_szFileURL) + 1];
|
m_szURLString = new char[lstrlen(m_szFileURL) + 1];
|
||||||
if(m_szURLString == NULL)
|
if(m_szURLString == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
strcpy(m_szURLString, m_szFileURL);
|
lstrcpy(m_szURLString, m_szFileURL);
|
||||||
return m_szURLString;
|
return m_szURLString;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,18 +351,18 @@ LPSTR CPlugin::createURLString()
|
||||||
|
|
||||||
if(!m_bSmartUpdate && m_szPageURL != NULL && !contentTypeIsJava)
|
if(!m_bSmartUpdate && m_szPageURL != NULL && !contentTypeIsJava)
|
||||||
{
|
{
|
||||||
szAddress = new char[strlen(m_szPageURL) + 1];
|
szAddress = new char[lstrlen(m_szPageURL) + 1];
|
||||||
if(szAddress == NULL)
|
if(szAddress == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
strcpy(szAddress, m_szPageURL);
|
lstrcpy(szAddress, m_szPageURL);
|
||||||
|
|
||||||
m_szURLString = new char[strlen(szAddress) + 1 + strlen(m_pNPMIMEType) + 1];
|
m_szURLString = new char[lstrlen(szAddress) + 1 + lstrlen((LPSTR)m_pNPMIMEType) + 1];
|
||||||
|
|
||||||
if(m_szURLString == NULL)
|
if(m_szURLString == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Append the MIME type to the URL
|
// Append the MIME type to the URL
|
||||||
sprintf(m_szURLString, "%s?%s", szAddress, (LPSTR)m_pNPMIMEType);
|
wsprintf(m_szURLString, "%s?%s", szAddress, (LPSTR)m_pNPMIMEType);
|
||||||
}
|
}
|
||||||
else // default
|
else // default
|
||||||
{
|
{
|
||||||
|
@ -374,20 +374,20 @@ LPSTR CPlugin::createURLString()
|
||||||
urlToOpen = szPageUrlForJVM;
|
urlToOpen = szPageUrlForJVM;
|
||||||
}
|
}
|
||||||
|
|
||||||
szAddress = new char[strlen(urlToOpen) + 1];
|
szAddress = new char[lstrlen(urlToOpen) + 1];
|
||||||
if(szAddress == NULL)
|
if(szAddress == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
strcpy(szAddress, urlToOpen);
|
lstrcpy(szAddress, urlToOpen);
|
||||||
|
|
||||||
m_szURLString = new char[strlen(szAddress) + 10 +
|
m_szURLString = new char[lstrlen(szAddress) + 10 +
|
||||||
strlen(m_pNPMIMEType) + 1];
|
lstrlen((LPSTR)m_pNPMIMEType) + 1];
|
||||||
|
|
||||||
if(m_szURLString == NULL)
|
if(m_szURLString == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
// Append the MIME type to the URL
|
// Append the MIME type to the URL
|
||||||
sprintf(m_szURLString, "%s?mimetype=%s",
|
wsprintf(m_szURLString, "%s?mimetype=%s",
|
||||||
szAddress, m_pNPMIMEType);
|
szAddress, (LPSTR)m_pNPMIMEType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -409,15 +409,14 @@ LPSTR CPlugin::createURLString()
|
||||||
m_szFileURL[0] = '\0';
|
m_szFileURL[0] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
m_szURLString = new char[strlen(szPluginFinderCommandBeginning) + strlen(urlToOpen) + 10 +
|
m_szURLString = new char[lstrlen(szPluginFinderCommandBeginning) + lstrlen(urlToOpen) + 10 +
|
||||||
strlen((LPSTR)m_pNPMIMEType) + 13 +
|
lstrlen((LPSTR)m_pNPMIMEType) + 13 +
|
||||||
strlen((LPSTR)m_szPageURL) + 11 +
|
lstrlen((LPSTR)m_szPageURL) + 11 +
|
||||||
strlen((LPSTR)m_szFileURL) +
|
lstrlen((LPSTR)m_szFileURL) +
|
||||||
strlen(szPluginFinderCommandEnd) + 1];
|
lstrlen(szPluginFinderCommandEnd) + 1];
|
||||||
sprintf(m_szURLString, "%s%s?mimetype=%s&pluginspage=%s&pluginurl=%s%s",
|
wsprintf(m_szURLString, "%s%s?mimetype=%s&pluginspage=%s&pluginurl=%s%s",
|
||||||
szPluginFinderCommandBeginning, urlToOpen,
|
szPluginFinderCommandBeginning, urlToOpen,
|
||||||
m_pNPMIMEType, m_szPageURL, m_szFileURL,
|
(LPSTR)m_pNPMIMEType, m_szPageURL, m_szFileURL, szPluginFinderCommandEnd);
|
||||||
szPluginFinderCommandEnd);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -513,13 +512,13 @@ void CPlugin::getPlugin()
|
||||||
m_szCommandMessage = NULL;
|
m_szCommandMessage = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
wchar_t szString[1024] = {'\0'};
|
char szString[1024] = {'\0'};
|
||||||
LoadStringW(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
|
LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
|
||||||
if(*szString)
|
if(*szString)
|
||||||
{
|
{
|
||||||
m_szCommandMessage = new wchar_t[wcslen(szString) + 1];
|
m_szCommandMessage = new char[lstrlen(szString) + 1];
|
||||||
if(m_szCommandMessage != NULL)
|
if(m_szCommandMessage != NULL)
|
||||||
wcscpy(m_szCommandMessage, szString);
|
lstrcpy(m_szCommandMessage, szString);
|
||||||
}
|
}
|
||||||
|
|
||||||
InvalidateRect(m_hWnd, NULL, TRUE);
|
InvalidateRect(m_hWnd, NULL, TRUE);
|
||||||
|
@ -549,20 +548,20 @@ void CPlugin::URLNotify(const char * szURL)
|
||||||
dbgOut2("CPlugin::URLNotify(), URL '%s'", szURL);
|
dbgOut2("CPlugin::URLNotify(), URL '%s'", szURL);
|
||||||
|
|
||||||
NPStream * pStream = NULL;
|
NPStream * pStream = NULL;
|
||||||
wchar_t buf[256];
|
char buf[256];
|
||||||
|
|
||||||
assert(m_hInst != NULL);
|
assert(m_hInst != NULL);
|
||||||
assert(m_pNPInstance != NULL);
|
assert(m_pNPInstance != NULL);
|
||||||
|
|
||||||
int iSize = LoadStringW(m_hInst, IDS_GOING2HTML, buf, sizeof(buf));
|
int iSize = LoadString(m_hInst, IDS_GOING2HTML, buf, sizeof(buf));
|
||||||
|
|
||||||
NPError rc = NPN_NewStream(m_pNPInstance, "text/html", "asd_plugin_finder", &pStream);
|
NPError rc = NPN_NewStream(m_pNPInstance, "text/html", "asd_plugin_finder", &pStream);
|
||||||
if (rc != NPERR_NO_ERROR)
|
if (rc != NPERR_NO_ERROR)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
//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>";
|
//char buf[] = "<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); // buf is unicode now.
|
NPN_Write(m_pNPInstance, pStream, iSize, buf);
|
||||||
|
|
||||||
NPN_DestroyStream(m_pNPInstance, pStream, NPRES_DONE);
|
NPN_DestroyStream(m_pNPInstance, pStream, NPRES_DONE);
|
||||||
}
|
}
|
||||||
|
@ -595,12 +594,12 @@ NPError CPlugin::destroyStream(NPStream *stream, NPError reason)
|
||||||
|
|
||||||
BOOL CPlugin::readyToRefresh()
|
BOOL CPlugin::readyToRefresh()
|
||||||
{
|
{
|
||||||
wchar_t szString[1024] = {'\0'};
|
char szString[1024] = {'\0'};
|
||||||
LoadStringW(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
|
LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
|
||||||
if(m_szCommandMessage == NULL)
|
if(m_szCommandMessage == NULL)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
return (wcscmp(m_szCommandMessage, szString) == 0);
|
return (lstrcmp(m_szCommandMessage, szString) == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
//***************************
|
//***************************
|
||||||
|
@ -627,7 +626,7 @@ void CPlugin::onRButtonUp(HWND hWnd, int x, int y, UINT keyFlags)
|
||||||
NPN_GetURL(m_pNPInstance, "javascript:navigator.plugins.refresh(true)", "_self");
|
NPN_GetURL(m_pNPInstance, "javascript:navigator.plugins.refresh(true)", "_self");
|
||||||
}
|
}
|
||||||
|
|
||||||
static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc)
|
static void DrawCommandMessage(HDC hDC, LPSTR szString, LPRECT lprc)
|
||||||
{
|
{
|
||||||
if(szString == NULL)
|
if(szString == NULL)
|
||||||
return;
|
return;
|
||||||
|
@ -638,7 +637,7 @@ static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc)
|
||||||
|
|
||||||
HFONT hFontOld = SelectFont(hDC, hFont);
|
HFONT hFontOld = SelectFont(hDC, hFont);
|
||||||
SIZE sz;
|
SIZE sz;
|
||||||
GetTextExtentPoint32W(hDC, szString, wcslen(szString), &sz);
|
GetTextExtentPoint32(hDC, szString, lstrlen(szString), &sz);
|
||||||
POINT pt;
|
POINT pt;
|
||||||
pt.x = sz.cx;
|
pt.x = sz.cx;
|
||||||
pt.y = sz.cy;
|
pt.y = sz.cy;
|
||||||
|
@ -660,7 +659,7 @@ static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc)
|
||||||
|
|
||||||
int iModeOld = SetBkMode(hDC, TRANSPARENT);
|
int iModeOld = SetBkMode(hDC, TRANSPARENT);
|
||||||
COLORREF crColorOld = SetTextColor(hDC, RGB(0,0,0));
|
COLORREF crColorOld = SetTextColor(hDC, RGB(0,0,0));
|
||||||
DrawTextW(hDC, szString, wcslen(szString), &rcText, DT_CENTER|DT_VCENTER);
|
DrawText(hDC, szString, lstrlen(szString), &rcText, DT_CENTER|DT_VCENTER);
|
||||||
SetTextColor(hDC, crColorOld);
|
SetTextColor(hDC, crColorOld);
|
||||||
SetBkMode(hDC, iModeOld);
|
SetBkMode(hDC, iModeOld);
|
||||||
SelectFont(hDC, hFontOld);
|
SelectFont(hDC, hFontOld);
|
||||||
|
|
|
@ -51,7 +51,7 @@ private:
|
||||||
HICON m_hIcon;
|
HICON m_hIcon;
|
||||||
char* m_szURLString;
|
char* m_szURLString;
|
||||||
|
|
||||||
wchar_t* m_szCommandMessage;
|
char* m_szCommandMessage;
|
||||||
BOOL m_bWaitingStreamFromPFS;
|
BOOL m_bWaitingStreamFromPFS;
|
||||||
NPStream* m_PFSStream;
|
NPStream* m_PFSStream;
|
||||||
|
|
||||||
|
@ -118,7 +118,7 @@ public:
|
||||||
#define JVM_SMARTUPDATE_URL "http://java.com/download"
|
#define JVM_SMARTUPDATE_URL "http://java.com/download"
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
#define REGISTRY_PLACE L"Software\\Netscape\\Netscape Navigator\\Default Plugin"
|
#define REGISTRY_PLACE "Software\\Netscape\\Netscape Navigator\\Default Plugin"
|
||||||
#else
|
#else
|
||||||
#define GWL_USERDATA 0
|
#define GWL_USERDATA 0
|
||||||
#define COLOR_3DSHADOW COLOR_BTNFACE
|
#define COLOR_3DSHADOW COLOR_BTNFACE
|
||||||
|
@ -126,7 +126,7 @@ public:
|
||||||
#define COLOR_3DDKSHADOW COLOR_BTNSHADOW
|
#define COLOR_3DDKSHADOW COLOR_BTNSHADOW
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define CLASS_NULL_PLUGIN L"NullPluginClass"
|
#define CLASS_NULL_PLUGIN "NullPluginClass"
|
||||||
|
|
||||||
BOOL RegisterNullPluginWindowClass();
|
BOOL RegisterNullPluginWindowClass();
|
||||||
void UnregisterNullPluginWindowClass();
|
void UnregisterNullPluginWindowClass();
|
||||||
|
|
|
@ -45,8 +45,8 @@ HKEY openRegistry()
|
||||||
{
|
{
|
||||||
HKEY phkResult;
|
HKEY phkResult;
|
||||||
|
|
||||||
if(RegCreateKeyW(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS)
|
if(RegCreateKey(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS)
|
||||||
MessageBoxW(0, L"Error creating Default Plugin registry key", L"Default Plugin", MB_OK);
|
MessageBox(0, "Error creating Default Plugin registry key", "Default Plugin", MB_OK);
|
||||||
|
|
||||||
return phkResult;
|
return phkResult;
|
||||||
}
|
}
|
||||||
|
@ -56,37 +56,30 @@ BOOL IsNewMimeType(LPSTR mime)
|
||||||
{
|
{
|
||||||
HKEY hkey = openRegistry();
|
HKEY hkey = openRegistry();
|
||||||
DWORD dwType, keysize = 512;
|
DWORD dwType, keysize = 512;
|
||||||
wchar_t keybuf[512];
|
char keybuf[512];
|
||||||
wchar_t wideMime[64];
|
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, 0,
|
if(RegQueryValueEx(hkey, mime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS)
|
||||||
mime,
|
|
||||||
strlen(mime) + 1,
|
|
||||||
wideMime,
|
|
||||||
64);
|
|
||||||
|
|
||||||
if(RegQueryValueExW(hkey, wideMime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS)
|
|
||||||
{
|
{
|
||||||
// key exists, must have already been here...
|
// key exists, must have already been here...
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if(RegSetValueExW(hkey, wideMime, 0, REG_SZ, (LPBYTE) L"(none)", 7) != ERROR_SUCCESS)
|
if(RegSetValueEx(hkey, mime, 0, REG_SZ, (LPBYTE) "(none)", 7) != ERROR_SUCCESS)
|
||||||
MessageBoxW(0, L"Error adding MIME type value", L"Default Plugin", MB_OK);
|
MessageBox(0, "Error adding MIME type value", "Default Plugin", MB_OK);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// string length in pixels for the specific window (selected font)
|
// string length in pixels for the specific window (selected font)
|
||||||
static int getWindowStringLength(HWND hWnd, wchar_t* lpsz)
|
static int getWindowStringLength(HWND hWnd, LPSTR lpsz)
|
||||||
{
|
{
|
||||||
SIZE sz;
|
SIZE sz;
|
||||||
HDC hDC = GetDC(hWnd);
|
HDC hDC = GetDC(hWnd);
|
||||||
HFONT hWindowFont = GetWindowFont(hWnd);
|
HFONT hWindowFont = GetWindowFont(hWnd);
|
||||||
HFONT hFontOld = SelectFont(hDC, hWindowFont);
|
HFONT hFontOld = SelectFont(hDC, hWindowFont);
|
||||||
GetTextExtentPoint32W(hDC, lpsz, wcslen(lpsz), &sz);
|
GetTextExtentPoint32(hDC, lpsz, lstrlen(lpsz), &sz);
|
||||||
POINT pt;
|
POINT pt;
|
||||||
pt.x = sz.cx;
|
pt.x = sz.cx;
|
||||||
pt.y = sz.cy;
|
pt.y = sz.cy;
|
||||||
|
@ -96,20 +89,20 @@ static int getWindowStringLength(HWND hWnd, wchar_t* lpsz)
|
||||||
return (int)pt.x;
|
return (int)pt.x;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*******************************************************************/
|
/****************************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) */
|
/* void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) */
|
||||||
/* */
|
/* */
|
||||||
/* helper to wrap long lines in a static control, which do not */
|
/* helper to wrap long lines in a static control, which do not */
|
||||||
/* wrap automatically if they do not have space characters */
|
/* wrap automatically if they do not have space characters */
|
||||||
/* */
|
/* */
|
||||||
/*******************************************************************/
|
/****************************************************************/
|
||||||
void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
|
void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText)
|
||||||
{
|
{
|
||||||
HWND hWndStatic = GetDlgItem(hWnd, iID);
|
HWND hWndStatic = GetDlgItem(hWnd, iID);
|
||||||
if((szText == NULL) || (wcslen(szText) == 0))
|
if((szText == NULL) || (lstrlen(szText) == 0))
|
||||||
{
|
{
|
||||||
SetDlgItemTextW(hWnd, iID, L"");
|
SetDlgItemText(hWnd, iID, "");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,7 +114,7 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
|
||||||
|
|
||||||
if(iStringLength <= iStaticLength)
|
if(iStringLength <= iStaticLength)
|
||||||
{
|
{
|
||||||
SetDlgItemTextW(hWnd, iID, szText);
|
SetDlgItemText(hWnd, iID, szText);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,19 +122,19 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
|
||||||
if(iBreaks <= 0)
|
if(iBreaks <= 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wchar_t * pBuf = new wchar_t[iStringLength + iBreaks + 1];
|
char * pBuf = new char[iStringLength + iBreaks + 1];
|
||||||
if(pBuf == NULL)
|
if(pBuf == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
wcscpy(pBuf, L"");
|
lstrcpy(pBuf, "");
|
||||||
|
|
||||||
int iStart = 0;
|
int iStart = 0;
|
||||||
int iLines = 0;
|
int iLines = 0;
|
||||||
for(int i = 0; i < iStringLength; i++)
|
for(int i = 0; i < iStringLength; i++)
|
||||||
{
|
{
|
||||||
wchar_t* sz = &szText[iStart];
|
char * sz = &szText[iStart];
|
||||||
int iIndex = i - iStart;
|
int iIndex = i - iStart;
|
||||||
wchar_t ch = sz[iIndex + 1];
|
char ch = sz[iIndex + 1];
|
||||||
|
|
||||||
sz[iIndex + 1] = '\0';
|
sz[iIndex + 1] = '\0';
|
||||||
|
|
||||||
|
@ -152,7 +145,7 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
|
||||||
sz[iIndex + 1] = ch;
|
sz[iIndex + 1] = ch;
|
||||||
if(iLines == iBreaks)
|
if(iLines == iBreaks)
|
||||||
{
|
{
|
||||||
wcscat(pBuf, sz);
|
lstrcat(pBuf, sz);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
|
@ -164,15 +157,15 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
|
||||||
ch = sz[iIndex];
|
ch = sz[iIndex];
|
||||||
sz[iIndex] = '\0'; // terminate string one char shorter
|
sz[iIndex] = '\0'; // terminate string one char shorter
|
||||||
|
|
||||||
wcscat(pBuf, sz); // append the string
|
lstrcat(pBuf, sz); // append the string
|
||||||
wcscat(pBuf, L" "); // append space character for successful wrapping
|
lstrcat(pBuf, " "); // append space character for successful wrapping
|
||||||
|
|
||||||
iStart += wcslen(sz); // shift new start position
|
iStart += lstrlen(sz);// shift new start position
|
||||||
sz[iIndex] = ch; // restore zeroed element
|
sz[iIndex] = ch; // restore zeroed element
|
||||||
iLines++; // count lines
|
iLines++; // count lines
|
||||||
}
|
}
|
||||||
|
|
||||||
SetDlgItemTextW(hWnd, iID, pBuf);
|
SetDlgItemText(hWnd, iID, pBuf);
|
||||||
|
|
||||||
delete [] pBuf;
|
delete [] pBuf;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,6 +40,6 @@
|
||||||
|
|
||||||
HKEY openRegistry();
|
HKEY openRegistry();
|
||||||
BOOL IsNewMimeType(LPSTR szMimeType);
|
BOOL IsNewMimeType(LPSTR szMimeType);
|
||||||
void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText);
|
void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText);
|
||||||
|
|
||||||
#endif // __UTILS_H__
|
#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);
|
nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA);
|
||||||
if (plugin) {
|
if (plugin) {
|
||||||
const char * string = plugin->getVersion();
|
const char * string = plugin->getVersion();
|
||||||
DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
char string[] = "Error occured";
|
char string[] = "Error occured";
|
||||||
DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndPaint(hWnd, &ps);
|
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
|
// get our plugin instance object and ask it for the version string
|
||||||
nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA);
|
nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA);
|
||||||
if (plugin)
|
if (plugin)
|
||||||
DrawTextA(hdc, plugin->mString, strlen(plugin->mString), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
DrawText(hdc, plugin->mString, strlen(plugin->mString), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||||
else {
|
else {
|
||||||
char string[] = "Error occured";
|
char string[] = "Error occured";
|
||||||
DrawTextA(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
DrawText(hdc, string, strlen(string), &rc, DT_SINGLELINE | DT_CENTER | DT_VCENTER);
|
||||||
}
|
}
|
||||||
|
|
||||||
EndPaint(hWnd, &ps);
|
EndPaint(hWnd, &ps);
|
||||||
|
|
|
@ -928,15 +928,14 @@ FileSystemDataSource::GetVolumeList(nsISimpleEnumerator** aResult)
|
||||||
#if defined (XP_WIN) && !defined (WINCE)
|
#if defined (XP_WIN) && !defined (WINCE)
|
||||||
|
|
||||||
PRInt32 driveType;
|
PRInt32 driveType;
|
||||||
PRUnichar drive[32];
|
char drive[32];
|
||||||
PRInt32 volNum;
|
PRInt32 volNum;
|
||||||
char *url;
|
char *url;
|
||||||
|
|
||||||
for (volNum = 0; volNum < 26; volNum++)
|
for (volNum = 0; volNum < 26; volNum++)
|
||||||
{
|
{
|
||||||
swprintf( drive, L"%c:\\", volNum + (PRUnichar)'A');
|
sprintf(drive, "%c:\\", volNum + 'A');
|
||||||
|
driveType = GetDriveType(drive);
|
||||||
driveType = GetDriveTypeW(drive);
|
|
||||||
if (driveType != DRIVE_UNKNOWN && driveType != DRIVE_NO_ROOT_DIR)
|
if (driveType != DRIVE_UNKNOWN && driveType != DRIVE_NO_ROOT_DIR)
|
||||||
{
|
{
|
||||||
if (nsnull != (url = PR_smprintf("file:///%c|/", volNum + 'A')))
|
if (nsnull != (url = PR_smprintf("file:///%c|/", volNum + 'A')))
|
||||||
|
|
|
@ -58,13 +58,14 @@ nsUserInfo::GetUsername(char **aUsername)
|
||||||
{
|
{
|
||||||
*aUsername = nsnull;
|
*aUsername = nsnull;
|
||||||
|
|
||||||
PRUnichar username[256];
|
TCHAR username[256];
|
||||||
DWORD size = 256;
|
DWORD size = 256;
|
||||||
|
|
||||||
if (!GetUserNameW(username, &size))
|
if (!GetUserName(username, &size))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
*aUsername = ToNewUTF8String(nsDependentString(username));
|
*aUsername = nsCRT::strdup(username);
|
||||||
|
|
||||||
if (*aUsername) return NS_OK;
|
if (*aUsername) return NS_OK;
|
||||||
|
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
|
@ -266,7 +266,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
|
||||||
SFGAOF sfgao;
|
SFGAOF sfgao;
|
||||||
|
|
||||||
// Bug 394974
|
// Bug 394974
|
||||||
HMODULE hDll = ::LoadLibraryW(L"shell32.dll");
|
HMODULE hDll = ::LoadLibrary("shell32.dll");
|
||||||
MySHParseDisplayName pMySHParseDisplayName = NULL;
|
MySHParseDisplayName pMySHParseDisplayName = NULL;
|
||||||
// Version 6.0 and higher
|
// Version 6.0 and higher
|
||||||
if (pMySHParseDisplayName =
|
if (pMySHParseDisplayName =
|
||||||
|
@ -274,19 +274,19 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
|
||||||
"SHParseDisplayName")) {
|
"SHParseDisplayName")) {
|
||||||
if (SUCCEEDED(pMySHParseDisplayName(NS_ConvertUTF8toUTF16(urlSpec).get(),
|
if (SUCCEEDED(pMySHParseDisplayName(NS_ConvertUTF8toUTF16(urlSpec).get(),
|
||||||
NULL, &pidl, 0, &sfgao))) {
|
NULL, &pidl, 0, &sfgao))) {
|
||||||
static const PRUnichar cmdVerb[] = L"open";
|
static const char cmdVerb[] = "open";
|
||||||
SHELLEXECUTEINFOW sinfo;
|
SHELLEXECUTEINFO sinfo;
|
||||||
memset(&sinfo, 0, sizeof(SHELLEXECUTEINFO));
|
memset(&sinfo, 0, sizeof(SHELLEXECUTEINFO));
|
||||||
sinfo.cbSize = sizeof(SHELLEXECUTEINFO);
|
sinfo.cbSize = sizeof(SHELLEXECUTEINFO);
|
||||||
sinfo.fMask = SEE_MASK_FLAG_DDEWAIT |
|
sinfo.fMask = SEE_MASK_FLAG_DDEWAIT |
|
||||||
SEE_MASK_FLAG_NO_UI |
|
SEE_MASK_FLAG_NO_UI |
|
||||||
SEE_MASK_INVOKEIDLIST;
|
SEE_MASK_INVOKEIDLIST;
|
||||||
sinfo.hwnd = NULL;
|
sinfo.hwnd = NULL;
|
||||||
sinfo.lpVerb = (LPWSTR)&cmdVerb;
|
sinfo.lpVerb = (LPCSTR)&cmdVerb;
|
||||||
sinfo.nShow = SW_SHOWNORMAL;
|
sinfo.nShow = SW_SHOWNORMAL;
|
||||||
sinfo.lpIDList = pidl;
|
sinfo.lpIDList = pidl;
|
||||||
|
|
||||||
BOOL result = ShellExecuteExW(&sinfo);
|
BOOL result = ShellExecuteEx(&sinfo);
|
||||||
|
|
||||||
CoTaskMemFree(pidl);
|
CoTaskMemFree(pidl);
|
||||||
|
|
||||||
|
@ -295,9 +295,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Version of shell32.dll < 6.0
|
// Version of shell32.dll < 6.0
|
||||||
LONG r = (LONG) ::ShellExecuteW(NULL, L"open",
|
LONG r = (LONG) ::ShellExecute(NULL, "open", urlSpec.get(), NULL, NULL,
|
||||||
NS_ConvertUTF8toUTF16(urlSpec).get(),
|
|
||||||
NULL, NULL,
|
|
||||||
SW_SHOWNORMAL);
|
SW_SHOWNORMAL);
|
||||||
if (r < 32)
|
if (r < 32)
|
||||||
rv = NS_ERROR_FAILURE;
|
rv = NS_ERROR_FAILURE;
|
||||||
|
|
|
@ -145,11 +145,11 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolSch
|
||||||
if (aProtocolScheme && *aProtocolScheme)
|
if (aProtocolScheme && *aProtocolScheme)
|
||||||
{
|
{
|
||||||
HKEY hKey;
|
HKEY hKey;
|
||||||
LONG err = ::RegOpenKeyExA(HKEY_CLASSES_ROOT, aProtocolScheme, 0,
|
LONG err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0,
|
||||||
KEY_QUERY_VALUE, &hKey);
|
KEY_QUERY_VALUE, &hKey);
|
||||||
if (err == ERROR_SUCCESS)
|
if (err == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
err = ::RegQueryValueExW(hKey, L"URL Protocol", NULL, NULL, NULL, NULL);
|
err = ::RegQueryValueEx(hKey, "URL Protocol", NULL, NULL, NULL, NULL);
|
||||||
*aHandlerExists = (err == ERROR_SUCCESS);
|
*aHandlerExists = (err == ERROR_SUCCESS);
|
||||||
// close the key
|
// close the key
|
||||||
::RegCloseKey(hKey);
|
::RegCloseKey(hKey);
|
||||||
|
|
|
@ -93,13 +93,13 @@ nsresult
|
||||||
nsAppShell::Init()
|
nsAppShell::Init()
|
||||||
{
|
{
|
||||||
if (!sMsgId)
|
if (!sMsgId)
|
||||||
sMsgId = RegisterWindowMessageW(L"nsAppShell:EventID");
|
sMsgId = RegisterWindowMessage("nsAppShell:EventID");
|
||||||
|
|
||||||
WNDCLASSW wc;
|
WNDCLASS wc;
|
||||||
HINSTANCE module = GetModuleHandle(NULL);
|
HINSTANCE module = GetModuleHandle(NULL);
|
||||||
|
|
||||||
const PRUnichar *const kWindowClass = L"nsAppShell:EventWindowClass";
|
const char *const kWindowClass = "nsAppShell:EventWindowClass";
|
||||||
if (!GetClassInfoW(module, kWindowClass, &wc)) {
|
if (!GetClassInfo(module, kWindowClass, &wc)) {
|
||||||
wc.style = 0;
|
wc.style = 0;
|
||||||
wc.lpfnWndProc = EventWindowProc;
|
wc.lpfnWndProc = EventWindowProc;
|
||||||
wc.cbClsExtra = 0;
|
wc.cbClsExtra = 0;
|
||||||
|
@ -108,12 +108,12 @@ nsAppShell::Init()
|
||||||
wc.hIcon = NULL;
|
wc.hIcon = NULL;
|
||||||
wc.hCursor = NULL;
|
wc.hCursor = NULL;
|
||||||
wc.hbrBackground = (HBRUSH) NULL;
|
wc.hbrBackground = (HBRUSH) NULL;
|
||||||
wc.lpszMenuName = (LPCWSTR) NULL;
|
wc.lpszMenuName = (LPCSTR) NULL;
|
||||||
wc.lpszClassName = kWindowClass;
|
wc.lpszClassName = kWindowClass;
|
||||||
RegisterClassW(&wc);
|
RegisterClass(&wc);
|
||||||
}
|
}
|
||||||
|
|
||||||
mEventWnd = CreateWindowW(kWindowClass, L"nsAppShell:EventWindow",
|
mEventWnd = CreateWindow(kWindowClass, "nsAppShell:EventWindow",
|
||||||
0, 0, 0, 10, 10, NULL, NULL, module, NULL);
|
0, 0, 0, 10, 10, NULL, NULL, module, NULL);
|
||||||
NS_ENSURE_STATE(mEventWnd);
|
NS_ENSURE_STATE(mEventWnd);
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "nsBidiKeyboard.h"
|
#include "nsBidiKeyboard.h"
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
#include <tchar.h>
|
|
||||||
|
|
||||||
NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard)
|
NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard)
|
||||||
|
|
||||||
|
@ -64,8 +63,8 @@ NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
// call LoadKeyboardLayout() only if the target keyboard layout is different from the current
|
// call LoadKeyboardLayout() only if the target keyboard layout is different from the current
|
||||||
PRUnichar currentLocaleName[KL_NAMELENGTH];
|
char currentLocaleName[KL_NAMELENGTH];
|
||||||
wcsncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH);
|
strncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH);
|
||||||
currentLocaleName[KL_NAMELENGTH-1] = '\0'; // null terminate
|
currentLocaleName[KL_NAMELENGTH-1] = '\0'; // null terminate
|
||||||
|
|
||||||
NS_ASSERTION(*currentLocaleName,
|
NS_ASSERTION(*currentLocaleName,
|
||||||
|
@ -97,26 +96,26 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL)
|
||||||
currentLocale = ::GetKeyboardLayout(0);
|
currentLocale = ::GetKeyboardLayout(0);
|
||||||
*aIsRTL = IsRTLLanguage(currentLocale);
|
*aIsRTL = IsRTLLanguage(currentLocale);
|
||||||
|
|
||||||
if (!::GetKeyboardLayoutNameW(mCurrentLocaleName))
|
if (!::GetKeyboardLayoutName(mCurrentLocaleName))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
NS_ASSERTION(*mCurrentLocaleName,
|
NS_ASSERTION(*mCurrentLocaleName,
|
||||||
"GetKeyboardLayoutName return string length == 0");
|
"GetKeyboardLayoutName return string length == 0");
|
||||||
NS_ASSERTION((wcslen(mCurrentLocaleName) < KL_NAMELENGTH),
|
NS_ASSERTION((strlen(mCurrentLocaleName) < KL_NAMELENGTH),
|
||||||
"GetKeyboardLayoutName return string length >= KL_NAMELENGTH");
|
"GetKeyboardLayoutName return string length >= KL_NAMELENGTH");
|
||||||
|
|
||||||
// The language set by the user overrides the default language for that direction
|
// The language set by the user overrides the default language for that direction
|
||||||
if (*aIsRTL) {
|
if (*aIsRTL) {
|
||||||
wcsncpy(mRTLKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
|
strncpy(mRTLKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
|
||||||
mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
||||||
} else {
|
} else {
|
||||||
wcsncpy(mLTRKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
|
strncpy(mLTRKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
|
||||||
mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_ASSERTION((wcslen(mRTLKeyboard) < KL_NAMELENGTH),
|
NS_ASSERTION((strlen(mRTLKeyboard) < KL_NAMELENGTH),
|
||||||
"mLTRKeyboard has string length >= KL_NAMELENGTH");
|
"mLTRKeyboard has string length >= KL_NAMELENGTH");
|
||||||
NS_ASSERTION((wcslen(mLTRKeyboard) < KL_NAMELENGTH),
|
NS_ASSERTION((strlen(mLTRKeyboard) < KL_NAMELENGTH),
|
||||||
"mRTLKeyboard has string length >= KL_NAMELENGTH");
|
"mRTLKeyboard has string length >= KL_NAMELENGTH");
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
@ -133,7 +132,7 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
|
||||||
int keyboards;
|
int keyboards;
|
||||||
HKL far* buf;
|
HKL far* buf;
|
||||||
HKL locale;
|
HKL locale;
|
||||||
PRUnichar localeName[KL_NAMELENGTH];
|
char localeName[KL_NAMELENGTH];
|
||||||
PRBool isLTRKeyboardSet = PR_FALSE;
|
PRBool isLTRKeyboardSet = PR_FALSE;
|
||||||
PRBool isRTLKeyboardSet = PR_FALSE;
|
PRBool isRTLKeyboardSet = PR_FALSE;
|
||||||
|
|
||||||
|
@ -157,11 +156,11 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
|
||||||
while (keyboards--) {
|
while (keyboards--) {
|
||||||
locale = buf[keyboards];
|
locale = buf[keyboards];
|
||||||
if (IsRTLLanguage(locale)) {
|
if (IsRTLLanguage(locale)) {
|
||||||
swprintf(mRTLKeyboard, L"%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
|
sprintf(mRTLKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
|
||||||
isRTLKeyboardSet = PR_TRUE;
|
isRTLKeyboardSet = PR_TRUE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
swprintf( mLTRKeyboard, L"%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
|
sprintf(mLTRKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
|
||||||
isLTRKeyboardSet = PR_TRUE;
|
isLTRKeyboardSet = PR_TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -179,20 +178,20 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
|
||||||
// installed this prevents us from arbitrarily resetting the current
|
// installed this prevents us from arbitrarily resetting the current
|
||||||
// layout (bug 80274)
|
// layout (bug 80274)
|
||||||
locale = ::GetKeyboardLayout(0);
|
locale = ::GetKeyboardLayout(0);
|
||||||
if (!::GetKeyboardLayoutNameW(localeName))
|
if (!::GetKeyboardLayoutName(localeName))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
NS_ASSERTION(*localeName,
|
NS_ASSERTION(*localeName,
|
||||||
"GetKeyboardLayoutName return string length == 0");
|
"GetKeyboardLayoutName return string length == 0");
|
||||||
NS_ASSERTION((wcslen(localeName) < KL_NAMELENGTH),
|
NS_ASSERTION((strlen(localeName) < KL_NAMELENGTH),
|
||||||
"GetKeyboardLayout return string length >= KL_NAMELENGTH");
|
"GetKeyboardLayout return string length >= KL_NAMELENGTH");
|
||||||
|
|
||||||
if (IsRTLLanguage(locale)) {
|
if (IsRTLLanguage(locale)) {
|
||||||
swprintf(mRTLKeyboard, localeName, KL_NAMELENGTH);
|
strncpy(mRTLKeyboard, localeName, KL_NAMELENGTH);
|
||||||
mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
swprintf( mLTRKeyboard, localeName, KL_NAMELENGTH);
|
strncpy(mLTRKeyboard, localeName, KL_NAMELENGTH);
|
||||||
mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -58,9 +58,9 @@ protected:
|
||||||
|
|
||||||
PRPackedBool mInitialized;
|
PRPackedBool mInitialized;
|
||||||
PRPackedBool mHaveBidiKeyboards;
|
PRPackedBool mHaveBidiKeyboards;
|
||||||
PRUnichar mLTRKeyboard[KL_NAMELENGTH];
|
char mLTRKeyboard[KL_NAMELENGTH];
|
||||||
PRUnichar mRTLKeyboard[KL_NAMELENGTH];
|
char mRTLKeyboard[KL_NAMELENGTH];
|
||||||
PRUnichar mCurrentLocaleName[KL_NAMELENGTH];
|
char mCurrentLocaleName[KL_NAMELENGTH];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
|
|
||||||
// oddly, this isn't in the MSVC headers anywhere.
|
// oddly, this isn't in the MSVC headers anywhere.
|
||||||
UINT nsClipboard::CF_HTML = ::RegisterClipboardFormatW(L"HTML Format");
|
UINT nsClipboard::CF_HTML = ::RegisterClipboardFormat("HTML Format");
|
||||||
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -111,9 +111,7 @@ UINT nsClipboard::GetFormat(const char* aMimeStr)
|
||||||
else if (strcmp(aMimeStr, kNativeHTMLMime) == 0)
|
else if (strcmp(aMimeStr, kNativeHTMLMime) == 0)
|
||||||
format = CF_HTML;
|
format = CF_HTML;
|
||||||
else
|
else
|
||||||
format = ::RegisterClipboardFormatW(NS_ConvertASCIItoUTF16(aMimeStr).get());
|
format = ::RegisterClipboardFormat(aMimeStr);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return format;
|
return format;
|
||||||
}
|
}
|
||||||
|
@ -318,7 +316,7 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, PRUint32 * aLe
|
||||||
);
|
);
|
||||||
|
|
||||||
// Display the string.
|
// Display the string.
|
||||||
MessageBoxW( NULL, (LPCWSTR)lpMsgBuf, L"GetLastError", MB_OK|MB_ICONINFORMATION );
|
MessageBox( NULL, (const char *)lpMsgBuf, "GetLastError", MB_OK|MB_ICONINFORMATION );
|
||||||
|
|
||||||
// Free the buffer.
|
// Free the buffer.
|
||||||
LocalFree( lpMsgBuf );
|
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
|
* 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
|
#ifndef CFSTR_INETURLA
|
||||||
#define CFSTR_INETURLA L"UniformResourceLocator"
|
#define CFSTR_INETURLA "UniformResourceLocator"
|
||||||
#endif
|
#endif
|
||||||
#ifndef CFSTR_INETURLW
|
#ifndef CFSTR_INETURLW
|
||||||
#define CFSTR_INETURLW L"UniformResourceLocatorW"
|
#define CFSTR_INETURLW "UniformResourceLocatorW"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// For support of MinGW w32api v2.4.
|
// 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
|
// 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.
|
// then that can be made the base required version and this code should be removed.
|
||||||
#ifndef CFSTR_FILEDESCRIPTORA
|
#ifndef CFSTR_FILEDESCRIPTORA
|
||||||
# define CFSTR_FILEDESCRIPTORA L"FileGroupDescriptor"
|
# define CFSTR_FILEDESCRIPTORA "FileGroupDescriptor"
|
||||||
#endif
|
#endif
|
||||||
#ifndef CFSTR_FILEDESCRIPTORW
|
#ifndef CFSTR_FILEDESCRIPTORW
|
||||||
# define CFSTR_FILEDESCRIPTORW L"FileGroupDescriptorW"
|
# define CFSTR_FILEDESCRIPTORW "FileGroupDescriptorW"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
|
|
|
@ -280,10 +280,10 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
}
|
}
|
||||||
catch(...) {
|
catch(...) {
|
||||||
MessageBoxW(ofn.hwndOwner,
|
MessageBox(ofn.hwndOwner,
|
||||||
0,
|
0,
|
||||||
L"The filepicker was unexpectedly closed by Windows.",
|
"The filepicker was unexpectedly closed by Windows.",
|
||||||
MB_ICONERROR);
|
MB_ICONERROR);
|
||||||
result = PR_FALSE;
|
result = PR_FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -56,7 +56,7 @@ static CloseThemeDataPtr closeTheme = NULL;
|
||||||
static GetThemeColorPtr getThemeColor = NULL;
|
static GetThemeColorPtr getThemeColor = NULL;
|
||||||
static IsAppThemedPtr isAppThemed = NULL;
|
static IsAppThemedPtr isAppThemed = NULL;
|
||||||
|
|
||||||
static const PRUnichar kThemeLibraryName[] = L"uxtheme.dll";
|
static const char kThemeLibraryName[] = "uxtheme.dll";
|
||||||
static HINSTANCE gThemeDLLInst = NULL;
|
static HINSTANCE gThemeDLLInst = NULL;
|
||||||
static HANDLE gMenuTheme = NULL;
|
static HANDLE gMenuTheme = NULL;
|
||||||
|
|
||||||
|
@ -105,13 +105,13 @@ static PRInt32 GetSystemParam(long flag, PRInt32 def)
|
||||||
nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
|
nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
|
||||||
{
|
{
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
gShell32DLLInst = LoadLibraryW(L"Shell32.dll");
|
gShell32DLLInst = LoadLibrary("Shell32.dll");
|
||||||
if (gShell32DLLInst)
|
if (gShell32DLLInst)
|
||||||
{
|
{
|
||||||
gSHAppBarMessage = (SHAppBarMessagePtr) GetProcAddress(gShell32DLLInst,
|
gSHAppBarMessage = (SHAppBarMessagePtr) GetProcAddress(gShell32DLLInst,
|
||||||
"SHAppBarMessage");
|
"SHAppBarMessage");
|
||||||
}
|
}
|
||||||
gThemeDLLInst = LoadLibraryW(kThemeLibraryName);
|
gThemeDLLInst = LoadLibrary(kThemeLibraryName);
|
||||||
if(gThemeDLLInst)
|
if(gThemeDLLInst)
|
||||||
{
|
{
|
||||||
openTheme = (OpenThemeDataPtr)GetProcAddress(gThemeDLLInst, "OpenThemeData");
|
openTheme = (OpenThemeDataPtr)GetProcAddress(gThemeDLLInst, "OpenThemeData");
|
||||||
|
@ -504,7 +504,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
|
||||||
if (gSHAppBarMessage)
|
if (gSHAppBarMessage)
|
||||||
{
|
{
|
||||||
// Get task bar window handle
|
// Get task bar window handle
|
||||||
HWND shellWindow = FindWindowW(L"Shell_TrayWnd", NULL);
|
HWND shellWindow = FindWindow("Shell_TrayWnd", NULL);
|
||||||
|
|
||||||
if (shellWindow != NULL)
|
if (shellWindow != NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -279,7 +279,7 @@ static GetThemeSysFontPtr getThemeSysFont = NULL;
|
||||||
static GetThemeColorPtr getThemeColor = NULL;
|
static GetThemeColorPtr getThemeColor = NULL;
|
||||||
static GetThemeMarginsPtr getThemeMargins = NULL;
|
static GetThemeMarginsPtr getThemeMargins = NULL;
|
||||||
|
|
||||||
static const PRUnichar kThemeLibraryName[] = L"uxtheme.dll";
|
static const char kThemeLibraryName[] = "uxtheme.dll";
|
||||||
|
|
||||||
static inline bool IsCheckboxWidgetType(PRUint8 aWidgetType)
|
static inline bool IsCheckboxWidgetType(PRUint8 aWidgetType)
|
||||||
{
|
{
|
||||||
|
@ -318,7 +318,7 @@ nsNativeThemeWin::nsNativeThemeWin() {
|
||||||
mHeaderTheme = NULL;
|
mHeaderTheme = NULL;
|
||||||
mMenuTheme = NULL;
|
mMenuTheme = NULL;
|
||||||
|
|
||||||
mThemeDLL = ::LoadLibraryW(kThemeLibraryName);
|
mThemeDLL = ::LoadLibrary(kThemeLibraryName);
|
||||||
if (mThemeDLL) {
|
if (mThemeDLL) {
|
||||||
openTheme = (OpenThemeDataPtr)GetProcAddress(mThemeDLL, "OpenThemeData");
|
openTheme = (OpenThemeDataPtr)GetProcAddress(mThemeDLL, "OpenThemeData");
|
||||||
closeTheme = (CloseThemeDataPtr)GetProcAddress(mThemeDLL, "CloseThemeData");
|
closeTheme = (CloseThemeDataPtr)GetProcAddress(mThemeDLL, "CloseThemeData");
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "plstr.h"
|
#include "plstr.h"
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "nsString.h"
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
|
||||||
// mmsystem.h is needed to build with WIN32_LEAN_AND_MEAN
|
// mmsystem.h is needed to build with WIN32_LEAN_AND_MEAN
|
||||||
|
@ -125,7 +125,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader,
|
||||||
flags |= SND_ASYNC;
|
flags |= SND_ASYNC;
|
||||||
}
|
}
|
||||||
|
|
||||||
::PlaySoundA(reinterpret_cast<const char*>(data), 0, flags);
|
::PlaySound(reinterpret_cast<const char*>(data), 0, flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -166,10 +166,12 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias)
|
||||||
PurgeLastSound();
|
PurgeLastSound();
|
||||||
|
|
||||||
if (aSoundAlias.EqualsLiteral("_moz_mailbeep")) {
|
if (aSoundAlias.EqualsLiteral("_moz_mailbeep")) {
|
||||||
::PlaySoundW(L"MailBeep", nsnull, SND_ALIAS | SND_ASYNC);
|
::PlaySound("MailBeep", nsnull, SND_ALIAS | SND_ASYNC);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
::PlaySoundW(PromiseFlatString(aSoundAlias).get(), nsnull, SND_ALIAS | SND_ASYNC);
|
nsCAutoString nativeSoundAlias;
|
||||||
|
NS_CopyUnicodeToNative(aSoundAlias, nativeSoundAlias);
|
||||||
|
::PlaySound(nativeSoundAlias.get(), nsnull, SND_ALIAS | SND_ASYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -264,7 +264,7 @@ nsToolkit::Startup(HMODULE hModule)
|
||||||
typedef BOOL (*SetProcessDPIAwareFunc)(VOID);
|
typedef BOOL (*SetProcessDPIAwareFunc)(VOID);
|
||||||
|
|
||||||
SetProcessDPIAwareFunc setDPIAware = (SetProcessDPIAwareFunc)
|
SetProcessDPIAwareFunc setDPIAware = (SetProcessDPIAwareFunc)
|
||||||
GetProcAddress(LoadLibraryW(L"user32.dll"),
|
GetProcAddress(LoadLibrary("user32.dll"),
|
||||||
"SetProcessDPIAware");
|
"SetProcessDPIAware");
|
||||||
|
|
||||||
if (setDPIAware)
|
if (setDPIAware)
|
||||||
|
@ -295,8 +295,8 @@ void nsToolkit::CreateInternalWindow(PRThread *aThread)
|
||||||
// create the internal window
|
// create the internal window
|
||||||
//
|
//
|
||||||
|
|
||||||
mDispatchWnd = ::CreateWindowW(L"nsToolkitClass",
|
mDispatchWnd = ::CreateWindow("nsToolkitClass",
|
||||||
L"NetscapeDispatchWnd",
|
"NetscapeDispatchWnd",
|
||||||
WS_DISABLED,
|
WS_DISABLED,
|
||||||
-50, -50,
|
-50, -50,
|
||||||
10, 10,
|
10, 10,
|
||||||
|
|
|
@ -150,7 +150,7 @@
|
||||||
#include "prprf.h"
|
#include "prprf.h"
|
||||||
#include "prmem.h"
|
#include "prmem.h"
|
||||||
|
|
||||||
static const PRUnichar kMozHeapDumpMessageString[] = L"MOZ_HeapDump";
|
static const char kMozHeapDumpMessageString[] = "MOZ_HeapDump";
|
||||||
|
|
||||||
#define kWindowPositionSlop 20
|
#define kWindowPositionSlop 20
|
||||||
|
|
||||||
|
@ -699,7 +699,7 @@ nsWindow::nsWindow() : nsBaseWidget()
|
||||||
|
|
||||||
// Heap dump
|
// Heap dump
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessageW(kMozHeapDumpMessageString);
|
nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessage(kMozHeapDumpMessageString);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1119,26 +1119,26 @@ nsWindow::EventIsInsideWindow(UINT Msg, nsWindow* aWindow)
|
||||||
return (PRBool) PtInRect(&r, mp);
|
return (PRBool) PtInRect(&r, mp);
|
||||||
}
|
}
|
||||||
|
|
||||||
static PRUnichar sPropName[40] = L"";
|
static char sPropName[40] = "";
|
||||||
static PRUnichar* GetNSWindowPropName() {
|
static char* GetNSWindowPropName() {
|
||||||
if (!*sPropName)
|
if (!*sPropName)
|
||||||
{
|
{
|
||||||
_snwprintf(sPropName, 39, L"MozillansIWidgetPtr%p", _getpid());
|
_snprintf(sPropName, 39, "MozillansIWidgetPtr%p", _getpid());
|
||||||
sPropName[39] = '\0';
|
sPropName[39] = '\0';
|
||||||
}
|
}
|
||||||
return sPropName;
|
return sPropName;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsWindow * nsWindow::GetNSWindowPtr(HWND aWnd) {
|
nsWindow * nsWindow::GetNSWindowPtr(HWND aWnd) {
|
||||||
return (nsWindow *) ::GetPropW(aWnd, GetNSWindowPropName());
|
return (nsWindow *) ::GetPropA(aWnd, GetNSWindowPropName());
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL nsWindow::SetNSWindowPtr(HWND aWnd, nsWindow * ptr) {
|
BOOL nsWindow::SetNSWindowPtr(HWND aWnd, nsWindow * ptr) {
|
||||||
if (ptr == NULL) {
|
if (ptr == NULL) {
|
||||||
::RemovePropW(aWnd, GetNSWindowPropName());
|
::RemovePropA(aWnd, GetNSWindowPropName());
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else {
|
} else {
|
||||||
return ::SetPropW(aWnd, GetNSWindowPropName(), (HANDLE)ptr);
|
return ::SetPropA(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
|
// Play the minimize sound while we're here, since that is also
|
||||||
// forgotten when we use SW_SHOWMINIMIZED.
|
// forgotten when we use SW_SHOWMINIMIZED.
|
||||||
::PlaySoundW(L"Minimize", nsnull, SND_ALIAS | SND_NODEFAULT | SND_ASYNC);
|
::PlaySound("Minimize", nsnull, SND_ALIAS | SND_NODEFAULT | SND_ASYNC);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
break;
|
break;
|
||||||
|
@ -5192,7 +5192,7 @@ LPCWSTR nsWindow::WindowPopupClassW()
|
||||||
return className;
|
return className;
|
||||||
}
|
}
|
||||||
|
|
||||||
LPCTSTR nsWindow::WindowClass()
|
LPCSTR nsWindow::WindowClass()
|
||||||
{
|
{
|
||||||
// Call into the wide version to make sure things get
|
// Call into the wide version to make sure things get
|
||||||
// registered properly.
|
// registered properly.
|
||||||
|
@ -5200,9 +5200,7 @@ LPCTSTR nsWindow::WindowClass()
|
||||||
|
|
||||||
// XXX: The class name used here must be kept in sync with
|
// XXX: The class name used here must be kept in sync with
|
||||||
// the classname used in WindowClassW();
|
// the classname used in WindowClassW();
|
||||||
#ifdef UNICODE
|
|
||||||
return classNameW;
|
|
||||||
#else
|
|
||||||
if (classNameW == kWClassNameHidden) {
|
if (classNameW == kWClassNameHidden) {
|
||||||
return kClassNameHidden;
|
return kClassNameHidden;
|
||||||
}
|
}
|
||||||
|
@ -5219,21 +5217,17 @@ LPCTSTR nsWindow::WindowClass()
|
||||||
return kClassNameContentFrame;
|
return kClassNameContentFrame;
|
||||||
}
|
}
|
||||||
return kClassNameGeneral;
|
return kClassNameGeneral;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LPCTSTR nsWindow::WindowPopupClass()
|
LPCSTR nsWindow::WindowPopupClass()
|
||||||
{
|
{
|
||||||
// Call into the wide version to make sure things get
|
// Call into the wide version to make sure things get
|
||||||
// registered properly.
|
// registered properly.
|
||||||
#ifdef UNICODE
|
WindowPopupClassW();
|
||||||
return WindowPopupClassW();
|
|
||||||
#else
|
|
||||||
|
|
||||||
// XXX: The class name used here must be kept in sync with
|
// XXX: The class name used here must be kept in sync with
|
||||||
// the classname used in WindowPopupClassW();
|
// the classname used in WindowPopupClassW();
|
||||||
return "MozillaDropShadowWindowClass";
|
return "MozillaDropShadowWindowClass";
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -7724,7 +7718,7 @@ STDMETHODIMP_(LRESULT) nsWindow::LresultFromObject(REFIID riid, WPARAM wParam, L
|
||||||
{
|
{
|
||||||
// open the dll dynamically
|
// open the dll dynamically
|
||||||
if (!gmAccLib)
|
if (!gmAccLib)
|
||||||
gmAccLib =::LoadLibraryW(L"OLEACC.DLL");
|
gmAccLib =::LoadLibrary("OLEACC.DLL");
|
||||||
|
|
||||||
if (gmAccLib) {
|
if (gmAccLib) {
|
||||||
if (!gmLresultFromObject)
|
if (!gmLresultFromObject)
|
||||||
|
|
|
@ -105,13 +105,6 @@ const LPCSTR kClassNameContent = "MozillaContentWindowClass";
|
||||||
const LPCSTR kClassNameContentFrame = "MozillaContentFrameWindowClass";
|
const LPCSTR kClassNameContentFrame = "MozillaContentFrameWindowClass";
|
||||||
const LPCSTR kClassNameGeneral = "MozillaWindowClass";
|
const LPCSTR kClassNameGeneral = "MozillaWindowClass";
|
||||||
const LPCSTR kClassNameDialog = "MozillaDialogClass";
|
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.
|
* Native WIN32 window wrapper.
|
||||||
|
|
|
@ -66,11 +66,6 @@
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
|
||||||
#include <tchar.h>
|
|
||||||
#include "nsString.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
Abort(const char *aMsg);
|
Abort(const char *aMsg);
|
||||||
|
|
||||||
|
@ -102,7 +97,7 @@ PRBool InDebugger()
|
||||||
#ifndef WINCE
|
#ifndef WINCE
|
||||||
PRBool fReturn = PR_FALSE;
|
PRBool fReturn = PR_FALSE;
|
||||||
LPFNISDEBUGGERPRESENT lpfnIsDebuggerPresent = NULL;
|
LPFNISDEBUGGERPRESENT lpfnIsDebuggerPresent = NULL;
|
||||||
HINSTANCE hKernel = LoadLibraryW(L"Kernel32.dll");
|
HINSTANCE hKernel = LoadLibrary("Kernel32.dll");
|
||||||
|
|
||||||
if(hKernel)
|
if(hKernel)
|
||||||
{
|
{
|
||||||
|
@ -406,9 +401,9 @@ Break(const char *aMsg)
|
||||||
* See http://bugzilla.mozilla.org/show_bug.cgi?id=54792
|
* See http://bugzilla.mozilla.org/show_bug.cgi?id=54792
|
||||||
*/
|
*/
|
||||||
PROCESS_INFORMATION pi;
|
PROCESS_INFORMATION pi;
|
||||||
STARTUPINFOW si;
|
STARTUPINFO si;
|
||||||
PRUnichar executable[MAX_PATH];
|
char executable[MAX_PATH];
|
||||||
PRUnichar* pName;
|
char* pName;
|
||||||
|
|
||||||
memset(&pi, 0, sizeof(pi));
|
memset(&pi, 0, sizeof(pi));
|
||||||
|
|
||||||
|
@ -417,15 +412,13 @@ Break(const char *aMsg)
|
||||||
si.wShowWindow = SW_SHOW;
|
si.wShowWindow = SW_SHOW;
|
||||||
|
|
||||||
// 2nd arg of CreateProcess is in/out
|
// 2nd arg of CreateProcess is in/out
|
||||||
PRUnichar *msgCopy = (PRUnichar*) _alloca((strlen(aMsg) + 1)*sizeof(PRUnichar));
|
char *msgCopy = (char*) _alloca(strlen(aMsg) + 1);
|
||||||
wcscpy(msgCopy , (PRUnichar*)NS_ConvertUTF8toUTF16(aMsg).get());
|
strcpy(msgCopy, aMsg);
|
||||||
|
|
||||||
if(GetModuleFileNameW(GetModuleHandleW(L"xpcom.dll"), (LPWCH)executable, MAX_PATH) &&
|
if(GetModuleFileName(GetModuleHandle("xpcom.dll"), executable, MAX_PATH) &&
|
||||||
NULL != (pName = wcsrchr(executable, '\\')) &&
|
NULL != (pName = strrchr(executable, '\\')) &&
|
||||||
NULL !=
|
NULL != strcpy(pName+1, "windbgdlg.exe") &&
|
||||||
wcscpy((WCHAR*)
|
CreateProcess(executable, msgCopy, NULL, NULL, PR_FALSE,
|
||||||
pName+1, L"windbgdlg.exe") &&
|
|
||||||
CreateProcessW((LPCWSTR)executable, (LPWSTR)msgCopy, NULL, NULL, PR_FALSE,
|
|
||||||
DETACHED_PROCESS | NORMAL_PRIORITY_CLASS,
|
DETACHED_PROCESS | NORMAL_PRIORITY_CLASS,
|
||||||
NULL, NULL, &si, &pi)) {
|
NULL, NULL, &si, &pi)) {
|
||||||
WaitForSingleObject(pi.hProcess, INFINITE);
|
WaitForSingleObject(pi.hProcess, INFINITE);
|
||||||
|
|
|
@ -328,9 +328,9 @@ EnsureImageHlpInitialized()
|
||||||
|
|
||||||
::InitializeCriticalSection(&gDbgHelpCS);
|
::InitializeCriticalSection(&gDbgHelpCS);
|
||||||
|
|
||||||
HMODULE module = ::LoadLibraryW(L"DBGHELP.DLL");
|
HMODULE module = ::LoadLibrary("DBGHELP.DLL");
|
||||||
if (!module) {
|
if (!module) {
|
||||||
module = ::LoadLibraryW(L"IMAGEHLP.DLL");
|
module = ::LoadLibrary("IMAGEHLP.DLL");
|
||||||
if (!module) return PR_FALSE;
|
if (!module) return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -127,7 +127,7 @@ NS_COM void StartupSpecialSystemDirectory()
|
||||||
#if defined (XP_WIN) && !defined (WINCE)
|
#if defined (XP_WIN) && !defined (WINCE)
|
||||||
// SHGetKnownFolderPath is only available on Windows Vista
|
// SHGetKnownFolderPath is only available on Windows Vista
|
||||||
// so that we need to use GetProcAddress to get the pointer.
|
// so that we need to use GetProcAddress to get the pointer.
|
||||||
gShell32DLLInst = LoadLibraryW(L"Shell32.dll");
|
gShell32DLLInst = LoadLibrary("Shell32.dll");
|
||||||
if(gShell32DLLInst)
|
if(gShell32DLLInst)
|
||||||
{
|
{
|
||||||
gGetKnownFolderPath = (nsGetKnownFolderPath)
|
gGetKnownFolderPath = (nsGetKnownFolderPath)
|
||||||
|
|
|
@ -108,8 +108,8 @@ private:
|
||||||
* HasMoreElements reads mLetter.
|
* HasMoreElements reads mLetter.
|
||||||
* GetNext advances mLetter.
|
* GetNext advances mLetter.
|
||||||
*/
|
*/
|
||||||
nsString mDrives;
|
nsCString mDrives;
|
||||||
const PRUnichar *mLetter;
|
const char *mLetter;
|
||||||
};
|
};
|
||||||
|
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
@ -2952,7 +2952,7 @@ nsresult nsDriveEnumerator::Init()
|
||||||
/* The string is null terminated */
|
/* The string is null terminated */
|
||||||
if (!EnsureStringLength(mDrives, length+1))
|
if (!EnsureStringLength(mDrives, length+1))
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
if (!GetLogicalDriveStringsW(length, mDrives.BeginWriting()))
|
if (!GetLogicalDriveStrings(length, mDrives.BeginWriting()))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
mLetter = mDrives.get();
|
mLetter = mDrives.get();
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
@ -2982,9 +2982,8 @@ NS_IMETHODIMP nsDriveEnumerator::GetNext(nsISupports **aNext)
|
||||||
*aNext = nsnull;
|
*aNext = nsnull;
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
nsString drive(mDrives);
|
NS_ConvertASCIItoUTF16 drive(mLetter);
|
||||||
mLetter += drive.Length() + 1;
|
mLetter += drive.Length() + 1;
|
||||||
|
|
||||||
nsILocalFile *file;
|
nsILocalFile *file;
|
||||||
nsresult rv =
|
nsresult rv =
|
||||||
NS_NewLocalFile(drive, PR_FALSE, &file);
|
NS_NewLocalFile(drive, PR_FALSE, &file);
|
||||||
|
|
|
@ -106,11 +106,10 @@ nsProcess::Init(nsIFile* executable)
|
||||||
|
|
||||||
|
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
static int assembleCmdLine(char *const *argv, PRUnichar **cmdLine)
|
static int assembleCmdLine(char *const *argv, char **cmdLine)
|
||||||
{
|
{
|
||||||
char *const *arg;
|
char *const *arg;
|
||||||
PRUnichar *p;
|
char *p, *q;
|
||||||
char *q;
|
|
||||||
int cmdLineSize;
|
int cmdLineSize;
|
||||||
int numBackslashes;
|
int numBackslashes;
|
||||||
int i;
|
int i;
|
||||||
|
@ -132,7 +131,7 @@ static int assembleCmdLine(char *const *argv, PRUnichar **cmdLine)
|
||||||
+ 2 /* we quote every argument */
|
+ 2 /* we quote every argument */
|
||||||
+ 1; /* space in between, or final null */
|
+ 1; /* space in between, or final null */
|
||||||
}
|
}
|
||||||
p = *cmdLine = (PRUnichar *) PR_MALLOC(cmdLineSize*sizeof(PRUnichar));
|
p = *cmdLine = (char *) PR_MALLOC(cmdLineSize);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -238,10 +237,10 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count,
|
||||||
my_argv[count+1] = NULL;
|
my_argv[count+1] = NULL;
|
||||||
|
|
||||||
#if defined(XP_WIN) && !defined (WINCE) /* wince uses nspr */
|
#if defined(XP_WIN) && !defined (WINCE) /* wince uses nspr */
|
||||||
STARTUPINFOW startupInfo;
|
STARTUPINFO startupInfo;
|
||||||
PROCESS_INFORMATION procInfo;
|
PROCESS_INFORMATION procInfo;
|
||||||
BOOL retVal;
|
BOOL retVal;
|
||||||
PRUnichar *cmdLine;
|
char *cmdLine;
|
||||||
|
|
||||||
if (assembleCmdLine(my_argv, &cmdLine) == -1) {
|
if (assembleCmdLine(my_argv, &cmdLine) == -1) {
|
||||||
nsMemory::Free(my_argv);
|
nsMemory::Free(my_argv);
|
||||||
|
@ -251,20 +250,20 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count,
|
||||||
ZeroMemory(&startupInfo, sizeof(startupInfo));
|
ZeroMemory(&startupInfo, sizeof(startupInfo));
|
||||||
startupInfo.cb = sizeof(startupInfo);
|
startupInfo.cb = sizeof(startupInfo);
|
||||||
|
|
||||||
retVal = CreateProcessW(NULL,
|
retVal = CreateProcess(NULL,
|
||||||
// const_cast<char*>(mTargetPath.get()),
|
// const_cast<char*>(mTargetPath.get()),
|
||||||
cmdLine,
|
cmdLine,
|
||||||
NULL, /* security attributes for the new
|
NULL, /* security attributes for the new
|
||||||
* process */
|
* process */
|
||||||
NULL, /* security attributes for the primary
|
NULL, /* security attributes for the primary
|
||||||
* thread in the new process */
|
* thread in the new process */
|
||||||
FALSE, /* inherit handles */
|
FALSE, /* inherit handles */
|
||||||
0, /* creation flags */
|
0, /* creation flags */
|
||||||
NULL, /* env */
|
NULL, /* env */
|
||||||
NULL, /* current drive and directory */
|
NULL, /* current drive and directory */
|
||||||
&startupInfo,
|
&startupInfo,
|
||||||
&procInfo
|
&procInfo
|
||||||
);
|
);
|
||||||
PR_Free( cmdLine );
|
PR_Free( cmdLine );
|
||||||
if (blocking) {
|
if (blocking) {
|
||||||
|
|
||||||
|
|
|
@ -42,8 +42,6 @@ VPATH = @srcdir@
|
||||||
|
|
||||||
include $(DEPTH)/config/autoconf.mk
|
include $(DEPTH)/config/autoconf.mk
|
||||||
|
|
||||||
OS_LIBS += shell32.lib
|
|
||||||
|
|
||||||
SIMPLE_PROGRAMS = windbgdlg$(BIN_SUFFIX)
|
SIMPLE_PROGRAMS = windbgdlg$(BIN_SUFFIX)
|
||||||
|
|
||||||
CPPSRCS = windbgdlg.cpp
|
CPPSRCS = windbgdlg.cpp
|
||||||
|
|
|
@ -42,7 +42,6 @@
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <shellapi.h>
|
|
||||||
|
|
||||||
int WINAPI
|
int WINAPI
|
||||||
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
|
@ -60,11 +59,10 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
DWORD regValue = -1;
|
DWORD regValue = -1;
|
||||||
DWORD regLength = sizeof regValue;
|
DWORD regLength = sizeof regValue;
|
||||||
HKEY hkeyCU, hkeyLM;
|
HKEY hkeyCU, hkeyLM;
|
||||||
RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU);
|
RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU);
|
||||||
RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM);
|
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM);
|
||||||
int argc =0;
|
const char * const * argv = __argv;
|
||||||
LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc);
|
for (int i = __argc - 1; regValue == (DWORD)-1 && i; --i) {
|
||||||
for (int i = argc - 1; regValue == (DWORD)-1 && i; --i) {
|
|
||||||
bool ok = false;
|
bool ok = false;
|
||||||
if (hkeyCU)
|
if (hkeyCU)
|
||||||
ok = RegQueryValueEx(hkeyCU, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS;
|
ok = RegQueryValueEx(hkeyCU, argv[i], 0, ®Type, (LPBYTE)®Value, ®Length) == ERROR_SUCCESS;
|
||||||
|
@ -79,15 +77,15 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
RegCloseKey(hkeyLM);
|
RegCloseKey(hkeyLM);
|
||||||
if (regValue != (DWORD)-1 && regValue != (DWORD)-2)
|
if (regValue != (DWORD)-1 && regValue != (DWORD)-2)
|
||||||
return regValue;
|
return regValue;
|
||||||
static PRUnichar msg[4048];
|
static char msg[4048];
|
||||||
|
|
||||||
wsprintf(msg,
|
wsprintf(msg,
|
||||||
L"%s\n\nClick Abort to exit the Application.\n"
|
"%s\n\nClick Abort to exit the Application.\n"
|
||||||
L"Click Retry to Debug the Application..\n"
|
"Click Retry to Debug the Application..\n"
|
||||||
L"Click Ignore to continue running the Application.",
|
"Click Ignore to continue running the Application.",
|
||||||
lpszCmdLine);
|
lpszCmdLine);
|
||||||
|
|
||||||
return MessageBoxW(NULL, msg, L"NSGlue_Assertion",
|
return MessageBox(NULL, msg, "NSGlue_Assertion",
|
||||||
MB_ICONSTOP | MB_SYSTEMMODAL|
|
MB_ICONSTOP | MB_SYSTEMMODAL|
|
||||||
MB_ABORTRETRYIGNORE | MB_DEFBUTTON3);
|
MB_ABORTRETRYIGNORE | MB_DEFBUTTON3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,7 +39,6 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "nscore.h"
|
#include "nscore.h"
|
||||||
#include "nsString.h"
|
|
||||||
|
|
||||||
//defines and includes for previous installation cleanup process
|
//defines and includes for previous installation cleanup process
|
||||||
#if defined (XP_WIN)
|
#if defined (XP_WIN)
|
||||||
|
@ -64,18 +63,15 @@ printf("\n****Inside ShowOSAlert ***\n");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
const PRInt32 max_len = 255;
|
const PRInt32 max_len = 255;
|
||||||
|
char message_copy[max_len+1] = { 0 };
|
||||||
PRInt32 input_len = strlen(aMessage);
|
PRInt32 input_len = strlen(aMessage);
|
||||||
PRInt32 copy_len = (input_len > max_len) ? max_len : input_len;
|
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);
|
strncpy(message_copy, aMessage, copy_len);
|
||||||
message_copy[copy_len] = 0;
|
message_copy[copy_len] = 0;
|
||||||
#endif
|
|
||||||
#if (XP_MAC)
|
#if defined (XP_WIN)
|
||||||
|
MessageBoxA(NULL, message_copy, NULL, MB_OK | MB_ICONERROR | MB_SETFOREGROUND );
|
||||||
|
#elif (XP_MAC)
|
||||||
short buttonClicked;
|
short buttonClicked;
|
||||||
StandardAlert(kAlertStopAlert, c2pstr(message_copy), nil, nil, &buttonClicked);
|
StandardAlert(kAlertStopAlert, c2pstr(message_copy), nil, nil, &buttonClicked);
|
||||||
#elif defined (XP_OS2)
|
#elif defined (XP_OS2)
|
||||||
|
|
Загрузка…
Ссылка в новой задаче