1 | /* $Id: time.cpp,v 1.6 1999-11-05 17:42:12 achimha Exp $ */
|
---|
2 |
|
---|
3 | /*
|
---|
4 | * Win32 time/date API functions
|
---|
5 | *
|
---|
6 | * Copyright 1998 Sander van Leeuwen (sandervl@xs4all.nl)
|
---|
7 | * Copyright 1999 Christoph Bratschi (cbratschi@datacomm.ch)
|
---|
8 | *
|
---|
9 | * Copyright 1996 Alexandre Julliard
|
---|
10 | * Copyright 1995 Martin von Loewis
|
---|
11 | * Copyright 1998 David Lee Lambert
|
---|
12 |
|
---|
13 | *
|
---|
14 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
15 | */
|
---|
16 | #include <os2win.h>
|
---|
17 | #include <winnls.h>
|
---|
18 | #include "winuser.h"
|
---|
19 | #include <stdlib.h>
|
---|
20 | #include <string.h>
|
---|
21 | #include <stdio.h>
|
---|
22 | #include "unicode.h"
|
---|
23 |
|
---|
24 | #define lstrcpynAtoW(unicode,ascii,asciilen) AsciiToUnicodeN(ascii,unicode,asciilen);
|
---|
25 |
|
---|
26 | #define WPRINTF_LEFTALIGN 0x0001 /* Align output on the left ('-' prefix) */
|
---|
27 | #define WPRINTF_PREFIX_HEX 0x0002 /* Prefix hex with 0x ('#' prefix) */
|
---|
28 | #define WPRINTF_ZEROPAD 0x0004 /* Pad with zeros ('0' prefix) */
|
---|
29 | #define WPRINTF_LONG 0x0008 /* Long arg ('l' prefix) */
|
---|
30 | #define WPRINTF_SHORT 0x0010 /* Short arg ('h' prefix) */
|
---|
31 | #define WPRINTF_UPPER_HEX 0x0020 /* Upper-case hex ('X' specifier) */
|
---|
32 | #define WPRINTF_WIDE 0x0040 /* Wide arg ('w' prefix) */
|
---|
33 |
|
---|
34 | typedef enum
|
---|
35 | {
|
---|
36 | WPR_UNKNOWN,
|
---|
37 | WPR_CHAR,
|
---|
38 | WPR_WCHAR,
|
---|
39 | WPR_STRING,
|
---|
40 | WPR_WSTRING,
|
---|
41 | WPR_SIGNED,
|
---|
42 | WPR_UNSIGNED,
|
---|
43 | WPR_HEXA
|
---|
44 | } WPRINTF_TYPE;
|
---|
45 |
|
---|
46 | typedef struct
|
---|
47 | {
|
---|
48 | UINT flags;
|
---|
49 | UINT width;
|
---|
50 | UINT precision;
|
---|
51 | WPRINTF_TYPE type;
|
---|
52 | } WPRINTF_FORMAT;
|
---|
53 |
|
---|
54 | typedef union {
|
---|
55 | WCHAR wchar_view;
|
---|
56 | CHAR char_view;
|
---|
57 | LPCSTR lpcstr_view;
|
---|
58 | LPCWSTR lpcwstr_view;
|
---|
59 | INT int_view;
|
---|
60 | } WPRINTF_DATA;
|
---|
61 |
|
---|
62 | static const CHAR null_stringA[] = "(null)";
|
---|
63 | static const WCHAR null_stringW[] = { '(', 'n', 'u', 'l', 'l', ')', 0 };
|
---|
64 |
|
---|
65 | //******************************************************************************
|
---|
66 | //******************************************************************************
|
---|
67 | VOID WIN32API GetLocalTime( LPSYSTEMTIME arg1)
|
---|
68 | {
|
---|
69 | /// dprintf(("KERNEL32: GetLocalTime\n"));
|
---|
70 | O32_GetLocalTime(arg1);
|
---|
71 | }
|
---|
72 | //******************************************************************************
|
---|
73 | //******************************************************************************
|
---|
74 | BOOL WIN32API SetLocalTime( const SYSTEMTIME * arg1)
|
---|
75 | {
|
---|
76 | dprintf(("KERNEL32: SetLocalTime\n"));
|
---|
77 | return O32_SetLocalTime(arg1);
|
---|
78 | }
|
---|
79 | //******************************************************************************
|
---|
80 | //******************************************************************************
|
---|
81 | BOOL WIN32API FileTimeToDosDateTime(const FILETIME * arg1, LPWORD arg2, LPWORD arg3)
|
---|
82 | {
|
---|
83 | dprintf(("KERNEL32: FileTimeToDosDateTime\n"));
|
---|
84 | return O32_FileTimeToDosDateTime(arg1, arg2, arg3);
|
---|
85 | }
|
---|
86 | //******************************************************************************
|
---|
87 | //******************************************************************************
|
---|
88 | BOOL WIN32API FileTimeToLocalFileTime(const FILETIME * arg1, LPFILETIME arg2)
|
---|
89 | {
|
---|
90 | dprintf(("KERNEL32: FileTimeToLocalFileTime\n"));
|
---|
91 | return O32_FileTimeToLocalFileTime(arg1, arg2);
|
---|
92 | }
|
---|
93 | //******************************************************************************
|
---|
94 | //******************************************************************************
|
---|
95 | BOOL WIN32API LocalFileTimeToFileTime(const FILETIME * arg1, LPFILETIME arg2)
|
---|
96 | {
|
---|
97 | dprintf(("KERNEL32: LocalFileTimeToFileTime\n"));
|
---|
98 | return O32_LocalFileTimeToFileTime(arg1, arg2);
|
---|
99 | }
|
---|
100 | //******************************************************************************
|
---|
101 | //******************************************************************************
|
---|
102 | BOOL WIN32API FileTimeToSystemTime(const FILETIME * arg1, LPSYSTEMTIME arg2)
|
---|
103 | {
|
---|
104 | dprintf(("KERNEL32: FileTimeToSystemTime"));
|
---|
105 | return O32_FileTimeToSystemTime(arg1, arg2);
|
---|
106 | }
|
---|
107 | //******************************************************************************
|
---|
108 | //******************************************************************************
|
---|
109 | BOOL WIN32API DosDateTimeToFileTime( WORD arg1, WORD arg2, LPFILETIME arg3)
|
---|
110 | {
|
---|
111 | dprintf(("KERNEL32: DosDateTimeToFileTime\n"));
|
---|
112 | return O32_DosDateTimeToFileTime(arg1, arg2, arg3);
|
---|
113 | }
|
---|
114 | //******************************************************************************
|
---|
115 | //******************************************************************************
|
---|
116 | BOOL WIN32API GetFileTime( HANDLE arg1, LPFILETIME arg2, LPFILETIME arg3, LPFILETIME arg4)
|
---|
117 | {
|
---|
118 | dprintf(("KERNEL32: GetFileTime\n"));
|
---|
119 | return O32_GetFileTime(arg1, arg2, arg3, arg4);
|
---|
120 | }
|
---|
121 | //******************************************************************************
|
---|
122 | //******************************************************************************
|
---|
123 | DWORD WIN32API GetTimeZoneInformation( LPTIME_ZONE_INFORMATION arg1)
|
---|
124 | {
|
---|
125 | dprintf(("KERNEL32: GetTimeZoneInformation\n"));
|
---|
126 | return O32_GetTimeZoneInformation(arg1);
|
---|
127 | }
|
---|
128 | //******************************************************************************
|
---|
129 | //******************************************************************************
|
---|
130 | DWORD WIN32API GetTickCount(void)
|
---|
131 | {
|
---|
132 | //// dprintf(("KERNEL32: GetTickCount\n"));
|
---|
133 | return O32_GetTickCount();
|
---|
134 | }
|
---|
135 | //******************************************************************************
|
---|
136 | //******************************************************************************
|
---|
137 | VOID WIN32API GetSystemTime( LPSYSTEMTIME arg1)
|
---|
138 | {
|
---|
139 | dprintf(("KERNEL32: OS2GetSystemTime\n"));
|
---|
140 | O32_GetSystemTime(arg1);
|
---|
141 | }
|
---|
142 | //******************************************************************************
|
---|
143 | //******************************************************************************
|
---|
144 | BOOL WIN32API SystemTimeToFileTime( const SYSTEMTIME * arg1, LPFILETIME arg2)
|
---|
145 | {
|
---|
146 | dprintf(("KERNEL32: OS2SystemTimeToFileTime\n"));
|
---|
147 | return O32_SystemTimeToFileTime(arg1, arg2);
|
---|
148 | }
|
---|
149 | //******************************************************************************
|
---|
150 | //******************************************************************************
|
---|
151 | BOOL WIN32API SystemTimeToTzSpecificLocalTime( LPTIME_ZONE_INFORMATION arg1, LPSYSTEMTIME arg2, LPSYSTEMTIME arg3)
|
---|
152 | {
|
---|
153 | dprintf(("KERNEL32: OS2SystemTimeToTzSpecificLocalTime\n"));
|
---|
154 | return O32_SystemTimeToTzSpecificLocalTime(arg1, arg2, arg3);
|
---|
155 | }
|
---|
156 | //******************************************************************************
|
---|
157 | //******************************************************************************
|
---|
158 | BOOL WIN32API SetTimeZoneInformation( const LPTIME_ZONE_INFORMATION arg1)
|
---|
159 | {
|
---|
160 | dprintf(("KERNEL32: OS2SetTimeZoneInformation\n"));
|
---|
161 | return O32_SetTimeZoneInformation(arg1);
|
---|
162 | }
|
---|
163 | //******************************************************************************
|
---|
164 | //******************************************************************************
|
---|
165 | BOOL WIN32API SetSystemTime(const SYSTEMTIME * arg1)
|
---|
166 | {
|
---|
167 | dprintf(("KERNEL32: OS2SetSystemTime\n"));
|
---|
168 | return O32_SetSystemTime(arg1);
|
---|
169 | }
|
---|
170 |
|
---|
171 | /***********************************************************************
|
---|
172 | * WPRINTF_ParseFormatA
|
---|
173 | *
|
---|
174 | * Parse a format specification. A format specification has the form:
|
---|
175 | *
|
---|
176 | * [-][#][0][width][.precision]type
|
---|
177 | *
|
---|
178 | * Return value is the length of the format specification in characters.
|
---|
179 | */
|
---|
180 | static INT WPRINTF_ParseFormatA( LPCSTR format, WPRINTF_FORMAT *res )
|
---|
181 | {
|
---|
182 | LPCSTR p = format;
|
---|
183 |
|
---|
184 | res->flags = 0;
|
---|
185 | res->width = 0;
|
---|
186 | res->precision = 0;
|
---|
187 | if (*p == '-') { res->flags |= WPRINTF_LEFTALIGN; p++; }
|
---|
188 | if (*p == '#') { res->flags |= WPRINTF_PREFIX_HEX; p++; }
|
---|
189 | if (*p == '0') { res->flags |= WPRINTF_ZEROPAD; p++; }
|
---|
190 | while ((*p >= '0') && (*p <= '9')) /* width field */
|
---|
191 | {
|
---|
192 | res->width = res->width * 10 + *p - '0';
|
---|
193 | p++;
|
---|
194 | }
|
---|
195 | if (*p == '.') /* precision field */
|
---|
196 | {
|
---|
197 | p++;
|
---|
198 | while ((*p >= '0') && (*p <= '9'))
|
---|
199 | {
|
---|
200 | res->precision = res->precision * 10 + *p - '0';
|
---|
201 | p++;
|
---|
202 | }
|
---|
203 | }
|
---|
204 | if (*p == 'l') { res->flags |= WPRINTF_LONG; p++; }
|
---|
205 | else if (*p == 'h') { res->flags |= WPRINTF_SHORT; p++; }
|
---|
206 | else if (*p == 'w') { res->flags |= WPRINTF_WIDE; p++; }
|
---|
207 | switch(*p)
|
---|
208 | {
|
---|
209 | case 'c':
|
---|
210 | res->type = (res->flags & WPRINTF_LONG) ? WPR_WCHAR : WPR_CHAR;
|
---|
211 | break;
|
---|
212 | case 'C':
|
---|
213 | res->type = (res->flags & WPRINTF_SHORT) ? WPR_CHAR : WPR_WCHAR;
|
---|
214 | break;
|
---|
215 | case 'd':
|
---|
216 | case 'i':
|
---|
217 | res->type = WPR_SIGNED;
|
---|
218 | break;
|
---|
219 | case 's':
|
---|
220 | res->type = (res->flags & (WPRINTF_LONG |WPRINTF_WIDE))
|
---|
221 | ? WPR_WSTRING : WPR_STRING;
|
---|
222 | break;
|
---|
223 | case 'S':
|
---|
224 | res->type = (res->flags & (WPRINTF_SHORT|WPRINTF_WIDE))
|
---|
225 | ? WPR_STRING : WPR_WSTRING;
|
---|
226 | break;
|
---|
227 | case 'u':
|
---|
228 | res->type = WPR_UNSIGNED;
|
---|
229 | break;
|
---|
230 | case 'X':
|
---|
231 | res->flags |= WPRINTF_UPPER_HEX;
|
---|
232 | /* fall through */
|
---|
233 | case 'x':
|
---|
234 | res->type = WPR_HEXA;
|
---|
235 | break;
|
---|
236 | default: /* unknown format char */
|
---|
237 | res->type = WPR_UNKNOWN;
|
---|
238 | p--; /* print format as normal char */
|
---|
239 | break;
|
---|
240 | }
|
---|
241 | return (INT)(p - format) + 1;
|
---|
242 | }
|
---|
243 |
|
---|
244 |
|
---|
245 | /***********************************************************************
|
---|
246 | * WPRINTF_ParseFormatW
|
---|
247 | *
|
---|
248 | * Parse a format specification. A format specification has the form:
|
---|
249 | *
|
---|
250 | * [-][#][0][width][.precision]type
|
---|
251 | *
|
---|
252 | * Return value is the length of the format specification in characters.
|
---|
253 | */
|
---|
254 | static INT WPRINTF_ParseFormatW( LPCWSTR format, WPRINTF_FORMAT *res )
|
---|
255 | {
|
---|
256 | LPCWSTR p = format;
|
---|
257 |
|
---|
258 | res->flags = 0;
|
---|
259 | res->width = 0;
|
---|
260 | res->precision = 0;
|
---|
261 | if (*p == '-') { res->flags |= WPRINTF_LEFTALIGN; p++; }
|
---|
262 | if (*p == '#') { res->flags |= WPRINTF_PREFIX_HEX; p++; }
|
---|
263 | if (*p == '0') { res->flags |= WPRINTF_ZEROPAD; p++; }
|
---|
264 | while ((*p >= '0') && (*p <= '9')) /* width field */
|
---|
265 | {
|
---|
266 | res->width = res->width * 10 + *p - '0';
|
---|
267 | p++;
|
---|
268 | }
|
---|
269 | if (*p == '.') /* precision field */
|
---|
270 | {
|
---|
271 | p++;
|
---|
272 | while ((*p >= '0') && (*p <= '9'))
|
---|
273 | {
|
---|
274 | res->precision = res->precision * 10 + *p - '0';
|
---|
275 | p++;
|
---|
276 | }
|
---|
277 | }
|
---|
278 | if (*p == 'l') { res->flags |= WPRINTF_LONG; p++; }
|
---|
279 | else if (*p == 'h') { res->flags |= WPRINTF_SHORT; p++; }
|
---|
280 | else if (*p == 'w') { res->flags |= WPRINTF_WIDE; p++; }
|
---|
281 | switch((CHAR)*p)
|
---|
282 | {
|
---|
283 | case 'c':
|
---|
284 | res->type = (res->flags & WPRINTF_SHORT) ? WPR_CHAR : WPR_WCHAR;
|
---|
285 | break;
|
---|
286 | case 'C':
|
---|
287 | res->type = (res->flags & WPRINTF_LONG) ? WPR_WCHAR : WPR_CHAR;
|
---|
288 | break;
|
---|
289 | case 'd':
|
---|
290 | case 'i':
|
---|
291 | res->type = WPR_SIGNED;
|
---|
292 | break;
|
---|
293 | case 's':
|
---|
294 | res->type = ((res->flags & WPRINTF_SHORT) && !(res->flags & WPRINTF_WIDE)) ? WPR_STRING : WPR_WSTRING;
|
---|
295 | break;
|
---|
296 | case 'S':
|
---|
297 | res->type = (res->flags & (WPRINTF_LONG|WPRINTF_WIDE)) ? WPR_WSTRING : WPR_STRING;
|
---|
298 | break;
|
---|
299 | case 'u':
|
---|
300 | res->type = WPR_UNSIGNED;
|
---|
301 | break;
|
---|
302 | case 'X':
|
---|
303 | res->flags |= WPRINTF_UPPER_HEX;
|
---|
304 | /* fall through */
|
---|
305 | case 'x':
|
---|
306 | res->type = WPR_HEXA;
|
---|
307 | break;
|
---|
308 | default:
|
---|
309 | res->type = WPR_UNKNOWN;
|
---|
310 | p--; /* print format as normal char */
|
---|
311 | break;
|
---|
312 | }
|
---|
313 | return (INT)(p - format) + 1;
|
---|
314 | }
|
---|
315 |
|
---|
316 |
|
---|
317 | /***********************************************************************
|
---|
318 | * WPRINTF_GetLen
|
---|
319 | */
|
---|
320 | static UINT WPRINTF_GetLen( WPRINTF_FORMAT *format, WPRINTF_DATA *arg,
|
---|
321 | LPSTR number, UINT maxlen )
|
---|
322 | {
|
---|
323 | UINT len;
|
---|
324 |
|
---|
325 | if (format->flags & WPRINTF_LEFTALIGN) format->flags &= ~WPRINTF_ZEROPAD;
|
---|
326 | if (format->width > maxlen) format->width = maxlen;
|
---|
327 | switch(format->type)
|
---|
328 | {
|
---|
329 | case WPR_CHAR:
|
---|
330 | case WPR_WCHAR:
|
---|
331 | return (format->precision = 1);
|
---|
332 | case WPR_STRING:
|
---|
333 | if (!arg->lpcstr_view) arg->lpcstr_view = null_stringA;
|
---|
334 | for (len = 0; !format->precision || (len < format->precision); len++)
|
---|
335 | if (!*(arg->lpcstr_view + len)) break;
|
---|
336 | if (len > maxlen) len = maxlen;
|
---|
337 | return (format->precision = len);
|
---|
338 | case WPR_WSTRING:
|
---|
339 | if (!arg->lpcwstr_view) arg->lpcwstr_view = null_stringW;
|
---|
340 | for (len = 0; !format->precision || (len < format->precision); len++)
|
---|
341 | if (!*(arg->lpcwstr_view + len)) break;
|
---|
342 | if (len > maxlen) len = maxlen;
|
---|
343 | return (format->precision = len);
|
---|
344 | case WPR_SIGNED:
|
---|
345 | len = sprintf( number, "%d", arg->int_view );
|
---|
346 | break;
|
---|
347 | case WPR_UNSIGNED:
|
---|
348 | len = sprintf( number, "%u", (UINT)arg->int_view );
|
---|
349 | break;
|
---|
350 | case WPR_HEXA:
|
---|
351 | len = sprintf( number,
|
---|
352 | (format->flags & WPRINTF_UPPER_HEX) ? "%X" : "%x",
|
---|
353 | (UINT)arg->int_view);
|
---|
354 | if (format->flags & WPRINTF_PREFIX_HEX) len += 2;
|
---|
355 | break;
|
---|
356 | default:
|
---|
357 | return 0;
|
---|
358 | }
|
---|
359 | if (len > maxlen) len = maxlen;
|
---|
360 | if (format->precision < len) format->precision = len;
|
---|
361 | if (format->precision > maxlen) format->precision = maxlen;
|
---|
362 | if ((format->flags & WPRINTF_ZEROPAD) && (format->width > format->precision))
|
---|
363 | format->precision = format->width;
|
---|
364 | return len;
|
---|
365 | }
|
---|
366 |
|
---|
367 | /***********************************************************************
|
---|
368 | * WPRINTF_ExtractVAPtr (Not a Windows API)
|
---|
369 | */
|
---|
370 | static WPRINTF_DATA WPRINTF_ExtractVAPtr( WPRINTF_FORMAT *format, va_list* args )
|
---|
371 | {
|
---|
372 | WPRINTF_DATA result;
|
---|
373 | switch(format->type)
|
---|
374 | {
|
---|
375 | case WPR_WCHAR:
|
---|
376 | result.wchar_view = va_arg( *args, WCHAR ); break;
|
---|
377 | case WPR_CHAR:
|
---|
378 | result.char_view = va_arg( *args, CHAR ); break;
|
---|
379 | case WPR_STRING:
|
---|
380 | result.lpcstr_view = va_arg( *args, LPCSTR); break;
|
---|
381 | case WPR_WSTRING:
|
---|
382 | result.lpcwstr_view = va_arg( *args, LPCWSTR); break;
|
---|
383 | case WPR_HEXA:
|
---|
384 | case WPR_SIGNED:
|
---|
385 | case WPR_UNSIGNED:
|
---|
386 | result.int_view = va_arg( *args, INT ); break;
|
---|
387 | default:
|
---|
388 | result.wchar_view = 0; break;
|
---|
389 | }
|
---|
390 | return result;
|
---|
391 | }
|
---|
392 |
|
---|
393 | /***********************************************************************
|
---|
394 | * wvsnprintfA (Not a Windows API)
|
---|
395 | */
|
---|
396 | INT WINAPI wvsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec,
|
---|
397 | va_list args )
|
---|
398 | {
|
---|
399 | WPRINTF_FORMAT format;
|
---|
400 | LPSTR p = buffer;
|
---|
401 | UINT i, len;
|
---|
402 | CHAR number[20];
|
---|
403 | WPRINTF_DATA argData;
|
---|
404 |
|
---|
405 | while (*spec && (maxlen > 1))
|
---|
406 | {
|
---|
407 | if (*spec != '%') { *p++ = *spec++; maxlen--; continue; }
|
---|
408 | spec++;
|
---|
409 | if (*spec == '%') { *p++ = *spec++; maxlen--; continue; }
|
---|
410 | spec += WPRINTF_ParseFormatA( spec, &format );
|
---|
411 | argData = WPRINTF_ExtractVAPtr( &format, &args );
|
---|
412 | len = WPRINTF_GetLen( &format, &argData, number, maxlen - 1 );
|
---|
413 | if (!(format.flags & WPRINTF_LEFTALIGN))
|
---|
414 | for (i = format.precision; i < format.width; i++, maxlen--)
|
---|
415 | *p++ = ' ';
|
---|
416 | switch(format.type)
|
---|
417 | {
|
---|
418 | case WPR_WCHAR:
|
---|
419 | *p = argData.wchar_view;
|
---|
420 | if (*p != '\0') p++;
|
---|
421 | else if (format.width > 1) *p++ = ' ';
|
---|
422 | else len = 0;
|
---|
423 | break;
|
---|
424 | case WPR_CHAR:
|
---|
425 | *p = argData.char_view;
|
---|
426 | if (*p != '\0') p++;
|
---|
427 | else if (format.width > 1) *p++ = ' ';
|
---|
428 | else len = 0;
|
---|
429 | break;
|
---|
430 | case WPR_STRING:
|
---|
431 | memcpy( p, argData.lpcstr_view, len );
|
---|
432 | p += len;
|
---|
433 | break;
|
---|
434 | case WPR_WSTRING:
|
---|
435 | {
|
---|
436 | LPCWSTR ptr = argData.lpcwstr_view;
|
---|
437 | for (i = 0; i < len; i++) *p++ = (CHAR)*ptr++;
|
---|
438 | }
|
---|
439 | break;
|
---|
440 | case WPR_HEXA:
|
---|
441 | if ((format.flags & WPRINTF_PREFIX_HEX) && (maxlen > 3))
|
---|
442 | {
|
---|
443 | *p++ = '0';
|
---|
444 | *p++ = (format.flags & WPRINTF_UPPER_HEX) ? 'X' : 'x';
|
---|
445 | maxlen -= 2;
|
---|
446 | len -= 2;
|
---|
447 | format.precision -= 2;
|
---|
448 | format.width -= 2;
|
---|
449 | }
|
---|
450 | /* fall through */
|
---|
451 | case WPR_SIGNED:
|
---|
452 | case WPR_UNSIGNED:
|
---|
453 | for (i = len; i < format.precision; i++, maxlen--) *p++ = '0';
|
---|
454 | memcpy( p, number, len );
|
---|
455 | p += len;
|
---|
456 | /* Go to the next arg */
|
---|
457 | break;
|
---|
458 | case WPR_UNKNOWN:
|
---|
459 | continue;
|
---|
460 | }
|
---|
461 | if (format.flags & WPRINTF_LEFTALIGN)
|
---|
462 | for (i = format.precision; i < format.width; i++, maxlen--)
|
---|
463 | *p++ = ' ';
|
---|
464 | maxlen -= len;
|
---|
465 | }
|
---|
466 | *p = 0;
|
---|
467 | //TRACE("%s\n",buffer);
|
---|
468 | return (maxlen > 1) ? (INT)(p - buffer) : -1;
|
---|
469 | }
|
---|
470 |
|
---|
471 |
|
---|
472 | /***********************************************************************
|
---|
473 | * wvsnprintfW (Not a Windows API)
|
---|
474 | */
|
---|
475 | INT WINAPI wvsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec,
|
---|
476 | va_list args )
|
---|
477 | {
|
---|
478 | WPRINTF_FORMAT format;
|
---|
479 | LPWSTR p = buffer;
|
---|
480 | UINT i, len;
|
---|
481 | CHAR number[20];
|
---|
482 |
|
---|
483 | while (*spec && (maxlen > 1))
|
---|
484 | {
|
---|
485 | if (*spec != '%') { *p++ = *spec++; maxlen--; continue; }
|
---|
486 | spec++;
|
---|
487 | if (*spec == '%') { *p++ = *spec++; maxlen--; continue; }
|
---|
488 | spec += WPRINTF_ParseFormatW( spec, &format );
|
---|
489 | len = WPRINTF_GetLen( &format, (WPRINTF_DATA*)args, number, maxlen - 1 );
|
---|
490 | if (!(format.flags & WPRINTF_LEFTALIGN))
|
---|
491 | for (i = format.precision; i < format.width; i++, maxlen--)
|
---|
492 | *p++ = ' ';
|
---|
493 | switch(format.type)
|
---|
494 | {
|
---|
495 | case WPR_WCHAR:
|
---|
496 | *p = va_arg( args, WCHAR );
|
---|
497 | if (*p != '\0') p++;
|
---|
498 | else if (format.width > 1) *p++ = ' ';
|
---|
499 | else len = 0;
|
---|
500 | break;
|
---|
501 | case WPR_CHAR:
|
---|
502 | *p = (WCHAR)va_arg( args, CHAR );
|
---|
503 | if (*p != '\0') p++;
|
---|
504 | else if (format.width > 1) *p++ = ' ';
|
---|
505 | else len = 0;
|
---|
506 | break;
|
---|
507 | case WPR_STRING:
|
---|
508 | {
|
---|
509 | LPCSTR ptr = va_arg( args, LPCSTR );
|
---|
510 | for (i = 0; i < len; i++) *p++ = (WCHAR)*ptr++;
|
---|
511 | }
|
---|
512 | break;
|
---|
513 | case WPR_WSTRING:
|
---|
514 | if (len) memcpy( p, va_arg( args, LPCWSTR ), len * sizeof(WCHAR) );
|
---|
515 | p += len;
|
---|
516 | break;
|
---|
517 | case WPR_HEXA:
|
---|
518 | if ((format.flags & WPRINTF_PREFIX_HEX) && (maxlen > 3))
|
---|
519 | {
|
---|
520 | *p++ = '0';
|
---|
521 | *p++ = (format.flags & WPRINTF_UPPER_HEX) ? 'X' : 'x';
|
---|
522 | maxlen -= 2;
|
---|
523 | len -= 2;
|
---|
524 | format.precision -= 2;
|
---|
525 | format.width -= 2;
|
---|
526 | }
|
---|
527 | /* fall through */
|
---|
528 | case WPR_SIGNED:
|
---|
529 | case WPR_UNSIGNED:
|
---|
530 | for (i = len; i < format.precision; i++, maxlen--) *p++ = '0';
|
---|
531 | for (i = 0; i < len; i++) *p++ = (WCHAR)number[i];
|
---|
532 | (void)va_arg( args, INT ); /* Go to the next arg */
|
---|
533 | break;
|
---|
534 | case WPR_UNKNOWN:
|
---|
535 | continue;
|
---|
536 | }
|
---|
537 | if (format.flags & WPRINTF_LEFTALIGN)
|
---|
538 | for (i = format.precision; i < format.width; i++, maxlen--)
|
---|
539 | *p++ = ' ';
|
---|
540 | maxlen -= len;
|
---|
541 | }
|
---|
542 | *p = 0;
|
---|
543 | return (maxlen > 1) ? (INT)(p - buffer) : -1;
|
---|
544 | }
|
---|
545 |
|
---|
546 | /***********************************************************************
|
---|
547 | * wsnprintfA (Not a Windows API)
|
---|
548 | */
|
---|
549 | INT WINAPIV wsnprintfA( LPSTR buffer, UINT maxlen, LPCSTR spec, ... )
|
---|
550 | {
|
---|
551 | va_list valist;
|
---|
552 | INT res;
|
---|
553 |
|
---|
554 | va_start( valist, spec );
|
---|
555 | res = wvsnprintfA( buffer, maxlen, spec, valist );
|
---|
556 | va_end( valist );
|
---|
557 | return res;
|
---|
558 | }
|
---|
559 |
|
---|
560 | /***********************************************************************
|
---|
561 | * wsnprintfW (Not a Windows API)
|
---|
562 | */
|
---|
563 | INT WINAPIV wsnprintfW( LPWSTR buffer, UINT maxlen, LPCWSTR spec, ... )
|
---|
564 | {
|
---|
565 | va_list valist;
|
---|
566 | INT res;
|
---|
567 |
|
---|
568 | va_start( valist, spec );
|
---|
569 | res = wvsnprintfW( buffer, maxlen, spec, valist );
|
---|
570 | va_end( valist );
|
---|
571 | return res;
|
---|
572 | }
|
---|
573 |
|
---|
574 | /******************************************************************************
|
---|
575 | * OLE2NLS_CheckLocale [intern]
|
---|
576 | */
|
---|
577 | static LCID OLE2NLS_CheckLocale (LCID locale)
|
---|
578 | {
|
---|
579 | if (!locale)
|
---|
580 | { locale = LOCALE_SYSTEM_DEFAULT;
|
---|
581 | }
|
---|
582 |
|
---|
583 | if (locale == LOCALE_SYSTEM_DEFAULT)
|
---|
584 | { return GetSystemDefaultLCID();
|
---|
585 | }
|
---|
586 | else if (locale == LOCALE_USER_DEFAULT)
|
---|
587 | { return GetUserDefaultLCID();
|
---|
588 | }
|
---|
589 | else
|
---|
590 | { return locale;
|
---|
591 | }
|
---|
592 | }
|
---|
593 |
|
---|
594 | /******************************************************************************
|
---|
595 | * OLE_GetFormatA [Internal]
|
---|
596 | *
|
---|
597 | * FIXME
|
---|
598 | * If datelen == 0, it should return the reguired string length.
|
---|
599 | *
|
---|
600 | This function implements stuff for GetDateFormat() and
|
---|
601 | GetTimeFormat().
|
---|
602 | d single-digit (no leading zero) day (of month)
|
---|
603 | dd two-digit day (of month)
|
---|
604 | ddd short day-of-week name
|
---|
605 | dddd long day-of-week name
|
---|
606 | M single-digit month
|
---|
607 | MM two-digit month
|
---|
608 | MMM short month name
|
---|
609 | MMMM full month name
|
---|
610 | y two-digit year, no leading 0
|
---|
611 | yy two-digit year
|
---|
612 | yyyy four-digit year
|
---|
613 | gg era string
|
---|
614 | h hours with no leading zero (12-hour)
|
---|
615 | hh hours with full two digits
|
---|
616 | H hours with no leading zero (24-hour)
|
---|
617 | HH hours with full two digits
|
---|
618 | m minutes with no leading zero
|
---|
619 | mm minutes with full two digits
|
---|
620 | s seconds with no leading zero
|
---|
621 | ss seconds with full two digits
|
---|
622 | t time marker (A or P)
|
---|
623 | tt time marker (AM, PM)
|
---|
624 | '' used to quote literal characters
|
---|
625 | '' (within a quoted string) indicates a literal '
|
---|
626 | These functions REQUIRE valid locale, date, and format.
|
---|
627 | */
|
---|
628 | static INT OLE_GetFormatA(LCID locale,
|
---|
629 | DWORD flags,
|
---|
630 | DWORD tflags,
|
---|
631 | LPSYSTEMTIME xtime,
|
---|
632 | LPCSTR _format, /*in*/
|
---|
633 | LPSTR date, /*out*/
|
---|
634 | INT datelen)
|
---|
635 | {
|
---|
636 | INT inpos, outpos;
|
---|
637 | int count, type, inquote, Overflow;
|
---|
638 | char buf[40];
|
---|
639 | char format[40];
|
---|
640 | char * pos;
|
---|
641 | int buflen;
|
---|
642 | const char * _dgfmt[] = { "%d", "%02d" };
|
---|
643 | const char ** dgfmt = _dgfmt - 1;
|
---|
644 | dprintf(("KERNEL32: OLE_GetFormatA"));
|
---|
645 |
|
---|
646 | if(datelen == 0) {
|
---|
647 | //FIXME_(ole)("datelen = 0, returning 255\n");
|
---|
648 | return 255;
|
---|
649 | }
|
---|
650 | /* initalize state variables and output buffer */
|
---|
651 | inpos = outpos = 0;
|
---|
652 | count = 0; inquote = 0; Overflow = 0;
|
---|
653 | type = '\0';
|
---|
654 | date[0] = buf[0] = '\0';
|
---|
655 |
|
---|
656 | strcpy(format,_format);
|
---|
657 | /* alter the formatstring, while it works for all languages now in wine
|
---|
658 | its possible that it fails when the time looks like ss:mm:hh as example*/
|
---|
659 | if (tflags & (TIME_NOMINUTESORSECONDS))
|
---|
660 | { if ((pos = strstr ( format, ":mm")) != 0)
|
---|
661 | { memcpy ( pos, pos+3, strlen(format)-(pos-format)-2 );
|
---|
662 | }
|
---|
663 | }
|
---|
664 | if (tflags & (TIME_NOSECONDS))
|
---|
665 | { if ((pos = strstr ( format, ":ss")) != 0)
|
---|
666 | { memcpy ( pos, pos+3, strlen(format)-(pos-format)-2 );
|
---|
667 | }
|
---|
668 | }
|
---|
669 |
|
---|
670 | for (inpos = 0;; inpos++) {
|
---|
671 | /* TRACE(ole, "STATE inpos=%2d outpos=%2d count=%d inquote=%d type=%c buf,date = %c,%c\n", inpos, outpos, count, inquote, type, buf[inpos], date[outpos]); */
|
---|
672 | if (inquote) {
|
---|
673 | if (format[inpos] == '\'') {
|
---|
674 | if (format[inpos+1] == '\'') {
|
---|
675 | inpos += 1;
|
---|
676 | date[outpos++] = '\'';
|
---|
677 | } else {
|
---|
678 | inquote = 0;
|
---|
679 | continue; /* we did nothing to the output */
|
---|
680 | }
|
---|
681 | } else if (format[inpos] == '\0') {
|
---|
682 | date[outpos++] = '\0';
|
---|
683 | if (outpos > datelen) Overflow = 1;
|
---|
684 | break;
|
---|
685 | } else {
|
---|
686 | date[outpos++] = format[inpos];
|
---|
687 | if (outpos > datelen) {
|
---|
688 | Overflow = 1;
|
---|
689 | date[outpos-1] = '\0'; /* this is the last place where
|
---|
690 | it's safe to write */
|
---|
691 | break;
|
---|
692 | }
|
---|
693 | }
|
---|
694 | } else if ( (count && (format[inpos] != type))
|
---|
695 | || count == 4
|
---|
696 | || (count == 2 && strchr("ghHmst", type)) )
|
---|
697 | {
|
---|
698 | if (type == 'd') {
|
---|
699 | if (count == 4) {
|
---|
700 | GetLocaleInfoA(locale,
|
---|
701 | LOCALE_SDAYNAME1
|
---|
702 | + xtime->wDayOfWeek - 1,
|
---|
703 | buf, sizeof(buf));
|
---|
704 | } else if (count == 3) {
|
---|
705 | GetLocaleInfoA(locale,
|
---|
706 | LOCALE_SABBREVDAYNAME1
|
---|
707 | + xtime->wDayOfWeek - 1,
|
---|
708 | buf, sizeof(buf));
|
---|
709 | } else {
|
---|
710 | sprintf(buf, dgfmt[count], xtime->wDay);
|
---|
711 | }
|
---|
712 | } else if (type == 'M') {
|
---|
713 | if (count == 3) {
|
---|
714 | GetLocaleInfoA(locale,
|
---|
715 | LOCALE_SABBREVMONTHNAME1
|
---|
716 | + xtime->wMonth - 1,
|
---|
717 | buf, sizeof(buf));
|
---|
718 | } else if (count == 4) {
|
---|
719 | GetLocaleInfoA(locale,
|
---|
720 | LOCALE_SMONTHNAME1
|
---|
721 | + xtime->wMonth - 1,
|
---|
722 | buf, sizeof(buf));
|
---|
723 | } else {
|
---|
724 | sprintf(buf, dgfmt[count], xtime->wMonth);
|
---|
725 | }
|
---|
726 | } else if (type == 'y') {
|
---|
727 | if (count == 4) {
|
---|
728 | sprintf(buf, "%d", xtime->wYear);
|
---|
729 | } else if (count == 3) {
|
---|
730 | strcpy(buf, "yyy");
|
---|
731 | //WARN_(ole)("unknown format, c=%c, n=%d\n", type, count);
|
---|
732 | } else {
|
---|
733 | sprintf(buf, dgfmt[count], xtime->wYear % 100);
|
---|
734 | }
|
---|
735 | } else if (type == 'g') {
|
---|
736 | if (count == 2) {
|
---|
737 | //FIXME_(ole)("LOCALE_ICALENDARTYPE unimp.\n");
|
---|
738 | strcpy(buf, "AD");
|
---|
739 | } else {
|
---|
740 | strcpy(buf, "g");
|
---|
741 | //WARN_(ole)("unknown format, c=%c, n=%d\n", type, count);
|
---|
742 | }
|
---|
743 | } else if (type == 'h') {
|
---|
744 | /* gives us hours 1:00 -- 12:00 */
|
---|
745 | sprintf(buf, dgfmt[count], (xtime->wHour-1)%12 +1);
|
---|
746 | } else if (type == 'H') {
|
---|
747 | /* 24-hour time */
|
---|
748 | sprintf(buf, dgfmt[count], xtime->wHour);
|
---|
749 | } else if ( type == 'm') {
|
---|
750 | sprintf(buf, dgfmt[count], xtime->wMinute);
|
---|
751 | } else if ( type == 's') {
|
---|
752 | sprintf(buf, dgfmt[count], xtime->wSecond);
|
---|
753 | } else if (type == 't') {
|
---|
754 | if (count == 1) {
|
---|
755 | sprintf(buf, "%c", (xtime->wHour < 12) ? 'A' : 'P');
|
---|
756 | } else if (count == 2) {
|
---|
757 | /* sprintf(buf, "%s", (xtime->wHour < 12) ? "AM" : "PM"); */
|
---|
758 | GetLocaleInfoA(locale,
|
---|
759 | (xtime->wHour<12)
|
---|
760 | ? LOCALE_S1159 : LOCALE_S2359,
|
---|
761 | buf, sizeof(buf));
|
---|
762 | }
|
---|
763 | };
|
---|
764 | /* we need to check the next char in the format string
|
---|
765 | again, no matter what happened */
|
---|
766 | inpos--;
|
---|
767 |
|
---|
768 | /* add the contents of buf to the output */
|
---|
769 | buflen = strlen(buf);
|
---|
770 | if (outpos + buflen < datelen) {
|
---|
771 | date[outpos] = '\0'; /* for strcat to hook onto */
|
---|
772 | strcat(date, buf);
|
---|
773 | outpos += buflen;
|
---|
774 | } else {
|
---|
775 | date[outpos] = '\0';
|
---|
776 | strncat(date, buf, datelen - outpos);
|
---|
777 | date[datelen - 1] = '\0';
|
---|
778 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
---|
779 | //WARN_(ole)("insufficient buffer\n");
|
---|
780 | return 0;
|
---|
781 | }
|
---|
782 | /* reset the variables we used to keep track of this item */
|
---|
783 | count = 0;
|
---|
784 | type = '\0';
|
---|
785 | } else if (format[inpos] == '\0') {
|
---|
786 | /* we can't check for this at the loop-head, because
|
---|
787 | that breaks the printing of the last format-item */
|
---|
788 | date[outpos] = '\0';
|
---|
789 | break;
|
---|
790 | } else if (count) {
|
---|
791 | /* continuing a code for an item */
|
---|
792 | count +=1;
|
---|
793 | continue;
|
---|
794 | } else if (strchr("hHmstyMdg", format[inpos])) {
|
---|
795 | type = format[inpos];
|
---|
796 | count = 1;
|
---|
797 | continue;
|
---|
798 | } else if (format[inpos] == '\'') {
|
---|
799 | inquote = 1;
|
---|
800 | continue;
|
---|
801 | } else {
|
---|
802 | date[outpos++] = format[inpos];
|
---|
803 | }
|
---|
804 | /* now deal with a possible buffer overflow */
|
---|
805 | if (outpos >= datelen) {
|
---|
806 | date[datelen - 1] = '\0';
|
---|
807 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
---|
808 | return 0;
|
---|
809 | }
|
---|
810 | }
|
---|
811 |
|
---|
812 | if (Overflow) {
|
---|
813 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
---|
814 | };
|
---|
815 | /* finish it off with a string terminator */
|
---|
816 | outpos++;
|
---|
817 | /* sanity check */
|
---|
818 | if (outpos > datelen-1) outpos = datelen-1;
|
---|
819 | date[outpos] = '\0';
|
---|
820 |
|
---|
821 | //TRACE_(ole)("OLE_GetFormatA returns string '%s', len %d\n",
|
---|
822 | // date, outpos);
|
---|
823 | return outpos;
|
---|
824 | }
|
---|
825 |
|
---|
826 | /******************************************************************************
|
---|
827 | * OLE_GetFormatW [INTERNAL]
|
---|
828 | */
|
---|
829 | static INT OLE_GetFormatW(LCID locale, DWORD flags, DWORD tflags,
|
---|
830 | LPSYSTEMTIME xtime,
|
---|
831 | LPCWSTR format,
|
---|
832 | LPWSTR output, INT outlen)
|
---|
833 | {
|
---|
834 | INT inpos, outpos;
|
---|
835 | int count, type=0, inquote;
|
---|
836 | int Overflow; /* loop check */
|
---|
837 | WCHAR buf[40];
|
---|
838 | int buflen=0;
|
---|
839 | WCHAR arg0[] = {0}, arg1[] = {'%','d',0};
|
---|
840 | WCHAR arg2[] = {'%','0','2','d',0};
|
---|
841 | WCHAR *argarr[3];
|
---|
842 | int datevars=0, timevars=0;
|
---|
843 | argarr[0] = arg0;
|
---|
844 | argarr[1] = arg1;
|
---|
845 | argarr[2] = arg2;
|
---|
846 |
|
---|
847 | dprintf(("KERNEL32: OLE_GetFormatW"));
|
---|
848 |
|
---|
849 | if(outlen == 0) {
|
---|
850 | //FIXME_(ole)("outlen = 0, returning 255\n");
|
---|
851 | return 255;
|
---|
852 | }
|
---|
853 | /* initialize state variables */
|
---|
854 | inpos = outpos = 0;
|
---|
855 | count = 0;
|
---|
856 | inquote = Overflow = 0;
|
---|
857 | /* this is really just a sanity check */
|
---|
858 | output[0] = buf[0] = 0;
|
---|
859 |
|
---|
860 | /* this loop is the core of the function */
|
---|
861 | for (inpos = 0; /* we have several break points */ ; inpos++) {
|
---|
862 | if (inquote) {
|
---|
863 | if (format[inpos] == (WCHAR) '\'') {
|
---|
864 | if (format[inpos+1] == '\'') {
|
---|
865 | inpos++;
|
---|
866 | output[outpos++] = '\'';
|
---|
867 | } else {
|
---|
868 | inquote = 0;
|
---|
869 | continue;
|
---|
870 | }
|
---|
871 | } else if (format[inpos] == 0) {
|
---|
872 | output[outpos++] = 0;
|
---|
873 | if (outpos > outlen) Overflow = 1;
|
---|
874 | break; /* normal exit (within a quote) */
|
---|
875 | } else {
|
---|
876 | output[outpos++] = format[inpos]; /* copy input */
|
---|
877 | if (outpos > outlen) {
|
---|
878 | Overflow = 1;
|
---|
879 | output[outpos-1] = 0;
|
---|
880 | break;
|
---|
881 | }
|
---|
882 | }
|
---|
883 | } else if ( (count && (format[inpos] != type))
|
---|
884 | || ( (count==4 && type =='y') ||
|
---|
885 | (count==4 && type =='M') ||
|
---|
886 | (count==4 && type =='d') ||
|
---|
887 | (count==2 && type =='g') ||
|
---|
888 | (count==2 && type =='h') ||
|
---|
889 | (count==2 && type =='H') ||
|
---|
890 | (count==2 && type =='m') ||
|
---|
891 | (count==2 && type =='s') ||
|
---|
892 | (count==2 && type =='t') ) ) {
|
---|
893 | if (type == 'd') {
|
---|
894 | if (count == 3) {
|
---|
895 | GetLocaleInfoW(locale,
|
---|
896 | LOCALE_SDAYNAME1 + xtime->wDayOfWeek -1,
|
---|
897 | buf, sizeof(buf)/sizeof(WCHAR) );
|
---|
898 | } else if (count == 3) {
|
---|
899 | GetLocaleInfoW(locale,
|
---|
900 | LOCALE_SABBREVDAYNAME1 +
|
---|
901 | xtime->wDayOfWeek -1,
|
---|
902 | buf, sizeof(buf)/sizeof(WCHAR) );
|
---|
903 | } else {
|
---|
904 | wsnprintfW(buf, 5, argarr[count], xtime->wDay );
|
---|
905 | };
|
---|
906 | } else if (type == 'M') {
|
---|
907 | if (count == 4) {
|
---|
908 | GetLocaleInfoW(locale, LOCALE_SMONTHNAME1 +
|
---|
909 | xtime->wMonth -1, buf,
|
---|
910 | sizeof(buf)/sizeof(WCHAR) );
|
---|
911 | } else if (count == 3) {
|
---|
912 | GetLocaleInfoW(locale, LOCALE_SABBREVMONTHNAME1 +
|
---|
913 | xtime->wMonth -1, buf,
|
---|
914 | sizeof(buf)/sizeof(WCHAR) );
|
---|
915 | } else {
|
---|
916 | wsnprintfW(buf, 5, argarr[count], xtime->wMonth);
|
---|
917 | }
|
---|
918 | } else if (type == 'y') {
|
---|
919 | if (count == 4) {
|
---|
920 | wsnprintfW(buf, 6, argarr[1] /* "%d" */,
|
---|
921 | xtime->wYear);
|
---|
922 | } else if (count == 3) {
|
---|
923 | lstrcpynAtoW(buf, "yyy", 5);
|
---|
924 | } else {
|
---|
925 | wsnprintfW(buf, 6, argarr[count],
|
---|
926 | xtime->wYear % 100);
|
---|
927 | }
|
---|
928 | } else if (type == 'g') {
|
---|
929 | if (count == 2) {
|
---|
930 | //FIXME_(ole)("LOCALE_ICALENDARTYPE unimplemented\n");
|
---|
931 | lstrcpynAtoW(buf, "AD", 5);
|
---|
932 | } else {
|
---|
933 | /* Win API sez we copy it verbatim */
|
---|
934 | lstrcpynAtoW(buf, "g", 5);
|
---|
935 | }
|
---|
936 | } else if (type == 'h') {
|
---|
937 | /* hours 1:00-12:00 --- is this right? */
|
---|
938 | wsnprintfW(buf, 5, argarr[count],
|
---|
939 | (xtime->wHour-1)%12 +1);
|
---|
940 | } else if (type == 'H') {
|
---|
941 | wsnprintfW(buf, 5, argarr[count],
|
---|
942 | xtime->wHour);
|
---|
943 | } else if (type == 'm' ) {
|
---|
944 | wsnprintfW(buf, 5, argarr[count],
|
---|
945 | xtime->wMinute);
|
---|
946 | } else if (type == 's' ) {
|
---|
947 | wsnprintfW(buf, 5, argarr[count],
|
---|
948 | xtime->wSecond);
|
---|
949 | } else if (type == 't') {
|
---|
950 | GetLocaleInfoW(locale, (xtime->wHour < 12) ?
|
---|
951 | LOCALE_S1159 : LOCALE_S2359,
|
---|
952 | buf, sizeof(buf) );
|
---|
953 | if (count == 1) {
|
---|
954 | buf[1] = 0;
|
---|
955 | }
|
---|
956 | }
|
---|
957 | /* no matter what happened, we need to check this next
|
---|
958 | character the next time we loop through */
|
---|
959 | inpos--;
|
---|
960 | /* cat buf onto the output */
|
---|
961 | outlen = lstrlenW(buf);
|
---|
962 | if (outpos + buflen < outlen) {
|
---|
963 | lstrcpyW( output + outpos, buf );
|
---|
964 | outpos += buflen;
|
---|
965 | } else {
|
---|
966 | lstrcpynW( output + outpos, buf, outlen - outpos );
|
---|
967 | Overflow = 1;
|
---|
968 | break; /* Abnormal exit */
|
---|
969 | }
|
---|
970 | /* reset the variables we used this time */
|
---|
971 | count = 0;
|
---|
972 | type = '\0';
|
---|
973 | } else if (format[inpos] == 0) {
|
---|
974 | /* we can't check for this at the beginning, because that
|
---|
975 | would keep us from printing a format spec that ended the
|
---|
976 | string */
|
---|
977 | output[outpos] = 0;
|
---|
978 | break; /* NORMAL EXIT */
|
---|
979 | } else if (count) {
|
---|
980 | /* how we keep track of the middle of a format spec */
|
---|
981 | count++;
|
---|
982 | continue;
|
---|
983 | } else if ( (datevars && (format[inpos]=='d' ||
|
---|
984 | format[inpos]=='M' ||
|
---|
985 | format[inpos]=='y' ||
|
---|
986 | format[inpos]=='g') ) ||
|
---|
987 | (timevars && (format[inpos]=='H' ||
|
---|
988 | format[inpos]=='h' ||
|
---|
989 | format[inpos]=='m' ||
|
---|
990 | format[inpos]=='s' ||
|
---|
991 | format[inpos]=='t') ) ) {
|
---|
992 | type = format[inpos];
|
---|
993 | count = 1;
|
---|
994 | continue;
|
---|
995 | } else if (format[inpos] == '\'') {
|
---|
996 | inquote = 1;
|
---|
997 | continue;
|
---|
998 | } else {
|
---|
999 | /* unquoted literals */
|
---|
1000 | output[outpos++] = format[inpos];
|
---|
1001 | }
|
---|
1002 | }
|
---|
1003 | if (Overflow) {
|
---|
1004 | SetLastError(ERROR_INSUFFICIENT_BUFFER);
|
---|
1005 | //WARN_(ole)(" buffer overflow\n");
|
---|
1006 | };
|
---|
1007 | /* final string terminator and sanity check */
|
---|
1008 | outpos++;
|
---|
1009 | if (outpos > outlen-1) outpos = outlen-1;
|
---|
1010 | output[outpos] = '0';
|
---|
1011 | //TRACE_(ole)(" returning %s\n", debugstr_w(output));
|
---|
1012 |
|
---|
1013 | return (!Overflow) ? outlen : 0;
|
---|
1014 |
|
---|
1015 | }
|
---|
1016 |
|
---|
1017 | /******************************************************************************
|
---|
1018 | * GetTimeFormat32A [KERNEL32.422]
|
---|
1019 | * Makes an ASCII string of the time
|
---|
1020 | *
|
---|
1021 | * Formats date according to format, or locale default if format is
|
---|
1022 | * NULL. The format consists of literal characters and fields as follows:
|
---|
1023 | *
|
---|
1024 | * h hours with no leading zero (12-hour)
|
---|
1025 | * hh hours with full two digits
|
---|
1026 | * H hours with no leading zero (24-hour)
|
---|
1027 | * HH hours with full two digits
|
---|
1028 | * m minutes with no leading zero
|
---|
1029 | * mm minutes with full two digits
|
---|
1030 | * s seconds with no leading zero
|
---|
1031 | * ss seconds with full two digits
|
---|
1032 | * t time marker (A or P)
|
---|
1033 | * tt time marker (AM, PM)
|
---|
1034 | *
|
---|
1035 | */
|
---|
1036 | INT WINAPI
|
---|
1037 | GetTimeFormatA(LCID locale, /* in */
|
---|
1038 | DWORD flags, /* in */
|
---|
1039 | LPSYSTEMTIME xtime, /* in */
|
---|
1040 | LPCSTR format, /* in */
|
---|
1041 | LPSTR timestr, /* out */
|
---|
1042 | INT timelen /* in */)
|
---|
1043 | { char format_buf[40];
|
---|
1044 | LPCSTR thisformat;
|
---|
1045 | SYSTEMTIME t;
|
---|
1046 | LPSYSTEMTIME thistime;
|
---|
1047 | LCID thislocale=0;
|
---|
1048 | DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */
|
---|
1049 | INT ret;
|
---|
1050 |
|
---|
1051 | dprintf(("KERNEL32: GetTimeFormatA"));
|
---|
1052 | //TRACE_(ole)("GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,xtime,format,timestr,timelen);
|
---|
1053 | thislocale = OLE2NLS_CheckLocale ( locale );
|
---|
1054 | if ( flags & (TIME_NOTIMEMARKER | TIME_FORCE24HOURFORMAT ))
|
---|
1055 | { //FIXME_(ole)("TIME_NOTIMEMARKER or TIME_FORCE24HOURFORMAT not implemented\n");
|
---|
1056 | }
|
---|
1057 |
|
---|
1058 | flags &= (TIME_NOSECONDS | TIME_NOMINUTESORSECONDS); /* mask for OLE_GetFormatA*/
|
---|
1059 | if (format == NULL)
|
---|
1060 | { if (flags & LOCALE_NOUSEROVERRIDE) /*use system default*/
|
---|
1061 | { thislocale = GetSystemDefaultLCID();
|
---|
1062 | }
|
---|
1063 | GetLocaleInfoA(thislocale, thisflags, format_buf, sizeof(format_buf));
|
---|
1064 | thisformat = format_buf;
|
---|
1065 | }
|
---|
1066 | else
|
---|
1067 | { thisformat = format;
|
---|
1068 | }
|
---|
1069 |
|
---|
1070 | if (xtime == NULL) /* NULL means use the current local time*/
|
---|
1071 | { GetLocalTime(&t);
|
---|
1072 | thistime = &t;
|
---|
1073 | }
|
---|
1074 | else
|
---|
1075 | { thistime = xtime;
|
---|
1076 | }
|
---|
1077 | ret = OLE_GetFormatA(thislocale, thisflags, flags, thistime, thisformat,
|
---|
1078 | timestr, timelen);
|
---|
1079 | return ret;
|
---|
1080 | }
|
---|
1081 |
|
---|
1082 | /******************************************************************************
|
---|
1083 | * GetTimeFormat32W [KERNEL32.423]
|
---|
1084 | * Makes a Unicode string of the time
|
---|
1085 | */
|
---|
1086 | INT WINAPI
|
---|
1087 | GetTimeFormatW(LCID locale, /* in */
|
---|
1088 | DWORD flags, /* in */
|
---|
1089 | LPSYSTEMTIME xtime, /* in */
|
---|
1090 | LPCWSTR format, /* in */
|
---|
1091 | LPWSTR timestr, /* out */
|
---|
1092 | INT timelen /* in */)
|
---|
1093 | { WCHAR format_buf[40];
|
---|
1094 | LPCWSTR thisformat;
|
---|
1095 | SYSTEMTIME t;
|
---|
1096 | LPSYSTEMTIME thistime;
|
---|
1097 | LCID thislocale=0;
|
---|
1098 | DWORD thisflags=LOCALE_STIMEFORMAT; /* standart timeformat */
|
---|
1099 | INT ret;
|
---|
1100 |
|
---|
1101 | dprintf(("KERNEL32: GetTimeFormatW"));
|
---|
1102 | //TRACE_(ole)("GetTimeFormat(0x%04lx,0x%08lx,%p,%s,%p,%d)\n",locale,flags,
|
---|
1103 | //xtime,debugstr_w(format),timestr,timelen);
|
---|
1104 | thislocale = OLE2NLS_CheckLocale ( locale );
|
---|
1105 | if ( flags & (TIME_NOTIMEMARKER | TIME_FORCE24HOURFORMAT ))
|
---|
1106 | { //FIXME_(ole)("TIME_NOTIMEMARKER or TIME_FORCE24HOURFORMAT not implemented\n");
|
---|
1107 | }
|
---|
1108 |
|
---|
1109 | flags &= (TIME_NOSECONDS | TIME_NOMINUTESORSECONDS); /* mask for OLE_GetFormatA*/
|
---|
1110 | if (format == NULL)
|
---|
1111 | { if (flags & LOCALE_NOUSEROVERRIDE) /*use system default*/
|
---|
1112 | { thislocale = GetSystemDefaultLCID();
|
---|
1113 | }
|
---|
1114 | GetLocaleInfoW(thislocale, thisflags, format_buf, 40);
|
---|
1115 | thisformat = format_buf;
|
---|
1116 | }
|
---|
1117 | else
|
---|
1118 | { thisformat = format;
|
---|
1119 | }
|
---|
1120 |
|
---|
1121 | if (xtime == NULL) /* NULL means use the current local time*/
|
---|
1122 | { GetSystemTime(&t);
|
---|
1123 | thistime = &t;
|
---|
1124 | }
|
---|
1125 | else
|
---|
1126 | { thistime = xtime;
|
---|
1127 | }
|
---|
1128 | ret = OLE_GetFormatW(thislocale, thisflags, flags, thistime, thisformat,
|
---|
1129 | timestr, timelen);
|
---|
1130 | return ret;
|
---|
1131 | }
|
---|
1132 |
|
---|
1133 | /******************************************************************************
|
---|
1134 | * GetDateFormat32A [KERNEL32.310]
|
---|
1135 | * Makes an ASCII string of the date
|
---|
1136 | *
|
---|
1137 | * This function uses format to format the date, or, if format
|
---|
1138 | * is NULL, uses the default for the locale. format is a string
|
---|
1139 | * of literal fields and characters as follows:
|
---|
1140 | *
|
---|
1141 | * - d single-digit (no leading zero) day (of month)
|
---|
1142 | * - dd two-digit day (of month)
|
---|
1143 | * - ddd short day-of-week name
|
---|
1144 | * - dddd long day-of-week name
|
---|
1145 | * - M single-digit month
|
---|
1146 | * - MM two-digit month
|
---|
1147 | * - MMM short month name
|
---|
1148 | * - MMMM full month name
|
---|
1149 | * - y two-digit year, no leading 0
|
---|
1150 | * - yy two-digit year
|
---|
1151 | * - yyyy four-digit year
|
---|
1152 | * - gg era string
|
---|
1153 | *
|
---|
1154 | */
|
---|
1155 | INT WINAPI GetDateFormatA(LCID locale,DWORD flags,
|
---|
1156 | LPSYSTEMTIME xtime,
|
---|
1157 | LPCSTR format, LPSTR date,INT datelen)
|
---|
1158 | {
|
---|
1159 | char format_buf[40];
|
---|
1160 | LPCSTR thisformat;
|
---|
1161 | SYSTEMTIME t;
|
---|
1162 | LPSYSTEMTIME thistime;
|
---|
1163 | LCID thislocale;
|
---|
1164 | INT ret;
|
---|
1165 |
|
---|
1166 | dprintf(("KERNEL32: GetDateFormatA\n"));
|
---|
1167 |
|
---|
1168 | if (!locale) {
|
---|
1169 | locale = LOCALE_SYSTEM_DEFAULT;
|
---|
1170 | };
|
---|
1171 |
|
---|
1172 | if (locale == LOCALE_SYSTEM_DEFAULT) {
|
---|
1173 | thislocale = GetSystemDefaultLCID();
|
---|
1174 | } else if (locale == LOCALE_USER_DEFAULT) {
|
---|
1175 | thislocale = GetUserDefaultLCID();
|
---|
1176 | } else {
|
---|
1177 | thislocale = locale;
|
---|
1178 | };
|
---|
1179 | if (xtime == NULL) {
|
---|
1180 | GetSystemTime(&t);
|
---|
1181 | thistime = &t;
|
---|
1182 | } else {
|
---|
1183 | thistime = xtime;
|
---|
1184 | };
|
---|
1185 | if (format == NULL) {
|
---|
1186 | GetLocaleInfoA(thislocale, ((flags&DATE_LONGDATE)
|
---|
1187 | ? LOCALE_SLONGDATE
|
---|
1188 | : LOCALE_SSHORTDATE),
|
---|
1189 | format_buf, sizeof(format_buf));
|
---|
1190 | thisformat = format_buf;
|
---|
1191 | } else {
|
---|
1192 | thisformat = format;
|
---|
1193 | };
|
---|
1194 |
|
---|
1195 | ret = OLE_GetFormatA(thislocale, flags, 0, thistime, thisformat,
|
---|
1196 | date, datelen);
|
---|
1197 |
|
---|
1198 | return ret;
|
---|
1199 | }
|
---|
1200 | /******************************************************************************
|
---|
1201 | * GetDateFormat32W [KERNEL32.311]
|
---|
1202 | * Makes a Unicode string of the date
|
---|
1203 | *
|
---|
1204 | * Acts the same as GetDateFormat32A(), except that it's Unicode.
|
---|
1205 | * Accepts & returns sizes as counts of Unicode characters.
|
---|
1206 | *
|
---|
1207 | */
|
---|
1208 | INT WINAPI GetDateFormatW(LCID locale,DWORD flags,
|
---|
1209 | LPSYSTEMTIME xtime,
|
---|
1210 | LPCWSTR format,
|
---|
1211 | LPWSTR date, INT datelen)
|
---|
1212 | {
|
---|
1213 | WCHAR format_buf[40];
|
---|
1214 | LPWSTR thisformat;
|
---|
1215 | SYSTEMTIME t;
|
---|
1216 | LPSYSTEMTIME thistime;
|
---|
1217 | LCID thislocale;
|
---|
1218 | INT ret;
|
---|
1219 |
|
---|
1220 | dprintf(("KERNEL32: GetDateFormatW\n"));
|
---|
1221 |
|
---|
1222 | if (!locale) {
|
---|
1223 | locale = LOCALE_SYSTEM_DEFAULT;
|
---|
1224 | };
|
---|
1225 |
|
---|
1226 | if (locale == LOCALE_SYSTEM_DEFAULT) {
|
---|
1227 | thislocale = GetSystemDefaultLCID();
|
---|
1228 | } else if (locale == LOCALE_USER_DEFAULT) {
|
---|
1229 | thislocale = GetUserDefaultLCID();
|
---|
1230 | } else {
|
---|
1231 | thislocale = locale;
|
---|
1232 | };
|
---|
1233 | if (xtime == NULL) {
|
---|
1234 | GetSystemTime(&t);
|
---|
1235 | thistime = &t;
|
---|
1236 | } else {
|
---|
1237 | thistime = xtime;
|
---|
1238 | };
|
---|
1239 | if (format == NULL) {
|
---|
1240 | GetLocaleInfoW(thislocale, ((flags&DATE_LONGDATE)
|
---|
1241 | ? LOCALE_SLONGDATE
|
---|
1242 | : LOCALE_SSHORTDATE),
|
---|
1243 | format_buf, sizeof(format_buf));
|
---|
1244 | thisformat = format_buf;
|
---|
1245 | } else {
|
---|
1246 | thisformat = (WCHAR*)format;
|
---|
1247 | };
|
---|
1248 |
|
---|
1249 | ret = OLE_GetFormatW(thislocale, flags, 0, thistime, thisformat,
|
---|
1250 | date, datelen);
|
---|
1251 |
|
---|
1252 | return ret;
|
---|
1253 | }
|
---|
1254 | /**************************************************************************
|
---|
1255 | * EnumTimeFormats32A (KERNEL32.210)
|
---|
1256 | */
|
---|
1257 | BOOL WINAPI EnumTimeFormatsA(
|
---|
1258 | TIMEFMT_ENUMPROCA lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags)
|
---|
1259 | {
|
---|
1260 | dprintf(("KERNEL32: EnumTimeFormatsA: only US English supported\n"));
|
---|
1261 |
|
---|
1262 | if(!lpTimeFmtEnumProc)
|
---|
1263 | {
|
---|
1264 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1265 | return FALSE;
|
---|
1266 | }
|
---|
1267 | if(dwFlags)
|
---|
1268 | {
|
---|
1269 | //FIXME_(ole)("Unknown time format (%ld)\n", dwFlags);
|
---|
1270 | }
|
---|
1271 |
|
---|
1272 | if(!(*lpTimeFmtEnumProc)("h:mm:ss tt")) return TRUE;
|
---|
1273 | if(!(*lpTimeFmtEnumProc)("hh:mm:ss tt")) return TRUE;
|
---|
1274 | if(!(*lpTimeFmtEnumProc)("H:mm:ss")) return TRUE;
|
---|
1275 | if(!(*lpTimeFmtEnumProc)("HH:mm:ss")) return TRUE;
|
---|
1276 |
|
---|
1277 | return TRUE;
|
---|
1278 | }
|
---|
1279 | /**************************************************************************
|
---|
1280 | * EnumTimeFormats32W (KERNEL32.211)
|
---|
1281 | */
|
---|
1282 | BOOL WINAPI EnumTimeFormatsW(
|
---|
1283 | TIMEFMT_ENUMPROCW lpTimeFmtEnumProc, LCID Locale, DWORD dwFlags)
|
---|
1284 | {
|
---|
1285 | WCHAR buf[20];
|
---|
1286 |
|
---|
1287 | dprintf(("KERNEL32: EnumTimeFormatsW: only US English supported\n"));
|
---|
1288 |
|
---|
1289 | if(!lpTimeFmtEnumProc)
|
---|
1290 | {
|
---|
1291 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1292 | return FALSE;
|
---|
1293 | }
|
---|
1294 | if(dwFlags)
|
---|
1295 | {
|
---|
1296 | //FIXME_(ole)("Unknown time format (%ld)\n", dwFlags);
|
---|
1297 | }
|
---|
1298 |
|
---|
1299 | AsciiToUnicode("h:mm:ss tt",buf);
|
---|
1300 | if(!(*lpTimeFmtEnumProc)(buf)) return TRUE;
|
---|
1301 | AsciiToUnicode("hh:mm:ss tt",buf);
|
---|
1302 | if(!(*lpTimeFmtEnumProc)(buf)) return TRUE;
|
---|
1303 | AsciiToUnicode("H:mm:ss",buf);
|
---|
1304 | if(!(*lpTimeFmtEnumProc)(buf)) return TRUE;
|
---|
1305 | AsciiToUnicode("HH:mm:ss",buf);
|
---|
1306 | if(!(*lpTimeFmtEnumProc)(buf)) return TRUE;
|
---|
1307 |
|
---|
1308 | return TRUE;
|
---|
1309 | }
|
---|
1310 | /*****************************************************************************
|
---|
1311 | * Name : DWORD GetSystemTimeAsFileTime
|
---|
1312 | * Purpose : The GetSystemTimeAsFileTime function obtains the current system
|
---|
1313 | * date and time. The information is in Coordinated Universal Time (UTC) format.
|
---|
1314 | * Parameters: LLPFILETIME lLPSYSTEMTIMEAsFileTime
|
---|
1315 | * Variables :
|
---|
1316 | * Result :
|
---|
1317 | * Remark :
|
---|
1318 | * Status : UNTESTED
|
---|
1319 | *
|
---|
1320 | * Author : Patrick Haller [Mon, 1998/06/15 08:00]
|
---|
1321 | *****************************************************************************/
|
---|
1322 |
|
---|
1323 | VOID WIN32API GetSystemTimeAsFileTime(LPFILETIME lpSystemTimeAsFileTime)
|
---|
1324 | {
|
---|
1325 | FILETIME ft; /* code sequence from WIN32.HLP */
|
---|
1326 | SYSTEMTIME st;
|
---|
1327 |
|
---|
1328 | dprintf(("KERNEL32: GetSystemTimeAsFileTime(%08xh)\n", lpSystemTimeAsFileTime));
|
---|
1329 |
|
---|
1330 | GetSystemTime(&st);
|
---|
1331 | SystemTimeToFileTime(&st, &ft);
|
---|
1332 | }
|
---|
1333 | /**************************************************************************
|
---|
1334 | * EnumDateFormats32A (KERNEL32.198)
|
---|
1335 | */
|
---|
1336 | BOOL WINAPI EnumDateFormatsA(
|
---|
1337 | DATEFMT_ENUMPROCA lpDateFmtEnumProc, LCID Locale, DWORD dwFlags)
|
---|
1338 | {
|
---|
1339 | dprintf(("KERNEL32: EnumDateFormatsA: only US English supported\n"));
|
---|
1340 |
|
---|
1341 | if(!lpDateFmtEnumProc)
|
---|
1342 | {
|
---|
1343 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1344 | return FALSE;
|
---|
1345 | }
|
---|
1346 | switch(dwFlags)
|
---|
1347 | {
|
---|
1348 | case DATE_SHORTDATE:
|
---|
1349 | if(!(*lpDateFmtEnumProc)("M/d/yy")) return TRUE;
|
---|
1350 | if(!(*lpDateFmtEnumProc)("M/d/yyyy")) return TRUE;
|
---|
1351 | if(!(*lpDateFmtEnumProc)("MM/dd/yy")) return TRUE;
|
---|
1352 | if(!(*lpDateFmtEnumProc)("MM/dd/yyyy")) return TRUE;
|
---|
1353 | if(!(*lpDateFmtEnumProc)("yy/MM/dd")) return TRUE;
|
---|
1354 | if(!(*lpDateFmtEnumProc)("dd-MMM-yy")) return TRUE;
|
---|
1355 | return TRUE;
|
---|
1356 | case DATE_LONGDATE:
|
---|
1357 | if(!(*lpDateFmtEnumProc)("dddd, MMMM dd, yyyy")) return TRUE;
|
---|
1358 | if(!(*lpDateFmtEnumProc)("MMMM dd, yyyy")) return TRUE;
|
---|
1359 | if(!(*lpDateFmtEnumProc)("dddd, dd MMMM, yyyy")) return TRUE;
|
---|
1360 | if(!(*lpDateFmtEnumProc)("dd MMMM, yyyy")) return TRUE;
|
---|
1361 | return TRUE;
|
---|
1362 | default:
|
---|
1363 | //FIXME_(ole)("Unknown date format (%ld)\n", dwFlags);
|
---|
1364 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1365 | return FALSE;
|
---|
1366 | }
|
---|
1367 | }
|
---|
1368 | /**************************************************************************
|
---|
1369 | * EnumDateFormats32W (KERNEL32.199)
|
---|
1370 | */
|
---|
1371 | BOOL WINAPI EnumDateFormatsW(
|
---|
1372 | DATEFMT_ENUMPROCW lpDateFmtEnumProc, LCID Locale, DWORD dwFlags)
|
---|
1373 | {
|
---|
1374 | WCHAR buf[50];
|
---|
1375 |
|
---|
1376 | dprintf(("KERNEL32: EnumDateFormatsW: only US English supported\n"));
|
---|
1377 |
|
---|
1378 | if(!lpDateFmtEnumProc)
|
---|
1379 | {
|
---|
1380 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1381 | return FALSE;
|
---|
1382 | }
|
---|
1383 | switch(dwFlags)
|
---|
1384 | {
|
---|
1385 | case DATE_SHORTDATE:
|
---|
1386 | AsciiToUnicode("M/d/yy",buf);
|
---|
1387 | if(!(*lpDateFmtEnumProc)(buf)) return TRUE;
|
---|
1388 | AsciiToUnicode("M/d/yyyy",buf);
|
---|
1389 | if(!(*lpDateFmtEnumProc)(buf)) return TRUE;
|
---|
1390 | AsciiToUnicode("MM/dd/yy",buf);
|
---|
1391 | if(!(*lpDateFmtEnumProc)(buf)) return TRUE;
|
---|
1392 | AsciiToUnicode("MM/dd/yyyy",buf);
|
---|
1393 | if(!(*lpDateFmtEnumProc)(buf)) return TRUE;
|
---|
1394 | AsciiToUnicode("yy/MM/dd",buf);
|
---|
1395 | if(!(*lpDateFmtEnumProc)(buf)) return TRUE;
|
---|
1396 | AsciiToUnicode("dd-MMM-yy",buf);
|
---|
1397 | if(!(*lpDateFmtEnumProc)(buf)) return TRUE;
|
---|
1398 | return TRUE;
|
---|
1399 | case DATE_LONGDATE:
|
---|
1400 | AsciiToUnicode("dddd, MMMM dd, yyyy",buf);
|
---|
1401 | if(!(*lpDateFmtEnumProc)(buf)) return TRUE;
|
---|
1402 | AsciiToUnicode("MMMM dd, yyyy",buf);
|
---|
1403 | if(!(*lpDateFmtEnumProc)(buf)) return TRUE;
|
---|
1404 | AsciiToUnicode("dddd, dd MMMM, yyyy",buf);
|
---|
1405 | if(!(*lpDateFmtEnumProc)(buf)) return TRUE;
|
---|
1406 | AsciiToUnicode("dd MMMM, yyyy",buf);
|
---|
1407 | if(!(*lpDateFmtEnumProc)(buf)) return TRUE;
|
---|
1408 | return TRUE;
|
---|
1409 | default:
|
---|
1410 | //FIXME_(ole)("Unknown date format (%ld)\n", dwFlags);
|
---|
1411 | SetLastError(ERROR_INVALID_PARAMETER);
|
---|
1412 | return FALSE;
|
---|
1413 | }
|
---|
1414 | }
|
---|
1415 |
|
---|