aboutsummaryrefslogtreecommitdiff
path: root/C/Util/7zipUninstall
diff options
context:
space:
mode:
Diffstat (limited to 'C/Util/7zipUninstall')
-rw-r--r--C/Util/7zipUninstall/7zipUninstall.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/C/Util/7zipUninstall/7zipUninstall.c b/C/Util/7zipUninstall/7zipUninstall.c
index e7051e2..2c1333b 100644
--- a/C/Util/7zipUninstall/7zipUninstall.c
+++ b/C/Util/7zipUninstall/7zipUninstall.c
@@ -1,5 +1,5 @@
1/* 7zipUninstall.c - 7-Zip Uninstaller 1/* 7zipUninstall.c - 7-Zip Uninstaller
22024-03-21 : Igor Pavlov : Public domain */ 2: Igor Pavlov : Public domain */
3 3
4#include "Precomp.h" 4#include "Precomp.h"
5 5
@@ -147,7 +147,7 @@ static LPCWSTR const kUninstallExe = L"Uninstall.exe";
147#define MAKE_CHAR_UPPER(c) ((((c) >= 'a' && (c) <= 'z') ? (c) - 0x20 : (c))) 147#define MAKE_CHAR_UPPER(c) ((((c) >= 'a' && (c) <= 'z') ? (c) - 0x20 : (c)))
148 148
149 149
150static void CpyAscii(wchar_t *dest, const char *s) 150static void CpyAscii(WCHAR *dest, const char *s)
151{ 151{
152 for (;;) 152 for (;;)
153 { 153 {
@@ -158,13 +158,13 @@ static void CpyAscii(wchar_t *dest, const char *s)
158 } 158 }
159} 159}
160 160
161static void CatAscii(wchar_t *dest, const char *s) 161static void CatAscii(WCHAR *dest, const char *s)
162{ 162{
163 dest += wcslen(dest); 163 dest += wcslen(dest);
164 CpyAscii(dest, s); 164 CpyAscii(dest, s);
165} 165}
166 166
167static void PrintErrorMessage(const char *s1, const wchar_t *s2) 167static void PrintErrorMessage(const char *s1, const WCHAR *s2)
168{ 168{
169 WCHAR m[MAX_PATH + 512]; 169 WCHAR m[MAX_PATH + 512];
170 m[0] = 0; 170 m[0] = 0;
@@ -183,12 +183,12 @@ static void PrintErrorMessage(const char *s1, const wchar_t *s2)
183} 183}
184 184
185 185
186static BoolInt AreStringsEqual_NoCase(const wchar_t *s1, const wchar_t *s2) 186static BoolInt AreStringsEqual_NoCase(const WCHAR *s1, const WCHAR *s2)
187{ 187{
188 for (;;) 188 for (;;)
189 { 189 {
190 wchar_t c1 = *s1++; 190 WCHAR c1 = *s1++;
191 wchar_t c2 = *s2++; 191 WCHAR c2 = *s2++;
192 if (c1 != c2 && MAKE_CHAR_UPPER(c1) != MAKE_CHAR_UPPER(c2)) 192 if (c1 != c2 && MAKE_CHAR_UPPER(c1) != MAKE_CHAR_UPPER(c2))
193 return False; 193 return False;
194 if (c2 == 0) 194 if (c2 == 0)
@@ -196,12 +196,12 @@ static BoolInt AreStringsEqual_NoCase(const wchar_t *s1, const wchar_t *s2)
196 } 196 }
197} 197}
198 198
199static BoolInt IsString1PrefixedByString2_NoCase(const wchar_t *s1, const wchar_t *s2) 199static BoolInt IsString1PrefixedByString2_NoCase(const WCHAR *s1, const WCHAR *s2)
200{ 200{
201 for (;;) 201 for (;;)
202 { 202 {
203 wchar_t c1; 203 WCHAR c1;
204 const wchar_t c2 = *s2++; 204 const WCHAR c2 = *s2++;
205 if (c2 == 0) 205 if (c2 == 0)
206 return True; 206 return True;
207 c1 = *s1++; 207 c1 = *s1++;
@@ -446,7 +446,7 @@ static LPCWSTR const k_AppPaths_7zFm = L"Software\\Microsoft\\Windows\\CurrentVe
446static LPCWSTR const k_Uninstall_7zip = k_REG_Uninstall L"7-Zip"; 446static LPCWSTR const k_Uninstall_7zip = k_REG_Uninstall L"7-Zip";
447 447
448 448
449static void RemoveQuotes(wchar_t *s) 449static void RemoveQuotes(WCHAR *s)
450{ 450{
451 const size_t len = wcslen(s); 451 const size_t len = wcslen(s);
452 size_t i; 452 size_t i;
@@ -457,7 +457,7 @@ static void RemoveQuotes(wchar_t *s)
457 s[len - 2] = 0; 457 s[len - 2] = 0;
458} 458}
459 459
460static BoolInt AreEqual_Path_PrefixName(const wchar_t *s, const wchar_t *prefix, const wchar_t *name) 460static BoolInt AreEqual_Path_PrefixName(const WCHAR *s, const WCHAR *prefix, const WCHAR *name)
461{ 461{
462 if (!IsString1PrefixedByString2_NoCase(s, prefix)) 462 if (!IsString1PrefixedByString2_NoCase(s, prefix))
463 return False; 463 return False;
@@ -558,13 +558,13 @@ static void WriteCLSID(void)
558} 558}
559 559
560 560
561static const wchar_t *GetCmdParam(const wchar_t *s) 561static const WCHAR *GetCmdParam(const WCHAR *s)
562{ 562{
563 unsigned pos = 0; 563 unsigned pos = 0;
564 BoolInt quoteMode = False; 564 BoolInt quoteMode = False;
565 for (;; s++) 565 for (;; s++)
566 { 566 {
567 const wchar_t c = *s; 567 const WCHAR c = *s;
568 if (c == 0 || (c == L' ' && !quoteMode)) 568 if (c == 0 || (c == L' ' && !quoteMode))
569 break; 569 break;
570 if (c == L'\"') 570 if (c == L'\"')
@@ -581,12 +581,12 @@ static const wchar_t *GetCmdParam(const wchar_t *s)
581} 581}
582 582
583/* 583/*
584static void RemoveQuotes(wchar_t *s) 584static void RemoveQuotes(WCHAR *s)
585{ 585{
586 const wchar_t *src = s; 586 const WCHAR *src = s;
587 for (;;) 587 for (;;)
588 { 588 {
589 wchar_t c = *src++; 589 WCHAR c = *src++;
590 if (c == '\"') 590 if (c == '\"')
591 continue; 591 continue;
592 *s++ = c; 592 *s++ = c;
@@ -618,11 +618,11 @@ static BOOL RemoveFileAfterReboot(void)
618 618
619// #define IS_LIMIT_CHAR(c) (c == 0 || c == ' ') 619// #define IS_LIMIT_CHAR(c) (c == 0 || c == ' ')
620 620
621static BoolInt IsThereSpace(const wchar_t *s) 621static BoolInt IsThereSpace(const WCHAR *s)
622{ 622{
623 for (;;) 623 for (;;)
624 { 624 {
625 const wchar_t c = *s++; 625 const WCHAR c = *s++;
626 if (c == 0) 626 if (c == 0)
627 return False; 627 return False;
628 if (c == ' ') 628 if (c == ' ')
@@ -630,7 +630,7 @@ static BoolInt IsThereSpace(const wchar_t *s)
630 } 630 }
631} 631}
632 632
633static void AddPathParam(wchar_t *dest, const wchar_t *src) 633static void AddPathParam(WCHAR *dest, const WCHAR *src)
634{ 634{
635 const BoolInt needQuote = IsThereSpace(src); 635 const BoolInt needQuote = IsThereSpace(src);
636 if (needQuote) 636 if (needQuote)
@@ -937,7 +937,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
937 #endif 937 #endif
938 lpCmdLine, int nCmdShow) 938 lpCmdLine, int nCmdShow)
939{ 939{
940 const wchar_t *cmdParams; 940 const WCHAR *cmdParams;
941 BoolInt useTemp = True; 941 BoolInt useTemp = True;
942 942
943 UNUSED_VAR(hPrevInstance) 943 UNUSED_VAR(hPrevInstance)
@@ -957,7 +957,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
957#endif 957#endif
958 958
959 { 959 {
960 const wchar_t *s = GetCommandLineW(); 960 const WCHAR *s = GetCommandLineW();
961 961
962 #ifndef UNDER_CE 962 #ifndef UNDER_CE
963 s = GetCmdParam(s); 963 s = GetCmdParam(s);
@@ -968,7 +968,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
968 for (;;) 968 for (;;)
969 { 969 {
970 { 970 {
971 wchar_t c = *s; 971 WCHAR c = *s;
972 if (c == 0) 972 if (c == 0)
973 break; 973 break;
974 if (c == ' ') 974 if (c == ' ')
@@ -979,7 +979,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
979 } 979 }
980 980
981 { 981 {
982 const wchar_t *s2 = GetCmdParam(s); 982 const WCHAR *s2 = GetCmdParam(s);
983 BoolInt error = True; 983 BoolInt error = True;
984 if (cmd[0] == '/') 984 if (cmd[0] == '/')
985 { 985 {
@@ -1022,7 +1022,7 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
1022 } 1022 }
1023 1023
1024 { 1024 {
1025 wchar_t *name; 1025 WCHAR *name;
1026 const DWORD len = GetModuleFileNameW(NULL, modulePath, MAX_PATH); 1026 const DWORD len = GetModuleFileNameW(NULL, modulePath, MAX_PATH);
1027 if (len == 0 || len > MAX_PATH) 1027 if (len == 0 || len > MAX_PATH)
1028 return 1; 1028 return 1;
@@ -1031,10 +1031,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
1031 wcscpy(modulePrefix, modulePath); 1031 wcscpy(modulePrefix, modulePath);
1032 1032
1033 { 1033 {
1034 wchar_t *s = modulePrefix; 1034 WCHAR *s = modulePrefix;
1035 for (;;) 1035 for (;;)
1036 { 1036 {
1037 const wchar_t c = *s++; 1037 const WCHAR c = *s++;
1038 if (c == 0) 1038 if (c == 0)
1039 break; 1039 break;
1040 if (c == WCHAR_PATH_SEPARATOR) 1040 if (c == WCHAR_PATH_SEPARATOR)
@@ -1079,14 +1079,14 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
1079 CpyAscii(path + pathLen, "7z"); 1079 CpyAscii(path + pathLen, "7z");
1080 1080
1081 { 1081 {
1082 wchar_t *s = path + wcslen(path); 1082 WCHAR *s = path + wcslen(path);
1083 UInt32 value = d; 1083 UInt32 value = d;
1084 unsigned k; 1084 unsigned k;
1085 for (k = 0; k < 8; k++) 1085 for (k = 0; k < 8; k++)
1086 { 1086 {
1087 const unsigned t = value & 0xF; 1087 const unsigned t = value & 0xF;
1088 value >>= 4; 1088 value >>= 4;
1089 s[7 - k] = (wchar_t)((t < 10) ? ('0' + t) : ('A' + (t - 10))); 1089 s[7 - k] = (WCHAR)((t < 10) ? ('0' + t) : ('A' + (t - 10)));
1090 } 1090 }
1091 s[k] = 0; 1091 s[k] = 0;
1092 } 1092 }