Jump to content











Photo
- - - - -

Time zone and locality - Win7PE


  • Please log in to reply
60 replies to this topic

#1 ozziegirl

ozziegirl
  • Members
  • 6 posts
  •  
    Australia

Posted 23 May 2011 - 03:23 AM

First of all thanks to the developers and contributers of Win7PE.
Is it possible to get the time zone and locality from the system I'm building Win7PE from?

Thanks in advance.

Ozziegirl.

#2 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 23 May 2011 - 03:43 AM

Hello and welcome :D

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 ozziegirl

ozziegirl
  • Members
  • 6 posts
  •  
    Australia

Posted 23 May 2011 - 03:57 AM

Thanks amalux for your fast reply.
No, The time zone and locality are USA. (I need Australia)
I am just doing a rebuild to check again.

#4 ozziegirl

ozziegirl
  • Members
  • 6 posts
  •  
    Australia

Posted 23 May 2011 - 04:15 AM

No it does not appear to be retrieving the right localized info.

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 amalux

amalux

    Platinum Member

  • Tutorial Writer
  • 2813 posts
  •  
    United States

Posted 23 May 2011 - 05:13 AM

Looking at the script, I see what it's supposed to do but I don't know why it's not working in your case. I don't have an Australian source to test so I'm not going to be of much help. Hopefully someone who has your source or one of the script authors can help you out soon. Good luck :D

#6 ozziegirl

ozziegirl
  • Members
  • 6 posts
  •  
    Australia

Posted 23 May 2011 - 05:27 AM

Thanks for trying amalux.

#7 dera

dera

    Gold Member

  • .script developer
  • 1335 posts
  •  
    Hungary

Posted 23 May 2011 - 06:18 AM

overall i think

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 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 784 posts
  •  
    France

Posted 23 May 2011 - 09:26 AM

Thank you Dera :frusty: ,
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).

Attached File  w32time.7z   4.2MB   547 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 ozziegirl

ozziegirl
  • Members
  • 6 posts
  •  
    Australia

Posted 23 May 2011 - 12:09 PM

Thanks dera and ChrisR.

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 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 784 posts
  •  
    France

Posted 23 May 2011 - 02:01 PM

Strange, the time zone informations come directly, in your case, from your file boot.wim of your Win7 source DVD.
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 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 23 May 2011 - 07:02 PM

You can indeed update these keys during build process, but many reg values come from the original boot.wim.

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...

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 carloscape

carloscape

    Frequent Member

  • Advanced user
  • 108 posts
  •  
    Honduras

Posted 23 May 2011 - 07:29 PM

I had a similar issue. The spanish dvd defaults to Spain and I am in Honduras. I basically just made a level 2 script to change the registry information after the 'Retrieve More Localized Info' script runs. I use it to set location, time zone and the keyboard I want to use. I make sure to set the '1- Copy Files' script to full and to add all keyboard and language files.

#13 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 784 posts
  •  
    France

Posted 24 May 2011 - 09:59 AM

After looking in more detail, the time zone informations used from boot.wim are not correct.
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-System
After searching for over 2 hours :white_flag: 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 :whistling: .

#14 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 24 May 2011 - 04:08 PM

After 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.

I guess I would have said that it's "correct", just not what was expected :confused1:

The right information seem to be in install.wim (in offline system hive) or in the HostOS.

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...

#15 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 24 May 2011 - 04:30 PM

I guess I would have said that it's "correct", just not what was expected :confused1:

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...

:cheers:

Peter

#16 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 24 May 2011 - 04:54 PM

Just a quick note: Need to slightly modify the above (for now :confused1: ) 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"



#17 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 784 posts
  •  
    France

Posted 24 May 2011 - 09:23 PM

thank you for your suggestions :confused1:

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 :cheers: )

[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%",Append
Same for the binary value StandardStart.
This works well without any external program :cheers: .


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 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 24 May 2011 - 10:12 PM

This works well without any external program :cheers:

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... :confused1:

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 :cheers: All depends on who has to maintain it (and that's YOU), so :( for adding this...Makes the time look "reasonable" again...

#19 ozziegirl

ozziegirl
  • Members
  • 6 posts
  •  
    Australia

Posted 25 May 2011 - 03:08 AM

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.

#20 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

Posted 25 May 2011 - 12:18 PM

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"

There is a new reg2WBSprg version 4.2.0 online.

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 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

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. :cheers:

Peter :thumbup:

#22 ChrisR

ChrisR

    Silver Member

  • .script developer
  • 784 posts
  •  
    France

Posted 25 May 2011 - 02:21 PM

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]

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 ;) .
Here is the corrected script, I hope.

Attached File  TimeZone.7z   27.95KB   525 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 Posted Image .
Only my opinion.

:)

#23 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 25 May 2011 - 02:23 PM

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.

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...

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 sbaeder

sbaeder

    Gold Member

  • .script developer
  • 1338 posts
  • Location:usa - massachusettes
  •  
    United States

Posted 25 May 2011 - 03:24 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

#25 pscEx

pscEx

    Platinum Member

  • Team Reboot
  • 12707 posts
  • Location:Korschenbroich, Germany
  • Interests:What somebody else cannot do.
  •  
    European Union

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




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users