Bug 521141 - Group running applications properly under shortcuts pinned to the taskbar. r=rstrong.

This commit is contained in:
Jim Mathies 2010-05-14 19:24:01 -05:00
Родитель f139d54f79
Коммит baab7c1f6d
11 изменённых файлов: 564 добавлений и 4 удалений

Просмотреть файл

@ -1,5 +1,14 @@
#filter substitution
# Win7: AppVendor, AppName, and AppVersion must match the application.ini values
# of Vendor, Name, and Version. These values are used in registering shortcuts
# with the taskbar. ExplicitAppUserModelID registration when the app launches is
# handled in widget/src/windows/WinTaskbar.cpp.
!define AppVendor "Mozilla"
!define AppName "Firefox"
!define AppVersion "@APP_VERSION@"
!define AppUserModelID "${AppVendor}.${AppName}.${AppVersion}"
!define GREVersion @MOZILLA_VERSION@
!define AB_CD "@AB_CD@"

Просмотреть файл

@ -35,9 +35,10 @@
# ***** END LICENSE BLOCK *****
# Required Plugins:
# AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in
# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
# UAC http://nsis.sourceforge.net/UAC_plug-in
# AppAssocReg http://nsis.sourceforge.net/Application_Association_Registration_plug-in
# ApplicationID http://nsis.sourceforge.net/ApplicationID_plug-in
# ShellLink http://nsis.sourceforge.net/ShellLink_plug-in
# UAC http://nsis.sourceforge.net/UAC_plug-in
; Set verbosity to 3 (e.g. no script) to lessen the noise in the build logs
!verbose 3
@ -426,8 +427,10 @@ Section "-Application" APP_IDX
${LogMsg} "Added Start Menu Directory: $SMPROGRAMS\$StartMenuDir"
${EndUnless}
CreateShortCut "$SMPROGRAMS\$StartMenuDir\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
ApplicationID::Set "$SMPROGRAMS\$StartMenuDir\${BrandFullName}.lnk" "${AppUserModelID}"
${LogMsg} "Added Shortcut: $SMPROGRAMS\$StartMenuDir\${BrandFullName}.lnk"
CreateShortCut "$SMPROGRAMS\$StartMenuDir\${BrandFullName} ($(SAFE_MODE)).lnk" "$INSTDIR\${FileMainEXE}" "-safe-mode" "$INSTDIR\${FileMainEXE}" 0
ApplicationID::Set "$SMPROGRAMS\$StartMenuDir\${BrandFullName} ($(SAFE_MODE)).lnk" "${AppUserModelID}"
${LogMsg} "Added Shortcut: $SMPROGRAMS\$StartMenuDir\${BrandFullName} ($(SAFE_MODE)).lnk"
${EndIf}
@ -435,6 +438,7 @@ Section "-Application" APP_IDX
${If} $AddDesktopSC == 1
CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "${AppUserModelID}"
${LogMsg} "Added Shortcut: $DESKTOP\${BrandFullName}.lnk"
${EndIf}
@ -595,6 +599,7 @@ FunctionEnd
Function AddQuickLaunchShortcut
CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
ApplicationID::Set "$QUICKLAUNCH\${BrandFullName}.lnk" "${AppUserModelID}"
FunctionEnd
Function CheckExistingInstall

Просмотреть файл

@ -156,17 +156,20 @@
SetShellVarContext all ; Set $DESKTOP to All Users
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "${AppUserModelID}"
ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR"
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
SetShellVarContext current ; Set $DESKTOP to the current user's desktop
${Unless} ${FileExists} "$DESKTOP\${BrandFullName}.lnk"
CreateShortCut "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
ApplicationID::Set "$DESKTOP\${BrandFullName}.lnk" "${AppUserModelID}"
ShellLink::SetShortCutWorkingDirectory "$DESKTOP\${BrandFullName}.lnk" "$INSTDIR"
${EndUnless}
${EndUnless}
${EndUnless}
${Unless} ${FileExists} "$QUICKLAUNCH\${BrandFullName}.lnk"
CreateShortCut "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR\${FileMainEXE}" "" "$INSTDIR\${FileMainEXE}" 0
ApplicationID::Set "$QUICKLAUNCH\${BrandFullName}.lnk" "${AppUserModelID}"
ShellLink::SetShortCutWorkingDirectory "$QUICKLAUNCH\${BrandFullName}.lnk" "$INSTDIR"
${EndUnless}
!macroend

