mirror of
https://github.com/veracrypt/VeraCrypt.git
synced 2026-05-31 16:56:19 +00:00
Windows: fix MSI Start Menu folder upgrades
Use a stable VeraCrypt Start Menu folder for MSI installs instead of deriving it from the versioned product name. Refresh the shortcut component identities for the new folder location and add upgrade-time cleanup for old versioned VeraCrypt Start Menu folders while preserving folders that contain non-VeraCrypt content. Fixes #1631.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
for upgrades to work ; Windows Installer ignores the 4th part -->
|
||||
<?define var.FullProductVersion = 1.26.28?>
|
||||
<?define var.ProductName = VeraCrypt $(var.FullProductVersion)?>
|
||||
<?define var.StartMenuFolderName = VeraCrypt?>
|
||||
|
||||
<!-- Unique GUID identifying this family of product (32-bit and 64-bit have the same) -->
|
||||
<?define var.UpgradeCode = {298F5D2B-3B01-4A13-BEFD-4B3C7BE43BC6}?>
|
||||
@@ -186,7 +187,7 @@
|
||||
<!-- Reference APPLICATIONPROGRAMSFOLDER to create a Start Menu Shortcut -->
|
||||
<!-- See https://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/create_start_menu_shortcut.html -->
|
||||
<Directory Id="ProgramMenuFolder">
|
||||
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductName)"/>
|
||||
<Directory Id="ApplicationProgramsFolder" Name="$(var.StartMenuFolderName)"/>
|
||||
</Directory>
|
||||
|
||||
<!-- We do not Reference QuickLaunchFolder under AppDataFolder to create a Quick Launch Shortcut -->
|
||||
@@ -2440,7 +2441,7 @@
|
||||
<DirectoryRef Id="ApplicationProgramsFolder">
|
||||
|
||||
<!-- Creating an advertised shortcut : enhances resiliency by verifying that all the components in the feature are installed when the shortcut is activated -->
|
||||
<Component Id="VCShortcutStartMenu" Guid="{9CA5F425-0268-4424-8E41-A94D90F1118D}">
|
||||
<Component Id="VCShortcutStartMenu" Guid="{684DA19F-50FC-43AA-89BA-1685DAC0D585}">
|
||||
|
||||
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
|
||||
<Shortcut Id="VCMenuShortcut"
|
||||
@@ -2456,7 +2457,7 @@
|
||||
<RegistryValue
|
||||
Root="HKCU"
|
||||
Key="Software\VeraCrypt_MSI"
|
||||
Name="VCStartMenuShortcutInstalled"
|
||||
Name="VCStartMenuShortcutInstalledStable"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"/>
|
||||
@@ -2464,7 +2465,7 @@
|
||||
</Component>
|
||||
|
||||
<!-- Creating an advertised shortcut : enhances resiliency by verifying that all the components in the feature are installed when the shortcut is activated -->
|
||||
<Component Id="VCExpanderShortcutStartMenu" Guid="9BA70A97-CB6D-4ED4-A0F7-A4CF9885DC33">
|
||||
<Component Id="VCExpanderShortcutStartMenu" Guid="{E0C191AE-86EB-462A-9C8A-73338EC7A153}">
|
||||
|
||||
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
|
||||
<Shortcut Id="VCExpanderStartMenuShortcut"
|
||||
@@ -2480,7 +2481,7 @@
|
||||
<RegistryValue
|
||||
Root="HKCU"
|
||||
Key="Software\VeraCrypt_MSI"
|
||||
Name="VCEexpanderStartMenuShortcutInstalled"
|
||||
Name="VCExpanderStartMenuShortcutInstalledStable"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"/>
|
||||
@@ -2488,7 +2489,7 @@
|
||||
</Component>
|
||||
|
||||
<!-- Creating an advertised shortcut : enhances resiliency by verifying that all the components in the feature are installed when the shortcut is activated -->
|
||||
<Component Id="VCWebsiteShortcutStartMenu" Guid="{D5AA7FFE-5256-4234-AEE1-F9F1EB6ECA4A}">
|
||||
<Component Id="VCWebsiteShortcutStartMenu" Guid="{00CA573B-4B04-4397-8061-CF5B5515DDBD}">
|
||||
|
||||
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
|
||||
<util:InternetShortcut Id="VCWebsiteStartMenuShortcut"
|
||||
@@ -2503,7 +2504,7 @@
|
||||
<RegistryValue
|
||||
Root="HKCU"
|
||||
Key="Software\VeraCrypt_MSI"
|
||||
Name="VCWebsiteStartMenuShortcutInstalled"
|
||||
Name="VCWebsiteStartMenuShortcutInstalledStable"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"/>
|
||||
@@ -3444,6 +3445,12 @@
|
||||
<CustomAction Id="PostInst_SetData"
|
||||
Property="DoPostInstall"
|
||||
Value="INSTALLDIR=[APPLICATIONROOTFOLDER]" />
|
||||
|
||||
<!-- Create a Custom Action which sets the CustomActionData property
|
||||
for CleanupOldStartMenuFolders Deferred Custom Action. -->
|
||||
<CustomAction Id="CleanupOldStartMenuFolders_SetData"
|
||||
Property="CleanupOldStartMenuFolders"
|
||||
Value="PROGRAMMENUFOLDER=[ProgramMenuFolder]" />
|
||||
|
||||
<!-- Create a Custom Action which sets the CustomActionData property
|
||||
for DoPostUninstall Deferred Custom Action.
|
||||
@@ -3474,6 +3481,14 @@
|
||||
Return="check"
|
||||
BinaryKey="VeraCryptCustomActions"
|
||||
DllEntry="VC_CustomAction_PostInstall" />
|
||||
|
||||
<!-- Best-effort cleanup of obsolete versioned Start Menu folders from previous MSI releases. -->
|
||||
<CustomAction Id="CleanupOldStartMenuFolders"
|
||||
Execute="deferred"
|
||||
Impersonate="no"
|
||||
Return="ignore"
|
||||
BinaryKey="VeraCryptCustomActions"
|
||||
DllEntry="VC_CustomAction_CleanupOldStartMenuFolders" />
|
||||
|
||||
<!-- Create our Pre-Uninstall Custom Action.
|
||||
We need to run it as deferred so that it runs
|
||||
@@ -3602,6 +3617,10 @@
|
||||
it will execute it twice : once when it installs new files (NOT Installed), and then when it removes unnecessary files (actual upgrade: UPGRADINGPRODUCTCODE).
|
||||
Therefore, we do not need to execute it at UPGRADINGPRODUCTCODE. -->
|
||||
<Custom Action="DoPostInstall" After="InstallFiles">(NOT Installed AND NOT REMOVE) OR REINSTALL</Custom>
|
||||
|
||||
<!-- Cleanup obsolete versioned Start Menu folders as late as possible in the install transaction. -->
|
||||
<Custom Action="CleanupOldStartMenuFolders_SetData" Before="CleanupOldStartMenuFolders">(NOT Installed AND NOT REMOVE) OR REINSTALL</Custom>
|
||||
<Custom Action="CleanupOldStartMenuFolders" After="PublishProduct">(NOT Installed AND NOT REMOVE) OR REINSTALL</Custom>
|
||||
|
||||
<!-- UNINSTALLATION ONLY CAs -->
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
for upgrades to work ; Windows Installer ignores the 4th part -->
|
||||
<?define var.FullProductVersion = 1.26.28?>
|
||||
<?define var.ProductName = VeraCrypt $(var.FullProductVersion)?>
|
||||
<?define var.StartMenuFolderName = VeraCrypt?>
|
||||
|
||||
<!-- Unique GUID identifying this family of product (32-bit and 64-bit have the same) -->
|
||||
<?define var.UpgradeCode = {813AB9FC-2117-4961-B459-EB65028EEC93}?>
|
||||
@@ -186,7 +187,7 @@
|
||||
<!-- Reference APPLICATIONPROGRAMSFOLDER to create a Start Menu Shortcut -->
|
||||
<!-- See https://wixtoolset.org/documentation/manual/v3/howtos/files_and_registry/create_start_menu_shortcut.html -->
|
||||
<Directory Id="ProgramMenuFolder">
|
||||
<Directory Id="ApplicationProgramsFolder" Name="$(var.ProductName)"/>
|
||||
<Directory Id="ApplicationProgramsFolder" Name="$(var.StartMenuFolderName)"/>
|
||||
</Directory>
|
||||
|
||||
<!-- We do not Reference QuickLaunchFolder under AppDataFolder to create a Quick Launch Shortcut -->
|
||||
@@ -2440,7 +2441,7 @@
|
||||
<DirectoryRef Id="ApplicationProgramsFolder">
|
||||
|
||||
<!-- Creating an advertised shortcut : enhances resiliency by verifying that all the components in the feature are installed when the shortcut is activated -->
|
||||
<Component Id="VCShortcutStartMenu" Guid="{9CA5F425-0268-4424-8E41-A94D90F1118D}">
|
||||
<Component Id="VCShortcutStartMenu" Guid="{684DA19F-50FC-43AA-89BA-1685DAC0D585}">
|
||||
|
||||
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
|
||||
<Shortcut Id="VCMenuShortcut"
|
||||
@@ -2456,7 +2457,7 @@
|
||||
<RegistryValue
|
||||
Root="HKCU"
|
||||
Key="Software\VeraCrypt_MSI"
|
||||
Name="VCStartMenuShortcutInstalled"
|
||||
Name="VCStartMenuShortcutInstalledStable"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"/>
|
||||
@@ -2464,7 +2465,7 @@
|
||||
</Component>
|
||||
|
||||
<!-- Creating an advertised shortcut : enhances resiliency by verifying that all the components in the feature are installed when the shortcut is activated -->
|
||||
<Component Id="VCExpanderShortcutStartMenu" Guid="9BA70A97-CB6D-4ED4-A0F7-A4CF9885DC33">
|
||||
<Component Id="VCExpanderShortcutStartMenu" Guid="{E0C191AE-86EB-462A-9C8A-73338EC7A153}">
|
||||
|
||||
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
|
||||
<Shortcut Id="VCExpanderStartMenuShortcut"
|
||||
@@ -2480,7 +2481,7 @@
|
||||
<RegistryValue
|
||||
Root="HKCU"
|
||||
Key="Software\VeraCrypt_MSI"
|
||||
Name="VCEexpanderStartMenuShortcutInstalled"
|
||||
Name="VCExpanderStartMenuShortcutInstalledStable"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"/>
|
||||
@@ -2488,7 +2489,7 @@
|
||||
</Component>
|
||||
|
||||
<!-- Creating an advertised shortcut : enhances resiliency by verifying that all the components in the feature are installed when the shortcut is activated -->
|
||||
<Component Id="VCWebsiteShortcutStartMenu" Guid="{D5AA7FFE-5256-4234-AEE1-F9F1EB6ECA4A}">
|
||||
<Component Id="VCWebsiteShortcutStartMenu" Guid="{00CA573B-4B04-4397-8061-CF5B5515DDBD}">
|
||||
|
||||
<Condition>INSTALLSTARTMENUSHORTCUT</Condition>
|
||||
<util:InternetShortcut Id="VCWebsiteStartMenuShortcut"
|
||||
@@ -2503,7 +2504,7 @@
|
||||
<RegistryValue
|
||||
Root="HKCU"
|
||||
Key="Software\VeraCrypt_MSI"
|
||||
Name="VCWebsiteStartMenuShortcutInstalled"
|
||||
Name="VCWebsiteStartMenuShortcutInstalledStable"
|
||||
Type="integer"
|
||||
Value="1"
|
||||
KeyPath="yes"/>
|
||||
@@ -3444,6 +3445,12 @@
|
||||
<CustomAction Id="PostInst_SetData"
|
||||
Property="DoPostInstall"
|
||||
Value="INSTALLDIR=[APPLICATIONROOTFOLDER]" />
|
||||
|
||||
<!-- Create a Custom Action which sets the CustomActionData property
|
||||
for CleanupOldStartMenuFolders Deferred Custom Action. -->
|
||||
<CustomAction Id="CleanupOldStartMenuFolders_SetData"
|
||||
Property="CleanupOldStartMenuFolders"
|
||||
Value="PROGRAMMENUFOLDER=[ProgramMenuFolder]" />
|
||||
|
||||
<!-- Create a Custom Action which sets the CustomActionData property
|
||||
for DoPostUninstall Deferred Custom Action.
|
||||
@@ -3474,6 +3481,14 @@
|
||||
Return="check"
|
||||
BinaryKey="VeraCryptCustomActions"
|
||||
DllEntry="VC_CustomAction_PostInstall" />
|
||||
|
||||
<!-- Best-effort cleanup of obsolete versioned Start Menu folders from previous MSI releases. -->
|
||||
<CustomAction Id="CleanupOldStartMenuFolders"
|
||||
Execute="deferred"
|
||||
Impersonate="no"
|
||||
Return="ignore"
|
||||
BinaryKey="VeraCryptCustomActions"
|
||||
DllEntry="VC_CustomAction_CleanupOldStartMenuFolders" />
|
||||
|
||||
<!-- Create our Pre-Uninstall Custom Action.
|
||||
We need to run it as deferred so that it runs
|
||||
@@ -3614,6 +3629,10 @@
|
||||
it will execute it twice : once when it installs new files (NOT Installed), and then when it removes unnecessary files (actual upgrade: UPGRADINGPRODUCTCODE).
|
||||
Therefore, we do not need to execute it at UPGRADINGPRODUCTCODE. -->
|
||||
<Custom Action="DoPostInstall" After="InstallFiles">(NOT Installed AND NOT REMOVE) OR REINSTALL</Custom>
|
||||
|
||||
<!-- Cleanup obsolete versioned Start Menu folders as late as possible in the install transaction. -->
|
||||
<Custom Action="CleanupOldStartMenuFolders_SetData" Before="CleanupOldStartMenuFolders">(NOT Installed AND NOT REMOVE) OR REINSTALL</Custom>
|
||||
<Custom Action="CleanupOldStartMenuFolders" After="PublishProduct">(NOT Installed AND NOT REMOVE) OR REINSTALL</Custom>
|
||||
|
||||
<!-- UNINSTALLATION ONLY CAs -->
|
||||
|
||||
|
||||
@@ -2134,6 +2134,225 @@ void Tokenize(const wchar_t* szInput, std::vector<std::wstring>& szTokens)
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL JoinPath(wchar_t *szPath, size_t cbPath, const wchar_t *szDirectory, const wchar_t *szFileName)
|
||||
{
|
||||
if (FAILED(StringCbCopyW(szPath, cbPath, szDirectory)))
|
||||
return FALSE;
|
||||
|
||||
size_t cchPath = wcslen(szPath);
|
||||
if (cchPath > 0 && szPath[cchPath - 1] != L'\\' && szPath[cchPath - 1] != L'/')
|
||||
{
|
||||
if (FAILED(StringCbCatW(szPath, cbPath, L"\\")))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return SUCCEEDED(StringCbCatW(szPath, cbPath, szFileName));
|
||||
}
|
||||
|
||||
static BOOL IsVersionedVeraCryptStartMenuFolderName(const wchar_t *szFolderName)
|
||||
{
|
||||
const wchar_t szPrefix[] = L"VeraCrypt ";
|
||||
const wchar_t *szVersion = NULL;
|
||||
BOOL bHasDigit = FALSE;
|
||||
BOOL bHasDot = FALSE;
|
||||
BOOL bPreviousDot = FALSE;
|
||||
|
||||
if (!szFolderName || _wcsnicmp(szFolderName, szPrefix, wcslen(szPrefix)) != 0)
|
||||
return FALSE;
|
||||
|
||||
szVersion = szFolderName + wcslen(szPrefix);
|
||||
if (*szVersion == L'\0')
|
||||
return FALSE;
|
||||
|
||||
while (*szVersion)
|
||||
{
|
||||
if (*szVersion >= L'0' && *szVersion <= L'9')
|
||||
{
|
||||
bHasDigit = TRUE;
|
||||
bPreviousDot = FALSE;
|
||||
}
|
||||
else if (*szVersion == L'.')
|
||||
{
|
||||
if (bPreviousDot)
|
||||
return FALSE;
|
||||
|
||||
bHasDot = TRUE;
|
||||
bPreviousDot = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
++szVersion;
|
||||
}
|
||||
|
||||
return bHasDigit && bHasDot && !bPreviousDot;
|
||||
}
|
||||
|
||||
static void DeleteStartMenuShortcutIfExists(MSIHANDLE hInstaller, const wchar_t *szFolderPath, const wchar_t *szShortcutName)
|
||||
{
|
||||
wchar_t szShortcutPath[TC_MAX_PATH];
|
||||
DWORD dwAttributes;
|
||||
|
||||
if (!JoinPath(szShortcutPath, sizeof(szShortcutPath), szFolderPath, szShortcutName))
|
||||
{
|
||||
MSILog(hInstaller, MSI_WARNING_LEVEL, L"Could not build Start Menu shortcut path for '%s'", szShortcutName);
|
||||
return;
|
||||
}
|
||||
|
||||
dwAttributes = GetFileAttributesW(szShortcutPath);
|
||||
if (dwAttributes == INVALID_FILE_ATTRIBUTES || (dwAttributes & FILE_ATTRIBUTE_DIRECTORY))
|
||||
return;
|
||||
|
||||
MSILog(hInstaller, MSI_INFO_LEVEL, L"Removing obsolete Start Menu shortcut '%s'", szShortcutPath);
|
||||
|
||||
if (dwAttributes & FILE_ATTRIBUTE_READONLY)
|
||||
SetFileAttributesW(szShortcutPath, dwAttributes & ~FILE_ATTRIBUTE_READONLY);
|
||||
|
||||
if (!DeleteFileW(szShortcutPath))
|
||||
{
|
||||
DWORD dwError = GetLastError();
|
||||
if (dwError != ERROR_FILE_NOT_FOUND && dwError != ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
MSILog(hInstaller, MSI_WARNING_LEVEL, L"Could not remove obsolete Start Menu shortcut '%s' (error %lu)", szShortcutPath, dwError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CleanupVersionedVeraCryptStartMenuFolder(MSIHANDLE hInstaller, const wchar_t *szFolderPath)
|
||||
{
|
||||
/* Delete only known VeraCrypt-created shortcuts; keep folders with any other content. */
|
||||
static const wchar_t *szShortcutNames[] =
|
||||
{
|
||||
L"VeraCrypt.lnk",
|
||||
L"VeraCryptExpander.lnk",
|
||||
L"VeraCrypt Website.url",
|
||||
L"VeraCrypt User's Guide.lnk",
|
||||
L"VeraCrypt User Guide.lnk",
|
||||
L"Uninstall VeraCrypt.lnk"
|
||||
};
|
||||
|
||||
for (size_t i = 0; i < ARRAYSIZE(szShortcutNames); ++i)
|
||||
DeleteStartMenuShortcutIfExists(hInstaller, szFolderPath, szShortcutNames[i]);
|
||||
|
||||
if (RemoveDirectoryW(szFolderPath))
|
||||
{
|
||||
MSILog(hInstaller, MSI_INFO_LEVEL, L"Removed obsolete Start Menu folder '%s'", szFolderPath);
|
||||
}
|
||||
else
|
||||
{
|
||||
DWORD dwError = GetLastError();
|
||||
if (dwError == ERROR_DIR_NOT_EMPTY)
|
||||
{
|
||||
MSILog(hInstaller, MSI_INFO_LEVEL, L"Obsolete Start Menu folder '%s' was left in place because it contains non-VeraCrypt items", szFolderPath);
|
||||
}
|
||||
else if (dwError != ERROR_FILE_NOT_FOUND && dwError != ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
MSILog(hInstaller, MSI_WARNING_LEVEL, L"Could not remove obsolete Start Menu folder '%s' (error %lu)", szFolderPath, dwError);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void CleanupVersionedVeraCryptStartMenuFoldersInRoot(MSIHANDLE hInstaller, const wchar_t *szProgramMenuFolder)
|
||||
{
|
||||
wchar_t szSearchPath[TC_MAX_PATH];
|
||||
WIN32_FIND_DATAW findData;
|
||||
HANDLE hFind;
|
||||
|
||||
if (!szProgramMenuFolder || szProgramMenuFolder[0] == L'\0')
|
||||
return;
|
||||
|
||||
if (!JoinPath(szSearchPath, sizeof(szSearchPath), szProgramMenuFolder, L"VeraCrypt *"))
|
||||
{
|
||||
MSILog(hInstaller, MSI_WARNING_LEVEL, L"Could not build obsolete Start Menu folder search path for '%s'", szProgramMenuFolder);
|
||||
return;
|
||||
}
|
||||
|
||||
hFind = FindFirstFileW(szSearchPath, &findData);
|
||||
if (hFind == INVALID_HANDLE_VALUE)
|
||||
{
|
||||
DWORD dwError = GetLastError();
|
||||
if (dwError != ERROR_FILE_NOT_FOUND && dwError != ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
MSILog(hInstaller, MSI_WARNING_LEVEL, L"Could not search obsolete Start Menu folders in '%s' (error %lu)", szProgramMenuFolder, dwError);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
|
||||
&& IsVersionedVeraCryptStartMenuFolderName(findData.cFileName))
|
||||
{
|
||||
wchar_t szFolderPath[TC_MAX_PATH];
|
||||
|
||||
if (JoinPath(szFolderPath, sizeof(szFolderPath), szProgramMenuFolder, findData.cFileName))
|
||||
CleanupVersionedVeraCryptStartMenuFolder(hInstaller, szFolderPath);
|
||||
else
|
||||
MSILog(hInstaller, MSI_WARNING_LEVEL, L"Could not build obsolete Start Menu folder path for '%s'", findData.cFileName);
|
||||
}
|
||||
}
|
||||
while (FindNextFileW(hFind, &findData));
|
||||
|
||||
FindClose(hFind);
|
||||
}
|
||||
|
||||
static void CleanupVersionedVeraCryptStartMenuFolders(MSIHANDLE hInstaller, const wchar_t *szProgramMenuFolder)
|
||||
{
|
||||
wchar_t szCommonPrograms[TC_MAX_PATH];
|
||||
|
||||
CleanupVersionedVeraCryptStartMenuFoldersInRoot(hInstaller, szProgramMenuFolder);
|
||||
|
||||
if (SUCCEEDED(SHGetFolderPathW(NULL, CSIDL_COMMON_PROGRAMS, NULL, SHGFP_TYPE_CURRENT, szCommonPrograms)))
|
||||
CleanupVersionedVeraCryptStartMenuFoldersInRoot(hInstaller, szCommonPrograms);
|
||||
}
|
||||
|
||||
EXTERN_C UINT STDAPICALLTYPE VC_CustomAction_CleanupOldStartMenuFolders(MSIHANDLE hInstaller)
|
||||
{
|
||||
std::wstring szValueBuf = L"";
|
||||
std::wstring szProgramMenuFolder = L"";
|
||||
DWORD cchValueBuf = 0;
|
||||
UINT uiStat = 0;
|
||||
|
||||
MSILog(hInstaller, MSI_INFO_LEVEL, L"Begin VC_CustomAction_CleanupOldStartMenuFolders");
|
||||
|
||||
uiStat = MsiGetProperty(hInstaller, TEXT("CustomActionData"), (LPWSTR)TEXT(""), &cchValueBuf);
|
||||
if (ERROR_MORE_DATA == uiStat)
|
||||
{
|
||||
++cchValueBuf; // add 1 for null termination
|
||||
szValueBuf.resize(cchValueBuf);
|
||||
uiStat = MsiGetProperty(hInstaller, TEXT("CustomActionData"), &szValueBuf[0], &cchValueBuf);
|
||||
if (ERROR_SUCCESS == uiStat)
|
||||
{
|
||||
MSILog(hInstaller, MSI_INFO_LEVEL, L"VC_CustomAction_CleanupOldStartMenuFolders: CustomActionData = '%s'", szValueBuf.c_str());
|
||||
|
||||
std::vector<std::wstring> szTokens;
|
||||
Tokenize(szValueBuf.c_str(), szTokens);
|
||||
|
||||
for (size_t i = 0; i < szTokens.size(); i++)
|
||||
{
|
||||
std::wstring szToken = szTokens[i];
|
||||
|
||||
if (wcsncmp(szToken.c_str(), L"PROGRAMMENUFOLDER=", wcslen(L"PROGRAMMENUFOLDER=")) == 0)
|
||||
{
|
||||
size_t index0 = szToken.find_first_of(L"=");
|
||||
if (index0 != std::wstring::npos)
|
||||
{
|
||||
szProgramMenuFolder = szToken.substr(index0 + 1);
|
||||
MSILog(hInstaller, MSI_INFO_LEVEL, L"VC_CustomAction_CleanupOldStartMenuFolders: PROGRAMMENUFOLDER = '%s'", szProgramMenuFolder.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CleanupVersionedVeraCryptStartMenuFolders(hInstaller, szProgramMenuFolder.c_str());
|
||||
|
||||
MSILog(hInstaller, MSI_INFO_LEVEL, L"End VC_CustomAction_CleanupOldStartMenuFolders");
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/*
|
||||
* Same as Setup.c, function DoInstall(), but
|
||||
* without the actual installation, it only prepares the system
|
||||
@@ -2390,13 +2609,22 @@ EXTERN_C UINT STDAPICALLTYPE VC_CustomAction_PostInstall(MSIHANDLE hInstaller)
|
||||
if ((ERROR_SUCCESS == uiStat))
|
||||
{
|
||||
MSILog(hInstaller, MSI_INFO_LEVEL, L"VC_CustomAction_PostInstall: CustomActionData = '%s'", szValueBuf.c_str());
|
||||
if (wcsncmp(szValueBuf.c_str(), L"INSTALLDIR=", wcslen(L"INSTALLDIR=")) == 0)
|
||||
|
||||
std::vector<std::wstring> szTokens;
|
||||
Tokenize(szValueBuf.c_str(), szTokens);
|
||||
|
||||
for (size_t i = 0; i < szTokens.size(); i++)
|
||||
{
|
||||
size_t index0 = szValueBuf.find_first_of(L"=");
|
||||
if (index0 != std::wstring::npos)
|
||||
std::wstring szToken = szTokens[i];
|
||||
|
||||
if (wcsncmp(szToken.c_str(), L"INSTALLDIR=", wcslen(L"INSTALLDIR=")) == 0)
|
||||
{
|
||||
szInstallDir = szValueBuf.substr(index0 + 1);
|
||||
MSILog(hInstaller, MSI_INFO_LEVEL, L"VC_CustomAction_PostInstall: INSTALLDIR = '%s'", szInstallDir.c_str());
|
||||
size_t index0 = szToken.find_first_of(L"=");
|
||||
if (index0 != std::wstring::npos)
|
||||
{
|
||||
szInstallDir = szToken.substr(index0 + 1);
|
||||
MSILog(hInstaller, MSI_INFO_LEVEL, L"VC_CustomAction_PostInstall: INSTALLDIR = '%s'", szInstallDir.c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ LIBRARY VERACRYPTSETUP
|
||||
EXPORTS
|
||||
VC_CustomAction_PreInstall
|
||||
VC_CustomAction_PostInstall
|
||||
VC_CustomAction_CleanupOldStartMenuFolders
|
||||
VC_CustomAction_PreUninstall
|
||||
VC_CustomAction_PostUninstall
|
||||
VC_CustomAction_DoChecks
|
||||
VC_CustomAction_DoChecks
|
||||
|
||||
Reference in New Issue
Block a user