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:
blassey@mozilla.com 2008-03-05 14:56:43 -08:00
parent 1ebe0d6f34
commit 92c51991b0
58 changed files with 551 additions and 526 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -396,8 +396,8 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs
rv = appHelper->AppendNative(NS_LITERAL_CSTRING("helper.exe"));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString appHelperPath;
rv = appHelper->GetPath(appHelperPath);
nsCAutoString appHelperPath;
rv = appHelper->GetNativePath(appHelperPath);
NS_ENSURE_SUCCESS(rv, rv);
if (aForAllUsers) {
@ -406,10 +406,10 @@ nsWindowsShellService::SetDefaultBrowser(PRBool aClaimAllTypes, PRBool aForAllUs
appHelperPath.AppendLiteral(" /SetAsDefaultAppUser");
}
STARTUPINFOW si = {sizeof(si), 0};
STARTUPINFO si = {sizeof(si), 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);
if (!ok)

View File

@ -929,6 +929,16 @@ morkStdioFile::Steal(nsIMdbEnv* ev, nsIMdbFile* ioThief)
void mork_fileflush(FILE * file)
{
fflush(file);
#ifndef WINCE
OSVERSIONINFOA vi = { sizeof(OSVERSIONINFOA) };
if ((GetVersionExA(&vi) && vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS))
{
// Win9x/ME
int fd = fileno(file);
HANDLE fh = (HANDLE)_get_osfhandle(fd);
FlushFileBuffers(fh);
}
#endif
}
#endif /*MORK_WIN*/

View File

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

View File

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

View File

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

View File

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

View File

@ -44,12 +44,18 @@
nsresult nsSystemFontsWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
nsString *aFontName,
gfxFontStyle *aFontStyle) const
nsString *aFontName,
gfxFontStyle *aFontStyle,
PRBool aIsWide) const
{
PRUnichar name[LF_FACESIZE];
name[0] = 0;
if (aIsWide)
memcpy(name, ptrLogFont->lfFaceName, LF_FACESIZE*2);
else {
MultiByteToWideChar(CP_ACP, 0, ptrLogFont->lfFaceName,
strlen(ptrLogFont->lfFaceName) + 1, name, sizeof(name)/sizeof(name[0]));
}
*aFontName = name;
// Do Style

View File

@ -51,7 +51,8 @@ public:
gfxFontStyle *aFontStyle) const;
private:
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,
nsString *aFontName,
gfxFontStyle *aFontStyle) const;

View File

