• R/O
  • SSH
  • HTTPS

tortoisesvn: Commit


Commit MetaInfo

Revision29257 (tree)
Time2021-09-08 01:32:10
Authorstefankueng

Log Message

split the CustomActions dll into two, because I can't get the delayload to work and on Win7/8 the WinRT APIs are not available, which prevents a proper unintall/repair on those systems

Change Summary

Incremental Difference

--- trunk/src/TortoiseSVNSetup/CustomActions/CustomActions.cpp (revision 29256)
+++ trunk/src/TortoiseSVNSetup/CustomActions/CustomActions.cpp (revision 29257)
@@ -30,7 +30,6 @@
3030 #include <winrt/Windows.Foundation.Collections.h>
3131 #include <winrt/Windows.ApplicationModel.h>
3232
33-#pragma comment(lib, "windowsapp.lib")
3433 #pragma comment(lib, "shlwapi")
3534 #pragma comment(lib, "shell32")
3635
@@ -97,66 +96,3 @@
9796 return ERROR_SUCCESS;
9897 }
9998
100-UINT __stdcall RegisterSparsePackage(MSIHANDLE hModule)
101-{
102- DWORD len = 0;
103- MsiGetPropertyW(hModule, L"INSTALLDIR", L"", &len);
104- auto sparseExtPath = std::make_unique<wchar_t[]>(len + 1LL);
105- len += 1;
106- MsiGetPropertyW(hModule, L"INSTALLDIR", sparseExtPath.get(), &len);
107-
108- len = 0;
109- MsiGetPropertyW(hModule, L"SPARSEPACKAGEFILE", L"", &len);
110- auto sparsePackageFile = std::make_unique<wchar_t[]>(len + 1LL);
111- len += 1;
112- MsiGetPropertyW(hModule, L"SPARSEPACKAGEFILE", sparsePackageFile.get(), &len);
113-
114- std::wstring sSparsePackagePath = sparseExtPath.get();
115- sSparsePackagePath += L"\\bin\\";
116- sSparsePackagePath += sparsePackageFile.get();
117-
118- PackageManager manager;
119- AddPackageOptions options;
120- Uri externalUri(sparseExtPath.get());
121- Uri packageUri(sSparsePackagePath.c_str());
122- options.ExternalLocationUri(externalUri);
123- auto deploymentOperation = manager.AddPackageByUriAsync(packageUri, options);
124-
125- auto deployResult = deploymentOperation.get();
126-
127- if (!SUCCEEDED(deployResult.ExtendedErrorCode()))
128- {
129- // Deployment failed
130- return deployResult.ExtendedErrorCode();
131- }
132- return ERROR_SUCCESS;
133-}
134-
135-UINT __stdcall UnregisterSparsePackage(MSIHANDLE hModule)
136-{
137- DWORD len = 0;
138- MsiGetPropertyW(hModule, L"SPARSEPACKAGENAME", L"", &len);
139- auto sparsePackageName = std::make_unique<wchar_t[]>(len + 1LL);
140- len += 1;
141- MsiGetPropertyW(hModule, L"SPARSEPACKAGENAME", sparsePackageName.get(), &len);
142-
143- PackageManager packageManager;
144-
145- auto packages = packageManager.FindPackages();
146- winrt::hstring fullName = sparsePackageName.get();
147- for (const auto& package : packages)
148- {
149- if (package.Id().Name() == sparsePackageName.get())
150- fullName = package.Id().FullName();
151- }
152-
153- auto deploymentOperation = packageManager.RemovePackageAsync(fullName, RemovalOptions::None);
154- auto deployResult = deploymentOperation.get();
155- if (!SUCCEEDED(deployResult.ExtendedErrorCode()))
156- {
157- // Deployment failed
158- return deployResult.ExtendedErrorCode();
159- }
160-
161- return ERROR_SUCCESS;
162-}
\ No newline at end of file
--- trunk/src/TortoiseSVNSetup/CustomActions/CustomActions11.cpp (nonexistent)
+++ trunk/src/TortoiseSVNSetup/CustomActions/CustomActions11.cpp (revision 29257)
@@ -0,0 +1,108 @@
1+// TortoiseSVN - a Windows shell extension for easy version control
2+
3+// Copyright (C) 2021 - TortoiseSVN
4+
5+// This program is free software; you can redistribute it and/or
6+// modify it under the terms of the GNU General Public License
7+// as published by the Free Software Foundation; either version 2
8+// of the License, or (at your option) any later version.
9+
10+// This program is distributed in the hope that it will be useful,
11+// but WITHOUT ANY WARRANTY; without even the implied warranty of
12+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+// GNU General Public License for more details.
14+
15+// You should have received a copy of the GNU General Public License
16+// along with this program; if not, write to the Free Software Foundation,
17+// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18+//
19+
20+/* BIG FAT WARNING: Do not use any functions which require the C-Runtime library
21+ in this custom action dll! The runtimes might not be installed yet!
22+*/
23+
24+#include <windows.h>
25+#include <msi.h>
26+#include <msiquery.h>
27+#include <shlwapi.h>
28+#include <winrt/Windows.Management.Deployment.h>
29+#include <winrt/Windows.Foundation.Collections.h>
30+#include <winrt/Windows.ApplicationModel.h>
31+
32+#pragma comment(lib, "windowsapp.lib")
33+
34+using namespace winrt::Windows::Foundation;
35+using namespace winrt::Windows::Management::Deployment;
36+
37+
38+BOOL APIENTRY DllMain(HANDLE /*hModule*/,
39+ DWORD /*ul_reason_for_call*/,
40+ LPVOID /*lpReserved*/
41+)
42+{
43+ return TRUE;
44+}
45+
46+UINT __stdcall RegisterSparsePackage(MSIHANDLE hModule)
47+{
48+ DWORD len = 0;
49+ MsiGetPropertyW(hModule, L"INSTALLDIR", L"", &len);
50+ auto sparseExtPath = std::make_unique<wchar_t[]>(len + 1LL);
51+ len += 1;
52+ MsiGetPropertyW(hModule, L"INSTALLDIR", sparseExtPath.get(), &len);
53+
54+ len = 0;
55+ MsiGetPropertyW(hModule, L"SPARSEPACKAGEFILE", L"", &len);
56+ auto sparsePackageFile = std::make_unique<wchar_t[]>(len + 1LL);
57+ len += 1;
58+ MsiGetPropertyW(hModule, L"SPARSEPACKAGEFILE", sparsePackageFile.get(), &len);
59+
60+ std::wstring sSparsePackagePath = sparseExtPath.get();
61+ sSparsePackagePath += L"\\bin\\";
62+ sSparsePackagePath += sparsePackageFile.get();
63+
64+ PackageManager manager;
65+ AddPackageOptions options;
66+ Uri externalUri(sparseExtPath.get());
67+ Uri packageUri(sSparsePackagePath.c_str());
68+ options.ExternalLocationUri(externalUri);
69+ auto deploymentOperation = manager.AddPackageByUriAsync(packageUri, options);
70+
71+ auto deployResult = deploymentOperation.get();
72+
73+ if (!SUCCEEDED(deployResult.ExtendedErrorCode()))
74+ {
75+ // Deployment failed
76+ return deployResult.ExtendedErrorCode();
77+ }
78+ return ERROR_SUCCESS;
79+}
80+
81+UINT __stdcall UnregisterSparsePackage(MSIHANDLE hModule)
82+{
83+ DWORD len = 0;
84+ MsiGetPropertyW(hModule, L"SPARSEPACKAGENAME", L"", &len);
85+ auto sparsePackageName = std::make_unique<wchar_t[]>(len + 1LL);
86+ len += 1;
87+ MsiGetPropertyW(hModule, L"SPARSEPACKAGENAME", sparsePackageName.get(), &len);
88+
89+ PackageManager packageManager;
90+
91+ auto packages = packageManager.FindPackages();
92+ winrt::hstring fullName = sparsePackageName.get();
93+ for (const auto& package : packages)
94+ {
95+ if (package.Id().Name() == sparsePackageName.get())
96+ fullName = package.Id().FullName();
97+ }
98+
99+ auto deploymentOperation = packageManager.RemovePackageAsync(fullName, RemovalOptions::None);
100+ auto deployResult = deploymentOperation.get();
101+ if (!SUCCEEDED(deployResult.ExtendedErrorCode()))
102+ {
103+ // Deployment failed
104+ return deployResult.ExtendedErrorCode();
105+ }
106+
107+ return ERROR_SUCCESS;
108+}
\ No newline at end of file
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Show on old repository browser