Просмотреть файл

@ -225,6 +225,9 @@ Section "Uninstall"
${un.RegCleanUninstall}
${un.DeleteShortcuts}
; Unregister resources associated with Win7 taskbar jump lists.
ApplicationID::UninstallJumpLists "${AppUserModelID}"
ClearErrors
WriteRegStr HKLM "Software\Mozilla" "${BrandShortName}InstallerTest" "Write Test"
${If} ${Errors}

Просмотреть файл

@ -0,0 +1,101 @@
// Microsoft Visual C++ generated resource script.
//
#include "resource1.h"
#define APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 2 resource.
//
#include "afxres.h"
/////////////////////////////////////////////////////////////////////////////
#undef APSTUDIO_READONLY_SYMBOLS
/////////////////////////////////////////////////////////////////////////////
// English (U.S.) resources
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
#ifdef _WIN32
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
#pragma code_page(1252)
#endif //_WIN32
#ifdef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// TEXTINCLUDE
//
1 TEXTINCLUDE
BEGIN
"resource1.h\0"
END
2 TEXTINCLUDE
BEGIN
"#include ""afxres.h""\r\n"
"\0"
END
3 TEXTINCLUDE
BEGIN
"\r\n"
"\0"
END
#endif // APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Version
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 1,0,0,0
PRODUCTVERSION 1,0,0,0
FILEFLAGSMASK 0x17L
#ifdef _DEBUG
FILEFLAGS 0x1L
#else
FILEFLAGS 0x0L
#endif
FILEOS 0x4L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "FileDescription", "NSIS Plug-in for managing Application Modal ID resources"
VALUE "FileVersion", "1, 0, 0, 0"
VALUE "InternalName", "ApplicationID"
VALUE "LegalCopyright", "Original code Copyright (c) 2009 Mike Anchor"
VALUE "OriginalFilename", "ApplicationID.dll"
VALUE "ProductName", "ApplicationID"
VALUE "ProductVersion", "1, 0, 0, 0"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END
#endif // English (U.S.) resources
/////////////////////////////////////////////////////////////////////////////
#ifndef APSTUDIO_INVOKED
/////////////////////////////////////////////////////////////////////////////
//
// Generated from the TEXTINCLUDE 3 resource.
//
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

Просмотреть файл

@ -0,0 +1,206 @@
<?xml version="1.0" encoding="Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="8.00"
Name="ApplicationID"
ProjectGUID="{EBB19D89-C251-4281-BC02-04559F609530}"
RootNamespace="ApplicationID"
Keyword="Win32Proj"
>
<Platforms>
<Platform
Name="Win32"
/>
</Platforms>
<ToolFiles>
</ToolFiles>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
CharacterSet="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;APPLICATIONID_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="4"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="2"
GenerateDebugInformation="true"
SubSystem="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory="$(SolutionDir)$(ConfigurationName)"
IntermediateDirectory="$(ConfigurationName)"
ConfigurationType="2"
ATLMinimizesCRunTimeLibraryUsage="true"
CharacterSet="1"
WholeProgramOptimization="1"
>
<Tool
Name="VCPreBuildEventTool"
/>
<Tool
Name="VCCustomBuildTool"
/>
<Tool
Name="VCXMLDataGeneratorTool"
/>
<Tool
Name="VCWebServiceProxyGeneratorTool"
/>
<Tool
Name="VCMIDLTool"
/>
<Tool
Name="VCCLCompilerTool"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;APPLICATIONID_EXPORTS"
RuntimeLibrary="0"
UsePrecompiledHeader="0"
WarningLevel="3"
Detect64BitPortabilityProblems="true"
DebugInformationFormat="3"
/>
<Tool
Name="VCManagedResourceCompilerTool"
/>
<Tool
Name="VCResourceCompilerTool"
/>
<Tool
Name="VCPreLinkEventTool"
/>
<Tool
Name="VCLinkerTool"
LinkIncremental="1"
GenerateDebugInformation="true"
SubSystem="2"
OptimizeReferences="2"
EnableCOMDATFolding="2"
TargetMachine="1"
/>
<Tool
Name="VCALinkTool"
/>
<Tool
Name="VCManifestTool"
/>
<Tool
Name="VCXDCMakeTool"
/>
<Tool
Name="VCBscMakeTool"
/>
<Tool
Name="VCFxCopTool"
/>
<Tool
Name="VCAppVerifierTool"
/>
<Tool
Name="VCWebDeploymentTool"
/>
<Tool
Name="VCPostBuildEventTool"
/>
</Configuration>
</Configurations>
<References>
</References>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
>
<File
RelativePath=".\Set.cpp"
>
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl;inc;xsd"
UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
<File
RelativePath=".\resource.h"
>
</File>
</Filter>
<Filter
Name="Resource Files"
Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
>
<File
RelativePath=".\ApplicationID.rc"
>
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>

