jdk/src/windows/native/java/lang/java_props_md.c
author xdono
Wed, 02 Jul 2008 12:55:45 -0700
changeset 715 f16baef3a20e
parent 49 b25b3ff21b7c
child 1626 e1c6dff266e5
permissions -rw-r--r--
6719955: Update copyright year Summary: Update copyright year for files that have been modified in 2008 Reviewed-by: ohair, tbell
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
715
f16baef3a20e 6719955: Update copyright year
xdono
parents: 49
diff changeset
     2
 * Copyright 1998-2008 Sun Microsystems, Inc.  All Rights Reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
 * published by the Free Software Foundation.  Sun designates this
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
 * by Sun in the LICENSE file that accompanied this code.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
 * CA 95054 USA or visit www.sun.com if you need additional information or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
 * have any questions.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
#include <windows.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
#include <shlobj.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
#include <objidl.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
#include <locale.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
#include <sys/types.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
#include <sys/timeb.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
#include <tchar.h>
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
#include "locale_str.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
#include "java_props.h"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
#ifndef VER_PLATFORM_WIN32_WINDOWS
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
#define VER_PLATFORM_WIN32_WINDOWS 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
#define SHELL_KEY "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
/* Encodings for Windows language groups. According to
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
   www.microsoft.com/globaldev/faqs/locales.asp,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
   some locales do not have codepages, and are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
   supported in Windows 2000/XP solely through Unicode.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
   In this case, we use utf-8 encoding */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
static char *encoding_names[] = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
    "Cp1250",    /*  0:Latin 2  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
    "Cp1251",    /*  1:Cyrillic */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
    "Cp1252",    /*  2:Latin 1  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
    "Cp1253",    /*  3:Greek    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
    "Cp1254",    /*  4:Latin 5  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
    "Cp1255",    /*  5:Hebrew   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
    "Cp1256",    /*  6:Arabic   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
    "Cp1257",    /*  7:Baltic   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
    "Cp1258",    /*  8:Viet Nam */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
    "MS874",     /*  9:Thai     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    "MS932",     /* 10:Japanese */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
    "GBK",       /* 11:PRC GBK  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    "MS949",     /* 12:Korean Extended Wansung */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
    "MS950",     /* 13:Chinese (Taiwan, Hongkong, Macau) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    "utf-8",     /* 14:Unicode  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
    "MS1361",    /* 15:Korean Johab */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
 * List mapping from LanguageID to Java locale IDs.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
 * The entries in this list should not be construed to suggest we actually have
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
 * full locale-data and other support for all of these locales; these are
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
 * merely all of the Windows locales for which we could construct an accurate
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
 * locale ID.  The data is based on the web page "Windows XP/Server 2003 -
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
 * List of Locale IDs, Input Locale, and Language Collection"
