summaryrefslogtreecommitdiff
path: root/alf/alfcompat.cpp
diff options
context:
space:
mode:
authorJonas Kümmerlin <jonas@kuemmerlin.eu>2018-12-27 20:50:39 +0100
committerJonas Kümmerlin <jonas@kuemmerlin.eu>2018-12-27 20:50:39 +0100
commitb0b0e97aa5a06b22768bb9c9ea5e8caf383d78a4 (patch)
tree8432ca1d8bf811bc7de6240e5988fb84e35b1f40 /alf/alfcompat.cpp
parent64b6b40ace30693f0e12d56799abc40c997df07c (diff)
split into multiple files
Diffstat (limited to 'alf/alfcompat.cpp')
-rw-r--r--alf/alfcompat.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/alf/alfcompat.cpp b/alf/alfcompat.cpp
new file mode 100644
index 0000000..452b9bc
--- /dev/null
+++ b/alf/alfcompat.cpp
@@ -0,0 +1,23 @@
+#include "alfpriv.h"
+
+ALFCompatFunctions *
+ALF_CreateCompatFuncTable(void)
+{
+ ALFCompatFunctions *compatfn = (ALFCompatFunctions*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY|HEAP_GENERATE_EXCEPTIONS, sizeof(ALFCompatFunctions));
+
+#define COMPAT(dll, entrypoint, ordinal) \
+ do { \
+ FARPROC p = GetProcAddress(GetModuleHandleA(#dll), #entrypoint); \
+ if (!p && ordinal) \
+ p = GetProcAddress(GetModuleHandleA(#dll), (char*)ordinal); \
+ CopyMemory(&compatfn->entrypoint, &p, sizeof(void*)); \
+ } while (0)
+
+ COMPAT(comctl32.dll, SetWindowSubclass, 410);
+ COMPAT(comctl32.dll, DefSubclassProc, 413);
+ COMPAT(comctl32.dll, RemoveWindowSubclass, 412);
+
+#undef COMPAT
+
+ return compatfn;
+}