Bug 699247 - Remove Win2K related code. r=jimm, sr=neil

This commit is contained in:
Masatoshi Kimura 2012-02-23 08:53:55 -06:00
parent 8310316245
commit 8cea90b046
37 changed files with 306 additions and 1487 deletions

View File

@ -353,16 +353,6 @@ nsNPAPIPlugin::RunPluginOOP(const nsPluginTag *aPluginTag)
}
#endif
#ifdef XP_WIN
OSVERSIONINFO osVerInfo = {0};
osVerInfo.dwOSVersionInfoSize = sizeof(osVerInfo);
GetVersionEx(&osVerInfo);
// Always disabled on 2K or less. (bug 536303)
if (osVerInfo.dwMajorVersion < 5 ||
(osVerInfo.dwMajorVersion == 5 && osVerInfo.dwMinorVersion == 0))
return false;
#endif
nsCOMPtr<nsIPrefBranch> prefs = do_GetService(NS_PREFSERVICE_CONTRACTID);
if (!prefs) {
return false;

View File

@ -57,7 +57,6 @@
#include "nsString.h"
#include "nsILocalFile.h"
#include "nsUnicharUtils.h"
#include "nsSetDllDirectory.h"
using namespace mozilla;
@ -303,7 +302,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
}
if (protectCurrentDirectory) {
mozilla::NS_SetDllDirectory(NULL);
SetDllDirectory(NULL);
}
nsresult rv = plugin->Load(outLibrary);
@ -311,7 +310,7 @@ nsresult nsPluginFile::LoadPlugin(PRLibrary **outLibrary)
*outLibrary = NULL;
if (protectCurrentDirectory) {
mozilla::NS_SetDllDirectory(L"");
SetDllDirectory(L"");
}
if (restoreOrigDir) {

View File

@ -147,7 +147,7 @@ PluginProcessChild::Init()
}
if (protectCurrentDirectory) {
SanitizeEnvironmentVariables();
NS_SetDllDirectory(L"");
SetDllDirectory(L"");
}
#else

View File

