Bug 1237463: LSP Annotator Enhancements; r=jimm

This commit is contained in:
Aaron Klotz 2016-01-25 12:48:02 -07:00
parent d675f44adf
commit 9e96529f18
2 changed files with 53 additions and 3 deletions

View File

@ -11,12 +11,19 @@
* on machines with several LSPs. * on machines with several LSPs.
*/ */
#if _WIN32_WINNT < 0x0600
// Redefining _WIN32_WINNT for some Vista APIs that we call
#undef _WIN32_WINNT
#define _WIN32_WINNT 0x0600
#endif
#include "nsICrashReporter.h" #include "nsICrashReporter.h"
#include "nsISupportsImpl.h" #include "nsISupportsImpl.h"
#include "nsServiceManagerUtils.h" #include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h" #include "nsThreadUtils.h"
#include "nsQueryObject.h" #include "nsQueryObject.h"
#include "nsWindowsHelpers.h"
#include <windows.h> #include <windows.h>
#include <rpc.h>
#include <ws2spi.h> #include <ws2spi.h>
namespace mozilla { namespace mozilla {
@ -83,16 +90,55 @@ LSPAnnotationGatherer::Run()
str.AppendLiteral(" : "); str.AppendLiteral(" : ");
str.AppendInt(providers[i].iVersion); str.AppendInt(providers[i].iVersion);
str.AppendLiteral(" : "); str.AppendLiteral(" : ");
str.AppendInt(providers[i].iAddressFamily);
str.AppendLiteral(" : ");
str.AppendInt(providers[i].iSocketType); str.AppendInt(providers[i].iSocketType);
str.AppendLiteral(" : "); str.AppendLiteral(" : ");
str.AppendInt(providers[i].iProtocol);
str.AppendLiteral(" : ");
str.AppendPrintf("0x%x", providers[i].dwServiceFlags1);
str.AppendLiteral(" : ");
str.AppendPrintf("0x%x", providers[i].dwProviderFlags);
str.AppendLiteral(" : ");
wchar_t path[MAX_PATH]; wchar_t path[MAX_PATH];
int dummy; int pathLen = MAX_PATH;
if (!WSCGetProviderPath(&providers[i].ProviderId, path, if (!WSCGetProviderPath(&providers[i].ProviderId, path, &pathLen, &err)) {
&dummy, &err)) {
AppendUTF16toUTF8(nsDependentString(path), str); AppendUTF16toUTF8(nsDependentString(path), str);
} }
str.AppendLiteral(" : ");
// If WSCGetProviderInfo is available, we should call it to obtain the
// category flags for this provider. When present, these flags inform
// Windows as to which order to chain the providers.
nsModuleHandle ws2_32(LoadLibraryW(L"ws2_32.dll"));
if (ws2_32) {
decltype(WSCGetProviderInfo)* pWSCGetProviderInfo =
reinterpret_cast<decltype(WSCGetProviderInfo)*>(
GetProcAddress(ws2_32, "WSCGetProviderInfo"));
if (pWSCGetProviderInfo) {
DWORD categoryInfo;
size_t categoryInfoSize = sizeof(categoryInfo);
if (!pWSCGetProviderInfo(&providers[i].ProviderId,
ProviderInfoLspCategories,
(PBYTE)&categoryInfo, &categoryInfoSize, 0,
&err)) {
str.AppendPrintf("0x%x", categoryInfo);
}
}
}
str.AppendLiteral(" : ");
if (providers[i].ProtocolChain.ChainLen <= BASE_PROTOCOL) {
// If we're dealing with a catalog entry that identifies an individual
// base or layer provider, log its provider GUID.
RPC_CSTR provIdStr = nullptr;
if (UuidToStringA(&providers[i].ProviderId, &provIdStr) == RPC_S_OK) {
str.Append(reinterpret_cast<char*>(provIdStr));
RpcStringFreeA(&provIdStr);
}
}
if (i + 1 != n) { if (i + 1 != n) {
str.AppendLiteral(" \n "); str.AppendLiteral(" \n ");
} }

View File

@ -105,3 +105,7 @@ for var in ('MOZ_ENABLE_D3D10_LAYER'):
RESFILE = 'widget.res' RESFILE = 'widget.res'
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
OS_LIBS += [
'rpcrt4',
]