summaryrefslogtreecommitdiff
path: root/alf/alfcompat.cpp
diff options
context:
space:
mode:
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;
+}