summaryrefslogtreecommitdiffstats
path: root/other-licenses/nsis/Contrib/ApplicationID
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 17:32:43 +0000
commit6bf0a5cb5034a7e684dcc3500e841785237ce2dd (patch)
treea68f146d7fa01f0134297619fbe7e33db084e0aa /other-licenses/nsis/Contrib/ApplicationID
parentInitial commit. (diff)
downloadthunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.tar.xz
thunderbird-6bf0a5cb5034a7e684dcc3500e841785237ce2dd.zip
Adding upstream version 1:115.7.0.upstream/1%115.7.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'other-licenses/nsis/Contrib/ApplicationID')
-rw-r--r--other-licenses/nsis/Contrib/ApplicationID/ApplicationID.vcproj206
-rw-r--r--other-licenses/nsis/Contrib/ApplicationID/Set.cpp219
2 files changed, 425 insertions, 0 deletions
diff --git a/other-licenses/nsis/Contrib/ApplicationID/ApplicationID.vcproj b/other-licenses/nsis/Contrib/ApplicationID/ApplicationID.vcproj
new file mode 100644
index 0000000000..6df3794340
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ApplicationID/ApplicationID.vcproj
@@ -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>
diff --git a/other-licenses/nsis/Contrib/ApplicationID/Set.cpp b/other-licenses/nsis/Contrib/ApplicationID/Set.cpp
new file mode 100644
index 0000000000..82cb77e16f
--- /dev/null
+++ b/other-licenses/nsis/Contrib/ApplicationID/Set.cpp
@@ -0,0 +1,219 @@
+/*
+ * 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>
+ */
+
+#define INITGUID
+
+#include <windows.h>
+#include <shlobj.h>
+#include <propvarutil.h>
+#include <propkey.h>
+#include <stdio.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;
+
+// Indicates that an application supports dual desktop and immersive modes. In Windows 8, this property is only applicable for web browsers.
+DEFINE_PROPERTYKEY(PKEY_AppUserModel_IsDualMode, 0x9F4C2855, 0x9F79, 0x4B39, 0xA8, 0xD0, 0xE1, 0xD4, 0x2D, 0xE1, 0xD5, 0xF3, 11);
+
+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];
+ TCHAR szDualMode[MAX_PATH];
+ bool success = false;
+
+ ZeroMemory(wszPath, sizeof(wszPath));
+ ZeroMemory(wszAppID, sizeof(wszAppID));
+ ZeroMemory(szPath, sizeof(szPath));
+ ZeroMemory(szAppID, sizeof(szAppID));
+ ZeroMemory(szDualMode, sizeof(szDualMode));
+
+ popstring(szPath, MAX_PATH);
+ popstring(szAppID, MAX_PATH);
+ bool dualMode = (popstring(szDualMode, MAX_PATH) == 0); // optional
+#if !defined(UNICODE)
+ MultiByteToWideChar(CP_ACP, 0, szPath, -1, wszPath, MAX_PATH);
+ MultiByteToWideChar(CP_ACP, 0, szAppID, -1, wszAppID, MAX_PATH);
+ if (dualMode && stricmp(szDualMode, "true") != 0) {
+ dualMode = false;
+ }
+#else
+ wcscpy_s(wszPath, szPath);
+ wcscpy_s(wszAppID, szAppID);
+ if (dualMode && _wcsicmp(szDualMode, L"true") != 0) {
+ dualMode = false;
+ }
+#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 (dualMode) {
+ InitPropVariantFromBoolean(true, &propvar);
+ m_pps->SetValue(PKEY_AppUserModel_IsDualMode, 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_s(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_s(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);
+}
+
+//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;
+}