Remove all hardcode string to En.rc
so it can be translate
Added: trunk/reactos/subsys/system/regsvr32/En.rc
Modified: trunk/reactos/subsys/system/regsvr32/regsvr32.c
Added: trunk/reactos/subsys/system/regsvr32/resource.h
_____
Added: trunk/reactos/subsys/system/regsvr32/En.rc
--- trunk/reactos/subsys/system/regsvr32/En.rc 2005-05-12 19:46:14 UTC
(rev 15245)
+++ trunk/reactos/subsys/system/regsvr32/En.rc 2005-05-12 20:04:02 UTC
(rev 15246)
@@ -0,0 +1,32 @@
+#include "resource.h"
+/*
+ * Moved all hardcoded strings to En.rc.
+ * By Magnus Olsen 2005 magnus(a)itkonsult-olsen.com
+ */
+
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+STRINGTABLE DISCARDABLE
+{
+IDS_UsageMessage, "%s\n\n\
+"Usage: regsvr32 [/u] [/s] [/c] [/n] [/i[:cmdline]] dllname\n\
+/u - Unregister server\n"\
+/s - Silent; display no message boxes\n"\
+/c - Console output\n"\
+/i - Call DllInstall passing it an optional [cmdline]; when used with
/u calls dll uninstall\n\
+/n - Do not call DllRegisterServer; this option must be used with /i"
+
+IDS_NoDllSpecified, "No DLL name specified."
+
+IDS_InvalidFlag, "Unrecognized flag: %s"
+
+IDS_SwitchN_NoI, "Unrecognized flag: /n must be used with the /i
switch"
+
+IDS_DllNotLoaded, "LoadLibrary(\"%s\") failed.\nGetLastError returns
0x%08x."
+
+IDS_MissingEntry, "%s was loaded, but the %s entry point was not
found.\n\n\
+%s may not be exported, or a corrupt version of %s may be in memory.
Consider using PView to detect and remove it."
+
+IDS_FailureMessage, "%s in %s failed.\nReturn code was: 0x%08x"
+
+IDS_SuccessMessage = "%s in %s succeeded."
+}
_____
Modified: trunk/reactos/subsys/system/regsvr32/regsvr32.c
--- trunk/reactos/subsys/system/regsvr32/regsvr32.c 2005-05-12
19:46:14 UTC (rev 15245)
+++ trunk/reactos/subsys/system/regsvr32/regsvr32.c 2005-05-12
20:04:02 UTC (rev 15246)
@@ -52,29 +52,20 @@
#define tszDllInstall szDllInstall
#endif
+#include "resource.h"
+
LPCTSTR ModuleTitle = _T("RegSvr32");
-LPCTSTR UsageMessage =
- _T("%s\n\n")
- _T("Usage: regsvr32 [/u] [/s] [/c] [/n] [/i[:cmdline]]
dllname\n")
- _T("/u - Unregister server\n")
- _T("/s - Silent; display no message boxes\n")
- _T("/c - Console output\n")
- _T("/i - Call DllInstall passing it an optional
[cmdline]; when used with /u calls dll uninstall\n")
- _T("/n - Do not call DllRegisterServer; this option must
be used with /i");
-LPCTSTR NoDllSpecified = _T("No DLL name specified.");
-LPCTSTR InvalidFlag = _T("Unrecognized flag: %s");
-LPCTSTR SwitchN_NoI = _T("Unrecognized flag: /n must be used with the
/i switch");
-LPCTSTR DllNotLoaded =
- _T("LoadLibrary(\"%s\") failed.\n")
- _T("GetLastError returns 0x%08x.");
-LPCTSTR MissingEntry =
- _T("%s was loaded, but the %s entry point was not found.\n\n")
- _T("%s may not be exported, or a corrupt version of %s may be
in memory. Consider using PView to detect and remove it.");
-LPCTSTR FailureMessage =
- _T("%s in %s failed.\n")
- _T("Return code was: 0x%08x");
-LPCTSTR SuccessMessage = _T("%s in %s succeeded.");
+TCHAR UsageMessage[RC_STRING_MAX_SIZE];
+TCHAR NoDllSpecified[RC_STRING_MAX_SIZE];
+TCHAR InvalidFlag[RC_STRING_MAX_SIZE];
+TCHAR SwitchN_NoI[RC_STRING_MAX_SIZE];
+TCHAR DllNotLoaded[RC_STRING_MAX_SIZE];
+TCHAR MissingEntry[RC_STRING_MAX_SIZE];
+TCHAR FailureMessage[RC_STRING_MAX_SIZE];
+TCHAR SuccessMessage[RC_STRING_MAX_SIZE];
+
+
// The macro CommandLineToArgv maps to a function that converts
// a command-line string to argc and argv similar to the ones
// in the standard main function. If this code is compiled for
@@ -276,6 +267,17 @@
DWORD dwErr;
int nRetValue,i;
+ // Get Langues msg
+ LoadString( GetModuleHandle(NULL), IDS_UsageMessage, (LPTSTR)
UsageMessage,RC_STRING_MAX_SIZE);
+ LoadString( GetModuleHandle(NULL), IDS_NoDllSpecified, (LPTSTR)
NoDllSpecified,RC_STRING_MAX_SIZE);
+ LoadString( GetModuleHandle(NULL), IDS_InvalidFlag, (LPTSTR)
InvalidFlag,RC_STRING_MAX_SIZE);
+ LoadString( GetModuleHandle(NULL), IDS_SwitchN_NoI, (LPTSTR)
SwitchN_NoI,RC_STRING_MAX_SIZE);
+
+ LoadString( GetModuleHandle(NULL), IDS_DllNotLoaded, (LPTSTR)
DllNotLoaded,RC_STRING_MAX_SIZE);
+ LoadString( GetModuleHandle(NULL), IDS_MissingEntry, (LPTSTR)
MissingEntry,RC_STRING_MAX_SIZE);
+ LoadString( GetModuleHandle(NULL), IDS_FailureMessage, (LPTSTR)
FailureMessage,RC_STRING_MAX_SIZE);
+ LoadString( GetModuleHandle(NULL), IDS_SuccessMessage, (LPTSTR)
SuccessMessage,RC_STRING_MAX_SIZE);
+
// Get command-line in argc-argv format
argv = CommandLineToArgv(GetCommandLine(),&argc);
@@ -328,7 +330,8 @@
}
}
- // An unrecognized flag was used, display a message and show
available options
+ // An unrecognized flag was used, display a message and show
available options
+
if (lptFuncName) {
lptMsgBuffer = (LPTSTR)malloc((_tcslen(UsageMessage) - 2
+ _tcslen(InvalidFlag) - 2 + _tcslen(lptFuncName) + 1) * sizeof(TCHAR));
_stprintf(lptMsgBuffer + (_tcslen(UsageMessage) -
2),InvalidFlag,lptFuncName);
_____
Added: trunk/reactos/subsys/system/regsvr32/resource.h
--- trunk/reactos/subsys/system/regsvr32/resource.h 2005-05-12
19:46:14 UTC (rev 15245)
+++ trunk/reactos/subsys/system/regsvr32/resource.h 2005-05-12
20:04:02 UTC (rev 15246)
@@ -0,0 +1,13 @@
+
+
+#define RC_STRING_MAX_SIZE 4096
+#define IDS_UsageMessage 100
+#define IDS_NoDllSpecified 101
+#define IDS_InvalidFlag 102
+#define IDS_SwitchN_NoI 103
+#define IDS_DllNotLoaded 104
+#define IDS_MissingEntry 105
+#define IDS_FailureMessage 106
+#define IDS_SuccessMessage 107
+
+/* EOF */