xref: /reactos/subsystems/mvdm/ntvdm/ntvdm.h (revision 7244e0c5)
1 /*
2  * COPYRIGHT:       GPL - See COPYING in the top level directory
3  * PROJECT:         ReactOS Virtual DOS Machine
4  * FILE:            subsystems/mvdm/ntvdm/ntvdm.h
5  * PURPOSE:         Header file to define commonly used stuff
6  * PROGRAMMERS:     Aleksandar Andrejevic <theflash AT sdf DOT lonestar DOT org>
7  */
8 
9 #ifndef _NTVDM_H_
10 #define _NTVDM_H_
11 
12 /* BUILD CONFIGURATION ********************************************************/
13 
14 /*
15  * Activate this line if you want to run NTVDM in standalone mode with:
16  * ntvdm.exe <program>
17  */
18 // #define STANDALONE
19 
20 /*
21  * Activate this line for Win2k compliancy
22  */
23 // #define WIN2K_COMPLIANT
24 
25 /*
26  * Activate this line if you want advanced hardcoded debug facilities
27  * (called interrupts, etc...), that may break PC-AT compatibility.
28  * USE AT YOUR OWN RISK! (disabled by default)
29  */
30 // #define ADVANCED_DEBUGGING
31 
32 #ifdef ADVANCED_DEBUGGING
33 #define ADVANCED_DEBUGGING_LEVEL    1
34 #endif
35 
36 
37 /* INCLUDES *******************************************************************/
38 
39 #include <stdio.h>
40 #include <stdarg.h>
41 #include <wchar.h>
42 
43 #ifndef _countof
44 #define _countof(_Array) (sizeof(_Array) / sizeof(_Array[0]))
45 #endif
46 
47 /* String widening macro */
48 #define __L(x)  L ## x
49 #define _L(x)   __L(x)
50 #define L(x)    _L(x)
51 
52 /* PSDK/NDK Headers */
53 #define WIN32_NO_STATUS
54 #include <windef.h>
55 #include <winbase.h>
56 #include <wingdi.h>
57 #include <wincon.h>
58 #include <winnls.h>
59 #include <winreg.h>
60 #include <winuser.h>
61 #include <commdlg.h>
62 
63 #include <subsys/win/vdm.h>
64 
65 // Do not include stuff that is only defined
66 // for backwards compatibility in nt_vdd.h
67 #define NO_NTVDD_COMPAT
68 #include <vddsvc.h>
69 
70 DWORD WINAPI SetLastConsoleEventActive(VOID);
71 
72 #define NTOS_MODE_USER
73 #include <ndk/kefuncs.h>    // For NtQueryPerformanceCounter()
74 #include <ndk/rtlfuncs.h>
75 
76 /* PSEH for SEH Support */
77 #include <pseh/pseh2.h>
78 
79 #include <ntstrsafe.h>
80 
81 
82 /* VARIABLES ******************************************************************/
83 
84 typedef struct _NTVDM_SETTINGS
85 {
86     ANSI_STRING BiosFileName;
87     ANSI_STRING RomFiles;
88     UNICODE_STRING FloppyDisks[2];
89     UNICODE_STRING HardDisks[4];
90 } NTVDM_SETTINGS, *PNTVDM_SETTINGS;
91 
92 extern NTVDM_SETTINGS GlobalSettings;
93 
94 // Command line of NTVDM
95 extern INT     NtVdmArgc;
96 extern WCHAR** NtVdmArgv;
97 
98 /* Full directory where NTVDM resides, or the SystemRoot\System32 path */
99 extern WCHAR NtVdmPath[MAX_PATH];
100 extern ULONG NtVdmPathSize; // Length without NULL terminator.
101 
102 extern HWND hConsoleWnd;
103 
104 
105 /* FUNCTIONS ******************************************************************/
106 
107 /*
108  * Interface functions
109  */
110 typedef VOID (*CHAR_PRINT)(IN CHAR Character);
111 VOID DisplayMessage(IN LPCWSTR Format, ...);
112 VOID PrintMessageAnsi(IN CHAR_PRINT CharPrint,
113                       IN LPCSTR Format, ...);
114 
115 /*static*/ VOID
116 UpdateVdmMenuDisks(VOID);
117 
118 BOOL ConsoleAttach(VOID);
119 VOID ConsoleDetach(VOID);
120 VOID ConsoleReattach(HANDLE ConOutHandle);
121 BOOL IsConsoleHandle(HANDLE hHandle);
122 VOID MenuEventHandler(PMENU_EVENT_RECORD MenuEvent);
123 VOID FocusEventHandler(PFOCUS_EVENT_RECORD FocusEvent);
124 
125 #endif // _NTVDM_H_
126 
127 /* EOF */
128