From 08142b98ea4e7a401529f05b3f77ca250744ab36 Mon Sep 17 00:00:00 2001 From: Magnus Olsen Date: Thu, 12 May 2005 19:31:10 +0000 Subject: [PATCH] Remove all hardcode string to En.rc so it can be translate svn path=/trunk/; revision=15243 --- reactos/subsys/system/rundll32/En.rc | 12 ++++++++++++ reactos/subsys/system/rundll32/resource.h | 7 +++++++ reactos/subsys/system/rundll32/rundll32.c | 20 ++++++++++++++++---- 3 files changed, 35 insertions(+), 4 deletions(-) create mode 100644 reactos/subsys/system/rundll32/En.rc create mode 100644 reactos/subsys/system/rundll32/resource.h diff --git a/reactos/subsys/system/rundll32/En.rc b/reactos/subsys/system/rundll32/En.rc new file mode 100644 index 00000000000..cd1bd8e6386 --- /dev/null +++ b/reactos/subsys/system/rundll32/En.rc @@ -0,0 +1,12 @@ +#include "resource.h" +/* + * Moved all hardcoded strings to En.rc. + * By Magnus Olsen 2005 magnus@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" +} diff --git a/reactos/subsys/system/rundll32/resource.h b/reactos/subsys/system/rundll32/resource.h new file mode 100644 index 00000000000..303964ded0e --- /dev/null +++ b/reactos/subsys/system/rundll32/resource.h @@ -0,0 +1,7 @@ + + +#define RC_STRING_MAX_SIZE 200 +#define IDS_DllNotLoaded 100 +#define IDS_MissingEntry 101 + +/* EOF */ diff --git a/reactos/subsys/system/rundll32/rundll32.c b/reactos/subsys/system/rundll32/rundll32.c index dab36473829..cceafa88d53 100644 --- a/reactos/subsys/system/rundll32/rundll32.c +++ b/reactos/subsys/system/rundll32/rundll32.c @@ -28,6 +28,7 @@ #include #include #include +#include "resource.h" typedef int (WINAPI *DllWinMainW)( HWND hWnd, @@ -42,13 +43,17 @@ typedef int (WINAPI *DllWinMainA)( 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 WINAPI WinMain( ) { int argc; + TCHAR szMsg[RC_STRING_MAX_SIZE]; + LPTSTR *argv; LPTSTR lptCmdLine,lptDllName,lptFuncName,lptMsgBuffer; LPSTR lpFuncName,lpaCmdLine; @@ -440,8 +447,10 @@ int WINAPI WinMain( 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 @@ int WINAPI WinMain( 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); }