mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 784739 - Switch from NULL to nullptr in browser/; r=ehsan
This commit is contained in:
parent
2cf187a437
commit
ae280e880b
@ -77,7 +77,7 @@ static void Output(const char *fmt, ... )
|
|||||||
#if MOZ_WINCONSOLE
|
#if MOZ_WINCONSOLE
|
||||||
fwprintf_s(stderr, wide_msg);
|
fwprintf_s(stderr, wide_msg);
|
||||||
#else
|
#else
|
||||||
MessageBoxW(NULL, wide_msg, L"Firefox", MB_OK
|
MessageBoxW(nullptr, wide_msg, L"Firefox", MB_OK
|
||||||
| MB_ICONERROR
|
| MB_ICONERROR
|
||||||
| MB_SETFOREGROUND);
|
| MB_SETFOREGROUND);
|
||||||
#endif
|
#endif
|
||||||
@ -325,16 +325,16 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
|
|||||||
// Check for a metro test harness command line args file
|
// Check for a metro test harness command line args file
|
||||||
HANDLE hTestFile = CreateFileA(path.get(),
|
HANDLE hTestFile = CreateFileA(path.get(),
|
||||||
GENERIC_READ,
|
GENERIC_READ,
|
||||||
0, NULL, OPEN_EXISTING,
|
0, nullptr, OPEN_EXISTING,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
NULL);
|
nullptr);
|
||||||
if (hTestFile != INVALID_HANDLE_VALUE) {
|
if (hTestFile != INVALID_HANDLE_VALUE) {
|
||||||
// Typical test harness command line args string is around 100 bytes.
|
// Typical test harness command line args string is around 100 bytes.
|
||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
DWORD bytesRead = 0;
|
DWORD bytesRead = 0;
|
||||||
if (!ReadFile(hTestFile, (VOID*)buffer, sizeof(buffer)-1,
|
if (!ReadFile(hTestFile, (VOID*)buffer, sizeof(buffer)-1,
|
||||||
&bytesRead, NULL) || !bytesRead) {
|
&bytesRead, nullptr) || !bytesRead) {
|
||||||
CloseHandle(hTestFile);
|
CloseHandle(hTestFile);
|
||||||
printf("failed to read test file '%s'", testFile);
|
printf("failed to read test file '%s'", testFile);
|
||||||
return -1;
|
return -1;
|
||||||
@ -349,7 +349,7 @@ static int do_main(int argc, char* argv[], nsIFile *xreDirectory)
|
|||||||
|
|
||||||
char* ptr = buffer;
|
char* ptr = buffer;
|
||||||
newArgv[0] = ptr;
|
newArgv[0] = ptr;
|
||||||
while (*ptr != NULL &&
|
while (*ptr != nullptr &&
|
||||||
(ptr - buffer) < sizeof(buffer) &&
|
(ptr - buffer) < sizeof(buffer) &&
|
||||||
newArgc < ARRAYSIZE(newArgv)) {
|
newArgc < ARRAYSIZE(newArgv)) {
|
||||||
if (isspace(*ptr)) {
|
if (isspace(*ptr)) {
|
||||||
@ -461,13 +461,13 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
|
|||||||
}
|
}
|
||||||
if (absfwurl) {
|
if (absfwurl) {
|
||||||
CFURLRef xulurl =
|
CFURLRef xulurl =
|
||||||
CFURLCreateCopyAppendingPathComponent(NULL, absfwurl,
|
CFURLCreateCopyAppendingPathComponent(nullptr, absfwurl,
|
||||||
CFSTR("XUL.framework"),
|
CFSTR("XUL.framework"),
|
||||||
true);
|
true);
|
||||||
|
|
||||||
if (xulurl) {
|
if (xulurl) {
|
||||||
CFURLRef xpcomurl =
|
CFURLRef xpcomurl =
|
||||||
CFURLCreateCopyAppendingPathComponent(NULL, xulurl,
|
CFURLCreateCopyAppendingPathComponent(nullptr, xulurl,
|
||||||
CFSTR("libxpcom.dylib"),
|
CFSTR("libxpcom.dylib"),
|
||||||
false);
|
false);
|
||||||
|
|
||||||
|
@ -61,20 +61,20 @@ NS_DEFINE_NAMED_CID(NS_SHELLSERVICE_CID);
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
|
static const mozilla::Module::CIDEntry kBrowserCIDs[] = {
|
||||||
{ &kNS_BROWSERDIRECTORYPROVIDER_CID, false, NULL, DirectoryProviderConstructor },
|
{ &kNS_BROWSERDIRECTORYPROVIDER_CID, false, nullptr, DirectoryProviderConstructor },
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
{ &kNS_SHELLSERVICE_CID, false, NULL, nsWindowsShellServiceConstructor },
|
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsWindowsShellServiceConstructor },
|
||||||
#elif defined(MOZ_WIDGET_GTK2)
|
#elif defined(MOZ_WIDGET_GTK2)
|
||||||
{ &kNS_SHELLSERVICE_CID, false, NULL, nsGNOMEShellServiceConstructor },
|
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsGNOMEShellServiceConstructor },
|
||||||
#endif
|
#endif
|
||||||
{ &kNS_FEEDSNIFFER_CID, false, NULL, nsFeedSnifferConstructor },
|
{ &kNS_FEEDSNIFFER_CID, false, nullptr, nsFeedSnifferConstructor },
|
||||||
{ &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, NULL, AboutRedirector::Create },
|
{ &kNS_BROWSER_ABOUT_REDIRECTOR_CID, false, nullptr, AboutRedirector::Create },
|
||||||
#if defined(XP_WIN)
|
#if defined(XP_WIN)
|
||||||
{ &kNS_WINIEHISTORYENUMERATOR_CID, false, NULL, nsIEHistoryEnumeratorConstructor },
|
{ &kNS_WINIEHISTORYENUMERATOR_CID, false, nullptr, nsIEHistoryEnumeratorConstructor },
|
||||||
#elif defined(XP_MACOSX)
|
#elif defined(XP_MACOSX)
|
||||||
{ &kNS_SHELLSERVICE_CID, false, NULL, nsMacShellServiceConstructor },
|
{ &kNS_SHELLSERVICE_CID, false, nullptr, nsMacShellServiceConstructor },
|
||||||
#endif
|
#endif
|
||||||
{ NULL }
|
{ nullptr }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
|
static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
|
||||||
@ -112,13 +112,13 @@ static const mozilla::Module::ContractIDEntry kBrowserContracts[] = {
|
|||||||
#elif defined(XP_MACOSX)
|
#elif defined(XP_MACOSX)
|
||||||
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
|
{ NS_SHELLSERVICE_CONTRACTID, &kNS_SHELLSERVICE_CID },
|
||||||
#endif
|
#endif
|
||||||
{ NULL }
|
{ nullptr }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
|
static const mozilla::Module::CategoryEntry kBrowserCategories[] = {
|
||||||
{ XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider", NS_BROWSERDIRECTORYPROVIDER_CONTRACTID },
|
{ XPCOM_DIRECTORY_PROVIDER_CATEGORY, "browser-directory-provider", NS_BROWSERDIRECTORYPROVIDER_CONTRACTID },
|
||||||
{ NS_CONTENT_SNIFFER_CATEGORY, "Feed Sniffer", NS_FEEDSNIFFER_CONTRACTID },
|
{ NS_CONTENT_SNIFFER_CATEGORY, "Feed Sniffer", NS_FEEDSNIFFER_CONTRACTID },
|
||||||
{ NULL }
|
{ nullptr }
|
||||||
};
|
};
|
||||||
|
|
||||||
static const mozilla::Module kBrowserModule = {
|
static const mozilla::Module kBrowserModule = {
|
||||||
|
@ -45,7 +45,7 @@ NS_IMPL_ISUPPORTS1(nsIEHistoryEnumerator, nsISimpleEnumerator)
|
|||||||
|
|
||||||
nsIEHistoryEnumerator::nsIEHistoryEnumerator()
|
nsIEHistoryEnumerator::nsIEHistoryEnumerator()
|
||||||
{
|
{
|
||||||
::CoInitialize(NULL);
|
::CoInitialize(nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsIEHistoryEnumerator::~nsIEHistoryEnumerator()
|
nsIEHistoryEnumerator::~nsIEHistoryEnumerator()
|
||||||
@ -60,7 +60,7 @@ nsIEHistoryEnumerator::EnsureInitialized()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
HRESULT hr = ::CoCreateInstance(CLSID_CUrlHistory,
|
HRESULT hr = ::CoCreateInstance(CLSID_CUrlHistory,
|
||||||
NULL,
|
nullptr,
|
||||||
CLSCTX_INPROC_SERVER,
|
CLSCTX_INPROC_SERVER,
|
||||||
IID_IUrlHistoryStg2,
|
IID_IUrlHistoryStg2,
|
||||||
getter_AddRefs(mIEHistory));
|
getter_AddRefs(mIEHistory));
|
||||||
|
@ -152,7 +152,7 @@ nsGNOMEShellService::KeyMatchesAppName(const char *aKeyValue) const
|
|||||||
|
|
||||||
gchar *commandPath;
|
gchar *commandPath;
|
||||||
if (mUseLocaleFilenames) {
|
if (mUseLocaleFilenames) {
|
||||||
gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, NULL, NULL, NULL);
|
gchar *nativePath = g_filename_from_utf8(aKeyValue, -1, nullptr, nullptr, nullptr);
|
||||||
if (!nativePath) {
|
if (!nativePath) {
|
||||||
NS_ERROR("Error converting path to filesystem encoding");
|
NS_ERROR("Error converting path to filesystem encoding");
|
||||||
return false;
|
return false;
|
||||||
@ -182,7 +182,7 @@ nsGNOMEShellService::CheckHandlerMatchesAppName(const nsACString &handler) const
|
|||||||
// The string will be something of the form: [/path/to/]browser "%s"
|
// The string will be something of the form: [/path/to/]browser "%s"
|
||||||
// We want to remove all of the parameters and get just the binary name.
|
// We want to remove all of the parameters and get just the binary name.
|
||||||
|
|
||||||
if (g_shell_parse_argv(command.get(), &argc, &argv, NULL) && argc > 0) {
|
if (g_shell_parse_argv(command.get(), &argc, &argv, nullptr) && argc > 0) {
|
||||||
command.Assign(argv[0]);
|
command.Assign(argv[0]);
|
||||||
g_strfreev(argv);
|
g_strfreev(argv);
|
||||||
}
|
}
|
||||||
@ -380,7 +380,7 @@ WriteImage(const nsCString& aPath, imgIContainer* aImage)
|
|||||||
if (!pixbuf)
|
if (!pixbuf)
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
gboolean res = gdk_pixbuf_save(pixbuf, aPath.get(), "png", NULL, NULL);
|
gboolean res = gdk_pixbuf_save(pixbuf, aPath.get(), "png", nullptr, nullptr);
|
||||||
|
|
||||||
g_object_unref(pixbuf);
|
g_object_unref(pixbuf);
|
||||||
return res ? NS_OK : NS_ERROR_FAILURE;
|
return res ? NS_OK : NS_ERROR_FAILURE;
|
||||||
@ -454,7 +454,7 @@ nsGNOMEShellService::SetDesktopBackground(nsIDOMElement* aElement,
|
|||||||
gsettings->GetCollectionForSchema(
|
gsettings->GetCollectionForSchema(
|
||||||
NS_LITERAL_CSTRING(kDesktopBGSchema), getter_AddRefs(background_settings));
|
NS_LITERAL_CSTRING(kDesktopBGSchema), getter_AddRefs(background_settings));
|
||||||
if (background_settings) {
|
if (background_settings) {
|
||||||
gchar *file_uri = g_filename_to_uri(filePath.get(), NULL, NULL);
|
gchar *file_uri = g_filename_to_uri(filePath.get(), nullptr, nullptr);
|
||||||
if (!file_uri)
|
if (!file_uri)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
@ -615,7 +615,7 @@ nsGNOMEShellService::OpenApplication(int32_t aApplication)
|
|||||||
// Perform shell argument expansion
|
// Perform shell argument expansion
|
||||||
int argc;
|
int argc;
|
||||||
char **argv;
|
char **argv;
|
||||||
if (!g_shell_parse_argv(appCommand.get(), &argc, &argv, NULL))
|
if (!g_shell_parse_argv(appCommand.get(), &argc, &argv, nullptr))
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
char **newArgv = new char*[argc + 1];
|
char **newArgv = new char*[argc + 1];
|
||||||
@ -630,8 +630,8 @@ nsGNOMEShellService::OpenApplication(int32_t aApplication)
|
|||||||
|
|
||||||
newArgv[newArgc] = nullptr;
|
newArgv[newArgc] = nullptr;
|
||||||
|
|
||||||
gboolean err = g_spawn_async(NULL, newArgv, NULL, G_SPAWN_SEARCH_PATH,
|
gboolean err = g_spawn_async(nullptr, newArgv, nullptr, G_SPAWN_SEARCH_PATH,
|
||||||
NULL, NULL, NULL, NULL);
|
nullptr, nullptr, nullptr, nullptr);
|
||||||
|
|
||||||
g_strfreev(argv);
|
g_strfreev(argv);
|
||||||
delete[] newArgv;
|
delete[] newArgv;
|
||||||
|
@ -40,13 +40,13 @@ nsMacShellService::IsDefaultBrowser(bool aStartupCheck,
|
|||||||
|
|
||||||
CFStringRef firefoxID = ::CFBundleGetIdentifier(::CFBundleGetMainBundle());
|
CFStringRef firefoxID = ::CFBundleGetIdentifier(::CFBundleGetMainBundle());
|
||||||
if (!firefoxID) {
|
if (!firefoxID) {
|
||||||
// CFBundleGetIdentifier is expected to return NULL only if the specified
|
// CFBundleGetIdentifier is expected to return nullptr only if the specified
|
||||||
// bundle doesn't have a bundle identifier in its plist. In this case, that
|
// bundle doesn't have a bundle identifier in its plist. In this case, that
|
||||||
// means a failure, since our bundle does have an identifier.
|
// means a failure, since our bundle does have an identifier.
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the default http handler's bundle ID (or NULL if it has not been explicitly set)
|
// Get the default http handler's bundle ID (or nullptr if it has not been explicitly set)
|
||||||
CFStringRef defaultBrowserID = ::LSCopyDefaultHandlerForURLScheme(CFSTR("http"));
|
CFStringRef defaultBrowserID = ::LSCopyDefaultHandlerForURLScheme(CFSTR("http"));
|
||||||
if (defaultBrowserID) {
|
if (defaultBrowserID) {
|
||||||
*aIsDefaultBrowser = ::CFStringCompare(firefoxID, defaultBrowserID, 0) == kCFCompareEqualTo;
|
*aIsDefaultBrowser = ::CFStringCompare(firefoxID, defaultBrowserID, 0) == kCFCompareEqualTo;
|
||||||
@ -259,7 +259,7 @@ nsMacShellService::OnStateChange(nsIWebProgress* aWebProgress,
|
|||||||
OSStatus status;
|
OSStatus status;
|
||||||
|
|
||||||
// Convert the path into a FSRef
|
// Convert the path into a FSRef
|
||||||
status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef, NULL);
|
status = ::FSPathMakeRef((const UInt8*)nativePath.get(), &pictureRef, nullptr);
|
||||||
if (status == noErr) {
|
if (status == noErr) {
|
||||||
err = ::FSNewAlias(nil, &pictureRef, &aliasHandle);
|
err = ::FSNewAlias(nil, &pictureRef, &aliasHandle);
|
||||||
if (err == noErr && aliasHandle == nil)
|
if (err == noErr && aliasHandle == nil)
|
||||||
@ -312,21 +312,21 @@ nsMacShellService::OpenApplication(int32_t aApplication)
|
|||||||
case nsIShellService::APPLICATION_MAIL:
|
case nsIShellService::APPLICATION_MAIL:
|
||||||
{
|
{
|
||||||
CFURLRef tempURL = ::CFURLCreateWithString(kCFAllocatorDefault,
|
CFURLRef tempURL = ::CFURLCreateWithString(kCFAllocatorDefault,
|
||||||
CFSTR("mailto:"), NULL);
|
CFSTR("mailto:"), nullptr);
|
||||||
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, NULL, &appURL);
|
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, nullptr, &appURL);
|
||||||
::CFRelease(tempURL);
|
::CFRelease(tempURL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nsIShellService::APPLICATION_NEWS:
|
case nsIShellService::APPLICATION_NEWS:
|
||||||
{
|
{
|
||||||
CFURLRef tempURL = ::CFURLCreateWithString(kCFAllocatorDefault,
|
CFURLRef tempURL = ::CFURLCreateWithString(kCFAllocatorDefault,
|
||||||
CFSTR("news:"), NULL);
|
CFSTR("news:"), nullptr);
|
||||||
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, NULL, &appURL);
|
err = ::LSGetApplicationForURL(tempURL, kLSRolesAll, nullptr, &appURL);
|
||||||
::CFRelease(tempURL);
|
::CFRelease(tempURL);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case nsIMacShellService::APPLICATION_KEYCHAIN_ACCESS:
|
case nsIMacShellService::APPLICATION_KEYCHAIN_ACCESS:
|
||||||
err = ::LSGetApplicationForInfo('APPL', 'kcmr', NULL, kLSRolesAll, NULL,
|
err = ::LSGetApplicationForInfo('APPL', 'kcmr', nullptr, kLSRolesAll, nullptr,
|
||||||
&appURL);
|
&appURL);
|
||||||
break;
|
break;
|
||||||
case nsIMacShellService::APPLICATION_NETWORK:
|
case nsIMacShellService::APPLICATION_NETWORK:
|
||||||
@ -356,7 +356,7 @@ nsMacShellService::OpenApplication(int32_t aApplication)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (appURL && err == noErr) {
|
if (appURL && err == noErr) {
|
||||||
err = ::LSOpenCFURLRef(appURL, NULL);
|
err = ::LSOpenCFURLRef(appURL, nullptr);
|
||||||
rv = err != noErr ? NS_ERROR_FAILURE : NS_OK;
|
rv = err != noErr ? NS_ERROR_FAILURE : NS_OK;
|
||||||
|
|
||||||
::CFRelease(appURL);
|
::CFRelease(appURL);
|
||||||
@ -394,12 +394,12 @@ nsMacShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACStrin
|
|||||||
|
|
||||||
const nsCString spec(aURI);
|
const nsCString spec(aURI);
|
||||||
const UInt8* uriString = (const UInt8*)spec.get();
|
const UInt8* uriString = (const UInt8*)spec.get();
|
||||||
CFURLRef uri = ::CFURLCreateWithBytes(NULL, uriString, aURI.Length(),
|
CFURLRef uri = ::CFURLCreateWithBytes(nullptr, uriString, aURI.Length(),
|
||||||
kCFStringEncodingUTF8, NULL);
|
kCFStringEncodingUTF8, nullptr);
|
||||||
if (!uri)
|
if (!uri)
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
|
|
||||||
CFArrayRef uris = ::CFArrayCreate(NULL, (const void**)&uri, 1, NULL);
|
CFArrayRef uris = ::CFArrayCreate(nullptr, (const void**)&uri, 1, nullptr);
|
||||||
if (!uris) {
|
if (!uris) {
|
||||||
::CFRelease(uri);
|
::CFRelease(uri);
|
||||||
return NS_ERROR_OUT_OF_MEMORY;
|
return NS_ERROR_OUT_OF_MEMORY;
|
||||||
@ -408,11 +408,11 @@ nsMacShellService::OpenApplicationWithURI(nsIFile* aApplication, const nsACStrin
|
|||||||
LSLaunchURLSpec launchSpec;
|
LSLaunchURLSpec launchSpec;
|
||||||
launchSpec.appURL = appURL;
|
launchSpec.appURL = appURL;
|
||||||
launchSpec.itemURLs = uris;
|
launchSpec.itemURLs = uris;
|
||||||
launchSpec.passThruParams = NULL;
|
launchSpec.passThruParams = nullptr;
|
||||||
launchSpec.launchFlags = kLSLaunchDefaults;
|
launchSpec.launchFlags = kLSLaunchDefaults;
|
||||||
launchSpec.asyncRefCon = NULL;
|
launchSpec.asyncRefCon = nullptr;
|
||||||
|
|
||||||
OSErr err = ::LSOpenFromURLSpec(&launchSpec, NULL);
|
OSErr err = ::LSOpenFromURLSpec(&launchSpec, nullptr);
|
||||||
|
|
||||||
::CFRelease(uris);
|
::CFRelease(uris);
|
||||||
::CFRelease(uri);
|
::CFRelease(uri);
|
||||||
@ -433,11 +433,11 @@ nsMacShellService::GetDefaultFeedReader(nsIFile** _retval)
|
|||||||
kCFStringEncodingASCII);
|
kCFStringEncodingASCII);
|
||||||
}
|
}
|
||||||
|
|
||||||
CFURLRef defaultHandlerURL = NULL;
|
CFURLRef defaultHandlerURL = nullptr;
|
||||||
OSStatus status = ::LSFindApplicationForInfo(kLSUnknownCreator,
|
OSStatus status = ::LSFindApplicationForInfo(kLSUnknownCreator,
|
||||||
defaultHandlerID,
|
defaultHandlerID,
|
||||||
NULL, // inName
|
nullptr, // inName
|
||||||
NULL, // outAppRef
|
nullptr, // outAppRef
|
||||||
&defaultHandlerURL);
|
&defaultHandlerURL);
|
||||||
|
|
||||||
if (status == noErr && defaultHandlerURL) {
|
if (status == noErr && defaultHandlerURL) {
|
||||||
|
@ -223,8 +223,8 @@ LaunchHelper(nsAutoString& aPath)
|
|||||||
STARTUPINFOW si = {sizeof(si), 0};
|
STARTUPINFOW si = {sizeof(si), 0};
|
||||||
PROCESS_INFORMATION pi = {0};
|
PROCESS_INFORMATION pi = {0};
|
||||||
|
|
||||||
if (!CreateProcessW(NULL, (LPWSTR)aPath.get(), NULL, NULL, FALSE, 0, NULL,
|
if (!CreateProcessW(nullptr, (LPWSTR)aPath.get(), nullptr, nullptr, FALSE, 0, nullptr,
|
||||||
NULL, &si, &pi)) {
|
nullptr, &si, &pi)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -361,7 +361,7 @@ nsWindowsShellService::IsDefaultBrowserVista(bool aCheckAllTypes,
|
|||||||
{
|
{
|
||||||
IApplicationAssociationRegistration* pAAR;
|
IApplicationAssociationRegistration* pAAR;
|
||||||
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
|
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
|
||||||
NULL,
|
nullptr,
|
||||||
CLSCTX_INPROC,
|
CLSCTX_INPROC,
|
||||||
IID_IApplicationAssociationRegistration,
|
IID_IApplicationAssociationRegistration,
|
||||||
(void**)&pAAR);
|
(void**)&pAAR);
|
||||||
@ -447,7 +447,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
|||||||
|
|
||||||
::ZeroMemory(currValue, sizeof(currValue));
|
::ZeroMemory(currValue, sizeof(currValue));
|
||||||
DWORD len = sizeof currValue;
|
DWORD len = sizeof currValue;
|
||||||
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue, &len);
|
res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr, (LPBYTE)currValue, &len);
|
||||||
// Close the key that was opened.
|
// Close the key that was opened.
|
||||||
::RegCloseKey(theKey);
|
::RegCloseKey(theKey);
|
||||||
if (REG_FAILED(res) ||
|
if (REG_FAILED(res) ||
|
||||||
@ -516,7 +516,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
|||||||
|
|
||||||
::ZeroMemory(currValue, sizeof(currValue));
|
::ZeroMemory(currValue, sizeof(currValue));
|
||||||
DWORD len = sizeof currValue;
|
DWORD len = sizeof currValue;
|
||||||
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue,
|
res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr, (LPBYTE)currValue,
|
||||||
&len);
|
&len);
|
||||||
// Close the key that was opened.
|
// Close the key that was opened.
|
||||||
::RegCloseKey(theKey);
|
::RegCloseKey(theKey);
|
||||||
@ -525,9 +525,9 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
|||||||
// Delete the key along with all of its childrean and then recreate it.
|
// Delete the key along with all of its childrean and then recreate it.
|
||||||
const nsString &flatName = PromiseFlatString(keyName);
|
const nsString &flatName = PromiseFlatString(keyName);
|
||||||
::SHDeleteKeyW(HKEY_CURRENT_USER, flatName.get());
|
::SHDeleteKeyW(HKEY_CURRENT_USER, flatName.get());
|
||||||
res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, NULL,
|
res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, nullptr,
|
||||||
REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, NULL,
|
REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, nullptr,
|
||||||
&theKey, NULL);
|
&theKey, nullptr);
|
||||||
if (REG_FAILED(res)) {
|
if (REG_FAILED(res)) {
|
||||||
// If disabling DDE fails try to disable it using the helper
|
// If disabling DDE fails try to disable it using the helper
|
||||||
// application when setting Firefox as the default browser.
|
// application when setting Firefox as the default browser.
|
||||||
@ -564,7 +564,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck,
|
|||||||
|
|
||||||
::ZeroMemory(currValue, sizeof(currValue));
|
::ZeroMemory(currValue, sizeof(currValue));
|
||||||
DWORD len = sizeof currValue;
|
DWORD len = sizeof currValue;
|
||||||
res = ::RegQueryValueExW(theKey, L"", NULL, NULL, (LPBYTE)currValue,
|
res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr, (LPBYTE)currValue,
|
||||||
&len);
|
&len);
|
||||||
|
|
||||||
// Don't update the FTP protocol handler's shell open command when the
|
// Don't update the FTP protocol handler's shell open command when the
|
||||||
@ -606,7 +606,7 @@ DynSHOpenWithDialog(HWND hwndParent, const OPENASINFO *poainfo)
|
|||||||
{
|
{
|
||||||
typedef HRESULT (WINAPI * SHOpenWithDialogPtr)(HWND hwndParent,
|
typedef HRESULT (WINAPI * SHOpenWithDialogPtr)(HWND hwndParent,
|
||||||
const OPENASINFO *poainfo);
|
const OPENASINFO *poainfo);
|
||||||
static SHOpenWithDialogPtr SHOpenWithDialogFn = NULL;
|
static SHOpenWithDialogPtr SHOpenWithDialogFn = nullptr;
|
||||||
if (!SHOpenWithDialogFn) {
|
if (!SHOpenWithDialogFn) {
|
||||||
// shell32.dll is in the knownDLLs list so will always be loaded from the
|
// shell32.dll is in the knownDLLs list so will always be loaded from the
|
||||||
// system32 directory.
|
// system32 directory.
|
||||||
@ -650,8 +650,8 @@ nsWindowsShellService::LaunchControlPanelDefaultPrograms()
|
|||||||
si.dwFlags = STARTF_USESHOWWINDOW;
|
si.dwFlags = STARTF_USESHOWWINDOW;
|
||||||
si.wShowWindow = SW_SHOWDEFAULT;
|
si.wShowWindow = SW_SHOWDEFAULT;
|
||||||
PROCESS_INFORMATION pi = {0};
|
PROCESS_INFORMATION pi = {0};
|
||||||
if (!CreateProcessW(controlEXEPath, params, NULL, NULL, FALSE, 0, NULL,
|
if (!CreateProcessW(controlEXEPath, params, nullptr, nullptr, FALSE, 0, nullptr,
|
||||||
NULL, &si, &pi)) {
|
nullptr, &si, &pi)) {
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
}
|
}
|
||||||
CloseHandle(pi.hProcess);
|
CloseHandle(pi.hProcess);
|
||||||
@ -665,11 +665,11 @@ nsWindowsShellService::LaunchHTTPHandlerPane()
|
|||||||
{
|
{
|
||||||
OPENASINFO info;
|
OPENASINFO info;
|
||||||
info.pcszFile = L"http";
|
info.pcszFile = L"http";
|
||||||
info.pcszClass = NULL;
|
info.pcszClass = nullptr;
|
||||||
info.oaifInFlags = OAIF_FORCE_REGISTRATION |
|
info.oaifInFlags = OAIF_FORCE_REGISTRATION |
|
||||||
OAIF_URL_PROTOCOL |
|
OAIF_URL_PROTOCOL |
|
||||||
OAIF_REGISTER_EXT;
|
OAIF_REGISTER_EXT;
|
||||||
return DynSHOpenWithDialog(NULL, &info);
|
return DynSHOpenWithDialog(nullptr, &info);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
@ -1028,8 +1028,8 @@ nsWindowsShellService::OpenApplication(int32_t aApplication)
|
|||||||
::ZeroMemory(&si, sizeof(STARTUPINFOW));
|
::ZeroMemory(&si, sizeof(STARTUPINFOW));
|
||||||
::ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
|
::ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
|
||||||
|
|
||||||
BOOL success = ::CreateProcessW(NULL, (LPWSTR)path.get(), NULL,
|
BOOL success = ::CreateProcessW(nullptr, (LPWSTR)path.get(), nullptr,
|
||||||
NULL, FALSE, 0, NULL, NULL,
|
nullptr, FALSE, 0, nullptr, nullptr,
|
||||||
&si, &pi);
|
&si, &pi);
|
||||||
if (!success)
|
if (!success)
|
||||||
return NS_ERROR_FAILURE;
|
return NS_ERROR_FAILURE;
|
||||||
|
@ -23,7 +23,7 @@ Log(const wchar_t *fmt, ...)
|
|||||||
#if !defined(SHOW_CONSOLE)
|
#if !defined(SHOW_CONSOLE)
|
||||||
return;
|
return;
|
||||||
#endif
|
#endif
|
||||||
va_list a = NULL;
|
va_list a = nullptr;
|
||||||
wchar_t szDebugString[1024];
|
wchar_t szDebugString[1024];
|
||||||
if(!lstrlenW(fmt))
|
if(!lstrlenW(fmt))
|
||||||
return;
|
return;
|
||||||
@ -34,8 +34,8 @@ Log(const wchar_t *fmt, ...)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
DWORD len;
|
DWORD len;
|
||||||
WriteConsoleW(sCon, szDebugString, lstrlenW(szDebugString), &len, NULL);
|
WriteConsoleW(sCon, szDebugString, lstrlenW(szDebugString), &len, nullptr);
|
||||||
WriteConsoleW(sCon, L"\n", 1, &len, NULL);
|
WriteConsoleW(sCon, L"\n", 1, &len, nullptr);
|
||||||
|
|
||||||
if (IsDebuggerPresent()) {
|
if (IsDebuggerPresent()) {
|
||||||
OutputDebugStringW(szDebugString);
|
OutputDebugStringW(szDebugString);
|
||||||
@ -53,7 +53,7 @@ SetupConsole()
|
|||||||
int fd = _open_osfhandle(reinterpret_cast<intptr_t>(sCon), 0);
|
int fd = _open_osfhandle(reinterpret_cast<intptr_t>(sCon), 0);
|
||||||
fp = _fdopen(fd, "w");
|
fp = _fdopen(fd, "w");
|
||||||
*stdout = *fp;
|
*stdout = *fp;
|
||||||
setvbuf(stdout, NULL, _IONBF, 0);
|
setvbuf(stdout, nullptr, _IONBF, 0);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -104,19 +104,19 @@ IsDX10Available()
|
|||||||
|
|
||||||
CComPtr<ID3D10Device1> device;
|
CComPtr<ID3D10Device1> device;
|
||||||
// Try for DX10.1
|
// Try for DX10.1
|
||||||
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, NULL,
|
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
|
||||||
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
||||||
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
||||||
D3D10_FEATURE_LEVEL_10_1,
|
D3D10_FEATURE_LEVEL_10_1,
|
||||||
D3D10_1_SDK_VERSION, &device))) {
|
D3D10_1_SDK_VERSION, &device))) {
|
||||||
// Try for DX10
|
// Try for DX10
|
||||||
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, NULL,
|
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
|
||||||
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
||||||
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
||||||
D3D10_FEATURE_LEVEL_10_0,
|
D3D10_FEATURE_LEVEL_10_0,
|
||||||
D3D10_1_SDK_VERSION, &device))) {
|
D3D10_1_SDK_VERSION, &device))) {
|
||||||
// Try for DX9.3 (we fall back to cairo and cairo has support for D3D 9.3)
|
// Try for DX9.3 (we fall back to cairo and cairo has support for D3D 9.3)
|
||||||
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, NULL,
|
if (FAILED(createD3DDevice(adapter1, D3D10_DRIVER_TYPE_HARDWARE, nullptr,
|
||||||
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
D3D10_CREATE_DEVICE_BGRA_SUPPORT |
|
||||||
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
D3D10_CREATE_DEVICE_PREVENT_INTERNAL_THREADING_OPTIMIZATIONS,
|
||||||
D3D10_FEATURE_LEVEL_9_3,
|
D3D10_FEATURE_LEVEL_9_3,
|
||||||
|
@ -42,7 +42,7 @@ template <class T>void SafeRelease(T **ppT)
|
|||||||
{
|
{
|
||||||
if (*ppT) {
|
if (*ppT) {
|
||||||
(*ppT)->Release();
|
(*ppT)->Release();
|
||||||
*ppT = NULL;
|
*ppT = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -63,8 +63,8 @@ public:
|
|||||||
|
|
||||||
CExecuteCommandVerb() :
|
CExecuteCommandVerb() :
|
||||||
mRef(1),
|
mRef(1),
|
||||||
mShellItemArray(NULL),
|
mShellItemArray(nullptr),
|
||||||
mUnkSite(NULL),
|
mUnkSite(nullptr),
|
||||||
mTargetIsFileSystemLink(false),
|
mTargetIsFileSystemLink(false),
|
||||||
mIsDesktopRequest(true),
|
mIsDesktopRequest(true),
|
||||||
mRequestMet(false)
|
mRequestMet(false)
|
||||||
@ -148,9 +148,9 @@ public:
|
|||||||
#ifdef SHOW_CONSOLE
|
#ifdef SHOW_CONSOLE
|
||||||
Log(L"SetSelection param count: %d", count);
|
Log(L"SetSelection param count: %d", count);
|
||||||
for (DWORD idx = 0; idx < count; idx++) {
|
for (DWORD idx = 0; idx < count; idx++) {
|
||||||
IShellItem* item = NULL;
|
IShellItem* item = nullptr;
|
||||||
if (SUCCEEDED(aArray->GetItemAt(idx, &item))) {
|
if (SUCCEEDED(aArray->GetItemAt(idx, &item))) {
|
||||||
LPWSTR str = NULL;
|
LPWSTR str = nullptr;
|
||||||
if (FAILED(item->GetDisplayName(SIGDN_FILESYSPATH, &str))) {
|
if (FAILED(item->GetDisplayName(SIGDN_FILESYSPATH, &str))) {
|
||||||
if (FAILED(item->GetDisplayName(SIGDN_URL, &str))) {
|
if (FAILED(item->GetDisplayName(SIGDN_URL, &str))) {
|
||||||
Log(L"Failed to get a shell item array item.");
|
Log(L"Failed to get a shell item array item.");
|
||||||
@ -165,7 +165,7 @@ public:
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
IShellItem* item = NULL;
|
IShellItem* item = nullptr;
|
||||||
if (FAILED(aArray->GetItemAt(0, &item))) {
|
if (FAILED(aArray->GetItemAt(0, &item))) {
|
||||||
return E_FAIL;
|
return E_FAIL;
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ public:
|
|||||||
|
|
||||||
IFACEMETHODIMP GetSelection(REFIID aRefID, void **aInt)
|
IFACEMETHODIMP GetSelection(REFIID aRefID, void **aInt)
|
||||||
{
|
{
|
||||||
*aInt = NULL;
|
*aInt = nullptr;
|
||||||
return mShellItemArray ? mShellItemArray->QueryInterface(aRefID, aInt) : E_FAIL;
|
return mShellItemArray ? mShellItemArray->QueryInterface(aRefID, aInt) : E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,7 +207,7 @@ public:
|
|||||||
|
|
||||||
IFACEMETHODIMP GetSite(REFIID aRefID, void **aInt)
|
IFACEMETHODIMP GetSite(REFIID aRefID, void **aInt)
|
||||||
{
|
{
|
||||||
*aInt = NULL;
|
*aInt = nullptr;
|
||||||
return mUnkSite ? mUnkSite->QueryInterface(aRefID, aInt) : E_FAIL;
|
return mUnkSite ? mUnkSite->QueryInterface(aRefID, aInt) : E_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,14 +224,14 @@ public:
|
|||||||
}
|
}
|
||||||
|
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
IServiceProvider* pSvcProvider = NULL;
|
IServiceProvider* pSvcProvider = nullptr;
|
||||||
hr = mUnkSite->QueryInterface(IID_IServiceProvider, (void**)&pSvcProvider);
|
hr = mUnkSite->QueryInterface(IID_IServiceProvider, (void**)&pSvcProvider);
|
||||||
if (!pSvcProvider) {
|
if (!pSvcProvider) {
|
||||||
Log(L"Couldn't get IServiceProvider service from explorer. (%X)", hr);
|
Log(L"Couldn't get IServiceProvider service from explorer. (%X)", hr);
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
IExecuteCommandHost* pHost = NULL;
|
IExecuteCommandHost* pHost = nullptr;
|
||||||
// If we can't get this it's a conventional desktop launch
|
// If we can't get this it's a conventional desktop launch
|
||||||
hr = pSvcProvider->QueryService(SID_ExecuteCommandHost,
|
hr = pSvcProvider->QueryService(SID_ExecuteCommandHost,
|
||||||
IID_IExecuteCommandHost, (void**)&pHost);
|
IID_IExecuteCommandHost, (void**)&pHost);
|
||||||
@ -282,7 +282,7 @@ public:
|
|||||||
bool result = false;
|
bool result = false;
|
||||||
IApplicationAssociationRegistration* pAAR;
|
IApplicationAssociationRegistration* pAAR;
|
||||||
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
|
HRESULT hr = CoCreateInstance(CLSID_ApplicationAssociationRegistration,
|
||||||
NULL,
|
nullptr,
|
||||||
CLSCTX_INPROC,
|
CLSCTX_INPROC,
|
||||||
IID_IApplicationAssociationRegistration,
|
IID_IApplicationAssociationRegistration,
|
||||||
(void**)&pAAR);
|
(void**)&pAAR);
|
||||||
@ -348,7 +348,7 @@ static bool GetModulePath(CStringW& aPathBuffer)
|
|||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
|
|
||||||
if (!GetModuleFileName(NULL, buffer, MAX_PATH)) {
|
if (!GetModuleFileName(nullptr, buffer, MAX_PATH)) {
|
||||||
Log(L"GetModuleFileName failed.");
|
Log(L"GetModuleFileName failed.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -400,7 +400,7 @@ static bool GetDefaultBrowserAppModelID(WCHAR* aIDBuffer,
|
|||||||
}
|
}
|
||||||
DWORD len = aCharLength * sizeof(WCHAR);
|
DWORD len = aCharLength * sizeof(WCHAR);
|
||||||
memset(aIDBuffer, 0, len);
|
memset(aIDBuffer, 0, len);
|
||||||
if (RegQueryValueExW(key, L"AppUserModelID", NULL, NULL,
|
if (RegQueryValueExW(key, L"AppUserModelID", nullptr, nullptr,
|
||||||
(LPBYTE)aIDBuffer, &len) != ERROR_SUCCESS || !len) {
|
(LPBYTE)aIDBuffer, &len) != ERROR_SUCCESS || !len) {
|
||||||
RegCloseKey(key);
|
RegCloseKey(key);
|
||||||
return false;
|
return false;
|
||||||
@ -492,7 +492,7 @@ bool CExecuteCommandVerb::SetTargetPath(IShellItem* aItem)
|
|||||||
CComPtr<IDataObject> object;
|
CComPtr<IDataObject> object;
|
||||||
// Check the underlying data object first to insure we get
|
// Check the underlying data object first to insure we get
|
||||||
// absolute uri. See chromium bug 157184.
|
// absolute uri. See chromium bug 157184.
|
||||||
if (SUCCEEDED(aItem->BindToHandler(NULL, BHID_DataObject,
|
if (SUCCEEDED(aItem->BindToHandler(nullptr, BHID_DataObject,
|
||||||
IID_IDataObject,
|
IID_IDataObject,
|
||||||
reinterpret_cast<void**>(&object))) &&
|
reinterpret_cast<void**>(&object))) &&
|
||||||
GetPlainText(object, cstrText)) {
|
GetPlainText(object, cstrText)) {
|
||||||
@ -515,7 +515,7 @@ bool CExecuteCommandVerb::SetTargetPath(IShellItem* aItem)
|
|||||||
Log(L"No data object or data object has no text.");
|
Log(L"No data object or data object has no text.");
|
||||||
|
|
||||||
// Use the shell item display name
|
// Use the shell item display name
|
||||||
LPWSTR str = NULL;
|
LPWSTR str = nullptr;
|
||||||
mTargetIsFileSystemLink = true;
|
mTargetIsFileSystemLink = true;
|
||||||
if (FAILED(aItem->GetDisplayName(SIGDN_FILESYSPATH, &str))) {
|
if (FAILED(aItem->GetDisplayName(SIGDN_FILESYSPATH, &str))) {
|
||||||
mTargetIsFileSystemLink = false;
|
mTargetIsFileSystemLink = false;
|
||||||
@ -555,12 +555,12 @@ void CExecuteCommandVerb::LaunchDesktopBrowser()
|
|||||||
SHELLEXECUTEINFOW seinfo;
|
SHELLEXECUTEINFOW seinfo;
|
||||||
memset(&seinfo, 0, sizeof(seinfo));
|
memset(&seinfo, 0, sizeof(seinfo));
|
||||||
seinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
|
seinfo.cbSize = sizeof(SHELLEXECUTEINFOW);
|
||||||
seinfo.fMask = NULL;
|
seinfo.fMask = nullptr;
|
||||||
seinfo.hwnd = NULL;
|
seinfo.hwnd = nullptr;
|
||||||
seinfo.lpVerb = NULL;
|
seinfo.lpVerb = nullptr;
|
||||||
seinfo.lpFile = browserPath;
|
seinfo.lpFile = browserPath;
|
||||||
seinfo.lpParameters = params;
|
seinfo.lpParameters = params;
|
||||||
seinfo.lpDirectory = NULL;
|
seinfo.lpDirectory = nullptr;
|
||||||
seinfo.nShow = SW_SHOWNORMAL;
|
seinfo.nShow = SW_SHOWNORMAL;
|
||||||
|
|
||||||
ShellExecuteExW(&seinfo);
|
ShellExecuteExW(&seinfo);
|
||||||
@ -594,9 +594,9 @@ IFACEMETHODIMP CExecuteCommandVerb::Execute()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Launch into Metro
|
// Launch into Metro
|
||||||
IApplicationActivationManager* activateMgr = NULL;
|
IApplicationActivationManager* activateMgr = nullptr;
|
||||||
DWORD processID;
|
DWORD processID;
|
||||||
if (FAILED(CoCreateInstance(CLSID_ApplicationActivationManager, NULL,
|
if (FAILED(CoCreateInstance(CLSID_ApplicationActivationManager, nullptr,
|
||||||
CLSCTX_LOCAL_SERVER,
|
CLSCTX_LOCAL_SERVER,
|
||||||
IID_IApplicationActivationManager,
|
IID_IApplicationActivationManager,
|
||||||
(void**)&activateMgr))) {
|
(void**)&activateMgr))) {
|
||||||
@ -616,7 +616,7 @@ IFACEMETHODIMP CExecuteCommandVerb::Execute()
|
|||||||
|
|
||||||
// Hand off focus rights to the out-of-process activation server. Without
|
// Hand off focus rights to the out-of-process activation server. Without
|
||||||
// this the metro interface won't launch.
|
// this the metro interface won't launch.
|
||||||
hr = CoAllowSetForegroundWindow(activateMgr, NULL);
|
hr = CoAllowSetForegroundWindow(activateMgr, nullptr);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
Log(L"CoAllowSetForegroundWindow result %X", hr);
|
Log(L"CoAllowSetForegroundWindow result %X", hr);
|
||||||
activateMgr->Release();
|
activateMgr->Release();
|
||||||
@ -686,7 +686,7 @@ ClassFactory::Register(CLSCTX aClass, REGCLS aUse)
|
|||||||
STDMETHODIMP
|
STDMETHODIMP
|
||||||
ClassFactory::QueryInterface(REFIID riid, void **ppv)
|
ClassFactory::QueryInterface(REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
IUnknown *punk = NULL;
|
IUnknown *punk = nullptr;
|
||||||
if (riid == IID_IUnknown || riid == IID_IClassFactory) {
|
if (riid == IID_IUnknown || riid == IID_IClassFactory) {
|
||||||
punk = static_cast<IClassFactory*>(this);
|
punk = static_cast<IClassFactory*>(this);
|
||||||
}
|
}
|
||||||
@ -702,7 +702,7 @@ ClassFactory::QueryInterface(REFIID riid, void **ppv)
|
|||||||
STDMETHODIMP
|
STDMETHODIMP
|
||||||
ClassFactory::CreateInstance(IUnknown *punkOuter, REFIID riid, void **ppv)
|
ClassFactory::CreateInstance(IUnknown *punkOuter, REFIID riid, void **ppv)
|
||||||
{
|
{
|
||||||
*ppv = NULL;
|
*ppv = nullptr;
|
||||||
if (punkOuter)
|
if (punkOuter)
|
||||||
return CLASS_E_NOAGGREGATION;
|
return CLASS_E_NOAGGREGATION;
|
||||||
return mUnkObject->QueryInterface(riid, ppv);
|
return mUnkObject->QueryInterface(riid, ppv);
|
||||||
@ -730,7 +730,7 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, PWSTR pszCmdLine, int)
|
|||||||
|
|
||||||
if (!wcslen(pszCmdLine) || StrStrI(pszCmdLine, L"-Embedding"))
|
if (!wcslen(pszCmdLine) || StrStrI(pszCmdLine, L"-Embedding"))
|
||||||
{
|
{
|
||||||
CoInitialize(NULL);
|
CoInitialize(nullptr);
|
||||||
|
|
||||||
CExecuteCommandVerb *pHandler = new CExecuteCommandVerb();
|
CExecuteCommandVerb *pHandler = new CExecuteCommandVerb();
|
||||||
if (!pHandler)
|
if (!pHandler)
|
||||||
@ -743,13 +743,13 @@ int APIENTRY wWinMain(HINSTANCE, HINSTANCE, PWSTR pszCmdLine, int)
|
|||||||
|
|
||||||
ClassFactory classFactory(ppi);
|
ClassFactory classFactory(ppi);
|
||||||
ppi->Release();
|
ppi->Release();
|
||||||
ppi = NULL;
|
ppi = nullptr;
|
||||||
|
|
||||||
// REGCLS_SINGLEUSE insures we only get used once and then discarded.
|
// REGCLS_SINGLEUSE insures we only get used once and then discarded.
|
||||||
if (FAILED(classFactory.Register(CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE)))
|
if (FAILED(classFactory.Register(CLSCTX_LOCAL_SERVER, REGCLS_SINGLEUSE)))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (!SetTimer(NULL, 1, HEARTBEAT_MSEC, NULL)) {
|
if (!SetTimer(nullptr, 1, HEARTBEAT_MSEC, nullptr)) {
|
||||||
Log(L"Failed to set timer, can't process request.");
|
Log(L"Failed to set timer, can't process request.");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -37,10 +37,10 @@ HRESULT
|
|||||||
SetShortcutProps(LPCWSTR aShortcutPath, LPCWSTR aAppModelID, bool aSetID, bool aSetMode)
|
SetShortcutProps(LPCWSTR aShortcutPath, LPCWSTR aAppModelID, bool aSetID, bool aSetMode)
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
::CoInitialize(NULL);
|
::CoInitialize(nullptr);
|
||||||
|
|
||||||
IPropertyStore *m_pps = NULL;
|
IPropertyStore *m_pps = nullptr;
|
||||||
if (FAILED(hres = SHGetPropertyStoreFromParsingName(aShortcutPath, NULL, GPS_READWRITE, IID_PPV_ARGS(&m_pps)))) {
|
if (FAILED(hres = SHGetPropertyStoreFromParsingName(aShortcutPath, nullptr, GPS_READWRITE, IID_PPV_ARGS(&m_pps)))) {
|
||||||
printf("SHGetPropertyStoreFromParsingName failed\n");
|
printf("SHGetPropertyStoreFromParsingName failed\n");
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
@ -79,10 +79,10 @@ HRESULT
|
|||||||
PrintShortcutProps(LPCWSTR aTargetPath)
|
PrintShortcutProps(LPCWSTR aTargetPath)
|
||||||
{
|
{
|
||||||
HRESULT hres;
|
HRESULT hres;
|
||||||
::CoInitialize(NULL);
|
::CoInitialize(nullptr);
|
||||||
|
|
||||||
IPropertyStore *m_pps = NULL;
|
IPropertyStore *m_pps = nullptr;
|
||||||
if (FAILED(hres = SHGetPropertyStoreFromParsingName(aTargetPath, NULL, GPS_READWRITE, IID_PPV_ARGS(&m_pps)))) {
|
if (FAILED(hres = SHGetPropertyStoreFromParsingName(aTargetPath, nullptr, GPS_READWRITE, IID_PPV_ARGS(&m_pps)))) {
|
||||||
printf("SHGetPropertyStoreFromParsingName failed\n");
|
printf("SHGetPropertyStoreFromParsingName failed\n");
|
||||||
goto Exit;
|
goto Exit;
|
||||||
}
|
}
|
||||||
@ -125,9 +125,9 @@ CreateLink(LPCWSTR aTargetPath, LPCWSTR aShortcutPath, LPCWSTR aDescription)
|
|||||||
|
|
||||||
wprintf(L"creating shortcut: '%s'\n", aShortcutPath);
|
wprintf(L"creating shortcut: '%s'\n", aShortcutPath);
|
||||||
|
|
||||||
CoInitialize(NULL);
|
CoInitialize(nullptr);
|
||||||
|
|
||||||
hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
hres = CoCreateInstance(CLSID_ShellLink, nullptr, CLSCTX_INPROC_SERVER,
|
||||||
IID_IShellLink, (LPVOID*)&psl);
|
IID_IShellLink, (LPVOID*)&psl);
|
||||||
if (FAILED(hres)) {
|
if (FAILED(hres)) {
|
||||||
CoUninitialize();
|
CoUninitialize();
|
||||||
@ -140,7 +140,7 @@ CreateLink(LPCWSTR aTargetPath, LPCWSTR aShortcutPath, LPCWSTR aDescription)
|
|||||||
psl->SetDescription(L"");
|
psl->SetDescription(L"");
|
||||||
}
|
}
|
||||||
|
|
||||||
IPersistFile* ppf = NULL;
|
IPersistFile* ppf = nullptr;
|
||||||
hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
|
hres = psl->QueryInterface(IID_IPersistFile, (LPVOID*)&ppf);
|
||||||
|
|
||||||
if (SUCCEEDED(hres)) {
|
if (SUCCEEDED(hres)) {
|
||||||
@ -261,7 +261,7 @@ int wmain(int argc, WCHAR* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (createShortcutFound) {
|
if (createShortcutFound) {
|
||||||
if (FAILED(hres = CreateLink(targetPathStr, shortcutPathStr, (descriptionFound ? descriptionStr : NULL)))) {
|
if (FAILED(hres = CreateLink(targetPathStr, shortcutPathStr, (descriptionFound ? descriptionStr : nullptr)))) {
|
||||||
printf("failed creating shortcut HRESULT=%X\n", hres);
|
printf("failed creating shortcut HRESULT=%X\n", hres);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -275,7 +275,7 @@ int wmain(int argc, WCHAR* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (appModelIDFound || modeFound) {
|
if (appModelIDFound || modeFound) {
|
||||||
if (FAILED(hres = SetShortcutProps(target, (appModelIDFound ? appModelIDStr : NULL), appModelIDFound, modeFound))) {
|
if (FAILED(hres = SetShortcutProps(target, (appModelIDFound ? appModelIDStr : nullptr), appModelIDFound, modeFound))) {
|
||||||
printf("failed adding property HRESULT=%X\n", hres);
|
printf("failed adding property HRESULT=%X\n", hres);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ CString sFirefoxPath;
|
|||||||
|
|
||||||
static void Log(const wchar_t *fmt, ...)
|
static void Log(const wchar_t *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list a = NULL;
|
va_list a = nullptr;
|
||||||
wchar_t szDebugString[1024];
|
wchar_t szDebugString[1024];
|
||||||
if(!lstrlenW(fmt))
|
if(!lstrlenW(fmt))
|
||||||
return;
|
return;
|
||||||
@ -53,7 +53,7 @@ static void Log(const wchar_t *fmt, ...)
|
|||||||
|
|
||||||
static void Fail(const wchar_t *fmt, ...)
|
static void Fail(const wchar_t *fmt, ...)
|
||||||
{
|
{
|
||||||
va_list a = NULL;
|
va_list a = nullptr;
|
||||||
wchar_t szDebugString[1024];
|
wchar_t szDebugString[1024];
|
||||||
if(!lstrlenW(fmt))
|
if(!lstrlenW(fmt))
|
||||||
return;
|
return;
|
||||||
@ -77,7 +77,7 @@ static bool GetModulePath(CStringW& aPathBuffer)
|
|||||||
WCHAR buffer[MAX_PATH];
|
WCHAR buffer[MAX_PATH];
|
||||||
memset(buffer, 0, sizeof(buffer));
|
memset(buffer, 0, sizeof(buffer));
|
||||||
|
|
||||||
if (!GetModuleFileName(NULL, buffer, MAX_PATH)) {
|
if (!GetModuleFileName(nullptr, buffer, MAX_PATH)) {
|
||||||
Fail(L"GetModuleFileName failed.");
|
Fail(L"GetModuleFileName failed.");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -132,7 +132,7 @@ static bool GetDefaultBrowserAppModelID(WCHAR* aIDBuffer,
|
|||||||
}
|
}
|
||||||
DWORD len = aCharLength * sizeof(WCHAR);
|
DWORD len = aCharLength * sizeof(WCHAR);
|
||||||
memset(aIDBuffer, 0, len);
|
memset(aIDBuffer, 0, len);
|
||||||
if (RegQueryValueExW(key, L"AppUserModelID", NULL, NULL,
|
if (RegQueryValueExW(key, L"AppUserModelID", nullptr, nullptr,
|
||||||
(LPBYTE)aIDBuffer, &len) != ERROR_SUCCESS || !len) {
|
(LPBYTE)aIDBuffer, &len) != ERROR_SUCCESS || !len) {
|
||||||
RegCloseKey(key);
|
RegCloseKey(key);
|
||||||
return false;
|
return false;
|
||||||
@ -172,7 +172,7 @@ static bool Launch()
|
|||||||
|
|
||||||
// The interface that allows us to activate the browser
|
// The interface that allows us to activate the browser
|
||||||
CComPtr<IApplicationActivationManager> activateMgr;
|
CComPtr<IApplicationActivationManager> activateMgr;
|
||||||
if (FAILED(CoCreateInstance(CLSID_ApplicationActivationManager, NULL,
|
if (FAILED(CoCreateInstance(CLSID_ApplicationActivationManager, nullptr,
|
||||||
CLSCTX_LOCAL_SERVER,
|
CLSCTX_LOCAL_SERVER,
|
||||||
IID_IApplicationActivationManager,
|
IID_IApplicationActivationManager,
|
||||||
(void**)&activateMgr))) {
|
(void**)&activateMgr))) {
|
||||||
@ -191,7 +191,7 @@ static bool Launch()
|
|||||||
|
|
||||||
// Hand off focus rights to the out-of-process activation server. Without
|
// Hand off focus rights to the out-of-process activation server. Without
|
||||||
// this the metro interface won't launch.
|
// this the metro interface won't launch.
|
||||||
hr = CoAllowSetForegroundWindow(activateMgr, NULL);
|
hr = CoAllowSetForegroundWindow(activateMgr, nullptr);
|
||||||
if (FAILED(hr)) {
|
if (FAILED(hr)) {
|
||||||
Fail(L"CoAllowSetForegroundWindow result %X", hr);
|
Fail(L"CoAllowSetForegroundWindow result %X", hr);
|
||||||
return false;
|
return false;
|
||||||
@ -215,7 +215,7 @@ static bool Launch()
|
|||||||
} else {
|
} else {
|
||||||
// Use the module path
|
// Use the module path
|
||||||
char path[MAX_PATH];
|
char path[MAX_PATH];
|
||||||
if (!GetModuleFileNameA(NULL, path, MAX_PATH)) {
|
if (!GetModuleFileNameA(nullptr, path, MAX_PATH)) {
|
||||||
Fail(L"GetModuleFileNameA errorno=%d", GetLastError());
|
Fail(L"GetModuleFileNameA errorno=%d", GetLastError());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -230,9 +230,9 @@ static bool Launch()
|
|||||||
|
|
||||||
Log(L"Writing out tests.ini to: '%s'", CStringW(testFilePath));
|
Log(L"Writing out tests.ini to: '%s'", CStringW(testFilePath));
|
||||||
HANDLE hTestFile = CreateFileA(testFilePath, GENERIC_WRITE,
|
HANDLE hTestFile = CreateFileA(testFilePath, GENERIC_WRITE,
|
||||||
0, NULL, CREATE_ALWAYS,
|
0, nullptr, CREATE_ALWAYS,
|
||||||
FILE_ATTRIBUTE_NORMAL,
|
FILE_ATTRIBUTE_NORMAL,
|
||||||
NULL);
|
nullptr);
|
||||||
if (hTestFile == INVALID_HANDLE_VALUE) {
|
if (hTestFile == INVALID_HANDLE_VALUE) {
|
||||||
Fail(L"CreateFileA errorno=%d", GetLastError());
|
Fail(L"CreateFileA errorno=%d", GetLastError());
|
||||||
return false;
|
return false;
|
||||||
@ -241,7 +241,7 @@ static bool Launch()
|
|||||||
DeleteTestFileHelper dtf(testFilePath);
|
DeleteTestFileHelper dtf(testFilePath);
|
||||||
|
|
||||||
CStringA asciiParams = sAppParams;
|
CStringA asciiParams = sAppParams;
|
||||||
if (!WriteFile(hTestFile, asciiParams, asciiParams.GetLength(), NULL, 0)) {
|
if (!WriteFile(hTestFile, asciiParams, asciiParams.GetLength(), nullptr, 0)) {
|
||||||
CloseHandle(hTestFile);
|
CloseHandle(hTestFile);
|
||||||
Fail(L"WriteFile errorno=%d", GetLastError());
|
Fail(L"WriteFile errorno=%d", GetLastError());
|
||||||
return false;
|
return false;
|
||||||
@ -269,7 +269,7 @@ static bool Launch()
|
|||||||
MSG msg;
|
MSG msg;
|
||||||
DWORD waitResult = WAIT_TIMEOUT;
|
DWORD waitResult = WAIT_TIMEOUT;
|
||||||
while ((waitResult = WaitForSingleObject(child, 10)) != WAIT_OBJECT_0) {
|
while ((waitResult = WaitForSingleObject(child, 10)) != WAIT_OBJECT_0) {
|
||||||
if (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE)) {
|
if (PeekMessage(&msg, nullptr, 0, 0, PM_REMOVE)) {
|
||||||
TranslateMessage(&msg);
|
TranslateMessage(&msg);
|
||||||
DispatchMessage(&msg);
|
DispatchMessage(&msg);
|
||||||
}
|
}
|
||||||
@ -281,7 +281,7 @@ static bool Launch()
|
|||||||
|
|
||||||
int wmain(int argc, WCHAR* argv[])
|
int wmain(int argc, WCHAR* argv[])
|
||||||
{
|
{
|
||||||
CoInitialize(NULL);
|
CoInitialize(nullptr);
|
||||||
|
|
||||||
int idx;
|
int idx;
|
||||||
bool firefoxParam = false;
|
bool firefoxParam = false;
|
||||||
|
Loading…
Reference in New Issue
Block a user