@ -310,7 +310,7 @@ NS_IMETHODIMP nsDeviceContextWin :: SetCanonicalPixelScale(float aScale)
nsresult nsDeviceContextWin::CopyLogFontToNSFont(HDC* aHDC, const LOGFONT* ptrLogFont,
nsFont* aFont) const
nsFont* aFont, PRBool aIsWide) const
{
PRUnichar name[LF_FACESIZE];
name[0] = 0;

View File

@ -101,7 +101,8 @@ protected:
void ComputeFullAreaUsingScreen ( nsRect* outRect ) ;
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 mCachedFullRect;

View File

@ -2121,9 +2121,40 @@ nsGlyphAgent::GetGlyphMetrics(HDC aDC,
GLYPHMETRICS* aGlyphMetrics)
{
memset(aGlyphMetrics, 0, sizeof(GLYPHMETRICS)); // UMR: bug 46438
if (eGlyphAgent_UNKNOWN == mState) { // first time we have been in this function
// see if this platform implements GetGlyphOutlineW()
DWORD len = GetGlyphOutlineW(aDC, aChar, GGO_METRICS, aGlyphMetrics, 0, nsnull, &mMat);
if (GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) {
// next time, we won't bother trying GetGlyphOutlineW()
mState = eGlyphAgent_ANSI;
}
else {
// all is well with GetGlyphOutlineW(), we will be using it from now on
mState = eGlyphAgent_UNICODE;
return 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

View File

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

View File

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

View File

@ -133,7 +133,7 @@ nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACS
{
nsCOMPtr<nsIWin32Locale> winLocale;
LCID localeAsLCID;
PRUnichar acp_name[6];
char acp_name[6];
//
// convert locale name to a code page (through the LCID)
@ -147,11 +147,11 @@ nsPlatformCharset::GetDefaultCharsetForLocale(const nsAString& localeName, nsACS
rv = winLocale->GetPlatformLocale(localeName, &localeAsLCID);
if (NS_FAILED(rv)) { return rv; }
if (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;
}
nsAutoString acp_key(NS_LITERAL_STRING("acp."));
acp_key.Append(acp_name);
acp_key.AppendWithConversion(acp_name);
return MapToCharset(acp_key, oResult);
}

View File

@ -112,7 +112,7 @@ ipcThreadWindowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
cd.dwData = GetCurrentProcessId();
cd.cbData = (DWORD) msg->MsgLen();
cd.lpData = (PVOID) msg->MsgBuf();
SendMessage(ipcDaemonHwnd, WM_COPYDATA, (WPARAM) hWnd, (LPARAM) &cd);
SendMessageA(ipcDaemonHwnd, WM_COPYDATA, (WPARAM) hWnd, (LPARAM) &cd);
LOG((" done.\n"));
delete msg;
}

View File

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

View File

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

View File

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

View File

@ -66,14 +66,14 @@ ClearVersion(verBlock *ver)
}
static BOOL
FileExists(wchar_t* szFile)
FileExists(LPCSTR szFile)
{
return GetFileAttributesW(szFile) != 0xFFFFFFFF;
return GetFileAttributes(szFile) != 0xFFFFFFFF;
}
// Get file version information from a file
static BOOL
GetFileVersion(wchar_t* szFile, verBlock *vbVersion)
GetFileVersion(LPSTR szFile, verBlock *vbVersion)
{
UINT uLen;
UINT dwLen;
@ -86,12 +86,12 @@ GetFileVersion(wchar_t* szFile, verBlock *vbVersion)
ClearVersion(vbVersion);
if (FileExists(szFile)) {
bRv = TRUE;
dwLen = GetFileVersionInfoSizeW(szFile, &dwHandle);
dwLen = GetFileVersionInfoSize(szFile, &dwHandle);
lpData = (LPVOID)malloc(dwLen);
uLen = 0;
if (lpData && GetFileVersionInfoW(szFile, dwHandle, dwLen, lpData) != 0) {
if (VerQueryValueW(lpData, L"\\", &lpBuffer, &uLen) != 0) {
if (lpData && GetFileVersionInfo(szFile, dwHandle, dwLen, lpData) != 0) {
if (VerQueryValue(lpData, "\\", &lpBuffer, &uLen) != 0) {
lpBuffer2 = (VS_FIXEDFILEINFO *)lpBuffer;
vbVersion->wMajor = HIWORD(lpBuffer2->dwFileVersionMS);
@ -124,15 +124,15 @@ CopyVersion(verBlock *ver1, verBlock *ver2)
static void
TranslateVersionStr(const char* szVersion, verBlock *vbVersion)
{
char* szNum1 = NULL;
char* szNum2 = NULL;
char* szNum3 = NULL;
char* szNum4 = NULL;
char* szJavaBuild = NULL;
LPSTR szNum1 = NULL;
LPSTR szNum2 = NULL;
LPSTR szNum3 = NULL;
LPSTR szNum4 = NULL;
LPSTR szJavaBuild = NULL;
char* strVer = nsnull;
char *strVer = nsnull;
if (szVersion) {
strVer = strdup(szVersion);
strVer = PL_strdup(szVersion);
}
if (!strVer) {
@ -157,7 +157,7 @@ TranslateVersionStr(const char* szVersion, verBlock *vbVersion)
vbVersion->wRelease = szNum3 ? atoi(szNum3) : 0;
vbVersion->wBuild = szNum4 ? atoi(szNum4) : 0;
free(strVer);
PL_strfree(strVer);
}
// 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
// Plug-In if it's available
static PRBool
TryToUseNPRuntimeJavaPlugIn(const wchar_t* javaVersion)
TryToUseNPRuntimeJavaPlugIn(const char* javaVersion)
{
HKEY javaKey = NULL;
wchar_t keyName[_MAX_PATH];
wcsncpy(keyName, L"Software\\JavaSoft\\Java Plug-in\\", wcslen(L"Software\\JavaSoft\\Java Plug-in\\"));
wcscpy(keyName, javaVersion);
char keyName[_MAX_PATH];
keyName[0] = 0;
PL_strcat(keyName, "Software\\JavaSoft\\Java Plug-in\\");
PL_strcat(keyName, javaVersion);
DWORD val;
DWORD valSize = sizeof(DWORD);
if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE,
if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
keyName, 0, KEY_READ, &javaKey)) {
return FALSE;
}
// Look for "UseNewJavaPlugin"
if (ERROR_SUCCESS != ::RegQueryValueExW(javaKey,
L"UseNewJavaPlugin",
NULL, NULL,
(LPBYTE) &val,
&valSize)) {
if (ERROR_SUCCESS != ::RegQueryValueEx(javaKey, "UseNewJavaPlugin",
NULL, NULL,
(LPBYTE) &val,
&valSize)) {
val = 0;
}
@ -264,7 +262,7 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
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
// explictly overriden failure to get the pref is okay, we'll do
// what we've been doing -- a filtered scan
@ -279,38 +277,38 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
HKEY keyloc;
long result;
DWORD type;
wchar_t szKey[_MAX_PATH] = L"Software\\Netscape\\Netscape Navigator";
wchar_t path[_MAX_PATH];
char szKey[_MAX_PATH] = "Software\\Netscape\\Netscape Navigator";
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) {
wchar_t current_version[80];
char current_version[80];
DWORD length = sizeof(current_version);
result = ::RegQueryValueExW(keyloc, L"CurrentVersion", NULL, &type,
result = ::RegQueryValueEx(keyloc, "CurrentVersion", NULL, &type,
(LPBYTE)&current_version, &length);
::RegCloseKey(keyloc);
wcscat(szKey, L"\\");
wcscat(szKey, current_version);
wcscat(szKey, L"\\Main");
result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc);
PL_strcat(szKey, "\\");
PL_strcat(szKey, current_version);
PL_strcat(szKey, "\\Main");
result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, szKey, 0, KEY_READ, &keyloc);
if (result == ERROR_SUCCESS) {
DWORD pathlen = sizeof(path);
result = ::RegQueryValueExW(keyloc, L"Plugins Directory", NULL, &type,
result = ::RegQueryValueEx(keyloc, "Plugins Directory", NULL, &type,
(LPBYTE)&path, &pathlen);
if (result == ERROR_SUCCESS) {
rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE,
getter_AddRefs(localFile));
rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE,
getter_AddRefs(localFile));
}
::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;
#ifdef OJI
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
@ -330,25 +328,24 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
DWORD pathlen;
verBlock maxVer;
ClearVersion(&maxVer);
wchar_t curKey[_MAX_PATH] = L"Software\\JavaSoft\\Java Runtime Environment";
wchar_t path[_MAX_PATH];
char curKey[_MAX_PATH] = "Software\\JavaSoft\\Java Runtime Environment";
char path[_MAX_PATH];
// Add + 15 to prevent buffer overrun when adding \bin (+ optionally
// \new_plugin)
#define JAVA_PATH_SIZE _MAX_PATH + 15
wchar_t newestPath[JAVA_PATH_SIZE];
const wchar_t mozPath[_MAX_PATH] = L"Software\\mozilla.org\\Mozilla";
wchar_t browserJavaVersion[_MAX_PATH];
char newestPath[JAVA_PATH_SIZE];
const char mozPath[_MAX_PATH] = "Software\\mozilla.org\\Mozilla";
char browserJavaVersion[_MAX_PATH];
PRBool tryNPRuntimeJavaPlugIn = PR_FALSE;
newestPath[0] = 0;
LONG result = ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ,
LONG result = ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0, KEY_READ,
&baseloc);
if (ERROR_SUCCESS != result)
return NS_ERROR_FAILURE;
// Look for "BrowserJavaVersion"
if (ERROR_SUCCESS != ::RegQueryValueExW(baseloc, L"BrowserJavaVersion", NULL,
if (ERROR_SUCCESS != ::RegQueryValueEx(baseloc, "BrowserJavaVersion", NULL,
NULL, (LPBYTE)&browserJavaVersion,
&numChars))
browserJavaVersion[0] = 0;
@ -359,13 +356,13 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
path[0] = 0;
numChars = _MAX_PATH;
pathlen = sizeof(path);
result = ::RegEnumKeyExW(baseloc, index, curKey, &numChars, NULL, NULL,
result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL,
NULL, &modTime);
index++;
// Skip major.minor as it always points to latest in its family
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 == '.') {
numChars++;
}
@ -374,24 +371,24 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
continue;
if (ERROR_SUCCESS == result) {
if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, curKey, 0,
if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0,
KEY_QUERY_VALUE, &keyloc)) {
// We have a sub key
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"JavaHome", NULL,
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "JavaHome", NULL,
&type, (LPBYTE)&path,
&pathlen)) {
verBlock curVer;
TranslateVersionStr(NS_ConvertUTF16toUTF8(curKey).get(), &curVer);
TranslateVersionStr(curKey, &curVer);
if (CompareVersion(curVer, minVer) >= 0) {
if (!wcsncmp(browserJavaVersion, curKey, _MAX_PATH)) {
wcscpy(newestPath, path);
if (!strncmp(browserJavaVersion, curKey, _MAX_PATH)) {
PL_strcpy(newestPath, path);
tryNPRuntimeJavaPlugIn = TryToUseNPRuntimeJavaPlugIn(curKey);
::RegCloseKey(keyloc);
break;
}
if (CompareVersion(curVer, maxVer) >= 0) {
wcscpy(newestPath, path);
PL_strcpy(newestPath, path);
CopyVersion(&maxVer, &curVer);
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
// CurrentVersion for Mozilla
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,
KEY_SET_VALUE|KEY_QUERY_VALUE,
NULL, &entryloc, NULL)) {
if (ERROR_SUCCESS != ::RegQueryValueExW(entryloc, L"CurrentVersion", 0,
if (ERROR_SUCCESS != ::RegQueryValueEx(entryloc, "CurrentVersion", 0,
NULL, NULL, NULL)) {
::RegSetValueExW(entryloc, L"CurrentVersion", 0, REG_SZ,
::RegSetValueEx(entryloc, "CurrentVersion", 0, REG_SZ,
(const BYTE*)MOZILLA_VERSION,
sizeof(MOZILLA_VERSION));
}
::RegCloseKey(entryloc);
}
wcscat(newestPath,L"\\bin");
PL_strcat(newestPath,"\\bin");
// See whether we should use the new NPRuntime-based Java Plug-In:
// - If tryNPRuntimeJavaPlugIn is true, and
@ -430,13 +427,13 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
// one any more.
if (tryNPRuntimeJavaPlugIn) {
// See whether the "new_plugin" directory exists
wchar_t tmpPath[JAVA_PATH_SIZE];
wcscpy(tmpPath, newestPath);
wcscat(tmpPath, L"\\new_plugin");
char tmpPath[JAVA_PATH_SIZE];
PL_strcpy(tmpPath, newestPath);
PL_strcat(tmpPath, "\\new_plugin");
nsCOMPtr<nsILocalFile> tmpFile;
if (NS_SUCCEEDED(NS_NewLocalFile(nsDependentString(tmpPath),
PR_TRUE,
getter_AddRefs(tmpFile))) &&
if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(tmpPath),
PR_TRUE,
getter_AddRefs(tmpFile))) &&
tmpFile) {
PRBool exists = 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
// directory for the Java Plug-In instead of the normal
// one
wcscpy(newestPath, tmpPath);
PL_strcpy(newestPath, tmpPath);
}
}
}
rv = NS_NewLocalFile(nsDependentString(newestPath), PR_TRUE,
getter_AddRefs(localFile));
rv = NS_NewNativeLocalFile(nsDependentCString(newestPath), PR_TRUE,
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;
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
return NS_ERROR_FAILURE;
@ -466,33 +463,33 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
DWORD type;
verBlock qtVer;
ClearVersion(&qtVer);
wchar_t path[_MAX_PATH];
char path[_MAX_PATH];
DWORD pathlen = sizeof(path);
// First we need to check the version of Quicktime via checking
// the EXE's version table
if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\QuickTimePlayer.exe", 0, KEY_READ, &keyloc)) {
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type,
(LPBYTE)&path, &pathlen)) {
GetFileVersion(path, &qtVer);
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\QuickTimePlayer.exe", 0, KEY_READ, &keyloc)) {
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type,
(LPBYTE)&path, &pathlen)) {
GetFileVersion((char*)path, &qtVer);
}
::RegCloseKey(keyloc);
}
if (CompareVersion(qtVer, minVer) < 0)
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);
result = ::RegQueryValueExW(keyloc, L"InstallDir", NULL, &type,
result = ::RegQueryValueEx(keyloc, "InstallDir", NULL, &type,
(LPBYTE)&path, &pathlen);
wcscat(path, L"\\Plugins");
PL_strcat(path, "\\Plugins");
if (result == ERROR_SUCCESS)
rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE,
getter_AddRefs(localFile));
rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE,
getter_AddRefs(localFile));
::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;
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer))))
return NS_ERROR_FAILURE;
@ -504,33 +501,33 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
DWORD type;
verBlock wmpVer;
ClearVersion(&wmpVer);
wchar_t path[_MAX_PATH];
char path[_MAX_PATH];
DWORD pathlen = sizeof(path);
// 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 == ::RegQueryValueExW(keyloc, NULL, NULL, &type,
(LPBYTE)&path, &pathlen)) {
GetFileVersion(path, &wmpVer);
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, "software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\wmplayer.exe", 0, KEY_READ, &keyloc)) {
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type,
(LPBYTE)&path, &pathlen)) {
GetFileVersion((char*)path, &wmpVer);
}
::RegCloseKey(keyloc);
}
if (CompareVersion(wmpVer, minVer) < 0)
return rv;
if (ERROR_SUCCESS == ::RegOpenKeyExW(HKEY_LOCAL_MACHINE,
L"software\\Microsoft\\MediaPlayer", 0,
if (ERROR_SUCCESS == ::RegOpenKeyEx(HKEY_LOCAL_MACHINE,
"software\\Microsoft\\MediaPlayer", 0,
KEY_READ, &keyloc)) {
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, L"Installation Directory",
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, "Installation Directory",
NULL, &type, (LPBYTE)&path,
&pathlen)) {
rv = NS_NewLocalFile(nsDependentString(path), PR_TRUE,
getter_AddRefs(localFile));
rv = NS_NewNativeLocalFile(nsDependentCString(path), PR_TRUE,
getter_AddRefs(localFile));
}
::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;
if (NS_FAILED(prefs->GetCharPref(prop, getter_Copies(strVer)))) {
return NS_ERROR_FAILURE;
@ -549,16 +546,16 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
DWORD pathlen;
verBlock maxVer;
ClearVersion(&maxVer);
wchar_t curKey[_MAX_PATH] = L"software\\Adobe\\Acrobat Reader";
wchar_t path[_MAX_PATH];
char curKey[_MAX_PATH] = "software\\Adobe\\Acrobat Reader";
char path[_MAX_PATH];
// Add + 8 to prevent buffer overrun when adding \browser
wchar_t newestPath[_MAX_PATH + 8];
char newestPath[_MAX_PATH + 8];
newestPath[0] = 0;
if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0,
if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0,
KEY_READ, &baseloc)) {
wcscpy(curKey, L"software\\Adobe\\Adobe Acrobat");
if (ERROR_SUCCESS != ::RegOpenKeyExW(HKEY_LOCAL_MACHINE, curKey, 0,
PL_strcpy(curKey, "software\\Adobe\\Adobe Acrobat");
if (ERROR_SUCCESS != ::RegOpenKeyEx(HKEY_LOCAL_MACHINE, curKey, 0,
KEY_READ, &baseloc)) {
return NS_ERROR_FAILURE;
}
@ -571,22 +568,22 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
path[0] = 0;
numChars = _MAX_PATH;
pathlen = sizeof(path);
result = ::RegEnumKeyExW(baseloc, index, curKey, &numChars, NULL, NULL,
result = ::RegEnumKeyEx(baseloc, index, curKey, &numChars, NULL, NULL,
NULL, &modTime);
index++;
if (ERROR_SUCCESS == result) {
verBlock curVer;
TranslateVersionStr(NS_ConvertUTF16toUTF8(curKey).get(), &curVer);
wcscat(curKey, L"\\InstallPath");
if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, curKey, 0,
TranslateVersionStr(curKey, &curVer);
PL_strcat(curKey, "\\InstallPath");
if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, curKey, 0,
KEY_QUERY_VALUE, &keyloc)) {
// We have a sub key
if (ERROR_SUCCESS == ::RegQueryValueExW(keyloc, NULL, NULL, &type,
if (ERROR_SUCCESS == ::RegQueryValueEx(keyloc, NULL, NULL, &type,
(LPBYTE)&path, &pathlen)) {
if (CompareVersion(curVer, maxVer) >= 0 &&
CompareVersion(curVer, minVer) >= 0) {
wcscpy(newestPath, path);
PL_strcpy(newestPath, path);
CopyVersion(&maxVer, &curVer);
}
}
@ -599,9 +596,9 @@ nsPluginDirServiceProvider::GetFile(const char *prop, PRBool *persistant,
::RegCloseKey(baseloc);
if (newestPath[0] != 0) {
wcscat(newestPath, L"\\browser");
rv = NS_NewLocalFile(nsDependentString(newestPath), PR_TRUE,
getter_AddRefs(localFile));
PL_strcat(newestPath,"\\browser");
rv = NS_NewNativeLocalFile(nsDependentCString(newestPath), PR_TRUE,
getter_AddRefs(localFile));
}
}
@ -629,32 +626,32 @@ nsPluginDirServiceProvider::GetPLIDDirectories(nsISimpleEnumerator **aEnumerator
nsresult
nsPluginDirServiceProvider::GetPLIDDirectoriesWithHKEY(HKEY aKey, nsCOMArray<nsILocalFile> &aDirs)
{
wchar_t subkey[_MAX_PATH] = L"Software\\MozillaPlugins";
char subkey[_MAX_PATH] = "Software\\MozillaPlugins";
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;
DWORD index = 0;
DWORD subkeylen = _MAX_PATH;
FILETIME modTime;
while (ERROR_SUCCESS == ::RegEnumKeyExW(baseloc, index++, subkey, &subkeylen,
while (ERROR_SUCCESS == ::RegEnumKeyEx(baseloc, index++, subkey, &subkeylen,
NULL, NULL, NULL, &modTime)) {
subkeylen = _MAX_PATH;
HKEY keyloc;
if (ERROR_SUCCESS == ::RegOpenKeyExW(baseloc, subkey, 0, KEY_QUERY_VALUE,
if (ERROR_SUCCESS == ::RegOpenKeyEx(baseloc, subkey, 0, KEY_QUERY_VALUE,
&keyloc)) {
DWORD type;
wchar_t path[_MAX_PATH];
char path[_MAX_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)) {
nsCOMPtr<nsILocalFile> localFile;
if (NS_SUCCEEDED(NS_NewLocalFile(nsDependentString(path),
PR_TRUE,
getter_AddRefs(localFile))) &&
if (NS_SUCCEEDED(NS_NewNativeLocalFile(nsDependentCString(path),
PR_TRUE,
getter_AddRefs(localFile))) &&
localFile) {
// Some vendors use a path directly to the DLL so chop off
// the filename

View File

@ -4017,18 +4017,18 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType,
#ifdef XP_WIN
static BOOL firstJavaPlugin = FALSE;
BOOL restoreOrigDir = FALSE;
PRUnichar origDir[_MAX_PATH];
char origDir[_MAX_PATH];
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");
nsCOMPtr<nsIFile> binDirectory;
result = NS_GetSpecialDirectory(NS_XPCOM_CURRENT_PROCESS_DIR,
getter_AddRefs(binDirectory));
if (NS_SUCCEEDED(result)) {
nsAutoString path;
binDirectory->GetPath(path);
restoreOrigDir = ::SetCurrentDirectoryW(path.get());
nsCAutoString path;
binDirectory->GetNativePath(path);
restoreOrigDir = ::SetCurrentDirectory(path.get());
}
}
#endif
@ -4036,7 +4036,7 @@ nsPluginHostImpl::TrySetUpPluginInstance(const char *aMimeType,
#ifdef XP_WIN
if (!firstJavaPlugin && restoreOrigDir) {
BOOL bCheck = ::SetCurrentDirectoryW(origDir);
BOOL bCheck = ::SetCurrentDirectory(origDir);
NS_ASSERTION(bCheck, " Error restoring driectoy");
firstJavaPlugin = TRUE;
}

View File

@ -62,7 +62,7 @@
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;
@ -203,7 +203,7 @@ NS_IMETHODIMP nsDelayedPopupsEnabledEvent::Run()
*/
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)
return TRUE;
@ -526,10 +526,10 @@ nsresult nsPluginNativeWindowWin::SubclassAndAssociateWindow()
if (!mPluginWinProc)
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");
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_OK;
@ -543,7 +543,7 @@ nsresult nsPluginNativeWindowWin::UndoSubclassAndAssociateWindow()
// remove window property
HWND hWnd = (HWND)window;
if (IsWindow(hWnd))
::RemovePropW(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
::RemoveProp(hWnd, NS_PLUGIN_WINDOW_PROPERTY_ASSOCIATION);
// restore the original win proc
// but only do this if this were us last time

View File

@ -58,18 +58,25 @@
/* 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;
::VerQueryValueW(verbuf,
key,
::VerQueryValue(verbuf,
TEXT(key),
(void **)&buf, &blen);
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;
@ -209,35 +216,35 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary* &outLibrary)
if (!mPlugin)
return NS_ERROR_NULL_POINTER;
nsAutoString temp;
mPlugin->GetPath(temp);
nsCAutoString temp;
mPlugin->GetNativePath(temp);
PRUnichar* index;
PRUnichar* pluginFolderPath = _wcsdup(temp.get());
char* index;
char* pluginFolderPath = PL_strdup(temp.get());
index = wcsrchr(pluginFolderPath, '\\');
index = PL_strrchr(pluginFolderPath, '\\');
*index = 0;
BOOL restoreOrigDir = FALSE;
PRUnichar aOrigDir[MAX_PATH + 1];
DWORD dwCheck = ::GetCurrentDirectoryW(sizeof(aOrigDir), aOrigDir);
char aOrigDir[MAX_PATH + 1];
DWORD dwCheck = ::GetCurrentDirectory(sizeof(aOrigDir), aOrigDir);
NS_ASSERTION(dwCheck <= MAX_PATH + 1, "Error in Loading plugin");
if (dwCheck <= MAX_PATH + 1)
{
restoreOrigDir = ::SetCurrentDirectoryW(pluginFolderPath);
restoreOrigDir = ::SetCurrentDirectory(pluginFolderPath);
NS_ASSERTION(restoreOrigDir, "Error in Loading plugin");
}
outLibrary = PR_LoadLibrary(NS_ConvertUTF16toUTF8(temp).get());
outLibrary = PR_LoadLibrary(temp.get());
if (restoreOrigDir)
{
BOOL bCheck = ::SetCurrentDirectoryW(aOrigDir);
BOOL bCheck = ::SetCurrentDirectory(aOrigDir);
NS_ASSERTION(bCheck, "Error in Loading plugin");
}
free(pluginFolderPath);
PL_strfree(pluginFolderPath);
return NS_OK;
}
@ -249,39 +256,37 @@ nsresult nsPluginFile::GetPluginInfo(nsPluginInfo& info)
{
nsresult res = NS_OK;
DWORD zerome, versionsize;
PRUnichar* verbuf = nsnull;
char* verbuf = nsnull;
const PRUnichar* path;
const char* path;
if (!mPlugin)
return NS_ERROR_NULL_POINTER;
nsAutoString temp;
mPlugin->GetPath(temp);
nsCAutoString temp;
mPlugin->GetNativePath(temp);
path = temp.get();
versionsize = ::GetFileVersionInfoSizeW(path, &zerome);
versionsize = ::GetFileVersionInfoSize((char*)path, &zerome);
if (versionsize > 0)
verbuf = (wchar_t *)PR_Malloc(versionsize);
verbuf = (char *)PR_Malloc(versionsize);
if(!verbuf)
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.fDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileDescription");
info.fName = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\ProductName");
info.fDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileDescription");
char *mimeType = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\MIMEType");
char *mimeDescription = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileOpenName");
char *extensions = GetKeyValue(verbuf, L"\\StringFileInfo\\040904E4\\FileExtents");
char *mimeType = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\MIMEType");
char *mimeDescription = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileOpenName");
char *extensions = GetKeyValue(verbuf, "\\StringFileInfo\\040904E4\\FileExtents");
info.fVariantCount = CalculateVariantCount(mimeType);
info.fMimeTypeArray = MakeStringArray(info.fVariantCount, mimeType);
info.fMimeDescriptionArray = MakeStringArray(info.fVariantCount, mimeDescription);
info.fExtensionArray = MakeStringArray(info.fVariantCount, extensions);
// fFileName is narrow. fix?
info.fFileName = PL_strdup(NS_ConvertUTF16toUTF8(path).get());
info.fFileName = PL_strdup(path);
PL_strfree(mimeType);
PL_strfree(mimeDescription);

View File

@ -79,18 +79,17 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
pPlugin->m_hWndDialog = hWnd;
wchar_t szString[512];
LoadStringW(hInst, IDS_TITLE, szString, sizeof(szString));
SetWindowTextW(hWnd, szString);
char szString[512];
LoadString(hInst, IDS_TITLE, szString, sizeof(szString));
SetWindowText(hWnd, szString);
LoadStringW(hInst, IDS_INFO, szString, sizeof(szString));
SetDlgItemTextW(hWnd, IDC_STATIC_INFO, szString);
LoadString(hInst, IDS_INFO, szString, sizeof(szString));
SetDlgItemText(hWnd, IDC_STATIC_INFO, szString);
// convert m_pNPMIMEType dougt
SetDlgItemTextA(hWnd, IDC_STATIC_INFOTYPE, pPlugin->m_pNPMIMEType);
SetDlgItemText(hWnd, IDC_STATIC_INFOTYPE, (LPSTR)pPlugin->m_pNPMIMEType);
LoadStringW(hInst, IDS_LOCATION, szString, sizeof(szString));
SetDlgItemTextW(hWnd, IDC_STATIC_LOCATION, szString);
LoadString(hInst, IDS_LOCATION, szString, sizeof(szString));
SetDlgItemText(hWnd, IDC_STATIC_LOCATION, szString);
char contentTypeIsJava = 0;
@ -100,36 +99,30 @@ static BOOL onInitDialog(HWND hWnd, HWND hWndFocus, LPARAM lParam)
}
if(pPlugin->m_szPageURL == NULL || contentTypeIsJava)
LoadStringW(hInst, IDS_FINDER_PAGE, szString, sizeof(szString));
LoadString(hInst, IDS_FINDER_PAGE, szString, sizeof(szString));
else
{
MultiByteToWideChar( CP_ACP, 0,
pPlugin->m_szPageURL,
strlen(pPlugin->m_szPageURL)+1,
szString,
511 ); // defect #362738
}
strncpy(szString, pPlugin->m_szPageURL,511); // defect #362738
SetDlgItemTextWrapped(hWnd, IDC_STATIC_URL, szString);
LoadStringW(hInst, IDS_QUESTION, szString, sizeof(szString));
SetDlgItemTextW(hWnd, IDC_STATIC_QUESTION, szString);
LoadString(hInst, IDS_QUESTION, szString, sizeof(szString));
SetDlgItemText(hWnd, IDC_STATIC_QUESTION, szString);
SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, L"");
SetDlgItemText(hWnd, IDC_STATIC_WARNING, "");
if(!pPlugin->m_bOnline)
{
EnableWindow(GetDlgItem(hWnd, IDC_GET_PLUGIN), FALSE);
LoadStringW(hInst, IDS_WARNING_OFFLINE, szString, sizeof(szString));
SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, szString);
SetDlgItemTextW(hWnd, IDC_STATIC_QUESTION, L"");
LoadString(hInst, IDS_WARNING_OFFLINE, szString, sizeof(szString));
SetDlgItemText(hWnd, IDC_STATIC_WARNING, szString);
SetDlgItemText(hWnd, IDC_STATIC_QUESTION, "");
return TRUE;
}
if((!pPlugin->m_bJava) || (!pPlugin->m_bJavaScript) || (!pPlugin->m_bSmartUpdate))
{
LoadStringW(hInst, IDS_WARNING_JS, szString, sizeof(szString));
SetDlgItemTextW(hWnd, IDC_STATIC_WARNING, szString);
LoadString(hInst, IDS_WARNING_JS, szString, sizeof(szString));
SetDlgItemText(hWnd, IDC_STATIC_WARNING, szString);
return TRUE;
}

View File

@ -86,18 +86,18 @@ NPError NP_LOADDS NPP_New(NPMIMEType pluginType,
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];
else if(strcmpi(argn[i],"codebase") == 0 && argv[i] != NULL)
else if(lstrcmpi(argn[i],"codebase") == 0 && argv[i] != NULL)
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];
else if(strcmpi(argn[i],"classid") == 0 && argv[i] != NULL)
else if(lstrcmpi(argn[i],"classid") == 0 && argv[i] != NULL)
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];
else if(strcmpi(argn[i],"HIDDEN") == 0 && argv[i] != NULL)
bHidden = (strcmp((char *)argv[i], "TRUE") == 0);
else if(lstrcmpi(argn[i],"HIDDEN") == 0 && argv[i] != NULL)
bHidden = (lstrcmp((char *)argv[i], "TRUE") == 0);
}
/* some post-processing on the filename to attempt to extract the extension: */

View File

@ -51,7 +51,7 @@
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);
@ -66,7 +66,7 @@ BOOL RegisterNullPluginWindowClass()
{
assert(hInst != NULL);
WNDCLASSW wc;
WNDCLASS wc;
memset(&wc, 0, sizeof(wc));
@ -78,14 +78,14 @@ BOOL RegisterNullPluginWindowClass()
wc.hbrBackground = HBRUSH(COLOR_WINDOW + 1);
wc.lpszClassName = szNullPluginWindowClassName;
ATOM aRet = RegisterClassW(&wc);
ATOM aRet = RegisterClass(&wc);
return (aRet != NULL);
}
void UnregisterNullPluginWindowClass()
{
assert(hInst != NULL);
UnregisterClassW(szNullPluginWindowClassName, hInst);
UnregisterClass(szNullPluginWindowClassName, hInst);
}
/*********************************************/
@ -129,41 +129,41 @@ CPlugin::CPlugin(HINSTANCE hInst,
if(pluginType && *pluginType)
{
m_pNPMIMEType = (NPMIMEType) new char[strlen(pluginType) + 1];
m_pNPMIMEType = (NPMIMEType)new char[lstrlen((LPSTR)pluginType) + 1];
if(m_pNPMIMEType != NULL)
strcpy(m_pNPMIMEType, pluginType);
lstrcpy((LPSTR)m_pNPMIMEType, pluginType);
}
if(szPageURL && *szPageURL)
{
m_szPageURL = new char[strlen(szPageURL) + 1];
m_szPageURL = new char[lstrlen(szPageURL) + 1];
if(m_szPageURL != NULL)
strcpy(m_szPageURL, szPageURL);
lstrcpy(m_szPageURL, szPageURL);
}
if(szFileURL && *szFileURL)
{
m_szFileURL = new char[strlen(szFileURL) + 1];
m_szFileURL = new char[lstrlen(szFileURL) + 1];
if(m_szFileURL != NULL)
strcpy(m_szFileURL, szFileURL);
lstrcpy(m_szFileURL, szFileURL);
}
if(szFileExtension && *szFileExtension)
{
m_szFileExtension = new char[strlen(szFileExtension) + 1];
m_szFileExtension = new char[lstrlen(szFileExtension) + 1];
if(m_szFileExtension != NULL)
strcpy(m_szFileExtension, szFileExtension);
lstrcpy(m_szFileExtension, szFileExtension);
}
m_hIcon = LoadIcon(m_hInst, MAKEINTRESOURCE(IDI_PLUGICON));
wchar_t szString[1024] = {'\0'};
LoadStringW(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString));
char szString[1024] = {'\0'};
LoadString(m_hInst, IDS_CLICK_TO_GET, szString, sizeof(szString));
if(*szString)
{
m_szCommandMessage = new wchar_t[wcslen(szString) + 1];
m_szCommandMessage = new char[lstrlen(szString) + 1];
if(m_szCommandMessage != NULL)
wcscpy(m_szCommandMessage, szString);
lstrcpy(m_szCommandMessage, szString);
}
}
@ -253,8 +253,8 @@ BOOL CPlugin::init(HWND hWndParent)
RECT rcParent;
GetClientRect(m_hWndParent, &rcParent);
CreateWindowW(szNullPluginWindowClassName,
L"NULL Plugin",
CreateWindow(szNullPluginWindowClassName,
"NULL Plugin",
WS_CHILD,
0,0, rcParent.right, rcParent.bottom,
m_hWndParent,
@ -332,10 +332,10 @@ LPSTR CPlugin::createURLString()
// check if there is file URL first
if(!m_bSmartUpdate && m_szFileURL != NULL)
{
m_szURLString = new char[strlen(m_szFileURL) + 1];
m_szURLString = new char[lstrlen(m_szFileURL) + 1];
if(m_szURLString == NULL)
return NULL;
strcpy(m_szURLString, m_szFileURL);
lstrcpy(m_szURLString, m_szFileURL);
return m_szURLString;
}
@ -351,18 +351,18 @@ LPSTR CPlugin::createURLString()
if(!m_bSmartUpdate && m_szPageURL != NULL && !contentTypeIsJava)
{
szAddress = new char[strlen(m_szPageURL) + 1];
szAddress = new char[lstrlen(m_szPageURL) + 1];
if(szAddress == 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)
return NULL;
// 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
{
@ -374,20 +374,20 @@ LPSTR CPlugin::createURLString()
urlToOpen = szPageUrlForJVM;
}
szAddress = new char[strlen(urlToOpen) + 1];
szAddress = new char[lstrlen(urlToOpen) + 1];
if(szAddress == NULL)
return NULL;
strcpy(szAddress, urlToOpen);
lstrcpy(szAddress, urlToOpen);
m_szURLString = new char[strlen(szAddress) + 10 +
strlen(m_pNPMIMEType) + 1];
m_szURLString = new char[lstrlen(szAddress) + 10 +
lstrlen((LPSTR)m_pNPMIMEType) + 1];
if(m_szURLString == NULL)
return NULL;
// Append the MIME type to the URL
sprintf(m_szURLString, "%s?mimetype=%s",
szAddress, m_pNPMIMEType);
wsprintf(m_szURLString, "%s?mimetype=%s",
szAddress, (LPSTR)m_pNPMIMEType);
}
else
{
@ -409,15 +409,14 @@ LPSTR CPlugin::createURLString()
m_szFileURL[0] = '\0';
}
m_szURLString = new char[strlen(szPluginFinderCommandBeginning) + strlen(urlToOpen) + 10 +
strlen((LPSTR)m_pNPMIMEType) + 13 +
strlen((LPSTR)m_szPageURL) + 11 +
strlen((LPSTR)m_szFileURL) +
strlen(szPluginFinderCommandEnd) + 1];
sprintf(m_szURLString, "%s%s?mimetype=%s&pluginspage=%s&pluginurl=%s%s",
szPluginFinderCommandBeginning, urlToOpen,
m_pNPMIMEType, m_szPageURL, m_szFileURL,
szPluginFinderCommandEnd);
m_szURLString = new char[lstrlen(szPluginFinderCommandBeginning) + lstrlen(urlToOpen) + 10 +
lstrlen((LPSTR)m_pNPMIMEType) + 13 +
lstrlen((LPSTR)m_szPageURL) + 11 +
lstrlen((LPSTR)m_szFileURL) +
lstrlen(szPluginFinderCommandEnd) + 1];
wsprintf(m_szURLString, "%s%s?mimetype=%s&pluginspage=%s&pluginurl=%s%s",
szPluginFinderCommandBeginning, urlToOpen,
(LPSTR)m_pNPMIMEType, m_szPageURL, m_szFileURL, szPluginFinderCommandEnd);
}
}
@ -513,13 +512,13 @@ void CPlugin::getPlugin()
m_szCommandMessage = NULL;
}
wchar_t szString[1024] = {'\0'};
LoadStringW(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
char szString[1024] = {'\0'};
LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
if(*szString)
{
m_szCommandMessage = new wchar_t[wcslen(szString) + 1];
m_szCommandMessage = new char[lstrlen(szString) + 1];
if(m_szCommandMessage != NULL)
wcscpy(m_szCommandMessage, szString);
lstrcpy(m_szCommandMessage, szString);
}
InvalidateRect(m_hWnd, NULL, TRUE);
@ -549,20 +548,20 @@ void CPlugin::URLNotify(const char * szURL)
dbgOut2("CPlugin::URLNotify(), URL '%s'", szURL);
NPStream * pStream = NULL;
wchar_t buf[256];
char buf[256];
assert(m_hInst != 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);
if (rc != NPERR_NO_ERROR)
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);
}
@ -595,12 +594,12 @@ NPError CPlugin::destroyStream(NPStream *stream, NPError reason)
BOOL CPlugin::readyToRefresh()
{
wchar_t szString[1024] = {'\0'};
LoadStringW(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
char szString[1024] = {'\0'};
LoadString(m_hInst, IDS_CLICK_WHEN_DONE, szString, sizeof(szString));
if(m_szCommandMessage == NULL)
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");
}
static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc)
static void DrawCommandMessage(HDC hDC, LPSTR szString, LPRECT lprc)
{
if(szString == NULL)
return;
@ -638,7 +637,7 @@ static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc)
HFONT hFontOld = SelectFont(hDC, hFont);
SIZE sz;
GetTextExtentPoint32W(hDC, szString, wcslen(szString), &sz);
GetTextExtentPoint32(hDC, szString, lstrlen(szString), &sz);
POINT pt;
pt.x = sz.cx;
pt.y = sz.cy;
@ -660,7 +659,7 @@ static void DrawCommandMessage(HDC hDC, wchar_t* szString, LPRECT lprc)
int iModeOld = SetBkMode(hDC, TRANSPARENT);
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);
SetBkMode(hDC, iModeOld);
SelectFont(hDC, hFontOld);

View File

@ -51,7 +51,7 @@ private:
HICON m_hIcon;
char* m_szURLString;
wchar_t* m_szCommandMessage;
char* m_szCommandMessage;
BOOL m_bWaitingStreamFromPFS;
NPStream* m_PFSStream;
@ -118,7 +118,7 @@ public:
#define JVM_SMARTUPDATE_URL "http://java.com/download"
#ifdef WIN32
#define REGISTRY_PLACE L"Software\\Netscape\\Netscape Navigator\\Default Plugin"
#define REGISTRY_PLACE "Software\\Netscape\\Netscape Navigator\\Default Plugin"
#else
#define GWL_USERDATA 0
#define COLOR_3DSHADOW COLOR_BTNFACE
@ -126,7 +126,7 @@ public:
#define COLOR_3DDKSHADOW COLOR_BTNSHADOW
#endif
#define CLASS_NULL_PLUGIN L"NullPluginClass"
#define CLASS_NULL_PLUGIN "NullPluginClass"
BOOL RegisterNullPluginWindowClass();
void UnregisterNullPluginWindowClass();

View File

@ -45,8 +45,8 @@ HKEY openRegistry()
{
HKEY phkResult;
if(RegCreateKeyW(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS)
MessageBoxW(0, L"Error creating Default Plugin registry key", L"Default Plugin", MB_OK);
if(RegCreateKey(HKEY_CURRENT_USER, REGISTRY_PLACE, &phkResult) != ERROR_SUCCESS)
MessageBox(0, "Error creating Default Plugin registry key", "Default Plugin", MB_OK);
return phkResult;
}
@ -56,37 +56,30 @@ BOOL IsNewMimeType(LPSTR mime)
{
HKEY hkey = openRegistry();
DWORD dwType, keysize = 512;
wchar_t keybuf[512];
wchar_t wideMime[64];
char keybuf[512];
MultiByteToWideChar(CP_ACP, 0,
mime,
strlen(mime) + 1,
wideMime,
64);
if(RegQueryValueExW(hkey, wideMime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS)
if(RegQueryValueEx(hkey, mime, 0, &dwType, (LPBYTE) &keybuf, &keysize) == ERROR_SUCCESS)
{
// key exists, must have already been here...
return FALSE;
}
else
{
if(RegSetValueExW(hkey, wideMime, 0, REG_SZ, (LPBYTE) L"(none)", 7) != ERROR_SUCCESS)
MessageBoxW(0, L"Error adding MIME type value", L"Default Plugin", MB_OK);
if(RegSetValueEx(hkey, mime, 0, REG_SZ, (LPBYTE) "(none)", 7) != ERROR_SUCCESS)
MessageBox(0, "Error adding MIME type value", "Default Plugin", MB_OK);
return TRUE;
}
}
// 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;
HDC hDC = GetDC(hWnd);
HFONT hWindowFont = GetWindowFont(hWnd);
HFONT hFontOld = SelectFont(hDC, hWindowFont);
GetTextExtentPoint32W(hDC, lpsz, wcslen(lpsz), &sz);
GetTextExtentPoint32(hDC, lpsz, lstrlen(lpsz), &sz);
POINT pt;
pt.x = sz.cx;
pt.y = sz.cy;
@ -96,20 +89,20 @@ static int getWindowStringLength(HWND hWnd, wchar_t* lpsz)
return (int)pt.x;
}
/*******************************************************************/
/* */
/* void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText) */
/* */
/* helper to wrap long lines in a static control, which do not */
/* wrap automatically if they do not have space characters */
/* */
/*******************************************************************/
void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
/****************************************************************/
/* */
/* void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText) */
/* */
/* helper to wrap long lines in a static control, which do not */
/* wrap automatically if they do not have space characters */
/* */
/****************************************************************/
void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText)
{
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;
}
@ -121,7 +114,7 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
if(iStringLength <= iStaticLength)
{
SetDlgItemTextW(hWnd, iID, szText);
SetDlgItemText(hWnd, iID, szText);
return;
}
@ -129,19 +122,19 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
if(iBreaks <= 0)
return;
wchar_t * pBuf = new wchar_t[iStringLength + iBreaks + 1];
char * pBuf = new char[iStringLength + iBreaks + 1];
if(pBuf == NULL)
return;
wcscpy(pBuf, L"");
lstrcpy(pBuf, "");
int iStart = 0;
int iLines = 0;
for(int i = 0; i < iStringLength; i++)
{
wchar_t* sz = &szText[iStart];
char * sz = &szText[iStart];
int iIndex = i - iStart;
wchar_t ch = sz[iIndex + 1];
char ch = sz[iIndex + 1];
sz[iIndex + 1] = '\0';
@ -152,7 +145,7 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
sz[iIndex + 1] = ch;
if(iLines == iBreaks)
{
wcscat(pBuf, sz);
lstrcat(pBuf, sz);
break;
}
continue;
@ -164,15 +157,15 @@ void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText)
ch = sz[iIndex];
sz[iIndex] = '\0'; // terminate string one char shorter
wcscat(pBuf, sz); // append the string
wcscat(pBuf, L" "); // append space character for successful wrapping
lstrcat(pBuf, sz); // append the string
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
iLines++; // count lines
}
SetDlgItemTextW(hWnd, iID, pBuf);
SetDlgItemText(hWnd, iID, pBuf);
delete [] pBuf;
}

View File

@ -40,6 +40,6 @@
HKEY openRegistry();
BOOL IsNewMimeType(LPSTR szMimeType);
void SetDlgItemTextWrapped(HWND hWnd, int iID, wchar_t* szText);
void SetDlgItemTextWrapped(HWND hWnd, int iID, LPSTR szText);
#endif // __UTILS_H__

View File

@ -146,11 +146,11 @@ static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA);
if (plugin) {
const char * string = plugin->getVersion();
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 {
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);

View File

@ -220,10 +220,10 @@ static LRESULT CALLBACK PluginWinProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM
// get our plugin instance object and ask it for the version string
nsPluginInstance *plugin = (nsPluginInstance *)GetWindowLong(hWnd, GWL_USERDATA);
if (plugin)
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 {
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);

View File

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

View File

@ -58,13 +58,14 @@ nsUserInfo::GetUsername(char **aUsername)
{
*aUsername = nsnull;
PRUnichar username[256];
TCHAR username[256];
DWORD size = 256;
if (!GetUserNameW(username, &size))
if (!GetUserName(username, &size))
return NS_ERROR_FAILURE;
*aUsername = ToNewUTF8String(nsDependentString(username));
*aUsername = nsCRT::strdup(username);
if (*aUsername) return NS_OK;
return NS_ERROR_FAILURE;

View File

@ -266,7 +266,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
SFGAOF sfgao;
// Bug 394974
HMODULE hDll = ::LoadLibraryW(L"shell32.dll");
HMODULE hDll = ::LoadLibrary("shell32.dll");
MySHParseDisplayName pMySHParseDisplayName = NULL;
// Version 6.0 and higher
if (pMySHParseDisplayName =
@ -274,19 +274,19 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
"SHParseDisplayName")) {
if (SUCCEEDED(pMySHParseDisplayName(NS_ConvertUTF8toUTF16(urlSpec).get(),
NULL, &pidl, 0, &sfgao))) {
static const PRUnichar cmdVerb[] = L"open";
SHELLEXECUTEINFOW sinfo;
static const char cmdVerb[] = "open";
SHELLEXECUTEINFO sinfo;
memset(&sinfo, 0, sizeof(SHELLEXECUTEINFO));
sinfo.cbSize = sizeof(SHELLEXECUTEINFO);
sinfo.fMask = SEE_MASK_FLAG_DDEWAIT |
SEE_MASK_FLAG_NO_UI |
SEE_MASK_INVOKEIDLIST;
sinfo.hwnd = NULL;
sinfo.lpVerb = (LPWSTR)&cmdVerb;
sinfo.lpVerb = (LPCSTR)&cmdVerb;
sinfo.nShow = SW_SHOWNORMAL;
sinfo.lpIDList = pidl;
BOOL result = ShellExecuteExW(&sinfo);
BOOL result = ShellExecuteEx(&sinfo);
CoTaskMemFree(pidl);
@ -295,9 +295,7 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
}
} else {
// Version of shell32.dll < 6.0
LONG r = (LONG) ::ShellExecuteW(NULL, L"open",
NS_ConvertUTF8toUTF16(urlSpec).get(),
NULL, NULL,
LONG r = (LONG) ::ShellExecute(NULL, "open", urlSpec.get(), NULL, NULL,
SW_SHOWNORMAL);
if (r < 32)
rv = NS_ERROR_FAILURE;

View File

@ -145,11 +145,11 @@ nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolSch
if (aProtocolScheme && *aProtocolScheme)
{
HKEY hKey;
LONG err = ::RegOpenKeyExA(HKEY_CLASSES_ROOT, aProtocolScheme, 0,
LONG err = ::RegOpenKeyEx(HKEY_CLASSES_ROOT, aProtocolScheme, 0,
KEY_QUERY_VALUE, &hKey);
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);
// close the key
::RegCloseKey(hKey);

View File

@ -93,13 +93,13 @@ nsresult
nsAppShell::Init()
{
if (!sMsgId)
sMsgId = RegisterWindowMessageW(L"nsAppShell:EventID");
sMsgId = RegisterWindowMessage("nsAppShell:EventID");
WNDCLASSW wc;
WNDCLASS wc;
HINSTANCE module = GetModuleHandle(NULL);
const PRUnichar *const kWindowClass = L"nsAppShell:EventWindowClass";
if (!GetClassInfoW(module, kWindowClass, &wc)) {
const char *const kWindowClass = "nsAppShell:EventWindowClass";
if (!GetClassInfo(module, kWindowClass, &wc)) {
wc.style = 0;
wc.lpfnWndProc = EventWindowProc;
wc.cbClsExtra = 0;
@ -108,12 +108,12 @@ nsAppShell::Init()
wc.hIcon = NULL;
wc.hCursor = NULL;
wc.hbrBackground = (HBRUSH) NULL;
wc.lpszMenuName = (LPCWSTR) NULL;
wc.lpszMenuName = (LPCSTR) NULL;
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);
NS_ENSURE_STATE(mEventWnd);

View File

@ -40,7 +40,6 @@
#include <stdio.h>
#include "nsBidiKeyboard.h"
#include "prmem.h"
#include <tchar.h>
NS_IMPL_ISUPPORTS1(nsBidiKeyboard, nsIBidiKeyboard)
@ -64,8 +63,8 @@ NS_IMETHODIMP nsBidiKeyboard::SetLangFromBidiLevel(PRUint8 aLevel)
return result;
// call LoadKeyboardLayout() only if the target keyboard layout is different from the current
PRUnichar currentLocaleName[KL_NAMELENGTH];
wcsncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH);
char currentLocaleName[KL_NAMELENGTH];
strncpy(currentLocaleName, (aLevel & 1) ? mRTLKeyboard : mLTRKeyboard, KL_NAMELENGTH);
currentLocaleName[KL_NAMELENGTH-1] = '\0'; // null terminate
NS_ASSERTION(*currentLocaleName,
@ -97,26 +96,26 @@ NS_IMETHODIMP nsBidiKeyboard::IsLangRTL(PRBool *aIsRTL)
currentLocale = ::GetKeyboardLayout(0);
*aIsRTL = IsRTLLanguage(currentLocale);
if (!::GetKeyboardLayoutNameW(mCurrentLocaleName))
if (!::GetKeyboardLayoutName(mCurrentLocaleName))
return NS_ERROR_FAILURE;
NS_ASSERTION(*mCurrentLocaleName,
"GetKeyboardLayoutName return string length == 0");
NS_ASSERTION((wcslen(mCurrentLocaleName) < KL_NAMELENGTH),
NS_ASSERTION((strlen(mCurrentLocaleName) < KL_NAMELENGTH),
"GetKeyboardLayoutName return string length >= KL_NAMELENGTH");
// The language set by the user overrides the default language for that direction
if (*aIsRTL) {
wcsncpy(mRTLKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
strncpy(mRTLKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
} else {
wcsncpy(mLTRKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
strncpy(mLTRKeyboard, mCurrentLocaleName, KL_NAMELENGTH);
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");
NS_ASSERTION((wcslen(mLTRKeyboard) < KL_NAMELENGTH),
NS_ASSERTION((strlen(mLTRKeyboard) < KL_NAMELENGTH),
"mRTLKeyboard has string length >= KL_NAMELENGTH");
return NS_OK;
}
@ -133,7 +132,7 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
int keyboards;
HKL far* buf;
HKL locale;
PRUnichar localeName[KL_NAMELENGTH];
char localeName[KL_NAMELENGTH];
PRBool isLTRKeyboardSet = PR_FALSE;
PRBool isRTLKeyboardSet = PR_FALSE;
@ -157,11 +156,11 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
while (keyboards--) {
locale = buf[keyboards];
if (IsRTLLanguage(locale)) {
swprintf(mRTLKeyboard, L"%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
sprintf(mRTLKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
isRTLKeyboardSet = PR_TRUE;
}
else {
swprintf( mLTRKeyboard, L"%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
sprintf(mLTRKeyboard, "%.*x", KL_NAMELENGTH - 1, LANGIDFROMLCID(locale));
isLTRKeyboardSet = PR_TRUE;
}
}
@ -179,20 +178,20 @@ nsresult nsBidiKeyboard::SetupBidiKeyboards()
// installed this prevents us from arbitrarily resetting the current
// layout (bug 80274)
locale = ::GetKeyboardLayout(0);
if (!::GetKeyboardLayoutNameW(localeName))
if (!::GetKeyboardLayoutName(localeName))
return NS_ERROR_FAILURE;
NS_ASSERTION(*localeName,
"GetKeyboardLayoutName return string length == 0");
NS_ASSERTION((wcslen(localeName) < KL_NAMELENGTH),
NS_ASSERTION((strlen(localeName) < KL_NAMELENGTH),
"GetKeyboardLayout return string length >= KL_NAMELENGTH");
if (IsRTLLanguage(locale)) {
swprintf(mRTLKeyboard, localeName, KL_NAMELENGTH);
strncpy(mRTLKeyboard, localeName, KL_NAMELENGTH);
mRTLKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
}
else {
swprintf( mLTRKeyboard, localeName, KL_NAMELENGTH);
strncpy(mLTRKeyboard, localeName, KL_NAMELENGTH);
mLTRKeyboard[KL_NAMELENGTH-1] = '\0'; // null terminate
}

View File

@ -58,9 +58,9 @@ protected:
PRPackedBool mInitialized;
PRPackedBool mHaveBidiKeyboards;
PRUnichar mLTRKeyboard[KL_NAMELENGTH];
PRUnichar mRTLKeyboard[KL_NAMELENGTH];
PRUnichar mCurrentLocaleName[KL_NAMELENGTH];
char mLTRKeyboard[KL_NAMELENGTH];
char mRTLKeyboard[KL_NAMELENGTH];
char mCurrentLocaleName[KL_NAMELENGTH];
};

View File

@ -70,7 +70,7 @@
// 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)
format = CF_HTML;
else
format = ::RegisterClipboardFormatW(NS_ConvertASCIItoUTF16(aMimeStr).get());
format = ::RegisterClipboardFormat(aMimeStr);
return format;
}
@ -318,7 +316,7 @@ nsresult nsClipboard::GetGlobalData(HGLOBAL aHGBL, void ** aData, PRUint32 * aLe
);
// 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.
LocalFree( lpMsgBuf );

View File

@ -82,10 +82,10 @@ IAsyncOperation : public IUnknown
* See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_basics/shell_basics_programming/transferring/clipboard.asp
*/
#ifndef CFSTR_INETURLA
#define CFSTR_INETURLA L"UniformResourceLocator"
#define CFSTR_INETURLA "UniformResourceLocator"
#endif
#ifndef CFSTR_INETURLW
#define CFSTR_INETURLW L"UniformResourceLocatorW"
#define CFSTR_INETURLW "UniformResourceLocatorW"
#endif
// For support of MinGW w32api v2.4.
@ -93,10 +93,10 @@ IAsyncOperation : public IUnknown
// http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/winsup/w32api/include/shlobj.h?cvsroot=src
// then that can be made the base required version and this code should be removed.
#ifndef CFSTR_FILEDESCRIPTORA
# define CFSTR_FILEDESCRIPTORA L"FileGroupDescriptor"
# define CFSTR_FILEDESCRIPTORA "FileGroupDescriptor"
#endif
#ifndef CFSTR_FILEDESCRIPTORW
# define CFSTR_FILEDESCRIPTORW L"FileGroupDescriptorW"
# define CFSTR_FILEDESCRIPTORW "FileGroupDescriptorW"
#endif
#ifdef __MINGW32__

View File

@ -280,10 +280,10 @@ NS_IMETHODIMP nsFilePicker::ShowW(PRInt16 *aReturnVal)
#ifndef WINCE
}
catch(...) {
MessageBoxW(ofn.hwndOwner,
0,
L"The filepicker was unexpectedly closed by Windows.",
MB_ICONERROR);
MessageBox(ofn.hwndOwner,
0,
"The filepicker was unexpectedly closed by Windows.",
MB_ICONERROR);
result = PR_FALSE;
}
#endif

View File

@ -56,7 +56,7 @@ static CloseThemeDataPtr closeTheme = NULL;
static GetThemeColorPtr getThemeColor = NULL;
static IsAppThemedPtr isAppThemed = NULL;
static const PRUnichar kThemeLibraryName[] = L"uxtheme.dll";
static const char kThemeLibraryName[] = "uxtheme.dll";
static HINSTANCE gThemeDLLInst = NULL;
static HANDLE gMenuTheme = NULL;
@ -105,13 +105,13 @@ static PRInt32 GetSystemParam(long flag, PRInt32 def)
nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
{
#ifndef WINCE
gShell32DLLInst = LoadLibraryW(L"Shell32.dll");
gShell32DLLInst = LoadLibrary("Shell32.dll");
if (gShell32DLLInst)
{
gSHAppBarMessage = (SHAppBarMessagePtr) GetProcAddress(gShell32DLLInst,
"SHAppBarMessage");
}
gThemeDLLInst = LoadLibraryW(kThemeLibraryName);
gThemeDLLInst = LoadLibrary(kThemeLibraryName);
if(gThemeDLLInst)
{
openTheme = (OpenThemeDataPtr)GetProcAddress(gThemeDLLInst, "OpenThemeData");
@ -504,7 +504,7 @@ NS_IMETHODIMP nsLookAndFeel::GetMetric(const nsMetricID aID, PRInt32 & aMetric)
if (gSHAppBarMessage)
{
// Get task bar window handle
HWND shellWindow = FindWindowW(L"Shell_TrayWnd", NULL);
HWND shellWindow = FindWindow("Shell_TrayWnd", NULL);
if (shellWindow != NULL)
{

View File

@ -279,7 +279,7 @@ static GetThemeSysFontPtr getThemeSysFont = NULL;
static GetThemeColorPtr getThemeColor = NULL;
static GetThemeMarginsPtr getThemeMargins = NULL;
static const PRUnichar kThemeLibraryName[] = L"uxtheme.dll";
static const char kThemeLibraryName[] = "uxtheme.dll";
static inline bool IsCheckboxWidgetType(PRUint8 aWidgetType)
{
@ -318,7 +318,7 @@ nsNativeThemeWin::nsNativeThemeWin() {
mHeaderTheme = NULL;
mMenuTheme = NULL;
mThemeDLL = ::LoadLibraryW(kThemeLibraryName);
mThemeDLL = ::LoadLibrary(kThemeLibraryName);
if (mThemeDLL) {
openTheme = (OpenThemeDataPtr)GetProcAddress(mThemeDLL, "OpenThemeData");
closeTheme = (CloseThemeDataPtr)GetProcAddress(mThemeDLL, "CloseThemeData");

View File

@ -40,7 +40,7 @@
#include "nscore.h"
#include "plstr.h"
#include <stdio.h>
#include "nsString.h"
#include <windows.h>
// mmsystem.h is needed to build with WIN32_LEAN_AND_MEAN
@ -125,7 +125,7 @@ NS_IMETHODIMP nsSound::OnStreamComplete(nsIStreamLoader *aLoader,
flags |= SND_ASYNC;
}
::PlaySoundA(reinterpret_cast<const char*>(data), 0, flags);
::PlaySound(reinterpret_cast<const char*>(data), 0, flags);
}
return NS_OK;
@ -166,10 +166,12 @@ NS_IMETHODIMP nsSound::PlaySystemSound(const nsAString &aSoundAlias)
PurgeLastSound();
if (aSoundAlias.EqualsLiteral("_moz_mailbeep")) {
::PlaySoundW(L"MailBeep", nsnull, SND_ALIAS | SND_ASYNC);
::PlaySound("MailBeep", nsnull, SND_ALIAS | SND_ASYNC);
}
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;

View File

@ -264,7 +264,7 @@ nsToolkit::Startup(HMODULE hModule)
typedef BOOL (*SetProcessDPIAwareFunc)(VOID);
SetProcessDPIAwareFunc setDPIAware = (SetProcessDPIAwareFunc)
GetProcAddress(LoadLibraryW(L"user32.dll"),
GetProcAddress(LoadLibrary("user32.dll"),
"SetProcessDPIAware");
if (setDPIAware)
@ -295,8 +295,8 @@ void nsToolkit::CreateInternalWindow(PRThread *aThread)
// create the internal window
//
mDispatchWnd = ::CreateWindowW(L"nsToolkitClass",
L"NetscapeDispatchWnd",
mDispatchWnd = ::CreateWindow("nsToolkitClass",
"NetscapeDispatchWnd",
WS_DISABLED,
-50, -50,
10, 10,

View File

@ -150,7 +150,7 @@
#include "prprf.h"
#include "prmem.h"
static const PRUnichar kMozHeapDumpMessageString[] = L"MOZ_HeapDump";
static const char kMozHeapDumpMessageString[] = "MOZ_HeapDump";
#define kWindowPositionSlop 20
@ -699,7 +699,7 @@ nsWindow::nsWindow() : nsBaseWidget()
// Heap dump
#ifndef WINCE
nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessageW(kMozHeapDumpMessageString);
nsWindow::uWM_HEAP_DUMP = ::RegisterWindowMessage(kMozHeapDumpMessageString);
#endif
}
@ -1119,26 +1119,26 @@ nsWindow::EventIsInsideWindow(UINT Msg, nsWindow* aWindow)
return (PRBool) PtInRect(&r, mp);
}
static PRUnichar sPropName[40] = L"";
static PRUnichar* GetNSWindowPropName() {
static char sPropName[40] = "";
static char* GetNSWindowPropName() {
if (!*sPropName)
{
_snwprintf(sPropName, 39, L"MozillansIWidgetPtr%p", _getpid());
_snprintf(sPropName, 39, "MozillansIWidgetPtr%p", _getpid());
sPropName[39] = '\0';
}
return sPropName;
}
nsWindow * nsWindow::GetNSWindowPtr(HWND aWnd) {
return (nsWindow *) ::GetPropW(aWnd, GetNSWindowPropName());
return (nsWindow *) ::GetPropA(aWnd, GetNSWindowPropName());
}
BOOL nsWindow::SetNSWindowPtr(HWND aWnd, nsWindow * ptr) {
if (ptr == NULL) {
::RemovePropW(aWnd, GetNSWindowPropName());
::RemovePropA(aWnd, GetNSWindowPropName());
return TRUE;
} 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
// 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
break;
@ -5192,7 +5192,7 @@ LPCWSTR nsWindow::WindowPopupClassW()
return className;
}
LPCTSTR nsWindow::WindowClass()
LPCSTR nsWindow::WindowClass()
{
// Call into the wide version to make sure things get
// registered properly.
@ -5200,9 +5200,7 @@ LPCTSTR nsWindow::WindowClass()
// XXX: The class name used here must be kept in sync with
// the classname used in WindowClassW();
#ifdef UNICODE
return classNameW;
#else
if (classNameW == kWClassNameHidden) {
return kClassNameHidden;
}
@ -5219,21 +5217,17 @@ LPCTSTR nsWindow::WindowClass()
return kClassNameContentFrame;
}
return kClassNameGeneral;
#endif
}
LPCTSTR nsWindow::WindowPopupClass()
LPCSTR nsWindow::WindowPopupClass()
{
// Call into the wide version to make sure things get
// registered properly.
#ifdef UNICODE
return WindowPopupClassW();
#else
WindowPopupClassW();
// XXX: The class name used here must be kept in sync with
// the classname used in WindowPopupClassW();
return "MozillaDropShadowWindowClass";
#endif
}
//-------------------------------------------------------------------------
@ -7724,7 +7718,7 @@ STDMETHODIMP_(LRESULT) nsWindow::LresultFromObject(REFIID riid, WPARAM wParam, L
{
// open the dll dynamically
if (!gmAccLib)
gmAccLib =::LoadLibraryW(L"OLEACC.DLL");
gmAccLib =::LoadLibrary("OLEACC.DLL");
if (gmAccLib) {
if (!gmLresultFromObject)

View File

@ -105,13 +105,6 @@ const LPCSTR kClassNameContent = "MozillaContentWindowClass";
const LPCSTR kClassNameContentFrame = "MozillaContentFrameWindowClass";
const LPCSTR kClassNameGeneral = "MozillaWindowClass";
const LPCSTR kClassNameDialog = "MozillaDialogClass";
const LPCTSTR kTClassNameHidden = TEXT("MozillaHiddenWindowClass");
const LPCTSTR kTClassNameUI = TEXT("MozillaUIWindowClass");
const LPCTSTR kTClassNameContent = TEXT("MozillaContentWindowClass");
const LPCTSTR kTClassNameContentFrame = TEXT("MozillaContentFrameWindowClass");
const LPCTSTR kTClassNameGeneral = TEXT("MozillaWindowClass");
const LPCTSTR kTClassNameDialog = TEXT("MozillaDialogClass");
/**
* Native WIN32 window wrapper.

View File

@ -66,11 +66,6 @@
#include <signal.h>
#endif
#if defined(XP_WIN)
#include <tchar.h>
#include "nsString.h"
#endif
static void
Abort(const char *aMsg);
@ -102,7 +97,7 @@ PRBool InDebugger()
#ifndef WINCE
PRBool fReturn = PR_FALSE;
LPFNISDEBUGGERPRESENT lpfnIsDebuggerPresent = NULL;
HINSTANCE hKernel = LoadLibraryW(L"Kernel32.dll");
HINSTANCE hKernel = LoadLibrary("Kernel32.dll");
if(hKernel)
{
@ -406,9 +401,9 @@ Break(const char *aMsg)
* See http://bugzilla.mozilla.org/show_bug.cgi?id=54792
*/
PROCESS_INFORMATION pi;
STARTUPINFOW si;
PRUnichar executable[MAX_PATH];
PRUnichar* pName;
STARTUPINFO si;
char executable[MAX_PATH];
char* pName;
memset(&pi, 0, sizeof(pi));
@ -417,15 +412,13 @@ Break(const char *aMsg)
si.wShowWindow = SW_SHOW;
// 2nd arg of CreateProcess is in/out
PRUnichar *msgCopy = (PRUnichar*) _alloca((strlen(aMsg) + 1)*sizeof(PRUnichar));
wcscpy(msgCopy , (PRUnichar*)NS_ConvertUTF8toUTF16(aMsg).get());
char *msgCopy = (char*) _alloca(strlen(aMsg) + 1);
strcpy(msgCopy, aMsg);
if(GetModuleFileNameW(GetModuleHandleW(L"xpcom.dll"), (LPWCH)executable, MAX_PATH) &&
NULL != (pName = wcsrchr(executable, '\\')) &&
NULL !=
wcscpy((WCHAR*)
pName+1, L"windbgdlg.exe") &&
CreateProcessW((LPCWSTR)executable, (LPWSTR)msgCopy, NULL, NULL, PR_FALSE,
if(GetModuleFileName(GetModuleHandle("xpcom.dll"), executable, MAX_PATH) &&
NULL != (pName = strrchr(executable, '\\')) &&
NULL != strcpy(pName+1, "windbgdlg.exe") &&
CreateProcess(executable, msgCopy, NULL, NULL, PR_FALSE,
DETACHED_PROCESS | NORMAL_PRIORITY_CLASS,
NULL, NULL, &si, &pi)) {
WaitForSingleObject(pi.hProcess, INFINITE);

View File

@ -328,9 +328,9 @@ EnsureImageHlpInitialized()
::InitializeCriticalSection(&gDbgHelpCS);
HMODULE module = ::LoadLibraryW(L"DBGHELP.DLL");
HMODULE module = ::LoadLibrary("DBGHELP.DLL");
if (!module) {
module = ::LoadLibraryW(L"IMAGEHLP.DLL");
module = ::LoadLibrary("IMAGEHLP.DLL");
if (!module) return PR_FALSE;
}

View File

@ -127,7 +127,7 @@ NS_COM void StartupSpecialSystemDirectory()
#if defined (XP_WIN) && !defined (WINCE)
// SHGetKnownFolderPath is only available on Windows Vista
// so that we need to use GetProcAddress to get the pointer.
gShell32DLLInst = LoadLibraryW(L"Shell32.dll");
gShell32DLLInst = LoadLibrary("Shell32.dll");
if(gShell32DLLInst)
{
gGetKnownFolderPath = (nsGetKnownFolderPath)

View File

@ -108,8 +108,8 @@ private:
* HasMoreElements reads mLetter.
* GetNext advances mLetter.
*/
nsString mDrives;
const PRUnichar *mLetter;
nsCString mDrives;
const char *mLetter;
};
//----------------------------------------------------------------------------
@ -2952,7 +2952,7 @@ nsresult nsDriveEnumerator::Init()
/* The string is null terminated */
if (!EnsureStringLength(mDrives, length+1))
return NS_ERROR_OUT_OF_MEMORY;
if (!GetLogicalDriveStringsW(length, mDrives.BeginWriting()))
if (!GetLogicalDriveStrings(length, mDrives.BeginWriting()))
return NS_ERROR_FAILURE;
mLetter = mDrives.get();
return NS_OK;
@ -2982,9 +2982,8 @@ NS_IMETHODIMP nsDriveEnumerator::GetNext(nsISupports **aNext)
*aNext = nsnull;
return NS_OK;
}
nsString drive(mDrives);
NS_ConvertASCIItoUTF16 drive(mLetter);
mLetter += drive.Length() + 1;
nsILocalFile *file;
nsresult rv =
NS_NewLocalFile(drive, PR_FALSE, &file);

View File

@ -106,11 +106,10 @@ nsProcess::Init(nsIFile* executable)
#if defined(XP_WIN)
static int assembleCmdLine(char *const *argv, PRUnichar **cmdLine)
static int assembleCmdLine(char *const *argv, char **cmdLine)
{
char *const *arg;
PRUnichar *p;
char *q;
char *p, *q;
int cmdLineSize;
int numBackslashes;
int i;
@ -132,7 +131,7 @@ static int assembleCmdLine(char *const *argv, PRUnichar **cmdLine)
+ 2 /* we quote every argument */
+ 1; /* space in between, or final null */
}
p = *cmdLine = (PRUnichar *) PR_MALLOC(cmdLineSize*sizeof(PRUnichar));
p = *cmdLine = (char *) PR_MALLOC(cmdLineSize);
if (p == NULL) {
return -1;
}
@ -238,10 +237,10 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count,
my_argv[count+1] = NULL;
#if defined(XP_WIN) && !defined (WINCE) /* wince uses nspr */
STARTUPINFOW startupInfo;
STARTUPINFO startupInfo;
PROCESS_INFORMATION procInfo;
BOOL retVal;
PRUnichar *cmdLine;
char *cmdLine;
if (assembleCmdLine(my_argv, &cmdLine) == -1) {
nsMemory::Free(my_argv);
@ -251,20 +250,20 @@ nsProcess::Run(PRBool blocking, const char **args, PRUint32 count,
ZeroMemory(&startupInfo, sizeof(startupInfo));
startupInfo.cb = sizeof(startupInfo);
retVal = CreateProcessW(NULL,
// const_cast<char*>(mTargetPath.get()),
cmdLine,
NULL, /* security attributes for the new
* process */
NULL, /* security attributes for the primary
* thread in the new process */
FALSE, /* inherit handles */
0, /* creation flags */
NULL, /* env */
NULL, /* current drive and directory */
&startupInfo,
&procInfo
);
retVal = CreateProcess(NULL,
// const_cast<char*>(mTargetPath.get()),
cmdLine,
NULL, /* security attributes for the new
* process */
NULL, /* security attributes for the primary
* thread in the new process */
FALSE, /* inherit handles */
0, /* creation flags */
NULL, /* env */
NULL, /* current drive and directory */
&startupInfo,
&procInfo
);
PR_Free( cmdLine );
if (blocking) {

View File

@ -42,8 +42,6 @@ VPATH = @srcdir@
include $(DEPTH)/config/autoconf.mk
OS_LIBS += shell32.lib
SIMPLE_PROGRAMS = windbgdlg$(BIN_SUFFIX)
CPPSRCS = windbgdlg.cpp

View File

@ -42,7 +42,6 @@
#include <windows.h>
#include <stdlib.h>
#include <shellapi.h>
int WINAPI
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
@ -60,11 +59,10 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
DWORD regValue = -1;
DWORD regLength = sizeof regValue;
HKEY hkeyCU, hkeyLM;
RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU);
RegOpenKeyExW(HKEY_LOCAL_MACHINE, L"Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM);
int argc =0;
LPWSTR *argv = CommandLineToArgvW(GetCommandLineW(), &argc);
for (int i = argc - 1; regValue == (DWORD)-1 && i; --i) {
RegOpenKeyEx(HKEY_CURRENT_USER, "Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyCU);
RegOpenKeyEx(HKEY_LOCAL_MACHINE, "Software\\mozilla.org\\windbgdlg", 0, KEY_READ, &hkeyLM);
const char * const * argv = __argv;
for (int i = __argc - 1; regValue == (DWORD)-1 && i; --i) {
bool ok = false;
if (hkeyCU)
ok = RegQueryValueEx(hkeyCU, argv[i], 0, &regType, (LPBYTE)&regValue, &regLength) == ERROR_SUCCESS;
@ -79,15 +77,15 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
RegCloseKey(hkeyLM);
if (regValue != (DWORD)-1 && regValue != (DWORD)-2)
return regValue;
static PRUnichar msg[4048];
static char msg[4048];
wsprintf(msg,
L"%s\n\nClick Abort to exit the Application.\n"
L"Click Retry to Debug the Application..\n"
L"Click Ignore to continue running the Application.",
"%s\n\nClick Abort to exit the Application.\n"
"Click Retry to Debug the Application..\n"
"Click Ignore to continue running the Application.",
lpszCmdLine);
return MessageBoxW(NULL, msg, L"NSGlue_Assertion",
return MessageBox(NULL, msg, "NSGlue_Assertion",
MB_ICONSTOP | MB_SYSTEMMODAL|
MB_ABORTRETRYIGNORE | MB_DEFBUTTON3);
}

View File

@ -39,7 +39,6 @@
#include <stdio.h>
#include <string.h>
#include "nscore.h"
#include "nsString.h"
//defines and includes for previous installation cleanup process
#if defined (XP_WIN)
@ -64,18 +63,15 @@ printf("\n****Inside ShowOSAlert ***\n");
#endif
const PRInt32 max_len = 255;
char message_copy[max_len+1] = { 0 };
PRInt32 input_len = strlen(aMessage);
PRInt32 copy_len = (input_len > max_len) ? max_len : input_len;
#if defined (XP_WIN)
NS_ConvertUTF8toUTF16 msg_str(aMessage, copy_len);
PRUnichar* message_copy = (PRUnichar*)msg_str.get();
MessageBoxW(NULL, message_copy, NULL, MB_OK | MB_ICONERROR | MB_SETFOREGROUND );
#else
char message_copy[max_len+1] = { 0 };
strncpy(message_copy, aMessage, copy_len);
message_copy[copy_len] = 0;
#endif
#if (XP_MAC)
#if defined (XP_WIN)
MessageBoxA(NULL, message_copy, NULL, MB_OK | MB_ICONERROR | MB_SETFOREGROUND );
#elif (XP_MAC)
short buttonClicked;
StandardAlert(kAlertStopAlert, c2pstr(message_copy), nil, nil, &buttonClicked);
#elif defined (XP_OS2)