📄 summary.c
字号:
/*********************************************************************
* Microsoft Diagnostics Version 2.0
*
* A diagnostic utility to detect as much useful information about a
* customer's computer system as is possible.
*
* Microsoft Diagnostics: We detect the World.
*
* SUMMARY.C - Operates the summary screen and supporting CW routines.
*********************************************************************/
/* Include Files */
#include "msd.h"
#ifdef CW_INCLUDED
#include "cgraphic.h"
#include <process.h>
AY FAR PASCAL GetUILine (void);
/********************************************************************
* Include the auxiliary CW code
********************************************************************/
#include "scr.c"
#include "auxcow.c"
/********************************************************************
* BeginCwInterface - Starts the CW interface code
*
* Returns: Void.
********************************************************************/
VOID BeginCwInterface (VOID)
{
ExamineDisplay();
if (GetCwSumInfo())
exit (1);
#ifdef BASED
/* Initialize the CW window segment */
if (!WndSegInit())
{
PutString ("Error creating window segment");
exit(2);
}
#endif
/* Initialize CW */
if (!FInitCow())
{
PutString ("Error initializing COW");
exit (2);
}
SetCursorBlink (TRUE);
/* SaveOriginalScreen(); */
SetIsaColors (fBlackWhite);
InitModeMapping();
if (!FInitScreenMode (-1))
{
PutString ("Error initializing screen");
exit (2);
}
EnableKeyboard (TRUE);
EnableOverlap (TRUE, (PWND) NULL, 0);
SetCWHook (WH_FRAME, FrameFilter);
fCwIsReady = TRUE;
InitMainWindows();
InitMsgBoxPlateBtns();
InitMyEditItem();
WarnWindowsUser();
/* Main Message Pump */
while (1)
{
MSG msg;
/* Dispatch messages until queue empty */
while (PeekMessage (&msg))
{
DispatchMessage (&msg);
}
while (!FMessage()) /* DOS wait */
{
/* If using FMessage(), application must poll keyboard */
if (fPollKeyboard)
PollKeyboard();
}
}
/* NOT REACHED */
}
/*********************************************************************
* GetCwSumInfo - Get the summary information while using the CW
* interface.
*
* Returns: TRUE if an error occured.
*********************************************************************/
BOOL GetCwSumInfo (VOID)
{
WORD wSize; /* Size of SUMMARY_STRUCT */
/* Obtain the info structure's size */
wSize = GetInfoSize (IDI_SUMMARY_SCREEN, FALSE);
if (wSize == 0)
return (TRUE);
/* Allocate enough room for the info structure */
pSum = malloc (wSize);
if (pSum == NULL)
{
OutOfMemory();
return (TRUE);
}
/* Zero out the structure */
memset (pSum, '\0', wSize);
/* Fill the structure with the information */
if (GetInfo (IDI_SUMMARY_SCREEN, pSum, FALSE, FALSE, TRUE))
{
free (pSum);
return (TRUE);
}
return (FALSE);
}
AY FAR PASCAL GetUILine (VOID)
{
return ((AY) 0);
}
VOID ScreenRedraw (VOID)
{
DrawWindow ( NULL );
}
/*********************************************************************
* SetIsaColors - Sets the correct colors for the CW MSD
*
* fBlackWhiteFlag - Uses the black and white color set if TRUE.
*********************************************************************/
VOID SetIsaColors (BOOL fBlackWhiteFlag)
{
ISA_PAIR *pisap = NULL; /* Pointer to the correct ISA */
ISA i; /* Looping variable */
/* Choose between color and black and white */
if (fBlackWhiteFlag)
pisap = aisapBlackAndWhite;
else
pisap = aisapColor;
/* Set the screen colors */
for (i = 0; i < isaMax; ++i)
SetIsaColor (i, pisap[i].wFore, pisap[i].wBack);
CheckMenuItem (midBlackWhite, fBlackWhiteFlag);
if (fCwIsReady)
DrawWindow (pwndDesktop);
}
/*******************************/
/* Initialize the main windows */
/*******************************/
VOID FAR InitMainWindows (VOID)
{
/* Register the main window */
if (!RegisterClass (0,
0,
0,
MainProcExtraBytes,
MainProcCallID,
MainWndProc))
{
return;
}
/* Register the Info Provider window */
if (!RegisterClass (0,
0,
0,
MainProcExtraBytes,
InfoWndCallID,
InfoWndProc))
{
return;
}
/* Register the Info Provider text window */
if (!RegisterClass (0,
0,
0,
MainProcExtraBytes,
InfoTxtWndCallID,
InfoTxtWndProc))
{
return;
}
/* Register the status line window */
if (!RegisterClass (0,
0,
0,
MainProcExtraBytes,
StatusLineCallID,
StatusLineProc))
{
return;
}
/* Create the status line window */
pwndStatusLine = (PWND) CreateWindow (StatusLineCallID,
NULL,
NULL,
WS_VISIBLE,
0, ayMac - (AY) 1, axMac, 1,
(HWND) pwndDesktop,
(HMENU) NULL,
NULL,
1);
if (pwndStatusLine == NULL)
return;
ShowWindow (pwndStatusLine, SW_VISIBLE, TRUE);
/* Create the main window */
pwndMainFrame = (PWND) CreateWindow (MainProcCallID,
NULL,
WS_CLIPOUT,
WS_FRAME,
0, 0, axMac, ayMac - (AY) 1,
(HWND) pwndDesktop,
(HMENU) hmnuMenuBar,
NULL,
1);
if (pwndMainFrame == NULL)
return;
EnableWindow (pwndMainFrame, TRUE);
ShowWindow (NULL, SW_VISIBLE, TRUE);
/* Enable mouse */
FEnableMouse(TRUE);
/* AddAccelTable (&prgmpvkeyid); */
SetFocus (pwndMainFrame);
}
/*********************************************************************
* MainWndProc - Window to display the pull down menus, the summary
* information, and the buttons
*********************************************************************/
STATIC LONG FAR PASCAL MainWndProc (PWND pwnd,
WORD message,
WORD wParam,
DWORD lParam)
{
WORD i; /* Looping variable */
WORD wKeyState; /* Shift key state when a key is pressed */
static struct BUTTON_INFO
{
PWND pwndInfo; /* PWND of the button's Info Window, or */
/* NULL if there is no Info window up */
/* for that button. */
CHAR chAccel; /* Accelerator character for the button */
PSZ pszHelp; /* Help text for info window */
} ButtonInfo[] =
{
{ NULL, 'P', "Computer: Displays computer, BIOS, and processor information." },
{ NULL, 'M', "Memory: Displays visual memory map and various types of memory." },
{ NULL, 'V', "Video: Displays video adapter make, model, type, and BIOS." },
{ NULL, 'N', "Network: Displays network information." },
{ NULL, 'O', "OS Version: Displays operating system information." },
{ NULL, 'U', "Mouse: Displays mouse information." },
{ NULL, 'A', "Other Adapters: Displays game adapter information." },
{ NULL, 'D', "Disk Drives: Displays disk drive types and sizes." },
{ NULL, 'L', "LPT Ports: Displays status of parallel ports." },
{ NULL, 'C', "COM Ports: Displays status of serial ports." },
{ NULL, 'Q', "IRQ Status: Displays current usage of hardware interrupts." },
{ NULL, 'T', "TSR Programs: Displays allocated memory control blocks." },
{ NULL, 'R', "Device Drivers: Displays installable device driver information." }
};
switch (message)
{
case WM_CREATE:
CreateChildWindows (pwnd);
break;
case WM_PAINT:
{
NPRRC prrc;
RRC rrc;
/* clear the window */
if ((prrc = (NPRRC) LOWORD (lParam)) == NULL)
{
GetClientRrc(pwnd, &rrc);
prrc = &rrc;
}
FillRrc (pwnd, prrc, ' ', isaSummaryText);
WriteSummaryText (pwnd);
break;
}
case WM_COMMAND:
{
switch (wParam)
{
case BaseBtnID + 0:
case BaseBtnID + 1:
case BaseBtnID + 2:
case BaseBtnID + 3:
case BaseBtnID + 4:
case BaseBtnID + 5:
case BaseBtnID + 6:
case BaseBtnID + 7:
case BaseBtnID + 8:
case BaseBtnID + 9:
case BaseBtnID + 10:
case BaseBtnID + 11:
case BaseBtnID + 12:
case BaseBtnID + 13:
if (HIWORD (lParam) == BN_CLICKED)
{
if (ButtonInfo[wParam - BaseBtnID].pwndInfo)
{
/* Bring up the entire info window */
SetFocus (ButtonInfo[wParam - BaseBtnID].pwndInfo);
}
else
{
#if HEAP_DEBUG
CHAR chBuffer[80];
sprintf (chBuffer, "_memavl = %u, _memmax = %u",
_memavl(), _memmax());
ShowStatus (chBuffer);
#endif
DisplayStatus (ST_WORKING);
ButtonInfo[wParam - BaseBtnID].pwndInfo =
ShowInfo (wParam - BaseBtnID + 4);
ShowStatus (ButtonInfo[wParam - BaseBtnID].pszHelp);
}
}
break;
default:
MenuCommand (pwnd, wParam);
break;
}
break;
}
case WM_INFO_WND_CLOSED:
{
WORD wNmbrOpen = 0; /* Number of open info windows */
/* Zero out the window pointer in the Button Info structure */
for (i = 0; i < NumBtns; ++i)
{
if (ButtonInfo[i].pwndInfo == (PWND) wParam)
ButtonInfo[i].pwndInfo = NULL;
/* Count up the number of open info windows */
if (ButtonInfo[i].pwndInfo != NULL)
++wNmbrOpen;
}
/* If we just closed the last info window, set the */
/* focus back here */
if (wNmbrOpen == 0)
SetFocus (pwnd);
DisplayStatus (0);
break;
}
case WM_DRAWITEM:
{
PWND_BTN pwndbtn; /* Button info structure */
RRC rrcButton; /* Button's relative co-ords */
RRC rrcShadow; /* Shadow's relative co-ords */
DWORD dwButtonState; /* Button's state */
DRAWITEMSTRUCT FAR * fpdis; /* Pointer to struct for */
/* drawing the button */
WORD wCenterLoc; /* Location to center the */
/* button's text */
WORD wAccelPos; /* This button's accel pos */
static WORD awAccelPos[] = /* Button Accelerator's position */
{
4, /* Com&puter */
1, /* &Memory */
1, /* &Video */
1, /* &Network */
1, /* &OS Version */
3, /* Mo&use */
7, /* Other &Adapters */
1, /* &Disk Drives */
1, /* &LPT Ports */
1, /* &COM Ports */
3, /* IR&Q Status */
1, /* &TSR Programs */
9 /* Device D&rivers */
};
/* Set the struct pointer */
fpdis = (DRAWITEMSTRUCT FAR *) lParam;
pwndbtn = (PWND_BTN) fpdis->hwndItem;
/* Get the button and shadow sizes */
_fmemcpy (&rrcButton, &(fpdis->rcItem), sizeof (RRC));
_fmemcpy (&rrcShadow, &(fpdis->rcItem), sizeof (RRC));
++(rrcShadow.ryTop);
++(rrcShadow.ryTop);
/* Find the centering location */
wCenterLoc = ((rrcButton.rxRight - rrcButton.rxLeft) / 2) -
(strlen (pwndbtn->szDialog) / 2);
/* Determine if the button is pushed in or not */
dwButtonState = SendMessage (fpdis->hwndItem, BM_GETSTATE, 0, 0L);
if (dwButtonState & 0x0004)
{
/* The button is pressed in */
/* Repaint the shadow area */
FillRrc (fpdis->hwndItem, &rrcShadow, '
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -