3 * Test program: Various info about DOS
4 * (C) 2009-2012 Jonathan Campbell.
5 * Hackipedia DOS library.
7 * This code is licensed under the LGPL.
8 * <insert LGPL legal text here>
23 #include <hw/cpu/cpu.h>
24 #include <hw/dos/dos.h>
25 #include <hw/dos/doswin.h>
26 #include <hw/dos/dosbox.h>
27 #include <hw/dos/dosntvdm.h>
30 # define WINFCON_STOCK_WIN_MAIN
31 # include <hw/dos/winfcon.h>
36 printf("DOS version %x.%02u\n",dos_version>>8,dos_version&0xFF);
37 printf(" Method: '%s'\n",dos_version_method);
38 printf(" Flavor: '%s'\n",dos_flavor_str(dos_flavor));
39 if (dos_flavor == DOS_FLAVOR_FREEDOS) {
40 printf(" FreeDOS kernel %u.%u.%u (%lX)\n",
41 (unsigned int)((freedos_kernel_version >> 16UL) & 0xFFUL),
42 (unsigned int)((freedos_kernel_version >> 8UL) & 0xFFUL),
43 (unsigned int)((freedos_kernel_version) & 0xFFUL),
44 (unsigned long)freedos_kernel_version);
45 if (freedos_kernel_version_str != NULL) {
46 #if TARGET_MSDOS == 32
47 printf(" FreeDOS kernel version string: %s\n",
48 freedos_kernel_version_str);
50 printf(" FreeDOS kernel version string: %Fs\n",
51 freedos_kernel_version_str);
56 if (detect_windows()) {
57 printf("I am running under Windows.\n");
58 printf(" Mode: %s\n",windows_mode_str(windows_mode));
59 printf(" Ver: %x.%u\n",windows_version>>8,windows_version&0xFF);
60 printf(" Method: '%s'\n",windows_version_method);
61 if (windows_emulation != WINEMU_NONE)
62 printf(" Emulation: '%s'\n",windows_emulation_str(windows_emulation));
63 if (windows_emulation_comment_str != NULL)
64 printf(" Emulation comment: '%s'\n",windows_emulation_comment_str);
67 printf("Not running under Windows or OS/2\n");
70 #if defined(NTVDM_CLIENT) && !defined(TARGET_WINDOWS)
71 if (ntvdm_dosntast_handle != DOSNTAST_HANDLE_UNASSIGNED) {
77 printf("This program is using the DOSNTAST.VDD driver (handle=%u io=0x%03X)\n",ntvdm_dosntast_handle,ntvdm_dosntast_io_base);
79 printf("GetTickCount() = %lu\n",ntvdm_dosntast_GetTickCount());
80 printf("waveOutGetNumDevs() = %d\n",j=ntvdm_dosntast_waveOutGetNumDevs());
82 memset(&woc,0,sizeof(woc));
83 if ((dw=ntvdm_dosntast_waveOutGetDevCaps(i,&woc,sizeof(woc))) == 0) {
84 printf(" [%u]: %s v%u.%u\n",i,woc.szPname,woc.vDriverVersion>>8,woc.vDriverVersion&0xFF);
85 printf(" MID=0x%04lX PID=0x%04lX FMTS=0x%08lX chan=%u\n",
86 (unsigned long)woc.wMid,
87 (unsigned long)woc.wPid,
88 (unsigned long)woc.dwFormats,
91 if (woc.dwSupport & WAVECAPS_LRVOLUME) printf("LRVOL ");
92 if (woc.dwSupport & WAVECAPS_PITCH) printf("PITCH ");
93 if (woc.dwSupport & WAVECAPS_PLAYBACKRATE) printf("PLAYRATE ");
94 if (woc.dwSupport & WAVECAPS_SYNC) printf("SYNC ");
95 if (woc.dwSupport & WAVECAPS_VOLUME) printf("VOL ");
96 if (woc.dwSupport & WAVECAPS_SAMPLEACCURATE) printf("SAMPLEACCURATE ");
100 printf(" [%u]: Cannot read err=0x%08lX\n",i,dw);
104 printf("GetVersionEx() = ");
105 o.dwOSVersionInfoSize = sizeof(o);
106 if (ntvdm_dosntast_getversionex(&o)) {
107 printf("v%lu.%lu build #%lu platform=%lu '%s'",
119 ntvdm_dosntast_MessageBox("Hello!\n\nIf you can read this, DOS programs are able to use the driver successfully!");
123 if (detect_dosbox_emu())
124 printf("I am also running under DOSBox\n");
125 if (detect_virtualbox_emu())
126 printf("I am also running under Sun/Oracle VirtualBox %s\n",virtualbox_version_str);
129 #if dpmi_present != 0
131 printf("DPMI present:\n");
132 # if TARGET_MSDOS == 16 || (TARGET_MSDOS == 32 && !defined(TARGET_WINDOWS))
133 if (dpmi_no_0301h > 0) printf(" - DPMI function 0301H: Call real-mode far routine NOT AVAILABLE\n");
134 printf(" - Flags: 0x%04x\n",dpmi_flags);
135 printf(" - Entry: %04x:%04x (real mode)\n",(unsigned int)(dpmi_entry_point>>16UL),(unsigned int)(dpmi_entry_point & 0xFFFFUL));
136 printf(" - Processor type: %02x\n",dpmi_processor_type);
137 printf(" - Version: %u.%u\n",dpmi_version>>8,dpmi_version&0xFF);
138 printf(" - Private data length: %u paras\n",dpmi_private_data_length_paragraphs);
144 printf("VCPI present (v%d.%d)\n",
149 #ifdef WINFCON_STOCK_WIN_MAIN
153 printf("---------[Type junk here]---------\n");
157 else if (c == 13) printf("\n");