@ -107,33 +107,14 @@ static const char *MapErrorCode(int rc)
//-----------------------------------------------------------------------------
static HINSTANCE sspi_lib;
static PSecurityFunctionTableW sspi;
static nsresult
InitSSPI()
{
PSecurityFunctionTableW (*initFun)(void);
LOG((" InitSSPI\n"));
sspi_lib = LoadLibraryW(L"secur32.dll");
if (!sspi_lib) {
sspi_lib = LoadLibraryW(L"security.dll");
if (!sspi_lib) {
LOG(("SSPI library not found"));
return NS_ERROR_UNEXPECTED;
}
}
initFun = (PSecurityFunctionTableW (*)(void))
GetProcAddress(sspi_lib, "InitSecurityInterfaceW");
if (!initFun) {
LOG(("InitSecurityInterfaceW not found"));
return NS_ERROR_UNEXPECTED;
}
sspi = initFun();
sspi = InitSecurityInterfaceW();
if (!sspi) {
LOG(("InitSecurityInterfaceW failed"));
return NS_ERROR_UNEXPECTED;

View File

@ -81,18 +81,6 @@ GetCairoAntialiasOption(gfxFont::AntialiasOption anAntialiasOption)
#define FE_FONTSMOOTHINGCLEARTYPE 2
#endif
static bool
HasClearType()
{
OSVERSIONINFO versionInfo;
versionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
return (GetVersionEx(&versionInfo) &&
(versionInfo.dwMajorVersion > 5 ||
(versionInfo.dwMajorVersion == 5 &&
versionInfo.dwMinorVersion >= 1))); // XP or newer
}
static bool
UsingClearType()
{
@ -100,10 +88,6 @@ UsingClearType()
if (!SystemParametersInfo(SPI_GETFONTSMOOTHING, 0, &fontSmoothing, 0) ||
!fontSmoothing)
{
return false;
}
if (!HasClearType()) {
return false;
}

View File

@ -65,6 +65,7 @@
#include "mozilla/Telemetry.h"
#include <usp10.h>
#include <t2embapi.h>
using namespace mozilla;
@ -102,50 +103,6 @@ BuildKeyNameFromFontName(nsAString &aName)
// Implementation of gfxPlatformFontList for Win32 GDI,
// using GDI font enumeration APIs to get the list of fonts
// from t2embapi.h, included in Platform SDK 6.1 but not 6.0
#ifndef __t2embapi__
#define TTLOAD_PRIVATE 0x00000001
#define LICENSE_PREVIEWPRINT 0x0004
#define E_NONE 0x0000L
typedef unsigned long( WINAPIV *READEMBEDPROC ) ( void*, void*, const unsigned long );
typedef struct
{
unsigned short usStructSize; // size in bytes of structure client should set to sizeof(TTLOADINFO)
unsigned short usRefStrSize; // size in wide characters of pusRefStr including NULL terminator
unsigned short *pusRefStr; // reference or actual string.
}TTLOADINFO;
LONG WINAPI TTLoadEmbeddedFont
(
HANDLE* phFontReference, // on completion, contains handle to identify embedded font installed
// on system
ULONG ulFlags, // flags specifying the request
ULONG* pulPrivStatus, // on completion, contains the embedding status
ULONG ulPrivs, // allows for the reduction of licensing privileges
ULONG* pulStatus, // on completion, may contain status flags for request
READEMBEDPROC lpfnReadFromStream, // callback function for doc/disk reads
LPVOID lpvReadStream, // the input stream tokin
LPWSTR szWinFamilyName, // the new 16 bit windows family name can be NULL
LPSTR szMacFamilyName, // the new 8 bit mac family name can be NULL
TTLOADINFO* pTTLoadInfo // optional security
);
#endif // __t2embapi__
typedef LONG( WINAPI *TTLoadEmbeddedFontProc ) (HANDLE* phFontReference, ULONG ulFlags, ULONG* pulPrivStatus, ULONG ulPrivs, ULONG* pulStatus,
READEMBEDPROC lpfnReadFromStream, LPVOID lpvReadStream, LPWSTR szWinFamilyName,
LPSTR szMacFamilyName, TTLOADINFO* pTTLoadInfo);
typedef LONG( WINAPI *TTDeleteEmbeddedFontProc ) (HANDLE hFontReference, ULONG ulFlags, ULONG* pulStatus);
static TTLoadEmbeddedFontProc TTLoadEmbeddedFontPtr = nsnull;
static TTDeleteEmbeddedFontProc TTDeleteEmbeddedFontPtr = nsnull;
class WinUserFontData : public gfxUserFontData {
public:
WinUserFontData(HANDLE aFontRef, bool aIsEmbedded)
@ -157,7 +114,7 @@ public:
if (mIsEmbedded) {
ULONG pulStatus;
LONG err;
err = TTDeleteEmbeddedFontPtr(mFontRef, 0, &pulStatus);
err = TTDeleteEmbeddedFont(mFontRef, 0, &pulStatus);
#if DEBUG
if (err != E_NONE) {
char buf[256];
@ -606,8 +563,6 @@ GDIFontFamily::FindStyleVariations()
gfxGDIFontList::gfxGDIFontList()
{
mFontSubstitutes.Init(50);
InitializeFontEmbeddingProcs();
}
static void
@ -794,15 +749,6 @@ gfxGDIFontList::LookupLocalFont(const gfxProxyFontEntry *aProxyEntry,
return fe;
}
void gfxGDIFontList::InitializeFontEmbeddingProcs()
{
HMODULE fontlib = LoadLibraryW(L"t2embed.dll");
if (!fontlib)
return;
TTLoadEmbeddedFontPtr = (TTLoadEmbeddedFontProc) GetProcAddress(fontlib, "TTLoadEmbeddedFont");
TTDeleteEmbeddedFontPtr = (TTDeleteEmbeddedFontProc) GetProcAddress(fontlib, "TTDeleteEmbeddedFont");
}
// used to control stream read by Windows TTLoadEmbeddedFont API
class EOTFontStreamReader {
@ -906,10 +852,6 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
};
FontDataDeleter autoDelete(aFontData);
// if calls aren't available, bail
if (!TTLoadEmbeddedFontPtr || !TTDeleteEmbeddedFontPtr)
return nsnull;
bool hasVertical;
bool isCFF = gfxFontUtils::IsCffFont(aFontData, hasVertical);
@ -948,11 +890,11 @@ gfxGDIFontList::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry,
EOTFontStreamReader eotReader(aFontData, aLength, buffer, eotlen,
&overlayNameData);
ret = TTLoadEmbeddedFontPtr(&fontRef, TTLOAD_PRIVATE, &privStatus,
LICENSE_PREVIEWPRINT, &pulStatus,
EOTFontStreamReader::ReadEOTStream,
&eotReader,
(PRUnichar*)(fontName.get()), 0, 0);
ret = TTLoadEmbeddedFont(&fontRef, TTLOAD_PRIVATE, &privStatus,
LICENSE_PREVIEWPRINT, &pulStatus,
EOTFontStreamReader::ReadEOTStream,
&eotReader,
(PRUnichar*)(fontName.get()), 0, 0);
if (ret != E_NONE) {
fontRef = nsnull;
char buf[256];

View File

@ -225,7 +225,6 @@ public:
// based on http://msdn.microsoft.com/en-us/library/ms724834(VS.85).aspx
enum {
kWindowsUnknown = 0,
kWindows2000 = 0x50000,
kWindowsXP = 0x50001,
kWindowsServer2003 = 0x50002,
kWindowsVista = 0x60000,

View File

@ -158,7 +158,7 @@ EnableBatteryNotifications()
DEVICE_NOTIFY_WINDOW_HANDLE);
} else
{
// for Windows 2000 and Windwos XP. If we remove Windows XP support,
// for Windows XP. If we remove Windows XP support,
// we should remove timer-based power notification
sUpdateTimer = do_CreateInstance(NS_TIMER_CONTRACTID);
if (sUpdateTimer) {

View File

@ -74,7 +74,7 @@ main(int argc, char* argv[])
// the details.
if (proctype != GeckoProcessType_Plugin) {
mozilla::SanitizeEnvironmentVariables();
mozilla::NS_SetDllDirectory(L"");
SetDllDirectory(L"");
}
#endif

View File

@ -79,9 +79,6 @@ nsAutodial::nsAutodial()
mNumRASConnectionEntries(0),
mAutodialServiceDialingLocation(-1)
{
mOSVerInfo.dwOSVersionInfoSize = sizeof(mOSVerInfo);
GetVersionEx(&mOSVerInfo);
// Initializations that can be made again since RAS OS settings can
// change.
Init();
@ -432,22 +429,27 @@ nsresult nsAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize)
//
// For Windows XP: HKCU/Software/Microsoft/RAS Autodial/Default/DefaultInternet.
// or HKLM/Software/Microsoft/RAS Autodial/Default/DefaultInternet.
// For Windows 2K: HKCU/RemoteAccess/InternetProfile.
const PRUnichar* key = nsnull;
const PRUnichar* val = nsnull;
const PRUnichar* key = L"Software\\Microsoft\\RAS Autodial\\Default";
const PRUnichar* val = L"DefaultInternet";
HKEY hKey = 0;
LONG result = 0;
// Windows 2000
if ((mOSVerInfo.dwMajorVersion == 5) && (mOSVerInfo.dwMinorVersion == 0)) // Windows 2000
{
key = L"RemoteAccess";
val = L"InternetProfile";
// Try HKCU first.
result = ::RegOpenKeyExW(
HKEY_CURRENT_USER,
key,
0,
KEY_READ,
&hKey);
if (result != ERROR_SUCCESS)
{
// If not present, try HKLM.
result = ::RegOpenKeyExW(
HKEY_CURRENT_USER,
HKEY_LOCAL_MACHINE,
key,
0,
KEY_READ,
@ -458,36 +460,6 @@ nsresult nsAutodial::GetDefaultEntryName(PRUnichar* entryName, int bufferSize)
return NS_ERROR_FAILURE;
}
}
else // Windows XP
{
key = L"Software\\Microsoft\\RAS Autodial\\Default";
val = L"DefaultInternet";
// Try HKCU first.
result = ::RegOpenKeyExW(
HKEY_CURRENT_USER,
key,
0,
KEY_READ,
&hKey);
if (result != ERROR_SUCCESS)
{
// If not present, try HKLM.
result = ::RegOpenKeyExW(
HKEY_LOCAL_MACHINE,
key,
0,
KEY_READ,
&hKey);
if (result != ERROR_SUCCESS)
{
return NS_ERROR_FAILURE;
}
}
}
DWORD entryType = 0;

View File

@ -126,9 +126,6 @@ private:
// Don't try to dial again within a few seconds of when user pressed cancel.
static PRIntervalTime mDontRetryUntil;
// OS version info.
OSVERSIONINFO mOSVerInfo;
public:
// ctor

View File

@ -960,18 +960,8 @@ nsSocketTransportService::DiscoverMaxCount()
gMaxCount = rlimitData.rlim_cur - 250;
#elif defined(XP_WIN) && !defined(WIN_CE)
// win 95, 98, etc had a limit of 100 - so we will just
// use the historical 50 in every case older than XP (0x501).
// >= XP is confirmed to have at least 1000
OSVERSIONINFO osInfo = { sizeof(OSVERSIONINFO) };
if (GetVersionEx(&osInfo)) {
PRInt32 version =
(osInfo.dwMajorVersion & 0xff) << 8 |
(osInfo.dwMinorVersion & 0xff);
if (version >= 0x501) /* xp or later */
gMaxCount = SOCKET_LIMIT_TARGET;
}
gMaxCount = SOCKET_LIMIT_TARGET;
#else
// other platforms are harder to test - so leave at safe legacy value
#endif

View File

@ -653,8 +653,6 @@ nsHttpHandler::BuildUserAgent()
}
#ifdef XP_WIN
typedef BOOL (WINAPI *IsWow64ProcessP) (HANDLE, PBOOL);
#define WNT_BASE "Windows NT %ld.%ld"
#define W64_PREFIX "; Win64"
#endif
@ -717,10 +715,7 @@ nsHttpHandler::InitUserAgentComponents()
format = WNT_BASE W64_PREFIX "; x64";
#else
BOOL isWow64 = FALSE;
IsWow64ProcessP fnIsWow64Process = (IsWow64ProcessP)
GetProcAddress(GetModuleHandleW(L"kernel32"), "IsWow64Process");
if (fnIsWow64Process &&
!fnIsWow64Process(GetCurrentProcess(), &isWow64)) {
if (!IsWow64Process(GetCurrentProcess(), &isWow64)) {
isWow64 = FALSE;
}
format = isWow64

View File

@ -59,42 +59,11 @@
#include <iptypes.h>
#include <iphlpapi.h>
typedef DWORD (WINAPI *GetAdaptersAddressesFunc)(ULONG, DWORD, PVOID,
PIP_ADAPTER_ADDRESSES,
PULONG);
typedef DWORD (WINAPI *GetAdaptersInfoFunc)(PIP_ADAPTER_INFO, PULONG);
typedef DWORD (WINAPI *GetIfEntryFunc)(PMIB_IFROW);
typedef DWORD (WINAPI *GetIpAddrTableFunc)(PMIB_IPADDRTABLE, PULONG, BOOL);
typedef DWORD (WINAPI *NotifyAddrChangeFunc)(PHANDLE, LPOVERLAPPED);
typedef void (WINAPI *NcFreeNetconPropertiesFunc)(NETCON_PROPERTIES*);
static HMODULE sIPHelper, sNetshell;
static GetAdaptersAddressesFunc sGetAdaptersAddresses;
static GetAdaptersInfoFunc sGetAdaptersInfo;
static GetIfEntryFunc sGetIfEntry;
static GetIpAddrTableFunc sGetIpAddrTable;
static NotifyAddrChangeFunc sNotifyAddrChange;
static HMODULE sNetshell;
static NcFreeNetconPropertiesFunc sNcFreeNetconProperties;
static void InitIPHelperLibrary(void)
{
if (!sIPHelper) {
sIPHelper = LoadLibraryW(L"iphlpapi.dll");
if (sIPHelper) {
sGetAdaptersAddresses = (GetAdaptersAddressesFunc)
GetProcAddress(sIPHelper, "GetAdaptersAddresses");
sGetAdaptersInfo = (GetAdaptersInfoFunc)
GetProcAddress(sIPHelper, "GetAdaptersInfo");
sGetIfEntry = (GetIfEntryFunc)
GetProcAddress(sIPHelper, "GetIfEntry");
sGetIpAddrTable = (GetIpAddrTableFunc)
GetProcAddress(sIPHelper, "GetIpAddrTable");
sNotifyAddrChange = (NotifyAddrChangeFunc)
GetProcAddress(sIPHelper, "NotifyAddrChange");
}
}
}
static void InitNetshellLibrary(void)
{
if (!sNetshell) {
@ -108,18 +77,6 @@ static void InitNetshellLibrary(void)
static void FreeDynamicLibraries(void)
{
if (sIPHelper)
{
sGetAdaptersAddresses = nsnull;
sGetAdaptersInfo = nsnull;
sGetIfEntry = nsnull;
sGetIpAddrTable = nsnull;
sNotifyAddrChange = nsnull;
FreeLibrary(sIPHelper);
sIPHelper = nsnull;
}
if (sNetshell) {
sNcFreeNetconProperties = nsnull;
FreeLibrary(sNetshell);
@ -185,17 +142,10 @@ nsNotifyAddrListener::Run()
OVERLAPPED overlapped = { 0 };
bool shuttingDown = false;
InitIPHelperLibrary();
if (!sNotifyAddrChange) {
CloseHandle(ev);
return NS_ERROR_NOT_AVAILABLE;
}
overlapped.hEvent = ev;
while (!shuttingDown) {
HANDLE h;
DWORD ret = sNotifyAddrChange(&h, &overlapped);
DWORD ret = NotifyAddrChange(&h, &overlapped);
if (ret == ERROR_IO_PENDING) {
ret = WaitForMultipleObjects(2, handles, FALSE, INFINITE);
@ -307,121 +257,6 @@ nsNotifyAddrListener::ChangeEvent::Run()
return NS_OK;
}
DWORD
nsNotifyAddrListener::GetOperationalStatus(DWORD aAdapterIndex)
{
DWORD status = MIB_IF_OPER_STATUS_CONNECTED;
// If this fails, assume it's connected. Didn't find a KB, but it
// failed for me w/Win2K SP2, and succeeded for me w/Win2K SP3.
if (sGetIfEntry) {
MIB_IFROW ifRow;
ifRow.dwIndex = aAdapterIndex;
if (sGetIfEntry(&ifRow) == ERROR_SUCCESS)
status = ifRow.dwOperStatus;
}
return status;
}
/**
* Calls GetIpAddrTable to check whether a link is up. Assumes so if any
* adapter has a non-zero IP (v4) address. Sets mLinkUp if GetIpAddrTable
* succeeds, but doesn't set mStatusKnown.
* Returns ERROR_SUCCESS on success, and a Win32 error code otherwise.
*/
DWORD
nsNotifyAddrListener::CheckIPAddrTable(void)
{
if (!sGetIpAddrTable)
return ERROR_CALL_NOT_IMPLEMENTED;
ULONG size = 0;
DWORD ret = sGetIpAddrTable(nsnull, &size, FALSE);
if (ret == ERROR_INSUFFICIENT_BUFFER && size > 0) {
PMIB_IPADDRTABLE table = (PMIB_IPADDRTABLE) malloc(size);
if (!table)
return ERROR_OUTOFMEMORY;
ret = sGetIpAddrTable(table, &size, FALSE);
if (ret == ERROR_SUCCESS) {
bool linkUp = false;
for (DWORD i = 0; !linkUp && i < table->dwNumEntries; i++) {
if (GetOperationalStatus(table->table[i].dwIndex) >=
MIB_IF_OPER_STATUS_CONNECTED &&
table->table[i].dwAddr != 0 &&
// Nor a loopback
table->table[i].dwAddr != 0x0100007F)
linkUp = true;
}
mLinkUp = linkUp;
}
free(table);
}
return ret;
}
/**
* Checks whether a link is up by calling GetAdaptersInfo. If any adapter's
* operational status is at least MIB_IF_OPER_STATUS_CONNECTED, checks:
* 1. If it's configured for DHCP, the link is considered up if the DHCP
* server is initialized.
* 2. If it's not configured for DHCP, the link is considered up if it has a
* nonzero IP address.
* Sets mLinkUp and mStatusKnown if GetAdaptersInfo succeeds.
* Returns ERROR_SUCCESS on success, and a Win32 error code otherwise. If the
* call is not present on the current platform, returns ERROR_NOT_SUPPORTED.
*/
DWORD
nsNotifyAddrListener::CheckAdaptersInfo(void)
{
if (!sGetAdaptersInfo)
return ERROR_NOT_SUPPORTED;
ULONG adaptersLen = 0;
DWORD ret = sGetAdaptersInfo(0, &adaptersLen);
if (ret == ERROR_BUFFER_OVERFLOW && adaptersLen > 0) {
PIP_ADAPTER_INFO adapters = (PIP_ADAPTER_INFO) malloc(adaptersLen);
if (!adapters)
return ERROR_OUTOFMEMORY;
ret = sGetAdaptersInfo(adapters, &adaptersLen);
if (ret == ERROR_SUCCESS) {
bool linkUp = false;
PIP_ADAPTER_INFO ptr;
for (ptr = adapters; ptr && !linkUp; ptr = ptr->Next) {
if (GetOperationalStatus(ptr->Index) >=
MIB_IF_OPER_STATUS_CONNECTED) {
if (ptr->DhcpEnabled) {
if (PL_strcmp(ptr->DhcpServer.IpAddress.String,
"255.255.255.255")) {
// it has a DHCP server, therefore it must have
// a usable address
linkUp = true;
}
}
else {
PIP_ADDR_STRING ipAddr;
for (ipAddr = &ptr->IpAddressList; ipAddr && !linkUp;
ipAddr = ipAddr->Next) {
if (PL_strcmp(ipAddr->IpAddress.String, "0.0.0.0")) {
linkUp = true;
}
}
}
}
}
mLinkUp = linkUp;
mStatusKnown = true;
}
free(adapters);
}
return ret;
}
bool
nsNotifyAddrListener::CheckIsGateway(PIP_ADAPTER_ADDRESSES aAdapter)
{
@ -527,22 +362,19 @@ nsNotifyAddrListener::CheckAdaptersAddresses(void)
GAA_FLAG_SKIP_FRIENDLY_NAME | GAA_FLAG_SKIP_ANYCAST |
GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER;
if (!sGetAdaptersAddresses)
return ERROR_NOT_SUPPORTED;
ULONG len = 16384;
PIP_ADAPTER_ADDRESSES addresses = (PIP_ADAPTER_ADDRESSES) malloc(len);
if (!addresses)
return ERROR_OUTOFMEMORY;
DWORD ret = sGetAdaptersAddresses(AF_UNSPEC, 0, NULL, addresses, &len);
DWORD ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, addresses, &len);
if (ret == ERROR_BUFFER_OVERFLOW) {
free(addresses);
addresses = (PIP_ADAPTER_ADDRESSES) malloc(len);
if (!addresses)
return ERROR_BUFFER_OVERFLOW;
ret = sGetAdaptersAddresses(AF_UNSPEC, 0, NULL, addresses, &len);
ret = GetAdaptersAddresses(AF_UNSPEC, 0, NULL, addresses, &len);
}
if (FAILED(CoInitializeEx(NULL, COINIT_MULTITHREADED))) {
@ -582,10 +414,6 @@ nsNotifyAddrListener::CheckLinkStatus(void)
const char *event;
ret = CheckAdaptersAddresses();
if (ret == ERROR_NOT_SUPPORTED)
ret = CheckAdaptersInfo();
if (ret == ERROR_NOT_SUPPORTED)
ret = CheckIPAddrTable();
if (ret != ERROR_SUCCESS)
mLinkUp = true; // I can't tell, so assume there's a link

View File

@ -81,9 +81,6 @@ protected:
nsresult Shutdown(void);
nsresult SendEventToUI(const char *aEventID);
DWORD GetOperationalStatus(DWORD aAdapterIndex);
DWORD CheckIPAddrTable(void);
DWORD CheckAdaptersInfo(void);
DWORD CheckAdaptersAddresses(void);
bool CheckIsGateway(PIP_ADAPTER_ADDRESSES aAdapter);
bool CheckICSStatus(PWCHAR aAdapterName);

View File

@ -524,10 +524,7 @@ endif
endif
ifeq ($(OS_ARCH),WINNT)
OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 uuid version winspool comdlg32 imm32 winmm wsock32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg)
ifneq (,$(MOZ_DEBUG)$(NS_TRACE_MALLOC))
OS_LIBS += $(call EXPAND_LIBNAME,imagehlp)
endif
OS_LIBS += $(call EXPAND_LIBNAME,shell32 ole32 version winspool comdlg32 imm32 msimg32 shlwapi psapi ws2_32 dbghelp rasapi32 rasdlg iphlpapi uxtheme setupapi t2embed secur32)
ifdef MOZ_CRASHREPORTER
OS_LIBS += $(call EXPAND_LIBNAME,wininet)
endif
@ -538,10 +535,14 @@ ifdef _MSC_VER
OS_LIBS += $(call EXPAND_LIBNAME,delayimp)
EXTRA_DSO_LDOPTS += \
-DELAYLOAD:gkmedias.dll \
-DELAYLOAD:psapi.dll \
-DELAYLOAD:dbghelp.dll \
-DELAYLOAD:rasapi32.dll \
-DELAYLOAD:rasdlg.dll \
-DELAYLOAD:comdlg32.dll \
-DELAYLOAD:winspool.drv \
-DELAYLOAD:t2embed.dll \
-DELAYLOAD:secur32.dll \
$(NULL)
ifdef ACCESSIBILITY
EXTRA_DSO_LDOPTS += -DELAYLOAD:oleacc.dll

View File

@ -77,7 +77,7 @@ int wmain(int argc, WCHAR **argv)
{
#ifndef XRE_DONT_PROTECT_DLL_LOAD
mozilla::SanitizeEnvironmentVariables();
mozilla::NS_SetDllDirectory(L"");
SetDllDirectoryW(L"");
#endif
#ifdef XRE_WANT_DLL_BLOCKLIST

View File

@ -247,13 +247,6 @@ nsMIMEInfoWin::GetProperty(const nsAString& aName, nsIVariant* *_retval)
return NS_OK;
}
typedef HRESULT (STDMETHODCALLTYPE *MySHParseDisplayName)
(PCWSTR pszName,
IBindCtx *pbc,
LPITEMIDLIST *ppidl,
SFGAOF sfgaoIn,
SFGAOF *psfgaoOut);
// this implementation was pretty much copied verbatime from
// Tony Robinson's code in nsExternalProtocolWin.cpp
nsresult
@ -274,15 +267,6 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
nsCAutoString urlSpec;
aURL->GetAsciiSpec(urlSpec);
// Some versions of windows (Win2k before SP3, Win XP before SP1)
// crash in ShellExecute on long URLs (bug 161357).
// IE 5 and 6 support URLS of 2083 chars in length, 2K is safe
const PRUint32 maxSafeURL(2048);
if (urlSpec.Length() > maxSafeURL)
return NS_ERROR_FAILURE;
HMODULE hDll = NULL;
static const PRUnichar cmdVerb[] = L"open";
SHELLEXECUTEINFOW sinfo;
memset(&sinfo, 0, sizeof(sinfo));
@ -297,22 +281,14 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
SFGAOF sfgao;
// Bug 394974
hDll = ::LoadLibraryW(L"shell32.dll");
MySHParseDisplayName pMySHParseDisplayName = NULL;
// Version 6.0 and higher
if (pMySHParseDisplayName =
(MySHParseDisplayName)::GetProcAddress(hDll, "SHParseDisplayName")) {
if (SUCCEEDED(pMySHParseDisplayName(NS_ConvertUTF8toUTF16(urlSpec).get(),
NULL, &pidl, 0, &sfgao))) {
sinfo.lpIDList = pidl;
sinfo.fMask |= SEE_MASK_INVOKEIDLIST;
} else {
// SHParseDisplayName exists, but failed. Bailing out as work around for
// Microsoft Security Bulletin MS07-061
rv = NS_ERROR_FAILURE;
}
if (SUCCEEDED(SHParseDisplayName(NS_ConvertUTF8toUTF16(urlSpec).get(),
NULL, &pidl, 0, &sfgao))) {
sinfo.lpIDList = pidl;
sinfo.fMask |= SEE_MASK_INVOKEIDLIST;
} else {
sinfo.lpFile = NS_ConvertUTF8toUTF16(urlSpec).get();
// SHParseDisplayName failed. Bailing out as work around for
// Microsoft Security Bulletin MS07-061
rv = NS_ERROR_FAILURE;
}
if (NS_SUCCEEDED(rv)) {
BOOL result = ShellExecuteExW(&sinfo);
@ -321,8 +297,6 @@ nsMIMEInfoWin::LoadUriInternal(nsIURI * aURL)
}
if (pidl)
CoTaskMemFree(pidl);
if (hDll)
::FreeLibrary(hDll);
}
return rv;

View File

@ -272,31 +272,6 @@ static void normalizeDriverId(nsString& driverid) {
}
}
// Setup API functions
typedef HDEVINFO (WINAPI*SetupDiGetClassDevsWFunc)(
CONST GUID *ClassGuid,
PCWSTR Enumerator,
HWND hwndParent,
DWORD Flags
);
typedef BOOL (WINAPI*SetupDiEnumDeviceInfoFunc)(
HDEVINFO DeviceInfoSet,
DWORD MemberIndex,
PSP_DEVINFO_DATA DeviceInfoData
);
typedef BOOL (WINAPI*SetupDiGetDeviceRegistryPropertyWFunc)(
HDEVINFO DeviceInfoSet,
PSP_DEVINFO_DATA DeviceInfoData,
DWORD Property,
PDWORD PropertyRegDataType,
PBYTE PropertyBuffer,
DWORD PropertyBufferSize,
PDWORD RequiredSize
);
typedef BOOL (WINAPI*SetupDiDestroyDeviceInfoListFunc)(
HDEVINFO DeviceInfoSet
);
// The device ID is a string like PCI\VEN_15AD&DEV_0405&SUBSYS_040515AD
// this function is used to extract the id's out of it
PRUint32
@ -362,184 +337,161 @@ GfxInfo::Init()
mDeviceID = displayDevice.DeviceID;
mDeviceString = displayDevice.DeviceString;
/* create a device information set composed of the current display device */
HDEVINFO devinfo = SetupDiGetClassDevsW(NULL, mDeviceID.get(), NULL,
DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES);
HMODULE setupapi = LoadLibraryW(L"setupapi.dll");
if (devinfo != INVALID_HANDLE_VALUE) {
HKEY key;
LONG result;
WCHAR value[255];
DWORD dwcbData;
SP_DEVINFO_DATA devinfoData;
DWORD memberIndex = 0;
if (setupapi) {
SetupDiGetClassDevsWFunc setupGetClassDevs = (SetupDiGetClassDevsWFunc)
GetProcAddress(setupapi, "SetupDiGetClassDevsW");
SetupDiEnumDeviceInfoFunc setupEnumDeviceInfo = (SetupDiEnumDeviceInfoFunc)
GetProcAddress(setupapi, "SetupDiEnumDeviceInfo");
SetupDiGetDeviceRegistryPropertyWFunc setupGetDeviceRegistryProperty = (SetupDiGetDeviceRegistryPropertyWFunc)
GetProcAddress(setupapi, "SetupDiGetDeviceRegistryPropertyW");
SetupDiDestroyDeviceInfoListFunc setupDestroyDeviceInfoList = (SetupDiDestroyDeviceInfoListFunc)
GetProcAddress(setupapi, "SetupDiDestroyDeviceInfoList");
devinfoData.cbSize = sizeof(devinfoData);
NS_NAMED_LITERAL_STRING(driverKeyPre, "System\\CurrentControlSet\\Control\\Class\\");
/* enumerate device information elements in the device information set */
while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData)) {
/* get a string that identifies the device's driver key */
if (SetupDiGetDeviceRegistryPropertyW(devinfo,
&devinfoData,
SPDRP_DRIVER,
NULL,
(PBYTE)value,
sizeof(value),
NULL)) {
nsAutoString driverKey(driverKeyPre);
driverKey += value;
result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.BeginReading(), 0, KEY_QUERY_VALUE, &key);
if (result == ERROR_SUCCESS) {
/* we've found the driver we're looking for */
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS)
mDriverVersion = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS)
mDriverDate = value;
RegCloseKey(key);
break;
}
}
}
if (setupGetClassDevs &&
setupEnumDeviceInfo &&
setupGetDeviceRegistryProperty &&
setupDestroyDeviceInfoList) {
/* create a device information set composed of the current display device */
HDEVINFO devinfo = setupGetClassDevs(NULL, mDeviceID.get(), NULL,
DIGCF_PRESENT | DIGCF_PROFILE | DIGCF_ALLCLASSES);
SetupDiDestroyDeviceInfoList(devinfo);
}
if (devinfo != INVALID_HANDLE_VALUE) {
HKEY key;
LONG result;
WCHAR value[255];
DWORD dwcbData;
SP_DEVINFO_DATA devinfoData;
DWORD memberIndex = 0;
mAdapterVendorID.AppendPrintf("0x%04x", ParseIDFromDeviceID(mDeviceID, "VEN_", 4));
mAdapterDeviceID.AppendPrintf("0x%04x", ParseIDFromDeviceID(mDeviceID, "&DEV_", 4));
mAdapterSubsysID = ParseIDFromDeviceID(mDeviceID, "&SUBSYS_", 8);
devinfoData.cbSize = sizeof(devinfoData);
NS_NAMED_LITERAL_STRING(driverKeyPre, "System\\CurrentControlSet\\Control\\Class\\");
/* enumerate device information elements in the device information set */
while (setupEnumDeviceInfo(devinfo, memberIndex++, &devinfoData)) {
/* get a string that identifies the device's driver key */
if (setupGetDeviceRegistryProperty(devinfo,
&devinfoData,
SPDRP_DRIVER,
NULL,
(PBYTE)value,
sizeof(value),
NULL)) {
nsAutoString driverKey(driverKeyPre);
driverKey += value;
result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.BeginReading(), 0, KEY_QUERY_VALUE, &key);
// We now check for second display adapter.
// Device interface class for display adapters.
CLSID GUID_DISPLAY_DEVICE_ARRIVAL;
HRESULT hresult = CLSIDFromString(L"{1CA05180-A699-450A-9A0C-DE4FBE3DDD89}",
&GUID_DISPLAY_DEVICE_ARRIVAL);
if (hresult == NOERROR) {
devinfo = SetupDiGetClassDevsW(&GUID_DISPLAY_DEVICE_ARRIVAL, NULL, NULL,
DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
if (devinfo != INVALID_HANDLE_VALUE) {
HKEY key;
LONG result;
WCHAR value[255];
DWORD dwcbData;
SP_DEVINFO_DATA devinfoData;
DWORD memberIndex = 0;
devinfoData.cbSize = sizeof(devinfoData);
nsAutoString adapterDriver2;
nsAutoString deviceID2;
nsAutoString driverVersion2;
nsAutoString driverDate2;
PRUint32 adapterVendorID2;
PRUint32 adapterDeviceID2;
NS_NAMED_LITERAL_STRING(driverKeyPre, "System\\CurrentControlSet\\Control\\Class\\");
/* enumerate device information elements in the device information set */
while (SetupDiEnumDeviceInfo(devinfo, memberIndex++, &devinfoData)) {
/* get a string that identifies the device's driver key */
if (SetupDiGetDeviceRegistryPropertyW(devinfo,
&devinfoData,
SPDRP_DRIVER,
NULL,
(PBYTE)value,
sizeof(value),
NULL)) {
nsAutoString driverKey2(driverKeyPre);
driverKey2 += value;
result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey2.BeginReading(), 0, KEY_QUERY_VALUE, &key);
if (result == ERROR_SUCCESS) {
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"MatchingDeviceId", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
continue;
}
deviceID2 = value;
nsAutoString adapterVendorID2String;
nsAutoString adapterDeviceID2String;
adapterVendorID2 = ParseIDFromDeviceID(deviceID2, "VEN_", 4);
adapterVendorID2String.AppendPrintf("0x%04x", adapterVendorID2);
adapterDeviceID2 = ParseIDFromDeviceID(deviceID2, "&DEV_", 4);
adapterDeviceID2String.AppendPrintf("0x%04x", adapterDeviceID2);
if (mAdapterVendorID == adapterVendorID2String &&
mAdapterDeviceID == adapterDeviceID2String) {
RegCloseKey(key);
continue;
}
// If this device is missing driver information, it is unlikely to
// be a real display adapter.
if (NS_FAILED(GetKeyValue(driverKey2.BeginReading(), L"InstalledDisplayDrivers",
adapterDriver2, REG_MULTI_SZ))) {
RegCloseKey(key);
continue;
}
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
RegCloseKey(key);
continue;
}
driverVersion2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
RegCloseKey(key);
continue;
}
driverDate2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"Device Description", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDesc", NULL, NULL, (LPBYTE)value, &dwcbData);
}
RegCloseKey(key);
if (result == ERROR_SUCCESS) {
/* we've found the driver we're looking for */
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS)
mDriverVersion = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result == ERROR_SUCCESS)
mDriverDate = value;
RegCloseKey(key);
mHasDualGPU = true;
mDeviceString2 = value;
mDeviceID2 = deviceID2;
mDeviceKey2 = driverKey2;
mDriverVersion2 = driverVersion2;
mDriverDate2 = driverDate2;
mAdapterVendorID2.AppendPrintf("0x%04x", adapterVendorID2);
mAdapterDeviceID2.AppendPrintf("0x%04x", adapterDeviceID2);
mAdapterSubsysID2 = ParseIDFromDeviceID(mDeviceID2, "&SUBSYS_", 8);
break;
}
}
}
setupDestroyDeviceInfoList(devinfo);
}
mAdapterVendorID.AppendPrintf("0x%04x", ParseIDFromDeviceID(mDeviceID, "VEN_", 4));
mAdapterDeviceID.AppendPrintf("0x%04x", ParseIDFromDeviceID(mDeviceID, "&DEV_", 4));
mAdapterSubsysID = ParseIDFromDeviceID(mDeviceID, "&SUBSYS_", 8);
// We now check for second display adapter.
// Device interface class for display adapters.
CLSID GUID_DISPLAY_DEVICE_ARRIVAL;
HRESULT hresult = CLSIDFromString(L"{1CA05180-A699-450A-9A0C-DE4FBE3DDD89}",
&GUID_DISPLAY_DEVICE_ARRIVAL);
if (hresult == NOERROR) {
devinfo = setupGetClassDevs(&GUID_DISPLAY_DEVICE_ARRIVAL, NULL, NULL,
DIGCF_PRESENT | DIGCF_INTERFACEDEVICE);
if (devinfo != INVALID_HANDLE_VALUE) {
HKEY key;
LONG result;
WCHAR value[255];
DWORD dwcbData;
SP_DEVINFO_DATA devinfoData;
DWORD memberIndex = 0;
devinfoData.cbSize = sizeof(devinfoData);
nsAutoString adapterDriver2;
nsAutoString deviceID2;
nsAutoString driverVersion2;
nsAutoString driverDate2;
PRUint32 adapterVendorID2;
PRUint32 adapterDeviceID2;
NS_NAMED_LITERAL_STRING(driverKeyPre, "System\\CurrentControlSet\\Control\\Class\\");
/* enumerate device information elements in the device information set */
while (setupEnumDeviceInfo(devinfo, memberIndex++, &devinfoData)) {
/* get a string that identifies the device's driver key */
if (setupGetDeviceRegistryProperty(devinfo,
&devinfoData,
SPDRP_DRIVER,
NULL,
(PBYTE)value,
sizeof(value),
NULL)) {
nsAutoString driverKey2(driverKeyPre);
driverKey2 += value;
result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey2.BeginReading(), 0, KEY_QUERY_VALUE, &key);
if (result == ERROR_SUCCESS) {
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"MatchingDeviceId", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
continue;
}
deviceID2 = value;
nsAutoString adapterVendorID2String;
nsAutoString adapterDeviceID2String;
adapterVendorID2 = ParseIDFromDeviceID(deviceID2, "VEN_", 4);
adapterVendorID2String.AppendPrintf("0x%04x", adapterVendorID2);
adapterDeviceID2 = ParseIDFromDeviceID(deviceID2, "&DEV_", 4);
adapterDeviceID2String.AppendPrintf("0x%04x", adapterDeviceID2);
if (mAdapterVendorID == adapterVendorID2String &&
mAdapterDeviceID == adapterDeviceID2String) {
RegCloseKey(key);
continue;
}
// If this device is missing driver information, it is unlikely to
// be a real display adapter.
if (NS_FAILED(GetKeyValue(driverKey2.BeginReading(), L"InstalledDisplayDrivers",
adapterDriver2, REG_MULTI_SZ))) {
RegCloseKey(key);
continue;
}
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverVersion", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
RegCloseKey(key);
continue;
}
driverVersion2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDate", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
RegCloseKey(key);
continue;
}
driverDate2 = value;
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"Device Description", NULL, NULL, (LPBYTE)value, &dwcbData);
if (result != ERROR_SUCCESS) {
dwcbData = sizeof(value);
result = RegQueryValueExW(key, L"DriverDesc", NULL, NULL, (LPBYTE)value, &dwcbData);
}
RegCloseKey(key);
if (result == ERROR_SUCCESS) {
mHasDualGPU = true;
mDeviceString2 = value;
mDeviceID2 = deviceID2;
mDeviceKey2 = driverKey2;
mDriverVersion2 = driverVersion2;
mDriverDate2 = driverDate2;
mAdapterVendorID2.AppendPrintf("0x%04x", adapterVendorID2);
mAdapterDeviceID2.AppendPrintf("0x%04x", adapterDeviceID2);
mAdapterSubsysID2 = ParseIDFromDeviceID(mDeviceID2, "&SUBSYS_", 8);
break;
}
}
}
}
setupDestroyDeviceInfoList(devinfo);
}
}
SetupDiDestroyDeviceInfoList(devinfo);
}
FreeLibrary(setupapi);
}
const char *spoofedDriverVersionString = PR_GetEnv("MOZ_GFX_SPOOF_DRIVER_VERSION");
@ -810,8 +762,6 @@ static OperatingSystem
WindowsVersionToOperatingSystem(PRInt32 aWindowsVersion)
{
switch(aWindowsVersion) {
case gfxWindowsPlatform::kWindows2000:
return DRIVER_OS_WINDOWS_2000;
case gfxWindowsPlatform::kWindowsXP:
return DRIVER_OS_WINDOWS_XP;
case gfxWindowsPlatform::kWindowsServer2003:
@ -996,13 +946,6 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
return NS_OK;
}
if (aFeature == FEATURE_DIRECT3D_9_LAYERS &&
mWindowsVersion < gfxWindowsPlatform::kWindowsXP)
{
*aStatus = FEATURE_BLOCKED_OS_VERSION;
return NS_OK;
}
// ANGLE currently uses D3D10 <-> D3D9 interop, which crashes on Optimus
// machines.
if (aFeature == FEATURE_WEBGL_ANGLE &&

View File

@ -63,7 +63,6 @@ namespace widget {
class WinUtils {
public:
enum WinVersion {
WIN2K_VERSION = 0x500,
WINXP_VERSION = 0x501,
WIN2K3_VERSION = 0x502,
VISTA_VERSION = 0x600,

View File

@ -52,10 +52,6 @@
using namespace mozilla::widget;
using mozilla::LookAndFeel;
typedef UINT (CALLBACK *SHAppBarMessagePtr)(DWORD, PAPPBARDATA);
SHAppBarMessagePtr gSHAppBarMessage = NULL;
static HINSTANCE gShell32DLLInst = NULL;
static nsresult GetColorFromTheme(nsUXThemeClass cls,
PRInt32 aPart,
PRInt32 aState,
@ -63,7 +59,7 @@ static nsresult GetColorFromTheme(nsUXThemeClass cls,
nscolor &aColor)
{
COLORREF color;
HRESULT hr = nsUXThemeData::GetThemeColor(cls, aPart, aState, aPropId, &color);
HRESULT hr = GetThemeColor(nsUXThemeData::GetTheme(cls), aPart, aState, aPropId, &color);
if (hr == S_OK)
{
aColor = COLOREF_2_NSRGB(color);
@ -80,22 +76,10 @@ static PRInt32 GetSystemParam(long flag, PRInt32 def)
nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
{
gShell32DLLInst = LoadLibraryW(L"Shell32.dll");
if (gShell32DLLInst)
{
gSHAppBarMessage = (SHAppBarMessagePtr) GetProcAddress(gShell32DLLInst,
"SHAppBarMessage");
}
}
nsLookAndFeel::~nsLookAndFeel()
{
if (gShell32DLLInst)
{
FreeLibrary(gShell32DLLInst);
gShell32DLLInst = NULL;
gSHAppBarMessage = NULL;
}
}
nsresult
@ -205,7 +189,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
break;
case eColorID__moz_menubarhovertext:
if (WinUtils::GetWindowsVersion() < WinUtils::VISTA_VERSION ||
!nsUXThemeData::isAppThemed())
!IsAppThemed())
{
idx = nsUXThemeData::sFlatMenus ?
COLOR_HIGHLIGHTTEXT :
@ -215,7 +199,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
// Fall through
case eColorID__moz_menuhovertext:
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION &&
nsUXThemeData::IsAppThemed())
IsAppThemed())
{
res = ::GetColorFromTheme(eUXMenu,
MENU_POPUPITEM, MPI_HOT, TMT_TEXTCOLOR, aColor);
@ -292,7 +276,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
break;
case eColorID__moz_win_mediatext:
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION &&
nsUXThemeData::IsAppThemed()) {
IsAppThemed()) {
res = ::GetColorFromTheme(eUXMediaToolbar,
TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor);
if (NS_SUCCEEDED(res))
@ -303,7 +287,7 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor &aColor)
break;
case eColorID__moz_win_communicationstext:
if (WinUtils::GetWindowsVersion() >= WinUtils::VISTA_VERSION &&
nsUXThemeData::IsAppThemed())
IsAppThemed())
{
res = ::GetColorFromTheme(eUXCommunicationsToolbar,
TP_BUTTON, TS_NORMAL, TMT_TEXTCOLOR, aColor);
@ -414,7 +398,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, PRInt32 &aResult)
aResult = 3;
break;
case eIntID_WindowsClassic:
aResult = !nsUXThemeData::IsAppThemed();
aResult = !IsAppThemed();
break;
case eIntID_TouchEnabled:
aResult = 0;
@ -442,7 +426,6 @@ nsLookAndFeel::GetIntImpl(IntID aID, PRInt32 &aResult)
break;
case eIntID_AlertNotificationOrigin:
aResult = 0;
if (gSHAppBarMessage)
{
// Get task bar window handle
HWND shellWindow = FindWindowW(L"Shell_TrayWnd", NULL);
@ -453,7 +436,7 @@ nsLookAndFeel::GetIntImpl(IntID aID, PRInt32 &aResult)
APPBARDATA appBarData;
appBarData.hWnd = shellWindow;
appBarData.cbSize = sizeof(appBarData);
if (gSHAppBarMessage(ABM_GETTASKBARPOS, &appBarData))
if (SHAppBarMessage(ABM_GETTASKBARPOS, &appBarData))
{
// Set alert origin as a bit field - see LookAndFeel.h
// 0 represents bottom right, sliding vertically.

View File

@ -166,13 +166,13 @@ static bool IsTopLevelMenu(nsIFrame *aFrame)
static MARGINS GetCheckboxMargins(HANDLE theme, HDC hdc)
{
MARGINS checkboxContent = {0};
nsUXThemeData::getThemeMargins(theme, hdc, MENU_POPUPCHECK, MCB_NORMAL, TMT_CONTENTMARGINS, NULL, &checkboxContent);
GetThemeMargins(theme, hdc, MENU_POPUPCHECK, MCB_NORMAL, TMT_CONTENTMARGINS, NULL, &checkboxContent);
return checkboxContent;
}
static SIZE GetCheckboxBGSize(HANDLE theme, HDC hdc)
{
SIZE checkboxSize;
nsUXThemeData::getThemePartSize(theme, hdc, MENU_POPUPCHECK, MC_CHECKMARKNORMAL, NULL, TS_TRUE, &checkboxSize);
GetThemePartSize(theme, hdc, MENU_POPUPCHECK, MC_CHECKMARKNORMAL, NULL, TS_TRUE, &checkboxSize);
MARGINS checkboxMargins = GetCheckboxMargins(theme, hdc);
@ -192,8 +192,8 @@ static SIZE GetCheckboxBGBounds(HANDLE theme, HDC hdc)
{
MARGINS checkboxBGSizing = {0};
MARGINS checkboxBGContent = {0};
nsUXThemeData::getThemeMargins(theme, hdc, MENU_POPUPCHECKBACKGROUND, MCB_NORMAL, TMT_SIZINGMARGINS, NULL, &checkboxBGSizing);
nsUXThemeData::getThemeMargins(theme, hdc, MENU_POPUPCHECKBACKGROUND, MCB_NORMAL, TMT_CONTENTMARGINS, NULL, &checkboxBGContent);
GetThemeMargins(theme, hdc, MENU_POPUPCHECKBACKGROUND, MCB_NORMAL, TMT_SIZINGMARGINS, NULL, &checkboxBGSizing);
GetThemeMargins(theme, hdc, MENU_POPUPCHECKBACKGROUND, MCB_NORMAL, TMT_CONTENTMARGINS, NULL, &checkboxBGContent);
#define posdx(d) ((d) > 0 ? d : 0)
@ -210,12 +210,12 @@ static SIZE GetCheckboxBGBounds(HANDLE theme, HDC hdc)
static SIZE GetGutterSize(HANDLE theme, HDC hdc)
{
SIZE gutterSize;
nsUXThemeData::getThemePartSize(theme, hdc, MENU_POPUPGUTTER, 0, NULL, TS_TRUE, &gutterSize);
GetThemePartSize(theme, hdc, MENU_POPUPGUTTER, 0, NULL, TS_TRUE, &gutterSize);
SIZE checkboxBGSize(GetCheckboxBGBounds(theme, hdc));
SIZE itemSize;
nsUXThemeData::getThemePartSize(theme, hdc, MENU_POPUPITEM, MPI_NORMAL, NULL, TS_TRUE, &itemSize);
GetThemePartSize(theme, hdc, MENU_POPUPITEM, MPI_NORMAL, NULL, TS_TRUE, &itemSize);
int width = NS_MAX(itemSize.cx, checkboxBGSize.cx + gutterSize.cx);
int height = NS_MAX(itemSize.cy, checkboxBGSize.cy);
@ -276,7 +276,7 @@ static HRESULT DrawThemeBGRTLAware(HANDLE theme, HDC hdc, int part, int state,
}
SetLayout(hdc, LAYOUT_RTL);
HRESULT hr = nsUXThemeData::drawThemeBG(theme, hdc, part, state, &newWRect, newCRectPtr);
HRESULT hr = DrawThemeBackground(theme, hdc, part, state, &newWRect, newCRectPtr);
SetLayout(hdc, 0);
if (hr == S_OK)
@ -285,7 +285,7 @@ static HRESULT DrawThemeBGRTLAware(HANDLE theme, HDC hdc, int part, int state,
}
// Draw normally if LTR or if anything went wrong
return nsUXThemeData::drawThemeBG(theme, hdc, part, state, widgetRect, clipRect);
return DrawThemeBackground(theme, hdc, part, state, widgetRect, clipRect);
}
/*
@ -383,7 +383,7 @@ static void AddPaddingRect(nsIntSize* aSize, CaptionButton button) {
if (!aSize)
return;
RECT offset;
if (!nsUXThemeData::IsAppThemed())
if (!IsAppThemed())
offset = buttonData[CAPTION_CLASSIC].hotPadding[button];
else if (WinUtils::GetWindowsVersion() == WinUtils::WINXP_VERSION)
offset = buttonData[CAPTION_XPTHEME].hotPadding[button];
@ -397,7 +397,7 @@ static void AddPaddingRect(nsIntSize* aSize, CaptionButton button) {
// the area we draw into to compensate.
static void OffsetBackgroundRect(RECT& rect, CaptionButton button) {
RECT offset;
if (!nsUXThemeData::IsAppThemed())
if (!IsAppThemed())
offset = buttonData[CAPTION_CLASSIC].hotPadding[button];
else if (WinUtils::GetWindowsVersion() == WinUtils::WINXP_VERSION)
offset = buttonData[CAPTION_XPTHEME].hotPadding[button];
@ -1217,9 +1217,6 @@ nsNativeThemeWin::DrawWidgetBackground(nsRenderingContext* aContext,
if (!theme)
return ClassicDrawWidgetBackground(aContext, aFrame, aWidgetType, aRect, aDirtyRect);
if (!nsUXThemeData::drawThemeBG)
return NS_ERROR_FAILURE;
// ^^ without the right sdk, assume xp theming and fall through.
if (nsUXThemeData::CheckForCompositor()) {
switch (aWidgetType) {
@ -1356,10 +1353,10 @@ RENDER_AGAIN:
if (aWidgetType == NS_THEME_SCALE_HORIZONTAL ||
aWidgetType == NS_THEME_SCALE_VERTICAL) {
RECT contentRect;
nsUXThemeData::getThemeContentRect(theme, hdc, part, state, &widgetRect, &contentRect);
GetThemeBackgroundContentRect(theme, hdc, part, state, &widgetRect, &contentRect);
SIZE siz;
nsUXThemeData::getThemePartSize(theme, hdc, part, state, &widgetRect, 1, &siz);
GetThemePartSize(theme, hdc, part, state, &widgetRect, TS_TRUE, &siz);
if (aWidgetType == NS_THEME_SCALE_HORIZONTAL) {
PRInt32 adjustment = (contentRect.bottom - contentRect.top - siz.cy) / 2 + 1;
@ -1374,7 +1371,7 @@ RENDER_AGAIN:
contentRect.right -= adjustment;
}
nsUXThemeData::drawThemeBG(theme, hdc, part, state, &contentRect, &clipRect);
DrawThemeBackground(theme, hdc, part, state, &contentRect, &clipRect);
}
else if (aWidgetType == NS_THEME_MENUCHECKBOX || aWidgetType == NS_THEME_MENURADIO)
{
@ -1403,7 +1400,7 @@ RENDER_AGAIN:
checkBGRect.top += (checkBGRect.bottom - checkBGRect.top)/2 - checkboxBGSize.cy/2;
checkBGRect.bottom = checkBGRect.top + checkboxBGSize.cy;
nsUXThemeData::drawThemeBG(theme, hdc, MENU_POPUPCHECKBACKGROUND, bgState, &checkBGRect, &clipRect);
DrawThemeBackground(theme, hdc, MENU_POPUPCHECKBACKGROUND, bgState, &checkBGRect, &clipRect);
MARGINS checkMargins = GetCheckboxMargins(theme, hdc);
RECT checkRect = checkBGRect;
@ -1411,14 +1408,14 @@ RENDER_AGAIN:
checkRect.right -= checkMargins.cxRightWidth;
checkRect.top += checkMargins.cyTopHeight;
checkRect.bottom -= checkMargins.cyBottomHeight;
nsUXThemeData::drawThemeBG(theme, hdc, MENU_POPUPCHECK, state, &checkRect, &clipRect);
DrawThemeBackground(theme, hdc, MENU_POPUPCHECK, state, &checkRect, &clipRect);
}
}
else if (aWidgetType == NS_THEME_MENUPOPUP)
{
nsUXThemeData::drawThemeBG(theme, hdc, MENU_POPUPBORDERS, /* state */ 0, &widgetRect, &clipRect);
DrawThemeBackground(theme, hdc, MENU_POPUPBORDERS, /* state */ 0, &widgetRect, &clipRect);
SIZE borderSize;
nsUXThemeData::getThemePartSize(theme, hdc, MENU_POPUPBORDERS, 0, NULL, TS_TRUE, &borderSize);
GetThemePartSize(theme, hdc, MENU_POPUPBORDERS, 0, NULL, TS_TRUE, &borderSize);
RECT bgRect = widgetRect;
bgRect.top += borderSize.cy;
@ -1426,7 +1423,7 @@ RENDER_AGAIN:
bgRect.left += borderSize.cx;
bgRect.right -= borderSize.cx;
nsUXThemeData::drawThemeBG(theme, hdc, MENU_POPUPBACKGROUND, /* state */ 0, &bgRect, &clipRect);
DrawThemeBackground(theme, hdc, MENU_POPUPBACKGROUND, /* state */ 0, &bgRect, &clipRect);
SIZE gutterSize(GetGutterSize(theme, hdc));
@ -1454,7 +1451,7 @@ RENDER_AGAIN:
else
sepRect.left += gutterSize.cx;
nsUXThemeData::drawThemeBG(theme, hdc, MENU_POPUPSEPARATOR, /* state */ 0, &sepRect, &clipRect);
DrawThemeBackground(theme, hdc, MENU_POPUPSEPARATOR, /* state */ 0, &sepRect, &clipRect);
}
// The following widgets need to be RTL-aware
else if (aWidgetType == NS_THEME_MENUARROW ||
@ -1467,7 +1464,7 @@ RENDER_AGAIN:
// If part is negative, the element wishes us to not render a themed
// background, instead opting to be drawn specially below.
else if (part >= 0) {
nsUXThemeData::drawThemeBG(theme, hdc, part, state, &widgetRect, &clipRect);
DrawThemeBackground(theme, hdc, part, state, &widgetRect, &clipRect);
}
// Draw focus rectangles for XP HTML checkboxes and radio buttons
@ -1529,7 +1526,7 @@ RENDER_AGAIN:
return NS_ERROR_FAILURE;
widgetRect.bottom = widgetRect.top + TB_SEPARATOR_HEIGHT;
nsUXThemeData::drawThemeEdge(theme, hdc, RP_BAND, 0, &widgetRect, EDGE_ETCHED, BF_TOP, NULL);
DrawThemeEdge(theme, hdc, RP_BAND, 0, &widgetRect, EDGE_ETCHED, BF_TOP, NULL);
}
else if (aWidgetType == NS_THEME_SCROLLBAR_THUMB_HORIZONTAL ||
aWidgetType == NS_THEME_SCROLLBAR_THUMB_VERTICAL)
@ -1541,12 +1538,12 @@ RENDER_AGAIN:
int gripPart = (aWidgetType == NS_THEME_SCROLLBAR_THUMB_HORIZONTAL) ?
SP_GRIPPERHOR : SP_GRIPPERVERT;
if (nsUXThemeData::getThemePartSize(theme, hdc, gripPart, state, NULL, TS_TRUE, &gripSize) == S_OK &&
nsUXThemeData::getThemeMargins(theme, hdc, part, state, TMT_CONTENTMARGINS, NULL, &thumbMgns) == S_OK &&
if (GetThemePartSize(theme, hdc, gripPart, state, NULL, TS_TRUE, &gripSize) == S_OK &&
GetThemeMargins(theme, hdc, part, state, TMT_CONTENTMARGINS, NULL, &thumbMgns) == S_OK &&
gripSize.cx + thumbMgns.cxLeftWidth + thumbMgns.cxRightWidth <= widgetRect.right - widgetRect.left &&
gripSize.cy + thumbMgns.cyTopHeight + thumbMgns.cyBottomHeight <= widgetRect.bottom - widgetRect.top)
{
nsUXThemeData::drawThemeBG(theme, hdc, gripPart, state, &widgetRect, &clipRect);
DrawThemeBackground(theme, hdc, gripPart, state, &widgetRect, &clipRect);
}
}
else if ((aWidgetType == NS_THEME_WINDOW_BUTTON_BOX ||
@ -1667,8 +1664,8 @@ RENDER_AGAIN:
PP_MOVEOVERLAY : PP_CHUNK;
}
nsUXThemeData::drawThemeBG(theme, hdc, overlayPart, state, &overlayRect,
&clipRect);
DrawThemeBackground(theme, hdc, overlayPart, state, &overlayRect,
&clipRect);
}
}
@ -1713,9 +1710,6 @@ nsNativeThemeWin::GetWidgetBorder(nsDeviceContext* aContext,
aWidgetType == NS_THEME_WIN_GLASS || aWidgetType == NS_THEME_WIN_BORDERLESS_GLASS)
return NS_OK; // Don't worry about it.
if (!nsUXThemeData::getThemeContentRect)
return NS_ERROR_FAILURE;
PRInt32 part, state;
nsresult rv = GetThemePartAndState(aFrame, aWidgetType, part, state);
if (NS_FAILED(rv))
@ -1733,7 +1727,7 @@ nsNativeThemeWin::GetWidgetBorder(nsDeviceContext* aContext,
outerRect.top = outerRect.left = 100;
outerRect.right = outerRect.bottom = 200;
RECT contentRect(outerRect);
HRESULT res = nsUXThemeData::getThemeContentRect(theme, NULL, part, state, &outerRect, &contentRect);
HRESULT res = GetThemeBackgroundContentRect(theme, NULL, part, state, &outerRect, &contentRect);
if (FAILED(res))
return NS_ERROR_FAILURE;
@ -1821,7 +1815,7 @@ nsNativeThemeWin::GetWidgetPadding(nsDeviceContext* aContext,
if (aWidgetType == NS_THEME_MENUPOPUP)
{
SIZE popupSize;
nsUXThemeData::getThemePartSize(theme, NULL, MENU_POPUPBORDERS, /* state */ 0, NULL, TS_TRUE, &popupSize);
GetThemePartSize(theme, NULL, MENU_POPUPBORDERS, /* state */ 0, NULL, TS_TRUE, &popupSize);
aResult->top = aResult->bottom = popupSize.cy;
aResult->left = aResult->right = popupSize.cx;
return true;
@ -1979,13 +1973,10 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* a
if (aWidgetType == NS_THEME_MENUITEM && IsTopLevelMenu(aFrame))
return NS_OK; // Don't worry about it for top level menus
if (!nsUXThemeData::getThemePartSize)
return NS_ERROR_FAILURE;
// Call GetSystemMetrics to determine size for WinXP scrollbars
// (GetThemeSysSize API returns the optimal size for the theme, but
// Windows appears to always use metrics when drawing standard scrollbars)
PRInt32 sizeReq = TS_TRUE; // Best-fit size
THEMESIZE sizeReq = TS_TRUE; // Best-fit size
switch (aWidgetType) {
case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
@ -2159,7 +2150,7 @@ nsNativeThemeWin::GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* a
return NS_ERROR_FAILURE;
SIZE sz;
nsUXThemeData::getThemePartSize(theme, hdc, part, state, NULL, sizeReq, &sz);
GetThemePartSize(theme, hdc, part, state, NULL, sizeReq, &sz);
aResult->width = sz.cx;
aResult->height = sz.cy;
@ -2353,12 +2344,12 @@ nsNativeThemeWin::GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType)
NS_ENSURE_SUCCESS(rv, eUnknownTransparency);
if (part <= 0) {
// Not a real part code, so isThemeBackgroundPartiallyTransparent may
// Not a real part code, so IsThemeBackgroundPartiallyTransparent may
// not work, so don't call it.
return eUnknownTransparency;
}
if (nsUXThemeData::isThemeBackgroundPartiallyTransparent(theme, part, state))
if (IsThemeBackgroundPartiallyTransparent(theme, part, state))
return eTransparent;
return eOpaque;
}

View File

@ -184,14 +184,6 @@
#define MSM_NORMAL 1
#define MSM_DISABLED 2
// Theme size constants
// minimum size
#define TS_MIN 0
// size without stretching
#define TS_TRUE 1
// size that theme mgr will use to draw part
#define TS_DRAW 2
// From tmschema.h in the Vista SDK
#define TMT_TEXTCOLOR 3803
#define TMT_SIZINGMARGINS 3601

View File

@ -63,28 +63,13 @@ nsUXThemeData::sThemeDLL = NULL;
HMODULE
nsUXThemeData::sDwmDLL = NULL;
BOOL
nsUXThemeData::sFlatMenus = FALSE;
bool
nsUXThemeData::sFlatMenus = false;
bool nsUXThemeData::sTitlebarInfoPopulatedAero = false;
bool nsUXThemeData::sTitlebarInfoPopulatedThemed = false;
SIZE nsUXThemeData::sCommandButtons[4];
nsUXThemeData::OpenThemeDataPtr nsUXThemeData::openTheme = NULL;
nsUXThemeData::CloseThemeDataPtr nsUXThemeData::closeTheme = NULL;
nsUXThemeData::DrawThemeBackgroundPtr nsUXThemeData::drawThemeBG = NULL;
nsUXThemeData::DrawThemeEdgePtr nsUXThemeData::drawThemeEdge = NULL;
nsUXThemeData::GetThemeContentRectPtr nsUXThemeData::getThemeContentRect = NULL;
nsUXThemeData::GetThemeBackgroundRegionPtr nsUXThemeData::getThemeBackgroundRegion = NULL;
nsUXThemeData::GetThemePartSizePtr nsUXThemeData::getThemePartSize = NULL;
nsUXThemeData::GetThemeSysFontPtr nsUXThemeData::getThemeSysFont = NULL;
nsUXThemeData::GetThemeColorPtr nsUXThemeData::getThemeColor = NULL;
nsUXThemeData::GetThemeMarginsPtr nsUXThemeData::getThemeMargins = NULL;
nsUXThemeData::IsAppThemedPtr nsUXThemeData::isAppThemed = NULL;
nsUXThemeData::GetCurrentThemeNamePtr nsUXThemeData::getCurrentThemeName = NULL;
nsUXThemeData::GetThemeSysColorPtr nsUXThemeData::getThemeSysColor = NULL;
nsUXThemeData::IsThemeBackgroundPartiallyTransparentPtr nsUXThemeData::isThemeBackgroundPartiallyTransparent = NULL;
nsUXThemeData::DwmExtendFrameIntoClientAreaProc nsUXThemeData::dwmExtendFrameIntoClientAreaPtr = NULL;
nsUXThemeData::DwmIsCompositionEnabledProc nsUXThemeData::dwmIsCompositionEnabledPtr = NULL;
nsUXThemeData::DwmSetIconicThumbnailProc nsUXThemeData::dwmSetIconicThumbnailPtr = NULL;
@ -109,22 +94,6 @@ nsUXThemeData::Initialize()
::ZeroMemory(sThemes, sizeof(sThemes));
NS_ASSERTION(!sThemeDLL, "nsUXThemeData being initialized twice!");
if (GetThemeDLL()) {
openTheme = (OpenThemeDataPtr)GetProcAddress(sThemeDLL, "OpenThemeData");
closeTheme = (CloseThemeDataPtr)GetProcAddress(sThemeDLL, "CloseThemeData");
drawThemeBG = (DrawThemeBackgroundPtr)GetProcAddress(sThemeDLL, "DrawThemeBackground");
drawThemeEdge = (DrawThemeEdgePtr)GetProcAddress(sThemeDLL, "DrawThemeEdge");
getThemeContentRect = (GetThemeContentRectPtr)GetProcAddress(sThemeDLL, "GetThemeBackgroundContentRect");
getThemeBackgroundRegion = (GetThemeBackgroundRegionPtr)GetProcAddress(sThemeDLL, "GetThemeBackgroundRegion");
getThemePartSize = (GetThemePartSizePtr)GetProcAddress(sThemeDLL, "GetThemePartSize");
getThemeSysFont = (GetThemeSysFontPtr)GetProcAddress(sThemeDLL, "GetThemeSysFont");
getThemeColor = (GetThemeColorPtr)GetProcAddress(sThemeDLL, "GetThemeColor");
getThemeMargins = (GetThemeMarginsPtr)GetProcAddress(sThemeDLL, "GetThemeMargins");
isAppThemed = (IsAppThemedPtr)GetProcAddress(sThemeDLL, "IsAppThemed");
getCurrentThemeName = (GetCurrentThemeNamePtr)GetProcAddress(sThemeDLL, "GetCurrentThemeName");
getThemeSysColor = (GetThemeSysColorPtr)GetProcAddress(sThemeDLL, "GetThemeSysColor");
isThemeBackgroundPartiallyTransparent = (IsThemeBackgroundPartiallyTransparentPtr)GetProcAddress(sThemeDLL, "IsThemeBackgroundPartiallyTransparent");
}
if (GetDwmDLL()) {
dwmExtendFrameIntoClientAreaPtr = (DwmExtendFrameIntoClientAreaProc)::GetProcAddress(sDwmDLL, "DwmExtendFrameIntoClientArea");
dwmIsCompositionEnabledPtr = (DwmIsCompositionEnabledProc)::GetProcAddress(sDwmDLL, "DwmIsCompositionEnabled");
@ -144,11 +113,11 @@ void
nsUXThemeData::Invalidate() {
for(int i = 0; i < eUXNumClasses; i++) {
if(sThemes[i]) {
closeTheme(sThemes[i]);
CloseThemeData(sThemes[i]);
sThemes[i] = NULL;
}
}
BOOL useFlat = false;
BOOL useFlat = FALSE;
sFlatMenus = ::SystemParametersInfo(SPI_GETFLATMENU, 0, &useFlat, 0) ?
useFlat : false;
}
@ -156,11 +125,9 @@ nsUXThemeData::Invalidate() {
HANDLE
nsUXThemeData::GetTheme(nsUXThemeClass cls) {
NS_ASSERTION(cls < eUXNumClasses, "Invalid theme class!");
if(!sThemeDLL)
return NULL;
if(!sThemes[cls])
{
sThemes[cls] = openTheme(NULL, GetClassName(cls));
sThemes[cls] = OpenThemeData(NULL, GetClassName(cls));
}
return sThemes[cls];
}
@ -377,14 +344,14 @@ nsUXThemeData::UpdateNativeThemeInfo()
sIsDefaultWindowsTheme = false;
sThemeId = LookAndFeel::eWindowsTheme_Generic;
if (!IsAppThemed() || !getCurrentThemeName) {
if (!IsAppThemed()) {
sThemeId = LookAndFeel::eWindowsTheme_Classic;
return;
}
WCHAR themeFileName[MAX_PATH + 1];
WCHAR themeColor[MAX_PATH + 1];
if (FAILED(getCurrentThemeName(themeFileName,
if (FAILED(GetCurrentThemeName(themeFileName,
MAX_PATH,
themeColor,
MAX_PATH,

View File

@ -119,7 +119,7 @@ class nsUXThemeData {
public:
static const PRUnichar kThemeLibraryName[];
static const PRUnichar kDwmLibraryName[];
static BOOL sFlatMenus;
static bool sFlatMenus;
static bool sTitlebarInfoPopulatedAero;
static bool sTitlebarInfoPopulatedThemed;
static SIZE sCommandButtons[4];
@ -141,64 +141,6 @@ public:
static mozilla::LookAndFeel::WindowsTheme GetNativeThemeId();
static bool IsDefaultWindowTheme();
static inline BOOL IsAppThemed() {
return isAppThemed && isAppThemed();
}
static inline HRESULT GetThemeColor(nsUXThemeClass cls, int iPartId, int iStateId,
int iPropId, OUT COLORREF* pFont) {
if(!getThemeColor)
return E_FAIL;
return getThemeColor(GetTheme(cls), iPartId, iStateId, iPropId, pFont);
}
// UXTheme.dll Function typedefs and declarations
typedef HANDLE (WINAPI*OpenThemeDataPtr)(HWND hwnd, LPCWSTR pszClassList);
typedef HRESULT (WINAPI*CloseThemeDataPtr)(HANDLE hTheme);
typedef HRESULT (WINAPI*DrawThemeBackgroundPtr)(HANDLE hTheme, HDC hdc, int iPartId,
int iStateId, const RECT *pRect,
const RECT* pClipRect);
typedef HRESULT (WINAPI*DrawThemeEdgePtr)(HANDLE hTheme, HDC hdc, int iPartId,
int iStateId, const RECT *pDestRect,
uint uEdge, uint uFlags,
const RECT* pContentRect);
typedef HRESULT (WINAPI*GetThemeContentRectPtr)(HANDLE hTheme, HDC hdc, int iPartId,
int iStateId, const RECT* pRect,
RECT* pContentRect);
typedef HRESULT (WINAPI*GetThemeBackgroundRegionPtr)(HANDLE hTheme, HDC hdc, int iPartId,
int iStateId, const RECT* pRect,
HRGN *pRegion);
typedef HRESULT (WINAPI*GetThemePartSizePtr)(HANDLE hTheme, HDC hdc, int iPartId,
int iStateId, RECT* prc, int ts,
SIZE* psz);
typedef HRESULT (WINAPI*GetThemeSysFontPtr)(HANDLE hTheme, int iFontId, OUT LOGFONT* pFont);
typedef HRESULT (WINAPI*GetThemeColorPtr)(HANDLE hTheme, int iPartId,
int iStateId, int iPropId, OUT COLORREF* pFont);
typedef HRESULT (WINAPI*GetThemeMarginsPtr)(HANDLE hTheme, HDC hdc, int iPartId,
int iStateid, int iPropId,
LPRECT prc, MARGINS *pMargins);
typedef BOOL (WINAPI*IsAppThemedPtr)(VOID);
typedef HRESULT (WINAPI*GetCurrentThemeNamePtr)(LPWSTR pszThemeFileName, int dwMaxNameChars,
LPWSTR pszColorBuff, int cchMaxColorChars,
LPWSTR pszSizeBuff, int cchMaxSizeChars);
typedef COLORREF (WINAPI*GetThemeSysColorPtr)(HANDLE hTheme, int iColorID);
typedef BOOL (WINAPI*IsThemeBackgroundPartiallyTransparentPtr)(HANDLE hTheme, int iPartId, int iStateId);
static OpenThemeDataPtr openTheme;
static CloseThemeDataPtr closeTheme;
static DrawThemeBackgroundPtr drawThemeBG;
static DrawThemeEdgePtr drawThemeEdge;
static GetThemeContentRectPtr getThemeContentRect;
static GetThemeBackgroundRegionPtr getThemeBackgroundRegion;
static GetThemePartSizePtr getThemePartSize;
static GetThemeSysFontPtr getThemeSysFont;
static GetThemeColorPtr getThemeColor;
static GetThemeMarginsPtr getThemeMargins;
static IsAppThemedPtr isAppThemed;
static GetCurrentThemeNamePtr getCurrentThemeName;
static GetThemeSysColorPtr getThemeSysColor;
static IsThemeBackgroundPartiallyTransparentPtr isThemeBackgroundPartiallyTransparent;
// dwmapi.dll function typedefs and declarations
typedef HRESULT (WINAPI*DwmExtendFrameIntoClientAreaProc)(HWND hWnd, const MARGINS *pMarInset);
typedef HRESULT (WINAPI*DwmIsCompositionEnabledProc)(BOOL *pfEnabled);

View File

@ -113,6 +113,7 @@
#include <process.h>
#include <commctrl.h>
#include <unknwn.h>
#include <psapi.h>
#include "prlog.h"
#include "prtime.h"
@ -1292,7 +1293,7 @@ void nsWindow::SetThemeRegion()
RECT rect = {0,0,mBounds.width,mBounds.height};
HDC dc = ::GetDC(mWnd);
nsUXThemeData::getThemeBackgroundRegion(nsUXThemeData::GetTheme(eUXTooltip), dc, TTP_STANDARD, TS_NORMAL, &rect, &hRgn);
GetThemeBackgroundRegion(nsUXThemeData::GetTheme(eUXTooltip), dc, TTP_STANDARD, TS_NORMAL, &rect, &hRgn);
if (hRgn) {
if (!SetWindowRgn(mWnd, hRgn, false)) // do not delete or alter hRgn if accepted.
DeleteObject(hRgn);
@ -7442,22 +7443,12 @@ bool nsWindow::OnHotKey(WPARAM wParam, LPARAM lParam)
return true;
}
typedef DWORD (WINAPI *GetProcessImageFileNameProc)(HANDLE, LPWSTR, DWORD);
// Determine whether the given HWND is the handle for the Elantech helper
// window. The helper window cannot be distinguished based on its
// window class, so we need to check if it is owned by the helper process,
// ETDCtrl.exe.
static bool IsElantechHelperWindow(HWND aHWND)
{
static HMODULE hPSAPI = ::LoadLibraryW(L"psapi.dll");
static GetProcessImageFileNameProc pGetProcessImageFileName =
reinterpret_cast<GetProcessImageFileNameProc>(::GetProcAddress(hPSAPI, "GetProcessImageFileNameW"));
if (!pGetProcessImageFileName) {
return false;
}
const PRUnichar* filenameSuffix = L"\\etdctrl.exe";
const int filenameSuffixLength = 12;
@ -7469,7 +7460,7 @@ static bool IsElantechHelperWindow(HWND aHWND)
HANDLE hProcess = ::OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, pid);
if (hProcess) {
PRUnichar path[256] = {L'\0'};
if (pGetProcessImageFileName(hProcess, path, ArrayLength(path))) {
if (GetProcessImageFileName(hProcess, path, ArrayLength(path))) {
int pathLength = lstrlenW(path);
if (pathLength >= filenameSuffixLength) {
if (lstrcmpiW(path + pathLength - filenameSuffixLength, filenameSuffix) == 0) {

View File

@ -758,23 +758,9 @@ PRUint8* nsWindowGfx::Data32BitTo1Bit(PRUint8* aImageData,
return outData;
}
bool nsWindowGfx::IsCursorTranslucencySupported()
{
static bool didCheck = false;
static bool isSupported = false;
if (!didCheck) {
didCheck = true;
// Cursor translucency is supported on Windows XP and newer
isSupported = WinUtils::GetWindowsVersion() >= WinUtils::WINXP_VERSION;
}
return isSupported;
}
/**
* Convert the given image data to a HBITMAP. If the requested depth is
* 32 bit and the OS supports translucency, a bitmap with an alpha channel
* will be returned.
* 32 bit, a bitmap with an alpha channel will be returned.
*
* @param aImageData The image data to convert. Must use the format accepted
* by CreateDIBitmap.
@ -793,7 +779,7 @@ HBITMAP nsWindowGfx::DataToBitmap(PRUint8* aImageData,
{
HDC dc = ::GetDC(NULL);
if (aDepth == 32 && IsCursorTranslucencySupported()) {
if (aDepth == 32) {
// Alpha channel. We need the new header.
BITMAPV4HEADER head = { 0 };
head.bV4Size = sizeof(head);

View File

@ -72,7 +72,6 @@ private:
* Cursor helpers
*/
static PRUint8* Data32BitTo1Bit(PRUint8* aImageData, PRUint32 aWidth, PRUint32 aHeight);
static bool IsCursorTranslucencySupported();
static HBITMAP DataToBitmap(PRUint8* aImageData, PRUint32 aWidth, PRUint32 aHeight, PRUint32 aDepth);
};

View File

@ -54,7 +54,6 @@ namespace widget {
enum OperatingSystem {
DRIVER_OS_UNKNOWN = 0,
DRIVER_OS_WINDOWS_2000,
DRIVER_OS_WINDOWS_XP,
DRIVER_OS_WINDOWS_SERVER_2003,
DRIVER_OS_WINDOWS_VISTA,

View File

@ -288,9 +288,7 @@ BlacklistNodeToTextValue(nsIDOMNode *aBlacklistNode, nsAString& aValue)
static OperatingSystem
BlacklistOSToOperatingSystem(const nsAString& os)
{
if (os == NS_LITERAL_STRING("WINNT 5.0"))
return DRIVER_OS_WINDOWS_2000;
else if (os == NS_LITERAL_STRING("WINNT 5.1"))
if (os == NS_LITERAL_STRING("WINNT 5.1"))
return DRIVER_OS_WINDOWS_XP;
else if (os == NS_LITERAL_STRING("WINNT 5.2"))
return DRIVER_OS_WINDOWS_SERVER_2003;

View File

@ -70,22 +70,6 @@ static void SanitizeEnvironmentVariables()
}
}
// Sets the directory from which DLLs can be loaded if the SetDllDirectory OS
// API is available.
// You must call SanitizeEnvironmentVariables before this function when calling
// it the first time.
static inline void NS_SetDllDirectory(const WCHAR *aDllDirectory)
{
typedef BOOL
(WINAPI *pfnSetDllDirectory) (LPCWSTR);
pfnSetDllDirectory setDllDirectory = nsnull;
setDllDirectory = reinterpret_cast<pfnSetDllDirectory>
(GetProcAddress(GetModuleHandleW(L"kernel32.dll"), "SetDllDirectoryW"));
if (setDllDirectory) {
setDllDirectory(aDllDirectory);
}
}
}
#endif

View File

@ -208,14 +208,12 @@ StackWalkInitCriticalAddress()
#include "mozilla/FunctionTimer.h"
#include "nspr.h"
#if defined(_M_IX86) || defined(_M_AMD64)
#include <imagehlp.h>
// We need a way to know if we are building for WXP (or later), as if we are, we
// need to use the newer 64-bit APIs. API_VERSION_NUMBER seems to fit the bill.
// A value of 9 indicates we want to use the new APIs.
#if API_VERSION_NUMBER >= 9
#define USING_WXP_VERSION 1
#endif
#if API_VERSION_NUMBER < 9
#error Too old imagehlp.h
#endif
// Define these as static pointers so that we can load the DLL on the
@ -226,116 +224,12 @@ StackWalkInitCriticalAddress()
//
PR_BEGIN_EXTERN_C
typedef DWORD (__stdcall *SYMSETOPTIONSPROC)(DWORD);
extern SYMSETOPTIONSPROC _SymSetOptions;
typedef BOOL (__stdcall *SYMINITIALIZEPROC)(HANDLE, LPSTR, BOOL);
extern SYMINITIALIZEPROC _SymInitialize;
typedef BOOL (__stdcall *SYMCLEANUPPROC)(HANDLE);
extern SYMCLEANUPPROC _SymCleanup;
typedef BOOL (__stdcall *STACKWALKPROC)(DWORD,
HANDLE,
HANDLE,
LPSTACKFRAME,
LPVOID,
PREAD_PROCESS_MEMORY_ROUTINE,
PFUNCTION_TABLE_ACCESS_ROUTINE,
PGET_MODULE_BASE_ROUTINE,
PTRANSLATE_ADDRESS_ROUTINE);
extern STACKWALKPROC _StackWalk;
#ifdef USING_WXP_VERSION
typedef BOOL (__stdcall *STACKWALKPROC64)(DWORD,
HANDLE,
HANDLE,
LPSTACKFRAME64,
PVOID,
PREAD_PROCESS_MEMORY_ROUTINE64,
PFUNCTION_TABLE_ACCESS_ROUTINE64,
PGET_MODULE_BASE_ROUTINE64,
PTRANSLATE_ADDRESS_ROUTINE64);
extern STACKWALKPROC64 _StackWalk64;
#endif
typedef LPVOID (__stdcall *SYMFUNCTIONTABLEACCESSPROC)(HANDLE, DWORD);
extern SYMFUNCTIONTABLEACCESSPROC _SymFunctionTableAccess;
#ifdef USING_WXP_VERSION
typedef LPVOID (__stdcall *SYMFUNCTIONTABLEACCESSPROC64)(HANDLE, DWORD64);
extern SYMFUNCTIONTABLEACCESSPROC64 _SymFunctionTableAccess64;
#endif
typedef DWORD (__stdcall *SYMGETMODULEBASEPROC)(HANDLE, DWORD);
extern SYMGETMODULEBASEPROC _SymGetModuleBase;
#ifdef USING_WXP_VERSION
typedef DWORD64 (__stdcall *SYMGETMODULEBASEPROC64)(HANDLE, DWORD64);
extern SYMGETMODULEBASEPROC64 _SymGetModuleBase64;
#endif
typedef BOOL (__stdcall *SYMGETSYMFROMADDRPROC)(HANDLE, DWORD, PDWORD, PIMAGEHLP_SYMBOL);
extern SYMGETSYMFROMADDRPROC _SymGetSymFromAddr;
#ifdef USING_WXP_VERSION
typedef BOOL (__stdcall *SYMFROMADDRPROC)(HANDLE, DWORD64, PDWORD64, PSYMBOL_INFO);
extern SYMFROMADDRPROC _SymFromAddr;
#endif
typedef DWORD ( __stdcall *SYMLOADMODULE)(HANDLE, HANDLE, PSTR, PSTR, DWORD, DWORD);
extern SYMLOADMODULE _SymLoadModule;
#ifdef USING_WXP_VERSION
typedef DWORD ( __stdcall *SYMLOADMODULE64)(HANDLE, HANDLE, PCSTR, PCSTR, DWORD64, DWORD);
extern SYMLOADMODULE64 _SymLoadModule64;
#endif
typedef DWORD ( __stdcall *SYMUNDNAME)(PIMAGEHLP_SYMBOL, PSTR, DWORD);
extern SYMUNDNAME _SymUnDName;
typedef DWORD ( __stdcall *SYMGETMODULEINFO)( HANDLE, DWORD, PIMAGEHLP_MODULE);
extern SYMGETMODULEINFO _SymGetModuleInfo;
#ifdef USING_WXP_VERSION
typedef BOOL ( __stdcall *SYMGETMODULEINFO64)( HANDLE, DWORD64, PIMAGEHLP_MODULE64);
extern SYMGETMODULEINFO64 _SymGetModuleInfo64;
#endif
typedef BOOL ( __stdcall *ENUMLOADEDMODULES)( HANDLE, PENUMLOADED_MODULES_CALLBACK, PVOID);
extern ENUMLOADEDMODULES _EnumerateLoadedModules;
#ifdef USING_WXP_VERSION
typedef BOOL ( __stdcall *ENUMLOADEDMODULES64)( HANDLE, PENUMLOADED_MODULES_CALLBACK64, PVOID);
extern ENUMLOADEDMODULES64 _EnumerateLoadedModules64;
#endif
typedef BOOL (__stdcall *SYMGETLINEFROMADDRPROC)(HANDLE, DWORD, PDWORD, PIMAGEHLP_LINE);
extern SYMGETLINEFROMADDRPROC _SymGetLineFromAddr;
#ifdef USING_WXP_VERSION
typedef BOOL (__stdcall *SYMGETLINEFROMADDRPROC64)(HANDLE, DWORD64, PDWORD, PIMAGEHLP_LINE64);
extern SYMGETLINEFROMADDRPROC64 _SymGetLineFromAddr64;
#endif
extern HANDLE hStackWalkMutex;
bool EnsureSymInitialized();
bool EnsureImageHlpInitialized();
/*
* SymGetModuleInfoEspecial
*
* Attempt to determine the module information.
* Bug 112196 says this DLL may not have been loaded at the time
* SymInitialize was called, and thus the module information
* and symbol information is not available.
* This code rectifies that problem.
* Line information is optional.
*/
BOOL SymGetModuleInfoEspecial(HANDLE aProcess, DWORD aAddr, PIMAGEHLP_MODULE aModuleInfo, PIMAGEHLP_LINE aLineInfo);
struct WalkStackData {
PRUint32 skipFrames;
HANDLE thread;
@ -351,82 +245,8 @@ struct WalkStackData {
void PrintError(char *prefix, WalkStackData* data);
unsigned int WINAPI WalkStackThread(void* data);
void WalkStackMain64(struct WalkStackData* data);
#if !defined(_WIN64)
void WalkStackMain(struct WalkStackData* data);
#endif
// Define these as static pointers so that we can load the DLL on the
// fly (and not introduce a link-time dependency on it). Tip o' the
// hat to Matt Pietrick for this idea. See:
//
// http://msdn.microsoft.com/library/periodic/period97/F1/D3/S245C6.htm
//
SYMSETOPTIONSPROC _SymSetOptions;
SYMINITIALIZEPROC _SymInitialize;
SYMCLEANUPPROC _SymCleanup;
STACKWALKPROC _StackWalk;
#ifdef USING_WXP_VERSION
STACKWALKPROC64 _StackWalk64;
#else
#define _StackWalk64 0
#endif
SYMFUNCTIONTABLEACCESSPROC _SymFunctionTableAccess;
#ifdef USING_WXP_VERSION
SYMFUNCTIONTABLEACCESSPROC64 _SymFunctionTableAccess64;
#else
#define _SymFunctionTableAccess64 0
#endif
SYMGETMODULEBASEPROC _SymGetModuleBase;
#ifdef USING_WXP_VERSION
SYMGETMODULEBASEPROC64 _SymGetModuleBase64;
#else
#define _SymGetModuleBase64 0
#endif
SYMGETSYMFROMADDRPROC _SymGetSymFromAddr;
#ifdef USING_WXP_VERSION
SYMFROMADDRPROC _SymFromAddr;
#else
#define _SymFromAddr 0
#endif
SYMLOADMODULE _SymLoadModule;
#ifdef USING_WXP_VERSION
SYMLOADMODULE64 _SymLoadModule64;
#else
#define _SymLoadModule64 0
#endif
SYMUNDNAME _SymUnDName;
SYMGETMODULEINFO _SymGetModuleInfo;
#ifdef USING_WXP_VERSION
SYMGETMODULEINFO64 _SymGetModuleInfo64;
#else
#define _SymGetModuleInfo64 0
#endif
ENUMLOADEDMODULES _EnumerateLoadedModules;
#ifdef USING_WXP_VERSION
ENUMLOADEDMODULES64 _EnumerateLoadedModules64;
#else
#define _EnumerateLoadedModules64 0
#endif
SYMGETLINEFROMADDRPROC _SymGetLineFromAddr;
#ifdef USING_WXP_VERSION
SYMGETLINEFROMADDRPROC64 _SymGetLineFromAddr64;
#else
#define _SymGetLineFromAddr64 0
#endif
DWORD gStackWalkThread;
CRITICAL_SECTION gDbgHelpCS;
@ -485,79 +305,12 @@ EnsureImageHlpInitialized()
::InitializeCriticalSection(&gDbgHelpCS);
HMODULE module = ::LoadLibraryW(L"DBGHELP.DLL");
if (!module) {
module = ::LoadLibraryW(L"IMAGEHLP.DLL");
if (!module) return false;
}
_SymSetOptions = (SYMSETOPTIONSPROC) ::GetProcAddress(module, "SymSetOptions");
if (!_SymSetOptions) return false;
_SymInitialize = (SYMINITIALIZEPROC) ::GetProcAddress(module, "SymInitialize");
if (!_SymInitialize) return false;
_SymCleanup = (SYMCLEANUPPROC)GetProcAddress(module, "SymCleanup");
if (!_SymCleanup) return false;
#ifdef USING_WXP_VERSION
_StackWalk64 = (STACKWALKPROC64)GetProcAddress(module, "StackWalk64");
#endif
_StackWalk = (STACKWALKPROC)GetProcAddress(module, "StackWalk");
if (!_StackWalk64 && !_StackWalk) return false;
#ifdef USING_WXP_VERSION
_SymFunctionTableAccess64 = (SYMFUNCTIONTABLEACCESSPROC64) GetProcAddress(module, "SymFunctionTableAccess64");
#endif
_SymFunctionTableAccess = (SYMFUNCTIONTABLEACCESSPROC) GetProcAddress(module, "SymFunctionTableAccess");
if (!_SymFunctionTableAccess64 && !_SymFunctionTableAccess) return false;
#ifdef USING_WXP_VERSION
_SymGetModuleBase64 = (SYMGETMODULEBASEPROC64)GetProcAddress(module, "SymGetModuleBase64");
#endif
_SymGetModuleBase = (SYMGETMODULEBASEPROC)GetProcAddress(module, "SymGetModuleBase");
if (!_SymGetModuleBase64 && !_SymGetModuleBase) return false;
_SymGetSymFromAddr = (SYMGETSYMFROMADDRPROC)GetProcAddress(module, "SymGetSymFromAddr");
#ifdef USING_WXP_VERSION
_SymFromAddr = (SYMFROMADDRPROC)GetProcAddress(module, "SymFromAddr");
#endif
if (!_SymFromAddr && !_SymGetSymFromAddr) return false;
#ifdef USING_WXP_VERSION
_SymLoadModule64 = (SYMLOADMODULE64)GetProcAddress(module, "SymLoadModule64");
#endif
_SymLoadModule = (SYMLOADMODULE)GetProcAddress(module, "SymLoadModule");
if (!_SymLoadModule64 && !_SymLoadModule) return false;
_SymUnDName = (SYMUNDNAME)GetProcAddress(module, "SymUnDName");
if (!_SymUnDName) return false;
#ifdef USING_WXP_VERSION
_SymGetModuleInfo64 = (SYMGETMODULEINFO64)GetProcAddress(module, "SymGetModuleInfo64");
#endif
_SymGetModuleInfo = (SYMGETMODULEINFO)GetProcAddress(module, "SymGetModuleInfo");
if (!_SymGetModuleInfo64 && !_SymGetModuleInfo) return false;
#ifdef USING_WXP_VERSION
_EnumerateLoadedModules64 = (ENUMLOADEDMODULES64)GetProcAddress(module, "EnumerateLoadedModules64");
#endif
_EnumerateLoadedModules = (ENUMLOADEDMODULES)GetProcAddress(module, "EnumerateLoadedModules");
if (!_EnumerateLoadedModules64 && !_EnumerateLoadedModules) return false;
#ifdef USING_WXP_VERSION
_SymGetLineFromAddr64 = (SYMGETLINEFROMADDRPROC64)GetProcAddress(module, "SymGetLineFromAddr64");
#endif
_SymGetLineFromAddr = (SYMGETLINEFROMADDRPROC)GetProcAddress(module, "SymGetLineFromAddr");
if (!_SymGetLineFromAddr64 && !_SymGetLineFromAddr) return false;
return gInitialized = true;
}
void
WalkStackMain64(struct WalkStackData* data)
{
#ifdef USING_WXP_VERSION
// Get the context information for the thread. That way we will
// know where our sp, fp, pc, etc. are and can fill in the
// STACKFRAME64 with the initial values.
@ -605,7 +358,7 @@ WalkStackMain64(struct WalkStackData* data)
// debug routines are not threadsafe, so grab the lock.
EnterCriticalSection(&gDbgHelpCS);
ok = _StackWalk64(
ok = StackWalk64(
#ifdef _M_AMD64
IMAGE_FILE_MACHINE_AMD64,
#elif defined _M_IA64
@ -620,8 +373,8 @@ WalkStackMain64(struct WalkStackData* data)
&frame64,
&context,
NULL,
_SymFunctionTableAccess64, // function table access routine
_SymGetModuleBase64, // module base routine
SymFunctionTableAccess64, // function table access routine
SymGetModuleBase64, // module base routine
0
);
LeaveCriticalSection(&gDbgHelpCS);
@ -649,106 +402,9 @@ WalkStackMain64(struct WalkStackData* data)
break;
}
return;
#endif
}
#if !defined(_WIN64)
void
WalkStackMain(struct WalkStackData* data)
{
// Get the context information for the thread. That way we will
// know where our sp, fp, pc, etc. are and can fill in the
// STACKFRAME with the initial values.
CONTEXT context;
HANDLE myProcess = data->process;
HANDLE myThread = data->thread;
DWORD addr;
STACKFRAME frame;
int skip = data->skipFrames; // skip our own stack walking frames
BOOL ok;
// Get a context for the specified thread.
memset(&context, 0, sizeof(CONTEXT));
context.ContextFlags = CONTEXT_FULL;
if (!GetThreadContext(myThread, &context)) {
PrintError("GetThreadContext");
return;
}
// Setup initial stack frame to walk from
#if defined _M_IX86
memset(&frame, 0, sizeof(frame));
frame.AddrPC.Offset = context.Eip;
frame.AddrPC.Mode = AddrModeFlat;
frame.AddrStack.Offset = context.Esp;
frame.AddrStack.Mode = AddrModeFlat;
frame.AddrFrame.Offset = context.Ebp;
frame.AddrFrame.Mode = AddrModeFlat;
#else
PrintError("Unknown platform. No stack walking.");
return;
#endif
// Now walk the stack
while (1) {
// debug routines are not threadsafe, so grab the lock.
EnterCriticalSection(&gDbgHelpCS);
ok = _StackWalk(
IMAGE_FILE_MACHINE_I386,
myProcess,
myThread,
&frame,
&context,
0, // read process memory routine
_SymFunctionTableAccess, // function table access routine
_SymGetModuleBase, // module base routine
0 // translate address routine
);
LeaveCriticalSection(&gDbgHelpCS);
if (ok)
addr = frame.AddrPC.Offset;
else {
addr = 0;
PrintError("WalkStack");
}
if (!ok || (addr == 0)) {
break;
}
if (skip-- > 0) {
continue;
}
if (data->pc_count < data->pc_size)
data->pcs[data->pc_count] = (void*)addr;
++data->pc_count;
if (frame.AddrReturn.Offset == 0)
break;
}
return;
}
#endif
static
void PerformStackWalk(struct WalkStackData* data)
{
#if defined(_WIN64)
WalkStackMain64(data);
#else
if (_StackWalk64)
WalkStackMain64(data);
else
WalkStackMain(data);
#endif
}
unsigned int WINAPI
WalkStackThread(void* aData)
{
@ -786,7 +442,7 @@ WalkStackThread(void* aData)
PrintError("ThreadSuspend");
}
else {
PerformStackWalk(data);
WalkStackMain64(data);
ret = ::ResumeThread(data->thread);
if (ret == -1) {
@ -860,7 +516,7 @@ NS_StackWalk(NS_WalkStackCallback aCallback, PRUint32 aSkipFrames,
if (aThread) {
// If we're walking the stack of another thread, we don't need to
// use a separate walker thread.
PerformStackWalk(&data);
WalkStackMain64(&data);
} else {
data.eventStart = ::CreateEvent(NULL, FALSE /* auto-reset*/,
FALSE /* initially non-signaled */, NULL);
@ -901,44 +557,12 @@ NS_StackWalk(NS_WalkStackCallback aCallback, PRUint32 aSkipFrames,
}
static BOOL CALLBACK callbackEspecial(
PCSTR aModuleName,
ULONG aModuleBase,
ULONG aModuleSize,
PVOID aUserContext)
{
BOOL retval = TRUE;
DWORD addr = *(DWORD*)aUserContext;
/*
* You'll want to control this if we are running on an
* architecture where the addresses go the other direction.
* Not sure this is even a realistic consideration.
*/
const BOOL addressIncreases = TRUE;
/*
* If it falls inside the known range, load the symbols.
*/
if (addressIncreases
? (addr >= aModuleBase && addr <= (aModuleBase + aModuleSize))
: (addr <= aModuleBase && addr >= (aModuleBase - aModuleSize))
) {
retval = _SymLoadModule(GetCurrentProcess(), NULL, (PSTR)aModuleName, NULL, aModuleBase, aModuleSize);
if (!retval)
PrintError("SymLoadModule");
}
return retval;
}
static BOOL CALLBACK callbackEspecial64(
PCSTR aModuleName,
DWORD64 aModuleBase,
ULONG aModuleSize,
PVOID aUserContext)
{
#ifdef USING_WXP_VERSION
BOOL retval = TRUE;
DWORD64 addr = *(DWORD64*)aUserContext;
@ -956,15 +580,12 @@ static BOOL CALLBACK callbackEspecial64(
? (addr >= aModuleBase && addr <= (aModuleBase + aModuleSize))
: (addr <= aModuleBase && addr >= (aModuleBase - aModuleSize))
) {
retval = _SymLoadModule64(GetCurrentProcess(), NULL, (PSTR)aModuleName, NULL, aModuleBase, aModuleSize);
retval = SymLoadModule64(GetCurrentProcess(), NULL, (PSTR)aModuleName, NULL, aModuleBase, aModuleSize);
if (!retval)
PrintError("SymLoadModule64");
}
return retval;
#else
return FALSE;
#endif
}
/*
@ -976,61 +597,6 @@ static BOOL CALLBACK callbackEspecial64(
* and symbol information is not available.
* This code rectifies that problem.
*/
BOOL SymGetModuleInfoEspecial(HANDLE aProcess, DWORD aAddr, PIMAGEHLP_MODULE aModuleInfo, PIMAGEHLP_LINE aLineInfo)
{
BOOL retval = FALSE;
/*
* Init the vars if we have em.
*/
aModuleInfo->SizeOfStruct = sizeof(IMAGEHLP_MODULE);
if (nsnull != aLineInfo) {
aLineInfo->SizeOfStruct = sizeof(IMAGEHLP_LINE);
}
/*
* Give it a go.
* It may already be loaded.
*/
retval = _SymGetModuleInfo(aProcess, aAddr, aModuleInfo);
if (FALSE == retval) {
BOOL enumRes = FALSE;
/*
* Not loaded, here's the magic.
* Go through all the modules.
*/
// Need to cast to PENUMLOADED_MODULES_CALLBACK because the
// constness of the first parameter of
// PENUMLOADED_MODULES_CALLBACK varies over SDK versions (from
// non-const to const over time). See bug 391848 and bug
// 415426.
enumRes = _EnumerateLoadedModules(aProcess, (PENUMLOADED_MODULES_CALLBACK)callbackEspecial, (PVOID)&aAddr);
if (FALSE != enumRes)
{
/*
* One final go.
* If it fails, then well, we have other problems.
*/
retval = _SymGetModuleInfo(aProcess, aAddr, aModuleInfo);
if (!retval)
PrintError("SymGetModuleInfo");
}
}
/*
* If we got module info, we may attempt line info as well.
* We will not report failure if this does not work.
*/
if (FALSE != retval && nsnull != aLineInfo && nsnull != _SymGetLineFromAddr) {
DWORD displacement = 0;
BOOL lineRes = FALSE;
lineRes = _SymGetLineFromAddr(aProcess, aAddr, &displacement, aLineInfo);
}
return retval;
}
// New members were added to IMAGEHLP_MODULE64 (that show up in the
// Platform SDK that ships with VC8, but not the Platform SDK that ships
@ -1047,7 +613,6 @@ BOOL SymGetModuleInfoEspecial(HANDLE aProcess, DWORD aAddr, PIMAGEHLP_MODULE aMo
#define NS_IMAGEHLP_MODULE64_SIZE sizeof(IMAGEHLP_MODULE64)
#endif
#ifdef USING_WXP_VERSION
BOOL SymGetModuleInfoEspecial64(HANDLE aProcess, DWORD64 aAddr, PIMAGEHLP_MODULE64 aModuleInfo, PIMAGEHLP_LINE64 aLineInfo)
{
BOOL retval = FALSE;
@ -1064,7 +629,7 @@ BOOL SymGetModuleInfoEspecial64(HANDLE aProcess, DWORD64 aAddr, PIMAGEHLP_MODULE
* Give it a go.
* It may already be loaded.
*/
retval = _SymGetModuleInfo64(aProcess, aAddr, aModuleInfo);
retval = SymGetModuleInfo64(aProcess, aAddr, aModuleInfo);
if (FALSE == retval) {
BOOL enumRes = FALSE;
@ -1078,14 +643,14 @@ BOOL SymGetModuleInfoEspecial64(HANDLE aProcess, DWORD64 aAddr, PIMAGEHLP_MODULE
// PENUMLOADED_MODULES_CALLBACK64 varies over SDK versions (from
// non-const to const over time). See bug 391848 and bug
// 415426.
enumRes = _EnumerateLoadedModules64(aProcess, (PENUMLOADED_MODULES_CALLBACK64)callbackEspecial64, (PVOID)&aAddr);
enumRes = EnumerateLoadedModules64(aProcess, (PENUMLOADED_MODULES_CALLBACK64)callbackEspecial64, (PVOID)&aAddr);
if (FALSE != enumRes)
{
/*
* One final go.
* If it fails, then well, we have other problems.
*/
retval = _SymGetModuleInfo64(aProcess, aAddr, aModuleInfo);
retval = SymGetModuleInfo64(aProcess, aAddr, aModuleInfo);
if (!retval)
PrintError("SymGetModuleInfo64");
}
@ -1095,10 +660,10 @@ BOOL SymGetModuleInfoEspecial64(HANDLE aProcess, DWORD64 aAddr, PIMAGEHLP_MODULE
* If we got module info, we may attempt line info as well.
* We will not report failure if this does not work.
*/
if (FALSE != retval && nsnull != aLineInfo && nsnull != _SymGetLineFromAddr64) {
if (FALSE != retval && nsnull != aLineInfo) {
DWORD displacement = 0;
BOOL lineRes = FALSE;
lineRes = _SymGetLineFromAddr64(aProcess, aAddr, &displacement, aLineInfo);
lineRes = SymGetLineFromAddr64(aProcess, aAddr, &displacement, aLineInfo);
if (!lineRes) {
// Clear out aLineInfo to indicate that it's not valid
memset(aLineInfo, 0, sizeof(*aLineInfo));
@ -1107,7 +672,6 @@ BOOL SymGetModuleInfoEspecial64(HANDLE aProcess, DWORD64 aAddr, PIMAGEHLP_MODULE
return retval;
}
#endif
bool
EnsureSymInitialized()
@ -1123,13 +687,13 @@ EnsureSymInitialized()
if (!EnsureImageHlpInitialized())
return false;
_SymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_UNDNAME);
retStat = _SymInitialize(GetCurrentProcess(), NULL, TRUE);
SymSetOptions(SYMOPT_LOAD_LINES | SYMOPT_UNDNAME);
retStat = SymInitialize(GetCurrentProcess(), NULL, TRUE);
if (!retStat)
PrintError("SymInitialize");
gInitialized = retStat;
/* XXX At some point we need to arrange to call _SymCleanup */
/* XXX At some point we need to arrange to call SymCleanup */
return retStat;
}
@ -1154,97 +718,42 @@ NS_DescribeCodeAddress(void *aPC, nsCodeAddressDetails *aDetails)
// debug routines are not threadsafe, so grab the lock.
EnterCriticalSection(&gDbgHelpCS);
#ifdef USING_WXP_VERSION
if (_StackWalk64) {
//
// Attempt to load module info before we attempt to resolve the symbol.
// This just makes sure we get good info if available.
//
//
// Attempt to load module info before we attempt to resolve the symbol.
// This just makes sure we get good info if available.
//
DWORD64 addr = (DWORD64)aPC;
IMAGEHLP_MODULE64 modInfo;
IMAGEHLP_LINE64 lineInfo;
BOOL modInfoRes;
modInfoRes = SymGetModuleInfoEspecial64(myProcess, addr, &modInfo, &lineInfo);
DWORD64 addr = (DWORD64)aPC;
IMAGEHLP_MODULE64 modInfo;
IMAGEHLP_LINE64 lineInfo;
BOOL modInfoRes;
modInfoRes = SymGetModuleInfoEspecial64(myProcess, addr, &modInfo, &lineInfo);
if (modInfoRes) {
PL_strncpyz(aDetails->library, modInfo.ModuleName,
sizeof(aDetails->library));
aDetails->loffset = (char*) aPC - (char*) modInfo.BaseOfImage;
if (lineInfo.FileName) {
PL_strncpyz(aDetails->filename, lineInfo.FileName,
sizeof(aDetails->filename));
aDetails->lineno = lineInfo.LineNumber;
}
}
ULONG64 buffer[(sizeof(SYMBOL_INFO) +
MAX_SYM_NAME*sizeof(TCHAR) + sizeof(ULONG64) - 1) / sizeof(ULONG64)];
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
pSymbol->MaxNameLen = MAX_SYM_NAME;
DWORD64 displacement;
ok = _SymFromAddr && _SymFromAddr(myProcess, addr, &displacement, pSymbol);
if (ok) {
PL_strncpyz(aDetails->function, pSymbol->Name,
sizeof(aDetails->function));
aDetails->foffset = displacement;
}
} else
#endif
{
//
// Attempt to load module info before we attempt to resolve the symbol.
// This just makes sure we get good info if available.
//
DWORD_PTR addr = (DWORD_PTR)aPC;
IMAGEHLP_MODULE modInfo;
IMAGEHLP_LINE lineInfo;
BOOL modInfoRes;
modInfoRes = SymGetModuleInfoEspecial(myProcess, addr, &modInfo, &lineInfo);
if (modInfoRes) {
PL_strncpyz(aDetails->library, modInfo.ModuleName,
sizeof(aDetails->library));
aDetails->loffset = (char*) aPC - (char*) modInfo.BaseOfImage;
if (modInfoRes) {
PL_strncpyz(aDetails->library, modInfo.ModuleName,
sizeof(aDetails->library));
aDetails->loffset = (char*) aPC - (char*) modInfo.BaseOfImage;
if (lineInfo.FileName) {
PL_strncpyz(aDetails->filename, lineInfo.FileName,
sizeof(aDetails->filename));
aDetails->lineno = lineInfo.LineNumber;
}
}
#ifdef USING_WXP_VERSION
ULONG64 buffer[(sizeof(SYMBOL_INFO) +
MAX_SYM_NAME*sizeof(TCHAR) + sizeof(ULONG64) - 1) / sizeof(ULONG64)];
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
pSymbol->MaxNameLen = MAX_SYM_NAME;
ULONG64 buffer[(sizeof(SYMBOL_INFO) +
MAX_SYM_NAME*sizeof(TCHAR) + sizeof(ULONG64) - 1) / sizeof(ULONG64)];
PSYMBOL_INFO pSymbol = (PSYMBOL_INFO)buffer;
pSymbol->SizeOfStruct = sizeof(SYMBOL_INFO);
pSymbol->MaxNameLen = MAX_SYM_NAME;
DWORD64 displacement;
DWORD64 displacement;
ok = SymFromAddr(myProcess, addr, &displacement, pSymbol);
ok = _SymFromAddr && _SymFromAddr(myProcess, addr, &displacement, pSymbol);
#else
char buf[sizeof(IMAGEHLP_SYMBOL) + 512];
PIMAGEHLP_SYMBOL pSymbol = (PIMAGEHLP_SYMBOL) buf;
pSymbol->SizeOfStruct = sizeof(buf);
pSymbol->MaxNameLength = 512;
DWORD displacement;
ok = _SymGetSymFromAddr(myProcess,
frame.AddrPC.Offset,
&displacement,
pSymbol);
#endif
if (ok) {
PL_strncpyz(aDetails->function, pSymbol->Name,
sizeof(aDetails->function));
aDetails->foffset = displacement;
}
if (ok) {
PL_strncpyz(aDetails->function, pSymbol->Name,
sizeof(aDetails->function));
aDetails->foffset = displacement;
}
LeaveCriticalSection(&gDbgHelpCS); // release our lock
@ -1255,23 +764,12 @@ EXPORT_XPCOM_API(nsresult)
NS_FormatCodeAddressDetails(void *aPC, const nsCodeAddressDetails *aDetails,
char *aBuffer, PRUint32 aBufferSize)
{
#ifdef USING_WXP_VERSION
if (_StackWalk64) {
if (aDetails->function[0])
_snprintf(aBuffer, aBufferSize, "%s!%s+0x%016lX",
aDetails->library, aDetails->function, aDetails->foffset);
else
_snprintf(aBuffer, aBufferSize, "0x%016lX", aPC);
} else {
#endif
if (aDetails->function[0])
_snprintf(aBuffer, aBufferSize, "%s!%s+0x%08lX",
aDetails->library, aDetails->function, aDetails->foffset);
else
_snprintf(aBuffer, aBufferSize, "0x%08lX", aPC);
#ifdef USING_WXP_VERSION
}
#endif
if (aDetails->function[0])
_snprintf(aBuffer, aBufferSize, "%s!%s+0x%016lX",
aDetails->library, aDetails->function, aDetails->foffset);
else
_snprintf(aBuffer, aBufferSize, "0x%016lX", aPC);
aBuffer[aBufferSize - 1] = '\0';
PRUint32 len = strlen(aBuffer);

View File

@ -673,7 +673,7 @@ GetSpecialSystemDirectory(SystemDirectories aSystemSystemDirectory,
GUID folderid_downloads = {0x374de290, 0x123f, 0x4565, {0x91, 0x64,
0x39, 0xc4, 0x92, 0x5e, 0x46, 0x7b}};
nsresult rv = GetKnownFolder(&folderid_downloads, aFile);
// On WinXP and 2k, there is no downloads folder, default
// On WinXP, there is no downloads folder, default
// to 'Desktop'.
if(NS_ERROR_FAILURE == rv)
{

View File

@ -110,9 +110,6 @@ unsigned char *_mbsstr( const unsigned char *str,
#define DRIVE_REMOTE 4
#endif
ILCreateFromPathWPtr nsLocalFile::sILCreateFromPathW = NULL;
SHOpenFolderAndSelectItemsPtr nsLocalFile::sSHOpenFolderAndSelectItems = NULL;
class nsDriveEnumerator : public nsISimpleEnumerator
{
public:
@ -2763,19 +2760,6 @@ nsLocalFile::SetPersistentDescriptor(const nsACString &aPersistentDescriptor)
}
/* attrib unsigned long fileAttributesWin; */
static bool IsXPOrGreater()
{
OSVERSIONINFO osvi;
ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&osvi);
return ((osvi.dwMajorVersion > 5) ||
((osvi.dwMajorVersion == 5) && (osvi.dwMinorVersion >= 1)));
}
NS_IMETHODIMP
nsLocalFile::GetFileAttributesWin(PRUint32 *aAttribs)
{
@ -2797,85 +2781,31 @@ nsLocalFile::SetFileAttributesWin(PRUint32 aAttribs)
if (dwAttrs == INVALID_FILE_ATTRIBUTES)
return NS_ERROR_FILE_INVALID_PATH;
if (IsXPOrGreater()) {
if (aAttribs & WFA_SEARCH_INDEXED) {
dwAttrs &= ~FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
} else {
dwAttrs |= FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
}
if (aAttribs & WFA_SEARCH_INDEXED) {
dwAttrs &= ~FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
} else {
dwAttrs |= FILE_ATTRIBUTE_NOT_CONTENT_INDEXED;
}
if (SetFileAttributesW(mWorkingPath.get(), dwAttrs) == 0)
return NS_ERROR_FAILURE;
return NS_OK;
}
}
NS_IMETHODIMP
nsLocalFile::Reveal()
{
// make sure mResolvedPath is set
nsresult rv = ResolveAndStat();
if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND)
return rv;
// First try revealing with the shell, and if that fails fall back
// to the classic way using explorer.exe command line parameters
rv = RevealUsingShell();
if (NS_FAILED(rv)) {
rv = RevealClassic();
}
return rv;
}
nsresult
nsLocalFile::RevealClassic()
{
// use the full path to explorer for security
nsCOMPtr<nsILocalFile> winDir;
nsresult rv = GetSpecialSystemDirectory(Win_WindowsDirectory, getter_AddRefs(winDir));
NS_ENSURE_SUCCESS(rv, rv);
nsAutoString explorerPath;
rv = winDir->GetPath(explorerPath);
NS_ENSURE_SUCCESS(rv, rv);
explorerPath.AppendLiteral("\\explorer.exe");
// Always open a new window for files because Win2K doesn't appear to select
// the file if a window showing that folder was already open. If the resolved
// path is a directory then instead of opening the parent and selecting it,
// we open the directory itself.
nsAutoString explorerParams;
if (mFileInfo64.type != PR_FILE_DIRECTORY) // valid because we ResolveAndStat above
explorerParams.AppendLiteral("/n,/select,");
explorerParams.Append(L'\"');
explorerParams.Append(mResolvedPath);
explorerParams.Append(L'\"');
if (::ShellExecuteW(NULL, L"open", explorerPath.get(), explorerParams.get(),
NULL, SW_SHOWNORMAL) <= (HINSTANCE) 32)
return NS_ERROR_FAILURE;
return NS_OK;
}
nsresult
nsLocalFile::RevealUsingShell()
{
// All of these shell32.dll related pointers should be non NULL
// on XP and later.
if (!sILCreateFromPathW || !sSHOpenFolderAndSelectItems) {
return NS_ERROR_FAILURE;
}
bool isDirectory;
// make sure mResolvedPath is set
bool isDirectory = false;
nsresult rv = IsDirectory(&isDirectory);
NS_ENSURE_SUCCESS(rv, rv);
if (NS_FAILED(rv) && rv != NS_ERROR_FILE_NOT_FOUND)
return rv;
HRESULT hr;
if (isDirectory) {
// We have a directory so we should open the directory itself.
ITEMIDLIST *dir = sILCreateFromPathW(mResolvedPath.get());
ITEMIDLIST *dir = ILCreateFromPathW(mResolvedPath.get());
if (!dir) {
return NS_ERROR_FAILURE;
}
@ -2884,7 +2814,7 @@ nsLocalFile::RevealUsingShell()
UINT count = ArrayLength(selection);
//Perform the open of the directory.
hr = sSHOpenFolderAndSelectItems(dir, count, selection, 0);
hr = SHOpenFolderAndSelectItems(dir, count, selection, 0);
CoTaskMemFree(dir);
}
else {
@ -2897,13 +2827,13 @@ nsLocalFile::RevealUsingShell()
NS_ENSURE_SUCCESS(rv, rv);
// We have a file so we should open the parent directory.
ITEMIDLIST *dir = sILCreateFromPathW(parentDirectoryPath.get());
ITEMIDLIST *dir = ILCreateFromPathW(parentDirectoryPath.get());
if (!dir) {
return NS_ERROR_FAILURE;
}
// Set the item in the directory to select to the file we want to reveal.
ITEMIDLIST *item = sILCreateFromPathW(mResolvedPath.get());
ITEMIDLIST *item = ILCreateFromPathW(mResolvedPath.get());
if (!item) {
CoTaskMemFree(dir);
return NS_ERROR_FAILURE;
@ -2913,7 +2843,7 @@ nsLocalFile::RevealUsingShell()
UINT count = ArrayLength(selection);
//Perform the selection of the file.
hr = sSHOpenFolderAndSelectItems(dir, count, selection, 0);
hr = SHOpenFolderAndSelectItems(dir, count, selection, 0);
CoTaskMemFree(dir);
CoTaskMemFree(item);
@ -3222,21 +3152,6 @@ nsLocalFile::GlobalInit()
{
nsresult rv = NS_CreateShortcutResolver();
NS_ASSERTION(NS_SUCCEEDED(rv), "Shortcut resolver could not be created");
// shell32.dll should be loaded already, so we are not actually
// loading the library here.
HMODULE hLibShell = GetModuleHandleW(L"shell32.dll");
if (hLibShell) {
// ILCreateFromPathW is available in XP and up.
sILCreateFromPathW = (ILCreateFromPathWPtr)
GetProcAddress(hLibShell,
"ILCreateFromPathW");
// SHOpenFolderAndSelectItems is available in XP and up.
sSHOpenFolderAndSelectItems = (SHOpenFolderAndSelectItemsPtr)
GetProcAddress(hLibShell,
"SHOpenFolderAndSelectItems");
}
}
void

View File

@ -56,11 +56,6 @@
#include <sys/stat.h>
typedef LPITEMIDLIST (WINAPI *ILCreateFromPathWPtr)(PCWSTR);
typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsPtr)(PCIDLIST_ABSOLUTE, UINT,
PCUITEMID_CHILD_ARRAY,
DWORD);
class nsLocalFile : public nsILocalFileWin,
public nsIHashable
{
@ -135,11 +130,6 @@ private:
nsresult HasFileAttribute(DWORD fileAttrib, bool *_retval);
nsresult AppendInternal(const nsAFlatString &node,
bool multipleComponents);
nsresult RevealClassic(); // Reveals the path using explorer.exe cmdline
nsresult RevealUsingShell(); // Uses newer shell API to reveal the path
static ILCreateFromPathWPtr sILCreateFromPathW;
static SHOpenFolderAndSelectItemsPtr sSHOpenFolderAndSelectItems;
};
#endif

View File

@ -103,7 +103,6 @@ private:
// protected with mLock.
PRInt32 mExitValue;
#if defined(PROCESSMODEL_WINAPI)
typedef DWORD (WINAPI*GetProcessIdPtr)(HANDLE process);
HANDLE mProcess;
#elif !defined(XP_MACOSX)
PRProcess *mProcess;

View File

@ -500,13 +500,7 @@ nsProcess::RunProcess(bool blocking, char **my_argv, nsIObserver* observer,
if (cmdLine)
PR_Free(cmdLine);
HMODULE kernelDLL = ::LoadLibraryW(L"kernel32.dll");
if (kernelDLL) {
GetProcessIdPtr getProcessId = (GetProcessIdPtr)GetProcAddress(kernelDLL, "GetProcessId");
if (getProcessId)
mPid = getProcessId(mProcess);
FreeLibrary(kernelDLL);
}
mPid = GetProcessId(mProcess);
#elif defined(XP_MACOSX)
// Initialize spawn attributes.
posix_spawnattr_t spawnattr;