1 /* GLIB - Library of useful routines for C programming
2 * Copyright (C) 1995-1998 Peter Mattis, Spencer Kimball and Josh MacDonald
3 * Copyright (C) 1998-1999 Tor Lillqvist
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
22 * Modified by the GLib Team and others 1997-1999. See the AUTHORS
23 * file for a list of people on the GLib Team. See the ChangeLog
24 * files for a list of changes. These files are distributed with
25 * GLib at ftp://ftp.gtk.org/pub/gtk/.
29 * MT safe for the unix part, FIXME: make the win32 part MT safe as well.
36 #include "glibconfig.h"
43 #define STRICT /* Strict typing, please */
55 g_win32_ftruncate (gint fd,
61 g_return_val_if_fail (fd >= 0, -1);
63 hfile = (HANDLE) _get_osfhandle (fd);
64 curpos = SetFilePointer (hfile, 0, NULL, FILE_CURRENT);
65 if (curpos == 0xFFFFFFFF
66 || SetFilePointer (hfile, size, NULL, FILE_BEGIN) == 0xFFFFFFFF
67 || !SetEndOfFile (hfile))
69 gint error = GetLastError ();
73 case ERROR_INVALID_HANDLE:
88 g_win32_opendir (const char *dirname)
94 g_return_val_if_fail (dirname != NULL, NULL);
96 result = g_new0 (DIR, 1);
97 result->find_file_data = g_new0 (WIN32_FIND_DATA, 1);
98 result->dir_name = g_strdup (dirname);
100 k = strlen (result->dir_name);
101 if (k && result->dir_name[k - 1] == '\\')
103 result->dir_name[k - 1] = '\0';
106 mask = g_strdup_printf ("%s\\*", result->dir_name);
108 result->find_file_handle = (guint) FindFirstFile (mask,
109 (LPWIN32_FIND_DATA) result->find_file_data);
112 if (result->find_file_handle == (guint) INVALID_HANDLE_VALUE)
114 int error = GetLastError ();
116 g_free (result->dir_name);
117 g_free (result->find_file_data);
126 result->just_opened = TRUE;
132 g_win32_readdir (DIR *dir)
134 static struct dirent result;
136 g_return_val_if_fail (dir != NULL, NULL);
138 if (dir->just_opened)
139 dir->just_opened = FALSE;
142 if (!FindNextFile ((HANDLE) dir->find_file_handle,
143 (LPWIN32_FIND_DATA) dir->find_file_data))
145 int error = GetLastError ();
149 case ERROR_NO_MORE_FILES:
157 strcpy (result.d_name, g_basename (((LPWIN32_FIND_DATA) dir->find_file_data)->cFileName));
163 g_win32_rewinddir (DIR *dir)
167 g_return_if_fail (dir != NULL);
169 if (!FindClose ((HANDLE) dir->find_file_handle))
170 g_warning ("gwin_rewinddir(): FindClose() failed\n");
172 mask = g_strdup_printf ("%s\\*", dir->dir_name);
173 dir->find_file_handle = (guint) FindFirstFile (mask,
174 (LPWIN32_FIND_DATA) dir->find_file_data);
177 if (dir->find_file_handle == (guint) INVALID_HANDLE_VALUE)
179 int error = GetLastError ();
188 dir->just_opened = TRUE;
192 g_win32_closedir (DIR *dir)
194 g_return_val_if_fail (dir != NULL, -1);
196 if (!FindClose ((HANDLE) dir->find_file_handle))
198 int error = GetLastError ();
203 errno = EIO; return -1;
207 g_free (dir->dir_name);
208 g_free (dir->find_file_data);
214 /* Mingw32 headers don't have latest language and sublanguage codes */
215 #ifndef LANG_AFRIKAANS
216 #define LANG_AFRIKAANS 0x36
218 #ifndef LANG_ALBANIAN
219 #define LANG_ALBANIAN 0x1c
222 #define LANG_ARABIC 0x01
224 #ifndef LANG_ARMENIAN
225 #define LANG_ARMENIAN 0x2b
227 #ifndef LANG_ASSAMESE
228 #define LANG_ASSAMESE 0x4d
231 #define LANG_AZERI 0x2c
234 #define LANG_BASQUE 0x2d
236 #ifndef LANG_BELARUSIAN
237 #define LANG_BELARUSIAN 0x23
240 #define LANG_BENGALI 0x45
243 #define LANG_CATALAN 0x03
245 #ifndef LANG_ESTONIAN
246 #define LANG_ESTONIAN 0x25
248 #ifndef LANG_FAEROESE
249 #define LANG_FAEROESE 0x38
252 #define LANG_FARSI 0x29
254 #ifndef LANG_GEORGIAN
255 #define LANG_GEORGIAN 0x37
257 #ifndef LANG_GUJARATI
258 #define LANG_GUJARATI 0x47
261 #define LANG_HEBREW 0x0d
264 #define LANG_HINDI 0x39
266 #ifndef LANG_INDONESIAN
267 #define LANG_INDONESIAN 0x21
270 #define LANG_KANNADA 0x4b
272 #ifndef LANG_KASHMIRI
273 #define LANG_KASHMIRI 0x60
276 #define LANG_KAZAK 0x3f
279 #define LANG_KONKANI 0x57
282 #define LANG_LATVIAN 0x26
284 #ifndef LANG_LITHUANIAN
285 #define LANG_LITHUANIAN 0x27
287 #ifndef LANG_MACEDONIAN
288 #define LANG_MACEDONIAN 0x2f
291 #define LANG_MALAY 0x3e
293 #ifndef LANG_MALAYALAM
294 #define LANG_MALAYALAM 0x4c
296 #ifndef LANG_MANIPURI
297 #define LANG_MANIPURI 0x58
300 #define LANG_MARATHI 0x4e
303 #define LANG_NEPALI 0x61
306 #define LANG_ORIYA 0x48
309 #define LANG_PUNJABI 0x46
311 #ifndef LANG_SANSKRIT
312 #define LANG_SANSKRIT 0x4f
315 #define LANG_SERBIAN 0x1a
318 #define LANG_SINDHI 0x59
321 #define LANG_SLOVAK 0x1b
324 #define LANG_SWAHILI 0x41
327 #define LANG_TAMIL 0x49
330 #define LANG_TATAR 0x44
333 #define LANG_TELUGU 0x4a
336 #define LANG_THAI 0x1e
338 #ifndef LANG_UKRAINIAN
339 #define LANG_UKRAINIAN 0x22
342 #define LANG_URDU 0x20
345 #define LANG_UZBEK 0x43
347 #ifndef LANG_VIETNAMESE
348 #define LANG_VIETNAMESE 0x2a
350 #ifndef SUBLANG_ARABIC_SAUDI_ARABIA
351 #define SUBLANG_ARABIC_SAUDI_ARABIA 0x01
353 #ifndef SUBLANG_ARABIC_IRAQ
354 #define SUBLANG_ARABIC_IRAQ 0x02
356 #ifndef SUBLANG_ARABIC_EGYPT
357 #define SUBLANG_ARABIC_EGYPT 0x03
359 #ifndef SUBLANG_ARABIC_LIBYA
360 #define SUBLANG_ARABIC_LIBYA 0x04
362 #ifndef SUBLANG_ARABIC_ALGERIA
363 #define SUBLANG_ARABIC_ALGERIA 0x05
365 #ifndef SUBLANG_ARABIC_MOROCCO
366 #define SUBLANG_ARABIC_MOROCCO 0x06
368 #ifndef SUBLANG_ARABIC_TUNISIA
369 #define SUBLANG_ARABIC_TUNISIA 0x07
371 #ifndef SUBLANG_ARABIC_OMAN
372 #define SUBLANG_ARABIC_OMAN 0x08
374 #ifndef SUBLANG_ARABIC_YEMEN
375 #define SUBLANG_ARABIC_YEMEN 0x09
377 #ifndef SUBLANG_ARABIC_SYRIA
378 #define SUBLANG_ARABIC_SYRIA 0x0a
380 #ifndef SUBLANG_ARABIC_JORDAN
381 #define SUBLANG_ARABIC_JORDAN 0x0b
383 #ifndef SUBLANG_ARABIC_LEBANON
384 #define SUBLANG_ARABIC_LEBANON 0x0c
386 #ifndef SUBLANG_ARABIC_KUWAIT
387 #define SUBLANG_ARABIC_KUWAIT 0x0d
389 #ifndef SUBLANG_ARABIC_UAE
390 #define SUBLANG_ARABIC_UAE 0x0e
392 #ifndef SUBLANG_ARABIC_BAHRAIN
393 #define SUBLANG_ARABIC_BAHRAIN 0x0f
395 #ifndef SUBLANG_ARABIC_QATAR
396 #define SUBLANG_ARABIC_QATAR 0x10
398 #ifndef SUBLANG_AZERI_LATIN
399 #define SUBLANG_AZERI_LATIN 0x01
401 #ifndef SUBLANG_AZERI_CYRILLIC
402 #define SUBLANG_AZERI_CYRILLIC 0x02
404 #ifndef SUBLANG_CHINESE_MACAU
405 #define SUBLANG_CHINESE_MACAU 0x05
407 #ifndef SUBLANG_ENGLISH_SOUTH_AFRICA
408 #define SUBLANG_ENGLISH_SOUTH_AFRICA 0x07
410 #ifndef SUBLANG_ENGLISH_JAMAICA
411 #define SUBLANG_ENGLISH_JAMAICA 0x08
413 #ifndef SUBLANG_ENGLISH_CARIBBEAN
414 #define SUBLANG_ENGLISH_CARIBBEAN 0x09
416 #ifndef SUBLANG_ENGLISH_BELIZE
417 #define SUBLANG_ENGLISH_BELIZE 0x0a
419 #ifndef SUBLANG_ENGLISH_TRINIDAD
420 #define SUBLANG_ENGLISH_TRINIDAD 0x0b
422 #ifndef SUBLANG_ENGLISH_ZIMBABWE
423 #define SUBLANG_ENGLISH_ZIMBABWE 0x0c
425 #ifndef SUBLANG_ENGLISH_PHILIPPINES
426 #define SUBLANG_ENGLISH_PHILIPPINES 0x0d
428 #ifndef SUBLANG_FRENCH_LUXEMBOURG
429 #define SUBLANG_FRENCH_LUXEMBOURG 0x05
431 #ifndef SUBLANG_FRENCH_MONACO
432 #define SUBLANG_FRENCH_MONACO 0x06
434 #ifndef SUBLANG_GERMAN_LUXEMBOURG
435 #define SUBLANG_GERMAN_LUXEMBOURG 0x04
437 #ifndef SUBLANG_GERMAN_LIECHTENSTEIN
438 #define SUBLANG_GERMAN_LIECHTENSTEIN 0x05
440 #ifndef SUBLANG_KASHMIRI_INDIA
441 #define SUBLANG_KASHMIRI_INDIA 0x02
443 #ifndef SUBLANG_MALAY_MALAYSIA
444 #define SUBLANG_MALAY_MALAYSIA 0x01
446 #ifndef SUBLANG_MALAY_BRUNEI_DARUSSALAM
447 #define SUBLANG_MALAY_BRUNEI_DARUSSALAM 0x02
449 #ifndef SUBLANG_NEPALI_INDIA
450 #define SUBLANG_NEPALI_INDIA 0x02
452 #ifndef SUBLANG_SERBIAN_LATIN
453 #define SUBLANG_SERBIAN_LATIN 0x02
455 #ifndef SUBLANG_SERBIAN_CYRILLIC
456 #define SUBLANG_SERBIAN_CYRILLIC 0x03
458 #ifndef SUBLANG_SPANISH_GUATEMALA
459 #define SUBLANG_SPANISH_GUATEMALA 0x04
461 #ifndef SUBLANG_SPANISH_COSTA_RICA
462 #define SUBLANG_SPANISH_COSTA_RICA 0x05
464 #ifndef SUBLANG_SPANISH_PANAMA
465 #define SUBLANG_SPANISH_PANAMA 0x06
467 #ifndef SUBLANG_SPANISH_DOMINICAN_REPUBLIC
468 #define SUBLANG_SPANISH_DOMINICAN_REPUBLIC 0x07
470 #ifndef SUBLANG_SPANISH_VENEZUELA
471 #define SUBLANG_SPANISH_VENEZUELA 0x08
473 #ifndef SUBLANG_SPANISH_COLOMBIA
474 #define SUBLANG_SPANISH_COLOMBIA 0x09
476 #ifndef SUBLANG_SPANISH_PERU
477 #define SUBLANG_SPANISH_PERU 0x0a
479 #ifndef SUBLANG_SPANISH_ARGENTINA
480 #define SUBLANG_SPANISH_ARGENTINA 0x0b
482 #ifndef SUBLANG_SPANISH_ECUADOR
483 #define SUBLANG_SPANISH_ECUADOR 0x0c
485 #ifndef SUBLANG_SPANISH_CHILE
486 #define SUBLANG_SPANISH_CHILE 0x0d
488 #ifndef SUBLANG_SPANISH_URUGUAY
489 #define SUBLANG_SPANISH_URUGUAY 0x0e
491 #ifndef SUBLANG_SPANISH_PARAGUAY
492 #define SUBLANG_SPANISH_PARAGUAY 0x0f
494 #ifndef SUBLANG_SPANISH_BOLIVIA
495 #define SUBLANG_SPANISH_BOLIVIA 0x10
497 #ifndef SUBLANG_SPANISH_EL_SALVADOR
498 #define SUBLANG_SPANISH_EL_SALVADOR 0x11
500 #ifndef SUBLANG_SPANISH_HONDURAS
501 #define SUBLANG_SPANISH_HONDURAS 0x12
503 #ifndef SUBLANG_SPANISH_NICARAGUA
504 #define SUBLANG_SPANISH_NICARAGUA 0x13
506 #ifndef SUBLANG_SPANISH_PUERTO_RICO
507 #define SUBLANG_SPANISH_PUERTO_RICO 0x14
509 #ifndef SUBLANG_SWEDISH_FINLAND
510 #define SUBLANG_SWEDISH_FINLAND 0x02
512 #ifndef SUBLANG_URDU_PAKISTAN
513 #define SUBLANG_URDU_PAKISTAN 0x01
515 #ifndef SUBLANG_URDU_INDIA
516 #define SUBLANG_URDU_INDIA 0x02
518 #ifndef SUBLANG_UZBEK_LATIN
519 #define SUBLANG_UZBEK_LATIN 0x01
521 #ifndef SUBLANG_UZBEK_CYRILLIC
522 #define SUBLANG_UZBEK_CYRILLIC 0x02
526 g_win32_getlocale (void)
531 gchar *l = NULL, *sl = NULL;
534 if ((ev = getenv ("LC_ALL")) != NULL
535 || (ev = getenv ("LC_CTYPE")) != NULL
536 || (ev = getenv ("LANG")) != NULL)
537 return g_strdup (ev);
539 lcid = GetThreadLocale ();
540 primary = PRIMARYLANGID (LANGIDFROMLCID (lcid));
541 sub = SUBLANGID (LANGIDFROMLCID (lcid));
544 case LANG_AFRIKAANS: l = "af"; break;
545 case LANG_ALBANIAN: l = "sq"; break;
550 case SUBLANG_ARABIC_SAUDI_ARABIA: sl = "SA"; break;
551 case SUBLANG_ARABIC_IRAQ: sl = "IQ"; break;
552 case SUBLANG_ARABIC_EGYPT: sl = "EG"; break;
553 case SUBLANG_ARABIC_LIBYA: sl = "LY"; break;
554 case SUBLANG_ARABIC_ALGERIA: sl = "DZ"; break;
555 case SUBLANG_ARABIC_MOROCCO: sl = "MA"; break;
556 case SUBLANG_ARABIC_TUNISIA: sl = "TN"; break;
557 case SUBLANG_ARABIC_OMAN: sl = "OM"; break;
558 case SUBLANG_ARABIC_YEMEN: sl = "YE"; break;
559 case SUBLANG_ARABIC_SYRIA: sl = "SY"; break;
560 case SUBLANG_ARABIC_JORDAN: sl = "JO"; break;
561 case SUBLANG_ARABIC_LEBANON: sl = "LB"; break;
562 case SUBLANG_ARABIC_KUWAIT: sl = "KW"; break;
563 case SUBLANG_ARABIC_UAE: sl = "AE"; break;
564 case SUBLANG_ARABIC_BAHRAIN: sl = "BH"; break;
565 case SUBLANG_ARABIC_QATAR: sl = "QA"; break;
568 case LANG_ARMENIAN: l = "hy"; break;
569 case LANG_ASSAMESE: l = "as"; break;
570 case LANG_AZERI: l = "az"; break;
571 case LANG_BASQUE: l = "eu"; break;
572 case LANG_BELARUSIAN: l = "be"; break;
573 case LANG_BENGALI: l = "bn"; break;
574 case LANG_BULGARIAN: l = "bg"; break;
575 case LANG_CATALAN: l = "ca"; break;
580 case SUBLANG_CHINESE_TRADITIONAL: sl = "TW"; break;
581 case SUBLANG_CHINESE_SIMPLIFIED: sl = "CH"; break;
582 case SUBLANG_CHINESE_HONGKONG: sl = "HK"; break;
583 case SUBLANG_CHINESE_SINGAPORE: sl = "SG"; break;
584 case SUBLANG_CHINESE_MACAU: sl = "MO"; break;
587 case LANG_CROATIAN: /* LANG_CROATIAN == LANG_SERBIAN
588 * What used to be called Serbo-Croatian
589 * should really now be two separate
590 * languages because of political reasons.
591 * (Says tml, who knows nothing about Serbian
593 * (I can feel those flames coming already.)
597 case SUBLANG_SERBIAN_LATIN: l = "hr"; break;
598 case SUBLANG_SERBIAN_CYRILLIC: l = "sr"; break;
599 default: l = "hr"; /* ??? */
602 case LANG_CZECH: l = "cs"; break;
603 case LANG_DANISH: l = "da"; break;
608 case SUBLANG_DUTCH_BELGIAN: sl = "BE"; break;
615 /* SUBLANG_ENGLISH_US == SUBLANG_DEFAULT. Heh. I thought
616 * English was the language spoken in England.
619 case SUBLANG_ENGLISH_UK: sl = "GB"; break;
620 case SUBLANG_ENGLISH_AUS: sl = "AU"; break;
621 case SUBLANG_ENGLISH_CAN: sl = "CA"; break;
622 case SUBLANG_ENGLISH_NZ: sl = "NZ"; break;
623 case SUBLANG_ENGLISH_EIRE: sl = "IE"; break;
624 case SUBLANG_ENGLISH_SOUTH_AFRICA: sl = "SA"; break;
625 case SUBLANG_ENGLISH_JAMAICA: sl = "JM"; break;
626 case SUBLANG_ENGLISH_CARIBBEAN: sl = "@caribbean"; break; /* ??? */
627 case SUBLANG_ENGLISH_BELIZE: sl = "BZ"; break;
628 case SUBLANG_ENGLISH_TRINIDAD: sl = "TT"; break;
629 case SUBLANG_ENGLISH_ZIMBABWE: sl = "ZW"; break;
630 case SUBLANG_ENGLISH_PHILIPPINES: sl = "PH"; break;
633 case LANG_ESTONIAN: l = "et"; break;
634 case LANG_FAEROESE: l = "fo"; break;
635 case LANG_FARSI: l = "fa"; break;
636 case LANG_FINNISH: l = "fi"; break;
641 case SUBLANG_FRENCH_BELGIAN: sl = "BE"; break;
642 case SUBLANG_FRENCH_CANADIAN: sl = "CA"; break;
643 case SUBLANG_FRENCH_SWISS: sl = "CH"; break;
644 case SUBLANG_FRENCH_LUXEMBOURG: sl = "LU"; break;
645 case SUBLANG_FRENCH_MONACO: sl = "MC"; break;
648 case LANG_GEORGIAN: l = "ka"; break;
653 case SUBLANG_GERMAN_SWISS: sl = "CH"; break;
654 case SUBLANG_GERMAN_AUSTRIAN: sl = "AT"; break;
655 case SUBLANG_GERMAN_LUXEMBOURG: sl = "LU"; break;
656 case SUBLANG_GERMAN_LIECHTENSTEIN: sl = "LI"; break;
659 case LANG_GREEK: l = "el"; break;
660 case LANG_GUJARATI: l = "gu"; break;
661 case LANG_HEBREW: l = "he"; break;
662 case LANG_HINDI: l = "hi"; break;
663 case LANG_HUNGARIAN: l = "hu"; break;
664 case LANG_ICELANDIC: l = "is"; break;
665 case LANG_INDONESIAN: l = "id"; break;
670 case SUBLANG_ITALIAN_SWISS: sl = "CH"; break;
673 case LANG_JAPANESE: l = "ja"; break;
674 case LANG_KANNADA: l = "kn"; break;
679 case SUBLANG_KASHMIRI_INDIA: sl = "IN"; break;
682 case LANG_KAZAK: l = "kk"; break;
683 case LANG_KONKANI: l = "kok"; break; /* ??? */
684 case LANG_KOREAN: l = "ko"; break;
685 case LANG_LATVIAN: l = "lv"; break;
686 case LANG_LITHUANIAN: l = "lt"; break;
687 case LANG_MACEDONIAN: l = "mk"; break;
692 case SUBLANG_MALAY_BRUNEI_DARUSSALAM: sl = "BN"; break;
695 case LANG_MALAYALAM: l = "ml"; break;
696 case LANG_MANIPURI: l = "mni"; break;
697 case LANG_MARATHI: l = "mr"; break;
702 case SUBLANG_NEPALI_INDIA: sl = "IN"; break;
709 /* SUBLANG_NORWEGIAN_BOKMAL == SUBLANG_DEFAULT */
710 case SUBLANG_NORWEGIAN_NYNORSK: sl = "@nynorsk"; break;
713 case LANG_ORIYA: l = "or"; break;
714 case LANG_POLISH: l = "pl"; break;
715 case LANG_PORTUGUESE:
719 /* Hmm. SUBLANG_PORTUGUESE_BRAZILIAN == SUBLANG_DEFAULT */
720 case SUBLANG_PORTUGUESE_BRAZILIAN: sl = "BR"; break;
723 case LANG_PUNJABI: l = "pa"; break;
724 case LANG_ROMANIAN: l = "ro"; break;
725 case LANG_RUSSIAN: l = "ru"; break;
726 case LANG_SANSKRIT: l = "sa"; break;
727 case LANG_SINDHI: l = "sd"; break;
728 case LANG_SLOVAK: l = "sk"; break;
729 case LANG_SLOVENIAN: l = "sl"; break;
734 case SUBLANG_SPANISH_MEXICAN: sl = "MX"; break;
735 case SUBLANG_SPANISH_MODERN: sl = "@modern"; break; /* ??? */
736 case SUBLANG_SPANISH_GUATEMALA: sl = "GT"; break;
737 case SUBLANG_SPANISH_COSTA_RICA: sl = "CR"; break;
738 case SUBLANG_SPANISH_PANAMA: sl = "PA"; break;
739 case SUBLANG_SPANISH_DOMINICAN_REPUBLIC: sl = "DO"; break;
740 case SUBLANG_SPANISH_VENEZUELA: sl = "VE"; break;
741 case SUBLANG_SPANISH_COLOMBIA: sl = "CO"; break;
742 case SUBLANG_SPANISH_PERU: sl = "PE"; break;
743 case SUBLANG_SPANISH_ARGENTINA: sl = "AR"; break;
744 case SUBLANG_SPANISH_ECUADOR: sl = "EC"; break;
745 case SUBLANG_SPANISH_CHILE: sl = "CL"; break;
746 case SUBLANG_SPANISH_URUGUAY: sl = "UY"; break;
747 case SUBLANG_SPANISH_PARAGUAY: sl = "PY"; break;
748 case SUBLANG_SPANISH_BOLIVIA: sl = "BO"; break;
749 case SUBLANG_SPANISH_EL_SALVADOR: sl = "SV"; break;
750 case SUBLANG_SPANISH_HONDURAS: sl = "HN"; break;
751 case SUBLANG_SPANISH_NICARAGUA: sl = "NI"; break;
752 case SUBLANG_SPANISH_PUERTO_RICO: sl = "PR"; break;
755 case LANG_SWAHILI: l = "sw"; break;
760 case SUBLANG_SWEDISH_FINLAND: sl = "FI"; break;
763 case LANG_TAMIL: l = "ta"; break;
764 case LANG_TATAR: l = "tt"; break;
765 case LANG_TELUGU: l = "te"; break;
766 case LANG_THAI: l = "th"; break;
767 case LANG_TURKISH: l = "tr"; break;
768 case LANG_UKRAINIAN: l = "uk"; break;
773 case SUBLANG_URDU_PAKISTAN: sl = "PK"; break;
774 case SUBLANG_URDU_INDIA: sl = "IN"; break;
781 case SUBLANG_UZBEK_CYRILLIC: sl = "@cyrillic"; break;
784 case LANG_VIETNAMESE: l = "vi"; break;
785 default: l = "xx"; break;
794 return g_strdup (bfr);
798 g_win32_error_message (gint error)
804 nbytes = FormatMessage (FORMAT_MESSAGE_ALLOCATE_BUFFER
805 |FORMAT_MESSAGE_IGNORE_INSERTS
806 |FORMAT_MESSAGE_FROM_SYSTEM,
808 (LPTSTR) &msg, 0, NULL);
809 if (nbytes > 2 && msg[nbytes-1] == '\n' && msg[nbytes-2] == '\r')
810 msg[nbytes-2] = '\0';
812 retval = g_strdup (msg);