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