Changeset 9593 for trunk/src/kernel32/time.cpp
- Timestamp:
- Jan 3, 2003, 12:26:43 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/time.cpp
r9561 r9593 1 /* $Id: time.cpp,v 1.2 3 2002-12-29 14:11:23 sandervl Exp $ */1 /* $Id: time.cpp,v 1.24 2003-01-03 11:26:43 sandervl Exp $ */ 2 2 3 3 /* … … 30 30 #include "unicode.h" 31 31 #include "oslibtime.h" 32 #include "winreg.h" 32 33 33 34 #define DBG_LOCALLOG DBG_time … … 183 184 //****************************************************************************** 184 185 //****************************************************************************** 186 DWORD TimeZoneName(LPSTR name, LPWSTR text, BOOL read) 187 { 188 CHAR AsciiText_1[32]; 189 CHAR AsciiText_2[32]; 190 HKEY hKeyOptions; 191 DWORD dwKeyType; 192 DWORD dwDataLength = sizeof(AsciiText_1); 193 DWORD dwDataLength_2; 194 BOOL Set = FALSE; 195 196 if (read) { 197 ZeroMemory(text, 2*sizeof(AsciiText_1)); 198 } 199 else { 200 UnicodeToAscii(text, &AsciiText_2[0]); 201 dwDataLength_2 = strlen(AsciiText_2); 202 } 203 DWORD rc = RegOpenKeyExA(HKEY_LOCAL_MACHINE, 204 "SOFTWARE\\TIME\\TIME_SETTING", 205 0, 206 (read) ? KEY_READ : KEY_ALL_ACCESS, 207 &hKeyOptions); 208 if (rc == ERROR_SUCCESS) 209 { 210 rc = RegQueryValueExA(hKeyOptions, 211 name, 212 0, 213 &dwKeyType, 214 (LPBYTE)AsciiText_1, 215 &dwDataLength); 216 if (rc == ERROR_SUCCESS) { 217 if (read) AsciiToUnicode(&AsciiText_1[0], text); 218 else Set = (strcmp(AsciiText_1,AsciiText_2) != 0); 219 } 220 else Set = (!read); 221 } 222 else { 223 if (!read) { 224 rc = RegCreateKeyA(HKEY_LOCAL_MACHINE, 225 "SOFTWARE\\TIME\\TIME_SETTING", 226 &hKeyOptions); 227 Set = (rc == ERROR_SUCCESS); 228 } 229 } 230 if (Set) rc = RegSetValueExA(hKeyOptions, 231 name, 232 0, 233 REG_SZ, 234 (LPBYTE)AsciiText_2, 235 dwDataLength_2); 236 237 RegCloseKey(hKeyOptions); 238 return rc; 239 } 240 //****************************************************************************** 185 241 DWORD WIN32API GetTimeZoneInformation(LPTIME_ZONE_INFORMATION lpTimeZone) 186 242 { 187 return O32_GetTimeZoneInformation(lpTimeZone); 243 DWORD ret = O32_GetTimeZoneInformation(lpTimeZone); 244 245 //Convert timezone names to unicode as WGSS (wrongly) returns ascii strings 246 TimeZoneName("STANDARD_NAME", &lpTimeZone->StandardName[0], TRUE); 247 TimeZoneName("DAYLIGHT_NAME", &lpTimeZone->DaylightName[0], TRUE); 248 return ret; 188 249 } 189 250 //****************************************************************************** … … 191 252 BOOL WIN32API SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION lpTimeZone) 192 253 { 254 //Convert timezone names to ascii as WGSS (wrongly) expects that 255 TimeZoneName("STANDARD_NAME", &lpTimeZone->StandardName[0], FALSE); 256 TimeZoneName("DAYLIGHT_NAME", &lpTimeZone->DaylightName[0], FALSE); 257 193 258 return O32_SetTimeZoneInformation(lpTimeZone); 194 259 } … … 216 281 //****************************************************************************** 217 282 283
Note:
See TracChangeset
for help on using the changeset viewer.