main.c revision 1.39 1 /* $NetBSD: main.c,v 1.39 2000/04/16 03:17:59 takemura Exp $ */
2
3 /*-
4 * Copyright (c) 1999 Shin Takemura.
5 * All rights reserved.
6 *
7 * This software is part of the PocketBSD.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by the PocketBSD project
20 * and its contributors.
21 * 4. Neither the name of the project nor the names of its contributors
22 * may be used to endorse or promote products derived from this software
23 * without specific prior written permission.
24 *
25 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 * SUCH DAMAGE.
36 *
37 */
38 #include <pbsdboot.h>
39 #include <commctrl.h>
40 #include <res/resource.h>
41
42 /*
43 * If you modify this program and update pbsdboot.uu,
44 * change version string which is coded in main.c
45 * appropriately.
46 *
47 * The version string is in format:
48 *
49 * Version A.B.C YYYY.MM.DD
50 *
51 * in where:
52 *
53 * A: Don't change this.
54 * B: Increment this number if you change program's behavior,
55 * fix some bugs or add new features.
56 * C: Increment this number if you change/add some
57 * parameters, constants, windows' resources.
58 * YYYY.MM.DD: date
59 */
60 TCHAR *version_string =
61 TEXT("PocketBSD boot loader\r\n")
62 TEXT("Version 1.13.2 2000.04.16\r\n")
63 #if ( _WIN32_WCE < 200 )
64 TEXT("Compiled for WinCE 1.01\r\n")
65 #else
66 TEXT("Compiled for WinCE 2.00\r\n")
67 #endif
68 TEXT("\r\n")
69 TEXT("Copyright(C) 1999 Shin Takemura,\r\n")
70 TEXT("All rights reserved.\r\n")
71 TEXT("\r\n")
72 TEXT("http://www.netbsd.org/Ports/hpcmips\r\n");
73
74 /*-----------------------------------------------------------------------------
75
76 type difinitions
77
78 -----------------------------------------------------------------------------*/
79 enum {
80 UPDATE_DLGBOX,
81 UPDATE_DATA,
82 };
83
84 struct fb_type {
85 int type;
86 TCHAR *name;
87 };
88
89 struct fb_setting {
90 TCHAR *name;
91 int type;
92 int width, height, linebytes;
93 long addr;
94 unsigned long platid_cpu, platid_machine;
95 };
96
97 /*-----------------------------------------------------------------------------
98
99 variable declarations
100
101 -----------------------------------------------------------------------------*/
102 HINSTANCE hInst = NULL;
103 HWND hWndMain;
104 HWND hWndCB = NULL;
105 HWND hDlgLoad = NULL;
106 unsigned int dlgStatus;
107 int user_define_idx;
108 int osversion;
109
110 /*-----------------------------------------------------------------------------
111
112 data
113
114 -----------------------------------------------------------------------------*/
115 TCHAR szAppName[ ] = TEXT("PocketBSD boot");
116 TCHAR szTitle[ ] = TEXT("Welcome to PocketBSD!");
117
118 /*
119 * Wince_conf identify executable binary file.
120 */
121 #if ( _WIN32_WCE < 200 )
122 static char *wince_conf = "Compiled for WinCE 1.01";
123 #else
124 static char *wince_conf = "Compiled for WinCE 2.00";
125 #endif
126
127 struct fb_type fb_types[] = {
128 { BIFB_D2_M2L_3, TEXT(BIFBN_D2_M2L_3) },
129 { BIFB_D2_M2L_3x2, TEXT(BIFBN_D2_M2L_3x2) },
130 { BIFB_D2_M2L_0, TEXT(BIFBN_D2_M2L_0) },
131 { BIFB_D8_00, TEXT(BIFBN_D8_00) },
132 { BIFB_D8_FF, TEXT(BIFBN_D8_FF) },
133 { BIFB_D16_0000, TEXT(BIFBN_D16_0000) },
134 { BIFB_D16_FFFF, TEXT(BIFBN_D16_FFFF) },
135 };
136
137 int fb_size[] = {
138 160, 240, 320, 400, 480, 600, 640,
139 768, 800, 1024, 1150, 1280, 1600
140 };
141
142 int fb_bpl[] = {
143 40, 80, 128, 160, 240, 256, 320,
144 384, 400, 480, 512, 600, 640, 768, 800, 1024, 1150, 1280, 1600
145 };
146
147 struct fb_setting fb_settings[] = {
148 /*
149 * You must choose fb_type to make the screen look black-on-white.
150 * (Foreground color is black and background color is white.)
151 */
152 { NULL, BIFB_D2_M2L_3,
153 320, 240, 80, 0xa000000,
154 PLATID_UNKNOWN, PLATID_UNKNOWN },
155 { TEXT("FreeStyle"), BIFB_D2_M2L_3,
156 320, 240, 80, 0xa000000,
157 PLATID_CPU_MIPS_VR_41XX, PLATID_MACH_EVEREX_FREESTYLE_AXX },
158 { TEXT("FreeStyle(Small Font)"), BIFB_D2_M2L_3x2,
159 640, 240, 80, 0xa000000,
160 PLATID_CPU_MIPS_VR_41XX, PLATID_MACH_EVEREX_FREESTYLE_AXX },
161 { TEXT("MobileGear MC-CS11"), BIFB_D2_M2L_0,
162 480, 240, 256, 0xa000000,
163 PLATID_CPU_MIPS_VR_4102, PLATID_MACH_NEC_MCCS_11 },
164 { TEXT("MobileGear MC-CS12"), BIFB_D2_M2L_0,
165 480, 240, 256, 0xa000000,
166 PLATID_CPU_MIPS_VR_4102, PLATID_MACH_NEC_MCCS_12 },
167 { TEXT("MobileGear MC-CS13"), BIFB_D2_M2L_0,
168 480, 240, 256, 0xa000000,
169 PLATID_CPU_MIPS_VR_4102, PLATID_MACH_NEC_MCCS_13 },
170 { TEXT("Mobile Pro 700"), BIFB_D2_M2L_0,
171 640, 240, 256, 0xa000000,
172 PLATID_CPU_MIPS_VR_4102, PLATID_MACH_NEC_MCR_MPRO700 },
173 { TEXT("MobileGearII MC-R300"), BIFB_D2_M2L_0,
174 640, 240, 256, 0xa000000,
175 PLATID_CPU_MIPS_VR_4111, PLATID_MACH_NEC_MCR_300 },
176 { TEXT("MobileGearII for DoCoMo"), BIFB_D2_M2L_0,
177 640, 240, 256, 0xa000000,
178 PLATID_CPU_MIPS_VR_4111, PLATID_MACH_NEC_MCR_FORDOCOMO },
179 { TEXT("MobileGearII MC-R320"), BIFB_D2_M2L_0,
180 640, 240, 160, 0xa000000,
181 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_NEC_MCR_320 },
182 { TEXT("MobileGearII MC/R430"), BIFB_D16_0000,
183 640, 240, 1280, 0xa180100,
184 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_NEC_MCR_430 },
185 { TEXT("MobileGearII MC-R500"), BIFB_D8_00,
186 640, 240, 1024, 0x13000000,
187 PLATID_CPU_MIPS_VR_4111, PLATID_MACH_NEC_MCR_500 },
188 { TEXT("Mobile Pro 750c"), BIFB_D8_00,
189 640, 240, 1024, 0x13000000,
190 PLATID_CPU_MIPS_VR_4111, PLATID_MACH_NEC_MCR_500A },
191 { TEXT("MobileGearII MC-R510"), BIFB_D8_00,
192 640, 240, 1024, 0xa000000,
193 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_NEC_MCR_510 },
194 { TEXT("NEC MC-R510(15bit color)"), BIFB_D16_0000,
195 640, 240, 1600, 0xa000000,
196 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_NEC_MCR_510 },
197 { TEXT("MobileGearII MC-R520"), BIFB_D16_0000,
198 640, 240, 1600, 0xa000000,
199 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_NEC_MCR_520 },
200 { TEXT("MobileGearII MC/R530"), BIFB_D16_0000,
201 640, 240, 1280, 0xa180100,
202 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_NEC_MCR_530 },
203 { TEXT("Mobile Pro 770"), BIFB_D16_0000,
204 640, 240, 1600, 0xa000000,
205 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_NEC_MCR_520A },
206 { TEXT("MobileGearII MC-R700"), BIFB_D16_0000,
207 800, 600, 1600, 0xa000000,
208 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_NEC_MCR_700 },
209 { TEXT("Mobile Pro 800"), BIFB_D16_0000,
210 800, 600, 1600, 0xa000000,
211 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_NEC_MCR_700A },
212 { TEXT("MobileGearII MC/R730"), BIFB_D16_0000,
213 800, 600, 1600, 0xa0ea600,
214 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_NEC_MCR_730 },
215 { TEXT("Tripad PV-6000"), BIFB_D8_00,
216 640, 480, 640, 0xa000000,
217 PLATID_CPU_MIPS_VR_4111, PLATID_MACH_SHARP_TRIPAD_PV6000 },
218 { TEXT("Vadem Clio"), BIFB_D8_00,
219 640, 480, 640, 0xa000000,
220 PLATID_CPU_MIPS_VR_4111, PLATID_MACH_SHARP_TRIPAD_PV6000 },
221 { TEXT("E-55"), BIFB_D2_M2L_0,
222 240, 320, 256, 0xa000000,
223 PLATID_CPU_MIPS_VR_4111, PLATID_MACH_CASIO_CASSIOPEIAE_E55 },
224 { TEXT("E-55(Small Font)"), BIFB_D2_M2L_0x2,
225 480, 320, 256, 0xa000000,
226 PLATID_CPU_MIPS_VR_4111, PLATID_MACH_CASIO_CASSIOPEIAE_E55 },
227 { TEXT("E-100"), BIFB_D16_FFFF,
228 240, 320, 512, 0xa200000,
229 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_CASIO_CASSIOPEIAE_E100 },
230 { TEXT("E-500"), BIFB_D16_FFFF,
231 240, 320, 512, 0xa200000,
232 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_CASIO_CASSIOPEIAE_E500 },
233 { TEXT("INTERTOP CX300"), BIFB_D8_00,
234 640, 480, 640, 0xa000000,
235 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_FUJITSU_INTERTOP_IT300 },
236 { TEXT("INTERTOP CX310"), BIFB_D8_00,
237 640, 480, 640, 0xa000000,
238 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_FUJITSU_INTERTOP_IT310 },
239 { TEXT("IBM WorkPad z50"), BIFB_D16_0000,
240 640, 480, 1280, 0xa000000,
241 PLATID_CPU_MIPS_VR_4121, PLATID_MACH_IBM_WORKPAD_26011AU },
242 { TEXT("Philips Nino 312"), BIFB_D2_M2L_0,
243 240, 320, 0, 0,
244 PLATID_CPU_MIPS_TX_3912, PLATID_MACH_PHILIPS_NINO_312 },
245 { TEXT("Compaq C-series 810"), BIFB_D2_M2L_0,
246 640, 240, 0, 0,
247 PLATID_CPU_MIPS_TX_3912, PLATID_MACH_COMPAQ_C_810 },
248 { TEXT("Compaq C-series 2010c"), BIFB_D8_00,
249 640, 240, 0, 0,
250 PLATID_CPU_MIPS_TX_3912, PLATID_MACH_COMPAQ_C_2010 },
251 { TEXT("Compaq C-series 2015c"), BIFB_D8_00,
252 640, 240, 0, 0,
253 PLATID_CPU_MIPS_TX_3912, PLATID_MACH_COMPAQ_C_2015 },
254 { TEXT("Compaq PRESARIO 213"), BIFB_D8_00,
255 320, 240, 0, 0,
256 PLATID_CPU_MIPS_VR_4111, PLATID_MACH_COMPAQ_PRESARIO_213 },
257 { TEXT("Compaq Aero 1530"), BIFB_D2_M2L_0,
258 320, 240, 0, 0,
259 PLATID_CPU_MIPS_VR_4111, PLATID_MACH_COMPAQ_AERO_1530 },
260 { TEXT("Victor InterLink MP-C101"), BIFB_D16_0000,
261 640, 480, 0, 0,
262 PLATID_CPU_MIPS_TX_3922, PLATID_MACH_VICTOR_INTERLINK_MPC101},
263 { TEXT("Sharp Telios HC-AJ1"), BIFB_D16_0000,
264 800, 600, 0, 0,
265 PLATID_CPU_MIPS_TX_3922, PLATID_MACH_SHARP_TELIOS_HCAJ1},
266 { TEXT("Sharp Mobilon HC-4100"), BIFB_D2_M2L_0, /* XXX 4bit greyscale */
267 640, 240, 0, 0,
268 PLATID_CPU_MIPS_TX_3912, PLATID_MACH_SHARP_MOBILON_HC4100},
269 { TEXT("Sharp HC-1200"), BIFB_D2_M2L_0, /* XXX 4bit greyscale */
270 640, 240, 0, 0,
271 PLATID_CPU_MIPS_TX_3912, PLATID_MACH_SHARP_MOBILON_HC1200},
272 };
273
274 #define ARRAYSIZEOF(a) (sizeof(a)/sizeof(*(a)))
275
276 #ifdef UNDER_CE
277 /* 'memory card' in HANKAKU KANA */
278 #define UNICODE_MEMORY_CARD \
279 TEXT('\\'), 0xff92, 0xff93, 0xff98, TEXT(' '), 0xff76, 0xff70, \
280 0xff84, 0xff9e
281 TCHAR unicode_memory_card[] = { UNICODE_MEMORY_CARD, TEXT('\\') };
282 TCHAR unicode_memory_card1[] = { UNICODE_MEMORY_CARD, TEXT('1'), TEXT('\\') };
283 TCHAR unicode_memory_card2[] = { UNICODE_MEMORY_CARD, TEXT('2'), TEXT('\\') };
284 #endif
285
286 #define LANGID_DEFAULT MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT)
287 struct path_s path_list[] = {
288 { TEXT("/"),
289 LANGID_DEFAULT, 0 },
290 { TEXT("2:/"),
291 LANGID_DEFAULT, 0 },
292 { TEXT("\\"),
293 LANGID_DEFAULT, 0 },
294 { TEXT("\\My Documents\\"),
295 LANGID_DEFAULT, 0 },
296 { TEXT("\\Storage Card\\"),
297 LANGID_DEFAULT, PATH_SAVE },
298 { TEXT("\\Storage Card1\\"),
299 LANGID_DEFAULT, PATH_SAVE },
300 { TEXT("\\Storage Card2\\"),
301 LANGID_DEFAULT, PATH_SAVE },
302 #ifdef UNDER_CE
303 { unicode_memory_card,
304 MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), PATH_SAVE },
305 { unicode_memory_card1,
306 MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), PATH_SAVE },
307 { unicode_memory_card2,
308 MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT), PATH_SAVE },
309 #endif
310 };
311 int path_list_items = ARRAYSIZEOF(path_list);
312
313 #ifdef ADDITIONAL_KERNELS
314 TCHAR* kernel_list[] = {
315
316 };
317 int kernel_list_items = ARRAYSIZEOF(kernel_list);
318 #endif
319
320 /*-----------------------------------------------------------------------------
321
322 function prototypes
323
324 -----------------------------------------------------------------------------*/
325 LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM);
326 void SetBootInfo(struct bootinfo *bi, struct fb_setting *fbs);
327 void wstrcpy(TCHAR* dst, TCHAR* src);
328 int reverse_fb_type(int type);
329
330 /*-----------------------------------------------------------------------------
331
332 function definitions
333
334 -----------------------------------------------------------------------------*/
335 void wstrcpy(TCHAR* dst, TCHAR* src)
336 {
337 while (*src) {
338 *dst++ = *src++;
339 }
340 *dst = *src;
341 }
342
343 int reverse_fb_type(int type)
344 {
345 int i;
346 struct {
347 int type0, type1;
348 } types[] = {
349 { BIFB_D2_M2L_3, BIFB_D2_M2L_0 },
350 { BIFB_D2_M2L_3x2, BIFB_D2_M2L_0x2 },
351 { BIFB_D8_FF, BIFB_D8_00 },
352 { BIFB_D16_FFFF, BIFB_D16_0000, },
353 };
354
355 for (i = 0; i < ARRAYSIZEOF(types); i++) {
356 if (types[i].type0 == type) {
357 return (types[i].type1);
358 }
359 if (types[i].type1 == type) {
360 return (types[i].type0);
361 }
362 }
363 debug_printf(TEXT("reverse_fb_type(): unknown type %d\n"), type);
364 return (type);
365 }
366
367 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
368 LPTSTR lpCmdLine, int nCmdShow )
369 {
370 MSG msg;
371 WNDCLASS wc;
372 int i, idx;
373 RECT rect;
374 #if ( 200 <= _WIN32_WCE )
375 OSVERSIONINFO osverinfo;
376
377 osverinfo.dwOSVersionInfoSize = sizeof(osverinfo);
378 if (!GetVersionEx(&osverinfo)) {
379 msg_printf(MSG_ERROR,
380 TEXT("Error"),
381 TEXT("GetVersionEx() failed"));
382 }
383 osversion = osverinfo.dwMajorVersion * 100 + osverinfo.dwMinorVersion;
384 #else
385 osversion = 100;
386 #endif
387
388 wc.style = (UINT)NULL;
389 wc.lpfnWndProc = (WNDPROC) WndProc;
390 wc.cbClsExtra = 0;
391 wc.cbWndExtra = 0;
392 wc.hInstance = hInstance;
393 wc.hIcon = NULL;
394 wc.hCursor = NULL;
395 wc.hbrBackground = (HBRUSH) GetStockObject(WHITE_BRUSH);
396 wc.lpszMenuName = NULL;
397 wc.lpszClassName = whoami;
398
399 RegisterClass(&wc);
400
401 InitCommonControls(); // Initialize common controls - command bar
402 hInst = hInstance; // Save handle to create command bar
403
404 hardware_test();
405
406 /*
407 * Main Window
408 */
409 #define WS_EX_CONTROLPARENT 0x00010000L
410 hWndMain = CreateWindowEx(WS_EX_CONTROLPARENT,
411 szAppName,
412 szTitle,
413 WS_VISIBLE,
414 CW_USEDEFAULT,
415 CW_USEDEFAULT,
416 CW_USEDEFAULT,
417 CW_USEDEFAULT,
418 NULL,
419 NULL,
420 hInstance,
421 NULL);
422
423 GetClientRect(hWndMain, &rect);
424 if (rect.right < rect.bottom) {
425 /*
426 * portrait
427 */
428 CreateMainWindow(hInst, hWndMain,
429 MAKEINTRESOURCE(IDD_MAIN_240X320),
430 CommandBar_Height(hWndCB));
431 } else {
432 /*
433 * landscape
434 */
435 CreateMainWindow(hInst, hWndMain,
436 MAKEINTRESOURCE(IDD_MAIN_640X240),
437 CommandBar_Height(hWndCB));
438 }
439 SetFocus(GetDlgItem(hWndMain, IDC_BOOT));
440
441 /*
442 * load preferences
443 */
444 pref_init(&pref);
445 if (pref_load(path_list, path_list_items) == 0) {
446 TCHAR tmp[256];
447 wsprintf(tmp, TEXT("%s is loaded."), where_pref_load_from);
448 SetDlgItemText(hWndMain, IDC_STATUS, tmp);
449
450 fb_settings[0].type = pref.fb_type;
451 fb_settings[0].width = pref.fb_width;
452 fb_settings[0].height = pref.fb_height;
453 fb_settings[0].linebytes = pref.fb_linebytes;
454 fb_settings[0].addr = pref.fb_addr;
455 fb_settings[0].platid_cpu = pref.platid_cpu;
456 fb_settings[0].platid_machine = pref.platid_machine;
457 } else {
458 TCHAR tmpbuf[PATHBUFLEN];
459 wsprintf(tmpbuf, TEXT("%s%S"), path_list[0].name, "netbsd");
460 SetDlgItemText(hWndMain, IDC_STATUS,
461 TEXT("preferences not loaded."));
462
463 pref.setting_idx = 1;
464 pref.fb_type = fb_settings[0].type;
465 pref.fb_width = fb_settings[0].width;
466 pref.fb_height = fb_settings[0].height;
467 pref.fb_linebytes = fb_settings[0].linebytes;
468 pref.fb_addr = fb_settings[0].addr;
469 pref.platid_cpu = fb_settings[0].platid_cpu;
470 pref.platid_machine = fb_settings[0].platid_machine;
471 wstrcpy(pref.setting_name, TEXT("User defined"));
472 wstrcpy(pref.kernel_name, tmpbuf);
473 wstrcpy(pref.options, TEXT(""));
474 pref.check_last_chance = FALSE;
475 pref.load_debug_info = FALSE;
476 pref.serial_port = FALSE;
477 pref.reverse_video = FALSE;
478 }
479 fb_settings[0].name = pref.setting_name;
480
481 /*
482 * initialize kernel file name list.
483 */
484 for (i = 0; i < path_list_items; i++) {
485 if (path_list[i].langid == LANGID_DEFAULT ||
486 path_list[i].langid == GetSystemDefaultLangID()) {
487 TCHAR tmpbuf[1024];
488 wsprintf(tmpbuf, TEXT("%s%S"),
489 path_list[i].name, "netbsd");
490 SendDlgItemMessage(hWndMain, IDC_KERNEL,
491 CB_ADDSTRING, 0, (LPARAM)tmpbuf);
492 }
493 }
494 #ifdef ADDITIONAL_KERNELS
495 for (i = 0; i < kernel_list_items; i++) {
496 SendDlgItemMessage(hWndMain, IDC_KERNEL, CB_ADDSTRING, 0,
497 (LPARAM)kernel_list[i]);
498 }
499 #endif
500 /*
501 SendDlgItemMessage(hWndMain, IDC_KERNEL, CB_SETCURSEL, 0,
502 (LPARAM)NULL);
503 */
504 SetDlgItemText(hWndMain, IDC_KERNEL, pref.kernel_name);
505 SetDlgItemText(hWndMain, IDC_OPTIONS, pref.options);
506
507 /*
508 * Frame Buffer setting names.
509 */
510 for (i = 0; i < ARRAYSIZEOF(fb_settings); i++) {
511 idx = SendDlgItemMessage(hWndMain, IDC_FBSELECT, CB_ADDSTRING,
512 0, (LPARAM)fb_settings[i].name);
513 SendDlgItemMessage(hWndMain, IDC_FBSELECT,
514 CB_SETITEMDATA, idx, (LPARAM)i);
515 if (i == 0) {
516 user_define_idx = idx;
517 }
518 }
519 SendDlgItemMessage(hWndMain, IDC_FBSELECT, CB_SETCURSEL,
520 pref.setting_idx, (LPARAM)NULL);
521 /*
522 * Check box, 'Pause before boot'
523 */
524 SendDlgItemMessage(hWndMain, IDC_PAUSE, BM_SETCHECK,
525 pref.check_last_chance, 0);
526 SendDlgItemMessage(hWndMain, IDC_DEBUG, BM_SETCHECK,
527 pref.load_debug_info, 0);
528 SendDlgItemMessage(hWndMain, IDC_COMM, BM_SETCHECK,
529 pref.serial_port, 0);
530 SendDlgItemMessage(hWndMain, IDC_REVERSEVIDEO, BM_SETCHECK,
531 pref.reverse_video, 0);
532
533 /*
534 * Map window and message loop
535 */
536 ShowWindow(hWndMain, SW_SHOW);
537 UpdateWindow(hWndMain);
538 while (GetMessage(&msg, NULL, 0, 0)) {
539 if (osversion < 211 ||
540 hWndMain == 0 || !IsDialogMessage(hWndMain, &msg)) {
541 TranslateMessage(&msg);
542 DispatchMessage(&msg);
543 }
544 }
545
546 return(msg.wParam);
547 }
548
549 BOOL CALLBACK DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
550 {
551 switch (message) {
552 case WM_INITDIALOG:
553 return (1);
554
555 case WM_PALETTECHANGED:
556 palette_check(hWnd);
557 break;
558
559 case WM_COMMAND:
560 switch (LOWORD(wParam)) {
561 case IDCANCEL:
562 dlgStatus = IDCANCEL;
563 break;
564 }
565 break;
566 default:
567 return (0);
568 }
569 }
570
571 BOOL CALLBACK DlgProc2(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
572 {
573 switch (message) {
574 case WM_INITDIALOG:
575 SetDlgItemText(hWnd, IDC_ABOUT_EDIT, version_string);
576 return (1);
577
578 case WM_PALETTECHANGED:
579 palette_check(hWnd);
580 break;
581
582 case WM_COMMAND:
583 switch (LOWORD(wParam)) {
584 case IDC_ABOUT_EDIT:
585 switch (HIWORD(wParam)) {
586 case EN_SETFOCUS:
587 //SendDlgItemMessage(hWnd, IDC_ABOUT_EDIT, EM_SETSEL, -1, 0);
588 SetFocus(GetDlgItem(hWnd, IDC_ABOUT_BITMAP));
589 break;
590 }
591 break;
592
593 case IDCANCEL:
594 EndDialog(hWnd, LOWORD(wParam));
595 return (1);
596 }
597 break;
598 default:
599 return (0);
600 }
601 }
602
603 void
604 SetBootInfo(struct bootinfo *bi, struct fb_setting *fbs)
605 {
606 TIME_ZONE_INFORMATION tz;
607
608 GetTimeZoneInformation(&tz);
609 memset(bi, 0, sizeof(struct bootinfo));
610 bi->length = sizeof(struct bootinfo);
611 bi->reserved = 0;
612 bi->magic = BOOTINFO_MAGIC;
613 bi->fb_addr = (unsigned char*)(fbs->addr + 0xA0000000);
614 bi->fb_type = fbs->type;
615 bi->fb_line_bytes = fbs->linebytes;
616 bi->fb_width = fbs->width;
617 bi->fb_height = fbs->height;
618 bi->platid_cpu = fbs->platid_cpu;
619 bi->platid_machine = fbs->platid_machine;
620 bi->timezone = tz.Bias;
621
622 debug_printf(TEXT("fb setting: %s fb_type=%d 0x%X %dx%d %d\n"),
623 fbs->name,
624 bi->fb_type, bi->fb_addr,
625 bi->fb_width, bi->fb_height, bi->fb_line_bytes);
626 debug_printf(TEXT("timezone: %02ld:00\n"), (bi->timezone / 60));
627 }
628
629
630 void
631 UpdateFbDlg(HWND hWnd, struct fb_setting *fbs, int direction)
632 {
633 int i;
634 TCHAR tmpbuf[PATHBUFLEN];
635 int type, width, height, linebytes;
636 long addr;
637
638 switch (direction) {
639 case UPDATE_DLGBOX:
640 SetDlgItemText(hWnd, IDC_FB_NAME, fbs->name);
641
642 for (i = 0; i < ARRAYSIZEOF(fb_types); i++) {
643 if (fb_types[i].type == fbs->type) break;
644 }
645 if (ARRAYSIZEOF(fb_types) <= i) {
646 MessageBox(NULL, TEXT("Unknown FrameBuffer type."),
647 szAppName, MB_OK);
648 return;
649 }
650 debug_printf(TEXT("UpdateFbDlg(%s)\n"), fbs->name);
651 i = SendDlgItemMessage(hWnd, IDC_FB_TYPE, CB_FINDSTRINGEXACT,
652 0, (LPARAM)fb_types[i].name);
653 SendDlgItemMessage(hWnd, IDC_FB_TYPE, CB_SETCURSEL, i, 0);
654
655 wsprintf(tmpbuf, TEXT("%X"), fbs->addr);
656 SetDlgItemText(hWnd, IDC_FB_ADDR, tmpbuf);
657 wsprintf(tmpbuf, TEXT("%d"), fbs->width);
658 SetDlgItemText(hWnd, IDC_FB_WIDTH, tmpbuf);
659 wsprintf(tmpbuf, TEXT("%d"), fbs->height);
660 SetDlgItemText(hWnd, IDC_FB_HEIGHT, tmpbuf);
661 wsprintf(tmpbuf, TEXT("%d"), fbs->linebytes);
662 SetDlgItemText(hWnd, IDC_FB_LINEBYTES, tmpbuf);
663 wsprintf(tmpbuf, TEXT("%08X"), fbs->platid_cpu);
664 SetDlgItemText(hWnd, IDC_FB_CPU, tmpbuf);
665 wsprintf(tmpbuf, TEXT("%08X"), fbs->platid_machine);
666 SetDlgItemText(hWnd, IDC_FB_MACHINE, tmpbuf);
667 break;
668 case UPDATE_DATA:
669 GetDlgItemText(hWnd, IDC_FB_NAME, fbs->name, PATHBUFLEN);
670 type = SendDlgItemMessage(hWnd, IDC_FB_TYPE,
671 CB_GETCURSEL, 0, 0);
672 type = SendDlgItemMessage(hWnd, IDC_FB_TYPE,
673 CB_GETITEMDATA, type, 0);
674 GetDlgItemText(hWnd, IDC_FB_WIDTH, tmpbuf, sizeof(tmpbuf));
675 width = _tcstol(tmpbuf, NULL, 10);
676 GetDlgItemText(hWnd, IDC_FB_HEIGHT, tmpbuf, sizeof(tmpbuf));
677 height = _tcstol(tmpbuf, NULL, 10);
678 GetDlgItemText(hWnd, IDC_FB_LINEBYTES, tmpbuf, sizeof(tmpbuf));
679 linebytes = _tcstol(tmpbuf, NULL, 10);
680 GetDlgItemText(hWnd, IDC_FB_ADDR, tmpbuf, sizeof(tmpbuf));
681 addr = _tcstoul(tmpbuf, NULL, 16);
682 GetDlgItemText(hWnd, IDC_FB_CPU, tmpbuf, sizeof(tmpbuf));
683 fbs->platid_cpu = _tcstoul(tmpbuf, NULL, 16);
684 GetDlgItemText(hWnd, IDC_FB_MACHINE, tmpbuf, sizeof(tmpbuf));
685 fbs->platid_machine = _tcstoul(tmpbuf, NULL, 16);
686 fbs->type = type;
687 fbs->addr = addr;
688 fbs->width = width;
689 fbs->height = height;
690 fbs->linebytes = linebytes;
691
692 debug_printf(TEXT("type=%d %dx%d %d bytes/line %08x %08x\n"),
693 type, width, height, linebytes,
694 fbs->platid_cpu,
695 fbs->platid_machine);
696 break;
697 default:
698 debug_printf(TEXT("UpdateFbDlg(): internal error!\n"));
699 break;
700 }
701 }
702
703 BOOL CALLBACK FbDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
704 {
705 int idx, i;
706 TCHAR tmpbuf[100];
707
708 switch (message) {
709 case WM_INITDIALOG:
710 {
711 UDACCEL uda;
712 for (i = 0; i < ARRAYSIZEOF(fb_settings); i++) {
713 idx = SendDlgItemMessage(hWnd, IDC_FB_NAME,
714 CB_ADDSTRING, 0,
715 (LPARAM)fb_settings[i].name);
716 SendDlgItemMessage(hWnd, IDC_FB_NAME,
717 CB_SETITEMDATA, idx, (LPARAM)i);
718 }
719 for (i = 0; i < ARRAYSIZEOF(fb_size); i++) {
720 wsprintf(tmpbuf, TEXT("%d"), fb_size[i]);
721 SendDlgItemMessage(hWnd, IDC_FB_WIDTH, CB_ADDSTRING,
722 0, (LPARAM)tmpbuf);
723 SendDlgItemMessage(hWnd, IDC_FB_HEIGHT, CB_ADDSTRING,
724 0, (LPARAM)tmpbuf);
725 }
726 for (i = 0; i < ARRAYSIZEOF(fb_bpl); i++) {
727 wsprintf(tmpbuf, TEXT("%d"), fb_bpl[i]);
728 SendDlgItemMessage(hWnd, IDC_FB_LINEBYTES,
729 CB_ADDSTRING, 0,
730 (LPARAM)tmpbuf);
731 }
732 for (i = 0; i < ARRAYSIZEOF(fb_types); i++) {
733 idx = SendDlgItemMessage(hWnd, IDC_FB_TYPE,
734 CB_ADDSTRING, 0,
735 (LPARAM)fb_types[i].name);
736 SendDlgItemMessage(hWnd, IDC_FB_TYPE, CB_SETITEMDATA,
737 idx, (LPARAM)fb_types[i].type);
738 }
739 UpdateFbDlg(hWnd, &fb_settings[0], UPDATE_DLGBOX);
740
741 uda.nSec = 1;
742 uda.nInc = 0x100;
743 /*
744 SendDlgItemMessage(hWnd, IDC_FB_ADDRSPIN, UDM_SETACCEL,
745 0, (LPARAM)&uda);
746 */
747 /*
748 SendDlgItemMessage(hWnd, IDC_FB_ADDRSPIN, UDM_SETRANGE,
749 0, MAKELPARAM(UD_MAXVAL, UD_MINVAL));
750 */
751 }
752 return (1);
753
754 case WM_PALETTECHANGED:
755 palette_check(hWnd);
756 break;
757
758 case WM_VSCROLL:
759 if ((HWND)lParam == GetDlgItem(hWnd, IDC_FB_ADDRSPIN)) {
760 long addr;
761 switch (LOWORD(wParam)) {
762 case SB_THUMBPOSITION:
763 case SB_THUMBTRACK:
764 GetDlgItemText(hWnd, IDC_FB_ADDR, tmpbuf, 100);
765 addr = _tcstoul(tmpbuf, NULL, 16);
766 if (50 < HIWORD(wParam)) {
767 addr -= 0x400;
768 } else {
769 addr += 0x400;
770 }
771 SendDlgItemMessage(hWnd, IDC_FB_ADDRSPIN,
772 UDM_SETPOS, 0,
773 MAKELPARAM(50, 0));
774 wsprintf(tmpbuf, TEXT("%X"), addr);
775 SetDlgItemText(hWnd, IDC_FB_ADDR, tmpbuf);
776 return (1);
777 }
778 }
779 break;
780
781 case WM_COMMAND:
782 switch (LOWORD(wParam)) {
783 case IDC_FB_NAME:
784 switch (HIWORD(wParam)) {
785 case CBN_SELCHANGE:
786 idx = SendDlgItemMessage(hWnd, IDC_FB_NAME,
787 CB_GETCURSEL, 0, 0);
788 i = SendDlgItemMessage(hWnd, IDC_FB_NAME,
789 CB_GETITEMDATA, idx, 0);
790 if (0 <= i && i < ARRAYSIZEOF(fb_settings)) {
791 fb_settings[0] = fb_settings[i];
792 UpdateFbDlg(hWnd, &fb_settings[0],
793 UPDATE_DLGBOX);
794 }
795 return (1);
796 }
797 break;
798 case IDOK:
799 UpdateFbDlg(hWnd, &fb_settings[0], UPDATE_DATA);
800
801 EndDialog(hWnd, IDOK);
802 return (1);
803
804 case IDCANCEL:
805 EndDialog(hWnd, IDCANCEL);
806 return (1);
807 }
808 break;
809 }
810 return (0);
811 }
812
813
814 BOOL SerialPort(BOOL on)
815 {
816 static HANDLE hPort = INVALID_HANDLE_VALUE;
817 BOOL res = (hPort != INVALID_HANDLE_VALUE);
818
819 if (on != res) {
820 if (on) {
821 hPort = CreateFile(TEXT("COM1:"),
822 GENERIC_READ | GENERIC_WRITE,
823 0, NULL, OPEN_EXISTING,
824 0,
825 NULL);
826 debug_printf(TEXT("serial port ON\n"));
827 if ( hPort == INVALID_HANDLE_VALUE ) {
828 debug_printf(TEXT("open failed\n"));
829 } else {
830 #if 0
831 DWORD Len;
832 BYTE x = 'X';
833 WriteFile (hPort, &x, 1, &Len, 0);
834 WriteFile (hPort, &x, 1, &Len, 0);
835 WriteFile (hPort, &x, 1, &Len, 0);
836 WriteFile (hPort, &x, 1, &Len, 0);
837 #endif
838 }
839 } else {
840 debug_printf(TEXT("serial port OFF\n"));
841 CloseHandle(hPort);
842 hPort = INVALID_HANDLE_VALUE;
843 }
844 }
845
846 return (res);
847 }
848
849
850 BOOL CheckCancel(int progress)
851 {
852 MSG msg;
853
854 if (0 <= progress) {
855 SendDlgItemMessage(hDlgLoad, IDC_PROGRESS,
856 PBM_SETPOS, (WPARAM)progress, (LPARAM)NULL);
857 } else {
858 if (pref.check_last_chance) {
859 if (msg_printf(MB_YESNO | MB_ICONHAND,
860 TEXT("Last chance..."),
861 TEXT("Push OK to boot.")) != IDYES) {
862 dlgStatus = IDCANCEL;
863 }
864 }
865 palette_set(hDlgLoad);
866 if (palette_succeeded == -1) {
867 msg_printf(MSG_ERROR,
868 TEXT("Warning"),
869 TEXT("Sorry, palette failed"));
870 }
871 }
872
873 /*
874 * Put WM_TIMER in my message queue.
875 * (WM_TIMER has lowest priority.)
876 */
877 SetTimer(hDlgLoad, 1, 1, NULL);
878
879 /*
880 * I tried PeekMessage() but it does not work.
881 */
882 while (GetMessage(&msg, NULL, 0, 0)) {
883 if (msg.hwnd == hDlgLoad && msg.message == WM_TIMER) {
884 break;
885 }
886 TranslateMessage(&msg);
887 DispatchMessage(&msg);
888 }
889
890 return (dlgStatus != 0);
891 }
892
893 LRESULT CALLBACK WndProc(HWND hWnd, UINT message,
894 WPARAM wParam, LPARAM lParam )
895 {
896 int i, idx;
897
898 switch (message) {
899 case WM_CREATE:
900 sndPlaySound(TEXT("OpenProg"), SND_NODEFAULT | SND_ASYNC);
901 hWndCB = CommandBar_Create(hInst, hWnd, 1);
902 CommandBar_AddAdornments(hWndCB, STD_HELP, (DWORD)NULL);
903 palette_init(hWnd);
904 break;
905
906 case WM_PAINT:
907 {
908 HDC hdc;
909 PAINTSTRUCT ps;
910
911 hdc = BeginPaint(hWnd, &ps);
912 EndPaint(hWnd, &ps);
913 }
914 break;
915
916 case WM_PALETTECHANGED:
917 palette_check(hWnd);
918 break;
919
920 case WM_HELP:
921 /*
922 MessageBox (NULL, TEXT("HELP NOT AVAILABLE"),
923 szAppName, MB_OK);
924 */
925 DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUT), hWnd, DlgProc2);
926 break;
927
928 case WM_COMMAND:
929 switch (LOWORD(wParam)) {
930 case IDC_BOOT:
931 {
932 int argc;
933 TCHAR wkernel_name[PATHBUFLEN];
934 TCHAR woptions[PATHBUFLEN];
935 char options[PATHBUFLEN*2], kernel_name[PATHBUFLEN*2];
936 platid_t platid;
937
938 char *p, *argv[32];
939 struct bootinfo bi;
940
941 if (SendDlgItemMessage(hWndMain, IDC_PAUSE,
942 BM_GETCHECK, 0, 0) ==
943 BST_CHECKED) {
944 pref.check_last_chance = TRUE;
945 } else {
946 pref.check_last_chance = FALSE;
947 }
948
949 if (SendDlgItemMessage(hWndMain, IDC_DEBUG,
950 BM_GETCHECK, 0, 0) ==
951 BST_CHECKED) {
952 pref.load_debug_info = TRUE;
953 } else {
954 pref.load_debug_info = FALSE;
955 }
956
957 if (SendDlgItemMessage(hWndMain, IDC_COMM,
958 BM_GETCHECK, 0, 0) ==
959 BST_CHECKED) {
960 pref.serial_port = TRUE;
961 } else {
962 pref.serial_port = FALSE;
963 }
964
965 if (SendDlgItemMessage(hWndMain, IDC_REVERSEVIDEO,
966 BM_GETCHECK, 0, 0) ==
967 BST_CHECKED) {
968 pref.reverse_video = TRUE;
969 } else {
970 pref.reverse_video = FALSE;
971 }
972
973 if (GetDlgItemText(hWndMain, IDC_KERNEL, wkernel_name,
974 sizeof(wkernel_name)) == 0) {
975 MessageBox (NULL, TEXT("Kernel name required"),
976 szAppName, MB_OK);
977 break;
978 }
979 GetDlgItemText(hWndMain, IDC_OPTIONS,
980 woptions, sizeof(woptions));
981 if (wcstombs(options, woptions, sizeof(options)) < 0 ||
982 wcstombs(kernel_name, wkernel_name,
983 sizeof(kernel_name)) < 0) {
984 MessageBox (NULL, TEXT("invalid character"),
985 szAppName, MB_OK);
986 break;
987 }
988
989 argc = 0;
990 argv[argc++] = kernel_name;
991 p = options;
992 while (*p) {
993 while (*p == ' ' || *p == '\t') {
994 p++;
995 }
996 if (*p == '\0')
997 break;
998 if (ARRAYSIZEOF(argv) <= argc) {
999 MessageBox (NULL,
1000 TEXT("too many options"),
1001 szAppName, MB_OK);
1002 argc++;
1003 break;
1004 } else {
1005 argv[argc++] = p;
1006 }
1007 while (*p != ' ' && *p != '\t' && *p != '\0') {
1008 p++;
1009 }
1010 if (*p == '\0') {
1011 break;
1012 } else {
1013 *p++ = '\0';
1014 }
1015 }
1016 if (ARRAYSIZEOF(argv) < argc) {
1017 break;
1018 }
1019
1020 EnableWindow(hWndMain, FALSE);
1021 if (MessageBox (hWndMain,
1022 TEXT("Data in memory will be lost.\nAre you sure?"),
1023 szAppName,
1024 MB_YESNO | MB_DEFBUTTON2 | MB_ICONHAND) == IDYES) {
1025 dlgStatus = 0;
1026 hDlgLoad =
1027 CreateDialog(hInst,
1028 MAKEINTRESOURCE(IDD_LOAD),
1029 hWndMain, DlgProc);
1030 ShowWindow(hDlgLoad, SW_SHOWNORMAL);
1031 BringWindowToTop(hDlgLoad);
1032
1033 /*
1034 * save settings.
1035 */
1036 pref.fb_type = fb_settings[0].type;
1037 pref.fb_width = fb_settings[0].width;
1038 pref.fb_height = fb_settings[0].height;
1039 pref.fb_linebytes = fb_settings[0].linebytes;
1040 pref.fb_addr = fb_settings[0].addr;
1041 pref.platid_cpu = fb_settings[0].platid_cpu;
1042 pref.platid_machine = fb_settings[0].platid_machine;
1043 wstrcpy(pref.kernel_name, wkernel_name);
1044 wstrcpy(pref.options, woptions);
1045
1046 pref_save(path_list, path_list_items);
1047
1048 SetBootInfo(&bi, &fb_settings[pref.setting_idx]);
1049 debug_printf(TEXT("Args: "));
1050 for (i = 0; i < argc; i++) {
1051 debug_printf(TEXT("'%S' "), argv[i]);
1052 }
1053 debug_printf(TEXT("\n"));
1054 debug_printf(TEXT("Bootinfo: fb_type=%d 0x%X %dx%d %d\n"),
1055 bi.fb_type, bi.fb_addr,
1056 bi.fb_width, bi.fb_height,
1057 bi.fb_line_bytes);
1058
1059 if (pref.serial_port) {
1060 SerialPort(TRUE);
1061 }
1062 if (pref.reverse_video) {
1063 bi.fb_type = reverse_fb_type(bi.fb_type);
1064 }
1065 /*
1066 * Set system infomation
1067 */
1068 platid.dw.dw0 = bi.platid_cpu;
1069 platid.dw.dw1 = bi.platid_machine;
1070 if (set_system_info(&platid)) {
1071 /*
1072 * boot !
1073 */
1074 pbsdboot(wkernel_name, argc, argv, &bi);
1075 }
1076 /*
1077 * Not return.
1078 */
1079
1080 if (pref.serial_port) {
1081 SerialPort(FALSE);
1082 }
1083
1084 DestroyWindow(hDlgLoad);
1085 }
1086 EnableWindow(hWndMain, TRUE);
1087 }
1088 break;
1089 case IDC_FBSETTING:
1090 if (DialogBox(hInst, MAKEINTRESOURCE(IDD_FB),
1091 hWndMain, FbDlgProc) == IDOK) {
1092 /* User defined */
1093 pref.setting_idx = 0;
1094 SendDlgItemMessage(hWndMain, IDC_FBSELECT,
1095 CB_DELETESTRING,
1096 (WPARAM)user_define_idx, 0);
1097 SendDlgItemMessage(hWndMain, IDC_FBSELECT,
1098 CB_INSERTSTRING,
1099 (WPARAM)user_define_idx,
1100 (LPARAM)fb_settings[0].name);
1101 SendDlgItemMessage(hWnd, IDC_FBSELECT,
1102 CB_SETCURSEL, 0, 0);
1103 }
1104 break;
1105 case IDC_FBSELECT:
1106 switch (HIWORD(wParam)) {
1107 case CBN_SELCHANGE:
1108 idx = SendDlgItemMessage(hWnd, IDC_FBSELECT,
1109 CB_GETCURSEL, 0, 0);
1110 i = SendDlgItemMessage(hWnd, IDC_FBSELECT,
1111 CB_GETITEMDATA, idx, 0);
1112 if (0 <= i && i < ARRAYSIZEOF(fb_settings)) {
1113 debug_printf(TEXT("fb_setting=%d\n"), i);
1114 pref.setting_idx = i;
1115 }
1116 break;
1117 }
1118 break;
1119 }
1120 break;
1121
1122 case WM_HIBERNATE:
1123 MessageBox(NULL, TEXT("MEMORY IS LOW"), szAppName, MB_OK);
1124 //Additional code to handle a low memory situation
1125
1126 case WM_CLOSE:
1127 sndPlaySound(TEXT("Close"), SND_NODEFAULT | SND_ASYNC);
1128
1129 DestroyWindow(hWnd);
1130 break;
1131
1132 case WM_DESTROY:
1133 PostQuitMessage(0);
1134 break;
1135
1136 default:
1137 return (DefWindowProc(hWnd, message, wParam, lParam));
1138 }
1139
1140 return (0);
1141 }
1142
1143
1144