Author: janderwald
Date: Sat Aug 12 23:32:57 2006
New Revision: 23563
URL:
http://svn.reactos.org/svn/reactos?rev=23563&view=rev
Log:
* implement unattend switch for intl
* makes ReactOS gui setup run unattended (untill VmWare popsup)
Modified:
trunk/reactos/dll/cpl/intl/intl.c
trunk/reactos/dll/cpl/intl/intl.h
trunk/reactos/dll/cpl/intl/intl.rbuild
Modified: trunk/reactos/dll/cpl/intl/intl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/intl.c?rev=23…
==============================================================================
--- trunk/reactos/dll/cpl/intl/intl.c (original)
+++ trunk/reactos/dll/cpl/intl/intl.c Sat Aug 12 23:32:57 2006
@@ -26,6 +26,8 @@
#include <windows.h>
#include <commctrl.h>
#include <cpl.h>
+#include <setupapi.h>
+#include <tchar.h>
#include "intl.h"
#include "resource.h"
@@ -38,7 +40,7 @@
HINSTANCE hApplet = 0;
-
+HINF hSetupInf = INVALID_HANDLE_VALUE;
/* Applets */
APPLET Applets[NUM_APPLETS] =
@@ -58,6 +60,71 @@
psp->pfnDlgProc = DlgProc;
}
+BOOL
+OpenSetupInf()
+{
+ LPTSTR lpCmdLine;
+ LPTSTR lpSwitch;
+ size_t len;
+
+ lpCmdLine = GetCommandLine();
+
+ lpSwitch = _tcsstr(lpCmdLine, _T("/f:\""));
+
+ if(!lpSwitch)
+ {
+ return FALSE;
+ }
+
+ len = _tcslen(lpSwitch);
+ if (len < 5)
+ {
+ return FALSE;
+ }
+
+ if(lpSwitch[len-1] != _T('\"'))
+ {
+ return FALSE;
+ }
+
+ lpSwitch[len-1] = _T('\0');
+
+ hSetupInf = SetupOpenInfFile(&lpSwitch[4],
+ NULL,
+ INF_STYLE_OLDNT,
+ NULL);
+
+ return (hSetupInf != INVALID_HANDLE_VALUE);
+}
+
+LONG ParseSetupInf()
+{
+ INFCONTEXT InfContext;
+ INT LocaleID;
+ TCHAR szBuffer[30];
+
+ if (!SetupFindFirstLine(hSetupInf,
+ _T("Unattend"),
+ _T("LocaleID"),
+ &InfContext))
+ {
+ return -1;
+ }
+
+ if (!SetupGetStringField(&InfContext,
+ 1,
+ szBuffer,
+ sizeof(szBuffer) / sizeof(TCHAR),
+ NULL))
+ {
+ return -1;
+ }
+ LocaleID = _ttoi(szBuffer);
+ SetNewLocale((LCID)LocaleID);
+ SetupCloseInfFile(hSetupInf);
+
+ return 0;
+}
LONG APIENTRY
Applet(HWND hwnd, UINT uMsg, LONG wParam, LONG lParam)
@@ -65,6 +132,11 @@
PROPSHEETPAGE psp[6];
PROPSHEETHEADER psh;
TCHAR Caption[256];
+
+ if (OpenSetupInf())
+ {
+ return ParseSetupInf();
+ }
LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
Modified: trunk/reactos/dll/cpl/intl/intl.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/intl.h?rev=23…
==============================================================================
--- trunk/reactos/dll/cpl/intl/intl.h (original)
+++ trunk/reactos/dll/cpl/intl/intl.h Sat Aug 12 23:32:57 2006
@@ -55,6 +55,9 @@
WPARAM wParam,
LPARAM lParam);
+
+void SetNewLocale(LCID lcid);
+
#endif /* __CPL_INTL_H */
/* EOF */
Modified: trunk/reactos/dll/cpl/intl/intl.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/intl/intl.rbuild?r…
==============================================================================
--- trunk/reactos/dll/cpl/intl/intl.rbuild (original)
+++ trunk/reactos/dll/cpl/intl/intl.rbuild Sat Aug 12 23:32:57 2006
@@ -11,6 +11,7 @@
<library>user32</library>
<library>comctl32</library>
<library>advapi32</library>
+ <library>setupapi</library>
<file>currency.c</file>
<file>date.c</file>
<file>general.c</file>