]> 4ch.mooo.com Git - 16.git/blob - src/lib/doslib/dos/ntastrm.c
added a bunch of things~ and midi stuff~
[16.git] / src / lib / doslib / dos / ntastrm.c
1 /* ntastrm.c
2  *
3  * Utility program: Manually trigger the removal of the DOSNTAST driver.
4  * (C) 2011-2012 Jonathan Campbell.
5  * Hackipedia DOS library.
6  *
7  * This code is licensed under the LGPL.
8  * <insert LGPL legal text here>
9  *
10  * If a program using DOSNTAST fails to unload the driver, it will remain resident.
11  * This program allows you to remove it manually if that happens. */
12
13 #include <stdlib.h>
14 #include <string.h>
15 #include <stdint.h>
16 #include <assert.h>
17 #include <stdlib.h>
18 #include <stdarg.h>
19 #include <unistd.h>
20 #include <stdio.h>
21 #include <conio.h>
22 #include <fcntl.h>
23 #include <dos.h>
24
25 #include <hw/cpu/cpu.h>
26 #include <hw/dos/dos.h>
27 #include <hw/dos/doswin.h>
28 #include <hw/dos/dosbox.h>
29 #include <hw/dos/dosntvdm.h>
30
31 #ifdef TARGET_WINDOWS
32 # define WINFCON_STOCK_WIN_MAIN
33 # include <hw/dos/winfcon.h>
34 #endif
35
36 int main() {
37         /* probe_dos() and detect_windows() should NOT auto-load the DOSNTAST driver.
38          * we're going to unload it if resident. */
39         lib_dos_option.dont_load_dosntast=1;
40
41         probe_dos();
42         printf("DOS version %x.%02u\n",dos_version>>8,dos_version&0xFF);
43         printf("    Method: '%s'\n",dos_version_method);
44
45         if (detect_windows()) {
46                 printf("I am running under Windows.\n");
47                 printf("    Mode: %s\n",windows_mode_str(windows_mode));
48                 printf("    Ver:  %x.%u\n",windows_version>>8,windows_version&0xFF);
49                 printf("    Method: '%s'\n",windows_version_method);
50                 if (windows_emulation != WINEMU_NONE)
51                         printf("    Emulation: '%s'\n",windows_emulation_str(windows_emulation));
52                 if (windows_emulation_comment_str != NULL)
53                         printf("    Emulation comment: '%s'\n",windows_emulation_comment_str);
54         }
55         else {
56                 printf("Not running under Windows or OS/2\n");
57         }
58
59 #if defined(NTVDM_CLIENT) && !defined(TARGET_WINDOWS)
60         if (ntvdm_dosntast_handle != DOSNTAST_HANDLE_UNASSIGNED) {
61                 printf("DOSNTAST.VDD driver was loaded (handle=%u), unloading...\n",ntvdm_dosntast_handle);
62                 ntvdm_dosntast_unload();
63         }
64 #endif
65
66         return 0;
67 }
68