|
|
1.1 root 1: /*++
2:
3: Copyright (c) 1993 Microsoft Corporation
4:
5: Module Name:
6:
7: monotest.c
8:
9: Abstract:
10:
11: A user mode test app for the mono device driver.
12:
13: Environment:
14:
15: User mode only
16:
17: Revision History:
18:
19: 03-22-93 : created
20:
21: --*/
22:
23: #include "windows.h"
24: #include "winioctl.h"
25: #include "stdio.h"
26: #include "stdlib.h"
27: #include "monopub.h"
28:
29:
30:
31: int
32: main(
33: IN int argc,
34: IN char *argv[]
35: )
36: /*++
37:
38: Routine Description:
39:
40: Tries to open the MONO driver & send it a couple of IOCTLs.
41:
42: Arguments:
43:
44: argc - count of command line arguments
45:
46: argv - command line arguments
47:
48: Return Value:
49:
50:
51: --*/
52: {
53:
54: HANDLE hDriver;
55: UCHAR outputString[] = "1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24\n25\n26\n27\n28\n29\n30\n";
56: DWORD cbReturned;
57:
58: if ((hDriver = CreateFile("\\\\.\\MONO",
59: GENERIC_READ | GENERIC_WRITE,
60: 0,
61: NULL,
62: OPEN_EXISTING,
63: FILE_ATTRIBUTE_NORMAL,
64: NULL
65: )) != ((HANDLE)-1))
66:
67: printf("\nRetrieved valid handle for MONO driver\n");
68:
69:
70: else
71: {
72: printf("Can't get a handle to MONO driver\n");
73:
74: return 0;
75: }
76:
77: if (DeviceIoControl (hDriver,
78: (DWORD) IOCTL_MONO_PRINT,
79: outputString,
80: sizeof(outputString),
81: NULL,
82: 0,
83: &cbReturned,
84: 0
85: ))
86: {
87: printf ("DeviceIoControl worked\n\n");
88:
89: printf ("Hit <Enter> to clear the mono display: \n");
90:
91: getchar ();
92:
93: DeviceIoControl (hDriver,
94: (DWORD) IOCTL_MONO_CLEAR_SCREEN,
95: NULL,
96: 0,
97: NULL,
98: 0,
99: &cbReturned,
100: 0);
101:
102: printf ("'Bye\n");
103: }
104: else
105: {
106: printf ("DeviceIoControl failed\n");
107: }
108:
109: CloseHandle(hDriver);
110:
111: return 1;
112: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.