90ce3da70b43 Initial load
duke
parents:
diff changeset
    75
 * (http://www.microsoft.com/globaldev/reference/winxp/xp-lcid.mspx)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    76
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    77
 * Some of the language IDs below are not yet used by Windows, but were
90ce3da70b43 Initial load
duke
parents:
diff changeset
    78
 * defined by Microsoft for other products, such as Office XP. They may
90ce3da70b43 Initial load
duke
parents:
diff changeset
    79
 * become Windows language IDs in the future.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    80
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    81
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    82
typedef struct LANGIDtoLocale {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    83
    WORD    langID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    84
    WORD    encoding;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    85
    char*   javaID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    86
} LANGIDtoLocale;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    87
90ce3da70b43 Initial load
duke
parents:
diff changeset
    88
static LANGIDtoLocale langIDMap[] = {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    89
    /* fallback locales to use when the country code doesn't match anything we have */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    90
    0x01,    6, "ar",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    91
    0x02,    1, "bg",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    92
    0x03,    2, "ca",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    93
    0x04,   11, "zh",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    94
    0x05,    0, "cs",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    95
    0x06,    2, "da",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    96
    0x07,    2, "de",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    97
    0x08,    3, "el",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    98
    0x09,    2, "en",
90ce3da70b43 Initial load
duke
parents:
diff changeset
    99
    0x0a,    2, "es",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   100
    0x0b,    2, "fi",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   101
    0x0c,    2, "fr",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   102
    0x0d,    5, "iw",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   103
    0x0e,    0, "hu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   104
    0x0f,    2, "is",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   105
    0x10,    2, "it",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   106
    0x11,   10, "ja",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   107
    0x12,   12, "ko",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   108
    0x13,    2, "nl",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   109
    0x14,    2, "no",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   110
    0x15,    0, "pl",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   111
    0x16,    2, "pt",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   112
    0x17,    2, "rm",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   113
    0x18,    0, "ro",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   114
    0x19,    1, "ru",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   115
    0x1a,    0, "sr",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   116
    0x1b,    0, "sk",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   117
    0x1c,    0, "sq",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   118
    0x1d,    2, "sv",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   119
    0x1e,    9, "th",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   120
    0x1f,    4, "tr",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   121
    0x20,    2, "ur",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   122
    0x21,    2, "in",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   123
    0x22,    1, "uk",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   124
    0x23,    1, "be",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   125
    0x24,    0, "sl",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   126
    0x25,    7, "et",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   127
    0x26,    7, "lv",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   128
    0x27,    7, "lt",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   129
    0x28,    1, "tg",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   130
    0x29,    6, "fa",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   131
    0x2a,    8, "vi",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   132
    0x2b,   14, "hy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   133
    0x2c,    4, "az",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   134
    0x2d,    2, "eu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
/*  0x2e,    2, "??",  no ISO-639 abbreviation for Sorbian */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
    0x2f,    1, "mk",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
    0x31,    2, "ts",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   138
    0x32,    2, "tn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   139
    0x34,    2, "xh",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    0x35,    2, "zu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
    0x36,    2, "af",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    0x37,   14, "ka",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
    0x38,    2, "fo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
    0x39,   14, "hi",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
    0x3a,   14, "mt",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   146
    0x3b,    2, "se",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   147
    0x3c,    2, "gd",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    0x3d,    2, "yi",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
    0x3e,    2, "ms",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    0x3f,    1, "kk",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   151
    0x40,    1, "ky",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
    0x41,    2, "sw",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   153
    0x42,    0, "tk",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   154
    0x43,    1, "uz",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   155
    0x44,    1, "tt",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   156
    0x45,   14, "bn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   157
    0x46,   14, "pa",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   158
    0x47,   14, "gu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   159
    0x48,   14, "or",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   160
    0x49,   14, "ta",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   161
    0x4a,   14, "te",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   162
    0x4b,   14, "kn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
    0x4c,   14, "ml",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   164
    0x4d,   14, "as",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   165
    0x4e,   14, "mr",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   166
    0x4f,   14, "sa",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   167
    0x50,    1, "mn",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   168
    0x51,   14, "bo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   169
    0x52,    1, "cy",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
    0x53,   14, "km",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
    0x54,   14, "lo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   172
    0x56,    2, "gl",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   173
    0x5b,   14, "si",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   174
    0x5d,   14, "iu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   175
    0x5e,   14, "am",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   176
/*  0x5f,    2, "??",  no ISO-639 abbreviation for Tamazight */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   177
    0x68,    2, "ha",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   178
    0x6a,    2, "yo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   179
    0x6b,    2, "qu",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   180
    0x6d,    1, "ba",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   181
    0x6f,    2, "kl",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   182
    0x70,    2, "ig",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
/*  0x78,   14, "??",  no ISO-639 abbreviation for Yi */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
    0x7e,    2, "br",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
    0x80,    6, "ug",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
    0x81,   14, "mi",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
    0x82,    2, "oc",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   188
    0x83,    2, "co",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
/*  0x84,    2, "??",  no ISO-639 abbreviation for Alsatian */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
/*  0x85,    1, "??",  no ISO-639 abbreviation for Yakut */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
/*  0x86,    2, "??",  no ISO-639 abbreviation for K'iche */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   192
    0x87,    2, "rw",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   193
    0x88,    2, "wo",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   194
/*  0x8c,    6, "??",  no ISO-639 abbreviation for Dari */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   195
    /* mappings for real Windows LCID values */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   196
    0x0401,  6, "ar_SA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   197
    0x0402,  1, "bg_BG",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   198
    0x0403,  2, "ca_ES",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   199
    0x0404, 13, "zh_TW",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   200
    0x0405,  0, "cs_CZ",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   201
    0x0406,  2, "da_DK",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   202
    0x0407,  2, "de_DE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   203
    0x0408,  3, "el_GR",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   204
    0x0409,  2, "en_US",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   205
    0x040a,  2, "es_ES",  /* (traditional sort) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   206
    0x040b,  2, "fi_FI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   207
    0x040c,  2, "fr_FR",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   208
    0x040d,  5, "iw_IL",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   209
    0x040e,  0, "hu_HU",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   210
    0x040f,  2, "is_IS",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   211
    0x0410,  2, "it_IT",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   212
    0x0411, 10, "ja_JP",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   213
    0x0412, 12, "ko_KR",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   214
    0x0413,  2, "nl_NL",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   215
    0x0414,  2, "no_NO",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   216
    0x0415,  0, "pl_PL",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   217
    0x0416,  2, "pt_BR",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   218
    0x0417,  2, "rm_CH",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   219
    0x0418,  0, "ro_RO",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   220
    0x0419,  1, "ru_RU",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   221
    0x041a,  0, "hr_HR",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   222
    0x041b,  0, "sk_SK",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   223
    0x041c,  0, "sq_AL",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   224
    0x041d,  2, "sv_SE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   225
    0x041e,  9, "th_TH",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   226
    0x041f,  4, "tr_TR",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   227
    0x0420,  6, "ur_PK",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   228
    0x0421,  2, "in_ID",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   229
    0x0422,  1, "uk_UA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   230
    0x0423,  1, "be_BY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   231
    0x0424,  0, "sl_SI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   232
    0x0425,  7, "et_EE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   233
    0x0426,  7, "lv_LV",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   234
    0x0427,  7, "lt_LT",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   235
    0x0428,  1, "tg_TJ",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   236
    0x0429,  6, "fa_IR",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   237
    0x042a,  8, "vi_VN",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   238
    0x042b, 14, "hy_AM",  /* Armenian  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   239
    0x042c,  4, "az_AZ",  /* Azeri_Latin */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   240
    0x042d,  2, "eu_ES",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   241
/*  0x042e,  2, "??",      no ISO-639 abbreviation for Upper Sorbian */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   242
    0x042f,  1, "mk_MK",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   243
/*  0x0430,  2, "??",      no ISO-639 abbreviation for Sutu */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   244
    0x0431,  2, "ts",     /* (country?) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   245
    0x0432,  2, "tn_ZA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   246
/*  0x0433,  2, "??",      no ISO-639 abbreviation for Venda */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   247
    0x0434,  2, "xh_ZA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   248
    0x0435,  2, "zu_ZA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   249
    0x0436,  2, "af_ZA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   250
    0x0437, 14, "ka_GE",  /* Georgian   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   251
    0x0438,  2, "fo_FO",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   252
    0x0439, 14, "hi_IN",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   253
    0x043a, 14, "mt_MT",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   254
    0x043b,  2, "se_NO",  /* Sami, Northern - Norway */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   255
    0x043c,  2, "gd_GB",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   256
    0x043d,  2, "yi",     /* (country?) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   257
    0x043e,  2, "ms_MY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   258
    0x043f,  1, "kk_KZ",  /* Kazakh */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   259
    0x0440,  1, "ky_KG",  /* Kyrgyz     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   260
    0x0441,  2, "sw_KE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   261
    0x0442,  0, "tk_TM",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   262
    0x0443,  4, "uz_UZ",  /* Uzbek_Latin */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   263
    0x0444,  1, "tt_RU",  /* Tatar */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   264
    0x0445, 14, "bn_IN",  /* Bengali   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   265
    0x0446, 14, "pa_IN",  /* Punjabi   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   266
    0x0447, 14, "gu_IN",  /* Gujarati  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   267
    0x0448, 14, "or_IN",  /* Oriya     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   268
    0x0449, 14, "ta_IN",  /* Tamil     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   269
    0x044a, 14, "te_IN",  /* Telugu    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   270
    0x044b, 14, "kn_IN",  /* Kannada   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   271
    0x044c, 14, "ml_IN",  /* Malayalam */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   272
    0x044d, 14, "as_IN",  /* Assamese  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   273
    0x044e, 14, "mr_IN",  /* Marathi   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   274
    0x044f, 14, "sa_IN",  /* Sanskrit  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   275
    0x0450,  1, "mn_MN",  /* Mongolian */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   276
    0x0451, 14, "bo_CN",  /* Tibetan   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   277
    0x0452,  2, "cy_GB",  /* Welsh     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   278
    0x0453, 14, "km_KH",  /* Khmer     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   279
    0x0454, 14, "lo_LA",  /* Lao       */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   280
    0x0456,  2, "gl_ES",  /* Galician  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   281
/*  0x0457, 14, "??_IN",  /* Konkani, no ISO-639 abbreviation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   282
/*  0x045a, 14, "??_SY",  /* Syriac, no ISO-639 abbreviation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   283
    0x045b, 14, "si_LK",  /* Sinhala   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   284
    0x045d, 14, "iu_CA",  /* Inuktitut */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   285
    0x045e, 14, "am_ET",  /* Amharic   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   286
    0x0461, 14, "ne_NP",  /* Nepali */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   287
    0x0462,  2, "fy_NL",  /* Frisian */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   288
    0x0463,  6, "ps_AF",  /* Pushto */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   289
/*  0x0464,  2, "??_PH",  /* Filipino, no ISO-639 abbreviation*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   290
    0x0465, 14, "dv_MV",  /* Divehi    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   291
    0x0468,  2, "ha_NG",  /* Hausa     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   292
    0x046a,  2, "yo_NG",  /* Yoruba    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   293
    0x046b,  2, "qu_BO",  /* Quechua - Bolivia */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   294
/*  0x046c,  2, "??_ZA",  /* Northern Sotho, no ISO-639 abbreviation */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   295
    0x046d,  1, "ba_RU",  /* Bashkir   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   296
    0x046e,  2, "lb_LU",  /* Luxembourgish */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   297
    0x046f,  2, "kl_GL",  /* Greenlandic */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   298
    0x0470,  2, "ig_NG",  /* Igbo      */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   299
/*  0x0478, 14, "??_CN",  /* Yi (PRC), no ISO-639 abbreviation */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   300
/*  0x047a,  2, "??_CL",  /* Mapudungun (Araucanian), no ISO-639 abbreviation */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   301
/*  0x047c,  2, "??_CA",  /* Mohawk, no ISO-639 abbreviation */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   302
    0x047e,  2, "br_FR",  /* Breton    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   303
    0x0480,  6, "ug_CN",  /* Uighur    */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   304
    0x0481, 14, "mi_NZ",  /* Maori - New Zealand */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   305
    0x0482,  2, "oc_FR",  /* Occitan   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   306
    0x0483,  2, "co_FR",  /* Corsican  */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   307
/*  0x0484,  2, "??_FR",  /* Alsatian, no ISO-639 abbreviation */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   308
/*  0x0485,  1, "??_RU",  /* Yakut, no ISO-639 abbreviation */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   309
/*  0x0486,  2, "??_GT",  /* K'iche, no ISO-639 abbreviation */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   310
    0x0487,  2, "rw_RW",  /* Kinyarwanda */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   311
    0x0488,  2, "wo_SN",  /* Wolof */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   312
/*  0x048c,  6, "??_AF",  /* Dari, no ISO-639 abbreviation */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   313
    0x0801,  6, "ar_IQ",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   314
    0x0804, 11, "zh_CN",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   315
    0x0807,  2, "de_CH",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   316
    0x0809,  2, "en_GB",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   317
    0x080a,  2, "es_MX",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   318
    0x080c,  2, "fr_BE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   319
    0x0810,  2, "it_CH",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   320
    0x0812, 15, "ko_KR",  /* Korean(Johab)*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   321
    0x0813,  2, "nl_BE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   322
    0x0814,  2, "no_NO_NY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   323
    0x0816,  2, "pt_PT",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   324
    0x0818,  0, "ro_MD",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   325
    0x0819,  1, "ru_MD",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   326
    0x081a,  0, "sr_CS",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   327
    0x081d,  2, "sv_FI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   328
    0x082c,  1, "az_AZ",  /* Azeri_Cyrillic */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   329
/*  0x082e,  2, "??",      no ISO-639 abbreviation for Lower Sorbian */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   330
    0x083b,  2, "se_SE",  /* Sami, Northern - Sweden */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   331
    0x083c,  2, "ga_IE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   332
    0x083e,  2, "ms_BN",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   333
    0x0843,  1, "uz_UZ",  /* Uzbek_Cyrillic */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   334
    0x0845, 14, "bn_BD",  /* Bengali   */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   335
    0x0850, 14, "mn_CN",  /* Traditional Mongolian */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   336
    0x085d,  2, "iu_CA",  /* Inuktitut */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   337
/*  0x085f,  2, "??_DZ",      no ISO-639 abbreviation for Tamazight */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   338
    0x086b,  2, "qu_EC",  /* Quechua - Ecuador */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   339
    0x0c01,  6, "ar_EG",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   340
    0x0c04, 13, "zh_HK",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   341
    0x0c07,  2, "de_AT",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   342
    0x0c09,  2, "en_AU",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   343
    0x0c0a,  2, "es_ES",  /* (modern sort) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   344
    0x0c0c,  2, "fr_CA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   345
    0x0c1a,  1, "sr_CS",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   346
    0x0c3b,  2, "se_FI",  /* Sami, Northern - Finland */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   347
    0x0c6b,  2, "qu_PE",  /* Quechua - Peru */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   348
    0x1001,  6, "ar_LY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   349
    0x1004, 11, "zh_SG",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   350
    0x1007,  2, "de_LU",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   351
    0x1009,  2, "en_CA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   352
    0x100a,  2, "es_GT",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   353
    0x100c,  2, "fr_CH",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   354
    0x101a,  0, "hr_BA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   355
/*  0x103b,  2, "??_NO",  /* Sami, Lule - Norway */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   356
    0x1401,  6, "ar_DZ",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   357
    0x1404, 13, "zh_MO",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   358
    0x1407,  2, "de_LI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   359
    0x1409,  2, "en_NZ",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   360
    0x140a,  2, "es_CR",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   361
    0x140c,  2, "fr_LU",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   362
    0x141a,  0, "bs_BA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   363
/*  0x143b,  2, "??_SE",  /* Sami, Lule - Sweden */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   364
    0x1801,  6, "ar_MA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   365
    0x1809,  2, "en_IE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   366
    0x180a,  2, "es_PA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   367
    0x180c,  2, "fr_MC",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   368
    0x181a,  0, "sr_BA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   369
/*  0x183b,  2, "??_NO",  /* Sami, Southern - Norway */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   370
    0x1c01,  6, "ar_TN",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   371
    0x1c09,  2, "en_ZA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   372
    0x1c0a,  2, "es_DO",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   373
    0x1c1a,  1, "sr_BA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   374
/*  0x1c3b,  2, "??_SE",  /* Sami, Southern - Sweden */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   375
    0x2001,  6, "ar_OM",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   376
    0x2009,  2, "en_JM",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   377
    0x200a,  2, "es_VE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   378
    0x201a,  0, "bs_BA",  /* Bosnian (Cyrillic) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   379
/*  0x203b,  2, "??_FI",  /* Sami, Skolt - Finland */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   380
    0x2401,  6, "ar_YE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   381
    0x2409,  2, "en",     /* ("Caribbean", which could be any of many countries) */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   382
    0x240a,  2, "es_CO",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   383
/*  0x243b,  2, "??_FI",  /* Sami, Inari - Finland */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   384
    0x2801,  6, "ar_SY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   385
    0x2809,  2, "en_BZ",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   386
    0x280a,  2, "es_PE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   387
    0x2c01,  6, "ar_JO",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   388
    0x2c09,  2, "en_TT",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   389
    0x2c0a,  2, "es_AR",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   390
    0x3001,  6, "ar_LB",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   391
    0x3009,  2, "en_ZW",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   392
    0x300a,  2, "es_EC",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   393
    0x3401,  6, "ar_KW",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   394
    0x3409,  2, "en_PH",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   395
    0x340a,  2, "es_CL",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   396
    0x3801,  6, "ar_AE",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   397
    0x380a,  2, "es_UY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   398
    0x3c01,  6, "ar_BH",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   399
    0x3c0a,  2, "es_PY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   400
    0x4001,  6, "ar_QA",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   401
    0x4009,  2, "en_IN",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   402
    0x400a,  2, "es_BO",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   403
    0x4409,  2, "en_MY",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   404
    0x440a,  2, "es_SV",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   405
    0x4809,  2, "en_SG",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   406
    0x480a,  2, "es_HN",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   407
    0x4c0a,  2, "es_NI",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   408
    0x500a,  2, "es_PR",
90ce3da70b43 Initial load
duke
parents:
diff changeset
   409
    0x540a,  2, "es_US"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   410
};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   411
90ce3da70b43 Initial load
duke
parents:
diff changeset
   412
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   413
 * binary-search our list of LANGID values.  If we don't find the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   414
 * one we're looking for, mask out the country code and try again
90ce3da70b43 Initial load
duke
parents:
diff changeset
   415
 * with just the primary language ID
90ce3da70b43 Initial load
duke
parents:
diff changeset
   416
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   417
static int
90ce3da70b43 Initial load
duke
parents:
diff changeset
   418
getLocaleEntryIndex(LANGID langID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   419
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   420
    int index = -1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   421
    int tries = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   422
    do {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   423
        int lo, hi, mid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   424
        lo = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   425
        hi = sizeof(langIDMap) / sizeof(LANGIDtoLocale);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   426
        while (index == -1 && lo < hi) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   427
            mid = (lo + hi) / 2;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   428
            if (langIDMap[mid].langID == langID) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   429
                index = mid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   430
            } else if (langIDMap[mid].langID > langID) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   431
                hi = mid;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   432
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   433
                lo = mid + 1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   434
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   435
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   436
        langID = PRIMARYLANGID(langID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   437
        ++tries;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   438
    } while (index == -1 && tries < 2);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   439
90ce3da70b43 Initial load
duke
parents:
diff changeset
   440
    return index;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   441
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   442
90ce3da70b43 Initial load
duke
parents:
diff changeset
   443
static char *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   444
getEncodingInternal(int index)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   445
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   446
    char * ret = encoding_names[langIDMap[index].encoding];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   447
90ce3da70b43 Initial load
duke
parents:
diff changeset
   448
    //Traditional Chinese Windows should use MS950_HKSCS as the
90ce3da70b43 Initial load
duke
parents:
diff changeset
   449
    //default encoding, if HKSCS patch has been installed.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   450
    // "old" MS950 0xfa41 -> u+e001
90ce3da70b43 Initial load
duke
parents:
diff changeset
   451
    // "new" MS950 0xfa41 -> u+92db
90ce3da70b43 Initial load
duke
parents:
diff changeset
   452
    if (strcmp(ret, "MS950") == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   453
        TCHAR  mbChar[2] = {(char)0xfa, (char)0x41};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   454
        WCHAR  unicodeChar;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   455
        MultiByteToWideChar(CP_ACP, 0, mbChar, 2, &unicodeChar, 1);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   456
        if (unicodeChar == 0x92db) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   457
            ret = "MS950_HKSCS";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   458
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   459
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   460
        //SimpChinese Windows should use GB18030 as the default
90ce3da70b43 Initial load
duke
parents:
diff changeset
   461
        //encoding, if gb18030 patch has been installed (on windows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   462
        //2000/XP, (1)Codepage 54936 will be available
90ce3da70b43 Initial load
duke
parents:
diff changeset
   463
        //(2)simsun18030.ttc will exist under system fonts dir )
90ce3da70b43 Initial load
duke
parents:
diff changeset
   464
        if (strcmp(ret, "GBK") == 0 && IsValidCodePage(54936)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   465
            char systemPath[MAX_PATH + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   466
            char* gb18030Font = "\\FONTS\\SimSun18030.ttc";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   467
            FILE *f = NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   468
            if (GetWindowsDirectory(systemPath, MAX_PATH + 1) != 0 &&
90ce3da70b43 Initial load
duke
parents:
diff changeset
   469
                strlen(systemPath) + strlen(gb18030Font) < MAX_PATH + 1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   470
                strcat(systemPath, "\\FONTS\\SimSun18030.ttc");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   471
                if ((f = fopen(systemPath, "r")) != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   472
                    fclose(f);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   473
                    ret = "GB18030";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   474
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   475
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   476
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   477
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   478
90ce3da70b43 Initial load
duke
parents:
diff changeset
   479
    return ret;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   480
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   481
90ce3da70b43 Initial load
duke
parents:
diff changeset
   482
// Exported entries for AWT
90ce3da70b43 Initial load
duke
parents:
diff changeset
   483
DllExport const char *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   484
getEncodingFromLangID(LANGID langID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   485
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   486
    int index = getLocaleEntryIndex(langID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   487
90ce3da70b43 Initial load
duke
parents:
diff changeset
   488
    if (index != (-1)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   489
        return getEncodingInternal(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   490
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   491
        return "Cp1252";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   492
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   493
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   494
90ce3da70b43 Initial load
duke
parents:
diff changeset
   495
DllExport const char *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   496
getJavaIDFromLangID(LANGID langID)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   497
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   498
    int index = getLocaleEntryIndex(langID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   499
90ce3da70b43 Initial load
duke
parents:
diff changeset
   500
    if (index != (-1)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   501
        return langIDMap[index].javaID;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   502
    } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   503
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   504
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   505
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   506
90ce3da70b43 Initial load
duke
parents:
diff changeset
   507
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   508
 * Code to figure out the user's home directory using the registry
90ce3da70b43 Initial load
duke
parents:
diff changeset
   509
*/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   510
static char *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   511
getHomeFromRegistry()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   512
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   513
    HKEY key;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   514
    int rc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   515
    DWORD type;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   516
    char *p;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   517
    char path[MAX_PATH+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   518
    int size = MAX_PATH+1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   519
90ce3da70b43 Initial load
duke
parents:
diff changeset
   520
    rc = RegOpenKeyEx(HKEY_CURRENT_USER, SHELL_KEY, 0, KEY_READ, &key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   521
    if (rc != ERROR_SUCCESS) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   522
        // Shell folder doesn't exist??!!
90ce3da70b43 Initial load
duke
parents:
diff changeset
   523
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   524
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   525
90ce3da70b43 Initial load
duke
parents:
diff changeset
   526
    path[0] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   527
    rc = RegQueryValueEx(key, "Desktop", 0, &type, path, &size);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   528
    if (rc != ERROR_SUCCESS || type != REG_SZ) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   529
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   530
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   531
    RegCloseKey(key);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   532
    /* Get the parent of Desktop directory */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   533
    p = strrchr(path, '\\');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   534
    if (p == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   535
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   536
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   537
    *p = '\0';
90ce3da70b43 Initial load
duke
parents:
diff changeset
   538
    return strdup(path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   539
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   540
90ce3da70b43 Initial load
duke
parents:
diff changeset
   541
/*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   542
 * Code to figure out the user's home directory using shell32.dll
90ce3da70b43 Initial load
duke
parents:
diff changeset
   543
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   544
typedef HRESULT (WINAPI *GetSpecialFolderType)(HWND, int, LPITEMIDLIST *);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   545
typedef BOOL (WINAPI *GetPathFromIDListType)(LPCITEMIDLIST, LPSTR);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   546
90ce3da70b43 Initial load
duke
parents:
diff changeset
   547
char *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   548
getHomeFromShell32()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   549
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   550
    HMODULE lib = LoadLibrary("SHELL32.DLL");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   551
    GetSpecialFolderType do_get_folder;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   552
    GetPathFromIDListType do_get_path;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   553
    HRESULT rc;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   554
    LPITEMIDLIST item_list = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   555
    char *p;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   556
    char path[MAX_PATH+1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   557
    int size = MAX_PATH+1;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   558
90ce3da70b43 Initial load
duke
parents:
diff changeset
   559
    if (lib == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   560
        // We can't load the library !!??
90ce3da70b43 Initial load
duke
parents:
diff changeset
   561
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   562
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   563
90ce3da70b43 Initial load
duke
parents:
diff changeset
   564
    do_get_folder = (GetSpecialFolderType)GetProcAddress(lib, "SHGetSpecialFolderLocation");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   565
    do_get_path = (GetPathFromIDListType)GetProcAddress(lib, "SHGetPathFromIDListA");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   566
90ce3da70b43 Initial load
duke
parents:
diff changeset
   567
    if (do_get_folder == 0 || do_get_path == 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   568
        // the library doesn't hold the right functions !!??
90ce3da70b43 Initial load
duke
parents:
diff changeset
   569
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   570
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   571
90ce3da70b43 Initial load
duke
parents:
diff changeset
   572
    rc = (*do_get_folder)(NULL, CSIDL_DESKTOPDIRECTORY, &item_list);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   573
    if (!SUCCEEDED(rc)) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   574
        // we can't find the shell folder.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   575
        return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   576
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   577
90ce3da70b43 Initial load
duke
parents:
diff changeset
   578
    path[0] = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   579
    (*do_get_path)(item_list, path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   580
90ce3da70b43 Initial load
duke
parents:
diff changeset
   581
    /* Get the parent of Desktop directory */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   582
    p = strrchr(path, '\\');
90ce3da70b43 Initial load
duke
parents:
diff changeset
   583
    if (p) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   584
        *p = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   585
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   586
90ce3da70b43 Initial load
duke
parents:
diff changeset
   587
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   588
     * We've been successful.  Note that we don't free the memory allocated
90ce3da70b43 Initial load
duke
parents:
diff changeset
   589
     * by ShGetSpecialFolderLocation.  We only ever come through here once,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   590
     * and only if the registry lookup failed, so it's just not worth it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   591
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   592
     * We also don't unload the SHELL32 DLL.  We've paid the hit for loading
90ce3da70b43 Initial load
duke
parents:
diff changeset
   593
     * it and we may need it again later.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   594
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   595
90ce3da70b43 Initial load
duke
parents:
diff changeset
   596
    return strdup(path);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   597
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   598
90ce3da70b43 Initial load
duke
parents:
diff changeset
   599
static boolean
90ce3da70b43 Initial load
duke
parents:
diff changeset
   600
haveMMX(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   601
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   602
    boolean mmx = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   603
    HMODULE lib = LoadLibrary("KERNEL32");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   604
    if (lib != NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   605
        BOOL (WINAPI *isProcessorFeaturePresent)(DWORD) =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   606
            (BOOL (WINAPI *)(DWORD))
90ce3da70b43 Initial load
duke
parents:
diff changeset
   607
            GetProcAddress(lib, "IsProcessorFeaturePresent");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   608
        if (isProcessorFeaturePresent != NULL)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   609
            mmx = isProcessorFeaturePresent(PF_MMX_INSTRUCTIONS_AVAILABLE);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   610
        FreeLibrary(lib);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   611
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   612
    return mmx;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   613
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   614
90ce3da70b43 Initial load
duke
parents:
diff changeset
   615
static const char *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   616
cpu_isalist(void)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   617
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   618
    SYSTEM_INFO info;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   619
    GetSystemInfo(&info);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   620
    switch (info.wProcessorArchitecture) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   621
#ifdef PROCESSOR_ARCHITECTURE_IA64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   622
    case PROCESSOR_ARCHITECTURE_IA64: return "ia64";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   623
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   624
#ifdef PROCESSOR_ARCHITECTURE_AMD64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   625
    case PROCESSOR_ARCHITECTURE_AMD64: return "amd64";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   626
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   627
    case PROCESSOR_ARCHITECTURE_INTEL:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   628
        switch (info.wProcessorLevel) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   629
        case 6: return haveMMX()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   630
            ? "pentium_pro+mmx pentium_pro pentium+mmx pentium i486 i386 i86"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   631
            : "pentium_pro pentium i486 i386 i86";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   632
        case 5: return haveMMX()
90ce3da70b43 Initial load
duke
parents:
diff changeset
   633
            ? "pentium+mmx pentium i486 i386 i86"
90ce3da70b43 Initial load
duke
parents:
diff changeset
   634
            : "pentium i486 i386 i86";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   635
        case 4: return "i486 i386 i86";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   636
        case 3: return "i386 i86";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   637
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   638
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   639
    return NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   640
}
90ce3da70b43 Initial load
duke
parents:
diff changeset
   641
90ce3da70b43 Initial load
duke
parents:
diff changeset
   642
java_props_t *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   643
GetJavaProperties(JNIEnv* env)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   644
{
90ce3da70b43 Initial load
duke
parents:
diff changeset
   645
    static java_props_t sprops = {0};
90ce3da70b43 Initial load
duke
parents:
diff changeset
   646
90ce3da70b43 Initial load
duke
parents:
diff changeset
   647
    if (sprops.user_dir) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   648
        return &sprops;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   649
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   650
90ce3da70b43 Initial load
duke
parents:
diff changeset
   651
    /* AWT properties */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   652
    sprops.awt_toolkit = "sun.awt.windows.WToolkit";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   653
90ce3da70b43 Initial load
duke
parents:
diff changeset
   654
    /* tmp dir */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   655
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   656
        char tmpdir[MAX_PATH + 1];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   657
        /* we might want to check that this succeed */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   658
        GetTempPath(MAX_PATH + 1, tmpdir);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   659
        sprops.tmp_dir = strdup(tmpdir);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   660
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   661
90ce3da70b43 Initial load
duke
parents:
diff changeset
   662
    /* Printing properties */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   663
    sprops.printerJob = "sun.awt.windows.WPrinterJob";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   664
90ce3da70b43 Initial load
duke
parents:
diff changeset
   665
    /* Java2D properties */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   666
    sprops.graphics_env = "sun.awt.Win32GraphicsEnvironment";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   667
90ce3da70b43 Initial load
duke
parents:
diff changeset
   668
    {    /* This is used only for debugging of font problems. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   669
        char *path = getenv("JAVA2D_FONTPATH");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   670
        sprops.font_dir = (path != 0) ? strdup(path) : NULL;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   671
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   672
90ce3da70b43 Initial load
duke
parents:
diff changeset
   673
    /* OS properties */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   674
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   675
        char buf[100];
49
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   676
        OSVERSIONINFOEX ver;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   677
        ver.dwOSVersionInfoSize = sizeof(ver);
49
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   678
        GetVersionEx((OSVERSIONINFO *) &ver);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   679
90ce3da70b43 Initial load
duke
parents:
diff changeset
   680
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   681
         * From msdn page on OSVERSIONINFOEX, current as of this
49
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   682
         * writing, decoding of dwMajorVersion and dwMinorVersion.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   683
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   684
         *  Operating system            dwMajorVersion  dwMinorVersion
90ce3da70b43 Initial load
duke
parents:
diff changeset
   685
         * ==================           ==============  ==============
90ce3da70b43 Initial load
duke
parents:
diff changeset
   686
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   687
         * Windows 95                   4               0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   688
         * Windows 98                   4               10
90ce3da70b43 Initial load
duke
parents:
diff changeset
   689
         * Windows ME                   4               90
90ce3da70b43 Initial load
duke
parents:
diff changeset
   690
         * Windows 3.51                 3               51
90ce3da70b43 Initial load
duke
parents:
diff changeset
   691
         * Windows NT 4.0               4               0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   692
         * Windows 2000                 5               0
90ce3da70b43 Initial load
duke
parents:
diff changeset
   693
         * Windows XP                   5               1
90ce3da70b43 Initial load
duke
parents:
diff changeset
   694
         * Windows Server 2003 family   5               2
49
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   695
         * Windows Vista family         6               0
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   696
         *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   697
         * This mapping will presumably be augmented as new Windows
90ce3da70b43 Initial load
duke
parents:
diff changeset
   698
         * versions are released.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   699
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   700
        switch (ver.dwPlatformId) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   701
        case VER_PLATFORM_WIN32s:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   702
            sprops.os_name = "Windows 3.1";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   703
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   704
        case VER_PLATFORM_WIN32_WINDOWS:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   705
           if (ver.dwMajorVersion == 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   706
                switch (ver.dwMinorVersion) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   707
                case  0: sprops.os_name = "Windows 95";           break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   708
                case 10: sprops.os_name = "Windows 98";           break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   709
                case 90: sprops.os_name = "Windows Me";           break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   710
                default: sprops.os_name = "Windows 9X (unknown)"; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   711
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   712
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   713
                sprops.os_name = "Windows 9X (unknown)";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   714
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   715
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   716
        case VER_PLATFORM_WIN32_NT:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   717
            if (ver.dwMajorVersion <= 4) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   718
                sprops.os_name = "Windows NT";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   719
            } else if (ver.dwMajorVersion == 5) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   720
                switch (ver.dwMinorVersion) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   721
                case  0: sprops.os_name = "Windows 2000";         break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   722
                case  1: sprops.os_name = "Windows XP";           break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   723
                case  2: sprops.os_name = "Windows 2003";         break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   724
                default: sprops.os_name = "Windows NT (unknown)"; break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   725
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   726
            } else if (ver.dwMajorVersion == 6) {
49
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   727
                /*
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   728
                 * From MSDN OSVERSIONINFOEX documentation:
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   729
                 *
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   730
                 * "Because the version numbers for Windows Server 2008
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   731
                 * and Windows Vista are identical, you must also test
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   732
                 * whether the wProductType member is VER_NT_WORKSTATION.
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   733
                 * If wProductType is VER_NT_WORKSTATION, the operating
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   734
                 * system is Windows Vista; otherwise, it is Windows
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   735
                 * Server 2008."
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   736
                 */
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   737
                if (ver.wProductType == VER_NT_WORKSTATION)
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   738
                    sprops.os_name = "Windows Vista";
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   739
                else
b25b3ff21b7c 6642034: System.getProperty("os.name") returns Windows Vista on Windows Server 2008 (longhorn)
martin
parents: 2
diff changeset
   740
                    sprops.os_name = "Windows Server 2008";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   741
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   742
                sprops.os_name = "Windows NT (unknown)";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   743
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   744
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   745
        default:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   746
            sprops.os_name = "Windows (unknown)";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   747
            break;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   748
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   749
        sprintf(buf, "%d.%d", ver.dwMajorVersion, ver.dwMinorVersion);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   750
        sprops.os_version = strdup(buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   751
#if _M_IA64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   752
        sprops.os_arch = "ia64";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   753
#elif _M_AMD64
90ce3da70b43 Initial load
duke
parents:
diff changeset
   754
        sprops.os_arch = "amd64";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   755
#elif _X86_
90ce3da70b43 Initial load
duke
parents:
diff changeset
   756
        sprops.os_arch = "x86";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   757
#else
90ce3da70b43 Initial load
duke
parents:
diff changeset
   758
        sprops.os_arch = "unknown";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   759
#endif
90ce3da70b43 Initial load
duke
parents:
diff changeset
   760
90ce3da70b43 Initial load
duke
parents:
diff changeset
   761
        sprops.patch_level = strdup(ver.szCSDVersion);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   762
90ce3da70b43 Initial load
duke
parents:
diff changeset
   763
        sprops.desktop = "windows";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   764
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   765
90ce3da70b43 Initial load
duke
parents:
diff changeset
   766
    /* Endianness of platform */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   767
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   768
        unsigned int endianTest = 0xff000000;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   769
        if (((char*)(&endianTest))[0] != 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   770
            sprops.cpu_endian = "big";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   771
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   772
            sprops.cpu_endian = "little";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   773
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   774
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   775
90ce3da70b43 Initial load
duke
parents:
diff changeset
   776
    /* CPU ISA list */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   777
    sprops.cpu_isalist = cpu_isalist();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   778
90ce3da70b43 Initial load
duke
parents:
diff changeset
   779
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   780
     * User name
90ce3da70b43 Initial load
duke
parents:
diff changeset
   781
     * We try to avoid calling GetUserName as it turns out to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   782
     * be surprisingly expensive on NT.  It pulls in an extra
90ce3da70b43 Initial load
duke
parents:
diff changeset
   783
     * 100 K of footprint.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   784
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   785
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   786
        char *uname = getenv("USERNAME");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   787
        if (uname != NULL && strlen(uname) > 0) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   788
            sprops.user_name = strdup(uname);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   789
        } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   790
            char buf[100];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   791
            int buflen = sizeof(buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   792
            sprops.user_name =
90ce3da70b43 Initial load
duke
parents:
diff changeset
   793
                GetUserName(buf, &buflen) ? strdup(buf) : "unknown";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   794
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   795
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   796
90ce3da70b43 Initial load
duke
parents:
diff changeset
   797
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   798
     * Home directory/
90ce3da70b43 Initial load
duke
parents:
diff changeset
   799
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   800
     * We first look under a standard registry key.  If that fails we
90ce3da70b43 Initial load
duke
parents:
diff changeset
   801
     * fall back on using a SHELL32.DLL API.  If that fails we use a
90ce3da70b43 Initial load
duke
parents:
diff changeset
   802
     * default value.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   803
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   804
     * Note: To save space we want to avoid loading SHELL32.DLL
90ce3da70b43 Initial load
duke
parents:
diff changeset
   805
     * unless really necessary.  However if we do load it, we leave it
90ce3da70b43 Initial load
duke
parents:
diff changeset
   806
     * in memory, as it may be needed again later.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   807
     *
90ce3da70b43 Initial load
duke
parents:
diff changeset
   808
     * The normal result is that for a given user name XXX:
90ce3da70b43 Initial load
duke
parents:
diff changeset
   809
     *     On multi-user NT, user.home gets set to c:\winnt\profiles\XXX.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   810
     *     On multi-user Win95, user.home gets set to c:\windows\profiles\XXX.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   811
     *     On single-user Win95, user.home gets set to c:\windows.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   812
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   813
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   814
        char *homep = getHomeFromRegistry();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   815
        if (homep == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   816
            homep = getHomeFromShell32();
90ce3da70b43 Initial load
duke
parents:
diff changeset
   817
            if (homep == NULL) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   818
                homep = "C:\\";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   819
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   820
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   821
        sprops.user_home = homep;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   822
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   823
90ce3da70b43 Initial load
duke
parents:
diff changeset
   824
    /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   825
     *  user.language
90ce3da70b43 Initial load
duke
parents:
diff changeset
   826
     *  user.country, user.variant (if user's environment specifies them)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   827
     *  file.encoding
90ce3da70b43 Initial load
duke
parents:
diff changeset
   828
     *  file.encoding.pkg
90ce3da70b43 Initial load
duke
parents:
diff changeset
   829
     */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   830
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   831
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   832
         * query the system for the current system default locale
90ce3da70b43 Initial load
duke
parents:
diff changeset
   833
         * (which is a Windows LCID value),
90ce3da70b43 Initial load
duke
parents:
diff changeset
   834
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   835
        LANGID langID = LANGIDFROMLCID(GetUserDefaultLCID());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   836
        LANGID sysLangID = LANGIDFROMLCID(GetSystemDefaultLCID());
90ce3da70b43 Initial load
duke
parents:
diff changeset
   837
90ce3da70b43 Initial load
duke
parents:
diff changeset
   838
        {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   839
            int index = getLocaleEntryIndex(langID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   840
90ce3da70b43 Initial load
duke
parents:
diff changeset
   841
            /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   842
             * if we didn't find the LCID that the system returned to us,
90ce3da70b43 Initial load
duke
parents:
diff changeset
   843
             * we don't have a Java locale ID that corresponds to it.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   844
             * Fall back on en_US.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   845
             */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   846
            if (index == -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   847
                sprops.language = "en";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   848
                sprops.country = "US";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   849
                sprops.encoding = "Cp1252";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   850
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   851
90ce3da70b43 Initial load
duke
parents:
diff changeset
   852
                /* otherwise, look up the corresponding Java locale ID from
90ce3da70b43 Initial load
duke
parents:
diff changeset
   853
                 * the list of Java locale IDs and set up the system properties
90ce3da70b43 Initial load
duke
parents:
diff changeset
   854
                 * accordingly.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   855
                 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   856
90ce3da70b43 Initial load
duke
parents:
diff changeset
   857
                char* lang;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   858
                char* ctry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   859
                char* variant;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   860
90ce3da70b43 Initial load
duke
parents:
diff changeset
   861
                lang = strdup(langIDMap[index].javaID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   862
                ctry = lang;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   863
90ce3da70b43 Initial load
duke
parents:
diff changeset
   864
                while (*ctry != '_' && *ctry != 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   865
                    ++ctry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   866
90ce3da70b43 Initial load
duke
parents:
diff changeset
   867
                if (*ctry == '_') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   868
                    *ctry++ = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   869
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   870
90ce3da70b43 Initial load
duke
parents:
diff changeset
   871
                variant = ctry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   872
                while (*variant != '_' && *variant != 0)
90ce3da70b43 Initial load
duke
parents:
diff changeset
   873
                    ++variant;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   874
90ce3da70b43 Initial load
duke
parents:
diff changeset
   875
                if (*variant == '_') {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   876
                    *variant++ = 0;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   877
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   878
90ce3da70b43 Initial load
duke
parents:
diff changeset
   879
                sprops.language = lang;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   880
                sprops.country = ctry;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   881
                sprops.variant = variant;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   882
                sprops.encoding = getEncodingInternal(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   883
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   884
            index = getLocaleEntryIndex(sysLangID);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   885
            if (index == -1) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   886
                sprops.sun_jnu_encoding = "Cp1252";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   887
            } else {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   888
                sprops.sun_jnu_encoding = getEncodingInternal(index);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   889
            }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   890
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   891
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   892
90ce3da70b43 Initial load
duke
parents:
diff changeset
   893
    sprops.unicode_encoding = "UnicodeLittle";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   894
    /* User TIMEZONE */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   895
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   896
        /*
90ce3da70b43 Initial load
duke
parents:
diff changeset
   897
         * We defer setting up timezone until it's actually necessary.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   898
         * Refer to TimeZone.getDefault(). However, the system
90ce3da70b43 Initial load
duke
parents:
diff changeset
   899
         * property is necessary to be able to be set by the command
90ce3da70b43 Initial load
duke
parents:
diff changeset
   900
         * line interface -D. Here temporarily set a null string to
90ce3da70b43 Initial load
duke
parents:
diff changeset
   901
         * timezone.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   902
         */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   903
        sprops.timezone = "";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   904
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   905
90ce3da70b43 Initial load
duke
parents:
diff changeset
   906
    /* Current directory */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   907
    {
90ce3da70b43 Initial load
duke
parents:
diff changeset
   908
        char buf[MAX_PATH];
90ce3da70b43 Initial load
duke
parents:
diff changeset
   909
        GetCurrentDirectory(sizeof(buf), buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   910
        sprops.user_dir = strdup(buf);
90ce3da70b43 Initial load
duke
parents:
diff changeset
   911
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   912
90ce3da70b43 Initial load
duke
parents:
diff changeset
   913
    sprops.file_separator = "\\";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   914
    sprops.path_separator = ";";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   915
    sprops.line_separator = "\r\n";
90ce3da70b43 Initial load
duke
parents:
diff changeset
   916
90ce3da70b43 Initial load
duke
parents:
diff changeset
   917
    return &sprops;
90ce3da70b43 Initial load
duke
parents:
diff changeset
   918
}