Author: cfinck
Date: Wed Jul 18 22:40:07 2007
New Revision: 27721
URL:
http://svn.reactos.org/svn/reactos?rev=27721&view=rev
Log:
- Localize the Usage message of "shutdown" and add a german localization
- Also add a version resource
Translators, feel free to make translations for this tool :-)
Added:
trunk/reactos/base/applications/shutdown/lang/
trunk/reactos/base/applications/shutdown/lang/de-DE.rc
trunk/reactos/base/applications/shutdown/lang/en-US.rc
trunk/reactos/base/applications/shutdown/misc.c
trunk/reactos/base/applications/shutdown/precomp.h
trunk/reactos/base/applications/shutdown/resource.h
trunk/reactos/base/applications/shutdown/rsrc.rc
trunk/reactos/base/applications/shutdown/shutdown.rc
Modified:
trunk/reactos/base/applications/shutdown/shutdown.c
trunk/reactos/base/applications/shutdown/shutdown.rbuild
Added: trunk/reactos/base/applications/shutdown/lang/de-DE.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/shutdown…
==============================================================================
--- trunk/reactos/base/applications/shutdown/lang/de-DE.rc (added)
+++ trunk/reactos/base/applications/shutdown/lang/de-DE.rc Wed Jul 18 22:40:07 2007
@@ -1,0 +1,19 @@
+/*
+ * German language file by Colin Finck <2007-07-18>
+ */
+
+LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL
+
+STRINGTABLE DISCARDABLE
+{
+
+IDS_USAGE, "Syntax: shutdown [-?] [-l | -s | -r] [-f]\n\n\
+ Keine Argumente\tDiese Meldung anzeigen\n\
+ -?\t\t\tDiese Meldung anzeigen\n\
+ -l\t\t\tBenutzer abmelden\n\
+ -s\t\t\tComputer herunterfahren\n\
+ -r\t\t\tComputer herunterfahren und neu starten\n\
+ -f\t\t\tLaufende Anwendungen ohne Warnung schlieáen\n\
+ \t\t\tWenn Sie keine weiteren Parameter angegeben haben,\n\
+ \t\t\tmeldet Sie diese Option auch ab"
+}
Added: trunk/reactos/base/applications/shutdown/lang/en-US.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/shutdown…
==============================================================================
--- trunk/reactos/base/applications/shutdown/lang/en-US.rc (added)
+++ trunk/reactos/base/applications/shutdown/lang/en-US.rc Wed Jul 18 22:40:07 2007
@@ -1,0 +1,14 @@
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+
+STRINGTABLE DISCARDABLE
+{
+
+IDS_USAGE, "Usage: shutdown [-?] [-l | -s | -r] [-f]\n\n\
+ No arguments or -?\tDisplay this message\n\
+ -l\t\t\tLog off\n\
+ -s\t\t\tShutdown the computer\n\
+ -r\t\t\tShutdown and restart the computer\n\
+ -f\t\t\tForces running applications to close without warnings\n\
+ \t\t\tIf you did not specify any other parameter, this option\n\
+ \t\t\twill also log off"
+}
Added: trunk/reactos/base/applications/shutdown/misc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/shutdown…
==============================================================================
--- trunk/reactos/base/applications/shutdown/misc.c (added)
+++ trunk/reactos/base/applications/shutdown/misc.c Wed Jul 18 22:40:07 2007
@@ -1,0 +1,63 @@
+#include "precomp.h"
+
+static INT
+LengthOfStrResource(IN HINSTANCE hInst,
+ IN UINT uID)
+{
+ HRSRC hrSrc;
+ HGLOBAL hRes;
+ LPWSTR lpName, lpStr;
+
+ if (hInst == NULL)
+ {
+ return -1;
+ }
+
+ /* There are always blocks of 16 strings */
+ lpName = (LPWSTR)MAKEINTRESOURCE((uID >> 4) + 1);
+
+ /* Find the string table block */
+ if ((hrSrc = FindResourceW(hInst, lpName, (LPWSTR)RT_STRING)) &&
+ (hRes = LoadResource(hInst, hrSrc)) &&
+ (lpStr = (WCHAR*) LockResource(hRes)))
+ {
+ UINT x;
+
+ /* Find the string we're looking for */
+ uID &= 0xF; /* position in the block, same as % 16 */
+ for (x = 0; x < uID; x++)
+ {
+ lpStr += (*lpStr) + 1;
+ }
+
+ /* Found the string */
+ return (int)(*lpStr);
+ }
+ return -1;
+}
+
+INT
+AllocAndLoadString(OUT LPTSTR *lpTarget,
+ IN HINSTANCE hInst,
+ IN UINT uID)
+{
+ INT ln;
+
+ ln = LengthOfStrResource(hInst,
+ uID);
+ if (ln++ > 0)
+ {
+ (*lpTarget) = (LPTSTR)LocalAlloc(LMEM_FIXED,
+ ln * sizeof(TCHAR));
+ if ((*lpTarget) != NULL)
+ {
+ INT Ret;
+ if (!(Ret = LoadString(hInst, uID, *lpTarget, ln)))
+ {
+ LocalFree((HLOCAL)(*lpTarget));
+ }
+ return Ret;
+ }
+ }
+ return 0;
+}
Added: trunk/reactos/base/applications/shutdown/precomp.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/shutdown…
==============================================================================
--- trunk/reactos/base/applications/shutdown/precomp.h (added)
+++ trunk/reactos/base/applications/shutdown/precomp.h Wed Jul 18 22:40:07 2007
@@ -1,0 +1,16 @@
+#ifndef __SHUTDOWN_PRECOMP_H
+#define __SHUTDOWN_PRECOMP_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <windows.h>
+#include <tchar.h>
+#include <reason.h> //shutdown codes
+#include "resource.h"
+
+// misc.c
+INT AllocAndLoadString(OUT LPTSTR *lpTarget,
+ IN HINSTANCE hInst,
+ IN UINT uID);
+
+#endif
Added: trunk/reactos/base/applications/shutdown/resource.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/shutdown…
==============================================================================
--- trunk/reactos/base/applications/shutdown/resource.h (added)
+++ trunk/reactos/base/applications/shutdown/resource.h Wed Jul 18 22:40:07 2007
@@ -1,0 +1,1 @@
+#define IDS_USAGE 1000
Added: trunk/reactos/base/applications/shutdown/rsrc.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/shutdown…
==============================================================================
--- trunk/reactos/base/applications/shutdown/rsrc.rc (added)
+++ trunk/reactos/base/applications/shutdown/rsrc.rc Wed Jul 18 22:40:07 2007
@@ -1,0 +1,5 @@
+#include <windows.h>
+#include "resource.h"
+
+#include "lang/de-DE.rc"
+#include "lang/en-US.rc"
Modified: trunk/reactos/base/applications/shutdown/shutdown.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/shutdown…
==============================================================================
--- trunk/reactos/base/applications/shutdown/shutdown.c (original)
+++ trunk/reactos/base/applications/shutdown/shutdown.c Wed Jul 18 22:40:07 2007
@@ -5,23 +5,18 @@
* PURPOSE: Initiate logoff, shutdown or reboot of the system
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <windows.h>
-#include <tchar.h>
-#include <reason.h> //shutdown codes
+#include "precomp.h"
// Print information about which commandline arguments the program accepts.
static void PrintUsage() {
- _tprintf(_T("Usage: shutdown [-?] [-l | -s | -r] [-f]\n"));
- _tprintf(_T("\n No args or -?\t\tDisplay this message"));
- _tprintf(_T("\n -l\t\t\tLog off"));
- _tprintf(_T("\n -s\t\t\tShutdown the computer"));
- _tprintf(_T("\n -r\t\t\tShutdown and restart the computer"));
- _tprintf(_T("\n -f\t\t\tForces running applications to close without
warnings"));
- _tprintf(_T("\n \t\t\tIf you did not specify any other parameter, this
option"));
- _tprintf(_T("\n \t\t\twill also log off"));
- _tprintf(_T("\n"));
+ LPTSTR lpUsage = NULL;
+
+ if( AllocAndLoadString( &lpUsage,
+ GetModuleHandle(NULL),
+ IDS_USAGE ) )
+ {
+ _putts( lpUsage );
+ }
}
struct CommandLineOptions {
Modified: trunk/reactos/base/applications/shutdown/shutdown.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/shutdown…
==============================================================================
--- trunk/reactos/base/applications/shutdown/shutdown.rbuild (original)
+++ trunk/reactos/base/applications/shutdown/shutdown.rbuild Wed Jul 18 22:40:07 2007
@@ -7,5 +7,8 @@
<library>advapi32</library>
<library>user32</library>
<library>kernel32</library>
+ <file>misc.c</file>
<file>shutdown.c</file>
+ <file>shutdown.rc</file>
+ <pch>precomp.h</pch>
</module>
Added: trunk/reactos/base/applications/shutdown/shutdown.rc
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/shutdown…
==============================================================================
--- trunk/reactos/base/applications/shutdown/shutdown.rc (added)
+++ trunk/reactos/base/applications/shutdown/shutdown.rc Wed Jul 18 22:40:07 2007
@@ -1,0 +1,9 @@
+#include <windows.h>
+#include "resource.h"
+
+#define REACTOS_STR_FILE_DESCRIPTION "ReactOS Shutdown Utility\0"
+#define REACTOS_STR_INTERNAL_NAME "shutdown\0"
+#define REACTOS_STR_ORIGINAL_FILENAME "shutdown.exe\0"
+#include <reactos/version.rc>
+
+#include "rsrc.rc"