Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 705171
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T04:01:24+00:00 2026-05-14T04:01:24+00:00

I’m using the WinAPI to set the time zone on a Windows XP SP3

  • 0

I’m using the WinAPI to set the time zone on a Windows XP SP3 box. I’m reading the time zone information from the HKLM\Software\Microsoft\WindowsNT\Time Zones\<time zone name> key and then setting the time zone to the specified time zone.

I enumerate the keys under the Time Zones key, grab the TZI value and stuff it into a TIME_ZONE_INFORMATION struct to be passed to SetTimeZoneInformation. All seems to work on the first pass. The time zone changes, no error is returned.

The second time I perform this operation (same user, new session, on login before userinit) the call succeeds but the system does not reflect the time zone change. Neither the clock nor time stamps on files are updated to the new time zone. When I navigate to:
HKLM\System\CurrentControlSet\Control\TimeZoneInformation my new time zone information is present.

A couple strange things are happening when I’m setting my time zone:

  • Also when I parse the TZI binary value from the registry to store in my TIME_ZONE_INFORMATION struct I’m noticing the struct has the DaylightDate.wDay and StandardDate.wDay field always set to 0
  • I tried to call GetTimeZoneInformation right after I call SetTimeZoneInformation but the call fails with a 1300 error (Not all privileges or groups referenced are assigned to the caller. )

I’m also making sure to send a WM_BROADCAST message so Explorer knows whats going on.

Think it’s the parsing of the byte array to the TIME_ZONE_INFORMATION struct? Or am I missing some thing else important?

EDIT:

Found a document stating why this is happening: here. Privilege was introduced in Vista…thanks MSDN docs…

Per the Microsoft documentation
I’m enabling the SE_TIME_ZONE_NAME
privilege for the current processes
token. But when I attempt to call
LookupPriviledgeValue for
SE_TIME_ZONE_NAME I get a 1313
error (A specified privilege does
not exist. ).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T04:01:25+00:00Added an answer on May 14, 2026 at 4:01 am

    After messing with this for awhile I’ve fixed the issue but I’m not quite sure what step fixed it. I added an extra clause to check the OS to verify whether or not to adjust the process token to enable the SE_TIME_ZONE_NAME. It now only does this on post-XP OS’s.

    I also changed how the TZI registry value was stored into my struct. I realized that on the TIME_ZONE_INFORMATION MSDN document is contained the struct that is used for the registry verison (REG_TZI_FORMAT). Simply reading the binary value straight into the struct eliminated a bit of code.

    I also guaranteed that BOTH DaylightName and StandardName were populated.

    Finally I called a RegFlushKey(HKEY_LOCAL_MACHINE) right after the SetTimeZoneInformation call. After taking these steps the time zone is changing as expected.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am reading a book about Javascript and jQuery and using one of the
I have a view passing on information from a database: def serve_article(request, id): served_article
I'm new to using the Perl treebuilder module for HTML parsing and can't figure
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
We're building an app, our first using Rails 3, and we're having to build
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.