mirror of
https://github.com/electronicarts/CnC_Renegade.git
synced 2025-12-16 23:51:41 -05:00
Initial commit of Command & Conquer Renegade source code.
This commit is contained in:
90
Code/Tools/MonoDrv/README.TXT
Normal file
90
Code/Tools/MonoDrv/README.TXT
Normal file
@@ -0,0 +1,90 @@
|
||||
Build & Run Instructions:
|
||||
-------------------------
|
||||
|
||||
|
||||
The MONO sample is composed of a simple monolithic export driver
|
||||
and a Win32 test application. The Win32 app retrieves a handle to
|
||||
the driver/device by calling CreateFile("\\.\MONO", ...), where MONO
|
||||
is a Win32 alias (or "symbolic link") for \Device\Mono, and
|
||||
subsequently sends it I/O requests (IOCTLs) to have it perform I/O
|
||||
on it's behalf.
|
||||
|
||||
|
||||
NOTE: MONO is intended to be a generic monolithic driver sample;
|
||||
it just happens that it was coded to support a monochrome
|
||||
video adapter.
|
||||
|
||||
Microsoft does not recommend the use this sample as a
|
||||
template for video driver development. We encourage developers
|
||||
to code within the stated video model; doing so will insure
|
||||
compatibility & portability, lessen development time,
|
||||
and produce smaller and more supportable code.
|
||||
|
||||
|
||||
As mentioned above, MONO is an export driver; it provides a
|
||||
MonoDbgPrint() API which may be called by other kernel mode drivers
|
||||
that include a prototype & link with MONO.LIB, e.g. by adding
|
||||
"TARGETLIBS=$(BASEDIR)\lib\*\mono.lib" to the sources file.
|
||||
(This can make single machine driver debugging a little more bearable.
|
||||
Note that the load order of the driver can be varied by changing
|
||||
the Start value in the registry, 0 being the earliest starting
|
||||
value. See Chapter 16 of the Kernel-mode Driver Design Guide for
|
||||
mode information on driver load ordering.)
|
||||
|
||||
There are currently three export drivers that ship with NT (i.e.
|
||||
VIDEOPRT.SYS and SCSIPORT.SYS); these represent the port side of
|
||||
the port/miniport driver model. The idea of this model is to split
|
||||
the OS-specific functionality into a common port driver, while the
|
||||
H/W specific functionality resides in the miniport driver. This
|
||||
way, miniports remain portable across various platforms & systems,
|
||||
and a single port driver can service several miniports on a particular
|
||||
platform.
|
||||
|
||||
The Win32 portion contains a file, MONOTEST.C, which attempts to
|
||||
obtain a handle to MONO & send it IOCTLs. The executable is built
|
||||
using the Windows NT SDK. First update the environment and path
|
||||
by running <mstools>\setenv.bat. Then change to the directory
|
||||
where you have the C source code and the makefile. Type
|
||||
"nmake /f monotest.mak" to compile the Win32 program, MONOTEST.EXE.
|
||||
|
||||
The kernel driver portion contains the driver source code, MONO.C
|
||||
and a text file used to configure your registry so that the driver
|
||||
can be loaded. The driver is built using the Windows NT DDK.
|
||||
|
||||
To build the driver:
|
||||
|
||||
|
||||
1. Assuming you have run <sdk_root>\setenv.bat and
|
||||
<ddk_root>\setenv.bat, build the driver by typing:
|
||||
|
||||
build -cef
|
||||
|
||||
(If there are any errors have a look at the build.log, build.err,
|
||||
and build.wrn files to get an idea of what went wrong.)
|
||||
|
||||
|
||||
2. Copy the newly built driver, <ddk_root>\lib\*\MONO.SYS to the
|
||||
<nt_root>\system32\drivers\ directory, i.e.:
|
||||
|
||||
copy \ntddk\lib\i386\free\mono.sys c:\winnt\system32\drivers\
|
||||
|
||||
|
||||
3. Update the registry by running regini.exe on the mapmem.ini
|
||||
file, i.e.:
|
||||
|
||||
regini mono.ini
|
||||
|
||||
This adds a MONO driver key under the HKEY_LOCAL_MACHINE\
|
||||
SYSTEM\CurrentControlSet\Services tree in the registry. You
|
||||
can verify this by starting REGEDIT.EXE and looking in the
|
||||
appropriate place.
|
||||
|
||||
|
||||
4. Reboot.
|
||||
|
||||
|
||||
5. Type:
|
||||
|
||||
net start mono
|
||||
|
||||
...and then execute MONOTEST.EXE.
|
||||
198
Code/Tools/MonoDrv/exe/MONOTEST.C
Normal file
198
Code/Tools/MonoDrv/exe/MONOTEST.C
Normal file
@@ -0,0 +1,198 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "windows.h"
|
||||
#include "winioctl.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "monodrvr.h"
|
||||
#include "conio.h"
|
||||
|
||||
|
||||
#define MESSAGE1 "*** Page 1 ***\n"
|
||||
#define MESSAGE2 "*** Page 2 ***\n"
|
||||
#define MESSAGE3 "Another line of text.\n"
|
||||
|
||||
|
||||
long Print(HANDLE handle, char const * text)
|
||||
{
|
||||
long retval = 0;
|
||||
if (text != NULL) {
|
||||
WriteFile(handle, text, strlen(text), &retval, NULL);
|
||||
printf(text);
|
||||
}
|
||||
return(retval);
|
||||
}
|
||||
|
||||
|
||||
int __cdecl main(int argc, char *argv[])
|
||||
{
|
||||
HANDLE handle1;
|
||||
HANDLE handle2;
|
||||
char attrib = 0x70;
|
||||
|
||||
handle1 = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (handle1 != INVALID_HANDLE_VALUE) {
|
||||
long retval;
|
||||
struct {
|
||||
int X,Y,W,H;
|
||||
} windowcontrol;
|
||||
int value;
|
||||
struct {
|
||||
int X,Y,W,H,A;
|
||||
} fillcontrol;
|
||||
|
||||
Print(handle1, MESSAGE1);
|
||||
|
||||
printf("Press <ENTER> to proceed.\n");
|
||||
getchar();
|
||||
|
||||
handle2 = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (handle2 != INVALID_HANDLE_VALUE) {
|
||||
Print(handle2, MESSAGE2);
|
||||
|
||||
printf("Press <ENTER> to proceed again.\n");getchar();
|
||||
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_BRING_TO_TOP, NULL, 0, NULL, 0, &retval, 0);
|
||||
printf("First page should reappear.\n");getchar();
|
||||
|
||||
DeviceIoControl(handle2, (DWORD)IOCTL_MONO_BRING_TO_TOP, NULL, 0, NULL, 0, &retval, 0);
|
||||
printf("Second page should reappear.\n");getchar();
|
||||
{
|
||||
unsigned short * ptr = NULL;
|
||||
unsigned short * ptr2 = NULL;
|
||||
|
||||
DeviceIoControl(handle2, (DWORD)IOCTL_MONO_LOCK, NULL, 0, &ptr, sizeof(ptr), &retval, 0);
|
||||
if (ptr != NULL) {
|
||||
*ptr = 0x0720;
|
||||
}
|
||||
printf("Upper left character should blank out.\n");getchar();
|
||||
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_BRING_TO_TOP, NULL, 0, NULL, 0, &retval, 0);
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_LOCK, NULL, 0, &ptr2, sizeof(ptr2), &retval, 0);
|
||||
if (ptr2 != NULL) {
|
||||
*ptr2 = 0x0720;
|
||||
}
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_UNLOCK, NULL, 0, NULL, 0, &retval, 0);
|
||||
printf("First page should NOT reappear (but it has been modified).\n");getchar();
|
||||
|
||||
DeviceIoControl(handle2, (DWORD)IOCTL_MONO_BRING_TO_TOP, NULL, 0, NULL, 0, &retval, 0);
|
||||
if (ptr != NULL) {
|
||||
*ptr = 0x0721;
|
||||
}
|
||||
DeviceIoControl(handle2, (DWORD)IOCTL_MONO_UNLOCK, NULL, 0, NULL, 0, &retval, 0);
|
||||
printf("Second page is now modified after after a call to unlock for page 1.\n");getchar();
|
||||
}
|
||||
CloseHandle(handle2);
|
||||
} else {
|
||||
printf("Unable to open second device handle.\n");getchar();
|
||||
}
|
||||
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_BRING_TO_TOP, NULL, 0, NULL, 0, &retval, 0);
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SET_ATTRIBUTE, &attrib, 1, NULL, 0, &retval, 0);
|
||||
Print(handle1, MESSAGE3);
|
||||
printf("First page should reappear with new text.\n");getchar();
|
||||
|
||||
windowcontrol.X = 10;
|
||||
windowcontrol.Y = 10;
|
||||
windowcontrol.W = 20;
|
||||
windowcontrol.H = 10;
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SET_WINDOW, &windowcontrol, sizeof(windowcontrol), NULL, 0, &retval, 0);
|
||||
Print(handle1, "This text should appear in a window that is of limited size. You should notice that the text wraps at the right margin.\n");
|
||||
printf("Sub window printing -- no wrap at right margin.\n");getchar();
|
||||
|
||||
value = MONOFLAG_WRAP;
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SET_FLAG, &value, sizeof(value), NULL, 0, &retval, 0);
|
||||
Print(handle1, "\fThis text should appear in a window that is of limited size. You should notice that the text wraps at the right margin.\n");
|
||||
printf("Sub window printing -- wrapping at right margin.\n");getchar();
|
||||
|
||||
|
||||
fillcontrol.X = 0;
|
||||
fillcontrol.Y = 0;
|
||||
fillcontrol.W = 100;
|
||||
fillcontrol.H = 100;
|
||||
fillcontrol.A = 0x0F;
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_FILL_ATTRIB, &fillcontrol, sizeof(fillcontrol), NULL, 0, &retval, 0);
|
||||
printf("Screen attribute change.\n");getchar();
|
||||
|
||||
fillcontrol.X = 0;
|
||||
fillcontrol.Y = 0;
|
||||
fillcontrol.W = 100;
|
||||
fillcontrol.H = 100;
|
||||
fillcontrol.A = 0x07;
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_FILL_ATTRIB, &fillcontrol, sizeof(fillcontrol), NULL, 0, &retval, 0);
|
||||
printf("Screen attribute restore.\n");getchar();
|
||||
|
||||
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_PAN, NULL, 0, NULL, 0, &retval, 0);
|
||||
printf("Now it should pan over one column.\n");getchar();
|
||||
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SCROLL, NULL, 0, NULL, 0, &retval, 0);
|
||||
printf("Now it should scroll up one row.\n");getchar();
|
||||
|
||||
attrib = 0x07;
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SET_ATTRIBUTE, &attrib, 1, NULL, 0, &retval, 0);
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, &retval, 0);
|
||||
|
||||
CloseHandle(handle1);
|
||||
}
|
||||
|
||||
#ifdef NEVER
|
||||
HANDLE hDriver;
|
||||
UCHAR outputString[] = "Test Message\nfor the monochrome device.\n";
|
||||
UCHAR altString[] = "'\t','\n'";
|
||||
UCHAR topline[] = "Top line of screen.\n\n\n\n";
|
||||
DWORD cbReturned;
|
||||
struct {
|
||||
int X;
|
||||
int Y;
|
||||
} cursorpos;
|
||||
|
||||
if ((hDriver = CreateFile("\\\\.\\MONO", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != ((HANDLE)-1)) {
|
||||
printf("\nRetrieved valid handle for MONO driver\n");
|
||||
} else {
|
||||
printf("Can't get a handle to MONO driver\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
WriteFile(hDriver, outputString, strlen(outputString), &cbReturned, NULL);
|
||||
printf("WriteFile says it wrote out %d bytes.\n", cbReturned);
|
||||
|
||||
|
||||
if (DeviceIoControl(hDriver, (DWORD) IOCTL_MONO_PRINT_RAW, altString, sizeof(altString)-1, NULL, 0, &cbReturned, 0)) {
|
||||
printf("DeviceIoControl worked\n\n");
|
||||
|
||||
cursorpos.X = 0;
|
||||
cursorpos.Y = 0;
|
||||
DeviceIoControl(hDriver, (DWORD)IOCTL_MONO_SET_CURSOR, (char*)&cursorpos, sizeof(cursorpos), NULL, 0, &cbReturned, 0);
|
||||
WriteFile(hDriver, topline, strlen(topline), &cbReturned, NULL);
|
||||
|
||||
printf("Hit <Enter> to clear the mono display: \n");
|
||||
getchar();
|
||||
|
||||
DeviceIoControl(hDriver, (DWORD) IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, &cbReturned, 0);
|
||||
|
||||
printf("'Bye\n");
|
||||
} else {
|
||||
printf("DeviceIoControl failed\n");
|
||||
}
|
||||
|
||||
CloseHandle(hDriver);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
2
Code/Tools/MonoDrv/old/DIRS
Normal file
2
Code/Tools/MonoDrv/old/DIRS
Normal file
@@ -0,0 +1,2 @@
|
||||
DIRS=sys \
|
||||
exe
|
||||
144
Code/Tools/MonoDrv/old/EXE/MONOTEST.C
Normal file
144
Code/Tools/MonoDrv/old/EXE/MONOTEST.C
Normal file
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "windows.h"
|
||||
#include "winioctl.h"
|
||||
#include "stdio.h"
|
||||
#include "stdlib.h"
|
||||
#include "monopub.h"
|
||||
#include "conio.h"
|
||||
|
||||
|
||||
#define MESSAGE1 "*** Page 1 ***\n"
|
||||
#define MESSAGE2 "*** Page 2 ***\n"
|
||||
#define MESSAGE3 "Another line of text.\n"
|
||||
|
||||
int __cdecl main(int argc, char *argv[])
|
||||
{
|
||||
HANDLE handle1;
|
||||
HANDLE handle2;
|
||||
char attrib = 0x70;
|
||||
|
||||
handle1 = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (handle1 != INVALID_HANDLE_VALUE) {
|
||||
long retval;
|
||||
|
||||
WriteFile(handle1, MESSAGE1, strlen(MESSAGE1), &retval, NULL);
|
||||
|
||||
printf("Press <ENTER> to proceed.\n");
|
||||
getchar();
|
||||
|
||||
handle2 = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (handle2 != INVALID_HANDLE_VALUE) {
|
||||
WriteFile(handle2, MESSAGE2, strlen(MESSAGE1), &retval, NULL);
|
||||
|
||||
printf("Press <ENTER> to proceed again.\n");
|
||||
getchar();
|
||||
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_BRING_TO_TOP, NULL, 0, NULL, 0, &retval, 0);
|
||||
printf("First page should reappear.\n");
|
||||
getchar();
|
||||
|
||||
DeviceIoControl(handle2, (DWORD)IOCTL_MONO_BRING_TO_TOP, NULL, 0, NULL, 0, &retval, 0);
|
||||
printf("Second page should reappear.\n");
|
||||
getchar();
|
||||
|
||||
{
|
||||
unsigned short * ptr = NULL;
|
||||
|
||||
DeviceIoControl(handle2, (DWORD)IOCTL_MONO_LOCK, NULL, 0, &ptr, sizeof(ptr), &retval, 0);
|
||||
if (ptr != NULL) {
|
||||
*ptr = 0x0720;
|
||||
}
|
||||
DeviceIoControl(handle2, (DWORD)IOCTL_MONO_UNLOCK, NULL, 0, NULL, 0, &retval, 0);
|
||||
|
||||
printf("Upper left character should blank out.\n");
|
||||
getchar();
|
||||
|
||||
}
|
||||
|
||||
CloseHandle(handle2);
|
||||
} else {
|
||||
printf("Unable to open second device handle.\n");
|
||||
getchar();
|
||||
}
|
||||
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SET_ATTRIBUTE, &attrib, 1, NULL, 0, &retval, 0);
|
||||
WriteFile(handle1, MESSAGE3, strlen(MESSAGE3), &retval, NULL);
|
||||
printf("First page should reappear with new text.\n");
|
||||
getchar();
|
||||
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_PAN, NULL, 0, NULL, 0, &retval, 0);
|
||||
printf("Now it should pan over one column.\n");
|
||||
getchar();
|
||||
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SCROLL, NULL, 0, NULL, 0, &retval, 0);
|
||||
printf("Now it should scroll up one row.\n");
|
||||
getchar();
|
||||
|
||||
attrib = 0x07;
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_SET_ATTRIBUTE, &attrib, 1, NULL, 0, &retval, 0);
|
||||
DeviceIoControl(handle1, (DWORD)IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, &retval, 0);
|
||||
|
||||
CloseHandle(handle1);
|
||||
}
|
||||
|
||||
#ifdef NEVER
|
||||
HANDLE hDriver;
|
||||
UCHAR outputString[] = "Test Message\nfor the monochrome device.\n";
|
||||
UCHAR altString[] = "'\t','\n'";
|
||||
UCHAR topline[] = "Top line of screen.\n\n\n\n";
|
||||
DWORD cbReturned;
|
||||
struct {
|
||||
int X;
|
||||
int Y;
|
||||
} cursorpos;
|
||||
|
||||
if ((hDriver = CreateFile("\\\\.\\MONO", GENERIC_READ | GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL)) != ((HANDLE)-1)) {
|
||||
printf("\nRetrieved valid handle for MONO driver\n");
|
||||
} else {
|
||||
printf("Can't get a handle to MONO driver\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
WriteFile(hDriver, outputString, strlen(outputString), &cbReturned, NULL);
|
||||
printf("WriteFile says it wrote out %d bytes.\n", cbReturned);
|
||||
|
||||
|
||||
if (DeviceIoControl(hDriver, (DWORD) IOCTL_MONO_PRINT_RAW, altString, sizeof(altString)-1, NULL, 0, &cbReturned, 0)) {
|
||||
printf("DeviceIoControl worked\n\n");
|
||||
|
||||
cursorpos.X = 0;
|
||||
cursorpos.Y = 0;
|
||||
DeviceIoControl(hDriver, (DWORD)IOCTL_MONO_SET_CURSOR, (char*)&cursorpos, sizeof(cursorpos), NULL, 0, &cbReturned, 0);
|
||||
WriteFile(hDriver, topline, strlen(topline), &cbReturned, NULL);
|
||||
|
||||
printf("Hit <Enter> to clear the mono display: \n");
|
||||
getchar();
|
||||
|
||||
DeviceIoControl(hDriver, (DWORD) IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, &cbReturned, 0);
|
||||
|
||||
printf("'Bye\n");
|
||||
} else {
|
||||
printf("DeviceIoControl failed\n");
|
||||
}
|
||||
|
||||
CloseHandle(hDriver);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
10
Code/Tools/MonoDrv/old/EXE/MONOTEST.MAK
Normal file
10
Code/Tools/MonoDrv/old/EXE/MONOTEST.MAK
Normal file
@@ -0,0 +1,10 @@
|
||||
|
||||
!include <ntwin32.mak>
|
||||
|
||||
all: monotest.exe
|
||||
|
||||
monotest.obj: monotest.c
|
||||
$(cc) $(cflags) $(cvars) $(cdebug) -I..\sys monotest.c
|
||||
|
||||
monotest.exe: monotest.obj
|
||||
$(link) $(linkdebug) $(conflags) -out:monotest.exe monotest.obj $(conlibs)
|
||||
11
Code/Tools/MonoDrv/old/EXE/SOURCES
Normal file
11
Code/Tools/MonoDrv/old/EXE/SOURCES
Normal file
@@ -0,0 +1,11 @@
|
||||
|
||||
TARGETNAME=monotest
|
||||
TARGETPATH=$(BASEDIR)\lib
|
||||
TARGETTYPE=PROGRAM
|
||||
|
||||
INCLUDES=..\sys
|
||||
|
||||
SOURCES=monotest.c
|
||||
|
||||
UMTYPE=console
|
||||
UMBASE=0x100000
|
||||
1424
Code/Tools/MonoDrv/old/SYS/MONO.C
Normal file
1424
Code/Tools/MonoDrv/old/SYS/MONO.C
Normal file
File diff suppressed because it is too large
Load Diff
61
Code/Tools/MonoDrv/old/SYS/MONOPUB.H
Normal file
61
Code/Tools/MonoDrv/old/SYS/MONOPUB.H
Normal file
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1993 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
monopub.h
|
||||
|
||||
Abstract:
|
||||
|
||||
This module contains the PUBLIC (viewable by driver & Win32 apps)
|
||||
definitions for the IOCTLs supported by the MONO device driver.
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel & User mode
|
||||
|
||||
Revision History:
|
||||
|
||||
03-22-93 : created
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Define the various device type values. Note that values used by Microsoft
|
||||
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
|
||||
// by customers.
|
||||
//
|
||||
#define FILE_DEVICE_MONO 0x00008000
|
||||
|
||||
//
|
||||
// The MONO device driver IOCTLs
|
||||
//
|
||||
#define IOCTL_MONO_CLEAR_SCREEN CTL_CODE(FILE_DEVICE_MONO, 0x801, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_PRINT_RAW CTL_CODE(FILE_DEVICE_MONO, 0x800, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SET_CURSOR CTL_CODE(FILE_DEVICE_MONO, 0x802, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SCROLL CTL_CODE(FILE_DEVICE_MONO, 0x803, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_BRING_TO_TOP CTL_CODE(FILE_DEVICE_MONO, 0x804, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SET_ATTRIBUTE CTL_CODE(FILE_DEVICE_MONO, 0x805, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_PAN CTL_CODE(FILE_DEVICE_MONO, 0x806, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_LOCK CTL_CODE(FILE_DEVICE_MONO, 0x807, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_UNLOCK CTL_CODE(FILE_DEVICE_MONO, 0x808, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
|
||||
7
Code/Tools/MonoDrv/old/SYS/SOURCES
Normal file
7
Code/Tools/MonoDrv/old/SYS/SOURCES
Normal file
@@ -0,0 +1,7 @@
|
||||
TARGETNAME=mono
|
||||
TARGETPATH=$(BASEDIR)\lib
|
||||
TARGETTYPE=EXPORT_DRIVER
|
||||
|
||||
DLLDEF=mono.def
|
||||
|
||||
SOURCES=mono.c
|
||||
8
Code/Tools/MonoDrv/sys/MAKEFILE
Normal file
8
Code/Tools/MonoDrv/sys/MAKEFILE
Normal file
@@ -0,0 +1,8 @@
|
||||
|
||||
#
|
||||
# DO NOT EDIT THIS FILE!!! Edit .\sources. if you want to add a new source
|
||||
# file to this component. This file merely indirects to the real make file
|
||||
# that is shared by all the driver components of the Windows NT DDK
|
||||
#
|
||||
|
||||
!INCLUDE $(NTMAKEENV)\makefile.def
|
||||
1410
Code/Tools/MonoDrv/sys/MONO.C
Normal file
1410
Code/Tools/MonoDrv/sys/MONO.C
Normal file
File diff suppressed because it is too large
Load Diff
2
Code/Tools/MonoDrv/sys/MONO.DEF
Normal file
2
Code/Tools/MonoDrv/sys/MONO.DEF
Normal file
@@ -0,0 +1,2 @@
|
||||
NAME MONO.SYS
|
||||
DESCRIPTION 'MONO.SYS'
|
||||
119
Code/Tools/MonoDrv/sys/MONODRVR.H
Normal file
119
Code/Tools/MonoDrv/sys/MONODRVR.H
Normal file
@@ -0,0 +1,119 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* $Header$ */
|
||||
/***********************************************************************************************
|
||||
*** C O N F I D E N T I A L --- W E S T W O O D S T U D I O S ***
|
||||
***********************************************************************************************
|
||||
* *
|
||||
* Project Name : NT Device Driver *
|
||||
* *
|
||||
* File Name : MONODRVR.H *
|
||||
* *
|
||||
* Programmer : Joe L. Bostic *
|
||||
* *
|
||||
* Start Date : 01/06/97 *
|
||||
* *
|
||||
* Last Update : January 6, 1997 [JLB] *
|
||||
* *
|
||||
*---------------------------------------------------------------------------------------------*
|
||||
* Functions: *
|
||||
* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
|
||||
|
||||
// This header is needed for the CTL_CODE macro.
|
||||
//#include <winioctl.h>
|
||||
|
||||
/*
|
||||
** This is the identifier for the Monochrome Display Driver.
|
||||
*/
|
||||
#define FILE_DEVICE_MONO 0x00008000
|
||||
|
||||
/*
|
||||
** These are the IOCTL commands supported by the Monochrome Display Driver.
|
||||
*/
|
||||
#define IOCTL_MONO_HELP_SCREEN CTL_CODE(FILE_DEVICE_MONO, 0x800, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_CLEAR_SCREEN CTL_CODE(FILE_DEVICE_MONO, 0x801, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_PRINT_RAW CTL_CODE(FILE_DEVICE_MONO, 0x802, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SET_CURSOR CTL_CODE(FILE_DEVICE_MONO, 0x803, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SCROLL CTL_CODE(FILE_DEVICE_MONO, 0x804, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_BRING_TO_TOP CTL_CODE(FILE_DEVICE_MONO, 0x805, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SET_ATTRIBUTE CTL_CODE(FILE_DEVICE_MONO, 0x806, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_PAN CTL_CODE(FILE_DEVICE_MONO, 0x807, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_LOCK CTL_CODE(FILE_DEVICE_MONO, 0x808, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_UNLOCK CTL_CODE(FILE_DEVICE_MONO, 0x809, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SET_WINDOW CTL_CODE(FILE_DEVICE_MONO, 0x80A, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_RESET_WINDOW CTL_CODE(FILE_DEVICE_MONO, 0x80B, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SET_FLAG CTL_CODE(FILE_DEVICE_MONO, 0x80C, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_CLEAR_FLAG CTL_CODE(FILE_DEVICE_MONO, 0x80D, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_FILL_ATTRIB CTL_CODE(FILE_DEVICE_MONO, 0x80E, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
|
||||
/*
|
||||
** These specify the various behavior flags available for the mono display driver. They
|
||||
** default to being OFF (or FALSE).
|
||||
*/
|
||||
typedef enum MonoFlagType
|
||||
{
|
||||
MONOFLAG_WRAP, // Text will wrap to the next line when right margin is reached.
|
||||
|
||||
MONOFLAG_COUNT // Used to indicate the number of mono flags available.
|
||||
} MonoFlagType;
|
||||
|
||||
|
||||
/*
|
||||
Here is a "C" example of how to use the Monochrome Display Driver.
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
HANDLE handle;
|
||||
|
||||
handle = CreateFile("\\\\.\\MONO", GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (handle != INVALID_HANDLE_VALUE) {
|
||||
long retval; // Return code from IoControl functions.
|
||||
unsigned short * pointer; // Working pointer to mono RAM.
|
||||
union {
|
||||
int X,Y;
|
||||
} cursor; // Cursor positioning parameter info.
|
||||
|
||||
// Prints a line of text to the screen [length of string is 13].
|
||||
WriteFile(handle, "Test Message\n", 13, &retval, NULL);
|
||||
|
||||
// Fetches a pointer to the mono memory.
|
||||
DeviceIoControl(handle, (DWORD)IOCTL_MONO_LOCK, NULL, 0, &pointer, sizeof(pointer), &retval, 0);
|
||||
if (pointer != NULL) {
|
||||
*pointer = 0x0721; // '!' character appears in upper left corner (attribute 0x07).
|
||||
}
|
||||
DeviceIoControl(handle, (DWORD)IOCTL_MONO_UNLOCK, NULL, 0, NULL, 0, &retval, 0);
|
||||
|
||||
// Set cursor to column 5, row 10.
|
||||
cursor.X = 5;
|
||||
cursor.Y = 10;
|
||||
DeviceIoControl(handle, (DWORD)IOCTL_MONO_SET_CURSOR, &cursor, sizeof(cursor), NULL, 0, &retval, 0);
|
||||
|
||||
// Clear the screen.
|
||||
DeviceIoControl(handle, (DWORD)IOCTL_MONO_CLEAR_SCREEN, NULL, 0, NULL, 0, &retval, 0);
|
||||
|
||||
CloseHandle(handle);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
*/
|
||||
|
||||
|
||||
62
Code/Tools/MonoDrv/sys/MONOPUB.H
Normal file
62
Code/Tools/MonoDrv/sys/MONOPUB.H
Normal file
@@ -0,0 +1,62 @@
|
||||
/*
|
||||
** Command & Conquer Renegade(tm)
|
||||
** Copyright 2025 Electronic Arts Inc.
|
||||
**
|
||||
** This program is free software: you can redistribute it and/or modify
|
||||
** it under the terms of the GNU General Public License as published by
|
||||
** the Free Software Foundation, either version 3 of the License, or
|
||||
** (at your option) any later version.
|
||||
**
|
||||
** This program is distributed in the hope that it will be useful,
|
||||
** but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
** GNU General Public License for more details.
|
||||
**
|
||||
** You should have received a copy of the GNU General Public License
|
||||
** along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/*++
|
||||
|
||||
Copyright (c) 1993 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
monopub.h
|
||||
|
||||
Abstract:
|
||||
|
||||
This module contains the PUBLIC (viewable by driver & Win32 apps)
|
||||
definitions for the IOCTLs supported by the MONO device driver.
|
||||
|
||||
Environment:
|
||||
|
||||
Kernel & User mode
|
||||
|
||||
Revision History:
|
||||
|
||||
03-22-93 : created
|
||||
|
||||
--*/
|
||||
|
||||
//
|
||||
// Define the various device type values. Note that values used by Microsoft
|
||||
// Corporation are in the range 0-32767, and 32768-65535 are reserved for use
|
||||
// by customers.
|
||||
//
|
||||
#define FILE_DEVICE_MONO 0x00008000
|
||||
|
||||
//
|
||||
// The MONO device driver IOCTLs
|
||||
//
|
||||
#define IOCTL_MONO_CLEAR_SCREEN CTL_CODE(FILE_DEVICE_MONO, 0x801, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_PRINT_RAW CTL_CODE(FILE_DEVICE_MONO, 0x800, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SET_CURSOR CTL_CODE(FILE_DEVICE_MONO, 0x802, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SCROLL CTL_CODE(FILE_DEVICE_MONO, 0x803, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_BRING_TO_TOP CTL_CODE(FILE_DEVICE_MONO, 0x804, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SET_ATTRIBUTE CTL_CODE(FILE_DEVICE_MONO, 0x805, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_PAN CTL_CODE(FILE_DEVICE_MONO, 0x806, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_LOCK CTL_CODE(FILE_DEVICE_MONO, 0x807, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_UNLOCK CTL_CODE(FILE_DEVICE_MONO, 0x808, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
#define IOCTL_MONO_SET_POS CTL_CODE(FILE_DEVICE_MONO, 0x809, METHOD_BUFFERED, FILE_WRITE_DATA)
|
||||
|
||||
7
Code/Tools/MonoDrv/sys/SOURCES
Normal file
7
Code/Tools/MonoDrv/sys/SOURCES
Normal file
@@ -0,0 +1,7 @@
|
||||
TARGETNAME=monodrvr
|
||||
TARGETPATH=$(BASEDIR)\lib
|
||||
TARGETTYPE=EXPORT_DRIVER
|
||||
|
||||
DLLDEF=monodrvr.def
|
||||
|
||||
SOURCES=monodrvr.c
|
||||
1658
Code/Tools/MonoDrv/sys/monodrvr.c
Normal file
1658
Code/Tools/MonoDrv/sys/monodrvr.c
Normal file
File diff suppressed because it is too large
Load Diff
2
Code/Tools/MonoDrv/sys/monodrvr.def
Normal file
2
Code/Tools/MonoDrv/sys/monodrvr.def
Normal file
@@ -0,0 +1,2 @@
|
||||
NAME MONODRVR.SYS
|
||||
DESCRIPTION 'MONODRVR.SYS'
|
||||
Reference in New Issue
Block a user