Просмотреть файл

@ -0,0 +1,210 @@
/*
* Module : Set.cpp
* Purpose: NSIS Plug-in for setting shortcut ApplicationID property
* Created: 27/12/2009
* Original code Copyright (c) 2009 Mike Anchor.
*/
/*
* Additional Mozilla contributions:
* Unicode support
* Jump list deletion on uninstall
* Pinned item removal on uninstall
* contrib: <jmathies@mozilla.com>
*/
#include <windows.h>
#include <shlobj.h>
#include <propvarutil.h>
#include <propkey.h>
#pragma comment (lib, "shlwapi.lib")
#define MAX_STRLEN 1024
typedef struct _stack_t {
struct _stack_t *next;
TCHAR text[MAX_PATH];
} stack_t;
stack_t **g_stacktop;
unsigned int g_stringsize;
TCHAR *g_variables;
int popstring(TCHAR *str, int len);
void pushstring(const TCHAR *str, int len);
extern "C" void __declspec(dllexport) Set(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
{
g_stringsize = string_size;
g_stacktop = stacktop;
g_variables = variables;
{
IPropertyStore *m_pps = NULL;
WCHAR wszPath[MAX_PATH];
WCHAR wszAppID[MAX_PATH];
TCHAR szPath[MAX_PATH];
TCHAR szAppID[MAX_PATH];
bool success = false;
ZeroMemory(wszPath, sizeof(wszPath));
ZeroMemory(wszAppID, sizeof(wszAppID));
ZeroMemory(szPath, sizeof(szPath));
ZeroMemory(szAppID, sizeof(szAppID));
popstring(szPath, MAX_PATH);
popstring(szAppID, MAX_PATH);
#if !defined(UNICODE)
MultiByteToWideChar(CP_ACP, 0, szPath, -1, wszPath, MAX_PATH);
MultiByteToWideChar(CP_ACP, 0, szAppID, -1, wszAppID, MAX_PATH);
#else
wcscpy(wszPath, szPath);
wcscpy(wszAppID, szAppID);
#endif
::CoInitialize(NULL);
if (SUCCEEDED(SHGetPropertyStoreFromParsingName(wszPath, NULL, GPS_READWRITE, IID_PPV_ARGS(&m_pps))))
{
PROPVARIANT propvar;
if (SUCCEEDED(InitPropVariantFromString(wszAppID, &propvar)))
{
if (SUCCEEDED(m_pps->SetValue(PKEY_AppUserModel_ID, propvar)))
{
if (SUCCEEDED(m_pps->Commit()))
{
success = true;
}
}
}
}
if (m_pps != NULL)
m_pps->Release();
CoUninitialize();
pushstring(success == true ? TEXT("0") : TEXT("-1"), MAX_PATH);
}
}
extern "C" void __declspec(dllexport) UninstallJumpLists(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
{
g_stringsize = string_size;
g_stacktop = stacktop;
g_variables = variables;
ICustomDestinationList *m_cdl = NULL;
WCHAR wszAppID[MAX_PATH];
TCHAR szAppID[MAX_PATH];
bool success = false;
ZeroMemory(wszAppID, sizeof(wszAppID));
ZeroMemory(szAppID, sizeof(szAppID));
popstring(szAppID, MAX_PATH);
#if !defined(UNICODE)
MultiByteToWideChar(CP_ACP, 0, szAppID, -1, wszAppID, MAX_PATH);
#else
wcscpy(wszAppID, szAppID);
#endif
CoInitialize(NULL);
CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER,
IID_ICustomDestinationList, (void**)&m_cdl);
if (m_cdl) {
if (SUCCEEDED(m_cdl->DeleteList(wszAppID))) {
success = true;
}
}
if (m_cdl)
m_cdl->Release();
CoUninitialize();
pushstring(success == true ? TEXT("0") : TEXT("-1"), MAX_PATH);
}
extern "C" void __declspec(dllexport) UninstallPinnedItem(HWND hwndParent, int string_size, TCHAR *variables, stack_t **stacktop)
{
g_stringsize = string_size;
g_stacktop = stacktop;
g_variables = variables;
IShellItem *pItem = NULL;
IStartMenuPinnedList *pPinnedList = NULL;
WCHAR wszPath[MAX_PATH];
TCHAR szPath[MAX_PATH];
bool success = false;
ZeroMemory(wszPath, sizeof(wszPath));
ZeroMemory(szPath, sizeof(szPath));
popstring(szPath, MAX_PATH);
#if !defined(UNICODE)
MultiByteToWideChar(CP_ACP, 0, szPath, -1, wszPath, MAX_PATH);
#else
wcscpy(wszPath, szPath);
#endif
CoInitialize(NULL);
HRESULT hr;
hr = SHCreateItemFromParsingName(wszPath, NULL, IID_PPV_ARGS(&pItem));
if (SUCCEEDED(hr)) {
hr = CoCreateInstance(CLSID_StartMenuPin,
NULL,
CLSCTX_INPROC_SERVER,
IID_PPV_ARGS(&pPinnedList));
if (SUCCEEDED(hr)) {
hr = pPinnedList->RemoveFromList(pItem);
pPinnedList->Release();
success = true;
}
pItem->Release();
}
CoUninitialize();
pushstring(success == true ? TEXT("0") : TEXT("-1"), MAX_PATH);
}
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}
//Function: Removes the element from the top of the NSIS stack and puts it in the buffer
int popstring(TCHAR *str, int len)
{
stack_t *th;
if (!g_stacktop || !*g_stacktop) return 1;
th=(*g_stacktop);
lstrcpyn(str,th->text, len);
*g_stacktop=th->next;
GlobalFree((HGLOBAL)th);
return 0;
}
//Function: Adds an element to the top of the NSIS stack
void pushstring(const TCHAR *str, int len)
{
stack_t *th;
if (!g_stacktop) return;
th=(stack_t*)GlobalAlloc(GPTR, sizeof(stack_t) + len);
lstrcpyn(th->text, str, len);
th->next=*g_stacktop;
*g_stacktop=th;
}

Просмотреть файл

@ -0,0 +1,14 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by ApplicationID.rc
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif

Просмотреть файл

@ -1,5 +1,5 @@
These directories contain modified source code to the NSIS Plugins used by the
Windows installers. All of these plugin dll's have been compiled with VC6.
Windows installers.
NSIS project page: http://nsis.sourceforge.net/
NSIS Unicode port project page: http://www.scratchpaper.com/
@ -54,3 +54,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=473348
https://bugzilla.mozilla.org/attachment.cgi?id=357014
-------------------------------------------------------------------------------
ApplicationID v1.0
http://nsis.sourceforge.net/ApplicationID_plug-in
Unicode support and taskbar resource deleteion was added for this plugin. A diff
of the changes to the source is available at:
https://bugzilla.mozilla.org/show_bug.cgi?id=521141
-------------------------------------------------------------------------------

Двоичные данные
toolkit/mozapps/installer/windows/nsis/ApplicationID.dll Normal file

Двоичный файл не отображается.

Просмотреть файл

@ -58,6 +58,7 @@ TOOLKIT_NSIS_FILES = \
nsProcess.dll \
ShellLink.dll \
UAC.dll \
ApplicationID.dll \
$(NULL)
$(CONFIG_DIR)/setup.exe::