[PATCH 3/3] uninstaller: Add support for translations (partial fix for bug 28186)
Hugh McMaster
hugh.mcmaster at outlook.com
Mon May 25 00:56:06 CDT 2015
This is a partial fix for https://bugs.winehq.org/show_bug.cgi?id=28186
---
programs/uninstaller/main.c | 29 ++++++++++++++++++-----------
programs/uninstaller/resource.h | 5 +++++
programs/uninstaller/uninstaller.rc | 3 +++
3 files changed, 26 insertions(+), 11 deletions(-)
diff --git a/programs/uninstaller/main.c b/programs/uninstaller/main.c
index f549372..7ac6bd0 100644
--- a/programs/uninstaller/main.c
+++ b/programs/uninstaller/main.c
@@ -100,6 +100,21 @@ static void WINEPROG_formatstring(const WCHAR *fmt, __ms_va_list va_args)
LocalFree(str);
}
+static void WINEPROG_output_message(UINT str_id, ...)
+{
+ WCHAR fmt[1024];
+ __ms_va_list va_args;
+
+ if (!LoadStringW(GetModuleHandleW(NULL), str_id, fmt, sizeof(fmt)/sizeof(WCHAR)))
+ {
+ WINE_FIXME("LoadString failed with %d\n", GetLastError());
+ return;
+ }
+ __ms_va_start(va_args, str_id);
+ WINEPROG_formatstring(fmt, va_args);
+ __ms_va_end(va_args);
+}
+
static void WINEPROG_output_array(const WCHAR *fmt, ...)
{
__ms_va_list va_args;
@@ -127,8 +142,6 @@ static void ListUninstallPrograms(void)
static void RemoveSpecificProgram(WCHAR *nameW)
{
unsigned int i;
- int lenName;
- char *name;
FetchUninstallInformation();
@@ -144,13 +157,7 @@ static void RemoveSpecificProgram(WCHAR *nameW)
if (i < numentries)
UninstallProgram();
else
- {
- lenName = WideCharToMultiByte(CP_UNIXCP, 0, nameW, -1, NULL, 0, NULL, NULL);
- name = HeapAlloc(GetProcessHeap(), 0, lenName);
- WideCharToMultiByte(CP_UNIXCP, 0, nameW, -1, name, lenName, NULL, NULL);
- fprintf(stderr, "Error: could not match application [%s]\n", name);
- HeapFree(GetProcessHeap(), 0, name);
- }
+ WINEPROG_output_message(STRING_NO_APP_MATCH, nameW);
}
@@ -175,7 +182,7 @@ int wmain(int argc, WCHAR *argv[])
{
if( i >= argc )
{
- WINE_ERR( "The remove option requires a parameter.\n");
+ WINEPROG_output_message(STRING_PARAM_REQ);
return 1;
}
@@ -184,7 +191,7 @@ int wmain(int argc, WCHAR *argv[])
}
else
{
- WINE_ERR( "unknown option %s\n",wine_dbgstr_w(token));
+ WINEPROG_output_message(STRING_UNKNOWN_OPTION, token);
return 1;
}
}
diff --git a/programs/uninstaller/resource.h b/programs/uninstaller/resource.h
index 67e1f4b..a022170 100644
--- a/programs/uninstaller/resource.h
+++ b/programs/uninstaller/resource.h
@@ -22,4 +22,9 @@
#define IDS_APPNAME 1000
#define IDS_UNINSTALLFAILED 1001
+
+#define STRING_NO_APP_MATCH 2000
+#define STRING_PARAM_REQ 2001
+#define STRING_UNKNOWN_OPTION 2002
+
#define MAX_STRING_LEN 255
diff --git a/programs/uninstaller/uninstaller.rc b/programs/uninstaller/uninstaller.rc
index 0018992..d424c35 100644
--- a/programs/uninstaller/uninstaller.rc
+++ b/programs/uninstaller/uninstaller.rc
@@ -27,4 +27,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
STRINGTABLE {
IDS_APPNAME, "Wine Application Uninstaller"
IDS_UNINSTALLFAILED, "Execution of uninstall command '%s' failed, perhaps due to missing executable.\nDo you want to remove the uninstall entry from the registry?"
+ STRING_NO_APP_MATCH, "uninstaller: An application with UUID %1 was not found.\n"
+ STRING_PARAM_REQ, "uninstaller: The option '--remove' must be followed by a UUID.\n"
+ STRING_UNKNOWN_OPTION, "uninstaller: Unknown option [%1].\n"
}
--
1.9.1
More information about the wine-patches
mailing list