Description
- If you run datetime.cpl on Windows XP with Italian languages, some items in the timezone are missing, including my time zone. This happens because the text in the "Display" key is larger than 64 bytes. I modified it to 128 bytes and now all entries are listed in the combobox.
- On Windows Vista and later, the "Index" value in the subkeys under "SOFTWARE\\Microsoft
Windows NT\\CurrentVersion
Time Zones" does not exist. For this reason, the combobox on newer version is empty. The "Index" key is not described in the MSDN documentation:
https://msdn.microsoft.com/it-it/library/windows/desktop/ms725481%28v=vs.85%29.aspx
and evidently Microsoft does not recommend to use it.
Since this value is only used for inserting the items in the list in some order, I did a change so that now the items are sorted by Bias value and alphabetically if the above values are identical. It works on both XP and Win7 and it also looks nicer to read.
- Fix a possible memory leak if the search of the time zones is interrupted by a reason different by ERROR_NO_MORE_ITEMS.
- Simplified the code, by doing a RegLocalQuery() that also frees the registry key if a failure is detected.