Don't fill colormap beyond end of screen depth.
[wine.git] / dlls / kernel / time.c
blob4ddace8fa04ec30c72195e7811ce2671113104b1
1 /*
2 * Win32 kernel functions
4 * Copyright 1995 Martin von Loewis and Cameron Heide
5 */
7 #include <string.h>
8 #include <unistd.h>
9 #include <stdlib.h>
10 #include <sys/time.h>
11 #include <sys/times.h>
12 #include "file.h"
13 #include "ntddk.h"
14 #include "winerror.h"
15 #include "winnls.h"
16 #include "wine/unicode.h"
17 #include "debugtools.h"
19 DEFAULT_DEBUG_CHANNEL(win32);
21 /* maximum time adjustment in seconds for SetLocalTime and SetSystemTime */
22 #define SETTIME_MAX_ADJUST 120
25 /* This structure is used to store strings that represent all of the time zones
26 in the world. (This is used to help GetTimeZoneInformation)
28 struct tagTZ_INFO
30 const char *psTZFromUnix;
31 WCHAR psTZWindows[32];
32 int bias;
33 int dst;
36 static const struct tagTZ_INFO TZ_INFO[] =
38 {"MHT",
39 {'D','a','t','e','l','i','n','e',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
40 -720, 0},
41 {"SST",
42 {'S','a','m','o','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
43 660, 0},
44 {"HST",
45 {'H','a','w','a','i','i','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
46 600, 0},
47 {"AKDT",
48 {'A','l','a','s','k','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
49 480, 1},
50 {"PDT",
51 {'P','a','c','i','f','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
52 420, 1},
53 {"MST",
54 {'U','S',' ','M','o','u','n','t','a','i','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
55 420, 0},
56 {"MDT",
57 {'M','o','u','n','t','a','i','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
58 360, 1},
59 {"CST",
60 {'C','e','n','t','r','a','l',' ','A','m','e','r','i','c','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
61 360, 0},
62 {"CDT",
63 {'C','e','n','t','r','a','l',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
64 300, 1},
65 {"COT",
66 {'S','A',' ','P','a','c','i','f','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
67 300, 0},
68 {"EDT",
69 {'E','a','s','t','e','r','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
70 240, 1},
71 {"EST",
72 {'U','S',' ','E','a','s','t','e','r','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
73 300, 0},
74 {"ADT",
75 {'A','t','l','a','n','t','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
76 180, 1},
77 {"VET",
78 {'S','A',' ','W','e','s','t','e','r','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
79 240, 0},
80 {"CLT",
81 {'P','a','c','i','f','i','c',' ','S','A',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
82 240, 0},
83 {"NDT",
84 {'N','e','w','f','o','u','n','d','l','a','n','d',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
85 150, 1},
86 {"BRT",
87 {'E','.',' ','S','o','u','t','h',' ','A','m','e','r','i','c','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
88 180, 0},
89 {"ART",
90 {'S','A',' ','E','a','s','t','e','r','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
91 180, 0},
92 {"WGST",
93 {'G','r','e','e','n','l','a','n','d',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
94 120, 1},
95 {"GST",
96 {'M','i','d','-','A','t','l','a','n','t','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
97 120, 0},
98 {"AZOST",
99 {'A','z','o','r','e','s',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
100 0, 1},
101 {"CVT",
102 {'C','a','p','e',' ','V','e','r','d','e',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
103 60, 0},
104 {"WET",
105 {'G','r','e','e','n','w','i','c','h',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
106 0, 0},
107 {"BST",
108 {'G','M','T',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
109 -60, 1},
110 {"GMT",
111 {'G','M','T',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
112 0, 0},
113 {"CEST",
114 {'C','e','n','t','r','a','l',' ','E','u','r','o','p','e',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
115 -120, 1},
116 {"WAT",
117 {'W','.',' ','C','e','n','t','r','a','l',' ','A','f','r','i','c','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
118 -60, 0},
119 {"EEST",
120 {'E','.',' ','E','u','r','o','p','e',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
121 -180, 1},
122 {"EET",
123 {'E','g','y','p','t',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
124 -120, 0},
125 {"CAT",
126 {'S','o','u','t','h',' ','A','f','r','i','c','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
127 -120, 0},
128 {"IST",
129 {'I','s','r','a','e','l',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
130 -120, 0},
131 {"ADT",
132 {'A','r','a','b','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
133 -240, 1},
134 {"AST",
135 {'A','r','a','b',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
136 -180, 0},
137 {"MSD",
138 {'R','u','s','s','i','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
139 -240, 1},
140 {"EAT",
141 {'E','.',' ','A','f','r','i','c','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
142 -180, 0},
143 {"IRST",
144 {'I','r','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
145 -270, 1},
146 {"GST",
147 {'A','r','a','b','i','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
148 -240, 0},
149 {"AZST",
150 {'C','a','u','c','a','s','u','s',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
151 -300, 1},
152 {"AFT",
153 {'A','f','g','h','a','n','i','s','t','a','n',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
154 -270, 0},
155 {"YEKST",
156 {'E','k','a','t','e','r','i','n','b','u','r','g',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
157 -360, 1},
158 {"PKT",
159 {'W','e','s','t',' ','A','s','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
160 -300, 0},
161 {"IST",
162 {'I','n','d','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
163 -330, 0},
164 {"NPT",
165 {'N','e','p','a','l',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
166 -345, 0},
167 {"ALMST",
168 {'N','.',' ','C','e','n','t','r','a','l',' ','A','s','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
169 -420, 1},
170 {"BDT",
171 {'C','e','n','t','r','a','l',' ','A','s','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
172 -360, 0},
173 {"LKT",
174 {'S','r','i',' ','L','a','n','k','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
175 -360, 0},
176 {"MMT",
177 {'M','y','a','n','m','a','r',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
178 -390, 0},
179 {"ICT",
180 {'S','E',' ','A','s','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
181 -420, 0},
182 {"KRAST",
183 {'N','o','r','t','h',' ','A','s','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
184 -480, 1},
185 {"CST",
186 {'C','h','i','n','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
187 -480, 0},
188 {"IRKST",
189 {'N','o','r','t','h',' ','A','s','i','a',' ','E','a','s','t',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
190 -540, 1},
191 {"SGT",
192 {'M','a','l','a','y',' ','P','e','n','i','n','s','u','l','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
193 -480, 0},
194 {"WST",
195 {'W','.',' ','A','u','s','t','r','a','l','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
196 -480, 0},
197 {"JST",
198 {'T','o','k','y','o',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
199 -540, 0},
200 {"KST",
201 {'K','o','r','e','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
202 -540, 0},
203 {"YAKST",
204 {'Y','a','k','u','t','s','k',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
205 -600, 1},
206 {"CST",
207 {'C','e','n','.',' ','A','u','s','t','r','a','l','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
208 -570, 0},
209 {"EST",
210 {'E','.',' ','A','u','s','t','r','a','l','i','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
211 -600, 0},
212 {"GST",
213 {'W','e','s','t',' ','P','a','c','i','f','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
214 -600, 0},
215 {"VLAST",
216 {'V','l','a','d','i','v','o','s','t','o','k',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
217 -660, 1},
218 {"MAGST",
219 {'C','e','n','t','r','a','l',' ','P','a','c','i','f','i','c',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
220 -720, 1},
221 {"NZST",
222 {'N','e','w',' ','Z','e','a','l','a','n','d',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
223 -720, 0},
224 {"FJT",
225 {'F','i','j','i',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
226 -720, 0},
227 {"TOT",
228 {'T','o','n','g','a',' ','S','t','a','n','d','a','r','d',' ','T','i','m','e','\0'},
229 -780, 0}
232 /* TIME_GetTZAsStr: helper function that returns the given timezone as a string.
233 This could be done with a hash table instead of merely iterating through
234 a table, however with the small amount of entries (60 or so) I didn't think
235 it was worth it. */
236 static const WCHAR* TIME_GetTZAsStr (time_t utc, int bias, int dst)
238 char psTZName[7];
239 struct tm *ptm = localtime(&utc);
240 int i;
242 if (!strftime (psTZName, 7, "%Z", ptm))
243 return (NULL);
245 for (i=0; i<(sizeof(TZ_INFO) / sizeof(struct tagTZ_INFO)); i++)
247 if ( strcmp(TZ_INFO[i].psTZFromUnix, psTZName) == 0 &&
248 TZ_INFO[i].bias == bias &&
249 TZ_INFO[i].dst == dst
251 return TZ_INFO[i].psTZWindows;
254 return (NULL);
258 /* TIME_GetBias: helper function calculates delta local time from UTC */
259 static int TIME_GetBias( time_t utc, int *pdaylight)
261 struct tm *ptm = localtime(&utc);
262 *pdaylight = ptm->tm_isdst; /* daylight for local timezone */
263 ptm = gmtime(&utc);
264 ptm->tm_isdst = *pdaylight; /* use local daylight, not that of Greenwich */
265 return (int)(utc-mktime(ptm));
269 /***********************************************************************
270 * SetLocalTime (KERNEL32.@)
272 * Sets the local time using current time zone and daylight
273 * savings settings.
275 * RETURNS
277 * True if the time was set, false if the time was invalid or the
278 * necessary permissions were not held.
280 BOOL WINAPI SetLocalTime(
281 const SYSTEMTIME *systime) /* [in] The desired local time. */
283 struct timeval tv;
284 struct tm t;
285 time_t sec;
286 time_t oldsec=time(NULL);
287 int err;
289 /* get the number of seconds */
290 t.tm_sec = systime->wSecond;
291 t.tm_min = systime->wMinute;
292 t.tm_hour = systime->wHour;
293 t.tm_mday = systime->wDay;
294 t.tm_mon = systime->wMonth - 1;
295 t.tm_year = systime->wYear - 1900;
296 t.tm_isdst = -1;
297 sec = mktime (&t);
299 /* set the new time */
300 tv.tv_sec = sec;
301 tv.tv_usec = systime->wMilliseconds * 1000;
303 /* error and sanity check*/
304 if( sec == (time_t)-1 || abs((int)(sec-oldsec)) > SETTIME_MAX_ADJUST ){
305 err = 1;
306 SetLastError(ERROR_INVALID_PARAMETER);
307 } else {
308 err=settimeofday(&tv, NULL); /* 0 is OK, -1 is error */
309 if(err == 0)
310 return TRUE;
311 SetLastError(ERROR_PRIVILEGE_NOT_HELD);
313 ERR("Cannot set time to %d/%d/%d %d:%d:%d Time adjustment %ld %s\n",
314 systime->wYear, systime->wMonth, systime->wDay, systime->wHour,
315 systime->wMinute, systime->wSecond,
316 sec-oldsec, err == -1 ? "No Permission" :
317 sec==(time_t)-1 ? "" : "is too large." );
318 return FALSE;
322 /***********************************************************************
323 * GetSystemTimeAdjustment (KERNEL32.@)
325 * Indicates the period between clock interrupt and the amount the clock
326 * is adjusted each interrupt so as to keep it insync with an external source.
328 * RETURNS
330 * Always returns true.
332 * BUGS
334 * Only the special case of disabled time adjustments is supported.
335 * (also the signature is wrong it should have a return type of BOOL)
337 DWORD WINAPI GetSystemTimeAdjustment(
338 LPDWORD lpTimeAdjustment, /* [out] The clock adjustment per interupt in 100's of nanoseconds. */
339 LPDWORD lpTimeIncrement, /* [out] The time between clock interupts in 100's of nanoseconds. */
340 LPBOOL lpTimeAdjustmentDisabled) /* [out] The clock synchonisation has been disabled. */
342 *lpTimeAdjustment = 0;
343 *lpTimeIncrement = 0;
344 *lpTimeAdjustmentDisabled = TRUE;
345 return TRUE;
349 /***********************************************************************
350 * SetSystemTime (KERNEL32.@)
352 * Sets the system time (utc).
354 * RETURNS
356 * True if the time was set, false if the time was invalid or the
357 * necessary permissions were not held.
359 BOOL WINAPI SetSystemTime(
360 const SYSTEMTIME *systime) /* [in] The desired system time. */
362 struct timeval tv;
363 struct timezone tz;
364 struct tm t;
365 time_t sec, oldsec;
366 int dst, bias;
367 int err;
369 /* call gettimeofday to get the current timezone */
370 gettimeofday(&tv, &tz);
371 oldsec=tv.tv_sec;
372 /* get delta local time from utc */
373 bias=TIME_GetBias(oldsec,&dst);
375 /* get the number of seconds */
376 t.tm_sec = systime->wSecond;
377 t.tm_min = systime->wMinute;
378 t.tm_hour = systime->wHour;
379 t.tm_mday = systime->wDay;
380 t.tm_mon = systime->wMonth - 1;
381 t.tm_year = systime->wYear - 1900;
382 t.tm_isdst = dst;
383 sec = mktime (&t);
384 /* correct for timezone and daylight */
385 sec += bias;
387 /* set the new time */
388 tv.tv_sec = sec;
389 tv.tv_usec = systime->wMilliseconds * 1000;
391 /* error and sanity check*/
392 if( sec == (time_t)-1 || abs((int)(sec-oldsec)) > SETTIME_MAX_ADJUST ){
393 err = 1;
394 SetLastError(ERROR_INVALID_PARAMETER);
395 } else {
396 err=settimeofday(&tv, NULL); /* 0 is OK, -1 is error */
397 if(err == 0)
398 return TRUE;
399 SetLastError(ERROR_PRIVILEGE_NOT_HELD);
401 ERR("Cannot set time to %d/%d/%d %d:%d:%d Time adjustment %ld %s\n",
402 systime->wYear, systime->wMonth, systime->wDay, systime->wHour,
403 systime->wMinute, systime->wSecond,
404 sec-oldsec, err == -1 ? "No Permission" :
405 sec==(time_t)-1 ? "" : "is too large." );
406 return FALSE;
410 /***********************************************************************
411 * GetTimeZoneInformation (KERNEL32.@)
413 * Fills in the a time zone information structure with values based on
414 * the current local time.
416 * RETURNS
418 * The daylight savings time standard or TIME_ZONE_ID_INVALID if the call failed.
420 DWORD WINAPI GetTimeZoneInformation(
421 LPTIME_ZONE_INFORMATION tzinfo) /* [out] The time zone structure to be filled in. */
423 time_t gmt;
424 int bias, daylight;
425 const WCHAR *psTZ;
428 memset(tzinfo, 0, sizeof(TIME_ZONE_INFORMATION));
430 gmt = time(NULL);
431 bias=TIME_GetBias(gmt,&daylight);
433 tzinfo->Bias = -bias / 60;
434 tzinfo->StandardBias = 0;
435 tzinfo->DaylightBias = -60;
436 psTZ = TIME_GetTZAsStr (gmt, (-bias/60), daylight);
437 if (psTZ) strcpyW( tzinfo->StandardName, psTZ );
438 return TIME_ZONE_ID_STANDARD;
442 /***********************************************************************
443 * SetTimeZoneInformation (KERNEL32.@)
445 * Set the local time zone with values based on the time zone structure.
447 * RETURNS
449 * True on successful setting of the time zone.
451 * BUGS
453 * Use the obsolete unix timezone structure and tz_dsttime member.
455 BOOL WINAPI SetTimeZoneInformation(
456 const LPTIME_ZONE_INFORMATION tzinfo) /* [in] The new time zone. */
458 struct timezone tz;
460 tz.tz_minuteswest = tzinfo->Bias;
461 #ifdef DST_NONE
462 tz.tz_dsttime = DST_NONE;
463 #else
464 tz.tz_dsttime = 0;
465 #endif
466 return !settimeofday(NULL, &tz);
470 /***********************************************************************
471 * SystemTimeToTzSpecificLocalTime (KERNEL32.@)
473 * Converts the system time (utc) to the local time in the specified time zone.
475 * RETURNS
477 * Returns true when the local time was calculated.
479 * BUGS
481 * Does not handle daylight savings time adjustments correctly.
483 BOOL WINAPI SystemTimeToTzSpecificLocalTime(
484 LPTIME_ZONE_INFORMATION lpTimeZoneInformation, /* [in] The desired time zone. */
485 LPSYSTEMTIME lpUniversalTime, /* [in] The utc time to base local time on. */
486 LPSYSTEMTIME lpLocalTime) /* [out] The local time in the time zone. */
488 FIXME(":stub\n");
489 SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
490 return FALSE;
494 /***********************************************************************
495 * GetSystemTimeAsFileTime (KERNEL32.@)
497 * Fills in a file time structure with the current time in UTC format.
499 VOID WINAPI GetSystemTimeAsFileTime(
500 LPFILETIME time) /* [out] The file time struct to be filled with the system time. */
502 NtQuerySystemTime( (LARGE_INTEGER *)time );
506 /*********************************************************************
507 * TIME_ClockTimeToFileTime (olorin@fandra.org, 20-Sep-1998)
509 * Used by GetProcessTimes to convert clock_t into FILETIME.
511 * Differences to UnixTimeToFileTime:
512 * 1) Divided by CLK_TCK
513 * 2) Time is relative. There is no 'starting date', so there is
514 * no need in offset correction, like in UnixTimeToFileTime
516 static void TIME_ClockTimeToFileTime(clock_t unix_time, LPFILETIME filetime)
518 LONGLONG secs = RtlEnlargedUnsignedMultiply( unix_time, 10000000 );
519 ((LARGE_INTEGER *)filetime)->QuadPart = RtlExtendedLargeIntegerDivide( secs, CLK_TCK, NULL );
522 /*********************************************************************
523 * GetProcessTimes (KERNEL32.@)
525 * Returns the user and kernel execution times of a process,
526 * along with the creation and exit times if known.
528 * olorin@fandra.org:
529 * Would be nice to subtract the cpu time, used by Wine at startup.
530 * Also, there is a need to separate times used by different applications.
532 * RETURNS
534 * Always returns true.
536 * BUGS
538 * lpCreationTime, lpExitTime are NOT INITIALIZED.
540 BOOL WINAPI GetProcessTimes(
541 HANDLE hprocess, /* [in] The process to be queried (obtained from PROCESS_QUERY_INFORMATION). */
542 LPFILETIME lpCreationTime, /* [out] The creation time of the process. */
543 LPFILETIME lpExitTime, /* [out] The exit time of the process if exited. */
544 LPFILETIME lpKernelTime, /* [out] The time spent in kernal routines in 100's of nanoseconds. */
545 LPFILETIME lpUserTime) /* [out] The time spent in user routines in 100's of nanoseconds. */
547 struct tms tms;
549 times(&tms);
550 TIME_ClockTimeToFileTime(tms.tms_utime,lpUserTime);
551 TIME_ClockTimeToFileTime(tms.tms_stime,lpKernelTime);
552 return TRUE;
555 /*********************************************************************
556 * GetCalendarInfoA (KERNEL32.@)
559 int WINAPI GetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType,
560 LPSTR lpCalData, int cchData, LPDWORD lpValue)
562 FIXME("(%08lx,%08lx,%08lx,%p,%d,%p): stub\n",
563 Locale, Calendar, CalType, lpCalData, cchData, lpValue);
564 /* dont have the #define values for those */
566 FIXME("\t");
568 if (CalType & CAL_NOUSEROVERRIDE)
569 MESSAGE("CAL_NOUSEROVERRIDE|");
570 if (CalType & CAL_RETURN_NUMBER)
571 MESSAGE("CAL_RETURN_NUMBER|");
572 if (CalType & CAL_USE_CP_ACP)
573 MESSAGE("CAL_USE_CP_ACP|");
576 /*switch (CalType & ~(CAL_NOUSEROVERRIDE|CAL_RETURN_NUMBER|CAL_USE_CP_ACP)) {*/
577 switch (CalType & 0xffff) {
578 #define X(x) case x: MESSAGE(#x"\n");break;
579 X(CAL_ICALINTVALUE)
580 X(CAL_SCALNAME)
581 X(CAL_IYEAROFFSETRANGE)
582 X(CAL_SERASTRING)
583 X(CAL_SSHORTDATE)
584 X(CAL_SLONGDATE)
585 X(CAL_SDAYNAME1)
586 X(CAL_SDAYNAME2)
587 X(CAL_SDAYNAME3)
588 X(CAL_SDAYNAME4)
589 X(CAL_SDAYNAME5)
590 X(CAL_SDAYNAME6)
591 X(CAL_SDAYNAME7)
592 X(CAL_SABBREVDAYNAME1)
593 X(CAL_SABBREVDAYNAME2)
594 X(CAL_SABBREVDAYNAME3)
595 X(CAL_SABBREVDAYNAME4)
596 X(CAL_SABBREVDAYNAME5)
597 X(CAL_SABBREVDAYNAME6)
598 X(CAL_SABBREVDAYNAME7)
599 X(CAL_SMONTHNAME1)
600 X(CAL_SMONTHNAME2)
601 X(CAL_SMONTHNAME3)
602 X(CAL_SMONTHNAME4)
603 X(CAL_SMONTHNAME5)
604 X(CAL_SMONTHNAME6)
605 X(CAL_SMONTHNAME7)
606 X(CAL_SMONTHNAME8)
607 X(CAL_SMONTHNAME9)
608 X(CAL_SMONTHNAME10)
609 X(CAL_SMONTHNAME11)
610 X(CAL_SMONTHNAME12)
611 X(CAL_SMONTHNAME13)
612 X(CAL_SABBREVMONTHNAME1)
613 X(CAL_SABBREVMONTHNAME2)
614 X(CAL_SABBREVMONTHNAME3)
615 X(CAL_SABBREVMONTHNAME4)
616 X(CAL_SABBREVMONTHNAME5)
617 X(CAL_SABBREVMONTHNAME6)
618 X(CAL_SABBREVMONTHNAME7)
619 X(CAL_SABBREVMONTHNAME8)
620 X(CAL_SABBREVMONTHNAME9)
621 X(CAL_SABBREVMONTHNAME10)
622 X(CAL_SABBREVMONTHNAME11)
623 X(CAL_SABBREVMONTHNAME12)
624 X(CAL_SABBREVMONTHNAME13)
625 X(CAL_SYEARMONTH)
626 #undef X
627 default: MESSAGE("Unknown caltype %ld\n",CalType & 0xffff);
628 return E_FAIL;
630 return 0;
633 /*********************************************************************
634 * GetCalendarInfoW (KERNEL32.@)
637 int WINAPI GetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType,
638 LPWSTR lpCalData, int cchData, LPDWORD lpValue)
640 FIXME("(%08lx,%08lx,%08lx,%p,%d,%p): stub\n",
641 Locale, Calendar, CalType, lpCalData, cchData, lpValue);
642 return 0;
645 /*********************************************************************
646 * SetCalendarInfoA (KERNEL32.@)
649 int WINAPI SetCalendarInfoA(LCID Locale, CALID Calendar, CALTYPE CalType, LPCSTR lpCalData)
651 FIXME("(%08lx,%08lx,%08lx,%s): stub\n",
652 Locale, Calendar, CalType, debugstr_a(lpCalData));
653 return 0;
656 /*********************************************************************
657 * SetCalendarInfoW (KERNEL32.@)
660 int WINAPI SetCalendarInfoW(LCID Locale, CALID Calendar, CALTYPE CalType, LPCWSTR lpCalData)
662 FIXME("(%08lx,%08lx,%08lx,%s): stub\n",
663 Locale, Calendar, CalType, debugstr_w(lpCalData));
664 return 0;