1 | /* $Id: Win32kCC.c,v 1.13 2001-02-17 20:25:44 bird Exp $
|
---|
2 | *
|
---|
3 | * Win32CC - Win32k Control Center.
|
---|
4 | *
|
---|
5 | * Copyright (c) 2000 knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
6 | *
|
---|
7 | * Project Odin Software License can be found in LICENSE.TXT
|
---|
8 | *
|
---|
9 | */
|
---|
10 |
|
---|
11 |
|
---|
12 | /*******************************************************************************
|
---|
13 | * Defined Constants And Macros *
|
---|
14 | *******************************************************************************/
|
---|
15 |
|
---|
16 | /*
|
---|
17 | * Private Window Messages
|
---|
18 | */
|
---|
19 | #define WM_SETCONTROLS (WM_USER + 10)
|
---|
20 | #define WM_QUERYCONTROLS (WM_USER + 11)
|
---|
21 |
|
---|
22 |
|
---|
23 | /*
|
---|
24 | * Notebook page constants.
|
---|
25 | */
|
---|
26 | #define W32KCCPG_STATUS 0
|
---|
27 | #define W32KCCPG_LOADERS 1
|
---|
28 | #define W32KCCPG_LOGGING 2
|
---|
29 | #define W32KCCPG_HEAPS 3
|
---|
30 | #define W32KCCPG_LDRFIX 4
|
---|
31 | #define W32KCCPG_MEMINFO 5
|
---|
32 | #define W32KCCPG_PAGES (W32KCCPG_MEMINFO+1)
|
---|
33 |
|
---|
34 |
|
---|
35 | /*
|
---|
36 | * Include defines
|
---|
37 | */
|
---|
38 | #define INCL_DOSERRORS
|
---|
39 | #define INCL_DOSFILEMGR
|
---|
40 | #define INCL_DOSRESOURCES
|
---|
41 | #define INCL_DOSMISC
|
---|
42 |
|
---|
43 | #define INCL_WINERRORS
|
---|
44 | #define INCL_WINDIALOGS
|
---|
45 | #define INCL_WINMESSAGEMGR
|
---|
46 | #define INCL_WINSTDSPIN
|
---|
47 | #define INCL_WINBUTTONS
|
---|
48 | #define INCL_WINWINDOWMGR
|
---|
49 | #define INCL_WINSTDBOOK
|
---|
50 | #define INCL_WINSYS
|
---|
51 | #define INCL_WINTIMER
|
---|
52 |
|
---|
53 | #define INCL_WINACCELERATORS
|
---|
54 | #define INCL_WINFRAMEMGR
|
---|
55 |
|
---|
56 | #define INCL_GPIPRIMITIVES
|
---|
57 | #define INCL_GPILCIDS
|
---|
58 |
|
---|
59 |
|
---|
60 |
|
---|
61 | /*******************************************************************************
|
---|
62 | * Header Files *
|
---|
63 | *******************************************************************************/
|
---|
64 | #include <os2.h>
|
---|
65 |
|
---|
66 | #include <string.h>
|
---|
67 | #include <stdio.h>
|
---|
68 | #include <stdarg.h>
|
---|
69 | #include <stdlib.h>
|
---|
70 | #include <errno.h>
|
---|
71 |
|
---|
72 | #include <Win32k.h>
|
---|
73 | #include <devSegDf.h> /* Win32k segment definitions. */
|
---|
74 | #include <Options.h>
|
---|
75 |
|
---|
76 | #include "Win32kCC.h"
|
---|
77 |
|
---|
78 |
|
---|
79 | /*******************************************************************************
|
---|
80 | * Structures and Typedefs *
|
---|
81 | *******************************************************************************/
|
---|
82 | typedef struct _Win32kCCPage
|
---|
83 | {
|
---|
84 | ULONG ulId;
|
---|
85 | HWND hwnd;
|
---|
86 | } WIN32KCCPAGE, *PWIN32KCCPAGE;
|
---|
87 |
|
---|
88 | typedef struct _Win32kCC
|
---|
89 | {
|
---|
90 | HWND hwnd;
|
---|
91 | HWND hwndNtbk;
|
---|
92 | HAB hab;
|
---|
93 | BOOL fDirty;
|
---|
94 |
|
---|
95 | K32OPTIONS Options;
|
---|
96 | K32OPTIONS NewOptions;
|
---|
97 | K32STATUS Status;
|
---|
98 |
|
---|
99 | ULONG idMemTimer; /* The Timer ID of the MemInfo Refresh Timer. */
|
---|
100 | K32SYSTEMMEMINFO MemInfo; /* Current displayed meminfo. */
|
---|
101 |
|
---|
102 | WIN32KCCPAGE aPages[W32KCCPG_PAGES]; /* Array containing generic page info. */
|
---|
103 |
|
---|
104 | } WIN32KCC, *PWIN32KCC;
|
---|
105 |
|
---|
106 |
|
---|
107 | /*******************************************************************************
|
---|
108 | * Global Variables *
|
---|
109 | *******************************************************************************/
|
---|
110 | BOOL fNotExit; /* Global variable used to stop WM_QUITS.
|
---|
111 | * As long as this is true the message
|
---|
112 | * loop will never exit, but ignore all
|
---|
113 | * WM_QUITs.
|
---|
114 | */
|
---|
115 | BOOL fOldNtbk; /* Set if we must use the old notebook
|
---|
116 | * style.
|
---|
117 | */
|
---|
118 |
|
---|
119 | /*******************************************************************************
|
---|
120 | * Internal Functions *
|
---|
121 | *******************************************************************************/
|
---|
122 | MRESULT EXPENTRY Win32kCCDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
123 |
|
---|
124 | MRESULT EXPENTRY LoadersDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
125 | MRESULT EXPENTRY LoggingDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
126 | MRESULT EXPENTRY StatusDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
127 | MRESULT EXPENTRY HeapsDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
128 | MRESULT EXPENTRY LdrFixDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
129 | MRESULT EXPENTRY MemInfoDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
130 |
|
---|
131 | MRESULT EXPENTRY NtbkDefPageDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2);
|
---|
132 |
|
---|
133 | BOOL SetDlgItemTextF(HWND hwndDlg, ULONG idItem, PSZ pszFormat, ...);
|
---|
134 | ULONG ShowMessage(HWND hwndOwner, int id, ULONG flStyle);
|
---|
135 | BOOL Complain(HWND hwndOwner, int id, ...);
|
---|
136 | PCSZ getLastErrorMsg(HAB hab);
|
---|
137 | PSZ getMessage(ULONG id);
|
---|
138 | int GetFixpackDesc(ULONG ulBuild, ULONG flKernel, PSZ pszBuffer);
|
---|
139 | char * stristr(const char *pszStr, const char *pszSubStr);
|
---|
140 |
|
---|
141 |
|
---|
142 |
|
---|
143 | /**
|
---|
144 | * Main function.
|
---|
145 | * (No parameters)
|
---|
146 | * @returns -1 WinInitialize failed.
|
---|
147 | * -2 Failed to create message queue.
|
---|
148 | * -3 Failed to load dialog.
|
---|
149 | * 0 Dialog was closed using cancel.
|
---|
150 | * 1 Dialog was close using ok.
|
---|
151 | */
|
---|
152 | int main(void)
|
---|
153 | {
|
---|
154 | HAB hab;
|
---|
155 | HMQ hmq;
|
---|
156 | ULONG rc = 0;
|
---|
157 | HWND hwnd;
|
---|
158 | ULONG aulVer[2];
|
---|
159 |
|
---|
160 | /*
|
---|
161 | * Initialize PM.
|
---|
162 | */
|
---|
163 | hab = WinInitialize(0);
|
---|
164 | if (hab == NULLHANDLE)
|
---|
165 | {
|
---|
166 | return -1;
|
---|
167 | }
|
---|
168 |
|
---|
169 | /*
|
---|
170 | * Create Message Queue.
|
---|
171 | */
|
---|
172 | hmq = WinCreateMsgQueue(hab, 0);
|
---|
173 | if (hmq == NULLHANDLE)
|
---|
174 | {
|
---|
175 | WinTerminate(hab);
|
---|
176 | return -2;
|
---|
177 | }
|
---|
178 |
|
---|
179 | /*
|
---|
180 | * Init Win32k library.
|
---|
181 | */
|
---|
182 | rc = libWin32kInit();
|
---|
183 | if (rc != NO_ERROR)
|
---|
184 | {
|
---|
185 | switch (rc)
|
---|
186 | {
|
---|
187 | case ERROR_FILE_NOT_FOUND:
|
---|
188 | Complain(HWND_DESKTOP, IDS_ERR_WIN32K_NOT_LOADED);
|
---|
189 | break;
|
---|
190 |
|
---|
191 | default:
|
---|
192 | Complain(HWND_DESKTOP, IDS_ERR_WIN32K_OPEN_FAILED, rc);
|
---|
193 | }
|
---|
194 | }
|
---|
195 |
|
---|
196 | /*
|
---|
197 | * Check version and set fOldNtbk accordingly.
|
---|
198 | */
|
---|
199 | fOldNtbk = (DosQuerySysInfo(QSV_VERSION_MAJOR, QSV_VERSION_MINOR, &aulVer, sizeof(aulVer))
|
---|
200 | || (aulVer[1] <= 20 && aulVer[0] < 40));
|
---|
201 |
|
---|
202 | /*
|
---|
203 | * Load the dialog.
|
---|
204 | */
|
---|
205 | hwnd = WinLoadDlg(HWND_DESKTOP, HWND_DESKTOP,
|
---|
206 | Win32kCCDlgProc,
|
---|
207 | NULLHANDLE,
|
---|
208 | fOldNtbk ? DL_WIN32KCC_OLD : DL_WIN32KCC,
|
---|
209 | NULL);
|
---|
210 |
|
---|
211 | /*
|
---|
212 | * Process the dialog.
|
---|
213 | */
|
---|
214 | if (hwnd != NULLHANDLE)
|
---|
215 | {
|
---|
216 | QMSG qmsg;
|
---|
217 | do
|
---|
218 | {
|
---|
219 | fNotExit = FALSE;
|
---|
220 | while(WinGetMsg(hab, &qmsg, NULLHANDLE, NULLHANDLE, NULLHANDLE))
|
---|
221 | WinDispatchMsg(hab, &qmsg);
|
---|
222 | } while (fNotExit);
|
---|
223 |
|
---|
224 |
|
---|
225 | }
|
---|
226 | else
|
---|
227 | {
|
---|
228 | Complain(HWND_DESKTOP,
|
---|
229 | IDS_ERR_DIALOGLOAD,
|
---|
230 | DL_WIN32KCC,
|
---|
231 | WinGetLastError(hab),
|
---|
232 | getLastErrorMsg(hab)
|
---|
233 | );
|
---|
234 | rc = -3;
|
---|
235 | }
|
---|
236 |
|
---|
237 | /*
|
---|
238 | * Cleanup.
|
---|
239 | */
|
---|
240 | WinDestroyMsgQueue(hmq);
|
---|
241 | WinTerminate(hab);
|
---|
242 | libWin32kTerm();
|
---|
243 |
|
---|
244 | return rc;
|
---|
245 | }
|
---|
246 |
|
---|
247 | #pragma info(noord) /*remove annoying (and possible incorrect) messages on the MP* macros */
|
---|
248 |
|
---|
249 | /**
|
---|
250 | * Dialog procedure for the DL_WIN32KCC notebook dialog.
|
---|
251 | * (See PMREF for the general specifications of this function.)
|
---|
252 | */
|
---|
253 | MRESULT EXPENTRY Win32kCCDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
254 | {
|
---|
255 | PWIN32KCC pThis;
|
---|
256 | int i;
|
---|
257 |
|
---|
258 |
|
---|
259 | /*
|
---|
260 | * Get instance data pointer (pThis).
|
---|
261 | */
|
---|
262 | if (msg != WM_INITDLG)
|
---|
263 | {
|
---|
264 | pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
265 | if (pThis == NULL)
|
---|
266 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
267 | }
|
---|
268 |
|
---|
269 |
|
---|
270 | /*
|
---|
271 | * Message switch.
|
---|
272 | */
|
---|
273 | switch (msg)
|
---|
274 | {
|
---|
275 | /*
|
---|
276 | * Initialize the controls and trigger a setcontrol event.
|
---|
277 | *
|
---|
278 | * mr: Focus changed or not.
|
---|
279 | * mp1: hwnd of dialog
|
---|
280 | * mp2: (user data) (NULL)
|
---|
281 | */
|
---|
282 | case WM_INITDLG:
|
---|
283 | {
|
---|
284 | static struct _NtbkPage
|
---|
285 | {
|
---|
286 | PFNWP pfnDlgProc;
|
---|
287 | ULONG idDlg;
|
---|
288 | ULONG idPage;
|
---|
289 | } aPages[W32KCCPG_PAGES] =
|
---|
290 | {
|
---|
291 | { StatusDlgProc , PG_WIN32K_INFO_PAGE, W32KCCPG_STATUS },
|
---|
292 | { LoadersDlgProc, DL_LOADERS_PAGE, W32KCCPG_LOADERS},
|
---|
293 | { LoggingDlgProc, DL_LOGGING_PAGE, W32KCCPG_LOGGING},
|
---|
294 | { HeapsDlgProc , DL_HEAPS_PAGE, W32KCCPG_HEAPS },
|
---|
295 | { LdrFixDlgProc , DL_LDRFIX_PAGE, W32KCCPG_LDRFIX },
|
---|
296 | { MemInfoDlgProc , DL_MEMINFO_PAGE, W32KCCPG_MEMINFO }
|
---|
297 | };
|
---|
298 | CHAR szTabText[128];
|
---|
299 | PDLGTEMPLATE pdlgt;
|
---|
300 | APIRET rc;
|
---|
301 | RECTL rectl;
|
---|
302 | SWP swp;
|
---|
303 | SWP swp2;
|
---|
304 |
|
---|
305 | /*
|
---|
306 | * Init and set instance data.
|
---|
307 | */
|
---|
308 | pThis = calloc(sizeof(*pThis), 1);
|
---|
309 | if (pThis == NULL)
|
---|
310 | {
|
---|
311 | /* complain, dismiss and return. */
|
---|
312 | Complain(hwnd, IDS_ERR_MALLOC_FAILED, __FILE__, __LINE__, __FUNCTION__);
|
---|
313 | WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
|
---|
314 | return FALSE;
|
---|
315 | }
|
---|
316 | pThis->hwnd = hwnd;
|
---|
317 | pThis->hab = WinQueryAnchorBlock(hwnd);
|
---|
318 | pThis->hwndNtbk = WinWindowFromID(hwnd, DL_WIN32KCC_NTBK);
|
---|
319 | if (!WinSetWindowPtr(hwnd, QWL_USER, pThis))
|
---|
320 | {
|
---|
321 | /* complain, dismiss and return. */
|
---|
322 | Complain(hwnd, IDS_ERR_SET_INSTANCEDATA,
|
---|
323 | WinGetLastError(pThis->hab),
|
---|
324 | getLastErrorMsg(pThis->hab));
|
---|
325 | WinDismissDlg(hwnd, 0);
|
---|
326 | WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
|
---|
327 | free(pThis);
|
---|
328 | return FALSE;
|
---|
329 | }
|
---|
330 |
|
---|
331 |
|
---|
332 | /*
|
---|
333 | * Load and set accellerator table.
|
---|
334 | */
|
---|
335 | WinSetAccelTable(pThis->hab, WinLoadAccelTable(pThis->hab, NULLHANDLE, DL_WIN32KCC), hwnd);
|
---|
336 |
|
---|
337 |
|
---|
338 | /*
|
---|
339 | * Insert notebooks pages.
|
---|
340 | */
|
---|
341 | for (i = 0; i < W32KCCPG_PAGES; i++)
|
---|
342 | {
|
---|
343 | ULONG ulErrId = 0;
|
---|
344 | ULONG iPage = aPages[i].idPage;
|
---|
345 |
|
---|
346 | rc = DosGetResource(NULLHANDLE, RT_DIALOG, aPages[i].idDlg, (PPVOID)(void*)&pdlgt);
|
---|
347 | if (rc)
|
---|
348 | {
|
---|
349 | Complain(hwnd, IDS_ERR_FAILED_TO_LOAD_DLGT, aPages[i].idDlg, rc);
|
---|
350 | WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
|
---|
351 | WinSendMsg(hwnd, WM_DESTROY, NULL, NULL);
|
---|
352 | return FALSE;
|
---|
353 | }
|
---|
354 |
|
---|
355 | pThis->aPages[iPage].hwnd =
|
---|
356 | (HWND)WinLoadDlg(hwnd, HWND_DESKTOP, aPages[i].pfnDlgProc,
|
---|
357 | NULLHANDLE, aPages[i].idDlg, pThis);
|
---|
358 | if (pThis->aPages[iPage].hwnd != NULLHANDLE)
|
---|
359 | {
|
---|
360 | /*
|
---|
361 | * Resize the notebook according to the first page.
|
---|
362 | * Get the size of the page we're inserting
|
---|
363 | * Calc notebook size according to that page.
|
---|
364 | * Resize the notebook controll.
|
---|
365 | * Resize the dialog.
|
---|
366 | * Recalc page rectangle.
|
---|
367 | */
|
---|
368 | if (i == 0)
|
---|
369 | {
|
---|
370 | WinQueryWindowPos(pThis->aPages[iPage].hwnd, &swp);
|
---|
371 | rectl.xLeft = rectl.yBottom = 0;
|
---|
372 | rectl.xRight = swp.cx;
|
---|
373 | rectl.yTop = swp.cy;
|
---|
374 | WinSendMsg(pThis->hwndNtbk, BKM_CALCPAGERECT, &rectl, (MPARAM)FALSE);
|
---|
375 |
|
---|
376 | WinQueryWindowPos(pThis->hwndNtbk, &swp);
|
---|
377 | WinSetWindowPos(pThis->hwndNtbk, NULLHANDLE,
|
---|
378 | 0, 0,
|
---|
379 | rectl.xRight - rectl.xLeft,
|
---|
380 | rectl.yTop - rectl.yBottom,
|
---|
381 | SWP_SIZE);
|
---|
382 |
|
---|
383 | WinQueryWindowPos(hwnd, &swp2);
|
---|
384 | WinSetWindowPos(hwnd, NULLHANDLE,
|
---|
385 | 0, 0,
|
---|
386 | swp2.cx + (rectl.xRight - rectl.xLeft) - swp.cx,
|
---|
387 | swp2.cy + (rectl.yTop - rectl.yBottom) - swp.cy,
|
---|
388 | SWP_SIZE);
|
---|
389 | }
|
---|
390 |
|
---|
391 | /*
|
---|
392 | * Insert page.
|
---|
393 | */
|
---|
394 | pThis->aPages[iPage].ulId =
|
---|
395 | (ULONG)WinSendMsg(pThis->hwndNtbk, BKM_INSERTPAGE, NULL,
|
---|
396 | MPFROM2SHORT(BKA_MAJOR | BKA_AUTOPAGESIZE, BKA_LAST));
|
---|
397 | if (pThis->aPages[iPage].ulId != 0)
|
---|
398 | {
|
---|
399 | /*
|
---|
400 | * Place the dialog into the page.
|
---|
401 | */
|
---|
402 | if (WinSendMsg(pThis->hwndNtbk, BKM_SETPAGEWINDOWHWND,
|
---|
403 | (MPARAM)pThis->aPages[iPage].ulId, (MPARAM)pThis->aPages[iPage].hwnd))
|
---|
404 | {
|
---|
405 | /*
|
---|
406 | * Set tab text - use the title of the dialog.
|
---|
407 | */
|
---|
408 | szTabText[0] = '\0';
|
---|
409 | if ( pdlgt != NULL && pdlgt->adlgti[0].cchText != 0
|
---|
410 | && pdlgt->adlgti[0].offText != 0xFFFF && pdlgt->adlgti[0].offText != 0)
|
---|
411 | strncat(szTabText, (char*)((unsigned)(pdlgt) + pdlgt->adlgti[0].offText), pdlgt->adlgti[0].cchText);
|
---|
412 | WinSendMsg(pThis->hwndNtbk, BKM_SETTABTEXT, (MPARAM)pThis->aPages[iPage].ulId, &szTabText[0]);
|
---|
413 | }
|
---|
414 | else
|
---|
415 | ulErrId = IDS_ERR_ADD_NTBK_PAGE_SET;
|
---|
416 | }
|
---|
417 | else
|
---|
418 | ulErrId = IDS_ERR_ADD_NTBK_PAGE_INSERT;
|
---|
419 | }
|
---|
420 | else
|
---|
421 | ulErrId = IDS_ERR_ADD_NTBK_PAGE_LOAD;
|
---|
422 |
|
---|
423 | /* Check for error */
|
---|
424 | if (ulErrId)
|
---|
425 | {
|
---|
426 | Complain(hwnd, ulErrId, aPages[i].idDlg, WinGetLastError(pThis->hab), getLastErrorMsg(pThis->hab));
|
---|
427 | WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
|
---|
428 | WinSendMsg(hwnd, WM_DESTROY, NULL, NULL);
|
---|
429 | return FALSE;
|
---|
430 | }
|
---|
431 | }
|
---|
432 |
|
---|
433 | if (fOldNtbk)
|
---|
434 | {
|
---|
435 | POINTL ptl;
|
---|
436 | FONTMETRICS fm;
|
---|
437 |
|
---|
438 | /*
|
---|
439 | * If it's an old style dialog we'll have to resize the tabs.
|
---|
440 | * Hackish!!! Seems like I don't do this right!
|
---|
441 | */
|
---|
442 | for (i = 0, ptl.x = 7, ptl.y = 7; i < W32KCCPG_PAGES; i++)
|
---|
443 | {
|
---|
444 | BOOKTEXT booktxt = {&szTabText[0], sizeof(szTabText)};
|
---|
445 | if (pThis->aPages[i].hwnd == NULLHANDLE) continue;
|
---|
446 |
|
---|
447 | if (WinSendMsg(pThis->hwndNtbk, BKM_QUERYTABTEXT, (MPARAM)pThis->aPages[i].ulId, &booktxt))
|
---|
448 | {
|
---|
449 | POINTL aptl[TXTBOX_COUNT];
|
---|
450 | if (GpiQueryTextBox(WinGetPS(pThis->hwndNtbk), strlen(booktxt.pString)+1, booktxt.pString, TXTBOX_COUNT, aptl))
|
---|
451 | {
|
---|
452 | if (ptl.x < abs(aptl[TXTBOX_BOTTOMRIGHT].x - aptl[TXTBOX_BOTTOMLEFT].x))
|
---|
453 | ptl.x = abs(aptl[TXTBOX_BOTTOMRIGHT].x - aptl[TXTBOX_BOTTOMLEFT].x);
|
---|
454 | }
|
---|
455 | }
|
---|
456 | }
|
---|
457 | if (GpiQueryFontMetrics(WinGetPS(pThis->hwndNtbk), sizeof(fm), &fm))
|
---|
458 | ptl.y = fm.lXHeight + fm.lEmHeight;
|
---|
459 |
|
---|
460 |
|
---|
461 | /*
|
---|
462 | * Before we resize anything, we'll have to get the size of a page.
|
---|
463 | * Change the tab size. This may effect the notebook page size.
|
---|
464 | * Recalc new notebook size using old page size.
|
---|
465 | * Addjust dialog window.
|
---|
466 | * Addjust notebook control.
|
---|
467 | */
|
---|
468 | WinQueryWindowPos(pThis->aPages[aPages[0].idPage].hwnd, &swp);
|
---|
469 |
|
---|
470 | WinSendMsg(pThis->hwndNtbk, BKM_SETDIMENSIONS, MPFROM2SHORT(ptl.x, ptl.y), (MPARAM)BKA_MAJORTAB);
|
---|
471 |
|
---|
472 | rectl.xLeft = swp.x;
|
---|
473 | rectl.yBottom = swp.y;
|
---|
474 | rectl.xRight = swp.cx - swp.x;
|
---|
475 | rectl.yTop = swp.cy - swp.y;
|
---|
476 | WinSendMsg(pThis->hwndNtbk, BKM_CALCPAGERECT, &rectl, (MPARAM)FALSE);
|
---|
477 | WinQueryWindowPos(hwnd, &swp);
|
---|
478 | WinQueryWindowPos(pThis->hwndNtbk, &swp2);
|
---|
479 | WinSetWindowPos(hwnd, NULLHANDLE, 0, 0,
|
---|
480 | swp.cx + rectl.xRight - rectl.xLeft - swp2.cx,
|
---|
481 | swp.cy + rectl.yTop - rectl.yBottom - swp2.cy,
|
---|
482 | SWP_SIZE);
|
---|
483 | WinSetWindowPos(pThis->hwndNtbk, NULLHANDLE, 0, 0,
|
---|
484 | rectl.xRight - rectl.xLeft,
|
---|
485 | rectl.yTop - rectl.yBottom,
|
---|
486 | SWP_SIZE);
|
---|
487 |
|
---|
488 | /*
|
---|
489 | * Set Status text background color to dialog background color.
|
---|
490 | */
|
---|
491 | WinSendMsg(pThis->hwndNtbk, BKM_SETNOTEBOOKCOLORS,
|
---|
492 | (MPARAM)SYSCLR_DIALOGBACKGROUND,
|
---|
493 | (MPARAM)BKA_BACKGROUNDPAGECOLORINDEX);
|
---|
494 | }
|
---|
495 |
|
---|
496 |
|
---|
497 | /*
|
---|
498 | * Send a set controls message which gets data from
|
---|
499 | * win32k and puts it into the controls.
|
---|
500 | */
|
---|
501 | WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);
|
---|
502 | break;
|
---|
503 | }
|
---|
504 |
|
---|
505 |
|
---|
506 | /*
|
---|
507 | * The user wants me to do something...
|
---|
508 | */
|
---|
509 | case WM_COMMAND:
|
---|
510 | switch (SHORT1FROMMP(mp1))
|
---|
511 | {
|
---|
512 | /*
|
---|
513 | * The user pushed the "Apply" button.
|
---|
514 | */
|
---|
515 | case PB_APPLY:
|
---|
516 | {
|
---|
517 | /* Check and get data from the dialog. */
|
---|
518 | if (WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)TRUE, NULL)
|
---|
519 | && pThis->fDirty
|
---|
520 | )
|
---|
521 | {
|
---|
522 | APIRET rc;
|
---|
523 | rc = libWin32kSetOptions(&pThis->NewOptions);
|
---|
524 | if (rc != NO_ERROR)
|
---|
525 | Complain(hwnd, IDS_ERR_SETPOPTIONS, rc);
|
---|
526 | WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);
|
---|
527 | }
|
---|
528 | }
|
---|
529 | break;
|
---|
530 |
|
---|
531 |
|
---|
532 | /*
|
---|
533 | * User pushed the "Refresh" button.
|
---|
534 | */
|
---|
535 | case PB_REFRESH:
|
---|
536 | WinSendMsg(hwnd, WM_SETCONTROLS, NULL, NULL);
|
---|
537 | break;
|
---|
538 |
|
---|
539 |
|
---|
540 | /*
|
---|
541 | * The user pushed the "Close" button.
|
---|
542 | */
|
---|
543 | case DID_OK:
|
---|
544 | /* Check if data is dirty */
|
---|
545 | if (!WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)FALSE, NULL) || pThis->fDirty)
|
---|
546 | {
|
---|
547 | if (ShowMessage(hwnd, IDM_INFO_DIRTY, MB_YESNO | MB_WARNING) != MBID_YES)
|
---|
548 | {
|
---|
549 | fNotExit = TRUE;
|
---|
550 | return NULL;
|
---|
551 | }
|
---|
552 | }
|
---|
553 | /* Close the dialog */
|
---|
554 | fNotExit = FALSE;
|
---|
555 | WinDismissDlg(hwnd, 0);
|
---|
556 | WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
|
---|
557 | break;
|
---|
558 |
|
---|
559 | /*
|
---|
560 | * The use requested update of config.sys.
|
---|
561 | */
|
---|
562 | case PB_UPD_CONFIGSYS:
|
---|
563 | {
|
---|
564 | ULONG ulBootDrv;
|
---|
565 | FILE * phConfigSys;
|
---|
566 | char * pszConfigSys = "A:\\Config.sys";
|
---|
567 | char szArgs[120];
|
---|
568 | int cchArgs;
|
---|
569 |
|
---|
570 | if (!WinSendMsg(hwnd, WM_QUERYCONTROLS, (MPARAM)TRUE, NULL))
|
---|
571 | break;
|
---|
572 | if (DosQuerySysInfo(QSV_BOOT_DRIVE, QSV_BOOT_DRIVE, &ulBootDrv, sizeof(ulBootDrv)))
|
---|
573 | break;
|
---|
574 |
|
---|
575 | /*
|
---|
576 | * Make argument list.
|
---|
577 | */
|
---|
578 | szArgs[0] = '\0';
|
---|
579 | if (pThis->NewOptions.fLogging) strcat(szArgs, " -L:Y");
|
---|
580 | if (pThis->NewOptions.usCom == 0x3f8) strcat(szArgs, " -C1");
|
---|
581 | /*if (pThis->NewOptions.usCom != 0x2f8) strcat(szArgs, " -C2"); - default */
|
---|
582 | if (pThis->NewOptions.usCom == 0x3e8) strcat(szArgs, " -C3");
|
---|
583 | if (pThis->NewOptions.usCom == 0x2e8) strcat(szArgs, " -C4");
|
---|
584 | if (pThis->NewOptions.fPE == FLAGS_PE_PE2LX)strcat(szArgs, " -P:pe2lx");
|
---|
585 | /*if (pThis->NewOptions.fPE == FLAGS_PE_MIXED)strcat(szArgs, " -P:mixed"); - old default */
|
---|
586 | if (pThis->NewOptions.fPE == FLAGS_PE_MIXED)strcat(szArgs, " -P:mixed");
|
---|
587 | /* if (pThis->NewOptions.fPE == FLAGS_PE_PE) strcat(szArgs, " -P:pe"); - default */
|
---|
588 | if (pThis->NewOptions.fPE == FLAGS_PE_NOT) strcat(szArgs, " -P:not");
|
---|
589 | if (pThis->NewOptions.ulInfoLevel != 0) /* -W0 is default */
|
---|
590 | sprintf(szArgs + strlen(szArgs), " -W%d", pThis->NewOptions.ulInfoLevel); /* FIXME - to be changed */
|
---|
591 | if (pThis->NewOptions.fElf) strcat(szArgs, " -E:Y"); /* default is disabled */
|
---|
592 | if (!pThis->NewOptions.fUNIXScript) strcat(szArgs, " -Script:N");
|
---|
593 | if (!pThis->NewOptions.fREXXScript) strcat(szArgs, " -Rexx:N");
|
---|
594 | if (!pThis->NewOptions.fJava) strcat(szArgs, " -Java:N");
|
---|
595 | if (pThis->NewOptions.fNoLoader) strcat(szArgs, " -Noloader");
|
---|
596 | if (!pThis->NewOptions.fDllFixes) strcat(szArgs, " -DllFixes:D"); /* default is enabled */
|
---|
597 | if (!pThis->NewOptions.fForcePreload) strcat(szArgs, " -ForcePreload:Y"); /* default is disabled */
|
---|
598 | if (pThis->NewOptions.cbSwpHeapMax != CB_SWP_MAX)
|
---|
599 | sprintf(szArgs + strlen(szArgs), " -HeapMax:%d", pThis->NewOptions.cbSwpHeapMax); /* FIXME - to be changed */
|
---|
600 | if (pThis->NewOptions.cbResHeapMax != CB_RES_MAX)
|
---|
601 | sprintf(szArgs + strlen(szArgs), " -ResHeapMax:%d", pThis->NewOptions.cbResHeapMax); /* FIXME - to be changed */
|
---|
602 | strcat(szArgs, "\n");
|
---|
603 | cchArgs = strlen(szArgs);
|
---|
604 |
|
---|
605 | /*
|
---|
606 | * Update Config.sys.
|
---|
607 | */
|
---|
608 | *pszConfigSys = (char)(ulBootDrv - 1 + 'A');
|
---|
609 | phConfigSys = fopen(pszConfigSys, "r+");
|
---|
610 | if (phConfigSys)
|
---|
611 | {
|
---|
612 | ULONG cbConfigSys;
|
---|
613 | if ( fseek(phConfigSys, 0, SEEK_END) == 0
|
---|
614 | && (cbConfigSys = ftell(phConfigSys)) > 0
|
---|
615 | && fseek(phConfigSys, 0, SEEK_SET) == 0
|
---|
616 | )
|
---|
617 | {
|
---|
618 | char * pszConfigSys;
|
---|
619 |
|
---|
620 | pszConfigSys = (char*)calloc(1, 2 * (cbConfigSys + 256)); /* Paranoia... */
|
---|
621 | if (pszConfigSys)
|
---|
622 | {
|
---|
623 | char *pszCurrent = pszConfigSys;
|
---|
624 |
|
---|
625 | /* Read and modify config.sys */
|
---|
626 | while (fgets(pszCurrent, cbConfigSys + pszCurrent - pszConfigSys, phConfigSys))
|
---|
627 | {
|
---|
628 | char *pszWin32k;
|
---|
629 | /* NB! This statment will not only update the "device=" statements!
|
---|
630 | * We'll call this a feature...
|
---|
631 | */
|
---|
632 | pszWin32k = stristr(pszCurrent, "win32k.sys");
|
---|
633 | if (pszWin32k)
|
---|
634 | {
|
---|
635 | int cch;
|
---|
636 | pszWin32k += 10; /* skip "win32k.sys" */
|
---|
637 | cch = strlen(pszWin32k);
|
---|
638 | strcpy(pszWin32k, szArgs);
|
---|
639 | if (cchArgs < cch)
|
---|
640 | { /* fix which stops us from shrinking the file.. */
|
---|
641 | memset(pszWin32k + cchArgs - 1, ' ', cch - cchArgs);
|
---|
642 | pszWin32k[cch - 1] = '\n';
|
---|
643 | pszWin32k[cch] = '\0';
|
---|
644 | }
|
---|
645 | }
|
---|
646 |
|
---|
647 | /* next */
|
---|
648 | pszCurrent += strlen(pszCurrent);
|
---|
649 | }
|
---|
650 | if (pszCurrent[-1] != '\n')
|
---|
651 | *pszCurrent++ = '\n';
|
---|
652 |
|
---|
653 | /* Write it back
|
---|
654 | * One big question, how do we shrink a file?
|
---|
655 | */
|
---|
656 | if ( fseek(phConfigSys, 0, SEEK_SET) == 0
|
---|
657 | && fwrite(pszConfigSys, 1, pszCurrent - pszConfigSys, phConfigSys))
|
---|
658 | {
|
---|
659 | ShowMessage(hwnd, IDM_CONFIGSYS_UPDATED, MB_OK);
|
---|
660 | }
|
---|
661 | else
|
---|
662 | Complain(hwnd, IDS_FWRITE_FAILED, pszConfigSys);
|
---|
663 | free(pszConfigSys);
|
---|
664 | }
|
---|
665 | else
|
---|
666 | Complain(hwnd, IDS_MALLOC_FAILED, cbConfigSys + 256);
|
---|
667 | }
|
---|
668 | else
|
---|
669 | Complain(hwnd, IDS_FSIZE_FAILED, pszConfigSys);
|
---|
670 | fclose(phConfigSys);
|
---|
671 | }
|
---|
672 | else
|
---|
673 | Complain(hwnd, IDS_ERR_FOPEN_FAILED, pszConfigSys);
|
---|
674 | break;
|
---|
675 | }
|
---|
676 | }
|
---|
677 | return NULL;
|
---|
678 |
|
---|
679 |
|
---|
680 | /*
|
---|
681 | * Close window. Typically sent when Alt-F4 pressed or system-menu-Close is selected.
|
---|
682 | */
|
---|
683 | case WM_CLOSE:
|
---|
684 | fNotExit = TRUE;
|
---|
685 | WinSendMsg(hwnd, WM_COMMAND,
|
---|
686 | MPFROMSHORT(DID_OK), MPFROM2SHORT(CMDSRC_MENU, FALSE));
|
---|
687 | return NULL;
|
---|
688 |
|
---|
689 |
|
---|
690 | /*
|
---|
691 | * Window is destroyed (last message which ever should reach us!)
|
---|
692 | * -Free acceltable if present.
|
---|
693 | * -Free instance data
|
---|
694 | * -Set the instance data pointer to NULL (just in case).
|
---|
695 | */
|
---|
696 | case WM_DESTROY:
|
---|
697 | {
|
---|
698 | HACCEL haccel = WinQueryAccelTable(pThis->hab, hwnd);
|
---|
699 | if (haccel)
|
---|
700 | WinDestroyAccelTable(haccel);
|
---|
701 | free(pThis);
|
---|
702 | WinSetWindowPtr(hwnd, QWL_USER, NULL);
|
---|
703 | break;
|
---|
704 | }
|
---|
705 |
|
---|
706 |
|
---|
707 | /*
|
---|
708 | * Gets data from win32k.
|
---|
709 | * Sets the controls according to the data from win32k.
|
---|
710 | *
|
---|
711 | * mr: reserved
|
---|
712 | * mp1: reserved
|
---|
713 | * mp2: reserved
|
---|
714 | */
|
---|
715 | case WM_SETCONTROLS:
|
---|
716 | {
|
---|
717 | APIRET rc;
|
---|
718 |
|
---|
719 | /*
|
---|
720 | * Call Win32k.sys to get options and statuses.
|
---|
721 | */
|
---|
722 | memset(&pThis->Options, 0, sizeof(K32OPTIONS));
|
---|
723 | pThis->Options.cb = sizeof(K32OPTIONS);
|
---|
724 | memset(&pThis->Status, 0, sizeof(K32STATUS));
|
---|
725 | pThis->Status.cb = sizeof(K32STATUS);
|
---|
726 | rc = libWin32kQueryOptionsStatus(&pThis->Options, &pThis->Status);
|
---|
727 | if (rc != NO_ERROR)
|
---|
728 | {
|
---|
729 | Complain(hwnd, IDS_ERR_QUERYOPTIONSTATUS, rc);
|
---|
730 | fNotExit = FALSE;
|
---|
731 | WinDismissDlg(hwnd, 0);
|
---|
732 | WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
|
---|
733 | return NULL;
|
---|
734 | }
|
---|
735 |
|
---|
736 | /*
|
---|
737 | * Update the individual pages.
|
---|
738 | */
|
---|
739 | for (i = 0; i < W32KCCPG_PAGES; i++)
|
---|
740 | {
|
---|
741 | if (pThis->aPages[i].hwnd != NULLHANDLE)
|
---|
742 | WinSendMsg(pThis->aPages[i].hwnd, msg, mp1, mp2);
|
---|
743 | }
|
---|
744 |
|
---|
745 | /* Since all fields are update now - we can't be dirty any longer. */
|
---|
746 | pThis->fDirty = FALSE;
|
---|
747 | return NULL;
|
---|
748 | }
|
---|
749 |
|
---|
750 |
|
---|
751 | /*
|
---|
752 | * Validate data in the controls. Complains accoring to mp1.
|
---|
753 | * Put the data into the win32k option struct.
|
---|
754 | *
|
---|
755 | * mr: Valid indicator.
|
---|
756 | * TRUE: Valid data.
|
---|
757 | * FALSE: Not valid data.
|
---|
758 | * mp1: BOOL fComplain.
|
---|
759 | * TRUE: Do complain about errors. The pThis->Options struct
|
---|
760 | * is updated on successful return.
|
---|
761 | * FALSE: Do not complain about errors, and don't update the
|
---|
762 | * pThis->Options struct.
|
---|
763 | * mp2: reserved.
|
---|
764 | */
|
---|
765 | case WM_QUERYCONTROLS:
|
---|
766 | {
|
---|
767 | /*
|
---|
768 | * Init temporary option struct.
|
---|
769 | */
|
---|
770 | memset(&pThis->NewOptions, 0, sizeof(K32OPTIONS));
|
---|
771 | pThis->NewOptions.cb = sizeof(K32OPTIONS);
|
---|
772 |
|
---|
773 | /*
|
---|
774 | * Query the individual pages.
|
---|
775 | */
|
---|
776 | for (i = 0; i < W32KCCPG_PAGES; i++)
|
---|
777 | {
|
---|
778 | if (pThis->aPages[i].hwnd != NULLHANDLE)
|
---|
779 | if (!WinSendMsg(pThis->aPages[i].hwnd, msg, mp1, mp2))
|
---|
780 | {
|
---|
781 | WinSendMsg(pThis->hwndNtbk, BKM_TURNTOPAGE, (MPARAM)pThis->aPages[i].ulId, NULL);
|
---|
782 | return (MPARAM)FALSE;
|
---|
783 | }
|
---|
784 | }
|
---|
785 |
|
---|
786 | /*
|
---|
787 | * Check if there is any change and set the fDirty flag accordingly.
|
---|
788 | */
|
---|
789 | pThis->fDirty = memcmp(&pThis->NewOptions, &pThis->Options, sizeof(K32OPTIONS)) != 0;
|
---|
790 | return (MPARAM)TRUE;
|
---|
791 | }
|
---|
792 |
|
---|
793 | case WM_TRANSLATEACCEL:
|
---|
794 | {
|
---|
795 | break;
|
---|
796 | }
|
---|
797 | }
|
---|
798 |
|
---|
799 | /*
|
---|
800 | * Return thru the default dialog procedure.
|
---|
801 | */
|
---|
802 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
803 | }
|
---|
804 |
|
---|
805 |
|
---|
806 | /**
|
---|
807 | * Dialog procedure for the DL_ dialog.
|
---|
808 | * (See PMREF for the general specifications of this function.)
|
---|
809 | */
|
---|
810 | MRESULT EXPENTRY LoadersDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
811 | {
|
---|
812 | PWIN32KCC pThis;
|
---|
813 |
|
---|
814 |
|
---|
815 | /*
|
---|
816 | * Get instance data pointer (pThis).
|
---|
817 | */
|
---|
818 | if (msg != WM_INITDLG)
|
---|
819 | {
|
---|
820 | pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
821 | if (pThis == NULL)
|
---|
822 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
823 | }
|
---|
824 |
|
---|
825 |
|
---|
826 | /*
|
---|
827 | * Message switch.
|
---|
828 | */
|
---|
829 | switch (msg)
|
---|
830 | {
|
---|
831 | /*
|
---|
832 | * Initialize controls.
|
---|
833 | *
|
---|
834 | * mr: Focus changed or not.
|
---|
835 | * mp1: hwnd of dialog
|
---|
836 | * mp2: (user data) (NULL)
|
---|
837 | */
|
---|
838 | case WM_INITDLG:
|
---|
839 | {
|
---|
840 | /*
|
---|
841 | * Initiate controls (ie. behaviour not data).
|
---|
842 | * - Ranges of the info level spinbuttons.
|
---|
843 | */
|
---|
844 | WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0);
|
---|
845 | WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_SETLIMITS, (MPARAM)4, (MPARAM)0);
|
---|
846 | break;
|
---|
847 | }
|
---|
848 |
|
---|
849 |
|
---|
850 | /*
|
---|
851 | * Gets data from win32k.
|
---|
852 | * Sets the controls according to the data from win32k.
|
---|
853 | *
|
---|
854 | * mr: reserved
|
---|
855 | * mp1: reserved
|
---|
856 | * mp2: reserved
|
---|
857 | */
|
---|
858 | case WM_SETCONTROLS:
|
---|
859 | {
|
---|
860 | CHAR szNumber[32];
|
---|
861 |
|
---|
862 | WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_SETCHECK, (MPARAM)(pThis->Options.fNoLoader), NULL);
|
---|
863 | /* PE */
|
---|
864 | WinSendDlgItemMsg(hwnd, RB_LDR_PE_PURE, BM_SETCHECK, (MPARAM)(pThis->Options.fPE == FLAGS_PE_PE2LX), NULL);
|
---|
865 | WinSendDlgItemMsg(hwnd, RB_LDR_PE_MIXED, BM_SETCHECK, (MPARAM)(pThis->Options.fPE == FLAGS_PE_MIXED), NULL);
|
---|
866 | WinSendDlgItemMsg(hwnd, RB_LDR_PE_PE, BM_SETCHECK, (MPARAM)(pThis->Options.fPE == FLAGS_PE_PE), NULL);
|
---|
867 | WinSendDlgItemMsg(hwnd, RB_LDR_PE_NOT, BM_SETCHECK, (MPARAM)(pThis->Options.fPE == FLAGS_PE_NOT), NULL);
|
---|
868 | WinSendDlgItemMsg(hwnd, CK_LDR_PE_ONEOBJECT, BM_SETCHECK, (MPARAM)(pThis->Options.fPEOneObject), NULL);
|
---|
869 | WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.ulInfoLevel), NULL); /* FIXME to be changed */
|
---|
870 | sprintf(szNumber, "%d", pThis->Status.cPe2LxModules);
|
---|
871 | WinSetDlgItemText(hwnd, TX_LDR_PE_MODULES_VAL, szNumber);
|
---|
872 | /* Elf */
|
---|
873 | WinSendDlgItemMsg(hwnd, CB_LDR_ELF_ENABLED, BM_SETCHECK, (MPARAM)(pThis->Options.fElf), NULL);
|
---|
874 | WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.ulInfoLevel), NULL); /* FIXME to be changed */
|
---|
875 | sprintf(szNumber, "%d", pThis->Status.cElf2LxModules);
|
---|
876 | WinSetDlgItemText(hwnd, TX_LDR_ELF_MODULES_VAL, szNumber);
|
---|
877 | /* UNIX Shell Scripts */
|
---|
878 | WinSendDlgItemMsg(hwnd, CB_LDR_SHELL_SCRIPTS, BM_SETCHECK, (MPARAM)(pThis->Options.fUNIXScript), NULL);
|
---|
879 | /* JAVA */
|
---|
880 | WinSendDlgItemMsg(hwnd, CB_LDR_JAVA, BM_SETCHECK, (MPARAM)(pThis->Options.fJava), NULL);
|
---|
881 | /* REXX Scripts */
|
---|
882 | WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_SETCHECK, (MPARAM)(pThis->Options.fREXXScript), NULL);
|
---|
883 | return NULL;
|
---|
884 | }
|
---|
885 |
|
---|
886 |
|
---|
887 | /*
|
---|
888 | * Validate data in the controls. Complains accoring to mp1.
|
---|
889 | * Put the data into the win32k option struct.
|
---|
890 | *
|
---|
891 | * mr: Valid indicator.
|
---|
892 | * TRUE: Valid data.
|
---|
893 | * FALSE: Not valid data.
|
---|
894 | * mp1: BOOL fComplain.
|
---|
895 | * TRUE: Do complain about errors. The pThis->Options struct
|
---|
896 | * is updated on successful return.
|
---|
897 | * FALSE: Do not complain about errors, and don't update the
|
---|
898 | * pThis->Options struct.
|
---|
899 | * mp2: reserved.
|
---|
900 | */
|
---|
901 | case WM_QUERYCONTROLS:
|
---|
902 | {
|
---|
903 | BOOL fComplain = (BOOL)mp1;
|
---|
904 | ULONG ul;
|
---|
905 |
|
---|
906 | pThis->NewOptions.fNoLoader = WinSendDlgItemMsg(hwnd, CB_LDR_DISABLE_ALL, BM_QUERYCHECK, NULL, NULL) != 0;
|
---|
907 | /* PE */
|
---|
908 | if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PURE, BM_QUERYCHECK, NULL, NULL))
|
---|
909 | pThis->NewOptions.fPE = FLAGS_PE_PE2LX;
|
---|
910 | else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_MIXED, BM_QUERYCHECK, NULL, NULL))
|
---|
911 | pThis->NewOptions.fPE = FLAGS_PE_MIXED;
|
---|
912 | else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_PE, BM_QUERYCHECK, NULL, NULL))
|
---|
913 | pThis->NewOptions.fPE = FLAGS_PE_PE;
|
---|
914 | else if (WinSendDlgItemMsg(hwnd, RB_LDR_PE_NOT, BM_QUERYCHECK, NULL, NULL))
|
---|
915 | pThis->NewOptions.fPE = FLAGS_PE_NOT;
|
---|
916 | else
|
---|
917 | {
|
---|
918 | if (fComplain)
|
---|
919 | Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON);
|
---|
920 | return (MPARAM)FALSE;
|
---|
921 | }
|
---|
922 | pThis->NewOptions.fPEOneObject = (ULONG)WinSendDlgItemMsg(hwnd, CK_LDR_PE_ONEOBJECT, BM_QUERYCHECK, NULL, NULL);
|
---|
923 | if (pThis->NewOptions.fPEOneObject > 2)
|
---|
924 | {
|
---|
925 | if (fComplain)
|
---|
926 | Complain(hwnd, IDS_ERR_NO_PE_RADIOBUTTON);
|
---|
927 | return (MPARAM)FALSE;
|
---|
928 | }
|
---|
929 | if (!WinSendDlgItemMsg(hwnd, SB_LDR_PE_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
|
---|
930 | {
|
---|
931 | if (fComplain)
|
---|
932 | {
|
---|
933 | Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL);
|
---|
934 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_PE_INFOLEVEL));
|
---|
935 | }
|
---|
936 | return (MPARAM)FALSE;
|
---|
937 | }
|
---|
938 | pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */
|
---|
939 |
|
---|
940 | /* Elf */
|
---|
941 | pThis->NewOptions.fElf = WinSendDlgItemMsg(hwnd, CB_LDR_ELF_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0;
|
---|
942 | if (!WinSendDlgItemMsg(hwnd, SB_LDR_ELF_INFOLEVEL, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
|
---|
943 | {
|
---|
944 | if (fComplain)
|
---|
945 | {
|
---|
946 | Complain(hwnd, IDS_ERR_INVALID_INFOLEVEL);
|
---|
947 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_LDR_ELF_INFOLEVEL));
|
---|
948 | }
|
---|
949 | return (MPARAM)FALSE;
|
---|
950 | }
|
---|
951 | //pThis->NewOptions.ulInfoLevel = ul; /* FIXME to be changed */
|
---|
952 | /* UNIX Shell Scripts */
|
---|
953 | pThis->NewOptions.fUNIXScript = WinSendDlgItemMsg(hwnd, CB_LDR_SHELL_SCRIPTS, BM_QUERYCHECK, NULL, NULL) != 0;
|
---|
954 | /* JAVA */
|
---|
955 | pThis->NewOptions.fJava = WinSendDlgItemMsg(hwnd, CB_LDR_JAVA, BM_QUERYCHECK, NULL, NULL) != 0;
|
---|
956 | /* REXX Scripts */
|
---|
957 | pThis->NewOptions.fREXXScript = WinSendDlgItemMsg(hwnd, CB_LDR_REXX, BM_QUERYCHECK, NULL, NULL) != 0;
|
---|
958 | return (MRESULT)TRUE;
|
---|
959 | }
|
---|
960 | }
|
---|
961 |
|
---|
962 | return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2);
|
---|
963 | }
|
---|
964 |
|
---|
965 |
|
---|
966 | /**
|
---|
967 | * Dialog procedure for the DL_ dialog.
|
---|
968 | * (See PMREF for the general specifications of this function.)
|
---|
969 | */
|
---|
970 | MRESULT EXPENTRY LoggingDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
971 | {
|
---|
972 | PWIN32KCC pThis;
|
---|
973 |
|
---|
974 |
|
---|
975 | /*
|
---|
976 | * Get instance data pointer (pThis).
|
---|
977 | */
|
---|
978 | if (msg != WM_INITDLG)
|
---|
979 | {
|
---|
980 | pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
981 | if (pThis == NULL)
|
---|
982 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
983 | }
|
---|
984 |
|
---|
985 |
|
---|
986 | /*
|
---|
987 | * Message switch.
|
---|
988 | */
|
---|
989 | switch (msg)
|
---|
990 | {
|
---|
991 | /*
|
---|
992 | * Gets data from win32k.
|
---|
993 | * Sets the controls according to the data from win32k.
|
---|
994 | *
|
---|
995 | * mr: reserved
|
---|
996 | * mp1: reserved
|
---|
997 | * mp2: reserved
|
---|
998 | */
|
---|
999 | case WM_SETCONTROLS:
|
---|
1000 | {
|
---|
1001 | WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_SETCHECK, (MPARAM)(pThis->Options.fLogging), NULL);
|
---|
1002 | WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3f8), NULL);
|
---|
1003 | WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2f8), NULL);
|
---|
1004 | WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x3e8), NULL);
|
---|
1005 | WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_SETCHECK, (MPARAM)(pThis->Options.usCom == 0x2e8), NULL);
|
---|
1006 | return NULL;
|
---|
1007 | }
|
---|
1008 |
|
---|
1009 |
|
---|
1010 | /*
|
---|
1011 | * Validate data in the controls. Complains accoring to mp1.
|
---|
1012 | * Put the data into the win32k option struct.
|
---|
1013 | *
|
---|
1014 | * mr: Valid indicator.
|
---|
1015 | * TRUE: Valid data.
|
---|
1016 | * FALSE: Not valid data.
|
---|
1017 | * mp1: BOOL fComplain.
|
---|
1018 | * TRUE: Do complain about errors. The pThis->Options struct
|
---|
1019 | * is updated on successful return.
|
---|
1020 | * FALSE: Do not complain about errors, and don't update the
|
---|
1021 | * pThis->Options struct.
|
---|
1022 | * mp2: reserved.
|
---|
1023 | */
|
---|
1024 | case WM_QUERYCONTROLS:
|
---|
1025 | {
|
---|
1026 | BOOL fComplain = (BOOL)mp1;
|
---|
1027 |
|
---|
1028 | pThis->NewOptions.fLogging = WinSendDlgItemMsg(hwnd, CB_LOGGING_ENABLED, BM_QUERYCHECK, NULL, NULL) != 0;
|
---|
1029 | if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM1, BM_QUERYCHECK, NULL, NULL))
|
---|
1030 | pThis->NewOptions.usCom = 0x3f8;
|
---|
1031 | else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM2, BM_QUERYCHECK, NULL, NULL))
|
---|
1032 | pThis->NewOptions.usCom = 0x2f8;
|
---|
1033 | else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM3, BM_QUERYCHECK, NULL, NULL))
|
---|
1034 | pThis->NewOptions.usCom = 0x3e8;
|
---|
1035 | else if (WinSendDlgItemMsg(hwnd, RB_LOGGING_COM4, BM_QUERYCHECK, NULL, NULL))
|
---|
1036 | pThis->NewOptions.usCom = 0x2e8;
|
---|
1037 | else
|
---|
1038 | {
|
---|
1039 | if (fComplain)
|
---|
1040 | Complain(hwnd, IDS_ERR_NO_COM_RADIOBUTTON);
|
---|
1041 | return (MPARAM)FALSE;
|
---|
1042 | }
|
---|
1043 | return (MRESULT)TRUE;
|
---|
1044 | }
|
---|
1045 | }
|
---|
1046 |
|
---|
1047 | return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2);
|
---|
1048 | }
|
---|
1049 |
|
---|
1050 |
|
---|
1051 | /**
|
---|
1052 | * Dialog procedure for the DL_ dialog.
|
---|
1053 | * (See PMREF for the general specifications of this function.)
|
---|
1054 | */
|
---|
1055 | MRESULT EXPENTRY StatusDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1056 | {
|
---|
1057 | PWIN32KCC pThis;
|
---|
1058 |
|
---|
1059 | /*
|
---|
1060 | * Get instance data pointer (pThis).
|
---|
1061 | */
|
---|
1062 | if (msg != WM_INITDLG)
|
---|
1063 | {
|
---|
1064 | pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
1065 | if (pThis == NULL)
|
---|
1066 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
1067 | }
|
---|
1068 |
|
---|
1069 |
|
---|
1070 | /*
|
---|
1071 | * Message switch.
|
---|
1072 | */
|
---|
1073 | switch (msg)
|
---|
1074 | {
|
---|
1075 | /*
|
---|
1076 | * Gets data from win32k.
|
---|
1077 | * Sets the controls according to the data from win32k.
|
---|
1078 | *
|
---|
1079 | * mr: reserved
|
---|
1080 | * mp1: reserved
|
---|
1081 | * mp2: reserved
|
---|
1082 | */
|
---|
1083 | case WM_SETCONTROLS:
|
---|
1084 | {
|
---|
1085 | CHAR szBuffer[100];
|
---|
1086 |
|
---|
1087 | /*
|
---|
1088 | * Set the controls
|
---|
1089 | */
|
---|
1090 | sprintf(szBuffer, "%d.%d", 0, pThis->Status.ulVersion);
|
---|
1091 | WinSetDlgItemText(hwnd, TX_W32K_VERSION_VAL, szBuffer);
|
---|
1092 | sprintf(szBuffer, "%s %s", pThis->Status.szBuildTime, pThis->Status.szBuildDate);
|
---|
1093 | WinSetDlgItemText(hwnd, TX_W32K_BUILD_DATETIME_VAL, szBuffer);
|
---|
1094 | WinSetDlgItemText(hwnd, TX_W32K_SYMBOLFILE_VAL, pThis->Status.szSymFile);
|
---|
1095 | sprintf(szBuffer, "%d - ", pThis->Status.ulBuild);
|
---|
1096 | if (GetFixpackDesc(pThis->Status.ulBuild, pThis->Status.fKernel, szBuffer + strlen(szBuffer)))
|
---|
1097 | sprintf(szBuffer, "%d", pThis->Status.ulBuild);
|
---|
1098 | WinSetDlgItemText(hwnd, TX_W32K_KERNELBUILD_VAL, szBuffer);
|
---|
1099 | return NULL;
|
---|
1100 | }
|
---|
1101 | }
|
---|
1102 |
|
---|
1103 | return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2);
|
---|
1104 | }
|
---|
1105 |
|
---|
1106 | /**
|
---|
1107 | * Dialog procedure for the DL_ dialog.
|
---|
1108 | * (See PMREF for the general specifications of this function.)
|
---|
1109 | */
|
---|
1110 | MRESULT EXPENTRY HeapsDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1111 | {
|
---|
1112 | PWIN32KCC pThis;
|
---|
1113 |
|
---|
1114 |
|
---|
1115 | /*
|
---|
1116 | * Get instance data pointer (pThis).
|
---|
1117 | */
|
---|
1118 | if (msg != WM_INITDLG)
|
---|
1119 | {
|
---|
1120 | pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
1121 | if (pThis == NULL)
|
---|
1122 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
1123 | }
|
---|
1124 |
|
---|
1125 |
|
---|
1126 | /*
|
---|
1127 | * Message switch.
|
---|
1128 | */
|
---|
1129 | switch (msg)
|
---|
1130 | {
|
---|
1131 | /*
|
---|
1132 | * Initialize controls.
|
---|
1133 | *
|
---|
1134 | * mr: Focus changed or not.
|
---|
1135 | * mp1: hwnd of dialog
|
---|
1136 | * mp2: (user data) (NULL)
|
---|
1137 | */
|
---|
1138 | case WM_INITDLG:
|
---|
1139 | {
|
---|
1140 | /*
|
---|
1141 | * Initiate controls (ie. behaviour not data).
|
---|
1142 | * - Max length of the max heap size entry fields.
|
---|
1143 | */
|
---|
1144 | WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128);
|
---|
1145 | WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETLIMITS, (MPARAM)32678, (MPARAM)128);
|
---|
1146 | break;
|
---|
1147 | }
|
---|
1148 |
|
---|
1149 |
|
---|
1150 | /*
|
---|
1151 | * Gets data from win32k.
|
---|
1152 | * Sets the controls according to the data from win32k.
|
---|
1153 | *
|
---|
1154 | * mr: reserved
|
---|
1155 | * mp1: reserved
|
---|
1156 | * mp2: reserved
|
---|
1157 | */
|
---|
1158 | case WM_SETCONTROLS:
|
---|
1159 | {
|
---|
1160 | CHAR szNumber[32];
|
---|
1161 |
|
---|
1162 | /* Resident */
|
---|
1163 | WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbResHeapMax / 1024), NULL);
|
---|
1164 | sprintf(szNumber, "%d", pThis->Status.cbResHeapInit / 1024);
|
---|
1165 | WinSetDlgItemText(hwnd, TX_HEAP_RES_INIT_VAL, szNumber);
|
---|
1166 | sprintf(szNumber, "%d", pThis->Status.cbResHeapSize / 1024);
|
---|
1167 | WinSetDlgItemText(hwnd, TX_HEAP_RES_SIZE_VAL, szNumber);
|
---|
1168 | sprintf(szNumber, "%d", pThis->Status.cbResHeapUsed / 1024);
|
---|
1169 | WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_VAL, szNumber);
|
---|
1170 | sprintf(szNumber, "%d", pThis->Status.cbResHeapFree / 1024);
|
---|
1171 | WinSetDlgItemText(hwnd, TX_HEAP_RES_FREE_VAL, szNumber);
|
---|
1172 | sprintf(szNumber, "%d", pThis->Status.cResBlocksUsed);
|
---|
1173 | WinSetDlgItemText(hwnd, TX_HEAP_RES_USED_BLOCKS_VAL, szNumber);
|
---|
1174 | sprintf(szNumber, "%d", pThis->Status.cResBlocksFree);
|
---|
1175 | WinSetDlgItemText(hwnd, TX_HEAP_RES_FREE_BLOCKS_VAL, szNumber);
|
---|
1176 | /* Swappable */
|
---|
1177 | WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_SETCURRENTVALUE, (MPARAM)(pThis->Options.cbSwpHeapMax / 1024), NULL);
|
---|
1178 | sprintf(szNumber, "%d", pThis->Status.cbSwpHeapInit / 1024);
|
---|
1179 | WinSetDlgItemText(hwnd, TX_HEAP_SWP_INIT_VAL, szNumber);
|
---|
1180 | sprintf(szNumber, "%d", pThis->Status.cbSwpHeapSize / 1024);
|
---|
1181 | WinSetDlgItemText(hwnd, TX_HEAP_SWP_SIZE_VAL, szNumber);
|
---|
1182 | sprintf(szNumber, "%d", pThis->Status.cbSwpHeapUsed / 1024);
|
---|
1183 | WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_VAL, szNumber);
|
---|
1184 | sprintf(szNumber, "%d", pThis->Status.cbSwpHeapFree / 1024);
|
---|
1185 | WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_VAL, szNumber);
|
---|
1186 | sprintf(szNumber, "%d", pThis->Status.cSwpBlocksUsed);
|
---|
1187 | WinSetDlgItemText(hwnd, TX_HEAP_SWP_USED_BLOCKS_VAL, szNumber);
|
---|
1188 | sprintf(szNumber, "%d", pThis->Status.cSwpBlocksFree);
|
---|
1189 | WinSetDlgItemText(hwnd, TX_HEAP_SWP_FREE_BLOCKS_VAL, szNumber);
|
---|
1190 | return NULL;
|
---|
1191 | }
|
---|
1192 |
|
---|
1193 |
|
---|
1194 | /*
|
---|
1195 | * Validate data in the controls. Complains accoring to mp1.
|
---|
1196 | * Put the data into the win32k option struct.
|
---|
1197 | *
|
---|
1198 | * mr: Valid indicator.
|
---|
1199 | * TRUE: Valid data.
|
---|
1200 | * FALSE: Not valid data.
|
---|
1201 | * mp1: BOOL fComplain.
|
---|
1202 | * TRUE: Do complain about errors. The pThis->Options struct
|
---|
1203 | * is updated on successful return.
|
---|
1204 | * FALSE: Do not complain about errors, and don't update the
|
---|
1205 | * pThis->Options struct.
|
---|
1206 | * mp2: reserved.
|
---|
1207 | */
|
---|
1208 | case WM_QUERYCONTROLS:
|
---|
1209 | {
|
---|
1210 | BOOL fComplain = (BOOL)mp1;
|
---|
1211 | ULONG ul;
|
---|
1212 |
|
---|
1213 | /* Resident */
|
---|
1214 | if (!WinSendDlgItemMsg(hwnd, SB_HEAP_RES_MAX, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
|
---|
1215 | {
|
---|
1216 | if (fComplain)
|
---|
1217 | {
|
---|
1218 | Complain(hwnd, IDS_ERR_INVALID_MAXHEAPSIZE);
|
---|
1219 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_HEAP_RES_MAX));
|
---|
1220 | }
|
---|
1221 | return (MPARAM)FALSE;
|
---|
1222 | }
|
---|
1223 | pThis->NewOptions.cbResHeapMax = ul*1024;
|
---|
1224 | /* Swappable */
|
---|
1225 | if (!WinSendDlgItemMsg(hwnd, SB_HEAP_SWP_MAX, SPBM_QUERYVALUE, (MPARAM)&ul, MPFROM2SHORT(0, SPBQ_UPDATEIFVALID)))
|
---|
1226 | {
|
---|
1227 | if (fComplain)
|
---|
1228 | {
|
---|
1229 | Complain(hwnd, IDS_ERR_INVALID_MAXHEAPSIZE);
|
---|
1230 | WinSetFocus(HWND_DESKTOP, WinWindowFromID(hwnd, SB_HEAP_SWP_MAX));
|
---|
1231 | }
|
---|
1232 | return (MPARAM)FALSE;
|
---|
1233 | }
|
---|
1234 | pThis->NewOptions.cbSwpHeapMax = ul*1024;
|
---|
1235 | return (MRESULT)TRUE;
|
---|
1236 | }
|
---|
1237 | }
|
---|
1238 |
|
---|
1239 | return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2);
|
---|
1240 | }
|
---|
1241 |
|
---|
1242 |
|
---|
1243 | /**
|
---|
1244 | * Dialog procedure for the DL_ dialog.
|
---|
1245 | * (See PMREF for the general specifications of this function.)
|
---|
1246 | */
|
---|
1247 | MRESULT EXPENTRY LdrFixDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1248 | {
|
---|
1249 | PWIN32KCC pThis;
|
---|
1250 |
|
---|
1251 |
|
---|
1252 | /*
|
---|
1253 | * Get instance data pointer (pThis).
|
---|
1254 | */
|
---|
1255 | if (msg != WM_INITDLG)
|
---|
1256 | {
|
---|
1257 | pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
1258 | if (pThis == NULL)
|
---|
1259 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
1260 | }
|
---|
1261 |
|
---|
1262 |
|
---|
1263 | /*
|
---|
1264 | * Message switch.
|
---|
1265 | */
|
---|
1266 | switch (msg)
|
---|
1267 | {
|
---|
1268 | /*
|
---|
1269 | * Gets data from win32k.
|
---|
1270 | * Sets the controls according to the data from win32k.
|
---|
1271 | *
|
---|
1272 | * mr: reserved
|
---|
1273 | * mp1: reserved
|
---|
1274 | * mp2: reserved
|
---|
1275 | */
|
---|
1276 | case WM_SETCONTROLS:
|
---|
1277 | {
|
---|
1278 | WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_SETCHECK, (MPARAM)(pThis->Options.fDllFixes), NULL);
|
---|
1279 | WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_SETCHECK, (MPARAM)(pThis->Options.fForcePreload), NULL);
|
---|
1280 | return NULL;
|
---|
1281 | }
|
---|
1282 |
|
---|
1283 |
|
---|
1284 | /*
|
---|
1285 | * Validate data in the controls. Complains accoring to mp1.
|
---|
1286 | * Put the data into the win32k option struct.
|
---|
1287 | *
|
---|
1288 | * mr: Valid indicator.
|
---|
1289 | * TRUE: Valid data.
|
---|
1290 | * FALSE: Not valid data.
|
---|
1291 | * mp1: BOOL fComplain.
|
---|
1292 | * TRUE: Do complain about errors. The pThis->Options struct
|
---|
1293 | * is updated on successful return.
|
---|
1294 | * FALSE: Do not complain about errors, and don't update the
|
---|
1295 | * pThis->Options struct.
|
---|
1296 | * mp2: reserved.
|
---|
1297 | */
|
---|
1298 | case WM_QUERYCONTROLS:
|
---|
1299 | {
|
---|
1300 | pThis->NewOptions.fDllFixes = WinSendDlgItemMsg(hwnd, CB_LDRFIX_DLLFIXES, BM_QUERYCHECK, NULL, NULL) != 0;
|
---|
1301 | pThis->NewOptions.fForcePreload = WinSendDlgItemMsg(hwnd, CB_LDRFIX_FORCEPRELOAD, BM_QUERYCHECK, NULL, NULL) != 0;
|
---|
1302 | pThis->NewOptions.fExeFixes = pThis->Options.fExeFixes;
|
---|
1303 | return (MRESULT)TRUE;
|
---|
1304 | }
|
---|
1305 | }
|
---|
1306 |
|
---|
1307 | return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2);
|
---|
1308 | }
|
---|
1309 |
|
---|
1310 |
|
---|
1311 | /**
|
---|
1312 | * Dialog procedure for the DL_ dialog.
|
---|
1313 | * (See PMREF for the general specifications of this function.)
|
---|
1314 | */
|
---|
1315 | MRESULT EXPENTRY MemInfoDlgProc (HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1316 | {
|
---|
1317 | PWIN32KCC pThis;
|
---|
1318 |
|
---|
1319 |
|
---|
1320 | /*
|
---|
1321 | * Get instance data pointer (pThis).
|
---|
1322 | */
|
---|
1323 | if (msg != WM_INITDLG)
|
---|
1324 | {
|
---|
1325 | pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
1326 | if (pThis == NULL)
|
---|
1327 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
1328 | }
|
---|
1329 |
|
---|
1330 |
|
---|
1331 | /*
|
---|
1332 | * Message switch.
|
---|
1333 | */
|
---|
1334 | switch (msg)
|
---|
1335 | {
|
---|
1336 | /*
|
---|
1337 | * Start timer.
|
---|
1338 | *
|
---|
1339 | * mr: Focus changed or not.
|
---|
1340 | * mp1: hwnd of dialog
|
---|
1341 | * mp2: (user data) (pThis for notebook)
|
---|
1342 | */
|
---|
1343 | case WM_INITDLG:
|
---|
1344 | {
|
---|
1345 | pThis = (PWIN32KCC)mp2;
|
---|
1346 | WinEnableWindow(WinWindowFromID(hwnd, TX_MEMINFO_PAGE_ENABLED), FALSE);
|
---|
1347 | pThis->idMemTimer = WinStartTimer(pThis->hab, hwnd, 42, 1000);
|
---|
1348 | if (!pThis->idMemTimer)
|
---|
1349 | Complain(hwnd, IDS_ERR_TIMER_START, WinGetLastError(pThis->hab), getLastErrorMsg(pThis->hab));
|
---|
1350 | memset(&pThis->MemInfo, -1, sizeof(pThis->MemInfo)); /* Force update of everything. */
|
---|
1351 | break; /* not return, break thru the ntbk page default procedure. */
|
---|
1352 | }
|
---|
1353 |
|
---|
1354 |
|
---|
1355 | /*
|
---|
1356 | * We've started a timer for refreshing the memory data.
|
---|
1357 | *
|
---|
1358 | * mr: reserved
|
---|
1359 | * mp1: Id of the timer which is ticking.
|
---|
1360 | * mp2: reserved
|
---|
1361 | */
|
---|
1362 | case WM_TIMER:
|
---|
1363 | {
|
---|
1364 | if ((ULONG)mp1 != pThis->idMemTimer)
|
---|
1365 | return NULL;
|
---|
1366 |
|
---|
1367 | /* intented fallthru to WM_SETCONTROLS */
|
---|
1368 | }
|
---|
1369 |
|
---|
1370 |
|
---|
1371 | /*
|
---|
1372 | * Save old data.
|
---|
1373 | * Gets system meminfo data from win32k.
|
---|
1374 | * Updated changed values.
|
---|
1375 | * Update pThis with new meminfo.
|
---|
1376 | *
|
---|
1377 | * mr: reserved
|
---|
1378 | * mp1: reserved
|
---|
1379 | * mp2: reserved
|
---|
1380 | */
|
---|
1381 | case WM_SETCONTROLS:
|
---|
1382 | {
|
---|
1383 | K32SYSTEMMEMINFO MemInfo;
|
---|
1384 | K32SYSTEMMEMINFO OldMemInfo;
|
---|
1385 | APIRET rc;
|
---|
1386 |
|
---|
1387 | OldMemInfo = pThis->MemInfo;
|
---|
1388 | MemInfo.cb = sizeof(MemInfo);
|
---|
1389 | MemInfo.flFlags = 0;
|
---|
1390 | rc = W32kQuerySystemMemInfo(&MemInfo);
|
---|
1391 | if (rc)
|
---|
1392 | {
|
---|
1393 | WinStopTimer(pThis->hab, hwnd, pThis->idMemTimer);
|
---|
1394 | break;
|
---|
1395 | }
|
---|
1396 |
|
---|
1397 | if (MemInfo.cbSwapFileSize != OldMemInfo.cbSwapFileSize)
|
---|
1398 | SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_SIZE , "%d", MemInfo.cbSwapFileSize / 1024);
|
---|
1399 | if (MemInfo.cbSwapFileAvail != OldMemInfo.cbSwapFileAvail)
|
---|
1400 | SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_AVAIL , "%d", MemInfo.cbSwapFileAvail / 1024);
|
---|
1401 | if (MemInfo.cbSwapFileUsed != OldMemInfo.cbSwapFileUsed)
|
---|
1402 | SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_USED , "%d", MemInfo.cbSwapFileUsed / 1024);
|
---|
1403 | if (MemInfo.cbSwapFileMinFree != OldMemInfo.cbSwapFileMinFree)
|
---|
1404 | SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_MINFREE , "%d", MemInfo.cbSwapFileMinFree / 1024);
|
---|
1405 | if (MemInfo.cbSwapFileCFGMinFree != OldMemInfo.cbSwapFileCFGMinFree)
|
---|
1406 | SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_CFG_MINFREE, "%d", MemInfo.cbSwapFileCFGMinFree / 1024);
|
---|
1407 | if (MemInfo.cbSwapFileCFGSwapSize != OldMemInfo.cbSwapFileCFGSwapSize)
|
---|
1408 | SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_CFG_SIZE , "%d", MemInfo.cbSwapFileCFGSwapSize / 1024);
|
---|
1409 | if (MemInfo.cSwapFileBrokenDF != OldMemInfo.cSwapFileBrokenDF)
|
---|
1410 | SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_BROKEN_DFS , "%d", MemInfo.cSwapFileBrokenDF);
|
---|
1411 | if (MemInfo.cSwapFileGrowFails != OldMemInfo.cSwapFileGrowFails)
|
---|
1412 | SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_GROW_FAILS , "%d", MemInfo.cSwapFileGrowFails);
|
---|
1413 | if (MemInfo.cSwapFileInMemFile != OldMemInfo.cSwapFileInMemFile)
|
---|
1414 | SetDlgItemTextF(hwnd, TX_MEMINFO_SWAP_DFS_IN_MEMFILE, "%d", MemInfo.cSwapFileInMemFile);
|
---|
1415 |
|
---|
1416 | if (MemInfo.cbPhysSize != OldMemInfo.cbPhysSize)
|
---|
1417 | SetDlgItemTextF(hwnd, TX_MEMINFO_PHYS_SIZE , "%d", MemInfo.cbPhysSize / 1024);
|
---|
1418 | if (MemInfo.cbPhysAvail != OldMemInfo.cbPhysAvail)
|
---|
1419 | SetDlgItemTextF(hwnd, TX_MEMINFO_PHYS_AVAIL, "%d", MemInfo.cbPhysAvail / 1024);
|
---|
1420 | if (MemInfo.cbPhysUsed != OldMemInfo.cbPhysUsed)
|
---|
1421 | SetDlgItemTextF(hwnd, TX_MEMINFO_PHYS_USED , "%d", MemInfo.cbPhysUsed / 1024);
|
---|
1422 | if (MemInfo.fPagingSwapEnabled != OldMemInfo.fPagingSwapEnabled)
|
---|
1423 | WinSendDlgItemMsg(hwnd, TX_MEMINFO_PAGE_ENABLED, BM_SETCHECK, (MPARAM)MemInfo.fPagingSwapEnabled, NULL);
|
---|
1424 | if (MemInfo.cPagingPageFaults != OldMemInfo.cPagingPageFaults)
|
---|
1425 | SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_FAULTS , "%d", MemInfo.cPagingPageFaults);
|
---|
1426 | if (MemInfo.cPagingPageFaultsActive != OldMemInfo.cPagingPageFaultsActive)
|
---|
1427 | SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_FAULTS_ACTIVE, "%d", MemInfo.cPagingPageFaultsActive);
|
---|
1428 | if (MemInfo.cPagingPhysPages != OldMemInfo.cPagingPhysPages)
|
---|
1429 | SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_PHYSPAGES, "%d", MemInfo.cPagingPhysPages);
|
---|
1430 | if (MemInfo.cPagingResidentPages != OldMemInfo.cPagingResidentPages)
|
---|
1431 | SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_RESPAGES , "%d", MemInfo.cPagingResidentPages);
|
---|
1432 | if (MemInfo.cPagingSwappablePages != OldMemInfo.cPagingSwappablePages)
|
---|
1433 | SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_SWAPPAGES, "%d", MemInfo.cPagingSwappablePages);
|
---|
1434 | if (MemInfo.cPagingDiscardablePages != OldMemInfo.cPagingDiscardablePages)
|
---|
1435 | SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_DISCPAGES, "%d", MemInfo.cPagingDiscardablePages);
|
---|
1436 | if (MemInfo.cPagingDiscardableInmem != OldMemInfo.cPagingDiscardableInmem)
|
---|
1437 | SetDlgItemTextF(hwnd, TX_MEMINFO_PAGE_DISCINMEM, "%d", MemInfo.cPagingDiscardableInmem);
|
---|
1438 |
|
---|
1439 | if (MemInfo.ulAddressLimit != OldMemInfo.ulAddressLimit)
|
---|
1440 | SetDlgItemTextF(hwnd, TX_MEMINFO_VM_ADDRESSLIMIT, "%08xh", MemInfo.ulAddressLimit);
|
---|
1441 | if (MemInfo.ulVMArenaSharedMin != OldMemInfo.ulVMArenaSharedMin)
|
---|
1442 | SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_MIN , "%08xh", MemInfo.ulVMArenaSharedMin);
|
---|
1443 | if (MemInfo.ulVMArenaSharedMax != OldMemInfo.ulVMArenaSharedMax)
|
---|
1444 | SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_MAX , "%08xh", MemInfo.ulVMArenaSharedMax);
|
---|
1445 | if (MemInfo.ulVMArenaPrivMax != OldMemInfo.ulVMArenaPrivMax)
|
---|
1446 | SetDlgItemTextF(hwnd, TX_MEMINFO_VM_PRIVATE_MAX , "%08xh", MemInfo.ulVMArenaPrivMax);
|
---|
1447 | if (MemInfo.ulVMArenaSystemMin != OldMemInfo.ulVMArenaSystemMin)
|
---|
1448 | SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SYSTEM_MIN , "%08xh", MemInfo.ulVMArenaSystemMin);
|
---|
1449 | if (MemInfo.ulVMArenaSystemMax != OldMemInfo.ulVMArenaSystemMax)
|
---|
1450 | SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SYSTEM_MAX , "%08xh", MemInfo.ulVMArenaSystemMax);
|
---|
1451 | if (MemInfo.ulVMArenaHighPrivMax != OldMemInfo.ulVMArenaHighPrivMax)
|
---|
1452 | SetDlgItemTextF(hwnd, TX_MEMINFO_VM_PRIVATE_HMAX, "%08xh", MemInfo.ulVMArenaHighPrivMax);
|
---|
1453 | if (MemInfo.ulVMArenaHighSharedMin != OldMemInfo.ulVMArenaHighSharedMin)
|
---|
1454 | SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_HMIN , "%08xh", MemInfo.ulVMArenaHighSharedMin);
|
---|
1455 | if (MemInfo.ulVMArenaHighSharedMax != OldMemInfo.ulVMArenaHighSharedMax)
|
---|
1456 | SetDlgItemTextF(hwnd, TX_MEMINFO_VM_SHARED_HMAX , "%08xh", MemInfo.ulVMArenaHighSharedMax);
|
---|
1457 |
|
---|
1458 | pThis->MemInfo = MemInfo;
|
---|
1459 | return NULL;
|
---|
1460 | }
|
---|
1461 |
|
---|
1462 | /*
|
---|
1463 | * Cleanup.
|
---|
1464 | *
|
---|
1465 | * mr: reserved
|
---|
1466 | * mp1: reserved
|
---|
1467 | * mp2: reserved
|
---|
1468 | */
|
---|
1469 | case WM_DESTROY:
|
---|
1470 | {
|
---|
1471 | WinStopTimer(pThis->hab, hwnd, pThis->idMemTimer);
|
---|
1472 | break;
|
---|
1473 | }
|
---|
1474 |
|
---|
1475 | }
|
---|
1476 |
|
---|
1477 | return NtbkDefPageDlgProc(hwnd, msg, mp1, mp2);
|
---|
1478 | }
|
---|
1479 |
|
---|
1480 |
|
---|
1481 |
|
---|
1482 | /**
|
---|
1483 | * Default notebook page dialog procedure.
|
---|
1484 | * (See PMREF for the general specifications of this function.)
|
---|
1485 | */
|
---|
1486 | MRESULT EXPENTRY NtbkDefPageDlgProc(HWND hwnd, ULONG msg, MPARAM mp1, MPARAM mp2)
|
---|
1487 | {
|
---|
1488 | /*
|
---|
1489 | * Message switch.
|
---|
1490 | */
|
---|
1491 | switch (msg)
|
---|
1492 | {
|
---|
1493 | /*
|
---|
1494 | * Sets the controls according to the data from win32k.
|
---|
1495 | *
|
---|
1496 | * mr: Focus changed or not.
|
---|
1497 | * mp1: hwnd of dialog
|
---|
1498 | * mp2: (user data) (pThis for notebook)
|
---|
1499 | */
|
---|
1500 | case WM_INITDLG:
|
---|
1501 | {
|
---|
1502 | PWIN32KCC pThis = (PWIN32KCC)mp2;
|
---|
1503 |
|
---|
1504 | if (!WinSetWindowPtr(hwnd, QWL_USER, mp2))
|
---|
1505 | {
|
---|
1506 | /* complain, dismiss and return. */
|
---|
1507 | Complain(hwnd, IDS_ERR_SET_INSTANCEDATA,
|
---|
1508 | WinGetLastError(pThis->hab),
|
---|
1509 | getLastErrorMsg(pThis->hab));
|
---|
1510 | WinPostMsg(hwnd, WM_QUIT, NULL, NULL);
|
---|
1511 | return FALSE;
|
---|
1512 | }
|
---|
1513 |
|
---|
1514 | /*
|
---|
1515 | * Install same acceltable as the notebook - Don't work.
|
---|
1516 | */
|
---|
1517 | WinSetAccelTable(pThis->hab, WinQueryAccelTable(pThis->hab, pThis->hwnd), hwnd);
|
---|
1518 | break;
|
---|
1519 | }
|
---|
1520 |
|
---|
1521 |
|
---|
1522 | /*
|
---|
1523 | * Gets data from win32k.
|
---|
1524 | * Sets the controls according to the data from win32k.
|
---|
1525 | *
|
---|
1526 | * mr: reserved
|
---|
1527 | * mp1: reserved
|
---|
1528 | * mp2: reserved
|
---|
1529 | */
|
---|
1530 | case WM_SETCONTROLS:
|
---|
1531 | {
|
---|
1532 | return NULL;
|
---|
1533 | }
|
---|
1534 |
|
---|
1535 |
|
---|
1536 | /*
|
---|
1537 | * Validate data in the controls. Complains accoring to mp1.
|
---|
1538 | * Put the data into the win32k option struct.
|
---|
1539 | *
|
---|
1540 | * mr: Valid indicator.
|
---|
1541 | * TRUE: Valid data.
|
---|
1542 | * FALSE: Not valid data.
|
---|
1543 | * mp1: BOOL fComplain.
|
---|
1544 | * TRUE: Do complain about errors. The pThis->Options struct
|
---|
1545 | * is updated on successful return.
|
---|
1546 | * FALSE: Do not complain about errors, and don't update the
|
---|
1547 | * pThis->Options struct.
|
---|
1548 | * mp2: reserved.
|
---|
1549 | */
|
---|
1550 | case WM_QUERYCONTROLS:
|
---|
1551 | {
|
---|
1552 | return (MRESULT)TRUE;
|
---|
1553 | }
|
---|
1554 |
|
---|
1555 |
|
---|
1556 | #if 0
|
---|
1557 | /*
|
---|
1558 | * Nice little hack to get global notebook accelerators to work.
|
---|
1559 | *
|
---|
1560 | * mr:
|
---|
1561 | *
|
---|
1562 | */
|
---|
1563 | case WM_TRANSLATEACCEL:
|
---|
1564 | {
|
---|
1565 | static BOOL fSem = FALSE;
|
---|
1566 | MRESULT mr;
|
---|
1567 | PWIN32KCC pThis = (PWIN32KCC)WinQueryWindowPtr(hwnd, QWL_USER);
|
---|
1568 | if (fSem || !pThis)
|
---|
1569 | return FALSE;
|
---|
1570 | fSem = TRUE;
|
---|
1571 | mr = WinSendMsg(pThis->hwnd, msg, mp1, mp2);
|
---|
1572 | fSem = FALSE;
|
---|
1573 | return mr;
|
---|
1574 | }
|
---|
1575 | #endif
|
---|
1576 | }
|
---|
1577 |
|
---|
1578 | return WinDefDlgProc(hwnd, msg, mp1, mp2);
|
---|
1579 | }
|
---|
1580 |
|
---|
1581 | /**
|
---|
1582 | * Spirintf version of WinSetDlgItemText.
|
---|
1583 | * @returns Same as WinSetDlgItemText.
|
---|
1584 | * @param hwndDlg Dialog Window Handle.
|
---|
1585 | * @param idItem Control ID.
|
---|
1586 | * @param pszFormat Pointer to format string. (input to sprintf)
|
---|
1587 | * @param .. Additional parameters.
|
---|
1588 | * @status completly implemented.
|
---|
1589 | * @author knut st. osmundsen (knut.stange.osmundsen@mynd.no)
|
---|
1590 | */
|
---|
1591 | BOOL SetDlgItemTextF(HWND hwndDlg, ULONG idItem, PSZ pszFormat, ...)
|
---|
1592 | {
|
---|
1593 | BOOL fRc;
|
---|
1594 | char sz[64];
|
---|
1595 | va_list arg;
|
---|
1596 |
|
---|
1597 | #pragma info(none)
|
---|
1598 | va_start(arg, pszFormat);
|
---|
1599 | #pragma info(restore)
|
---|
1600 | vsprintf(sz, pszFormat, arg);
|
---|
1601 | va_end(arg);
|
---|
1602 |
|
---|
1603 | fRc = WinSetDlgItemText(hwndDlg, idItem, sz);
|
---|
1604 | #ifdef DEBUG
|
---|
1605 | if (!fRc)
|
---|
1606 | Complain(hwndDlg, IDS_ERR_ASSERT, __FILE__, __LINE__, __FUNCTION__);
|
---|
1607 | #endif
|
---|
1608 |
|
---|
1609 | return fRc;
|
---|
1610 | }
|
---|
1611 |
|
---|
1612 |
|
---|
1613 | /**
|
---|
1614 | * Pops up a message box displaying a message from the message table.
|
---|
1615 | * @returns Return from WinMessageBox
|
---|
1616 | * @param hwndOwner Handle to owner window.
|
---|
1617 | * @param id Message table id of the message.
|
---|
1618 | * @param flStyle Messagebox style.
|
---|
1619 | * If 0 the apply default style.
|
---|
1620 | */
|
---|
1621 | ULONG ShowMessage(HWND hwndOwner, int id, ULONG flStyle)
|
---|
1622 | {
|
---|
1623 | return WinMessageBox(HWND_DESKTOP,
|
---|
1624 | hwndOwner,
|
---|
1625 | getMessage(id),
|
---|
1626 | "Win32k Control Center", 0,
|
---|
1627 | (flStyle == 0
|
---|
1628 | ? MB_OK | MB_INFORMATION
|
---|
1629 | : flStyle)
|
---|
1630 | | MB_MOVEABLE
|
---|
1631 | );
|
---|
1632 | }
|
---|
1633 |
|
---|
1634 |
|
---|
1635 |
|
---|
1636 | /**
|
---|
1637 | * Pops up a message box displaying some complaint or error.
|
---|
1638 | * @returns Success indicator.
|
---|
1639 | * @param hwndOwner Handle of owner window.
|
---|
1640 | * @param id String table id of the message.
|
---|
1641 | * @param ... Arguments passed on to vsprintf to format the message.
|
---|
1642 | */
|
---|
1643 | BOOL Complain(HWND hwndOwner, int id, ...)
|
---|
1644 | {
|
---|
1645 | ULONG rc;
|
---|
1646 | char szMsg[1024];
|
---|
1647 | char szMsgOutput[4096];
|
---|
1648 |
|
---|
1649 |
|
---|
1650 | /*
|
---|
1651 | * Load the string and format it.
|
---|
1652 | */
|
---|
1653 | if (WinLoadString(WinQueryAnchorBlock(hwndOwner), 0, id, sizeof(szMsg), szMsg))
|
---|
1654 | {
|
---|
1655 | va_list args;
|
---|
1656 | #pragma info(none)
|
---|
1657 | va_start(args, id);
|
---|
1658 | #pragma info(restore)
|
---|
1659 | vsprintf(szMsgOutput, szMsg, args);
|
---|
1660 | va_end(args);
|
---|
1661 | }
|
---|
1662 | else
|
---|
1663 | sprintf(szMsgOutput, "Failed to load the message id %id.\n", id);
|
---|
1664 |
|
---|
1665 |
|
---|
1666 | /*
|
---|
1667 | * Show message.
|
---|
1668 | */
|
---|
1669 | rc = WinMessageBox(HWND_DESKTOP, hwndOwner,
|
---|
1670 | szMsgOutput,
|
---|
1671 | "Win32k Control Center - error",
|
---|
1672 | 0,
|
---|
1673 | MB_APPLMODAL | MB_ICONHAND | MB_OK | MB_MOVEABLE);
|
---|
1674 | if (rc == (ULONG)MBID_ERROR)
|
---|
1675 | {
|
---|
1676 | rc = WinMessageBox(HWND_DESKTOP, HWND_DESKTOP,
|
---|
1677 | szMsgOutput,
|
---|
1678 | "Win32k Control Center - error",
|
---|
1679 | 0,
|
---|
1680 | MB_ICONHAND | MB_OK | MB_MOVEABLE);
|
---|
1681 | }
|
---|
1682 |
|
---|
1683 |
|
---|
1684 | /*
|
---|
1685 | * Return according to rc.
|
---|
1686 | */
|
---|
1687 | return rc != MBID_ERROR;
|
---|
1688 | }
|
---|
1689 |
|
---|
1690 |
|
---|
1691 | /**
|
---|
1692 | * Gets the message string for the last error message.
|
---|
1693 | * @returns Pointer to message string.
|
---|
1694 | * @param hab Handle of application anchor block.
|
---|
1695 | */
|
---|
1696 | PCSZ getLastErrorMsg(HAB hab)
|
---|
1697 | {
|
---|
1698 | char *pszErrInfo;
|
---|
1699 | PERRINFO pErrInfo = WinGetErrorInfo(hab);
|
---|
1700 |
|
---|
1701 | if (pErrInfo != NULL && pErrInfo->cDetailLevel > 0)
|
---|
1702 | {
|
---|
1703 | pszErrInfo = (char*)(void*)pErrInfo;
|
---|
1704 | pszErrInfo += ((PUSHORT)(void*)(pszErrInfo + pErrInfo->offaoffszMsg))[pErrInfo->cDetailLevel-1];
|
---|
1705 | }
|
---|
1706 | else
|
---|
1707 | pszErrInfo = "<none>";
|
---|
1708 |
|
---|
1709 | return pszErrInfo;
|
---|
1710 | }
|
---|
1711 |
|
---|
1712 |
|
---|
1713 | /**
|
---|
1714 | * Gets a message from the executable resources.
|
---|
1715 | * @returns Pointer to read-only string.
|
---|
1716 | * NULL if not found/error.
|
---|
1717 | * @param id String Id.
|
---|
1718 | */
|
---|
1719 | PSZ getMessage(ULONG id)
|
---|
1720 | {
|
---|
1721 | PSZ psz;
|
---|
1722 |
|
---|
1723 | if (DosGetResource(NULLHANDLE, RT_MESSAGE, id / 16 + 1, (PPVOID)(void*)&psz) == NO_ERROR)
|
---|
1724 | {
|
---|
1725 | psz +=2;
|
---|
1726 | id %= 16;
|
---|
1727 | while (id-- > 0)
|
---|
1728 | psz += 1 + *psz;
|
---|
1729 | return psz+1;
|
---|
1730 | }
|
---|
1731 | else
|
---|
1732 | psz = NULL;
|
---|
1733 |
|
---|
1734 | return psz;
|
---|
1735 | }
|
---|
1736 |
|
---|
1737 |
|
---|
1738 | /**
|
---|
1739 | * Determin the fixpack+kernel description from build no. and kernel flags.
|
---|
1740 | * @returns 0 on success. Description i szBuffer.
|
---|
1741 | * -1 on error.
|
---|
1742 | * @param ulBuild Kernel build no.
|
---|
1743 | * @param flKernel Win32k kernel flags.
|
---|
1744 | * @param szBuffer Pointer to buffer
|
---|
1745 | */
|
---|
1746 | int GetFixpackDesc(ULONG ulBuild, ULONG flKernel, PSZ pszBuffer)
|
---|
1747 | {
|
---|
1748 |
|
---|
1749 | pszBuffer[0] = '\0';
|
---|
1750 | if (ulBuild == 9023)
|
---|
1751 | strcpy(pszBuffer, "Warp 4 GA");
|
---|
1752 | else if (ulBuild > 9023 && ulBuild <= 9036)
|
---|
1753 | sprintf(pszBuffer, "Warp 4 FP %d", ulBuild - 9024);
|
---|
1754 | else if (ulBuild == 14039)
|
---|
1755 | strcpy(pszBuffer, "WS4eB GA");
|
---|
1756 | else if (ulBuild == 14040)
|
---|
1757 | strcpy(pszBuffer, flKernel & KF_W4 ? "Warp 4 FP13" : "WS4eB FP1");
|
---|
1758 | else if (ulBuild >= 14041 /*&& ulBuild <= 1406x*/)
|
---|
1759 | strcpy(pszBuffer, "Warp 4 FP14");
|
---|
1760 | /*
|
---|
1761 | else if (ulBuild >= 14048)
|
---|
1762 | {
|
---|
1763 | if (flKernel & KF_W4)
|
---|
1764 | sprintf(pszBuffer, "Warp 4 FP%d", ulBuild - 14049 + 15); //???
|
---|
1765 | else
|
---|
1766 | sprintf(pszBuffer, "WS4eB FP%d", ulBuild - 14048 + 2); //???
|
---|
1767 | }
|
---|
1768 | */
|
---|
1769 | else if (ulBuild >= 8255 && ulBuild <= 8270)
|
---|
1770 | sprintf(pszBuffer, "Warp 3 FP%d", ulBuild - 8255 + 32);
|
---|
1771 | else
|
---|
1772 | return -1;
|
---|
1773 |
|
---|
1774 | /*
|
---|
1775 | * Check type.
|
---|
1776 | */
|
---|
1777 | if (pszBuffer[0] != '\0')
|
---|
1778 | {
|
---|
1779 | char *pszAdd;
|
---|
1780 |
|
---|
1781 | if (flKernel & KF_SMP)
|
---|
1782 | pszAdd = "SMP ";
|
---|
1783 | else
|
---|
1784 | pszAdd = " ";
|
---|
1785 | strcpy(pszBuffer + strlen(pszBuffer), pszAdd);
|
---|
1786 |
|
---|
1787 | if (flKernel & KF_DEBUG)
|
---|
1788 | {
|
---|
1789 | if (flKernel & KF_HAS_DEBUGTYPE)
|
---|
1790 | pszAdd = (flKernel & KF_ALLSTRICT) ? "(Allstrict)" : "(Halfstrict)";
|
---|
1791 | else
|
---|
1792 | pszAdd = "(Debug)";
|
---|
1793 | }
|
---|
1794 | else
|
---|
1795 | pszAdd = "(Retail)";
|
---|
1796 | strcpy(pszBuffer + strlen(pszBuffer), pszAdd);
|
---|
1797 | }
|
---|
1798 |
|
---|
1799 | return 0;
|
---|
1800 | }
|
---|
1801 |
|
---|
1802 |
|
---|
1803 | /**
|
---|
1804 | * Upcases a char.
|
---|
1805 | * @returns Upper case of the char given in ch.
|
---|
1806 | * @param ch Char to capitalize.
|
---|
1807 | */
|
---|
1808 | #define upcase(ch) ((ch) >= 'a' && (ch) <= 'z' ? (char)((ch) - ('a' - 'A')) : (ch))
|
---|
1809 |
|
---|
1810 |
|
---|
1811 | /**
|
---|
1812 | * Searches for a substring in a string.
|
---|
1813 | * @returns Pointer to start of substring when found, NULL when not found.
|
---|
1814 | * @param pszStr String to be searched.
|
---|
1815 | * @param pszSubStr String to be searched.
|
---|
1816 | * @remark Depends on the upcase function.
|
---|
1817 | */
|
---|
1818 | static char *stristr(const char *pszStr, const char *pszSubStr)
|
---|
1819 | {
|
---|
1820 | int cchSubStr = strlen(pszSubStr);
|
---|
1821 | int i = 0;
|
---|
1822 |
|
---|
1823 | while (*pszStr != '\0' && i < cchSubStr)
|
---|
1824 | {
|
---|
1825 | i = 0;
|
---|
1826 | while (i < cchSubStr && pszStr[i] != '\0' &&
|
---|
1827 | (upcase(pszStr[i]) == upcase(pszSubStr[i])))
|
---|
1828 | i++;
|
---|
1829 | pszStr++;
|
---|
1830 | }
|
---|
1831 |
|
---|
1832 | #pragma info(none)
|
---|
1833 | return (char*)(*pszStr != '\0' ? (const char*)pszStr - 1 : (const char*)NULL);
|
---|
1834 | #pragma info(restore)
|
---|
1835 | }
|
---|
1836 |
|
---|