ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/cebix/SheepShaver/src/Windows/user_strings_windows.cpp
Revision: 1.3
Committed: 2005-03-19T19:09:44Z (19 years, 6 months ago) by gbeauche
Branch: MAIN
Changes since 1.2: +1 -0 lines
Log Message:
Check that we are running a Windows NT kernel >= 4.0 and drivers are
installed correctly (namely cdenable.sys)

File Contents

# User Rev Content
1 gbeauche 1.1 /*
2     * user_strings_windows.cpp - Localizable strings, Windows specific strings
3     *
4 gbeauche 1.2 * SheepShaver (C) 1997-2005 Christian Bauer and Marc Hellwig
5 gbeauche 1.1 *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18     * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19     */
20    
21     #include "sysdeps.h"
22     #include "user_strings.h"
23    
24    
25     // Platform-specific string definitions
26     user_string_def platform_strings[] = {
27     // Common strings that have a platform-specific variant
28     {STR_EXTFS_VOLUME_NAME, "My Computer"},
29    
30     // Purely platform-specific strings
31     {STR_LOW_MEM_MMAP_ERR, "Cannot map Low Memory Globals: %s."},
32     {STR_KD_SHMGET_ERR, "Cannot create SHM segment for Kernel Data: %s."},
33     {STR_KD_SHMAT_ERR, "Cannot map first Kernel Data area: %s."},
34     {STR_KD2_SHMAT_ERR, "Cannot map second Kernel Data area: %s."},
35     {STR_ROM_MMAP_ERR, "Cannot map ROM: %s."},
36     {STR_RAM_MMAP_ERR, "Cannot map RAM: %s."},
37     {STR_DR_CACHE_MMAP_ERR, "Cannot map DR Cache: %s."},
38     {STR_DR_EMULATOR_MMAP_ERR, "Cannot map DR Emulator: %s."},
39     {STR_SHEEP_MEM_MMAP_ERR, "Cannot map SheepShaver Data area: %s."},
40     {STR_NO_XVISUAL_ERR, "Cannot obtain appropriate X visual."},
41     {STR_NO_AUDIO_WARN, "No audio device found, audio output will be disabled."},
42     {STR_KEYCODE_FILE_WARN, "Cannot open keycode translation file %s (%s)."},
43     {STR_KEYCODE_VENDOR_WARN, "Cannot find vendor '%s' in keycode translation file %s."},
44     {STR_VOSF_INIT_ERR, "Cannot initialize Video on SEGV signals."},
45    
46     {STR_OPEN_WINDOW_ERR, "Cannot open Mac window."},
47     {STR_WINDOW_TITLE_GRABBED, "SheepShaver (mouse grabbed, press Ctrl-F5 to release)"},
48 gbeauche 1.3 {STR_NO_WIN32_NT_4, "SheepShaver does not run on Windows NT versions less than 4.0"},
49 gbeauche 1.1
50     {-1, NULL} // End marker
51     };
52    
53    
54     /*
55     * Search for main volume name
56     */
57    
58     static const char *get_volume_name(void)
59     {
60     HKEY hHelpKey;
61     DWORD key_type, cbData;
62    
63     static char volume[256];
64     memset(volume, 0, sizeof(volume));
65    
66     // Try Windows 2000 key first
67     if (ERROR_SUCCESS == RegOpenKey(
68     HKEY_CURRENT_USER,
69     "Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
70     &hHelpKey))
71     {
72     cbData = sizeof(volume);
73     RegQueryValueEx( hHelpKey, 0, NULL, &key_type, (unsigned char *)volume, &cbData );
74     RegCloseKey(hHelpKey);
75     }
76    
77     if (volume[0] == 0 &&
78     ERROR_SUCCESS == RegOpenKey(
79     HKEY_CURRENT_USER,
80     "Software\\Classes\\CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
81     &hHelpKey))
82     {
83     cbData = sizeof(volume);
84     RegQueryValueEx( hHelpKey, 0, NULL, &key_type, (unsigned char *)volume, &cbData );
85     RegCloseKey(hHelpKey);
86     }
87    
88     if (volume[0] == 0 &&
89     ERROR_SUCCESS == RegOpenKey(
90     HKEY_CLASSES_ROOT,
91     "CLSID\\{20D04FE0-3AEA-1069-A2D8-08002B30309D}",
92     &hHelpKey))
93     {
94     cbData = sizeof(volume);
95     RegQueryValueEx( hHelpKey, 0, NULL, &key_type, (unsigned char *)volume, &cbData );
96     RegCloseKey(hHelpKey);
97     }
98    
99     // Fix the error that some "tweak" apps do.
100     if (stricmp(volume, "%USERNAME% on %COMPUTER%") == 0)
101     volume[0] = '\0';
102    
103     // No volume name found, default to "My Computer"
104     if (volume[0] == 0)
105     strcpy(volume, "My Computer");
106    
107     return volume;
108     }
109    
110    
111     /*
112     * Fetch pointer to string, given the string number
113     */
114    
115     const char *GetString(int num)
116     {
117     // First, search for platform-specific variable string
118     switch (num) {
119     case STR_EXTFS_VOLUME_NAME:
120     return get_volume_name();
121     }
122    
123     // Next, search for platform-specific string
124     int i = 0;
125     while (platform_strings[i].num >= 0) {
126     if (platform_strings[i].num == num)
127     return platform_strings[i].str;
128     i++;
129     }
130    
131     // Not found, search for common string
132     i = 0;
133     while (common_strings[i].num >= 0) {
134     if (common_strings[i].num == num)
135     return common_strings[i].str;
136     i++;
137     }
138     return NULL;
139     }