aboutsummaryrefslogtreecommitdiff
path: root/int2fwin.h
diff options
context:
space:
mode:
authorJavier <dev.git@javispedro.com>2022-03-12 13:24:01 +0100
committerJavier <dev.git@javispedro.com>2022-03-12 13:24:01 +0100
commit0561b7fabde7a4e2a32437217f8dd85912c89c05 (patch)
treeedfc9f1388c4fb5560291027dfdeacfd57d2d46c /int2fwin.h
parenta5ae81421c666fe55bbd8c6272cc94da9acd830b (diff)
downloadvbados-0561b7fabde7a4e2a32437217f8dd85912c89c05.tar.gz
vbados-0561b7fabde7a4e2a32437217f8dd85912c89c05.zip
use int2f to detect fullscreen dosboxes in protected mode
Diffstat (limited to 'int2fwin.h')
-rw-r--r--int2fwin.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/int2fwin.h b/int2fwin.h
new file mode 100644
index 0000000..8d79211
--- /dev/null
+++ b/int2fwin.h
@@ -0,0 +1,55 @@
+/*
+ * VBMouse - Interface to the Windows int 2Fh services
+ * Copyright (C) 2022 Javier S. Pedro
+ *
+ * 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 2
+ * 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, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+
+#ifndef INT2FWIN_H
+#define INT2FWIN_H
+
+#include <stdbool.h>
+#include <stdint.h>
+#include <dos.h>
+
+typedef void (__far *LPFN)(void);
+
+enum int2f_functions
+{
+ INT2F_NOTIFY_BACKGROUND_SWITCH = 0x4001,
+ INT2F_NOTIFY_FOREGROUND_SWITCH = 0x4002
+};
+
+static bool windows_386_enhanced_mode(void);
+#pragma aux windows_386_enhanced_mode = \
+ "mov ax, 0x1600" \
+ "int 0x2F" \
+ "test al, 0x7F" /* return value is either 0x80 or 0x00 if win386 is not running */ \
+ "setnz al" \
+ __value [al] \
+ __modify [ax]
+
+static inline void hook_int2f(LPFN *prev, LPFN new)
+{
+ *prev = _dos_getvect(0x2F);
+ _dos_setvect(0x2F, new);
+}
+
+static inline void unhook_int2f(LPFN prev)
+{
+ _dos_setvect(0x2F, prev);
+}
+
+#endif