mirror of
https://github.com/WindowsNT351/CE-Collections.git
synced 2025-12-27 01:20:25 +08:00
2551
This commit is contained in:
parent
f77f99976a
commit
699f482e80
155
DOS/Loadcepc.exe/DEBUG.C
Normal file
155
DOS/Loadcepc.exe/DEBUG.C
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Functions:
|
||||||
|
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include <windows.h>
|
||||||
|
|
||||||
|
unsigned char __inline READ_PORT_UCHAR(unsigned char *port)
|
||||||
|
{
|
||||||
|
return _inp((unsigned short)port);
|
||||||
|
}
|
||||||
|
|
||||||
|
void __inline WRITE_PORT_UCHAR(unsigned char * port, unsigned char value)
|
||||||
|
{
|
||||||
|
_outp((unsigned short)port, (value));
|
||||||
|
}
|
||||||
|
|
||||||
|
#define LS_TSR_EMPTY 0x40
|
||||||
|
#define LS_THR_EMPTY 0x20
|
||||||
|
#define LS_RX_BREAK 0x10
|
||||||
|
#define LS_RX_FRAMING_ERR 0x08
|
||||||
|
#define LS_RX_PARITY_ERR 0x04
|
||||||
|
#define LS_RX_OVERRUN 0x02
|
||||||
|
#define LS_RX_DATA_READY 0x01
|
||||||
|
|
||||||
|
#define LS_RX_ERRORS ( LS_RX_FRAMING_ERR | LS_RX_PARITY_ERR | LS_RX_OVERRUN )
|
||||||
|
|
||||||
|
#define COM1_BASE 0x03F8
|
||||||
|
#define COM2_BASE 0x02F8
|
||||||
|
|
||||||
|
#define comTxBuffer 0x00
|
||||||
|
#define comRxBuffer 0x00
|
||||||
|
#define comDivisorLow 0x00
|
||||||
|
#define comDivisorHigh 0x01
|
||||||
|
#define comIntEnable 0x01
|
||||||
|
#define comIntId 0x02
|
||||||
|
#define comFIFOControl 0x02
|
||||||
|
#define comLineControl 0x03
|
||||||
|
#define comModemControl 0x04
|
||||||
|
#define comLineStatus 0x05
|
||||||
|
#define comModemStatus 0x06
|
||||||
|
|
||||||
|
#define IoPortBase ( (unsigned char *) COM1_BASE )
|
||||||
|
|
||||||
|
extern struct _ARGUMENTS
|
||||||
|
{
|
||||||
|
unsigned char ucVideoMode;
|
||||||
|
unsigned char ucComPort;
|
||||||
|
unsigned char ucBaudDivisor;
|
||||||
|
unsigned char ucPCIConfigType;
|
||||||
|
} BootArgs;
|
||||||
|
|
||||||
|
// 14400 = 8
|
||||||
|
// 16457 = 7 +/-
|
||||||
|
// 19200 = 6
|
||||||
|
// 23040 = 5
|
||||||
|
// 28800 = 4
|
||||||
|
// 38400 = 3
|
||||||
|
// 57600 = 2
|
||||||
|
// 115200 = 1
|
||||||
|
|
||||||
|
|
||||||
|
void OEMInitDebugSerial(void)
|
||||||
|
{
|
||||||
|
unsigned char ucArgs[3];
|
||||||
|
unsigned int dwSize;
|
||||||
|
|
||||||
|
dwSize = sizeof(ucArgs);
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase+comLineControl, 0x80); // Access Baud Divisor
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase+comDivisorLow, BootArgs.ucBaudDivisor&0x7f); // 19200
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase+comDivisorHigh, 0x00);
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase+comFIFOControl, 0x01); // Enable FIFO if present
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase+comLineControl, 0x03); // 8 bit, no parity
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase+comIntEnable, 0x00); // No interrupts, polled
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase+comModemControl, 0x03); // Assert DTR, RTS
|
||||||
|
}
|
||||||
|
|
||||||
|
void OEMWriteDebugString(unsigned short *str)
|
||||||
|
{
|
||||||
|
while (*str)
|
||||||
|
{
|
||||||
|
while (!(READ_PORT_UCHAR(IoPortBase+comLineStatus) & LS_THR_EMPTY))
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase+comTxBuffer, (unsigned char)*str++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void OEMWriteDebugByte(BYTE ucChar)
|
||||||
|
{
|
||||||
|
while (!(READ_PORT_UCHAR(IoPortBase+comLineStatus) & LS_THR_EMPTY))
|
||||||
|
{
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase+comTxBuffer, ucChar);
|
||||||
|
}
|
||||||
|
|
||||||
|
int iComTotal=0;
|
||||||
|
void OEMReadDebugBytes(unsigned char * ucBuffer, int usReadSize) {
|
||||||
|
int i=0;
|
||||||
|
unsigned char uStat;
|
||||||
|
|
||||||
|
while (usReadSize--) {
|
||||||
|
do {
|
||||||
|
uStat=READ_PORT_UCHAR(IoPortBase+comLineStatus);
|
||||||
|
if (uStat & LS_RX_ERRORS) {
|
||||||
|
while (1)
|
||||||
|
printf("port status error=%xh i=%u\r",uStat,iComTotal);
|
||||||
|
}
|
||||||
|
} while (!(uStat&LS_RX_DATA_READY));
|
||||||
|
ucBuffer[i++]=READ_PORT_UCHAR(IoPortBase+comRxBuffer);
|
||||||
|
iComTotal++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int OEMReadDebugByte(void)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
OEMReadDebugBytes((unsigned char *)&i,1);
|
||||||
|
return i;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*****************************************************************************
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* @func void | OEMClearDebugComError | Clear a debug communications er
|
||||||
|
or
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
OEMClearDebugCommError(
|
||||||
|
void
|
||||||
|
)
|
||||||
|
{
|
||||||
|
}
|
||||||
45
DOS/Loadcepc.exe/ETHERNET.H
Normal file
45
DOS/Loadcepc.exe/ETHERNET.H
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Functions:
|
||||||
|
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _ETHERNET_H
|
||||||
|
#define _ETHERNET_H 1
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Addressing info struct. We don't ARP for unknown ethernet addresses, so
|
||||||
|
* even the ethernet address must be configured.
|
||||||
|
*/
|
||||||
|
typedef struct _EDBG_ADDR {
|
||||||
|
DWORD dwIP;
|
||||||
|
USHORT wMAC[3];
|
||||||
|
USHORT wPort;
|
||||||
|
|
||||||
|
} EDBG_ADDR;
|
||||||
|
|
||||||
|
|
||||||
|
#define EDBG_SYSINTR_NOINTR 0xFFFFFFFF
|
||||||
|
|
||||||
|
// The following defs can be used for platforms which support multiple adapter types.
|
||||||
|
// Identifiers are provided here for drivers which are built in common\oak\drivers\ethdbg.
|
||||||
|
// Any platform specific adapter types can be identified based off of EDBG_ADAPTER_OEM.
|
||||||
|
#define EDBG_ADAPTER_SMC9000 0
|
||||||
|
#define EDBG_ADAPTER_NE2000 1
|
||||||
|
|
||||||
|
#define EDBG_ADAPTER_OEM 16
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _ETHERNET_H
|
||||||
258
DOS/Loadcepc.exe/ETHMAIN.C
Normal file
258
DOS/Loadcepc.exe/ETHMAIN.C
Normal file
@ -0,0 +1,258 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
Routines for the SMC9000 ethernet controller used for the debug
|
||||||
|
ethernet services. This file has been stripped of all but the
|
||||||
|
detect and functionality
|
||||||
|
|
||||||
|
Functions:
|
||||||
|
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <conio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
|
||||||
|
#include "loadcepc.h"
|
||||||
|
#include "smchw.h"
|
||||||
|
#include "wdm.h"
|
||||||
|
|
||||||
|
#include "ethernet.h"
|
||||||
|
#include "..\inc\bootarg.h"
|
||||||
|
|
||||||
|
BOOT_ARGS BootArgs;
|
||||||
|
|
||||||
|
// The base address for the card
|
||||||
|
static BYTE volatile *pbEthernetBase;
|
||||||
|
#define ReadWord( wOffset ) _inpw((USHORT)(pbEthernetBase + wOffset))
|
||||||
|
#define WriteWord( wOffset, Value ) _outpw((USHORT)(pbEthernetBase + wOffset), (USHORT)Value)
|
||||||
|
|
||||||
|
typedef struct _SMC_CONFIG
|
||||||
|
{
|
||||||
|
BYTE *pbIoBase;
|
||||||
|
USHORT wIRQ;
|
||||||
|
|
||||||
|
} SMC_CONFIG;
|
||||||
|
|
||||||
|
SMC_CONFIG Configs[] =
|
||||||
|
{
|
||||||
|
{ 0x300, 2 },
|
||||||
|
{ 0x320, 10},
|
||||||
|
{ 0x340, 11},
|
||||||
|
{ 0x360, 3}
|
||||||
|
};
|
||||||
|
|
||||||
|
#define NUM_ELEMENTS(a) (sizeof(a)/sizeof(a[0]))
|
||||||
|
#define NUM_SMC_CONFIGS (NUM_ELEMENTS(Configs))
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
SMCDetect(BYTE **ppbBaseAddress, USHORT *pwIrq)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
USHORT BSR;
|
||||||
|
USHORT MyAddr[3];
|
||||||
|
|
||||||
|
for (i=0;i<NUM_SMC_CONFIGS;i++) {
|
||||||
|
*ppbBaseAddress = (BYTE *)pbEthernetBase = Configs[i].pbIoBase;
|
||||||
|
*pwIrq = Configs[i].wIRQ;
|
||||||
|
// The upper byte of the BSR always reads 0x33, use this to verify the I/O base
|
||||||
|
BSR = ReadWord(BANKSEL_REG);
|
||||||
|
if ((BSR & 0xFF00) == 0x3300) {
|
||||||
|
printf("SMCDetect: SMC board found at I/O base 0x%X\n",*ppbBaseAddress);
|
||||||
|
|
||||||
|
// Verify that a valid Ethernet address is loaded
|
||||||
|
WriteWord( BANKSEL_REG, BANK1 );
|
||||||
|
MyAddr[0] = ReadWord( MACADDR_REG0 );
|
||||||
|
MyAddr[1] = ReadWord( MACADDR_REG1 );
|
||||||
|
MyAddr[2] = ReadWord( MACADDR_REG2 );
|
||||||
|
|
||||||
|
if (MyAddr[0] || MyAddr[1] || MyAddr[2]) {
|
||||||
|
printf( "MAC Address:%02X:%02X:%02X:%02X:%02X:%02X\r\n",
|
||||||
|
MyAddr[0] & 0x00FF, MyAddr[0] >> 8,
|
||||||
|
MyAddr[1] & 0x00FF, MyAddr[1] >> 8,
|
||||||
|
MyAddr[2] & 0x00FF, MyAddr[2] >> 8 );
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("SMCDetect: Invalid Ethernet address (check switch settings)\n");
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
printf("SMCDetect: SMC board not found\n");
|
||||||
|
return FALSE;
|
||||||
|
} // SMCDetect
|
||||||
|
|
||||||
|
WORD
|
||||||
|
hex_atoi(char * hexstr)
|
||||||
|
{
|
||||||
|
WORD wRet = 0;
|
||||||
|
while (*hexstr) {
|
||||||
|
wRet <<= 4;
|
||||||
|
switch (*hexstr) {
|
||||||
|
case '1':
|
||||||
|
case '2':
|
||||||
|
case '3':
|
||||||
|
case '4':
|
||||||
|
case '5':
|
||||||
|
case '6':
|
||||||
|
case '7':
|
||||||
|
case '8':
|
||||||
|
case '9':
|
||||||
|
wRet += (WORD)(*hexstr - '0');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'a':
|
||||||
|
case 'b':
|
||||||
|
case 'c':
|
||||||
|
case 'd':
|
||||||
|
case 'e':
|
||||||
|
case 'f':
|
||||||
|
wRet += (WORD)(*hexstr - 'a');
|
||||||
|
wRet += 10;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'A':
|
||||||
|
case 'B':
|
||||||
|
case 'C':
|
||||||
|
case 'D':
|
||||||
|
case 'E':
|
||||||
|
case 'F':
|
||||||
|
wRet += (WORD)(*hexstr - 'A');
|
||||||
|
wRet += 10;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
hexstr++;
|
||||||
|
}
|
||||||
|
return wRet;
|
||||||
|
} // hex_atoi
|
||||||
|
|
||||||
|
|
||||||
|
//
|
||||||
|
// Function to extract the debug ethernet adapter options from the command line
|
||||||
|
//
|
||||||
|
// Expect argstr = "/E:<card>:<io addr>:<irq>:<debug zone mask>"
|
||||||
|
//
|
||||||
|
// Return FALSE for failure
|
||||||
|
//
|
||||||
|
BOOL
|
||||||
|
ParseEthernetOptions(char * argstr)
|
||||||
|
{
|
||||||
|
BOOL bRet;
|
||||||
|
char * begin;
|
||||||
|
char * end;
|
||||||
|
char endch;
|
||||||
|
char CardType;
|
||||||
|
char * card;
|
||||||
|
BYTE *pBase;
|
||||||
|
USHORT wIRQ;
|
||||||
|
int a; // argument counter 0 = CardType, 1 = I/O Base Address, 2 = IRQ
|
||||||
|
|
||||||
|
bRet = FALSE;
|
||||||
|
|
||||||
|
if (strlen(argstr) < 10) { // "/E:1:123:1" at minimum
|
||||||
|
goto peo_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
end = argstr + 2;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Extract the CardType, I/O Base address and IRQ from the command line
|
||||||
|
// (and super secret EDBG debug zone mask)
|
||||||
|
//
|
||||||
|
for (a = 0; a < 4; a++) {
|
||||||
|
begin = end;
|
||||||
|
//
|
||||||
|
// Colon delimited list
|
||||||
|
//
|
||||||
|
if (*begin != ':') {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
begin++; // skip colon
|
||||||
|
end = begin;
|
||||||
|
while ((*end) && (*end != ':')) {
|
||||||
|
end++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (begin == end) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
endch = *end;
|
||||||
|
*end = 0; // temporarily zero terminate the option string
|
||||||
|
|
||||||
|
switch (a) {
|
||||||
|
case 0: // CardType
|
||||||
|
CardType = *begin;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 1: // I/O base address
|
||||||
|
pBase = (BYTE *)hex_atoi(begin);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2: // IRQ
|
||||||
|
wIRQ = hex_atoi(begin);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 3: // EDBG Debug zone mask (defined in oak\inc\ethdbg.h)
|
||||||
|
BootArgs.dwEdbgDebugZone = (DWORD)hex_atoi(begin);
|
||||||
|
BootArgs.dwEdbgDebugZone |= 0x10000;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default: // error!
|
||||||
|
goto peo_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
*end = endch; // un-zero-terminate if need be.
|
||||||
|
}
|
||||||
|
|
||||||
|
if (a < 3) {
|
||||||
|
goto peo_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (CardType) {
|
||||||
|
case '0':
|
||||||
|
// Search for a SMC9000 debug Ethernet card
|
||||||
|
if (SMCDetect(&pBase, &wIRQ))
|
||||||
|
BootArgs.ucEdbgAdapterType = EDBG_ADAPTER_SMC9000;
|
||||||
|
else {
|
||||||
|
printf("Could not detect SMC9000 debug Ethernet card\n");
|
||||||
|
goto peo_exit;
|
||||||
|
}
|
||||||
|
card = "SMC9000";
|
||||||
|
break;
|
||||||
|
|
||||||
|
case '1':
|
||||||
|
BootArgs.ucEdbgAdapterType = EDBG_ADAPTER_NE2000;
|
||||||
|
card = "NE2000";
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
goto peo_exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
BootArgs.ucEdbgIRQ = wIRQ;
|
||||||
|
// WARNING - must mask off high bits
|
||||||
|
BootArgs.dwEdbgBaseAddr = (DWORD)pBase & 0xFFFF;
|
||||||
|
BootArgs.ucLoaderFlags |= LDRFL_USE_EDBG;
|
||||||
|
printf("Debug network card: %s at I/O port 0x%x, IRQ 0x%x\n", card, pBase, wIRQ);
|
||||||
|
bRet = TRUE;
|
||||||
|
|
||||||
|
peo_exit:
|
||||||
|
return bRet;
|
||||||
|
} // ParseEthernetOptions
|
||||||
45
DOS/Loadcepc.exe/HALETHER.H
Normal file
45
DOS/Loadcepc.exe/HALETHER.H
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Functions:
|
||||||
|
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _ETHERNET_H
|
||||||
|
#define _ETHERNET_H 1
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Addressing info struct. We don't ARP for unknown ethernet addresses, so
|
||||||
|
* even the ethernet address must be configured.
|
||||||
|
*/
|
||||||
|
typedef struct _EDBG_ADDR {
|
||||||
|
DWORD dwIP;
|
||||||
|
USHORT wMAC[3];
|
||||||
|
USHORT wPort;
|
||||||
|
|
||||||
|
} EDBG_ADDR;
|
||||||
|
|
||||||
|
|
||||||
|
#define EDBG_SYSINTR_NOINTR 0xFFFFFFFF
|
||||||
|
|
||||||
|
// The following defs can be used for platforms which support multiple adapter types.
|
||||||
|
// Identifiers are provided here for drivers which are built in common\oak\drivers\ethdbg.
|
||||||
|
// Any platform specific adapter types can be identified based off of EDBG_ADAPTER_OEM.
|
||||||
|
#define EDBG_ADAPTER_SMC9000 0
|
||||||
|
#define EDBG_ADAPTER_NE2000 1
|
||||||
|
|
||||||
|
#define EDBG_ADAPTER_OEM 16
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _ETHERNET_H
|
||||||
18
DOS/Loadcepc.exe/KERNEL.H
Normal file
18
DOS/Loadcepc.exe/KERNEL.H
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#include "windows.h"
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define LOCKFLAG_WRITE 1
|
||||||
|
|
||||||
|
#define int long
|
||||||
|
|
||||||
|
#define ZONE_DEBUG 1
|
||||||
|
|
||||||
|
#define DEBUGMSG(a, b) printf b
|
||||||
|
|
||||||
|
int OEMParallelPortGetByte(void);
|
||||||
|
VOID OEMParallelPortSendByte(BYTE chData);
|
||||||
|
|
||||||
|
#define LockPages(a, b, c, d)
|
||||||
|
#define UnlockPages(a, b)
|
||||||
|
|
||||||
|
#define KUnicodeToAscii(a, b, c) strncpy(a, b, c)
|
||||||
18
DOS/Loadcepc.exe/LOADCEPC.H
Normal file
18
DOS/Loadcepc.exe/LOADCEPC.H
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
#define TRUE 1
|
||||||
|
#define FALSE 0
|
||||||
|
|
||||||
|
typedef int BOOL;
|
||||||
|
|
||||||
|
typedef unsigned char BYTE, *LPBYTE, UCHAR, *PUCHAR;
|
||||||
|
typedef unsigned int USHORT, *PUSHORT;
|
||||||
|
typedef unsigned long ULONG, *PULONG;
|
||||||
|
|
||||||
|
typedef unsigned short WORD, *PWORD;
|
||||||
|
typedef unsigned long DWORD, *PDWORD;
|
||||||
|
|
||||||
|
typedef signed char INT8;
|
||||||
|
typedef unsigned char UINT8;
|
||||||
|
typedef signed short INT16;
|
||||||
|
typedef unsigned short UINT16;
|
||||||
|
typedef signed int INT32;
|
||||||
|
typedef unsigned int UINT32;
|
||||||
132
DOS/Loadcepc.exe/LOADCEPC.MAK
Normal file
132
DOS/Loadcepc.exe/LOADCEPC.MAK
Normal file
@ -0,0 +1,132 @@
|
|||||||
|
# Microsoft Visual C++ generated build script - Do not modify
|
||||||
|
|
||||||
|
PROJ = LOADCEPC
|
||||||
|
DEBUG = 0
|
||||||
|
PROGTYPE = 6
|
||||||
|
CALLER =
|
||||||
|
ARGS =
|
||||||
|
DLLS =
|
||||||
|
D_RCDEFINES = -d_DEBUG
|
||||||
|
R_RCDEFINES = -dNDEBUG
|
||||||
|
ORIGIN = MSVC
|
||||||
|
ORIGIN_VER = 1.00
|
||||||
|
PROJPATH = d:\WINCE\PLATFORM\CEPC\LOADCEPC\
|
||||||
|
USEMFC = 0
|
||||||
|
CC = cl
|
||||||
|
CPP = cl
|
||||||
|
CXX = cl
|
||||||
|
CCREATEPCHFLAG =
|
||||||
|
CPPCREATEPCHFLAG =
|
||||||
|
CUSEPCHFLAG =
|
||||||
|
CPPUSEPCHFLAG =
|
||||||
|
FIRSTC = MAIN.C
|
||||||
|
FIRSTCPP =
|
||||||
|
RC = rc
|
||||||
|
CFLAGS_D_DEXE = /I . /nologo /G2 /W4 /Z7 /Od /D "_DEBUG" /D "_DOS" /Fc /FR
|
||||||
|
CFLAGS_R_DEXE = /I . /nologo /Gs /G2 /W4 /Z7 /Ox /D "NDEBUG" /D "_DOS" /Fc /FR
|
||||||
|
LFLAGS_D_DEXE = /NOLOGO /NOI /STACK:5120 /ONERROR:NOEXE /CO /MAP /LINE
|
||||||
|
LFLAGS_R_DEXE = /NOLOGO /NOI /STACK:5120 /ONERROR:NOEXE /CO /MAP /LINE
|
||||||
|
LIBS_D_DEXE = slibce oldnames
|
||||||
|
LIBS_R_DEXE = slibce oldnames
|
||||||
|
RCFLAGS = /nologo
|
||||||
|
RESFLAGS = /nologo
|
||||||
|
RUNFLAGS =
|
||||||
|
OBJS_EXT = TRANSFER.OBJ
|
||||||
|
LIBS_EXT =
|
||||||
|
!if "$(DEBUG)" == "1"
|
||||||
|
CFLAGS = $(CFLAGS_D_DEXE)
|
||||||
|
LFLAGS = $(LFLAGS_D_DEXE)
|
||||||
|
LIBS = $(LIBS_D_DEXE)
|
||||||
|
MAPFILE = nul
|
||||||
|
RCDEFINES = $(D_RCDEFINES)
|
||||||
|
!else
|
||||||
|
CFLAGS = $(CFLAGS_R_DEXE)
|
||||||
|
LFLAGS = $(LFLAGS_R_DEXE)
|
||||||
|
LIBS = $(LIBS_R_DEXE)
|
||||||
|
MAPFILE = nul
|
||||||
|
RCDEFINES = $(R_RCDEFINES)
|
||||||
|
!endif
|
||||||
|
!if [if exist MSVC.BND del MSVC.BND]
|
||||||
|
!endif
|
||||||
|
SBRS = MAIN.SBR \
|
||||||
|
XMSAPI.SBR \
|
||||||
|
VIDEO.SBR \
|
||||||
|
PPFS.SBR
|
||||||
|
|
||||||
|
|
||||||
|
TRANSFER_DEP =
|
||||||
|
|
||||||
|
MAIN_DEP = d:\wince\platform\cepc\loadcepc\loadcepc.h \
|
||||||
|
d:\wince\platform\cepc\loadcepc\xmsapi.h
|
||||||
|
|
||||||
|
XMSAPI_DEP = d:\wince\platform\cepc\loadcepc\xmsapi.h
|
||||||
|
|
||||||
|
|
||||||
|
VIDEO_DEP = d:\wince\platform\cepc\loadcepc\loadcepc.h \
|
||||||
|
d:\wince\platform\cepc\loadcepc\video.h
|
||||||
|
|
||||||
|
MDPPFS_DEP = d:\wince\platform\cepc\ppfstool\wdm.h \
|
||||||
|
d:\wince\platform\cepc\ppfstool\pc.h
|
||||||
|
|
||||||
|
|
||||||
|
PPFS_DEP = d:\wince\platform\cepc\ppfstool\kernel.h
|
||||||
|
|
||||||
|
|
||||||
|
PPFSTOOL_DEP = d:\wince\platform\cepc\ppfstool\ppfs.h
|
||||||
|
|
||||||
|
ETHMAIN_DEP = d:\wince\platform\cepc\loadcepc\loadcepc.h \
|
||||||
|
d:\wince\platform\cepc\loadcepc\smchw.h
|
||||||
|
|
||||||
|
all: $(PROJ).EXE $(PROJ).BSC
|
||||||
|
|
||||||
|
MAIN.OBJ: MAIN.C $(MAIN_DEP)
|
||||||
|
$(CC) $(CFLAGS) $(CCREATEPCHFLAG) /c MAIN.C
|
||||||
|
|
||||||
|
XMSAPI.OBJ: XMSAPI.C $(XMSAPI_DEP)
|
||||||
|
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c XMSAPI.C
|
||||||
|
|
||||||
|
VIDEO.OBJ: VIDEO.C $(VIDEO_DEP)
|
||||||
|
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c VIDEO.C
|
||||||
|
|
||||||
|
MDPPFS.OBJ: MDPPFS.C $(MDPPFS_DEP)
|
||||||
|
$(CC) $(CFLAGS) $(CCREATEPCHFLAG) /c MDPPFS.C
|
||||||
|
|
||||||
|
PPFS.OBJ: PPFS.C $(PPFS_DEP)
|
||||||
|
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c PPFS.C
|
||||||
|
|
||||||
|
DEBUG.OBJ: DEBUG.C $(PPFS_DEP)
|
||||||
|
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c DEBUG.C
|
||||||
|
|
||||||
|
PPFSTOOL.OBJ: PPFSTOOL.C $(PPFSTOOL_DEP)
|
||||||
|
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c PPFSTOOL.C
|
||||||
|
|
||||||
|
ETHMAIN.OBJ: ETHMAIN.C $(ETHMAIN_DEP)
|
||||||
|
$(CC) $(CFLAGS) $(CUSEPCHFLAG) /c ETHMAIN.C
|
||||||
|
|
||||||
|
$(PROJ).EXE:: MAIN.OBJ XMSAPI.OBJ VIDEO.OBJ MDPPFS.OBJ DEBUG.OBJ PPFS.OBJ PPFSTOOL.OBJ ETHMAIN.OBJ $(OBJS_EXT) $(DEFFILE)
|
||||||
|
echo >NUL @<<$(PROJ).CRF
|
||||||
|
MAIN.OBJ +
|
||||||
|
XMSAPI.OBJ +
|
||||||
|
VIDEO.OBJ +
|
||||||
|
MDPPFS.OBJ +
|
||||||
|
PPFS.OBJ +
|
||||||
|
PPFSTOOL.OBJ +
|
||||||
|
ETHMAIN.OBJ +
|
||||||
|
DEBUG.OBJ +
|
||||||
|
$(OBJS_EXT)
|
||||||
|
$(PROJ).EXE
|
||||||
|
$(MAPFILE)
|
||||||
|
c:\msvc\lib\+
|
||||||
|
$(LIBS)
|
||||||
|
$(DEFFILE);
|
||||||
|
<<
|
||||||
|
link $(LFLAGS) @$(PROJ).CRF
|
||||||
|
|
||||||
|
run: $(PROJ).EXE
|
||||||
|
$(PROJ) $(RUNFLAGS)
|
||||||
|
|
||||||
|
|
||||||
|
$(PROJ).BSc: $(SBRS)
|
||||||
|
bscmake @<<
|
||||||
|
/o$@ $(SBRS)
|
||||||
|
<<
|
||||||
11
DOS/Loadcepc.exe/LOADNKPC.H
Normal file
11
DOS/Loadcepc.exe/LOADNKPC.H
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
#define TRUE 1
|
||||||
|
#define FALSE 0
|
||||||
|
|
||||||
|
typedef int BOOL;
|
||||||
|
|
||||||
|
typedef unsigned char UCHAR, *PUCHAR;
|
||||||
|
typedef unsigned int USHORT, *PUSHORT;
|
||||||
|
typedef unsigned long ULONG, *PULONG;
|
||||||
|
|
||||||
|
typedef unsigned short WORD, *PWORD;
|
||||||
|
typedef unsigned long DWORD, *PDWORD;
|
||||||
976
DOS/Loadcepc.exe/MAIN.C
Normal file
976
DOS/Loadcepc.exe/MAIN.C
Normal file
@ -0,0 +1,976 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Functions:
|
||||||
|
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include <conio.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#include "loadcepc.h"
|
||||||
|
#include "xmsapi.h"
|
||||||
|
#include "ethernet.h"
|
||||||
|
#include "..\inc\bootarg.h"
|
||||||
|
|
||||||
|
#pragma warning(disable: 4001)
|
||||||
|
|
||||||
|
#define CHUNKSIZE 32768
|
||||||
|
#define COPY_FLAG_UPDATE_EXISTING 0x0001
|
||||||
|
#define COPY_FLAG_UPDATE_OR_ADD 0x0002
|
||||||
|
|
||||||
|
int LoadImage(BOOL bVerbose, BOOL bParallelDownload, char *pszFileName, PULONG pulEntryAddress);
|
||||||
|
|
||||||
|
int ExecuteImage(BOOL bVerbose, ULONG ulEntryPoint);
|
||||||
|
|
||||||
|
void Launch(ULONG ulEntryPoint, ULONG ulArguments);
|
||||||
|
|
||||||
|
UCHAR SetVideoMode(UCHAR iDesiredMode);
|
||||||
|
|
||||||
|
UCHAR GetPCIConfigMechanism();
|
||||||
|
BOOL ParseEthernetOptions(char * argstr);
|
||||||
|
|
||||||
|
extern int NoPPFS; // parallel port not present flag
|
||||||
|
int OEMParallelPortGetByte(void);
|
||||||
|
void OEMParallelPortSendByte(UCHAR chData);
|
||||||
|
void OEMParallelPortInit(void);
|
||||||
|
void DisplayDirectory(char *pszPath);
|
||||||
|
void GetFile(char *pszSource, char *pszDestination, USHORT usCopyFlags);
|
||||||
|
|
||||||
|
BOOL SMCDetect(BYTE **ppbBaseAddress, USHORT *pwIrq);
|
||||||
|
|
||||||
|
const unsigned char BootHeader[] = {
|
||||||
|
0xAA, // header = 4 bytes
|
||||||
|
0x55,
|
||||||
|
0x55,
|
||||||
|
0xAA,
|
||||||
|
0x00, // opcode = 2 bytes (0 = BOOT)
|
||||||
|
0x00,
|
||||||
|
};
|
||||||
|
#define BOOT_HEADER_SIZE (sizeof(BootHeader) / sizeof(BootHeader[0]))
|
||||||
|
|
||||||
|
const unsigned char BootTail[] = {
|
||||||
|
0x5A, // trail = 4 bytes
|
||||||
|
0xA5,
|
||||||
|
0x0A,
|
||||||
|
0x1A
|
||||||
|
};
|
||||||
|
#define BOOT_TAIL_SIZE (sizeof(BootTail) / sizeof(BootTail[0]))
|
||||||
|
|
||||||
|
#define BOOT_TYPE -4 // boot type for x86
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
ULONG ulRate;
|
||||||
|
UCHAR ucDivisor;
|
||||||
|
} BaudTable[] =
|
||||||
|
{
|
||||||
|
{ 9600, 12 },
|
||||||
|
{ 19200, 6 },
|
||||||
|
{ 38400, 3 },
|
||||||
|
{ 57600, 2 },
|
||||||
|
{ 115200, 1 }
|
||||||
|
};
|
||||||
|
|
||||||
|
#define NUM_BAUD_RATES (sizeof(BaudTable) / sizeof(BaudTable[0]))
|
||||||
|
|
||||||
|
BOOT_ARGS BootArgs;
|
||||||
|
|
||||||
|
BOOL bSerialDownload=FALSE;
|
||||||
|
extern int OEMReadDebugByte(void);
|
||||||
|
extern void OEMReadDebugBytes(unsigned char * ucBuffer, int usReadSize);
|
||||||
|
extern void OEMWriteDebugByte(unsigned char ch);
|
||||||
|
|
||||||
|
void
|
||||||
|
usage(char *pszProgramNameArg)
|
||||||
|
{
|
||||||
|
char * pszProgram;
|
||||||
|
|
||||||
|
pszProgram = strrchr(pszProgramNameArg, '\\');
|
||||||
|
|
||||||
|
if (pszProgram != NULL)
|
||||||
|
{
|
||||||
|
pszProgram++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pszProgram = pszProgramNameArg;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"%s: Loads an NK ROM image into memory and boots it\n\n"
|
||||||
|
"Usage:%s [/B:baud] [/C:port] [/D:display] [/E:Card:IO:IRQ] [/P] [/Q]\n"
|
||||||
|
"\t\t[/H] [/V] [<file name>]\n\n"
|
||||||
|
"\t/B\tBaudrate - 9600, 19200, 38400, 57600, or 115200 (default 19200)\n"
|
||||||
|
"\t/C\tCOM Port - 1 = COM1, 2 = COM2 (default COM1)\n"
|
||||||
|
"\t/D\tDisplay Resolution - 0 = 320x200 (default), 1 = 480x240x256,\n"
|
||||||
|
"\t\t\t2 = 640x480x256, 3 = 800x600x256, 4 = 1024x768x256\n"
|
||||||
|
"\t\t\t5 = 240x320x256 \n"
|
||||||
|
"\t/P\tParallel port boot download.\n"
|
||||||
|
"\t/Q\tSerial port boot download.\n"
|
||||||
|
"\t/E:Card:IO:IRQ\tCard 0 = SMC9000, 1 = NE2000 (For Debug Ethernet)\n"
|
||||||
|
"\t\t\t(Other debug ethernet options in hex digits)\n"
|
||||||
|
"\t/H\tHelp - displays this message\n"
|
||||||
|
"\t/V\tVerbose - displays extra status information during boot\n"
|
||||||
|
"\n\tDefault <file name> is NK.BIN except for /P option which uses\n"
|
||||||
|
"\tdefault on host unless <file name> specified.\n"
|
||||||
|
"\nPress any key for more options...\n",
|
||||||
|
pszProgram, pszProgram);
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push dx
|
||||||
|
xor ax,ax
|
||||||
|
int 0x16
|
||||||
|
pop dx
|
||||||
|
}
|
||||||
|
printf(
|
||||||
|
"usage: %s -s[:]<pattern> -(g|r|u)[[:]<pattern> [<destination>]\n"
|
||||||
|
"-s Show a directory of files matching <pattern>.\n\n"
|
||||||
|
"-g Get files matching <pattern> and copy them to the\n"
|
||||||
|
" optionally specified <destination>. Any existing file with\n"
|
||||||
|
" the same name will be overwritten.\n\n"
|
||||||
|
"-r Refresh files matching <pattern> which already exist in <destination>\n"
|
||||||
|
" and have a timestamp newer than the one in <destination>.\n\n"
|
||||||
|
"-u Update files matching <pattern> which don't already exist in\n"
|
||||||
|
" <destination> or those that have a timestamp newer than those\n"
|
||||||
|
" in <destination>.\n\n"
|
||||||
|
"<pattern> Windows filename path with optional wildcard characters.\n\n"
|
||||||
|
"<destination> If not specified then the current directory is the\n"
|
||||||
|
" default.\n"
|
||||||
|
" If specified and it doesn't exist and the last character is \\,\n"
|
||||||
|
" then the directory is created. Otherwise <destination> is\n"
|
||||||
|
" treated as the name of the file.\n"
|
||||||
|
" It is an error for <pattern> to match multiple files\n"
|
||||||
|
" when <destination> specifies a file.\n",
|
||||||
|
pszProgram);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main(int argc, char **argv)
|
||||||
|
{
|
||||||
|
|
||||||
|
char * pszFileName = "nk.bin";
|
||||||
|
ULONG ulEntryPoint;
|
||||||
|
ULONG ulArguments;
|
||||||
|
int xmsError;
|
||||||
|
BOOL bEnabled;
|
||||||
|
BOOL bVerbose = FALSE;
|
||||||
|
BOOL bParallelDownload=FALSE;
|
||||||
|
int iDesiredMode = 0;
|
||||||
|
ULONG ulBaudRate;
|
||||||
|
char cOption;
|
||||||
|
int i;
|
||||||
|
int iPpfstool=0;
|
||||||
|
|
||||||
|
|
||||||
|
/* Set up boot args struct */
|
||||||
|
BootArgs.ucVideoMode = 0;
|
||||||
|
BootArgs.ucComPort = 1;
|
||||||
|
BootArgs.ucBaudDivisor = 6;
|
||||||
|
BootArgs.ucPCIConfigType = 0;
|
||||||
|
|
||||||
|
BootArgs.dwSig = BOOTARG_SIG;
|
||||||
|
BootArgs.dwLen = sizeof(BOOT_ARGS);
|
||||||
|
|
||||||
|
OEMParallelPortInit(); // initialize parallel port
|
||||||
|
/*
|
||||||
|
** Parse arguments
|
||||||
|
*/
|
||||||
|
|
||||||
|
if (argc > 1)
|
||||||
|
{
|
||||||
|
int iArgIndex;
|
||||||
|
|
||||||
|
for (iArgIndex = 1; iArgIndex < argc; iArgIndex++)
|
||||||
|
{
|
||||||
|
if (argv[iArgIndex][0] != '/' && argv[iArgIndex][0] != '-')
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cOption=tolower(argv[iArgIndex][1]);
|
||||||
|
switch (argv[iArgIndex][1])
|
||||||
|
{
|
||||||
|
case 'b': /* Baud rate */
|
||||||
|
case 'B':
|
||||||
|
if (argv[iArgIndex][2] != ':' ||
|
||||||
|
argv[iArgIndex][3] < '0' || argv[iArgIndex][3] > '9')
|
||||||
|
{
|
||||||
|
printf("Invalid option - %s\n", argv[iArgIndex]);
|
||||||
|
usage(argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulBaudRate = atol(&argv[iArgIndex][3]);
|
||||||
|
|
||||||
|
for (i = 0; i < NUM_BAUD_RATES; i++)
|
||||||
|
{
|
||||||
|
if (BaudTable[i].ulRate == ulBaudRate)
|
||||||
|
{
|
||||||
|
BootArgs.ucBaudDivisor = BaudTable[i].ucDivisor;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i >= NUM_BAUD_RATES)
|
||||||
|
{
|
||||||
|
printf("Unsupported baud rate - %s\n", argv[iArgIndex]);
|
||||||
|
usage(argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'c': /* COM port */
|
||||||
|
case 'C':
|
||||||
|
if (argv[iArgIndex][2] != ':' ||
|
||||||
|
(argv[iArgIndex][3] != '1' && argv[iArgIndex][3] != '2' &&
|
||||||
|
argv[iArgIndex][3] != '3' && argv[iArgIndex][3] != '4'))
|
||||||
|
{
|
||||||
|
printf("Invalid option - %s\n", argv[iArgIndex]);
|
||||||
|
usage(argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
BootArgs.ucComPort = (UCHAR)(argv[iArgIndex][3] - '0');
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'd': /* Display mode */
|
||||||
|
case 'D':
|
||||||
|
if (argv[iArgIndex][2] != ':' ||
|
||||||
|
argv[iArgIndex][3] < '0' || argv[iArgIndex][3] > '5')
|
||||||
|
{
|
||||||
|
printf("Invalid option - %s\n", argv[iArgIndex]);
|
||||||
|
usage(argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
iDesiredMode = argv[iArgIndex][3] - '0';
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'p': /* Parallel port boot download */
|
||||||
|
case 'P':
|
||||||
|
bParallelDownload=TRUE;
|
||||||
|
pszFileName= NULL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'q': /* Serial port boot download */
|
||||||
|
case 'Q':
|
||||||
|
bSerialDownload=TRUE;
|
||||||
|
pszFileName= NULL;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'v':
|
||||||
|
case 'V':
|
||||||
|
bVerbose = TRUE;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'S':
|
||||||
|
case 's':
|
||||||
|
{
|
||||||
|
char *pszPath;
|
||||||
|
iPpfstool=1;
|
||||||
|
if (argv[iArgIndex][2] != '\0')
|
||||||
|
{
|
||||||
|
pszPath = &argv[iArgIndex][2];
|
||||||
|
if (*pszPath == ':')
|
||||||
|
{
|
||||||
|
pszPath++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (argc > (i+1) && argv[iArgIndex+1][0] != '-' && argv[iArgIndex+1][0] != '/')
|
||||||
|
{
|
||||||
|
pszPath = argv[iArgIndex+1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pszPath = "*.*";
|
||||||
|
}
|
||||||
|
DisplayDirectory(pszPath);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'E':
|
||||||
|
case 'e':
|
||||||
|
if (!ParseEthernetOptions(argv[iArgIndex])) {
|
||||||
|
printf("Invalid option - %s\n", argv[iArgIndex]);
|
||||||
|
usage(argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'G':
|
||||||
|
case 'R':
|
||||||
|
case 'U':
|
||||||
|
case 'g':
|
||||||
|
case 'r':
|
||||||
|
case 'u':
|
||||||
|
{
|
||||||
|
char *pszSource;
|
||||||
|
char *pszDestination;
|
||||||
|
|
||||||
|
iPpfstool=1;
|
||||||
|
if (argv[iArgIndex][2] != '\0')
|
||||||
|
{
|
||||||
|
pszSource = &argv[iArgIndex][2];
|
||||||
|
if (*pszSource == ':')
|
||||||
|
{
|
||||||
|
pszSource++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (argc > (iArgIndex+1) && argv[iArgIndex+1][0] != '-' && argv[iArgIndex+1][0] != '/')
|
||||||
|
{
|
||||||
|
pszSource = argv[iArgIndex+1];
|
||||||
|
iArgIndex++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Error source path missing\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc > (iArgIndex+1) && argv[iArgIndex+1][0] != '-' && argv[iArgIndex+1][0] != '/')
|
||||||
|
{
|
||||||
|
pszDestination = argv[iArgIndex+1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pszDestination = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetFile(
|
||||||
|
pszSource, pszDestination,
|
||||||
|
cOption == 'r' ? COPY_FLAG_UPDATE_EXISTING :
|
||||||
|
cOption == 'u' ? COPY_FLAG_UPDATE_OR_ADD :
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf("Unrecognized option - %s\n", argv[iArgIndex]);
|
||||||
|
/* FALL THROUGH */
|
||||||
|
|
||||||
|
case '?':
|
||||||
|
case 'h':
|
||||||
|
case 'H':
|
||||||
|
usage(argv[0]);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iArgIndex == (argc - 1))
|
||||||
|
{
|
||||||
|
pszFileName = argv[iArgIndex];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (iPpfstool)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
if (!XmsIsInstalled())
|
||||||
|
{
|
||||||
|
printf("HIMEM.SYS must be loaded\n");
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bVerbose)
|
||||||
|
{
|
||||||
|
if ((xmsError = XmsQueryA20(&bEnabled)) != XMS_SUCCESS)
|
||||||
|
{
|
||||||
|
printf("Error querying A20 status - %s\n", XmsErrorString(xmsError));
|
||||||
|
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bEnabled)
|
||||||
|
{
|
||||||
|
printf("Warning A20 line already enabled\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Check if PCI Bios is available, if so find out config mechanism
|
||||||
|
*/
|
||||||
|
|
||||||
|
BootArgs.ucPCIConfigType = GetPCIConfigMechanism();
|
||||||
|
|
||||||
|
if (!LoadImage(bVerbose, bParallelDownload, pszFileName, &ulEntryPoint))
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Enable A20 line
|
||||||
|
*/
|
||||||
|
|
||||||
|
if ((xmsError = XmsLocalEnableA20()) != XMS_SUCCESS)
|
||||||
|
{
|
||||||
|
printf("Can't enable A20 line, error = 0x%4.4X\n", xmsError);
|
||||||
|
|
||||||
|
return 5;
|
||||||
|
}
|
||||||
|
|
||||||
|
BootArgs.ucVideoMode = SetVideoMode(iDesiredMode);
|
||||||
|
|
||||||
|
if (bSerialDownload)
|
||||||
|
BootArgs.ucBaudDivisor|=0x80;
|
||||||
|
|
||||||
|
if (bVerbose)
|
||||||
|
{
|
||||||
|
printf("Jumping to 0x%8.8lX\n", ulEntryPoint);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Convert arguments to linear addres
|
||||||
|
*/
|
||||||
|
|
||||||
|
ulArguments = (((ULONG)(void far *)&BootArgs) >> 16) << 4;
|
||||||
|
ulArguments += ((ULONG)(void far *)&BootArgs) & 0xFFFF;
|
||||||
|
|
||||||
|
Launch(ulEntryPoint, ulArguments);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Launch shouldn't have returned
|
||||||
|
*/
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
USHORT DownloadRead(int hImage, UCHAR* ucBuffer, USHORT usReadSize, BOOL bParallelDownload) {
|
||||||
|
int loop, loop2;
|
||||||
|
|
||||||
|
if (bParallelDownload) {
|
||||||
|
for (loop = 0; loop < usReadSize; loop++ ) {
|
||||||
|
ucBuffer[loop]= (UCHAR)OEMParallelPortGetByte();
|
||||||
|
if (NoPPFS)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return usReadSize;
|
||||||
|
} else if (bSerialDownload) {
|
||||||
|
OEMReadDebugBytes(ucBuffer,usReadSize);
|
||||||
|
return usReadSize;
|
||||||
|
} else
|
||||||
|
return _read(hImage, ucBuffer, usReadSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
LoadImage(BOOL bVerbose, BOOL bParallelDownload, char *pszFileName, PULONG pulEntryPoint)
|
||||||
|
{
|
||||||
|
int hImage;
|
||||||
|
long lImageSize;
|
||||||
|
|
||||||
|
int xmsError;
|
||||||
|
|
||||||
|
USHORT usTotalFree;
|
||||||
|
USHORT usLargestBlock;
|
||||||
|
USHORT usBlockHandle;
|
||||||
|
|
||||||
|
ULONG ulLinearAddress;
|
||||||
|
|
||||||
|
ULONG ulSectionAddress;
|
||||||
|
ULONG ulSectionSize;
|
||||||
|
ULONG ulSectionChecksum;
|
||||||
|
|
||||||
|
ULONG ulSectionOffset;
|
||||||
|
ULONG ulChecksum;
|
||||||
|
|
||||||
|
USHORT usReadSize;
|
||||||
|
USHORT usAmountRead;
|
||||||
|
ULONG ulReadTotal=0;
|
||||||
|
ULONG ulReadProgress=0;
|
||||||
|
|
||||||
|
USHORT usIndex;
|
||||||
|
|
||||||
|
static UCHAR ucBuffer[ CHUNKSIZE ];
|
||||||
|
|
||||||
|
static UCHAR ucSignature[] = { 'B', '0', '0', '0', 'F', 'F', '\n' };
|
||||||
|
int i;
|
||||||
|
UCHAR BootPacket[256];
|
||||||
|
UCHAR *pDestByte;
|
||||||
|
UCHAR *pTemp;
|
||||||
|
unsigned int chksum;
|
||||||
|
long int uiTemp;
|
||||||
|
long int bootType;
|
||||||
|
unsigned len;
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Stop the floppy motor in case it contained the image file
|
||||||
|
*/
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push dx
|
||||||
|
mov dx, 03F2h ; Floppy motor and DMA control
|
||||||
|
in al, dx
|
||||||
|
and al, 00Fh ; Clear motor on bits
|
||||||
|
out dx, al
|
||||||
|
pop dx
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
** Find the largest Extended Memory block and allocate it
|
||||||
|
*/
|
||||||
|
|
||||||
|
xmsError = XmsQueryFreeExtendedMemory(&usLargestBlock, &usTotalFree);
|
||||||
|
|
||||||
|
if (xmsError != XMS_SUCCESS)
|
||||||
|
{
|
||||||
|
printf("Error querying free extended memory - %s\n", XmsErrorString(xmsError));
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bVerbose)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
** Print info about memory available
|
||||||
|
*/
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"Total free extended memory = %u, largest block = %u\n",
|
||||||
|
usTotalFree, usLargestBlock);
|
||||||
|
}
|
||||||
|
|
||||||
|
xmsError = XmsAllocateExtendedMemory(usLargestBlock, &usBlockHandle);
|
||||||
|
|
||||||
|
if (xmsError != XMS_SUCCESS)
|
||||||
|
{
|
||||||
|
printf("Error allocating extended memory - %s\n", XmsErrorString(xmsError));
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Lock the block and obtain its linear address. Then ensure that the
|
||||||
|
** image fits into it.
|
||||||
|
*/
|
||||||
|
|
||||||
|
xmsError = XmsLockExtendedMemory(usBlockHandle, &ulLinearAddress);
|
||||||
|
|
||||||
|
if (xmsError != XMS_SUCCESS)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
printf("Error locking extended memory - %s\n", XmsErrorString(xmsError));
|
||||||
|
|
||||||
|
XmsFreeExtendedMemory(usBlockHandle);
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bVerbose)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
** Print info about block allocated
|
||||||
|
*/
|
||||||
|
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
printf("Block allocated at 0x%lX\n", ulLinearAddress);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Zero upper memory in CHUNKSIZE chunks
|
||||||
|
*/
|
||||||
|
|
||||||
|
memset(ucBuffer, 0, sizeof(ucBuffer));
|
||||||
|
ulSectionSize = (ULONG)usLargestBlock * 1024;
|
||||||
|
#if 1
|
||||||
|
for (ulSectionOffset = 0; ulSectionOffset < ulSectionSize; ulSectionOffset += usReadSize)
|
||||||
|
{
|
||||||
|
if ((ulSectionSize - ulSectionOffset) < CHUNKSIZE)
|
||||||
|
{
|
||||||
|
usReadSize = (USHORT)(ulSectionSize - ulSectionOffset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
usReadSize = CHUNKSIZE;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmsError = XmsMoveExtendedMemory(
|
||||||
|
0, (ULONG)(UCHAR far *)ucBuffer,
|
||||||
|
usBlockHandle, ulSectionOffset, usReadSize);
|
||||||
|
|
||||||
|
if (xmsError != XMS_SUCCESS)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
printf("Error zeroing extended memory - %s\n", XmsErrorString(xmsError));
|
||||||
|
|
||||||
|
XmsUnlockExtendedMemory(usBlockHandle);
|
||||||
|
|
||||||
|
XmsFreeExtendedMemory(usBlockHandle);
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Open image file
|
||||||
|
*/
|
||||||
|
if (bSerialDownload)
|
||||||
|
OEMInitDebugSerial();
|
||||||
|
if (bParallelDownload || bSerialDownload) {
|
||||||
|
//
|
||||||
|
// Prepare boot packet
|
||||||
|
//
|
||||||
|
pDestByte = BootPacket;
|
||||||
|
for (i = 0; i < BOOT_HEADER_SIZE; i++) {
|
||||||
|
*pDestByte++ = BootHeader[i];
|
||||||
|
}
|
||||||
|
|
||||||
|
chksum = 0;
|
||||||
|
len = 9;
|
||||||
|
|
||||||
|
if (pszFileName) {
|
||||||
|
if (bSerialDownload)
|
||||||
|
printf("Loading image %s via serial port.\r\n",pszFileName);
|
||||||
|
else
|
||||||
|
printf("Loading image %s via parallel port.\r\n",pszFileName);
|
||||||
|
bootType = 1; // The NULL byte
|
||||||
|
for (pTemp = pszFileName; *pTemp; pTemp++) {
|
||||||
|
bootType++;
|
||||||
|
}
|
||||||
|
|
||||||
|
len += bootType;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
if (bSerialDownload)
|
||||||
|
printf("Loading host default image via serial port.\r\n");
|
||||||
|
else
|
||||||
|
printf("Loading host default image via parallel port.\r\n");
|
||||||
|
bootType = BOOT_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
uiTemp = len;
|
||||||
|
for (i = 0; i < 2; i++) {
|
||||||
|
*pDestByte++ = (unsigned char)(uiTemp & 0xFF);
|
||||||
|
chksum += (uiTemp & 0xFF);
|
||||||
|
uiTemp >>= 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
uiTemp = bootType;
|
||||||
|
for (i = 0; i < 4; i++) {
|
||||||
|
*pDestByte++ = (unsigned char)(uiTemp & 0xFF);
|
||||||
|
chksum += (uiTemp & 0xFF);
|
||||||
|
uiTemp >>= 8;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bootType > 0) {
|
||||||
|
for (pTemp = pszFileName; *pTemp; pTemp++) {
|
||||||
|
*pDestByte++ = *pTemp;
|
||||||
|
chksum += *pTemp;
|
||||||
|
}
|
||||||
|
*pDestByte++ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pDestByte++ = (unsigned char)((~chksum) & 0xFF);
|
||||||
|
|
||||||
|
for (i = 0; i < BOOT_TAIL_SIZE; i++) {
|
||||||
|
*pDestByte++ = BootTail[i];
|
||||||
|
}
|
||||||
|
if (bVerbose)
|
||||||
|
printf("Sending boot packet: ");
|
||||||
|
usIndex=0;
|
||||||
|
while (&BootPacket[usIndex] < pDestByte) {
|
||||||
|
if (NoPPFS)
|
||||||
|
return FALSE;
|
||||||
|
if (bVerbose)
|
||||||
|
printf("%x ",BootPacket[usIndex]);
|
||||||
|
if (bSerialDownload)
|
||||||
|
OEMWriteDebugByte(BootPacket[usIndex]);
|
||||||
|
else
|
||||||
|
OEMParallelPortSendByte(BootPacket[usIndex]);
|
||||||
|
usIndex++;
|
||||||
|
}
|
||||||
|
if (bVerbose)
|
||||||
|
printf("Sent.\r\n");
|
||||||
|
} else {
|
||||||
|
hImage = _open(pszFileName, _O_BINARY | _O_RDONLY);
|
||||||
|
|
||||||
|
if (hImage == -1)
|
||||||
|
{
|
||||||
|
printf("%s: Error opening file - %s\n", pszFileName, _strerror(NULL));
|
||||||
|
XmsUnlockExtendedMemory(usBlockHandle);
|
||||||
|
XmsFreeExtendedMemory(usBlockHandle);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((lImageSize = _filelength(hImage)) == -1)
|
||||||
|
{
|
||||||
|
printf("%s: Error obtaining file size - %s\n", pszFileName, _strerror(NULL));
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
if (bVerbose)
|
||||||
|
{
|
||||||
|
printf("Loading %s, size = %ld\n", pszFileName, lImageSize);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Read initial signature and physical start and size
|
||||||
|
*/
|
||||||
|
|
||||||
|
usReadSize = sizeof(ucSignature) + 2 * sizeof(ULONG);
|
||||||
|
|
||||||
|
if (DownloadRead(hImage, &ucBuffer, usReadSize, bParallelDownload) != (int)usReadSize)
|
||||||
|
{
|
||||||
|
printf("Error reading signature - %s\n", _strerror(NULL));
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (memcmp(ucBuffer, ucSignature, sizeof(ucSignature)) != 0)
|
||||||
|
{
|
||||||
|
printf("Error invalid signature\nData: ");
|
||||||
|
for (i=0; i<usReadSize; i++)
|
||||||
|
printf("%x ",ucBuffer[i]);
|
||||||
|
printf("\r\n");
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulReadTotal=*(PULONG)&ucBuffer[sizeof(ucSignature) + sizeof(ULONG)];
|
||||||
|
if (bVerbose)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
** Print Physical start and size
|
||||||
|
*/
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"Image physical start = 0x%8.8lX, size = %ld\n",
|
||||||
|
*(PULONG)&ucBuffer[sizeof(ucSignature)],
|
||||||
|
*(PULONG)&ucBuffer[sizeof(ucSignature) + sizeof(ULONG)]);
|
||||||
|
}
|
||||||
|
// Initialize the percent thingie.
|
||||||
|
DrawPercent((DWORD)-1, (DWORD)"");
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Copy file to upper memory in CHUNKSIZE chunks
|
||||||
|
*/
|
||||||
|
|
||||||
|
for ( ; ; )
|
||||||
|
{
|
||||||
|
usAmountRead = DownloadRead(hImage, ucBuffer, 3 * sizeof(ULONG), bParallelDownload);
|
||||||
|
ulReadProgress+=12;
|
||||||
|
if (usAmountRead != 3 * sizeof(ULONG))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
printf("Error reading header - %s\n", XmsErrorString(xmsError));
|
||||||
|
|
||||||
|
XmsUnlockExtendedMemory(usBlockHandle);
|
||||||
|
|
||||||
|
XmsFreeExtendedMemory(usBlockHandle);
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
ulSectionAddress = *(PULONG)&ucBuffer[0];
|
||||||
|
ulSectionSize = *(PULONG)&ucBuffer[4];
|
||||||
|
ulSectionChecksum = *(PULONG)&ucBuffer[8];
|
||||||
|
|
||||||
|
if (ulSectionAddress == 0)
|
||||||
|
{
|
||||||
|
*pulEntryPoint = ulSectionSize;
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (ulSectionAddress < ulLinearAddress ||
|
||||||
|
(ulSectionAddress + ulSectionSize) >
|
||||||
|
(ulLinearAddress + (ULONG)usLargestBlock * 1024))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
printf(
|
||||||
|
"Error image section doesn't fit in allocated block\n"
|
||||||
|
"Block allocated at 0x%lX, size = %ld\n"
|
||||||
|
"Section physical start = 0x%8.8lX, size = %ld\n",
|
||||||
|
ulLinearAddress, (ULONG)usLargestBlock * 1024,
|
||||||
|
ulSectionAddress, ulSectionSize);
|
||||||
|
|
||||||
|
XmsUnlockExtendedMemory(usBlockHandle);
|
||||||
|
|
||||||
|
XmsFreeExtendedMemory(usBlockHandle);
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bVerbose)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
printf(
|
||||||
|
"Section physical start = 0x%8.8lX, size = %ld\n",
|
||||||
|
ulSectionAddress, ulSectionSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
ulChecksum = 0;
|
||||||
|
|
||||||
|
for (ulSectionOffset = 0; ulSectionOffset < ulSectionSize; )
|
||||||
|
{
|
||||||
|
if ((ulSectionSize - ulSectionOffset) < CHUNKSIZE)
|
||||||
|
{
|
||||||
|
usReadSize = (USHORT)(ulSectionSize - ulSectionOffset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
usReadSize = CHUNKSIZE;
|
||||||
|
}
|
||||||
|
usAmountRead = DownloadRead(hImage, ucBuffer, usReadSize,bParallelDownload);
|
||||||
|
|
||||||
|
if (usAmountRead != usReadSize)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
printf("Error reading section - %s\n", XmsErrorString(xmsError));
|
||||||
|
|
||||||
|
XmsUnlockExtendedMemory(usBlockHandle);
|
||||||
|
|
||||||
|
XmsFreeExtendedMemory(usBlockHandle);
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
ulReadProgress+= usReadSize;
|
||||||
|
DrawPercent(ulReadProgress, ulReadTotal);
|
||||||
|
#if 0
|
||||||
|
|
||||||
|
for (usIndex = 0; usIndex < usAmountRead; usIndex++)
|
||||||
|
{
|
||||||
|
ulChecksum += ucBuffer[usIndex];
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#if 1
|
||||||
|
xmsError = XmsMoveExtendedMemory(
|
||||||
|
0, (ULONG)(UCHAR far *)ucBuffer,
|
||||||
|
usBlockHandle, ulSectionAddress - ulLinearAddress + ulSectionOffset,
|
||||||
|
(usAmountRead + 1) & ~1U);
|
||||||
|
|
||||||
|
if (xmsError != XMS_SUCCESS)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
printf("Error moving extended memory - %s\n", XmsErrorString(xmsError));
|
||||||
|
|
||||||
|
XmsUnlockExtendedMemory(usBlockHandle);
|
||||||
|
|
||||||
|
XmsFreeExtendedMemory(usBlockHandle);
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
ulSectionOffset += usAmountRead;
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
if (ulChecksum != ulSectionChecksum)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
printf(
|
||||||
|
"Bad checksum 0x%8.8lX, expected 0x%8.8lX\n",
|
||||||
|
ulChecksum, ulSectionChecksum);
|
||||||
|
|
||||||
|
XmsUnlockExtendedMemory(usBlockHandle);
|
||||||
|
|
||||||
|
XmsFreeExtendedMemory(usBlockHandle);
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
DrawPercent(ulReadTotal, ulReadTotal);
|
||||||
|
if (!bParallelDownload && !bSerialDownload)
|
||||||
|
_close(hImage);
|
||||||
|
|
||||||
|
/*
|
||||||
|
** Stop the floppy motor in case it contained the image file
|
||||||
|
*/
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
push dx
|
||||||
|
mov dx, 03F2h ; Floppy motor and DMA control
|
||||||
|
in al, dx
|
||||||
|
and al, 00Fh ; Clear motor on bits
|
||||||
|
out dx, al
|
||||||
|
pop dx
|
||||||
|
}
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
UCHAR
|
||||||
|
GetPCIConfigMechanism()
|
||||||
|
{
|
||||||
|
UCHAR ucPCIVersionMajor;
|
||||||
|
UCHAR ucPCIVersionMinor;
|
||||||
|
UCHAR ucPCIBus;
|
||||||
|
UCHAR ucPCIConfigMech;
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov ax, 0xB101
|
||||||
|
int 0x1A
|
||||||
|
|
||||||
|
jc noPCI
|
||||||
|
|
||||||
|
cmp dx, 0x4350 ; 'CP'
|
||||||
|
|
||||||
|
jne noPCI
|
||||||
|
|
||||||
|
or ah, ah
|
||||||
|
jnz noPCI
|
||||||
|
|
||||||
|
mov ucPCIVersionMajor, bh
|
||||||
|
mov ucPCIVersionMinor, bl
|
||||||
|
mov ucPCIBus, cl
|
||||||
|
|
||||||
|
and al, 0x03
|
||||||
|
mov ucPCIConfigMech, al
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"%d PCI bus%s (Version %X.%2.2X) using Configuration Mechanism # %d\n",
|
||||||
|
ucPCIBus + 1, ucPCIBus == 0 ? "" : "ses",
|
||||||
|
ucPCIVersionMajor, ucPCIVersionMinor, ucPCIConfigMech);
|
||||||
|
|
||||||
|
return (ucPCIBus << 2) | ucPCIConfigMech;
|
||||||
|
|
||||||
|
noPCI:
|
||||||
|
printf("PCI bus not detected\n");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
488
DOS/Loadcepc.exe/MDPPFS.C
Normal file
488
DOS/Loadcepc.exe/MDPPFS.C
Normal file
@ -0,0 +1,488 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
mdppfs.c
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
This file implements the NK kernel ppfs client side interface
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include "windows.h"
|
||||||
|
#include "wdm.h"
|
||||||
|
#include "pc.h"
|
||||||
|
|
||||||
|
#define PAR_PORT_BASE 0x0378
|
||||||
|
#define PAR_PORT_DATA 0
|
||||||
|
#define PAR_PORT_STAT 1
|
||||||
|
#define PAR_PORT_CTRL 2
|
||||||
|
|
||||||
|
#define PAR_STAT_NBUSY 0x80
|
||||||
|
#define PAR_STAT_NACK 0x40
|
||||||
|
#define PAR_STAT_PE 0x20
|
||||||
|
#define PAR_STAT_SLCT 0x10
|
||||||
|
#define PAR_STAT_NERR 0x08 // This isn't connected
|
||||||
|
|
||||||
|
#define PAR_CTRL_READ 0x20
|
||||||
|
#define PAR_CTRL_IRQE 0x10
|
||||||
|
#define PAR_CTRL_SLCT_IN 0x08
|
||||||
|
#define PAR_CTRL_NINIT 0x04
|
||||||
|
#define PAR_CTRL_AUTOFEED 0x02
|
||||||
|
#define PAR_CTRL_STROBE 0x01
|
||||||
|
|
||||||
|
#define STATUS_IS_DISCONNECTED(a) \
|
||||||
|
((((a) & (PAR_STAT_PE | PAR_STAT_SLCT)) != PAR_STAT_SLCT) || \
|
||||||
|
(((a) & (PAR_STAT_NBUSY | PAR_STAT_NACK)) == PAR_STAT_NACK))
|
||||||
|
|
||||||
|
//#define STATUS_IS_DISCONNECTED(a) (!((a) & PAR_STAT_SLCT))
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
#define LOG_ENTRY_TYPE_MASK 0xFF00
|
||||||
|
#define LOG_ENTRY_DATA_MASK 0x00FF
|
||||||
|
|
||||||
|
#define LOG_ENTRY_READ ((USHORT)('R' << 8))
|
||||||
|
#define LOG_ENTRY_WRITE ((USHORT)('W' << 8))
|
||||||
|
#define LOG_ENTRY_CONTROL ((USHORT)('C' << 8))
|
||||||
|
#define LOG_ENTRY_STATUS ((USHORT)('S' << 8))
|
||||||
|
#define LOG_ENTRY_DATA ((USHORT)('D' << 8))
|
||||||
|
#define LOG_ENTRY_EXIT ((USHORT)('E' << 8))
|
||||||
|
#define LOG_ENTRY_EVENT ((USHORT)('V' << 8))
|
||||||
|
|
||||||
|
#define LOG_EVENT_SKIP_RECEIVE ((USHORT)0)
|
||||||
|
#define LOG_EVENT_BAD_STATUS ((USHORT)1)
|
||||||
|
#define LOG_EVENT_BAD_DISCONNECT ((USHORT)2)
|
||||||
|
|
||||||
|
#define NUMBER_LOG_EVENTS 3
|
||||||
|
|
||||||
|
TCHAR *EventDescriptions[NUMBER_LOG_EVENTS] =
|
||||||
|
{
|
||||||
|
TEXT("# Skipped Receives"),
|
||||||
|
TEXT("# Bad Status"),
|
||||||
|
TEXT("# Bad Disconnect"),
|
||||||
|
};
|
||||||
|
|
||||||
|
DWORD dwEventCounters[NUMBER_LOG_EVENTS];
|
||||||
|
|
||||||
|
VOID LogEntry(USHORT usEntry);
|
||||||
|
VOID DumpLog(VOID);
|
||||||
|
VOID DumpCounters(VOID);
|
||||||
|
|
||||||
|
#define LOG_ENTRY(a) LogEntry(a)
|
||||||
|
#define DUMP_LOG() DumpLog()
|
||||||
|
#else
|
||||||
|
#define LOG_ENTRY(a)
|
||||||
|
#define DUMP_LOG()
|
||||||
|
#endif
|
||||||
|
|
||||||
|
extern volatile DWORD *PtrCurMSec; /* current millisecond counter */
|
||||||
|
|
||||||
|
#define IoPortBase ((PUCHAR)PAR_PORT_BASE)
|
||||||
|
|
||||||
|
BOOL NoPPFS;
|
||||||
|
BOOL bLastOpWasWrite;
|
||||||
|
|
||||||
|
BOOL __inline VerifyDisconnect(VOID)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
USHORT usStatus;
|
||||||
|
|
||||||
|
for (i = 0; i < 3; i++)
|
||||||
|
{
|
||||||
|
usStatus = READ_PORT_UCHAR(IoPortBase + PAR_PORT_STAT);
|
||||||
|
|
||||||
|
LOG_ENTRY((USHORT)(LOG_ENTRY_STATUS | usStatus));
|
||||||
|
|
||||||
|
if (!STATUS_IS_DISCONNECTED(usStatus))
|
||||||
|
{
|
||||||
|
LOG_ENTRY(LOG_ENTRY_EVENT | LOG_EVENT_BAD_STATUS);
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL WaitForStatus(USHORT usMask, USHORT usValue)
|
||||||
|
{
|
||||||
|
USHORT usStatus;
|
||||||
|
DWORD msecStart = *PtrCurMSec;
|
||||||
|
int tries = 0;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
if (*PtrCurMSec - msecStart >= 200)
|
||||||
|
{
|
||||||
|
if (++tries > 5)
|
||||||
|
{
|
||||||
|
NoPPFS = TRUE;
|
||||||
|
|
||||||
|
printf("\r\nWaitForStatus: time out (1), status = %2.2X\r\n",
|
||||||
|
usStatus);
|
||||||
|
|
||||||
|
LOG_ENTRY(LOG_ENTRY_EXIT | 2);
|
||||||
|
|
||||||
|
DUMP_LOG();
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
msecStart = *PtrCurMSec;
|
||||||
|
}
|
||||||
|
|
||||||
|
usStatus = READ_PORT_UCHAR(IoPortBase + PAR_PORT_STAT);
|
||||||
|
|
||||||
|
LOG_ENTRY((USHORT)(LOG_ENTRY_STATUS | usStatus));
|
||||||
|
|
||||||
|
//
|
||||||
|
// Use SELECTIN to identify the existence of ppsh
|
||||||
|
//
|
||||||
|
if (STATUS_IS_DISCONNECTED(usStatus))
|
||||||
|
{
|
||||||
|
if (VerifyDisconnect())
|
||||||
|
{
|
||||||
|
printf("\r\nWaitForStatus: PPSH disconnected\r\n");
|
||||||
|
|
||||||
|
NoPPFS = TRUE;
|
||||||
|
|
||||||
|
LOG_ENTRY(LOG_ENTRY_EXIT | 1);
|
||||||
|
|
||||||
|
DUMP_LOG();
|
||||||
|
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
usStatus = READ_PORT_UCHAR(IoPortBase + PAR_PORT_STAT);
|
||||||
|
LOG_ENTRY((USHORT)(LOG_ENTRY_STATUS | usStatus));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((usStatus & usMask) == usValue)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < 2; i++)
|
||||||
|
{
|
||||||
|
usStatus = READ_PORT_UCHAR(IoPortBase + PAR_PORT_STAT);
|
||||||
|
|
||||||
|
LOG_ENTRY((USHORT)(LOG_ENTRY_STATUS | usStatus));
|
||||||
|
|
||||||
|
if ((usStatus & usMask) != usValue)
|
||||||
|
{
|
||||||
|
LOG_ENTRY(LOG_ENTRY_EVENT | LOG_EVENT_BAD_STATUS);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while ((usStatus & usMask) != usValue);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int OEMParallelPortInit(void)
|
||||||
|
{
|
||||||
|
LOG_ENTRY(LOG_ENTRY_CONTROL | PAR_CTRL_AUTOFEED | PAR_CTRL_STROBE);
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(
|
||||||
|
IoPortBase + PAR_PORT_CTRL, PAR_CTRL_AUTOFEED | PAR_CTRL_STROBE);
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int OEMParallelPortGetByte(void)
|
||||||
|
{
|
||||||
|
BYTE value;
|
||||||
|
|
||||||
|
if (NoPPFS)
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
Retry:
|
||||||
|
LOG_ENTRY(LOG_ENTRY_READ);
|
||||||
|
|
||||||
|
LOG_ENTRY(LOG_ENTRY_CONTROL | PAR_CTRL_READ | PAR_CTRL_STROBE);
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase + PAR_PORT_CTRL, PAR_CTRL_READ | PAR_CTRL_STROBE);
|
||||||
|
|
||||||
|
if (!WaitForStatus(PAR_STAT_NACK, PAR_STAT_NACK))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
value = READ_PORT_UCHAR(IoPortBase + PAR_PORT_DATA);
|
||||||
|
|
||||||
|
LOG_ENTRY((USHORT)(LOG_ENTRY_DATA | value));
|
||||||
|
|
||||||
|
LOG_ENTRY(LOG_ENTRY_CONTROL | PAR_CTRL_AUTOFEED | PAR_CTRL_STROBE);
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase + PAR_PORT_CTRL, PAR_CTRL_AUTOFEED | PAR_CTRL_STROBE);
|
||||||
|
|
||||||
|
if (!WaitForStatus(PAR_STAT_NACK, 0))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ENTRY(LOG_ENTRY_EXIT | 0);
|
||||||
|
|
||||||
|
if (bLastOpWasWrite && value == 0x1A)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// There is a problem which I haven't tracked down yet but this works
|
||||||
|
// around it. The problem is that periodically the first character we
|
||||||
|
// receive after a write is the last byte sent of the previous write.
|
||||||
|
//
|
||||||
|
// For now we will ignore it
|
||||||
|
//
|
||||||
|
LOG_ENTRY(LOG_ENTRY_EVENT | LOG_EVENT_SKIP_RECEIVE);
|
||||||
|
bLastOpWasWrite = FALSE;
|
||||||
|
goto Retry;
|
||||||
|
}
|
||||||
|
|
||||||
|
bLastOpWasWrite = FALSE;
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID OEMParallelPortSendByte(BYTE chData)
|
||||||
|
{
|
||||||
|
if (NoPPFS)
|
||||||
|
return;
|
||||||
|
|
||||||
|
LOG_ENTRY(LOG_ENTRY_WRITE);
|
||||||
|
|
||||||
|
if (!WaitForStatus(PAR_STAT_NBUSY, 0))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ENTRY((USHORT)(LOG_ENTRY_DATA | chData));
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase + PAR_PORT_DATA, chData);
|
||||||
|
|
||||||
|
LOG_ENTRY(LOG_ENTRY_CONTROL | PAR_CTRL_AUTOFEED);
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase + PAR_PORT_CTRL, PAR_CTRL_AUTOFEED);
|
||||||
|
|
||||||
|
if (!WaitForStatus(PAR_STAT_NBUSY, PAR_STAT_NBUSY))
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG_ENTRY(LOG_ENTRY_CONTROL | PAR_CTRL_AUTOFEED | PAR_CTRL_STROBE);
|
||||||
|
|
||||||
|
WRITE_PORT_UCHAR(IoPortBase + PAR_PORT_CTRL, PAR_CTRL_AUTOFEED | PAR_CTRL_STROBE);
|
||||||
|
|
||||||
|
LOG_ENTRY(LOG_ENTRY_EXIT | 0);
|
||||||
|
|
||||||
|
bLastOpWasWrite = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
#define LOG_SIZE 0x1000
|
||||||
|
#define RW_STACK_SIZE 10
|
||||||
|
|
||||||
|
WCHAR wcHexDigits[16] =
|
||||||
|
{
|
||||||
|
TEXT('0'), TEXT('1'), TEXT('2'), TEXT('3'),
|
||||||
|
TEXT('4'), TEXT('5'), TEXT('6'), TEXT('7'),
|
||||||
|
TEXT('8'), TEXT('9'), TEXT('A'), TEXT('B'),
|
||||||
|
TEXT('C'), TEXT('D'), TEXT('E'), TEXT('F')
|
||||||
|
};
|
||||||
|
|
||||||
|
USHORT usLogBuffer[LOG_SIZE];
|
||||||
|
int iLogHead = 0;
|
||||||
|
int iLogTail = 0;
|
||||||
|
|
||||||
|
VOID
|
||||||
|
LogEntry(USHORT usEntry)
|
||||||
|
{
|
||||||
|
static USHORT usLastEntry;
|
||||||
|
USHORT usEntryType;
|
||||||
|
USHORT usEntryData;
|
||||||
|
|
||||||
|
usEntryData = usEntry & LOG_ENTRY_DATA_MASK;
|
||||||
|
usEntryType = usEntry & LOG_ENTRY_TYPE_MASK;
|
||||||
|
|
||||||
|
switch (usEntryType)
|
||||||
|
{
|
||||||
|
case LOG_ENTRY_STATUS:
|
||||||
|
if (usLastEntry == usEntry)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Don't log duplicate status
|
||||||
|
//
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LOG_ENTRY_EVENT:
|
||||||
|
if (usEntryData < NUMBER_LOG_EVENTS)
|
||||||
|
{
|
||||||
|
dwEventCounters[usEntryData]++;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
usLastEntry = usEntry;
|
||||||
|
|
||||||
|
usLogBuffer[iLogTail++] = usEntry;
|
||||||
|
iLogTail %= LOG_SIZE;
|
||||||
|
|
||||||
|
if (iLogTail == iLogHead)
|
||||||
|
{
|
||||||
|
iLogHead++;
|
||||||
|
iLogHead %= LOG_SIZE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DumpLog(VOID)
|
||||||
|
{
|
||||||
|
// R 00 W 4F
|
||||||
|
TCHAR szPrintLine[100];
|
||||||
|
int iLogCurrent;
|
||||||
|
PTCHAR pCurrentColumn;
|
||||||
|
int nDataItems;
|
||||||
|
USHORT usCurrentOp, usLastOp;
|
||||||
|
int iReadWriteStack[RW_STACK_SIZE];
|
||||||
|
int i;
|
||||||
|
|
||||||
|
pCurrentColumn = szPrintLine;
|
||||||
|
nDataItems = 0;
|
||||||
|
|
||||||
|
usLastOp = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < RW_STACK_SIZE; i++)
|
||||||
|
{
|
||||||
|
iReadWriteStack[i] = iLogTail;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (iLogCurrent = iLogHead; iLogCurrent != iLogTail;
|
||||||
|
iLogCurrent++, iLogCurrent %= LOG_SIZE)
|
||||||
|
{
|
||||||
|
usCurrentOp = usLogBuffer[iLogCurrent] & LOG_ENTRY_TYPE_MASK;
|
||||||
|
switch (usCurrentOp)
|
||||||
|
{
|
||||||
|
case LOG_ENTRY_READ:
|
||||||
|
case LOG_ENTRY_WRITE:
|
||||||
|
if (usLastOp != usCurrentOp)
|
||||||
|
{
|
||||||
|
if (pCurrentColumn != szPrintLine)
|
||||||
|
{
|
||||||
|
memcpy(pCurrentColumn, TEXT("\r\n"), sizeof(TEXT("\r\n")));
|
||||||
|
OutputDebugString(szPrintLine);
|
||||||
|
pCurrentColumn = szPrintLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pCurrentColumn++ = (TCHAR)(usLogBuffer[iLogCurrent] >> 8);
|
||||||
|
*pCurrentColumn++ = TEXT(' ');
|
||||||
|
usLastOp = usCurrentOp;
|
||||||
|
nDataItems = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < (RW_STACK_SIZE - 1); i++)
|
||||||
|
{
|
||||||
|
iReadWriteStack[i] = iReadWriteStack[i + 1];
|
||||||
|
}
|
||||||
|
|
||||||
|
iReadWriteStack[RW_STACK_SIZE - 1] = iLogCurrent;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LOG_ENTRY_EVENT:
|
||||||
|
case LOG_ENTRY_DATA:
|
||||||
|
if (nDataItems == 25)
|
||||||
|
{
|
||||||
|
memcpy(pCurrentColumn, TEXT("\r\n"), sizeof(TEXT("\r\n")));
|
||||||
|
OutputDebugString(szPrintLine);
|
||||||
|
pCurrentColumn = szPrintLine;
|
||||||
|
*pCurrentColumn++ = TEXT(' ');
|
||||||
|
*pCurrentColumn++ = TEXT(' ');
|
||||||
|
nDataItems = 0;
|
||||||
|
}
|
||||||
|
*pCurrentColumn++ = wcHexDigits[(usLogBuffer[iLogCurrent] >> 4) & 0x0F];
|
||||||
|
*pCurrentColumn++ = wcHexDigits[usLogBuffer[iLogCurrent] & 0x0F];
|
||||||
|
*pCurrentColumn++ = usCurrentOp == LOG_ENTRY_DATA ? TEXT(' ') : TEXT('!');
|
||||||
|
nDataItems++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pCurrentColumn != szPrintLine)
|
||||||
|
{
|
||||||
|
memcpy(pCurrentColumn, TEXT("\r\n"), sizeof(TEXT("\r\n")));
|
||||||
|
OutputDebugString(szPrintLine);
|
||||||
|
pCurrentColumn = szPrintLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
nDataItems = 0;
|
||||||
|
|
||||||
|
for (i = 0; i < RW_STACK_SIZE; i++)
|
||||||
|
{
|
||||||
|
if (iReadWriteStack[i] != iLogTail)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
iLogCurrent = (i < RW_STACK_SIZE) ? iReadWriteStack[i] : iLogTail;
|
||||||
|
|
||||||
|
for ( ; iLogCurrent != iLogTail; iLogCurrent++, iLogCurrent %= LOG_SIZE)
|
||||||
|
{
|
||||||
|
if (nDataItems == 16)
|
||||||
|
{
|
||||||
|
memcpy(pCurrentColumn, TEXT("\r\n"), sizeof(TEXT("\r\n")));
|
||||||
|
OutputDebugString(szPrintLine);
|
||||||
|
pCurrentColumn = szPrintLine;
|
||||||
|
nDataItems = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
*pCurrentColumn++ = (TCHAR)(usLogBuffer[iLogCurrent] >> 8);
|
||||||
|
|
||||||
|
*pCurrentColumn++ = TEXT(' ');
|
||||||
|
|
||||||
|
*pCurrentColumn++ = wcHexDigits[(usLogBuffer[iLogCurrent] >> 4) & 0x0F];
|
||||||
|
|
||||||
|
*pCurrentColumn++ = wcHexDigits[usLogBuffer[iLogCurrent] & 0x0F];
|
||||||
|
|
||||||
|
*pCurrentColumn++ = TEXT(' ');
|
||||||
|
|
||||||
|
nDataItems++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pCurrentColumn != szPrintLine)
|
||||||
|
{
|
||||||
|
memcpy(pCurrentColumn, TEXT("\r\n"), sizeof(TEXT("\r\n")));
|
||||||
|
OutputDebugString(szPrintLine);
|
||||||
|
pCurrentColumn = szPrintLine;
|
||||||
|
}
|
||||||
|
|
||||||
|
DumpCounters();
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DumpCounters(VOID)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < NUMBER_LOG_EVENTS; i++)
|
||||||
|
{
|
||||||
|
if (dwEventCounters[i] != 0)
|
||||||
|
{
|
||||||
|
NKDbgPrintfW(
|
||||||
|
TEXT("%s = %d\r\n"), EventDescriptions[i], dwEventCounters[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
0
DOS/Loadcepc.exe/PC.H
Normal file
0
DOS/Loadcepc.exe/PC.H
Normal file
460
DOS/Loadcepc.exe/PPFS.C
Normal file
460
DOS/Loadcepc.exe/PPFS.C
Normal file
@ -0,0 +1,460 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
ppfs.c
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
This file implements the NK kernel ppfs client side interface
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include "kernel.h"
|
||||||
|
|
||||||
|
/* All strings must be <= 128 bytes including the null termination */
|
||||||
|
|
||||||
|
/* Message format: (assume little endians, lower address first>
|
||||||
|
* -4 0 4 N-1 N N+4
|
||||||
|
* AA5555AA<header><data><checksum>5AA50A1A
|
||||||
|
*
|
||||||
|
* Header format:
|
||||||
|
* 0 2 4
|
||||||
|
* <opcode><length>
|
||||||
|
* lsb msb
|
||||||
|
*
|
||||||
|
* Length is 16 bit value. It includes all fields (== N)
|
||||||
|
* Opcode is 16 bit value. Current values are:
|
||||||
|
* 0x0000 - boot (AA5555AA00000500FA5AA50A1A)
|
||||||
|
* 0x0001 - init (AA5555AA01000500F95AA50A1A)
|
||||||
|
* 0x0002 - open
|
||||||
|
* 0x0003 - close
|
||||||
|
* 0x0004 - read
|
||||||
|
* 0x0005 - write
|
||||||
|
* 0x0006 - seek
|
||||||
|
* 0x0007 - delete
|
||||||
|
* 0x0008 - findfirst
|
||||||
|
* 0x0009 - findnext
|
||||||
|
* 0x000A - rRegGet
|
||||||
|
* 0x000B - rRegOpen
|
||||||
|
* 0x000C - rRegClose
|
||||||
|
* 0x000D - rRegEnum
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* Reply to a message will have the same opcode. Bit15 is set to
|
||||||
|
* indicate transmission failure.
|
||||||
|
*
|
||||||
|
* Data is stream of bytes
|
||||||
|
*
|
||||||
|
* Checksum is ~(sum of preceding N-1 bytes)
|
||||||
|
*
|
||||||
|
* Length of data is <length> - 5
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
CRITICAL_SECTION ppfscs;
|
||||||
|
extern int NoPPFS; // parallel port not present flag
|
||||||
|
|
||||||
|
int read_value(int *chksum) {
|
||||||
|
int loop;
|
||||||
|
int result;
|
||||||
|
BYTE ch;
|
||||||
|
for (loop = 0; loop < sizeof(int); loop++ ) {
|
||||||
|
ch = (BYTE)OEMParallelPortGetByte();
|
||||||
|
*chksum += ch;
|
||||||
|
((LPBYTE)&result)[loop] = ch;
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_value(int val, int *chksum) {
|
||||||
|
int loop;
|
||||||
|
BYTE ch;
|
||||||
|
for (loop = 0; loop < 4; loop++) {
|
||||||
|
ch = ((LPBYTE)&val)[loop];
|
||||||
|
*chksum += ch;
|
||||||
|
OEMParallelPortSendByte(ch);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int read_header(int *chksum) {
|
||||||
|
if (read_value(chksum) != 0xaa5555aa)
|
||||||
|
return -1;
|
||||||
|
*chksum = 0;
|
||||||
|
return read_value(chksum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_header(int cmd, int *chksum) {
|
||||||
|
write_value(0xaa5555aa,chksum);
|
||||||
|
*chksum = 0;
|
||||||
|
write_value(cmd,chksum);
|
||||||
|
}
|
||||||
|
|
||||||
|
void read_data(LPBYTE buf, int cnt, int *chksum) {
|
||||||
|
BYTE ch;
|
||||||
|
while (cnt--) {
|
||||||
|
ch = (BYTE)OEMParallelPortGetByte();
|
||||||
|
*chksum += ch;
|
||||||
|
*buf++ = ch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_data(LPBYTE buf, int cnt, int *chksum) {
|
||||||
|
while (cnt--) {
|
||||||
|
*chksum += *buf;
|
||||||
|
OEMParallelPortSendByte(*buf++);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* returns TRUE if success, FALSE if failure */
|
||||||
|
BOOL read_end(int checksum) {
|
||||||
|
BYTE b;
|
||||||
|
int tmp;
|
||||||
|
b = (BYTE)OEMParallelPortGetByte();
|
||||||
|
if (((checksum & 0xff) != b) ||
|
||||||
|
(read_value(&tmp) != 0x1a0aa55a))
|
||||||
|
return FALSE;
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
void write_end(int checksum) {
|
||||||
|
int tmp;
|
||||||
|
BYTE ch = (BYTE)((checksum & 0xff) ^ 0xff);
|
||||||
|
OEMParallelPortSendByte(ch);
|
||||||
|
write_value(0x1a0aa55a,&tmp); /* Write out end of message signature */
|
||||||
|
}
|
||||||
|
|
||||||
|
int rlseek(int fd, int off, int mode) {
|
||||||
|
int chksum, result;
|
||||||
|
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
if (NoPPFS)
|
||||||
|
{
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
write_header(0x00110006,&chksum); /* opcode = 0x0006, length = 17 */
|
||||||
|
write_value(fd,&chksum);
|
||||||
|
write_value(off,&chksum);
|
||||||
|
write_value(mode,&chksum);
|
||||||
|
write_end(chksum);
|
||||||
|
if (read_header(&chksum) != 0x00090006) { /* opcode = 0x0006, length = 9 */
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
result = read_value(&chksum);
|
||||||
|
if (!read_end(chksum)) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rwriteshort(int fd, char *buf, int cnt) {
|
||||||
|
int chksum, result;
|
||||||
|
|
||||||
|
write_header(0x000d0005+(cnt<<16), &chksum); /* opcode = 0x0005, length = 13 + cnt */
|
||||||
|
write_value(fd,&chksum);
|
||||||
|
write_value(cnt,&chksum);
|
||||||
|
write_data(buf,cnt,&chksum);
|
||||||
|
write_end(chksum);
|
||||||
|
if (read_header(&chksum) != 0x00090005) /* opcode = 0x0005, length = 9 */
|
||||||
|
return -1;
|
||||||
|
result = read_value(&chksum);
|
||||||
|
if (!read_end(chksum))
|
||||||
|
return -1;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rwrite(int fd, char *buf, int cnt) {
|
||||||
|
int csize, fullsize;
|
||||||
|
int result, result2;
|
||||||
|
char *buf2 = buf;
|
||||||
|
if (NoPPFS)
|
||||||
|
return -1;
|
||||||
|
fullsize = cnt;
|
||||||
|
LockPages(buf,fullsize,0,0);
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
result2 = 0;
|
||||||
|
while (cnt) {
|
||||||
|
csize = ( cnt > 32*1024L ? 32*1024L : cnt);
|
||||||
|
if ((result = rwriteshort(fd,buf2,csize)) == -1) {
|
||||||
|
result2 = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
result2 += result;
|
||||||
|
cnt -= csize;
|
||||||
|
buf2 += csize;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
UnlockPages(buf,fullsize);
|
||||||
|
return result2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rreadshort(int fd, char *buf, int cnt) {
|
||||||
|
int chksum, result, size;
|
||||||
|
write_header(0x000d0004, &chksum); /* opcode = 0x0004, length = 13 */
|
||||||
|
write_value(fd, &chksum);
|
||||||
|
write_value(cnt,&chksum);
|
||||||
|
write_end(chksum);
|
||||||
|
result = read_header(&chksum);
|
||||||
|
if ((result & 0xffff) != 0x0004)
|
||||||
|
return -1;
|
||||||
|
size = ((result >> 16) & 0xffff) - 9; /* subtract header & chksum */
|
||||||
|
result = read_value(&chksum);
|
||||||
|
read_data(buf,size,&chksum);
|
||||||
|
if (!read_end(chksum))
|
||||||
|
return -1;
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rread(int fd, char *buf, int cnt) {
|
||||||
|
int csize, fullsize;
|
||||||
|
int result, result2;
|
||||||
|
char *buf2 = buf;
|
||||||
|
if (NoPPFS)
|
||||||
|
return -1;
|
||||||
|
fullsize = cnt;
|
||||||
|
LockPages(buf,fullsize,0,LOCKFLAG_WRITE);
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
result2 = 0;
|
||||||
|
while (cnt) {
|
||||||
|
csize = ( cnt > 32*1024L ? 32*1024L : cnt);
|
||||||
|
if ((result = rreadshort(fd,buf2,csize)) == -1) {
|
||||||
|
result2 = -1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
result2 += result;
|
||||||
|
cnt -= csize;
|
||||||
|
buf2 += csize;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
UnlockPages(buf,fullsize);
|
||||||
|
return result2;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rclose(int fd) {
|
||||||
|
int chksum, result;
|
||||||
|
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
if (NoPPFS) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
write_header(0x00090003, &chksum); /* opcode = 0x0003, length = 9 */
|
||||||
|
write_value(fd,&chksum);
|
||||||
|
write_end(chksum);
|
||||||
|
if (read_header(&chksum) != 0x00090003) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
result = read_value(&chksum);
|
||||||
|
if (!read_end(chksum)) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define MAX_FILENAME_LEN 256
|
||||||
|
|
||||||
|
void SC_PPSHRestart(void) {
|
||||||
|
NoPPFS = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ropen(WCHAR *name, int mode) {
|
||||||
|
int chksum, result, len;
|
||||||
|
char fname[MAX_FILENAME_LEN];
|
||||||
|
len = strlenW(name)+1;
|
||||||
|
KUnicodeToAscii(fname,name,MAX_FILENAME_LEN);
|
||||||
|
if (NoPPFS)
|
||||||
|
return -1;
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
write_header(0x00090002 + (len<<16), &chksum); /* opcode = 0x0002, length = 9 + strlen + 1 */
|
||||||
|
write_value(mode,&chksum);
|
||||||
|
write_data(fname,len,&chksum);
|
||||||
|
write_end(chksum);
|
||||||
|
if (read_header(&chksum) != 0x00090002) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
result = read_value(&chksum);
|
||||||
|
if (!read_end(chksum)) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rfindfirst(DWORD hFind, WCHAR *pattern, struct _finddata_t *fd) {
|
||||||
|
int chksum, result, len;
|
||||||
|
char fname[MAX_FILENAME_LEN];
|
||||||
|
|
||||||
|
if (NoPPFS)
|
||||||
|
return -1;
|
||||||
|
if (pattern != NULL) {
|
||||||
|
len = strlenW(pattern)+1;
|
||||||
|
KUnicodeToAscii(fname,pattern,MAX_FILENAME_LEN);
|
||||||
|
} else {
|
||||||
|
len = 0;
|
||||||
|
}
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
write_header(0x00090008 + (len<<16), &chksum); /* opcode = 0x0002, length = 9 + strlen + 1 */
|
||||||
|
write_value(hFind,&chksum);
|
||||||
|
if (len != 0) {
|
||||||
|
write_data(fname,len,&chksum);
|
||||||
|
}
|
||||||
|
write_end(chksum);
|
||||||
|
result = read_header(&chksum);
|
||||||
|
if ((result & 0xffff) != 0x0008)
|
||||||
|
return -1;
|
||||||
|
len = ((result >> 16) & 0xffff) - 9; /* subtract header & chksum */
|
||||||
|
result = read_value(&chksum);
|
||||||
|
if (len != 0) {
|
||||||
|
read_data((LPBYTE)fd,len,&chksum);
|
||||||
|
}
|
||||||
|
if (!read_end(chksum)) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rfindnext(DWORD hFind, struct _finddata_t *fd) {
|
||||||
|
int chksum, result, len;
|
||||||
|
|
||||||
|
if (NoPPFS)
|
||||||
|
return -1;
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
write_header(0x00090009, &chksum); /* opcode = 0x0009, length = 9 */
|
||||||
|
write_value(hFind,&chksum);
|
||||||
|
write_end(chksum);
|
||||||
|
result = read_header(&chksum);
|
||||||
|
if ((result & 0xffff) != 0x0009)
|
||||||
|
return -1;
|
||||||
|
len = ((result >> 16) & 0xffff) - 9; /* subtract header & chksum */
|
||||||
|
result = read_value(&chksum);
|
||||||
|
if (len != 0) {
|
||||||
|
read_data((LPBYTE)fd,len,&chksum);
|
||||||
|
}
|
||||||
|
if (!read_end(chksum)) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Registration database access functions for kernel debug support initialization
|
||||||
|
int rRegOpen(DWORD hKey, CHAR *szName, LPDWORD lphKey) {
|
||||||
|
int chksum, len;
|
||||||
|
if (NoPPFS)
|
||||||
|
return -1;
|
||||||
|
len = strlen(szName)+1;
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
write_header(0x0009000B + (len<<16), &chksum); /* opcode = 0x000B, length = 9 + strlen + 1 */
|
||||||
|
write_value(hKey,&chksum);
|
||||||
|
write_data(szName,len,&chksum);
|
||||||
|
write_end(chksum);
|
||||||
|
if (read_header(&chksum) != 0x0009000B) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
*lphKey = read_value(&chksum);
|
||||||
|
if (!read_end(chksum)) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rRegClose(DWORD hKey) {
|
||||||
|
int chksum, result;
|
||||||
|
if (NoPPFS)
|
||||||
|
return -1;
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
write_header(0x0009000C, &chksum); /* opcode = 0x000C, length = 9 */
|
||||||
|
write_value(hKey,&chksum);
|
||||||
|
write_end(chksum);
|
||||||
|
if (read_header(&chksum) != 0x0009000C) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
result = read_value(&chksum);
|
||||||
|
if (!read_end(chksum)) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rRegGet(DWORD hKey, CHAR *szName, LPDWORD lpdwType,
|
||||||
|
LPBYTE lpbData, LPDWORD lpdwSize) {
|
||||||
|
int chksum, result, len;
|
||||||
|
if (NoPPFS)
|
||||||
|
return -1;
|
||||||
|
len = strlen(szName)+1;
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
write_header(0x0009000A + (len<<16), &chksum); /* opcode = 0x000A, length = 9 + strlen + 1 */
|
||||||
|
write_value(hKey,&chksum);
|
||||||
|
write_data(szName,len,&chksum);
|
||||||
|
write_end(chksum);
|
||||||
|
DEBUGMSG(ZONE_DEBUG,(TEXT("NKDBG: RegGet. hKey=%lu, Name=%a\r\n"), hKey, szName));
|
||||||
|
result = read_header(&chksum);
|
||||||
|
if ((result & 0xffff) != 0x000A)
|
||||||
|
{
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
len = ((result >> 16) & 0xffff) - 9; /* subtract header & chksum */
|
||||||
|
*lpdwType = read_value(&chksum);
|
||||||
|
*lpdwSize = len;
|
||||||
|
DEBUGMSG(ZONE_DEBUG,(TEXT("NKDBG: RegGet. Type=%lu, Size=%lu\r\n"), *lpdwType, *lpdwSize));
|
||||||
|
read_data(lpbData,len,&chksum);
|
||||||
|
if (!read_end(chksum)) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
int rRegEnum(DWORD hKey, DWORD dwIndex, LPBYTE lpbData, LPDWORD lpdwSize) {
|
||||||
|
int chksum, result, len;
|
||||||
|
if (NoPPFS)
|
||||||
|
return -1;
|
||||||
|
EnterCriticalSection(&ppfscs);
|
||||||
|
write_header(0x000D000D, &chksum); /* opcode = 0x000A, length = 13 */
|
||||||
|
write_value(hKey,&chksum);
|
||||||
|
write_value(dwIndex,&chksum);
|
||||||
|
write_end(chksum);
|
||||||
|
DEBUGMSG(ZONE_DEBUG,(TEXT("NKDBG: RegEnum. hKey=%lu, Index=%u\r\n"), hKey, dwIndex));
|
||||||
|
result = read_header(&chksum);
|
||||||
|
if ((result & 0xffff) != 0x000D)
|
||||||
|
{
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
len = ((result >> 16) & 0xffff) - 9; /* subtract header & chksum */
|
||||||
|
result = read_value(&chksum);
|
||||||
|
*lpdwSize = len;
|
||||||
|
DEBUGMSG(ZONE_DEBUG,(TEXT("NKDBG: RegEnum. Return=%lu, Size=%lu\r\n"), result, *lpdwSize));
|
||||||
|
read_data(lpbData,len,&chksum);
|
||||||
|
if (!read_end(chksum)) {
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
LeaveCriticalSection(&ppfscs);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
14
DOS/Loadcepc.exe/PPFS.H
Normal file
14
DOS/Loadcepc.exe/PPFS.H
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
long rlseek(long fd, long off, long mode);
|
||||||
|
long rwrite(long fd, char *buf, long cnt);
|
||||||
|
long rread(long fd, char *buf, long cnt);
|
||||||
|
long rclose(long fd);
|
||||||
|
long ropen(WCHAR *name, long mode);
|
||||||
|
|
||||||
|
long rRegOpen(DWORD hKey, CHAR *szName, LPDWORD lphKey);
|
||||||
|
long rRegClose(DWORD hKey);
|
||||||
|
long rRegGet(DWORD hKey, CHAR *szName, LPDWORD lpdwType,
|
||||||
|
LPBYTE lpbData, LPDWORD lpdwSize);
|
||||||
|
long rRegEnum(DWORD hKey, DWORD dwIndex, LPBYTE lpbData, LPDWORD lpdwSize);
|
||||||
|
|
||||||
|
long rfindfirst(DWORD hFind, WCHAR *pattern, struct _finddata_t *fd);
|
||||||
|
long rfindnext(DWORD hFind, struct _finddata_t *fd);
|
||||||
545
DOS/Loadcepc.exe/PPFSTOOL.C
Normal file
545
DOS/Loadcepc.exe/PPFSTOOL.C
Normal file
@ -0,0 +1,545 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Functions:
|
||||||
|
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#include "windows.h"
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <sys\stat.h>
|
||||||
|
#include <sys\utime.h>
|
||||||
|
#include <ctype.h>
|
||||||
|
#include <direct.h>
|
||||||
|
#include <dos.h>
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <io.h>
|
||||||
|
#include <time.h>
|
||||||
|
#include "ppfs.h"
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
VOID DumpCounters(VOID);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
DWORD CurMSec = 0;
|
||||||
|
DWORD *PtrCurMSec = &CurMSec;
|
||||||
|
|
||||||
|
#define COPY_FLAG_UPDATE_EXISTING 0x0001
|
||||||
|
#define COPY_FLAG_UPDATE_OR_ADD 0x0002
|
||||||
|
|
||||||
|
typedef unsigned long _fsize_t; /* Could be 64 bits for Win32 */
|
||||||
|
|
||||||
|
struct _finddata_t {
|
||||||
|
unsigned long attrib;
|
||||||
|
time_t time_create; /* -1 for FAT file systems */
|
||||||
|
time_t time_access; /* -1 for FAT file systems */
|
||||||
|
time_t time_write;
|
||||||
|
_fsize_t size;
|
||||||
|
char name[260];
|
||||||
|
};
|
||||||
|
|
||||||
|
void
|
||||||
|
usage2(char *pszProgramPath)
|
||||||
|
{
|
||||||
|
char *pszProgramName;
|
||||||
|
|
||||||
|
if ((pszProgramName = strrchr(pszProgramPath, '\\')) == NULL)
|
||||||
|
{
|
||||||
|
pszProgramName = pszProgramPath;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pszProgramName++;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"%s: Parallel Port FileSystem Tool\n"
|
||||||
|
"usage: %s -d[:]<pattern> -(g|r|u)[[:]<pattern> [<destination>]\n"
|
||||||
|
"-d Display a directory of files matching <pattern>.\n\n"
|
||||||
|
"-g Get files matching <pattern> and copy them to the\n"
|
||||||
|
" optionally specified <destination>. Any existing file with\n"
|
||||||
|
" the same name will be overwritten.\n\n"
|
||||||
|
"-r Refresh files matching <pattern> which already exist in <destination>\n"
|
||||||
|
" and have a timestamp newer than the one in <destination>.\n\n"
|
||||||
|
"-u Update files matching <pattern> which don't already exist in\n"
|
||||||
|
" <destination> or those that have a timestamp newer than those\n"
|
||||||
|
" in <destination>.\n\n"
|
||||||
|
"<pattern> Windows filename path with optional wildcard characters.\n\n"
|
||||||
|
"<destination> If not specified then the current directory is the\n"
|
||||||
|
" default.\n"
|
||||||
|
" If specified and it doesn't exist and the last character is \\,\n"
|
||||||
|
" then the directory is created. Otherwise <destination> is\n"
|
||||||
|
" treated as the name of the file.\n"
|
||||||
|
" It is an error for <pattern> to match multiple files\n"
|
||||||
|
" when <destination> specifies a file.\n",
|
||||||
|
pszProgramName, pszProgramName);
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DisplayDirectory(char *pszPath)
|
||||||
|
{
|
||||||
|
DWORD hFind;
|
||||||
|
struct _finddata_t fd;
|
||||||
|
struct tm *ptmWrite;
|
||||||
|
|
||||||
|
hFind = rfindfirst(0, pszPath, &fd);
|
||||||
|
|
||||||
|
if (hFind == 0)
|
||||||
|
{
|
||||||
|
printf("%s: No files found\n", pszPath);
|
||||||
|
}
|
||||||
|
else if (hFind != -1)
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ptmWrite = gmtime(&fd.time_write);
|
||||||
|
|
||||||
|
printf(
|
||||||
|
"%c%c%c%c%c %2.2d/%2.2d/%2.2d %2.2d:%2.2d:%2.2d %-8ld %s\n",
|
||||||
|
fd.attrib & _A_RDONLY ? 'R' : ' ',
|
||||||
|
fd.attrib & _A_HIDDEN ? 'H' : ' ',
|
||||||
|
fd.attrib & _A_SYSTEM ? 'S' : ' ',
|
||||||
|
fd.attrib & _A_SUBDIR ? 'D' : ' ',
|
||||||
|
fd.attrib & _A_ARCH ? 'A' : ' ',
|
||||||
|
ptmWrite->tm_mon + 1, ptmWrite->tm_mday, ptmWrite->tm_year,
|
||||||
|
ptmWrite->tm_hour, ptmWrite->tm_min, ptmWrite->tm_sec,
|
||||||
|
fd.size, fd.name);
|
||||||
|
|
||||||
|
hFind = rfindnext(hFind, &fd);
|
||||||
|
}
|
||||||
|
while (hFind != 0 && hFind != -1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hFind == -1)
|
||||||
|
{
|
||||||
|
printf("%s: Error processing directory\n", pszPath);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
DrawPercent (DWORD CurValue, DWORD MaxValue)
|
||||||
|
{
|
||||||
|
DWORD dwPercent;
|
||||||
|
static DWORD dwOldPercent = 10000;
|
||||||
|
|
||||||
|
if (CurValue == (DWORD)-1) {
|
||||||
|
dwOldPercent = 10000;
|
||||||
|
fprintf(stderr, "%s ", MaxValue);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dwPercent = (CurValue*100)/MaxValue;
|
||||||
|
if ((dwPercent / 5) != (dwOldPercent / 5))
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b");
|
||||||
|
|
||||||
|
for (dwOldPercent=0; dwOldPercent < (dwPercent/5); dwOldPercent++)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%c", 219);
|
||||||
|
}
|
||||||
|
|
||||||
|
for (; dwOldPercent < 20; dwOldPercent++)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "%c", 176);
|
||||||
|
}
|
||||||
|
|
||||||
|
dwOldPercent = dwPercent;
|
||||||
|
fprintf(stderr, " %2d%%", dwPercent);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fprintf(stderr, "\b\b\b%2d%%", dwPercent);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
GetOneFile(
|
||||||
|
char *pszSourceFile, char *pszDestinationFile,
|
||||||
|
DWORD dwFileSize, time_t tmModify)
|
||||||
|
{
|
||||||
|
int hDestinationFile;
|
||||||
|
DWORD hSourceFile;
|
||||||
|
|
||||||
|
int nReadCount;
|
||||||
|
static char cReadBuffer[16384];
|
||||||
|
|
||||||
|
DWORD dwBytesWritten;
|
||||||
|
|
||||||
|
printf("%s --> %s\n", pszSourceFile, pszDestinationFile);
|
||||||
|
|
||||||
|
hDestinationFile = _open(
|
||||||
|
pszDestinationFile, _O_WRONLY | _O_CREAT | _O_BINARY | _O_TRUNC,
|
||||||
|
_S_IREAD | _S_IWRITE);
|
||||||
|
|
||||||
|
if (hDestinationFile == -1)
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"%s: Error opening file for write access, error = %d\n",
|
||||||
|
pszDestinationFile, errno);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
hSourceFile = ropen(pszSourceFile, _O_RDONLY);
|
||||||
|
|
||||||
|
if (hSourceFile == -1)
|
||||||
|
{
|
||||||
|
_close(hDestinationFile);
|
||||||
|
printf("%s: Error opening file for read access\n", pszSourceFile);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Initialize the percent thingie.
|
||||||
|
DrawPercent((DWORD)-1, (DWORD)"");
|
||||||
|
|
||||||
|
dwBytesWritten = 0;
|
||||||
|
|
||||||
|
for ( ; ; )
|
||||||
|
{
|
||||||
|
nReadCount = (int)rread(hSourceFile, &cReadBuffer[0], sizeof(cReadBuffer));
|
||||||
|
|
||||||
|
if (nReadCount <= 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
_write(hDestinationFile, cReadBuffer, nReadCount);
|
||||||
|
|
||||||
|
dwBytesWritten += nReadCount;
|
||||||
|
|
||||||
|
DrawPercent(dwBytesWritten, dwFileSize);
|
||||||
|
}
|
||||||
|
|
||||||
|
fprintf(stderr, "\r \r");
|
||||||
|
|
||||||
|
rclose(hSourceFile);
|
||||||
|
|
||||||
|
_close(hDestinationFile);
|
||||||
|
|
||||||
|
if (nReadCount == 0)
|
||||||
|
{
|
||||||
|
struct _utimbuf utDestination;
|
||||||
|
time_t tmNow;
|
||||||
|
|
||||||
|
time(&tmNow);
|
||||||
|
|
||||||
|
utDestination.actime = tmNow;
|
||||||
|
utDestination.modtime = tmModify != 0 ? tmModify : tmNow;
|
||||||
|
_utime(pszDestinationFile, &utDestination);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_unlink(pszDestinationFile);
|
||||||
|
}
|
||||||
|
|
||||||
|
return nReadCount == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
BOOL
|
||||||
|
CheckDestination(char *pszDestination, char **ppszDirEnd)
|
||||||
|
{
|
||||||
|
struct _stat stDestination;
|
||||||
|
BOOL bIsDir;
|
||||||
|
|
||||||
|
*ppszDirEnd = strrchr(pszDestination, '\\');
|
||||||
|
|
||||||
|
if (*ppszDirEnd == NULL && pszDestination[1] == ':')
|
||||||
|
{
|
||||||
|
*ppszDirEnd = &pszDestination[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (*ppszDirEnd == NULL)
|
||||||
|
{
|
||||||
|
*ppszDirEnd = pszDestination;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
(*ppszDirEnd)++;
|
||||||
|
}
|
||||||
|
|
||||||
|
bIsDir = FALSE;
|
||||||
|
|
||||||
|
if (pszDestination[strlen(pszDestination)-1] == '\\')
|
||||||
|
{
|
||||||
|
pszDestination[strlen(pszDestination)-1] = '\0';
|
||||||
|
bIsDir = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_stat(pszDestination, &stDestination) == 0)
|
||||||
|
{
|
||||||
|
if (stDestination.st_mode & _S_IFDIR)
|
||||||
|
{
|
||||||
|
bIsDir = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (bIsDir)
|
||||||
|
{
|
||||||
|
if (_mkdir(pszDestination) == -1)
|
||||||
|
{
|
||||||
|
printf("%s: Error creating directory, error = %d\n", pszDestination, errno);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bIsDir)
|
||||||
|
{
|
||||||
|
*ppszDirEnd = &pszDestination[strlen(pszDestination)];
|
||||||
|
|
||||||
|
if (*ppszDirEnd[-1] != '\\')
|
||||||
|
{
|
||||||
|
*(*ppszDirEnd)++ = '\\';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return bIsDir;
|
||||||
|
}
|
||||||
|
|
||||||
|
VOID
|
||||||
|
GetFile(char *pszSource, char *pszDestination, USHORT usCopyFlags)
|
||||||
|
{
|
||||||
|
DWORD hFind;
|
||||||
|
|
||||||
|
struct _stat stDestination;
|
||||||
|
char szDestinationFile[_MAX_PATH];
|
||||||
|
char *pDestinationDirEnd;
|
||||||
|
|
||||||
|
struct _finddata_t fdSource;
|
||||||
|
char szSourceFile[_MAX_PATH];
|
||||||
|
char *pSourceDirEnd;
|
||||||
|
|
||||||
|
BOOL bDestinationIsDir;
|
||||||
|
|
||||||
|
int nFilesCopied = 0;
|
||||||
|
|
||||||
|
BOOL bDestinationExists;
|
||||||
|
BOOL bDoCopy;
|
||||||
|
|
||||||
|
pSourceDirEnd = strrchr(pszSource, '\\');
|
||||||
|
|
||||||
|
if (pSourceDirEnd == NULL && pszSource[1] == ':')
|
||||||
|
{
|
||||||
|
pSourceDirEnd = &pszSource[1];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pSourceDirEnd != NULL)
|
||||||
|
{
|
||||||
|
int nDirLength = pSourceDirEnd - pszSource + 1;
|
||||||
|
|
||||||
|
memcpy(szSourceFile, pszSource, nDirLength);
|
||||||
|
pSourceDirEnd = &szSourceFile[nDirLength];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pSourceDirEnd = szSourceFile;
|
||||||
|
}
|
||||||
|
|
||||||
|
hFind = rfindfirst(0, pszSource, &fdSource);
|
||||||
|
|
||||||
|
if (hFind == 0 || hFind == -1)
|
||||||
|
{
|
||||||
|
printf("%s: File(s) not found\n", pszSource);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pszDestination != NULL)
|
||||||
|
{
|
||||||
|
strcpy(szDestinationFile, pszDestination);
|
||||||
|
|
||||||
|
bDestinationIsDir = CheckDestination(szDestinationFile, &pDestinationDirEnd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pDestinationDirEnd = szDestinationFile;
|
||||||
|
bDestinationIsDir = TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
strcpy(pSourceDirEnd, fdSource.name);
|
||||||
|
|
||||||
|
if (bDestinationIsDir)
|
||||||
|
{
|
||||||
|
strcpy(pDestinationDirEnd, fdSource.name);
|
||||||
|
}
|
||||||
|
|
||||||
|
bDoCopy = TRUE;
|
||||||
|
|
||||||
|
if (usCopyFlags & (COPY_FLAG_UPDATE_EXISTING | COPY_FLAG_UPDATE_OR_ADD))
|
||||||
|
{
|
||||||
|
bDestinationExists = _stat(szDestinationFile, &stDestination) == 0;
|
||||||
|
|
||||||
|
if (bDestinationExists)
|
||||||
|
{
|
||||||
|
//
|
||||||
|
// Clear lsb of both times so inaccurate FATFS doesn't cause
|
||||||
|
// problems
|
||||||
|
//
|
||||||
|
stDestination.st_mtime &= ~1;
|
||||||
|
fdSource.time_write &= ~1;
|
||||||
|
|
||||||
|
if (stDestination.st_mtime >= fdSource.time_write)
|
||||||
|
{
|
||||||
|
printf("%s: Up to date\n", szDestinationFile);
|
||||||
|
bDoCopy = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (!(usCopyFlags & COPY_FLAG_UPDATE_OR_ADD))
|
||||||
|
{
|
||||||
|
printf("%s: Skipping\n", szSourceFile);
|
||||||
|
bDoCopy = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bDoCopy)
|
||||||
|
{
|
||||||
|
if (GetOneFile(szSourceFile, szDestinationFile, fdSource.size, fdSource.time_write))
|
||||||
|
{
|
||||||
|
nFilesCopied++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
hFind = rfindnext(hFind, &fdSource);
|
||||||
|
|
||||||
|
if (!bDestinationIsDir && hFind != 0 && hFind != -1)
|
||||||
|
{
|
||||||
|
printf(
|
||||||
|
"%s: Destination isn't a directory and multiple files selected\n",
|
||||||
|
szDestinationFile);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (hFind != 0 && hFind != -1);
|
||||||
|
|
||||||
|
if (hFind != 0 && hFind != -1)
|
||||||
|
{
|
||||||
|
rfindfirst(hFind, NULL, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
|
printf("%d files copied\n", nFilesCopied);
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
main2(int argc, char **argv)
|
||||||
|
{
|
||||||
|
char cOption;
|
||||||
|
int i;
|
||||||
|
int OEMParallelPortInit(void);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Keep timezone conversions from getting in our way. All of the responses
|
||||||
|
// from the host are in local time anyways.
|
||||||
|
//
|
||||||
|
_daylight = 0;
|
||||||
|
_timezone = 0;
|
||||||
|
|
||||||
|
OEMParallelPortInit();
|
||||||
|
|
||||||
|
for (i = 1; i < argc; i++)
|
||||||
|
{
|
||||||
|
if (argv[i][0] == '-' || argv[i][0] == '/')
|
||||||
|
{
|
||||||
|
cOption = tolower(argv[i][1]);
|
||||||
|
|
||||||
|
switch (cOption)
|
||||||
|
{
|
||||||
|
case '?':
|
||||||
|
case 'h':
|
||||||
|
usage2(argv[0]);
|
||||||
|
break;
|
||||||
|
case 'd':
|
||||||
|
{
|
||||||
|
char *pszPath;
|
||||||
|
|
||||||
|
if (argv[i][2] != '\0')
|
||||||
|
{
|
||||||
|
pszPath = &argv[i][2];
|
||||||
|
if (*pszPath == ':')
|
||||||
|
{
|
||||||
|
pszPath++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (argc > (i+1) && argv[i+1][0] != '-' && argv[i+1][0] != '/')
|
||||||
|
{
|
||||||
|
pszPath = argv[i+1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pszPath = "*.*";
|
||||||
|
}
|
||||||
|
DisplayDirectory(pszPath);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 'g':
|
||||||
|
case 'r':
|
||||||
|
case 'u':
|
||||||
|
{
|
||||||
|
char *pszSource;
|
||||||
|
char *pszDestination;
|
||||||
|
|
||||||
|
if (argv[i][2] != '\0')
|
||||||
|
{
|
||||||
|
pszSource = &argv[i][2];
|
||||||
|
if (*pszSource == ':')
|
||||||
|
{
|
||||||
|
pszSource++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (argc > (i+1) && argv[i+1][0] != '-' && argv[i+1][0] != '/')
|
||||||
|
{
|
||||||
|
pszSource = argv[i+1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
printf("Error source path missing\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (argc > (i+1) && argv[i+1][0] != '-' && argv[i+1][0] != '/')
|
||||||
|
{
|
||||||
|
pszDestination = argv[i+1];
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
pszDestination = NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
GetFile(
|
||||||
|
pszSource, pszDestination,
|
||||||
|
cOption == 'r' ? COPY_FLAG_UPDATE_EXISTING :
|
||||||
|
cOption == 'u' ? COPY_FLAG_UPDATE_OR_ADD :
|
||||||
|
0);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
printf("%s: Unsupported option\n\n", argv[i]);
|
||||||
|
usage2(argv[0]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#if DEBUG
|
||||||
|
DumpCounters();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
7
DOS/Loadcepc.exe/SETUPENV.BAT
Normal file
7
DOS/Loadcepc.exe/SETUPENV.BAT
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
REM set __MSVCDIR=\\robertko\msvc15
|
||||||
|
set __MSVCDIR=e:\msvc15
|
||||||
|
|
||||||
|
set PATH=%__MSVCDIR%\bin;%PATH%;%_WINCEROOT%\sdk\bin\i386
|
||||||
|
set MSDevDir=%__MSVCDIR%
|
||||||
|
set lib=%__MSVCDIR%\lib
|
||||||
|
set include=%__MSVCDIR%\include
|
||||||
182
DOS/Loadcepc.exe/SMCHW.H
Normal file
182
DOS/Loadcepc.exe/SMCHW.H
Normal file
@ -0,0 +1,182 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
smchw.h
|
||||||
|
Abstract:
|
||||||
|
Definitions for the SMC9000 registers
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
#ifndef _SMCHW_H
|
||||||
|
#define _SMCHW_H
|
||||||
|
|
||||||
|
|
||||||
|
// These registers are in Bank 0 at the given offsets from the base address
|
||||||
|
// Since they are set up for 32-bit accesses, the offsets are multiplied by 2 from
|
||||||
|
// the numbers given in the SMC91C94 spec.
|
||||||
|
#define TCR_REG 0
|
||||||
|
#define EPHSTATUS_REG 2
|
||||||
|
#define RCR_REG 4
|
||||||
|
#define COUNTER_REG 6
|
||||||
|
#define MIR_REG 8
|
||||||
|
#define MCR_REG 10
|
||||||
|
// The register at offset 24 is reserved
|
||||||
|
// The bank select register is the same for all 4 banks
|
||||||
|
#define BANKSEL_REG 14
|
||||||
|
|
||||||
|
// Bank 1 registers
|
||||||
|
#define CONFIG_REG 0
|
||||||
|
#define BASE_REG 2
|
||||||
|
#define MACADDR_REG0 4
|
||||||
|
#define MACADDR_REG1 6
|
||||||
|
#define MACADDR_REG2 8
|
||||||
|
#define GENERAL_REG 10
|
||||||
|
#define CONTROL_REG 12
|
||||||
|
|
||||||
|
// Bank 2 _REGisters
|
||||||
|
#define MMUCOMMAND_REG 0
|
||||||
|
#define PNR_ARR_REG 2
|
||||||
|
#define FIFOPORTS_REG 4
|
||||||
|
#define POINTER_REG 6
|
||||||
|
#define DATA_REG 8
|
||||||
|
#define AUXDATA_REG 10
|
||||||
|
#define INTERRUPT_REG 12
|
||||||
|
#define INTERRUPT_MASK_REG 13
|
||||||
|
|
||||||
|
// Bank 3 registers
|
||||||
|
#define MULTITAB_REG0 0
|
||||||
|
#define MULTITAB_REG1 2
|
||||||
|
#define MULTITAB_REG2 4
|
||||||
|
#define MULTITAB_REG3 6
|
||||||
|
#define MGMT_REG 8
|
||||||
|
#define REVISION_REG 10
|
||||||
|
#define ERCV_REG 12
|
||||||
|
|
||||||
|
// These values are written to the bank select register to change banks.
|
||||||
|
#define BANK0 0x3300
|
||||||
|
#define BANK1 0x3301
|
||||||
|
#define BANK2 0x3302
|
||||||
|
#define BANK3 0x3303
|
||||||
|
|
||||||
|
// EPH Status reg (also used for TX status word)
|
||||||
|
#define EPH_UNDERRUN 0x8000 // Frame uderrun
|
||||||
|
#define EPH_LINKERROR 0x4000 // 10BASET link error condition
|
||||||
|
#define EPH_RXOVERRUN 0x2000 // Receiver overrun
|
||||||
|
#define EPH_COUNTER 0x1000 // Counter roll over
|
||||||
|
#define EPH_EXDEFER 0x0800 // Excessive deferral
|
||||||
|
#define EPH_CARRIER 0x0400 // Carrier not present
|
||||||
|
#define EPH_LATE 0x0200 // Late collision
|
||||||
|
#define EPH_DEFER 0x0080 // Frame was deferred
|
||||||
|
#define EPH_BCAST 0x0040 // Last frame was broadcast
|
||||||
|
#define EPH_SQET 0x0020 // Signal Quality Error
|
||||||
|
#define EPH_16COL 0x0010 // Too many collisions
|
||||||
|
#define EPH_MCAST 0x0008 // Last frame was multicast
|
||||||
|
#define EPH_MULTICOL 0x0004 // Multiple collisions on last frame
|
||||||
|
#define EPH_1COL 0x0002 // Single collision on last frame
|
||||||
|
#define EPH_TX_OK 0x0001 // Frame successfully transmitted
|
||||||
|
|
||||||
|
|
||||||
|
// MMU Commands
|
||||||
|
#define CMD_NOP 0 // No-Op command
|
||||||
|
#define CMD_ALLOC 0x0020 // Allocate memory
|
||||||
|
#define CMD_RESET 0x0040 // Reset MMU to initial state
|
||||||
|
#define CMD_REM_TOP 0x0060 // Remove frame from top of RX fifo
|
||||||
|
#define CMD_REM_REL_TOP 0x0080 // Remove and release top of RX fifo
|
||||||
|
#define CMD_REL_SPEC 0x00a0 // Release specific packet
|
||||||
|
#define CMD_ENQ_TX 0x00c0 // Enqueue to xmit fifo
|
||||||
|
#define CMD_ENQ_RX 0x00e0 // Reset xmit fifos (should only be done
|
||||||
|
// with transmitter disabled)
|
||||||
|
#define MMU_CMD_BUSY 0x0001 // MMU busy, don't modify PNR
|
||||||
|
|
||||||
|
// Allocation Result Register (low byte of PNR_ARR_REG)
|
||||||
|
#define ARR_FAIL 0x80 // Allocation failed
|
||||||
|
#define ARR_ALLOC_MSK 0x7f // Mask allocated packet number
|
||||||
|
// Actually 1fh but use full mask for
|
||||||
|
// upward compatibility.
|
||||||
|
|
||||||
|
// Pointer Register (POINTER_REG)
|
||||||
|
#define PTR_RCV 0x8000 // Access is to receive area
|
||||||
|
#define PTR_AUTO 0x4000 // Auto-increment on access
|
||||||
|
#define PTR_READ 0x2000 // =1 then read operation
|
||||||
|
// =0 then write operation
|
||||||
|
#define PTR_ETEN 0x1000 // Detect early transmit underrun
|
||||||
|
#define PTR_NOT_EMPTY 0x0800 // Write fifo not empty
|
||||||
|
#define PTR_OFFSET 0x03ff // Mask pointer value
|
||||||
|
|
||||||
|
// Fifo Ports Register (FIFOPORTS_REG)
|
||||||
|
#define FIFO_EMPTY 0x80 // No packet at top of fifo
|
||||||
|
#define FIFO_TX_PKT_MASK 0x7f // Mask top packet number
|
||||||
|
// Actually 1fh but use full mask for
|
||||||
|
// upward compatibility.
|
||||||
|
|
||||||
|
// Interrupt flags that can be set/acknowledged
|
||||||
|
#define ERCV_INT 0x0040
|
||||||
|
#define EPH_INT 0x0020
|
||||||
|
#define RX_OVRN_INT 0x0010
|
||||||
|
#define ALLOC_INT 0x0008
|
||||||
|
#define TXEMPTY_INT 0x0004
|
||||||
|
#define TX_INT 0x0002
|
||||||
|
#define RCV_INT 0x0001
|
||||||
|
|
||||||
|
// Interrupt mask bits, if these are set the interrupt is enabled
|
||||||
|
#define ERCV_INTM 0x4000
|
||||||
|
#define EPH_INTM 0x2000
|
||||||
|
#define RX_OVRN_INTM 0x1000
|
||||||
|
#define ALLOC_INTM 0x0800
|
||||||
|
#define TXEMPTY_INTM 0x0400
|
||||||
|
#define TX_INTM 0x0200
|
||||||
|
#define RCV_INTM 0x0100
|
||||||
|
|
||||||
|
// This value is used to intialize the Control Register (Pg 49 of the SMC91C94 spec):
|
||||||
|
// Bit 14 - RCV_BAD - Don't receive Frames with bad CRC
|
||||||
|
// Bit 13 - PWRDN - Don't go into power down mode
|
||||||
|
// Bit 11 - AUTO RELEASE - Do use the auto memory release feature for successfully transmitted Frames
|
||||||
|
// Bit 7 - LE ENABLE - Don't generate interrupts for link errors (merged through EPH_INT)
|
||||||
|
// Bit 6 - CR ENABLE - Don't generate interrupts for counter roll over (merged through EPH_INT)
|
||||||
|
// Bit 5 - TE ENABLE - Do generate interrupts for transmit errors (merged through EPH_INT)
|
||||||
|
// Bit 2 - EEPROM SELECT - Don't select the EEPROM
|
||||||
|
// Bit 1 - RELOAD - Don't reload EEPROM data
|
||||||
|
// Bit 0 - STORE - Don't store EEPROM data
|
||||||
|
#define CONTROL_REG_INIT 0x0920
|
||||||
|
|
||||||
|
// This value is used to intialize the Transmit Control Register (Pg 35 of the SMC91C94 spec):
|
||||||
|
// Bit 13 - EPH LOOP - Don't do EPH Internal Loopback
|
||||||
|
// Bit 12 - STP SQET - Don't stop transmission on SQET error
|
||||||
|
// DANGER - May need FDUPLX for IPX
|
||||||
|
// Bit 11 - FDUPLX - Don't use full duplex operation so that Frames sourced by this card are not received by it
|
||||||
|
// Bit 10 - MON_CSN - Don't monitor carrier while transmitting. Transmission will continue whether the card senses
|
||||||
|
// it's own carrier after the preamble or not.
|
||||||
|
// Bit 8 - NOCRC - Do insert the CRC at the end of transmitted frames automatically
|
||||||
|
// Bit 7 - PAD_EN - Do pad frames shorter than the minimum of 64 bytes automatically
|
||||||
|
// Bit 2 - FORCOL - Don't force a collision
|
||||||
|
// Bit 1 - LOOP - Don't loop back frames internally without transmitting
|
||||||
|
// Bit 0 - TXENA - Do enable transmission
|
||||||
|
#define TCR_REG_INIT 0x0081
|
||||||
|
|
||||||
|
// This value is used to initialize the Memory Configuration Register (Pg 42 of the SMC91C94 spec):
|
||||||
|
// Bits 7-0 - MEMORY RESERVED FOR TRANSMIT - Reserve memory for transmit purposes only. I need to
|
||||||
|
// reserve enough memory for one maximum sized Frame for transmission purposes. This will prevent
|
||||||
|
// deadlock conditions in which Frames keep coming in, but can't be acknowledged because of a lack of memory.
|
||||||
|
// The amount of memory reserved is calculated as MCR_REG_INIT * 256 * M, where M is 1 for the 91C94
|
||||||
|
// (pg 42 of the SMC91C94 spec.). So, for a 1500 byte frame, I need 1500 / 256 = 6 memory pages.
|
||||||
|
#define MCR_REG_INIT 0x0006
|
||||||
|
|
||||||
|
// This value is used to initialize the Receive Control Register (Pg 39 of the SMC91C94 spec):
|
||||||
|
// Bit 15 - SOFT RST - Don't do a soft reset
|
||||||
|
// Bit 14 - FILT_CAR - Don't filter the carrier signal
|
||||||
|
// Bit 9 - STRIP CRC - Don't strip the CRC from the Frame
|
||||||
|
// Bit 8 - RXEN - Do enable the Frame receiver
|
||||||
|
// Bit 2 - ALMUL - Don't accept all multicast frames
|
||||||
|
// Bit 1 - PRMS - Don't go into promiscuous mode
|
||||||
|
// Bit 0 - RX_ABORT - Write the receive abort flag low
|
||||||
|
// (set by a frame that was longer than 1532 bytes or out of buffer memory error)
|
||||||
|
#define RCR_REG_INIT 0x0100
|
||||||
|
|
||||||
|
|
||||||
|
#endif // _SMCHW_H
|
||||||
205
DOS/Loadcepc.exe/TRANSFER.ASM
Normal file
205
DOS/Loadcepc.exe/TRANSFER.ASM
Normal file
@ -0,0 +1,205 @@
|
|||||||
|
;***********************************************************************************************************
|
||||||
|
;
|
||||||
|
; Init.Asm - Boot Loader initialization code for x86 PC.
|
||||||
|
;
|
||||||
|
; Author: RBN
|
||||||
|
;
|
||||||
|
; Written 5/1/96
|
||||||
|
;
|
||||||
|
;***********************************************************************************************************
|
||||||
|
|
||||||
|
.486p
|
||||||
|
|
||||||
|
OpPrefix MACRO
|
||||||
|
db 66h
|
||||||
|
ENDM
|
||||||
|
|
||||||
|
_TEXT SEGMENT WORD PUBLIC USE16 'CODE'
|
||||||
|
|
||||||
|
FLAT_STACK_SIZE EQU 4000h
|
||||||
|
db FLAT_STACK_SIZE dup ( 0 )
|
||||||
|
FLAT_STACK_START equ $
|
||||||
|
|
||||||
|
;
|
||||||
|
; This static GDT contains 2 selectors - A flat code selector, and a flat data selector.
|
||||||
|
;
|
||||||
|
GDT_Data LABEL DWORD
|
||||||
|
db 0, 0, 0, 0, 0, 0, 0, 0 ; First GDT entry always unused
|
||||||
|
CS_FLAT_SEL EQU ($-GDT_Data)
|
||||||
|
db 0FFh, 0FFh, 00h, 00h, 00h, 10011010b, 11001111b, 00h ; Code
|
||||||
|
DS_FLAT_SEL EQU ($-GDT_Data)
|
||||||
|
db 0FFh, 0FFh, 00h, 00h, 00h, 10010010b, 11001111b, 00h ; Data
|
||||||
|
GDT_TABLE_SIZE = $ - OFFSET GDT_Data
|
||||||
|
|
||||||
|
;
|
||||||
|
; Limit + Pointer to the GDT
|
||||||
|
;
|
||||||
|
GDTPtr LABEL FWORD
|
||||||
|
dw GDT_TABLE_SIZE - 1 ; Limit of 0 = 1 byte
|
||||||
|
dd OFFSET GDT_Data
|
||||||
|
|
||||||
|
PModeEntrySeg dw SEG InPModeNow
|
||||||
|
|
||||||
|
PModeEntryOff dd OFFSET InPModeNow
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
;******************************************************************************
|
||||||
|
;
|
||||||
|
; Launch
|
||||||
|
;
|
||||||
|
; At this point, we are running in a 16-bit code segment.
|
||||||
|
; Since this code is written in a 16-bit code segment, we need to put an
|
||||||
|
; OpPrefix in front of all 32-bit instructions.
|
||||||
|
;
|
||||||
|
; This function jumps to InPModeNow to force CS to be reloaded with a
|
||||||
|
; valid PMode selector.
|
||||||
|
;
|
||||||
|
;******************************************************************************
|
||||||
|
|
||||||
|
Launch PROC NEAR C PUBLIC
|
||||||
|
|
||||||
|
cli ; Make sure we don't get any more interrupts
|
||||||
|
|
||||||
|
mov al, 0FFh ; Disable all PIC interrupts
|
||||||
|
out 021h, al
|
||||||
|
|
||||||
|
if 0
|
||||||
|
mov dx, 003FBh
|
||||||
|
mov al, 080h ; Access Baud Divisor
|
||||||
|
out dx, al
|
||||||
|
|
||||||
|
dec dx ; 3FAh
|
||||||
|
dec dx ; 3F9h
|
||||||
|
|
||||||
|
dec dx ; 3F8h
|
||||||
|
mov al, 002h ; 57600 Baud
|
||||||
|
out dx, al
|
||||||
|
|
||||||
|
inc dx ; 3F9h
|
||||||
|
xor al, al
|
||||||
|
out dx, al
|
||||||
|
|
||||||
|
inc dx ; 3FAh
|
||||||
|
|
||||||
|
inc dx ; 3FBh
|
||||||
|
mov al, 003h ; DLAB = 0, 8 bit, no parity
|
||||||
|
out dx, al
|
||||||
|
|
||||||
|
dec dx ; 3FAh
|
||||||
|
|
||||||
|
dec dx ; 3F9h
|
||||||
|
xor al, al ; No interrupts, polled
|
||||||
|
out dx, al
|
||||||
|
|
||||||
|
inc dx ; 3FAh
|
||||||
|
mov al, 001h ; Enable FIFO if present
|
||||||
|
out dx, al
|
||||||
|
|
||||||
|
inc dx ; 3FBh
|
||||||
|
|
||||||
|
inc dx ; 3FCh
|
||||||
|
mov al, 003h ; Assert DTR, RTS
|
||||||
|
out dx, al
|
||||||
|
|
||||||
|
mov dx, 03FDh
|
||||||
|
@@:
|
||||||
|
in al, dx ; Get Modem status
|
||||||
|
test al, 020h
|
||||||
|
jz @B
|
||||||
|
|
||||||
|
mov al, 'A'
|
||||||
|
mov dx, 03F8h
|
||||||
|
out dx, al
|
||||||
|
endif
|
||||||
|
|
||||||
|
;
|
||||||
|
; Since we were loaded by the DOS 16bit real-mode loader we need to
|
||||||
|
; manually relocate all references to linear addresses before we switch
|
||||||
|
; to protect mode.
|
||||||
|
;
|
||||||
|
|
||||||
|
xor ebx, ebx ; Clear upper word
|
||||||
|
mov bx, cs ; Our segment
|
||||||
|
shl ebx, 4 ; Convert segment to linear address
|
||||||
|
|
||||||
|
mov eax, DWORD PTR [GDTPtr + 2]
|
||||||
|
add eax, ebx
|
||||||
|
mov DWORD PTR [GDTPtr + 2], eax
|
||||||
|
|
||||||
|
xor eax, eax
|
||||||
|
mov ax, [PModeEntrySeg]
|
||||||
|
shl eax, 4
|
||||||
|
add eax, [PModeEntryOff]
|
||||||
|
mov [PModeLbl], eax
|
||||||
|
|
||||||
|
pop ax ; Remove return address from stack
|
||||||
|
pop edx ; Load entry point from arguments
|
||||||
|
pop esi ; Linear address of arguments
|
||||||
|
|
||||||
|
OpPrefix
|
||||||
|
lgdt FWORD PTR [GDTPtr] ; Load the GDTR
|
||||||
|
|
||||||
|
mov ecx, OFFSET FLAT_STACK_START
|
||||||
|
add ecx, ebx
|
||||||
|
|
||||||
|
;
|
||||||
|
; Don't need OpPrefix on mov to/from CR0 -- It's always 32-bit
|
||||||
|
;
|
||||||
|
mov eax, cr0 ; Get the current CR0
|
||||||
|
or al, 1 ; Set the PE bit to enable protected mode
|
||||||
|
mov cr0, eax ; NOW WE'RE IN PMODE!
|
||||||
|
|
||||||
|
OpPrefix
|
||||||
|
db 0EAh ; Far jump forces a selector lookup
|
||||||
|
PModeLbl dd 0
|
||||||
|
dw CS_FLAT_SEL
|
||||||
|
|
||||||
|
Launch ENDP
|
||||||
|
|
||||||
|
_TEXT ENDS
|
||||||
|
|
||||||
|
_TEXT32 SEGMENT WORD PUBLIC USE32 'CODE32'
|
||||||
|
|
||||||
|
;***********************************************************************************************************
|
||||||
|
;
|
||||||
|
; InPModeNow
|
||||||
|
;
|
||||||
|
; This function is responsible for setting up the data selectors and the stack and then jumping to main.
|
||||||
|
;
|
||||||
|
;***********************************************************************************************************
|
||||||
|
|
||||||
|
InPModeNow PROC NEAR
|
||||||
|
|
||||||
|
mov eax, DS_FLAT_SEL
|
||||||
|
mov ds, eax
|
||||||
|
mov es, eax
|
||||||
|
mov fs, eax
|
||||||
|
mov gs, eax
|
||||||
|
mov ss, eax
|
||||||
|
mov esp, ecx
|
||||||
|
|
||||||
|
push edx
|
||||||
|
|
||||||
|
mov edx, 001FFFFCh
|
||||||
|
mov dword ptr [edx], esi ; Save linear ptr to args in known location
|
||||||
|
|
||||||
|
if 0
|
||||||
|
mov dx, 03FDh
|
||||||
|
@@:
|
||||||
|
in al, dx ; Get Modem status
|
||||||
|
test al, 020h
|
||||||
|
jz @B
|
||||||
|
|
||||||
|
mov al, 'B'
|
||||||
|
mov dx, 03F8h
|
||||||
|
out dx, al
|
||||||
|
endif
|
||||||
|
|
||||||
|
ret ; Jump to entry point
|
||||||
|
|
||||||
|
InPModeNow ENDP
|
||||||
|
|
||||||
|
_TEXT32 ENDS
|
||||||
|
|
||||||
|
END
|
||||||
146
DOS/Loadcepc.exe/VIDEO.C
Normal file
146
DOS/Loadcepc.exe/VIDEO.C
Normal file
@ -0,0 +1,146 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Functions:
|
||||||
|
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "loadcepc.h"
|
||||||
|
#include "video.h"
|
||||||
|
|
||||||
|
#define VESAMODE480x200x256 0x101 /* VESA Mode 101 - 480x200x256 emulated in 640x480 */
|
||||||
|
#define VESAMODE640x480x256 0x101 /* VESA Mode 101 - 640x480x256 */
|
||||||
|
#define VESAMODE800x600x256 0x103 /* VESA Mode 103 - 800x600x256 */
|
||||||
|
#define VESAMODE1024x768x256 0x105 /* VESA Mode 105 - 1024x768x256 */
|
||||||
|
|
||||||
|
#define VESASCANLENGTH1024 1024 /* These VESA modes have the same scan length */
|
||||||
|
|
||||||
|
void mode320x200x256(void)
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
** Put the display into 320x200x256 colour mode and clear it
|
||||||
|
*/
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov ah, 0 ; Set video mode
|
||||||
|
mov al, 013h ; 320x200x256 and clear screen
|
||||||
|
int 10h ; set mode 13
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int isVesaSupported(void)
|
||||||
|
{
|
||||||
|
VESA_GENERAL_INFO vesaInfo, far *pVesaInfo = &vesaInfo;
|
||||||
|
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov ax, 04F00h ; Get VESA info
|
||||||
|
les di, pVesaInfo ; Pointer to info buffer
|
||||||
|
int 10h ; check for VESA
|
||||||
|
|
||||||
|
cmp ax, 0004Fh ; Was it successful?
|
||||||
|
jne noVesa
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
noVesa:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
int setVesaMode(int vesaMode, int scanLength)
|
||||||
|
{
|
||||||
|
__asm
|
||||||
|
{
|
||||||
|
mov ax, 04F02h ; VESA Set mode
|
||||||
|
mov bx, vesaMode ; Set given VESA Mode
|
||||||
|
int 10h ;
|
||||||
|
|
||||||
|
cmp ax, 0004Fh ; Was it successful?
|
||||||
|
jne failed
|
||||||
|
|
||||||
|
mov ax, 04F06h ; VESA Set logical scan line length
|
||||||
|
mov bl, 0
|
||||||
|
mov cx, scanLength ; Set so banks are an integral number lines
|
||||||
|
int 10h ; set VESA scan length
|
||||||
|
|
||||||
|
cmp ax, 0004Fh ; Was it successful?
|
||||||
|
jne failed
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
failed:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* SetVideoMode: maps from the user input 0-X to a VESA mode
|
||||||
|
** User VESA MODE
|
||||||
|
** Input
|
||||||
|
** 0 320x200x256 default mode, should work with any video card with 64K memory
|
||||||
|
** 1 480x240x256 non-standard VGA resolution, emulated in a 640x480 window.
|
||||||
|
** 2 640x480x256
|
||||||
|
** 3 800x600x256
|
||||||
|
** 4 1024x768x256
|
||||||
|
** 5 320x240x256 non-standard VGA resolution, emulated in a 640x480 window.
|
||||||
|
*/
|
||||||
|
|
||||||
|
UCHAR SetVideoMode(UCHAR desiredMode)
|
||||||
|
{
|
||||||
|
int vesaMode = 0;
|
||||||
|
int scanLength = VESASCANLENGTH1024;
|
||||||
|
|
||||||
|
if (desiredMode == 0)
|
||||||
|
{
|
||||||
|
/* In the default mode, there is no need to bank switch the card since only 64K required */
|
||||||
|
/* VESA is NOT required for this mode. */
|
||||||
|
goto defaultMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isVesaSupported())
|
||||||
|
{
|
||||||
|
/* Use VESA to put the video card into the appropriate mode */
|
||||||
|
switch (desiredMode)
|
||||||
|
{
|
||||||
|
case 0x01: /* 480x240x256 is emulated in a partial 640x480x256 screen */
|
||||||
|
case 0x02:
|
||||||
|
case 0x05: /* 240x320x256 is emulated in a partial 640x480x256 screen */
|
||||||
|
scanLength = VESASCANLENGTH1024; /* scan length for this mode */
|
||||||
|
vesaMode = VESAMODE640x480x256; /* VESA Mode 101 - 640x480x256 */
|
||||||
|
break;
|
||||||
|
case 0x03:
|
||||||
|
scanLength = VESASCANLENGTH1024; /* scan length for this mode */
|
||||||
|
vesaMode = VESAMODE800x600x256; /* VESA Mode 103 - 800x600x256 */
|
||||||
|
break;
|
||||||
|
case 0x04:
|
||||||
|
scanLength = VESASCANLENGTH1024; /* scan length for this mode */
|
||||||
|
vesaMode = VESAMODE1024x768x256; /* VESA Mode 105 - 1024x768x256 */
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
goto defaultMode;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* OK, setup the video card */
|
||||||
|
if (setVesaMode(vesaMode, scanLength))
|
||||||
|
{
|
||||||
|
return desiredMode; /* Successful setting of VESA mode */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
defaultMode:
|
||||||
|
mode320x200x256();
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
27
DOS/Loadcepc.exe/VIDEO.H
Normal file
27
DOS/Loadcepc.exe/VIDEO.H
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
#pragma pack(1)
|
||||||
|
typedef struct _VESA_GENERAL_INFO
|
||||||
|
{
|
||||||
|
UCHAR szSignature[4];
|
||||||
|
WORD wVersion;
|
||||||
|
UCHAR far * pszVendor;
|
||||||
|
DWORD dwCapabilities;
|
||||||
|
WORD far * pModeList;
|
||||||
|
WORD wTotalMemory;
|
||||||
|
UCHAR ucReserved[236];
|
||||||
|
} VESA_GENERAL_INFO;
|
||||||
|
|
||||||
|
typedef struct _VESA_MODE_INFO
|
||||||
|
{
|
||||||
|
WORD wModeAttributes;
|
||||||
|
UCHAR ucWindowAAttributes;
|
||||||
|
UCHAR ucWindowBAttributes;
|
||||||
|
WORD wWindowGranularity;
|
||||||
|
WORD wWindowSize;
|
||||||
|
WORD wWindowASegment;
|
||||||
|
WORD wWindowBSegment;
|
||||||
|
DWORD pWindowSchemeFunction;
|
||||||
|
WORD wBytesPerScanLine;
|
||||||
|
UCHAR ucReserved[238];
|
||||||
|
} VESA_MODE_INFO;
|
||||||
|
|
||||||
|
#pragma pack()
|
||||||
7
DOS/Loadcepc.exe/WDM.H
Normal file
7
DOS/Loadcepc.exe/WDM.H
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
int __cdecl _inp(unsigned);
|
||||||
|
int __cdecl _outp(unsigned, int);
|
||||||
|
|
||||||
|
#pragma intrinsic(_inp, _outp)
|
||||||
|
|
||||||
|
#define READ_PORT_UCHAR(a) _inp((unsigned)a)
|
||||||
|
#define WRITE_PORT_UCHAR(a, b) _outp((unsigned)a, (int)b)
|
||||||
30
DOS/Loadcepc.exe/WINDOWS.H
Normal file
30
DOS/Loadcepc.exe/WINDOWS.H
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
typedef struct _CRITICAL_SECTION
|
||||||
|
{
|
||||||
|
int iDummy;
|
||||||
|
} CRITICAL_SECTION, *LPCRITICAL_SECTION;
|
||||||
|
|
||||||
|
typedef unsigned long DWORD, *LPDWORD;
|
||||||
|
typedef unsigned long BOOL;
|
||||||
|
typedef char CHAR;
|
||||||
|
typedef unsigned char BYTE, *LPBYTE, UCHAR, *PUCHAR;
|
||||||
|
typedef unsigned short USHORT, *PUSHORT;
|
||||||
|
|
||||||
|
#define FALSE 0
|
||||||
|
#define TRUE 1
|
||||||
|
|
||||||
|
#define TEXT
|
||||||
|
#define VOID void
|
||||||
|
#define WCHAR char
|
||||||
|
#define TCHAR char
|
||||||
|
#define PTCHAR char *
|
||||||
|
|
||||||
|
#define strlenW strlen
|
||||||
|
|
||||||
|
#define OutputDebugString printf
|
||||||
|
#define NKDbgPrintfW printf
|
||||||
|
|
||||||
|
#define EnterCriticalSection(a)
|
||||||
|
#define LeaveCriticalSection(a)
|
||||||
408
DOS/Loadcepc.exe/XMSAPI.C
Normal file
408
DOS/Loadcepc.exe/XMSAPI.C
Normal file
@ -0,0 +1,408 @@
|
|||||||
|
/*++
|
||||||
|
THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF
|
||||||
|
ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO
|
||||||
|
THE IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A
|
||||||
|
PARTICULAR PURPOSE.
|
||||||
|
Copyright (c) 1995-1998 Microsoft Corporation
|
||||||
|
|
||||||
|
Module Name:
|
||||||
|
|
||||||
|
Abstract:
|
||||||
|
|
||||||
|
Functions:
|
||||||
|
|
||||||
|
|
||||||
|
Notes:
|
||||||
|
|
||||||
|
--*/
|
||||||
|
|
||||||
|
#include "xmsapi.h"
|
||||||
|
|
||||||
|
#pragma warning(disable:4704)
|
||||||
|
|
||||||
|
#pragma pack(1)
|
||||||
|
|
||||||
|
typedef struct _EXTENDED_MEMORY_MOVE
|
||||||
|
{
|
||||||
|
unsigned long ulLength;
|
||||||
|
unsigned int uiSourceHandle;
|
||||||
|
unsigned long ulSourceOffset;
|
||||||
|
unsigned int uiDestinationHandle;
|
||||||
|
unsigned long ulDestinationOffset;
|
||||||
|
|
||||||
|
} EXTENDED_MEMORY_MOVE, *PEXTENDED_MEMORY_MOVE;
|
||||||
|
|
||||||
|
#pragma pack()
|
||||||
|
|
||||||
|
int (far * XMSControl)() = 0;
|
||||||
|
|
||||||
|
struct
|
||||||
|
{
|
||||||
|
int iErrorCode;
|
||||||
|
char * pszErrorString;
|
||||||
|
}
|
||||||
|
XmsErrorMessages[] =
|
||||||
|
{
|
||||||
|
{ XMS_SUCCESS, "Success" },
|
||||||
|
|
||||||
|
{ XMS_E_NOT_IMPLEMENTED, "Not implemented" },
|
||||||
|
{ XMS_E_VDISK_DETECTED, "VDISK detected" },
|
||||||
|
{ XMS_E_A20_ERROR, "A20 error" },
|
||||||
|
|
||||||
|
{ XMS_W_NO_HMA, "No HMA" },
|
||||||
|
{ XMS_W_HMA_IN_USE, "HMA in use" },
|
||||||
|
{ XMS_W_HMA_DENIED, "HMA denied" },
|
||||||
|
{ XMS_W_HMA_NOT_ALLOCATED, "HMA not allocated" },
|
||||||
|
{ XMS_W_A20_STILL_ENABLED, "A20 still enabled" },
|
||||||
|
|
||||||
|
{ XMS_S_NO_FREE_EXTENDED_MEMORY, "No free extended memory" },
|
||||||
|
{ XMS_S_NO_FREE_HANDLES, "No free handles" },
|
||||||
|
{ XMS_S_INVALID_HANDLE, "Invalid handle" },
|
||||||
|
{ XMS_S_INVALID_SOURCE_HANDLE, "Invalid source handle" },
|
||||||
|
{ XMS_S_INVALID_SOURCE_OFFSET, "Invalid source offset" },
|
||||||
|
{ XMS_S_INVALID_DESTINATION_HANDLE, "Invalid destination handle" },
|
||||||
|
{ XMS_S_INVALID_DESTINATION_OFFSET, "Invalid destination offset" },
|
||||||
|
{ XMS_S_INVALID_LENGTH, "Invalid length" },
|
||||||
|
{ XMS_S_INVALID_OVERLAP, "Invalid overlap" },
|
||||||
|
{ XMS_S_PARITY_ERROR, "Parity error" },
|
||||||
|
{ XMS_S_BLOCK_LOCKED, "Block locked" },
|
||||||
|
{ XMS_S_HANDLE_LOCKED, "Handle locked" },
|
||||||
|
{ XMS_S_LOCK_COUNT_OVERFLOW, "Lock count overflow" },
|
||||||
|
{ XMS_S_LOCK_FAILED, "Lock failed" },
|
||||||
|
|
||||||
|
{ XMS_I_SMALLER_UMB_AVAILABLE, "Smaller UMB available" },
|
||||||
|
{ XMS_I_NO_UMBS_AVAILABLE, "No UMBs available" },
|
||||||
|
{ XMS_I_INVALID_UMB_SEGMENT, "Invalid UMB segment" }
|
||||||
|
};
|
||||||
|
|
||||||
|
#define N_XMS_ERROR_MESSAGES (sizeof(XmsErrorMessages) / sizeof(XmsErrorMessages[0]))
|
||||||
|
|
||||||
|
int
|
||||||
|
XmsIsInstalled()
|
||||||
|
{
|
||||||
|
int bInstalled = 0;
|
||||||
|
|
||||||
|
if (XMSControl != 0)
|
||||||
|
{
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
mov ax,4300h ; Check if XMS is present)
|
||||||
|
int 2Fh
|
||||||
|
xor ah,ah
|
||||||
|
cmp al,80h
|
||||||
|
jne done ; Nope - no point in continuing
|
||||||
|
|
||||||
|
mov ax,4310h ; Get XMS entry point
|
||||||
|
int 2Fh
|
||||||
|
mov WORD PTR [XMSControl], bx ; Save entry point
|
||||||
|
mov WORD PTR [XMSControl + 2], es
|
||||||
|
|
||||||
|
inc bInstalled ; Indicate installed
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
return bInstalled;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
XmsLocalEnableA20()
|
||||||
|
{
|
||||||
|
int xmsError = XMS_SUCCESS;
|
||||||
|
|
||||||
|
if (!XmsIsInstalled())
|
||||||
|
{
|
||||||
|
return XMS_E_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
mov ah, 05h
|
||||||
|
call [XMSControl]
|
||||||
|
clc
|
||||||
|
rcr al, 1
|
||||||
|
jc done
|
||||||
|
|
||||||
|
xor bh, bh
|
||||||
|
mov xmsError, bx
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
return xmsError;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
XmsLocalDisableA20()
|
||||||
|
{
|
||||||
|
int xmsError = XMS_SUCCESS;
|
||||||
|
|
||||||
|
if (!XmsIsInstalled())
|
||||||
|
{
|
||||||
|
return XMS_E_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
mov ah, 06h
|
||||||
|
call [XMSControl]
|
||||||
|
clc
|
||||||
|
rcr al, 1
|
||||||
|
jc done
|
||||||
|
|
||||||
|
xor bh, bh
|
||||||
|
mov xmsError, bx
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
return xmsError;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
XmsQueryA20(
|
||||||
|
int *pbEnabled)
|
||||||
|
{
|
||||||
|
int xmsError = XMS_SUCCESS;
|
||||||
|
|
||||||
|
if (!XmsIsInstalled())
|
||||||
|
{
|
||||||
|
return XMS_E_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
mov ah, 07h
|
||||||
|
call [XMSControl]
|
||||||
|
|
||||||
|
push si
|
||||||
|
mov si, pbEnabled
|
||||||
|
mov WORD PTR [si], ax
|
||||||
|
pop si
|
||||||
|
|
||||||
|
xor bh, bh
|
||||||
|
mov xmsError, bx
|
||||||
|
}
|
||||||
|
|
||||||
|
return xmsError;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
XmsQueryFreeExtendedMemory(
|
||||||
|
unsigned int *puiLargestFreeBlock,
|
||||||
|
unsigned int *puiTotalFree)
|
||||||
|
{
|
||||||
|
int xmsError = XMS_SUCCESS;
|
||||||
|
|
||||||
|
if (!XmsIsInstalled())
|
||||||
|
{
|
||||||
|
return XMS_E_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
mov ah, 08h
|
||||||
|
call [XMSControl]
|
||||||
|
|
||||||
|
push si
|
||||||
|
mov si, puiLargestFreeBlock
|
||||||
|
mov WORD PTR [si], ax
|
||||||
|
|
||||||
|
mov si, puiTotalFree
|
||||||
|
mov WORD PTR [si], dx
|
||||||
|
pop si
|
||||||
|
|
||||||
|
xor bh, bh
|
||||||
|
mov xmsError, bx
|
||||||
|
}
|
||||||
|
|
||||||
|
return xmsError;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
XmsAllocateExtendedMemory(
|
||||||
|
unsigned int uiBlockSizeK,
|
||||||
|
unsigned int * puiBlockHandle)
|
||||||
|
{
|
||||||
|
int xmsError = XMS_SUCCESS;
|
||||||
|
|
||||||
|
if (!XmsIsInstalled())
|
||||||
|
{
|
||||||
|
return XMS_E_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
mov ah, 09h
|
||||||
|
mov dx, uiBlockSizeK
|
||||||
|
call [XMSControl]
|
||||||
|
|
||||||
|
push si
|
||||||
|
mov si, puiBlockHandle
|
||||||
|
mov WORD PTR [si], dx
|
||||||
|
pop si
|
||||||
|
|
||||||
|
clc
|
||||||
|
rcr al, 1
|
||||||
|
jc done
|
||||||
|
|
||||||
|
xor bh, bh
|
||||||
|
mov xmsError, bx
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
return xmsError;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
XmsFreeExtendedMemory(
|
||||||
|
unsigned int uiBlockHandle)
|
||||||
|
{
|
||||||
|
int xmsError = XMS_SUCCESS;
|
||||||
|
|
||||||
|
if (!XmsIsInstalled())
|
||||||
|
{
|
||||||
|
return XMS_E_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
mov ah, 0Ah
|
||||||
|
mov dx, uiBlockHandle
|
||||||
|
call [XMSControl]
|
||||||
|
|
||||||
|
clc
|
||||||
|
rcr al, 1
|
||||||
|
jc done
|
||||||
|
|
||||||
|
xor bh, bh
|
||||||
|
mov xmsError, bx
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
return xmsError;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
XmsMoveExtendedMemory(
|
||||||
|
unsigned int uiSourceHandle,
|
||||||
|
unsigned long ulSourceOffset,
|
||||||
|
unsigned int uiDestinationHandle,
|
||||||
|
unsigned long ulDestinationOffset,
|
||||||
|
unsigned long ulLength)
|
||||||
|
{
|
||||||
|
EXTENDED_MEMORY_MOVE moveInfo;
|
||||||
|
|
||||||
|
int xmsError = XMS_SUCCESS;
|
||||||
|
|
||||||
|
if (!XmsIsInstalled())
|
||||||
|
{
|
||||||
|
return XMS_E_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
moveInfo.uiSourceHandle = uiSourceHandle;
|
||||||
|
moveInfo.ulSourceOffset = ulSourceOffset;
|
||||||
|
moveInfo.uiDestinationHandle = uiDestinationHandle;
|
||||||
|
moveInfo.ulDestinationOffset = ulDestinationOffset;
|
||||||
|
moveInfo.ulLength = ulLength;
|
||||||
|
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
mov ah, 0Bh
|
||||||
|
|
||||||
|
push si
|
||||||
|
lea si, moveInfo
|
||||||
|
call [XMSControl]
|
||||||
|
pop si
|
||||||
|
|
||||||
|
clc
|
||||||
|
rcr al, 1
|
||||||
|
jc done
|
||||||
|
|
||||||
|
xor bh, bh
|
||||||
|
mov xmsError, bx
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
return xmsError;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
XmsLockExtendedMemory(
|
||||||
|
unsigned int uiBlockHandle,
|
||||||
|
unsigned long * pulLinearAddress)
|
||||||
|
{
|
||||||
|
int xmsError = XMS_SUCCESS;
|
||||||
|
|
||||||
|
if (!XmsIsInstalled())
|
||||||
|
{
|
||||||
|
return XMS_E_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
mov ah, 0Ch
|
||||||
|
mov dx, uiBlockHandle
|
||||||
|
call [XMSControl]
|
||||||
|
|
||||||
|
push si
|
||||||
|
mov si, pulLinearAddress
|
||||||
|
mov WORD PTR [si], bx
|
||||||
|
mov WORD PTR [si + 2], dx
|
||||||
|
pop si
|
||||||
|
|
||||||
|
clc
|
||||||
|
rcr al, 1
|
||||||
|
jc done
|
||||||
|
|
||||||
|
xor bh, bh
|
||||||
|
mov xmsError, bx
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
return xmsError;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
XmsUnlockExtendedMemory(
|
||||||
|
unsigned int uiBlockHandle)
|
||||||
|
{
|
||||||
|
int xmsError = XMS_SUCCESS;
|
||||||
|
|
||||||
|
if (!XmsIsInstalled())
|
||||||
|
{
|
||||||
|
return XMS_E_NOT_IMPLEMENTED;
|
||||||
|
}
|
||||||
|
|
||||||
|
_asm
|
||||||
|
{
|
||||||
|
mov ah, 0Dh
|
||||||
|
mov dx, uiBlockHandle
|
||||||
|
call [XMSControl]
|
||||||
|
|
||||||
|
clc
|
||||||
|
rcr al, 1
|
||||||
|
jc done
|
||||||
|
|
||||||
|
xor bh, bh
|
||||||
|
mov xmsError, bx
|
||||||
|
}
|
||||||
|
|
||||||
|
done:
|
||||||
|
return xmsError;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *XmsErrorString(int xmsError)
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < N_XMS_ERROR_MESSAGES; i++)
|
||||||
|
{
|
||||||
|
if (XmsErrorMessages[i].iErrorCode == xmsError)
|
||||||
|
{
|
||||||
|
return XmsErrorMessages[i].pszErrorString;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "Unknown error";
|
||||||
|
}
|
||||||
62
DOS/Loadcepc.exe/XMSAPI.H
Normal file
62
DOS/Loadcepc.exe/XMSAPI.H
Normal file
@ -0,0 +1,62 @@
|
|||||||
|
#define XMS_SUCCESS 0x00
|
||||||
|
|
||||||
|
#define XMS_E_NOT_IMPLEMENTED 0x80
|
||||||
|
#define XMS_E_VDISK_DETECTED 0x81
|
||||||
|
#define XMS_E_A20_ERROR 0x82
|
||||||
|
|
||||||
|
#define XMS_W_NO_HMA 0x90
|
||||||
|
#define XMS_W_HMA_IN_USE 0x91
|
||||||
|
#define XMS_W_HMA_DENIED 0x92
|
||||||
|
#define XMS_W_HMA_NOT_ALLOCATED 0x93
|
||||||
|
#define XMS_W_A20_STILL_ENABLED 0x94
|
||||||
|
|
||||||
|
#define XMS_S_NO_FREE_EXTENDED_MEMORY 0xA0
|
||||||
|
#define XMS_S_NO_FREE_HANDLES 0xA1
|
||||||
|
#define XMS_S_INVALID_HANDLE 0xA2
|
||||||
|
#define XMS_S_INVALID_SOURCE_HANDLE 0xA3
|
||||||
|
#define XMS_S_INVALID_SOURCE_OFFSET 0xA4
|
||||||
|
#define XMS_S_INVALID_DESTINATION_HANDLE 0xA5
|
||||||
|
#define XMS_S_INVALID_DESTINATION_OFFSET 0xA6
|
||||||
|
#define XMS_S_INVALID_LENGTH 0xA7
|
||||||
|
#define XMS_S_INVALID_OVERLAP 0xA8
|
||||||
|
#define XMS_S_PARITY_ERROR 0xA9
|
||||||
|
#define XMS_S_BLOCK_LOCKED 0xAA
|
||||||
|
#define XMS_S_HANDLE_LOCKED 0xAB
|
||||||
|
#define XMS_S_LOCK_COUNT_OVERFLOW 0xAC
|
||||||
|
#define XMS_S_LOCK_FAILED 0xAD
|
||||||
|
|
||||||
|
#define XMS_I_SMALLER_UMB_AVAILABLE 0xB0
|
||||||
|
#define XMS_I_NO_UMBS_AVAILABLE 0xB1
|
||||||
|
#define XMS_I_INVALID_UMB_SEGMENT 0xB2
|
||||||
|
|
||||||
|
int XmsIsInstalled();
|
||||||
|
|
||||||
|
int XmsLocalEnableA20();
|
||||||
|
|
||||||
|
int XmsLocalDisableA20();
|
||||||
|
|
||||||
|
int XmsQueryA20(
|
||||||
|
int *pbEnabled);
|
||||||
|
|
||||||
|
int XmsQueryFreeExtendedMemory(
|
||||||
|
unsigned int *puiLargestFreeBlock, unsigned int *puiTotalFree);
|
||||||
|
|
||||||
|
int XmsAllocateExtendedMemory(
|
||||||
|
unsigned int uiBlockSizeK, unsigned int * puiBlockHandle);
|
||||||
|
|
||||||
|
int XmsFreeExtendedMemory(
|
||||||
|
unsigned int uiBlockHandle);
|
||||||
|
|
||||||
|
int XmsMoveExtendedMemory(
|
||||||
|
unsigned int uiSourceHandle, unsigned long ulSourceOffset,
|
||||||
|
unsigned int uiDestinationHandle, unsigned long ulDestinationOffset,
|
||||||
|
unsigned long ulLength);
|
||||||
|
|
||||||
|
int XmsLockExtendedMemory(
|
||||||
|
unsigned int uiBlockHandle,
|
||||||
|
unsigned long * pulLinearAddress);
|
||||||
|
|
||||||
|
int XmsUnlockExtendedMemory(
|
||||||
|
unsigned int uiBlockHandle);
|
||||||
|
|
||||||
|
char *XmsErrorString();
|
||||||
11
DOS/exitLogo.com/exitLogo.asm
Normal file
11
DOS/exitLogo.com/exitLogo.asm
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
main:
|
||||||
|
mov AX, 4A32h
|
||||||
|
mov BL, byte 3
|
||||||
|
int 2fh
|
||||||
|
|
||||||
|
mov AX, 4A32h
|
||||||
|
mov BL, byte 5
|
||||||
|
int 2fh
|
||||||
|
|
||||||
|
mov ah,4ch
|
||||||
|
int 21h
|
||||||
20
WNT/about/Release/about.Build.CppClean.log
Normal file
20
WNT/about/Release/about.Build.CppClean.log
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\release\about.ipdb
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\release\about.iobj
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.pch
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\vc141.pdb
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\pch.obj
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\aboutdlg.obj
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.obj
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\release\about.exe
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\release\about.pdb
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.res
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.tlog\about.write.1u.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.tlog\cl.command.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.tlog\cl.read.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.tlog\cl.write.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.tlog\link.command.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.tlog\link.read.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.tlog\link.write.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.tlog\rc.command.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.tlog\rc.read.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\about\release\about.tlog\rc.write.1.tlog
|
||||||
7
WNT/about/Release/about.log
Normal file
7
WNT/about/Release/about.log
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141_xp\Toolset.targets(39,5): warning MSB8051: 面向 Windows XP 的支持已被弃用,将来的 Visual Studio 版本不再提供该支持。请访问 https://go.microsoft.com/fwlink/?linkid=2023588,获取详细信息。
|
||||||
|
正在生成代码
|
||||||
|
0 of 201 functions ( 0.0%) were compiled, the rest were copied from previous compilation.
|
||||||
|
0 functions were new in current compilation
|
||||||
|
0 functions had inline decision re-evaluated but remain unchanged
|
||||||
|
已完成代码的生成
|
||||||
|
about.vcxproj -> C:\Users\351\Documents\Visual Studio 2017\Projects\cec20\Release\about.exe
|
||||||
BIN
WNT/about/Release/about.obj
Normal file
BIN
WNT/about/Release/about.obj
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.pch
Normal file
BIN
WNT/about/Release/about.pch
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.res
Normal file
BIN
WNT/about/Release/about.res
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.tlog/CL.command.1.tlog
Normal file
BIN
WNT/about/Release/about.tlog/CL.command.1.tlog
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.tlog/CL.read.1.tlog
Normal file
BIN
WNT/about/Release/about.tlog/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.tlog/CL.write.1.tlog
Normal file
BIN
WNT/about/Release/about.tlog/CL.write.1.tlog
Normal file
Binary file not shown.
2
WNT/about/Release/about.tlog/about.lastbuildstate
Normal file
2
WNT/about/Release/about.tlog/about.lastbuildstate
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141_xp:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=7.0
|
||||||
|
Release|Win32|C:\Users\351\Documents\Visual Studio 2017\Projects\cec20\|
|
||||||
BIN
WNT/about/Release/about.tlog/about.write.1u.tlog
Normal file
BIN
WNT/about/Release/about.tlog/about.write.1u.tlog
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.tlog/link.command.1.tlog
Normal file
BIN
WNT/about/Release/about.tlog/link.command.1.tlog
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.tlog/link.read.1.tlog
Normal file
BIN
WNT/about/Release/about.tlog/link.read.1.tlog
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.tlog/link.write.1.tlog
Normal file
BIN
WNT/about/Release/about.tlog/link.write.1.tlog
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.tlog/rc.command.1.tlog
Normal file
BIN
WNT/about/Release/about.tlog/rc.command.1.tlog
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.tlog/rc.read.1.tlog
Normal file
BIN
WNT/about/Release/about.tlog/rc.read.1.tlog
Normal file
Binary file not shown.
BIN
WNT/about/Release/about.tlog/rc.write.1.tlog
Normal file
BIN
WNT/about/Release/about.tlog/rc.write.1.tlog
Normal file
Binary file not shown.
BIN
WNT/about/Release/aboutDlg.obj
Normal file
BIN
WNT/about/Release/aboutDlg.obj
Normal file
Binary file not shown.
BIN
WNT/about/Release/pch.obj
Normal file
BIN
WNT/about/Release/pch.obj
Normal file
Binary file not shown.
BIN
WNT/about/Release/vc141.pdb
Normal file
BIN
WNT/about/Release/vc141.pdb
Normal file
Binary file not shown.
BIN
WNT/about/about.aps
Normal file
BIN
WNT/about/about.aps
Normal file
Binary file not shown.
107
WNT/about/about.cpp
Normal file
107
WNT/about/about.cpp
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
|
||||||
|
// about.cpp: 定义应用程序的类行为。
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
#include "framework.h"
|
||||||
|
#include "about.h"
|
||||||
|
#include "aboutDlg.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// CaboutApp
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CaboutApp, CWinApp)
|
||||||
|
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CaboutApp 构造
|
||||||
|
|
||||||
|
CaboutApp::CaboutApp()
|
||||||
|
{
|
||||||
|
// 支持重新启动管理器
|
||||||
|
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||||
|
|
||||||
|
// TODO: 在此处添加构造代码,
|
||||||
|
// 将所有重要的初始化放置在 InitInstance 中
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 唯一的 CaboutApp 对象
|
||||||
|
|
||||||
|
CaboutApp theApp;
|
||||||
|
|
||||||
|
|
||||||
|
// CaboutApp 初始化
|
||||||
|
|
||||||
|
BOOL CaboutApp::InitInstance()
|
||||||
|
{
|
||||||
|
// 如果一个运行在 Windows XP 上的应用程序清单指定要
|
||||||
|
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
|
||||||
|
//则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
|
||||||
|
INITCOMMONCONTROLSEX InitCtrls;
|
||||||
|
InitCtrls.dwSize = sizeof(InitCtrls);
|
||||||
|
// 将它设置为包括所有要在应用程序中使用的
|
||||||
|
// 公共控件类。
|
||||||
|
InitCtrls.dwICC = ICC_WIN95_CLASSES;
|
||||||
|
InitCommonControlsEx(&InitCtrls);
|
||||||
|
|
||||||
|
CWinApp::InitInstance();
|
||||||
|
|
||||||
|
|
||||||
|
AfxEnableControlContainer();
|
||||||
|
|
||||||
|
// 创建 shell 管理器,以防对话框包含
|
||||||
|
// 任何 shell 树视图控件或 shell 列表视图控件。
|
||||||
|
CShellManager *pShellManager = new CShellManager;
|
||||||
|
|
||||||
|
// 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
|
||||||
|
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
|
||||||
|
|
||||||
|
// 标准初始化
|
||||||
|
// 如果未使用这些功能并希望减小
|
||||||
|
// 最终可执行文件的大小,则应移除下列
|
||||||
|
// 不需要的特定初始化例程
|
||||||
|
// 更改用于存储设置的注册表项
|
||||||
|
// TODO: 应适当修改该字符串,
|
||||||
|
// 例如修改为公司或组织名
|
||||||
|
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
|
||||||
|
|
||||||
|
CaboutDlg dlg;
|
||||||
|
m_pMainWnd = &dlg;
|
||||||
|
INT_PTR nResponse = dlg.DoModal();
|
||||||
|
if (nResponse == IDOK)
|
||||||
|
{
|
||||||
|
// TODO: 在此放置处理何时用
|
||||||
|
// “确定”来关闭对话框的代码
|
||||||
|
}
|
||||||
|
else if (nResponse == IDCANCEL)
|
||||||
|
{
|
||||||
|
// TODO: 在此放置处理何时用
|
||||||
|
// “取消”来关闭对话框的代码
|
||||||
|
}
|
||||||
|
else if (nResponse == -1)
|
||||||
|
{
|
||||||
|
TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
|
||||||
|
TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除上面创建的 shell 管理器。
|
||||||
|
if (pShellManager != nullptr)
|
||||||
|
{
|
||||||
|
delete pShellManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
|
||||||
|
ControlBarCleanUp();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
|
||||||
|
// 而不是启动应用程序的消息泵。
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
32
WNT/about/about.h
Normal file
32
WNT/about/about.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
// about.h: PROJECT_NAME 应用程序的主头文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __AFXWIN_H__
|
||||||
|
#error "include 'pch.h' before including this file for PCH"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "resource.h" // 主符号
|
||||||
|
|
||||||
|
|
||||||
|
// CaboutApp:
|
||||||
|
// 有关此类的实现,请参阅 about.cpp
|
||||||
|
//
|
||||||
|
|
||||||
|
class CaboutApp : public CWinApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
CaboutApp();
|
||||||
|
|
||||||
|
// 重写
|
||||||
|
public:
|
||||||
|
virtual BOOL InitInstance();
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
extern CaboutApp theApp;
|
||||||
BIN
WNT/about/about.rc
Normal file
BIN
WNT/about/about.rc
Normal file
Binary file not shown.
221
WNT/about/about.vcxproj
Normal file
221
WNT/about/about.vcxproj
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
|
<ProjectGuid>{1839CDDC-A7DA-4657-81A3-AF3F799C97F7}</ProjectGuid>
|
||||||
|
<Keyword>MFCProj</Keyword>
|
||||||
|
<RootNamespace>about</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Static</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="about.h" />
|
||||||
|
<ClInclude Include="aboutDlg.h" />
|
||||||
|
<ClInclude Include="framework.h" />
|
||||||
|
<ClInclude Include="pch.h" />
|
||||||
|
<ClInclude Include="Resource.h" />
|
||||||
|
<ClInclude Include="targetver.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="about.cpp" />
|
||||||
|
<ClCompile Include="aboutDlg.cpp" />
|
||||||
|
<ClCompile Include="pch.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="about.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res\about.rc2" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="E:\Desktop\background - 副本 (2).bmp" />
|
||||||
|
<Image Include="res\about.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
66
WNT/about/about.vcxproj.filters
Normal file
66
WNT/about/about.vcxproj.filters
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="源文件">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="头文件">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="资源文件">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="about.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="aboutDlg.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="framework.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="targetver.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Resource.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="pch.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="about.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="aboutDlg.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pch.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="about.rc">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res\about.rc2">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="res\about.ico">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</Image>
|
||||||
|
<Image Include="E:\Desktop\background - 副本 (2).bmp">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</Image>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
6
WNT/about/about.vcxproj.user
Normal file
6
WNT/about/about.vcxproj.user
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<RESOURCE_FILE>about.rc</RESOURCE_FILE>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
89
WNT/about/aboutDlg.cpp
Normal file
89
WNT/about/aboutDlg.cpp
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
|
||||||
|
// aboutDlg.cpp: 实现文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
#include "framework.h"
|
||||||
|
#include "about.h"
|
||||||
|
#include "aboutDlg.h"
|
||||||
|
#include "afxdialogex.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// CaboutDlg 对话框
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
CaboutDlg::CaboutDlg(CWnd* pParent /*=nullptr*/)
|
||||||
|
: CDialogEx(IDD_ABOUT_DIALOG, pParent)
|
||||||
|
{
|
||||||
|
//m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void CaboutDlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialogEx::DoDataExchange(pDX);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(CaboutDlg, CDialogEx)
|
||||||
|
ON_WM_PAINT()
|
||||||
|
ON_WM_QUERYDRAGICON()
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// CaboutDlg 消息处理程序
|
||||||
|
|
||||||
|
BOOL CaboutDlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialogEx::OnInitDialog();
|
||||||
|
|
||||||
|
// 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
|
||||||
|
// 执行此操作
|
||||||
|
SetIcon(m_hIcon, TRUE); // 设置大图标
|
||||||
|
SetIcon(m_hIcon, FALSE); // 设置小图标
|
||||||
|
|
||||||
|
// TODO: 在此添加额外的初始化代码
|
||||||
|
SetWindowLong(m_hWnd, GWL_STYLE, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX);
|
||||||
|
|
||||||
|
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果向对话框添加最小化按钮,则需要下面的代码
|
||||||
|
// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
|
||||||
|
// 这将由框架自动完成。
|
||||||
|
|
||||||
|
void CaboutDlg::OnPaint()
|
||||||
|
{
|
||||||
|
if (IsIconic())
|
||||||
|
{
|
||||||
|
CPaintDC dc(this); // 用于绘制的设备上下文
|
||||||
|
|
||||||
|
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
||||||
|
|
||||||
|
// 使图标在工作区矩形中居中
|
||||||
|
int cxIcon = GetSystemMetrics(SM_CXICON);
|
||||||
|
int cyIcon = GetSystemMetrics(SM_CYICON);
|
||||||
|
CRect rect;
|
||||||
|
GetClientRect(&rect);
|
||||||
|
int x = (rect.Width() - cxIcon + 1) / 2;
|
||||||
|
int y = (rect.Height() - cyIcon + 1) / 2;
|
||||||
|
|
||||||
|
// 绘制图标
|
||||||
|
dc.DrawIcon(x, y, m_hIcon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CDialogEx::OnPaint();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//当用户拖动最小化窗口时系统调用此函数取得光标
|
||||||
|
//显示。
|
||||||
|
HCURSOR CaboutDlg::OnQueryDragIcon()
|
||||||
|
{
|
||||||
|
return static_cast<HCURSOR>(m_hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
33
WNT/about/aboutDlg.h
Normal file
33
WNT/about/aboutDlg.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
|
||||||
|
// aboutDlg.h: 头文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
// CaboutDlg 对话框
|
||||||
|
class CaboutDlg : public CDialogEx
|
||||||
|
{
|
||||||
|
// 构造
|
||||||
|
public:
|
||||||
|
CaboutDlg(CWnd* pParent = nullptr); // 标准构造函数
|
||||||
|
|
||||||
|
// 对话框数据
|
||||||
|
#ifdef AFX_DESIGN_TIME
|
||||||
|
enum { IDD = IDD_ABOUT_DIALOG };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
protected:
|
||||||
|
HICON m_hIcon;
|
||||||
|
|
||||||
|
// 生成的消息映射函数
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnPaint();
|
||||||
|
afx_msg HCURSOR OnQueryDragIcon();
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
49
WNT/about/framework.h
Normal file
49
WNT/about/framework.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef VC_EXTRALEAN
|
||||||
|
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "targetver.h"
|
||||||
|
|
||||||
|
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
|
||||||
|
|
||||||
|
// 关闭 MFC 的一些常见且经常可放心忽略的隐藏警告消息
|
||||||
|
#define _AFX_ALL_WARNINGS
|
||||||
|
|
||||||
|
#include <afxwin.h> // MFC 核心组件和标准组件
|
||||||
|
#include <afxext.h> // MFC 扩展
|
||||||
|
|
||||||
|
|
||||||
|
#include <afxdisp.h> // MFC 自动化类
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _AFX_NO_OLE_SUPPORT
|
||||||
|
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
|
||||||
|
#endif
|
||||||
|
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
|
||||||
|
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
|
||||||
|
#include <afxcontrolbars.h> // MFC 支持功能区和控制条
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _UNICODE
|
||||||
|
#if defined _M_IX86
|
||||||
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
#elif defined _M_X64
|
||||||
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
#else
|
||||||
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
5
WNT/about/pch.cpp
Normal file
5
WNT/about/pch.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// pch.cpp: 与预编译标头对应的源文件
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
// 当使用预编译的头时,需要使用此源文件,编译才能成功。
|
||||||
13
WNT/about/pch.h
Normal file
13
WNT/about/pch.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// pch.h: 这是预编译标头文件。
|
||||||
|
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
|
||||||
|
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
|
||||||
|
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
|
||||||
|
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
|
||||||
|
|
||||||
|
#ifndef PCH_H
|
||||||
|
#define PCH_H
|
||||||
|
|
||||||
|
// 添加要在此处预编译的标头
|
||||||
|
#include "framework.h"
|
||||||
|
|
||||||
|
#endif //PCH_H
|
||||||
BIN
WNT/about/res/about.ico
Normal file
BIN
WNT/about/res/about.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 66 KiB |
BIN
WNT/about/res/about.rc2
Normal file
BIN
WNT/about/res/about.rc2
Normal file
Binary file not shown.
17
WNT/about/resource.h
Normal file
17
WNT/about/resource.h
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ 生成的包含文件。
|
||||||
|
// 供 about.rc 使用
|
||||||
|
//
|
||||||
|
#define IDD_ABOUT_DIALOG 102
|
||||||
|
#define IDB_BITMAP1 130
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1002
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
8
WNT/about/targetver.h
Normal file
8
WNT/about/targetver.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
|
||||||
|
|
||||||
|
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
|
||||||
|
// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
|
||||||
|
|
||||||
|
#include <SDKDDKVer.h>
|
||||||
20
WNT/menu.exe/Release/menu2.Build.CppClean.log
Normal file
20
WNT/menu.exe/Release/menu2.Build.CppClean.log
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.pch
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\vc141.pdb
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\pch.obj
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2dlg.obj
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.obj
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\release\menu2.exe
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\release\menu2.pdb
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\release\menu2.ipdb
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\release\menu2.iobj
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.res
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.tlog\cl.command.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.tlog\cl.read.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.tlog\cl.write.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.tlog\link.command.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.tlog\link.read.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.tlog\link.write.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.tlog\menu2.write.1u.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.tlog\rc.command.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.tlog\rc.read.1.tlog
|
||||||
|
c:\users\351\documents\visual studio 2017\projects\cec20\menu2\release\menu2.tlog\rc.write.1.tlog
|
||||||
8
WNT/menu.exe/Release/menu2.log
Normal file
8
WNT/menu.exe/Release/menu2.log
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\IDE\VC\VCTargets\Platforms\Win32\PlatformToolsets\v141_xp\Toolset.targets(39,5): warning MSB8051: 面向 Windows XP 的支持已被弃用,将来的 Visual Studio 版本不再提供该支持。请访问 https://go.microsoft.com/fwlink/?linkid=2023588,获取详细信息。
|
||||||
|
pch.cpp
|
||||||
|
menu2.cpp
|
||||||
|
menu2Dlg.cpp
|
||||||
|
正在生成代码
|
||||||
|
All 233 functions were compiled because no usable IPDB/IOBJ from previous compilation was found.
|
||||||
|
已完成代码的生成
|
||||||
|
menu2.vcxproj -> C:\Users\351\Documents\Visual Studio 2017\Projects\cec20\Release\menu2.exe
|
||||||
BIN
WNT/menu.exe/Release/menu2.obj
Normal file
BIN
WNT/menu.exe/Release/menu2.obj
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.pch
Normal file
BIN
WNT/menu.exe/Release/menu2.pch
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.res
Normal file
BIN
WNT/menu.exe/Release/menu2.res
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.tlog/CL.command.1.tlog
Normal file
BIN
WNT/menu.exe/Release/menu2.tlog/CL.command.1.tlog
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.tlog/CL.read.1.tlog
Normal file
BIN
WNT/menu.exe/Release/menu2.tlog/CL.read.1.tlog
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.tlog/CL.write.1.tlog
Normal file
BIN
WNT/menu.exe/Release/menu2.tlog/CL.write.1.tlog
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.tlog/link.command.1.tlog
Normal file
BIN
WNT/menu.exe/Release/menu2.tlog/link.command.1.tlog
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.tlog/link.read.1.tlog
Normal file
BIN
WNT/menu.exe/Release/menu2.tlog/link.read.1.tlog
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.tlog/link.write.1.tlog
Normal file
BIN
WNT/menu.exe/Release/menu2.tlog/link.write.1.tlog
Normal file
Binary file not shown.
2
WNT/menu.exe/Release/menu2.tlog/menu2.lastbuildstate
Normal file
2
WNT/menu.exe/Release/menu2.tlog/menu2.lastbuildstate
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
#TargetFrameworkVersion=v4.0:PlatformToolSet=v141_xp:EnableManagedIncrementalBuild=false:VCToolArchitecture=Native32Bit:WindowsTargetPlatformVersion=7.0
|
||||||
|
Release|Win32|C:\Users\351\Documents\Visual Studio 2017\Projects\cec20\|
|
||||||
BIN
WNT/menu.exe/Release/menu2.tlog/menu2.write.1u.tlog
Normal file
BIN
WNT/menu.exe/Release/menu2.tlog/menu2.write.1u.tlog
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.tlog/rc.command.1.tlog
Normal file
BIN
WNT/menu.exe/Release/menu2.tlog/rc.command.1.tlog
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.tlog/rc.read.1.tlog
Normal file
BIN
WNT/menu.exe/Release/menu2.tlog/rc.read.1.tlog
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2.tlog/rc.write.1.tlog
Normal file
BIN
WNT/menu.exe/Release/menu2.tlog/rc.write.1.tlog
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/menu2Dlg.obj
Normal file
BIN
WNT/menu.exe/Release/menu2Dlg.obj
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/pch.obj
Normal file
BIN
WNT/menu.exe/Release/pch.obj
Normal file
Binary file not shown.
BIN
WNT/menu.exe/Release/vc141.pdb
Normal file
BIN
WNT/menu.exe/Release/vc141.pdb
Normal file
Binary file not shown.
49
WNT/menu.exe/framework.h
Normal file
49
WNT/menu.exe/framework.h
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef VC_EXTRALEAN
|
||||||
|
#define VC_EXTRALEAN // 从 Windows 头中排除极少使用的资料
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "targetver.h"
|
||||||
|
|
||||||
|
#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 构造函数将是显式的
|
||||||
|
|
||||||
|
// 关闭 MFC 的一些常见且经常可放心忽略的隐藏警告消息
|
||||||
|
#define _AFX_ALL_WARNINGS
|
||||||
|
|
||||||
|
#include <afxwin.h> // MFC 核心组件和标准组件
|
||||||
|
#include <afxext.h> // MFC 扩展
|
||||||
|
|
||||||
|
|
||||||
|
#include <afxdisp.h> // MFC 自动化类
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef _AFX_NO_OLE_SUPPORT
|
||||||
|
#include <afxdtctl.h> // MFC 对 Internet Explorer 4 公共控件的支持
|
||||||
|
#endif
|
||||||
|
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
#include <afxcmn.h> // MFC 对 Windows 公共控件的支持
|
||||||
|
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||||
|
|
||||||
|
#include <afxcontrolbars.h> // MFC 支持功能区和控制条
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _UNICODE
|
||||||
|
#if defined _M_IX86
|
||||||
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
#elif defined _M_X64
|
||||||
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
#else
|
||||||
|
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
5
WNT/menu.exe/menu.enus
Normal file
5
WNT/menu.exe/menu.enus
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
[1]
|
||||||
|
fat=0
|
||||||
|
name="CE"
|
||||||
|
cmd="DeviceEmulator.exe"
|
||||||
|
para="..\ARMV4\WM65PPC.bin"
|
||||||
BIN
WNT/menu.exe/menu2.aps
Normal file
BIN
WNT/menu.exe/menu2.aps
Normal file
Binary file not shown.
107
WNT/menu.exe/menu2.cpp
Normal file
107
WNT/menu.exe/menu2.cpp
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
|
||||||
|
// menu2.cpp: 定义应用程序的类行为。
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
#include "framework.h"
|
||||||
|
#include "menu2.h"
|
||||||
|
#include "menu2Dlg.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
// Cmenu2App
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(Cmenu2App, CWinApp)
|
||||||
|
ON_COMMAND(ID_HELP, &CWinApp::OnHelp)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// Cmenu2App 构造
|
||||||
|
|
||||||
|
Cmenu2App::Cmenu2App()
|
||||||
|
{
|
||||||
|
// 支持重新启动管理器
|
||||||
|
m_dwRestartManagerSupportFlags = AFX_RESTART_MANAGER_SUPPORT_RESTART;
|
||||||
|
|
||||||
|
// TODO: 在此处添加构造代码,
|
||||||
|
// 将所有重要的初始化放置在 InitInstance 中
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 唯一的 Cmenu2App 对象
|
||||||
|
|
||||||
|
Cmenu2App theApp;
|
||||||
|
|
||||||
|
|
||||||
|
// Cmenu2App 初始化
|
||||||
|
|
||||||
|
BOOL Cmenu2App::InitInstance()
|
||||||
|
{
|
||||||
|
// 如果一个运行在 Windows XP 上的应用程序清单指定要
|
||||||
|
// 使用 ComCtl32.dll 版本 6 或更高版本来启用可视化方式,
|
||||||
|
//则需要 InitCommonControlsEx()。 否则,将无法创建窗口。
|
||||||
|
INITCOMMONCONTROLSEX InitCtrls;
|
||||||
|
InitCtrls.dwSize = sizeof(InitCtrls);
|
||||||
|
// 将它设置为包括所有要在应用程序中使用的
|
||||||
|
// 公共控件类。
|
||||||
|
InitCtrls.dwICC = ICC_WIN95_CLASSES;
|
||||||
|
InitCommonControlsEx(&InitCtrls);
|
||||||
|
|
||||||
|
CWinApp::InitInstance();
|
||||||
|
|
||||||
|
|
||||||
|
AfxEnableControlContainer();
|
||||||
|
|
||||||
|
// 创建 shell 管理器,以防对话框包含
|
||||||
|
// 任何 shell 树视图控件或 shell 列表视图控件。
|
||||||
|
CShellManager *pShellManager = new CShellManager;
|
||||||
|
|
||||||
|
// 激活“Windows Native”视觉管理器,以便在 MFC 控件中启用主题
|
||||||
|
CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows));
|
||||||
|
|
||||||
|
// 标准初始化
|
||||||
|
// 如果未使用这些功能并希望减小
|
||||||
|
// 最终可执行文件的大小,则应移除下列
|
||||||
|
// 不需要的特定初始化例程
|
||||||
|
// 更改用于存储设置的注册表项
|
||||||
|
// TODO: 应适当修改该字符串,
|
||||||
|
// 例如修改为公司或组织名
|
||||||
|
SetRegistryKey(_T("应用程序向导生成的本地应用程序"));
|
||||||
|
|
||||||
|
Cmenu2Dlg dlg;
|
||||||
|
m_pMainWnd = &dlg;
|
||||||
|
INT_PTR nResponse = dlg.DoModal();
|
||||||
|
if (nResponse == IDOK)
|
||||||
|
{
|
||||||
|
// TODO: 在此放置处理何时用
|
||||||
|
// “确定”来关闭对话框的代码
|
||||||
|
}
|
||||||
|
else if (nResponse == IDCANCEL)
|
||||||
|
{
|
||||||
|
// TODO: 在此放置处理何时用
|
||||||
|
// “取消”来关闭对话框的代码
|
||||||
|
}
|
||||||
|
else if (nResponse == -1)
|
||||||
|
{
|
||||||
|
TRACE(traceAppMsg, 0, "警告: 对话框创建失败,应用程序将意外终止。\n");
|
||||||
|
TRACE(traceAppMsg, 0, "警告: 如果您在对话框上使用 MFC 控件,则无法 #define _AFX_NO_MFC_CONTROLS_IN_DIALOGS。\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除上面创建的 shell 管理器。
|
||||||
|
if (pShellManager != nullptr)
|
||||||
|
{
|
||||||
|
delete pShellManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
#if !defined(_AFXDLL) && !defined(_AFX_NO_MFC_CONTROLS_IN_DIALOGS)
|
||||||
|
ControlBarCleanUp();
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// 由于对话框已关闭,所以将返回 FALSE 以便退出应用程序,
|
||||||
|
// 而不是启动应用程序的消息泵。
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
32
WNT/menu.exe/menu2.h
Normal file
32
WNT/menu.exe/menu2.h
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
|
||||||
|
// menu2.h: PROJECT_NAME 应用程序的主头文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifndef __AFXWIN_H__
|
||||||
|
#error "include 'pch.h' before including this file for PCH"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include "resource.h" // 主符号
|
||||||
|
|
||||||
|
|
||||||
|
// Cmenu2App:
|
||||||
|
// 有关此类的实现,请参阅 menu2.cpp
|
||||||
|
//
|
||||||
|
|
||||||
|
class Cmenu2App : public CWinApp
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
Cmenu2App();
|
||||||
|
|
||||||
|
// 重写
|
||||||
|
public:
|
||||||
|
virtual BOOL InitInstance();
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
};
|
||||||
|
|
||||||
|
extern Cmenu2App theApp;
|
||||||
BIN
WNT/menu.exe/menu2.rc
Normal file
BIN
WNT/menu.exe/menu2.rc
Normal file
Binary file not shown.
221
WNT/menu.exe/menu2.vcxproj
Normal file
221
WNT/menu.exe/menu2.vcxproj
Normal file
@ -0,0 +1,221 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup Label="ProjectConfigurations">
|
||||||
|
<ProjectConfiguration Include="Debug|Win32">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|Win32">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>Win32</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Debug|x64">
|
||||||
|
<Configuration>Debug</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
<ProjectConfiguration Include="Release|x64">
|
||||||
|
<Configuration>Release</Configuration>
|
||||||
|
<Platform>x64</Platform>
|
||||||
|
</ProjectConfiguration>
|
||||||
|
</ItemGroup>
|
||||||
|
<PropertyGroup Label="Globals">
|
||||||
|
<VCProjectVersion>15.0</VCProjectVersion>
|
||||||
|
<ProjectGuid>{CFE8D300-EF37-486D-BA7F-C82809264B39}</ProjectGuid>
|
||||||
|
<Keyword>MFCProj</Keyword>
|
||||||
|
<RootNamespace>menu2</RootNamespace>
|
||||||
|
<WindowsTargetPlatformVersion>10.0.17763.0</WindowsTargetPlatformVersion>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141_xp</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Static</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>true</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
|
||||||
|
<ConfigurationType>Application</ConfigurationType>
|
||||||
|
<UseDebugLibraries>false</UseDebugLibraries>
|
||||||
|
<PlatformToolset>v141</PlatformToolset>
|
||||||
|
<WholeProgramOptimization>true</WholeProgramOptimization>
|
||||||
|
<CharacterSet>Unicode</CharacterSet>
|
||||||
|
<UseOfMfc>Dynamic</UseOfMfc>
|
||||||
|
</PropertyGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||||
|
<ImportGroup Label="ExtensionSettings">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="Shared">
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||||
|
</ImportGroup>
|
||||||
|
<PropertyGroup Label="UserMacros" />
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<LinkIncremental>true</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<LinkIncremental>false</LinkIncremental>
|
||||||
|
</PropertyGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>Disabled</Optimization>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
|
<ClCompile>
|
||||||
|
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||||
|
<WarningLevel>Level3</WarningLevel>
|
||||||
|
<Optimization>MaxSpeed</Optimization>
|
||||||
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
|
<SDLCheck>true</SDLCheck>
|
||||||
|
<PreprocessorDefinitions>_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
|
||||||
|
</ClCompile>
|
||||||
|
<Link>
|
||||||
|
<SubSystem>Windows</SubSystem>
|
||||||
|
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||||
|
<OptimizeReferences>true</OptimizeReferences>
|
||||||
|
</Link>
|
||||||
|
<Midl>
|
||||||
|
<MkTypLibCompatible>false</MkTypLibCompatible>
|
||||||
|
<ValidateAllParameters>true</ValidateAllParameters>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
</Midl>
|
||||||
|
<ResourceCompile>
|
||||||
|
<Culture>0x0804</Culture>
|
||||||
|
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
|
<AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemDefinitionGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="framework.h" />
|
||||||
|
<ClInclude Include="menu2.h" />
|
||||||
|
<ClInclude Include="menu2Dlg.h" />
|
||||||
|
<ClInclude Include="pch.h" />
|
||||||
|
<ClInclude Include="Resource.h" />
|
||||||
|
<ClInclude Include="targetver.h" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="menu2.cpp" />
|
||||||
|
<ClCompile Include="menu2Dlg.cpp" />
|
||||||
|
<ClCompile Include="pch.cpp">
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
|
||||||
|
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="menu2.rc" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res\menu2.rc2" />
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="E:\Desktop\background2.bmp" />
|
||||||
|
<Image Include="res\menu2.ico" />
|
||||||
|
</ItemGroup>
|
||||||
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
</ImportGroup>
|
||||||
|
</Project>
|
||||||
66
WNT/menu.exe/menu2.vcxproj.filters
Normal file
66
WNT/menu.exe/menu2.vcxproj.filters
Normal file
@ -0,0 +1,66 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<ItemGroup>
|
||||||
|
<Filter Include="源文件">
|
||||||
|
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
|
||||||
|
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="头文件">
|
||||||
|
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
|
||||||
|
<Extensions>h;hh;hpp;hxx;hm;inl;inc;ipp;xsd</Extensions>
|
||||||
|
</Filter>
|
||||||
|
<Filter Include="资源文件">
|
||||||
|
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
|
||||||
|
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
|
||||||
|
</Filter>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClInclude Include="menu2.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="menu2Dlg.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="framework.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="targetver.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="Resource.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
<ClInclude Include="pch.h">
|
||||||
|
<Filter>头文件</Filter>
|
||||||
|
</ClInclude>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ClCompile Include="menu2.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="menu2Dlg.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
<ClCompile Include="pch.cpp">
|
||||||
|
<Filter>源文件</Filter>
|
||||||
|
</ClCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<ResourceCompile Include="menu2.rc">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</ResourceCompile>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="res\menu2.rc2">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</None>
|
||||||
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<Image Include="res\menu2.ico">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</Image>
|
||||||
|
<Image Include="E:\Desktop\background2.bmp">
|
||||||
|
<Filter>资源文件</Filter>
|
||||||
|
</Image>
|
||||||
|
</ItemGroup>
|
||||||
|
</Project>
|
||||||
6
WNT/menu.exe/menu2.vcxproj.user
Normal file
6
WNT/menu.exe/menu2.vcxproj.user
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||||
|
<PropertyGroup>
|
||||||
|
<RESOURCE_FILE>menu2.rc</RESOURCE_FILE>
|
||||||
|
</PropertyGroup>
|
||||||
|
</Project>
|
||||||
213
WNT/menu.exe/menu2Dlg.cpp
Normal file
213
WNT/menu.exe/menu2Dlg.cpp
Normal file
@ -0,0 +1,213 @@
|
|||||||
|
|
||||||
|
// menu2Dlg.cpp: 实现文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
#include "framework.h"
|
||||||
|
#include "menu2.h"
|
||||||
|
#include "menu2Dlg.h"
|
||||||
|
#include "afxdialogex.h"
|
||||||
|
|
||||||
|
#ifdef _DEBUG
|
||||||
|
#define new DEBUG_NEW
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define MAXTREE 255
|
||||||
|
|
||||||
|
// Cmenu2Dlg 对话框
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Cmenu2Dlg::Cmenu2Dlg(CWnd* pParent /*=nullptr*/)
|
||||||
|
: CDialogEx(IDD_MENU2_DIALOG, pParent)
|
||||||
|
{
|
||||||
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cmenu2Dlg::DoDataExchange(CDataExchange* pDX)
|
||||||
|
{
|
||||||
|
CDialogEx::DoDataExchange(pDX);
|
||||||
|
DDX_Control(pDX, IDC_TREE1, m_tree);
|
||||||
|
}
|
||||||
|
|
||||||
|
BEGIN_MESSAGE_MAP(Cmenu2Dlg, CDialogEx)
|
||||||
|
ON_WM_PAINT()
|
||||||
|
ON_WM_QUERYDRAGICON()
|
||||||
|
ON_NOTIFY(TVN_SELCHANGED, IDC_TREE1, &Cmenu2Dlg::OnTvnSelchangedTree1)
|
||||||
|
ON_BN_CLICKED(IDOK, &Cmenu2Dlg::OnBnClickedOk)
|
||||||
|
ON_BN_CLICKED(IDCANCEL, &Cmenu2Dlg::OnBnClickedCancel)
|
||||||
|
ON_NOTIFY(NM_CLICK, IDC_SYSLINK1, &Cmenu2Dlg::OnNMClickSyslink1)
|
||||||
|
ON_NOTIFY(NM_CLICK, IDC_SYSLINK2, &Cmenu2Dlg::OnNMClickSyslink2)
|
||||||
|
ON_NOTIFY(NM_CLICK, IDC_SYSLINK3, &Cmenu2Dlg::OnNMClickSyslink3)
|
||||||
|
END_MESSAGE_MAP()
|
||||||
|
|
||||||
|
|
||||||
|
// Cmenu2Dlg 消息处理程序
|
||||||
|
|
||||||
|
|
||||||
|
void Cmenu2Dlg::MyExpandTree(HTREEITEM hTreeItem)
|
||||||
|
{
|
||||||
|
if (!m_tree.ItemHasChildren(hTreeItem))//如果树控件根节点没有子节点则返回
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
HTREEITEM hNextItem = m_tree.GetChildItem(hTreeItem);//若树控件的根节点有子节点则获取根节点的子节点
|
||||||
|
while (hNextItem != NULL)//若有
|
||||||
|
{
|
||||||
|
MyExpandTree(hNextItem);//递归,展开子节点下的所有子节点
|
||||||
|
hNextItem = m_tree.GetNextItem(hNextItem, TVGN_NEXT);//获取根节点的下一个子节点
|
||||||
|
}
|
||||||
|
m_tree.Expand(hTreeItem, TVE_EXPAND);//展开节点
|
||||||
|
}
|
||||||
|
|
||||||
|
TCHAR lpPath[255] = { 0 };
|
||||||
|
HTREEITEM treeStr[255] = { 0 };
|
||||||
|
BOOL Cmenu2Dlg::OnInitDialog()
|
||||||
|
{
|
||||||
|
CDialogEx::OnInitDialog();
|
||||||
|
|
||||||
|
// 设置此对话框的图标。 当应用程序主窗口不是对话框时,框架将自动
|
||||||
|
// 执行此操作
|
||||||
|
SetIcon(m_hIcon, TRUE); // 设置大图标
|
||||||
|
SetIcon(m_hIcon, FALSE); // 设置小图标
|
||||||
|
|
||||||
|
// TODO: 在此添加额外的初始化代码
|
||||||
|
GetCurrentDirectory(MAX_PATH, lpPath);
|
||||||
|
wsprintf(lpPath, L"%s\\menu.enus", lpPath);
|
||||||
|
|
||||||
|
|
||||||
|
SetWindowLong(m_hWnd, GWL_STYLE, WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX);
|
||||||
|
|
||||||
|
treeStr[0] = m_tree.InsertItem(L"Windows CE", 1, 0, TVI_ROOT);
|
||||||
|
for (int i = 1; i < 255; i++)
|
||||||
|
{
|
||||||
|
TCHAR iniCBuffer[255] = { 0 };
|
||||||
|
wsprintf(iniCBuffer, L"%d", i);
|
||||||
|
int currentFat = GetPrivateProfileInt(iniCBuffer, L"fat", -1, lpPath);
|
||||||
|
if (currentFat == -1)
|
||||||
|
break;
|
||||||
|
TCHAR currentName[255] = { 0 };
|
||||||
|
GetPrivateProfileString(iniCBuffer, L"name", NULL, currentName, 255, lpPath);
|
||||||
|
treeStr[i] = m_tree.InsertItem(currentName, 1, 0, treeStr[currentFat]);
|
||||||
|
}
|
||||||
|
|
||||||
|
MyExpandTree(m_tree.GetRootItem());
|
||||||
|
|
||||||
|
return TRUE; // 除非将焦点设置到控件,否则返回 TRUE
|
||||||
|
}
|
||||||
|
|
||||||
|
// 如果向对话框添加最小化按钮,则需要下面的代码
|
||||||
|
// 来绘制该图标。 对于使用文档/视图模型的 MFC 应用程序,
|
||||||
|
// 这将由框架自动完成。
|
||||||
|
|
||||||
|
void Cmenu2Dlg::OnPaint()
|
||||||
|
{
|
||||||
|
if (IsIconic())
|
||||||
|
{
|
||||||
|
CPaintDC dc(this); // 用于绘制的设备上下文
|
||||||
|
|
||||||
|
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
||||||
|
|
||||||
|
// 使图标在工作区矩形中居中
|
||||||
|
int cxIcon = GetSystemMetrics(SM_CXICON);
|
||||||
|
int cyIcon = GetSystemMetrics(SM_CYICON);
|
||||||
|
CRect rect;
|
||||||
|
GetClientRect(&rect);
|
||||||
|
int x = (rect.Width() - cxIcon + 1) / 2;
|
||||||
|
int y = (rect.Height() - cyIcon + 1) / 2;
|
||||||
|
|
||||||
|
// 绘制图标
|
||||||
|
dc.DrawIcon(x, y, m_hIcon);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//CDialogEx::OnPaint();
|
||||||
|
CPaintDC dc(this);
|
||||||
|
CRect rect;
|
||||||
|
GetClientRect(&rect);
|
||||||
|
CDC dcMem;
|
||||||
|
dcMem.CreateCompatibleDC(&dc);
|
||||||
|
CBitmap bmpBackground;
|
||||||
|
bmpBackground.LoadBitmap(IDB_BITMAP1); //对话框的背景图片
|
||||||
|
|
||||||
|
BITMAP bitmap;
|
||||||
|
bmpBackground.GetBitmap(&bitmap);
|
||||||
|
CBitmap *pbmpOld = dcMem.SelectObject(&bmpBackground);
|
||||||
|
dc.StretchBlt(0, 0, rect.Width(), rect.Height(), &dcMem, 0, 0, bitmap.bmWidth, bitmap.bmHeight, SRCCOPY);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//当用户拖动最小化窗口时系统调用此函数取得光标
|
||||||
|
//显示。
|
||||||
|
HCURSOR Cmenu2Dlg::OnQueryDragIcon()
|
||||||
|
{
|
||||||
|
return static_cast<HCURSOR>(m_hIcon);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
void Cmenu2Dlg::OnTvnSelchangedTree1(NMHDR *pNMHDR, LRESULT *pResult)
|
||||||
|
{
|
||||||
|
LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void doCommand(TCHAR *cmd, TCHAR *para)
|
||||||
|
{
|
||||||
|
ShellExecute(NULL, L"open", cmd, para, NULL, SW_SHOWNORMAL);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Cmenu2Dlg::OnBnClickedOk()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
//CDialogEx::OnOK();
|
||||||
|
HTREEITEM hselected = m_tree.GetSelectedItem();
|
||||||
|
int currentTreeID = 0;
|
||||||
|
for (; currentTreeID < 255; currentTreeID++)
|
||||||
|
{
|
||||||
|
if (hselected == treeStr[currentTreeID])
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
TCHAR currentINIHead[255] = { 0 };
|
||||||
|
TCHAR currentINICmd[255] = { 0 };
|
||||||
|
TCHAR currentINIPara[255] = { 0 };
|
||||||
|
wsprintf(currentINIHead, L"%d", currentTreeID);
|
||||||
|
GetPrivateProfileString(currentINIHead, L"cmd", NULL, currentINICmd, 255, lpPath);
|
||||||
|
GetPrivateProfileString(currentINIHead, L"para", NULL, currentINIPara, 255, lpPath);
|
||||||
|
if (currentINICmd[0] != NULL)
|
||||||
|
doCommand(currentINICmd, currentINIPara);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Cmenu2Dlg::OnBnClickedCancel()
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
|
||||||
|
CDialogEx::OnCancel();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Cmenu2Dlg::OnNMClickSyslink1(NMHDR *pNMHDR, LRESULT *pResult)
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
doCommand(L"..\\DOCS\\UpdateLog.txt", NULL);
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Cmenu2Dlg::OnNMClickSyslink2(NMHDR *pNMHDR, LRESULT *pResult)
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
doCommand(L"..\\DOCS\\TimeLine.xlsx", NULL);
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Cmenu2Dlg::OnNMClickSyslink3(NMHDR *pNMHDR, LRESULT *pResult)
|
||||||
|
{
|
||||||
|
// TODO: 在此添加控件通知处理程序代码
|
||||||
|
doCommand(L".\\about.exe", NULL);
|
||||||
|
*pResult = 0;
|
||||||
|
}
|
||||||
44
WNT/menu.exe/menu2Dlg.h
Normal file
44
WNT/menu.exe/menu2Dlg.h
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
|
||||||
|
// menu2Dlg.h: 头文件
|
||||||
|
//
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
|
||||||
|
// Cmenu2Dlg 对话框
|
||||||
|
class Cmenu2Dlg : public CDialogEx
|
||||||
|
{
|
||||||
|
// 构造
|
||||||
|
public:
|
||||||
|
Cmenu2Dlg(CWnd* pParent = nullptr); // 标准构造函数
|
||||||
|
|
||||||
|
// 对话框数据
|
||||||
|
#ifdef AFX_DESIGN_TIME
|
||||||
|
enum { IDD = IDD_MENU2_DIALOG };
|
||||||
|
#endif
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
|
||||||
|
|
||||||
|
|
||||||
|
// 实现
|
||||||
|
protected:
|
||||||
|
HICON m_hIcon;
|
||||||
|
|
||||||
|
// 生成的消息映射函数
|
||||||
|
virtual BOOL OnInitDialog();
|
||||||
|
afx_msg void OnPaint();
|
||||||
|
afx_msg HCURSOR OnQueryDragIcon();
|
||||||
|
DECLARE_MESSAGE_MAP()
|
||||||
|
public:
|
||||||
|
afx_msg void OnTvnSelchangedTree1(NMHDR *pNMHDR, LRESULT *pResult);
|
||||||
|
CTreeCtrl m_tree;
|
||||||
|
|
||||||
|
void MyExpandTree(HTREEITEM hTreeItem);
|
||||||
|
|
||||||
|
afx_msg void OnBnClickedOk();
|
||||||
|
afx_msg void OnBnClickedCancel();
|
||||||
|
afx_msg void OnNMClickSyslink1(NMHDR *pNMHDR, LRESULT *pResult);
|
||||||
|
afx_msg void OnNMClickSyslink2(NMHDR *pNMHDR, LRESULT *pResult);
|
||||||
|
afx_msg void OnNMClickSyslink3(NMHDR *pNMHDR, LRESULT *pResult);
|
||||||
|
};
|
||||||
5
WNT/menu.exe/pch.cpp
Normal file
5
WNT/menu.exe/pch.cpp
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
// pch.cpp: 与预编译标头对应的源文件
|
||||||
|
|
||||||
|
#include "pch.h"
|
||||||
|
|
||||||
|
// 当使用预编译的头时,需要使用此源文件,编译才能成功。
|
||||||
13
WNT/menu.exe/pch.h
Normal file
13
WNT/menu.exe/pch.h
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
// pch.h: 这是预编译标头文件。
|
||||||
|
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
|
||||||
|
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
|
||||||
|
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
|
||||||
|
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
|
||||||
|
|
||||||
|
#ifndef PCH_H
|
||||||
|
#define PCH_H
|
||||||
|
|
||||||
|
// 添加要在此处预编译的标头
|
||||||
|
#include "framework.h"
|
||||||
|
|
||||||
|
#endif //PCH_H
|
||||||
BIN
WNT/menu.exe/res/menu2.ico
Normal file
BIN
WNT/menu.exe/res/menu2.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
WNT/menu.exe/res/menu2.rc2
Normal file
BIN
WNT/menu.exe/res/menu2.rc2
Normal file
Binary file not shown.
22
WNT/menu.exe/resource.h
Normal file
22
WNT/menu.exe/resource.h
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
//{{NO_DEPENDENCIES}}
|
||||||
|
// Microsoft Visual C++ 生成的包含文件。
|
||||||
|
// 供 menu2.rc 使用
|
||||||
|
//
|
||||||
|
#define IDD_MENU2_DIALOG 102
|
||||||
|
#define IDR_MAINFRAME 128
|
||||||
|
#define IDB_BITMAP1 130
|
||||||
|
#define IDC_TREE1 1000
|
||||||
|
#define IDC_SYSLINK1 1001
|
||||||
|
#define IDC_SYSLINK2 1002
|
||||||
|
#define IDC_SYSLINK3 1003
|
||||||
|
|
||||||
|
// Next default values for new objects
|
||||||
|
//
|
||||||
|
#ifdef APSTUDIO_INVOKED
|
||||||
|
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||||
|
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||||
|
#define _APS_NEXT_COMMAND_VALUE 32771
|
||||||
|
#define _APS_NEXT_CONTROL_VALUE 1004
|
||||||
|
#define _APS_NEXT_SYMED_VALUE 101
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
8
WNT/menu.exe/targetver.h
Normal file
8
WNT/menu.exe/targetver.h
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
// 包括 SDKDDKVer.h 将定义可用的最高版本的 Windows 平台。
|
||||||
|
|
||||||
|
// 如果要为以前的 Windows 平台生成应用程序,请包括 WinSDKVer.h,并将
|
||||||
|
// 将 _WIN32_WINNT 宏设置为要支持的平台,然后再包括 SDKDDKVer.h。
|
||||||
|
|
||||||
|
#include <SDKDDKVer.h>
|
||||||
Loading…
x
Reference in New Issue
Block a user