[ros-diffs] [greatlrd] 15243: Remove all hardcode string to En.rc

greatlrd at svn.reactos.com greatlrd at svn.reactos.com
Thu May 12 21:31:12 CEST 2005


Remove all hardcode string to En.rc 
so it can be translate
Added: trunk/reactos/subsys/system/rundll32/En.rc
Added: trunk/reactos/subsys/system/rundll32/resource.h
Modified: trunk/reactos/subsys/system/rundll32/rundll32.c
  _____  

Added: trunk/reactos/subsys/system/rundll32/En.rc
--- trunk/reactos/subsys/system/rundll32/En.rc	2005-05-12 18:20:41 UTC
(rev 15242)
+++ trunk/reactos/subsys/system/rundll32/En.rc	2005-05-12 19:31:10 UTC
(rev 15243)
@@ -0,0 +1,12 @@

+#include "resource.h"
+/*
+ * Moved all hardcoded strings to En.rc.
+ * By Magnus Olsen  2005 magnus at itkonsult-olsen.com
+ */
+
+LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
+STRINGTABLE DISCARDABLE
+{
+IDS_DllNotLoaded,   "LoadLibrary failed to load \'%s\'"
+IDS_MissingEntry, "Missing entry point:%s\nIn %s"
+}
  _____  

Added: trunk/reactos/subsys/system/rundll32/resource.h
--- trunk/reactos/subsys/system/rundll32/resource.h	2005-05-12
18:20:41 UTC (rev 15242)
+++ trunk/reactos/subsys/system/rundll32/resource.h	2005-05-12
19:31:10 UTC (rev 15243)
@@ -0,0 +1,7 @@

+
+
+#define RC_STRING_MAX_SIZE                 200
+#define IDS_DllNotLoaded                   100
+#define IDS_MissingEntry                   101
+
+/* EOF */
  _____  

Modified: trunk/reactos/subsys/system/rundll32/rundll32.c
--- trunk/reactos/subsys/system/rundll32/rundll32.c	2005-05-12
18:20:41 UTC (rev 15242)
+++ trunk/reactos/subsys/system/rundll32/rundll32.c	2005-05-12
19:31:10 UTC (rev 15243)
@@ -28,6 +28,7 @@

 #include <string.h>
 #include <malloc.h>
 #include <tchar.h>
+#include "resource.h"
 
 typedef int (WINAPI *DllWinMainW)(
   HWND hWnd,
@@ -42,13 +43,17 @@
   int nCmdShow
 );
 
+/*
 LPCTSTR DllNotLoaded = _T("LoadLibrary failed to load \"%s\"");
 LPCTSTR MissingEntry = _T("Missing entry point:%s\nIn %s");
+*/
 LPCTSTR rundll32_wtitle = _T("rundll32");
 LPCTSTR rundll32_wclass = _T("rundll32_window");
+
 TCHAR ModuleFileName[MAX_PATH+1];
 LPTSTR ModuleTitle;
 
+
 // CommandLineToArgv converts a command-line string to argc and
 // argv similar to the ones in the standard main function.
 // This is a specialized version coded specifically for rundll32
@@ -327,6 +332,8 @@
 )
 {
 	int argc;
+	TCHAR szMsg[RC_STRING_MAX_SIZE];
+
 	LPTSTR *argv;
 	LPTSTR lptCmdLine,lptDllName,lptFuncName,lptMsgBuffer;
 	LPSTR lpFuncName,lpaCmdLine;
@@ -440,8 +447,10 @@
 		else {
 			// The specified dll function was not found;
display an error message
 			GetModuleTitle();
-			lptMsgBuffer =
(LPTSTR)malloc((_tcslen(MissingEntry) - 4 + _tcslen(lptFuncName) +
_tcslen(lptDllName) + 1) * sizeof(TCHAR));
-
_stprintf(lptMsgBuffer,MissingEntry,lptFuncName,lptDllName);
+            LoadString( GetModuleHandle(NULL), IDS_MissingEntry,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+
+			lptMsgBuffer = (LPTSTR)malloc((_tcslen(szMsg) -
4 + _tcslen(lptFuncName) + _tcslen(lptDllName) + 1) * sizeof(TCHAR));
+
_stprintf(lptMsgBuffer,szMsg,lptFuncName,lptDllName);
 
MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONERROR);
 			free(lptMsgBuffer);
 		}
@@ -455,8 +464,11 @@
 	else {
 		// The dll could not be loaded; display an error message
 		GetModuleTitle();
-		lptMsgBuffer = (LPTSTR)malloc((_tcslen(DllNotLoaded) - 2
+ _tcslen(lptDllName) + 1) * sizeof(TCHAR));
-		_stprintf(lptMsgBuffer,DllNotLoaded,lptDllName);
+		LoadString( GetModuleHandle(NULL), IDS_DllNotLoaded,
(LPTSTR) szMsg,RC_STRING_MAX_SIZE);
+
+		lptMsgBuffer = (LPTSTR)malloc((_tcslen(szMsg) - 2 +
_tcslen(lptDllName) + 1) * sizeof(TCHAR));
+		_stprintf(lptMsgBuffer,szMsg,lptDllName);
+		
 		MessageBox(0,lptMsgBuffer,ModuleTitle,MB_ICONERROR);
 		free(lptMsgBuffer);
 	}
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.reactos.org/pipermail/ros-diffs/attachments/20050512/d3716451/attachment.html


More information about the Ros-diffs mailing list