Time zone and locality - Win7PE
#1
Posted 23 May 2011 - 03:23 AM
Is it possible to get the time zone and locality from the system I'm building Win7PE from?
Thanks in advance.
Ozziegirl.
#2
Posted 23 May 2011 - 03:43 AM
Assuming you mean Win7PE_SE project, there is 'Retrieve More Localized Info' script under Build section which should do just that. There is no configuration needed, is it not working for you?
#3
Posted 23 May 2011 - 03:57 AM
No, The time zone and locality are USA. (I need Australia)
I am just doing a rebuild to check again.
#4
Posted 23 May 2011 - 04:15 AM
Time setting in Win7PE is:
(UTC -08:00) Pacific Time (US & Canada)
Location setting in Win7PE is:
United States.
My location is Brisbane Austrlia.
#5
Posted 23 May 2011 - 05:13 AM
#6
Posted 23 May 2011 - 05:27 AM
#7
Posted 23 May 2011 - 06:18 AM
1. the time zone infrormations are stored under the reg key:
'HKLM\SYSTEM\ControlSet001\Control\TimeZoneInformation'
2. in Win7PE_SE project the file 'w32time.dll' is missing
so should add the files 'system32\w32time.dll' and 'system32\%DistLang%\w32time.dll.mui' to the project
3. to allow to start the W32Time service should set the registry permission on the '\services\W32Time' key in your PE
e.g.:
[codebox]RegHiveLoad,"WB-System","%RegSystem%"
ShellExecute,Hide,"%WindowsDir%\system32\cmd.exe","/c #$qSetACL.exe -on #$qHKEY_LOCAL_MACHINE\WB-System\ControlSet001\services\W32Time#$q -ot reg -rec yes -actn ace -ace #$qn:S-1-1-0;p:full;s:y#$q#$q","%Tools%\%OSArch%"
RegHiveUnLoad,"WB-System"[/codebox]
#8
Posted 23 May 2011 - 09:26 AM
I added the Windows Time service with w32time.dll (+ mui) and permissions.
Thank you for trying with your Australian source ozziegirl (by replacing the script 1-files and 2-Config).
w32time.7z 4.2MB 552 downloads
In fact, the time zone infrormations are stored under the reg key:
'HKLM\SYSTEM\ControlSet001\Control\TimeZoneInformation'
Can you look at the values you have in your HostOS and your Win7Pe.
#9
Posted 23 May 2011 - 12:09 PM
The W32Time service works.
I can change the time zone and location when booted in the Win7PE environment.
I can manually add the reg keys needed for time zone and location during the build.
It would be nice if 'Retrieve More Localized Info' script under Build section, grabbed this info for me.
#10
Posted 23 May 2011 - 02:01 PM
Inside the key 'HKLM\SYSTEM\ControlSet001\Control\TimeZoneInformation' from system hive.
I don't have an Australian source DVD to test and check these values (that looks like an en-US dvd).
You can indeed update these keys during build process, but many reg values come from the original boot.wim.
#11
Posted 23 May 2011 - 07:02 PM
I think Amalux got it wrong at the start of the thread, since I think that the request was to have the local information come from the BUILD machine, not the SOURCE of the PE...You can indeed update these keys during build process, but many reg values come from the original boot.wim.
As Chris stated, the defaults already come from the source being used, which is what the "Retrieve More Localized Info" script says it is going to do. If that is the case, then (for example) this is why all the US "english" sources assume that the default that it is PACIFIC timezone...My guess is that other "languages" also make some sort of assumption...
Not sure if this is a "main configuration" screen setting or if a tweak script or even put it on this page? But clearly, something on the whole timezone issue isn't quite "right".
#12
Posted 23 May 2011 - 07:29 PM
#13
Posted 24 May 2011 - 09:59 AM
for info, the'Retrieve More Localized Info' extract location information from the source but not those.
The right informations seem to be in install.wim (in offline system hive) or in the HostOS.
By cons to extract them, I have an issues with WB 80 , errors with regread, regwrite binary data :
it works well for other key.
If,Not,ExistDir,%ProjectTemp%\RWHive,DirMake,%ProjectTemp%\RWHive FileCopy,%InstallSRC%\Windows\system32\config\system,%ProjectTemp%\RWHive RegHiveLoad,WB-SYST,%ProjectTemp%\RWHive\system If,ExistRegKey,HKLM,WB-SYST\ControlSet001\Control\TimeZoneInformation,DaylightStart,RegRead,HKLM,WB-SYST\ControlSet001\Control\TimeZoneInformation,DaylightStart,%DaylightStart% If,ExistRegKey,HKLM,WB-SYST\ControlSet001\Control\TimeZoneInformation,StandardStart,RegRead,HKLM,WB-SYST\ControlSet001\Control\TimeZoneInformation,StandardStart,%StandardStart% RegHiveunLoad,WB-SYST // StrFormat,REPLACE,%DaylightStart%,#$q,,%DaylightStart% StrFormat,REPLACE,%StandardStart%,#$q,,%StandardStart% RegHiveLoad,WB-System,%RegSystem% If,Not,%DaylightStart%,Equal,,RegWrite,HKLM,0x3,WB-System\ControlSet001\Control\TimeZoneInformation,DaylightStart,%DaylightStart% If,Not,%StandardStart%,Equal,,RegWrite,HKLM,0x3,WB-System\ControlSet001\Control\TimeZoneInformation,StandardStart,%StandardStart% RegHiveUnLoad,WB-SystemAfter searching for over 2 hours I found this topic that talks about the problem .
I also tried by adding StrFormat,LEFT,%StandardStart%,47,%StandardStart% nothing to do.
Is there a workaround ?
ps: it seems to work correctly with beta WinBuilder_110520 .
#14
Posted 24 May 2011 - 04:08 PM
I guess I would have said that it's "correct", just not what was expectedAfter looking in more detail, the time zone information used from boot.wim are not correct.
for info, the 'Retrieve More Localized Info' extract location information from the source but not those.
To me, as I was also thinking about this, I decided it was probably just best to use an export of the entire timzone key, then use reg2WBSprg to convert it to a set of script lines, and then just execute that script...The right information seem to be in install.wim (in offline system hive) or in the HostOS.
Seems to work OK...Yes, it means adding the executable to the script to be extracted, but it's not very large...(51K)...
[GetLocalTimeZone] // Use the HOST OS to set the PE timezone... If,Not,EXISTDIR,%LCIDUtildir%,DirMake,%LCIDUtildir% If,Not,EXISTDIR,%LocalizeInfoTemp%,DirMake,%LocalizeInfoTemp% If,EXISTFILE,"%LocalizeInfoTemp%\TimeZone.reg",FileDelete,"%LocalizeInfoTemp%\TimeZone.reg",NOWARN ShellExecute,Hide,reg,"export HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation #$q%LocalizeInfoTemp%\TimeZone.reg#$q" ExtractFile,%ScriptFile%,Folder,reg2wbsprg.exe,%LocalizeInfoTemp% ShellExecute,Hide,#$q%LocalizeInfoTemp%\reg2wbsprg.exe#$q,"-h -e -r -f#$q%LocalizeInfoTemp%\TimeZone.reg#$q -o#$q%LocalizeInfoTemp%\TimeZone.script#$q" Run,"%LocalizeInfoTemp%\TimeZone.script",Process
Double checking on 80 right now, but since the script created doesn't use any variables to try to store the data, there shouldn't be any syntax issues...
#15
Posted 24 May 2011 - 04:30 PM
I guess I would have said that it's "correct", just not what was expected
To me, as I was also thinking about this, I decided it was probably just best to use an export of the entire timzone key, then use reg2WBSprg to convert it to a set of script lines, and then just execute that script...
Seems to work OK...Yes, it means adding the executable to the script to be extracted, but it's not very large...(51K)...[GetLocalTimeZone] // Use the HOST OS to set the PE timezone... If,Not,EXISTDIR,%LCIDUtildir%,DirMake,%LCIDUtildir% If,Not,EXISTDIR,%LocalizeInfoTemp%,DirMake,%LocalizeInfoTemp% If,EXISTFILE,"%LocalizeInfoTemp%\TimeZone.reg",FileDelete,"%LocalizeInfoTemp%\TimeZone.reg",NOWARN ShellExecute,Hide,reg,"export HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\TimeZoneInformation #$q%LocalizeInfoTemp%\TimeZone.reg#$q" ExtractFile,%ScriptFile%,Folder,reg2wbsprg.exe,%LocalizeInfoTemp% ShellExecute,Hide,#$q%LocalizeInfoTemp%\reg2wbsprg.exe#$q,"-h -e -r -f#$q%LocalizeInfoTemp%\TimeZone.reg#$q -o#$q%LocalizeInfoTemp%\TimeZone.script#$q" Run,"%LocalizeInfoTemp%\TimeZone.script",Process
Double checking on 80 right now, but since the script created doesn't use any variables to try to store the data, there shouldn't be any syntax issues...
Peter
#16
Posted 24 May 2011 - 04:54 PM
ShellExecute,Hide,#$q%LocalizeInfoTemp%\reg2wbsprg.exe#$q,"-h -e -a -r -f#$q%LocalizeInfoTemp%\TimeZone.reg#$q -o#$q%LocalizeInfoTemp%\TimeZone.script#$q"
#17
Posted 24 May 2011 - 09:23 PM
I resolved this Bug WB 80, at first step before your posts with reg export - txtreplace and reg import :
[TimeZone] If,Not,ExistDir,%ProjectTemp%\RWHive,DirMake,%ProjectTemp%\RWHive FileCopy,%InstallSRC%\Windows\system32\config\system,%ProjectTemp%\RWHive RegHiveLoad,WB-SYST,%ProjectTemp%\RWHive\system ShellExecute,hide,%RegeditexeFolder%regedit.exe,"/a #$q%ProjectTemp%\RWHive\TimeZone.reg#$q HKEY_LOCAL_MACHINE\WB-SYST\ControlSet001\Control\TimeZoneInformation" RegHiveunLoad,WB-SYST TXTReplace,%ProjectTemp%\RWHive\TimeZone.reg,[HKEY_LOCAL_MACHINE\WB-SYST\ControlSet001\Control\TimeZoneInformation],[HKEY_LOCAL_MACHINE\WB-System\ControlSet001\Control\TimeZoneInformation] RegHiveLoad,WB-System,%RegSystem% ShellExecute,hide,%RegeditexeFolder%regedit.exe,"/s #$q%ProjectTemp%\RWHive\TimeZone.reg#$q" RegHiveUnLoad,WB-System .....
And in a second time, with a workaround all written in WB (thanks Lancelot )
[TimeZone] If,Not,ExistDir,%ProjectTemp%\RWHive,DirMake,%ProjectTemp%\RWHive FileCopy,%InstallSRC%\Windows\system32\config\system,%ProjectTemp%\RWHive RegHiveLoad,WB-SYST,%ProjectTemp%\RWHive\system If,ExistRegKey,HKLM,WB-SYST\ControlSet001\Control\TimeZoneInformation,DaylightStart,RegRead,HKLM,WB-SYST\ControlSet001\Control\TimeZoneInformation,DaylightStart,%DaylightStart% RegHiveunLoad,WB-SYST // StrFormat,REPLACE,%DaylightStart%,#$q,,%DaylightStart% // Set,%w%,%ProjectTemp%\RWHive\TimeZone.txt If,ExistFile,%w%,CapiC,FileDelete,%w% If,ExistFile,%w%,Exit,"%w% NOT Deleted - Exit" FileCreateBlank,%w% TxtAddline,%w%,[WriteReg],Append If,Not,%DaylightStart%,Equal,,Run,%scriptfile%,TimeZone_DayLightStart // RegHiveLoad,Tmp_System,%RegSystem% Run,%w%,WriteReg RegHiveUnLoad,Tmp_System [TimeZone_DayLightStart] TxtAddline,%w%,"RegWrite,HKLM,0x3,Tmp_System\ControlSet001\Control\TimeZoneInformation,DaylightStart,%DaylightStart%",AppendSame for the binary value StandardStart.
This works well without any external program .
Here are the scripts changed (1-files & locale) with the new time zone information executed for sytem locale = "Auto" in main configuration.
Edit: attachment deleted
Thank you for your feedback ozziegirl & carloscape, I have only fr-FR and en-US win7 source.
#18
Posted 24 May 2011 - 10:12 PM
Yes, but it also means you have to write more code and hard-code in all the sub-keys...the above approach works well for the entire branch exported and you don't have to care if MS decides in a service pack or some other foolish way to change things...This works well without any external program
BUT, important thing is that we have MANY ways to solve the problem, and all of them highlite different aspects that could be useful in some later approach...here you take a bit of the "external" approach by writing a script, you just use WB to write it! Since I had seen the reg2WBSprg when searching for something else, I thought of it. In this case, trade-off is hard-coding all the keys (bad), but no extra program (good!)...Can't fault your choice even if different than mine All depends on who has to maintain it (and that's YOU), so for adding this...Makes the time look "reasonable" again...
#19
Posted 25 May 2011 - 03:08 AM
I replaced the scripts 1-files & locale that you posted TimeZone.7z
I sorry to say I'm now getting this build error:
Run - Failed to find section [TimeZone_DayLightStart] in file: [%BaseDir%\Projects\Win7PE_SE\Build\1-files.Script]
Thanks for taking the time to resolve this issue.
#20
Posted 25 May 2011 - 12:18 PM
There is a new reg2WBSprg version 4.2.0 online.Just a quick note: Need to slightly modify the above (for now ) since we should probably use the API by adding the -A switch to reg2WBSprg (for now) to account for delta in location of the registry files!
ShellExecute,Hide,#$q%LocalizeInfoTemp%\reg2wbsprg.exe#$q,"-h -e -a -r -f#$q%LocalizeInfoTemp%\TimeZone.reg#$q -o#$q%LocalizeInfoTemp%\TimeZone.script#$q"
Replace the /a switch by a /7 switch.
This will give you correct API-free output for Win7 (and Vista) source CD.
Without the switch output is for XP source CD.
Peter
#21
Posted 25 May 2011 - 01:28 PM
This works well without any external program .
If,ExistFile,%w%,CapiC,FileDelete,%w%What do you think what CapiC is doing?
It starts a cmd shell.
Peter
#22
Posted 25 May 2011 - 02:21 PM
yes, I tested the script locally (with timezone) alone but it is called from another script (here, run,%ScriptFile%, don't work), Oouups my fault .I sorry to say I'm now getting this build error:
Run - Failed to find section [TimeZone_DayLightStart] in file: [%BaseDir%\Projects\Win7PE_SE\Build\1-files.Script]
Here is the corrected script, I hope.
TimeZone.7z 27.95KB 532 downloads
@Psc
The method certainly works well with an external program like reg2wbsprg.exe or open source autoit, but I think it is better, if not too complicated, to write it in native WB code or via regedit.exe for an entire branch of the registry.
By cons, for certain operations, an external program is needed to keep a slight WB syntax.
Sure, cmd.exe, regedit, reg, attrib,... are external program, if you want, but not quite of the same way .
Only my opinion.
#23
Posted 25 May 2011 - 02:23 PM
I get this to (on both 80 and 81 ) But it is a simple "fix"...Just replace %Scriptfile% with %LocaleScript% on the two lines where the new locale.script tries to use an internal routine... This is because the variable %Scriptfile% refers to the current script that WB has executed, and not always the current script running I could see it go either way, since if you were just debugging the locale.script (and using WB to invoke it), the variable would be set to the locale.script...Hi ChrisR.
I replaced the scripts 1-files & locale that you posted TimeZone.7z
I sorry to say I'm now getting this build error:
Run - Failed to find section [TimeZone_DayLightStart] in file: [%BaseDir%\Projects\Win7PE_SE\Build\1-files.Script]
Thanks for taking the time to resolve this issue.
BTW, LocaleScript is just set in the script.project file, and serves a role similar to the API - it is a helper script...
Scott
#24
Posted 25 May 2011 - 03:24 PM
Maybe this should just be separated out to a "tweak"???
Scott
#25
Posted 25 May 2011 - 03:37 PM
But (for me anyway) the bigger issue is that it reads the information from the SOURCE, and not the HOST...For me (in the east coast), I still get a PE that is set to Pacific time zone...We really need an option to get it from the source OR the host!...
Maybe this should just be separated out to a "tweak"???
Scott
Same concerns I found, but I did not report, because I'm currently rather busy with tasks of a higher priority!
Peter
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users